Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
case bugfix
- X-seq: zsh-workers 2656
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- Subject: case bugfix
- Date: Sat, 28 Dec 1996 20:10:19 +0100 (MET)
There is quite serious bug in case:
case * in
\*) echo yes;;
esac
This should print yes but you get `zsh: too many arguments to case' if
there are more than one files in the current directory.
Fix is included below. This should be applied to zsh-3.0.2 as well.
Zoltan
*** Src/parse.c 1996/12/21 02:35:32 3.1.1.0
--- Src/parse.c 1996/12/28 18:38:33
***************
*** 481,487 ****
{
int brflag;
LinkList pats, lists;
! int n = 0;
char **pp;
List *ll;
LinkNode no;
--- 481,487 ----
{
int brflag;
LinkList pats, lists;
! int n = 1;
char **pp;
List *ll;
LinkNode no;
***************
*** 492,498 ****
yylex();
if (tok != STRING)
YYERRORV;
! addlinknode(c->args, tokstr);
incmdpos = 1;
yylex();
while (tok == SEPER)
--- 492,499 ----
yylex();
if (tok != STRING)
YYERRORV;
! pats = newlinklist();
! addlinknode(pats, tokstr);
incmdpos = 1;
yylex();
while (tok == SEPER)
***************
*** 504,510 ****
incmdpos = 0;
yylex();
cc = c->u.casecmd = (struct casecmd *)make_casecmd();
- pats = newlinklist();
lists = newlinklist();
for (;;) {
char *str;
--- 505,510 ----
*** Src/exec.c 1996/12/27 01:31:33 3.1.1.2
--- Src/exec.c 1996/12/28 18:39:38
***************
*** 1208,1215 ****
}
/* Do prefork substitutions */
! prefork(args, (((type == CCASE) ? 4 : 0)
! | (assign ? 2 : isset(MAGICEQUALSUBST))));
if (type == SIMPLE) {
int unglobbed = 0;
--- 1208,1214 ----
}
/* Do prefork substitutions */
! prefork(args, assign ? 2 : isset(MAGICEQUALSUBST));
if (type == SIMPLE) {
int unglobbed = 0;
*** Src/loop.c 1996/12/21 02:35:32 3.1.1.0
--- Src/loop.c 1996/12/28 18:41:19
***************
*** 374,397 ****
{
struct casecmd *node;
char *word;
- LinkList args;
List *l;
char **p;
node = cmd->u.casecmd;
- args = cmd->args;
l = node->lists;
p = node->pats;
lastval = 0;
! if (firstnode(args) && nextnode(firstnode(args))) {
! zerr("too many arguments to case", NULL, 0);
! return 1;
! }
! if (empty(args))
! word = dupstring("");
! else
! word = (char *)peekfirst(args);
if (node) {
while (*p) {
--- 374,390 ----
{
struct casecmd *node;
char *word;
List *l;
char **p;
node = cmd->u.casecmd;
l = node->lists;
p = node->pats;
lastval = 0;
! word = *p++;
! singsub(&word);
! untokenize(word);
if (node) {
while (*p) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author