From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22823 invoked from network); 9 May 1998 22:54:33 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 May 1998 22:54:33 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id SAA01091; Sat, 9 May 1998 18:41:37 -0400 (EDT) Resent-Date: Sat, 9 May 1998 18:41:37 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199805092240.RAA03045@hzoli.home> Subject: PATCH: K&R compiler fix To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Sat, 9 May 1998 17:40:16 -0500 (CDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"GSyiQ.0.-G.XkDLr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3959 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Some very old K&R compilers do not allow initialization of automatic character arrays (or any automatic arrays). That was in 3.1.2, I did not try to compile 3.1.3 with such a compiler (the old SunOS 4.1 cc has this problem). There may be other such problems hiding. Zoli *** Src/Modules/stat.c.orig Sat May 2 03:45:37 1998 --- Src/Modules/stat.c Sat May 9 17:33:35 1998 *************** statmodeprint(mode_t mode, char *outbuf, *** 50,56 **** strcat(outbuf, " ("); } if (flags & STF_STRING) { ! char pm[11] = "?---------"; if (S_ISBLK(mode)) *pm = 'b'; --- 50,62 ---- strcat(outbuf, " ("); } if (flags & STF_STRING) { ! static const char *modes = "?rwxrwxrwx"; ! static const mode_t mflags[] = { S_IRUSR, S_IWUSR, S_IXUSR, ! S_IRGRP, S_IWGRP, S_IXGRP, ! S_IROTH, S_IWOTH, S_IXOTH }; ! mode_t *mfp = mflags; ! char pm[11]; ! int i; if (S_ISBLK(mode)) *pm = 'b'; *************** statmodeprint(mode_t mode, char *outbuf, *** 74,98 **** *pm = '-'; else if (S_ISSOCK(mode)) *pm = 's'; - if(mode & S_IRUSR) - pm[1] = 'r'; - if(mode & S_IWUSR) - pm[2] = 'w'; - if(mode & S_IXUSR) - pm[3] = 'x'; - if(mode & S_IRGRP) - pm[4] = 'r'; - if(mode & S_IWGRP) - pm[5] = 'w'; - if(mode & S_IXGRP) - pm[6] = 'x'; - if(mode & S_IROTH) - pm[7] = 'r'; - if(mode & S_IWOTH) - pm[8] = 'w'; - if(mode & S_IXOTH) - pm[9] = 'x'; if (mode & S_ISUID) pm[3] = (mode & S_IXUSR) ? 's' : 'S'; if (mode & S_ISGID) --- 80,91 ---- *pm = '-'; else if (S_ISSOCK(mode)) *pm = 's'; + else + *pm = '?'; + + for (i = 1; i <= 9; i++) + pm[i] = (mode & *mfp++) ? modes[i] : '-'; if (mode & S_ISUID) pm[3] = (mode & S_IXUSR) ? 's' : 'S'; if (mode & S_ISGID)