home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / OS2 / MAN11A.ZIP / src / patches.os2 < prev    next >
Text File  |  1994-01-23  |  15KB  |  677 lines

  1. Only in new: config.h
  2. Only in new: director.c
  3. Only in new: getopt.c
  4. Only in new: include
  5. Only in new: Makefile.os2
  6. diff -c man-1.1/makewhatis.sh new/makewhatis.sh
  7. *** man-1.1/makewhatis.sh    Sun Aug 25 20:35:38 1991
  8. --- new/makewhatis.sh    Sun Jan 23 15:22:38 1994
  9. ***************
  10. *** 29,34 ****
  11. --- 29,35 ----
  12.       do
  13.           if [ -d $subdir ]
  14.           then
  15. +         cd $subdir
  16.               for f in `find . -name '*' -print`
  17.               do
  18.                   sed -n '/^\.TH.*$/p
  19. diff -c man-1.1/man.c new/man.c
  20. *** man-1.1/man.c    Mon Aug 26 05:01:02 1991
  21. --- new/man.c    Wed Jan 05 00:53:44 1994
  22. ***************
  23. *** 19,25 ****
  24. --- 19,27 ----
  25.   #include <stdio.h>
  26.   #include <ctype.h>
  27.   #include <string.h>
  28. + #ifndef _MSC_VER
  29.   #include <sys/file.h>
  30. + #endif
  31.   #include <signal.h>
  32.   #include "config.h"
  33.   #include "gripes.h"
  34. ***************
  35. *** 80,85 ****
  36. --- 82,89 ----
  37.   static int whatis;
  38.   static int findall;
  39.   static int print_where;
  40. + static char nroff_cmd[] = NROFF;
  41. + static char *nroff = nroff_cmd;
  42.   
  43.   #ifdef ALT_SYSTEMS
  44.   static int alt_system;
  45. ***************
  46. *** 94,101 ****
  47. --- 98,109 ----
  48.   #ifdef ALT_SYSTEMS
  49.   static char args[] = "M:P:S:adfhkm:p:tw?";
  50.   #else
  51. + #ifdef OS2
  52. + static char args[] = "M:N:P:S:adfhkp:tw?";
  53. + #else
  54.   static char args[] = "M:P:S:adfhkp:tw?";
  55.   #endif
  56. + #endif
  57.   #else
  58.   #ifdef ALT_SYSTEMS
  59.   static char args[] = "M:P:S:adfhkm:p:w?";
  60. ***************
  61. *** 184,193 ****
  62. --- 192,207 ----
  63.       "usage: %s [-adfhktw] [section] [-M path] [-P pager] [-S list]\n\
  64.              [-m system] [-p string] name ...\n\n";
  65.   #else
  66. + #ifdef OS2
  67. +   static char s1[] =
  68. +     "usage: %s [-adfhktw] [section] [-M path] [-N nroff] [-P pager] [-S list]\n\
  69. +            [-p string] name ...\n\n";
  70. + #else
  71.     static char s1[] =
  72.       "usage: %s [-adfhktw] [section] [-M path] [-P pager] [-S list]\n\
  73.              [-p string] name ...\n\n";
  74.   #endif
  75. + #endif
  76.   #else
  77.   #ifdef ALT_SYSTEMS
  78.     static char s1[] =
  79. ***************
  80. *** 206,244 ****
  81.     h : print this help message\n\
  82.     k : same as apropos(1)\n";
  83.   
  84. - #ifdef HAS_TROFF
  85. -   static char s3[] = "  t : use troff to format pages for printing\n";
  86. - #endif
  87. -   static char s4[] = "  w : print location of man page(s) that would be displayed\n\n\
  88. -   M path   : set search path for manual pages to `path'\n\
  89. -   P pager  : use program `pager' to display pages\n\
  90. -   S list   : colon separated section list\n";
  91. - #ifdef ALT_SYSTEMS
  92. -   static char s5[] = "  m system : search for alternate system's man pages\n";
  93. - #endif
  94. -   static char s6[] = "  p string : string tells which preprocessors to run\n\
  95. -                e - [n]eqn(1)   p - pic(1)    t - tbl(1)\n\
  96. -                g - grap(1)     r - refer(1)  v - vgrind(1)\n";
  97.     strcat (usage_string, s1);
  98.     strcat (usage_string, s2);
  99.   
  100.   #ifdef HAS_TROFF
  101. !   strcat (usage_string, s3);
  102.   #endif
  103.   
  104. !   strcat (usage_string, s4);
  105.   
  106. ! #ifdef ALT_SYSTEMS
  107. !   strcat (usage_string, s5);
  108.   #endif
  109.   
  110. !   strcat (usage_string, s6);
  111.   
  112. !   fprintf (stderr, usage_string, prognam, version, prognam);
  113.     exit(1);
  114.   }
  115.   
  116. --- 220,256 ----
  117.     h : print this help message\n\
  118.     k : same as apropos(1)\n";
  119.   
  120.     strcat (usage_string, s1);
  121.     strcat (usage_string, s2);
  122.   
  123.   #ifdef HAS_TROFF
  124. !   strcat(usage_string, "  t : use troff to format pages for printing\n");
  125.   #endif
  126.   
  127. !   strcat(usage_string,
  128. !      "  w : print location of man page(s) that would be displayed\n\n");
  129.   
  130. !   fprintf (stderr, usage_string, prognam, version, prognam);
  131. !   fprintf(stderr,
  132. !      "  M path   : set search path for manual pages to `path'\n");
  133. ! #ifdef OS2
  134. !   fprintf(stderr, 
  135. !      "  N nroff  : set nroff command (%s)\n", nroff);
  136.   #endif
  137. +   fprintf(stderr, "\
  138. +   P pager  : use program `pager' to display pages\n\
  139. +   S list   : colon separated section list\n");
  140.   
  141. ! #ifdef ALT_SYSTEMS
  142. !   fprintf(stderr,
  143. !      "  m system : search for alternate system's man pages\n";
  144. ! #endif
  145.   
  146. !   fprintf(stderr, "\
  147. !   p string : string tells which preprocessors to run\n\
  148. !                e - [n]eqn(1)   p - pic(1)    t - tbl(1)\n\
  149. !                g - grap(1)     r - refer(1)  v - vgrind(1)\n");
  150.     exit(1);
  151.   }
  152.   
  153. ***************
  154. *** 286,291 ****
  155. --- 298,308 ----
  156.     extern void downcase ();
  157.     extern char *manpath ();
  158.   
  159. + #ifdef OS2
  160. +   if (NULL == (nroff = getenv("NROFF")))
  161. +     nroff = (_osmode == DOS_MODE || _osmajor < 20) ? NROFF16 : nroff_cmd;
  162. + #endif
  163.     while ((c = getopt (argc, argv, args)) != EOF)
  164.       {
  165.         switch (c)
  166. ***************
  167. *** 293,298 ****
  168. --- 310,320 ----
  169.       case 'M':
  170.         manp = strdup (optarg);
  171.         break;
  172. + #ifdef OS2
  173. +     case 'N':
  174. +       nroff = optarg;
  175. +       break;
  176. + #endif
  177.       case 'P':
  178.         pager = strdup (optarg);
  179.         break;
  180. ***************
  181. *** 390,399 ****
  182.     /*
  183.      * Expand the manpath into a list for easier handling.
  184.      */
  185.     mp = manpathlist;
  186.     for (p = manp; ; p = end+1)
  187.       {
  188. !       if ((end = strchr (p, ':')) != NULL)
  189.       *end = '\0';
  190.   
  191.   #ifdef ALT_SYSTEMS
  192. --- 412,425 ----
  193.     /*
  194.      * Expand the manpath into a list for easier handling.
  195.      */
  196. + #ifdef OS2
  197. +   for (p = manp; p = strchr(p, '\\'); )
  198. +     *p = '/';
  199. + #endif
  200.     mp = manpathlist;
  201.     for (p = manp; ; p = end+1)
  202.       {
  203. !       if ((end = strchr (p, PATHSEP)) != NULL)
  204.       *end = '\0';
  205.   
  206.   #ifdef ALT_SYSTEMS
  207. ***************
  208. *** 421,427 ****
  209.         if (end == NULL)
  210.       break;
  211.   
  212. !       *end = ':';
  213.       }
  214.     *mp = NULL;
  215.   }
  216. --- 447,453 ----
  217.         if (end == NULL)
  218.       break;
  219.   
  220. !       *end = PATHSEP;
  221.       }
  222.     *mp = NULL;
  223.   }
  224. ***************
  225. *** 440,446 ****
  226.     register char **vs;
  227.   
  228.     for (vs = section_list; *vs != NULL; vs++)
  229. !     if ((strcmp (*vs, name) == NULL) || (isdigit (name[0])))
  230.         return strdup (name);
  231.   
  232.     return NULL;
  233. --- 466,472 ----
  234.     register char **vs;
  235.   
  236.     for (vs = section_list; *vs != NULL; vs++)
  237. !     if ((strcmp (*vs, name) == 0) || (isdigit (name[0])))
  238.         return strdup (name);
  239.   
  240.     return NULL;
  241. ***************
  242. *** 506,517 ****
  243.   #ifdef DO_COMPRESS
  244.     if (to_cat)
  245.       {
  246. !       int len = strlen (name) + 3;
  247.         to_name = (char *) malloc (len);
  248.         if (to_name == NULL)
  249.       gripe_alloc (len, "to_name");
  250.         strcpy (to_name, name);
  251. !       strcat (to_name, ".Z");
  252.       }
  253.     else
  254.       to_name = strdup (name);
  255. --- 532,543 ----
  256.   #ifdef DO_COMPRESS
  257.     if (to_cat)
  258.       {
  259. !       int len = strlen (name) + strlen(COMPRESS_EXT) + 1;
  260.         to_name = (char *) malloc (len);
  261.         if (to_name == NULL)
  262.       gripe_alloc (len, "to_name");
  263.         strcpy (to_name, name);
  264. !       strcat (to_name, COMPRESS_EXT);
  265.       }
  266.     else
  267.       to_name = strdup (name);
  268. ***************
  269. *** 522,528 ****
  270.     t1 = strrchr (to_name, '/');
  271.     if (t1 != NULL)
  272.       {
  273. !       *t1 = NULL;
  274.         t2 = strrchr (to_name, '/');
  275.         *t1 = '/';
  276.       }
  277. --- 548,554 ----
  278.     t1 = strrchr (to_name, '/');
  279.     if (t1 != NULL)
  280.       {
  281. !       *t1 = '\0';
  282.         t2 = strrchr (to_name, '/');
  283.         *t1 = '/';
  284.       }
  285. ***************
  286. *** 640,672 ****
  287.   {
  288.     char *expander = NULL;
  289.     int len = strlen (file);
  290.   
  291. !   if (file[len - 2] == '.')
  292. !     {
  293. !       switch (file[len - 1])
  294. !     {
  295. ! #ifdef FCAT
  296. !     case 'F':
  297. !       if (strcmp (FCAT, "") != 0)
  298. !         expander = strdup (FCAT);
  299. !       break;
  300. ! #endif
  301. ! #ifdef YCAT
  302. !     case 'Y':
  303. !       if (strcmp (YCAT, "") != 0)
  304. !         expander = strdup (YCAT);
  305. !       break;
  306. ! #endif
  307. ! #ifdef ZCAT
  308. !     case 'Z':
  309. !       if (strcmp (ZCAT, "") != 0)
  310. !         expander = strdup (ZCAT);
  311. !       break;
  312. ! #endif
  313. !     default:
  314. !       break;
  315. !     }
  316. !     }
  317.     return expander;
  318.   }
  319.   #endif
  320. --- 666,682 ----
  321.   {
  322.     char *expander = NULL;
  323.     int len = strlen (file);
  324. +   int i;
  325. +   UNCOMPRESS *u = uncompress;
  326.   
  327. !   while (u->ext) {
  328. !     if (0 < (i = len - strlen(u->ext)))
  329. !       if (!strcmp(file + i, u->ext)) {
  330. !     expander = u->prog;
  331. !     break;
  332. !       }
  333. !     u++;
  334. !   }
  335.     return expander;
  336.   }
  337.   #endif
  338. ***************
  339. *** 881,887 ****
  340.   #endif
  341.       {
  342.         strcat (buf, " | ");
  343. !       strcat (buf, NROFF);
  344.       }
  345.   
  346.     if (tbl_found && !troff && strcmp (COL, "") != 0)
  347. --- 891,897 ----
  348.   #endif
  349.       {
  350.         strcat (buf, " | ");
  351. !       strcat (buf, nroff);
  352.       }
  353.   
  354.     if (tbl_found && !troff && strcmp (COL, "") != 0)
  355. ***************
  356. *** 985,1001 ****
  357.     else
  358.   #endif
  359.       {
  360. !       if (strcmp (TBL, "") != 0)
  361.       {
  362.         strcpy (buf, TBL);
  363.         strcat (buf, " ");
  364.         strcat (buf, file);
  365.         strcat (buf, " | ");
  366. !       strcat (buf, NROFF);
  367.       }
  368.         else
  369.       {
  370. !       strcpy (buf, NROFF);
  371.         strcat (buf, " ");
  372.         strcat (buf, file);
  373.       }
  374. --- 995,1011 ----
  375.     else
  376.   #endif
  377.       {
  378. !       if (nroff == nroff_cmd && strcmp (TBL, "") != 0)
  379.       {
  380.         strcpy (buf, TBL);
  381.         strcat (buf, " ");
  382.         strcat (buf, file);
  383.         strcat (buf, " | ");
  384. !       strcat (buf, nroff);
  385.       }
  386.         else
  387.       {
  388. !       strcpy (buf, nroff);
  389.         strcat (buf, " ");
  390.         strcat (buf, file);
  391.       }
  392. ***************
  393. *** 1009,1014 ****
  394. --- 1019,1055 ----
  395.     return buf;
  396.   }
  397.   
  398. + char *
  399. + path_fixup(s)
  400. + char *s;
  401. + {
  402. + #if defined(OS2)
  403. +   char *p = s;
  404. +   if (s)
  405. +     while (p = strchr(p, '/')) *p = '\\';
  406. + #endif
  407. +   return s;
  408. + }
  409. + char *
  410. + chdir_fmt(path)
  411. + char *path;
  412. + {
  413. +   static char buf[MAXPATHLEN+9];
  414. + #ifdef OS2
  415. + /*
  416. +   sprintf(buf, "cd %s & ", path);
  417. +   path_fixup(buf+3); 
  418. + */
  419. +   *buf = '\0';
  420. + #else
  421. +   sprintf(buf, "cd %s ; ", path);
  422. + #endif
  423. +   return(buf);
  424. + }
  425.   /*
  426.    * Try to format the man page and create a new formatted file.  Return
  427.    * 1 for success and 0 for failure.
  428. ***************
  429. *** 1035,1044 ****
  430.       return 0;
  431.         else
  432.   #ifdef DO_COMPRESS
  433. !     sprintf (command, "(cd %s ; %s | %s > %s)", path,
  434.            roff_command, COMPRESSOR, cat_file);
  435.   #else
  436. !         sprintf (command, "(cd %s ; %s > %s)", path,
  437.            roff_command, cat_file);
  438.   #endif
  439.         /*
  440. --- 1076,1085 ----
  441.       return 0;
  442.         else
  443.   #ifdef DO_COMPRESS
  444. !     sprintf (command, "(%s%s | %s > %s)", chdir_fmt(path),
  445.            roff_command, COMPRESSOR, cat_file);
  446.   #else
  447. !         sprintf (command, "(%s%s > %s)", chdir_fmt(path),
  448.            roff_command, cat_file);
  449.   #endif
  450.         /*
  451. ***************
  452. *** 1103,1109 ****
  453.         if (roff_command == NULL)
  454.       return 0;
  455.         else
  456. !     sprintf (command, "(cd %s ; %s)", path, roff_command);
  457.   
  458.         found = do_system_command (command);
  459.       }
  460. --- 1144,1150 ----
  461.         if (roff_command == NULL)
  462.       return 0;
  463.         else
  464. !     sprintf (command, "(%s%s)", chdir_fmt(path), roff_command);
  465.   
  466.         found = do_system_command (command);
  467.       }
  468. ***************
  469. *** 1162,1168 ****
  470.             if (roff_command == NULL)
  471.               return 0;
  472.             else
  473. !             sprintf (command, "(cd %s ; %s | %s)", path,
  474.                    roff_command, pager);
  475.   
  476.             found = do_system_command (command);
  477. --- 1203,1209 ----
  478.             if (roff_command == NULL)
  479.               return 0;
  480.             else
  481. !             sprintf (command, "(%s%s | %s)", chdir_fmt(path),
  482.                    roff_command, pager);
  483.   
  484.             found = do_system_command (command);
  485. ***************
  486. *** 1250,1256 ****
  487.               }
  488.             else
  489.               {
  490. !               found += display_cat_file (*np);
  491.               }
  492.           }
  493.           }
  494. --- 1291,1297 ----
  495.               }
  496.             else
  497.               {
  498. !               found += display_cat_file (path_fixup(*np));
  499.               }
  500.           }
  501.           }
  502. ***************
  503. *** 1276,1282 ****
  504.           fprintf (stderr, "will try to write %s if needed\n", cat_file);
  505.           }
  506.   
  507. !       found += format_and_display (path, man_file, cat_file);
  508.       }
  509.       }
  510.   #endif /* NROFF_MISSING */
  511. --- 1317,1323 ----
  512.           fprintf (stderr, "will try to write %s if needed\n", cat_file);
  513.           }
  514.   
  515. !       found += format_and_display (path, man_file, path_fixup(cat_file));
  516.       }
  517.       }
  518.   #endif /* NROFF_MISSING */
  519. Only in new: man.def
  520. Only in new: man32.def
  521. diff -c man-1.1/manpath.c new/manpath.c
  522. *** man-1.1/manpath.c    Sun Aug 25 21:45:42 1991
  523. --- new/manpath.c    Thu Jan 06 20:05:52 1994
  524. ***************
  525. *** 186,194 ****
  526.     DIRLIST *dlp = list;
  527.     FILE *config;
  528.   
  529. !   if ((config = fopen (config_file, "r")) == NULL)
  530. !     gripe_getting_mp_config (config_file);
  531.   
  532.     while ((bp = fgets (buf, BUFSIZ, config)) != NULL)
  533.       {
  534.         while (*bp && (*bp == ' ' || *bp == '\t'))
  535. --- 186,207 ----
  536.     DIRLIST *dlp = list;
  537.     FILE *config;
  538.   
  539. ! #ifdef OS2
  540. !   char *config_file_sp[] = {"INIT", "DPATH", "PATH", NULL};
  541.   
  542. +   for (i = 0; config_file_sp[i]; i++) {
  543. +     _searchenv(config_file, config_file_sp[i], buf);
  544. +     if (*buf) break;
  545. +   }
  546. + #else
  547. +   *buf = '\0';
  548. + #endif
  549. +   if (*buf == '\0')
  550. +     strcpy(buf, config_file);
  551. +   if ((config = fopen (buf, "r")) == NULL)
  552. +     gripe_getting_mp_config (buf);
  553.     while ((bp = fgets (buf, BUFSIZ, config)) != NULL)
  554.       {
  555.         while (*bp && (*bp == ' ' || *bp == '\t'))
  556. ***************
  557. *** 315,321 ****
  558.         len = strlen (path);
  559.         memcpy (p, path, len);
  560.         p += len;
  561. !       *p++ = ':';
  562.         dlp++;
  563.       }
  564.       }
  565. --- 328,334 ----
  566.         len = strlen (path);
  567.         memcpy (p, path, len);
  568.         p += len;
  569. !       *p++ = PATHSEP;
  570.         dlp++;
  571.       }
  572.       }
  573. ***************
  574. *** 352,361 ****
  575.     char *has_subdirs ();
  576.   
  577.     tmppath = strdup (path);
  578.     for (p = tmppath; ; p = end+1)
  579.       {
  580. !       if (end = strchr(p, ':'))
  581.       *end = '\0';
  582.   
  583.         if (debug)
  584. --- 365,376 ----
  585.     char *has_subdirs ();
  586.   
  587.     tmppath = strdup (path);
  588. ! #ifdef OS2
  589. !   for (p = tmppath; p = strchr(p, '\\'); p++) *p = '/';
  590. ! #endif
  591.     for (p = tmppath; ; p = end+1)
  592.       {
  593. !       if (end = strchr(p, PATHSEP))
  594.       *end = '\0';
  595.   
  596.         if (debug)
  597. ***************
  598. *** 366,372 ****
  599.          * If we haven't added it to the list yet, do.
  600.          */
  601.         for (dlp = list; dlp->mandir[0] != '\0'; dlp++)
  602. !     if (dlp->bin[0] != '\0' && !strcmp (p, dlp->bin))
  603.         {
  604.           if (debug)
  605.             fprintf (stderr, "is in the config file\n");
  606. --- 381,392 ----
  607.          * If we haven't added it to the list yet, do.
  608.          */
  609.         for (dlp = list; dlp->mandir[0] != '\0'; dlp++)
  610. !     if (dlp->bin[0] != '\0' &&
  611. ! #ifdef OS2
  612. !         !stricmp (p, dlp->bin))
  613. ! #else
  614. !         !strcmp (p, dlp->bin))
  615. ! #endif
  616.         {
  617.           if (debug)
  618.             fprintf (stderr, "is in the config file\n");
  619. ***************
  620. *** 422,428 ****
  621.         lp++;
  622.       }
  623.   
  624. !   manpathlist = (char *) malloc (len);
  625.     if (manpathlist == NULL)
  626.       gripe_alloc (len, "manpathlist");
  627.   
  628. --- 442,448 ----
  629.         lp++;
  630.       }
  631.   
  632. !   manpathlist = (char *) malloc (len+1);
  633.     if (manpathlist == NULL)
  634.       gripe_alloc (len, "manpathlist");
  635.   
  636. ***************
  637. *** 435,445 ****
  638.         len = strlen (*lp);
  639.         memcpy (p, *lp, len);
  640.         p += len;
  641. !       *p++ = ':';
  642.         lp++;
  643.       }
  644.   
  645. !   p[-1] = '\0';
  646.   
  647.     return manpathlist;
  648.   }
  649. --- 455,466 ----
  650.         len = strlen (*lp);
  651.         memcpy (p, *lp, len);
  652.         p += len;
  653. !       *p++ = PATHSEP;
  654.         lp++;
  655.       }
  656.   
  657. !   if (p > manpathlist)
  658. !     p[-1] = '\0';
  659.   
  660.     return manpathlist;
  661.   }
  662. Only in new: manpath.def
  663. Only in new: manpath32.def
  664.