Path: utzoo!news-server.csri.toronto.edu!rutgers!att!bu.edu!transfer!lectroid!jjmhome!acestes!paradis From: paradis@acestes.UUCP (Jim Paradis) Newsgroups: comp.os.minix Subject: Bash patches (1/4) Message-ID: <162@acestes.UUCP> Date: 11 Mar 91 21:09:23 GMT Reply-To: paradis@acestes.UUCP (Jim Paradis) Organization: Alberichs Rings & Things Lines: 1487 This is the first of four articles containing my patches to make BASH (Gnu's Bourne-Again Shell) work under MINIX. I'm only posting patches because the full sources for BASH are (like most GNU goodies) obscenely large 8-). It's available from finer FTP sites everywhere. Note: These sources were built using bcc on MINIX 1.5.10 with Bruce Evans' 32-bit patches. Bash is way too big to run on 16-bit MINIX. If someone else is perverse enough to try this, be my guest 8-). Also, I built this using estdio; you should too. This is the only environment I've tested this on... if you have a different environment, lotsa luck! 8-) These patches are relative to version 1.05 of bash. You should be sitting in the main source directory when you execute the patches in this part. --------------8<---- cut here ----8<---- cut here 8<----------------------- *** bash-1.05/Makefile Mon Oct 29 17:36:38 1990 --- minix_bash/Makefile Sat Mar 9 23:09:14 1991 *************** *** 14,32 **** MAKE = make #CPP_DEFINES = -DHAVE_GCC -DHAVE_FIXED_INCLUDES -DHAVE_BISON CPP = /lib/cpp $(CPPFLAGS) #CPP = $(CC) -E CPPFLAGS = -P $(SYSTEM) $(CPP_DEFINES) -DM_DESTDIR=$(DESTDIR) ! CPP_ARGS = -DCPP_CC=$(CC) `./makeargs.sh` all: bash-Makefile $(MAKE) -f bash-Makefile bash-Makefile: cpp-Makefile Makefile machines.h makeargs.sh cp cpp-Makefile tmp-Makefile.c ! @echo $(CPP) $(CPP_ARGS) tmp-Makefile.c \| cat -s >bash-Makefile ! @$(CPP) $(CPP_ARGS) tmp-Makefile.c | cat -s >bash-Makefile rm -f tmp-Makefile.c # Subsequent lines contain targets that are correctly handled by an --- 14,34 ---- MAKE = make #CPP_DEFINES = -DHAVE_GCC -DHAVE_FIXED_INCLUDES -DHAVE_BISON + CC = bcc + CPP = /lib/cpp $(CPPFLAGS) #CPP = $(CC) -E CPPFLAGS = -P $(SYSTEM) $(CPP_DEFINES) -DM_DESTDIR=$(DESTDIR) ! CPP_ARGS = -DMINIX -DCPP_CC=$(CC) `./makeargs.sh` all: bash-Makefile $(MAKE) -f bash-Makefile bash-Makefile: cpp-Makefile Makefile machines.h makeargs.sh cp cpp-Makefile tmp-Makefile.c ! echo $(CPP) $(CPP_ARGS) tmp-Makefile.c \| cat >bash-Makefile ! $(CPP) $(CPP_ARGS) tmp-Makefile.c | cat >bash-Makefile rm -f tmp-Makefile.c # Subsequent lines contain targets that are correctly handled by an *** bash-1.05/builtins.c Mon Oct 29 17:36:40 1990 --- minix_bash/builtins.c Thu Nov 1 23:30:44 1990 *************** *** 19,36 **** Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include ! #include #include #include ! #include #include #include "shell.h" #ifndef SYSV ! #include ! #include ! #endif #include "builtins.h" #include "trap.h" --- 19,42 ---- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include ! #ifndef MINIX ! #include ! #endif /* MINIX */ #include #include ! #ifndef MINIX ! #include ! #endif /* MINIX */ #include #include "shell.h" #ifndef SYSV ! #ifndef MINIX ! #include ! #include ! #endif /* MINIX */ ! #endif /* SYSV */ #include "builtins.h" #include "trap.h" *************** *** 41,46 **** --- 47,56 ---- #include "jobs.h" #endif + #ifdef MINIX + #define killpg(pg, sig) kill(-(pg), (sig)) + #endif /* MINIX */ + extern int errno; /* Not always in . Bogusness. */ #ifndef sigmask *************** *** 52,57 **** --- 62,72 ---- #include #endif + #ifdef MINIX + #include + #include + #endif /* MINIX */ + #if defined (HAVE_VPRINTF) #include #endif *************** *** 2190,2196 **** information comes from variables in jobs.c used to keep track of this stuff. */ ! #if !defined (SYSV) static long scale60 (tvalp) struct timeval *tvalp; --- 2205,2211 ---- information comes from variables in jobs.c used to keep track of this stuff. */ ! #if !defined(SYSV) && !defined(MINIX) static long scale60 (tvalp) struct timeval *tvalp; *************** *** 2204,2210 **** { int system_minutes_used, user_minutes_used; long system_seconds_used, user_seconds_used; ! #ifndef SYSV struct rusage self, kids; no_args (list); --- 2219,2225 ---- { int system_minutes_used, user_minutes_used; long system_seconds_used, user_seconds_used; ! #if !defined(SYSV) && !defined(MINIX) struct rusage self, kids; no_args (list); *** bash-1.05/config.h Sun Feb 25 09:19:30 1990 --- minix_bash/config.h Thu Nov 1 21:29:54 1990 *************** *** 39,44 **** --- 39,49 ---- #undef JOB_CONTROL #endif /* SYSV */ + /* Neither does MINIX! */ + #ifdef MINIX + #undef JOB_CONTROL + #endif /* MINIX */ + /* Define ALIAS if you want the alias features. */ #define ALIAS *** bash-1.05/cpp-Makefile Mon Oct 29 17:36:42 1990 --- minix_bash/cpp-Makefile Sat Mar 9 23:31:17 1991 *************** *** 50,56 **** BISON = bison -y #else BISON = yacc ! #endif /* If the person blithely typed "make CC=gcc", then make that work. */ #if defined (__GNUC__) && !defined (HAVE_GCC) --- 50,56 ---- BISON = bison -y #else BISON = yacc ! #endif /* HAVE_BISON */ /* If the person blithely typed "make CC=gcc", then make that work. */ #if defined (__GNUC__) && !defined (HAVE_GCC) *************** *** 174,186 **** /**/# Support libraries required. Termcap and Readline. /**/# We would like to use the GNU termcap library. #if defined (USE_GNU_TERMCAP) #define TERMSRC_DEP TERMCAP = $(TLIBSRC)/libtermcap.a TERMLIB = -L$(TLIBSRC) -ltermcap #else TERMLIB = -ltermcap ! #endif READLINE= ./readline/libreadline.a --- 174,190 ---- /**/# Support libraries required. Termcap and Readline. /**/# We would like to use the GNU termcap library. + #if defined (MINIX) + TERMLIB = + #else /* !MINIX */ #if defined (USE_GNU_TERMCAP) #define TERMSRC_DEP TERMCAP = $(TLIBSRC)/libtermcap.a TERMLIB = -L$(TLIBSRC) -ltermcap #else TERMLIB = -ltermcap ! #endif /* USE_GNU_TERMCAP */ ! #endif /* MINIX */ READLINE= ./readline/libreadline.a *************** *** 222,228 **** LIBDEP = $(READLINE) #endif ! CSOURCES = shell.c parse.y general.c make_cmd.c print_cmd.c\ dispose_cmd.c execute_cmd.c variables.c builtins.c\ copy_cmd.c flags.c subst.c glob.c hash.c mailcheck.c\ test.c trap.c jobs.c nojobs.c $(ALLOC_FILES) braces.c\ --- 226,232 ---- LIBDEP = $(READLINE) #endif ! CSOURCES = shell.c y.tab.c general.c make_cmd.c print_cmd.c\ dispose_cmd.c execute_cmd.c variables.c builtins.c\ copy_cmd.c flags.c subst.c glob.c hash.c mailcheck.c\ test.c trap.c jobs.c nojobs.c $(ALLOC_FILES) braces.c\ *************** *** 265,274 **** $(PROGRAM): .build $(OBJECTS) $(LIBDEP) bash-Makefile $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) \ $(LIBRARIES) $(LOCAL_LIBS) $(TERMLIB) ! $(RM) -f .make ! ! .build: .make newversion.aux ! if ./newversion.aux -build; then mv -f newversion.h version.h; fi .make: @echo --- 269,286 ---- $(PROGRAM): .build $(OBJECTS) $(LIBDEP) bash-Makefile $(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) \ $(LIBRARIES) $(LOCAL_LIBS) $(TERMLIB) ! #ifdef MINIX ! chmem +256000 $(PROGRAM) ! #endif /* MINIX */ ! $(RM) -f .make ! ! #ifdef MINIX ! .build: .make newversion.aux ! if ./newversion.aux -build; then mv newversion.h version.h; fi ! #else /* !MINIX */ ! .build: .make newversion.aux ! if ./newversion.aux -build; then mv -f newversion.h version.h; fi ! #endif /* MINIX */ .make: @echo *************** *** 286,297 **** shell.h: general.h variables.h config.h touch shell.h ! y.tab.c: parse.y shell.h -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi $(BISON) -d parse.y -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi ! $(READLINE): $(READLINE_SOURCE) (cd $(RLIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)') --- 298,309 ---- shell.h: general.h variables.h config.h touch shell.h ! #ifndef MINIX y.tab.c: parse.y shell.h -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi $(BISON) -d parse.y -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi ! #endif /* MINIX */ $(READLINE): $(READLINE_SOURCE) (cd $(RLIBSRC); $(MAKE) $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)') *************** *** 321,328 **** #if !defined (HAVE_ALLOCA) #if !defined (__GNUC__) $(ALLOCA): $(ALLOCA_SOURCE) ! $(CC) -I$(ALLOC_DIR) $(CFLAGS) -c $(ALLOCA_SOURCE) ! @-mv `basename $*`.o $(ALLOCA) 2>&1 >/dev/null #else /* GCC */ $(ALLOCA): $(ALLOCA_SOURCE) $(CC) -I$(ALLOC_DIR) $(CFLAGS) -o $(ALLOCA) -c $(ALLOCA_SOURCE) --- 333,344 ---- #if !defined (HAVE_ALLOCA) #if !defined (__GNUC__) $(ALLOCA): $(ALLOCA_SOURCE) ! #ifdef MINIX ! $(CC) -I$(ALLOC_DIR) $(CFLAGS) -c $(ALLOCA_SOURCE) -o $(ALLOCA) ! #else /* !MINIX */ ! $(CC) -I$(ALLOC_DIR) $(CFLAGS) -c $(ALLOCA_SOURCE) ! @-mv `basename $*`.o $(ALLOCA) 2>&1 >/dev/null ! #endif /* MINIX */ #else /* GCC */ $(ALLOCA): $(ALLOCA_SOURCE) $(CC) -I$(ALLOC_DIR) $(CFLAGS) -o $(ALLOCA) -c $(ALLOCA_SOURCE) *************** *** 409,416 **** @echo cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z @cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z ! newversion.aux: newversion.c ! $(CC) -g -o newversion.aux newversion.c -lm newversion: newversion.aux rm -f .build --- 425,437 ---- @echo cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z @cp $(PROGRAM).tar.Z $(PROGRAM)-`cat .distribution`.tar.Z ! #ifdef MINIX ! newversion.aux: newversion.c ! $(CC) -o newversion.aux newversion.c ! #else /* !MINIX */ ! newversion.aux: newversion.c ! $(CC) -g -o newversion.aux newversion.c -lm ! #endif /* MINIX */ newversion: newversion.aux rm -f .build *************** *** 425,434 **** etags $(SOURCES) $(LIBRARY_SOURCE) clean: ! $(RM) $(OBJECTS) $(PROGRAM) y.tab.c y.tab.h newversion.aux $(RM) .make bash-Makefile (cd $(RLIBSRC); $(RM) *.o *.a) dist-clean: ! $(RM) $(OBJECTS) $(PROGRAM) y.tab.c newversion.aux ! $(RM) -rf uuencoded --- 446,463 ---- etags $(SOURCES) $(LIBRARY_SOURCE) clean: ! #ifdef MINIX ! $(RM) $(OBJECTS) $(PROGRAM) newversion.aux ! #else /* ! MINIX */ ! $(RM) $(OBJECTS) $(PROGRAM) y.tab.c y.tab.h newversion.aux ! #endif /* MINIX */ $(RM) .make bash-Makefile (cd $(RLIBSRC); $(RM) *.o *.a) dist-clean: ! #ifdef MINIX ! $(RM) $(OBJECTS) $(PROGRAM) newversion.aux ! #else /* ! MINIX */ ! $(RM) $(OBJECTS) $(PROGRAM) y.tab.c newversion.aux ! #endif /* MINIX */ ! $(RM) -rf uuencoded *** bash-1.05/execute_cmd.c Mon Oct 29 17:36:42 1990 --- minix_bash/execute_cmd.c Thu Nov 1 23:28:00 1990 *************** *** 23,29 **** #ifndef SONY #include #endif ! #include #include #include --- 23,34 ---- #ifndef SONY #include #endif ! #ifdef MINIX ! #include ! #define NOFILE OPEN_MAX ! #else ! #include ! #endif /* MINIX */ #include #include *************** *** 31,37 **** #define SIGABRT SIGIOT #endif ! #include #include #include "shell.h" --- 36,46 ---- #define SIGABRT SIGIOT #endif ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #include #include "shell.h" *************** *** 1391,1397 **** group_member (gid) int gid; { ! #ifdef SYSV return ((gid == getgid ()) || (gid == geteuid ())); #else --- 1400,1406 ---- group_member (gid) int gid; { ! #if defined(SYSV) || defined(MINIX) return ((gid == getgid ()) || (gid == geteuid ())); #else *** bash-1.05/general.c Mon Oct 29 17:36:42 1990 --- minix_bash/general.c Thu Nov 1 23:27:16 1990 *************** *** 25,31 **** #ifdef SYSV #include #else ! #include #endif /* SYSV */ #ifndef NULL --- 25,35 ---- #ifdef SYSV #include #else ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #endif /* SYSV */ #ifndef NULL *************** *** 456,461 **** --- 460,508 ---- } #endif /* NO_DUP */ + #ifdef MINIX + /* Functions needed for MINIX... */ + + char + *getwd(s) + char *s; + { + getcwd(s,MAXPATHLEN); + return s; + } + + gethostname(name, namelen) + char *name; + int namelen; + { + FILE * f; + char linebuf[80]; + int i; + + f = fopen("/etc/uucpname","r"); + if(f == (FILE *)NULL) { + return(-1); + } + + if(fgets(linebuf, 80, f) == NULL) { + return(-1); + } + + for(i = 0; i < sizeof(linebuf); i++) { + if(linebuf[i] == '\n') { + linebuf[i] = '\0'; + break; + } + } + + if(strlen(linebuf) > namelen) { + return(-1); + } + strcpy(name, linebuf); + return(0); + } + + #endif /* MINIX */ #ifdef SYSV #include bcopy(s,d,n) char *d,*s; { while(n--) *d++ = *s++; } *** bash-1.05/glob.c Mon Oct 29 17:36:44 1990 --- minix_bash/glob.c Thu Nov 1 22:12:36 1990 *************** *** 27,33 **** #include ! #if defined (SYSVr3) || defined (DIRENT) # include # define direct dirent # define D_NAMLEN(d) strlen((d)->d_name) --- 27,33 ---- #include ! #if defined (SYSVr3) || defined (DIRENT) || defined(MINIX) # include # define direct dirent # define D_NAMLEN(d) strlen((d)->d_name) *************** *** 54,60 **** #define rindex strrchr #else /* not SYSV */ ! #include extern void bcopy (); #endif /* not SYSV */ --- 54,64 ---- #define rindex strrchr #else /* not SYSV */ ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ extern void bcopy (); #endif /* not SYSV */ *** bash-1.05/jobs.h Fri Jan 5 13:27:38 1990 --- minix_bash/jobs.h Thu Nov 1 21:54:24 1990 *************** *** 94,100 **** typedef struct process { struct process *next; /* Next process in the pipeline. A circular chain. */ int pid; /* Process ID. */ ! union wait status; /* The status of this command as returned by wait. */ int running; /* Non-zero if this process is running. */ char *command; /* The particular program that is running. */ } PROCESS; --- 94,104 ---- typedef struct process { struct process *next; /* Next process in the pipeline. A circular chain. */ int pid; /* Process ID. */ ! #ifdef MINIX ! int status; ! #else ! union wait status; /* The status of this command as returned by wait. */ ! #endif /* MINIX */ int running; /* Non-zero if this process is running. */ char *command; /* The particular program that is running. */ } PROCESS; *** bash-1.05/machines.h Mon Oct 29 17:36:46 1990 --- minix_bash/machines.h Sat Mar 9 23:12:38 1991 *************** *** 376,381 **** --- 376,397 ---- #define HAVE_SETLINEBUF #endif /* clipper */ + /* **************************************** */ + /* */ + /* MINIX */ + /* */ + /* **************************************** */ + /* This is for MINIX 1.5 with Bruce Evans' 386 patches. + * it has not been tested on any other MINIX configuration. + */ + #if defined(MINIX) + + #define M_MACHINE "PC_386" + #define M_OS Minix + #define SYSDEP_CFLAGS -DMINIX -D_MINIX -D_POSIX_SOURCE + + #endif /* MINIX */ + /* **************************************************************** */ /* */ /* Generic Entry */ *** bash-1.05/mailcheck.c Sat Jan 20 12:57:46 1990 --- minix_bash/mailcheck.c Thu Nov 1 22:13:32 1990 *************** *** 21,27 **** #include #include #include ! #include #include "shell.h" #ifndef MAXPATHLEN --- 21,29 ---- #include #include #include ! #ifndef MINIX ! #include ! #endif /* MINIX */ #include "shell.h" #ifndef MAXPATHLEN *** bash-1.05/make_cmd.c Mon Oct 29 17:36:46 1990 --- minix_bash/make_cmd.c Thu Nov 1 21:28:02 1990 *************** *** 24,30 **** #ifndef SONY #include #endif ! #include #if defined (HAVE_VPRINTF) #include --- 24,32 ---- #ifndef SONY #include #endif ! #ifndef MINIX ! #include ! #endif /* MINIX */ #if defined (HAVE_VPRINTF) #include *************** *** 210,217 **** /* Return a command which is the connection of the word or redirection in ELEMENT, and the command * or NULL in COMMAND. */ COMMAND * ! make_simple_command (element, command) ! ELEMENT element; COMMAND *command; { /* If we are starting from scratch, then make the initial command --- 212,219 ---- /* Return a command which is the connection of the word or redirection in ELEMENT, and the command * or NULL in COMMAND. */ COMMAND * ! make_simple_command (elementp, command) ! ELEMENT *elementp; COMMAND *command; { /* If we are starting from scratch, then make the initial command *************** *** 228,244 **** command->subshell = 0; command->value.Simple = temp; } ! if (element.word) ! { ! WORD_LIST *tw = (WORD_LIST *)xmalloc (sizeof (WORD_LIST)); ! tw->word = element.word; tw->next = command->value.Simple->words; command->value.Simple->words = tw; } else { ! element.redirect->next = command->value.Simple->redirects; ! command->value.Simple->redirects = element.redirect; } return (command); } --- 230,246 ---- command->subshell = 0; command->value.Simple = temp; } ! if (elementp->word) ! { ! WORD_LIST *tw = (WORD_LIST *)xmalloc (sizeof (WORD_LIST)); ! tw->word = elementp->word; tw->next = command->value.Simple->words; command->value.Simple->words = tw; } else { ! elementp->redirect->next = command->value.Simple->redirects; ! command->value.Simple->redirects = elementp->redirect; } return (command); } *** bash-1.05/makeargs.sh Mon Oct 29 17:36:46 1990 --- minix_bash/makeargs.sh Thu Nov 1 16:14:24 1990 *************** *** 1,37 **** ! #!/bin/sh ! # ! # This file outputs a string of text which are CPP defines helping to ! # describe the operating system version. We just take guesses by ! # looking at random files. ! ! # Test for shared libraries (this is pretty Sunish). ! if test -f /lib/ld.so; then SHLIB=-DHAVE_SHARED_LIBS; fi ! ! # Get name of maintainer. ! if test -f /usr/ucb/whoami; then ! WHOAMI=`whoami`@`hostname`; ! else ! WHOAMI=`who am i | awk '{ print $1; }'` ! fi ! ! if [ "$WHOAMI" = "" ]; then ! WHOAMI=`id | sed 's/uid=[01-9]*(//' | sed 's/) [) A-Za-z01-9(=,]*//'` ! if test -f /bin/hostname; then ! WHOAMI=$WHOAMI@`/bin/hostname` ! elif test -f /usr/bin/uuname; then ! WHOAMI=`uuname`!$WHOAMI ! fi ! fi ! ! # ! # Is this a Xenix system? ! # ! if [ -f /xenix ]; then ! SYSDEF="-DXenix" ! case "`uname -p`" in ! *286) SYSDEF="-DXenix286" ;; ! *386) SYSDEF="-DXenix386" ;; ! esac ! fi ! ! echo "-DCPP_MAINTAINER=${WHOAMI} ${SHLIB} ${SYSDEF}" --- 1 ---- ! echo "-DCPP_MAINTAINER=root" *** bash-1.05/newversion.c Wed Jan 3 14:50:28 1990 --- minix_bash/newversion.c Thu Nov 1 16:25:48 1990 *************** *** 28,34 **** char **argv; { FILE *file, *must_open (); ! float distver = 0.0; int dist = 0, build = 0, buildver = 0; int dist_inc = 0, build_inc = 0; int dot_dist_needs_making = 0, dot_build_needs_making = 0; --- 28,35 ---- char **argv; { FILE *file, *must_open (); ! int distver_major = 0; ! int distver_minor = 0; int dist = 0, build = 0, buildver = 0; int dist_inc = 0, build_inc = 0; int dot_dist_needs_making = 0, dot_build_needs_making = 0; *************** *** 51,57 **** arg_index++; } ! if (!get_float_from_file (".distribution", &distver)) dot_dist_needs_making++; if (!dist) --- 52,58 ---- arg_index++; } ! if (!get_float_from_file (".distribution", &distver_major, &distver_minor)) dot_dist_needs_making++; if (!dist) *************** *** 62,69 **** else dist_inc++; ! if (dist && arg_index < argc) ! if (1 != sscanf (argv[arg_index], "%f", &distver)) { fprintf (stderr, "Bad input `%s'. Expected float value for -dist.\n", argv[arg_index]); --- 63,72 ---- else dist_inc++; ! if (dist && arg_index < argc) { ! distver_major = distver_minor = 0; ! if (2 != sscanf (argv[arg_index], "%d.%d", ! &distver_major, &distver_minor)) { fprintf (stderr, "Bad input `%s'. Expected float value for -dist.\n", argv[arg_index]); *************** *** 74,79 **** --- 77,83 ---- arg_index++; dist_inc = 0; } + } if (build && arg_index < argc) if (1 != sscanf (argv[arg_index], "%d", &buildver)) *************** *** 88,94 **** build_inc = 0; } ! if (dot_dist_needs_making && !distver) { fprintf (stderr, "There is no `.distribution' file for me to infer from.\n"); exit (1); --- 92,98 ---- build_inc = 0; } ! if (dot_dist_needs_making && !distver_major && !distver_minor) { fprintf (stderr, "There is no `.distribution' file for me to infer from.\n"); exit (1); *************** *** 97,112 **** if (build) buildver = buildver + 1; ! if (dist_inc) ! distver = distver + 0.01; ! ! file = must_open ("newversion.h", "w"); ! fprintf (file, "%s%.2f%s%d\n","\ /* Version control for the shell. This file gets changed when you say\n\ `make newversion' to the Makefile. It is created by newversion.aux. */\n\ \n\ /* The distribution version number of this shell. */\n\ ! #define DISTVERSION \"", distver, "\"\n\n/* The last built version of this shell. */\n\ #define BUILDVERSION ", buildver); fclose (file); --- 101,121 ---- if (build) buildver = buildver + 1; ! if (dist_inc) { ! distver_minor++; ! if(distver_minor >= 100) { ! distver_major++; ! distver_minor = 0; ! } ! } ! ! file = must_open ("newversion.h", "w"); ! fprintf (file, "%s%d.%02d%s%d\n","\ /* Version control for the shell. This file gets changed when you say\n\ `make newversion' to the Makefile. It is created by newversion.aux. */\n\ \n\ /* The distribution version number of this shell. */\n\ ! #define DISTVERSION \"", distver_major, distver_minor, "\"\n\n/* The last built version of this shell. */\n\ #define BUILDVERSION ", buildver); fclose (file); *************** *** 117,138 **** if (dist) { file = must_open (".distribution", "w"); ! fprintf (file, "%.2f\n", distver); fclose (file); } exit (0); } ! get_float_from_file (filename, var) ! char *filename; ! float *var; { FILE *stream; int result; if ((stream = fopen (filename, "r")) == (FILE *)NULL) return (1); ! result = fscanf (stream, "%f\n", var); fclose (stream); return (result == 1); } --- 126,148 ---- if (dist) { file = must_open (".distribution", "w"); ! fprintf (file, "%d.%02d\n", distver_major, distver_minor); fclose (file); } exit (0); } ! get_float_from_file (filename, var1, var2) ! char *filename; ! int * var1; ! int * var2; { FILE *stream; int result; if ((stream = fopen (filename, "r")) == (FILE *)NULL) return (1); ! result = fscanf (stream, "%d.%d\n", var1, var2); fclose (stream); return (result == 1); } *** bash-1.05/nojobs.c Mon Oct 29 17:36:48 1990 --- minix_bash/nojobs.c Thu Nov 1 23:29:18 1990 *************** *** 21,29 **** #include #include ! #include ! #include ! #include #include #include #include --- 21,31 ---- #include #include ! #ifndef MINIX ! #include ! #include ! #endif /* MINIX */ ! #include #include #include #include *************** *** 36,42 **** #define SIGABRT SIGIOT #endif ! #ifdef SYSV #define killpg(pg, sig) kill(-(pg),(sig)) #endif /* SYSV */ --- 38,44 ---- #define SIGABRT SIGIOT #endif ! #if defined(SYSV) || defined(MINIX) #define killpg(pg, sig) kill(-(pg),(sig)) #endif /* SYSV */ *************** *** 149,155 **** int pid; { int got_pid; ! union wait status; while ((got_pid = wait (&status)) != pid) { --- 151,161 ---- int pid; { int got_pid; ! #ifdef MINIX ! int status; ! #else ! union wait status; ! #endif /* MINIX */ while ((got_pid = wait (&status)) != pid) { *************** *** 175,181 **** while (1) { int got_pid; ! union wait status; while ((got_pid = wait(&status)) != -1) /* wait for ECHILD */ ; --- 181,191 ---- while (1) { int got_pid; ! #ifdef MINIX ! int status; ! #else ! union wait status; ! #endif /* MINIX */ while ((got_pid = wait(&status)) != -1) /* wait for ECHILD */ ; *************** *** 196,208 **** { extern int interactive; int got_pid, return_val, oldmask; ! union wait status; while ((got_pid = wait (&status)) != pid) { if (got_pid < 0 && errno == ECHILD) { ! status.w_termsig = status.w_retcode = 0; break; } else if (got_pid < 0 && errno != EINTR) --- 206,226 ---- { extern int interactive; int got_pid, return_val, oldmask; ! #ifdef MINIX ! int status; ! #else ! union wait status; ! #endif /* MINIX */ while ((got_pid = wait (&status)) != pid) { if (got_pid < 0 && errno == ECHILD) { ! #ifdef MINIX ! status = 0; ! #else ! status.w_termsig = status.w_retcode = 0; ! #endif /* MINIX */ break; } else if (got_pid < 0 && errno != EINTR) *************** *** 213,231 **** QUIT; /* Default return value. */ ! return_val = status.w_retcode & 0x7f; ! ! if (status.w_termsig != 0 && status.w_termsig != WSTOPPED) ! { ! extern char *sys_siglist[]; ! fprintf (stderr, "%s", sys_siglist[status.w_termsig]); ! if (status.w_coredump) ! fprintf (stderr, " (core dumped)"); ! fprintf (stderr, "\n"); ! return_val = status.w_termsig + 128; ! } ! ! if (status.w_termsig != 0) set_tty_state (); else get_tty_state (); --- 231,272 ---- QUIT; /* Default return value. */ ! #ifdef MINIX ! return_val = WEXITSTATUS(status) & 0x7f; ! #else ! return_val = status.w_retcode & 0x7f; ! #endif /* MINIX */ ! ! #ifdef MINIX ! if (WTERMSIG(status) != 0 && !WIFSTOPPED(status)) ! #else ! if (status.w_termsig != 0 && status.w_termsig != WSTOPPED) ! #endif /* MINIX */ ! { ! extern char *sys_siglist[]; ! #ifdef MINIX ! fprintf (stderr, "%s", sys_siglist[WTERMSIG(status)]); ! #else ! fprintf (stderr, "%s", sys_siglist[status.w_termsig]); ! #endif /* MINIX */ ! ! #ifndef MINIX ! if (status.w_coredump) ! fprintf (stderr, " (core dumped)"); ! #endif /* MINIX */ ! fprintf (stderr, "\n"); ! #ifdef MINIX ! return_val = WTERMSIG(status) + 128; ! #else ! return_val = status.w_termsig + 128; ! #endif /* MINIX */ ! } ! ! #ifdef MINIX ! if (WTERMSIG(status) != 0) ! #else ! if (status.w_termsig != 0) ! #endif /* MINIX */ set_tty_state (); else get_tty_state (); *************** *** 251,278 **** return (result); } ! static struct termio shell_tty_info; /* Fill the contents of shell_tty_info with the current tty info. */ get_tty_state () { int tty = open ("/dev/tty", O_RDONLY); if (tty != -1) { ioctl (tty, TCGETA, &shell_tty_info); close (tty); } } /* Make the current tty use the state in shell_tty_info. */ set_tty_state () { int tty = open ("/dev/tty", O_RDONLY); if (tty != -1) { ioctl (tty, TCSETAW, &shell_tty_info); /* Wait for output, no flush */ close (tty); } } /* Give the terminal to PGRP. */ --- 292,325 ---- return (result); } ! #ifndef MINIX ! static struct termio shell_tty_info; ! #endif /* MINIX */ /* Fill the contents of shell_tty_info with the current tty info. */ get_tty_state () { + #ifndef MINIX int tty = open ("/dev/tty", O_RDONLY); if (tty != -1) { ioctl (tty, TCGETA, &shell_tty_info); close (tty); } + #endif /* MINIX */ } /* Make the current tty use the state in shell_tty_info. */ set_tty_state () { + #ifndef MINIX int tty = open ("/dev/tty", O_RDONLY); if (tty != -1) { ioctl (tty, TCSETAW, &shell_tty_info); /* Wait for output, no flush */ close (tty); } + #endif /* MINIX */ } /* Give the terminal to PGRP. */ *** bash-1.05/shell.c Mon Oct 29 17:36:50 1990 --- minix_bash/shell.c Thu Nov 1 16:31:42 1990 *************** *** 41,52 **** #ifndef SONY #include #endif ! #include #include #include #if defined (HAVE_VPRINTF) ! #include #endif #include "shell.h" --- 41,58 ---- #ifndef SONY #include #endif ! #ifndef MINIX ! #include ! #endif /* MINIX */ #include #include #if defined (HAVE_VPRINTF) ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #endif #include "shell.h" *************** *** 803,809 **** #ifdef SIGEMT SIGEMT, #endif ! SIGFPE, SIGKILL, SIGBUS, SIGSEGV, SIGSYS, SIGPIPE, SIGALRM, SIGTERM, #ifdef SIGXCPU SIGXCPU, #endif --- 809,819 ---- #ifdef SIGEMT SIGEMT, #endif ! SIGFPE, SIGKILL, SIGBUS, SIGSEGV, ! #ifdef SIGSYS ! SIGSYS, ! #endif ! SIGPIPE, SIGALRM, SIGTERM, #ifdef SIGXCPU SIGXCPU, #endif *** bash-1.05/siglist.c Thu Feb 22 13:53:22 1990 --- minix_bash/siglist.c Thu Nov 1 23:43:30 1990 *************** *** 18,24 **** with Bash; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! #include #ifndef NSIG # define NSIG 64 --- 18,28 ---- with Bash; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #ifndef NSIG # define NSIG 64 *** bash-1.05/test.c Tue Jan 16 19:31:06 1990 --- minix_bash/test.c Thu Nov 1 22:14:34 1990 *************** *** 29,35 **** Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include ! #include #ifndef SONY #include --- 29,39 ---- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #ifndef SONY #include *************** *** 37,43 **** #include #include ! #include #ifndef R_OK #define R_OK 4 --- 41,51 ---- #include #include ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #ifndef R_OK #define R_OK 4 *** bash-1.05/ulimit.c Wed Dec 20 04:39:06 1989 --- minix_bash/ulimit.c Thu Nov 1 22:48:58 1990 *************** *** 21,26 **** --- 21,27 ---- #include #include "shell.h" + #ifndef MINIX #include #include extern int errno; *************** *** 62,71 **** --- 63,75 ---- RESOURCE_LIMIT *resource_limits = (RESOURCE_LIMIT *)NULL; + #endif /* Not MINIX */ + /* Called after we fork. Sets the process resource limits to the values saved in RESOURCE_LIMITS. */ set_process_resource_limits () { + #ifndef MINIX long shell_ulimit (); register RESOURCE_LIMIT *limits = resource_limits; *************** *** 74,79 **** --- 78,84 ---- shell_ulimit (limits->cmd, limits->limit, 1); limits = limits->next; } + #endif /* !MINIX */ } /* Report or set limits associated with certain per-process resources. *************** *** 82,87 **** --- 87,96 ---- ulimit_builtin (list) register WORD_LIST *list; { + #ifdef MINIX + report_error("ulimit not implemented under MINIX"); + return (EXECUTION_SUCCESS); + #else long shell_ulimit (); register char *s; int c, setting, cmd, r = EXECUTION_SUCCESS; *************** *** 229,236 **** } while (list); return (EXECUTION_SUCCESS); ! } ! /* The ulimit that we call from within Bash. Extended to handle more resources by Chet Ramey (chet@cwjcc.cwru.edu). WHICH says which limit to twiddle; SETTING is non-zero if NEWLIM --- 238,247 ---- } while (list); return (EXECUTION_SUCCESS); ! #endif /* MINIX */ ! } ! ! #ifndef MINIX /* The ulimit that we call from within Bash. Extended to handle more resources by Chet Ramey (chet@cwjcc.cwru.edu). WHICH says which limit to twiddle; SETTING is non-zero if NEWLIM *************** *** 390,393 **** } #endif /* !SYSV */ ! --- 401,404 ---- } #endif /* !SYSV */ ! #endif /* !MINIX */ *** bash-1.05/unwind_prot.c Sat Jan 20 15:02:32 1990 --- minix_bash/unwind_prot.c Thu Nov 1 22:37:48 1990 *************** *** 25,31 **** /* */ /* **************************************************************** */ ! #include #include "config.h" #include "general.h" --- 25,35 ---- /* */ /* **************************************************************** */ ! #ifdef MINIX ! #include ! #else ! #include ! #endif /* MINIX */ #include "config.h" #include "general.h" *** bash-1.05/version.h Mon Oct 29 17:36:52 1990 --- minix_bash/version.h Sat Mar 9 23:31:30 1991 *************** *** 5,8 **** #define DISTVERSION "1.05" /* The last built version of this shell. */ ! #define BUILDVERSION 14 --- 5,8 ---- #define DISTVERSION "1.05" /* The last built version of this shell. */ ! #define BUILDVERSION 4 *** bash-1.05/y.tab.h Sat Mar 9 23:42:41 1991 --- minix_bash/y.tab.h Thu Nov 1 21:30:24 1990 *************** *** 0 **** --- 1,39 ---- + + typedef union { + WORD_DESC *word; /* the word that we read. */ + int number; /* the number that we read. */ + WORD_LIST *word_list; + COMMAND *command; + REDIRECT *redirect; + ELEMENT element; + PATTERN_LIST *pattern; + } YYSTYPE; + extern YYSTYPE yylval; + # define IF 257 + # define THEN 258 + # define ELSE 259 + # define ELIF 260 + # define FI 261 + # define CASE 262 + # define ESAC 263 + # define FOR 264 + # define WHILE 265 + # define UNTIL 266 + # define DO 267 + # define DONE 268 + # define FUNCTION 269 + # define IN 270 + # define WORD 271 + # define NUMBER 272 + # define AND_AND 273 + # define OR_OR 274 + # define GREATER_GREATER 275 + # define LESS_LESS 276 + # define LESS_AND 277 + # define GREATER_AND 278 + # define SEMI_SEMI 279 + # define LESS_LESS_MINUS 280 + # define AND_GREATER 281 + # define DOUBLE_OPEN 282 + # define DOUBLE_CLOSE 283 + # define yacc_EOF 284 -- Jim Paradis UUCP: harvard!m2c!jjmhome!acestes!paradis 9 Carlstad St. AT&T: (508) 792-3810 Worcester, MA 01607-1569 ICBM: 42deg 13' 52", 71deg 47' 51"