switch (code) {
case C_PROMPT:
if (sscanf(arg, "%d %d", &nmin, &nbtu) != 2) {
- fprintf(stderr, "prompt: bad server prompt %s", arg);
+ fprintf(stderr, "Warning: server sent malformed prompt %s",
+ arg);
}
snprintf(the_prompt, sizeof(the_prompt), "[%d:%d] Command : ",
nmin, nbtu);
{
size_t seen = seen_input(arg);
- if (restricted) {
- fprintf(stderr, "Can't %s in restricted mode\n", attempt);
+ if (!expected) {
+ fprintf(stderr, "Warning: dropped conflicting %s %s",
+ attempt, arg);
return 0;
}
- if (executing) {
- fprintf(stderr, "Can't %s in a batch file\n", attempt);
+ if (!seen || (input_to_forget && input_to_forget != seen)) {
+ fprintf(stderr, "Warning: server attempted to %s %s",
+ attempt, arg);
return 0;
}
+ input_to_forget = seen;
- if (!expected) {
- fprintf(stderr, "WARNING! Server attempted to %s unexpectedly\n",
- attempt);
+ if (restricted) {
+ fprintf(stderr, "Can't %s in restricted mode\n", attempt);
return 0;
}
- if (!seen || (input_to_forget && input_to_forget != seen)) {
- fprintf(stderr, "WARNING! Server attempted to %s %s",
- attempt, arg);
+ if (executing) {
+ fprintf(stderr, "Can't %s in a batch file\n", attempt);
return 0;
}
- input_to_forget = seen;
return 1;
}
if (!redir_authorized(p, "redirect to file", !redir_fp))
return;
if (*p++ != '>') {
- fprintf(stderr, "WARNING! Weird redirection %s", p);
+ fprintf(stderr, "Warning: dropped weird redirection %s", p);
return;
}
if (!redir_authorized(p, "pipe to shell command", !redir_fp))
return;
if (*p++ != '|') {
- fprintf(stderr, "WARNING! Weird pipe %s", p);
+ fprintf(stderr, "Warning: dropped weird pipe %s", p);
return;
}
p[strlen(p) - 1] = 0;
redir_is_pipe = 1;
+ errno = 0;
if ((redir_fp = popen(p, "w")) == NULL) {
- fprintf(stderr, "Can't redirect to pipe %s: %s\n",
- p, strerror(errno));
+ fprintf(stderr, "Can't redirect to pipe %s%s%s\n",
+ p, errno ? ": " : "", errno ? strerror(errno) : "");
}
}
}
if ((fd = open(p, O_RDONLY)) < 0) {
- fprintf(stderr, "Can't open execute file %s: %s\n",
+ fprintf(stderr, "Can't open batch file %s: %s\n",
p, strerror(errno));
return -1;
}