istewart@datlog.co.uk (08/30/90)
Posting-number: Volume 14, Issue 65 Submitted-by: istewart@datlog.co.uk Archive-name: ms_sh-1.6/patch02 This is patch 1.6.3 for the MS-DOS Shell. It fixes a number of minor problems in the shell, addes a few new features and fixes on major problem in the directory handling functions. The changes are detailed in the Readme update and the change logs. Some of the files have changed because I have moved to GNU RCS 4.2. Most of the patches that Kai Uwe Rommel posted in comp.binaries.ibm.pc.d have been implemented. The main one I left one was that which allowed the user to execute COMMAND.COM internal commands by having COMMAND.COM automatically invoked. There were three reasons for leaving it out 1) the problem of wild card expansion - the shell does wildcard expansion before invoking a program which is likely to cause command.com to reject the command; 2) if the user really wants these commands, they can be generated just as easily using functions: dir () { command /c dir $1; } and 3) some of the command.com internal commands have Unix equivalents and the Unix equivalent tend to be more feature loaded. If you don't like it, you can always install Kai's patches yourself. This is not to say don't mail me changes. I just don't think this one is appropriate. Other than that, here it is. The two shars generate Patch1.6.3 which should be applied via patch -p <Patch1.6.3 from the shell source root directory. Regards, Ian Stewartson Data Logic Ltd, Queens House, Greenhill Way, Harrow, Middlesex, HA1 1YR, UK. (Phone) +44 81 863 0383 (Telex) 888103 (Fax) +44 81 861 2010 (Network) istewart@datlog.co.uk or ukc!datlog!istewart ----CUT HERE---- #!/bin/sh # This is a shell archive (shar 3.21) # made 08/21/1990 20:17 UTC by istewart@datlog.co.uk # Source directory /usr/proj1/ssd/istewart/src/shell # # existing files WILL be overwritten # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 51095 -rw-r--r-- Patch1.6.3 # if touch 2>&1 | fgrep '[-amc]' > /dev/null then TOUCH=touch else TOUCH=true fi if test -r @shar_seq_.tmp; then echo "Must unpack archives in sequence!" next=`cat @shar_seq_.tmp`; echo "Please unpack part $next next" exit 1 fi # ============= Patch1.6.3 ============== echo "x - extracting Patch1.6.3 (Text)" sed 's/^X//' << 'SHAR_EOF' > Patch1.6.3 && XIndex: Notes1.6 X*** ../sh16.2/Notes1.6 Tue Jun 26 19:46:22 1990 X--- Notes1.6 Fri Aug 17 21:29:59 1990 X*************** X*** 1,4 **** X! Version 1.6.2 Release Notes: X X Note: Release 1.6.1 did occur to comp.ibm.pc.binaries. However, the X transmission was corrupt and by the time I was notified (the moderator having X--- 1,4 ---- X! Version 1.6.3 Release Notes: X X Note: Release 1.6.1 did occur to comp.ibm.pc.binaries. However, the X transmission was corrupt and by the time I was notified (the moderator having X*************** X*** 35,40 **** X--- 35,46 ---- X 18. The directory routines have been modified to correctly handle X all valid Unix format directory names (ie a Unix directory name X can end in /. However, DOS does not think this is a directory). X+ 19. A bug in director.c which caused the shell to crash or hang has X+ been fixed. X+ 20. The DOS 4 command processor does not like the use of switchar. X+ The code has been fixed to cope with DOS 4. X+ 21. A bug in the processing of functions has been fixed which caused X+ the shell to crash or hang has been fixed. X X The following enhancements have been made: X X*************** X*** 69,74 **** X--- 75,83 ---- X data and stack space after the first write. X 19. The ms_dio function have been enhanced to support raw and block X devices (well not really - just the stat and fstat functions). X+ 20. The POSIX variable substitution command ${#name} to give the X+ string length has been implemented. X+ 21. The POSIX I/O option <> has been implemented. X X The following enhancements/bugs remain outstanding: X XIndex: ReadMe XPrereq: 1.7 X*** ../sh16.2/ReadMe Fri Apr 6 17:58:18 1990 X--- ReadMe Fri Aug 17 21:31:12 1990 X*************** X*** 13,21 **** X 2. The sources (or parts thereof) or objects generated from the X sources (or parts of sources) cannot be sold under any circumstances. X X! $Header: readme 1.7 90/04/03 18:07:01 MS_user Exp $ X X $Log: readme $ X Revision 1.7 90/04/03 18:07:01 MS_user X Some changes for 1.6 (Int 24 and Config file) X X--- 13,24 ---- X 2. The sources (or parts thereof) or objects generated from the X sources (or parts of sources) cannot be sold under any circumstances. X X! $Header: C:/SRC/SHELL/RCS/readme 1.8 90/08/15 01:18:53 MS_user Exp $ X X $Log: readme $ X+ Revision 1.8 90/08/15 01:18:53 MS_user X+ Add 1.6.3 comment X+ X Revision 1.7 90/04/03 18:07:01 MS_user X Some changes for 1.6 (Int 24 and Config file) X X*************** X*** 107,112 **** X--- 110,117 ---- X Unix V.4. X X 11) A configuration file is supported to allow edit key specification. X+ X+ 12) The support of POSIX P1003.2 commands has been started. X X The shell was built using MS-DOS C and MASM v5.1 in large model mode. X XIndex: lib/director.c X*** ../sh16.2/lib/director.c Fri Jun 22 09:18:24 1990 X--- lib/director.c Fri Aug 17 21:31:57 1990 X*************** X*** 20,28 **** X #include <dos.h> X X #define ATTRIBUTES (_A_SUBDIR | _A_HIDDEN | _A_SYSTEM | \ X! _A_NORMAL | _A_RDONLY | _A_ARCH | _A_VOLID) X X! static void free_dircontents (struct _dircontents *); X X DIR *opendir(name) X char *name; X--- 20,29 ---- X #include <dos.h> X X #define ATTRIBUTES (_A_SUBDIR | _A_HIDDEN | _A_SYSTEM | \ X! _A_NORMAL | _A_RDONLY | _A_ARCH) X X! typedef struct _dircontents DIRCONT; X! static void free_dircontents (DIRCONT *); X X DIR *opendir(name) X char *name; X*************** X*** 30,36 **** X struct stat statb; X DIR *dirp; X char *last; X! struct _dircontents *dp; X char *nbuf; X struct find_t dtabuf; X int len = strlen (name); X--- 31,37 ---- X struct stat statb; X DIR *dirp; X char *last; X! DIRCONT *dp; X char *nbuf; X struct find_t dtabuf; X int len = strlen (name); X*************** X*** 41,47 **** X return (DIR *)NULL; X } X X! if ((nbuf = malloc (len + 4)) == (char *)NULL) X return (DIR *) NULL; X X strcpy (nbuf, name); X--- 42,48 ---- X return (DIR *)NULL; X } X X! if ((nbuf = malloc (len + 5)) == (char *)NULL) X return (DIR *) NULL; X X strcpy (nbuf, name); X*************** X*** 90,97 **** X strcat (last, "*.*"); X X dirp->dd_loc = 0; X! dirp->dd_cp = (struct _dircontents *) NULL; X! dirp->dd_contents = (struct _dircontents *) NULL; X X if (_dos_findfirst (nbuf, ATTRIBUTES, &dtabuf) != 0) X { X--- 91,98 ---- X strcat (last, "*.*"); X X dirp->dd_loc = 0; X! dirp->dd_cp = (DIRCONT *) NULL; X! dirp->dd_contents = (DIRCONT *) NULL; X X if (_dos_findfirst (nbuf, ATTRIBUTES, &dtabuf) != 0) X { X*************** X*** 101,124 **** X X do X { X! if (((dp = (struct _dircontents *) malloc (sizeof (struct _dircontents))) == (struct _dircontents *) NULL) || X ((dp->_d_entry = strdup (dtabuf.name)) == (char *) NULL)) X { X if (dp != (char *)NULL) X! free ((char *) dp); X X free (nbuf); X free_dircontents (dirp->dd_contents); X return (DIR *) NULL; X } X X! if (dirp->dd_contents) X dirp->dd_cp = dirp->dd_cp->_d_next = dp; X X else X dirp->dd_contents = dirp->dd_cp = dp; X X! dp->_d_next = (struct _dircontents *) NULL; X X } while (_dos_findnext (&dtabuf) == 0); X X--- 102,125 ---- X X do X { X! if (((dp = (DIRCONT *) malloc (sizeof (DIRCONT))) == (DIRCONT *)NULL) || X ((dp->_d_entry = strdup (dtabuf.name)) == (char *) NULL)) X { X if (dp != (char *)NULL) X! free ((char *)dp); X X free (nbuf); X free_dircontents (dirp->dd_contents); X return (DIR *) NULL; X } X X! if (dirp->dd_contents != (DIRCONT *) NULL) X dirp->dd_cp = dirp->dd_cp->_d_next = dp; X X else X dirp->dd_contents = dirp->dd_cp = dp; X X! dp->_d_next = (DIRCONT *) NULL; X X } while (_dos_findnext (&dtabuf) == 0); X X*************** X*** 132,138 **** X DIR *dirp; X { X free_dircontents (dirp->dd_contents); X! free ((char *) dirp); X return 0; X } X X--- 133,139 ---- X DIR *dirp; X { X free_dircontents (dirp->dd_contents); X! free ((char *)dirp); X return 0; X } X X*************** X*** 141,147 **** X { X static struct dirent dp; X X! if (dirp->dd_cp == (struct _dircontents *) NULL) X return (struct dirent *) NULL; X X dp.d_reclen = strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry)); X--- 142,148 ---- X { X static struct dirent dp; X X! if (dirp->dd_cp == (DIRCONT *) NULL) X return (struct dirent *) NULL; X X dp.d_reclen = strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry)); X*************** X*** 163,175 **** X DIR *dirp; X off_t off; X { X! long i = off; X! struct _dircontents *dp; X X if (off < 0L) X return; X X! for (dp = dirp->dd_contents ; --i >= 0 && dp ; dp = dp->_d_next) X ; X X dirp->dd_loc = off - (i + 1); X--- 164,177 ---- X DIR *dirp; X off_t off; X { X! long i = off; X! DIRCONT *dp; X X if (off < 0L) X return; X X! for (dp = dirp->dd_contents; (--i >= 0) && (dp != (DIRCONT *)NULL); X! dp = dp->_d_next) X ; X X dirp->dd_loc = off - (i + 1); X*************** X*** 182,198 **** X return dirp->dd_loc; X } X X! static void free_dircontents(dp) X! struct _dircontents *dp; X { X! struct _dircontents *odp; X X! while (dp) X { X! if (dp->_d_entry) X! free(dp->_d_entry); X X! dp = (odp = dp)->_d_next; X! free((char *) odp); X } X } X--- 184,200 ---- X return dirp->dd_loc; X } X X! static void free_dircontents (dp) X! DIRCONT *dp; X { X! DIRCONT *odp; X X! while ((odp = dp) != (DIRCONT *)NULL) X { X! if (dp->_d_entry != (char *)NULL) X! free (dp->_d_entry); X X! dp = dp->_d_next; X! free ((char *)odp); X } X } XIndex: sh.1 XPrereq: 1.10 X*** ../sh16.2/sh.1 Tue May 1 20:02:16 1990 X--- sh.1 Fri Aug 17 21:31:41 1990 X*************** X*** 14,22 **** X .\" 2. The sources (or parts thereof) or objects generated from the sources X .\" (or parts of sources) cannot be sold under any circumstances. X .\" X! .\" $Header: sh.1 1.10 90/05/01 19:58:38 MS_user Exp $ X .\" X .\" $Log: sh.1 $ X .\" Revision 1.10 90/05/01 19:58:38 MS_user X .\" Fix typing error X .\" X--- 14,25 ---- X .\" 2. The sources (or parts thereof) or objects generated from the sources X .\" (or parts of sources) cannot be sold under any circumstances. X .\" X! .\" $Header: C:/SRC/SHELL/RCS/sh.1 1.11 90/08/14 23:17:25 Ian_Stewartson Exp $ X .\" X .\" $Log: sh.1 $ X+ .\" Revision 1.11 90/08/14 23:17:25 Ian_Stewartson X+ .\" Add IO read/write open X+ .\" X .\" Revision 1.10 90/05/01 19:58:38 MS_user X .\" Fix typing error X .\" X*************** X*** 487,492 **** X--- 490,499 ---- X \fB<\h@-.1m@&\h@-.1m@\-\fR X The standard input is closed. Similarly for the standard output using X \fB>\h@-.1m@&\h@-.1m@\-\fR. X+ .TP X+ \fBn<\h@-.3m@>word\fR X+ causes the file \fIword\fR to be opened on file descriptor \fIn\fR for both X+ reading and writing. The file must already exist. X .PD X .PP X If any of the above is preceded by a digit, the file descriptor which will be XIndex: shell/sh3.c XPrereq: 1.22 X*** ../sh16.2/shell/sh3.c Thu Jun 21 21:48:04 1990 X--- shell/sh3.c Fri Aug 17 21:34:34 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh3.c 1.22 90/06/21 11:10:47 MS_user Exp $ X * X * $Log: sh3.c $ X * Revision 1.22 90/06/21 11:10:47 MS_user X * Ensure Areanum is set correctly for memory areas X * X--- 13,28 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh3.c 1.24 90/08/16 10:28:47 Ian_Stewartson Exp $ X * X * $Log: sh3.c $ X+ * Revision 1.24 90/08/16 10:28:47 Ian_Stewartson X+ * Find setting of switch character for DOS4 for batch files X+ * X+ * Revision 1.23 90/08/14 23:34:09 MS_user X+ * Fix memory bugs - Copy function tree before execution X+ * Save Extended line file name correctly X+ * X * Revision 1.22 90/06/21 11:10:47 MS_user X * Ensure Areanum is set correctly for memory areas X * X*************** X*** 213,219 **** X Break_List = (Break_C *)NULL; X bc.nextlev = SShell_List; X SShell_List = &bc; X! rv = forkexec (t, pin, pout, act, wp); X } X X /* Restore the original environment */ X--- 220,226 ---- X Break_List = (Break_C *)NULL; X bc.nextlev = SShell_List; X SShell_List = &bc; X! rv = execute (t->left, pin, pout, act); X } X X /* Restore the original environment */ X*************** X*** 472,477 **** X--- 479,492 ---- X X if (t->type == TCOM) X { X+ X+ /* Malloc failed somewhere - given up */ X+ X+ if (wp == (char **)NULL) X+ return setstatus (-1); X+ X+ /* Skip over any assignments */ X+ X while ((cp = *wp++) != (char *)NULL) X ; X X*************** X*** 592,597 **** X--- 607,613 ---- X Break_C *s_SList = SShell_List; X int LS_depth = Execute_stack_depth; X Break_C bc; X+ C_Op *New; X X /* Set up $0..$n for the function */ X X*************** X*** 604,610 **** X Break_List = (Break_C *)NULL; X bc.nextlev = Return_List; X Return_List = &bc; X! rv = execute (fop->tree->left, NOPIPE, NOPIPE, FEXEC); X } X X /* A return has been executed - Unlike, while and for, we just need to X--- 620,627 ---- X Break_List = (Break_C *)NULL; X bc.nextlev = Return_List; X Return_List = &bc; X! New = Copy_Function (fop->tree->left); X! rv = execute (New, NOPIPE, NOPIPE, FEXEC); X } X X /* A return has been executed - Unlike, while and for, we just need to X*************** X*** 719,728 **** X cp = "here file"; X break; X X! case IOWRITE | IOCAT: /* >> */ X if (check_rsh (cp)) X return TRUE; X X if ((u = S_open (FALSE, cp, O_WRONLY | O_TEXT)) >= 0) X { X lseek (u, 0L, SEEK_END); X--- 736,752 ---- X cp = "here file"; X break; X X! case IOWRITE | IOREAD: /* <> */ X if (check_rsh (cp)) X return TRUE; X X+ u = S_open (FALSE, cp, O_RDWR); X+ break; X+ X+ case IOWRITE | IOCAT: /* >> */ X+ if (check_rsh (cp)) X+ return TRUE; X+ X if ((u = S_open (FALSE, cp, O_WRONLY | O_TEXT)) >= 0) X { X lseek (u, 0L, SEEK_END); X*************** X*** 946,952 **** X r.x.ax = 0x3700; X intdos (&r, &r); X X! if (r.h.al == 0) X *new_argv[1] = (char)(r.h.dl); X } X X--- 970,976 ---- X r.x.ax = 0x3700; X intdos (&r, &r); X X! if ((r.h.al == 0) && (_osmajor < 4)) X *new_argv[1] = (char)(r.h.dl); X } X X*************** X*** 1654,1660 **** X ((fd = S_open (FALSE, Extend_file = g_tempname (), O_CMASK, X 0600)) >= 0)) X { X! Extend_file = strsave (Extend_file, 0); X X /* Copy to end of list */ X X--- 1678,1686 ---- X ((fd = S_open (FALSE, Extend_file = g_tempname (), O_CMASK, X 0600)) >= 0)) X { X! if ((Extend_file = strsave (Extend_file, 0)) == null) X! Extend_file = (char *)NULL; X! X X /* Copy to end of list */ X XIndex: shell/sh4.c XPrereq: 1.7 X*** ../sh16.2/shell/sh4.c Thu Jun 21 21:48:52 1990 X--- shell/sh4.c Fri Aug 17 21:34:51 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh4.c 1.7 90/06/21 11:11:51 MS_user Exp $ X * X * $Log: sh4.c $ X * Revision 1.7 90/06/21 11:11:51 MS_user X * Ensure Areanum is set correctly for memory areas X * X--- 13,29 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh4.c 1.9 90/08/16 10:29:27 Ian_Stewartson Exp $ X * X * $Log: sh4.c $ X+ * Revision 1.9 90/08/16 10:29:27 Ian_Stewartson X+ * Add support from String length option in ${}. X+ * Restore the memcpys X+ * X+ * Revision 1.8 90/08/14 23:34:35 MS_user X+ * Fix memory bugs - ensure string copy is terminated X+ * Change some memcpys to local copy functions - don't know why. X+ * X * Revision 1.7 90/06/21 11:11:51 MS_user X * Ensure Areanum is set correctly for memory areas X * X*************** X*** 64,69 **** X--- 72,78 ---- X static Word_B *New_Elist; X static char *spcl = "[?*"; X static char *spcl1 = "\"'"; X+ static char *bad_subs = "sh: bad substitution\n"; X X static void globname (char *, char *); X static bool expand (char *, Word_B **, int); X*************** X*** 135,141 **** X { X register Word_B *wb = (Word_B *)NULL; X register Var_List *vp; X! char *cp, *sp; X int len = 0; X X for (vp = vlist; vp != (Var_List *)NULL; vp = vp->next) X--- 144,150 ---- X { X register Word_B *wb = (Word_B *)NULL; X register Var_List *vp; X! char *cp; X int len = 0; X X for (vp = vlist; vp != (Var_List *)NULL; vp = vp->next) X*************** X*** 410,415 **** X--- 419,425 ---- X register char *s, c, *cp; X Var_List *vp; X bool colon_f = FALSE; X+ bool hash_f = FALSE; X char *dol_special = "$ "; X X c = (char)readc (); X*************** X*** 429,435 **** X while (((c = (char)readc ()) != 0) && isalnum (c)) X { X if (e.linep < e.eline) X! *e.linep++ = c; X } X X unget(c); X--- 439,445 ---- X while (((c = (char)readc ()) != 0) && isalnum (c)) X { X if (e.linep < e.eline) X! *e.linep++ = c; X } X X unget(c); X*************** X*** 465,475 **** X return c; X } X X! /* Check for zero length string */ X X if (s == e.linep) X { X! print_error ("sh: bad substitution\n"); X gflg++; X return c; X } X--- 475,494 ---- X return c; X } X X! /* Check for Hash at start */ X X+ if ((*s == '#') && ((s - e.linep) > 1)) X+ { X+ hash_f = TRUE; X+ memcpy (s, s + 1, e.linep - s - 1); X+ --e.linep; X+ } X+ X+ /* Check for zero length string */ X+ X if (s == e.linep) X { X! print_error (bad_subs); X gflg++; X return c; X } X*************** X*** 513,528 **** X } X } X X! /* Check for * and @ processing */ X X if (s[1] == 0 && (*s == '*' || *s == '@')) X { X if (dolc > 1) X { X e.linep = s; X! PUSHIO (awordlist, dolv + 1, dol_char); X! e.iop->dflag = (char)(!quoted ? DSA_NULL X! : ((*s == '*') ? DSA_STAR : DSA_AMP)); X return 0; X } X X--- 532,575 ---- X } X } X X! /* Cannot have both # & : */ X X+ if (hash_f && colon_f) X+ { X+ print_error (bad_subs); X+ gflg++; X+ return c; X+ } X+ X+ /* Check for * and @ processing */ X+ X if (s[1] == 0 && (*s == '*' || *s == '@')) X { X if (dolc > 1) X { X e.linep = s; X! X! /* If hash flag set, convert to string length */ X! X! if (hash_f) X! { X! int slen, n; X! X! for (n = 1, slen = 0; dolv[n] != (char *)NULL; X! slen += (strlen (dolv[n++]) + 1)); X! X! dolp = strsave (putn (slen - 1), areanum); X! PUSHIO (aword, dolp, quoted ? qstrchar : strchar); X! } X! X! else X! { X! PUSHIO (awordlist, dolv + 1, dol_char); X! e.iop->dflag = (char)(!quoted ? DSA_NULL X! : ((*s == '*') ? DSA_STAR X! : DSA_AMP)); X! } X! X return 0; X } X X*************** X*** 592,597 **** X--- 639,649 ---- X gflg++; X } X X+ /* If hash flag set, convert to string length */ X+ X+ if (hash_f) X+ dolp = strsave (putn (strlen (dolp)), areanum); X+ X e.linep = s; X PUSHIO (aword, dolp, quoted ? qstrchar : strchar); X return 0; X*************** X*** 821,834 **** X for (i = 0; i < C_EList->w_nword; i++) X unquote (C_EList->w_words[i]); X X- qsort (C_EList->w_words, C_EList->w_nword, sizeof (char *), sort_compare); X- X /* Did we find any files matching the specification. Yes - add them to X * the block X */ X X if (C_EList->w_nword) X { X for (i = 0; i < C_EList->w_nword; i++) X wb = addword (C_EList->w_words[i], wb); X X--- 873,887 ---- X for (i = 0; i < C_EList->w_nword; i++) X unquote (C_EList->w_words[i]); X X /* Did we find any files matching the specification. Yes - add them to X * the block X */ X X if (C_EList->w_nword) X { X+ qsort (C_EList->w_words, C_EList->w_nword, sizeof (char *), X+ sort_compare); X+ X for (i = 0; i < C_EList->w_nword; i++) X wb = addword (C_EList->w_words[i], wb); X X*************** X*** 852,858 **** X { X register char *np, *cp; X char *name, *gp, *dp; X- DIR *dn; X struct dirent *d_ce; X char dname[NAME_MAX + 1]; X struct stat dbuf; X--- 905,910 ---- X*************** X*** 889,895 **** X X /* Open the directory */ X X! if ((dn = opendir (dp)) == (DIR *)NULL) X { X DELETE (dp); X DELETE (gp); X--- 941,947 ---- X X /* Open the directory */ X X! if ((e.cdir = opendir (dp)) == (DIR *)NULL) X { X DELETE (dp); X DELETE (gp); X*************** X*** 898,908 **** X X /* Scan for matches */ X X! while ((d_ce = readdir (dn)) != (struct dirent *)NULL) X { X! if ((*(strcpy (dname, d_ce->d_name)) == '.') && (*gp != '.')) X continue; X X for (cp = dname; *cp; cp++) X { X if (any (*cp, spcl)) X--- 950,961 ---- X X /* Scan for matches */ X X! while ((d_ce = readdir (e.cdir)) != (struct dirent *)NULL) X { X! if ((*(strncpy (dname, d_ce->d_name, NAME_MAX)) == '.') && (*gp != '.')) X continue; X X+ dname[NAME_MAX] = 0; X for (cp = dname; *cp; cp++) X { X if (any (*cp, spcl)) X*************** X*** 935,941 **** X } X } X X! closedir (dn); X DELETE (dp); X DELETE (gp); X } X--- 988,995 ---- X } X } X X! closedir (e.cdir); X! e.cdir = (DIR *)NULL; X DELETE (dp); X DELETE (gp); X } X*************** X*** 1034,1055 **** X register Word_B *wb; X { X register char **wd; X! register nb; X X /* If the word block is empty or does not exist, return no list */ X X if (wb == (Word_B **)NULL) X return (char *)NULL; X X! if (wb->w_nword == 0) X { X DELETE (wb); X return (char *)NULL; X } X- X- /* Get some space for the array and set it up */ X- X- wd = (char **)space (nb = sizeof (char *) * wb->w_nword); X X memcpy ((char *)wd, (char *)wb->w_words, nb); X DELETE (wb); /* perhaps should done by caller */ X--- 1088,1108 ---- X register Word_B *wb; X { X register char **wd; X! register int nb; X X /* If the word block is empty or does not exist, return no list */ X X if (wb == (Word_B **)NULL) X return (char *)NULL; X X! /* Get some space for the array and set it up */ X! X! if (((nb = sizeof (char *) * wb->w_nword) == 0) || X! ((wd = (char **)space (nb)) == (char **)NULL)) X { X DELETE (wb); X return (char *)NULL; X } X X memcpy ((char *)wd, (char *)wb->w_words, nb); X DELETE (wb); /* perhaps should done by caller */ XIndex: shell/sh5.c XPrereq: 1.9 X*** ../sh16.2/shell/sh5.c Thu Jun 21 21:49:29 1990 X--- shell/sh5.c Fri Aug 17 21:35:07 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh5.c 1.9 90/05/11 18:45:40 MS_user Exp $ X * X * $Log: sh5.c $ X * Revision 1.9 90/05/11 18:45:40 MS_user X * Fix problem when at end of buffer on re-load from file X * X--- 13,24 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh5.c 1.10 90/08/14 23:30:47 Ian_Stewartson Exp $ X * X * $Log: sh5.c $ X+ * Revision 1.10 90/08/14 23:30:47 Ian_Stewartson X+ * Changes to env structure. X+ * X * Revision 1.9 90/05/11 18:45:40 MS_user X * Fix problem when at end of buffer on re-load from file X * X*************** X*** 58,63 **** X--- 61,67 ---- X #include <fcntl.h> X #include <io.h> X #include <limits.h> X+ #include <dirent.h> X #include <unistd.h> X #include "sh.h" X XIndex: shell/sh6.c XPrereq: 1.13 X*** ../sh16.2/shell/sh6.c Thu Jun 21 21:49:38 1990 X--- shell/sh6.c Fri Aug 17 21:35:10 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh6.c 1.13 90/05/15 21:10:19 MS_user Exp $ X * X * $Log: sh6.c $ X * Revision 1.13 90/05/15 21:10:19 MS_user X * Release 1.6.2 X * X--- 13,24 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh6.c 1.14 90/08/14 23:34:49 MS_user Exp $ X * X * $Log: sh6.c $ X+ * Revision 1.14 90/08/14 23:34:49 MS_user X+ * Changed for release 1.6.3 X+ * X * Revision 1.13 90/05/15 21:10:19 MS_user X * Release 1.6.2 X * X*************** X*** 65,75 **** X #include <setjmp.h> X #include <stdlib.h> X #include <limits.h> X #include <unistd.h> X #include <string.h> X #include "sh.h" X X! static char *Copy_Right1 = "MS-DOS SH Version 1.6.2 - %s (DOS %d.%d)\n"; X static char *Copy_Right2 = "Copyright (c) Data Logic Ltd and Charles Forsyth 1990\n"; X char **dolv; /* Parameter array */ X int dolc; /* Number of entries in parameter array */ X--- 68,79 ---- X #include <setjmp.h> X #include <stdlib.h> X #include <limits.h> X+ #include <dirent.h> X #include <unistd.h> X #include <string.h> X #include "sh.h" X X! static char *Copy_Right1 = "MS-DOS SH Version 1.6.3 - %s (DOS %d.%d)\n"; X static char *Copy_Right2 = "Copyright (c) Data Logic Ltd and Charles Forsyth 1990\n"; X char **dolv; /* Parameter array */ X int dolc; /* Number of entries in parameter array */ X*************** X*** 151,156 **** X--- 155,161 ---- X (int *)NULL, X FALSE, /* End of file processing */ X FDBASE, /* Base file handler */ X+ (DIR *)NULL, /* Currently open directory */ X (Environ *)NULL /* Previous Env pointer */ X }; X XIndex: shell/sh7.c XPrereq: 1.17 X*** ../sh16.2/shell/sh7.c Thu Jun 21 21:50:36 1990 X--- shell/sh7.c Fri Aug 17 21:35:57 1990 X*************** X*** 15,23 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh7.c 1.17 90/05/31 09:50:05 MS_user Exp $ X * X * $Log: sh7.c $ X * Revision 1.17 90/05/31 09:50:05 MS_user X * Implement partial write when swapping to disk X * X--- 15,27 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh7.c 1.18 90/08/14 23:34:55 MS_user Exp $ X * X * $Log: sh7.c $ X+ * Revision 1.18 90/08/14 23:34:55 MS_user X+ * Fix directory display on change directory X+ * Fix spelling mistake. X+ * X * Revision 1.17 90/05/31 09:50:05 MS_user X * Implement partial write when swapping to disk X * X*************** X*** 88,93 **** X--- 92,98 ---- X #include <stdlib.h> X #include <fcntl.h> X #include <limits.h> X+ #include <dirent.h> X #include <stdarg.h> X #include "sh.h" X X*************** X*** 1026,1032 **** X X Getcwd (); X X! if (first || (strchr (p, '/') != (char *)NULL)) X dopwd (t); X X return 0; X--- 1031,1037 ---- X X Getcwd (); X X! if (first) X dopwd (t); X X return 0; X*************** X*** 1756,1762 **** X #endif X X /* X! * Type fucntion: For each name, indicate how it would be interpreted X */ X X static char *type_ext[] = { X--- 1761,1767 ---- X #endif X X /* X! * Type function: For each name, indicate how it would be interpreted X */ X X static char *type_ext[] = { X*************** X*** 1789,1794 **** X--- 1794,1805 ---- X X while ((cp = t->words[n++]) != (char *)NULL) X { X+ if (inbuilt (cp)) X+ { X+ v1_puts (cp); X+ v1a_puts (" is a shell internal command"); X+ continue; X+ } X X /* Check for a function */ X X*************** X*** 1844,1849 **** X--- 1855,1861 ---- X (stricmp (xp, ".bat") != 0)) X continue; X X+ Convert_Backslashes (strlwr (l_path)); X print_error ("%s is %s\n", cp, l_path); X found = TRUE; X } XIndex: shell/sh8.c XPrereq: 1.11 X*** ../sh16.2/shell/sh8.c Thu Jun 21 21:51:03 1990 X--- shell/sh8.c Fri Aug 17 21:35:41 1990 X*************** X*** 12,20 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh8.c 1.11 90/06/21 11:12:13 MS_user Exp $ X * X * $Log: sh8.c $ X * Revision 1.11 90/06/21 11:12:13 MS_user X * Ensure Areanum is set correctly for memory areas X * X--- 12,23 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh8.c 1.12 90/08/14 23:31:08 Ian_Stewartson Exp $ X * X * $Log: sh8.c $ X+ * Revision 1.12 90/08/14 23:31:08 Ian_Stewartson X+ * Changes to env structure. X+ * X * Revision 1.11 90/06/21 11:12:13 MS_user X * Ensure Areanum is set correctly for memory areas X * X*************** X*** 64,69 **** X--- 67,73 ---- X #include <string.h> X #include <unistd.h> X #include <limits.h> X+ #include <dirent.h> X #include <ctype.h> X #include "sh.h" X XIndex: shell/sh9.c XPrereq: 1.12 X*** ../sh16.2/shell/sh9.c Thu Jun 21 21:51:46 1990 X--- shell/sh9.c Fri Aug 17 21:36:02 1990 X*************** X*** 12,18 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh9.c 1.12 90/05/31 10:39:26 MS_user Exp $ X * X * $Log: sh9.c $ X * Revision 1.12 90/05/31 10:39:26 MS_user X--- 12,18 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh9.c 1.12 90/05/31 10:39:26 MS_user Exp $ X * X * $Log: sh9.c $ X * Revision 1.12 90/05/31 10:39:26 MS_user XIndex: shell/makefile XPrereq: 1.3 X*** ../sh16.2/shell/makefile Thu Jun 21 21:43:10 1990 X--- shell/makefile Fri Aug 17 21:33:08 1990 X*************** X*** 8,16 **** X # source form. X # X # X! # $Header: makefile 1.3 90/01/18 15:41:48 MS_user Locked $ X # X # $Log: makefile $ X # Revision 1.3 90/01/18 15:41:48 MS_user X # ANother change for new make X # X--- 8,25 ---- X # source form. X # X # X! # $Header: C:/SRC/SHELL/RCS/makefile 1.6 90/08/16 12:21:40 Ian_Stewartson Exp $ X # X # $Log: makefile $ X+ # Revision 1.6 90/08/16 12:21:40 Ian_Stewartson X+ # Remove command on sh6.obj line X+ # X+ # Revision 1.5 90/08/15 01:42:32 MS_user X+ # Remove local directory functions X+ # X+ # Revision 1.4 90/08/15 01:16:36 MS_user X+ # Add stack command X+ # X # Revision 1.3 90/01/18 15:41:48 MS_user X # ANother change for new make X # X*************** X*** 22,28 **** X # X # X X! ASFLAGS= /Ml /Zi /Zd X X OBJS=sh0.obj sh1.obj sh2.obj sh3.obj sh4.obj sh5.obj sh6.obj \ X sh7.obj sh8.obj sh9.obj sh10.obj X--- 31,37 ---- X # X # X X! ASFLAGS= /Ml X X OBJS=sh0.obj sh1.obj sh2.obj sh3.obj sh4.obj sh5.obj sh6.obj \ X sh7.obj sh8.obj sh9.obj sh10.obj X*************** X*** 34,38 **** X sh6.obj: $(SRCS) X X sh.exe: $(OBJS) X! link sh0+sh1+sh2+sh3+sh4+sh5+sh6+sh7+sh8+sh9+sh10/co/noi, sh.exe\; X! link sh0+sh1+sh2+sh3+sh4+sh5+sh6+sh7+sh8+sh9+sh10/noi, nd_sh.exe\; X--- 43,47 ---- X sh6.obj: $(SRCS) X X sh.exe: $(OBJS) X! link sh0+sh1+sh2+sh3+sh4+sh5+sh6+sh7+sh8+sh9+sh10/co/noi/stack:0x2000, sh.exe\; X! link sh0+sh1+sh2+sh3+sh4+sh5+sh6+sh7+sh8+sh9+sh10/noi/stack:0x2000, nd_sh.exe\; XIndex: shell/sh.h XPrereq: 1.20 X*** ../sh16.2/shell/sh.h Thu Jun 21 21:43:37 1990 X--- shell/sh.h Fri Aug 17 21:33:20 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh.h 1.20 90/05/31 09:47:41 MS_user Exp $ X * X * $Log: sh.h $ X * Revision 1.20 90/05/31 09:47:41 MS_user X * Implement partial write when swapping to disk X * X--- 13,26 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh.h 1.21 90/08/14 23:54:44 MS_user Exp $ X * X * $Log: sh.h $ X+ * Revision 1.21 90/08/14 23:54:44 MS_user X+ * Add addition value to env structure X+ * Add some new publics X+ * Update patchlevel X+ * X * Revision 1.20 90/05/31 09:47:41 MS_user X * Implement partial write when swapping to disk X * X*************** X*** 80,86 **** X * X */ X X! #define PATCHLEVEL 6 X #define LINE_MAX 1000 /* Command line length */ X #define HISTORY_MAX 100 /* History array length */ X /* Space for full file name */ X--- 85,91 ---- X * X */ X X! #define PATCHLEVEL 7 X #define LINE_MAX 1000 /* Command line length */ X #define HISTORY_MAX 100 /* History array length */ X /* Space for full file name */ X*************** X*** 327,332 **** X--- 332,338 ---- X int *errpt; X bool eof_p; /* EOF processing enabled */ X int iofd; X+ DIR *cdir; /* Currently open directory */ X struct env *oenv; /* Previous environment */ X } Environ; X X*************** X*** 622,627 **** X--- 628,635 ---- X extern void Print_Version (int); X extern bool anys (char *, char *); X extern void Clear_Swap_File (void); X+ extern C_Op *Copy_Function (C_Op *); X+ extern void Convert_Backslashes (char *); X X /* X * Interrupt handling XIndex: shell/sh0.asm XPrereq: 1.10 X*** ../sh16.2/shell/sh0.asm Thu Jun 21 21:45:35 1990 X--- shell/sh0.asm Fri Aug 17 21:33:41 1990 X*************** X*** 16,22 **** X ; 2. The sources (or parts thereof) or objects generated from the sources X ; (or parts of sources) cannot be sold under any circumstances. X ; X! ; $Header: sh0.asm 1.10 90/05/31 17:46:31 MS_user Exp $ X ; X ; $Log: sh0.asm $ X ; Revision 1.10 90/05/31 17:46:31 MS_user X--- 16,22 ---- X ; 2. The sources (or parts thereof) or objects generated from the sources X ; (or parts of sources) cannot be sold under any circumstances. X ; X! ; $Header: C:/SRC/SHELL/RCS/sh0.asm 1.10 90/05/31 17:46:31 MS_user Exp $ X ; X ; $Log: sh0.asm $ X ; Revision 1.10 90/05/31 17:46:31 MS_user XIndex: shell/sh1.c XPrereq: 1.16 X*** ../sh16.2/shell/sh1.c Thu Jun 21 21:46:25 1990 X--- shell/sh1.c Fri Aug 17 21:32:33 1990 X*************** X*** 13,21 **** X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: sh1.c 1.16 90/05/31 09:48:06 MS_user Exp $ X * X * $Log: sh1.c $ X * Revision 1.16 90/05/31 09:48:06 MS_user X * Implement partial write when swapping to disk X * Add some signal lockouts to prevent corruption X--- 13,25 ---- X * 2. The sources (or parts thereof) or objects generated from the sources X * (or parts of sources) cannot be sold under any circumstances. X * X! * $Header: C:/SRC/SHELL/RCS/sh1.c 1.17 90/08/14 23:32:53 MS_user Exp $ X * X * $Log: sh1.c $ X+ * Revision 1.17 90/08/14 23:32:53 MS_user X+ * Fix memory bugs - Add malloc checking functions for debug X+ * Make Convert_Backslashes public X+ * X * Revision 1.16 90/05/31 09:48:06 MS_user X * Implement partial write when swapping to disk X * Add some signal lockouts to prevent corruption X*************** X*** 83,88 **** X--- 87,93 ---- X #include <ctype.h> X #include <fcntl.h> X #include <limits.h> X+ #include <dirent.h> X #include <dos.h> X #include <time.h> X #include "sh.h" X*************** X*** 92,98 **** X--- 97,119 ---- X * without having to know about it. X */ X X+ #undef CHECK_MALLOC X+ X+ #ifdef CHECK_MALLOC X+ #define MAGIC1 0xd8a5 X+ #define MAGIC2 0xa5d8 X+ static void sh_free (void *); X+ static void sh_chkmem (char *, char *, size_t, bool); X+ #define SH_FREE sh_free X+ #else X+ #define SH_FREE free X+ #endif X+ X typedef struct region { X+ #ifdef CHECK_MALLOC X+ unsigned int magic1; X+ unsigned int len; X+ #endif X struct region *next; X int area; X } s_region; X*************** X*** 125,131 **** X static void Check_Mail (void); X static void Pre_Process_Argv (char **); X static void Load_G_VL (void); X- static void Convert_Backslashes (char *); X static void Load_profiles (void); X static void U2D_Path (void); X X--- 146,151 ---- X*************** X*** 530,540 **** X char *fmt; X { X va_list ap; X- char x[100]; X X va_start (ap, fmt); X! vsprintf (x, fmt, ap); X! S_puts (x); X exstat = -1; X X /* If leave on error - exit */ X--- 550,558 ---- X char *fmt; X { X va_list ap; X X va_start (ap, fmt); X! vfprintf (stderr, fmt, ap); X exstat = -1; X X /* If leave on error - exit */ X*************** X*** 553,565 **** X char *fmt; X { X va_list ap; X- char x[100]; X X /* Error message processing */ X X va_start (ap, fmt); X! vsprintf (x, fmt, ap); X! S_puts (x); X exstat = -1; X X if (FL_TEST ('e')) X--- 571,581 ---- X char *fmt; X { X va_list ap; X X /* Error message processing */ X X va_start (ap, fmt); X! vfprintf (stderr, fmt, ap); X exstat = -1; X X if (FL_TEST ('e')) X*************** X*** 636,641 **** X--- 652,665 ---- X X if ((ep = e.oenv) != (Environ *)NULL) X { X+ X+ /* Close any open directories */ X+ X+ if (e.cdir != (DIR *)NULL) X+ closedir (e.cdir); X+ X+ /* Get the files used in this environment to close */ X+ X fd = e.iofd; X e = *ep; X X*************** X*** 1269,1290 **** X * Get a string in a malloced area X */ X X! char *getcell(nbytes) X unsigned int nbytes; X { X s_region *np; X void (*save_signal)(int); X X if (nbytes == 0) X abort (); /* silly and defeats the algorithm */ X X /* Grab some space */ X X! if ((np = (s_region *)calloc (nbytes + sizeof (s_region), 1)) == (s_region *)NULL) X! return (char *)NULL; X X! /* Disable signals */ X X save_signal = signal (SIGINT, SIG_IGN); X X /* Link into chain */ SHAR_EOF echo "End of part 1" echo "File Patch1.6.3 is continued in part 2" echo "2" > @shar_seq_.tmp exit 0