home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume4 / client_man < prev    next >
Internet Message Format  |  1986-11-30  |  17KB

  1. From: talcott!ut-sally!im4u!jsq (John Quarterman)
  2. Subject: Client/server context diffs to 4.2BSD man.c
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 4, Issue 55
  7. Submitted by: talcott!ut-sally!im4u!jsq (John Quarterman)
  8.  
  9.  
  10. : This is a shar archive.  Extract with sh, not csh.
  11. echo x - README.man
  12. sed -e 's/^X//' > README.man << '!RoNnIe!RaYgUn!'
  13. XThis article includes a context diff of the source to the 4.2BSD man command
  14. Xto make it work with the generic client and server programs previously posted.
  15. X
  16. XOnce again:  I make no claims whatever as to the security, safety, or utility
  17. Xof this software.  USE AT YOUR OWN RISK!
  18. X
  19. X    John Quarterman, ut-sally!jsq, jsq@sally.utexas.edu
  20. X
  21. X
  22. XThe diffs to the man command found in man.c.diffs include not only
  23. Xthe changes to make it call client if necessary, but also at least
  24. Xtwo other modifications which you may or may not want:
  25. X    Files in /usr/man/manl may be named, e.g., server.8 instead of server.l.
  26. X    Manual pages are kept compressed (compress 4.0 is recommended for this).
  27. XThe idea for the latter change came from Sequent Computer Systems, Inc.,
  28. Xbut this implementation was done without seeing their code.
  29. X
  30. XObviously man could be made to work with the client and server programs
  31. Xwithout changing man.c itself by using the same sort of shell script
  32. Xhack as in the phone program example.  However, the difference in speed
  33. Xis worth the hacking in this case (I tried it both ways).
  34. !RoNnIe!RaYgUn!
  35. echo x - man.c.diff
  36. sed -e 's/^X//' > man.c.diff << '!RoNnIe!RaYgUn!'
  37. X*** man.c.orig    Thu Apr  3 12:15:08 1986
  38. X--- man.c    Fri Dec 20 11:54:43 1985
  39. X***************
  40. X*** 5,13 ****
  41. X  #include <stdio.h>
  42. X  #include <ctype.h>
  43. X  #include <sgtty.h>
  44. X! #include <sys/types.h>
  45. X  #include <sys/stat.h>
  46. X- #include <signal.h>
  47. X  /*
  48. X   * man
  49. X   * link also to apropos and whatis
  50. X--- 5,12 ----
  51. X  #include <stdio.h>
  52. X  #include <ctype.h>
  53. X  #include <sgtty.h>
  54. X! #include <sys/param.h>
  55. X  #include <sys/stat.h>
  56. X  /*
  57. X   * man
  58. X   * link also to apropos and whatis
  59. X***************
  60. X*** 14,26 ****
  61. X   * This version uses more for underlining and paging.
  62. X   */
  63. X  #define    MANDIR    "/usr/man"        /* this is deeply embedded */
  64. X  #define    NROFFCAT "nroff -h -man"    /* for nroffing to cat file */
  65. X  #define    NROFF    "nroff -man"        /* for nroffing to tty */
  66. X! #define    MORE    "more -s"        /* paging filter */
  67. X! #define    CAT    "cat -s"        /* for '-' opt (no more) */
  68. X  
  69. X  #define TROFFCMD \
  70. X! "itroff -man %s"
  71. X  #ifdef notdef
  72. X  "troff -t -man /usr/lib/tmac/tmac.vcat %s | /usr/lib/rvsort |/usr/ucb/vpr -t"
  73. X  #endif
  74. X--- 13,27 ----
  75. X   * This version uses more for underlining and paging.
  76. X   */
  77. X  #define    MANDIR    "/usr/man"        /* this is deeply embedded */
  78. X+ #define WHATIS "/usr/lib/whatis"    /* whatis database */
  79. X  #define    NROFFCAT "nroff -h -man"    /* for nroffing to cat file */
  80. X  #define    NROFF    "nroff -man"        /* for nroffing to tty */
  81. X! #define    MORE    "more"            /* paging filter */
  82. X! #define    CAT    "cat"            /* for '-' opt (no more) */
  83. X  
  84. X  #define TROFFCMD \
  85. X! "ditroff -man %s"
  86. X! 
  87. X  #ifdef notdef
  88. X  "troff -t -man /usr/lib/tmac/tmac.vcat %s | /usr/lib/rvsort |/usr/ucb/vpr -t"
  89. X  #endif
  90. X***************
  91. X*** 29,45 ****
  92. X  #define    TROFFCMD "troff -man %s"
  93. X  */
  94. X  
  95. X! #define    ALLSECT    "1nl6823457po"    /* order to look through sections */
  96. X! #define    SECT1    "1nlo"        /* sections to look at if 1 is specified */
  97. X! #define    SUBSEC1    "mcgprv"    /* subsections to try in section 1 */
  98. X! #define    SUBSEC2    "v"
  99. X! #define    SUBSEC3    "jxmsnvcf"
  100. X! #define    SUBSEC4    "pfvsn"
  101. X! #define    SUBSEC8    "vc"
  102. X  
  103. X  int    nomore;
  104. X  int    cflag;
  105. X! char    *manpath = "/usr/man";
  106. X  char    *strcpy();
  107. X  char    *strcat();
  108. X  char    *trim();
  109. X--- 30,63 ----
  110. X  #define    TROFFCMD "troff -man %s"
  111. X  */
  112. X  
  113. X! #define    ALLSECT    "16823457"    /* order to look through sections */
  114. X! #define    SECTS    "nlxpo"        /* additional sections to look at if 1-8 is specified */
  115. X! #define    SUBSEC1    "mcgprvx"    /* subsections to try in section 1 */
  116. X! #define    SUBSEC2    "pvx"
  117. X! #define    SUBSEC3    "jxmsnpvcfx"
  118. X! #define    SUBSEC4    "pfvsnx"
  119. X! #define    SUBSEC8    "vcpx"
  120. X  
  121. X  int    nomore;
  122. X+ int    isremote;
  123. X  int    cflag;
  124. X! char    manpath[MAXPATHLEN] = MANDIR;
  125. X! char    whatispath[MAXPATHLEN] = WHATIS;
  126. X! char    *machine = NULL;
  127. X! #if vax
  128. X! #define OURMACHINE    "vax"
  129. X! #else
  130. X! #if sun
  131. X! #define OURMACHINE    "sun"
  132. X! #else
  133. X! #if ns32000
  134. X! #define OURMACHINE    "b8k"
  135. X! #else
  136. X! #define OURMACHINE    "vax"
  137. X! #endif
  138. X! #endif
  139. X! #endif
  140. X! #define DOMAIN ".CS.UTEXAS.EDU"
  141. X  char    *strcpy();
  142. X  char    *strcat();
  143. X  char    *trim();
  144. X***************
  145. X*** 55,61 ****
  146. X--- 73,121 ----
  147. X      int argc;
  148. X      char *argv[];
  149. X  {
  150. X+     char *command, *dot, *rindex(), *index();
  151. X  
  152. X+     /* check how we are called and append suffix to
  153. X+        manual path.  This enables an alternate manual
  154. X+        set to be used.  We also have to change the 
  155. X+        location of the whatis database by also appending
  156. X+        the suffix.  I.e for a sun manual set the path is
  157. X+        set to MANDIR.sun and whatis is WHATIS.sun.
  158. X+        But don't append .local if called as man.local.
  159. X+      */
  160. X+ 
  161. X+     if ((command = rindex(*argv, '/')) != NULL)
  162. X+         command++;
  163. X+     else
  164. X+         command = *argv;
  165. X+     if ((dot = index(command, '.')) != NULL) {
  166. X+         *dot++ = '\0';
  167. X+         if (strcmp(dot, "local") != 0)
  168. X+             dot = NULL;
  169. X+         else
  170. X+             machine = dot;
  171. X+     }
  172. X+     if (argv[1] != NULL && strcmp(argv[1], "-m") == 0
  173. X+     && argv[2] != NULL) {
  174. X+         argc--, argv++;
  175. X+         argc--, argv++;
  176. X+         machine = *argv;
  177. X+     }
  178. X+     if (machine != NULL && strcmp(machine, OURMACHINE) != 0) {
  179. X+         dot = manpath + strlen(manpath);
  180. X+         strcat (dot, ".");
  181. X+         strcat (dot, machine);
  182. X+         strcat (whatispath, dot);
  183. X+     }
  184. X+     {
  185. X+         struct stat stbuf;
  186. X+         if (fstat(0, &stbuf) != -1
  187. X+         && ((stbuf.st_mode&S_IFMT) == S_IFSOCK
  188. X+            || (stbuf.st_mode&S_IFMT) == 0))
  189. X+             isremote++;
  190. X+     }
  191. X+     if (chdir(manpath) < 0 || (chdir("man1") < 0 && chdir("cat1") < 0))
  192. X+         remoteman(command, ++argv);
  193. X      if (signal(SIGINT, SIG_IGN) == SIG_DFL) {
  194. X          signal(SIGINT, remove);
  195. X          signal(SIGQUIT, remove);
  196. X***************
  197. X*** 62,77 ****
  198. X          signal(SIGTERM, remove);
  199. X      }
  200. X      umask(0);
  201. X!     if (strcmp(argv[0], "apropos") == 0) {
  202. X          apropos(argc-1, argv+1);
  203. X          exit(0);
  204. X      }
  205. X!     if (strcmp(argv[0], "whatis") == 0) {
  206. X          whatis(argc-1, argv+1);
  207. X          exit(0);
  208. X      }
  209. X      if (argc <= 1) {
  210. X!         fprintf(stderr, "Usage: man [ section ] name ...\n");
  211. X          exit(1);
  212. X      }
  213. X      argc--, argv++;
  214. X--- 122,137 ----
  215. X          signal(SIGTERM, remove);
  216. X      }
  217. X      umask(0);
  218. X!     if (strcmp(command, "apropos") == 0) {
  219. X          apropos(argc-1, argv+1);
  220. X          exit(0);
  221. X      }
  222. X!     if (strcmp(command, "whatis") == 0) {
  223. X          whatis(argc-1, argv+1);
  224. X          exit(0);
  225. X      }
  226. X      if (argc <= 1) {
  227. X!     fprintf(stderr, "Usage: man [ -m machine ] [ section ] name ...\n");
  228. X          exit(1);
  229. X      }
  230. X      argc--, argv++;
  231. X***************
  232. X*** 96,102 ****
  233. X  
  234. X          case 'P':
  235. X              argc--, argv++;
  236. X!             manpath = *argv;
  237. X              break;
  238. X          }
  239. X          argc--, argv++;
  240. X--- 156,162 ----
  241. X  
  242. X          case 'P':
  243. X              argc--, argv++;
  244. X!             strcpy(manpath, *argv);
  245. X              break;
  246. X          }
  247. X          argc--, argv++;
  248. X***************
  249. X*** 105,111 ****
  250. X          fprintf(stderr, "Can't chdir to %s.\n", manpath);
  251. X          exit(1);
  252. X      }
  253. X!     if (troffit == 0 && nomore == 0 && !isatty(1))
  254. X          nomore++;
  255. X      section = 0;
  256. X      do {
  257. X--- 165,171 ----
  258. X          fprintf(stderr, "Can't chdir to %s.\n", manpath);
  259. X          exit(1);
  260. X      }
  261. X!     if (isremote == 0 && troffit == 0 && nomore == 0 && !isatty(1))
  262. X          nomore++;
  263. X      section = 0;
  264. X      do {
  265. X***************
  266. X*** 132,174 ****
  267. X              }
  268. X              continue;
  269. X          }
  270. X!         manual(section, argv[0]);
  271. X          argc--, argv++;
  272. X      } while (argc > 0);
  273. X      exit(0);
  274. X  }
  275. X  
  276. X! manual(sec, name)
  277. X!     char sec;
  278. X!     char *name;
  279. X  {
  280. X!     char section = sec;
  281. X!     char work[100], work2[100], cmdbuf[150];
  282. X      int ss;
  283. X!     struct stat stbuf, stbuf2;
  284. X      int last;
  285. X!     char *sp = ALLSECT;
  286. X  
  287. X      strcpy(work, "manx/");
  288. X      strcat(work, name);
  289. X      strcat(work, ".x");
  290. X      last = strlen(work) - 1;
  291. X!     if (section == '1') {
  292. X!         sp = SECT1;
  293. X!         section = 0;
  294. X      }
  295. X!     if (section == 0) {
  296. X!         ss = 0;
  297. X!         for (section = *sp++; section; section = *sp++) {
  298. X!             work[3] = section;
  299. X              work[last] = section;
  300. X!             work[last+1] = 0;
  301. X              work[last+2] = 0;
  302. X              if (stat(work, &stbuf) >= 0)
  303. X!                 break;
  304. X!             if (work[last] >= '1' && work[last] <= '8') {
  305. X                  char *cp;
  306. X- search:
  307. X                  switch (work[last]) {
  308. X                  case '1': cp = SUBSEC1; break;
  309. X                  case '2': cp = SUBSEC2; break;
  310. X--- 192,263 ----
  311. X              }
  312. X              continue;
  313. X          }
  314. X!         manual(section, subsec, argv[0]);
  315. X          argc--, argv++;
  316. X      } while (argc > 0);
  317. X      exit(0);
  318. X  }
  319. X  
  320. X! manual(sec, subsec, name)
  321. X! char sec;
  322. X! char subsec;
  323. X! char *name;
  324. X  {
  325. X!     char work[100], work2[100], workZ[100], cmdbuf[150];
  326. X!     char sects[100], lsects[100];
  327. X!     char section;
  328. X      int ss;
  329. X!     struct stat stbuf, stbuf2, stbufZ;
  330. X      int last;
  331. X!     char *sp, *lsp, *secp;
  332. X!     extern char *index();
  333. X  
  334. X      strcpy(work, "manx/");
  335. X      strcat(work, name);
  336. X      strcat(work, ".x");
  337. X      last = strlen(work) - 1;
  338. X! 
  339. X!     /* set up sections to search */
  340. X!     if (sec == '\0') {
  341. X!         strcpy(sects, ALLSECT);
  342. X!         sp = sects;
  343. X!         strcpy(lsects, SECTS);    /* special sections */
  344. X      }
  345. X!     else {
  346. X!         sects[0] = sec;
  347. X!         sects[1] = '\0';
  348. X!         sp = sects;
  349. X!         if (sec >= '1' && sec <= '8')
  350. X!             strcpy(lsects, SECTS);    /* special sections */
  351. X!         else
  352. X!             strcpy(lsects, "x");    /* only search in specified sectin */
  353. X!     } 
  354. X! 
  355. X!     /* do the search */
  356. X!     secp = index(lsects, 'x');
  357. X!     ss = 0;
  358. X!     for (section = *sp++; section; section = *sp++) {
  359. X! #ifdef DEBUG
  360. X! fprintf (stderr, "section = %c\n", section);
  361. X! #endif
  362. X!         *secp = section;
  363. X!         /* special section searching 
  364. X!            this will search through the specified section plus all
  365. X!            the sections in lsect
  366. X!            Note that the 'x' entry in lsect is replaced with
  367. X!            the specific main section to search */
  368. X!         for (lsp = lsects; *lsp != NULL; lsp++) {
  369. X!             work[3] = *lsp;
  370. X              work[last] = section;
  371. X!             work[last+1] = subsec;
  372. X              work[last+2] = 0;
  373. X+ #ifdef DEBUG
  374. X+ fprintf(stderr, "work - %s\n", work);
  375. X+ #endif
  376. X              if (stat(work, &stbuf) >= 0)
  377. X!                 goto found;
  378. X!             if (subsec == '\0') { 
  379. X                  char *cp;
  380. X                  switch (work[last]) {
  381. X                  case '1': cp = SUBSEC1; break;
  382. X                  case '2': cp = SUBSEC2; break;
  383. X***************
  384. X*** 176,182 ****
  385. X                  case '4': cp = SUBSEC4; break;
  386. X                  case '8': cp = SUBSEC8; break;
  387. X                  }
  388. X!                 while (*cp) {
  389. X                      work[last+1] = *cp++;
  390. X                      if (stat(work, &stbuf) >= 0) {
  391. X                          ss = work[last+1];
  392. X--- 265,271 ----
  393. X                  case '4': cp = SUBSEC4; break;
  394. X                  case '8': cp = SUBSEC8; break;
  395. X                  }
  396. X!                 while (cp && *cp) {
  397. X                      work[last+1] = *cp++;
  398. X                      if (stat(work, &stbuf) >= 0) {
  399. X                          ss = work[last+1];
  400. X***************
  401. X*** 187,216 ****
  402. X                      work[last+1] = 0;
  403. X              }
  404. X          }
  405. X-         if (section == 0) {
  406. X-             if (sec == 0)
  407. X-                 printf("No manual entry for %s.\n", name);
  408. X-             else
  409. X-                 printf("No entry for %s in section %c of the manual.\n", name, sec);
  410. X-             return;
  411. X-         }
  412. X-     } else {
  413. X-         work[3] = section;
  414. X-         work[last] = section;
  415. X-         work[last+1] = subsec;
  416. X-         work[last+2] = 0;
  417. X-         if (stat(work, &stbuf) < 0) {
  418. X-             if ((section >= '1' && section <= '8') && subsec == 0) {
  419. X-                 sp = "\0";
  420. X-                 goto search;
  421. X-             }
  422. X-             printf("No entry for %s in section %c", name, section);
  423. X-             if (subsec)
  424. X-                 putchar(subsec);
  425. X-             printf(" of the manual.\n");
  426. X-             return;
  427. X-         }
  428. X      }
  429. X  found:
  430. X      if (troffit)
  431. X          troff(work);
  432. X--- 276,291 ----
  433. X                      work[last+1] = 0;
  434. X              }
  435. X          }
  436. X      }
  437. X+     if (sec == 0)
  438. X+         printf("No manual entry for %s.\n", name);
  439. X+     else {
  440. X+         printf("No entry for %s in section %c", name, sec);
  441. X+         if (subsec != '\0')
  442. X+             putchar(subsec);
  443. X+         printf(" of the manual.\n");
  444. X+     }
  445. X+     return;
  446. X  found:
  447. X      if (troffit)
  448. X          troff(work);
  449. X***************
  450. X*** 229,235 ****
  451. X                  register char *cp = abuf+strlen(".so ");
  452. X                  char *dp;
  453. X  
  454. X!                 while (*cp && *cp != '\n')
  455. X                      cp++;
  456. X                  *cp = 0;
  457. X                  while (cp > abuf && *--cp != '/')
  458. X--- 304,310 ----
  459. X                  register char *cp = abuf+strlen(".so ");
  460. X                  char *dp;
  461. X  
  462. X!                 while (cp && *cp && *cp != '\n')
  463. X                      cp++;
  464. X                  *cp = 0;
  465. X                  while (cp > abuf && *--cp != '/')
  466. X***************
  467. X*** 254,260 ****
  468. X              if (stat(work2, &stbuf2) < 0)
  469. X                  goto hardway;
  470. X              strcpy(work2+3, work+3);
  471. X!             if (stat(work2, &stbuf2) < 0 || stbuf2.st_mtime < stbuf.st_mtime) {
  472. X                  printf("Reformatting page.  Wait...");
  473. X                  fflush(stdout);
  474. X                  unlink(work2);
  475. X--- 329,346 ----
  476. X              if (stat(work2, &stbuf2) < 0)
  477. X                  goto hardway;
  478. X              strcpy(work2+3, work+3);
  479. X!             strcpy(workZ, work2);
  480. X!             strcat(workZ, ".Z");
  481. X! #ifdef DEBUG
  482. X! fprintf (stderr, "%s %s %s\n", work, work2, workZ);
  483. X! exit(0);
  484. X! #endif
  485. X!             if (stat(work2, &stbuf2) >= 0) {
  486. X!                 if (stbuf2.st_mtime > stbuf.st_mtime)
  487. X!                     compress(work2, workZ);
  488. X!                 unlink(work2);
  489. X!             }
  490. X!             if (stat(workZ, &stbufZ) < 0 || stbufZ.st_mtime < stbuf.st_mtime) {
  491. X                  printf("Reformatting page.  Wait...");
  492. X                  fflush(stdout);
  493. X                  unlink(work2);
  494. X***************
  495. X*** 266,274 ****
  496. X                      remove();
  497. X                      /*NOTREACHED*/
  498. X                  }
  499. X                  printf(" done\n");
  500. X              }
  501. X!             strcpy(work, work2);
  502. X          }
  503. X  hardway:
  504. X          nroff(work);
  505. X--- 352,361 ----
  506. X                      remove();
  507. X                      /*NOTREACHED*/
  508. X                  }
  509. X+                 compress(work2, workZ);
  510. X                  printf(" done\n");
  511. X              }
  512. X!             strcpy(work, workZ);
  513. X          }
  514. X  hardway:
  515. X          nroff(work);
  516. X***************
  517. X*** 275,289 ****
  518. X      }
  519. X  }
  520. X  
  521. X  nroff(cp)
  522. X      char *cp;
  523. X  {
  524. X      char cmd[BUFSIZ];
  525. X  
  526. X!     if (cp[0] == 'c')
  527. X!         sprintf(cmd, "%s %s", nomore? CAT : MORE, cp);
  528. X!     else
  529. X!         sprintf(cmd, nomore? "%s %s" : "%s %s|%s", NROFF, cp, MORE);
  530. X      system(cmd);
  531. X  }
  532. X  
  533. X--- 362,466 ----
  534. X      }
  535. X  }
  536. X  
  537. X+ compress(cp, z)
  538. X+     char *cp, *z;
  539. X+ {
  540. X+     char cmdbuf[100];
  541. X+ 
  542. X+     printf("Compressing...");
  543. X+     fflush(stdout);
  544. X+     unlink(z);
  545. X+     sprintf(cmdbuf, "compress -f %s\n", cp);
  546. X+     if (system(cmdbuf)) {
  547. X+         printf(" aborted (sorry)\n");
  548. X+         remove();
  549. X+         /*NOTREACHED*/
  550. X+     }
  551. X+     printf(".");
  552. X+     
  553. X+ }
  554. X+ 
  555. X+ static
  556. X+ char *
  557. X+ more()
  558. X+ {
  559. X+     extern char *getenv();
  560. X+     char *more;
  561. X+ 
  562. X+     if ((more = getenv("PAGER")) == NULL)
  563. X+         more = MORE;
  564. X+     return(more);
  565. X+ }
  566. X+ 
  567. X+ remoteman(command, argv)
  568. X+ char *command;
  569. X+ char **argv;
  570. X+ {
  571. X+     char host[128];
  572. X+     char *args[32];
  573. X+     char **ap = args, **tp = &args[sizeof(args)/sizeof(args[0]) - 1];
  574. X+ 
  575. X+     if (machine == NULL)
  576. X+         machine = OURMACHINE;
  577. X+     (void)strcpy(host, "man.");
  578. X+     (void)strcat(host, machine);
  579. X+     (void)strcat(host, DOMAIN);
  580. X+     *ap++ = "client";
  581. X+     *ap++ = host;
  582. X+     *ap++ = command;
  583. X+     *ap++ = "-m";
  584. X+     *ap++ = machine;
  585. X+     while (*argv && ap < tp)
  586. X+         *ap++ = *argv++;
  587. X+     *ap = NULL;
  588. X+     if (!isremote) {
  589. X+         int pipefds[2], pid;
  590. X+         char *filter;
  591. X+ 
  592. X+         if (pipe(pipefds) == -1) {
  593. X+             perror("pipe");
  594. X+             exit(1);
  595. X+         }
  596. X+         switch (pid = vfork()) {
  597. X+         case -1:
  598. X+             perror("vfork");
  599. X+             exit(1);
  600. X+             break;
  601. X+         case 0:
  602. X+             dup2(pipefds[1], 1);
  603. X+             close(pipefds[0]);
  604. X+             close(pipefds[1]);
  605. X+             break;
  606. X+         default:
  607. X+             dup2(pipefds[0], 0);
  608. X+             close(pipefds[0]);
  609. X+             close(pipefds[1]);
  610. X+             filter = nomore ? CAT : more();
  611. X+             execlp (filter, filter, "-s", NULL);
  612. X+             perror(filter);
  613. X+             exit(1);
  614. X+             break;
  615. X+         }
  616. X+     }
  617. X+     execvp(*args, args);
  618. X+     perror(*args);
  619. X+     exit(1);
  620. X+ }
  621. X+ 
  622. X  nroff(cp)
  623. X      char *cp;
  624. X  {
  625. X      char cmd[BUFSIZ];
  626. X  
  627. X!     if (cp[0] == 'c') {
  628. X!         if (isremote) {
  629. X!             execlp ("zcat", "zcat", cp, NULL);
  630. X!             perror("zcat");
  631. X!             exit(1);
  632. X!         } else
  633. X!             sprintf(cmd, "zcat %s | %s -s", cp, nomore? CAT:more());
  634. X!     } else
  635. X!         sprintf(cmd, nomore? "%s %s" : "%s %s|%s -s", NROFF, cp,more());
  636. X      system(cmd);
  637. X  }
  638. X  
  639. X***************
  640. X*** 329,336 ****
  641. X          fprintf(stderr, "apropos what?\n");
  642. X          exit(1);
  643. X      }
  644. X!     if (freopen("/usr/lib/whatis", "r", stdin) == NULL) {
  645. X!         perror("/usr/lib/whatis");
  646. X          exit (1);
  647. X      }
  648. X      gotit = (char *) calloc(1, blklen(argv));
  649. X--- 506,513 ----
  650. X          fprintf(stderr, "apropos what?\n");
  651. X          exit(1);
  652. X      }
  653. X!     if (freopen(whatispath, "r", stdin) == NULL) {
  654. X!         perror(whatispath);
  655. X          exit (1);
  656. X      }
  657. X      gotit = (char *) calloc(1, blklen(argv));
  658. X***************
  659. X*** 410,417 ****
  660. X          fprintf(stderr, "whatis what?\n");
  661. X          exit(1);
  662. X      }
  663. X!     if (freopen("/usr/lib/whatis", "r", stdin) == NULL) {
  664. X!         perror("/usr/lib/whatis");
  665. X          exit (1);
  666. X      }
  667. X      for (avp = argv; *avp; avp++)
  668. X--- 587,594 ----
  669. X          fprintf(stderr, "whatis what?\n");
  670. X          exit(1);
  671. X      }
  672. X!     if (freopen(whatispath, "r", stdin) == NULL) {
  673. X!         perror(whatispath);
  674. X          exit (1);
  675. X      }
  676. X      for (avp = argv; *avp; avp++)
  677. !RoNnIe!RaYgUn!
  678. exit
  679.  
  680.