home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / OS2 / gnuinfo.zip / patches.emx < prev    next >
Text File  |  1998-01-04  |  46KB  |  1,756 lines

  1. Only in new: FILE_ID.DIZ
  2. Only in new: README.EMX
  3. Only in new: patches.emx
  4. Only in new: config.h.emx
  5. Only in new: Makefile.emx
  6. Only in new/info: Makefile.emx
  7. Only in new/makeinfo: Makefile.emx
  8. Only in new/util: Makefile.emx
  9. Only in new/intl: gnuintl.def
  10. Only in new/intl: Makefile.emx
  11. Only in new/lib: Makefile.emx
  12. Only in new/lib: pc.c
  13. Only in new/lib: pc.h
  14. Only in new/lib: termcap.c
  15. Only in new/lib: termcap.h
  16. Only in new/lib: tparam.c
  17. diff -cbr orig/info/dir.c new/info/dir.c
  18. *** orig/info/dir.c    Sun Jul 27 23:09:20 1997
  19. --- new/info/dir.c    Mon Jan  5 04:53:53 1998
  20. ***************
  21. *** 40,70 ****
  22. --- 40,90 ----
  23.   
  24.   typedef struct
  25.   {
  26. + #ifdef __EMX__
  27. +   char *path;
  28. + #else
  29.     unsigned long device;
  30.     unsigned long inode;
  31. + #endif
  32.   } dir_file_list_entry_type;
  33.   
  34.   static int
  35.   new_dir_file_p (test)
  36. + #ifdef __EMX__
  37. +     char *test;
  38. + #else
  39.       struct stat *test;
  40. + #endif
  41.   {
  42.     static unsigned dir_file_list_len = 0;
  43.     static dir_file_list_entry_type *dir_file_list = NULL;
  44.     unsigned i;
  45. + #ifdef __EMX__
  46. +   char path[1024];
  47. +   _fullpath(path, test, sizeof(path));
  48. + #endif
  49.     
  50.     for (i = 0; i < dir_file_list_len; i++)
  51.       {
  52.         dir_file_list_entry_type entry;
  53.         entry = dir_file_list[i];
  54. + #ifdef __EMX__
  55. +       if (stricmp(path, entry.path) == 0)
  56. + #else
  57.         if (entry.device == test->st_dev && entry.inode == test->st_ino)
  58. + #endif
  59.           return 0;
  60.       }
  61.     
  62.     dir_file_list_len++;
  63.     dir_file_list = xrealloc (dir_file_list, 
  64.                           dir_file_list_len * sizeof (dir_file_list_entry_type));
  65. + #ifdef __EMX__
  66. +   dir_file_list[dir_file_list_len - 1].path = strdup(path);
  67. + #else
  68.     dir_file_list[dir_file_list_len - 1].device = test->st_dev;
  69.     dir_file_list[dir_file_list_len - 1].inode = test->st_ino;
  70. + #endif
  71.     return 1;
  72.   }
  73.   
  74. ***************
  75. *** 88,94 ****
  76. --- 108,118 ----
  77.   
  78.     /* Initialize the list we use to avoid reading the same dir file twice
  79.        with the dir file just found.  */
  80. + #ifdef __EMX__
  81. +   new_dir_file_p (dir_buffer->fullpath);
  82. + #else
  83.     new_dir_file_p (&dir_buffer->finfo);
  84. + #endif
  85.     
  86.     path_index = update_tags = 0;
  87.   
  88. ***************
  89. *** 132,138 ****
  90. --- 156,166 ----
  91.             statable = (stat (fullpath, &finfo) == 0);
  92.   
  93.             /* Only add this file if we have not seen it before.  */
  94. + #ifdef __EMX__
  95. +           if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (fullpath))
  96. + #else
  97.             if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo))
  98. + #endif
  99.               {
  100.                 long filesize;
  101.                 char *contents = filesys_read_info_file (fullpath, &filesize,
  102. diff -cbr orig/info/dribble.c new/info/dribble.c
  103. *** orig/info/dribble.c    Tue Jul 15 20:32:22 1997
  104. --- new/info/dribble.c    Sat Nov 15 12:43:34 1997
  105. ***************
  106. *** 37,43 ****
  107.     /* Perhaps close existing dribble file. */
  108.     close_dribble_file ();
  109.   
  110. !   info_dribble_file = fopen (name, "w");
  111.   
  112.   #if defined (HAVE_SETVBUF)
  113.     if (info_dribble_file)
  114. --- 37,43 ----
  115.     /* Perhaps close existing dribble file. */
  116.     close_dribble_file ();
  117.   
  118. !   info_dribble_file = fopen (name, "wb");
  119.   
  120.   #if defined (HAVE_SETVBUF)
  121.     if (info_dribble_file)
  122. diff -cbr orig/info/echo-area.c new/info/echo-area.c
  123. *** orig/info/echo-area.c    Thu Jul 24 23:13:44 1997
  124. --- new/info/echo-area.c    Sat Dec 27 22:15:54 1997
  125. ***************
  126. *** 1464,1470 ****
  127.   static void
  128.   pause_or_input ()
  129.   {
  130. ! #if defined (FD_SET)
  131.     struct timeval timer;
  132.     fd_set readfds;
  133.     int ready;
  134. --- 1464,1470 ----
  135.   static void
  136.   pause_or_input ()
  137.   {
  138. ! #if defined (FD_SET) && !defined(__EMX__)
  139.     struct timeval timer;
  140.     fd_set readfds;
  141.     int ready;
  142. diff -cbr orig/info/filesys.c new/info/filesys.c
  143. *** orig/info/filesys.c    Thu Jul 24 23:23:08 1997
  144. --- new/info/filesys.c    Sat Nov 15 18:49:12 1997
  145. ***************
  146. *** 24,31 ****
  147. --- 24,41 ----
  148.   #include "tilde.h"
  149.   #include "filesys.h"
  150.   
  151. + #ifdef __EMX__
  152. + #define COLONCHR ';'
  153. + #define COLONSTR ";"
  154. + #include <ctype.h>
  155. + #else
  156. + #define COLONCHR ':'
  157. + #define COLONSTR ":"
  158. + #endif
  159.   /* Local to this file. */
  160.   static char *info_file_in_path (), *lookup_info_filename ();
  161. + static char *info_check_file ();
  162.   static void remember_info_filename (), maybe_initialize_infopath ();
  163.   
  164.   typedef struct
  165. ***************
  166. *** 38,51 ****
  167.     "",
  168.     ".info",
  169.     "-info",
  170.     (char *)NULL
  171.   };
  172.   
  173.   static COMPRESSION_ALIST compress_suffixes[] = {
  174. !   { ".Z", "uncompress" },
  175.     { ".Y", "unyabba" },
  176. !   { ".z", "gunzip" },
  177. !   { ".gz", "gunzip" },
  178.     { (char *)NULL, (char *)NULL }
  179.   };
  180.   
  181. --- 48,62 ----
  182.     "",
  183.     ".info",
  184.     "-info",
  185. +   ".inf",
  186.     (char *)NULL
  187.   };
  188.   
  189.   static COMPRESSION_ALIST compress_suffixes[] = {
  190. !   { ".Z", "compress -d" },
  191.     { ".Y", "unyabba" },
  192. !   { ".z", "gzip -d" },
  193. !   { ".gz", "gzip -d" },
  194.     { (char *)NULL, (char *)NULL }
  195.   };
  196.   
  197. ***************
  198. *** 86,98 ****
  199.            various extensions to it.  I guess we have to stat this file
  200.            after all. */
  201.         if (initial_character == '/')
  202. !         temp = info_file_in_path (partial + 1, "/");
  203.         else if (initial_character == '~')
  204.           {
  205.             expansion = tilde_expand_word (partial);
  206.             if (*expansion == '/')
  207.               {
  208. !               temp = info_file_in_path (expansion + 1, "/");
  209.                 free (expansion);
  210.               }
  211.             else
  212. --- 97,113 ----
  213.            various extensions to it.  I guess we have to stat this file
  214.            after all. */
  215.         if (initial_character == '/')
  216. !     temp = info_check_file (partial);
  217. ! #ifdef __EMX__
  218. !       else if (isalpha(initial_character) && partial[1] == ':')
  219. !     temp = info_check_file (partial);
  220. ! #endif
  221.         else if (initial_character == '~')
  222.           {
  223.             expansion = tilde_expand_word (partial);
  224.             if (*expansion == '/')
  225.               {
  226. !           temp = info_check_file (expansion);
  227.                 free (expansion);
  228.               }
  229.             else
  230. ***************
  231. *** 116,122 ****
  232.   
  233.             strcat (local_temp_filename, "/");
  234.             strcat (local_temp_filename, partial);
  235. !           return (local_temp_filename);
  236.           }
  237.         else
  238.           temp = info_file_in_path (partial, infopath);
  239. --- 131,141 ----
  240.   
  241.             strcat (local_temp_filename, "/");
  242.             strcat (local_temp_filename, partial);
  243. !       temp = info_check_file (local_temp_filename);
  244. !       free (local_temp_filename);
  245. !       return (temp);
  246.           }
  247.         else
  248.           temp = info_file_in_path (partial, infopath);
  249. ***************
  250. *** 143,151 ****
  251.   info_file_in_path (filename, path)
  252.        char *filename, *path;
  253.   {
  254. !   struct stat finfo;
  255. !   char *temp_dirname;
  256. !   int statable, dirname_index;
  257.   
  258.     dirname_index = 0;
  259.   
  260. --- 162,169 ----
  261.   info_file_in_path (filename, path)
  262.        char *filename, *path;
  263.   {
  264. !   char *temp_dirname, *final_name;
  265. !   int dirname_index;
  266.   
  267.     dirname_index = 0;
  268.   
  269. ***************
  270. *** 170,179 ****
  271.           strcat (temp, "/");
  272.         strcat (temp, filename);
  273.   
  274. -       pre_suffix_length = strlen (temp);
  275.         free (temp_dirname);
  276.   
  277.         for (i = 0; info_suffixes[i]; i++)
  278.           {
  279.             strcpy (temp + pre_suffix_length, info_suffixes[i]);
  280. --- 188,219 ----
  281.           strcat (temp, "/");
  282.         strcat (temp, filename);
  283.   
  284.         free (temp_dirname);
  285.   
  286. +       final_name = info_check_file (temp);
  287. +       free (temp);
  288. +       if (final_name)
  289. +     return (final_name);
  290. +     }
  291. +   return ((char *)NULL);
  292. + }
  293. + /* check if the file exists, possibly trying the compressed file suffixes */
  294. + static char *
  295. + info_check_file (filename)
  296. +      char *filename;
  297. + {
  298. +   register int i, statable, pre_suffix_length;
  299. +   struct stat finfo;
  300. +   char *temp;
  301. +   temp = (char *)xmalloc (30 + strlen (filename));
  302. +   strcpy (temp, filename);
  303. +   pre_suffix_length = strlen (temp);
  304.         for (i = 0; info_suffixes[i]; i++)
  305.           {
  306.             strcpy (temp + pre_suffix_length, info_suffixes[i]);
  307. ***************
  308. *** 223,231 ****
  309.                   }
  310.               }
  311.           }
  312. !       free (temp);
  313. !     }
  314. !   return ((char *)NULL);
  315.   }
  316.   
  317.   /* Given a string containing units of information separated by colons,
  318. --- 263,269 ----
  319.                   }
  320.               }
  321.           }
  322. !   return ((char *) NULL);
  323.   }
  324.   
  325.   /* Given a string containing units of information separated by colons,
  326. ***************
  327. *** 242,248 ****
  328.     if ((i >= strlen (string)) || !string)
  329.       return ((char *) NULL);
  330.   
  331. !   while (string[i] && string[i] != ':')
  332.       i++;
  333.     if (i == start)
  334.       {
  335. --- 280,286 ----
  336.     if ((i >= strlen (string)) || !string)
  337.       return ((char *) NULL);
  338.   
  339. !   while (string[i] && string[i] != COLONCHR)
  340.       i++;
  341.     if (i == start)
  342.       {
  343. ***************
  344. *** 353,366 ****
  345.       strcpy (infopath, path);
  346.     else if (where == INFOPATH_APPEND)
  347.       {
  348. !       strcat (infopath, ":");
  349.         strcat (infopath, path);
  350.       }
  351.     else if (where == INFOPATH_PREPEND)
  352.       {
  353.         char *temp = xstrdup (infopath);
  354.         strcpy (infopath, path);
  355. !       strcat (infopath, ":");
  356.         strcat (infopath, temp);
  357.         free (temp);
  358.       }
  359. --- 391,404 ----
  360.       strcpy (infopath, path);
  361.     else if (where == INFOPATH_APPEND)
  362.       {
  363. !       strcat (infopath, COLONSTR);
  364.         strcat (infopath, path);
  365.       }
  366.     else if (where == INFOPATH_PREPEND)
  367.       {
  368.         char *temp = xstrdup (infopath);
  369.         strcpy (infopath, path);
  370. !       strcat (infopath, COLONSTR);
  371.         strcat (infopath, temp);
  372.         free (temp);
  373.       }
  374. ***************
  375. *** 387,393 ****
  376.        long *filesize;
  377.        struct stat *finfo;
  378.   {
  379. !   long st_size;
  380.   
  381.     *filesize = filesys_error_number = 0;
  382.   
  383. --- 425,431 ----
  384.        long *filesize;
  385.        struct stat *finfo;
  386.   {
  387. !   long st_size, result;
  388.   
  389.     *filesize = filesys_error_number = 0;
  390.   
  391. ***************
  392. *** 410,416 ****
  393.         /* Try to read the contents of this file. */
  394.         st_size = (long) finfo->st_size;
  395.         contents = (char *)xmalloc (1 + st_size);
  396. !       if ((read (descriptor, contents, st_size)) != st_size)
  397.           {
  398.             filesys_error_number = errno;
  399.             close (descriptor);
  400. --- 448,455 ----
  401.         /* Try to read the contents of this file. */
  402.         st_size = (long) finfo->st_size;
  403.         contents = (char *)xmalloc (1 + st_size);
  404. !       result = read (descriptor, contents, st_size);
  405. !       if (result == -1 || result > st_size)
  406.           {
  407.             filesys_error_number = errno;
  408.             close (descriptor);
  409. diff -cbr orig/info/info.c new/info/info.c
  410. *** orig/info/info.c    Wed Jul 30 17:21:44 1997
  411. --- new/info/info.c    Sat Nov 22 12:03:14 1997
  412. ***************
  413. *** 94,100 ****
  414.   };
  415.   
  416.   /* String describing the shorthand versions of the long options found above. */
  417. ! static char *short_options = "d:n:f:o:s";
  418.   
  419.   /* When non-zero, the Info window system has been initialized. */
  420.   int info_windows_initialized_p = 0;
  421. --- 94,100 ----
  422.   };
  423.   
  424.   /* String describing the shorthand versions of the long options found above. */
  425. ! static char *short_options = "d:n:f:o:sh?";
  426.   
  427.   /* When non-zero, the Info window system has been initialized. */
  428.   int info_windows_initialized_p = 0;
  429. ***************
  430. *** 118,123 ****
  431. --- 118,124 ----
  432.     NODE *initial_node;           /* First node loaded by Info. */
  433.   
  434.     remember_info_program_name (argv[0]);
  435. +   setvbuf(stdout, NULL, _IOFBF, BUFSIZ);
  436.   
  437.   #ifdef HAVE_SETLOCALE
  438.     /* Set locale via LC_ALL.  */
  439. ***************
  440. *** 168,173 ****
  441. --- 169,179 ----
  442.             user_filename = xstrdup (optarg);
  443.             break;
  444.   
  445. +       /* User is requesting help. */
  446. +     case 'h':
  447. +       print_help_p = 1;
  448. +       break;
  449.             /* User is specifying the name of a file to output to. */
  450.           case 'o':
  451.             if (user_output_filename)
  452. ***************
  453. *** 591,596 ****
  454. --- 597,604 ----
  455.   static void
  456.   usage ()
  457.   {
  458. +   fprintf (stderr,"\nGNU %s %s - info %s\n\n", 
  459. +            PACKAGE, VERSION, version_string ());
  460.     fprintf (stderr,"%s\n%s\n%s\n%s\n%s\n",
  461.   _("Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]..."),
  462.   _("            [--directory dir-path] [--file info-file] [--node node-name]..."),
  463. diff -cbr orig/info/info.h new/info/info.h
  464. *** orig/info/info.h    Tue Jul 15 20:34:24 1997
  465. --- new/info/info.h    Sat Nov 15 13:02:02 1997
  466. ***************
  467. *** 54,60 ****
  468.   #endif /* !whitespace */
  469.   
  470.   #if !defined (whitespace_or_newline)
  471. ! #  define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
  472.   #endif /* !whitespace_or_newline */
  473.   
  474.   /* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number
  475. --- 54,60 ----
  476.   #endif /* !whitespace */
  477.   
  478.   #if !defined (whitespace_or_newline)
  479. ! #  define whitespace_or_newline(c) (whitespace (c) || (c == '\n') || (c == '\r'))
  480.   #endif /* !whitespace_or_newline */
  481.   
  482.   /* Add POINTER to the list of pointers found in ARRAY.  SLOTS is the number
  483. diff -cbr orig/info/man.c new/info/man.c
  484. *** orig/info/man.c    Fri Aug  1 01:49:58 1997
  485. --- new/info/man.c    Sat Dec 27 22:16:20 1997
  486. ***************
  487. *** 28,33 ****
  488. --- 28,37 ----
  489.   #if defined (HAVE_SYS_WAIT_H)
  490.   #include <sys/wait.h>
  491.   #endif
  492. + #ifdef __EMX__
  493. + #include <process.h>
  494. + #include <sys/wait.h>
  495. + #endif
  496.   
  497.   #include "tilde.h"
  498.   #include "man.h"
  499. ***************
  500. *** 153,159 ****
  501. --- 157,173 ----
  502.   
  503.         free (temp_dirname);
  504.   
  505. + #ifdef __EMX__
  506. +       strcat (temp, ".cmd");
  507. +       statable = (stat (temp, &finfo) == 0);
  508. +       if (!statable)
  509. +       {
  510. +     strcpy(temp + strlen (temp) - 4, ".exe");
  511.         statable = (stat (temp, &finfo) == 0);
  512. +       }
  513. + #else
  514. +       statable = (stat (temp, &finfo) == 0);
  515. + #endif
  516.   
  517.         /* If we have found a regular executable file, then use it. */
  518.         if ((statable) && (S_ISREG (finfo.st_mode)) &&
  519. ***************
  520. *** 247,252 ****
  521. --- 261,298 ----
  522.        writer end is pipes[1]. */
  523.     pipe (pipes);
  524.   
  525. + #ifdef __EMX__
  526. +   {
  527. +     int pid, old_stdout, old_stderr;
  528. +     
  529. +     old_stdout = dup (fileno (stdout));
  530. +     fcntl (old_stdout, F_SETFD, FD_CLOEXEC);
  531. +     dup2 (pipes[1], fileno (stdout));
  532. +     old_stderr = dup (fileno (stderr));
  533. +     fcntl (old_stderr, F_SETFD, FD_CLOEXEC);
  534. +     close (fileno (stderr));
  535. +     
  536. +     close (pipes[1]);
  537. +     fcntl (pipes[0], F_SETFD, FD_CLOEXEC);
  538. +     pid = spawnv (P_NOWAIT, formatter_args[0], formatter_args);
  539. +     close (fileno (stdout));
  540. +     dup2 (old_stdout, fileno (stdout));
  541. +     close (old_stdout);
  542. +     dup2 (old_stderr, fileno (stderr));
  543. +     close (old_stderr);
  544. +     if (pid != -1)
  545. +       formatted_page = read_from_fd (pipes[0]);
  546. +     close (pipes[0]);
  547. +     waitpid (pid, NULL, WNOHANG);
  548. +   }
  549. + #else
  550.     signal (SIGCHLD, reap_children);
  551.   
  552.     child = fork ();
  553. ***************
  554. *** 278,283 ****
  555. --- 324,330 ----
  556.         close (pipes[1]);
  557.         exit (0);
  558.       }
  559. + #endif
  560.   
  561.     /* If we have the page, then clean it up. */
  562.     if (formatted_page)
  563. ***************
  564. *** 363,369 ****
  565.     int bsize = 0;
  566.     int bindex = 0;
  567.     int select_result;
  568. ! #if defined (FD_SET)
  569.     fd_set read_fds;
  570.   
  571.     timeout.tv_sec = 15;
  572. --- 410,416 ----
  573.     int bsize = 0;
  574.     int bindex = 0;
  575.     int select_result;
  576. ! #if defined (FD_SET) && !defined(__EMX__)
  577.     fd_set read_fds;
  578.   
  579.     timeout.tv_sec = 15;
  580. diff -cbr orig/info/session.c new/info/session.c
  581. *** orig/info/session.c    Thu Jul 24 23:34:00 1997
  582. --- new/info/session.c    Sat Dec 27 22:14:08 1997
  583. ***************
  584. *** 22,27 ****
  585. --- 22,31 ----
  586.   #include "info.h"
  587.   #include <sys/ioctl.h>
  588.   
  589. + #ifdef __EMX__
  590. + #  include <pc.h>
  591. + #endif
  592.   #if defined (HAVE_SYS_TIME_H)
  593.   #  include <sys/time.h>
  594.   #  define HAVE_STRUCT_TIMEVAL
  595. ***************
  596. *** 305,311 ****
  597.   {
  598.     FILE *stream;
  599.   
  600. !   stream = fopen (filename, "r");
  601.   
  602.     if (!stream)
  603.       return;
  604. --- 309,315 ----
  605.   {
  606.     FILE *stream;
  607.   
  608. !   stream = fopen (filename, "rb");
  609.   
  610.     if (!stream)
  611.       return;
  612. ***************
  613. *** 2476,2482 ****
  614.     if (strcmp (output_filename, "-") == 0)
  615.       output_stream = stdout;
  616.     else
  617. !     output_stream = fopen (output_filename, "w");
  618.   
  619.     if (!output_stream)
  620.       {
  621. --- 2480,2486 ----
  622.     if (strcmp (output_filename, "-") == 0)
  623.       output_stream = stdout;
  624.     else
  625. !     output_stream = fopen (output_filename, "wb");
  626.   
  627.     if (!output_stream)
  628.       {
  629. ***************
  630. *** 2601,2607 ****
  631.     if (strcmp (filename, "-") == 0)
  632.       output_stream = stdout;
  633.     else
  634. !     output_stream = fopen (filename, "w");
  635.   
  636.     if (!output_stream)
  637.       {
  638. --- 2605,2611 ----
  639.     if (strcmp (filename, "-") == 0)
  640.       output_stream = stdout;
  641.     else
  642. !     output_stream = fopen (filename, "wb");
  643.   
  644.     if (!output_stream)
  645.       {
  646. ***************
  647. *** 3823,3829 ****
  648.         if (!info_any_buffered_input_p () &&
  649.             !info_input_pending_p ())
  650.           {
  651. ! #if defined (FD_SET)
  652.             struct timeval timer;
  653.             fd_set readfds;
  654.   
  655. --- 3827,3833 ----
  656.         if (!info_any_buffered_input_p () &&
  657.             !info_input_pending_p ())
  658.           {
  659. ! #if defined (FD_SET) && !defined(__EMX__)
  660.             struct timeval timer;
  661.             fd_set readfds;
  662.   
  663. ***************
  664. *** 4147,4152 ****
  665. --- 4151,4160 ----
  666.   
  667.     space_avail = info_input_buffer_space_available ();
  668.   
  669. + #ifdef __EMX__
  670. +   while (chars_avail < space_avail && (tty = pc_getc(0)) != -1)
  671. +     input[chars_avail++] = tty;
  672. + #else
  673.     /* If we can just find out how many characters there are to read, do so. */
  674.   #if defined (FIONREAD)
  675.     {
  676. ***************
  677. *** 4174,4179 ****
  678. --- 4182,4188 ----
  679.     }
  680.   #  endif /* O_NDELAY */
  681.   #endif /* !FIONREAD */
  682. + #endif
  683.   
  684.     while (i < chars_avail)
  685.       {
  686. ***************
  687. *** 4201,4206 ****
  688. --- 4210,4218 ----
  689.         unsigned char c;
  690.         int tty = fileno (info_input_stream);
  691.   
  692. + #ifdef __EMX__
  693. +       keystroke = pc_getc(1);
  694. + #else
  695.         /* Using stream I/O causes FIONREAD etc to fail to work
  696.            so unless someone can find a portable way of finding
  697.            out how many characters are currently buffered, we
  698. ***************
  699. *** 4230,4235 ****
  700. --- 4242,4248 ----
  701.                 exit (0);
  702.               }
  703.           }
  704. + #endif
  705.       }
  706.   
  707.     if (info_dribble_file)
  708. diff -cbr orig/info/terminal.c new/info/terminal.c
  709. *** orig/info/terminal.c    Tue Jul 29 23:42:04 1997
  710. --- new/info/terminal.c    Mon Dec 29 08:30:34 1997
  711. ***************
  712. *** 118,124 ****
  713. --- 118,128 ----
  714.   output_character_function (c)
  715.        int c;
  716.   {
  717. + #ifdef __RSXNT__
  718. +   pc_putc (c);
  719. + #else
  720.     putc (c, stdout);
  721. + #endif
  722.     return c;
  723.   }
  724.   
  725. ***************
  726. *** 133,139 ****
  727. --- 137,145 ----
  728.   static void
  729.   terminal_begin_using_terminal ()
  730.   {
  731. + #ifdef SIGWINCH
  732.     RETSIGTYPE (*sigsave) ();
  733. + #endif
  734.   
  735.     if (term_keypad_on)
  736.         send_to_terminal (term_keypad_on);
  737. ***************
  738. *** 141,155 ****
  739. --- 147,167 ----
  740.     if (!term_begin_use || !*term_begin_use)
  741.       return;
  742.   
  743. + #ifdef SIGWINCH
  744.     sigsave = signal (SIGWINCH, SIG_IGN); 
  745. + #endif
  746.     send_to_terminal (term_begin_use);
  747.     /* Without this fflush and sleep, running info in a shelltool or
  748.        cmdtool (TERM=sun-cmd) with scrollbars loses -- the scrollbars are
  749.        not restored properly.
  750.        From: strube@physik3.gwdg.de (Hans Werner Strube).  */
  751.     fflush (stdout);
  752. + #ifndef __EMX__
  753.     sleep (1);
  754. + #endif
  755. + #ifdef SIGWINCH
  756.     signal (SIGWINCH, sigsave);
  757. + #endif
  758.   }
  759.   
  760.   /* Tell the terminal that we will not be doing any more cursor
  761. ***************
  762. *** 157,163 ****
  763. --- 169,177 ----
  764.   static void
  765.   terminal_end_using_terminal ()
  766.   {
  767. + #ifdef SIGWINCH
  768.     RETSIGTYPE (*sigsave) ();
  769. + #endif
  770.   
  771.     if (term_keypad_off)
  772.         send_to_terminal (term_keypad_off);
  773. ***************
  774. *** 165,175 ****
  775. --- 179,200 ----
  776.     if (!term_end_use || !*term_end_use)
  777.       return;
  778.   
  779. + #ifdef SIGWINCH
  780.     sigsave = signal (SIGWINCH, SIG_IGN);
  781. + #endif
  782. + #ifdef __EMX__
  783. +   terminal_goto_xy (0, screenheight - 2); /* cmd.exe writes extra newline */
  784. + #else
  785. +   terminal_goto_xy (0, screenheight - 1);
  786. + #endif
  787.     send_to_terminal (term_end_use);
  788.     fflush (stdout);
  789. + #ifndef __EMX__
  790.     sleep (1);
  791. + #endif
  792. + #ifdef SIGWINCH
  793.     signal (SIGWINCH, sigsave);
  794. + #endif
  795.   }
  796.   
  797.   /* **************************************************************** */
  798. ***************
  799. *** 449,454 ****
  800. --- 474,487 ----
  801.       {
  802.         screenwidth = screenheight = 0;
  803.   
  804. + #ifdef __EMX__
  805. +       {
  806. +     int size[2];
  807. +     _scrsize(size);
  808. +     screenwidth  = size[0];
  809. +     screenheight = size[1];
  810. +       }
  811. + #else
  812.   #if defined (TIOCGWINSZ)
  813.         {
  814.           struct winsize window_size;
  815. ***************
  816. *** 460,465 ****
  817. --- 493,499 ----
  818.             }
  819.         }
  820.   #endif                          /* TIOCGWINSZ */
  821. + #endif
  822.   
  823.         /* Environment variable COLUMNS overrides setting of "co". */
  824.         if (screenwidth <= 0)
  825. ***************
  826. *** 669,674 ****
  827. --- 703,712 ----
  828.   
  829.     tty = fileno (stdin);
  830.   
  831. + #ifdef __EMX__
  832. +   pc_init ();
  833. + #else
  834.   #if defined (HAVE_TERMIOS_H)
  835.     tcgetattr (tty, &original_termios);
  836.     tcgetattr (tty, &ttybuff);
  837. ***************
  838. *** 779,784 ****
  839. --- 817,823 ----
  840.     ttybuff.sg_flags |= CBREAK;
  841.     ioctl (tty, TIOCSETN, &ttybuff);
  842.   #endif /* !HAVE_TERMIOS_H && !HAVE_TERMIO_H */
  843. + #endif /* !__EMX__ */
  844.   }
  845.   
  846.   /* Restore the tty settings back to what they were before we started using
  847. ***************
  848. *** 796,801 ****
  849. --- 835,844 ----
  850.   
  851.     tty = fileno (stdin);
  852.   
  853. + #ifdef __EMX__
  854. +   pc_exit ();
  855. + #else
  856.   #if defined (HAVE_TERMIOS_H)
  857.     tcsetattr (tty, TCSANOW, &original_termios);
  858.   #else
  859. ***************
  860. *** 820,825 ****
  861. --- 863,869 ----
  862.   
  863.   #  endif /* !HAVE_TERMIO_H */
  864.   #endif /* !HAVE_TERMIOS_H */
  865. + #endif /* !__EMX__ */
  866.     terminal_end_using_terminal ();
  867.   }
  868.   
  869. diff -cbr orig/intl/bindtextdom.c new/intl/bindtextdom.c
  870. *** orig/intl/bindtextdom.c    Sat Jun 14 23:12:00 1997
  871. --- new/intl/bindtextdom.c    Sat Nov 15 12:41:50 1997
  872. ***************
  873. *** 49,55 ****
  874.   /* @@ end of prolog @@ */
  875.   
  876.   /* Contains the default location of the message catalogs.  */
  877. ! extern const char _nl_default_dirname[];
  878.   
  879.   /* List with bindings of specific domains.  */
  880.   extern struct binding *_nl_domain_bindings;
  881. --- 49,55 ----
  882.   /* @@ end of prolog @@ */
  883.   
  884.   /* Contains the default location of the message catalogs.  */
  885. ! extern const char *_nl_default_dirname;
  886.   
  887.   /* List with bindings of specific domains.  */
  888.   extern struct binding *_nl_domain_bindings;
  889. ***************
  890. *** 73,78 ****
  891. --- 73,81 ----
  892.        const char *dirname;
  893.   {
  894.     struct binding *binding;
  895. +   if (_nl_default_dirname == NULL)
  896. +     _nl_default_dirname = GNULOCALEDIR;
  897.   
  898.     /* Some sanity checks.  */
  899.     if (domainname == NULL || domainname[0] == '\0')
  900. diff -cbr orig/intl/dcgettext.c new/intl/dcgettext.c
  901. *** orig/intl/dcgettext.c    Sat Jun 14 23:12:00 1997
  902. --- new/intl/dcgettext.c    Sat Nov 15 12:57:04 1997
  903. ***************
  904. *** 151,157 ****
  905.   const char *_nl_current_default_domain = _nl_default_default_domain;
  906.   
  907.   /* Contains the default location of the message catalogs.  */
  908. ! const char _nl_default_dirname[] = GNULOCALEDIR;
  909.   
  910.   /* List with bindings of specific domains created by bindtextdomain()
  911.      calls.  */
  912. --- 151,157 ----
  913.   const char *_nl_current_default_domain = _nl_default_default_domain;
  914.   
  915.   /* Contains the default location of the message catalogs.  */
  916. ! const char *_nl_default_dirname = NULL;
  917.   
  918.   /* List with bindings of specific domains created by bindtextdomain()
  919.      calls.  */
  920. ***************
  921. *** 235,240 ****
  922. --- 235,243 ----
  923.     if (msgid == NULL)
  924.       return NULL;
  925.   
  926. +   if (_nl_default_dirname == NULL)
  927. +     _nl_default_dirname = GNULOCALEDIR;
  928.     /* If DOMAINNAME is NULL, we are interested in the default domain.  If
  929.        CATEGORY is not LC_MESSAGES this might not make much sense but the
  930.        defintion left this undefined.  */
  931. ***************
  932. *** 258,264 ****
  933. --- 261,274 ----
  934.   
  935.     if (binding == NULL)
  936.       dirname = (char *) _nl_default_dirname;
  937. + #ifdef __EMX__
  938. + #define getcwd _getcwd2
  939. +   /* we have to deal with drive letters here and with getcwd below */
  940. +   else if (binding->dirname[0] == '/' || 
  941. +        isalpha(binding->dirname[0]) && binding->dirname[1] == ':')
  942. + #else
  943.     else if (binding->dirname[0] == '/')
  944. + #endif
  945.       dirname = binding->dirname;
  946.     else
  947.       {
  948. diff -cbr orig/intl/gettext.h new/intl/gettext.h
  949. *** orig/intl/gettext.h    Sat Jun 14 23:12:00 1997
  950. --- new/intl/gettext.h    Sat Nov 15 12:57:04 1997
  951. ***************
  952. *** 25,30 ****
  953. --- 25,36 ----
  954.   # include <limits.h>
  955.   #endif
  956.   
  957. + #ifdef __EMX__
  958. + #define PATH_SEPARATOR ';'
  959. + #else
  960. + #define PATH_SEPARATOR ':'
  961. + #endif
  962.   /* @@ end of prolog @@ */
  963.   
  964.   /* The magic number of the GNU message catalog format.  */
  965. diff -cbr orig/intl/libgettext.h new/intl/libgettext.h
  966. *** orig/intl/libgettext.h    Sat Jun 14 23:12:00 1997
  967. --- new/intl/libgettext.h    Fri Dec 26 19:28:24 1997
  968. ***************
  969. *** 36,41 ****
  970. --- 36,49 ----
  971.   # include <locale.h>
  972.   #endif
  973.   
  974. + #ifdef __EMX__
  975. + #define CheckEnv(e, d) ({char *v = getenv(e); v ? v : (d);})
  976. + #define StrCat(s1, s2) ({int l = strlen(s1) + strlen(s2);  \
  977. +   char *r = malloc(l); strcpy(r, s1); strcat(r, s2); r;})
  978. + #define GNULOCALEDIR CheckEnv("GNULOCALEDIR","/lib/glocale")
  979. + #define LOCALE_ALIAS_PATH StrCat(GNULOCALEDIR, ";.")
  980. + #define LOCALEDIR CheckEnv("LOCALEDIR","/lib/locale")
  981. + #endif
  982.   
  983.   #ifdef __cplusplus
  984.   extern "C" {
  985. diff -cbr orig/intl/loadmsgcat.c new/intl/loadmsgcat.c
  986. *** orig/intl/loadmsgcat.c    Sat Jun 14 23:12:02 1997
  987. --- new/intl/loadmsgcat.c    Sat Nov 15 18:58:00 1997
  988. ***************
  989. *** 38,43 ****
  990. --- 38,47 ----
  991.   #include "gettext.h"
  992.   #include "gettextP.h"
  993.   
  994. + #ifndef O_BINARY
  995. + #define O_BINARY 0
  996. + #endif
  997.   /* @@ end of prolog @@ */
  998.   
  999.   #ifdef _LIBC
  1000. ***************
  1001. *** 58,63 ****
  1002. --- 62,92 ----
  1003.   int _nl_msg_cat_cntr;
  1004.   
  1005.   
  1006. + #ifdef __EMX__
  1007. + #include <string.h>
  1008. + /* quick hack to at least translate german umlauts from Latin-1 to
  1009. +    Codepage 850/437 - needs to be extended to other NLS characters */
  1010. + static char *cp850  = "\x84\x94\x81\x8E\x99\x9A\xE1\xAE\xAF";
  1011. + static char *latin1 = "\xE4\xF6\xFC\xC4\xD6\xDC\xDF\xAB\xBB";
  1012. + static void recode_msg (char *msg)
  1013. + {
  1014. +   char *ptr = msg;
  1015. +   int len = strlen (msg), pos;
  1016. +   while ((pos = strcspn(ptr, latin1)) < len)
  1017. +   {
  1018. +     ptr[pos] = cp850[strchr(latin1, ptr[pos]) - latin1];
  1019. +     ptr += pos + 1;
  1020. +     len -= pos + 1;
  1021. +   }
  1022. + }
  1023. + #endif
  1024.   /* Load the message catalogs specified by FILENAME.  If it is no valid
  1025.      message catalog do nothing.  */
  1026.   void
  1027. ***************
  1028. *** 84,90 ****
  1029.       return;
  1030.   
  1031.     /* Try to open the addressed file.  */
  1032. !   fd = open (domain_file->filename, O_RDONLY);
  1033.     if (fd == -1)
  1034.       return;
  1035.   
  1036. --- 113,119 ----
  1037.       return;
  1038.   
  1039.     /* Try to open the addressed file.  */
  1040. !   fd = open (domain_file->filename, O_RDONLY | O_BINARY);
  1041.     if (fd == -1)
  1042.       return;
  1043.   
  1044. ***************
  1045. *** 192,197 ****
  1046. --- 221,235 ----
  1047.         domain_file->data = NULL;
  1048.         return;
  1049.       }
  1050. + #ifdef __EMX__
  1051. +   {
  1052. +     int i;
  1053. +     for (i = 0; i < domain->nstrings; i++)
  1054. +       recode_msg ((char *) domain->data + W (domain->must_swap,
  1055. +                          domain->trans_tab[i].offset));
  1056. +   }
  1057. + #endif
  1058.   
  1059.     /* Show that one domain is changed.  This might make some cached
  1060.        translations invalid.  */
  1061. diff -cbr orig/intl/localealias.c new/intl/localealias.c
  1062. *** orig/intl/localealias.c    Sat Jun 14 23:12:02 1997
  1063. --- new/intl/localealias.c    Sat Nov 15 12:41:54 1997
  1064. ***************
  1065. *** 67,72 ****
  1066. --- 67,77 ----
  1067.   # endif
  1068.   #endif
  1069.   
  1070. + #ifdef _LIBC
  1071. + # include <libintl.h>
  1072. + #else
  1073. + # include "libgettext.h"
  1074. + #endif
  1075.   #include "gettext.h"
  1076.   #include "gettextP.h"
  1077.   
  1078. ***************
  1079. *** 139,148 ****
  1080.   _nl_expand_alias (name)
  1081.       const char *name;
  1082.   {
  1083. !   static const char *locale_alias_path = LOCALE_ALIAS_PATH;
  1084.     struct alias_map *retval;
  1085.     size_t added;
  1086.   
  1087.     do
  1088.       {
  1089.         struct alias_map item;
  1090. --- 144,156 ----
  1091.   _nl_expand_alias (name)
  1092.       const char *name;
  1093.   {
  1094. !   static const char *locale_alias_path = NULL;
  1095.     struct alias_map *retval;
  1096.     size_t added;
  1097.   
  1098. +   if (locale_alias_path == NULL)
  1099. +     locale_alias_path = LOCALE_ALIAS_PATH;
  1100.     do
  1101.       {
  1102.         struct alias_map item;
  1103. ***************
  1104. *** 168,178 ****
  1105.       {
  1106.         const char *start;
  1107.   
  1108. !       while (locale_alias_path[0] == ':')
  1109.           ++locale_alias_path;
  1110.         start = locale_alias_path;
  1111.   
  1112. !       while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
  1113.           ++locale_alias_path;
  1114.   
  1115.         if (start < locale_alias_path)
  1116. --- 176,186 ----
  1117.       {
  1118.         const char *start;
  1119.   
  1120. !       while (locale_alias_path[0] == PATH_SEPARATOR)
  1121.           ++locale_alias_path;
  1122.         start = locale_alias_path;
  1123.   
  1124. !       while (locale_alias_path[0] != '\0' && locale_alias_path[0] != PATH_SEPARATOR)
  1125.           ++locale_alias_path;
  1126.   
  1127.         if (start < locale_alias_path)
  1128. diff -cbr orig/lib/system.h new/lib/system.h
  1129. *** orig/lib/system.h    Thu Jul 31 22:34:36 1997
  1130. --- new/lib/system.h    Sat Nov 15 17:29:28 1997
  1131. ***************
  1132. *** 37,43 ****
  1133.   #ifdef HAVE_LOCALE_H
  1134.   #include <locale.h>
  1135.   #endif
  1136. ! #include <libintl.h>
  1137.   
  1138.   /* Don't use bcopy!  Use memmove if source and destination may overlap,
  1139.      memcpy otherwise.  */
  1140. --- 37,43 ----
  1141.   #ifdef HAVE_LOCALE_H
  1142.   #include <locale.h>
  1143.   #endif
  1144. ! #include <libgettext.h>
  1145.   
  1146.   /* Don't use bcopy!  Use memmove if source and destination may overlap,
  1147.      memcpy otherwise.  */
  1148. diff -cbr orig/lib/xmalloc.c new/lib/xmalloc.c
  1149. *** orig/lib/xmalloc.c    Mon Jun 19 22:06:30 1995
  1150. --- new/lib/xmalloc.c    Sat Dec 27 00:41:40 1997
  1151. ***************
  1152. *** 25,30 ****
  1153. --- 25,34 ----
  1154.   
  1155.      Written by Brian Fox (bfox@ai.mit.edu). */
  1156.   
  1157. + #ifdef HAVE_CONFIG_H
  1158. + #include <config.h>
  1159. + #endif
  1160.   #if !defined (ALREADY_HAVE_XMALLOC)
  1161.   #include <stdio.h>
  1162.   #include <sys/types.h>
  1163. diff -cbr orig/makeinfo/makeinfo.c new/makeinfo/makeinfo.c
  1164. *** orig/makeinfo/makeinfo.c    Thu Jul 31 23:36:28 1997
  1165. --- new/makeinfo/makeinfo.c    Sat Nov 15 12:55:16 1997
  1166. ***************
  1167. *** 49,54 ****
  1168. --- 49,60 ----
  1169.   # endif
  1170.   #endif
  1171.   
  1172. + #ifdef __EMX__
  1173. + #include <stdlib.h>
  1174. + #include <assert.h>
  1175. + #include <io.h>
  1176. + #endif
  1177.   /* We'd like to take advantage of _doprnt if it's around, a la error.c,
  1178.      but then we'd have no VA_SPRINTF.  */
  1179.   #if HAVE_VPRINTF
  1180. ***************
  1181. *** 226,231 ****
  1182. --- 232,240 ----
  1183.      specified marker. */
  1184.   int number_footnotes = 1;
  1185.   
  1186. + /* Non-zero indicates that a FAT compatible output name should be created. */
  1187. + int fat_name = 0;
  1188.   /* The current footnote number in this node.  Each time a new node is
  1189.      started this is reset to 1. */
  1190.   int current_footnote_number = 1;
  1191. ***************
  1192. *** 792,797 ****
  1193. --- 801,807 ----
  1194.     { "paragraph-indent", 1, 0, 'p' },            /* formerly -pi */
  1195.     { "reference-limit", 1, 0, 'r' },             /* formerly -rl */
  1196.     { "verbose", 0, &verbose_mode, 1 },           /* formerly -verbose */
  1197. +   { "fat-name", 0, &fat_name, 1 },
  1198.     { "help", 0, 0, 'h' },
  1199.     { "version", 0, 0, 'V' },
  1200.     {NULL, 0, NULL, 0}
  1201. ***************
  1202. *** 948,953 ****
  1203. --- 958,970 ----
  1204.     bindtextdomain (PACKAGE, LOCALEDIR);
  1205.     textdomain (PACKAGE);
  1206.   
  1207. + #ifdef __EMX__
  1208. +   _response (&argc, &argv);
  1209. +   _wildcard (&argc, &argv);
  1210. +   if (argc == 1 && isatty (0))
  1211. +     usage (NO_ERROR);
  1212. + #endif
  1213. +   
  1214.     /* Parse argument flags from the input line. */
  1215.     while ((c = getopt_long (argc, argv, "D:e:E:f:I:o:p:P:r:s:U:V",
  1216.                              long_options, &ind)) != EOF)
  1217. ***************
  1218. *** 970,976 ****
  1219.                 fprintf (stderr,
  1220.                         _("%s: %s arg must be numeric, not `%s'.\n"),
  1221.                         "--error-limit", progname, optarg);
  1222. !               usage (stderr, FATAL);
  1223.               }
  1224.             break;
  1225.   
  1226. --- 987,993 ----
  1227.                 fprintf (stderr,
  1228.                         _("%s: %s arg must be numeric, not `%s'.\n"),
  1229.                         "--error-limit", progname, optarg);
  1230. !               usage (FATAL);
  1231.               }
  1232.             break;
  1233.   
  1234. ***************
  1235. *** 1157,1162 ****
  1236. --- 1174,1182 ----
  1237.     if (exit_value != 0)
  1238.       fprintf (stderr, _("Try `%s --help' for more information.\n"), progname);
  1239.     else
  1240. +   {
  1241. +     printf ("\nGNU %s %s - makeinfo %d.%d\n\n", 
  1242. +         PACKAGE, VERSION, major_version, minor_version);
  1243.       printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n\
  1244.   \n\
  1245.   Translate Texinfo source documentation to a format suitable for reading\n\
  1246. ***************
  1247. *** 1192,1197 ****
  1248. --- 1212,1218 ----
  1249.   "),
  1250.              progname, paragraph_start_indent,
  1251.              fill_column, max_error_level, reference_warning_limit);
  1252. +   }
  1253.     exit (exit_value);
  1254.   }
  1255.   
  1256. ***************
  1257. *** 1231,1237 ****
  1258.   {
  1259.     struct stat fileinfo;
  1260.     long file_size;
  1261. !   int file = -1, count = 0;
  1262.     char *fullpath, *result, *get_file_info_in_path ();
  1263.   
  1264.     result = fullpath = (char *)NULL;
  1265. --- 1252,1258 ----
  1266.   {
  1267.     struct stat fileinfo;
  1268.     long file_size;
  1269. !   int file = -1, count = 0, bytes_read;
  1270.     char *fullpath, *result, *get_file_info_in_path ();
  1271.   
  1272.     result = fullpath = (char *)NULL;
  1273. ***************
  1274. *** 1244,1250 ****
  1275.     filename = fullpath;
  1276.     file_size = (long) fileinfo.st_size;
  1277.   
  1278. !   file = open (filename, O_RDONLY);
  1279.     if (file < 0)
  1280.       goto error_exit;
  1281.   
  1282. --- 1265,1271 ----
  1283.     filename = fullpath;
  1284.     file_size = (long) fileinfo.st_size;
  1285.   
  1286. !   file = open (filename, O_RDONLY|O_TEXT);
  1287.     if (file < 0)
  1288.       goto error_exit;
  1289.   
  1290. ***************
  1291. *** 1264,1271 ****
  1292.       count += n;
  1293.     if (n == -1)
  1294.   #else /* !VMS && !WIN32 */
  1295. !     count = file_size;
  1296. !     if (read (file, result, file_size) != file_size)
  1297.   #endif /* !VMS && !WIN32 */
  1298.     error_exit:
  1299.       {
  1300. --- 1285,1296 ----
  1301.       count += n;
  1302.     if (n == -1)
  1303.   #else /* !VMS && !WIN32 */
  1304. !     count = read (file, result, file_size);
  1305. ! #ifdef __EMX__
  1306. !     if (count <= 0 || count > file_size)
  1307. ! #else
  1308. !     if (count != file_size)
  1309. ! #endif
  1310.   #endif /* !VMS && !WIN32 */
  1311.     error_exit:
  1312.       {
  1313. ***************
  1314. *** 1575,1580 ****
  1315. --- 1600,1608 ----
  1316.           }
  1317.         else
  1318.           {
  1319. + #ifdef __EMX__
  1320. +       return (strdup (filename));
  1321. + #else
  1322.             struct passwd *user_entry;
  1323.             int i, c;
  1324.             char *username = (char *)xmalloc (257);
  1325. ***************
  1326. *** 1598,1603 ****
  1327. --- 1626,1632 ----
  1328.                                       + strlen (&filename[i]));
  1329.             strcpy (result, user_entry->pw_dir);
  1330.             strcat (result, &filename[i]);
  1331. + #endif
  1332.           }
  1333.       }
  1334.   #endif /* not WIN32 */
  1335. ***************
  1336. *** 1922,1927 ****
  1337. --- 1951,1958 ----
  1338.     ".texinfo",
  1339.     ".texi",
  1340.     ".txinfo",
  1341. +   ".txi",
  1342. +   ".tex",
  1343.     "",
  1344.     (char *)NULL
  1345.   };
  1346. ***************
  1347. *** 2134,2140 ****
  1348.         else
  1349.           real_output_filename = xstrdup (real_output_filename);
  1350.   
  1351. !       output_stream = fopen (real_output_filename, "w");
  1352.       }
  1353.   
  1354.     if (output_stream != stdout)
  1355. --- 2165,2171 ----
  1356.         else
  1357.           real_output_filename = xstrdup (real_output_filename);
  1358.   
  1359. !       output_stream = fopen (real_output_filename, "wb");
  1360.       }
  1361.   
  1362.     if (output_stream != stdout)
  1363. ***************
  1364. *** 2279,2284 ****
  1365. --- 2310,2316 ----
  1366.   void
  1367.   reader_loop ()
  1368.   {
  1369. +   extern int executing_string;
  1370.     int character;
  1371.     int done = 0;
  1372.     int dash_count = 0;
  1373. ***************
  1374. *** 3095,3100 ****
  1375. --- 3127,3133 ----
  1376.   {
  1377.     last_inserted_character = '\n';
  1378.     last_char_was_newline = 1;
  1379. +   last_inserted_character = 0;
  1380.   }
  1381.   
  1382.   /* Align the end of the text in output_paragraph with fill_column. */
  1383. ***************
  1384. *** 5388,5397 ****
  1385.                       (10 + strlen (root_pathname) + strlen (root_filename));
  1386.                     sprintf
  1387.                       (split_filename,
  1388.                        "%s%s-%d", root_pathname, root_filename, which_file);
  1389.   
  1390. !                   fd = open
  1391. !                     (split_filename, O_WRONLY | O_TRUNC | O_CREAT, 0666);
  1392.   
  1393.                     if ((fd < 0) ||
  1394.                         (write (fd, the_header, header_size) != header_size) ||
  1395. --- 5421,5435 ----
  1396.                       (10 + strlen (root_pathname) + strlen (root_filename));
  1397.                     sprintf
  1398.                       (split_filename,
  1399. + #ifdef __EMX__
  1400. +              fat_name ? "%s%s.i%.2d" : "%s%s-%d", 
  1401. +              root_pathname, root_filename, which_file);
  1402. + #else
  1403.                        "%s%s-%d", root_pathname, root_filename, which_file);
  1404. + #endif
  1405.   
  1406. !           fd = open (split_filename, 
  1407. !                  O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666);
  1408.   
  1409.                     if ((fd < 0) ||
  1410.                         (write (fd, the_header, header_size) != header_size) ||
  1411. ***************
  1412. *** 5412,5418 ****
  1413. --- 5450,5461 ----
  1414.                         indirect_info += strlen (indirect_info);
  1415.                       }
  1416.   
  1417. + #ifdef __EMX__
  1418. +           sprintf (indirect_info, 
  1419. +                fat_name ? "%s.i%.2d: %ld\n" : "%s-%d: %ld\n",
  1420. + #else
  1421.                     sprintf (indirect_info, "%s-%d: %d\n",
  1422. + #endif
  1423.                              root_filename, which_file, file_top);
  1424.   
  1425.                     free (split_filename);
  1426. ***************
  1427. *** 5427,5433 ****
  1428.       /* We have sucessfully created the subfiles.  Now write out the
  1429.          original again.  We must use `output_stream', or
  1430.          write_tag_table_indirect () won't know where to place the output. */
  1431. !     output_stream = fopen (filename, "w");
  1432.       if (!output_stream)
  1433.         {
  1434.           perror (filename);
  1435. --- 5470,5476 ----
  1436.       /* We have sucessfully created the subfiles.  Now write out the
  1437.          original again.  We must use `output_stream', or
  1438.          write_tag_table_indirect () won't know where to place the output. */
  1439. !     output_stream = fopen (filename, "wb");
  1440.       if (!output_stream)
  1441.         {
  1442.           perror (filename);
  1443. diff -cbr orig/util/deref.c new/util/deref.c
  1444. *** orig/util/deref.c    Thu Nov 19 03:15:06 1992
  1445. --- new/util/deref.c    Sat Dec 27 00:39:08 1997
  1446. ***************
  1447. *** 48,53 ****
  1448. --- 48,55 ----
  1449.    *    Use of fgets for input (to be fixed).
  1450.    */
  1451.   
  1452. + #include <config.h>
  1453.   #include <stdio.h>
  1454.   #include <ctype.h>
  1455.   #include <errno.h>
  1456. diff -cbr orig/util/install-info.c new/util/install-info.c
  1457. *** orig/util/install-info.c    Fri Jul 25 20:09:04 1997
  1458. --- new/util/install-info.c    Sat Nov 15 12:47:58 1997
  1459. ***************
  1460. *** 283,288 ****
  1461. --- 283,289 ----
  1462.   void
  1463.   print_help ()
  1464.   {
  1465. +   printf ("\nGNU %s %s - install-info\n\nUsage: ", PACKAGE, VERSION);
  1466.     printf (_("%s [OPTION]... [INFO-FILE [DIR-FILE]]\n\
  1467.     Install INFO-FILE in the Info directory file DIR-FILE.\n\
  1468.   \n\
  1469. ***************
  1470. *** 423,428 ****
  1471. --- 424,435 ----
  1472.     int i;
  1473.   
  1474.     progname = argv[0];
  1475. +   if (argc == 1)
  1476. +   {
  1477. +     print_help ();
  1478. +     exit (0);
  1479. +   }
  1480.   
  1481.   #ifdef HAVE_SETLOCALE
  1482.     /* Set locale via LC_ALL.  */
  1483. diff -cbr orig/util/texindex.c new/util/texindex.c
  1484. *** orig/util/texindex.c    Fri Jul 25 01:34:46 1997
  1485. --- new/util/texindex.c    Fri Dec 26 19:51:30 1997
  1486. ***************
  1487. *** 34,39 ****
  1488. --- 34,46 ----
  1489.   #define memset(ptr, ignore, count) bzero (ptr, count)
  1490.   #endif
  1491.   
  1492. +    /* OS/2 port (c) 1991 Kai Uwe Rommel,
  1493. +    rommel@leo.org
  1494. +    This port is also distributed under the terms of the
  1495. +    GNU General Public License as published by the
  1496. +    Free Software Foundation. */
  1497.   
  1498.   char *mktemp ();
  1499.   
  1500. ***************
  1501. *** 59,64 ****
  1502. --- 66,80 ----
  1503.   #  define TI_FATAL_ERROR 1
  1504.   #endif /* !VMS */
  1505.   
  1506. + #ifdef __EMX__
  1507. + #include <stdarg.h>
  1508. + #include <stdlib.h>
  1509. + #include <assert.h>
  1510. + #include <io.h>
  1511. + #include <sys/types.h>
  1512. + #include <fcntl.h>
  1513. + #endif
  1514.   #if !defined (SEEK_SET)
  1515.   #  define SEEK_SET 0
  1516.   #  define SEEK_CUR 1
  1517. ***************
  1518. *** 174,179 ****
  1519. --- 190,200 ----
  1520.   {
  1521.     int i;
  1522.   
  1523. + #ifdef __EMX__
  1524. +   _response(&argc, &argv);
  1525. +   _wildcard(&argc, &argv);
  1526. + #endif
  1527. +   
  1528.     tempcount = 0;
  1529.     last_deleted_tempcount = 0;
  1530.   
  1531. ***************
  1532. *** 213,219 ****
  1533. --- 234,244 ----
  1534.   
  1535.     decode_command (argc, argv);
  1536.   
  1537. + #ifdef __EMX__
  1538. +   tempbase = mktemp (concat ("tiXXXXXX", "", ""));
  1539. + #else
  1540.     tempbase = mktemp (concat ("txiXXXXXX", "", ""));
  1541. + #endif
  1542.   
  1543.     /* Process input files completely, one by one.  */
  1544.   
  1545. ***************
  1546. *** 223,229 ****
  1547.         long ptr;
  1548.         char *outfile;
  1549.   
  1550. !       desc = open (infiles[i], O_RDONLY, 0);
  1551.         if (desc < 0)
  1552.           pfatal_with_name (infiles[i]);
  1553.         lseek (desc, (off_t) 0, SEEK_END);
  1554. --- 248,254 ----
  1555.         long ptr;
  1556.         char *outfile;
  1557.   
  1558. !       desc = open (infiles[i], O_RDONLY|O_TEXT, 0);
  1559.         if (desc < 0)
  1560.           pfatal_with_name (infiles[i]);
  1561.         lseek (desc, (off_t) 0, SEEK_END);
  1562. ***************
  1563. *** 279,284 ****
  1564. --- 304,310 ----
  1565.     register int i;
  1566.     FILE *f = result_value ? stderr : stdout;
  1567.   
  1568. +   fprintf (f, "\nGNU %s %s - texindex 2.1\n\n", PACKAGE, VERSION);
  1569.     fprintf (f, _("Usage: %s [OPTION]... FILE...\n"), program_name);
  1570.     fprintf (f, _("Generate a sorted index for each TeX output FILE.\n"));
  1571.     /* Avoid trigraph nonsense.  */
  1572. ***************
  1573. *** 321,331 ****
  1574. --- 347,366 ----
  1575.     if (tempdir == NULL)
  1576.       tempdir = "sys$scratch:";
  1577.   #else
  1578. + #ifdef __EMX__
  1579. +   if (tempdir == NULL)
  1580. +     tempdir = getenv("TMP");
  1581. +   if ( !tempdir )
  1582. +     tempdir = "/";
  1583. +   else
  1584. +     tempdir = concat (tempdir, "/", "");
  1585. + #else
  1586.     if (tempdir == NULL)
  1587.       tempdir = "/tmp/";
  1588.     else
  1589.       tempdir = concat (tempdir, "/", "");
  1590.   #endif
  1591. + #endif
  1592.   
  1593.     keep_tempfiles = 0;
  1594.   
  1595. ***************
  1596. *** 900,915 ****
  1597.   /* Sort an input file too big to sort in core.  */
  1598.   
  1599.   void
  1600. ! sort_offline (infile, nfiles, total, outfile)
  1601.        char *infile;
  1602. -      int nfiles;
  1603.        long total;
  1604.        char *outfile;
  1605.   {
  1606.     /* More than enough. */
  1607.     int ntemps = 2 * (total + MAX_IN_CORE_SORT - 1) / MAX_IN_CORE_SORT;
  1608.     char **tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
  1609. !   FILE *istream = fopen (infile, "r");
  1610.     int i;
  1611.     struct linebuffer lb;
  1612.     long linelength;
  1613. --- 935,949 ----
  1614.   /* Sort an input file too big to sort in core.  */
  1615.   
  1616.   void
  1617. ! sort_offline (infile, total, outfile)
  1618.        char *infile;
  1619.        long total;
  1620.        char *outfile;
  1621.   {
  1622.     /* More than enough. */
  1623.     int ntemps = 2 * (total + MAX_IN_CORE_SORT - 1) / MAX_IN_CORE_SORT;
  1624.     char **tempfiles = (char **) xmalloc (ntemps * sizeof (char *));
  1625. !   FILE *istream = fopen (infile, "rt");
  1626.     int i;
  1627.     struct linebuffer lb;
  1628.     long linelength;
  1629. ***************
  1630. *** 981,987 ****
  1631.     for (i = 0; i < ntemps; i++)
  1632.       {
  1633.         char *newtemp = maketempname (++tempcount);
  1634. !       sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp);
  1635.         if (!keep_tempfiles)
  1636.           unlink (tempfiles[i]);
  1637.         tempfiles[i] = newtemp;
  1638. --- 1015,1021 ----
  1639.     for (i = 0; i < ntemps; i++)
  1640.       {
  1641.         char *newtemp = maketempname (++tempcount);
  1642. !       sort_in_core (tempfiles[i], MAX_IN_CORE_SORT, newtemp);
  1643.         if (!keep_tempfiles)
  1644.           unlink (tempfiles[i]);
  1645.         tempfiles[i] = newtemp;
  1646. ***************
  1647. *** 1015,1021 ****
  1648.   
  1649.     /* Read the contents of the file into the moby array `data'. */
  1650.   
  1651. !   int desc = open (infile, O_RDONLY, 0);
  1652.   
  1653.     if (desc < 0)
  1654.       fatal (_("failure reopening %s"), infile);
  1655. --- 1049,1055 ----
  1656.   
  1657.     /* Read the contents of the file into the moby array `data'. */
  1658.   
  1659. !   int desc = open (infile, O_RDONLY|O_TEXT, 0);
  1660.   
  1661.     if (desc < 0)
  1662.       fatal (_("failure reopening %s"), infile);
  1663. ***************
  1664. *** 1071,1077 ****
  1665.        Make a `struct lineinfo' for each line, which records the keyfield
  1666.        as well as the line, and sort them.  */
  1667.   
  1668. !   lineinfo = (struct lineinfo *) malloc ((nextline - linearray) * sizeof (struct lineinfo));
  1669.   
  1670.     if (lineinfo)
  1671.       {
  1672. --- 1105,1111 ----
  1673.        Make a `struct lineinfo' for each line, which records the keyfield
  1674.        as well as the line, and sort them.  */
  1675.   
  1676. !   lineinfo = (struct lineinfo *) xmalloc ((nextline - linearray) * sizeof (struct lineinfo));
  1677.   
  1678.     if (lineinfo)
  1679.       {
  1680. ***************
  1681. *** 1542,1548 ****
  1682.         thisline[i] = &lb1[i];
  1683.         prevline[i] = &lb2[i];
  1684.         file_lossage[i] = 0;
  1685. !       streams[i] = fopen (infiles[i], "r");
  1686.         if (!streams[i])
  1687.           pfatal_with_name (infiles[i]);
  1688.   
  1689. --- 1576,1582 ----
  1690.         thisline[i] = &lb1[i];
  1691.         prevline[i] = &lb2[i];
  1692.         file_lossage[i] = 0;
  1693. !       streams[i] = fopen (infiles[i], "rt");
  1694.         if (!streams[i])
  1695.           pfatal_with_name (infiles[i]);
  1696.   
  1697. ***************
  1698. *** 1733,1739 ****
  1699.              _("Virtual memory exhausted in %s ()!  Needed %d bytes."),
  1700.              callers_name, bytes_wanted);
  1701.   
  1702. !   error (printable_string);
  1703.     abort ();
  1704.   }
  1705.   
  1706. --- 1767,1773 ----
  1707.              _("Virtual memory exhausted in %s ()!  Needed %d bytes."),
  1708.              callers_name, bytes_wanted);
  1709.   
  1710. !   error (printable_string, "");
  1711.     abort ();
  1712.   }
  1713.   
  1714.