Use errorMsg rather than fprintf.
diff --git a/shell/lash.c b/shell/lash.c
index f4564f7..048394a 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -207,12 +207,12 @@
if (!jobList->head) {
if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) {
- fprintf(stderr, "%s: exactly one argument is expected\n",
+ errorMsg("%s: exactly one argument is expected\n",
cmd->progs[0].argv[0]);
return FALSE;
}
if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
- fprintf(stderr, "%s: bad argument '%s'\n",
+ errorMsg("%s: bad argument '%s'\n",
cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
return FALSE;
for (job = jobList->head; job; job = job->next) {
@@ -226,7 +226,7 @@
}
if (!job) {
- fprintf(stderr, "%s: unknown job %d\n",
+ errorMsg("%s: unknown job %d\n",
cmd->progs[0].argv[0], jobNum);
return FALSE;
}
@@ -519,7 +519,7 @@
rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult);
if (rc == GLOB_NOSPACE) {
- fprintf(stderr, "out of space during glob operation\n");
+ errorMsg("out of space during glob operation\n");
return;
} else if (rc == GLOB_NOMATCH ||
(!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -607,7 +607,7 @@
if (*src == '\\') {
src++;
if (!*src) {
- fprintf(stderr, "character expected after \\\n");
+ errorMsg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -686,7 +686,7 @@
chptr++;
if (!*chptr) {
- fprintf(stderr, "file name expected after %c\n", *src);
+ errorMsg("file name expected after %c\n", *src);
freeJob(job);
job->numProgs=0;
return 1;
@@ -705,7 +705,7 @@
if (*prog->argv[argc])
argc++;
if (!argc) {
- fprintf(stderr, "empty command in pipe1.\n");
+ errorMsg("empty command in pipe1\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -731,7 +731,7 @@
src++;
if (!*src) {
- fprintf(stderr, "empty command in pipe2\n");
+ errorMsg("empty command in pipe2\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -750,7 +750,7 @@
case '\\':
src++;
if (!*src) {
- fprintf(stderr, "character expected after \\\n");
+ errorMsg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -965,7 +965,7 @@
if (openfd < 0) {
/* this could get lost if stderr has been redirected, but
bash and ash both lose it as well (though zsh doesn't!) */
- fprintf(stderr, "error opening %s: %s\n", redir->filename,
+ errorMsg("error opening %s: %s\n", redir->filename,
strerror(errno));
return 1;
}