home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / LES177AS.ZIP / DIFFS.177 < prev    next >
Encoding:
Text File  |  1992-01-04  |  44.6 KB  |  2,029 lines

  1. *** funcs.h    Sat Jul 06 15:50:04 1991
  2. --- ..\myles177\funcs.h    Wed Sep 11 20:53:48 1991
  3. ***************
  4. *** 75,81 ****
  5.       public void opt_W ();
  6.       public void opt_query ();
  7.       public void init_option ();
  8. -     public struct option * findopt ();
  9.       public int iread ();
  10.       public void intread ();
  11.       public long get_time ();
  12. --- 75,80 ----
  13. *** less.h    Sat Jul 06 15:50:18 1991
  14. --- ..\myles177\less.h    Fri Oct 04 21:24:24 1991
  15. *************** typedef union parg
  16. *** 96,103 ****
  17.   #define    NORMAL        (0)
  18.   #define    UNDERLINE    (1)
  19.   #define    BOLD        (2)
  20. ! #define    BLINK        (3)
  21.   #define    INVIS        (4)
  22.   
  23.   #define    CONTROL(c)        ((c)&037)
  24.   #define    ESC            CONTROL('[')
  25. --- 96,106 ----
  26.   #define    NORMAL        (0)
  27.   #define    UNDERLINE    (1)
  28.   #define    BOLD        (2)
  29. ! #define    BLINKING    (3)
  30.   #define    INVIS        (4)
  31. + #ifdef TURBOC
  32. + #define BOLD2        (5)
  33. + #endif
  34.   
  35.   #define    CONTROL(c)        ((c)&037)
  36.   #define    ESC            CONTROL('[')
  37. *************** typedef union parg
  38. *** 107,113 ****
  39. --- 110,120 ----
  40.   /* Library function declarations */
  41.   offset_t lseek();
  42.   #define    BAD_LSEEK    ((offset_t)-1)
  43. + #ifdef TURBOC
  44. + #include <conio.h>
  45. + #else
  46.   VOID_POINTER calloc();
  47. + #endif
  48.   
  49.   #define    ch_zero()    ((POSITION)0)
  50.   #include "funcs.h"
  51. *** ch.c    Sat Jul 06 15:49:42 1991
  52. --- ..\myles177\ch.c    Fri Sep 13 21:35:40 1991
  53. ***************
  54. *** 6,13 ****
  55.   
  56.   #include "less.h"
  57.   
  58.   public int file = -1;        /* File descriptor of the input file */
  59. ! public int ignore_eoi;
  60.   
  61.   /*
  62.    * Pool of buffers holding the most recently used blocks of the input file.
  63. --- 6,17 ----
  64.   
  65.   #include "less.h"
  66.   
  67. + #ifdef TURBOC
  68. + #include <signal.h>
  69. + #endif
  70.   public int file = -1;        /* File descriptor of the input file */
  71. ! public int ignore_eoi = 0;
  72.   
  73.   /*
  74.    * Pool of buffers holding the most recently used blocks of the input file.
  75. *************** fch_get()
  76. *** 191,196 ****
  77. --- 195,204 ----
  78.               sleep(1);
  79.               slept = 1;
  80.           }
  81. + #ifdef TURBOC
  82. +         if (kbhit())
  83. +             raise(SIGINT);
  84. + #endif
  85.           if (sigs)
  86.               return (EOI);
  87.       }
  88. *************** ch_seek(pos)
  89. *** 307,313 ****
  90.        * Set read pointer.
  91.        */
  92.       ch_block = new_block;
  93. !     ch_offset = pos % BUFSIZ;
  94.       return (0);
  95.   }
  96.   
  97. --- 315,321 ----
  98.        * Set read pointer.
  99.        */
  100.       ch_block = new_block;
  101. !     ch_offset = (unsigned) pos % BUFSIZ;
  102.       return (0);
  103.   }
  104.   
  105. *************** ch_flush()
  106. *** 498,504 ****
  107.        */
  108.       ch_fpos = 0;
  109.       ch_block = ch_fpos / BUFSIZ;
  110. !     ch_offset = ch_fpos % BUFSIZ;
  111.   
  112.       if (lseek(file, (offset_t)0, 0) == BAD_LSEEK)
  113.       {
  114. --- 506,512 ----
  115.        */
  116.       ch_fpos = 0;
  117.       ch_block = ch_fpos / BUFSIZ;
  118. !     ch_offset = (unsigned) ch_fpos % BUFSIZ;
  119.   
  120.       if (lseek(file, (offset_t)0, 0) == BAD_LSEEK)
  121.       {
  122. *** charset.c    Sat Jul 06 15:49:44 1991
  123. --- ..\myles177\charset.c    Thu Nov 14 12:22:52 1991
  124. *************** struct charset {
  125. *** 15,20 ****
  126. --- 15,21 ----
  127.   } charsets[] = {
  128.       { "ascii",    "8bcccbcc18b95.b"    },
  129.       { "latin1",    "8bcccbcc18b95.33b."    },
  130. +     { "ibmpc",    "8bcccbcc18b."    },
  131.       { NULL }
  132.   };
  133.   
  134. *************** struct charset {
  135. *** 23,29 ****
  136.   
  137.   static char chardef[256];
  138.   static char *binfmt = "\\%o";
  139. ! public int binattr = BLINK;
  140.   
  141.   extern char *getenv();
  142.   
  143. --- 24,34 ----
  144.   
  145.   static char chardef[256];
  146.   static char *binfmt = "\\%o";
  147. ! #ifdef TURBOC
  148. ! public int binattr = BOLD2;
  149. ! #else
  150. ! public int binattr = BLINKING;
  151. ! #endif
  152.   
  153.   extern char *getenv();
  154.   
  155. *************** icharset(name)
  156. *** 117,123 ****
  157.   
  158.       error("invalid charset name", NULL_PARG);
  159.       quit(1);
  160. !     /*NOTREACHED*/
  161.   }
  162.   
  163.   /*
  164. --- 122,128 ----
  165.   
  166.       error("invalid charset name", NULL_PARG);
  167.       quit(1);
  168. !     return (0);    /*NOTREACHED*/
  169.   }
  170.   
  171.   /*
  172. *************** init_charset()
  173. *** 143,150 ****
  174.           ichardef(s);
  175.           return;
  176.       }
  177.       (void) icharset("ascii");
  178.   
  179.       s = getenv("LESSBINFMT");
  180.       if (s != NULL && *s != '\0')
  181. --- 148,158 ----
  182.           ichardef(s);
  183.           return;
  184.       }
  185. ! #ifdef TURBOC
  186. !     (void) icharset("ibmpc");
  187. ! #else
  188.       (void) icharset("ascii");
  189. + #endif
  190.   
  191.       s = getenv("LESSBINFMT");
  192.       if (s != NULL && *s != '\0')
  193. *************** init_charset()
  194. *** 154,160 ****
  195.               switch (s[1])
  196.               {
  197.               case 'd':  binattr = BOLD;      break;
  198. !             case 'k':  binattr = BLINK;     break;
  199.               case 'u':  binattr = UNDERLINE; break;
  200.               default:   binattr = NORMAL;    break;
  201.               }
  202. --- 162,168 ----
  203.               switch (s[1])
  204.               {
  205.               case 'd':  binattr = BOLD;      break;
  206. !             case 'k':  binattr = BLINKING;  break;
  207.               case 'u':  binattr = UNDERLINE; break;
  208.               default:   binattr = NORMAL;    break;
  209.               }
  210. *** command.c    Sat Jul 06 15:49:50 1991
  211. --- ..\myles177\command.c    Sat Jan 04 23:16:58 1992
  212. *************** prompt()
  213. *** 431,437 ****
  214. --- 431,439 ----
  215.           so_exit();
  216.       }
  217.   #if __MSDOS__
  218. + #ifndef TURBOC
  219.       scroll_bar();
  220. + #endif
  221.   #endif
  222.   }
  223.   
  224. *** decode.c    Sun Mar 10 12:03:20 1991
  225. --- ..\myles177\decode.c    Thu Sep 12 21:16:36 1991
  226. *************** static char cmdtable[] =
  227. *** 44,52 ****
  228. --- 44,61 ----
  229.       '\200','\107',0,        A_GOLINE,        /* home */
  230.       '\200','\117',0,        A_GOEND,        /* end */
  231.       '\200','\073',0,        A_HELP,            /* F1 */
  232. +     '\200','\061',0,        A_NEXT_FILE,        /* ALT-n */
  233. +     '\200','\031',0,        A_PREV_FILE,        /* ALT-p */
  234. +     '\200','\022',0,        A_EXAMINE,        /* ALT-e */
  235. +     '\200','\020',0,        A_QUIT,            /* ALT-q */
  236. +     '\200','\055',0,        A_QUIT,            /* ALT-x */
  237. + #ifdef A_MODIFY_WINDOW
  238.       '\200','\104',0,        A_MODIFY_WINDOW,    /* F10 */
  239. + #endif
  240. + #ifdef A_MODIFY_COLOURS
  241.       '\200','\103',0,        A_MODIFY_COLOURS,    /* F9 */
  242.   #endif
  243. + #endif
  244.       '\r',0,                A_F_LINE,
  245.       '\n',0,                A_F_LINE,
  246.       'e',0,                A_F_LINE,
  247. *************** static char cmdtable[] =
  248. *** 141,146 ****
  249. --- 150,156 ----
  250.       'h',0,                A_HELP,
  251.       'V',0,                A_VERSION,
  252.       'q',0,                A_QUIT,
  253. +     'Q',0,                A_QUIT,
  254.       ':','q',0,            A_QUIT,
  255.       ':','Q',0,            A_QUIT,
  256.       'Z','Z',0,            A_QUIT,
  257. *************** add_cmdtable(filename)
  258. *** 308,314 ****
  259.           close(f);
  260.           return (-1);
  261.       }
  262. !     if ((t->t_start = (char *) calloc(len, sizeof(char))) == NULL)
  263.       {
  264.           free((char *)t);
  265.           close(f);
  266. --- 318,324 ----
  267.           close(f);
  268.           return (-1);
  269.       }
  270. !     if ((t->t_start = (char *) calloc((unsigned)len, sizeof(char))) == NULL)
  271.       {
  272.           free((char *)t);
  273.           close(f);
  274. *************** add_cmdtable(filename)
  275. *** 328,340 ****
  276.        * In a valid lesskey file, the last byte or 
  277.        * the second to the last byte must be zero.
  278.        */
  279. !     if (n != len || (t->t_start[n-1] != '\0' && t->t_start[n-2] != '\0'))
  280.       {
  281.           free(t->t_start);
  282.           free((char *)t);
  283.           return (-1);
  284.       }
  285. !     t->t_end = t->t_start + n;
  286.   
  287.       /*
  288.        * Link it into the list of tables.
  289. --- 338,350 ----
  290.        * In a valid lesskey file, the last byte or 
  291.        * the second to the last byte must be zero.
  292.        */
  293. !     if (n != len || (t->t_start[(unsigned)n-1] != '\0' && t->t_start[(unsigned)n-2] != '\0'))
  294.       {
  295.           free(t->t_start);
  296.           free((char *)t);
  297.           return (-1);
  298.       }
  299. !     t->t_end = t->t_start + (unsigned) n;
  300.   
  301.       /*
  302.        * Link it into the list of tables.
  303. *** edit.c    Sat Jul 06 15:49:54 1991
  304. --- ..\myles177\edit.c    Tue Oct 08 18:18:28 1991
  305. *************** edit(filename, just_looking)
  306. *** 40,46 ****
  307. --- 40,48 ----
  308.       int just_looking;
  309.   {
  310.       register int f;
  311. + #if LOGFILE
  312.       char *s;
  313. + #endif
  314.       int answer;
  315.       int no_display;
  316.       struct scrpos scrpos;
  317. *************** edit(filename, just_looking)
  318. *** 159,166 ****
  319. --- 161,170 ----
  320.       new_file = 1;
  321.   
  322.   #if  __MSDOS__
  323. + #ifndef TURBOC
  324.       top_filename();
  325.   #endif
  326. + #endif
  327.   
  328.       if (every_first_cmd != NULL)
  329.           ungetsc(every_first_cmd);
  330. *************** edit_list(list)
  331. *** 208,214 ****
  332.       register char *es;
  333.       register char *filename;
  334.       char *good_filename;
  335. -     IFILE save_curr_ifile;
  336.   
  337.       /*
  338.        * good_filename keeps track of the first valid filename.
  339. --- 212,217 ----
  340. *************** edit_list(list)
  341. *** 216,222 ****
  342.       good_filename = NULL;
  343.       s = list;
  344.       es = s + strlen(s);
  345. -     save_curr_ifile = curr_ifile;
  346.       while ((s = skipsp(s)) < es)
  347.       {
  348.           /*
  349. --- 219,224 ----
  350. *************** edit_list(list)
  351. *** 236,242 ****
  352.            *    entered after the position where that one already
  353.            *    was, instead of at the end. }}
  354.            */
  355. !         if (edit(filename, 1) == 0 && good_filename == NULL)
  356.               good_filename = filename;
  357.       }
  358.   
  359. --- 238,244 ----
  360.            *    entered after the position where that one already
  361.            *    was, instead of at the end. }}
  362.            */
  363. !         if (edit(filename, 0) == 0 && good_filename == NULL)
  364.               good_filename = filename;
  365.       }
  366.   
  367. *************** edit_list(list)
  368. *** 245,251 ****
  369.        */
  370.       if (good_filename != NULL)
  371.       {
  372. -         curr_ifile = save_curr_ifile;
  373.           (void) edit(good_filename, 0);
  374.       }
  375.   }
  376. --- 247,252 ----
  377. *** filename.c    Sat Jul 06 15:49:58 1991
  378. --- ..\myles177\filename.c    Wed Sep 18 23:55:26 1991
  379. ***************
  380. *** 6,11 ****
  381. --- 6,15 ----
  382.   #include <stdio.h>
  383.   #include "less.h"
  384.   
  385. + #ifdef TURBOC
  386. + #include <string.h>
  387. + #endif
  388.   extern char *getenv();
  389.   
  390.   extern int force_open;
  391. *************** homefile(filename)
  392. *** 42,48 ****
  393.                       sizeof(char));
  394.           if (pathname == NULL)
  395.               return (NULL);
  396. !         sprintf(pathname, "%s\\%s", homedir, filename);
  397.       }
  398.   #else
  399.       if (homedir == NULL)
  400. --- 46,56 ----
  401.                       sizeof(char));
  402.           if (pathname == NULL)
  403.               return (NULL);
  404. !         if ((homedir[strlen(homedir)-1] != '/')
  405. !          && (homedir[strlen(homedir)-1] != '\\'))
  406. !             sprintf(pathname, "%s/%s", homedir, filename);
  407. !         else
  408. !             sprintf(pathname, "%s%s", homedir, filename);
  409.       }
  410.   #else
  411.       if (homedir == NULL)
  412. *************** find_helpfile()
  413. *** 65,76 ****
  414.       register char *helpfile;
  415.   #if __MSDOS__
  416.       extern char *searchpath();
  417.       /*
  418.        * Look in current directory.
  419.        */
  420.       if (access(HELPFILE,0) == 0)
  421. !         return (HELPFILE);
  422.       /*
  423.        * Find the basename of HELPFILE,
  424.        * and look for it in each directory in the search path.
  425. --- 73,87 ----
  426.       register char *helpfile;
  427.   #if __MSDOS__
  428.       extern char *searchpath();
  429. ! #endif
  430. !     if ((helpfile = getenv("LESSHELP")) != NULL)
  431. !         return (save(helpfile));
  432. ! #if __MSDOS__
  433.       /*
  434.        * Look in current directory.
  435.        */
  436.       if (access(HELPFILE,0) == 0)
  437. !         return (save(HELPFILE));
  438.       /*
  439.        * Find the basename of HELPFILE,
  440.        * and look for it in each directory in the search path.
  441. *************** find_helpfile()
  442. *** 81,88 ****
  443.           helpfile++;
  444.       return (save(searchpath(helpfile)));
  445.   #else
  446. -     if ((helpfile = getenv("LESSHELP")) != NULL)
  447. -         return (save(helpfile));
  448.       return (save(HELPFILE));
  449.   #endif
  450.   }
  451. --- 92,97 ----
  452. *************** seek_filesize(f)
  453. *** 190,196 ****
  454. --- 199,222 ----
  455.    * Expand a filename, substituting any environment variables, etc.
  456.    */
  457.   #if GLOB
  458. + #ifdef TURBOC
  459. + extern char * expand();
  460. +     public char *
  461. + glob(filename)
  462. +     char *filename;
  463. + {
  464. +     char *p;
  465. +     filename = fexpand(filename);
  466. +     if (filename == NULL)
  467. +         return (NULL);
  468. +     p = expand(fexpand(filename));
  469. +     free (filename);
  470. +     return p;
  471. + }
  472.   
  473. + #else /* not TURBOC */
  474.   FILE *popen();
  475.   
  476.       public char *
  477. *************** glob(filename)
  478. *** 260,265 ****
  479. --- 286,292 ----
  480.       return (gfilename);
  481.   }
  482.   
  483. + #endif /* TURBOC */
  484.   #else
  485.   
  486.       public char *
  487. *** forwback.c    Sat Jul 06 15:50:00 1991
  488. --- ..\myles177\forwback.c    Sat Jan 04 23:29:14 1992
  489. *************** forw(n, pos, force, only_last, nblank)
  490. *** 107,113 ****
  491.        * repainting itself involves scrolling forward a screenful).
  492.        */
  493.       do_repaint = (only_last && n > sc_height-1) || 
  494. !         (forw_scroll >= 0 && n > forw_scroll && n != sc_height-1);
  495.   
  496.       if (!do_repaint)
  497.       {
  498. --- 107,113 ----
  499.        * repainting itself involves scrolling forward a screenful).
  500.        */
  501.       do_repaint = (only_last && n > sc_height-1) || 
  502. !         (n > get_forw_scroll() && n != sc_height-1);
  503.   
  504.       if (!do_repaint)
  505.       {
  506. *************** forw(n, pos, force, only_last, nblank)
  507. *** 146,151 ****
  508. --- 146,152 ----
  509.                   home();
  510.               } else if (!first_time)
  511.               {
  512. +                 if (onscreen(pos) < 0)
  513.                       putstr("...skipping...\n");
  514.               }
  515.           }
  516. *************** get_back_scroll()
  517. *** 367,372 ****
  518.       if (back_scroll >= 0)
  519.           return (back_scroll);
  520.       if (top_scroll)
  521. !         return (sc_height - 2);
  522.       return (10000); /* infinity */
  523.   }
  524. --- 368,387 ----
  525.       if (back_scroll >= 0)
  526.           return (back_scroll);
  527.       if (top_scroll)
  528. !         return (sc_height - 3);
  529.       return (10000); /* infinity */
  530. + }
  531. + /*
  532. +  * Get the forwards scroll limit.
  533. +  * Must call this function instead of just using the value of
  534. +  * forw_scroll, because the default case depends on sc_height
  535. +  * as well as forw_scroll.
  536. +  */
  537. +     public int
  538. + get_forw_scroll()
  539. + {
  540. +     if (forw_scroll >= 0)
  541. +         return (forw_scroll);
  542. +     return (sc_height - 3);
  543.   }
  544. *** help.c    Sun Mar 10 12:03:22 1991
  545. --- ..\myles177\help.c    Thu Sep 12 21:25:54 1991
  546. ***************
  547. *** 14,21 ****
  548. --- 14,23 ----
  549.   #include <dir.h>
  550.   #include <string.h>
  551.   #include <stdlib.h>
  552. + #ifndef TURBOC
  553.   extern int output_mode;
  554.   #endif
  555. + #endif
  556.   
  557.   extern char *progname;
  558.   
  559. *************** help()
  560. *** 36,45 ****
  561. --- 38,54 ----
  562.           "it again:Press RETURN for more., or q when done ");
  563.       cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 50,
  564.                   sizeof(char));
  565. + #ifdef TURBOC
  566. +     if (directvideo)
  567. +         sprintf(cmd, "-%s %s", progname, helpfile);
  568. +     else
  569. +         sprintf(cmd, "-%s -v %s", progname, helpfile);
  570. + #else
  571.       if (output_mode == 0)
  572.           sprintf(cmd, "-%s %s", progname, helpfile);
  573.       else
  574.           sprintf(cmd, "-%s -qVW4,4,76,23,Help %s", progname, helpfile);
  575. + #endif    /* TURBOC */
  576.   #else
  577.       cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 150,
  578.                   sizeof(char));
  579. *************** help()
  580. *** 46,53 ****
  581.       sprintf(cmd, 
  582.        "-%s -m -H -+E -+s '-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done ' %s",
  583.           progname, helpfile);
  584. - #endif
  585.       free(helpfile);
  586.       lsystem(cmd);
  587.       error("End of help", NULL_PARG);
  588.       free(cmd);
  589. --- 55,62 ----
  590.       sprintf(cmd, 
  591.        "-%s -m -H -+E -+s '-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done ' %s",
  592.           progname, helpfile);
  593.       free(helpfile);
  594. + #endif
  595.       lsystem(cmd);
  596.       error("End of help", NULL_PARG);
  597.       free(cmd);
  598. *** input.c    Sun Mar 10 12:03:22 1991
  599. --- ..\myles177\input.c    Sat Jan 04 21:44:42 1992
  600. *************** back_line(curr_pos)
  601. *** 137,174 ****
  602.           return (NULL_POSITION);
  603.       }
  604.   
  605. -     if (squeeze)
  606. -     {
  607. -         /*
  608. -          * Find out if the "current" line was blank.
  609. -          */
  610. -         (void) ch_forw_get();    /* Skip the newline */
  611. -         c = ch_forw_get();    /* First char of "current" line */
  612. -         (void) ch_back_get();    /* Restore our position */
  613. -         (void) ch_back_get();
  614. -         if (c == '\n')
  615. -         {
  616. -             /*
  617. -              * The "current" line was blank.
  618. -              * Skip over any preceding blank lines,
  619. -              * since we skipped them in forw_line().
  620. -              */
  621. -             while ((c = ch_back_get()) == '\n' || c == '\r')
  622. -                 if (sigs)
  623. -                 {
  624. -                     null_line();
  625. -                     return (NULL_POSITION);
  626. -                 }
  627. -             if (c == EOI)
  628. -             {
  629. -                 null_line();
  630. -                 return (NULL_POSITION);
  631. -             }
  632. -             (void) ch_forw_get();
  633. -         }
  634. -     }
  635.       /*
  636.        * Scan backwards until we hit the beginning of the line.
  637.        */
  638. --- 137,142 ----
  639. *************** back_line(curr_pos)
  640. *** 198,203 ****
  641. --- 166,212 ----
  642.                */
  643.               new_pos = ch_tell();
  644.               break;
  645. +         }
  646. +     }
  647. +     if (squeeze && c != EOI)
  648. +     {
  649. +         /*
  650. +          * Find out if the "new" line is blank.
  651. +          */
  652. +         (void) ch_forw_get();   /* Skip the newline */
  653. +         c = ch_forw_get();      /* First char of "new" line */
  654. +         if (c == '\n' || c == '\r')
  655. +         {
  656. +             /*
  657. +              * The "new" line is blank.
  658. +              * Skip over any preceding blank lines,
  659. +              * since we skipped them in forw_line().
  660. +              */
  661. +             while ((c = ch_back_get()) == '\n' || c == '\r')
  662. +                 if (sigs)
  663. +                 {
  664. +                     null_line();
  665. +                     return (NULL_POSITION);
  666. +                 }
  667. +             if (c != EOI)
  668. +             {
  669. +                 /*
  670. +                  * We're near the end of a non-blank line.
  671. +                  * Get to the beginning of the blank lines
  672. +                  * that come after it.
  673. +                  */
  674. +                 (void) ch_forw_get();
  675. +                 while (ch_forw_get() == '\r')
  676. +                     if (sigs)
  677. +                     {
  678. +                         null_line();
  679. +                         return (NULL_POSITION);
  680. +                     }
  681. +             }
  682. +             new_pos = ch_tell();
  683.           }
  684.       }
  685.   
  686. *** lesskey.c    Sat Jul 06 15:50:32 1991
  687. --- ..\myles177\lesskey.c    Thu Sep 12 21:33:28 1991
  688. *************** struct cmdname
  689. *** 107,113 ****
  690.       NULL,            0
  691.   };
  692.   
  693. ! main(argc, argv)
  694.       int argc;
  695.       char *argv[];
  696.   {
  697. --- 107,119 ----
  698.       NULL,            0
  699.   };
  700.   
  701. ! void usage()
  702. ! {
  703. !     fprintf(stderr, "usage: lesskey [-o output] [input]\n");
  704. !     exit(1);
  705. ! }
  706. ! void main(argc, argv)
  707.       int argc;
  708.       char *argv[];
  709.   {
  710. *************** main(argc, argv)
  711. *** 286,295 ****
  712.           p = getenv("HOME");
  713.           if (p == NULL || *p == '\0')
  714.           {
  715. -             fprintf(stderr, "cannot find $HOME - using current directory\n");
  716.   #if __MSDOS__
  717.               strcpy(line, "_less");
  718.   #else
  719.               strcpy(line, ".less");
  720.   #endif
  721.           } else
  722. --- 292,302 ----
  723.           p = getenv("HOME");
  724.           if (p == NULL || *p == '\0')
  725.           {
  726.   #if __MSDOS__
  727. +             fprintf(stderr, "No %HOME defined - using current directory\n");
  728.               strcpy(line, "_less");
  729.   #else
  730. +             fprintf(stderr, "cannot find $HOME - using current directory\n");
  731.               strcpy(line, ".less");
  732.   #endif
  733.           } else
  734. *************** main(argc, argv)
  735. *** 296,302 ****
  736.           {
  737.               strcpy(line, p);
  738.   #if __MSDOS__
  739. !             strcat(line, "\\_less");
  740.   #else
  741.               strcat(line, "/.less");
  742.   #endif
  743. --- 303,312 ----
  744.           {
  745.               strcpy(line, p);
  746.   #if __MSDOS__
  747. !             if ((line[strlen(line)-1] != '/')
  748. !              && (line[strlen(line)-1] != '\\'))
  749. !                 strcat(line, "/");
  750. !             strcat(line, "_less");
  751.   #else
  752.               strcat(line, "/.less");
  753.   #endif
  754. *************** main(argc, argv)
  755. *** 305,312 ****
  756.       }
  757.       if ((out = fopen(outfile, "w")) == NULL)
  758.           perror(outfile);
  759. !     else
  760.           fwrite((char *)usertable, 1, up-usertable, out);
  761.       exit(0);
  762.   }
  763.   
  764. --- 315,324 ----
  765.       }
  766.       if ((out = fopen(outfile, "w")) == NULL)
  767.           perror(outfile);
  768. !     else {
  769.           fwrite((char *)usertable, 1, up-usertable, out);
  770. +         fprintf(stderr, "Key definitions written to %s\n", outfile);
  771. +     }
  772.       exit(0);
  773.   }
  774.   
  775. *************** tchar(pp)
  776. *** 351,360 ****
  777.       }
  778.       *pp = p+1;
  779.       return (*p);
  780. - }
  781. - usage()
  782. - {
  783. -     fprintf(stderr, "usage: lesskey [-o output] [input]\n");
  784. -     exit(1);
  785.   }
  786. --- 363,366 ----
  787. *** line.c    Sat Jul 06 15:50:36 1991
  788. --- ..\myles177\line.c    Mon Sep 09 20:48:00 1991
  789. *************** plinenum(pos)
  790. *** 68,74 ****
  791.        */
  792.       lno = find_linenum(pos);
  793.   
  794. !     sprintf(&linebuf[curr], "%6d", lno);
  795.       n = strlen(&linebuf[curr]);
  796.       column += n;
  797.       for (i = 0;  i < n;  i++)
  798. --- 68,74 ----
  799.        */
  800.       lno = find_linenum(pos);
  801.   
  802. !     sprintf(&linebuf[curr], "%6u", lno);
  803.       n = strlen(&linebuf[curr]);
  804.       column += n;
  805.       for (i = 0;  i < n;  i++)
  806. *************** attr_swidth(a)
  807. *** 99,105 ****
  808.       {
  809.       case BOLD:    return (bo_s_width);
  810.       case UNDERLINE:    return (ul_s_width);
  811. !     case BLINK:    return (bl_s_width);
  812.       }
  813.       return (0);
  814.   }
  815. --- 99,105 ----
  816.       {
  817.       case BOLD:    return (bo_s_width);
  818.       case UNDERLINE:    return (ul_s_width);
  819. !     case BLINKING:    return (bl_s_width);
  820.       }
  821.       return (0);
  822.   }
  823. *************** attr_ewidth(a)
  824. *** 116,122 ****
  825.       {
  826.       case BOLD:    return (bo_e_width);
  827.       case UNDERLINE:    return (ul_e_width);
  828. !     case BLINK:    return (bl_e_width);
  829.       }
  830.       return (0);
  831.   }
  832. --- 116,122 ----
  833.       {
  834.       case BOLD:    return (bo_e_width);
  835.       case UNDERLINE:    return (ul_e_width);
  836. !     case BLINKING:    return (bl_e_width);
  837.       }
  838.       return (0);
  839.   }
  840. *************** do_append(c)
  841. *** 320,326 ****
  842.           {
  843.               STOREC(' ', NORMAL);
  844.           } while ((column % tabstop) != 0);
  845. !     } else if (control_char(c))
  846.       {
  847.       do_control_char:
  848.           if (ctldisp == 0)
  849. --- 320,326 ----
  850.           {
  851.               STOREC(' ', NORMAL);
  852.           } while ((column % tabstop) != 0);
  853. !     } else if ((c != '\r') && control_char(c))
  854.       {
  855.       do_control_char:
  856.           if (ctldisp == 0)
  857. *************** pdone(endline)
  858. *** 375,381 ****
  859.        * Add a newline if necessary,
  860.        * and append a '\0' to the end of the line.
  861.        */
  862. !     if (column < sc_width || !auto_wrap || ignaw || ctldisp == 0)
  863.       {
  864.           linebuf[curr] = '\n';
  865.           attr[curr] = NORMAL;
  866. --- 375,385 ----
  867.        * Add a newline if necessary,
  868.        * and append a '\0' to the end of the line.
  869.        */
  870. !     if (column < sc_width || !auto_wrap || ignaw
  871. ! #ifndef TURBOC
  872. ! || ctldisp == 0
  873. ! #endif
  874. !     )
  875.       {
  876.           linebuf[curr] = '\n';
  877.           attr[curr] = NORMAL;
  878. *** linenum.c    Sun Mar 10 12:03:24 1991
  879. --- ..\myles177\linenum.c    Thu Sep 12 22:08:34 1991
  880. *************** struct linenum
  881. *** 35,41 ****
  882.       struct linenum *prev;        /* Line to previous in the list */
  883.       POSITION pos;            /* File position */
  884.       POSITION gap;            /* Gap between prev and next */
  885. !     int line;            /* Line number */
  886.   };
  887.   /*
  888.    * "gap" needs some explanation: the gap of any particular line number
  889. --- 35,41 ----
  890.       struct linenum *prev;        /* Line to previous in the list */
  891.       POSITION pos;            /* File position */
  892.       POSITION gap;            /* Gap between prev and next */
  893. !     unsigned line;            /* Line number */
  894.   };
  895.   /*
  896.    * "gap" needs some explanation: the gap of any particular line number
  897. *************** struct linenum
  898. *** 48,54 ****
  899.   
  900.   #define    NPOOL    50            /* Size of line number pool */
  901.   
  902. ! #define    LONGTIME    (2)        /* In seconds */
  903.   
  904.   public int lnloop = 0;            /* Are we in the line num loop? */
  905.   
  906. --- 48,54 ----
  907.   
  908.   #define    NPOOL    50            /* Size of line number pool */
  909.   
  910. ! #define    LONGTIME    (1)        /* In seconds */
  911.   
  912.   public int lnloop = 0;            /* Are we in the line num loop? */
  913.   
  914. *************** add_lnum(lno, pos)
  915. *** 204,218 ****
  916.   longloopmessage()
  917.   {
  918.       ierror("Calculating line numbers", NULL_PARG);
  919. -     /*
  920. -      * Set the lnloop flag here, so if the user interrupts while
  921. -      * we are calculating line numbers, the signal handler will 
  922. -      * turn off line numbers (linenums=0).
  923. -      */
  924. -     lnloop = 1;
  925.   }
  926.   
  927. ! static int loopcount;
  928.   #if GET_TIME
  929.   static long startime;
  930.   #endif
  931. --- 204,212 ----
  932.   longloopmessage()
  933.   {
  934.       ierror("Calculating line numbers", NULL_PARG);
  935.   }
  936.   
  937. ! static long loopcount;
  938.   #if GET_TIME
  939.   static long startime;
  940.   #endif
  941. *************** static long startime;
  942. *** 220,225 ****
  943. --- 214,222 ----
  944.       static void
  945.   longish()
  946.   {
  947. + #ifdef TURBOC
  948. +     if (kbhit()) ;    /* permit control^c checking */
  949. + #endif
  950.   #if GET_TIME
  951.       if (loopcount >= 0 && ++loopcount > 100)
  952.       {
  953. *************** find_linenum(pos)
  954. *** 248,254 ****
  955.       POSITION pos;
  956.   {
  957.       register struct linenum *p;
  958. !     register int lno;
  959.       POSITION cpos;
  960.   
  961.       if (!linenums)
  962. --- 245,251 ----
  963.       POSITION pos;
  964.   {
  965.       register struct linenum *p;
  966. !     register unsigned lno;
  967.       POSITION cpos;
  968.   
  969.       if (!linenums)
  970. *************** find_linenum(pos)
  971. *** 300,305 ****
  972. --- 297,308 ----
  973.           if (ch_seek(p->pos))
  974.               return (0);
  975.           loopcount = 0;
  976. +         /*
  977. +          * Set the lnloop flag here, so if the user interrupts while
  978. +          * we are calculating line numbers, the signal handler will 
  979. +          * turn off line numbers (linenums=0).
  980. +          */
  981. +         lnloop = 1;
  982.           for (lno = p->line, cpos = p->pos;  cpos < pos;  lno++)
  983.           {
  984.               /*
  985. *************** find_linenum(pos)
  986. *** 329,334 ****
  987. --- 332,343 ----
  988.           if (ch_seek(p->pos))
  989.               return (0);
  990.           loopcount = 0;
  991. +         /*
  992. +          * Set the lnloop flag here, so if the user interrupts while
  993. +          * we are calculating line numbers, the signal handler will 
  994. +          * turn off line numbers (linenums=0).
  995. +          */
  996. +         lnloop = 1;
  997.           for (lno = p->line, cpos = p->pos;  cpos > pos;  lno--)
  998.           {
  999.               /*
  1000. *************** find_linenum(pos)
  1001. *** 355,361 ****
  1002.    */
  1003.       public POSITION
  1004.   find_pos(lno)
  1005. !     int lno;
  1006.   {
  1007.       register struct linenum *p;
  1008.       POSITION cpos;
  1009. --- 364,370 ----
  1010.    */
  1011.       public POSITION
  1012.   find_pos(lno)
  1013. !     unsigned lno;
  1014.   {
  1015.       register struct linenum *p;
  1016.       POSITION cpos;
  1017. *************** currline(where)
  1018. *** 429,435 ****
  1019.   {
  1020.       POSITION pos;
  1021.       POSITION len;
  1022. !     int lnum;
  1023.   
  1024.       pos = position(where);
  1025.       len = ch_length();
  1026. --- 438,444 ----
  1027.   {
  1028.       POSITION pos;
  1029.       POSITION len;
  1030. !     unsigned lnum;
  1031.   
  1032.       pos = position(where);
  1033.       len = ch_length();
  1034. *** lsystem.c    Sat Jul 06 15:50:44 1991
  1035. --- ..\myles177\lsystem.c    Wed Sep 11 20:44:24 1991
  1036. ***************
  1037. *** 20,29 ****
  1038. --- 20,42 ----
  1039.   #include <stdlib.h>
  1040.   #include <time.h>
  1041.   #include <ctype.h>
  1042. + #ifdef TURBOC
  1043. + /*
  1044. +  * This is what could be used, but why bother at all?
  1045. +  * For some people, switchar fiddling breaks things..
  1046. +  *
  1047. +  * extern int getswitchar();
  1048. +  * extern void setswitchar();
  1049. +  * #define get_swchar()        ((char) getswitchar())
  1050. +  * #define swchar_to_dos()        setswitchar('/')
  1051. +  * #define swchar_to_unix()    setswitchar('-')
  1052. +  */
  1053. + #else
  1054.   char get_swchar();
  1055.   void swchar_to_dos();
  1056.   void swchar_to_unix();
  1057.   #endif
  1058. + #endif
  1059.   
  1060.   extern char *getenv();
  1061.   
  1062. *************** lsystem(cmd)
  1063. *** 40,47 ****
  1064. --- 53,64 ----
  1065.       char *cmd;
  1066.   {
  1067.       register int inp;
  1068. + #if __MSDOS__
  1069. +     register int inp2;
  1070. + #else
  1071.       register char *shell;
  1072.       register char *p;
  1073. + #endif
  1074.       register char *curr_filename;
  1075.   
  1076.       /*
  1077. *************** lsystem(cmd)
  1078. *** 84,91 ****
  1079.        */
  1080.   #if __MSDOS__
  1081.   {
  1082. -     register int inp2;
  1083.       inp = dup(0);
  1084.       inp2 = open("CON", O_TEXT|O_RDONLY);
  1085.       dup2(0,inp2);
  1086. --- 101,106 ----
  1087. *************** lsystem(cmd)
  1088. *** 106,120 ****
  1089. --- 121,139 ----
  1090.   #if __MSDOS__
  1091.   {
  1092.       int result;
  1093. + #ifndef TURBOC
  1094.       char sw_char;
  1095.   
  1096.       sw_char = get_swchar();
  1097.       swchar_to_dos();
  1098. + #endif /* TURBOC */
  1099.       result = system(cmd);
  1100.       if (result != 0)
  1101.           perror("less");
  1102. + #ifndef TURBOC
  1103.       if (sw_char == '-')
  1104.           swchar_to_unix();
  1105. + #endif /* TURBOC */
  1106.   }
  1107.   #else
  1108.       p = NULL;
  1109. *** main.c    Sat Jul 06 15:50:48 1991
  1110. --- ..\myles177\main.c    Thu Sep 19 00:09:30 1991
  1111. *************** extern char *    tagpattern;
  1112. *** 41,51 ****
  1113. --- 41,66 ----
  1114.   extern int    tagoption;
  1115.   #endif
  1116.   
  1117. + #ifdef TURBOC
  1118. + void check_for_desqview ()
  1119. + {
  1120. +     asm {
  1121. +         mov    cx,'DE'        /* cx,dx = an invalid date */
  1122. +         mov    dx,'SQ'
  1123. +         mov    ax,2B01h    /* DOS "set date" function */
  1124. +         int    21h             /* Try to set invalid date */
  1125. +     }
  1126. +     if (_AL != 0xff)                /* DOS returns 0xff = function failed */
  1127. +         directvideo = 0;    /* DV active: use BIOS calls */
  1128. + }
  1129. + #include <stdio.h>
  1130. + #endif    /* TURBOC */
  1131.   
  1132.   
  1133.   /*
  1134.    * Entry point.
  1135.    */
  1136. + void
  1137.   main(argc, argv)
  1138.       int argc;
  1139.       char *argv[];
  1140. *************** main(argc, argv)
  1141. *** 63,68 ****
  1142. --- 78,86 ----
  1143.       init_prompt();
  1144.       init_charset();
  1145.       init_option();
  1146. + #ifdef TURBOC
  1147. +     check_for_desqview ();
  1148. + #endif    /* TURBOC */
  1149.       scan_option(getenv("LESS"));
  1150.   
  1151.   #define    isoptstring(s)    (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0')
  1152. *************** ecalloc(count, size)
  1153. *** 212,223 ****
  1154.   {
  1155.       register VOID_POINTER p;
  1156.   
  1157. !     p = calloc(count, size);
  1158.       if (p != NULL)
  1159.           return (p);
  1160.       error("Cannot allocate memory", NULL_PARG);
  1161.       quit(1);
  1162. !     /*NOTREACHED*/
  1163.   }
  1164.   
  1165.   /*
  1166. --- 230,241 ----
  1167.   {
  1168.       register VOID_POINTER p;
  1169.   
  1170. !     p = (VOID_POINTER) calloc(count, size);
  1171.       if (p != NULL)
  1172.           return (p);
  1173.       error("Cannot allocate memory", NULL_PARG);
  1174.       quit(1);
  1175. !     return (NULL); /*NOTREACHED*/
  1176.   }
  1177.   
  1178.   /*
  1179. *************** quit(status)
  1180. *** 262,267 ****
  1181. --- 280,286 ----
  1182.       flush();
  1183.       raw_mode(0);
  1184.   #if __MSDOS__
  1185. + #ifndef TURBOC
  1186.       restore_screen();
  1187.       /* 
  1188.        * If we don't close 2, we get some garbage from
  1189. *************** quit(status)
  1190. *** 270,275 ****
  1191. --- 289,295 ----
  1192.        * The same bug shows up if we use ^C^C to abort.
  1193.        */
  1194.       close(2);
  1195. + #endif
  1196.   #endif
  1197.       exit(status);
  1198.   }
  1199. *** optfunc.c    Sat Jul 06 15:50:50 1991
  1200. --- ..\myles177\optfunc.c    Thu Sep 12 21:47:44 1991
  1201. *************** extern char *tags;
  1202. *** 40,48 ****
  1203. --- 40,50 ----
  1204.   #endif
  1205.   #if __MSDOS__
  1206.   public char *window_box = NULL;
  1207. + #ifndef TURBOC
  1208.   extern int  directvideo;
  1209.   extern int  output_mode;
  1210.   #endif
  1211. + #endif
  1212.   
  1213.   
  1214.   #if LOGFILE
  1215. *************** opt_v(type, s)
  1216. *** 303,308 ****
  1217. --- 305,311 ----
  1218.       int type;
  1219.       register char *s;
  1220.   {
  1221. + #ifndef TURBOC
  1222.       switch (type)
  1223.       {
  1224.       case INIT:
  1225. *************** opt_v(type, s)
  1226. *** 315,322 ****
  1227. --- 318,327 ----
  1228.       case QUERY:
  1229.           break;
  1230.       }
  1231. + #endif
  1232.   }
  1233.   
  1234. + #ifndef TURBOC
  1235.   /*
  1236.    * Handler for -W option. (set/modify window boundaries)
  1237.    */
  1238. *************** opt_W(type, s)
  1239. *** 347,352 ****
  1240. --- 352,358 ----
  1241.       }
  1242.   }
  1243.   #endif
  1244. + #endif    /* TURBOC */
  1245.   
  1246.   /*
  1247.    * "-?" means display a help message.
  1248. *** option.c    Sat Jul 06 15:50:54 1991
  1249. --- ..\myles177\option.c    Tue Sep 10 16:14:24 1991
  1250. *************** static int flip_triple();
  1251. *** 20,25 ****
  1252. --- 20,27 ----
  1253.   extern int screen_trashed;
  1254.   extern char *every_first_cmd;
  1255.   
  1256. + public struct option * findopt ();
  1257.   /* 
  1258.    * Scan an argument (either from the command line or from the 
  1259.    * LESS environment variable) and process it.
  1260. *************** scan_option(s)
  1261. *** 107,113 ****
  1262. --- 109,119 ----
  1263.           if (o == NULL)
  1264.           {
  1265.               parg.p_string = propt(c);
  1266. + #ifdef    TURBOC
  1267. +             error("There is no %s flag (\"less -?\" for help)",
  1268. + #else
  1269.               error("There is no %s flag (\"less -\\?\" for help)",
  1270. + #endif    /* TURBOC */
  1271.                   &parg);
  1272.               quit(1);
  1273.           }
  1274. *** opttbl.c    Sun Mar 10 12:03:28 1991
  1275. --- ..\myles177\opttbl.c    Thu Sep 12 21:46:10 1991
  1276. *************** public int swindow;        /* Size of scrollin
  1277. *** 34,40 ****
  1278. --- 34,42 ----
  1279.   public int jump_sline;        /* Screen line of "jump target" */
  1280.   public int chopline;        /* Truncate displayed lines at screen width */
  1281.   #if __MSDOS__
  1282. + #ifndef TURBOC
  1283.   public int output_mode;        /* Which screen output method */
  1284. + #endif /* TURBOC */
  1285.   public int refresh_on_quit;    /* Repaint screen on quit, if possible */
  1286.   #endif
  1287.   
  1288. *************** static struct option option[] =
  1289. *** 176,183 ****
  1290. --- 178,189 ----
  1291.           "Print backspace as ^H"
  1292.       },
  1293.   #if __MSDOS__
  1294. + #ifdef TURBOC
  1295. +     { 'v', BOOL, 1, &directvideo, opt_v,
  1296. + #else
  1297.       { 'v', TRIPLE|NO_TOGGLE, 0, &output_mode, opt_v,
  1298.           "Output is to standard output, using ansi screen control",
  1299. + #endif
  1300.           "Output is to video BIOS",
  1301.           "Output is directly to memory mapped video"
  1302.       },
  1303. *************** static struct option option[] =
  1304. *** 187,192 ****
  1305. --- 193,199 ----
  1306.           "Display ~ for lines after end-of-file",
  1307.           NULL
  1308.       },
  1309. + #ifndef TURBOC
  1310.   #if __MSDOS__
  1311.   #if MOVE_WINDOW
  1312.   #define    W_FLAGS    STRING
  1313. *************** static struct option option[] =
  1314. *** 198,203 ****
  1315. --- 205,211 ----
  1316.       },
  1317.   #undef W_FLAGS
  1318.   #endif
  1319. + #endif /* TURBOC */
  1320.       { 'x', NUMBER|REPAINT, 8, &tabstop, NULL,
  1321.           "Tab stops: ",
  1322.           "Tab stops every %d spaces", 
  1323. *** output.c    Sun Mar 10 12:03:32 1991
  1324. --- ..\myles177\output.c    Fri Oct 04 21:24:58 1991
  1325. *************** extern int so_s_width, so_e_width;
  1326. *** 13,20 ****
  1327. --- 13,22 ----
  1328.   extern int screen_trashed;
  1329.   extern int any_display;
  1330.   #if __MSDOS__
  1331. + #ifndef TURBOC
  1332.   extern int output_mode;
  1333.   #endif
  1334. + #endif
  1335.   
  1336.   /*
  1337.    * Display the line which is in the line buffer.
  1338. *************** put_line()
  1339. *** 51,63 ****
  1340.               {
  1341.               case UNDERLINE:    ul_exit();    break;
  1342.               case BOLD:    bo_exit();    break;
  1343. !             case BLINK:    bl_exit();    break;
  1344.               }
  1345.               switch (a)
  1346.               {
  1347.               case UNDERLINE:    ul_enter();    break;
  1348.               case BOLD:    bo_enter();    break;
  1349. !             case BLINK:    bl_enter();    break;
  1350.               }
  1351.               curr_attr = a;
  1352.           }
  1353. --- 53,71 ----
  1354.               {
  1355.               case UNDERLINE:    ul_exit();    break;
  1356.               case BOLD:    bo_exit();    break;
  1357. !             case BLINKING:    bl_exit();    break;
  1358. ! #ifdef TURBOC
  1359. !             case BOLD2:    bo2_exit();    break;
  1360. ! #endif
  1361.               }
  1362.               switch (a)
  1363.               {
  1364.               case UNDERLINE:    ul_enter();    break;
  1365.               case BOLD:    bo_enter();    break;
  1366. !             case BLINKING:    bl_enter();    break;
  1367. ! #ifdef TURBOC
  1368. !             case BOLD2:    bo2_enter();    break;
  1369. ! #endif
  1370.               }
  1371.               curr_attr = a;
  1372.           }
  1373. *************** static char *ob = obuf;
  1374. *** 92,97 ****
  1375. --- 101,114 ----
  1376.       public void
  1377.   flush()
  1378.   {
  1379. + #ifdef TURBOC
  1380. +     *ob = '\0';
  1381. +     cputs(obuf);
  1382. +     ob = obuf;
  1383. + #else
  1384.       register int n;
  1385.       register int fd;
  1386.   
  1387. *************** flush()
  1388. *** 111,116 ****
  1389. --- 128,135 ----
  1390.       if (write(fd, obuf, n) != n)
  1391.           screen_trashed = 1;
  1392.       ob = obuf;
  1393. + #endif    /* TURBOC */
  1394.   }
  1395.   
  1396.   /*
  1397. *** prompt.c    Sun Mar 10 12:03:40 1991
  1398. --- ..\myles177\prompt.c    Sun Sep 01 11:13:32 1991
  1399. *************** ap_pos(pos)
  1400. *** 82,88 ****
  1401.   ap_int(n)
  1402.       int n;
  1403.   {
  1404. !     sprintf(mp, "%d", n);
  1405.       setmp();
  1406.   }
  1407.   
  1408. --- 82,88 ----
  1409.   ap_int(n)
  1410.       int n;
  1411.   {
  1412. !     sprintf(mp, "%u", n);
  1413.       setmp();
  1414.   }
  1415.   
  1416. *************** protochar(c, where)
  1417. *** 249,254 ****
  1418. --- 249,256 ----
  1419.           else
  1420.               ap_quest();
  1421.           break;
  1422. +     default:    /* When in doubt, just add the char to the message */
  1423. +         *mp++ = c;
  1424.       }
  1425.   }
  1426.   
  1427. *** screen.c    Sat Jul 06 15:50:58 1991
  1428. --- ..\myles177\screen.c    Tue Nov 12 23:38:28 1991
  1429. ***************
  1430. *** 6,11 ****
  1431. --- 6,16 ----
  1432.    */
  1433.   
  1434.   #include "less.h"
  1435. + #ifdef TURBOC
  1436. + extern struct text_info _video;
  1437. + #else
  1438.   #if XENIX
  1439.   #include <sys/types.h>
  1440.   #include <sys/ioctl.h>
  1441. *************** static char
  1442. *** 64,69 ****
  1443. --- 69,76 ----
  1444.       *sc_init,        /* Startup terminal initialization */
  1445.       *sc_deinit;        /* Exit terminal de-initialization */
  1446.   
  1447. + #endif /* TURBOC */
  1448.   static int init_done = 0;
  1449.   
  1450.   public int auto_wrap;        /* Terminal does \r\n when write past margin */
  1451. *************** public int ul_s_width, ul_e_width;    /* Pr
  1452. *** 75,80 ****
  1453. --- 82,89 ----
  1454.   public int so_s_width, so_e_width;    /* Printing width of standout seq */
  1455.   public int bl_s_width, bl_e_width;    /* Printing width of blink seq */
  1456.   
  1457. + #ifndef TURBOC
  1458.   static char *cheaper();
  1459.   
  1460.   /*
  1461. *************** static char *cheaper();
  1462. *** 85,94 ****
  1463.   /*extern*/ short ospeed;    /* Terminal output baud rate */
  1464.   /*extern*/ char PC;        /* Pad character */
  1465.   
  1466.   extern int quiet;        /* If VERY_QUIET, use visual bell for bell */
  1467.   extern int know_dumb;        /* Don't complain about a dumb terminal */
  1468. ! extern int back_scroll;
  1469.   extern int swindow;
  1470.   extern char *tgetstr();
  1471.   extern char *tgoto();
  1472.   extern char *getenv();
  1473. --- 94,108 ----
  1474.   /*extern*/ short ospeed;    /* Terminal output baud rate */
  1475.   /*extern*/ char PC;        /* Pad character */
  1476.   
  1477. + #endif /* TURBOC */
  1478.   extern int quiet;        /* If VERY_QUIET, use visual bell for bell */
  1479.   extern int know_dumb;        /* Don't complain about a dumb terminal */
  1480. ! extern int back_scroll, forw_scroll;
  1481.   extern int swindow;
  1482. + #ifndef TURBOC
  1483.   extern char *tgetstr();
  1484.   extern char *tgoto();
  1485.   extern char *getenv();
  1486. *************** get_term()
  1487. *** 289,295 ****
  1488.       scrsize(&sc_height, &sc_width);
  1489.       pos_init();
  1490.       if (swindow < 0)
  1491. !         swindow = sc_height - 1;
  1492.   
  1493.       auto_wrap = tgetflag("am");
  1494.       ignaw = tgetflag("xn");
  1495. --- 303,309 ----
  1496.       scrsize(&sc_height, &sc_width);
  1497.       pos_init();
  1498.       if (swindow < 0)
  1499. !         swindow = sc_height - 2;
  1500.   
  1501.       auto_wrap = tgetflag("am");
  1502.       ignaw = tgetflag("xn");
  1503. *************** putbs()
  1504. *** 702,704 ****
  1505. --- 716,985 ----
  1506.   {
  1507.       tputs(sc_backspace, 1, putchr);
  1508.   }
  1509. + #else  /* TURBOC under MSDOS: */
  1510. +     public void
  1511. + raw_mode(on)
  1512. +     int on;
  1513. + {
  1514. +     on = on;
  1515. + }
  1516. + /*
  1517. +  * Set terminal capabilities for TURBOC video output
  1518. +  */
  1519. +     public void
  1520. + get_term()
  1521. + {
  1522. +     extern int output_mode;
  1523. +     /*
  1524. +      * Get size of the screen.
  1525. +      */
  1526. +     sc_height = _video.screenheight;
  1527. +     sc_width  = _video.screenwidth;
  1528. +     if (sc_width != 80)
  1529. +         directvideo = 0;
  1530. +     pos_init();
  1531. +     if (swindow < 0)
  1532. +         swindow = sc_height - 2;
  1533. +     auto_wrap = 1;
  1534. +     ignaw = 0;
  1535. +     erase_char = '\b';
  1536. +     kill_char = '\003';
  1537. +     so_e_width = so_s_width = 0;
  1538. +     bo_s_width = bo_e_width = 0;
  1539. +     ul_s_width = ul_e_width = 0;
  1540. +     bl_s_width = bl_e_width = 0;
  1541. + }
  1542. + /*
  1543. +  * Below are the functions which perform all the 
  1544. +  * terminal-specific screen manipulation.
  1545. +  */
  1546. + /*
  1547. +  * Initialize terminal
  1548. +  */
  1549. +     public void
  1550. + init()
  1551. + {
  1552. +     flush();
  1553. +     if (init_done)
  1554. +         return;
  1555. +     textbackground(BLACK);
  1556. +     textcolor(LIGHTGRAY);
  1557. +     init_done = 1;
  1558. + }
  1559. + /*
  1560. +  * Deinitialize terminal
  1561. +  */
  1562. +     public void
  1563. + deinit()
  1564. + {
  1565. +     flush();
  1566. +     if (!init_done)
  1567. +         return;
  1568. +     init_done = 0;
  1569. + }
  1570. + /*
  1571. +  * Home cursor (move to upper left corner of screen).
  1572. +  */
  1573. +     public void
  1574. + home()
  1575. + {
  1576. +     flush();
  1577. +     gotoxy(1,1);
  1578. + }
  1579. + /*
  1580. +  * Add a blank line (called with cursor at home).
  1581. +  * Should scroll the display down.
  1582. +  */
  1583. +     public void
  1584. + add_line()
  1585. + {
  1586. +     flush();
  1587. +     insline();
  1588. + }
  1589. + /*
  1590. +  * Move cursor to lower left corner of screen.
  1591. +  */
  1592. +     public void
  1593. + lower_left()
  1594. + {
  1595. +     flush();
  1596. +     gotoxy(1,sc_height);
  1597. + }
  1598. + /*
  1599. +  * Ring the terminal bell.
  1600. +  */
  1601. +     public void
  1602. + bell()
  1603. + {
  1604. +     flush();
  1605. +     if (quiet == VERY_QUIET)
  1606. +         vbell();
  1607. +     else
  1608. +         putch('\7');
  1609. + }
  1610. + /*
  1611. +  * Output the "visual bell", if there is one.
  1612. +  */
  1613. +     public void
  1614. + vbell()
  1615. + {
  1616. + }
  1617. + /*
  1618. +  * Clear the screen.
  1619. +  */
  1620. +     public void
  1621. + clear()
  1622. + {
  1623. +     flush();
  1624. +     clrscr();
  1625. + }
  1626. + /*
  1627. +  * Clear from the cursor to the end of the cursor's line.
  1628. +  * {{ This must not move the cursor. }}
  1629. +  */
  1630. +     public void
  1631. + clear_eol()
  1632. + {
  1633. +     flush();
  1634. +     clreol();
  1635. + }
  1636. + /*
  1637. +  * Begin "standout" (bold, underline, or whatever).
  1638. +  */
  1639. +     public void
  1640. + so_enter()
  1641. + {
  1642. +     flush();
  1643. +     textcolor(RED);
  1644. + }
  1645. + /*
  1646. +  * End "standout".
  1647. +  */
  1648. +     public void
  1649. + so_exit()
  1650. + {
  1651. +     flush();
  1652. +     textcolor(LIGHTGRAY);
  1653. + }
  1654. + /*
  1655. +  * Begin "underline" (hopefully real underlining, 
  1656. +  * otherwise whatever the terminal provides).
  1657. +  */
  1658. +     public void
  1659. + ul_enter()
  1660. + {
  1661. +     flush();
  1662. +     textcolor(YELLOW);
  1663. + }
  1664. + /*
  1665. +  * End "underline".
  1666. +  */
  1667. +     public void
  1668. + ul_exit()
  1669. + {
  1670. +     flush();
  1671. +     textcolor(LIGHTGRAY);
  1672. + }
  1673. + /*
  1674. +  * Begin "bold"
  1675. +  */
  1676. +     public void
  1677. + bo_enter()
  1678. + {
  1679. +     flush();
  1680. +     textcolor(GREEN);
  1681. + }
  1682. + /*
  1683. +  * End "bold".
  1684. +  */
  1685. +     public void
  1686. + bo_exit()
  1687. + {
  1688. +     flush();
  1689. +     textcolor(LIGHTGRAY);
  1690. + }
  1691. + /*
  1692. +  * Begin "blink"
  1693. +  */
  1694. +     public void
  1695. + bl_enter()
  1696. + {
  1697. +     flush();
  1698. +     textcolor(_video.attribute|BLINK);
  1699. + }
  1700. + /*
  1701. +  * End "blink".
  1702. +  */
  1703. +     public void
  1704. + bl_exit()
  1705. + {
  1706. +     flush();
  1707. +     textcolor(_video.attribute&127);
  1708. + }
  1709. + /*
  1710. +  * Begin "bold2"
  1711. +  */
  1712. +     public void
  1713. + bo2_enter()
  1714. + {
  1715. +     flush();
  1716. +     textcolor(LIGHTBLUE);
  1717. + }
  1718. + /*
  1719. +  * End "bold2".
  1720. +  */
  1721. +     public void
  1722. + bo2_exit()
  1723. + {
  1724. +     flush();
  1725. +     textcolor(LIGHTGRAY);
  1726. + }
  1727. + /*
  1728. +  * Erase the character to the left of the cursor 
  1729. +  * and move the cursor left.
  1730. +  */
  1731. +     public void
  1732. + backspace()
  1733. + {
  1734. +     /* 
  1735. +      * Try to erase the previous character by overstriking with a space.
  1736. +      */
  1737. +     putstr("\b \b");
  1738. + }
  1739. + /*
  1740. +  * Output a plain backspace, without erasing the previous char.
  1741. +  */
  1742. +     public void
  1743. + putbs()
  1744. + {
  1745. +     putchr('\b');
  1746. + }
  1747. + #endif
  1748. *** search.c    Sat Jul 06 15:51:02 1991
  1749. --- ..\myles177\search.c    Thu Nov 14 12:23:10 1991
  1750. *************** search(search_type, pattern, n)
  1751. *** 213,218 ****
  1752. --- 213,221 ----
  1753.       oldpos = pos;
  1754.       for (;;)
  1755.       {
  1756. + #ifdef TURBOC
  1757. +         if (kbhit()) ;    /* permit ^C check */
  1758. + #endif
  1759.           /*
  1760.            * Get lines until we find a matching one or 
  1761.            * until we hit end-of-file (or beginning-of-file 
  1762. *** signal.c    Sun Mar 10 12:03:40 1991
  1763. --- ..\myles177\signal.c    Tue Sep 10 19:38:00 1991
  1764. *************** psignals()
  1765. *** 210,215 ****
  1766. --- 210,218 ----
  1767.            * {{ You may wish to replace the bell() with 
  1768.            *    error("Interrupt", NULL_PARG); }}
  1769.            */
  1770. + #ifdef TURBOC
  1771. +         screen_trashed = 1;
  1772. + #endif
  1773.   
  1774.           /*
  1775.            * If we were interrupted while in the "calculating 
  1776. *************** psignals()
  1777. *** 218,225 ****
  1778. --- 221,230 ----
  1779.           if (lnloop)
  1780.           {
  1781.               lnloop = 0;
  1782. + #ifndef TURBOC
  1783.               if (linenums == 2)
  1784.                   screen_trashed = 1;
  1785. + #endif
  1786.               linenums = 0;
  1787.               error("Line numbers turned off", NULL_PARG);
  1788.           }
  1789. *** ttyin.c    Sat Jul 06 15:51:06 1991
  1790. --- ..\myles177\ttyin.c    Wed Sep 11 19:16:48 1991
  1791. ***************
  1792. *** 3,8 ****
  1793. --- 3,13 ----
  1794.    */
  1795.   
  1796.   #include "less.h"
  1797. + extern int kill_char;
  1798. + #ifndef TURBOC
  1799.   #if __MSDOS__
  1800.   #include <io.h>
  1801.   #include <stdio.h>
  1802. *************** getchr()
  1803. *** 63,69 ****
  1804.           /*
  1805.            * In raw read, we don't see ^C so look here for it.
  1806.            */
  1807. !         if (c == '\003')
  1808.               raise(SIGINT);
  1809.   #endif
  1810.           /*
  1811. --- 68,74 ----
  1812.           /*
  1813.            * In raw read, we don't see ^C so look here for it.
  1814.            */
  1815. !         if (c == kill_char)
  1816.               raise(SIGINT);
  1817.   #endif
  1818.           /*
  1819. *************** getchr()
  1820. *** 77,79 ****
  1821. --- 82,132 ----
  1822.   
  1823.       return (c);
  1824.   }
  1825. + #else /* TURBOC */
  1826. + #include <dos.h>
  1827. + #include <signal.h>
  1828. + /*
  1829. +  * Open keyboard for input.
  1830. +  */
  1831. +     public void
  1832. + open_getchr()
  1833. + {
  1834. + }
  1835. + /*
  1836. +  * Get a character directly from the PC BIOS.
  1837. +  */
  1838. +     public int
  1839. + getchr()
  1840. + {
  1841. +     int c;
  1842. +      static int extrac = 0;
  1843. +  
  1844. +      if (extrac) {
  1845. +          c = extrac;
  1846. +          extrac = 0;
  1847. +          return c;
  1848. +      }
  1849. +      flush ();
  1850. +      do {
  1851. +          asm {
  1852. +              mov    ah,0    /* call:  BIOS read char into ax */
  1853. +              int    16h
  1854. +          }
  1855. +         c = _AX;
  1856. +         if (c == 0) {
  1857. +             raise (SIGINT);
  1858. +             c = kill_char;
  1859. +         } else {
  1860. +             extrac = c >> 8;
  1861. +             if (c &= 0xff)
  1862. +                 extrac = 0;
  1863. +             else
  1864. +                 c = '\200';
  1865. +         }
  1866. +      } while (c == 0);
  1867. +     return c;
  1868. + }
  1869. + #endif    /* TURBOC */
  1870. *** version.c    Sat Jul 06 15:51:10 1991
  1871. --- ..\myles177\version.c    Sat Jan 04 23:49:20 1992
  1872. ***************
  1873. *** 310,315 ****
  1874.    *    v177: Add LESSHELP variable.            4/2/91    mark
  1875.    *          Fix bug with F command with -e.
  1876.    *          Try /dev/tty for input before using fd 2.
  1877.    */
  1878.   
  1879. ! char version[] = "@(#) less  version 177";
  1880. --- 310,321 ----
  1881.    *    v177: Add LESSHELP variable.            4/2/91    mark
  1882.    *          Fix bug with F command with -e.
  1883.    *          Try /dev/tty for input before using fd 2.
  1884. +  *          Executable posted to comp.binaries.ibm.pc    Aug/91    M.Lord
  1885. +  *    v177+ Fixed many bugs in original port.        9/1/91    M.Lord
  1886. +  *    v177++ Added all optional features, new fixes    Oct/91    M.Lord
  1887. +  *    v177D Added missing ifdefs for unix compilation Nov/91    M.Lord
  1888. +  *    v177E Fix for buggy -s option;                  Jan/92    KiYun Roe
  1889. +  *          less +G  fixed                            Jan/92    M.Lord
  1890.    */
  1891.   
  1892. ! char version[] = "@(#) less  version 177E";
  1893. *** less.hlp    Sat Jul 06 15:50:20 1991
  1894. --- ..\myles177\less.hlp    Thu Sep 12 22:09:52 1991
  1895. ***************
  1896. *** 1,11 ****
  1897.   
  1898. !                      SUMMARY OF COMMANDS
  1899.   
  1900.         Commands marked with * may be preceded by a number, N.
  1901.         Notes in parentheses indicate the behavior if N is given.
  1902.   
  1903.     h  H                 Display this help.
  1904. !   q  :q  :Q  ZZ        Exit.
  1905.   
  1906.     e  ^E  j  ^N  CR  *  Forward  one line (or N lines).
  1907.     y  ^Y  k  ^K  ^P  *  Backward one line (or N lines).
  1908. --- 1,11 ----
  1909.   
  1910. ! LESS V177            SUMMARY OF COMMANDS
  1911.   
  1912.         Commands marked with * may be preceded by a number, N.
  1913.         Notes in parentheses indicate the behavior if N is given.
  1914.   
  1915.     h  H                 Display this help.
  1916. !   q  Q  :q  :Q  ZZ     Exit.
  1917.   
  1918.     e  ^E  j  ^N  CR  *  Forward  one line (or N lines).
  1919.     y  ^Y  k  ^K  ^P  *  Backward one line (or N lines).
  1920. ***************
  1921. *** 15,21 ****
  1922.     w                 *  Backward one window (and set window to N).
  1923.     d  ^D             *  Forward  one half-window (and set half-window to N).
  1924.     u  ^U             *  Backward one half-window (and set half-window to N).
  1925. !   F                    Forward forever; like "tail -f".
  1926.     r  ^R  ^L            Repaint screen.
  1927.     R                    Repaint screen, discarding buffered input.
  1928.   
  1929. --- 15,21 ----
  1930.     w                 *  Backward one window (and set window to N).
  1931.     d  ^D             *  Forward  one half-window (and set half-window to N).
  1932.     u  ^U             *  Backward one half-window (and set half-window to N).
  1933. !   F                    Forward forever; like "tail -f" (except on MSDOS).
  1934.     r  ^R  ^L            Repaint screen.
  1935.     R                    Repaint screen, discarding buffered input.
  1936.   
  1937. ***************
  1938. *** 52,60 ****
  1939.     ^X^X                 Same as '.
  1940.   
  1941.     E [file]             Examine a new file.
  1942. !   :e  ^X^V             Same as E.
  1943. !   :n                *  Examine the (N-th) next file from the command line.
  1944. !   :p                *  Examine the (N-th) previous file from the command line.
  1945.     =  ^G  :f            Print current file name.
  1946.     V                    Print version number of "less".
  1947.   
  1948. --- 52,60 ----
  1949.     ^X^X                 Same as '.
  1950.   
  1951.     E [file]             Examine a new file.
  1952. !   :e  ALT-e  ^X^V      Same as E.
  1953. !   :n  ALT-n         *  Examine the (N-th) next file from the command line.
  1954. !   :p  ALT-p         *  Examine the (N-th) previous file from the command line.
  1955.     =  ^G  :f            Print current file name.
  1956.     V                    Print version number of "less".
  1957.   
  1958. ***************
  1959. *** 97,102 ****
  1960. --- 97,103 ----
  1961.     -t [tag]      Find a tag.
  1962.     -T [tagsfile] Use an alternate tags file.
  1963.     -u  -U        Change handling of backspaces.
  1964. +   -v            Use video BIOS instead of direct screen writes (MSDOS only).
  1965.     -w            Display ~ for lines after end-of-file.
  1966.     -x [N]        Set tab stops.
  1967.     -y [N]        Forward scroll limit.
  1968.