[comp.binaries.ibm.pc] History fixes

nelson@sun.soe.clarkson.edu (Russ Nelson) (03/21/88)

Apologies.  The 'history' program that I just posted (and which is
probably now uneconomical to cancel) has a small problem in the source
that makes the .com file (when recompiled) about 4K larger than it
needs to be.  The following fixes make it use the 7.7K that I
advertised.

The reason I made this mistake is because I:
  (1) Updated the archive.
  (2) Made some changes.
  (3) Compiled.
  (4) Made some more changes which I didn't like.
  (5) Reverted to the copy of the source from (1).
I was then in the situation of having a newer object file that WASN'T
compiled from the existing source.  Let this be a lesson to me!


*** original/edit.c
--- edit.c
**************
*** 1,6
  /* history -- command history mechanism, Copyright 1985-6  Michael M Rubenstein */
! /* Portions Copyright 1987, 1988, Russell Nelson */
! /* History:30,34 */
  /* 01-29-88 19:59:01 add C-A and C-E for home and end respectively. */
  /* 10-18-87 12:12:06 give an error if they compile with other than TINY. */
  /* 10-18-87 11:51:06 use msdos(8) to read keystrokes. */
--- 1,6 -----
  /* history -- command history mechanism, Copyright 1985-6  Michael M Rubenstein */
  /* Portions Copyright 1987, Russell Nelson */
! /* History:218,1 */
  /* 01-29-88 19:59:01 add C-A and C-E for home and end respectively. */
  /* 10-18-87 12:12:06 give an error if they compile with other than TINY. */
  /* 10-18-87 11:51:06 use msdos(8) to read keystrokes. */
**************
*** 67,75
  #define CTLLEFT         256 + 115
  #define CTLRIGHT        256 + 116
  
- int			_stklen = 1024;		/* need at least 1K stack only */
- int			_stkmax = 1024;		/* use at most 1K stack only */
- 
  int                     insert = FALSE;         /* insert mode switch */
  unsigned char           line[256];
  
--- 67,72 -----
  #define CTLLEFT         256 + 115
  #define CTLRIGHT        256 + 116
  
  int                     insert = FALSE;         /* insert mode switch */
  unsigned char           line[256];
  
**************
*** 88,93
  #error Must be compiled with -mt
  #endif
  
  void main(int argc, char *argv[])
  {
  
--- 85,95 -----
  #error Must be compiled with -mt
  #endif
  
+ void exit(int c)
+ { _exit(c);}
+ 
+ void _setenvp(void){}		/* dummy out _setenvp */
+ 
  void main(int argc, char *argv[])
  {
  
**************
*** 101,109
        else if (len > 32767) len = 32767;
        }
      else len = 256;
!     if (init_history(j, len)) {
!       printf("history: insuff mem\n");
!       abort();
      }
    }
  
--- 103,109 -----
        else if (len > 32767) len = 32767;
        }
      else len = 256;
!     init_history(j, len);
      }
    setup();
  }
**************
*** 105,112
        printf("history: insuff mem\n");
        abort();
      }
-   }
- 
    setup();
  }
  
--- 105,110 -----
      else len = 256;
      init_history(j, len);
      }
    setup();
  }
  
**************
*** 216,222
                      break;
  
        case INS:     /* insert char */
!                     setcursor((insert = !insert) ? icursor : cursor);
                      break;
  
        case CTLU:
--- 214,221 -----
                      break;
  
        case INS:     /* insert char */
!                     insert = !insert;
!                     setcursor(insert? icursor : cursor);
                      break;
  
        case CTLU: