zsh-workers
 help / color / mirror / code / Atom feed
* zsh-2.6-beta16: an incompatibility with ksh in typeset command
@ 1996-05-09  8:38 SUZUKI Hisao
  0 siblings, 0 replies; only message in thread
From: SUZUKI Hisao @ 1996-05-09  8:38 UTC (permalink / raw)
  To: zsh-workers

     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@otsl.oki.co.jp	# you come to the end:  then stop.'



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-05-09 10:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-09  8:38 zsh-2.6-beta16: an incompatibility with ksh in typeset command SUZUKI Hisao

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).