From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: PATCH: K&R compiler fix
Date: Sat, 9 May 1998 17:40:16 -0500 (CDT) [thread overview]
Message-ID: <199805092240.RAA03045@hzoli.home> (raw)
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)
reply other threads:[~1998-05-09 22:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199805092240.RAA03045@hzoli.home \
--to=hzoli@cs.elte.hu \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).