From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id CAA14972 for ; Sat, 10 Jun 1995 02:59:13 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA09458 (5.65c/Gatech-10.0-IDA for ); Fri, 9 Jun 1995 12:58:24 -0400 Received: by math (5.x/SMI-SVR4) id AA27516; Fri, 9 Jun 1995 12:56:05 -0400 Resent-Date: Fri, 9 Jun 1995 18:55:18 +0100 (MET DST) Old-Return-Path: From: hzoli@cs.elte.hu (Zoltan Hidvegi) Message-Id: <9506091655.AA05115@turan.elte.hu> Subject: Octal and hex numbers in zsh To: zsh-workers@math.gatech.edu (zsh-workers) Date: Fri, 9 Jun 1995 18:55:18 +0100 (MET DST) X-Mailer: ELM [version 2.4 PL21] Content-Type: text Resent-Message-Id: <"anOh01.0.sj6.Zq7sl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/95 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu The following simple patch removes the feature when a leading zero denotes octal number. But leading 0x still can be uset for hex numbers. The 0xff syntax also sets lastbase (ie. it sets the base to 16 if an integer is first assigned this way). To remove this feature, replace `lastbase = 16' with `16' below. This patch does not depend on the strtol feature to interpret 0xff as a hex number if called with base 0. Zoltan rcsdiff -qc -kk -r1.7 -r1.8 math.c *** math.c --- math.c 1995/06/02 23:56:54 *************** *** 327,336 **** case '\t': case '\n': break; default: if (idigit(*--ptr)) { unary = 0; ! yyval = strtol(ptr, &ptr, 0); if (*ptr == '#') { ptr++; --- 327,343 ---- case '\t': case '\n': break; + case '0': + if (*ptr == 'x' || *ptr == 'X') { + /* Should we set lastbase here? */ + yyval = strtol(++ptr, &ptr, lastbase = 16); + return NUM; + } + /* Fall through! */ default: if (idigit(*--ptr)) { unary = 0; ! yyval = strtol(ptr, &ptr, 10); if (*ptr == '#') { ptr++;