From b0f199cb124434e5f3d62397ec4b3ce3e040d3b5 Mon Sep 17 00:00:00 2001 From: maya Date: Mon, 6 Apr 2020 19:53:22 +0000 Subject: [PATCH] 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). --- usr.bin/man/man.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index cba36bc32353..25c4c2ba97a3 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -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!