CVS commit: src/usr.bin/man

2022-06-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jun 19 18:51:06 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf.5: improve wording on searching alternate machine paths

As requested by uwe@. Hopefully this is clearer now.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-06-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jun 19 18:51:06 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf.5: improve wording on searching alternate machine paths

As requested by uwe@. Hopefully this is clearer now.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.conf.5
diff -u src/usr.bin/man/man.conf.5:1.29 src/usr.bin/man/man.conf.5:1.30
--- src/usr.bin/man/man.conf.5:1.29	Sat Jun 18 13:41:12 2022
+++ src/usr.bin/man/man.conf.5	Sun Jun 19 18:51:06 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: man.conf.5,v 1.29 2022/06/18 13:41:12 uwe Exp $
+.\"	$NetBSD: man.conf.5,v 1.30 2022/06/19 18:51:06 gutteridge Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -170,11 +170,11 @@ Defines additional paths to be searched 
 hardware name whose literal value is taken from
 .Xr uname 1
 .Fl m .
-For example on an amd64,
+For example, on an amd64, the
 .Ic _amd64
 control keyword is used, where
 .Ql x86
-is commonly supplied as an alternate machine path to also search.
+is supplied by default as an alternate machine path to also search.
 .El
 .Pp
 Section configuration lines in



CVS commit: src/usr.bin/man

2022-06-18 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jun 18 13:41:12 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf(5): Tweak formatting for prettier PS output.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.conf.5
diff -u src/usr.bin/man/man.conf.5:1.28 src/usr.bin/man/man.conf.5:1.29
--- src/usr.bin/man/man.conf.5:1.28	Sat Jun 18 02:19:07 2022
+++ src/usr.bin/man/man.conf.5	Sat Jun 18 13:41:12 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: man.conf.5,v 1.28 2022/06/18 02:19:07 gutteridge Exp $
+.\"	$NetBSD: man.conf.5,v 1.29 2022/06/18 13:41:12 uwe Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -64,14 +64,14 @@ section subdirectory contains unformatte
 and
 .Xr mdoc 7 ) .
 Formatted manual pages are normally named with a trailing
-.Dq \.0
+.Ql \&.0
 suffix.
 .Pp
 The
 .Nm
 file contains comment and configuration lines.
 Comment lines start with the
-.Dq #
+.Ql #
 character.
 Blank lines are also treated as comment lines.
 Configuration lines consist of a configuration keyword followed by a
@@ -79,31 +79,37 @@ configuration string.
 There are two types of configuration keywords: control keywords and
 section keywords.
 Control keywords must start with the
-.Dq _
+.Ql _
 character.
 The following control keywords are currently defined:
-.Bl -tag -width XXmachineX
-.It _build
+.Bl -tag -width Ic
+.It Ic _build
 Identifies the set of suffixes used for manual pages that must be
 formatted for display and the command that should be used to format
 them.
 Manual file names, regardless of their format, are expected to end in a
-.Dq \.*
+.Dq \&.*
 pattern, i.e. a
-.Dq \&\.
+.Ql \&.
 followed by some suffix.
-The first field of a _build line contains a man page suffix specification.
+The first field of a
+.Ic _build
+line contains a man page suffix specification.
 The suffix specification may contain the normal shell globbing characters
-(NOT including curly braces
-.Pq Dq {} ) .
-The rest of the _build line is a shell command line whose standard
+.Po
+.Em not
+including csh-style curly braces
+.Pc .
+The rest of the
+.Ic _build
+line is a shell command line whose standard
 output is a formatted manual page that can be directly displayed to
 the user.
 There should be exactly one occurrence of the string
-.Dq %s
+.Ql %s
 in the shell command line, and it will
 be replaced by the name of the file which is being formatted.
-.It _crunch
+.It Ic _crunch
 Used by
 .Xr catman 8
 to determine how to crunch formatted pages
@@ -113,29 +119,27 @@ used to compress the man page.
 The rest of the line must be a shell command line, used to compress the
 formatted pages.
 There should be exactly one occurrence of the string
-.Dq %s
+.Ql %s
 in the shell command line, and it will
 be replaced by the name of the output file.
-.It _default
+.It Ic _default
 Contains the system-wide default man path used to search for man pages.
-.It _mandb
+.It Ic _mandb
 Defines the full pathname (not just a directory path) for a database to
