home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-01-19 | 37.7 KB | 1,394 lines |
- Index: Notes1.6
- *** ../sh16.3/Notes1.6 Fri Aug 17 21:29:59 1990
- --- Notes1.6 Tue Nov 6 20:47:31 1990
- ***************
- *** 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
- --- 1,4 ----
- ! Version 1.6.4 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
- ***************
- *** 41,47 ****
- 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:
-
- 1. /dev/tty and /dev/null are mapped to /dev/con and /dev/nul internally
- --- 41,48 ----
- 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.
- ! 22. A bug in the function code that caused case functions to hang
- ! has been fixed.
- The following enhancements have been made:
-
- 1. /dev/tty and /dev/null are mapped to /dev/con and /dev/nul internally
- ***************
- *** 78,83 ****
- --- 79,87 ----
- 20. The POSIX variable substitution command ${#name} to give the
- string length has been implemented.
- 21. The POSIX I/O option <> has been implemented.
- + 22. The POSIX I/O options ${#*%} and ~ have been implemented.
- + 23. The builtin command command has been implemented.
- + 24. The source for stdargv.c has been modified to work under OS/2
-
- The following enhancements/bugs remain outstanding:
-
- ***************
- *** 93,98 ****
- --- 97,108 ----
- processing of escape characters. The shell uses the 8-bit to
- mark escaped characters (Release 1.7).
-
- + 3. Interrupting a disk swap at the wrong time may cause the shell to
- + hang. I've tried disabling Control-Break during disk read/writes
- + but this only causes the shell to hang on re-load every time in
- + some environments. In the next release, I'm going to put in some
- + checks and issue re-read/writes when necessary.
- +
- Thanks are due to
-
- Greg Yachuk
- ***************
- *** 101,106 ****
- --- 111,117 ----
- John B Thiel
- Harry McGavran
- Bill Davidsen
- + Richard J Reiner
-
- for their comments, fixes, tolerance etc in testing release 1.6
-
- Index: lib/stdargv.c
- *** ../sh16.3/lib/stdargv.c Fri Mar 2 11:34:58 1990
- --- lib/stdargv.c Tue Nov 6 20:52:05 1990
- ***************
- *** 18,25 ****
- * This function replaces the standard MS-DOS command
- * line processing function (_setargv in stdargv.obj).
- *
- ! * CALLING SEQUENCE: The following calling sequences are used:
- *
- * void _setargv ();
- *
- * ERROR MESSAGES: Out of memory
- --- 18,27 ----
- * This function replaces the standard MS-DOS command
- * line processing function (_setargv in stdargv.obj).
- *
- ! * Support for OS2 added. Compile with -DOS2
- *
- + * CALLING SEQUENCE: The following calling sequences are used:
- + *
- * void _setargv ();
- *
- * ERROR MESSAGES: Out of memory
- ***************
- *** 32,45 ****
- #include <stdio.h> /* Standard I/O delarations */
- #include <stdlib.h> /* Standard library functions */
- #include <errno.h> /* Error number declarations */
- #include <dos.h> /* DOS functions declarations */
- #include <bios.h> /* BIOS functions declarations */
- #include <ctype.h> /* Character type declarations */
- #include <string.h> /* String library functions */
- #include <limits.h> /* String library functions */
- #include <fcntl.h> /* File Control Declarations */
- - #include <io.h> /* Input/Output Declarations */
- #include <dirent.h> /* Direction I/O functions */
-
- /*
- * DATA DEFINITIONS:
- --- 34,51 ----
- #include <stdio.h> /* Standard I/O delarations */
- #include <stdlib.h> /* Standard library functions */
- #include <errno.h> /* Error number declarations */
- + #ifdef OS2
- + #include <os2.h> /* OS2 functions declarations */
- + #else
- #include <dos.h> /* DOS functions declarations */
- #include <bios.h> /* BIOS functions declarations */
- + #endif
- #include <ctype.h> /* Character type declarations */
- #include <string.h> /* String library functions */
- #include <limits.h> /* String library functions */
- #include <fcntl.h> /* File Control Declarations */
- #include <dirent.h> /* Direction I/O functions */
- + #include <unistd.h>
-
- /*
- * DATA DEFINITIONS:
- ***************
- *** 65,76 ****
- --- 71,90 ----
- static void ex_fatal (int, char *, char *); /* Fatal error processing*/
- static char *ex_environment (char *); /* Process environment */
- static char *_ex_multi_drive (char *); /* Check for multidrive */
- + static int N_floppy_disks (void);
- static char *ex_nomem = "%s: %s\n";
-
- extern char far *_pgmptr; /* Program name */
- extern char **__argv; /* Current argument address */
- extern int __argc; /* Current argument count */
-
- + #ifdef OS2
- + static void _dos_setdrive (unsigned int, unsigned int *);
- + static void _dos_getdrive (unsigned int *);
- + extern ushort _aenvseg; /* Environment seg */
- + extern ushort _acmdln; /* Command line offset */
- + #endif
- +
- /*
- * MODULE ABSTRACT: _setargv
- *
- ***************
- *** 79,92 ****
-
- void _setargv ()
- {
- /* Set up pointer to command line */
- char far *argvp = (char far *)((((long)_psp) << 16) + 0x081L);
- unsigned int envs = *(int far *)((((long)_psp) << 16) + 0x02cL);
- char far *s; /* Temporary string pointer */
- ! #ifndef M_I86LM
- char buf[MAX_LINE]; /* Temporary space */
- char *cp;
- ! #endif
-
- /* Command line can be null or 0x0d terminated - convert to null */
-
- --- 93,131 ----
-
- void _setargv ()
- {
- + #ifdef OS2
- + char far *argvp = (char far *)((((long)_aenvseg) << 16));
- + ushort off = _acmdln;
- +
- + while (--off)
- + {
- + if (argvp[off - 1] == 0)
- + break;
- + }
- +
- + /* Add program name */
- +
- + _pgmptr = &argvp[off];
- +
- + if (argvp[_acmdln] == 0)
- + ex_add_arg (ex_tounix (_pgmptr)); /* Add the program name */
- +
- + else
- + {
- + argvp += _acmdln;
- + ex_add_arg (ex_tounix (argvp)); /* Add the program name */
- + argvp += strlen (argvp) + 1;
- + exp_line (argvp);
- + }
- + #else
- /* Set up pointer to command line */
- char far *argvp = (char far *)((((long)_psp) << 16) + 0x081L);
- unsigned int envs = *(int far *)((((long)_psp) << 16) + 0x02cL);
- char far *s; /* Temporary string pointer */
- ! # ifndef M_I86LM
- char buf[MAX_LINE]; /* Temporary space */
- char *cp;
- ! # endif
-
- /* Command line can be null or 0x0d terminated - convert to null */
-
- ***************
- *** 123,129 ****
-
- _pgmptr = s;
-
- ! #ifndef M_I86LM
- cp = buf;
- while (*(cp++) = *(s++));
-
- --- 162,168 ----
-
- _pgmptr = s;
-
- ! # ifndef M_I86LM
- cp = buf;
- while (*(cp++) = *(s++));
-
- ***************
- *** 134,142 ****
- while (*(cp++) = *(s++));
-
- exp_line (buf);
- ! #else
- ex_add_arg (ex_tounix (s)); /* Add the program name */
- exp_line (argvp);
- #endif
-
- ex_add_arg ((char *)NULL);
- --- 173,182 ----
- while (*(cp++) = *(s++));
-
- exp_line (buf);
- ! # else
- ex_add_arg (ex_tounix (s)); /* Add the program name */
- exp_line (argvp);
- + # endif
- #endif
-
- ex_add_arg ((char *)NULL);
- ***************
- *** 262,268 ****
-
- /* Check to see if the second diskette drive is really there */
-
- ! if (((_bios_equiplist () & 0x00c0) == 0x0000) && (s_drive == 2))
- continue;
-
- /* If the drive exists and is in our list - process it */
- --- 302,308 ----
-
- /* Check to see if the second diskette drive is really there */
-
- ! if ((N_floppy_disks () < 2) && (s_drive == 2))
- continue;
-
- /* If the drive exists and is in our list - process it */
- ***************
- *** 619,623 ****
- --- 659,703 ----
- }
-
- return (*prefix && (*(prefix + 1) == ':')) ? prefix + 1 : (char *)NULL;
- + }
- +
- + /* Some OS/2 functions to emulate the DOS functions */
- +
- + #ifdef OS2
- + static void _dos_getdrive (cdp)
- + unsigned int *cdp;
- + {
- + USHORT cdr;
- + ULONG ndr;
- +
- + DosQCurDisk((PUSHORT)&cdr, (PULONG) &ndr);
- + *cdp = (unsigned int)cdr;
- + }
- +
- + static void _dos_setdrive (cdr, ndp)
- + unsigned int cdr;
- + unsigned int *ndp;
- + {
- + USHORT dummy;
- + ULONG ndr;
- +
- + DosQCurDisk((PUSHORT)&dummy, (PULONG) &ndr);
- + *ndp = (unsigned int)ndr;
- +
- + DosSelectDisk ((USHORT)cdr);
- + }
- + #endif
- +
- + /* Return the number of floppy disks */
- +
- + static int N_floppy_disks ()
- + {
- + #ifdef OS2
- + BYTE nflop = 1;
- + DosDevConfig (&nflop, 2, 0);
- + return nflop;
- + #else
- + return ((_bios_equiplist () & 0x00c0) >> 6) + 1;
- + #endif
- }
- #endif
- Index: sh.1
- Prereq: 1.11
- *** ../sh16.3/sh.1 Fri Aug 17 21:31:41 1990
- --- sh.1 Tue Nov 6 20:11:17 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: 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
- .\"
- --- 14,26 ----
- .\" 2. The sources (or parts thereof) or objects generated from the sources
- .\" (or parts of sources) cannot be sold under any circumstances.
- .\"
- ! .\" $Header: D:/SRC/SHELL/RCS/sh.1 1.12 90/11/06 20:08:46 Ian_Stewartson Exp $
- .\"
- .\" $Log: sh.1 $
- + .\" Revision 1.12 90/11/06 20:08:46 Ian_Stewartson
- + .\" Add POSIX options {#%*} and ~
- + .\" Add builtin command
- + .\"
- .\" Revision 1.11 90/08/14 23:17:25 Ian_Stewartson
- .\" Add IO read/write open
- .\"
- ***************
- *** 163,172 ****
- .SS Comments
- A word beginning with \fB#\fR causes that word and all the following
- characters up to a new-line to be ignored.
- .SS Command Substitution
- ! The standard output from a command enclosed in a pair of grave accents
- ! (\fB\(ga\(ga\fR) may be used as part or all of a word; trailing new-lines
- ! are removed.
- .SS Parameter Substitution
- The character \fB$\fR is used to introduce substitutable \fIparameters\fR.
- There are two types of parameters, positional and keyword. If \fIparameter\fR
- --- 167,179 ----
- .SS Comments
- A word beginning with \fB#\fR causes that word and all the following
- characters up to a new-line to be ignored.
- + .SS Tilde Substitution
- + Each word is checked to see if it begins with an unquoted\fB~\fR. If it is,
- + the \fB~\fR is replaced by the value of the \fBHOME\fR parameter.
- .SS Command Substitution
- ! The standard output from a command enclosed in parenthesis preceded by a
- ! dollar sign (\fB$()\fR), or in a pair of grave accents (\fB\(ga\(ga\fR) may
- ! be used as part or all of a word; trailing new-lines are removed.
- .SS Parameter Substitution
- The character \fB$\fR is used to introduce substitutable \fIparameters\fR.
- There are two types of parameters, positional and keyword. If \fIparameter\fR
- ***************
- *** 184,196 ****
- .PD 0
- .TP
- \fB${\fIparameter\fB}\fR
- ! The value, if any, of the parameter is substituted. The braces are required
- ! only when \fIparameter\fR is followed by a letter, digit, or underscore that
- ! is not to be interpreted as part of its name. If \fIparameter\fR is
- ! \fB*\fR or \fB@\fR, all the positional parameters, starting with \fB$1\fR,
- ! are substituted (separated by spaces). Parameter \fB$0\fR is set from argument
- ! zero when the shell is invoked.
- .TP
- \fB${\fIparameter\fB:-\fIword\fB}\fR
- If \fIparameter\fR is set and is non-null, substitute its value; otherwise
- substitute \fIword\fR.
- --- 191,208 ----
- .PD 0
- .TP
- \fB${\fIparameter\fB}\fR
- ! The value, if any, of the \fIparameter\fR is substituted. The braces are
- ! required only when \fIparameter\fR is followed by a letter, digit, or
- ! underscore that is not to be interpreted as part of its name. If
- ! \fIparameter\fR is \fB*\fR or \fB@\fR, all the positional parameters, starting
- ! with \fB$1\fR, are substituted (separated by spaces). Parameter \fB$0\fR is
- ! set from argument zero when the shell is invoked.
- .TP
- + \fB${#\fIparameter\fB}\fR
- + If \fIparameter\fR is \fB*\fR or \fB@\fR, the number of positional parameters
- + is substituted. Otherwise, the length of the value of the \fIparameter\fR is
- + substituted.
- + .TP
- \fB${\fIparameter\fB:-\fIword\fB}\fR
- If \fIparameter\fR is set and is non-null, substitute its value; otherwise
- substitute \fIword\fR.
- ***************
- *** 208,213 ****
- --- 220,242 ----
- \fB${\fIparameter\fB:+\fIword\fB}\fR
- If \fIparameter\fR is set and is non-null, substitute \fIword\fR; otherwise
- substitute nothing.
- + .TP
- + \fB${\fIparameter\fB#\fIpattern\fB}\fR
- + \fB${\fIparameter\fB##\fIpattern\fB}\fR
- + If the Shell \fIpattern\fR matches the beginning of the value of
- + \fIparameter\fR, then the value of this substitution is the value of the
- + \fIparameter\fR with the matched portion deleted; otherwise the value of
- + this \fIparameter\fR is substituted. In the first form the smallest matching
- + \fIpattern\fR is deleted and in the latter form the largest matching
- + \fIpattern\fR is deleted.
- + .TP
- + \fB${\fIparameter\fB%\fIpattern\fB}\fR
- + \fB${\fIparameter\fB%%\fIpattern\fB}\fR
- + If the Shell \fIpattern\fR matches the end of the value of \fIparameter\fR,
- + then the value of this substitution is the value of the \fIparameter\fR with
- + the matched portion deleted; otherwise the value of this \fIparameter\fR is
- + substituted. In the first form the smallest matching \fIpattern\fR is deleted
- + and in the latter form the largest matching \fIpattern\fR is deleted.
- .PD
- .PP
- In the above, \fIword\fR is not evaluated unless it is to be used as the
- ***************
- *** 830,835 ****
- --- 859,886 ----
- Exit from the enclosing \fBfor\fR or \fBwhile\fR loop, if any. If \fIn\fR is
- specified, break \fIn\fR levels.
- .TP
- + \fBbuiltin\fR \*(OK \fIargs\fR ... \*(CK
- + Force the selection of the \fBbuiltin\fR version of a command. The builtin
- + shell command selected by the first \fIargs\fR value is executed with the
- + parameters defined by the remaining \fIargs\fRs. If no arguments are given,
- + a list of all \fIbuiltin\fR commands is printed.
- + .sp
- + If the first argument is one of the following, the processing of the
- + builtin command in the following arguments are changed as indicated:
- + .RS
- + .TP
- + \fB-a\fR
- + Set the following builtin commands to use builtin version in preference to
- + any function or external versions.
- + .TP
- + \fB-d\fR
- + Set the following builtin commands to use the function or external version
- + in preference to the builtin version.
- + .TP
- + \fB-s\fR
- + Display the current status of the following builtin commands.
- + .RE
- + .TP
- \fBcontinue\fR \*(OK \fIn\fR \*(CK
- Resume the next iteration of the enclosing \fBfor\fR or \fBwhile\fR loop. If
- \fIn\fR is specified, resume at the \fIn\fR-th enclosing loop.
- ***************
- *** 986,992 ****
- \fBmsdos\fR \*(OK \fIname\fR ... \*(CK
- The given \fIname\fRs are marked \fImsdos\fR format and if the \fB-m\fR flag
- is set, the values of the these \fIname\fRs are exported to child processes
- ! with any slashes in the value replaced by backslashes.
- .TP
- \fBpwd\fR
- Print the current working directory.
- --- 1037,1044 ----
- \fBmsdos\fR \*(OK \fIname\fR ... \*(CK
- The given \fIname\fRs are marked \fImsdos\fR format and if the \fB-m\fR flag
- is set, the values of the these \fIname\fRs are exported to child processes
- ! with any slashes in the value replaced by backslashes. If no arguments are
- ! given, a list of all \fImsdos\fR names is printed.
- .TP
- \fBpwd\fR
- Print the current working directory.
- Index: shell/sh.h
- Prereq: 1.21
- *** ../sh16.3/shell/sh.h Fri Aug 17 21:33:20 1990
- --- shell/sh.h Tue Nov 6 19:18:37 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: 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
- --- 13,27 ----
- * 2. The sources (or parts thereof) or objects generated from the sources
- * (or parts of sources) cannot be sold under any circumstances.
- *
- ! * $Header: D:/SRC/SHELL/RCS/sh.h 1.23 90/09/19 15:29:54 Ian_Stewartson Exp $
- *
- * $Log: sh.h $
- + * Revision 1.23 90/09/19 15:29:54 Ian_Stewartson
- + * Allow builtin commands to selected/de-selected
- + *
- + * Revision 1.22 90/08/24 21:53:13 Ian_Stewartson
- + * Add support for POSIX macro command {x#y} and {x%y}
- + *
- * Revision 1.21 90/08/14 23:54:44 MS_user
- * Add addition value to env structure
- * Add some new publics
- ***************
- *** 85,91 ****
- *
- */
-
- ! #define PATCHLEVEL 7
- #define LINE_MAX 1000 /* Command line length */
- #define HISTORY_MAX 100 /* History array length */
- /* Space for full file name */
- --- 91,97 ----
- *
- */
-
- ! #define PATCHLEVEL 8
- #define LINE_MAX 1000 /* Command line length */
- #define HISTORY_MAX 100 /* History array length */
- /* Space for full file name */
- ***************
- *** 168,179 ****
- struct builtin {
- char *command;
- int (*fn)(C_Op *);
- };
-
- /*
- ! * actions determining the environment of a process
- */
-
- #define FEXEC 0x0001 /* execute without forking */
-
- /* MSDOS Memory Control Block chain structure */
- --- 174,193 ----
- struct builtin {
- char *command;
- int (*fn)(C_Op *);
- + int mode;
- };
-
- /*
- ! * Valid values of mode
- */
-
- + #define BLT_ALWAYS 0x0001 /* Always use builtin version */
- + #define BLT_CURRENT 0x0002 /* Currently use builtin version */
- +
- + /*
- + * actions determining the environment of a process
- + */
- +
- #define FEXEC 0x0001 /* execute without forking */
-
- /* MSDOS Memory Control Block chain structure */
- ***************
- *** 376,384 ****
- /* depth */
-
- /*
- ! * Variable list
- */
-
- typedef struct var {
- char *value; /* Value */
- char *name; /* Name */
- --- 390,407 ----
- /* depth */
-
- /*
- ! * Mode values for new gmatch
- */
-
- + #define GM_ALL 0 /* Match full string */
- + #define GM_SHORTEST 1 /* Shortest prefix/suffix */
- + #define GM_LONGEST 2 /* Longest prefix/suffix */
- +
- + /*
- + /*
- + * Variable list
- + */
- +
- typedef struct var {
- char *value; /* Value */
- char *name; /* Name */
- ***************
- *** 531,537 ****
- extern void s_vstatus (Var_List *, int);
- extern bool isassign (char *);
- extern bool assign (char *, int);
- ! extern bool gmatch (char *, char *, bool);
- extern char *getcell (unsigned int);
- extern void freecell (char *);
- extern void freearea (int);
- --- 554,561 ----
- extern void s_vstatus (Var_List *, int);
- extern bool isassign (char *);
- extern bool assign (char *, int);
- ! extern bool gmatch (char *, char *, bool, char **, int);
- ! extern bool gmatch_suffix (char *, char *, bool, char **, int);
- extern char *getcell (unsigned int);
- extern void freecell (char *);
- extern void freearea (int);
- ***************
- *** 574,580 ****
- extern void put_prompt (char *);
- extern bool eqname (char *, char *);
- extern bool any (char, char *);
- ! extern int (*inbuilt (char *))();
- extern char *path_append (char *, char *, char *);
- extern void unset (char *, bool);
- extern int S_open (bool, char *, int, ...);
- --- 598,604 ----
- extern void put_prompt (char *);
- extern bool eqname (char *, char *);
- extern bool any (char, char *);
- ! extern int (*inbuilt (char *, bool *))();
- extern char *path_append (char *, char *, char *);
- extern void unset (char *, bool);
- extern int S_open (bool, char *, int, ...);
- Index: shell/sh0.asm
- Prereq: 1.10
- *** ../sh16.3/shell/sh0.asm Fri Aug 17 21:33:41 1990
- --- shell/sh0.asm Tue Nov 6 19:19:30 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: 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
- --- 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: D:/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.17
- *** ../sh16.3/shell/sh1.c Fri Aug 17 21:32:33 1990
- --- shell/sh1.c Tue Nov 6 19:20:30 1990
- ***************
- *** 13,77 ****
- * 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
- ! *
- * Revision 1.15 90/05/15 21:08:59 MS_user
- * Restore original directory on exit
- ! *
- * Revision 1.14 90/04/25 22:33:28 MS_user
- * Fix rsh check for PATH
- ! *
- * Revision 1.13 90/04/25 09:18:12 MS_user
- * Change version message processing
- ! *
- * Revision 1.12 90/04/04 11:32:12 MS_user
- * Change MAILPATH to use a semi-colon and not a colon for DOS
- ! *
- * Revision 1.11 90/04/03 17:58:35 MS_user
- * Stop shell exit from lowest level CLI
- ! *
- * Revision 1.10 90/03/27 20:24:49 MS_user
- * Fix problem with Interrupts not restoring std??? and clearing extended file
- ! *
- * Revision 1.9 90/03/26 20:56:13 MS_user
- * Change I/O restore so that "exec >filename" works
- ! *
- * Revision 1.8 90/03/26 04:30:14 MS_user
- * Remove original Interrupt 24 save address
- ! *
- * Revision 1.7 90/03/12 20:16:22 MS_user
- * Save program name for Initialisation file processing
- ! *
- * Revision 1.6 90/03/09 16:05:33 MS_user
- * Add build file name function and change the profile check to use it
- ! *
- * Revision 1.5 90/03/06 16:49:14 MS_user
- * Add disable history option
- ! *
- * Revision 1.4 90/03/06 15:09:27 MS_user
- * Add Unix PATH variable conversion
- ! *
- * Revision 1.3 90/03/05 13:47:45 MS_user
- * Get /etc/profile and profile order rigth
- * Use $HOME/profile and not profile
- * Check cursor position before outputing prompt
- * Move some of processing in main to sub-routines
- ! *
- * Revision 1.2 90/02/14 04:46:20 MS_user
- * Add Interrupt 24 processing
- ! *
- * Revision 1.1 90/01/25 13:40:39 MS_user
- * Initial revision
- ! *
- */
-
- #include <sys/types.h>
- --- 13,83 ----
- * 2. The sources (or parts thereof) or objects generated from the sources
- * (or parts of sources) cannot be sold under any circumstances.
- *
- ! * $Header: D:/SRC/SHELL/RCS/sh1.c 1.19 90/11/06 19:13:39 Ian_Stewartson Exp $
- *
- * $Log: sh1.c $
- + * Revision 1.19 90/11/06 19:13:39 Ian_Stewartson
- + * Add deletion of swap file on interrupt
- + *
- + * Revision 1.18 90/08/24 21:54:05 Ian_Stewartson
- + * Add support for POSIX macro command {x#y} and {x%y}
- + *
- * 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
- ! *
- * Revision 1.15 90/05/15 21:08:59 MS_user
- * Restore original directory on exit
- ! *
- * Revision 1.14 90/04/25 22:33:28 MS_user
- * Fix rsh check for PATH
- ! *
- * Revision 1.13 90/04/25 09:18:12 MS_user
- * Change version message processing
- ! *
- * Revision 1.12 90/04/04 11:32:12 MS_user
- * Change MAILPATH to use a semi-colon and not a colon for DOS
- ! *
- * Revision 1.11 90/04/03 17:58:35 MS_user
- * Stop shell exit from lowest level CLI
- ! *
- * Revision 1.10 90/03/27 20:24:49 MS_user
- * Fix problem with Interrupts not restoring std??? and clearing extended file
- ! *
- * Revision 1.9 90/03/26 20:56:13 MS_user
- * Change I/O restore so that "exec >filename" works
- ! *
- * Revision 1.8 90/03/26 04:30:14 MS_user
- * Remove original Interrupt 24 save address
- ! *
- * Revision 1.7 90/03/12 20:16:22 MS_user
- * Save program name for Initialisation file processing
- ! *
- * Revision 1.6 90/03/09 16:05:33 MS_user
- * Add build file name function and change the profile check to use it
- ! *
- * Revision 1.5 90/03/06 16:49:14 MS_user
- * Add disable history option
- ! *
- * Revision 1.4 90/03/06 15:09:27 MS_user
- * Add Unix PATH variable conversion
- ! *
- * Revision 1.3 90/03/05 13:47:45 MS_user
- * Get /etc/profile and profile order rigth
- * Use $HOME/profile and not profile
- * Check cursor position before outputing prompt
- * Move some of processing in main to sub-routines
- ! *
- * Revision 1.2 90/02/14 04:46:20 MS_user
- * Add Interrupt 24 processing
- ! *
- * Revision 1.1 90/01/25 13:40:39 MS_user
- * Initial revision
- ! *
- */
-
- #include <sys/types.h>
- ***************
- *** 528,534 ****
-
- Clear_Swap_File ();
-
- ! /* If this is a command only - restore the directory because DOS doesn't
- * and the user might expect it
- */
-
- --- 534,540 ----
-
- Clear_Swap_File ();
-
- ! /* If this is a command only - restore the directory because DOS doesn't
- * and the user might expect it
- */
-
- ***************
- *** 713,720 ****
- signal (SIGINT, onintr);
- SW_intr = 1;
-
- ! /* Are we talking to the user? Yes - check in parser */
-
- if (talking)
- {
- if (inparse)
- --- 719,731 ----
- signal (SIGINT, onintr);
- SW_intr = 1;
-
- ! /* Zap the swap file, just in case it got corrupted */
-
- + S_close (SW_fp, TRUE);
- + Clear_Swap_File ();
- +
- + /* Are we talking to the user? Yes - check in parser */
- +
- if (talking)
- {
- if (inparse)
- ***************
- *** 775,782 ****
- --- 786,800 ----
- register int i;
- {
- if (i == SIGINT) /* Need this because swapper sets it */
- + {
- SW_intr = 0;
-
- + /* Zap the swap file, just in case it got corrupted */
- +
- + S_close (SW_fp, TRUE);
- + Clear_Swap_File ();
- + }
- +
- trapset = i;
- signal (i, sig);
- }
- ***************
- *** 1185,1298 ****
- }
-
- /*
- ! * Match a pattern as in sh(1).
- */
-
- ! bool gmatch (s, p, IgnoreCase)
- ! register char *s, *p;
- bool IgnoreCase;
- {
- ! register int sc, pc;
-
- ! if ((s == (char *)NULL) || (p == (char *)NULL))
- return FALSE;
-
- ! while ((pc = *(p++) & CMASK) != '\0')
- {
- ! sc = *(s++) & QMASK;
-
- ! switch (pc)
- {
- case '[': /* Class expression */
- ! if ((p = cclass (p, sc, IgnoreCase)) == (char *)NULL)
- return FALSE;
-
- break;
-
- case '?': /* Match any character */
- ! if (sc == 0)
- return FALSE;
-
- break;
-
- case '*': /* Match as many as possible */
- ! s--;
- do
- {
- ! if (!*p || gmatch (s, p, IgnoreCase))
- ! return TRUE;
-
- ! } while (*(s++));
-
- ! return FALSE;
-
- default:
- if (IgnoreCase)
- {
- ! sc = tolower (sc);
- ! pc = tolower ((pc & ~QUOTE));
- }
-
- ! if (sc != (pc & ~QUOTE))
- return FALSE;
- }
- }
-
- ! return (*s == 0) ? TRUE : FALSE;
- ! }
-
- /*
- * Process a class expression - []
- */
-
- ! static char *cclass (p, sub, IgnoreCase)
- ! register char *p;
- ! register int sub;
- bool IgnoreCase;
- {
- ! register int c, d, not, found;
-
- /* Exclusive or inclusive class */
-
- ! if ((not = *p == NOT) != 0)
- ! p++;
-
- found = not;
-
- do
- {
- ! if (!*p)
- return (char *)NULL;
-
- /* Get the next character in class, converting to lower case if necessary */
-
- ! c = IgnoreCase ? tolower ((*p & CMASK)) : (*p & CMASK);
-
- /* If this is a range, get the end of range character */
-
- ! if ((*(p + 1) == '-') && (*(p + 2) != ']'))
- {
- ! d = IgnoreCase ? tolower ((*(p + 2) & CMASK)) : (*(p + 2) & CMASK);
- ! p++;
- }
-
- else
- ! d = c;
-
- /* Is the current character in the class? */
-
- ! if ((c <= sub) && (sub <= d))
- found = !not;
-
- ! } while (*(++p) != ']');
-
- ! return found ? p + 1 : (char *)NULL;
- }
-
- /*
- ! * Get a string in a malloced area
- */
-
- char *getcell (nbytes)
- unsigned int nbytes;
- {
- --- 1203,1381 ----
- }
-
- /*
- ! * Match a pattern as in sh(1). Enhancement to handle prefix processing
- ! *
- ! * IgnoreCase - ignore case on comparisions.
- ! * end - end of match in 'string'.
- ! * mode - mode for match processing - see GM_ flags in sh.h
- */
-
- ! bool gmatch (string, pattern, IgnoreCase, end, mode)
- ! register char *string, *pattern;
- bool IgnoreCase;
- + char **end;
- + int mode;
- {
- ! register int string_c, pattern_c;
- ! char *save_end;
-
- ! if ((string == (char *)NULL) || (pattern == (char *)NULL))
- return FALSE;
-
- ! while ((pattern_c = *(pattern++) & CMASK) != '\0')
- {
- ! string_c = *(string++) & QMASK;
-
- ! switch (pattern_c)
- {
- case '[': /* Class expression */
- ! if ((pattern = cclass (pattern, string_c, IgnoreCase)) == (char *)NULL)
- return FALSE;
-
- break;
-
- case '?': /* Match any character */
- ! if (string_c == 0)
- return FALSE;
-
- break;
-
- case '*': /* Match as many as possible */
- ! --string;
- ! save_end = (char *)NULL;
- !
- do
- {
- ! if (!*pattern ||
- ! gmatch (string, pattern, IgnoreCase, end, mode))
- ! {
- ! if (mode == GM_LONGEST)
- ! save_end = *end;
-
- ! else
- ! return TRUE;
- ! }
-
- ! } while (*(string++));
-
- + if (end != (char **)NULL)
- + *end = save_end;
- +
- + return (save_end == (char *)NULL) ? FALSE : TRUE;
- +
- default:
- if (IgnoreCase)
- {
- ! string_c = tolower (string_c);
- ! pattern_c = tolower ((pattern_c & ~QUOTE));
- }
-
- ! if (string_c != (pattern_c & ~QUOTE))
- return FALSE;
- }
- }
-
- ! if (end != (char **)NULL)
- ! {
- ! *end = string;
- ! return TRUE;
- ! }
-
- + return (*string == 0) ? TRUE : FALSE;
- + }
- +
- /*
- * Process a class expression - []
- */
-
- ! static char *cclass (pattern, string_c, IgnoreCase)
- ! register char *pattern;
- ! register int string_c;
- bool IgnoreCase;
- {
- ! register int llimit_c, ulimit_c, not, found;
-
- /* Exclusive or inclusive class */
-
- ! if ((not = *pattern == NOT) != 0)
- ! pattern++;
-
- found = not;
-
- do
- {
- ! if (!*pattern)
- return (char *)NULL;
-
- /* Get the next character in class, converting to lower case if necessary */
-
- ! llimit_c = IgnoreCase ? tolower ((*pattern & CMASK))
- ! : (*pattern & CMASK);
-
- /* If this is a range, get the end of range character */
-
- ! if ((*(pattern + 1) == '-') && (*(pattern + 2) != ']'))
- {
- ! ulimit_c = IgnoreCase ? tolower ((*(pattern + 2) & CMASK))
- ! : (*(pattern + 2) & CMASK);
- ! pattern++;
- }
-
- else
- ! ulimit_c = llimit_c;
-
- /* Is the current character in the class? */
-
- ! if ((llimit_c <= string_c) && (string_c <= ulimit_c))
- found = !not;
-
- ! } while (*(++pattern) != ']');
-
- ! return found ? pattern + 1 : (char *)NULL;
- }
-
- /*
- ! * Suffix processing - find the longest/shortest suffix.
- */
-
- + bool gmatch_suffix (string, pattern, IgnoreCase, start, mode)
- + register char *string, *pattern;
- + bool IgnoreCase;
- + char **start;
- + int mode;
- + {
- + char *save_start = (char *)NULL;
- +
- + /* Scan the string, looking for a match to the end */
- +
- + while (*string)
- + {
- + if (gmatch (string, pattern, IgnoreCase, (char **)NULL, GM_ALL))
- + {
- +
- + /* If longest, stop here */
- +
- + if (mode == GM_LONGEST)
- + {
- + *start = string;
- + return TRUE;
- + }
- +
- + /* Save the start of the shortest string so far and continue */
- +
- + save_start = string;
- + }
- +
- + ++string;
- + }
- +
- + return ((*start = save_start) == (char *)NULL) ? FALSE : TRUE;
- + }
- +
- + /*
- + * Get a string in a malloced area
- + */
- +
- char *getcell (nbytes)
- unsigned int nbytes;
- {
- ***************
- *** 1323,1329 ****
- print_warn ("Malloc access to bad segment\n");
- return (char *)NULL;
- }
- !
- np->magic1 = MAGIC1;
- np->len = nbytes;
- rp = (char *)(np + 1);
- --- 1406,1412 ----
- print_warn ("Malloc access to bad segment\n");
- return (char *)NULL;
- }
- !
- np->magic1 = MAGIC1;
- np->len = nbytes;
- rp = (char *)(np + 1);
- ***************
- *** 1362,1370 ****
- /* Disable signals */
-
- save_signal = signal (SIGINT, SIG_IGN);
- -
- - /* Find the string in the chain */
-
- if (s != (char *)NULL)
- {
- while (cp != (s_region *)NULL)
- --- 1445,1453 ----
- /* Disable signals */
-
- save_signal = signal (SIGINT, SIG_IGN);
-
- + /* Find the string in the chain */
- +
- if (s != (char *)NULL)
- {
- while (cp != (s_region *)NULL)
- ***************
- *** 2012,2018 ****
- str1++;
- str2++;
- }
- !
- return rtn;
- }
-
- --- 2095,2101 ----
- str1++;
- str2++;
- }
- !
- return rtn;
- }
-
- ***************
- *** 2064,2074 ****
-
- while (--len >= 0)
- {
- ! if ((*(str1++) = *(str2++)) == 0)
- {
- while (--len >= 0)
- *(str1++) = 0;
- !
- break;
- }
- }
- --- 2147,2157 ----
-
- while (--len >= 0)
- {
- ! if ((*(str1++) = *(str2++)) == 0)
- {
- while (--len >= 0)
- *(str1++) = 0;
- !
- break;
- }
- }
- Index: shell/sh3.c
- Prereq: 1.24
- *** ../sh16.3/shell/sh3.c Fri Aug 17 21:34:34 1990
- --- shell/sh3.c Tue Nov 6 19:21:26 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: 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
- *
- --- 13,32 ----
- * 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.27 90/09/19 15:30:31 Ian_Stewartson Exp $
- *
- * $Log: sh3.c $
- + * Revision 1.27 90/09/19 15:30:31 Ian_Stewartson
- + * Allow builtin commands to selected/de-selected
- + *
- + * Revision 1.26 90/09/11 20:06:11 Ian_Stewartson
- + * Add support for buitlin command, including the alway builtin functions
- + * Change search order to match POSIX
- + *
- + * Revision 1.25 90/08/24 21:55:00 Ian_Stewartson
- + * Change processing order (function, external, internal) to conform to
- + * POSIX. Update to gmatch for macro command changes
- + *
- * Revision 1.24 90/08/16 10:28:47 Ian_Stewartson
- * Find setting of switch character for DOS4 for batch files
- *
- ***************
- *** 144,149 ****
- --- 155,161 ----
- static char *AE2big = "arg/env list too big";
- static char *EMS_emsg = "Warning: EMS Error (%x)\n";
- static char *XMS_emsg = "Warning: XMS Error (%x)\n";
- + static char *EF_msg = "%s: %s\n";
- /* Extended Command line processing file name */
- static char *Extend_file = (char *)NULL;
- static char *Swap_File = (char *)NULL; /* Swap file */
- ***************
- *** 475,481 ****
- --- 487,495 ----
- void (*sig_int)();
- char **owp = wp;
- bool spawn = FALSE;
- + bool builtin = FALSE;
- Fun_Ops *fop;
- + int i;
-
- if (t->type == TCOM)
- {
- ***************
- *** 510,522 ****
- /* Check for built in commands */
-
- else if (cp != (char *)NULL)
- ! shcom = inbuilt (cp);
- }
-
- /* Unix fork simulation? */
-
- t->words = wp;
- ! if (shcom == NULL && (act & FEXEC) == 0)
- {
- spawn = TRUE;
-
- --- 524,536 ----
- /* Check for built in commands */
-
- else if (cp != (char *)NULL)
- ! shcom = inbuilt (cp, &builtin);
- }
-
- /* Unix fork simulation? */
-
- t->words = wp;
- ! if ((act & FEXEC) == 0)
- {
- spawn = TRUE;
-
- ***************
- *** 534,540 ****
-
- while (((cp = *owp++) != (char *)NULL) && assign (cp, COPYV))
- {
- ! if (shcom == NULL)
- s_vstatus (lookup (cp, TRUE), EXPORT);
- }
-
- --- 548,554 ----
-
- while (((cp = *owp++) != (char *)NULL) && assign (cp, COPYV))
- {
- ! if (shcom == (int (*)())NULL)
- s_vstatus (lookup (cp, TRUE), EXPORT);
- }
-
- ***************
- *** 565,572 ****
- }
- }
-
- - if (shcom)
- - return restore_std (setstatus ((*shcom)(t)), TRUE);
-
- /* All fids above 10 are autoclosed in the exec file because we have used
- * the O_NOINHERIT flag. Note I patched open.obj to pass this flag to the
- --- 579,584 ----
- ***************
- *** 598,604 ****
- * in some processing for return.
- */
-
- ! if ((fop = Fun_Search (wp[0])) != (Fun_Ops *)NULL)
- {
- char **s_dolv = dolv;
- int s_dolc = dolc;
- --- 610,616 ----
- * in some processing for return.
- */
-
- ! if (!builtin && (fop = Fun_Search (wp[0])) != (Fun_Ops *)NULL)
- {
- char **s_dolv = dolv;
- int s_dolc = dolc;
- ***************
- *** 651,659 ****
-
- /* Ok - execute the program */
-
- ! return restore_std (rexecve (wp[0], wp, makenv (), spawn), TRUE);
- ! }
-
- /*
- * Restore Local Environment
- */
- --- 663,685 ----
-
- /* Ok - execute the program */
-
- ! if (!builtin)
- ! rv = rexecve (wp[0], wp, makenv (), spawn);
-
- + /* If we didn't find it, check for internal command */
- +
- + if (builtin || ((rv == -1) && (errno == ENOENT)))
- + {
- + if (shcom != (int (*)())NULL)
- + rv = setstatus ((*shcom)(t));
- +
- + else
- + print_warn (EF_msg, wp[0], "not found");
- + }
- +
- + return restore_std (rv, TRUE);
- + }
- +
- /*
- * Restore Local Environment
- */
- ***************
- *** 835,841 ****
-
- for (wp = t1->words; *wp != (char *)NULL;)
-