Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/2] builtins: Say 'bad option: +x', not 'bad option: -x', when +x was passed.
- X-seq: zsh-workers 40010
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/2] builtins: Say 'bad option: +x', not 'bad option: -x', when +x was passed.
- Date: Thu, 24 Nov 2016 06:57:52 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=qbzxMlQKDlU9Euow4NuY1vQLpm8=; b=hKgXSI QSvwaYF9FKckCy2eId/L/Abl+pBDcSozGPv9kVuD19PHDpW341uy7JdxhcMIs5rs DoOheVWcPW2saXy9oie3F+IK6hDLHQFEJjp+IprKQ0onfrO2BeTnNc2/RpMfKkN6 m+pe8JaRzGwiMQjxal+UvrWg72FNuwmlTh79Q=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=qbzxMlQKDlU9Euow4NuY1vQLpm8=; b=SLmfv ISPpUw05MBeRZTxBnIrRJr/6UHCfz4ttGB8fKbUY7IxBGoXILzNQnoVwp7Pcuz3J 14oPcNuq5ksq/It3tAHYAQ8IOSHFft9JkCkmrF79HqQ+3+gFbOsi1tz9WDefrKbe kemCkLq7E9ETDm44IiWuoMEq7jTncKq91rg/ok=
- In-reply-to: <1479970672-23682-1-git-send-email-danielsh@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1479970672-23682-1-git-send-email-danielsh@fujitsu.shahaf.local2>
---
Src/builtin.c | 5 +++--
Test/A02alias.ztst | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Src/builtin.c b/Src/builtin.c
index ab159ad..e641a97 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -249,7 +249,7 @@ int
execbuiltin(LinkList args, LinkList assigns, Builtin bn)
{
char *pp, *name, *optstr;
- int flags, sense, argc, execop, xtr = isset(XTRACE);
+ int flags, argc, execop, xtr = isset(XTRACE);
struct options ops;
/* initialise options structure */
@@ -294,6 +294,7 @@ execbuiltin(LinkList args, LinkList assigns, Builtin bn)
/* Sort out the options. */
if (optstr) {
char *arg = *argv;
+ int sense; /* 1 for -x, 0 for +x */
/* while arguments look like options ... */
while (arg &&
/* Must begin with - or maybe + */
@@ -387,7 +388,7 @@ execbuiltin(LinkList args, LinkList assigns, Builtin bn)
if (*arg) {
if(*arg == Meta)
*++arg ^= 32;
- zwarnnam(name, "bad option: -%c", *arg);
+ zwarnnam(name, "bad option: %c%c", "+-"[sense], *arg);
return 1;
}
arg = *++argv;
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 1e09cd3..e52578e 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -110,3 +110,8 @@
127:No endless loop with suffix alias in command position
>You said it.
?(eval):1: command not found: thingummy.mysuff
+
+ alias +x; alias -z
+1:error message has the correct sign
+?(eval):alias:1: bad option: +x
+?(eval):alias:1: bad option: -z
Messages sorted by:
Reverse Date,
Date,
Thread,
Author