-be used
-by the
+be used by the
 .Xr apropos 1
 and
 .Xr whatis 1
 commands.
 The pathname may contain the normal shell globbing characters,
-including curly braces
-.Pq Dq {} ;
+including csh-style curly braces;
 to escape a shell globbing character,
 precede it with a backslash
-.Pq Dq \e .
-.It _subdir
+.Pq Ql \e .
+.It Ic _subdir
 Contains the list (in search order) of section subdirectories which will
 be searched in any man path directory named with a trailing slash
-.Pq Dq /
+.Pq Ql /
 character.
 This list is also used, even if there is no trailing slash character,
 when a path is specified to the
@@ -147,28 +151,29 @@ environment variable, or by the
 and
 .Fl m
 options.
-.It _suffix
+.It Ic _suffix
 identifies the set of suffixes used for formatted man pages
 (the
-.Dq \.0
+.Ql \&.0
 suffix is normally used here).
 Formatted man pages can be directly displayed to the user.
-Each suffix may contain the normal shell globbing characters (NOT
-including curly braces
-.Pq Dq {} ) .
-.It _version
+Each suffix may contain the normal shell globbing characters
+.Po
+.Em not
+including csh-style curly braces
+.Pc .
+.It Ic _version
 Contains the version of the configuration file.
-.It _ Ns Aq machine
+.It Ic _ Ns Aq Ar machine
 Defines additional paths to be searched for the particular
-.Dv machine
+.Ar machine
 hardware name whose literal value is taken from
 .Xr uname 1
 .Fl m .
-For example on an
-.Dv amd64 ,
-.Dv _amd64
-is used, where
-.Dq x86
+For example on an amd64,
+.Ic _amd64
+control keyword is used, where
+.Ql x86
 is commonly supplied as an alternate machine path to also search.
 .El
 .Pp
@@ -178,13 +183,12 @@ consist of a section keyword naming the 
 string that defines the directory or 

CVS commit: src/usr.bin/man

2022-06-18 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jun 18 13:41:12 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf(5): Tweak formatting for prettier PS output.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/man

2022-06-18 Thread Valery Ushakov
On Sat, Jun 18, 2022 at 02:19:07 +, David H. Gutteridge wrote:

> Module Name:  src
> Committed By: gutteridge
> Date: Sat Jun 18 02:19:07 UTC 2022
> 
> Modified Files:
>   src/usr.bin/man: man.conf.5
> 
> Log Message:
> man.conf.5: add details about the machine line and search order
> 
> Also, tweak some grammar, style, and markup while here.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.27 -r1.28 src/usr.bin/man/man.conf.5

Please, could you rephrase the bit about the _ keyword.  It
is not quite clear on the first reading which is the keyword and which
is the value (epecially in text output where formatting (wrong anyway
:) doesn't provide a hint).  Using "value" to talk about the keyword
doesn't help too.  Also, "commonly" in the added phrase is misleading
I'd say.  Commonly implies "not always", which is false - we suppply
x86 as an extra subdir in the default man.conf.  I know that passage
was not very clear to begin with, but you touch it you buy it :).

Not being a native speaker I don't dare touching it, I'm afraid to
make more mess.

TIA!

-uwe


CVS commit: src/usr.bin/man

2022-06-17 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun 18 02:19:07 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf.5: add details about the machine line and search order

Also, tweak some grammar, style, and markup while here.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.conf.5
diff -u src/usr.bin/man/man.conf.5:1.27 src/usr.bin/man/man.conf.5:1.28
--- src/usr.bin/man/man.conf.5:1.27	Thu Jun 16 15:11:43 2016
+++ src/usr.bin/man/man.conf.5	Sat Jun 18 02:19:07 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: man.conf.5,v 1.27 2016/06/16 15:11:43 abhinav Exp $
+.\"	$NetBSD: man.conf.5,v 1.28 2022/06/18 02:19:07 gutteridge Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)man.conf.5	8.5 (Berkeley) 1/2/94
 .\"
-.Dd June 16, 2016
+.Dd June 18, 2022
 .Dt MAN.CONF 5
 .Os
 .Sh NAME
@@ -45,8 +45,9 @@ file contains the default configuration 
 .Xr catman 8 ,
 and
 .Xr makemandb 8
