[comp.sources.misc] v13i080: MS-Shell 1.6 - Patch 1. Part 02 of 02

istewart@datlog.co.uk (07/03/90)

Posting-number: Volume 13, Issue 80
Submitted-by: istewart@datlog.co.uk
Archive-name: ms_sh-1.6/patch01-pt2

#!/bin/sh
# this is PAT.02 (part 2 of 2)
# do not concatenate these parts, unpack them in order with /bin/sh
# file Patch1.6.2 continued
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
if test ! -r @shar_seq_.tmp; then
	echo "Please unpack part 1 first!"
	exit 1
fi
(read Scheck
 if test "$Scheck" != 2; then
	echo "Please unpack part $Scheck next!"
	exit 1
 else
	exit 0
 fi
) < @shar_seq_.tmp || exit 1
echo "x - Continuing file Patch1.6.2"
sed 's/^X//' << 'SHAR_EOF' >> Patch1.6.2 &&
X   *
X!  *    $Header: sh1.c 1.16 90/05/31 09:48:06 MS_user Exp $
X   *
X   *    $Log:	sh1.c $
X+  * Revision 1.16  90/05/31  09:48:06  MS_user
X+  * Implement partial write when swapping to disk
X+  * Add some signal lockouts to prevent corruption
X+  * 
X+  * Revision 1.15  90/05/15  21:08:59  MS_user
X+  * Restore original directory on exit
X+  * 
X   * Revision 1.14  90/04/25  22:33:28  MS_user
X   * Fix rsh check for PATH
X   * 
X***************
X*** 100,105 ****
X--- 107,114 ----
X  static char	*search    = ";c:/bin;c:/usr/bin";
X  static char	*ymail     = "You have mail\n";
X  static char	*Path	   = "PATH";
X+ 				/* Entry directory			*/
X+ static char	*Start_directory = (char *)NULL;
X  					/* Original Interrupt 24 address */
X  static void	(interrupt far *Orig_I24_V) (void);
X  #ifdef SIGQUIT
X***************
X*** 142,151 ****
X   * -x.  Some programs!!
X   */
X  
X!      Pre_Process_Argv (argv);
X  
X! /* Process the options */
X  
X      while ((sc = getopt (argc, argv, "abc:defghijklmnopqrtsuvwxyz0")) != EOF)
X      {
X  	switch (sc)
X--- 151,164 ----
X   * -x.  Some programs!!
X   */
X  
X!     Pre_Process_Argv (argv);
X  
X! /* Save the start directory for when we exit */
X  
X+     Start_directory = getcwd ((char *)NULL, PATH_MAX + 4);
X+ 
X+ /* Process the options */
X+ 
X      while ((sc = getopt (argc, argv, "abc:defghijklmnopqrtsuvwxyz0")) != EOF)
X      {
X  	switch (sc)
X***************
X*** 490,497 ****
X  #endif
X  
X      closeall ();
X-     exit (exstat);
X  
X  /* NOTREACHED */
X  }
X  
X--- 503,524 ----
X  #endif
X  
X      closeall ();
X  
X+ /* Clear swap file if necessary */
X+ 
X+     Clear_Swap_File ();
X+ 
X+ /* If this is a command only - restore the directory because DOS doesn't 
X+  * and the user might expect it
X+  */
X+ 
X+     if (Start_directory != (char *)NULL)
X+ 	Restore_Dir (Start_directory);
X+ 
X+ /* Exit - hurray */
X+ 
X+     exit (exstat);
X+ 
X  /* NOTREACHED */
X  }
X  
X***************
X*** 1130,1136 ****
X      ps1   = lookup ("PS1", TRUE);
X      ps2   = lookup ("PS2", TRUE);
X      C_dir = lookup ("~", TRUE);
X!     Restore_Dir ();
X  }
X  
X  /*
X--- 1157,1163 ----
X      ps1   = lookup ("PS1", TRUE);
X      ps2   = lookup ("PS2", TRUE);
X      C_dir = lookup ("~", TRUE);
X!     Restore_Dir (C_dir->value);
X  }
X  
X  /*
X***************
X*** 1246,1251 ****
X--- 1273,1279 ----
X  unsigned int	nbytes;
X  {
X      s_region		*np;
X+     void		(*save_signal)(int);
X  
X      if (nbytes == 0)
X  	abort ();	/* silly and defeats the algorithm */
X***************
X*** 1255,1266 ****
X      if ((np = (s_region *)calloc (nbytes + sizeof (s_region), 1)) == (s_region *)NULL)
X          return (char *)NULL;
X  
X! /* Link into chain */
X  
X      np->next = areastart;
X      np->area = areanum;
X      areastart = np;
X  
X      return ((char *)np) + sizeof (s_region);
X  }
X  
X--- 1283,1302 ----
X      if ((np = (s_region *)calloc (nbytes + sizeof (s_region), 1)) == (s_region *)NULL)
X          return (char *)NULL;
X  
X! /* Disable signals */
X  
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X+ /* Link into chain */
X+ 
X      np->next = areastart;
X      np->area = areanum;
X      areastart = np;
X  
X+ /* Restore signals */
X+ 
X+     signal (SIGINT, save_signal);
X+ 
X      return ((char *)np) + sizeof (s_region);
X  }
X  
X***************
X*** 1274,1282 ****
X      register s_region	*cp = areastart;
X      s_region		*lp = (s_region *)NULL;
X      s_region		*sp = (s_region *)(s - sizeof (s_region));
X  
X! /* Find the string in the chain */
X  
X      if (s != (char *)NULL)
X      {
X  	while (cp != (s_region *)NULL)
X--- 1310,1323 ----
X      register s_region	*cp = areastart;
X      s_region		*lp = (s_region *)NULL;
X      s_region		*sp = (s_region *)(s - sizeof (s_region));
X+     void		(*save_signal)(int);
X  
X! /* Disable signals */
X  
X+     save_signal = signal (SIGINT, SIG_IGN);
X+     
X+ /* Find the string in the chain */
X+ 
X      if (s != (char *)NULL)
X      {
X  	while (cp != (s_region *)NULL)
X***************
X*** 1302,1309 ****
X  	    break;
X  	}
X      }
X- }
X  
X  /*
X   * Autodelete space nolonger required.  Ie. Free all the strings in a malloced
X   * area
X--- 1343,1354 ----
X  	    break;
X  	}
X      }
X  
X+ /* Restore signals */
X+ 
X+     signal (SIGINT, save_signal);
X+ }
X+ 
X  /*
X   * Autodelete space nolonger required.  Ie. Free all the strings in a malloced
X   * area
X***************
X*** 1314,1324 ****
X--- 1359,1375 ----
X  {
X      register s_region	*cp = areastart;
X      s_region		*lp = (s_region *)NULL;
X+     void		(*save_signal)(int);
X  
X+ /* Disable signals */
X+ 
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X      while (cp != (s_region *)NULL)
X      {
X  
X  /* Is the area number less than that specified - yes, continue */
X+ 
X  	if (cp->area < a)
X  	{
X  	    lp = cp;
X***************
X*** 1348,1353 ****
X--- 1399,1408 ----
X  	    cp = lp->next;
X  	}
X      }
X+ 
X+ /* Restore signals */
X+ 
X+     signal (SIGINT, save_signal);
X  }
X  
X  /*
XIndex: shell/sh10.c
XPrereq: 1.2
X*** ../sh16/shell/sh10.c	Tue May  1 19:48:22 1990
X--- shell/sh10.c	Thu Jun 21 21:46:42 1990
X***************
X*** 12,20 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh10.c 1.2 90/04/25 22:34:04 MS_user Exp $
X   *
X   *    $Log:	sh10.c $
X   * Revision 1.2  90/04/25  22:34:04  MS_user
X   * Fix case in TELIF where then and else parts are not defined
X   * 
X--- 12,23 ----
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh10.c 1.3 90/05/31 09:51:06 MS_user Exp $
X   *
X   *    $Log:	sh10.c $
X+  * Revision 1.3  90/05/31  09:51:06  MS_user
X+  * Add some signal lockouts to prevent corruption
X+  * 
X   * Revision 1.2  90/04/25  22:34:04  MS_user
X   * Fix case in TELIF where then and else parts are not defined
X   * 
X***************
X*** 397,402 ****
X--- 400,406 ----
X      char		*name = *t->words;
X      register Fun_Ops	*fp = Fun_Search (name);
X      Fun_Ops		*p_fp = (Fun_Ops *)NULL;
X+     void		(*save_signal)(int);
X  
X  /* Find the entry */
X  
X***************
X*** 404,411 ****
X  			(strcmp (*(fp->tree->words), name) != 0);
X  			p_fp = fp, fp = fp->next);
X  
X! /* If it already exists, free the tree and delete the entry */
X  
X      if (fp != (Fun_Ops *)NULL)
X      {
X  	Set_Free_ExTree (fp->tree, Free_ExTree);
X--- 408,419 ----
X  			(strcmp (*(fp->tree->words), name) != 0);
X  			p_fp = fp, fp = fp->next);
X  
X! /* Disable signals */
X  
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X+ /* If it already exists, free the tree and delete the entry */
X+ 
X      if (fp != (Fun_Ops *)NULL)
X      {
X  	Set_Free_ExTree (fp->tree, Free_ExTree);
X***************
X*** 419,426 ****
X  	DELETE (fp);
X      }
X  
X! /* If delete only - exit */
X  
X      if (delete_only)
X  	return;
X  
X--- 427,438 ----
X  	DELETE (fp);
X      }
X  
X! /* Restore signals */
X  
X+     signal (SIGINT, save_signal);
X+ 
X+ /* If delete only - exit */
X+ 
X      if (delete_only)
X  	return;
X  
X***************
X*** 429,440 ****
X--- 441,462 ----
X      if ((fp = (Fun_Ops *)space (sizeof (Fun_Ops))) == (Fun_Ops *)NULL)
X  	return;
X  
X+ /* Disable signals */
X+ 
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X+ /* Set up the tree */
X+ 
X      setarea ((char *)fp, 0);
X      Set_Free_ExTree (t, Set_ExTree);
X  
X      fp->tree = t;
X      fp->next = fun_list;
X      fun_list = fp;
X+ 
X+ /* Restore signals */
X+ 
X+     signal (SIGINT, save_signal);
X  }
X  
X  /*
XIndex: shell/sh3.c
XPrereq: 1.15
X*** ../sh16/shell/sh3.c	Tue May  1 19:48:50 1990
X--- shell/sh3.c	Thu Jun 21 21:48: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.15 90/04/30 19:50:11 MS_user Exp $
X   *
X   *    $Log:	sh3.c $
X   * Revision 1.15  90/04/30  19:50:11  MS_user
X   * Stop search path if second character of name is colon
X   * 
X--- 13,44 ----
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh3.c 1.22 90/06/21 11:10:47 MS_user Exp $
X   *
X   *    $Log:	sh3.c $
X+  * Revision 1.22  90/06/21  11:10:47  MS_user
X+  * Ensure Areanum is set correctly for memory areas
X+  * 
X+  * Revision 1.21  90/06/08  14:53:58  MS_user
X+  * Finally, we've fixed Gen_Full_Path_Name
X+  * 
X+  * Revision 1.20  90/05/31  17:44:11  MS_user
X+  * Ensure Swap file is saved at level 0
X+  * 
X+  * Revision 1.19  90/05/31  09:49:12  MS_user
X+  * Implement partial write when swapping to disk
X+  * Add some signal lockouts to prevent corruption
X+  * Fix a bug in Gen_Full_Path for c:program
X+  * 
X+  * Revision 1.18  90/05/15  21:09:39  MS_user
X+  * Change Restore_Dir parameter to take directory name
X+  * 
X+  * Revision 1.17  90/05/11  18:47:40  MS_user
X+  * Get switchchar for command.com
X+  * 
X+  * Revision 1.16  90/05/09  18:03:08  MS_user
X+  * Fix bug in Gen_Full_Path with programs in root directory
X+  * 
X   * Revision 1.15  90/04/30  19:50:11  MS_user
X   * Stop search path if second character of name is colon
X   * 
X***************
X*** 116,121 ****
X--- 139,145 ----
X  static char	*XMS_emsg = "Warning: XMS Error (%x)\n";
X  			/* Extended Command line processing file name	*/
X  static char		*Extend_file = (char *)NULL;
X+ static char		*Swap_File = (char *)NULL;	/* Swap file	*/
X  
X  /*
X   * execute tree recursively
X***************
X*** 206,212 ****
X  
X  	case TCOM:			/* A command process	*/
X  	    rv = forkexec (t, pin, pout, act, wp);
X! 	    Restore_Dir ();
X  	    break;
X  
X  	case TPIPE:			/* Pipe processing		*/
X--- 230,236 ----
X  
X  	case TCOM:			/* A command process	*/
X  	    rv = forkexec (t, pin, pout, act, wp);
X! 	    Restore_Dir (C_dir->value);
X  	    break;
X  
X  	case TPIPE:			/* Pipe processing		*/
X***************
X*** 410,422 ****
X   * Restore the original directory
X   */
X  
X! void	Restore_Dir ()
X  {
X      unsigned int	dummy;
X  
X!     _dos_setdrive (tolower(*C_dir->value) - 'a' + 1, &dummy);
X  
X!     if (chdir (&C_dir->value[2]) != 0)
X      {
X  	S_puts ("Warning: current directory reset to /\n");
X  	chdir ("/");
X--- 434,447 ----
X   * Restore the original directory
X   */
X  
X! void	Restore_Dir (path)
X! char	*path;
X  {
X      unsigned int	dummy;
X  
X!     _dos_setdrive (tolower(*path) - 'a' + 1, &dummy);
X  
X!     if (chdir (&path[2]) != 0)
X      {
X  	S_puts ("Warning: current directory reset to /\n");
X  	chdir ("/");
X***************
X*** 622,628 ****
X  {
X      Execute_stack_depth = stack;
X      Delete_G_VL ();
X!     Restore_Dir ();
X      restore_std (setstatus (retval), TRUE);
X  }
X  
X--- 647,653 ----
X  {
X      Execute_stack_depth = stack;
X      Delete_G_VL ();
X!     Restore_Dir (C_dir->value);
X      restore_std (setstatus (retval), TRUE);
X  }
X  
X***************
X*** 835,840 ****
X--- 860,866 ----
X      int			nargc = 0;		/* # script args	*/
X      char		*p_name;		/* Program name		*/
X      int			i;
X+     union REGS		r;
X  
X  /* If the environment is null - It is too big - error */
X  
X***************
X*** 914,921 ****
X  		    {
X  			new_argv[0] = lookup ("COMSPEC", FALSE)->value;
X  			new_argv[1] = "/c";
X- 		    }
X  
X  /* Stick in the pre-fix arguments */
X  
X  		    else if (nargc)
X--- 940,955 ----
X  		    {
X  			new_argv[0] = lookup ("COMSPEC", FALSE)->value;
X  			new_argv[1] = "/c";
X  
X+ /* Get the switch character */
X+ 
X+ 			r.x.ax = 0x3700;
X+ 			intdos (&r, &r);
X+ 
X+ 			if (r.h.al == 0)
X+ 			    *new_argv[1] = (char)(r.h.dl);
X+ 		    }
X+ 
X  /* Stick in the pre-fix arguments */
X  
X  		    else if (nargc)
X***************
X*** 1196,1201 ****
X--- 1230,1236 ----
X  	size = mp->MCB_len + 1;
X  
X      SW_Blocks = (size / 0x0400) + 1;
X+     SW_SBlocks = ((size - etext + _psp - 1) / 0x0400) + 1;
X  
X  /* OK Now we've set up the FCB's, command line and opened the swap file.
X   * Get some sys info for the swapper and execute my little assembler
X***************
X*** 1275,1309 ****
X  
X      if (Swap_Mode & SWAP_DISK)
X      {
X! 	if ((SW_fp = S_open (TRUE, g_tempname (), O_SMASK, 0600)) < 0)
X  	{
X  	    Swap_Mode &= (~SWAP_DISK);
X  	    print_error ("No Swap files\n");
X  	    errno = ENOSPC;
X  	    return -1;
X  	}
X  
X! 	SW_Mode = 1;			/* Set Disk file swap		*/
X  
X! /* Execute the program */
X  
X  	res = SA_spawn (envp);
X  
X! 	Clear_Extended_File ();
X  
X  	if (res == -2)
X  	{
X  	    Swap_Mode &= (~SWAP_DISK);
X  	    print_warn ("Swap file write failed\n");
X  	    errno = ENOSPC;
X  	    res = -1;
X  	}
X  
X! /* Close the swap file and return the result */
X  
X- 	serrno = errno;
X- 	S_close (SW_fp, TRUE);
X- 	errno = serrno;
X  	return res;
X      }
X  
X--- 1310,1385 ----
X  
X      if (Swap_Mode & SWAP_DISK)
X      {
X! 	SW_Pwrite = 0;
X! 
X! 	if (Swap_File == (char *)NULL)
X! 	    SW_fp = S_open (FALSE, (ep = g_tempname ()), O_SMASK, 0600);
X! 	
X! 	else
X  	{
X+ 	    SW_fp = S_open (FALSE, Swap_File, O_SaMASK);
X+ 	    SW_Pwrite = 1;
X+ 	}
X+ 
X+ 	if (SW_fp < 0)
X+ 	{
X+ 	    Clear_Swap_File ();
X  	    Swap_Mode &= (~SWAP_DISK);
X  	    print_error ("No Swap files\n");
X  	    errno = ENOSPC;
X  	    return -1;
X  	}
X  
X! /* Save the swap file name ? */
X  
X! 	if ((Swap_File == (char *)NULL) &&
X! 	    ((Swap_File = strsave (ep, 0)) == null))
X! 		Swap_File = (char *)NULL;
X  
X+ 	SW_Mode = 1;			/* Set Disk file swap		*/
X+ 	
X+ /* Seek to correct location */
X+ 
X+ 	if (SW_Pwrite)
X+ 	{
X+     	    long	loc = (long)(etext - _psp + 1) * 16L;
X+ 
X+ 	    if (lseek (SW_fp, loc, SEEK_SET) != loc)
X+ 	    {
X+ 		serrno = errno;
X+ 		S_close (SW_fp, TRUE);
X+ 		Clear_Swap_File ();
X+ 		Swap_Mode &= (~SWAP_DISK);
X+ 		print_error ("No Swap files\n");
X+ 		errno = serrno;
X+ 		return -1;
X+ 	    }
X+ 	}
X+ 
X+ /* Execute the program */
X+ 
X  	res = SA_spawn (envp);
X  
X! /* Close the swap file and extended command line files */
X  
X+ 	Clear_Extended_File ();
X+ 	serrno = errno;
X+ 	S_close (SW_fp, TRUE);
X+ 	errno = serrno;
X+ 
X+ /* Check for out of swap space */
X+ 
X  	if (res == -2)
X  	{
X+ 	    Clear_Swap_File ();
X  	    Swap_Mode &= (~SWAP_DISK);
X  	    print_warn ("Swap file write failed\n");
X  	    errno = ENOSPC;
X  	    res = -1;
X  	}
X  
X! /* Return the result */
X  
X  	return res;
X      }
X  
X***************
X*** 1520,1540 ****
X      char		*ep;
X      char		*new_args[3];
X  
X- /* Find the start of the program name */
X- 
X-     if ((pname = strrchr (path, '/')) == (char *)NULL)
X- 	pname = path;
X- 
X-     else
X- 	++pname;
X- 
X  /* Translate process name to MSDOS format */
X  
X      if ((argv[0] = Gen_Full_Path_Name (path)) == (char *)NULL)
X  	return -1;
X  
X! /* Extended command line processing */
X  
X      Extend_file == (char *)NULL;		/* Set no file		*/
X  
X      if ((*(pl++) != (char *)NULL) &&
X--- 1596,1612 ----
X      char		*ep;
X      char		*new_args[3];
X  
X  /* Translate process name to MSDOS format */
X  
X      if ((argv[0] = Gen_Full_Path_Name (path)) == (char *)NULL)
X  	return -1;
X  
X! /* Find the start of the program name */
X  
X+     pname = ((pname = strrchr (path, '\\')) == (char *)NULL) ? path : pname + 1;
X+ 
X+ /* Extended command line processing */
X+ 
X      Extend_file == (char *)NULL;		/* Set no file		*/
X  
X      if ((*(pl++) != (char *)NULL) &&
X***************
X*** 1582,1591 ****
X  	    ((fd = S_open (FALSE, Extend_file = g_tempname (), O_CMASK,
X  			   0600)) >= 0))
X  	{
X! 	    if ((ep = space (strlen (Extend_file) + 1)) != (char *)NULL)
X! 		strcpy (ep, Extend_file);
X! 	    
X! 	    Extend_file = ep;
X  
X  /* Copy to end of list */
X  
X--- 1654,1660 ----
X  	    ((fd = S_open (FALSE, Extend_file = g_tempname (), O_CMASK,
X  			   0600)) >= 0))
X  	{
X! 	    Extend_file = strsave (Extend_file, 0);
X  
X  /* Copy to end of list */
X  
X***************
X*** 1595,1602 ****
X  		    (write (fd, "\n", 1) != 1))
X  		{
X  		    close (fd);
X! 		    unlink (Extend_file);
X! 		    Extend_file == (char *)NULL;
X  		    errno = ENOSPC;
X  		    return -1;
X  		}
X--- 1664,1670 ----
X  		    (write (fd, "\n", 1) != 1))
X  		{
X  		    close (fd);
X! 		    Clear_Extended_File ();
X  		    errno = ENOSPC;
X  		    return -1;
X  		}
X***************
X*** 1716,1728 ****
X      Extend_file = (char *)NULL;
X  }
X  
X! /* Convert the executable path to the full path name */
X  
X  static char	*Gen_Full_Path_Name (path)
X  char		*path;
X  {
X      char		cpath[PATH_MAX + 4];
X      char		npath[PATH_MAX + NAME_MAX + 4];
X      char		*p;
X      unsigned int	dummy;
X  
X--- 1784,1810 ----
X      Extend_file = (char *)NULL;
X  }
X  
X! /* Clear Disk swap file file */
X  
X+ void	Clear_Swap_File ()
X+ {
X+     if (Swap_File != (char *)NULL)
X+     {
X+ 	unlink (Swap_File);
X+ 	DELETE (Swap_File);
X+     }
X+ 
X+     Swap_File = (char *)NULL;
X+ }
X+ 
X+ /* Convert the executable path to the full path name */
X+ 
X  static char	*Gen_Full_Path_Name (path)
X  char		*path;
X  {
X      char		cpath[PATH_MAX + 4];
X      char		npath[PATH_MAX + NAME_MAX + 4];
X+     char		n1path[PATH_MAX + 4];
X      char		*p;
X      unsigned int	dummy;
X  
X***************
X*** 1737,1746 ****
X  /* In current directory ? */
X  
X      if ((p = strrchr (path, '\\')) == (char *)NULL)
X  	 p = path;
X  
X!     else
X      {
X  	*(p++) = 0;
X  
X  /* Change to the directory containing the executable */
X--- 1819,1861 ----
X  /* In current directory ? */
X  
X      if ((p = strrchr (path, '\\')) == (char *)NULL)
X+     {
X  	 p = path;
X  
X! /* Check for a:program case */
X! 
X! 	 if (*(p + 1) == ':')
X! 	 {
X! 	    p += 2;
X! 
X! /* Switch drives and get the path of the other drive */
X! 
X! 	    _dos_setdrive (tolower (*path) - 'a' + 1, &dummy);
X! 	    getcwd (npath, PATH_MAX + 3);
X! 	    _dos_setdrive (tolower (*cpath) - 'a' + 1, &dummy);
X! 	 }
X!     }
X! 
X! /* In root directory */
X! 
X!     else if ((p - path) == 0)
X      {
X+ 	++p;
X+ 	strcpy (npath, "x:\\");
X+ 	*npath = *cpath;
X+     }
X+ 
X+     else if (((p - path) == 2) && (*(path + 1) == ':'))
X+     {
X+ 	++p;
X+ 	strcpy (npath, "x:\\");
X+ 	*npath = *path;
X+     }
X+ 
X+ /* Find the directory */
X+ 
X+     else
X+     {
X  	*(p++) = 0;
X  
X  /* Change to the directory containing the executable */
X***************
X*** 1748,1757 ****
X--- 1863,1884 ----
X  	if (*(path + 1) == ':')
X  	    _dos_setdrive (tolower (*path) - 'a' + 1, &dummy);
X  
X+ /* Save the current directory on this drive */
X+ 
X+ 	getcwd (n1path, PATH_MAX + 3);
X+ 
X+ /* Find the directory we want */
X+ 
X  	if (chdir (path) < 0)
X  	    return (char *)NULL;
X  
X+ /* Save its full name */
X+ 
X  	getcwd (npath, PATH_MAX + 3);
X+ 
X+ /* Restore the original */
X+ 
X+ 	chdir (n1path);
X  
X  /* Restore our original directory */
X  
XIndex: shell/sh4.c
XPrereq: 1.6
X*** ../sh16/shell/sh4.c	Tue May  1 19:49:02 1990
X--- shell/sh4.c	Thu Jun 21 21:48:52 1990
X***************
X*** 13,21 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh4.c 1.6 90/04/25 22:35:26 MS_user Exp $
X   *
X   *    $Log:	sh4.c $
X   * Revision 1.6  90/04/25  22:35:26  MS_user
X   * Make anys a global function
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: sh4.c 1.7 90/06/21 11:11:51 MS_user Exp $
X   *
X   *    $Log:	sh4.c $
X+  * Revision 1.7  90/06/21  11:11:51  MS_user
X+  * Ensure Areanum is set correctly for memory areas
X+  * 
X   * Revision 1.6  90/04/25  22:35:26  MS_user
X   * Make anys a global function
X   * 
X***************
X*** 150,158 ****
X  
X  	    if (FL_TEST ('m') && (vp->status & C_MSDOS))
X  	    {
X! 		cp = space (strlen (sp = wb->w_words[wb->w_nword - 1]) + 1);
X  		wb->w_words[wb->w_nword - 1] = cp;
X! 		Convert_Slashes (strcpy (cp, sp));
X  	    }
X  	}
X      }
X--- 153,161 ----
X  
X  	    if (FL_TEST ('m') && (vp->status & C_MSDOS))
X  	    {
X! 		cp = strsave (wb->w_words[wb->w_nword - 1], areanum);
X  		wb->w_words[wb->w_nword - 1] = cp;
X! 		Convert_Slashes (cp);
X  	    }
X  	}
X      }
XIndex: shell/sh5.c
XPrereq: 1.8
X*** ../sh16/shell/sh5.c	Tue May  1 19:49:12 1990
X--- shell/sh5.c	Thu Jun 21 21:49:29 1990
X***************
X*** 13,21 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh5.c 1.8 90/04/25 10:58:41 MS_user Exp $
X   *
X   *    $Log:	sh5.c $
X   * Revision 1.8  90/04/25  10:58:41  MS_user
X   * Fix re-reading re-assigned buffers correctly.
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: sh5.c 1.9 90/05/11 18:45:40 MS_user Exp $
X   *
X   *    $Log:	sh5.c $
X+  * Revision 1.9  90/05/11  18:45:40  MS_user
X+  * Fix problem when at end of buffer on re-load from file
X+  * 
X   * Revision 1.8  90/04/25  10:58:41  MS_user
X   * Fix re-reading re-assigned buffers correctly.
X   * 
X***************
X*** 428,434 ****
X  
X      if (ap->afid != AFID_NOBUF)
X      {
X! 	if ((i = (ap->afid != bp->id)) || (bp->bufp == bp->ebufp))
X  	{
X  
X  /* Are we re-reading a corrupted buffer? */
X--- 431,443 ----
X  
X      if (ap->afid != AFID_NOBUF)
X      {
X! 
X! /* When we reread a buffer, we need to check to see if we have reached the
X!  * end.  If we have, we need to read the next buffer.  Hence, this loop for
X!  * the second read
X!  */
X! 
X! 	while (((i = (ap->afid != bp->id)) || (bp->bufp == bp->ebufp)))
X  	{
X  
X  /* Are we re-reading a corrupted buffer? */
XIndex: shell/sh6.c
XPrereq: 1.11
X*** ../sh16/shell/sh6.c	Tue May  1 19:49:19 1990
X--- shell/sh6.c	Thu Jun 21 21:49:38 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.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--- 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: sh6.c 1.13 90/05/15 21:10:19 MS_user Exp $
X   *
X   *    $Log:	sh6.c $
X+  * Revision 1.13  90/05/15  21:10:19  MS_user
X+  * Release 1.6.2
X+  * 
X+  * Revision 1.12  90/05/09  20:35:41  MS_user
X+  * Change to release 1.6.1
X+  * 
X   * Revision 1.11  90/04/25  22:38:47  MS_user
X   * Add initialisation for new field in IO_Args
X   * 
X***************
X*** 63,69 ****
X  #include <string.h>
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--- 69,75 ----
X  #include <string.h>
X  #include "sh.h"
X  
X! static char	*Copy_Right1 = "MS-DOS SH Version 1.6.2 - %s (DOS %d.%d)\n";
X  static char	*Copy_Right2 = "Copyright (c) Data Logic Ltd and Charles Forsyth 1990\n";
X  char		**dolv;		/* Parameter array			*/
X  int		dolc;		/* Number of entries in parameter array	*/
XIndex: shell/sh7.c
XPrereq: 1.16
X*** ../sh16/shell/sh7.c	Tue May  1 19:49:34 1990
X--- shell/sh7.c	Thu Jun 21 21:50:36 1990
X***************
X*** 15,23 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh7.c 1.16 90/04/30 19:50:44 MS_user Exp $
X   *
X   *    $Log:	sh7.c $
X   * Revision 1.16  90/04/30  19:50:44  MS_user
X   * Stop search path if second character of name is colon
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.17 90/05/31 09:50:05 MS_user Exp $
X   *
X   *    $Log:	sh7.c $
X+  * Revision 1.17  90/05/31  09:50:05  MS_user
X+  * Implement partial write when swapping to disk
X+  * 
X   * Revision 1.16  90/04/30  19:50:44  MS_user
X   * Stop search path if second character of name is colon
X   * 
X***************
X*** 505,510 ****
X--- 508,514 ----
X  /* Set up new values */
X  
X      Swap_Mode = SWAP_OFF;
X+     Clear_Swap_File ();
X  
X      while ((cp = t->words[n++]) != (char *)NULL)
X      {
XIndex: shell/sh8.c
XPrereq: 1.8
X*** ../sh16/shell/sh8.c	Tue May  1 19:49:46 1990
X--- shell/sh8.c	Thu Jun 21 21:51:03 1990
X***************
X*** 12,20 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh8.c 1.8 90/03/26 20:58:11 MS_user Exp $
X   *
X   *    $Log:	sh8.c $
X   * Revision 1.8  90/03/26  20:58:11  MS_user
X   * Change I/O restore so that "exec >filename" works
X   * 
X--- 12,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: sh8.c 1.11 90/06/21 11:12:13 MS_user Exp $
X   *
X   *    $Log:	sh8.c $
X+  * Revision 1.11  90/06/21  11:12:13  MS_user
X+  * Ensure Areanum is set correctly for memory areas
X+  * 
X+  * Revision 1.10  90/05/31  11:31:53  MS_user
X+  * Correct misplaced signal restore
X+  * 
X+  * Revision 1.9  90/05/31  09:50:41  MS_user
X+  * Add some signal lockouts to prevent corruption
X+  * 
X   * Revision 1.8  90/03/26  20:58:11  MS_user
X   * Change I/O restore so that "exec >filename" works
X   * 
X***************
X*** 94,99 ****
X--- 103,109 ----
X      s_flist		*fp = (struct s_flist *)NULL;
X      int			*f_list = (int *)NULL;
X      char		*f_name = (char *)NULL;
X+     void		(*save_signal)(int);
X  
X  /* Check the permission mask if it exists */
X  
X***************
X*** 117,122 ****
X--- 127,136 ----
X  	return -1;
X      }
X  
X+ /* Disable signals */
X+ 
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X  /* Set up the structure.  Change two Unix device names to the DOS
X   * equivalents and disable create
X   */
X***************
X*** 148,171 ****
X  	DELETE (f_list);
X  	DELETE (fp);
X  	errno = pmask;
X! 	return -1;
X      }
X  
X  /* Make sure everything is in area 0 */
X  
X!     setarea ((char *)fp, 0);
X!     setarea ((char *)f_list, 0);
X  
X  /* List into the list */
X  
X!     fp->fl_next   = list_start;
X!     list_start = fp;
X  
X  /* Return the file descriptor */
X  
X!     return fp->fl_fd[0];
X! }
X  
X  /*
X   * Scan the File list for the appropriate entry for the specified ID
X   */
X--- 162,194 ----
X  	DELETE (f_list);
X  	DELETE (fp);
X  	errno = pmask;
X! 	pmask = -1;
X      }
X  
X  /* Make sure everything is in area 0 */
X  
X!     else
X!     {
X! 	setarea ((char *)fp, 0);
X! 	setarea ((char *)f_list, 0);
X  
X  /* List into the list */
X  
X! 	fp->fl_next   = list_start;
X! 	list_start = fp;
X  
X  /* Return the file descriptor */
X  
X! 	pmask = fp->fl_fd[0];
X!     }
X  
X+ /* Restore signals */
X+ 
X+     signal (SIGINT, save_signal);
X+ 
X+     return pmask;
X+ }
X+ 
X  /*
X   * Scan the File list for the appropriate entry for the specified ID
X   */
X***************
X*** 207,215 ****
X      bool	release = TRUE;
X      bool	delete = FALSE;
X      char	*fname;
X  
X! /* Find the entry for this ID */
X  
X      if (fp != (s_flist *)NULL)
X      {
X  	for (i = 0; i < fp->fl_count; i++)
X--- 230,243 ----
X      bool	release = TRUE;
X      bool	delete = FALSE;
X      char	*fname;
X+     void	(*save_signal)(int);
X  
X! /* Disable signals */
X  
X+     save_signal = signal (SIGINT, SIG_IGN);
X+ 
X+ /* Find the entry for this ID */
X+ 
X      if (fp != (s_flist *)NULL)
X      {
X  	for (i = 0; i < fp->fl_count; i++)
X***************
X*** 271,278 ****
X  	DELETE (fname);
X      }
X  
X! /* Restore results and error code */
X  
X      errno = serrno;
X      return i;
X  }
X--- 299,310 ----
X  	DELETE (fname);
X      }
X  
X! /* Restore signals */
X  
X+     signal (SIGINT, save_signal);
X+ 
X+ /* Restore results and error code */
X+ 
X      errno = serrno;
X      return i;
X  }
X***************
X*** 326,331 ****
X--- 358,364 ----
X  	    == (int *)NULL)
X  	    return new_fid;
X  
X+ 	setarea ((char *)flist, 0);
X  	memcpy ((char *)flist, (char *)fp->fl_fd, sizeof (int) * fp->fl_size);
X  	DELETE (fp->fl_fd);
X  
XIndex: shell/sh9.c
XPrereq: 1.11
X*** ../sh16/shell/sh9.c	Tue May  1 19:49:58 1990
X--- shell/sh9.c	Thu Jun 21 21:51:46 1990
X***************
X*** 12,20 ****
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh9.c 1.11 90/03/27 20:22:07 MS_user Exp $
X   *
X   *    $Log:	sh9.c $
X   * Revision 1.11  90/03/27  20:22:07  MS_user
X   * Fix problem with paging down history file - the last item was incorrect
X   * 
X--- 12,23 ----
X   * 2.  The sources (or parts thereof) or objects generated from the sources
X   *     (or parts of sources) cannot be sold under any circumstances.
X   *
X!  *    $Header: sh9.c 1.12 90/05/31 10:39:26 MS_user Exp $
X   *
X   *    $Log:	sh9.c $
X+  * Revision 1.12  90/05/31  10:39:26  MS_user
X+  * Initialise the input buffer in case of interrupts
X+  * 
X   * Revision 1.11  90/03/27  20:22:07  MS_user
X   * Fix problem with paging down history file - the last item was incorrect
X   * 
X***************
X*** 229,234 ****
X--- 232,238 ----
X  /* Set to last history item */
X  
X      c_history = l_history;
X+     memset (l_buffer, 0, LINE_MAX + 1);
X  
X  /* Process the input */
X  
SHAR_EOF
echo "File Patch1.6.2 is complete" &&
$TOUCH -am 0626201490 Patch1.6.2 &&
chmod 0644 Patch1.6.2 ||
echo "restore of Patch1.6.2 failed"
set `wc -c Patch1.6.2`;Wc_c=$1
if test "$Wc_c" != "65254"; then
	echo original size 65254, current size $Wc_c
fi
rm -f @shar_seq_.tmp
echo "You have unpacked the last part"
exit 0