andy@CSVAX.CALTECH.EDU (Andy Fyfe) (06/24/89)
Continuing troubles on the unixpc, and other related comments: 1. The filenames unwind_protect.c and malloc-rcheck.c are 16 and 15 characters long respectively. Both need to be no more than 14. 2. In shell.c, in the array "terminating_signals", SIGVTALRM and SIGPROF should be conditionally included. Also, there seems to be no reason to substitute zeroes for missing signals, since they are only used in a call to signal(2), and a zero signal will be rejected as invalid (or should be). 3. There's a typo in config.h in one of the #if's (defined is misspelled as "definded"). As it stands, gcc's __builtin_alloca is used only for the UnixPC. I'd expect every user of gcc would want this, so the diffs change this around for alloca rather than fix the typo. (Should SUN386i cause SUN4 to be defined? I thought SUN4 == sparc.) 4. There's a typo in the definition of dup2 in general.c. The fDUPFD should be F_DUPFD. 5. There's a type in the definition of gethostname in general.c. The variable "namelen" should be "namlen". 6. Glob.c and builtins.c need to include "config.h" (otherwise we don't get the mapping of UNIXPC --> SYSV (and presumably others)). Since config.h takes care of the alloca stuff, glob.c doesn't need to. 7. In builtins.c, in shell_ulimit, to get the file limit, under SYSV you use ulimit. The second parameter to ulimit is a long and it's not needed to get the limit, so it can simply be 0L. Then, under System V, the resource.h/struct rlimit stuff isn't needed at all. 8. In general.c, I believe the standard SYSV include file is "string.h" -- I don't think this is particular to the UnixPC. Our suns have both -- string.h says it's from S5R2 (and has strchr), while strings.h says it's from BSD (and has index). 9. In config.h, you have the "READLINE" stuff twice. The diffs follow. Andy Fyfe andy@csvax.caltech.edu ------------------------------------------------------------------------------- diff -c2 save/builtins.c ./builtins.c *** save/builtins.c Fri Jun 23 20:35:09 1989 --- ./builtins.c Fri Jun 23 20:55:07 1989 *************** *** 19,26 **** Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> #include <sys/param.h> ! #ifndef UNIXPC #include <sys/time.h> #include <sys/resource.h> --- 19,28 ---- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + #include "config.h" + #include <stdio.h> #include <sys/param.h> ! #ifndef SYSV #include <sys/time.h> #include <sys/resource.h> *************** *** 2417,2425 **** long newlim; { ! #ifdef UNIXPC ! long limit; ! #else struct rlimit limit; ! #endif /* UNIXPC */ switch (which) --- 2419,2425 ---- long newlim; { ! #ifndef SYSV struct rlimit limit; ! #endif switch (which) *************** *** 2430,2438 **** { #ifdef SYSV ! #ifdef UNIXPC ! return (ulimit (1, limit)); ! #else /* UNIXPC */ ! return (ulimit (1, limit.rlim_max)); ! #endif /* UNIXPC */ #else if (getrlimit (RLIMIT_FSIZE, &limit) != 0 ) --- 2430,2434 ---- { #ifdef SYSV ! return (ulimit (1, 0L)); #else if (getrlimit (RLIMIT_FSIZE, &limit) != 0 ) diff -c2 save/config.h ./config.h *** save/config.h Sun Jun 11 17:27:02 1989 --- ./config.h Fri Jun 23 21:06:17 1989 *************** *** 14,30 **** #ifdef SUN4 ! #include <alloca.h> #endif - /* Define READLINE to get the nifty/glitzy editing features. - This is on by default. You can turn it off interactively - with the -nolineediting flag. */ - #define READLINE - #if defined (HPUX) || defined (UNIXPC) #define SYSV - #if defined (UNIXPC) && definded (__GNUC__) - #define alloca __builtin_alloca - #endif #endif --- 14,27 ---- #ifdef SUN4 ! #include <alloca.h> /* sparcs are different */ ! #else ! #ifdef __GNUC__ ! #define alloca __builtin_alloca /* use gcc's builtin version */ ! #else ! char *alloca(); /* use the library version */ #endif #if defined (HPUX) || defined (UNIXPC) #define SYSV #endif diff -c2 save/general.c ./general.c *** save/general.c Thu Jun 22 21:46:14 1989 --- ./general.c Fri Jun 23 20:04:19 1989 *************** *** 364,368 **** char *index(s,c) char *s; { char *strchr(); return strchr(s,c); } char *rindex(s,c) char *s; { char *strrchr(); return strrchr(s,c); } ! int dup2 (f, t) int f, t; { close (t); return (fcntl (f, fDUPFD, t)); } gethostname (name, namlen) --- 364,368 ---- char *index(s,c) char *s; { char *strchr(); return strchr(s,c); } char *rindex(s,c) char *s; { char *strrchr(); return strrchr(s,c); } ! int dup2 (f, t) int f, t; { close (t); return (fcntl (f, F_DUPFD, t)); } gethostname (name, namlen) *************** *** 376,380 **** i = strlen (uts.nodename) + 1; strncpy (name, uts.nodename, i < namlen - 1 ? i : namlen - 1); ! name[namelen - 1] = '\0'; return 0; } --- 376,380 ---- i = strlen (uts.nodename) + 1; strncpy (name, uts.nodename, i < namlen - 1 ? i : namlen - 1); ! name[namlen - 1] = '\0'; return 0; } diff -c2 save/glob.c ./glob.c *** save/glob.c Thu Jun 22 21:36:27 1989 --- ./glob.c Fri Jun 23 20:54:11 1989 *************** *** 23,26 **** --- 23,27 ---- based on specifications for the pattern matching. (RMS) */ + #include "config.h" #include <sys/types.h> *************** *** 48,57 **** #define DP_NAMELEN(x) (x)->d_namlen #endif - - #ifdef sparc - #include <alloca.h> - #else - extern char *alloca (); - #endif /* sparc */ extern char *malloc (), *realloc (); --- 49,52 ---- diff -c2 save/shell.c ./shell.c *** save/shell.c Fri Jun 23 10:46:13 1989 --- ./shell.c Fri Jun 23 20:04:25 1989 *************** *** 735,748 **** SIGXFSZ, #endif ! SIGVTALRM, SIGPROF, #ifdef SIGLOST SIGLOST, - #else - 0, #endif #ifdef SIGUSR1 SIGUSR1, SIGUSR2 - #else - 0, 0 #endif }; --- 735,749 ---- SIGXFSZ, #endif ! #ifdef SIGVTALRM ! SIGVTALRM, ! #endif ! #ifdef SIGPROG ! SIGPROF, ! #endif #ifdef SIGLOST SIGLOST, #endif #ifdef SIGUSR1 SIGUSR1, SIGUSR2 #endif };
james@bigtex.cactus.org (James Van Artsdalen) (06/25/89)
> Date: Fri, 23 Jun 89 21:23:23 PDT > From: andy@csvax.caltech.edu (Andy Fyfe) > As it stands, gcc's __builtin_alloca is used only for the UnixPC. > I'd expect every user of gcc would want this, so the diffs change this > around for alloca rather than fix the typo. A number of alloca() implementations are broken, so it really is better to use the GNU C version if possible no matter what the system. --- James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die" Dell Computer Co 9505 Arboretum Blvd Austin TX 78759 512-338-8789