Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).
This commit is contained in:
maya 2020-04-06 19:53:22 +00:00
parent d40c171347
commit b0f199cb12

View File

@ -1,4 +1,4 @@
/* $NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $ */
/* $NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
__RCSID("$NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $");
__RCSID("$NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $");
#endif
#endif /* not lint */
@ -363,8 +363,10 @@ main(int argc, char **argv)
}
if (m.getpath)
if (m.getpath) {
printmanpath(&m);
exit(cleanup());
}
/*
* now m.mymanpath is complete!