home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / ms_sh-1.6 / patch01 < prev    next >
Encoding:
Text File  |  1990-07-02  |  39.1 KB  |  1,641 lines

  1. Newsgroups: comp.sources.misc
  2. from: istewart@datlog.co.uk
  3. subject: v13i079: MS-Shell 1.6 - Patch 1.  Part 01 of 02
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 79
  7. Submitted-by: istewart@datlog.co.uk
  8. Archive-name: ms_sh-1.6/patch01
  9.  
  10. This is the FIRST patch to the MS-DOS Bourne Shell release 1.6.  However,
  11. it changes the release from 1.6 to 1.6.2.  Release 1.6.1 never successfully
  12. made it out of Data Logic - transmission corruption.
  13.  
  14. The patch fixes a number of minor problems in 1.6 and changes the way
  15. swap files are written.  After the first write, only the data and stack
  16. are written to the file - reducing the I/O overhead I hope.  There are
  17. also some fixes and enhancements to the directory and raw I/O functions to
  18. support Unix format directory names (ones ending in a / which DOS doesn't
  19. like).
  20.  
  21. The changes are marked in the diffs for Notes1.6.
  22.  
  23. There are two shar files in this patch.  Unshar them (they check the order
  24. so you should be OK there) to generate Patch1.6.2.  Then apply the patch
  25. in the top level source directory for the shell.
  26.  
  27.     patch -p <Patch1.6.2
  28.  
  29. In passing, this version has been tested on PC-NFS 3.0 with no problems.
  30.  
  31. Regards,
  32.  
  33. Ian Stewartson
  34. Data Logic Ltd, Queens House, Greenhill Way, Harrow, Middlesex, HA1 1YR, UK.
  35. (Phone) +44 81 863 0383 (Telex) 888103 (Fax) +44 81 861 2010
  36. (Network) istewart@datlog.co.uk or ukc!datlog!istewart
  37. --------------------
  38. #!/bin/sh
  39. # This is MS-Shell, Patch 1.6.2, a shell archive (shar 3.21)
  40. # made 06/26/1990 19:18 UTC by istewart@dlvax2
  41. # Source directory /usr/proj1/ssd/istewart/src/shell
  42. #
  43. # existing files WILL be overwritten
  44. #
  45. # This is part 1 of a multipart archive                                    
  46. # do not concatenate these parts, unpack them in order with /bin/sh        
  47. #
  48. # This shar contains:
  49. # length  mode       name
  50. # ------ ---------- ------------------------------------------
  51. #  65254 -rw-r--r-- Patch1.6.2
  52. #
  53. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  54.  then TOUCH=touch
  55.  else TOUCH=true
  56. fi
  57. if test -r @shar_seq_.tmp; then
  58.     echo "Must unpack archives in sequence!"
  59.     next=`cat @shar_seq_.tmp`; echo "Please unpack part $next next"
  60.     exit 1
  61. fi
  62. # ============= Patch1.6.2 ==============
  63. echo "x - extracting Patch1.6.2 (Text)"
  64. sed 's/^X//' << 'SHAR_EOF' > Patch1.6.2 &&
  65. XIndex: Notes1.6
  66. X*** ../sh16/Notes1.6    Mon Apr 30 21:43:13 1990
  67. X--- Notes1.6    Tue Jun 26 19:46:22 1990
  68. X***************
  69. X*** 1,7 ****
  70. X! Version 1.6 Release Notes:
  71. X  
  72. X! The following problems have been fixed in 1.6
  73. X  
  74. X     1.   Traps did now work correctly (as far as possible for DOS) la System
  75. X      V.3
  76. X     2.   File descriptor duplication closed standard input.
  77. X--- 1,12 ----
  78. X! Version 1.6.2 Release Notes:
  79. X  
  80. X! Note: Release 1.6.1 did occur to comp.ibm.pc.binaries.  However, the
  81. X! transmission was corrupt and by the time I was notified (the moderator having
  82. X! been in hospital), release 1.6.2 was ready.  So the source patches for
  83. X! 1.6.1 where not released.
  84. X  
  85. X+ The following problems have been fixed in 1.6.2 (including 1.6).
  86. X+ 
  87. X     1.   Traps did now work correctly (as far as possible for DOS) la System
  88. X      V.3
  89. X     2.   File descriptor duplication closed standard input.
  90. X***************
  91. X*** 18,23 ****
  92. X--- 23,40 ----
  93. X     9.   exec >filename did not work
  94. X    10.   Some temporary files were not deleted.
  95. X    11.   The swapper failed to check for disk full errors
  96. X+   12.   The full path name is provided to the DOS spawn interrupt so that
  97. X+     the PICNIX utilities now work.
  98. X+   13.   Certain areas of code are now protected against interruption which
  99. X+     would cause hanging.
  100. X+   14.    The original directory is restored on exit.
  101. X+   15.    A couple of missing setarea having been added to stop hangs
  102. X+   16.    The input buffer is correctly initialised and nulls are added so
  103. X+     that the correct command is saved when an interrupt occurs.
  104. X+   17.    An error in the reloading of buffers from files has been fixed.
  105. X+   18.    The directory routines have been modified to correctly handle
  106. X+     all valid Unix format directory names (ie a Unix directory name
  107. X+     can end in /.  However, DOS does not think this is a directory).
  108. X  
  109. X  The following enhancements have been made:
  110. X  
  111. X***************
  112. X*** 48,53 ****
  113. X--- 65,74 ----
  114. X     16.  Quoting of arugments with white space in them to MSDOS commands
  115. X      has been added.
  116. X     17.  Full internal Interrup 24 support is provided.
  117. X+    18.  The amount of data written to swap file by only dumping the
  118. X+     data and stack space after the first write.
  119. X+    19.    The ms_dio function have been enhanced to support raw and block
  120. X+     devices (well not really - just the stat and fstat functions).
  121. X  
  122. X  The following enhancements/bugs remain outstanding:
  123. X  
  124. X***************
  125. X*** 62,70 ****
  126. X      2.  8 Bit character are not supported.  This is tied in with the
  127. X      processing of escape characters.  The shell uses the 8-bit to
  128. X      mark escaped characters (Release 1.7).
  129. X-     
  130. X-     3.  Reduce the amount of data written to swap file by only dumping the
  131. X-     data and stack space after the first write (Release 1.7+).
  132. X      
  133. X  Thanks are due to
  134. X  
  135. X--- 83,88 ----
  136. XIndex: lib/ms_dio.c
  137. X*** ../sh16/lib/ms_dio.c    Fri Mar  2 11:32:52 1990
  138. X--- lib/ms_dio.c    Fri Jun 22 09:15:57 1990
  139. X***************
  140. X*** 11,18 ****
  141. X   * The devices supported are:
  142. X   *
  143. X   *    /dev/hdxy    - Hard disk drive x parition y (x = 0 to 9, y =
  144. X!  *              0 to 9, where 0 is the whole disk).
  145. X!  *    /dev/fdx    - Floppy drive x (x = 0 to 9).
  146. X   *    /dev/kmem    - Memory driver
  147. X   *
  148. X   * It does its best to determine what type of disk you are reading.
  149. X--- 11,21 ----
  150. X   * The devices supported are:
  151. X   *
  152. X   *    /dev/hdxy    - Hard disk drive x parition y (x = 0 to 9, y =
  153. X!  *              0 to 9, where 0 is the whole disk) as a block
  154. X!  *              device
  155. X!  *    /dev/fdx    - Floppy drive x (x = 0 to 9) as a block device
  156. X!  *    /dev/rhdxy    - Hard disk drive as a character device
  157. X!  *    /dev/rfdx    - Floppy drive as a character device
  158. X   *    /dev/kmem    - Memory driver
  159. X   *
  160. X   * It does its best to determine what type of disk you are reading.
  161. X***************
  162. X*** 20,25 ****
  163. X--- 23,30 ----
  164. X   * Redistribution and use in source and binary forms are permitted
  165. X   * provided that the above copyright notice is duplicated in the
  166. X   * source form.
  167. X+  *
  168. X+  * Version 1.2, 22 June 90
  169. X   */
  170. X  
  171. X  #include <sys/types.h>
  172. X***************
  173. X*** 33,38 ****
  174. X--- 38,44 ----
  175. X  #include <ctype.h>
  176. X  #include <unistd.h>
  177. X  #include <time.h>
  178. X+ #include <stdarg.h>
  179. X  #include <ms_dio.h>
  180. X  
  181. X  #undef open
  182. X***************
  183. X*** 49,74 ****
  184. X  #undef isatty
  185. X  #undef tell
  186. X  
  187. X! #define SECSIZ        512
  188. X  #define    MS_MODIFIER    30000
  189. X! #define BIOS_READ    0x2
  190. X  #define BIOS_WRITE    0x3
  191. X  #define HD_FLAG        0x80        /* Hard disk flag        */
  192. X  #define MEGABYTE    1048576L
  193. X! #define DRIVE_RAM    20
  194. X  
  195. X- #ifdef __STDC__
  196. X  static int        dio_do (int, struct fs *, char *, long, unsigned int);
  197. X  static struct fs    *dio_fpcheck (int);
  198. X! static int        dio_fncheck (char *);
  199. X! #else
  200. X! static int        dio_do ();
  201. X! static struct fs    *dio_fpcheck ();
  202. X! static int        dio_fncheck ();
  203. X! #endif
  204. X  
  205. X  static struct fs {
  206. X      int        mode;            /* Open mode            */
  207. X      int        drive;
  208. X      int        partition;        /* Hard disk partition number    */
  209. X      off_t    location;        /* Current offset        */
  210. X--- 55,77 ----
  211. X  #undef isatty
  212. X  #undef tell
  213. X  
  214. X! #define SECSIZ        512        /* Sector size            */
  215. X  #define    MS_MODIFIER    30000
  216. X! #define BIOS_READ    0x2        /* BIOS functions        */
  217. X  #define BIOS_WRITE    0x3
  218. X  #define HD_FLAG        0x80        /* Hard disk flag        */
  219. X  #define MEGABYTE    1048576L
  220. X! #define DRIVE_RAM    20        /* RAM drive value        */
  221. X  
  222. X  static int        dio_do (int, struct fs *, char *, long, unsigned int);
  223. X  static struct fs    *dio_fpcheck (int);
  224. X! static int        dio_fncheck (char *, mode_t *);
  225. X  
  226. X+ /* Our internal file handler table */
  227. X+ 
  228. X  static struct fs {
  229. X      int        mode;            /* Open mode            */
  230. X+     mode_t    st_mode;        /* File mode for stat        */
  231. X      int        drive;
  232. X      int        partition;        /* Hard disk partition number    */
  233. X      off_t    location;        /* Current offset        */
  234. X***************
  235. X*** 79,84 ****
  236. X--- 82,89 ----
  237. X      long    m_scount;        /* Total sectors per disk    */
  238. X  } *MS_io_fs[_NFILE];
  239. X  
  240. X+ /* MSDOS Partition table */
  241. X+ 
  242. X  struct partition {
  243. X      long    f_type;            /* Type flags            */
  244. X      long    f_status;        /* Status flags            */
  245. X***************
  246. X*** 86,93 ****
  247. X      long    size;            /* Size in sectors        */
  248. X  };
  249. X  
  250. X! static int    fs_init = 0;
  251. X  
  252. X  /* Do the actual read/write to the disk.  This function is not used
  253. X   * for the RAM drive
  254. X   */
  255. X--- 91,125 ----
  256. X      long    size;            /* Size in sectors        */
  257. X  };
  258. X  
  259. X! static int    fs_init = 0;        /* Initialisation complete    */
  260. X! static int    DIO_Error_Code;        /* Last do_dio Error Code    */
  261. X  
  262. X+ #define DEC_BADC    0x01        /* Bad command            */
  263. X+ #define DEC_AMNF    0x02        /* Address mark not found    */
  264. X+ #define DEC_WRITEP    0x03        /* Write protected        */
  265. X+ #define DEC_SECNF    0x04        /* Sector not found        */
  266. X+ #define DEC_RESET    0x05        /* Reset failed            */
  267. X+ #define DEC_CHANGE    0x06        /* Diskette remove/changed    */
  268. X+ #define DEC_PARAMETER    0x07        /* Bad parameter table        */
  269. X+ #define DEC_DMAOVER    0x08        /* DMA overrun            */
  270. X+ #define DEC_DMACROSS    0x09        /* DMA across 64K boundary    */
  271. X+ #define DEC_BADSECTOR    0x0a        /* Bad sector detected        */
  272. X+ #define DEC_BADTRACK    0x0b        /* Bad track detected        */
  273. X+ #define DEC_UNSUPTRK    0x0c        /* Unsupported track        */
  274. X+ #define DEC_INVSEC    0x0d        /* Invalid number of sectors    */
  275. X+ #define DEC_CDAMD    0x0e        /* Control data address mark    */
  276. X+ #define DEC_DMAARB    0x0f        /* DMA arbitration error    */
  277. X+ #define DEC_CRC        0x10        /* bad CRC/ECC on read        */
  278. X+ #define DEC_ECC        0x11        /* Data ECC corrected        */
  279. X+ #define DEC_CONTROL    0x20        /* Controller failed        */
  280. X+ #define DEC_SEEK    0x40        /* Seek failed            */
  281. X+ #define DEC_TIMEOUT    0x80        /* Timeout            */
  282. X+ #define DEC_NOTREADY    0xaa        /* Drive not ready        */
  283. X+ #define DEC_UNDEF    0xbb        /* Undefined error        */
  284. X+ #define DEC_WRITEF    0xcc        /* Write fault            */
  285. X+ #define DEC_STATUS    0xe0        /* Status error            */
  286. X+ #define DEC_SENSE    0xff        /* Sense operation failed    */
  287. X+ 
  288. X  /* Do the actual read/write to the disk.  This function is not used
  289. X   * for the RAM drive
  290. X   */
  291. X***************
  292. X*** 107,112 ****
  293. X--- 139,146 ----
  294. X      struct SREGS    sreg;
  295. X  #endif
  296. X  
  297. X+     DIO_Error_Code = 0;
  298. X+ 
  299. X      for (j = 0; j < secknt; j += nsec, buf += (nsec * SECSIZ), secnum += nsec)
  300. X      {
  301. X  
  302. X***************
  303. X*** 154,165 ****
  304. X  
  305. X          if (!reg.x.cflag)
  306. X          break;
  307. X-     }
  308. X  
  309. X  /* Check for failure */
  310. X  
  311. X      if (i == 3)
  312. X      {
  313. X          errno = EIO;
  314. X          return -1;
  315. X      }
  316. X--- 188,210 ----
  317. X  
  318. X          if (!reg.x.cflag)
  319. X          break;
  320. X  
  321. X+ /* If we are reading more than one sector - reduce the number of sectors by
  322. X+  * two
  323. X+  */
  324. X+ 
  325. X+         else if (nsec > 1)
  326. X+         {
  327. X+         --i;
  328. X+         nsec /= 2;
  329. X+         }
  330. X+     }
  331. X+ 
  332. X  /* Check for failure */
  333. X  
  334. X      if (i == 3)
  335. X      {
  336. X+         DIO_Error_Code = (int)reg.h.ah;
  337. X          errno = EIO;
  338. X          return -1;
  339. X      }
  340. X***************
  341. X*** 168,174 ****
  342. X      return secknt * SECSIZ;
  343. X  }
  344. X  
  345. X! /* Write function */
  346. X  
  347. X  int        dio_write (fp, from_buf, from_cnt)
  348. X  int        fp;            /* File handler            */
  349. X--- 213,221 ----
  350. X      return secknt * SECSIZ;
  351. X  }
  352. X  
  353. X! /*
  354. X!  * write - Write function
  355. X!  */
  356. X  
  357. X  int        dio_write (fp, from_buf, from_cnt)
  358. X  int        fp;            /* File handler            */
  359. X***************
  360. X*** 290,296 ****
  361. X      return amt;
  362. X  }
  363. X  
  364. X! /* Read function */
  365. X  
  366. X  int        dio_read (fp, to_buf, to_cnt)
  367. X  int        fp;            /* File handler            */
  368. X--- 337,345 ----
  369. X      return amt;
  370. X  }
  371. X  
  372. X! /*
  373. X!  * read - Read function
  374. X!  */
  375. X  
  376. X  int        dio_read (fp, to_buf, to_cnt)
  377. X  int        fp;            /* File handler            */
  378. X***************
  379. X*** 334,339 ****
  380. X--- 383,390 ----
  381. X      return to_cnt;
  382. X      }
  383. X  
  384. X+ /* Get the last part of the first sector required */
  385. X+ 
  386. X      fquo = FP->location / SECSIZ;
  387. X      frem = (unsigned int) (FP->location % SECSIZ);
  388. X  
  389. X***************
  390. X*** 355,360 ****
  391. X--- 406,413 ----
  392. X      to_cnt -= amt;
  393. X      }
  394. X  
  395. X+ /* Get the middle sectors required */
  396. X+ 
  397. X      cquo = to_cnt / SECSIZ;
  398. X      crem = to_cnt % SECSIZ;
  399. X  
  400. X***************
  401. X*** 391,415 ****
  402. X      return (amt);
  403. X  }
  404. X  
  405. X! int    dio_open (name, mode, permissions)
  406. X  char    *name;
  407. X  int    mode;
  408. X- mode_t    permissions;
  409. X  {
  410. X      struct fs    *FP;
  411. X      int        fp, i, j;
  412. X      int        drive, ndrive;
  413. X      union REGS    iregs;
  414. X      char    buf[SECSIZ];
  415. X  
  416. X! /* Check for initialisation */
  417. X  
  418. X      if (!(fs_init++))
  419. X      memset (MS_io_fs, 0, sizeof (struct fs *) * _NFILE);
  420. X  
  421. X  /* Direct I/o file name */
  422. X  
  423. X!     if ((drive = dio_fncheck (name)) != -1)
  424. X      {
  425. X      for (fp = 0; (fp < _NFILE) && (MS_io_fs[fp] != (struct fs *)NULL); fp++)
  426. X          ;
  427. X--- 444,480 ----
  428. X      return (amt);
  429. X  }
  430. X  
  431. X! /*
  432. X!  * open - Open a file
  433. X!  */
  434. X! 
  435. X! int    dio_open (name, mode)
  436. X  char    *name;
  437. X  int    mode;
  438. X  {
  439. X      struct fs    *FP;
  440. X      int        fp, i, j;
  441. X      int        drive, ndrive;
  442. X      union REGS    iregs;
  443. X      char    buf[SECSIZ];
  444. X+     va_list    ap;
  445. X+     int        permissions;
  446. X+     mode_t    dmode;
  447. X  
  448. X! /* Check the permission mask if it exists */
  449. X  
  450. X+     va_start (ap, mode);
  451. X+     permissions = va_arg (ap, int);
  452. X+     va_end (ap);
  453. X+ 
  454. X+ /* Check for initialisation */
  455. X+ 
  456. X      if (!(fs_init++))
  457. X      memset (MS_io_fs, 0, sizeof (struct fs *) * _NFILE);
  458. X  
  459. X  /* Direct I/o file name */
  460. X  
  461. X!     if ((drive = dio_fncheck (name, &dmode)) != -1)
  462. X      {
  463. X      for (fp = 0; (fp < _NFILE) && (MS_io_fs[fp] != (struct fs *)NULL); fp++)
  464. X          ;
  465. X***************
  466. X*** 424,430 ****
  467. X      }
  468. X  
  469. X      FP->location = 0L;
  470. X!     FP->mode = mode;
  471. X  
  472. X  /* RAM access ? */
  473. X  
  474. X--- 489,496 ----
  475. X      }
  476. X  
  477. X      FP->location = 0L;
  478. X!     FP->mode     = mode;
  479. X!     FP->st_mode  = dmode;
  480. X  
  481. X  /* RAM access ? */
  482. X  
  483. X***************
  484. X*** 585,592 ****
  485. X  
  486. X          if (dio_do (BIOS_READ, FP, buf, 0L, 1) == -1)
  487. X          {
  488. X-             FP->m_sector = (iregs.h.bl == 0x02) ? 15 : 9;
  489. X  
  490. X              iregs.h.ah   = 0x17;
  491. X              iregs.h.dl   = (unsigned char)FP->drive;
  492. X              iregs.h.al   = (unsigned char)(5 - iregs.h.bl);
  493. X--- 651,672 ----
  494. X  
  495. X          if (dio_do (BIOS_READ, FP, buf, 0L, 1) == -1)
  496. X          {
  497. X  
  498. X+ /* If not a sector not found error - abort */
  499. X+ 
  500. X+             if ((DIO_Error_Code != DEC_SECNF) &&
  501. X+             (DIO_Error_Code != DEC_UNSUPTRK) &&
  502. X+             (DIO_Error_Code != DEC_INVSEC))
  503. X+             {
  504. X+             free (FP);
  505. X+             errno = EIO;
  506. X+             return -1;
  507. X+             }
  508. X+ 
  509. X+ /* Otherwise, switch type */
  510. X+ 
  511. X+             FP->m_sector = (iregs.h.bl == 0x02) ? 15 : 9;
  512. X+ 
  513. X              iregs.h.ah   = 0x17;
  514. X              iregs.h.dl   = (unsigned char)FP->drive;
  515. X              iregs.h.al   = (unsigned char)(5 - iregs.h.bl);
  516. X***************
  517. X*** 604,615 ****
  518. X  /* Check to see if sector 8 exists */
  519. X  
  520. X          if (dio_do (BIOS_READ, FP, buf, 8L, 1) == -1)
  521. X!             FP->m_sector = 8;
  522. X  
  523. X  /* Check to see if sector 380 exists */
  524. X  
  525. X          if (dio_do (BIOS_READ, FP, buf, 380L, 1) == -1)
  526. X              FP->m_head = 1;
  527. X          }
  528. X  
  529. X  /* 720K drive - read sector 15 to see if 1.4M */
  530. X--- 684,723 ----
  531. X  /* Check to see if sector 8 exists */
  532. X  
  533. X          if (dio_do (BIOS_READ, FP, buf, 8L, 1) == -1)
  534. X!         {
  535. X  
  536. X+ /* If not a sector not found error - abort */
  537. X+ 
  538. X+             if ((DIO_Error_Code != DEC_SECNF) &&
  539. X+             (DIO_Error_Code != DEC_UNSUPTRK) &&
  540. X+             (DIO_Error_Code != DEC_INVSEC))
  541. X+             {
  542. X+             free (FP);
  543. X+             errno = EIO;
  544. X+             return -1;
  545. X+             }
  546. X+ 
  547. X+             FP->m_sector = 8;
  548. X+         }
  549. X+ 
  550. X  /* Check to see if sector 380 exists */
  551. X  
  552. X          if (dio_do (BIOS_READ, FP, buf, 380L, 1) == -1)
  553. X+         {
  554. X+ 
  555. X+ /* If not a sector not found error - abort */
  556. X+ 
  557. X+             if ((DIO_Error_Code != DEC_SECNF) &&
  558. X+             (DIO_Error_Code != DEC_UNSUPTRK) &&
  559. X+             (DIO_Error_Code != DEC_INVSEC))
  560. X+             {
  561. X+             free (FP);
  562. X+             errno = EIO;
  563. X+             return -1;
  564. X+             }
  565. X+ 
  566. X              FP->m_head = 1;
  567. X+         }
  568. X          }
  569. X  
  570. X  /* 720K drive - read sector 15 to see if 1.4M */
  571. X***************
  572. X*** 619,625 ****
  573. X--- 727,747 ----
  574. X          FP->m_scount = FP->m_cyl * FP->m_head * FP->m_sector;
  575. X  
  576. X          if (dio_do (BIOS_READ, FP, buf, 17L, 1) == -1)
  577. X+         {
  578. X+ 
  579. X+ /* If not a sector not found error - abort */
  580. X+ 
  581. X+             if ((DIO_Error_Code != DEC_SECNF) &&
  582. X+             (DIO_Error_Code != DEC_UNSUPTRK) &&
  583. X+             (DIO_Error_Code != DEC_INVSEC))
  584. X+             {
  585. X+             free (FP);
  586. X+             errno = EIO;
  587. X+             return -1;
  588. X+             }
  589. X+ 
  590. X              FP->m_sector = 9;
  591. X+         }
  592. X          }
  593. X  
  594. X          FP->m_scount = FP->m_cyl * FP->m_head * FP->m_sector;
  595. X***************
  596. X*** 635,641 ****
  597. X      return open (name, mode, permissions);
  598. X  }
  599. X  
  600. X! /* fstat function */
  601. X  
  602. X  int        dio_fstat (fp, St)
  603. X  int        fp;
  604. X--- 757,765 ----
  605. X      return open (name, mode, permissions);
  606. X  }
  607. X  
  608. X! /* 
  609. X!  * fstat - fstat function
  610. X!  */
  611. X  
  612. X  int        dio_fstat (fp, St)
  613. X  int        fp;
  614. X***************
  615. X*** 652,658 ****
  616. X  /* Dummy values */
  617. X  
  618. X      memset (St, 0, sizeof (struct stat));
  619. X!     St->st_mode = 0x61b6;
  620. X      St->st_nlink = 1;
  621. X  
  622. X      if (FP->drive == DRIVE_RAM)
  623. X--- 776,782 ----
  624. X  /* Dummy values */
  625. X  
  626. X      memset (St, 0, sizeof (struct stat));
  627. X!     St->st_mode = FP->st_mode;
  628. X      St->st_nlink = 1;
  629. X  
  630. X      if (FP->drive == DRIVE_RAM)
  631. X***************
  632. X*** 675,681 ****
  633. X  }
  634. X  
  635. X  /*
  636. X!  * Close function
  637. X   */
  638. X  
  639. X  int    dio_close (fp)
  640. X--- 799,805 ----
  641. X  }
  642. X  
  643. X  /*
  644. X!  * close - Close function
  645. X   */
  646. X  
  647. X  int    dio_close (fp)
  648. X***************
  649. X*** 695,701 ****
  650. X  }
  651. X  
  652. X  /*
  653. X!  * Seek function
  654. X   */
  655. X  
  656. X  long    dio_lseek (fp, off, type)
  657. X--- 819,825 ----
  658. X  }
  659. X  
  660. X  /*
  661. X!  * lseek - Seek function
  662. X   */
  663. X  
  664. X  long    dio_lseek (fp, off, type)
  665. X***************
  666. X*** 737,743 ****
  667. X      return (FP->location = check);
  668. X  }
  669. X  
  670. X! /* Check for a valid file pointer */
  671. X  
  672. X  static struct fs    *dio_fpcheck (fp)
  673. X  int            fp;
  674. X--- 861,870 ----
  675. X      return (FP->location = check);
  676. X  }
  677. X  
  678. X! /*
  679. X!  * Check for a valid file pointer.  Look up the file handler in the table
  680. X!  * of our file handlers
  681. X!  */
  682. X  
  683. X  static struct fs    *dio_fpcheck (fp)
  684. X  int            fp;
  685. X***************
  686. X*** 754,800 ****
  687. X      return FP;
  688. X  }
  689. X  
  690. X! /* Check for a valid file name */
  691. X  
  692. X! static int    dio_fncheck (name)
  693. X  char        *name;
  694. X  {
  695. X  
  696. X! /* Check for hard disk */
  697. X  
  698. X!     if (isdigit(name[7]) && isdigit(name[8]) && (strlen (name) == 9) &&
  699. X!     (!strnicmp (name, "/dev/hd", 6)))
  700. X      {
  701. X      int    i = atoi (&name[7]);
  702. X  
  703. X      return ((i % 10) > 4) ? -1 : i | HD_FLAG;
  704. X      }
  705. X  
  706. X! /* Check for floppy disk */
  707. X  
  708. X!     else if (isdigit(name[7]) && (strlen (name) == 8) &&
  709. X!     (!strnicmp (name, "/dev/fd", 6)))
  710. X      return name[7] - '0';
  711. X  
  712. X      else if (!stricmp (name, "/dev/kmem"))
  713. X      return DRIVE_RAM;
  714. X  
  715. X      return -1;
  716. X  }
  717. X  
  718. X! /* Get file status */
  719. X  
  720. X  int        dio_stat (name, St)
  721. X  char        *name;
  722. X  struct stat    *St;
  723. X  {
  724. X      int        drive;
  725. X  
  726. X!     if ((drive = dio_fncheck (name)) == -1)
  727. X      return stat (name, St);
  728. X  
  729. X      memset (St, 0, sizeof (struct stat));
  730. X!     St->st_mode = 0x61b6;
  731. X      St->st_nlink = 1;
  732. X      St->st_atime = time ((time_t *)NULL);
  733. X      St->st_ctime = St->st_ctime;
  734. X--- 881,959 ----
  735. X      return FP;
  736. X  }
  737. X  
  738. X! /*
  739. X!  * Check for a valid file name.  We are looking for one of 'our' file names
  740. X!  * /dev/hd??, /dev/fd? or /dev/mem.  The device number is returned.
  741. X!  */
  742. X  
  743. X! static int    dio_fncheck (name, dmode)
  744. X  char        *name;
  745. X+ mode_t        *dmode;
  746. X  {
  747. X  
  748. X! /* Set up default mode */
  749. X  
  750. X!     if (dmode != (mode_t *)NULL)
  751. X!     *dmode = 0x61b6;
  752. X! 
  753. X! /* Check for hard disk */
  754. X! 
  755. X!     if (isdigit (name[7]) && isdigit (name[8]) && (strlen (name) == 9) &&
  756. X!     (strnicmp (name, "/dev/hd", 7) == 0))
  757. X      {
  758. X      int    i = atoi (&name[7]);
  759. X  
  760. X      return ((i % 10) > 4) ? -1 : i | HD_FLAG;
  761. X      }
  762. X  
  763. X!     else if (isdigit (name[8]) && isdigit (name[9]) && (strlen (name) == 10) &&
  764. X!          (strnicmp (name, "/dev/rhd", 8) == 0))
  765. X!     {
  766. X!     int    i = atoi (&name[8]);
  767. X  
  768. X!     if (dmode != (mode_t *)NULL)
  769. X!         *dmode = 0x21b6;
  770. X! 
  771. X!     return ((i % 10) > 4) ? -1 : i | HD_FLAG;
  772. X!     }
  773. X! 
  774. X! /* Check for floppy disk */
  775. X! 
  776. X!     else if (isdigit (name[7]) && (strlen (name) == 8) &&
  777. X!     (!strnicmp (name, "/dev/fd", 7)))
  778. X      return name[7] - '0';
  779. X  
  780. X+     else if (isdigit(name[8]) && (strlen (name) == 9) &&
  781. X+     (!strnicmp (name, "/dev/rfd", 8)))
  782. X+     {
  783. X+     if (dmode != (mode_t *)NULL)
  784. X+         *dmode = 0x21b6;
  785. X+ 
  786. X+     return name[8] - '0';
  787. X+     }
  788. X+ 
  789. X      else if (!stricmp (name, "/dev/kmem"))
  790. X      return DRIVE_RAM;
  791. X  
  792. X      return -1;
  793. X  }
  794. X  
  795. X! /*
  796. X!  * stat - Get file status
  797. X!  */
  798. X  
  799. X  int        dio_stat (name, St)
  800. X  char        *name;
  801. X  struct stat    *St;
  802. X  {
  803. X      int        drive;
  804. X+     mode_t    dmode;
  805. X  
  806. X!     if ((drive = dio_fncheck (name, &dmode)) == -1)
  807. X      return stat (name, St);
  808. X  
  809. X      memset (St, 0, sizeof (struct stat));
  810. X!     St->st_mode  = dmode;
  811. X      St->st_nlink = 1;
  812. X      St->st_atime = time ((time_t *)NULL);
  813. X      St->st_ctime = St->st_ctime;
  814. X***************
  815. X*** 816,828 ****
  816. X      return 0;
  817. X  }
  818. X  
  819. X! /* Check file access */
  820. X  
  821. X  int    dio_access (name, mode)
  822. X  char    *name;
  823. X  int    mode;
  824. X  {
  825. X!     if (dio_fncheck (name) == -1)
  826. X      return access (name, mode);
  827. X  
  828. X      else if (mode & 1)
  829. X--- 975,989 ----
  830. X      return 0;
  831. X  }
  832. X  
  833. X! /*
  834. X!  * access - Check file access
  835. X!  */
  836. X  
  837. X  int    dio_access (name, mode)
  838. X  char    *name;
  839. X  int    mode;
  840. X  {
  841. X!     if (dio_fncheck (name, (mode_t *)NULL) == -1)
  842. X      return access (name, mode);
  843. X  
  844. X      else if (mode & 1)
  845. X***************
  846. X*** 834,859 ****
  847. X      return 0;
  848. X  }
  849. X  
  850. X! /* Change file permissions */
  851. X  
  852. X  int    dio_chmod (name, mode)
  853. X  char    *name;
  854. X  int    mode;
  855. X  {
  856. X!     return (dio_fncheck (name) == -1) ? chmod (name, mode) : 0;
  857. X  }
  858. X  
  859. X! /* Create file */
  860. X  
  861. X  int    dio_creat (name, mode)
  862. X  char    *name;
  863. X  int    mode;
  864. X  {
  865. X!     return (dio_fncheck (name) == -1) ? creat (name, mode)
  866. X                        : dio_open (name, O_WRONLY, mode);
  867. X  }
  868. X  
  869. X! /* Duplicate handler */
  870. X  
  871. X  int    dio_dup (fp)
  872. X  int    fp;
  873. X--- 995,1026 ----
  874. X      return 0;
  875. X  }
  876. X  
  877. X! /*
  878. X!  * chmod - Change file permissions
  879. X!  */
  880. X  
  881. X  int    dio_chmod (name, mode)
  882. X  char    *name;
  883. X  int    mode;
  884. X  {
  885. X!     return (dio_fncheck (name, (mode_t *)NULL) == -1) ? chmod (name, mode) : 0;
  886. X  }
  887. X  
  888. X! /*
  889. X!  * create - Create file
  890. X!  */
  891. X  
  892. X  int    dio_creat (name, mode)
  893. X  char    *name;
  894. X  int    mode;
  895. X  {
  896. X!     return (dio_fncheck (name, (mode_t *)NULL) == -1) ? creat (name, mode)
  897. X                        : dio_open (name, O_WRONLY, mode);
  898. X  }
  899. X  
  900. X! /*
  901. X!  * dup - Duplicate handler
  902. X!  */
  903. X  
  904. X  int    dio_dup (fp)
  905. X  int    fp;
  906. X***************
  907. X*** 864,872 ****
  908. X--- 1031,1043 ----
  909. X      if (fp < MS_MODIFIER)
  910. X      return dup (fp);
  911. X  
  912. X+ /* Check valid */
  913. X+ 
  914. X      if ((FP1 = dio_fpcheck (fp)) == (struct fs *)NULL)
  915. X      return -1;
  916. X  
  917. X+ /* Create a new entry */
  918. X+ 
  919. X      for (fp = 0; (fp < _NFILE) && (MS_io_fs[fp] != (struct fs *)NULL); fp++)
  920. X      ;
  921. X  
  922. X***************
  923. X*** 877,888 ****
  924. X      return -1;
  925. X      }
  926. X  
  927. X      MS_io_fs[fp] = FP;
  928. X      *FP = *FP1;
  929. X      return fp;
  930. X  }
  931. X  
  932. X! /* Check if tty */
  933. X  
  934. X  int    dio_isatty (fp)
  935. X  int    fp;
  936. X--- 1048,1063 ----
  937. X      return -1;
  938. X      }
  939. X  
  940. X+ /* Duplicate it */
  941. X+ 
  942. X      MS_io_fs[fp] = FP;
  943. X      *FP = *FP1;
  944. X      return fp;
  945. X  }
  946. X  
  947. X! /*
  948. X!  * isatty - Check if tty
  949. X!  */
  950. X  
  951. X  int    dio_isatty (fp)
  952. X  int    fp;
  953. X***************
  954. X*** 893,899 ****
  955. X      return 0;
  956. X  }
  957. X  
  958. X! /* Tell location */
  959. X  
  960. X  long    dio_tell (fp)
  961. X  int    fp;
  962. X--- 1068,1076 ----
  963. X      return 0;
  964. X  }
  965. X  
  966. X! /*
  967. X!  * tell - Tell location
  968. X!  */
  969. X  
  970. X  long    dio_tell (fp)
  971. X  int    fp;
  972. XIndex: lib/director.c
  973. X*** ../sh16/lib/director.c    Fri Mar  2 11:33:41 1990
  974. X--- lib/director.c    Fri Jun 22 09:18:24 1990
  975. X***************
  976. X*** 4,9 ****
  977. X--- 4,11 ----
  978. X   *  A public domain implementation of BSD directory routines for
  979. X   *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
  980. X   *  August 1897
  981. X+  *
  982. X+  *  Modified by Ian Stewartson, Data Logic.
  983. X   */
  984. X  
  985. X  #include <sys/types.h>
  986. X***************
  987. X*** 27,70 ****
  988. X  {
  989. X      struct stat        statb;
  990. X      DIR            *dirp;
  991. X!     char        c;
  992. X      struct _dircontents    *dp;
  993. X!     char        nbuf[PATH_MAX + NAME_MAX + 2];
  994. X      struct find_t    dtabuf;
  995. X      
  996. X!     if (stat (name, &statb) < 0)
  997. X!     return (DIR *) NULL;
  998. X  
  999. X!     if (!S_ISDIR(statb.st_mode))
  1000. X      {
  1001. X      errno = ENOTDIR;
  1002. X      return (DIR *)NULL;
  1003. X      }
  1004. X  
  1005. X      if ((dirp = (DIR *) malloc (sizeof (DIR))) == (DIR *) NULL)
  1006. X      return (DIR *) NULL;
  1007. X  
  1008. X!     if (*name && (c = name[strlen (name) - 1]) != '\\' && c != '/')
  1009. X!     (void) strcat (strcpy (nbuf, name), "\\*.*");
  1010. X  
  1011. X!     else
  1012. X!     (void) strcat (strcpy (nbuf, name), "*.*");
  1013. X  
  1014. X      dirp->dd_loc      = 0;
  1015. X      dirp->dd_cp       = (struct _dircontents *) NULL;
  1016. X      dirp->dd_contents = (struct _dircontents *) NULL;
  1017. X  
  1018. X      if (_dos_findfirst (nbuf, ATTRIBUTES, &dtabuf) != 0)
  1019. X      return dirp;
  1020. X  
  1021. X      do 
  1022. X      {
  1023. X!     if (((dp = (struct _dircontents *) malloc(sizeof(struct _dircontents))) == (struct _dircontents *) NULL) ||
  1024. X          ((dp->_d_entry = strdup (dtabuf.name)) == (char *) NULL))
  1025. X      {
  1026. X          if (dp != (char *)NULL)
  1027. X          free ((char *) dp);
  1028. X  
  1029. X          free_dircontents (dirp->dd_contents);
  1030. X          return (DIR *) NULL;
  1031. X      }
  1032. X--- 29,113 ----
  1033. X  {
  1034. X      struct stat        statb;
  1035. X      DIR            *dirp;
  1036. X!     char        *last;
  1037. X      struct _dircontents    *dp;
  1038. X!     char        *nbuf;
  1039. X      struct find_t    dtabuf;
  1040. X+     int            len = strlen (name);
  1041. X      
  1042. X!     if (!len)
  1043. X!     {
  1044. X!     errno = ENOTDIR;
  1045. X!     return (DIR *)NULL;
  1046. X!     }
  1047. X  
  1048. X!     if ((nbuf = malloc (len + 4)) == (char *)NULL)
  1049. X!     return (DIR *) NULL;
  1050. X! 
  1051. X!     strcpy (nbuf, name);
  1052. X!     last = &nbuf[len - 1];
  1053. X! 
  1054. X! /* Ok, DOS is very picky about its directory names.  The following are
  1055. X!  * valid.
  1056. X!  *
  1057. X!  *  c:/
  1058. X!  *  c:.
  1059. X!  *  c:name/name1
  1060. X!  *
  1061. X!  *  c:name/ is not valid
  1062. X!  */
  1063. X! 
  1064. X!     if (((*last == '\\') || (*last == '/')) && (len > 1) &&
  1065. X!     (!((len == 3) && (name[1] == ':'))))
  1066. X!     *(last--) = 0;
  1067. X! 
  1068. X! /* Check its a directory */    
  1069. X! 
  1070. X!     if (stat (nbuf, &statb) < 0)
  1071. X      {
  1072. X+     free (nbuf);
  1073. X+     return (DIR *) NULL;
  1074. X+     }
  1075. X+ 
  1076. X+     if (!S_ISDIR (statb.st_mode))
  1077. X+     {
  1078. X+     free (nbuf);
  1079. X      errno = ENOTDIR;
  1080. X      return (DIR *)NULL;
  1081. X      }
  1082. X  
  1083. X      if ((dirp = (DIR *) malloc (sizeof (DIR))) == (DIR *) NULL)
  1084. X+     {
  1085. X+     free (nbuf);
  1086. X      return (DIR *) NULL;
  1087. X+     }
  1088. X  
  1089. X! /* Set up to find everything */
  1090. X  
  1091. X!     if ((*last != '\\') && (*last != '/'))
  1092. X!     strcat (last, "/");
  1093. X  
  1094. X+     strcat (last, "*.*");
  1095. X+ 
  1096. X      dirp->dd_loc      = 0;
  1097. X      dirp->dd_cp       = (struct _dircontents *) NULL;
  1098. X      dirp->dd_contents = (struct _dircontents *) NULL;
  1099. X  
  1100. X      if (_dos_findfirst (nbuf, ATTRIBUTES, &dtabuf) != 0)
  1101. X+     {
  1102. X+     free (nbuf);
  1103. X      return dirp;
  1104. X+     }
  1105. X  
  1106. X      do 
  1107. X      {
  1108. X!     if (((dp = (struct _dircontents *) malloc (sizeof (struct _dircontents))) == (struct _dircontents *) NULL) ||
  1109. X          ((dp->_d_entry = strdup (dtabuf.name)) == (char *) NULL))
  1110. X      {
  1111. X          if (dp != (char *)NULL)
  1112. X          free ((char *) dp);
  1113. X  
  1114. X+         free (nbuf);
  1115. X          free_dircontents (dirp->dd_contents);
  1116. X          return (DIR *) NULL;
  1117. X      }
  1118. X***************
  1119. X*** 80,90 ****
  1120. X      } while (_dos_findnext (&dtabuf) == 0);
  1121. X  
  1122. X      dirp->dd_cp = dirp->dd_contents;
  1123. X  
  1124. X      return dirp;
  1125. X  }
  1126. X  
  1127. X! int    closedir(dirp)
  1128. X  DIR    *dirp;
  1129. X  {
  1130. X      free_dircontents (dirp->dd_contents);
  1131. X--- 123,134 ----
  1132. X      } while (_dos_findnext (&dtabuf) == 0);
  1133. X  
  1134. X      dirp->dd_cp = dirp->dd_contents;
  1135. X+     free (nbuf);
  1136. X  
  1137. X      return dirp;
  1138. X  }
  1139. X  
  1140. X! int    closedir (dirp)
  1141. X  DIR    *dirp;
  1142. X  {
  1143. X      free_dircontents (dirp->dd_contents);
  1144. X***************
  1145. X*** 92,98 ****
  1146. X      return 0;
  1147. X  }
  1148. X  
  1149. X! struct dirent    *readdir(dirp)
  1150. X  DIR        *dirp;
  1151. X  {
  1152. X      static struct dirent    dp;
  1153. X--- 136,142 ----
  1154. X      return 0;
  1155. X  }
  1156. X  
  1157. X! struct dirent    *readdir (dirp)
  1158. X  DIR        *dirp;
  1159. X  {
  1160. X      static struct dirent    dp;
  1161. XIndex: shell/sh.h
  1162. XPrereq: 1.17
  1163. X*** ../sh16/shell/sh.h    Tue May  1 20:01:03 1990
  1164. X--- shell/sh.h    Thu Jun 21 21:43:37 1990
  1165. X***************
  1166. X*** 13,21 ****
  1167. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1168. X   *     (or parts of sources) cannot be sold under any circumstances.
  1169. X   *
  1170. X!  *    $Header: sh.h 1.17 90/05/01 19:58:18 MS_user Exp $
  1171. X   *
  1172. X   *    $Log:    sh.h $
  1173. X   * Revision 1.17  90/05/01  19:58:18  MS_user
  1174. X   * Change Patchlevel
  1175. X   * 
  1176. X--- 13,30 ----
  1177. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1178. X   *     (or parts of sources) cannot be sold under any circumstances.
  1179. X   *
  1180. X!  *    $Header: sh.h 1.20 90/05/31 09:47:41 MS_user Exp $
  1181. X   *
  1182. X   *    $Log:    sh.h $
  1183. X+  * Revision 1.20  90/05/31  09:47:41  MS_user
  1184. X+  * Implement partial write when swapping to disk
  1185. X+  * 
  1186. X+  * Revision 1.19  90/05/15  21:08:41  MS_user
  1187. X+  * Release 1.6.2
  1188. X+  * 
  1189. X+  * Revision 1.18  90/05/09  20:36:22  MS_user
  1190. X+  * Patchlvel for 1.6.1
  1191. X+  * 
  1192. X   * Revision 1.17  90/05/01  19:58:18  MS_user
  1193. X   * Change Patchlevel
  1194. X   * 
  1195. X***************
  1196. X*** 71,77 ****
  1197. X   * 
  1198. X   */
  1199. X  
  1200. X! #define PATCHLEVEL    4
  1201. X  #define    LINE_MAX    1000    /* Command line length            */
  1202. X  #define HISTORY_MAX    100    /* History array length            */
  1203. X                  /* Space for full file name        */
  1204. X--- 80,86 ----
  1205. X   * 
  1206. X   */
  1207. X  
  1208. X! #define PATCHLEVEL    6
  1209. X  #define    LINE_MAX    1000    /* Command line length            */
  1210. X  #define HISTORY_MAX    100    /* History array length            */
  1211. X                  /* Space for full file name        */
  1212. X***************
  1213. X*** 101,106 ****
  1214. X--- 110,116 ----
  1215. X  #define O_PMASK        (O_RDWR | O_CREAT | O_TRUNC | O_TEXT)
  1216. X                  /* Open in create mode for swap file    */
  1217. X  #define O_SMASK        (O_RDWR | O_CREAT | O_TRUNC | O_BINARY)
  1218. X+ #define O_SaMASK    (O_RDWR | O_BINARY)
  1219. X  #define O_RMASK        (O_RDONLY | O_NOINHERIT | O_TEXT)
  1220. X  
  1221. X  /*
  1222. X***************
  1223. X*** 180,186 ****
  1224. X--- 190,199 ----
  1225. X  extern char        path_line[];    /* Process path            */
  1226. X  extern unsigned int    SW_intr;    /* interrupt pending        */
  1227. X  extern unsigned int    SW_Blocks;    /* Number of blocks to read    */
  1228. X+ extern unsigned int    SW_SBlocks;    /* Short Number of blocks to    */
  1229. X+                     /* read                */
  1230. X  extern int        SW_fp;        /* File or EMS Handler        */
  1231. X+ extern int        SW_Pwrite;    /* Partial write to disk?    */
  1232. X  extern unsigned long    SW_EMstart;    /* Start addr of extend mem    */
  1233. X  extern unsigned int    SW_Mode;    /* Type of swapping to do    */
  1234. X                      /* 1 - disk            */
  1235. X***************
  1236. X*** 189,194 ****
  1237. X--- 202,208 ----
  1238. X                      /* 4 - XMS Driver        */
  1239. X  extern unsigned int    SW_EMSFrame;    /* EMS Frame segment        */
  1240. X  
  1241. X+ extern unsigned int    etext;        /* End of text segment        */
  1242. X  extern int        Swap_Mode;    /* Swapping mode        */
  1243. X  
  1244. X  /* If you change these values, change sh7, swap_device as well */
  1245. X***************
  1246. X*** 590,596 ****
  1247. X  extern int    getn (char *);
  1248. X  extern int    Create_NG_VL (void);
  1249. X  extern void    Delete_G_VL (void);
  1250. X! extern void    Restore_Dir (void);
  1251. X  extern void    Restore_Environment (int, int);
  1252. X  extern int    sort_compare (char **, char **);
  1253. X  extern int    Check_Script (char *, char **, int *);
  1254. X--- 604,610 ----
  1255. X  extern int    getn (char *);
  1256. X  extern int    Create_NG_VL (void);
  1257. X  extern void    Delete_G_VL (void);
  1258. X! extern void    Restore_Dir (char *);
  1259. X  extern void    Restore_Environment (int, int);
  1260. X  extern int    sort_compare (char **, char **);
  1261. X  extern int    Check_Script (char *, char **, int *);
  1262. X***************
  1263. X*** 607,612 ****
  1264. X--- 621,627 ----
  1265. X  extern void    Clear_Extended_File (void);
  1266. X  extern void    Print_Version (int);
  1267. X  extern bool    anys (char *, char *);
  1268. X+ extern void    Clear_Swap_File (void);
  1269. X  
  1270. X  /*
  1271. X   * Interrupt handling
  1272. XIndex: shell/sh0.asm
  1273. XPrereq: 1.8
  1274. X*** ../sh16/shell/sh0.asm    Tue May  1 19:50:48 1990
  1275. X--- shell/sh0.asm    Thu Jun 21 21:45:35 1990
  1276. X***************
  1277. X*** 16,24 ****
  1278. X  ; 2.  The sources (or parts thereof) or objects generated from the sources
  1279. X  ;     (or parts of sources) cannot be sold under any circumstances.
  1280. X  ;
  1281. X! ;    $Header: sh0.asm 1.8 90/04/25 22:32:31 MS_user Exp $
  1282. X  ;
  1283. X  ;    $Log:    sh0.asm $
  1284. X  ;    Revision 1.8  90/04/25  22:32:31  MS_user
  1285. X  ;    Fix missing disk full check on writing swap file
  1286. X  ;    
  1287. X--- 16,30 ----
  1288. X  ; 2.  The sources (or parts thereof) or objects generated from the sources
  1289. X  ;     (or parts of sources) cannot be sold under any circumstances.
  1290. X  ;
  1291. X! ;    $Header: sh0.asm 1.10 90/05/31 17:46:31 MS_user Exp $
  1292. X  ;
  1293. X  ;    $Log:    sh0.asm $
  1294. X+ ;    Revision 1.10  90/05/31  17:46:31  MS_user
  1295. X+ ;    Enasure that correct block zero is written for partial write
  1296. X+ ;    
  1297. X+ ;    Revision 1.9  90/05/31  10:04:56  MS_user
  1298. X+ ;    Implement partial write on disk swapping
  1299. X+ ;    
  1300. X  ;    Revision 1.8  90/04/25  22:32:31  MS_user
  1301. X  ;    Fix missing disk full check on writing swap file
  1302. X  ;    
  1303. X***************
  1304. X*** 63,68 ****
  1305. X--- 69,77 ----
  1306. X  
  1307. X  DGROUP        group    CONST, _BSS, _DATA
  1308. X  
  1309. X+ C_ETEXT        segment word public 'ENDCODE' 
  1310. X+ C_ETEXT        ends 
  1311. X+ 
  1312. X  ;
  1313. X  ; Declare external functions and data
  1314. X  ;
  1315. X***************
  1316. X*** 72,80 ****
  1317. X      extrn    __psp:word
  1318. X  
  1319. X  ;
  1320. X! ; Start of the spawn function
  1321. X  ;
  1322. X  
  1323. X  SH0_TEXT    segment
  1324. X          assume  cs: SH0_TEXT, ds: NOTHING, ss: DGROUP
  1325. X  
  1326. X--- 81,99 ----
  1327. X      extrn    __psp:word
  1328. X  
  1329. X  ;
  1330. X! ; Declare end of text variable.  The ENDCODE segment appears to be the last
  1331. X! ; code segment loaded by the Microsoft loader
  1332. X  ;
  1333. X  
  1334. X+ C_ETEXT        segment word public 'ENDCODE' 
  1335. X+         public    cetext
  1336. X+ cetext        equ    $
  1337. X+ C_ETEXT        ends 
  1338. X+ 
  1339. X+ ;
  1340. X+ ; Start of the spawn function
  1341. X+ ;
  1342. X+ 
  1343. X  SH0_TEXT    segment
  1344. X          assume  cs: SH0_TEXT, ds: NOTHING, ss: DGROUP
  1345. X  
  1346. X***************
  1347. X*** 85,90 ****
  1348. X--- 104,110 ----
  1349. X          public    _path_line
  1350. X          public    _SW_intr
  1351. X          public    _SW_Blocks
  1352. X+         public    _SW_SBlocks
  1353. X          public    _SW_fp
  1354. X          public    _SW_I0_V
  1355. X          public    _SW_I23_V
  1356. X***************
  1357. X*** 96,107 ****
  1358. X--- 116,132 ----
  1359. X          public    _SW_XMS_Gversion
  1360. X          public    _SW_XMS_Allocate
  1361. X          public    _SW_XMS_Free
  1362. X+         public    _etext
  1363. X+         public    _SW_Pwrite
  1364. X  
  1365. X  
  1366. X  _cmd_line    db    129 dup (?)    ; Command line
  1367. X  _path_line    db    80 dup (?)    ; Path line
  1368. X+ _etext        dw    seg cetext    ; End of text segment
  1369. X  _SW_Blocks    dw    0        ; Number of blocks to read/write
  1370. X+ _SW_SBlocks    dw    0        ; Short Number of blocks to read/write
  1371. X  _SW_fp        dw    0        ; File ID
  1372. X+ _SW_Pwrite    dw    0        ; Partial write to disk?
  1373. X  _SW_I0_V    dd    0        ; Our Interrupt Zero address
  1374. X  _SW_I23_V    dd    0        ; Our Interrupt 23 address
  1375. X  _SW_EMstart    dd    0100000H    ; Default Extended Mem start
  1376. X***************
  1377. X*** 303,313 ****
  1378. X  ; Copy out to the swap file
  1379. X  ;
  1380. X  
  1381. X-     mov    si, word ptr cs:_SW_Blocks    ; Load Number of blocks to read
  1382. X      mov    bx, word ptr cs:_SW_fp        ; Load file handler
  1383. X  
  1384. X! ; load up extended memory GDT for destination
  1385. X  
  1386. X      mov    ax, word ptr cs:_SW_EMstart
  1387. X      mov    dl, byte ptr cs:_SW_EMstart + 2
  1388. X      call    $GDT_dest_load
  1389. X--- 328,354 ----
  1390. X  ; Copy out to the swap file
  1391. X  ;
  1392. X  
  1393. X      mov    bx, word ptr cs:_SW_fp        ; Load file handler
  1394. X+     mov    si, word ptr cs:_SW_Blocks    ; Load Number of blocks to read
  1395. X+     mov    ax, word ptr cs:N_mcb        ; Load the start address
  1396. X  
  1397. X! ;
  1398. X! ;  Check for Partial write on disk swap file
  1399. X! ;
  1400. X  
  1401. X+     cmp    word ptr cs: _SW_Mode, 1    ; Partial disk write ?
  1402. X+     jnz    SPart_Write
  1403. X+     cmp    word ptr cs: _SW_Pwrite, 0
  1404. X+     jz    SPart_Write
  1405. X+ 
  1406. X+     mov    si, word ptr cs:_SW_SBlocks    ; Load Number of blocks to read
  1407. X+     mov    ax, word ptr cs:_etext        ; Load the start address
  1408. X+ 
  1409. X+ SPart_Write:
  1410. X+     push    ax
  1411. X+ 
  1412. X+ ; load up extended memory GDT for destination
  1413. X+ 
  1414. X      mov    ax, word ptr cs:_SW_EMstart
  1415. X      mov    dl, byte ptr cs:_SW_EMstart + 2
  1416. X      call    $GDT_dest_load
  1417. X***************
  1418. X*** 316,324 ****
  1419. X  ; set up DS register with start of start copy
  1420. X  ;
  1421. X  
  1422. X!     mov    ax, word ptr cs:N_mcb        ; Load the start address
  1423. X      mov    ds, ax
  1424. X- 
  1425. X      mov    ax, word ptr cs:SW_LMstart     ; Load Full start address
  1426. X      mov    dl, byte ptr cs:SW_LMstart + 2
  1427. X      call    $GDT_src_load
  1428. X--- 357,364 ----
  1429. X  ; set up DS register with start of start copy
  1430. X  ;
  1431. X  
  1432. X!     pop    ax
  1433. X      mov    ds, ax
  1434. X      mov    ax, word ptr cs:SW_LMstart     ; Load Full start address
  1435. X      mov    dl, byte ptr cs:SW_LMstart + 2
  1436. X      call    $GDT_src_load
  1437. X***************
  1438. X*** 337,343 ****
  1439. X  $Write_L1:
  1440. X      mov    ax, word ptr cs: _SW_Mode
  1441. X      dec    ax
  1442. X!     jz    $Write_disk
  1443. X      dec    ax
  1444. X      jnz    $Write_L2
  1445. X      jmp    $W_extend
  1446. X--- 377,383 ----
  1447. X  $Write_L1:
  1448. X      mov    ax, word ptr cs: _SW_Mode
  1449. X      dec    ax
  1450. X!     jz    $W_disk
  1451. X      dec    ax
  1452. X      jnz    $Write_L2
  1453. X      jmp    $W_extend
  1454. X***************
  1455. X*** 391,425 ****
  1456. X  ;
  1457. X  ; Write to disk
  1458. X  ;
  1459. X! $Write_disk:
  1460. X!     mov    ax, 04000H        ; Set up to write
  1461. X!     mov    cx, ax            ; Load count
  1462. X!     xor    dx, dx            ; Clear start address
  1463. X!     push    bx            ; Save FP
  1464. X!     push    si            ; Save count and Data Segment
  1465. X  
  1466. X!     int    021H            ; Write the data
  1467. X  
  1468. X-     pop    si            ; Restore Regs
  1469. X-     pop    bx
  1470. X-     jnc    $Write_disk1        ; NO error - continue
  1471. X- 
  1472. X- ;
  1473. X- ; Error - abort
  1474. X- ;
  1475. X-     mov    ds, word ptr cs:S_ds    ; Restore DS
  1476. X-     mov    ah, al
  1477. X-     call    far ptr __maperror    ; Map the error
  1478. X-     jmp    $Write_Error1
  1479. X- 
  1480. X- ; Check for 16K write
  1481. X- 
  1482. X- $Write_disk1:
  1483. X-     cmp    ax, 04000H
  1484. X-     jz    $Write_Incr
  1485. X-     mov    ax,01c1cH        ; Set disk full
  1486. X-     jmp    $Write_error        ; NO - abort
  1487. X- 
  1488. X  $Write_Incr:
  1489. X      dec    si            ; Decrement block count
  1490. X      mov    ax, ds            ; Increment offset
  1491. X--- 431,441 ----
  1492. X  ;
  1493. X  ; Write to disk
  1494. X  ;
  1495. X! $W_disk:
  1496. X!     call    $Write_disk
  1497. X  
  1498. X! ; Increment counter
  1499. X  
  1500. X  $Write_Incr:
  1501. X      dec    si            ; Decrement block count
  1502. X      mov    ax, ds            ; Increment offset
  1503. X***************
  1504. X*** 469,482 ****
  1505. X      mov    al, ah
  1506. X      xor    ah, ah
  1507. X      mov    word ptr ds:_errno, ax    ; Save error code
  1508. X  $Write_Error1:
  1509. X      mov    ax, 0FFFEH
  1510. X      jmp    $SA_spawn_Exit        ; Exit
  1511. X  
  1512. X  ;
  1513. X! ; Swap file is now written, set up environment
  1514. X  ;
  1515. X  $Write_Complete:
  1516. X      mov    ds, word ptr cs:exec_env    ; Load Env seg.
  1517. X      xor    si, si                ; Clear start offset
  1518. X  
  1519. X--- 485,519 ----
  1520. X      mov    al, ah
  1521. X      xor    ah, ah
  1522. X      mov    word ptr ds:_errno, ax    ; Save error code
  1523. X+ 
  1524. X  $Write_Error1:
  1525. X      mov    ax, 0FFFEH
  1526. X      jmp    $SA_spawn_Exit        ; Exit
  1527. X  
  1528. X  ;
  1529. X! ; Swap file is now written, set up environment.  If this was a partial
  1530. X! ; write, we need to write the first 4K.
  1531. X  ;
  1532. X+ 
  1533. X  $Write_Complete:
  1534. X+     cmp    word ptr cs: _SW_Mode, 1    ; Partial disk write ?
  1535. X+     jnz    S1Part_Write
  1536. X+     cmp    word ptr cs: _SW_Pwrite, 0
  1537. X+     jz    S1Part_Write
  1538. X+ 
  1539. X+     mov    ax, 04200H            ; Set seek
  1540. X+     xor    dx, dx
  1541. X+     xor    cx, cx
  1542. X+     int    021H
  1543. X+     jnc    $Write_C1            ; Abort - swap file error
  1544. X+     jmp    $Map_error
  1545. X+ 
  1546. X+ $Write_C1:
  1547. X+     mov    ax, word ptr cs:N_mcb        ; Load the start address
  1548. X+     mov    ds, ax
  1549. X+     call    $Write_disk
  1550. X+ 
  1551. X+ S1Part_Write:
  1552. X      mov    ds, word ptr cs:exec_env    ; Load Env seg.
  1553. X      xor    si, si                ; Clear start offset
  1554. X  
  1555. X***************
  1556. X*** 660,665 ****
  1557. X--- 697,704 ----
  1558. X  ;
  1559. X  ; Error
  1560. X  ;
  1561. X+ 
  1562. X+ $Map_error:
  1563. X      mov    ds, word ptr cs:S_ds    ; Restore DS
  1564. X      mov    ah, al
  1565. X      call    far ptr __maperror    ; Map the error
  1566. X***************
  1567. X*** 927,932 ****
  1568. X--- 966,1014 ----
  1569. X      ret
  1570. X  
  1571. X  $Read_XMS    endp
  1572. X+ 
  1573. X+ ;
  1574. X+ ; WRITE DISK FUNCTION
  1575. X+ ;
  1576. X+ ;    BX - file handler
  1577. X+ ;    SI - Block count
  1578. X+ ;    DS - Output data segement
  1579. X+ ;
  1580. X+ 
  1581. X+ $Write_disk    proc    near
  1582. X+ 
  1583. X+     mov    ax, 04000H        ; Set up to write
  1584. X+     mov    cx, ax            ; Load count
  1585. X+     xor    dx, dx            ; Clear start address
  1586. X+     push    bx            ; Save FP
  1587. X+     push    si            ; Save count and Data Segment
  1588. X+ 
  1589. X+     int    021H            ; Write the data
  1590. X+ 
  1591. X+     pop    si            ; Restore Regs
  1592. X+     pop    bx
  1593. X+     jnc    $Write_disk1        ; NO error - continue
  1594. X+ 
  1595. X+ ;
  1596. X+ ; Error - abort
  1597. X+ ;
  1598. X+     mov    ds, word ptr cs:S_ds    ; Restore DS
  1599. X+     mov    ah, al
  1600. X+     call    far ptr __maperror    ; Map the error
  1601. X+     jmp    $Write_Error1
  1602. X+ 
  1603. X+ ; Check for 16K write
  1604. X+ 
  1605. X+ $Write_disk1:
  1606. X+     cmp    ax, 04000H
  1607. X+     jnz    $Write_disk2
  1608. X+     ret
  1609. X+ 
  1610. X+ $Write_disk2:
  1611. X+     mov    ax,01c1cH        ; Set disk full
  1612. X+     jmp    $Write_error        ; NO - abort
  1613. X+ 
  1614. X+ $Write_disk    endp
  1615. X  
  1616. X  ;
  1617. X  ; READ DISK FUNCTION
  1618. XIndex: shell/sh1.c
  1619. XPrereq: 1.14
  1620. X*** ../sh16/shell/sh1.c    Tue May  1 19:48:00 1990
  1621. X--- shell/sh1.c    Thu Jun 21 21:46:25 1990
  1622. X***************
  1623. X*** 13,21 ****
  1624. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1625. X   *     (or parts of sources) cannot be sold under any circumstances.
  1626. X   *
  1627. X!  *    $Header: sh1.c 1.14 90/04/25 22:33:28 MS_user Exp $
  1628. X   *
  1629. X   *    $Log:    sh1.c $
  1630. X   * Revision 1.14  90/04/25  22:33:28  MS_user
  1631. X   * Fix rsh check for PATH
  1632. X   * 
  1633. X--- 13,28 ----
  1634. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1635. X   *     (or parts of sources) cannot be sold under any circumstances.
  1636. SHAR_EOF
  1637. echo "File Patch1.6.2 is continued in part 2"
  1638. echo "2" > @shar_seq_.tmp
  1639. exit 0
  1640.  
  1641.