*** dos.c.orig	Wed Aug 30 14:20:02 2000
--- dos.c	Wed Aug 30 14:38:34 2000
***************
*** 568,574 ****
      int			n;
      
      /* pointer to buffer */
!     addr = (unsigned char *)MAKEPTR(R_DS, R_DL);
  
      /* capacity of buffer */
      avail = addr[0];
--- 568,574 ----
      int			n;
      
      /* pointer to buffer */
!     addr = (unsigned char *)MAKEPTR(R_DS, R_DX);
  
      /* capacity of buffer */
      avail = addr[0];
***************
*** 1302,1307 ****
--- 1302,1323 ----
      return(0);
  }
  
+ static int
+ write_or_truncate(int fd, char *addr, int len)
+ {
+     off_t offset;
+  
+     if ( len == 0 ){
+       offset = lseek(fd,0,SEEK_CUR);
+       if( offset < 0 )
+           return -1;
+       else
+           return ftruncate(fd,offset);
+     } else {
+       return write(fd,addr,len);
+     }
+ }
+ 
  /*
  ** 21:40
  **
***************
*** 1321,1327 ****
      switch (R_BX) {
      case 0:
  	if (redirect0) {
! 	    n = write (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
--- 1337,1343 ----
      switch (R_BX) {
      case 0:
  	if (redirect0) {
! 	    n = write_or_truncate (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
***************
*** 1330,1336 ****
  	break;
      case 1:
  	if (redirect1) {
! 	    n = write (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
--- 1346,1352 ----
  	break;
      case 1:
  	if (redirect1) {
! 	    n = write_or_truncate (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
***************
*** 1339,1345 ****
  	break;
      case 2:
  	if (redirect2) {
! 	    n = write (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
--- 1355,1361 ----
  	break;
      case 2:
  	if (redirect2) {
! 	    n = write_or_truncate (R_BX, addr, nbytes);
  	    break;
  	}
  	n = nbytes;
***************
*** 1347,1353 ****
  	    tty_write(*addr++, -1);
  	break;
      default:
! 	n = write (R_BX, addr, nbytes);
  	break;
      }
      if (n < 0)
--- 1363,1369 ----
  	    tty_write(*addr++, -1);
  	break;
      default:
! 	n = write_or_truncate (R_BX, addr, nbytes);
  	break;
      }
      if (n < 0)
***************
*** 1704,1709 ****
--- 1720,1726 ----
  {
      return_status = R_AL;
      done(REGS, R_AL);
+     return(0);
  }
  
  /*
***************
*** 2352,2358 ****
      { 0x4e,	IFT_NOSUBFUNC,	int21_find,	"findfirst"},
      { 0x4f,	IFT_NOSUBFUNC,	int21_find,	"findnext"},
      { 0x50,	IFT_NOSUBFUNC,	int21_50,	"set psp"},
!     { 0x50,	IFT_NOSUBFUNC,	int21_62,	"get psp"},
      { 0x52,	IFT_NOSUBFUNC,	int21_NOFUNC,	"get LoL"},
      { 0x53,	IFT_NOSUBFUNC,	int21_NOFUNC,	"translate BPB to DPB"},
      { 0x54,	IFT_NOSUBFUNC,	int21_NULLFUNC,	"get verify flag"},
--- 2369,2375 ----
      { 0x4e,	IFT_NOSUBFUNC,	int21_find,	"findfirst"},
      { 0x4f,	IFT_NOSUBFUNC,	int21_find,	"findnext"},
      { 0x50,	IFT_NOSUBFUNC,	int21_50,	"set psp"},
!     { 0x51,	IFT_NOSUBFUNC,	int21_62,	"get psp"},
      { 0x52,	IFT_NOSUBFUNC,	int21_NOFUNC,	"get LoL"},
      { 0x53,	IFT_NOSUBFUNC,	int21_NOFUNC,	"translate BPB to DPB"},
      { 0x54,	IFT_NOSUBFUNC,	int21_NULLFUNC,	"get verify flag"},



