From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: make zsh print errors like a well-behaved compiler
Date: Thu, 25 Nov 1999 12:20:20 -0500 [thread overview]
Message-ID: <19991125122020.B11876@dman.com> (raw)
This will change the error given when running a script
from something like
/tmp/brokenscript: command not found: badcommand [5]
/tmp/brokenscript:5: command not found: badcommand
This makes it parsable for emacs's compile-goto-error
and all sorts of other fun software that can now
be led to believe that zsh is a compiler.
It also makes 5 look more like a line number instead
of a possible error code.
--- Src/utils.c 1999/11/05 15:49:30 1.1.1.42
+++ Src/utils.c 1999/11/25 17:05:29
@@ -76,7 +76,7 @@
*/
nicezputs((isset(SHINSTDIN) && !locallevel) ? "zsh" :
scriptname ? scriptname : argzero, stderr);
- fputs(": ", stderr);
+ fputc((unsigned char)':', stderr);
zerrmsg(fmt, str, num);
}
@@ -89,11 +89,11 @@
trashzle();
if (unset(SHINSTDIN) || locallevel) {
nicezputs(scriptname ? scriptname : argzero, stderr);
- fputs(": ", stderr);
+ fputc((unsigned char)':', stderr);
}
if (cmd) {
nicezputs(cmd, stderr);
- fputs(": ", stderr);
+ fputc((unsigned char)':', stderr);
}
zerrmsg(fmt, str, num);
}
@@ -102,6 +102,11 @@
void
zerrmsg(const char *fmt, const char *str, int num)
{
+ if ((unset(SHINSTDIN) || locallevel) && lineno)
+ fprintf(stderr, "%ld: ", (long)lineno);
+ else
+ fputc((unsigned char)' ', stderr);
+
while (*fmt)
if (*fmt == '%') {
fmt++;
@@ -149,10 +154,7 @@
putc(*fmt == Meta ? *++fmt ^ 32 : *fmt, stderr);
fmt++;
}
- if ((unset(SHINSTDIN) || locallevel) && lineno)
- fprintf(stderr, " [%ld]\n", (long)lineno);
- else
- putc('\n', stderr);
+ putc('\n', stderr);
fflush(stderr);
}
next reply other threads:[~1999-11-25 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-25 17:20 Clint Adams [this message]
1999-11-25 17:58 ` Bart Schaefer
1999-11-25 18:21 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19991125122020.B11876@dman.com \
--to=schizo@debian.org \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).