-to find manual pages and information about manual pages (e.g. the
-whatis database).
+to find manual pages and information about manual pages (e.g., the
+.Xr whatis 1
+database).
 .Pp
 Manual pages are located by searching an ordered set of directories
 called the
@@ -106,8 +107,9 @@ be replaced by the name of the file whic
 Used by
 .Xr catman 8
 to determine how to crunch formatted pages
-which originally were compressed man pages: The first field lists a suffix
-which indicates what kind of compression were used to compress the man page.
+which originally were compressed man pages.
+The first field lists a suffix which indicates what kind of compression was
+used to compress the man page.
 The rest of the line must be a shell command line, used to compress the
 formatted pages.
 There should be exactly one occurrence of the string
@@ -159,13 +161,15 @@ Contains the version of the configuratio
 .It _ Ns Aq machine
 Defines additional paths to be searched for the particular
 .Dv machine
-whose literal value is taken from
+hardware name whose literal value is taken from
 .Xr uname 1
 .Fl m .
 For example on an
 .Dv amd64 ,
 .Dv _amd64
-is used.
+is used, where
+.Dq x86
+is commonly supplied as an alternate machine path to also search.
 .El
 .Pp
 Section configuration lines in
@@ -184,7 +188,7 @@ Section keywords must not start with the
 character.
 .Pp
 A section path may contain either a list of absolute directories or
