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