home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 036 / less232.zip / PATCHES.OS2 < prev    next >
Text File  |  1994-09-24  |  21KB  |  879 lines

  1. Only in new: README.OS2
  2. Only in new: Makefile.os2
  3. Only in new: patches.os2
  4. Only in new: defines.os2
  5. Only in new: less.ini
  6. Only in new: lesskey.inp
  7. Only in new: termcap.c
  8. Only in new: termcap.dat
  9. Only in new: termcap.h
  10. Only in new: zfiles.c
  11. diff -cbr orig/ch.c new/ch.c
  12. *** orig/ch.c    Fri Aug 26 06:54:28 1994
  13. --- new/ch.c    Sat Sep 24 10:40:10 1994
  14. ***************
  15. *** 87,93 ****
  16.   
  17.   static struct filestate *thisfile;
  18.   
  19. ! extern int ispipe;
  20.   extern int autobuf;
  21.   extern int sigs;
  22.   #if LOGFILE
  23. --- 87,93 ----
  24.   
  25.   static struct filestate *thisfile;
  26.   
  27. ! extern int ispipe, iscompressed;
  28.   extern int autobuf;
  29.   extern int sigs;
  30.   #if LOGFILE
  31. ***************
  32. *** 501,507 ****
  33.   {
  34.       register struct buf *bp;
  35.   
  36. !     if (ispipe)
  37.       {
  38.           /*
  39.            * If input is a pipe, we don't flush buffer contents,
  40. --- 501,507 ----
  41.   {
  42.       register struct buf *bp;
  43.   
  44. !     if (ispipe && !iscompressed)
  45.       {
  46.           /*
  47.            * If input is a pipe, we don't flush buffer contents,
  48. ***************
  49. *** 528,533 ****
  50. --- 528,539 ----
  51.       ch_fpos = 0;
  52.       ch_block = ch_fpos / LBUFSIZE;
  53.       ch_offset = ch_fpos % LBUFSIZE;
  54. +     if (iscompressed)
  55. +     {
  56. +           ch_fsize = NULL_POSITION;
  57. +           return;
  58. +     }
  59.   
  60.       if (lseek(file, (off_t)0, 0) == BAD_LSEEK)
  61.       {
  62. diff -cbr orig/charset.c new/charset.c
  63. *** orig/charset.c    Sun Aug 28 23:26:22 1994
  64. --- new/charset.c    Sat Sep 24 10:41:20 1994
  65. ***************
  66. *** 47,52 ****
  67. --- 47,53 ----
  68.       { "ascii",    "8bcccbcc18b95.b"        },
  69.       { "latin1",    "8bcccbcc18b95.33b."        },
  70.       { "dos",    "8bcccbcc12bc5b95.98b.b"    },
  71. +     { "pc8",    "8bcccbcc18b95.b128."        },
  72.       { "koi8-r",    "8bcccbcc18b95.b128."        },
  73.       { NULL }
  74.   };
  75. ***************
  76. *** 237,243 ****
  77. --- 238,248 ----
  78.       /*
  79.        * Default to "ascii".
  80.        */
  81. + #if OS2
  82. +     (void) icharset("pc8");
  83. + #else
  84.       (void) icharset("ascii");
  85. + #endif
  86.   #endif
  87.   }
  88.   
  89. diff -cbr orig/command.c new/command.c
  90. *** orig/command.c    Fri Sep 02 22:19:24 1994
  91. --- new/command.c    Sat Sep 24 10:40:12 1994
  92. ***************
  93. *** 35,41 ****
  94.   #include "cmd.h"
  95.   
  96.   extern int erase_char, kill_char;
  97. ! extern int ispipe;
  98.   extern int sigs;
  99.   extern int quit_at_eof;
  100.   extern int hit_eof;
  101. --- 35,41 ----
  102.   #include "cmd.h"
  103.   
  104.   extern int erase_char, kill_char;
  105. ! extern int ispipe, iscompressed;
  106.   extern int sigs;
  107.   extern int quit_at_eof;
  108.   extern int hit_eof;
  109. ***************
  110. *** 432,438 ****
  111.        */
  112.       if (empty_screen())
  113.       {
  114. !         if (initial_scrpos.pos == NULL_POSITION)
  115.               /*
  116.                * {{ Maybe this should be:
  117.                *    jump_loc(ch_zero(), jump_sline);
  118. --- 432,438 ----
  119.        */
  120.       if (empty_screen())
  121.       {
  122. !         if (initial_scrpos.pos == NULL_POSITION || iscompressed)
  123.               /*
  124.                * {{ Maybe this should be:
  125.                *    jump_loc(ch_zero(), jump_sline);
  126. diff -cbr orig/decode.c new/decode.c
  127. *** orig/decode.c    Thu Aug 25 06:28:26 1994
  128. --- new/decode.c    Sat Sep 24 10:40:12 1994
  129. ***************
  130. *** 310,316 ****
  131.        * Try to open the lesskey file.
  132.        * If we can't, return an error.
  133.        */
  134. !     f = open(filename, 0);
  135.       if (f < 0)
  136.           return (-1);
  137.   
  138. --- 310,316 ----
  139.        * Try to open the lesskey file.
  140.        * If we can't, return an error.
  141.        */
  142. !         f = open(filename, O_RDONLY | O_BINARY);
  143.       if (f < 0)
  144.           return (-1);
  145.   
  146. diff -cbr orig/edit.c new/edit.c
  147. *** orig/edit.c    Fri Sep 09 08:23:44 1994
  148. --- new/edit.c    Sat Sep 24 10:40:14 1994
  149. ***************
  150. *** 34,40 ****
  151.   public int fd0 = 0;
  152.   #define    ISPIPE(fd)    ((fd)==fd0)
  153.   
  154. ! extern int ispipe;
  155.   extern int new_file;
  156.   extern int errmsgs;
  157.   extern int quit_at_eof;
  158. --- 34,40 ----
  159.   public int fd0 = 0;
  160.   #define    ISPIPE(fd)    ((fd)==fd0)
  161.   
  162. ! extern int ispipe, iscompressed, newcompressed;
  163.   extern int new_file;
  164.   extern int errmsgs;
  165.   extern int quit_at_eof;
  166. ***************
  167. *** 151,156 ****
  168. --- 151,159 ----
  169.       /*
  170.        * Close the current file, unless it is a pipe.
  171.        */
  172. +         if (iscompressed)
  173. +             Zclose(file);
  174. +         else
  175.       if (!ISPIPE(file))
  176.       {
  177.           close(file);
  178. ***************
  179. *** 235,246 ****
  180.           }
  181.           del_ifile(ifile);
  182.           return (1);
  183.       }
  184. - #if MSOFTC
  185.       else if ((f = open(open_filename, O_RDONLY|O_BINARY)) < 0)
  186. - #else
  187. -     else if ((f = open(open_filename, 0)) < 0)
  188. - #endif
  189.       {
  190.           parg.p_string = errno_message(filename);
  191.           error("%s", &parg);
  192. --- 238,258 ----
  193.           }
  194.           del_ifile(ifile);
  195.           return (1);
  196. +         } else if ((answer = isZfile(filename)) >= 0)
  197. +     {
  198. +         f = Zopen(filename, answer);
  199. +         if ( f < 0 )
  200. +         {
  201. +                         parg.p_string = errno_message(filename);
  202. +             error("%s", &parg);
  203. +             free(parg.p_string);
  204. +             return (1);
  205. +                 }
  206. +         newcompressed = 1;
  207.       }
  208.       else if ((f = open(open_filename, O_RDONLY|O_BINARY)) < 0)
  209.       {
  210.           parg.p_string = errno_message(filename);
  211.           error("%s", &parg);
  212. ***************
  213. *** 258,264 ****
  214.           }
  215.       }
  216.   
  217. !     ispipe = ISPIPE(f);
  218.   #if LOGFILE
  219.   {
  220.       char *s;
  221. --- 270,279 ----
  222.           }
  223.       }
  224.   
  225. !         iscompressed = newcompressed;
  226. !         newcompressed = 0;
  227. !     ispipe = ISPIPE(f) || iscompressed;
  228.   #if LOGFILE
  229.   {
  230.       char *s;
  231. ***************
  232. *** 520,526 ****
  233.   {
  234.       if (isatty(fd0))
  235.       {
  236. ! #if MSOFTC
  237.           error("Missing filename (\"less -?\" for help)", NULL_PARG);
  238.   #else
  239.           error("Missing filename (\"less -\\?\" for help)", NULL_PARG);
  240. --- 535,541 ----
  241.   {
  242.       if (isatty(fd0))
  243.       {
  244. ! #if MSOFTC || OS2
  245.           error("Missing filename (\"less -?\" for help)", NULL_PARG);
  246.   #else
  247.           error("Missing filename (\"less -\\?\" for help)", NULL_PARG);
  248. ***************
  249. *** 598,604 ****
  250.           /*
  251.            * Append: open the file and seek to the end.
  252.            */
  253. ! #if MSOFTC
  254.           logfile = open(filename, O_APPEND|O_WRONLY);
  255.   #else
  256.           logfile = open(filename, 1);
  257. --- 613,619 ----
  258.           /*
  259.            * Append: open the file and seek to the end.
  260.            */
  261. ! #if MSOFTC || OS2
  262.           logfile = open(filename, O_APPEND|O_WRONLY);
  263.   #else
  264.           logfile = open(filename, 1);
  265. diff -cbr orig/filename.c new/filename.c
  266. *** orig/filename.c    Fri Sep 02 22:20:34 1994
  267. --- new/filename.c    Sat Sep 24 10:40:14 1994
  268. ***************
  269. *** 85,90 ****
  270. --- 85,103 ----
  271.       }
  272.       
  273.   #else
  274. + #if OS2
  275. +         pathname = (char *) calloc(256, sizeof(char));
  276. +     if (pathname == NULL)
  277. +         return NULL;
  278. +         _searchenv(filename, "INIT", pathname);
  279. +         if ( pathname[0] == 0 )
  280. +           _searchenv(filename, "PATH", pathname);
  281. +         if ( pathname[0] == 0 )
  282. +         {
  283. +           free(pathname);
  284. +           return NULL;
  285. +         }
  286. + #else
  287.       if (homedir == NULL)
  288.           return (NULL);
  289.       pathname = (char *) calloc(strlen(homedir)+strlen(filename)+2,
  290. ***************
  291. *** 93,98 ****
  292. --- 106,112 ----
  293.           return (NULL);
  294.       sprintf(pathname, "%s/%s", homedir, filename);
  295.   #endif
  296. + #endif
  297.       return (pathname);
  298.   }
  299.   
  300. ***************
  301. *** 106,112 ****
  302.       
  303.       if ((helpfile = getenv("LESSHELP")) != NULL)
  304.           return (save(helpfile));
  305. ! #if MSOFTC
  306.       return (homefile(HELPFILE));
  307.   #else
  308.       return (save(HELPFILE));
  309. --- 120,126 ----
  310.       
  311.       if ((helpfile = getenv("LESSHELP")) != NULL)
  312.           return (save(helpfile));
  313. ! #if MSOFTC || OS2
  314.       return (homefile(HELPFILE));
  315.   #else
  316.       return (save(HELPFILE));
  317. ***************
  318. *** 314,319 ****
  319. --- 328,334 ----
  320.           (s2 == NULL ? 0 : strlen(s2)) + 1;
  321.       scmd = (char *) ecalloc(len, sizeof(char));
  322.       sprintf(scmd, cmd, s1, s2);
  323. + #if !OS2
  324.       shell = getenv("SHELL");
  325.       if (shell != NULL && *shell != '\0')
  326.       {
  327. ***************
  328. *** 326,332 ****
  329.           free(scmd);
  330.           scmd = scmd2;
  331.       }
  332.       fd = popen(scmd, "r");
  333.       free(scmd);
  334.       return (fd);
  335. --- 341,347 ----
  336.           free(scmd);
  337.           scmd = scmd2;
  338.       }
  339. ! #endif
  340.       fd = popen(scmd, "r");
  341.       free(scmd);
  342.       return (fd);
  343. ***************
  344. *** 336,341 ****
  345. --- 351,368 ----
  346.   glob(filename)
  347.       char *filename;
  348.   {
  349. + #if OS2
  350. +     char **list = _fnexplode(filename);
  351. +     char *names;
  352. +     int cnt, length = 0;
  353. +     for (cnt = 0; list[cnt]; cnt++)
  354. +           length += strlen(list[cnt]) + 1;
  355. +     names = (char *) ecalloc(length, sizeof(char));
  356. +     for (cnt = 0; list[cnt]; cnt++)
  357. +           strcat(strcat(names, list[cnt]), " ");
  358. +     _fnexplodefree(list);
  359. +     return names;
  360. + #else
  361.       FILE *fd;
  362.       char *gfilename;
  363.   
  364. ***************
  365. *** 362,367 ****
  366. --- 389,395 ----
  367.       if (*gfilename == '\0')
  368.           return (NULL);
  369.       return (gfilename);
  370. + #endif
  371.   }
  372.   
  373.       public char *
  374. diff -cbr orig/help.c new/help.c
  375. *** orig/help.c    Tue Jul 26 02:40:10 1994
  376. --- new/help.c    Sat Sep 24 10:40:16 1994
  377. ***************
  378. *** 69,77 ****
  379. --- 69,83 ----
  380.   #else
  381.       cmd = (char *) ecalloc(strlen(helpfile) + strlen(progname) + 150,
  382.                   sizeof(char));
  383. + #if OS2
  384. +     sprintf(cmd,
  385. +      "-%s -m -H -+E -+s \"-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done \" %s",
  386. +         progname, helpfile);
  387. + #else
  388.       sprintf(cmd, 
  389.        "-%s -m -H -+E -+s '-PmHELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done ' %s",
  390.           progname, helpfile);
  391. + #endif
  392.   #endif
  393.       free(helpfile);
  394.       lsystem(cmd);
  395. diff -cbr orig/less.h new/less.h
  396. *** orig/less.h    Fri Aug 26 06:59:10 1994
  397. --- new/less.h    Sat Sep 24 10:40:16 1994
  398. ***************
  399. *** 62,67 ****
  400. --- 62,70 ----
  401.   #include <stdlib.h>
  402.   #include <string.h>
  403.   #endif
  404. + #if HAVE_FCNTL_H
  405. + #include <fcntl.h>
  406. + #endif
  407.   
  408.   #if !STDC_HEADERS
  409.   char *getenv();
  410. ***************
  411. *** 199,204 ****
  412. --- 202,211 ----
  413.   /* Flags for editchar() */
  414.   #define    EC_PEEK        01
  415.   #define    EC_NOHISTORY    02
  416. + #ifndef O_BINARY
  417. + #define O_BINARY 0
  418. + #endif
  419.   
  420.   #define    SIGNAL(sig,func)    signal(sig,func)
  421.   
  422. diff -cbr orig/less.nro new/less.nro
  423. *** orig/less.nro    Tue Sep 13 06:48:42 1994
  424. --- new/less.nro    Sat Sep 24 10:40:18 1994
  425. ***************
  426. *** 1122,1127 ****
  427. --- 1122,1193 ----
  428.   .I less
  429.   is being run.
  430.   
  431. + .SH "REGULAR EXPRESSION SYNTAX"
  432. + This segment is extracted from regexp.3 in Henry Spencer's regexp package.
  433. + The entire regexp package can be obtained separately.
  434. + .PP
  435. + A regular expression is zero or more \fIbranches\fR, separated by `|'.
  436. + It matches anything that matches one of the branches.
  437. + .PP
  438. + A branch is zero or more \fIpieces\fR, concatenated.
  439. + It matches a match for the first, followed by a match for the second, etc.
  440. + .PP
  441. + A piece is an \fIatom\fR possibly followed by `*', `+', or `?'.
  442. + An atom followed by `*' matches a sequence of 0 or more matches of the atom.
  443. + An atom followed by `+' matches a sequence of 1 or more matches of the atom.
  444. + An atom followed by `?' matches a match of the atom, or the null string.
  445. + .PP
  446. + An atom is a regular expression in parentheses (matching a match for the
  447. + regular expression), a \fIrange\fR (see below), `.'
  448. + (matching any single character), `^' (matching the null string at the
  449. + beginning of the input string), `$' (matching the null string at the
  450. + end of the input string), a `\e' followed by a single character (matching
  451. + that character), or a single character with no other significance
  452. + (matching that character).
  453. + .PP
  454. + A \fIrange\fR is a sequence of characters enclosed in `[]'.
  455. + It normally matches any single character from the sequence.
  456. + If the sequence begins with `^',
  457. + it matches any single character \fInot\fR from the rest of the sequence.
  458. + If two characters in the sequence are separated by `\-', this is shorthand
  459. + for the full list of ASCII characters between them
  460. + (e.g. `[0-9]' matches any decimal digit).
  461. + To include a literal `]' in the sequence, make it the first character
  462. + (following a possible `^').
  463. + To include a literal `\-', make it the first or last character.
  464. + .SH AMBIGUITY
  465. + If a regular expression could match two different parts of the input string,
  466. + it will match the one which begins earliest.
  467. + If both begin in the same place       but match different lengths, or match
  468. + the same length in different ways, life gets messier, as follows.
  469. + .PP
  470. + In general, the possibilities in a list of branches are considered in
  471. + left-to-right order, the possibilities for `*', `+', and `?' are
  472. + considered longest-first, nested constructs are considered from the
  473. + outermost in, and concatenated constructs are considered leftmost-first.
  474. + The match that will be chosen is the one that uses the earliest
  475. + possibility in the first choice that has to be made.
  476. + If there is more than one choice, the next will be made in the same manner
  477. + (earliest possibility) subject to the decision on the first choice.
  478. + And so forth.
  479. + .PP
  480. + For example, `(ab|a)b*c' could match `abc' in one of two ways.
  481. + The first choice is between `ab' and `a'; since `ab' is earlier, and does
  482. + lead to a successful overall match, it is chosen.
  483. + Since the `b' is already spoken for,
  484. + the `b*' must match its last possibility\(emthe empty string\(emsince
  485. + it must respect the earlier choice.
  486. + .PP
  487. + In the particular case where no `|'s are present and there is only one
  488. + `*', `+', or `?', the net effect is that the longest possible
  489. + match will be chosen.
  490. + So `ab*', presented with `xabbbby', will match `abbbb'.
  491. + Note that if `ab*' is tried against `xabyabbbz', it
  492. + will match `ab' just after `x', due to the begins-earliest rule.
  493. + (In effect, the decision on where to start the match is the first choice
  494. + to be made, hence subsequent choices must respect it even if this leads them
  495. + to less-preferred alternatives.)
  496.   .SH "SEE ALSO"
  497.   lesskey(1)
  498.   
  499. diff -cbr orig/lesskey.c new/lesskey.c
  500. *** orig/lesskey.c    Tue Sep 13 06:56:02 1994
  501. --- new/lesskey.c    Sat Sep 24 10:41:48 1994
  502. ***************
  503. *** 202,208 ****
  504.   
  505.   usage()
  506.   {
  507. !     fprintf(stderr, "usage: lesskey [-o output] [input]\n");
  508.       exit(1);
  509.   }
  510.   
  511. --- 202,208 ----
  512.   
  513.   usage()
  514.   {
  515. !     fprintf(stderr, "\nUsage: lesskey [-o output] [input]\n");
  516.       exit(1);
  517.   }
  518.   
  519. ***************
  520. *** 257,262 ****
  521. --- 257,265 ----
  522.               exit(1);
  523.           }
  524.       } else
  525. +             if ( isatty(fileno(stdin)) )
  526. +                 usage();
  527. +             else
  528.           desc = stdin;
  529.   
  530.       /*
  531. ***************
  532. *** 380,385 ****
  533. --- 383,396 ----
  534.        */
  535.       if (outfile == NULL)
  536.       {
  537. + #if OS2
  538. +                 if ( p = getenv("INIT") )
  539. +                   strcpy(line, p);
  540. +                 else
  541. +                   strcpy(line, ".");
  542. +                 strcat(line, "\\less.ini");
  543. + #else
  544.           p = getenv("HOME");
  545.           if (p == NULL || *p == '\0')
  546.           {
  547. ***************
  548. *** 396,401 ****
  549. --- 407,413 ----
  550.               strcat(line, LESSKEYFILE);
  551.           }
  552.           outfile = line;
  553. + #endif
  554.       }
  555.       if ((out = fopen(outfile, "w")) == NULL)
  556.           perror(outfile);
  557. diff -cbr orig/lsystem.c new/lsystem.c
  558. *** orig/lsystem.c    Fri Sep 02 22:23:16 1994
  559. --- new/lsystem.c    Sat Sep 24 10:40:20 1994
  560. ***************
  561. *** 40,45 ****
  562. --- 40,48 ----
  563.   #if MSOFTC
  564.   #include <dos.h>
  565.   #endif
  566. + #if OS2
  567. + #include <process.h>
  568. + #endif
  569.   
  570.   extern int screen_trashed;
  571.   extern IFILE curr_ifile;
  572. ***************
  573. *** 56,62 ****
  574.       char *cmd;
  575.   {
  576.       register int inp;
  577. ! #if MSOFTC
  578.       register int inp2;
  579.   #endif
  580.       register char *shell;
  581. --- 59,65 ----
  582.       char *cmd;
  583.   {
  584.       register int inp;
  585. ! #if MSOFTC || OS2
  586.       register int inp2;
  587.   #endif
  588.       register char *shell;
  589. ***************
  590. *** 100,106 ****
  591.        * (the normal standard input), even if less's standard input 
  592.        * is coming from a pipe.
  593.        */
  594. ! #if MSOFTC
  595.       inp = dup(0);
  596.       inp2 = open("CON", O_TEXT|O_RDONLY);
  597.       dup2(0,inp2);
  598. --- 103,109 ----
  599.        * (the normal standard input), even if less's standard input 
  600.        * is coming from a pipe.
  601.        */
  602. ! #if MSOFTC || OS2
  603.       inp = dup(0);
  604.       inp2 = open("CON", O_TEXT|O_RDONLY);
  605.       dup2(0,inp2);
  606. ***************
  607. *** 141,153 ****
  608.       system(p);
  609.       free(p);
  610.   #else
  611.       system(cmd);
  612.   #endif
  613.   
  614.       /*
  615.        * Restore standard input, reset signals, raw mode, etc.
  616.        */
  617. ! #if MSOFTC
  618.       close(inp2);
  619.       dup2(0,inp);
  620.       close(inp);
  621. --- 144,166 ----
  622.       system(p);
  623.       free(p);
  624.   #else
  625. + #if OS2
  626. +         if ( *cmd == 0 )
  627. +         {
  628. +           if ( (p = getenv("COMSPEC")) == NULL )
  629. +             p = "cmd.exe";
  630. +           spawnlp(P_WAIT, p, p, NULL);
  631. +         }
  632. +         else
  633. + #endif
  634.       system(cmd);
  635.   #endif
  636.   
  637.       /*
  638.        * Restore standard input, reset signals, raw mode, etc.
  639.        */
  640. ! #if MSOFTC || OS2
  641.       close(inp2);
  642.       dup2(0,inp);
  643.       close(inp);
  644. diff -cbr orig/main.c new/main.c
  645. *** orig/main.c    Wed Sep 21 23:05:20 1994
  646. --- new/main.c    Sat Sep 24 10:40:20 1994
  647. ***************
  648. *** 32,38 ****
  649.   #include "less.h"
  650.   #include "position.h"
  651.   
  652. ! public int    ispipe;
  653.   public char *    every_first_cmd = NULL;
  654.   public int    new_file;
  655.   public int    is_tty;
  656. --- 32,38 ----
  657.   #include "less.h"
  658.   #include "position.h"
  659.   
  660. ! public int      ispipe, iscompressed, newcompressed;
  661.   public char *    every_first_cmd = NULL;
  662.   public int    new_file;
  663.   public int    is_tty;
  664. ***************
  665. *** 69,74 ****
  666. --- 69,90 ----
  667.   extern int    jump_sline;
  668.   #endif
  669.   
  670. + extern char version[];
  671. + extern char *strchr();
  672. + usage()
  673. + {
  674. +   int x = strlen(progname);
  675. +   printf("\n%s.\n", version + 5);
  676. +   printf("\nUsage: %s [-[+]aABcCdeEfgimMnNqQruUsw] [-bN] [-hN] [-xN] [-[z]N]", progname);
  677. +   printf("\n       %*s [-P[mM=]string] [-[lL]logfile] [-kkeyfile]", x, "");
  678. +   printf("\n       %*s [+cmd] [-ttag] [filename]...\n", x, "");
  679. +   printf("\n   or: %s -?\n", progname);
  680. +   exit(1);
  681. + }
  682.   
  683.   
  684.   /*
  685. ***************
  686. *** 81,88 ****
  687. --- 97,112 ----
  688.   {
  689.       IFILE ifile;
  690.   
  691. + #ifdef __EMX__
  692. +     _response(&argc, &argv);
  693. +     _wildcard(&argc, &argv);
  694. + #endif
  695.       progname = *argv++;
  696.   
  697. +     if (isatty(0) && argc == 1)
  698. +       usage();
  699.       /*
  700.        * Process command line arguments and LESS environment arguments.
  701.        * Command line arguments override environment arguments.
  702. ***************
  703. *** 129,135 ****
  704.       ifile = NULL_IFILE;
  705.       while (--argc >= 0)
  706.       {
  707. ! #if MSOFTC
  708.           /*
  709.            * Because the "shell" doesn't expand filename patterns,
  710.            * treat each argument as a filename pattern rather than
  711. --- 153,159 ----
  712.       ifile = NULL_IFILE;
  713.       while (--argc >= 0)
  714.       {
  715. ! #if MSOFTC || OS2
  716.           /*
  717.            * Because the "shell" doesn't expand filename patterns,
  718.            * treat each argument as a filename pattern rather than
  719. diff -cbr orig/screen.c new/screen.c
  720. *** orig/screen.c    Fri Sep 23 19:51:38 1994
  721. --- new/screen.c    Sat Sep 24 10:44:24 1994
  722. ***************
  723. *** 152,157 ****
  724. --- 152,162 ----
  725.   
  726.       if (on == curr_on)
  727.           return;
  728. + #if OS2
  729. +         signal(SIGINT, SIG_IGN);
  730. +     erase_char = '\b';
  731. +     kill_char = '\033';
  732. + #else
  733.   #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS
  734.       {
  735.       struct termios s;
  736. ***************
  737. *** 318,323 ****
  738. --- 323,329 ----
  739.       }
  740.   #endif
  741.   #endif
  742. + #endif
  743.       curr_on = on;
  744.   }
  745.   
  746. ***************
  747. *** 343,348 ****
  748. --- 349,362 ----
  749.       public void
  750.   scrsize()
  751.   {
  752. + #if OS2
  753. +         {
  754. +           int s[2];
  755. +       _scrsize(s);
  756. +           sc_width = s[0];
  757. +           sc_height = s[1];
  758. +         }
  759. + #else
  760.       register char *s;
  761.   #ifdef TIOCGWINSZ
  762.       struct winsize w;
  763. ***************
  764. *** 385,390 ****
  765. --- 399,405 ----
  766.           sc_width = atoi(s);
  767.       else
  768.            sc_width = tgetnum("co");
  769. + #endif
  770.   
  771.        if (sc_width <= 0)
  772.             sc_width = 80;
  773. ***************
  774. *** 539,545 ****
  775. --- 554,564 ----
  776.        * Find out what kind of terminal this is.
  777.        */
  778.        if ((term = getenv("TERM")) == NULL)
  779. + #if OS2
  780. +                 term = "ansi";
  781. + #else
  782.            term = "unknown";
  783. + #endif
  784.        if (tgetent(termbuf, term) <= 0)
  785.            strcpy(termbuf, "dumb:hc:");
  786.   
  787. ***************
  788. *** 727,736 ****
  789. --- 746,761 ----
  790.       t2 = tgetstr("sr", &sp);
  791.       if (hard || t2 == NULL)
  792.           t2 = "";
  793. + #if OS2
  794. +         if (*t1 == '\0' && *t2 == '\0')
  795. +            sc_addline = "";
  796. +         else
  797. + #endif
  798.       if (above_mem)
  799.           sc_addline = t1;
  800.       else
  801.           sc_addline = cheaper(t1, t2, "scroll backwards", "");
  802.       if (*sc_addline == '\0')
  803.       {
  804.           /*
  805. diff -cbr orig/ttyin.c new/ttyin.c
  806. *** orig/ttyin.c    Wed Aug 03 02:43:16 1994
  807. --- new/ttyin.c    Sat Sep 24 10:40:22 1994
  808. ***************
  809. *** 42,48 ****
  810.       public void
  811.   open_getchr()
  812.   {
  813. ! #if MSOFTC
  814.       extern int fd0;
  815.       /*
  816.        * Open a new handle to CON: in binary mode 
  817. --- 42,48 ----
  818.       public void
  819.   open_getchr()
  820.   {
  821. ! #if MSOFTC || OS2
  822.       extern int fd0;
  823.       /*
  824.        * Open a new handle to CON: in binary mode 
  825. ***************
  826. *** 85,90 ****
  827. --- 85,109 ----
  828.           if (c == '\003')
  829.               return (READ_INTR);
  830.   #else
  831. + #if OS2
  832. +           static int scan = -1;
  833. +         flush();
  834. +         if ( scan != -1 )
  835. +         {
  836. +             c = scan;
  837. +             scan = -1;
  838. +             result = 1;
  839. +         }
  840. +         else
  841. +         {
  842. +               while ( _read_kbd(0, 0, 0) != -1);
  843. +               if ( (c = _read_kbd(0, 1, 0)) == -1 )
  844. +                   return READ_INTR;
  845. +             if ( c == 0 && (scan = _read_kbd(0, 0, 0)) != -1 )
  846. +                   c = 0xE0;
  847. +             result = 1;
  848. +         }
  849. + #else
  850.           result = iread(tty, &c, sizeof(char));
  851.           if (result == READ_INTR)
  852.               return (READ_INTR);
  853. ***************
  854. *** 96,101 ****
  855. --- 115,121 ----
  856.                */
  857.               quit(1);
  858.           }
  859. + #endif
  860.   #endif
  861.           /*
  862.            * Various parts of the program cannot handle
  863.