-a list of or relative directories (but not both).
+a list of relative directories (but not both).
 Relative directory paths are treated as a list of subdirectories that
 are appended to the current man path directory being searched.
 Section configuration lines with absolute directory paths (starting with
@@ -206,7 +210,8 @@ In addition to the above rules, the
 .Xr man 1
 command also always checks in each directory that it searches for
 a subdirectory with the same name as the current machine type.
-If the machine-specific directory is found, it is also searched.
+If a machine-specific subdirectory is found, it is also searched
+before the parent directory is.
 This allows the manual to contain machine-specific man pages.
 Note that the machine subdirectory does not need to be specified
 in the



CVS commit: src/usr.bin/man

2022-06-17 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun 18 02:19:07 UTC 2022

Modified Files:
src/usr.bin/man: man.conf.5

Log Message:
man.conf.5: add details about the machine line and search order

Also, tweak some grammar, style, and markup while here.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/man/man.conf.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-06-17 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun 18 02:14:39 UTC 2022

Modified Files:
src/usr.bin/man: man.1

Log Message:
man.1: add a small note about alternate machine name searches


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/man/man.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-06-17 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Jun 18 02:14:39 UTC 2022

Modified Files:
src/usr.bin/man: man.1

Log Message:
man.1: add a small note about alternate machine name searches


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/man/man.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.1
diff -u src/usr.bin/man/man.1:1.29 src/usr.bin/man/man.1:1.30
--- src/usr.bin/man/man.1:1.29	Thu Jun 16 15:10:58 2016
+++ src/usr.bin/man/man.1	Sat Jun 18 02:14:39 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: man.1,v 1.29 2016/06/16 15:10:58 abhinav Exp $
+.\"	$NetBSD: man.1,v 1.30 2022/06/18 02:14:39 gutteridge Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)man.1	8.2 (Berkeley) 1/2/94
 .\"
-.Dd June 16, 2016
+.Dd June 18, 2022
 .Dt MAN 1
 .Os
 .Sh NAME
@@ -213,7 +213,7 @@ As some man pages are intended only for 
 searches any subdirectories,
 with the same name as the current architecture,
 in every directory which it searches.
-Machine specific areas are checked before general areas.
+Machine-specific areas are checked before general areas.
 The current machine type may be overridden by setting the environment
 variable
 .Ev MACHINE
@@ -222,6 +222,12 @@ Machine-specific man pages may also be r
 prepending the relevant subdirectory name to the page name,
 separated by
 .Ql Pa \&/ .
+(See also the
+.Dq _ Ns Aq machine
+line in the
+.Xr man.conf 5
+configuration file, which defines additional supplemental paths related to a
+specific machine type.)
 .It Ev MANPATH
 The standard search path used by
 .Nm
@@ -235,7 +241,7 @@ The subdirectories to be searched as wel
 is specified by the
 .Dq _subdir
 line in the
-.Nm
+.Xr man.conf 5
 configuration file.
 .It Ev PAGER
 The pagination command used for writing the output.



CVS commit: src/usr.bin/man

2022-05-09 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 10 00:42:00 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man.c: minor KNF


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.72 src/usr.bin/man/man.c:1.73
--- src/usr.bin/man/man.c:1.72	Tue Mar  8 23:13:05 2022
+++ src/usr.bin/man/man.c	Tue May 10 00:42:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.72 2022/03/08 23:13:05 rillig Exp $	*/
+/*	$NetBSD: man.c,v 1.73 2022/05/10 00:42:00 gutteridge Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.72 2022/03/08 23:13:05 rillig Exp $");
+__RCSID("$NetBSD: man.c,v 1.73 2022/05/10 00:42:00 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -932,7 +932,7 @@ check_pager(const char *name)
 		++p;
 
 	/* make sure it's "more", not "morex" */
-	if (!strncmp(p, "more", 4) && (!p[4] || isspace((unsigned char)p[4]))){
+	if (!strncmp(p, "more", 4) && (!p[4] || isspace((unsigned char)p[4]))) {
 		char *newname;
 		(void)asprintf(, "%s %s", p, "-s");
 		name = newname;



CVS commit: src/usr.bin/man

2022-05-09 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May 10 00:42:00 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man.c: minor KNF


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/man

2022-03-10 Thread Roland Illig

Am 10.03.2022 um 22:48 schrieb David H. Gutteridge:

Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:13:05 UTC 2022

Modified Files:
 src/usr.bin/man: man.c

Log Message:
man: remove unused global variable 'instype' (since yesterday)

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


Hi Roland,

Hardly the most pressing concern for us to discuss, but, the reason I'd
defined that global variable is because that's how NetBSD's "style"
document shows it's done in its enum example. I didn't think that was
necessary here, but took the "style" example literally.


Hi Dave,

I agree that taking the "style" example literally could lead to this
code, thank you for explaining how you arrived with this code.  In fact,
when I first saw your code I didn't realize that 'instype' was a
variable, I thought it would be a typedef name.  Only when I tried to
remove this unused name, the generated binary changed, which made me
cautious.

To avoid future misinterpretation, I fixed the enum example in
share/misc/style.


As for the other change you made (enum vs. int), I guess that's just bad
style on my part. I don't really work in C anymore, but when I did, in
my context, we treated enum and int as being interchangable. Good to
know.


I changed the parameter type from int to enum because this enables
stricter checks in the compilers and in lint.  They would report a
mismatch of enum types then.  The enum check in lint is not enabled by
default though, but still it is there (LINTFLAGS+= -e in the Makefile).

For usr.bin/man, there aren't many enum constants that could be
confused, but in other programs like usr.bin/make there are really many
of them, and 2 years ago there were even enum constants from different
types that used the same prefix "VAR_", which increased the confusion.
That's the reason that I prefer to be as specific with enum types as
possible.

Another benefit is that using 'enum' (or 'bool') instead of 'int'
communicates the purpose of the variable more precisely to human
readers, and I like this extra bit of precision.

Regards,
Roland


Re: CVS commit: src/usr.bin/man

2022-03-10 Thread David H. Gutteridge
> Module Name:src
> Committed By:   rillig
> Date:   Tue Mar  8 23:13:05 UTC 2022
> 
> Modified Files:
> src/usr.bin/man: man.c
> 
> Log Message:
> man: remove unused global variable 'instype' (since yesterday)
> 
> No functional change.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.71 -r1.72 src/usr.bin/man/man.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.

Hi Roland,

Hardly the most pressing concern for us to discuss, but, the reason I'd
defined that global variable is because that's how NetBSD's "style"
document shows it's done in its enum example. I didn't think that was
necessary here, but took the "style" example literally.

As for the other change you made (enum vs. int), I guess that's just bad
style on my part. I don't really work in C anymore, but when I did, in
my context, we treated enum and int as being interchangable. Good to
know.

Regards,

Dave



CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:13:05 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man: remove unused global variable 'instype' (since yesterday)

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.71 src/usr.bin/man/man.c:1.72
--- src/usr.bin/man/man.c:1.71	Tue Mar  8 23:09:36 2022
+++ src/usr.bin/man/man.c	Tue Mar  8 23:13:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.71 2022/03/08 23:09:36 rillig Exp $	*/
+/*	$NetBSD: man.c,v 1.72 2022/03/08 23:13:05 rillig Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.71 2022/03/08 23:09:36 rillig Exp $");
+__RCSID("$NetBSD: man.c,v 1.72 2022/03/08 23:13:05 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,7 @@ __RCSID("$NetBSD: man.c,v 1.71 2022/03/0
 enum inserttype {
 	INS_TAIL,
 	INS_HEAD
-} instype;
+};
 
 /*
  * manstate: structure collecting the current global state so we can



CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:13:05 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man: remove unused global variable 'instype' (since yesterday)

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:09:36 UTC 2022

Modified Files:
src/usr.bin/man: man.c manconf.h

Log Message:
man: remove trailing whitespace

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/man/man.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/man/manconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.70 src/usr.bin/man/man.c:1.71
--- src/usr.bin/man/man.c:1.70	Tue Mar  8 23:05:32 2022
+++ src/usr.bin/man/man.c	Tue Mar  8 23:09:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.70 2022/03/08 23:05:32 rillig Exp $	*/
+/*	$NetBSD: man.c,v 1.71 2022/03/08 23:09:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.70 2022/03/08 23:05:32 rillig Exp $");
+__RCSID("$NetBSD: man.c,v 1.71 2022/03/08 23:09:36 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -75,7 +75,7 @@ enum inserttype {
 } instype;
 
 /*
- * manstate: structure collecting the current global state so we can 
+ * manstate: structure collecting the current global state so we can
  * easily identify it and pass it to helper functions in one arg.
  */
 struct manstate {
@@ -90,13 +90,13 @@ struct manstate {
 	char *sectionname;	/* -s: limit search to a given man section */
 	int where;		/* -w: just show paths of all matching files */
 	int getpath;	/* -p: print the path of directories containing man pages */
-		
+
 	/* important tags from the config file */
 	TAG *defaultpath;	/* _default: default MANPATH */
 	TAG *subdirs;		/* _subdir: default subdir search list */
 	TAG *suffixlist;	/* _suffix: for files that can be cat()'d */
 	TAG *buildlist;		/* _build: for files that must be built */
-	
+
 	/* tags for internal use */
 	TAG *intmp;		/* _intmp: tmp files we must cleanup */
 	TAG *missinglist;	/* _missing: pages we couldn't find */
@@ -246,8 +246,8 @@ main(int argc, char **argv)
 			argc--;
 		}
 
-	} 
-	
+	}
+
 	if (m.manpath == NULL)
 		m.manpath = getenv("MANPATH"); /* note: -M overrides getenv */
 
@@ -261,7 +261,7 @@ main(int argc, char **argv)
 	m.defaultpath = gettag("_default", 1);
 	m.subdirs = gettag("_subdir", 1);
 	m.suffixlist = gettag("_suffix", 1);
-	m.buildlist = gettag("_build", 1); 
+	m.buildlist = gettag("_build", 1);
 	/* internal use */
 	m.mymanpath = gettag("_new_path", 1);
 	m.missinglist = gettag("_missing", 1);
@@ -276,7 +276,7 @@ main(int argc, char **argv)
 	 * as config() will ensure that any additional entries will match
 	 * the first one.)
 	 */
-	abs_section = (m.section != NULL && 
+	abs_section = (m.section != NULL &&
 		!TAILQ_EMPTY(>entrylist) &&
 			*(TAILQ_FIRST(>entrylist)->s) == '/');
 
@@ -297,7 +297,7 @@ main(int argc, char **argv)
 
 	/*
 	 * [2] section can now only be non-null if the user asked for
-	 * a section and that section's elements did not have 
+	 * a section and that section's elements did not have
 	 * absolute paths.  in this case we use the section's
 	 * elements to override _subdir from the config file.
 	 *
@@ -312,10 +312,10 @@ main(int argc, char **argv)
 	 * go with the default.   in either case we need to append
 	 * the subdir and machine spec to each element of the path.
 	 *
-	 * for absolute section paths that come from the config file, 
-	 * we only append the subdir spec if the path ends in 
-	 * a '/' --- elements that do not end in '/' are assumed to 
-	 * not have subdirectories.  this is mainly for backward compat, 
+	 * for absolute section paths that come from the config file,
+	 * we only append the subdir spec if the path ends in
+	 * a '/' --- elements that do not end in '/' are assumed to
+	 * not have subdirectories.  this is mainly for backward compat,
 	 * but it allows non-subdir configs like:
 	 *	sect3   /usr/share/man/{old/,}cat3
 	 *	doc /usr/{pkg,share}/doc/{sendmail/op,sendmail/intro}
@@ -352,9 +352,9 @@ main(int argc, char **argv)
 	}
 
 	/*
-	 * [4] finally, prepend the "-m" m.addpath to mymanpath if it 
+	 * [4] finally, prepend the "-m" m.addpath to mymanpath if it
 	 * was specified.   subdirs and machine are always applied to
-	 * m.addpath. 
+	 * m.addpath.
 	 */
 	if (m.addpath) {
 
@@ -373,7 +373,7 @@ main(int argc, char **argv)
 		printmanpath();
 		exit(cleanup());
 	}
-		
+
 	/*
 	 * now m.mymanpath is complete!
 	 */
@@ -385,8 +385,8 @@ main(int argc, char **argv)
 #endif
 
 	/*
-	 * start searching for matching files and format them if necessary.   
-	 * setup an interrupt handler so that we can ensure that temporary 
+	 * start searching for matching files and format them if necessary.
+	 * setup an interrupt handler so that we can ensure that 

CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:09:36 UTC 2022

Modified Files:
src/usr.bin/man: man.c manconf.h

Log Message:
man: remove trailing whitespace

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/man/man.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/man/manconf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:05:32 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man: fix type mismatch between enum and int (since yesterday)

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.69 src/usr.bin/man/man.c:1.70
--- src/usr.bin/man/man.c:1.69	Mon Mar  7 22:43:39 2022
+++ src/usr.bin/man/man.c	Tue Mar  8 23:05:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.69 2022/03/07 22:43:39 gutteridge Exp $	*/
+/*	$NetBSD: man.c,v 1.70 2022/03/08 23:05:32 rillig Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.69 2022/03/07 22:43:39 gutteridge Exp $");
+__RCSID("$NetBSD: man.c,v 1.70 2022/03/08 23:05:32 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -122,7 +122,8 @@ static void	 jump(char **, const char *,
 static int	 manual(char *, struct manstate *, glob_t *);
 static void	 onsig(int) __dead;
 static void	 usage(void) __dead;
-static void	 addpath(struct manstate *, const char *, size_t, const char *, int);
+static void	 addpath(struct manstate *, const char *, size_t, const char *,
+		 enum inserttype);
 static const char *getclass(const char *);
 static void printmanpath(struct manstate *);
 
@@ -1018,14 +1019,14 @@ getclass(const char *machine)
 
 static void
 addpath(struct manstate *m, const char *dir, size_t len, const char *sub,
-	int ishead)
+	enum inserttype ishead)
 {
 	char buf[2 * MAXPATHLEN + 1];
 	(void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,%s%s%s}",
 	 dir, (dir[len - 1] == '/') ? "" : "/", sub, m->machine,
 	 m->machclass ? "/" : "", m->machclass ? m->machclass : "",
 	 m->machclass ? "," : "");
-	if (addentry(m->mymanpath, buf, ishead) < 0)
+	if (addentry(m->mymanpath, buf, (int)ishead) < 0)
 		errx(EXIT_FAILURE, "malloc failed");
 }
 



CVS commit: src/usr.bin/man

2022-03-08 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Mar  8 23:05:32 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man: fix type mismatch between enum and int (since yesterday)

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/man

2022-03-07 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Mon Mar  7 22:43:39 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man.c: fix -m option so it works as documented

Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.68 src/usr.bin/man/man.c:1.69
--- src/usr.bin/man/man.c:1.68	Mon Apr  6 19:53:22 2020
+++ src/usr.bin/man/man.c	Mon Mar  7 22:43:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $	*/
+/*	$NetBSD: man.c,v 1.69 2022/03/07 22:43:39 gutteridge Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $");
+__RCSID("$NetBSD: man.c,v 1.69 2022/03/07 22:43:39 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -69,6 +69,11 @@ __RCSID("$NetBSD: man.c,v 1.68 2020/04/0
 #define MAN_DEBUG 0		/* debug path output */
 #endif
 
+enum inserttype {
+	INS_TAIL,
+	INS_HEAD
+} instype;
+
 /*
  * manstate: structure collecting the current global state so we can 
  * easily identify it and pass it to helper functions in one arg.
@@ -117,7 +122,7 @@ static void	 jump(char **, const char *,
 static int	 manual(char *, struct manstate *, glob_t *);
 static void	 onsig(int) __dead;
 static void	 usage(void) __dead;
-static void	 addpath(struct manstate *, const char *, size_t, const char *);
+static void	 addpath(struct manstate *, const char *, size_t, const char *, int);
 static const char *getclass(const char *);
 static void printmanpath(struct manstate *);
 
@@ -327,7 +332,7 @@ main(int argc, char **argv)
 			if (len < 1)
 continue;
 			TAILQ_FOREACH(esubd, >entrylist, q)
-addpath(, p, len, esubd->s);
+addpath(, p, len, esubd->s, INS_TAIL);
 		}
 
 	} else {
@@ -335,12 +340,12 @@ main(int argc, char **argv)
 		TAILQ_FOREACH(epath, >entrylist, q) {
 			/* handle trailing "/" magic here ... */
 		  	if (abs_section && epath->s[epath->len - 1] != '/') {
-addpath(, "", 1, epath->s);
+addpath(, "", 1, epath->s, INS_TAIL);
 continue;
 			}
 
 			TAILQ_FOREACH(esubd, >entrylist, q)
-addpath(, epath->s, epath->len, esubd->s);
+addpath(, epath->s, epath->len, esubd->s, INS_TAIL);
 		}
 
 	}
