Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zsh-2.6-beta16: an incompatibility with ksh in typeset command
- X-seq: zsh-workers 1036
- From: suzuki@xxxxxxxxxxxxxxxxxxxxxxxxx (SUZUKI Hisao)
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: zsh-2.6-beta16: an incompatibility with ksh in typeset command
- Date: Thu, 9 May 96 17:38:47 JST
I found a slight incompatibility between zsh-2.6-beta16 and
AT&T ksh (on Solaris2, for example).
In ksh, the optional numeric argument of `typeset' command,
which is typically used to specify the output arithmetic base,
is placed just after the option(s) of the command. For example,
$ typeset -i2 a
$ a=10
$ echo $a
2#1010
$
In zsh-2.6-beta16, however, you must put a space between the
option and numeric argument, like this:
% typeset -i 2 a
This is an annoying difference and the following is a
sample fix; it preserves the backward compatibility by extending
only the erroneous case, though it is very quick and dirty...
*** builtin.c~ Wed May 1 17:18:34 1996
--- builtin.c Thu May 9 17:33:16 1996
***************
*** 123,131 ****
break;
/* the above loop may have exited on an invalid option */
if (*arg) {
! zerr("bad option: %c", NULL, *arg);
! zsfree(xarg);
! return 1;
}
/* handle the special "set" options */
arg = (char *) ugetnode(args);
--- 123,143 ----
break;
/* the above loop may have exited on an invalid option */
if (*arg) {
! /* for "typeset", -L, -R, -Z and -i may take a numeric
! argument at the tail of the options */
! if (idigit(*arg) &&
! (flags & BINF_TYPEOPT) &&
! (ops['L'] == 1 || ops['R'] == 1 || ops['Z'] == 1 ||
! ops['i'] == 1)) {
! char* endPtr;
! auxlen = (int)strtol(arg, &endPtr, 10);
! arg = endPtr;
! }
! if (*arg) {
! zerr("bad option: %c", NULL, *arg);
! zsfree(xarg);
! return 1;
! }
}
/* handle the special "set" options */
arg = (char *) ugetnode(args);
SUZUKI Hisao # `Begin at the beginning and go on till
suzuki@xxxxxxxxxxxxxx # you come to the end: then stop.'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author