=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/man/Attic/man.c,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/man/Attic/man.c 2001/01/31 19:26:51 1.16 --- src/usr.bin/man/Attic/man.c 2001/04/10 02:32:33 1.17 *************** *** 1,4 **** ! /* $OpenBSD: man.c,v 1.16 2001/01/31 19:26:51 deraadt Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: man.c,v 1.17 2001/04/10 02:32:33 millert Exp $ */ /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */ /* *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else ! static char rcsid[] = "$OpenBSD: man.c,v 1.16 2001/01/31 19:26:51 deraadt Exp $"; #endif #endif /* not lint */ --- 44,50 ---- #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else ! static char rcsid[] = "$OpenBSD: man.c,v 1.17 2001/04/10 02:32:33 millert Exp $"; #endif #endif /* not lint */ *************** *** 160,172 **** if (!*argv) usage(); ! if (!f_cat && !f_how && !f_where) if (!isatty(1)) f_cat = 1; else if ((pager = getenv("PAGER")) != NULL && (*pager != '\0')) pager = check_pager(pager); else pager = _PATH_PAGER; /* Read the configuration file. */ config(conffile); --- 160,173 ---- if (!*argv) usage(); ! if (!f_cat && !f_how && !f_where) { if (!isatty(1)) f_cat = 1; else if ((pager = getenv("PAGER")) != NULL && (*pager != '\0')) pager = check_pager(pager); else pager = _PATH_PAGER; + } /* Read the configuration file. */ config(conffile); *************** *** 253,259 **** /* * 3: If the user set the -m option, insert the user's list before * whatever list we have, again appending the _subdir list and ! * the machine. */ if (p_add != NULL) { e_sectp = NULL; --- 254,260 ---- /* * 3: If the user set the -m option, insert the user's list before * whatever list we have, again appending the _subdir list and ! * the machine. */ if (p_add != NULL) { e_sectp = NULL; *************** *** 269,275 **** err(1, NULL); /* puts it at the end, should be at the top, but then the added entries would be in reverse order, fix later when all are added*/ ! TAILQ_INSERT_TAIL(&defp->list, ep, q); if (e_sectp == NULL) /* save first added, to-be the new top */ e_sectp = ep; } --- 270,276 ---- err(1, NULL); /* puts it at the end, should be at the top, but then the added entries would be in reverse order, fix later when all are added*/ ! TAILQ_INSERT_TAIL(&defp->list, ep, q); if (e_sectp == NULL) /* save first added, to-be the new top */ e_sectp = ep; } *************** *** 279,285 **** defp->list.tqh_first = e_sectp; /* first added entry, new top */ *e_sectp->q.tqe_prev = NULL; /* terminate list */ } ! } /* * 4: If no -m was specified, and a section was, rewrite the section's * paths (if they have a trailing slash) to append the _subdir list --- 280,286 ---- defp->list.tqh_first = e_sectp; /* first added entry, new top */ *e_sectp->q.tqe_prev = NULL; /* terminate list */ } ! } /* * 4: If no -m was specified, and a section was, rewrite the section's * paths (if they have a trailing slash) to append the _subdir list *************** *** 353,363 **** for (ap = pg.gl_pathv; *ap != NULL; ++ap) { if (**ap == '\0') continue; ! (void)printf("%s\n", *ap); } exit(cleanup()); } ! /* * 8: We display things in a single command; build a list of things * to display. --- 354,364 ---- for (ap = pg.gl_pathv; *ap != NULL; ++ap) { if (**ap == '\0') continue; ! (void)puts(*ap); } exit(cleanup()); } ! /* * 8: We display things in a single command; build a list of things * to display. *************** *** 374,387 **** } p = cmd; len = strlen(pager); ! memmove(p, pager, len); p += len; *p++ = ' '; for (ap = pg.gl_pathv; *ap != NULL; ++ap) { if (**ap == '\0') continue; len = strlen(*ap); ! memmove(p, *ap, len); p += len; *p++ = ' '; } --- 375,388 ---- } p = cmd; len = strlen(pager); ! memcpy(p, pager, len); p += len; *p++ = ' '; for (ap = pg.gl_pathv; *ap != NULL; ++ap) { if (**ap == '\0') continue; len = strlen(*ap); ! memcpy(p, *ap, len); p += len; *p++ = ' '; } *************** *** 512,518 **** return (anyfound); } ! /* * build_page -- * Build a man page for display. */ --- 513,519 ---- return (anyfound); } ! /* * build_page -- * Build a man page for display. */ *************** *** 534,540 **** } /* ! * Historically man chdir'd to the root of the man tree. * This was used in man pages that contained relative ".so" * directives (including other man pages for command aliases etc.) * It even went one step farther, by examining the first line --- 535,541 ---- } /* ! * Historically man chdir'd to the root of the man tree. * This was used in man pages that contained relative ".so" * directives (including other man pages for command aliases etc.) * It even went one step farther, by examining the first line *************** *** 542,552 **** * make hard(?) links to the cat'ted man pages for space savings. * (We don't do that here, but we could). */ ! /* copy and find the end */ for (b = buf, p = *pathp; (*b++ = *p++) != '\0';) continue; ! /* skip the last two path components, page name and man[n] */ for (--b, n = 2; b != buf; b--) if (*b == '/') --- 543,553 ---- * make hard(?) links to the cat'ted man pages for space savings. * (We don't do that here, but we could). */ ! /* copy and find the end */ for (b = buf, p = *pathp; (*b++ = *p++) != '\0';) continue; ! /* skip the last two path components, page name and man[n] */ for (--b, n = 2; b != buf; b--) if (*b == '/') *************** *** 629,637 **** if (*buf == '\n') ++lcnt; else { ! for(; lcnt; --lcnt) (void)putchar('\n'); ! for (p = buf; isspace(*p); ++p); (void)fputs(p, stdout); } } --- 630,641 ---- if (*buf == '\n') ++lcnt; else { ! while (lcnt) { ! --lcnt; (void)putchar('\n'); ! } ! for (p = buf; isspace(*p); ++p) ! ; (void)fputs(p, stdout); } } *************** *** 680,686 **** /* * if the user uses "more", we make it "more -s"; watch out for ! * PAGER = "mypager /usr/ucb/more" */ for (p = name; *p && !isspace(*p); ++p) ; --- 684,690 ---- /* * if the user uses "more", we make it "more -s"; watch out for ! * PAGER = "mypager /usr/bin/more" */ for (p = name; *p && !isspace(*p); ++p) ; *************** *** 694,700 **** save = name; /* allocate space to add the "-s" */ if (!(name = ! malloc((u_int)(strlen(save) + 1 + sizeof("-s"))))) err(1, NULL); (void)sprintf(name, "%s %s", save, "-s"); } --- 698,704 ---- save = name; /* allocate space to add the "-s" */ if (!(name = ! malloc(strlen(save) + 1 + sizeof("-s")))) err(1, NULL); (void)sprintf(name, "%s %s", save, "-s"); } *************** *** 722,728 **** exit(1); } ! /* * onsig -- * If signaled, delete the temporary files. */ --- 726,732 ---- exit(1); } ! /* * onsig -- * If signaled, delete the temporary files. */