@@ -358,7 +363,7 @@ main(int argc, char **argv)
 			if (len < 1)
 continue;
 			TAILQ_FOREACH(esubd, >entrylist, q)
-addpath(, p, len, esubd->s);
+addpath(, p, len, esubd->s, INS_HEAD); /* Add to front */
 		}
 
 	}
@@ -1012,14 +1017,15 @@ getclass(const char *machine)
 }
 
 static void
-addpath(struct manstate *m, const char *dir, size_t len, const char *sub)
+addpath(struct manstate *m, const char *dir, size_t len, const char *sub,
+	int ishead)
 {
 	char buf[2 * MAXPATHLEN + 1];
 	(void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,%s%s%s}",
 	 dir, (dir[len - 1] == '/') ? "" : "/", sub, m->machine,
 	 m->machclass ? "/" : "", m->machclass ? m->machclass : "",
 	 m->machclass ? "," : "");
-	if (addentry(m->mymanpath, buf, 0) < 0)
+	if (addentry(m->mymanpath, buf, ishead) < 0)
 		errx(EXIT_FAILURE, "malloc failed");
 }
 



CVS commit: src/usr.bin/man

2022-03-07 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Mon Mar  7 22:43:39 UTC 2022

Modified Files:
src/usr.bin/man: man.c

