From decwrl!sdd.hp.com!cs.utexas.edu!uunet!allbery Mon May 7 07:37:02 PDT 1990 Article 1498 of comp.sources.misc: Path: decwrl!sdd.hp.com!cs.utexas.edu!uunet!allbery From: istewart@datlog.co.uk Newsgroups: comp.sources.misc Subject: v12i019: MS_SH 1.6 Upgrade Kit - Part 01 of 08 Message-ID: <87521@uunet.UU.NET> Date: 5 May 90 17:05:32 GMT Sender: allbery@uunet.UU.NET Lines: 1450 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Posting-number: Volume 12, Issue 19 Submitted-by: istewart@datlog.co.uk Archive-name: ms_sh-1.6/part01 This is the upgrade kit to release 1.6 of the MSDOS Shell from version 1.4. It comes in eight (8) parts. It contains the patches to convert from 1.5 to 1.6. It also contains the patches and release notes for 1.5 (the patches originally appeared in comp.sources.bugs, but I saw a posting which commented that offical patches should also appear the the source group to which the source was orginally posted - so here they are). There are three additional files which appear in 1.6: ms_dio.2 (man pages for the ms_dio functions); Patch.Lib (how to patch the MSC C library open function); and scripts/sh.ini (a sample initialisation file for the shell). The release 1.6 changes are descripted in the file Notes1.6. Unshar the postings in order in the top level directory of your shell sources. Then apply the patch (or patches) as necessary using: patch -p < Patch1.5 # If appropriate to get 1.5 patch -p < Patch1.6 # If appropriate to get 1.6 The binaries are being posted to comp.binaries.ibm.pc in the near future. 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 #!/bin/sh # shar: Shell Archiver (v1.23) # # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files. # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # The following text will create: # Patch1.5 # Patch1.6 # Notes1.6 # Notes1.5 # Patch.Lib # ms_dio.2 # scripts/sh.ini # if test -r s2_seq_.tmp then echo "Must unpack archives in sequence!" next=`cat s2_seq_.tmp`; echo "Please unpack part $next next" exit 1; fi echo "x - extracting Patch1.5 (Text)" sed 's/^X//' << 'SHAR_EOF' > Patch1.5 && XIndex: ReadMe XPrereq: 1.1 X*** ../sh14/ReadMe Mon Feb 19 14:13:41 1990 X--- ReadMe Fri Feb 16 19:07:39 1990 X*************** X*** 1,4 **** X! MS-DOS Shell Version 1.4 README January 1990 X X MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited and Charles Forsyth X X--- 1,4 ---- X! MS-DOS Shell Version 1.5 README February 1990 X X MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited and Charles Forsyth X 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: readme 1.1 90/01/25 13:43:20 MS_user Exp $ X X $Log: readme $ X! # Revision 1.1 90/01/25 13:43:20 MS_user X! # Initial revision X! # X ________________________________________________________________________________ X X This is an implementation of the Unix Shell for MSDOS. As far as X--- 13,30 ---- 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.3 90/02/16 16:58:10 MS_user Exp $ X X $Log: readme $ X! Revision 1.3 90/02/16 16:58:10 MS_user X! Set up 1.5 release X! X! Revision 1.2 90/02/14 04:53:20 MS_user X! Interrupt 24 note X! X! Revision 1.1 90/01/25 13:43:20 MS_user X! Initial revision X! X ________________________________________________________________________________ X X This is an implementation of the Unix Shell for MSDOS. As far as X*************** X*** 76,81 **** X--- 82,91 ---- X X 7) Wild cards on drives (ie echo *:*.c will echo all the C files in X the current directories of each drive) are supported. X+ X+ 8) Interrupt 24 processing has been added. X+ X+ The shell was built using MS-DOS C and MASM v5.1 in large model mode. X X In order to rebuild this program, you need the DIRECTORY(3) functions X for MSDOS (also included) and the version of open in your library must XIndex: sh.1 XPrereq: 1.1 X*** ../sh14/sh.1 Mon Feb 19 14:24:22 1990 X--- sh.1 Fri Feb 16 19:07:02 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.1 1.1 90/01/24 14:17:00 MS_user Locked $ X .\" X .\" $Log: sh.1 $ X .\" Revision 1.1 90/01/24 14:17:00 MS_user X .\" Initial revision 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: sh.1 1.2 90/02/16 16:58:27 MS_user Exp $ X .\" X .\" $Log: sh.1 $ X+ .\" Revision 1.2 90/02/16 16:58:27 MS_user X+ .\" Set up 1.5 release X+ .\" X .\" Revision 1.1 90/01/24 14:17:00 MS_user X .\" Initial revision X .\" X*************** X*** 23,29 **** X .\" X .ds OK [\| X .ds CK \|] X! .TH SH 1L "Data Logic Limited" "MS-DOS Version 1.4" X .SH NAME X sh, rsh - shell, the standard/restricted command programming language X .SH SYNOPSIS X--- 26,32 ---- X .\" X .ds OK [\| X .ds CK \|] X! .TH SH 1L "Data Logic Limited" "MS-DOS Version 1.5" X .SH NAME X sh, rsh - shell, the standard/restricted command programming language X .SH SYNOPSIS XIndex: sh.h XPrereq: 1.1 X*** ../sh14/sh.h Mon Feb 19 16:47:24 1990 X--- sh.h Fri Feb 16 19:03:36 1990 X*************** X*** 13,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: sh.h 1.1 90/01/29 17:46:51 MS_user Exp $ X * X * $Log: sh.h $ X * Revision 1.1 90/01/29 17:46:51 MS_user X * Initial revision X * X * X */ X X #define LINE_MAX 1000 /* Command line length */ X #define HISTORY_MAX 100 /* History array length */ X /* Space for full file name */ X--- 13,34 ---- 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.3 90/02/16 16:58:48 MS_user Exp $ X * X * $Log: sh.h $ X+ * Revision 1.3 90/02/16 16:58:48 MS_user X+ * Set up 1.5 release X+ * X+ * Revision 1.2 90/02/14 04:45:33 MS_user X+ * Add Interrupt 24 processing and clean up interrupt 0 and 23 processing X+ * X * Revision 1.1 90/01/29 17:46:51 MS_user X * Initial revision X * X * X */ X X+ #define PATCHLEVEL 1 X #define LINE_MAX 1000 /* Command line length */ X #define HISTORY_MAX 100 /* History array length */ X /* Space for full file name */ X*************** X*** 124,133 **** X extern unsigned int SW_intr; /* interrupt pending */ X extern unsigned int SW_Blocks; /* Number of blocks to read */ X extern int SW_fp; /* File or EMS Handler */ X- extern unsigned int SW_I0_V_BX; /* Out interrupt Zero address */ X- extern unsigned int SW_I0_V_ES; X- extern unsigned int SW_I23_V_ES; /* Our Interrupt 23 address */ X- extern unsigned int SW_I23_V_BX; X extern unsigned long SW_EMstart; /* Start addr of extend mem */ X extern unsigned int SW_Mode; /* Type of swapping to do */ X /* 1 - disk */ X--- 131,136 ---- X*************** X*** 523,525 **** X--- 526,537 ---- X extern void Restore_Environment (int, int); X extern int sort_compare (char **, char **); X extern int Check_Script (char *); X+ X+ /* X+ * Interrupt handling X+ */ X+ X+ extern void interrupt SW_Int24 (void); /* Int 24 New address */ X+ extern void (interrupt far *SW_I24_V) (void); /* Old address */ X+ extern void (interrupt far *SW_I0_V) (void); /* Int 0 address */ X+ extern void (interrupt far *SW_I23_V) (void); /* Int 23 address */ XIndex: sh0.asm XPrereq: 1.1 X*** ../sh14/sh0.asm Mon Feb 19 16:46:08 1990 X--- sh0.asm Fri Feb 16 19:13:56 1990 X*************** X*** 18,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: sh0.asm 1.1 90/01/25 13:43:36 MS_user Exp $ X ; X ; $Log: sh0.asm $ X ; Revision 1.1 90/01/25 13:43:36 MS_user X ; Initial revision X ; X--- 18,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: sh0.asm 1.2 90/02/14 04:45:58 MS_user Exp $ X ; X ; $Log: sh0.asm $ X+ ; Revision 1.2 90/02/14 04:45:58 MS_user X+ ; Add Interrupt 24 processing and clean up interrupt 0 and 23 processing X+ ; X ; Revision 1.1 90/01/25 13:43:36 MS_user X ; Initial revision X ; X*************** X*** 67,88 **** X public _SW_intr X public _SW_Blocks X public _SW_fp X! public _SW_I0_V_BX X! public _SW_I0_V_ES X! public _SW_I23_V_ES X! public _SW_I23_V_BX X public _SW_EMstart X public _SW_Mode X public _SW_EMSFrame X X _cmd_line db 129 dup (?) ; Command line X _path_line db 80 dup (?) ; Path line X _SW_Blocks dw 0 ; Number of blocks to read/write X _SW_fp dw 0 ; File ID X! _SW_I23_V_ES dw 0 ; Interrupt 23 address X! _SW_I23_V_BX dw 0 X! _SW_I0_V_BX dw 0 ; Our Interrupt zero value X! _SW_I0_V_ES dw 0 X _SW_EMstart dd 0100000H ; Default Extended Mem start X _SW_Mode dw 0 ; Type of swapping to do X ; 1 - disk X--- 70,90 ---- X public _SW_intr X public _SW_Blocks X public _SW_fp X! public _SW_I0_V X! public _SW_I23_V X! public _SW_I24_V X public _SW_EMstart X public _SW_Mode X public _SW_EMSFrame X+ public _SW_Int24 X X _cmd_line db 129 dup (?) ; Command line X _path_line db 80 dup (?) ; Path line X _SW_Blocks dw 0 ; Number of blocks to read/write X _SW_fp dw 0 ; File ID X! _SW_I0_V dd 0 ; Our Interrupt Zero address X! _SW_I23_V dd 0 ; Our Interrupt 23 address X! _SW_I24_V dd 0 ; Original Interrupt 24 address X _SW_EMstart dd 0100000H ; Default Extended Mem start X _SW_Mode dw 0 ; Type of swapping to do X ; 1 - disk X*************** X*** 91,97 **** X _SW_EMSFrame dw 0 ; EMS Frame segment X _SW_intr dw 0 ; Interrupt 23 detected. X X- X ; X ; Some addition variables X ; X--- 93,98 ---- X*************** X*** 514,520 **** X ; Check for interrupt 23 detected X ; X mov ax, word ptr cs:_SW_intr X! xor ax, ax X jz $I23_Cf ; No - continue; X X ; X--- 515,521 ---- X ; Check for interrupt 23 detected X ; X mov ax, word ptr cs:_SW_intr X! or ax, ax X jz $I23_Cf ; No - continue; X X ; X*************** X*** 527,534 **** X sti X X mov ds, word ptr cs:S_ds ; Restore DS X! mov word ptr ds:_errno, 4 ; Set to EINTR X! jmp $Exec_Error X X ; X ; No interrupts - continue X--- 528,535 ---- X sti X X mov ds, word ptr cs:S_ds ; Restore DS X! xor ax, ax X! jmp $Exec_Complete X X ; X ; No interrupts - continue X*************** X*** 729,741 **** X $SA_spawn_Exit: X push ax ; Save exit code X mov ax, 02523H ; Set Control C Interrupt X! mov ds, word ptr cs:_SW_I23_V_ES X! mov dx, word ptr cs:_SW_I23_V_BX X int 021H X X! mov ax, 02523H ; Set Divide Zero Interrupt X! mov ds, word ptr cs:_SW_I0_V_ES X! mov dx, word ptr cs:_SW_I0_V_BX X X ; X X--- 730,742 ---- X $SA_spawn_Exit: X push ax ; Save exit code X mov ax, 02523H ; Set Control C Interrupt X! mov dx, word ptr cs:_SW_I23_V X! mov ds, word ptr cs:_SW_I23_V + 2 X int 021H X X! mov ax, 02500H ; Set Divide Zero Interrupt X! mov dx, word ptr cs:_SW_I0_V X! mov ds, word ptr cs:_SW_I0_V + 2 X X ; X X*************** X*** 983,1003 **** X ; X X SA_IRET proc far X! push ax X! push bp ; Save the AX and DS registers X! push ds X! mov bp, seg SH0_TEXT ; Get my segment X! mov ds, bp X! inc word ptr ds:_SW_intr ; Set Interrupt 23 detected. X! cmp byte ptr ds:InShell, 0 ; Are we in the shell ? X jz $SA_Ins X X ; In another program - move the stack around X X- mov bp, sp X- pop ds ; Unstack values X- pop bp X- pop ax X stc X ret X X--- 984,995 ---- X ; X X SA_IRET proc far X! inc word ptr cs:_SW_intr ; Set Interrupt 23 detected. X! cmp byte ptr cs:InShell, 0 ; Are we in the shell ? X jz $SA_Ins X X ; In another program - move the stack around X X stc X ret X X*************** X*** 1005,1013 **** X ; In shell - ignore interrupt 23 for the moment X X $SA_Ins: X- pop ds ; Restore regs X- pop bp X- pop ax X iret X X SA_IRET endp X--- 997,1002 ---- X*************** X*** 1028,1033 **** X--- 1017,1054 ---- X int 021H X X SA_DZERO endp X+ X+ ; X+ ; INTERRUPT 24 - ERROR HANDLER - Output message X+ ; X+ X+ _SW_Int24 proc far X+ pushf ; Save flags X+ call dword ptr cs:_SW_I24_V X+ X+ cmp byte ptr cs:InShell, 0 ; Are we in the shell ? X+ jnz $SW_int24c ; No - no processing X+ X+ test ah, 010h X+ jnz $SW_int24a X+ test ah, 008h X+ jnz $SW_int24b X+ X+ mov al, 003h ; Fail system call X+ X+ $SW_int24c: X+ iret X+ X+ ; X+ $SW_int24a: X+ xor al, al ; Ignore error X+ iret X+ X+ ; X+ $SW_int24b: X+ mov al, 001h ; Retry error X+ iret X+ _SW_Int24 endp X X ; X ; Start of overwrite area for environment. Align on a paragraph XIndex: sh1.c XPrereq: 1.1 X*** ../sh14/sh1.c Mon Feb 19 16:09:18 1990 X--- sh1.c Fri Feb 16 19:12:27 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.1 90/01/25 13:40:39 MS_user Exp $ X * X * $Log: sh1.c $ X * Revision 1.1 90/01/25 13:40:39 MS_user X * Initial revision 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: sh1.c 1.2 90/02/14 04:46:20 MS_user Exp $ X * X * $Log: sh1.c $ X+ * Revision 1.2 90/02/14 04:46:20 MS_user X+ * Add Interrupt 24 processing X+ * X * Revision 1.1 90/01/25 13:40:39 MS_user X * Initial revision X * X*************** X*** 1522,1527 **** X--- 1525,1538 ---- X /* Patch the ctype table as a cheat */ X X (_ctype+1)['_'] |= _UPPER; X+ X+ /* Save the interrupt 24 address */ X+ X+ SW_I24_V = _dos_getvect (0x24); X+ X+ /* Set the newinterrupt 24 address */ X+ X+ _dos_setvect (0x24, SW_Int24); X } X X /* XIndex: sh3.c XPrereq: 1.1 X*** ../sh14/sh3.c Mon Feb 19 16:24:02 1990 X--- sh3.c Fri Feb 16 19:10:04 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.1 90/01/25 13:41:24 MS_user Exp $ X * X * $Log: sh3.c $ X * Revision 1.1 90/01/25 13:41:24 MS_user X * Initial revision 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: sh3.c 1.2 90/02/14 04:47:06 MS_user Exp $ X * X * $Log: sh3.c $ X+ * Revision 1.2 90/02/14 04:47:06 MS_user X+ * Clean up Interrupt 23 and 0 processing, change EMS version error message X+ * X * Revision 1.1 90/01/25 13:41:24 MS_user X * Initial revision X * X*************** X*** 1116,1135 **** X X /* Save the interrupt 0 address */ X X! or.x.ax = 0x3500; X! intdosx (&or, &or, &sr); X X- SW_I0_V_BX = or.x.bx; X- SW_I0_V_ES = sr.es; X- X /* Save the interrupt 23 address */ X X! or.x.ax = 0x3523; X! intdosx (&or, &or, &sr); X X- SW_I23_V_BX = or.x.bx; X- SW_I23_V_ES = sr.es; X- X /* Get max Extended memory pages, and convert to 16K blocks. If Extended X * memory swapping disabled, set to zero X */ X--- 1119,1130 ---- X X /* Save the interrupt 0 address */ X X! SW_I0_V = _dos_getvect (0x00); X X /* Save the interrupt 23 address */ X X! SW_I23_V = _dos_getvect (0x23); X X /* Get max Extended memory pages, and convert to 16K blocks. If Extended X * memory swapping disabled, set to zero X */ X*************** X*** 1174,1180 **** X X if ((or.h.ah != 0) || (or.h.al < 0x32)) X { X! EMS_error (EMS_emsg, or.h.ah); X return; X } X X--- 1169,1175 ---- X X if ((or.h.ah != 0) || (or.h.al < 0x32)) X { X! EMS_error ("Warning: EMS Version < 3.2\n", 0); X return; X } X XIndex: sh6.c XPrereq: 1.1 X*** ../sh14/sh6.c Mon Feb 19 16:33:18 1990 X--- sh6.c Fri Feb 16 19:07:19 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.1 90/01/25 13:42:04 MS_user Exp $ X * X * $Log: sh6.c $ X * Revision 1.1 90/01/25 13:42:04 MS_user X * Initial revision 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: sh6.c 1.2 90/02/16 16:58:22 MS_user Exp $ X * X * $Log: sh6.c $ X+ * Revision 1.2 90/02/16 16:58:22 MS_user X+ * Set up 1.5 release X+ * X * Revision 1.1 90/01/25 13:42:04 MS_user X * Initial revision X * X*************** X*** 31,37 **** X #include X #include "sh.h" X X! char *Copy_Right1 = "MS-DOS SH Version 1.4\341 (DOS %d.%d)\n"; X 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--- 34,40 ---- X #include X #include "sh.h" X X! char *Copy_Right1 = "MS-DOS SH Version 1.5\341 (DOS %d.%d)\n"; X 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 */ XIndex: sh7.c XPrereq: 1.1 X*** ../sh14/sh7.c Mon Feb 19 16:36:26 1990 X--- sh7.c Fri Feb 16 19:16:21 1990 X*************** X*** 3,9 **** X * MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited and Charles Forsyth X * X * This code is based on (in part) the shell program written by Charles X! * Forsyth and is subject to the following copyright restrictions: X * X * 1. Redistribution and use in source and binary forms are permitted X * provided that the above copyright notice is duplicated in the X--- 3,11 ---- X * MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited and Charles Forsyth X * X * This code is based on (in part) the shell program written by Charles X! * Forsyth and is subject to the following copyright restrictions. The X! * code for the test (dotest) command was based on code written by X! * Erik Baalbergen. The following copyright conditions apply: X * X * 1. Redistribution and use in source and binary forms are permitted X * provided that the above copyright notice is duplicated in the 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: sh7.c 1.1 90/01/29 17:46:25 MS_user Exp $ X * X * $Log: sh7.c $ X * Revision 1.1 90/01/29 17:46:25 MS_user X * Initial revision X * X--- 15,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: sh7.c 1.2 90/01/30 14:43:34 MS_user Exp $ X * X * $Log: sh7.c $ X+ * Revision 1.2 90/01/30 14:43:34 MS_user X+ * Add missing author note X+ * X * Revision 1.1 90/01/29 17:46:25 MS_user X * Initial revision X * XIndex: sh9.c XPrereq: 1.1 X*** ../sh14/sh9.c Mon Feb 19 16:42:18 1990 X--- sh9.c Mon Feb 19 15:49:13 1990 X*************** X*** 12,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: sh9.c 1.1 90/01/26 17:25:19 MS_user Exp $ X * X * $Log: sh9.c $ X * Revision 1.1 90/01/26 17:25:19 MS_user X * Initial revision X! * X! * X */ X X #include X--- 12,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: sh9.c 1.2 90/02/19 15:42:39 MS_user Exp $ X * X * $Log: sh9.c $ X+ * Revision 1.2 90/02/19 15:42:39 MS_user X+ * Remove dependency on ANSI.SYS X+ * X * Revision 1.1 90/01/26 17:25:19 MS_user X * Initial revision X! * X! * X */ X X #include X*************** X*** 47,68 **** X static bool UpDate_CLine (char *); X static bool Re_start (char *); X static void memrcpy (char *, char *, int); X! static int read_cursor_position (void); X static void set_cursor_position (int); X static void gen_cursor_position (void); X X static bool insert_mode = FALSE; X static char *c_buffer_pos; /* Position in command line */ X static char *end_buffer; /* End of command line */ X static int s_cursor; /* Start cursor position */ X static int c_history = -1; /* Current entry */ X static int l_history = 0; /* End of history array */ X static int M_length = -1; /* Match length */ X static char l_buffer[LINE_MAX + 1]; X! static char *No_prehistory = "history: No previous commands\033[2K\n"; X! static char *No_MatchHistory = "history: No history match found\033[2K\n"; X! static char *No_posthistory = "history: No more commands\033[2K\n"; X! static char *History_2long = "history: History line too long\033[2K\n"; X static char *H_TooLongI = "History file line too long - ignored (%d)\n"; X X /* Arrary of history Items */ X--- 50,73 ---- X static bool UpDate_CLine (char *); X static bool Re_start (char *); X static void memrcpy (char *, char *, int); X! static void read_cursor_position (void); X static void set_cursor_position (int); X static void gen_cursor_position (void); X+ static void erase_to_end_of_line (void); X X static bool insert_mode = FALSE; X static char *c_buffer_pos; /* Position in command line */ X static char *end_buffer; /* End of command line */ X static int s_cursor; /* Start cursor position */ X+ static int m_line = 0; /* Max write line number */ X static int c_history = -1; /* Current entry */ X static int l_history = 0; /* End of history array */ X static int M_length = -1; /* Match length */ X static char l_buffer[LINE_MAX + 1]; X! static char *No_prehistory = "history: No previous commands"; X! static char *No_MatchHistory = "history: No history match found"; X! static char *No_posthistory = "history: No more commands"; X! static char *History_2long = "history: History line too long"; X static char *H_TooLongI = "History file line too long - ignored (%d)\n"; X X /* Arrary of history Items */ X*************** X*** 129,135 **** X end_buffer = l_buffer; X insert_mode = FALSE; X M_length = -1; X! s_cursor = read_cursor_position (); X X while (((i = getch ()) != 0x1a) && (i != NL) && (i != '\r')) X { X--- 134,140 ---- X end_buffer = l_buffer; X insert_mode = FALSE; X M_length = -1; X! read_cursor_position (); X X while (((i = getch ()) != 0x1a) && (i != NL) && (i != '\r')) X { X*************** X*** 156,162 **** X v1a_puts (l_buffer); X break; X } X! X else if (*l_buffer != '!') X break; X X--- 161,167 ---- X v1a_puts (l_buffer); X break; X } X! X else if (*l_buffer != '!') X break; X X*************** X*** 372,385 **** X X /* Read Cursor position */ X X! static int read_cursor_position () X { X union REGS r; X X r.h.ah = 0x03; /* Read cursor position */ X r.h.bh = 0; /* Page zero */ X int86 (0x10, &r, &r); X! return (r.h.dh * 80) + r.h.dl; X } X X /* Re-position the cursor */ X--- 377,391 ---- X X /* Read Cursor position */ X X! static void read_cursor_position () X { X union REGS r; X X r.h.ah = 0x03; /* Read cursor position */ X r.h.bh = 0; /* Page zero */ X int86 (0x10, &r, &r); X! s_cursor = (r.h.dh * 80) + r.h.dl; X! m_line = r.h.dh; X } X X /* Re-position the cursor */ X*************** X*** 402,412 **** X s_cursor -= 80; X } X X int86 (0x10, &r, &r); X } X X! /* Generate the new cursor position */ X X static void gen_cursor_position () X { X char *cp = l_buffer - 1; X--- 408,439 ---- X s_cursor -= 80; X } X X+ if (m_line < r.h.dh) X+ m_line = r.h.dh; X+ X int86 (0x10, &r, &r); X } X X! /* Erase to end of line (avoid need for STUPID ansi.sys memory eater!) */ X X+ static void erase_to_end_of_line () X+ { X+ union REGS r; X+ X+ r.h.ah = 0x03; X+ r.h.bh = 0; X+ int86 (0x10, &r, &r); X+ X+ if ((r.x.cx = 80 - r.h.dl + (m_line - r.h.dh) * 80) > 0) X+ { X+ r.x.ax = 0x0920; X+ r.x.bx = 0x0007; X+ int86 (0x10, &r, &r); X+ } X+ } X+ X+ /* Generate the new cursor position */ X+ X static void gen_cursor_position () X { X char *cp = l_buffer - 1; X*************** X*** 471,477 **** X ++cp; X } X X! v1_puts ("\033[2K"); /* clear to end of line */ X } X X /* Process history command X--- 498,504 ---- X ++cp; X } X X! erase_to_end_of_line (); /* clear to end of line */ X } X X /* Process history command X*************** X*** 531,540 **** X X while (isspace (*optionals)) X ++optionals; X- X X- /* Copy selected item into line buffer */ X X case 2: X M_length = strlen (l_buffer) - 1; X if (!Scan_History ()) X--- 558,567 ---- X X while (isspace (*optionals)) X ++optionals; X X X+ /* Copy selected item into line buffer */ X+ X case 2: X M_length = strlen (l_buffer) - 1; X if (!Scan_History ()) X*************** X*** 562,568 **** X X if (end_buffer > optionals) X memrcpy (end_buffer + 1 + opt_len, optionals + opt_len, opt_len + 1); X! X else X strcpy (end_buffer + 1, optionals); X X--- 589,595 ---- X X if (end_buffer > optionals) X memrcpy (end_buffer + 1 + opt_len, optionals + opt_len, opt_len + 1); X! X else X strcpy (end_buffer + 1, optionals); X X*************** X*** 816,822 **** X--- 843,853 ---- X char *cp; X { X if (cp != (char *)NULL) X+ { X print_warn (cp); X+ erase_to_end_of_line (); X+ v1_putc (NL); X+ } X X put_prompt (last_prompt); X X*************** X*** 824,830 **** X X c_buffer_pos = l_buffer; X end_buffer = l_buffer; X! s_cursor = read_cursor_position (); X X return FALSE; X } X--- 855,861 ---- X X c_buffer_pos = l_buffer; X end_buffer = l_buffer; X! read_cursor_position (); X X return FALSE; X } SHAR_EOF chmod 0644 Patch1.5 || echo "restore of Patch1.5 fails" set `wc -c Patch1.5`;Sum=$1 if test "$Sum" != "24187" then echo original size 24187, current size $Sum;fi echo "x - extracting Patch1.6 (Text)" sed 's/^X//' << 'SHAR_EOF' > Patch1.6 && XIndex: lib/popen.c X*** ../sh15/lib/popen.c Fri Mar 2 11:34:14 1990 X--- lib/popen.c Mon Apr 30 22:51:53 1990 X*************** X*** 17,44 **** X char *p_file; /* Pipe file name */ X int p_status; /* Status for close to return */ X /* Read pipes only */ X! bool p_write; /* Read or write */ X } PIPE; X X static PIPE P_list[_NFILE]; /* The pipe structures */ X static int Pipes_Inited = 0; /* Initialised ? */ X static int Unique_Pipe = 0; X X! static PIPE *_p_save_entry (char *, bool); X static int _p_run (char *); X static int _p_reset_entry (PIPE *, int); X static PIPE *_p_get_entry (FILE *); X X /* Set up a pipe structure */ X X static PIPE *_p_save_entry (prog, mode) X char *prog; X! bool mode; X { X FILE *fp; /* File handler */ X PIPE *pp; /* Pipe handler structure */ X char tmpfile[NAME_MAX + PATH_MAX + 2]; X char *tmpdir; /* Points to directory prefix of pipe */ X X /* Find out where we should put temporary files */ X X--- 17,46 ---- X char *p_file; /* Pipe file name */ X int p_status; /* Status for close to return */ X /* Read pipes only */ X! char p_write; /* Read or write */ X } PIPE; X X static PIPE P_list[_NFILE]; /* The pipe structures */ X static int Pipes_Inited = 0; /* Initialised ? */ X static int Unique_Pipe = 0; X X! static PIPE *_p_save_entry (char *, char *); X static int _p_run (char *); X static int _p_reset_entry (PIPE *, int); X static PIPE *_p_get_entry (FILE *); X+ static int _p_onexit (void); X X /* Set up a pipe structure */ X X static PIPE *_p_save_entry (prog, mode) X char *prog; X! char *mode; X { X FILE *fp; /* File handler */ X PIPE *pp; /* Pipe handler structure */ X char tmpfile[NAME_MAX + PATH_MAX + 2]; X char *tmpdir; /* Points to directory prefix of pipe */ X+ char s_mode = *mode; X X /* Find out where we should put temporary files */ X X*************** X*** 52,65 **** X X /* Get a unique pipe file name */ X X! sprintf (tmpfile, "%s/pipe%05d.tmp", tmpdir, Unique_Pipe++); X unlink (tmpfile); X X /* Create the pipe */ X X! if ((fp = fopen (tmpfile, "w")) == (FILE *) NULL) X! return (PIPE *)NULL; X X /* Create the PIPE entry */ X X if ((pp = _p_get_entry ((FILE *)NULL)) == (PIPE *)NULL) X--- 54,71 ---- X X /* Get a unique pipe file name */ X X! sprintf (tmpfile, "%s/pipe%.4x.tmp", tmpdir, Unique_Pipe++); X unlink (tmpfile); X X /* Create the pipe */ X X! *mode = 'w'; X! fp = fopen (tmpfile, mode); X! *mode = s_mode; X X+ if (fp == (FILE *) NULL) X+ return (PIPE *)NULL; X+ X /* Create the PIPE entry */ X X if ((pp = _p_get_entry ((FILE *)NULL)) == (PIPE *)NULL) X*************** X*** 73,79 **** X /* Set up the entry */ X X pp->p_fp = fp; X! pp->p_write = mode; X pp->p_process = strdup (prog); X pp->p_file = strdup (tmpfile); X X--- 79,85 ---- X /* Set up the entry */ X X pp->p_fp = fp; X! pp->p_write = *mode; X pp->p_process = strdup (prog); X pp->p_file = strdup (tmpfile); X X*************** X*** 121,127 **** X shell = ++bp; X X if (strcmp (shell, "command.com")) X! *dash = '-'; X X /* Run the program */ X X--- 127,133 ---- X shell = ++bp; X X if (strcmp (shell, "command.com")) X! *dash = '/'; X X /* Run the program */ X X*************** X*** 199,210 **** X { X memset (&P_list[0], 0, sizeof (P_list)); X Pipes_Inited = 1; X- } X X /* For write style pipe, pclose handles program execution */ X X! if (strcmp (type, "w") == 0) X! return ((pp = _p_save_entry (command, TRUE)) == (PIPE *)NULL) X ? (FILE *)NULL : pp->p_fp; X X /* read pipe must create tmp file, set up stdout to point to the temp X--- 205,219 ---- X { X memset (&P_list[0], 0, sizeof (P_list)); X Pipes_Inited = 1; X X+ if (onexit (_p_onexit) == (onexit_t)NULL) X+ return (FILE *)NULL; X+ } X+ X /* For write style pipe, pclose handles program execution */ X X! if (*type == 'w') X! return ((pp = _p_save_entry (command, type)) == (PIPE *)NULL) X ? (FILE *)NULL : pp->p_fp; X X /* read pipe must create tmp file, set up stdout to point to the temp X*************** X*** 213,228 **** X * fine. X */ X X! else if (strcmp (type, "r") == 0) X { X! if ((pp = _p_save_entry (command, FALSE)) == (PIPE *)NULL) X return (FILE *)NULL; X X /* Save the stdout file descriptor, dup the pipe onto standard out, X * execute the command, close the pipe and re-open it X */ X X! if ((old_stdout = dup (fileno(stdout)) < 0) || X (dup2 (fileno (pp->p_fp), fileno(stdout)) < 0) || X ((pp->p_status = _p_run (command)) < 0) || X (fclose (pp->p_fp) < 0) || X--- 222,237 ---- X * fine. X */ X X! else if (*type == 'r') X { X! if ((pp = _p_save_entry (command, type)) == (PIPE *)NULL) X return (FILE *)NULL; X X /* Save the stdout file descriptor, dup the pipe onto standard out, X * execute the command, close the pipe and re-open it X */ X X! if (((old_stdout = dup (fileno(stdout))) < 0) || X (dup2 (fileno (pp->p_fp), fileno(stdout)) < 0) || X ((pp->p_status = _p_run (command)) < 0) || X (fclose (pp->p_fp) < 0) || X*************** X*** 264,270 **** X * descriptor to stdin, execute the command, and then restore stdin X */ X X! if (pp->p_write && X ( ((pp->p_fp = fopen (pp->p_file, "r")) == (FILE *)NULL) || X ((old_stdin = dup (fileno (stdin))) < 0) || X (dup2 (fileno (pp->p_fp), fileno (stdin)) < 0) || X--- 273,279 ---- X * descriptor to stdin, execute the command, and then restore stdin X */ X X! if ((pp->p_write == 'w') && X ( ((pp->p_fp = fopen (pp->p_file, "r")) == (FILE *)NULL) || X ((old_stdin = dup (fileno (stdin))) < 0) || X (dup2 (fileno (pp->p_fp), fileno (stdin)) < 0) || X*************** X*** 277,280 **** X--- 286,304 ---- X /* Close the temp file and remove it */ X X return _p_reset_entry (pp, 0); X+ } X+ X+ /* Clean up on exit, in case a pipe has not been processed */ X+ X+ static int _p_onexit () X+ { X+ int i; X+ X+ for (i = 0; i < _NFILE; i++) X+ { X+ if (P_list[i].p_fp != (FILE *)NULL) X+ pclose (P_list[i].p_fp); X+ } X+ X+ return 0; X } XIndex: shell/sh6.c XPrereq: 1.2 X*** ../sh15/shell/sh6.c Fri Feb 16 19:07:19 1990 X--- shell/sh6.c Tue May 1 19:49:19 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.2 90/02/16 16:58:22 MS_user Exp $ X * X * $Log: sh6.c $ X * Revision 1.2 90/02/16 16:58:22 MS_user X * Set up 1.5 release X * X--- 13,48 ---- 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.11 90/04/25 22:38:47 MS_user Exp $ X * X * $Log: sh6.c $ X+ * Revision 1.11 90/04/25 22:38:47 MS_user X+ * Add initialisation for new field in IO_Args X+ * X+ * Revision 1.10 90/04/25 09:20:39 MS_user X+ * Change version message processing X+ * X+ * Revision 1.9 90/04/11 12:57:12 MS_user X+ * Update release date X+ * X+ * Revision 1.8 90/04/06 17:17:46 MS_user X+ * RELEASE 1.6! X+ * X+ * Revision 1.7 90/03/26 20:55:36 MS_user X+ * Move to beta test version X+ * X+ * Revision 1.6 90/03/12 20:34:07 MS_user X+ * Add save program name variable for initialisation file X+ * X+ * Revision 1.5 90/03/06 15:13:48 MS_user X+ * Set up for alpha release X+ * X+ * Revision 1.4 90/03/05 13:52:31 MS_user X+ * Change in environment structure X+ * X+ * Revision 1.3 90/02/22 16:38:56 MS_user X+ * Add XMS support X+ * X * Revision 1.2 90/02/16 16:58:22 MS_user X * Set up 1.5 release X * X*************** X*** 26,47 **** X X #include X #include X #include X #include X #include X #include X #include X #include X #include "sh.h" X X! char *Copy_Right1 = "MS-DOS SH Version 1.5\341 (DOS %d.%d)\n"; X! 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 int exstat; /* Exit status */ X char gflg; X int fn_area_number = -1; /* Next function area number */ X! int talking; /* interactive (talking-type wireless) */ X int execflg; /* Exec mode */ X int multiline; /* \n changed to ; */ X int Current_Event = 0; /* Current history event */ X--- 53,76 ---- X X #include X #include X+ #include X #include X #include X #include X #include X #include X #include X+ #include X #include "sh.h" X X! static char *Copy_Right1 = "MS-DOS SH Version 1.6 - %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 int exstat; /* Exit status */ X char gflg; X int fn_area_number = -1; /* Next function area number */ X! bool talking = FALSE;/* interactive (talking-type wireless) */ X int execflg; /* Exec mode */ X int multiline; /* \n changed to ; */ X int Current_Event = 0; /* Current history event */ X*************** X*** 78,83 **** X--- 107,113 ---- X Var_List *C_dir; /* Current directory */ X char *last_prompt; /* Last prompt output */ X Var_List *ifs; /* Inter-field separator */ X+ char *Program_Name; /* Program name */ X char *home = "HOME"; X char *shell = "SHELL"; X char *history_file = "HISTFILE"; X*************** X*** 96,101 **** X--- 126,132 ---- X 0, /* File descriptor */ X AFID_NOBUF, /* Buffer id */ X 0L, /* File position */ X+ 0, /* Offset in buffer */ X (IO_Buf *)NULL /* Buffer */ X }; X X*************** X*** 112,117 **** X--- 143,161 ---- X iostack, /* I/O Stack pointers */ X iostack - 1, X (int *)NULL, X+ FALSE, /* End of file processing */ X FDBASE, /* Base file handler */ X (Environ *)NULL /* Previous Env pointer */ X }; X+ X+ /* The only bit of code in this module prints the version number */ X+ X+ void Print_Version (fp) X+ int fp; X+ { X+ char buf[100]; X+ X+ sprintf (buf, Copy_Right1, __DATE__, _osmajor, _osminor); X+ write (fp, buf, strlen (buf)); X+ write (fp, Copy_Right2, strlen (Copy_Right2)); X+ } XIndex: shell/sh0.asm XPrereq: 1.2 X*** ../sh15/shell/sh0.asm Fri Feb 16 19:13:56 1990 X--- shell/sh0.asm Tue May 1 19:50:48 1990 X*************** X*** 4,11 **** X X ; MS-DOS SHELL - Swapper X ; X- ; MS-DOS SHELL - Copyright (c) 1989 Data Logic Limited. X- ; X ; MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited X ; X ; This code is subject to the following copyright restrictions: X--- 4,9 ---- X*************** X*** 18,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: sh0.asm 1.2 90/02/14 04:45:58 MS_user Exp $ X ; X ; $Log: sh0.asm $ X ; Revision 1.2 90/02/14 04:45:58 MS_user X ; Add Interrupt 24 processing and clean up interrupt 0 and 23 processing X ; X--- 16,42 ---- 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.8 90/04/25 22:32:31 MS_user Exp $ X ; X ; $Log: sh0.asm $ X+ ; Revision 1.8 90/04/25 22:32:31 MS_user X+ ; Fix missing disk full check on writing swap file X+ ; X+ ; Revision 1.7 90/04/11 12:54:38 MS_user X+ ; Fix non-disk device name print in CEH X+ ; X+ ; Revision 1.6 90/03/26 04:31:01 MS_user X+ ; Remove original Interrupt 24 save address X+ ; X+ ; Revision 1.5 90/03/26 04:12:38 MS_user X+ ; Add Full Interrupt 24 handler X+ ; X+ ; Revision 1.4 90/03/05 13:47:05 MS_user X+ ; Add XMS driver X+ ; X+ ; Revision 1.3 90/02/22 16:50:23 MS_user X+ ; Add XMS Driver support X+ ; X ; Revision 1.2 90/02/14 04:45:58 MS_user X ; Add Interrupt 24 processing and clean up interrupt 0 and 23 processing X ; X*************** X*** 72,97 **** X public _SW_fp X public _SW_I0_V X public _SW_I23_V X- public _SW_I24_V X public _SW_EMstart X public _SW_Mode X public _SW_EMSFrame X public _SW_Int24 X X _cmd_line db 129 dup (?) ; Command line X _path_line db 80 dup (?) ; Path line X _SW_Blocks dw 0 ; Number of blocks to read/write X _SW_fp dw 0 ; File ID X _SW_I0_V dd 0 ; Our Interrupt Zero address X _SW_I23_V dd 0 ; Our Interrupt 23 address X- _SW_I24_V dd 0 ; Original Interrupt 24 address X _SW_EMstart dd 0100000H ; Default Extended Mem start X _SW_Mode dw 0 ; Type of swapping to do X ; 1 - disk X ; 2 - Extended memory X! ; 3 - Expanded memory X _SW_EMSFrame dw 0 ; EMS Frame segment X _SW_intr dw 0 ; Interrupt 23 detected. SHAR_EOF echo "End of part 1" echo "File Patch1.6 is continued in part 2" echo "2" > s2_seq_.tmp exit 0