Log Message:
man.c: fix -m option so it works as documented

Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/usr.bin/man

2014-08-14 Thread matthew green

Alan Barrett writes:
 Module Name:  src
 Committed By: apb
 Date: Thu Aug 14 15:31:12 UTC 2014
 
 Modified Files:
   src/usr.bin/man: man.c
 
 Log Message:
 For an argument to be interpreted as a local file name, bypassing the
 search rules in man.conf or MANPATH, it must begin with /, ./, or
 ../.  Simply testing whether it contains / is wrong, because it
 breaks usage like man 8 vax/boot.
 
 This reverts revision 1.57 dated 2013-10-06,
 Be more permissive in interpreting man pages as filenames.

what about trying to stat() it and use it, as a last resort?
it's always kind of bothered me man file.1 doesn't work,
and the ./ workaround always seems sleezy.


.mrg.


Re: CVS commit: src/usr.bin/man

2013-07-18 Thread Valery Ushakov
On Thu, Jul 18, 2013 at 11:39:08 -0400, Christos Zoulas wrote:

 - fix cast qual issues

Do you really need EMPTY hack?  Why not just (untested)

- pg-gl_pathv[cnt] = ;
+ *pg-gl_pathv[cnt] = '\0';

-uwe


Re: CVS commit: src/usr.bin/man

2013-07-18 Thread Valery Ushakov
On Thu, Jul 18, 2013 at 11:39:08 -0400, Christos Zoulas wrote:

 - don't use snprintf on a user-provided buffer

This:

- (void)snprintf(buf, sizeof(buf), fmt, escpage, suffix-s);
+ fixstring(buf, sizeof(buf), fmt, escpage);

seems wrong, as it loses suffix-s, doesn't it?

And fixstring is a terrible name.

-uwe