cwm.1: use key names from /usr/X11R6/include/X11/keysymdef.h

2017-07-20 Thread Michael Reed

While trying to unbind C-/ in cwm, it took me a while to realize
that you can't do "unbind-key C-/", as the key "/" is not defined
in /usr/X11R6/include/X11/keysymdef.h.

Instead you must do "unbind-key C-slash", as "slash" is defined
there.

Considering this, I think that the cwm man page is misleading,
as it does not use key names from keysymdef.h.  The following
patch fixes that.



diff --git a/app/cwm/cwm.1 b/app/cwm/cwm.1
index 2fc12e4f..ba21776e 100644
--- a/app/cwm/cwm.1
+++ b/app/cwm/cwm.1
@@ -83,9 +83,9 @@ Hide current window.
 Lower current window.
 .It Ic M-Up
 Raise current window.
-.It Ic M-/
+.It Ic M-slash
 Search for windows.
-.It Ic C-/
+.It Ic C-slash
 Search for applications.
 .It Ic CM-n
 Label current window.
@@ -113,9 +113,9 @@ Toggle stickiness of current window.
 Toggle full-screen mode of current window.
 .It Ic CM-m
 Toggle maximization of current window.
-.It Ic CM-=
+.It Ic CM-equal
 Toggle vertical maximization of current window.
-.It Ic CMS-=
+.It Ic CMS-equal
 Toggle horizontal maximization of current window.
 .It Ic M-[hjkl]
 Move window by a small amount.
@@ -127,11 +127,11 @@ Resize window by a small amount.
 .It Ic CMS-[hjkl]
 Resize window by a large amount; see
 .Xr cwmrc 5 .
-.It Ic M-?
+.It Ic M-question
 Spawn
 .Dq exec program
 dialog.
-.It Ic M-.
+.It Ic M-period
 Spawn
 .Dq ssh to
 dialog.



airport.7: mandoc -Tlint fixes

2017-05-30 Thread Michael Reed

Hi,

The new airport.7 has a few small formatting issues as determined
by `mandoc -Tlint`. This diff fixes them.




Index: airport.7
===
RCS file: /cvs/src/share/man/man7/airport.7,v
retrieving revision 1.1
diff -u -p -r1.1 airport.7
--- airport.7   28 May 2017 19:26:33 -  1.1
+++ airport.7   30 May 2017 17:19:02 -
@@ -1,6 +1,5 @@
 .\"$OpenBSD: airport.7,v 1.1 2017/05/28 19:26:33 benno Exp $
 .\"
-
 .\" Copyright (c) 2017 Sebastian Benoit.
 .\" All rights reserved.
 .\"
@@ -40,14 +39,14 @@ The list is not a complete list of all I
 New airports can only be added by
 .Ox
 developers who have visited an airport and thereby have verified its 
existence.

-.Sh CAVEATS
-There are also railway stations with IATA codes.
-These may not be listed, except if someone landed there by plane and
-survived to update the file.
-.Sh STANDARDS
-.Lk http://www.iata.org/codes
-.%T Airline and Airport Code Search
 .Sh FILES
 .Bl -tag -width /usr/share/misc/airport -compact
 .It Pa /usr/share/misc/airport
 .El
+.Sh STANDARDS
+.Lk http://www.iata.org/codes
+.%T Airline and Airport Code Search
+.Sh CAVEATS
+There are also railway stations with IATA codes.
+These may not be listed, except if someone landed there by plane and
+survived to update the file.



operator.7: Remove ref to nonexistant FILES

2017-05-30 Thread Michael Reed

Hi,

Per [1], /usr/share/misc/operator no longer exists, so
there's no need to reference it.

[1]: 
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/share/misc/Attic/operator




Index: operator.7
===
RCS file: /cvs/src/share/man/man7/operator.7,v
retrieving revision 1.9
diff -u -p -r1.9 operator.7
--- operator.7  3 Sep 2011 22:59:07 -   1.9
+++ operator.7  30 May 2017 17:17:46 -
@@ -58,7 +58,3 @@
 .It "\&," Ta "left to right"
 .El
 .Ed
-.Sh FILES
-.Bl -tag -width /usr/share/misc/operator -compact
-.It Pa /usr/share/misc/operator
-.El



faq13.html: clarify cd burning instructions

2017-03-18 Thread Michael Reed

That way you don't do what I did and read through half the
"Creating data CD-ROMs" section before realizing you're reading
the wrong section. :)


diff --git a/faq/faq13.html b/faq/faq13.html
index 6f94803..28d04b9 100644
--- a/faq/faq13.html
+++ b/faq/faq13.html
@@ -615,6 +615,9 @@ copying files to your hard disk.
 
 Writing CDs
 
+We can create either a data CD for storage of arbitrary data, or an audio

+CD for use with a CD player.
+
 Creating data CD-ROMs
 
 First, you will want to create an ISO 9660 filesystem to put on a CD-ROM.




cwmrc(5) small cleanup

2017-03-18 Thread Michael Reed

The signatures for the functions bind-key and bind-mouse do
not match how they are used.



diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5
index fbecaedb..1da9c08c 100644
--- a/app/cwm/cwmrc.5
+++ b/app/cwm/cwmrc.5
@@ -63,7 +63,7 @@ The name and class values, respectively, for existing windows
 are both set in the WM_CLASS property and may be obtained using
 .Xr xprop 1 .
 .Pp
-.It Ic bind-key Ar key function
+.It Ic bind-key Ar key Ns - Ns Ar function
 Bind or rebind key
 .Ar key
 to
@@ -92,7 +92,7 @@ may either be one from the
 .Sx BIND FUNCTION LIST
 (see below) or the command line that is to be executed.
 .Pp
-.It Ic bind-mouse Ar button function
+.It Ic bind-mouse Ar button Ns - Ns Ar function
 Bind or rebind button
 .Ar button
 to
@@ -245,7 +245,6 @@ A special
 keyword
 .Dq all
 can be used to unbind all buttons.
-.Pp
 .El
 .Sh BIND FUNCTION LIST
 .Bl -tag -width 23n -compact



cdio: don't print message about "file not multiple of block length"

2017-03-18 Thread Michael Reed

It seems as if cdio copes fine regardless of whether the file
is a multiple of the block length, so is it really so important
that the message is printed unconditionally?

This patch makes it so that the "-v" flag must be used at least
once for that warning to print.



diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c
index 2866d8050..af07ae391 100644
--- a/usr.bin/cdio/mmc.c
+++ b/usr.bin/cdio/mmc.c
@@ -467,8 +467,10 @@ writetrack(struct track_info *tr, int track)
return (-1);
}
if (tr->sz % tr->blklen) {
-   warnx("file %s is not multiple of block length %d",
-   tr->file, tr->blklen);
+   if (verbose > 1) {
+   warnx("file %s is not multiple of block length %d",
+   tr->file, tr->blklen);
+   }
end_lba = tr->sz / tr->blklen + lba + 1;
} else {
end_lba = tr->sz / tr->blklen + lba;



cdio(1): introduce acronym on first use

2017-03-18 Thread Michael Reed

That way the user doesn't have to scroll through the
man page to find what it stands for.

On a side note, googling for "tao cd" is not helpful,
but googling "track at once" is.



diff --git a/usr.bin/cdio/cdio.1 b/usr.bin/cdio/cdio.1
index ff350ca8f..900449b0a 100644
--- a/usr.bin/cdio/cdio.1
+++ b/usr.bin/cdio/cdio.1
@@ -45,7 +45,7 @@
 The
 .Nm
 program is a compact disc control utility,
-with support for playing audio CDs and TAO CD writing.
+with support for playing audio CDs and track-at-once (TAO) CD writing.
 .Pp
 If no command is given,
 .Nm



Fix wxabort refs in mmap and mprotect man pages

2017-03-10 Thread Michael Reed

The sysctl(3) man page does not seem to contain anything about kern.exabort.
While here, also use proper .Xr markup.


Index: mmap.2
===
RCS file: /cvs/src/lib/libc/sys/mmap.2,v
retrieving revision 1.52
diff -u -p -r1.52 mmap.2
--- mmap.2  27 May 2016 19:45:04 -  1.52
+++ mmap.2  11 Mar 2017 00:58:46 -
@@ -281,7 +281,8 @@ In particular,
 .Dv PROT_WRITE | PROT_EXEC
 mappings are not permitted in most binaries (see
 .Dv kern.wxabort
-in sysctl 3
+in
+.Xr sysctl 8
 for more information).
 .El
 .Sh SEE ALSO
Index: mprotect.2
===
RCS file: /cvs/src/lib/libc/sys/mprotect.2,v
retrieving revision 1.20
diff -u -p -r1.20 mprotect.2
--- mprotect.2  27 May 2016 19:45:04 -  1.20
+++ mprotect.2  11 Mar 2017 00:58:46 -
@@ -104,7 +104,8 @@ In particular,
 .Dv PROT_WRITE | PROT_EXEC
 mappings are not permitted in most binaries (see
 .Dv kern.wxabort
-in sysctl 3
+in
+.Xr sysctl 8
 for more information).
 .It Bq Er EINVAL
 The



lib/libc/sys/pledge.2: Fix comment

2017-01-29 Thread Michael Reed

It seem that sio_open(3) is more relevant to the "audio" pledge
than the "bpf" one, so move the reference accordingly.


Index: pledge.2
===
RCS file: /cvs/src/lib/libc/sys/pledge.2,v
retrieving revision 1.39
diff -u -p -r1.39 pledge.2
--- pledge.223 Jan 2017 07:19:39 -  1.39
+++ pledge.229 Jan 2017 17:38:16 -
@@ -528,15 +528,15 @@ devices:
 .Dv AUDIO_SETPAR ,
 .Dv AUDIO_START ,
 .Dv AUDIO_STOP .
-.It Va bpf
-Allow
-.Dv BIOCGSTATS
-operation for statistics collection from a bpf device.
 .Pp
 See
 .Xr sio_open 3
 for more information on using the sndio API in combination with
 .Fn pledge .
+.It Va bpf
+Allow
+.Dv BIOCGSTATS
+operation for statistics collection from a bpf device.
 .El
 .Pp
 A whitelist of permitted paths may be provided in



acme-client.1: fix broken example

2017-01-28 Thread Michael Reed

One of the examples is broken:

$ acme-client -vN www.example.com
acme-client: unknown option -- N
usage: acme-client [-ADFnrv] [-f configfile] domain

This commit [0] makes me think that -D should be used instead, but
I'm not sure.

P.s.: This man page also contains a reference to a non-existant Challenges
section (".Sx Challenges"); I haven't included a patch as I don't know how
best to address it.

[0]: 
https://github.com/openbsd/src/commit/2453e683be3ff3f89bf7f499869580fa120a059d



Index: acme-client.1
===
RCS file: /cvs/src/usr.sbin/acme-client/acme-client.1,v
retrieving revision 1.19
diff -u -p -r1.19 acme-client.1
--- acme-client.1   21 Jan 2017 15:53:15 -  1.19
+++ acme-client.1   28 Jan 2017 16:11:39 -
@@ -104,7 +104,7 @@ as in the
 .Sx Challenges
 section:
 .Pp
-.Dl # acme-client -vN www.example.com
+.Dl # acme-client -vD www.example.com
 .Pp
 A daily
 .Xr cron 8



sys/dev/uaudio.c: Fix broken links

2017-01-28 Thread Michael Reed

Index: uaudio.c
===
RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
retrieving revision 1.122
diff -u -p -r1.122 uaudio.c
--- uaudio.c3 Jan 2017 06:45:58 -   1.122
+++ uaudio.c28 Jan 2017 15:57:12 -
@@ -32,9 +32,9 @@
  */
 
 /*

- * USB audio specs: http://www.usb.org/developers/devclass_docs/audio10.pdf
- *  http://www.usb.org/developers/devclass_docs/frmts10.pdf
- *  http://www.usb.org/developers/devclass_docs/termt10.pdf
+ * USB audio specs: 
http://www.usb.org/developers/docs/devclass_docs/audio10.pdf
+ *  
http://www.usb.org/developers/docs/devclass_docs/frmts10.pdf
+ *  
http://www.usb.org/developers/docs/devclass_docs/termt10.pdf
  */
 
 #include 




acme-client.1: Use indented display for source code

2016-09-05 Thread Michael Reed
I find that keeping prose at a different indentation level than source
code makes the man page easier to read.  Besides, it's already done
in most other man pages.



Index: acme-client.1
===
RCS file: /cvs/src/usr.sbin/acme-client/acme-client.1,v
retrieving revision 1.7
diff -u -p -r1.7 acme-client.1
--- acme-client.1   1 Sep 2016 13:42:45 -   1.7
+++ acme-client.1   5 Sep 2016 21:59:35 -
@@ -222,11 +222,11 @@ The default challenge directory
 can be served by
 .Xr httpd 8
 with this location block:
-.Bd -literal
-   location "/.well-known/acme-challenge/*" {
-   root "/acme"
-   root strip 2
-   }
+.Bd -literal -offset indent
+location "/.well-known/acme-challenge/*" {
+   root "/acme"
+   root strip 2
+}
 .Ed
 .Pp
 This way, the files placed in
@@ -261,14 +261,14 @@ web server has already been configured t
 as in the
 .Sx Challenges
 section:
-.Bd -literal
+.Bd -literal -offset indent
 # acme-client -vNn foo.com www.foo.com smtp.foo.com
 .Ed
 .Pp
 A daily
 .Xr cron 8
 job can renew the certificates:
-.Bd -literal
+.Bd -literal -offset indent
 #! /bin/sh
 
 acme-client foo.com www.foo.com smtp.foo.com



sysmerge.8: Mention PAGER behavior when undefined/empty

2016-09-05 Thread Michael Reed
As is done in other man pages.


===
RCS file: /cvs/src/usr.sbin/sysmerge/sysmerge.8,v
retrieving revision 1.78
diff -u -p -r1.78 sysmerge.8
--- sysmerge.8  2 Sep 2016 12:17:33 -   1.78
+++ sysmerge.8  5 Sep 2016 21:54:28 -
@@ -126,6 +126,11 @@ the default is
 .Xr vi 1 .
 .It Ev PAGER
 Specifies the pagination program to use.
+If
+.Ev PAGER
+is empty or not set,
+.Xr more 1
+will be used.
 .El
 .Sh FILES
 .Bl -tag -width "/var/sysmerge/xetc.tgz" -compact



Be specific about doas(1) timeout length

2016-09-05 Thread Michael Reed
So people don't have to look in the source code.


Index: doas.conf.5
===
RCS file: /cvs/src/usr.bin/doas/doas.conf.5,v
retrieving revision 1.30
diff -u -p -r1.30 doas.conf.5
--- doas.conf.5 2 Sep 2016 18:12:30 -   1.30
+++ doas.conf.5 5 Sep 2016 21:41:48 -
@@ -49,7 +49,7 @@ Options are:
 The user is not required to enter a password.
 .It Ic persist
 After the user successfully authenticates, do not ask for a password
-again for some time.
+again for 5 minutes.
 .It Ic keepenv
 The user's environment is maintained.
 The default is to reset the environment, except for the variables



vi.1: pull in some changes from nvi2

2016-02-11 Thread Michael Reed

nvi2[1]'s man page has diverged a bit from our own.  I think many of the
changes are for the better, although not all; because of that I'll be sending
a patch to nvi2 after this.

To ease review, this patch only includes the low hanging fruit--primarily typo
fixes and using correct macros.

[1]: https://github.com/lichray/nvi2



Index: vi.1
===
RCS file: /cvs/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1,v
retrieving revision 1.64
diff -u -p -r1.64 vi.1
--- vi.19 Feb 2016 07:41:12 -   1.64
+++ vi.111 Feb 2016 18:01:20 -
@@ -189,7 +189,7 @@ to give information to you.
 The other fact that you need to understand is that
 .Nm vi
 is a modeful editor,
-i.e. you are either entering text or you are executing commands,
+i.e., you are either entering text or you are executing commands,
 and you have to be in the right mode to do one or the other.
 You will be in command mode when you first start editing a file.
 There are commands that switch you into input mode.
@@ -198,7 +198,7 @@ and that is the
 .Aq escape
 key.
 .Pp
-Key names are written using angle brackets, e.g.\&
+Key names are written using angle brackets, e.g.,
 .Aq escape
 means the
 .Dq escape
@@ -315,7 +315,7 @@ and long lines can take up more than a s
 The above commands work on
 .Dq physical
 characters and lines,
-i.e. they affect the entire line no matter how many screen lines it takes up
+i.e., they affect the entire line no matter how many screen lines it takes up
 and the entire character no matter how many screen columns it takes up.
 .Sh REGULAR EXPRESSIONS
 .Nm ex Ns / Ns Nm vi
@@ -478,7 +478,7 @@ It is specified using a line-oriented mo
 .It
 It is specified using one of the following motion commands:
 .Aq Cm control-A ,
-.Cm ` Ns Aq Cm character ,
+.Cm ` Ns Aq Ar character ,
 .Cm n ,
 .Cm N ,
 .Cm % ,
@@ -879,7 +879,7 @@ are treated as a single sentence.
 .Cm ,\&
 .Xc
 Reverse find character
-(i.e. the last
+(i.e., the last
 .Cm F ,
 .Cm f ,
 .Cm T
@@ -988,7 +988,7 @@ command.
 .Cm ;\&
 .Xc
 Repeat the last character find
-(i.e. the last
+(i.e., the last
 .Cm F ,
 .Cm f ,
 .Cm T
@@ -1520,7 +1520,7 @@ If
 is given,
 display the screen before the screen before
 .Ar count1
-.Pq i.e. 2 screens before .
+.Pq i.e., 2 screens before .
 Otherwise, display the screen before the current screen.
 .El
 .Pp
@@ -2059,10 +2059,11 @@ If this is the entire
 pattern, the replacement part of the previous
 .Cm substitute
 command.
-.It Sq \e#
+.It Sq Pf \e Ar #
 Where
-.Sq #
-is an integer from 1 to 9, the text matched by the #'th subexpression in
+.Sq Ar #
+is an integer from 1 to 9, the text matched by the
+.Ar # Ns 'th subexpression in
 .Ar pattern .
 .It Sq \eL
 Causes the characters up to the end of the line of the next occurrence of
@@ -2247,7 +2248,7 @@ default values.
 In each entry below, the first part of the tag line is the full name
 of the option, followed by any equivalent abbreviations.
 The part in square brackets is the default value of the option.
-Most of the options are boolean, i.e. they are either on or off,
+Most of the options are boolean, i.e., they are either on or off,
 and do not have an associated value.
 .Pp
 Options apply to both
@@ -2391,7 +2392,7 @@ commands are disallowed.
 .Nm vi
 only.
 Optimize text throughput to dumb terminals.
-This option is not yet implemented
+This option is not yet implemented.
 .It Cm paragraphs , para Bq "IPLPPPQPP LIpplpipbp"
 .Nm vi
 only.
@@ -2482,7 +2483,7 @@ This option will never be implemented.
 This option sets tab widths for the editor display.
 .It Cm taglength , tl Bq 0
 Set the number of significant characters in tag names.
-.It Cm tags, tag Bq tags
+.It Cm tags , tag Bq tags
 Set the list of tags files.
 .It Xo
 .Cm term , ttytype , tty
@@ -2591,8 +2592,7 @@ and
 .Pa $HOME/.exrc
 files.
 This value is also used as the default directory for the
-.Nm vi
-.Cm cd
+.Ic cd
 command.
 .It Ev LINES
 The number of rows on the screen.
@@ -2629,7 +2629,7 @@ option is explicitly reset by the user,
 .Nm ex Ns / Ns Nm vi
 enters the value into the environment.
 .It Ev TMPDIR
-The location used to stored temporary files (see also the
+The location used to store temporary files (see also the
 .Cm directory
 edit option).
 .El



vi.1: remove more predefined strings

2016-02-08 Thread Michael Reed

Done for the same reason as rev.  1.57[1].  I observed no diff in the
generated output for terminals, but I'm unsure if these strings are
wanted for prettier pdf/ps/html/... output.

Regards,
  Michael Reed

[1]: 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1?rev=1.57&content-type=text/x-cvsweb-markup


Index: vi.1
===
RCS file: /cvs/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1,v
retrieving revision 1.63
diff -u -p -r1.63 vi.1
--- vi.16 Jan 2016 22:41:53 -   1.63
+++ vi.18 Feb 2016 18:20:05 -
@@ -354,7 +354,7 @@ matches the beginning of the word.
 .Sq \e>
 matches the end of the word.
 .It
-.Sq \(a~
+.Sq ~
 matches the replacement part of the last
 .Cm substitute
 command.
@@ -2059,9 +2059,9 @@ If this is the entire
 pattern, the replacement part of the previous
 .Cm substitute
 command.
-.It Sq \e\(sh
+.It Sq \e#
 Where
-.Sq \(sh
+.Sq #
 is an integer from 1 to 9, the text matched by the #'th subexpression in
 .Ar pattern .
 .It Sq \eL
@@ -2350,9 +2350,9 @@ Display lines in an unambiguous fashion.
 Attempt to get an exclusive lock on any file being edited, read or written.
 .It Cm magic Bq on
 When turned off, all regular expression characters except for
-.Sq \(ha
+.Sq ^
 and
-.Sq \(Do
+.Sq $
 are treated as ordinary characters.
 Preceding individual characters by
 .Sq \e



`ifstated -n' more useful error message

2016-01-28 Thread Michael Reed
If fopen("/etc/ifstated.conf", ...) fails for whatever reason the
error message isn't very helpful:

  $ ifstated -n
  ifstated: /etc/ifstated.conf

With this patch:

  $ ./ifstated -n
  ifstated: /etc/ifstated.conf: No such file or directory



Index: parse.y
===
RCS file: /cvs/src/usr.sbin/ifstated/parse.y,v
retrieving revision 1.36
diff -u -p -r1.36 parse.y
--- parse.y 20 Nov 2014 05:51:20 -  1.36
+++ parse.y 29 Jan 2016 01:56:31 -
@@ -685,7 +685,7 @@ pushfile(const char *name, int secret)
return (NULL);
}
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
-   warnx("%s", nfile->name);
+   warn("%s", nfile->name);
free(nfile->name);
free(nfile);
return (NULL);



less.h small cleanup

2016-01-26 Thread Michael Reed
- sorts includes + remove unneeded comment
- less.h 1.24[1] removes the only use of CHAR_BIT, so remove it
- remove SHELL_META_QUEST, doesn't seem to be used either

[1]: 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/less/less.h.diff?r1=1.23&r2=1.24&sortby=date&f=h

Index: less.h
===
RCS file: /cvs/src/usr.bin/less/less.h,v
retrieving revision 1.24
diff -u -p -r1.24 less.h
--- less.h  26 Jan 2016 01:51:06 -  1.24
+++ less.h  26 Jan 2016 18:58:20 -
@@ -15,19 +15,18 @@
 
 #include "defines.h"
 
-/* Library function declarations */
-
 #include 
-#include 
-#include 
-#include 
+
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 
 /*
  * Simple lowercase test which can be used during option processing
@@ -53,18 +52,12 @@
 #defineOPT_ON  1
 #defineOPT_ONPLUS  2
 
-#ifndef CHAR_BIT
-#defineCHAR_BIT 8
-#endif
-
 /*
  * Special types and constants.
  */
 typedef unsigned long LWCHAR;
 #defineMIN_LINENUM_WIDTH  7/* Min printing width of a line number 
*/
 #defineMAX_UTF_CHAR_LEN   6/* Max bytes in one UTF-8 char */
-
-#defineSHELL_META_QUEST 1
 
 /*
  * An IFILE represents an input file.



sndiod.8: More completely document `d' flag

2016-01-15 Thread Michael Reed
Hi,

I noticed that the sndiod(8) manual doesn't mention that:
- `sndiod -d' doesn't daemonize
- the `d' flag can be specified multiple times

The wording was taken from syslogd.8.

Index: sndiod.8
===
RCS file: /cvs/src/usr.bin/sndiod/sndiod.8,v
retrieving revision 1.1
diff -u -p -r1.1 sndiod.8
--- sndiod.87 Jan 2016 07:41:01 -   1.1
+++ sndiod.816 Jan 2016 05:32:30 -
@@ -152,10 +152,9 @@ respectively any client is allowed to us
 This is a subset of the audio device channels.
 The default is 0:1, i.e. stereo.
 .It Fl d
-Increase log verbosity.
-.Nm
-logs on
-.Em stderr .
+Enable debugging to standard error, and do not disassociate from the
+controlling terminal.
+Can be specified multiple times to further increase log verbosity.
 .It Fl e Ar enc
 Attempt to configure the device to use this encoding.
 The default is



fuser(1): Fix pledge when `u' flag is used

2016-01-01 Thread Michael Reed
Hi,

`fuser -u -c /' doesn't seem to work for me:

fuser(28663): syscall 33 "getpw"

The patch below fixes my issue.  The pledge condition was already a bit
long, so I just switched to snprintf(3); not sure what's normally done
in such situations.

Regards,
  Michael



Index: fstat.c
===
RCS file: /cvs/src/usr.bin/fstat/fstat.c,v
retrieving revision 1.85
diff -u -p -r1.85 fstat.c
--- fstat.c 30 Dec 2015 19:02:12 -  1.85
+++ fstat.c 2 Jan 2016 03:18:17 -
@@ -142,6 +142,7 @@ main(int argc, char *argv[])
int arg, ch, what;
char *memf, *nlistf, *optstr;
char buf[_POSIX2_LINE_MAX];
+   char promises[1024];
const char *errstr;
int cnt, flags;
 
@@ -275,18 +276,12 @@ main(int argc, char *argv[])
if ((kf = kvm_getfiles(kd, what, arg, sizeof(*kf), &cnt)) == NULL)
errx(1, "%s", kvm_geterr(kd));
 
-   if (fuser) {
-   if (sflg) { /* fuser might call kill(2) */
-   if (pledge("stdio rpath proc", NULL) == -1)
-   err(1, "pledge");
-   } else {
-   if (pledge("stdio rpath", NULL) == -1)
-   err(1, "pledge");
-   }
-   } else {
-   if (pledge("stdio rpath getpw", NULL) == -1)
-   err(1, "pledge");
-   }
+   snprintf(promises, sizeof(promises), "stdio rpath%s%s",
+   (fuser && sflg) ? " proc" : "",  /* fuser might call kill(2) */
+   (!fuser || uflg) ? " getpw" : "");
+
+   if (pledge(promises, NULL) == -1)
+   err(1, "pledge");
 
find_splices(kf, cnt);
if (!fuser)



sed(1): Fix incomplete error message

2016-01-01 Thread Michael Reed
Hi,

I noticed that when doing `sed -i` on a file you don't have
permission to read, the error message printed isn't very helpful:

  $ sed -i '/test/d' /var/log/Xorg.1.log.old
  sed: /var/log/Xorg.1.log.old

The patch below seems to fix the issue for me:

  $ ./sed -i '/test/d' /var/log/Xorg.1.log.old
  sed: /var/log/Xorg.1.log.old: Permission denied

Regards,
  Michael



Index: main.c
===
RCS file: /cvs/src/usr.bin/sed/main.c,v
retrieving revision 1.30
diff -u -p -r1.30 main.c
--- main.c  26 Oct 2015 22:22:56 -  1.30
+++ main.c  1 Jan 2016 19:17:16 -
@@ -374,7 +374,7 @@ mf_fgets(SPACE *sp, enum e_spflag spflag
if (len >= sizeof(tmpfname))
error(FATAL, "%s: name too long", fname);
if ((fd = mkstemp(tmpfname)) == -1)
-   error(FATAL, "%s", fname);
+   error(FATAL, "%s: %s", fname, strerror(errno));
if ((outfile = fdopen(fd, "w")) == NULL) {
unlink(tmpfname);
error(FATAL, "%s", fname);



ksh.1: Remove $ERRNO reference

2015-12-25 Thread Michael Reed
It's had the ``Not implemented'' notice since ksh.1's initial import
19 years ago [1], so it's probably not going to be implemented.

[1]: 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/ksh.1?rev=1.1&content-type=text/x-cvsweb-markup



Index: ksh.1
===
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.171
diff -u -p -r1.171 ksh.1
--- ksh.1   24 Nov 2015 21:07:31 -  1.171
+++ ksh.1   25 Dec 2015 18:32:46 -
@@ -1386,12 +1386,6 @@ is set, it overrides
 If this parameter is found to be set after any profile files are executed, the
 expanded value is used as a shell startup file.
 It typically contains function and alias definitions.
-.It Ev ERRNO
-Integer value of the shell's
-.Va errno
-variable.
-It indicates the reason the last system call failed.
-Not yet implemented.
 .It Ev EXECSHELL
 If set, this parameter is assumed to contain the shell that is to be used to
 execute commands that



ksh.1: simplify SYNOPSIS a bit

2015-12-25 Thread Michael Reed
Literal pipe characters are easier to read and there isn't any
difference in the output for mandoc(1) -Thtml and -Tutf8.

\*(Ba is still used elsewhere in ksh.1, although I didn't touch
those as I'm unsure if this change is even wanted.


Index: ksh.1
===
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.171
diff -u -p -r1.171 ksh.1
--- ksh.1   24 Nov 2015 21:07:31 -  1.171
+++ ksh.1   25 Dec 2015 18:18:51 -
@@ -14,7 +14,7 @@
 .Bk -words
 .Op Fl +abCefhiklmnpruvXx
 .Op Fl +o Ar option
-.Op Fl c Ar string \*(Ba Fl s \*(Ba Ar file Op Ar argument ...
+.Op Fl c Ar string | Fl s | Ar file Op Ar argument ...
 .Ek
 .Sh DESCRIPTION
 .Nm



lesskey.1: Don't mention email address

2015-11-22 Thread Michael Reed
This was already done for less.1, as OpenBSD's less(1) differs
substantially from upstream.



Index: lesskey.1
===
RCS file: /cvs/src/usr.bin/less/lesskey.1,v
retrieving revision 1.13
diff -u -p -r1.13 lesskey.1
--- lesskey.1   5 Nov 2015 22:08:44 -   1.13
+++ lesskey.1   23 Nov 2015 06:21:07 -
@@ -448,9 +448,6 @@ file.
 .Xr less 1
 .Sh AUTHORS
 .An Mark Nudelman
-.Pp
-Send bug reports or comments to
-.Aq Mt bug\-l...@gnu.org .
 .\" .Sh CAVEATS
 .\" On MS-DOS and OS/2 systems, certain keys send a sequence of characters
 .\" which start with a NUL character (0).



less.1: Update for LESSCHARSET removal

2015-11-22 Thread Michael Reed
Index: less.1
===
RCS file: /cvs/src/usr.bin/less/less.1,v
retrieving revision 1.50
diff -u -p -r1.50 less.1
--- less.1  15 Nov 2015 21:05:56 -  1.50
+++ less.1  23 Nov 2015 06:15:22 -
@@ -1424,67 +1424,9 @@ in text files.
 .Pp
 A "character set" is simply a description of which characters are to
 be considered normal, control, and binary.
-The
-.Ev LESSCHARSET
-environment variable may be used to select a character set.
-Possible values for
-.Ev LESSCHARSET
-are:
-.Bl -tag -width "IBM-1047"
-.It ascii
-BS, TAB, NL, CR, and formfeed are control characters,
-all chars with values between 32 and 126 are normal,
-and all others are binary.
-.It iso8859
-Selects an ISO 8859 character set.
-This is the same as ASCII, except characters between 160 and 255 are
-treated as normal characters.
-.It latin1
-Same as iso8859.
-.It latin9
-Same as iso8859.
-.It dos
-Selects a character set appropriate for MS-DOS.
-.It ebcdic
-Selects an EBCDIC character set.
-.It IBM-1047
-Selects an EBCDIC character set used by OS/390
-.Ux
-Services.
-This is the EBCDIC analogue of latin1.
-You get similar results by setting either LESSCHARSET=IBM-1047 or
-LC_CTYPE=en_US in your environment.
-.It koi8-r
-Selects a Russian character set.
-.It next
-Selects a character set appropriate for NeXT computers.
-.It utf-8
-Selects the UTF-8 encoding of the ISO 10646 character set.
-UTF-8 is special in that it supports multi-byte characters in the input file.
-It is the only character set that supports multi-byte characters.
-.It windows
-Selects a character set appropriate for Microsoft Windows (cp 1251).
-.El
-.Pp
-If neither LESSCHARSET is not set,
-but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" is found in the
-.Ev LC_ALL , LC_CTYPE
-or
-.Ev LANG
-environment variables, then the default character set is utf-8.
-.Pp
-If that string is not found, but your system supports the
-setlocale interface,
 .Nm
-will use setlocale to determine the character set.
-setlocale is controlled by setting the
-.Ev LANG
-or
-.Ev LC_CTYPE
-environment variables.
-.Pp
-Finally, if the
-setlocale interface is also not available, the default character set is latin1.
+will determine the character set to use from the environment (see
+.Xr locale 1 ) .
 .Pp
 Control and binary characters are displayed in standout (reverse video).
 Each such character is displayed in caret notation if possible
@@ -1893,8 +1835,6 @@ end character in an ANSI color escape se
 (default "0123456789;[?!"'#%()*+\ ").
 .It Ev LESSBINFMT
 Format for displaying non-printable, non-control characters.
-.It Ev LESSCHARSET
-Selects a predefined character set.
 .It Ev LESSCLOSE
 Command line to invoke the (optional) input-postprocessor.
 .It Ev LESSEDIT
Index: lesskey.1
===
RCS file: /cvs/src/usr.bin/less/lesskey.1,v
retrieving revision 1.13
diff -u -p -r1.13 lesskey.1
--- lesskey.1   5 Nov 2015 22:08:44 -   1.13
+++ lesskey.1   23 Nov 2015 06:15:22 -
@@ -410,13 +410,10 @@ Although the lesskey file can be used to
 environment, the main purpose of assigning variables in the lesskey file
 is simply to have all less configuration information stored in one file.
 .Pp
-The following input file sets the -i option whenever less is run,
-and specifies the character set to be
-.Qq latin1 :
+The following input file sets the -i option whenever less is run:
 .Bd -literal -offset indent
 #env
 LESS = -i
-LESSCHARSET = latin1
 .Ed
 .Sh ENVIRONMENT
 .Bl -tag -width LESSKEY_SYSTEM -compact



less.1: secure mode is not a compile-time option

2015-11-15 Thread Michael Reed
>From https://github.com/gdamore/less-fork/blob/master/CHANGES#L35-L37

 * SECURE mode (limited features) is removed - this version of less is always
   fully featured.  (It was a compile-time option.)  Download official less
   if you need restricted mode. (Hint: zones or chroot are better solutions!)



Index: less.1
===
RCS file: /cvs/src/usr.bin/less/less.1,v
retrieving revision 1.49
diff -u -p -r1.49 less.1
--- less.1  8 Nov 2015 09:56:38 -   1.49
+++ less.1  15 Nov 2015 20:54:16 -
@@ -1756,8 +1756,6 @@ Metacharacters in filenames, such as "*"
 .It " "
 Filename completion (TAB, ^L).
 .El
-.Pp
-Less can also be compiled to be permanently in "secure" mode.
 .Sh COMPATIBILITY WITH MORE
 If the environment variable
 .Ev LESS_IS_MORE



less(1): fix implicit declaration

2015-11-09 Thread Michael Reed
Index: main.c
===
RCS file: /cvs/src/usr.bin/less/main.c,v
retrieving revision 1.26
diff -u -p -r1.26 main.c
--- main.c  9 Nov 2015 18:41:46 -   1.26
+++ main.c  9 Nov 2015 21:09:46 -
@@ -13,6 +13,7 @@
  * Entry point, initialization, miscellaneous routines.
  */
 
+#include 
 #include 
 #include 
 #include 



less: use __progname

2015-11-05 Thread Michael Reed
Not sure if such changes which diverge from upstream are wanted,
but here it is.



Index: less.h
===
RCS file: /cvs/src/usr.bin/less/less.h,v
retrieving revision 1.11
diff -u -p -r1.11 less.h
--- less.h  5 Nov 2015 22:18:27 -   1.11
+++ less.h  5 Nov 2015 23:14:31 -
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /*
Index: main.c
===
RCS file: /cvs/src/usr.bin/less/main.c,v
retrieving revision 1.18
diff -u -p -r1.18 main.c
--- main.c  5 Nov 2015 22:18:27 -   1.18
+++ main.c  5 Nov 2015 23:14:31 -
@@ -15,7 +15,6 @@
  * Entry point, initialization, miscellaneous routines.
  */
 
-#include 
 #include 
 #include 
 #include "less.h"
@@ -31,7 +30,7 @@ off_t start_attnpos = -1;
 off_t  end_attnpos = -1;
 intwscroll;
 
-static char*progname;
+extern char*__progname;
 
 intquitting;
 intsecure;
@@ -68,7 +67,6 @@ main(int argc, char *argv[])
IFILE ifile;
char *s;
 
-   progname = basename(argv[0]);
argv++;
argc--;
 
@@ -77,8 +75,8 @@ main(int argc, char *argv[])
 * act like LESS_IS_MORE is set.  We have to set this as early
 * as possible for POSIX.
 */
-   if ((strcmp(progname, "more") == 0) ||
-   (strcmp(progname, "page") == 0)) {
+   if ((strcmp(__progname, "more") == 0) ||
+   (strcmp(__progname, "page") == 0)) {
less_is_more = 1;
} else {
s = lgetenv("LESS_IS_MORE");



locate(1): small cleanup

2015-10-23 Thread Michael Reed
- mmap support was recently made the default, but the includes were
  left unsorted; this diff deals with that

- remove optarg & optind declarations as unistd.h already does this

- remove `#ifdef sun' block: htohl() isn't used anywhere here, although
  ntohl() is in util.c (perhaps endian.h should be included there).
  Besides that ``grep -wR sun /usr/include | grep define'' didn't show
  that `sun' was being defined.



Index: locate.c
===
RCS file: /cvs/src/usr.bin/locate/locate/locate.c,v
retrieving revision 1.29
diff -u -p -r1.29 locate.c
--- locate.c23 Oct 2015 14:16:02 -  1.29
+++ locate.c23 Oct 2015 20:14:45 -
@@ -63,26 +63,21 @@
  * in the standard 'find'.
  */
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-
-#ifdef sun
-#include  /* SunOS byteorder(3) htohl(3) */
-#endif
 
 #include "locate.h"
 #include "pathnames.h"
@@ -120,9 +115,6 @@ extern int  getwf(FILE *);
 extern u_char   *tolower_word(u_char *);
 extern int check_bigram_char(int);
 extern char*patprep(char *);
-
-extern char *optarg;
-extern int  optind;
 
 
 int



aucat.1: small cleanup

2015-10-16 Thread Michael Reed
The use of Bk/Ek and Xo/Xc was not needed, as confirmed by
"diff <{mandoc old.1} <{mandoc new.1} | less".  The only visible
changes should be the Ar -> Cm conversions.


Index: aucat.1
===
RCS file: /cvs/src/usr.bin/aucat/aucat.1,v
retrieving revision 1.109
diff -u -p -r1.109 aucat.1
--- aucat.1 14 Sep 2015 18:06:28 -  1.109
+++ aucat.1 17 Oct 2015 01:21:10 -
@@ -22,7 +22,6 @@
 .Nd audio files manipulation tool
 .Sh SYNOPSIS
 .Nm aucat
-.Bk -words
 .Op Fl dn
 .Op Fl b Ar size
 .Op Fl c Ar min : Ns Ar max
@@ -35,7 +34,6 @@
 .Op Fl q Ar port
 .Op Fl r Ar rate
 .Op Fl v Ar volume
-.Ek
 .Sh DESCRIPTION
 The
 .Nm
@@ -78,9 +76,7 @@ The options are as follows:
 .It Fl b Ar size
 The buffer size of the audio device in frames.
 Default is 7680.
-.It Xo
-.Fl c Ar min : Ns Ar max
-.Xc
+.It Fl c Ar min : Ns Ar max
 The range of audio file channel numbers.
 The default is
 .Cm 0:1 ,
@@ -125,15 +121,15 @@ Default is
 Audio file type.
 The following file types are supported:
 .Bl -tag -width auto
-.It Ar raw
+.It Cm raw
 Headerless file.
-.It Ar wav
+.It Cm wav
 Microsoft WAV file format.
-.It Ar aiff
+.It Cm aiff
 Apple's audio interchange file format.
-.It Ar au
+.It Cm au
 Sun/NeXT audio file format.
-.It Ar auto
+.It Cm auto
 Try to guess, depending on the file name.
 This is the default.
 .El



ctags.1: stop misusing Nm

2015-10-14 Thread Michael Reed
If the author wanted to emphasize these terms then they should have
used Sy or Em, but I wasn't convinced that the terms below
needed emphasis so I just removed the Nm usage altogether.


Index: ctags.1
===
RCS file: /cvs/src/usr.bin/ctags/ctags.1,v
retrieving revision 1.30
diff -u -p -r1.30 ctags.1
--- ctags.1 22 Aug 2015 06:46:00 -  1.30
+++ ctags.1 14 Oct 2015 20:08:43 -
@@ -200,12 +200,7 @@ The
 command appeared in
 .Bx 2 .
 .Sh BUGS
-Recognition of
-.Nm functions ,
-.Nm subroutines ,
-and
-.Nm procedures
-for
+Recognition of functions, subroutines, and procedures for
 .Tn FORTRAN
 and Pascal is done in a very simple-minded way.
 No attempt



sendbug(1): remove -V flag

2015-10-11 Thread Michael Reed
The version is stored in a constant string which is prone to
become outdated, as has happened here.  uname(3) could be
used to make sure it's always up to date, but I don't see
the point given uname(1)'s `r' flag already does this.


Index: sendbug.1
===
RCS file: /cvs/src/usr.bin/sendbug/sendbug.1,v
retrieving revision 1.25
diff -u -p -r1.25 sendbug.1
--- sendbug.1   9 Sep 2015 21:23:31 -   1.25
+++ sendbug.1   11 Oct 2015 21:11:00 -
@@ -11,7 +11,7 @@
 .Nd report a bug in OpenBSD
 .Sh SYNOPSIS
 .Nm
-.Op Fl DEPV
+.Op Fl DEP
 .Sh DESCRIPTION
 .Nm
 is used to submit problem reports (PRs) to the
@@ -80,8 +80,6 @@ to read a PR from the standard input, de
 and write them into the current directory.
 .It Fl P
 Generate and print the template with system information filled out.
-.It Fl V
-Print the version number.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width Ds
Index: sendbug.c
===
RCS file: /cvs/src/usr.bin/sendbug/sendbug.c,v
retrieving revision 1.71
diff -u -p -r1.71 sendbug.c
--- sendbug.c   10 Oct 2015 20:35:01 -  1.71
+++ sendbug.c   11 Oct 2015 21:11:00 -
@@ -45,7 +45,6 @@ void  usbdevs(FILE *);
 
 const char *categories = "system user library documentation kernel "
 "alpha amd64 arm hppa i386 m88k mips64 powerpc sh sparc sparc64 vax";
-char *version = "5.5";
 const char *comment[] = {
"",
"",
@@ -65,7 +64,7 @@ usage(void)
 {
extern char *__progname;
 
-   fprintf(stderr, "usage: %s [-DEPV]\n", __progname);
+   fprintf(stderr, "usage: %s [-DEP]\n", __progname);
exit(1);
 }
 
@@ -89,7 +88,7 @@ main(int argc, char *argv[])
if (pledge("stdio rpath wpath cpath tmppath getpw proc exec", NULL) == 
-1)
err(1, "pledge");
 
-   while ((ch = getopt(argc, argv, "DEPV")) != -1)
+   while ((ch = getopt(argc, argv, "DEP")) != -1)
switch (ch) {
case 'D':
Dflag = 1;
@@ -100,9 +99,6 @@ main(int argc, char *argv[])
case 'P':
Pflag = 1;
break;
-   case 'V':
-   printf("%s\n", version);
-   exit(0);
default:
usage();
}



Re: skey(1) cleanup

2015-10-09 Thread Michael Reed
On 10/09/15 19:06, Tim van der Molen wrote:
> Michael Reed (2015-10-09 23:21 +0200):
>> On 10/09/15 11:03, Tim van der Molen wrote:
>>> Michael Reed (2015-10-09 09:10 +0200):
>>>> The argument passed to usage() was always the same (argv[0]), so
>>>> this patch removes the parameter and uses __progname instead.
>>>> The usage message was misaligned, so I fixed that as well.
>>>
>>> This has already been addressed in a diff I will commit shortly. Thanks
>>> though.
>>>
>>
>> Thanks Tim (and Theo for the style comments).  By the way, the usage
>> message is still misaligned; could you take a look at this updated diff?
> 
> Hi Michael,
> 
> A quick grep through /usr/src/*bin reveals that various forms of
> indentation are used, and that there's no prevalent one. So I don't
> think this is worth changing.

This was mainly done so the synopsis printed by usage() has the same
type of indentation as that in the manual page (all mdoc manuals seem
to have this property), but I see that the type of indentation is indeed
inconsistent, so it's no big deal.


> 
>> Index: skey.c
>> ===
>> RCS file: /cvs/src/usr.bin/skey/skey.c,v
>> retrieving revision 1.30
>> diff -u -p -r1.30 skey.c
>> --- skey.c   9 Oct 2015 20:24:37 -   1.30
>> +++ skey.c   9 Oct 2015 21:13:59 -
>> @@ -148,7 +148,7 @@ void
>>  usage(void)
>>  {
>>  fprintf(stderr,
>> -"usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n\t"
>> -"[-p passphrase] [/] key\n", __progname);
>> +"usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n"
>> +"[-p passphrase] [/] key\n", __progname);
>>  exit(1);
>>  }



Re: skey(1) cleanup

2015-10-09 Thread Michael Reed
On 10/09/15 11:03, Tim van der Molen wrote:
> Michael Reed (2015-10-09 09:10 +0200):
>> The argument passed to usage() was always the same (argv[0]), so
>> this patch removes the parameter and uses __progname instead.
>> The usage message was misaligned, so I fixed that as well.
> 
> This has already been addressed in a diff I will commit shortly. Thanks
> though.
> 

Thanks Tim (and Theo for the style comments).  By the way, the usage
message is still misaligned; could you take a look at this updated diff?

Index: skey.c
===
RCS file: /cvs/src/usr.bin/skey/skey.c,v
retrieving revision 1.30
diff -u -p -r1.30 skey.c
--- skey.c  9 Oct 2015 20:24:37 -   1.30
+++ skey.c  9 Oct 2015 21:13:59 -
@@ -148,7 +148,7 @@ void
 usage(void)
 {
fprintf(stderr,
-   "usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n\t"
-   "[-p passphrase] [/] key\n", __progname);
+   "usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n"
+   "[-p passphrase] [/] key\n", __progname);
exit(1);
 }



skey(1) cleanup

2015-10-09 Thread Michael Reed
The argument passed to usage() was always the same (argv[0]), so
this patch removes the parameter and uses __progname instead.
The usage message was misaligned, so I fixed that as well.


Index: skey.c
===
RCS file: /cvs/src/usr.bin/skey/skey.c,v
retrieving revision 1.28
diff -u -p -r1.28 skey.c
--- skey.c  18 Apr 2015 18:28:38 -  1.28
+++ skey.c  9 Oct 2015 07:01:27 -
@@ -30,7 +30,7 @@
 #include 
 #include 
 
-voidusage(char *);
+void __dead usage(void);
 
 int
 main(int argc, char *argv[])
@@ -57,14 +57,14 @@ main(int argc, char *argv[])
switch (argv[i][1]) {
case 'n':
if (++i == argc)
-   usage(argv[0]);
+   usage();
cnt = strtonum(argv[i], 1, SKEY_MAX_SEQ -1, 
&errstr);
if (errstr)
-   usage(argv[0]);
+   usage();
break;
case 'p':
if (++i == argc)
-   usage(argv[0]);
+   usage();
if (strlcpy(passwd, argv[i], sizeof(passwd)) >=
sizeof(passwd))
errx(1, "Password too long");
@@ -74,42 +74,42 @@ main(int argc, char *argv[])
hexmode = 1;
break;
default:
-   usage(argv[0]);
+   usage();
}
} else {
/* Multi character switches are hash types */
if (skey_set_algorithm(&argv[i][1]) == NULL) {
warnx("Unknown hash algorithm %s", &argv[i][1]);
-   usage(argv[0]);
+   usage();
}
}
i++;
}
 
if (argc > i + 2)
-   usage(argv[0]);
+   usage();
 
/* Could be in the form / */
if (argc <= i + 1) {
/* look for / in it */
if (argc <= i)
-   usage(argv[0]);
+   usage();
slash = strchr(argv[i], '/');
if (slash == NULL)
-   usage(argv[0]);
+   usage();
*slash++ = '\0';
seed = slash;
 
n = strtonum(argv[i], 0, SKEY_MAX_SEQ, &errstr);
if (errstr) {
warnx("%s: %s", argv[i], errstr);
-   usage(argv[0]);
+   usage();
}
} else {
n = strtonum(argv[i], 0, SKEY_MAX_SEQ, &errstr);
if (errstr) {
warnx("%s: %s", argv[i], errstr);
-   usage(argv[0]);
+   usage();
}
seed = argv[++i];
}
@@ -147,10 +147,13 @@ main(int argc, char *argv[])
 }
 
 void
-usage(char *s)
+usage(void)
 {
+   extern char *__progname;
+
fprintf(stderr,
-   "usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n\t"
-   "[-p passphrase] [/] key\n", s);
+   "usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n"
+   "[-p passphrase] [/] key\n",
+   __progname);
exit(1);
 }



Re: bsd.port.mk.5: restructure `clean' section

2015-10-05 Thread Michael Reed
ping

On 09/26/15 14:49, Michael Reed wrote:
> The `clean' target takes optional arguments, so denote that in
> the item header.  Additionally, the subtargets are fixed strings,
> not variables, so change the use of Va to Cm to reflect that.
> 
> 
> Index: bsd.port.mk.5
> ===
> RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
> retrieving revision 1.426
> diff -u -p -r1.426 bsd.port.mk.5
> --- bsd.port.mk.5 23 Sep 2015 01:38:36 -  1.426
> +++ bsd.port.mk.5 26 Sep 2015 18:46:05 -
> @@ -178,47 +178,49 @@ will try to fetch a version with the cor
>  main archive site in the case of a checksum mismatch.
>  .Ev NO_CHECKSUM
>  can be used to avoid all checksumming steps.
> -.It Cm clean
> +.It Cm clean Ns Op Pf = Ar subtarget
>  Clean ports contents.
> -By default, it will clean the work directory.
> -It can be invoked as
> -make clean='[depends build bulk work fake flavors dist install sub package
> -packages plist]'.
> +If
> +.Ar subtarget
> +is omitted, it will clean the work directory.
> +Otherwise,
> +.Ar subtarget
> +can be set to one of the following:
>  .Bl -tag -width packages
> -.It Va work
> +.It Cm work
>  Clean work directory.
> -.It Va bulk
> +.It Cm bulk
>  Clean bulk cookie.
> -.It Va build
> +.It Cm build
>  Clean the
>  .Va WRKBUILD
>  directory (only useful if
>  .Va SEPARATE_BUILD
>  is set).
> -.It Va depends
> +.It Cm depends
>  Recurse into dependencies.
> -.It Va dist
> +.It Cm dist
>  Clean distribution files.
> -.It Va fake
> +.It Cm fake
>  Clean fake installation directory.
> -.It Va flavors
> +.It Cm flavors
>  Clean all work directories.
> -.It Va install
> +.It Cm install
>  Uninstall package.
> -.It Va package
> +.It Cm package
>  Remove all copies of package file.
> -.It Va plist
> +.It Cm plist
>  Remove registered packing lists of all subpackages.
> -.It Va sub
> +.It Cm sub
>  With
> -.Va install
> +.Cm install
>  or
> -.Va package ,
> +.Cm package ,
>  clean subpackages as well.
> -.It Va packages
> +.It Cm packages
>  Shorthand for
>  .Sq sub package .
> -.It Va all
> +.It Cm all
>  Shorthand for
>  .Sq work flavors packages plist .
>  .El
> 



pkg_(add|delete|info): fix synopses

2015-10-04 Thread Michael Reed
The use of an ellipsis in manuals usually seems to already imply
optional arguments, e.g., `.Op Ar file ...', so constructs like
`Ar pkg-name Op Ar ...' seem redundant to me.

While here, also denote the `pkg-name' argument to pkg_delete
as optional, since you can do things like `pkg_delete -nX'.



Index: pkg_add.1
===
RCS file: /cvs/src/usr.sbin/pkg_add/pkg_add.1,v
retrieving revision 1.132
diff -u -p -r1.132 pkg_add.1
--- pkg_add.1   16 Apr 2015 20:01:39 -  1.132
+++ pkg_add.1   4 Oct 2015 17:54:40 -
@@ -31,7 +31,7 @@
 .Op Fl L Ar localbase
 .Op Fl l Ar file
 .Op Fl P Ar type
-.Ar pkg-name Op Ar ...
+.Ar pkg-name ...
 .Ek
 .Sh DESCRIPTION
 The
Index: pkg_delete.1
===
RCS file: /cvs/src/usr.sbin/pkg_add/pkg_delete.1,v
retrieving revision 1.50
diff -u -p -r1.50 pkg_delete.1
--- pkg_delete.18 Apr 2015 17:25:58 -   1.50
+++ pkg_delete.14 Oct 2015 17:54:40 -
@@ -26,7 +26,7 @@
 .Op Fl acIimnqsvXx
 .Op Fl B Ar pkg-destdir
 .Op Fl D Ar name Ns Op = Ns Ar value
-.Ar pkg-name Op Ar ...
+.Op Ar pkg-name ...
 .Sh DESCRIPTION
 The
 .Nm
Index: pkg_info.1
===
RCS file: /cvs/src/usr.sbin/pkg_add/pkg_info.1,v
retrieving revision 1.50
diff -u -p -r1.50 pkg_info.1
--- pkg_info.1  8 Sep 2014 01:27:55 -   1.50
+++ pkg_info.1  4 Oct 2015 17:54:40 -
@@ -30,8 +30,7 @@
 .Op Fl l Ar str
 .Op Fl Q Ar query
 .Op Fl r Ar pkgspec
-.Op Ar pkg-name
-.Op Ar ...
+.Op Ar pkg-name ...
 .Ek
 .Sh DESCRIPTION
 The
Index: OpenBSD/PkgAdd.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm,v
retrieving revision 1.87
diff -u -p -r1.87 PkgAdd.pm
--- OpenBSD/PkgAdd.pm   30 Jun 2015 19:20:08 -  1.87
+++ OpenBSD/PkgAdd.pm   4 Oct 2015 17:54:40 -
@@ -107,7 +107,7 @@ sub handle_options
my $state = shift;
$state->SUPER::handle_options('ruUzl:A:P:',
'[-acinqrsUuvxz] [-A arch] [-B pkg-destdir] [-D name[=value]]',
-   '[-L localbase] [-l file] [-P type] pkg-name [...]');
+   '[-L localbase] [-l file] [-P type] pkg-name ...');
 
$state->{arch} = $state->opt('A');
 
Index: OpenBSD/PkgDelete.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm,v
retrieving revision 1.34
diff -u -p -r1.34 PkgDelete.pm
--- OpenBSD/PkgDelete.pm29 Nov 2014 10:42:51 -  1.34
+++ OpenBSD/PkgDelete.pm4 Oct 2015 17:54:40 -
@@ -101,7 +101,7 @@ sub handle_options
 {
my $state = shift;
$state->SUPER::handle_options('X',
-   '[-acimnqsvXx] [-B pkg-destdir] [-D name[=value]] pkg-name [...]');
+   '[-acimnqsvXx] [-B pkg-destdir] [-D name[=value]] [pkg-name ...]');
 
my $base = $state->opt('B') // $ENV{'PKG_DESTDIR'} // '';
if ($base ne '') {
Index: OpenBSD/PkgInfo.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm,v
retrieving revision 1.35
diff -u -p -r1.35 PkgInfo.pm
--- OpenBSD/PkgInfo.pm  6 Apr 2015 12:19:35 -   1.35
+++ OpenBSD/PkgInfo.pm  4 Oct 2015 17:54:40 -
@@ -559,7 +559,7 @@ sub parse_and_run
$state->{no_exports} = 1;
$state->handle_options('cCdfF:hIKLmPQ:qr:RsSUe:E:Ml:aAt',
'[-AaCcdfIKLMmPqRSstUv] [-D nolock][-E filename] [-e pkg-name] ',
-   '[-l str] [-Q query] [-r pkgspec] [pkg-name] [...]');
+   '[-l str] [-Q query] [-r pkgspec] [pkg-name ...]');
 
if ($state->opt('r')) {
 



Re: more on tame

2015-10-04 Thread Michael Reed
perror(3) is being used instead of err(3) in a few places;  is
that on purpose?  If it's an oversight, I also noticed the same
in patch(1).

On 10/04/15 01:34, Theo de Raadt wrote:
> 42 tame calls have been commited to 28 userland programs so far.
> For instance gzip, md5, ping, traceroute, tcpdump, script, arp,
> whois, ntpd, sshd...
> 
> Below is a tree of roughly a hundred more programs.  Not all are
> fully verified yet, but they being placed in snapshots.
> 
> Some of these I did myself, but others were contributed.  I am trying
> to focus on the programs which do either file or socket behaviour, but
> not both.  Or, on the programs which do their fd setup early.
> 
> I appreciate the feedback I've received so far.
> 
> Index: bin/dd/dd.c
> ===
> RCS file: /cvs/src/bin/dd/dd.c,v
> retrieving revision 1.21
> diff -u -p -u -r1.21 dd.c
> --- bin/dd/dd.c   16 Jan 2015 06:39:31 -  1.21
> +++ bin/dd/dd.c   28 Sep 2015 20:15:11 -
> @@ -149,6 +149,9 @@ setup(void)
>   if (out.offset)
>   pos_out();
>  
> + if (tame("stdio", NULL) == -1)
> + err(1, "tame");
> +
>   /*
>* Truncate the output file; ignore errors because it fails on some
>* kinds of output files, tapes, for example.
> Index: bin/df/df.c
> ===
> RCS file: /cvs/src/bin/df/df.c,v
> retrieving revision 1.52
> diff -u -p -u -r1.52 df.c
> --- bin/df/df.c   16 Jan 2015 06:39:31 -  1.52
> +++ bin/df/df.c   2 Oct 2015 00:19:01 -
> @@ -79,6 +79,9 @@ main(int argc, char *argv[])
>   int width, maxwidth;
>   char *mntpt;
>  
> + if (tame("stdio rpath", NULL) == -1)
> + err(1, "tame");
> +
>   while ((ch = getopt(argc, argv, "hiklnPt:")) != -1)
>   switch (ch) {
>   case 'h':
> Index: bin/expr/expr.c
> ===
> RCS file: /cvs/src/bin/expr/expr.c,v
> retrieving revision 1.20
> diff -u -p -u -r1.20 expr.c
> --- bin/expr/expr.c   11 Aug 2015 17:15:46 -  1.20
> +++ bin/expr/expr.c   28 Sep 2015 20:15:11 -
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -499,6 +500,9 @@ main(int argc, char *argv[])
>   struct val *vp;
>  
>   (void) setlocale(LC_ALL, "");
> +
> + if (tame("stdio", NULL) == -1)
> + err(1, "tame");
>  
>   if (argc > 1 && !strcmp(argv[1], "--"))
>   argv++;
> Index: bin/ls/ls.c
> ===
> RCS file: /cvs/src/bin/ls/ls.c,v
> retrieving revision 1.41
> diff -u -p -u -r1.41 ls.c
> --- bin/ls/ls.c   25 Jun 2015 02:04:07 -  1.41
> +++ bin/ls/ls.c   28 Sep 2015 20:15:11 -
> @@ -123,6 +123,9 @@ ls_main(int argc, char *argv[])
>   termwidth = width;
>   }
>  
> + if (tame("stdio rpath", NULL) == -1)
> + err(1, "tame");
> +
>   /* Root is -A automatically. */
>   if (!getuid())
>   f_listdot = 1;
> Index: bin/mkdir/mkdir.c
> ===
> RCS file: /cvs/src/bin/mkdir/mkdir.c,v
> retrieving revision 1.25
> diff -u -p -u -r1.25 mkdir.c
> --- bin/mkdir/mkdir.c 2 Apr 2013 20:26:17 -   1.25
> +++ bin/mkdir/mkdir.c 3 Oct 2015 03:32:46 -
> @@ -55,6 +55,9 @@ main(int argc, char *argv[])
>  
>   setlocale(LC_ALL, "");
>  
> + if (tame("stdio cpath rpath fattr", NULL) == -1)
> + err(1, "tame");
> +
>   /*
>* The default file mode is a=rwx (0777) with selected permissions
>* removed in accordance with the file mode creation mask.  For
> Index: bin/pax/ar_io.c
> ===
> RCS file: /cvs/src/bin/pax/ar_io.c,v
> retrieving revision 1.50
> diff -u -p -u -r1.50 ar_io.c
> --- bin/pax/ar_io.c   22 Mar 2015 03:15:00 -  1.50
> +++ bin/pax/ar_io.c   3 Oct 2015 23:42:07 -
> @@ -75,6 +75,7 @@ static int wr_trail = 1;/* trailer was
>  static int can_unlnk = 0;/* do we unlink null archives?  */
>  const char *arcname; /* printable name of archive */
>  const char *gzip_program;/* name of gzip program */
> +const char *delayed_tame;/* tame request for after forking gzip_program 
> */
>  static pid_t zpid = -1;  /* pid of child process */
>  int force_one_volume;/* 1 if we ignore volume 
> changes */
>  
> @@ -1276,4 +1277,6 @@ ar_start_gzip(int fd, const char *path, 
>   err(1, "could not exec %s", path);
>   /* NOTREACHED */
>   }
> + if (delayed_tame != NULL && tame(delayed_tame, NULL) == -1)
> + err(1, "tame");
>  }
> Index: bin/pax/extern.h
> ===

acpidump(8): fix usage message

2015-10-02 Thread Michael Reed
This brings the usage info in line with most other programs.



Index: acpidump.c
===
RCS file: /cvs/src/usr.sbin/acpidump/acpidump.c,v
retrieving revision 1.13
diff -u -p -r1.13 acpidump.c
--- acpidump.c  3 Oct 2015 01:05:12 -   1.13
+++ acpidump.c  3 Oct 2015 06:28:57 -
@@ -560,7 +560,7 @@ usage(void)
 {
extern char *__progname;
 
-   fprintf(stderr, "%s -o prefix_for_output\n", __progname);
+   fprintf(stderr, "usage: %s -o prefix_for_output\n", __progname);
exit(1);
 }
 



Re: mk.conf.5: Use Ql where appropriate

2015-10-01 Thread Michael Reed
On 10/01/15 23:43, Michael Reed wrote:
> On 10/01/15 16:38, Jason McIntyre wrote:
>> On Sun, Sep 27, 2015 at 03:48:10PM -0400, Michael Reed wrote:
>>> Hi all,
>>>
>>> Instead of using a mix of single and double quotes
>>> to denote command invocations and literal strings,
>>> use Ql instead.  This was inspired by revision 1.425
>>> of bsd.port.mk [1].
>>>
>>> While doing the above, I also removed a seemingly bogus
>>> use of `Ev' prepending `-pipe'.
>>>
>>> Regards,
>>> Michael
>>>
>>> [1]: 
>>> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/share/man/man5/bsd.port.mk.5?sortby=date
>>>
>>>
>>
>> while i don;t entirely object to this diff, i won;t be committing it
>> either. we have no real hard or fast rules about having to use macros
>> for quoting - i personally don;t see any benefit.
> 
> That's fine, but could you take a look at the bogus Ev at least?
> Here's a standalone diff of it:
> 
> Index: mk.conf.5
> ===
> RCS file: /cvs/src/share/man/man5/mk.conf.5,v
> retrieving revision 1.28
> diff -u -p -r1.28 mk.conf.5
> --- mk.conf.5 30 Jul 2015 08:03:50 -  1.28
> +++ mk.conf.5 2 Oct 2015 03:41:10 -
> @@ -203,7 +203,7 @@ Do not build PIE objects or executables.
>  Do not build profiled versions of system libraries.
>  .It Ev PIPE
>  If set to
> -.Qq Ev -pipe ,
> +.Qq -pipe ,
>  .Xr gcc 1
>  will be given the
>  .Fl pipe

I forgot to mention: the only reason I used the quoting macros
instead of literal quotes was to get typographic quotes; I prefer
them due to the start and end quote differing in appearance, similar
to open and close parens.  Still, the benefit is minor at best.

> 
> 
>>
>> jmc
>>
>>>
>>> Index: mk.conf.5
>>> ===
>>> RCS file: /cvs/src/share/man/man5/mk.conf.5,v
>>> retrieving revision 1.28
>>> diff -u -p -r1.28 mk.conf.5
>>> --- mk.conf.5   30 Jul 2015 08:03:50 -  1.28
>>> +++ mk.conf.5   27 Sep 2015 19:34:24 -
>>> @@ -75,10 +75,14 @@ Binary mode.
>>>  Binary owner.
>>>  .Bq root
>>>  .It Ev BSDOBJDIR
>>> -The real path to the system 'obj' tree, so that 'make obj' will work 
>>> correctly.
>>> +The real path to the system object tree, so that
>>> +.Ql make obj
>>> +will work correctly.
>>>  .Bq Pa /usr/obj
>>>  .It Ev BSDSRCDIR
>>> -The real path to the system sources, so that 'make obj' will work 
>>> correctly.
>>> +The real path to the system sources, so that
>>> +.Ql make obj
>>> +will work correctly.
>>>  .Bq Pa /usr/src
>>>  .It Ev DIRMODE
>>>  Mode for new directories.
>>> @@ -160,7 +164,7 @@ National Language Support files owner.
>>>  Mode for non-executable files.
>>>  .Bq 444
>>>  .It Ev XOBJDIR
>>> -The real path to the 'obj' tree for building the X Window System.
>>> +The real path to the object tree for building the X Window System.
>>>  .Bq Pa /usr/xobj
>>>  .It Ev XSRCDIR
>>>  The real path to the X Window System sources.
>>> @@ -203,7 +207,7 @@ Do not build PIE objects or executables.
>>>  Do not build profiled versions of system libraries.
>>>  .It Ev PIPE
>>>  If set to
>>> -.Qq Ev -pipe ,
>>> +.Ql -pipe ,
>>>  .Xr gcc 1
>>>  will be given the
>>>  .Fl pipe
>>> @@ -218,20 +222,29 @@ Compile in support for S/key authenticat
>>>  A space separated list of directories,
>>>  relative to
>>>  .Ev BSDSRCDIR ,
>>> -to be skipped during "make build".
>>> +to be skipped during
>>> +.Ql make build .
>>>  .It Ev SUDO
>>>  Command run by
>>>  .Xr make 1
>>>  when doing certain operations requiring root privileges
>>> -(e.g. the "make install" portion of "make build").
>>> +(e.g. the
>>> +.Ql make install
>>> +portion of
>>> +.Ql make build ) .
>>>  If set to
>>>  .Ev /usr/bin/doas ,
>>> -this allows one to run "make build" as a user other than root
>>> +this allows one to run
>>> +.Ql make build
>>> +as a user other than root
>>>  (assuming doas is set up for that user).
>>>  .It Ev SYS_INCLUDE
>>>  Copy or symlink kernel include files into
>>>  .Pa /usr/include .
>>> -Possible values are "symlinks" or "copies"
>>> +Possible values are
>>> +.Ql symlinks
>>> +or
>>> +.Ql copies
>>>  (which is the same as the variable being unset).
>>>  .It Ev WARNINGS
>>>  Adds appropriate warning flags (defined in
>>>
>>
> 



Re: mk.conf.5: Use Ql where appropriate

2015-10-01 Thread Michael Reed
On 10/01/15 16:38, Jason McIntyre wrote:
> On Sun, Sep 27, 2015 at 03:48:10PM -0400, Michael Reed wrote:
>> Hi all,
>>
>> Instead of using a mix of single and double quotes
>> to denote command invocations and literal strings,
>> use Ql instead.  This was inspired by revision 1.425
>> of bsd.port.mk [1].
>>
>> While doing the above, I also removed a seemingly bogus
>> use of `Ev' prepending `-pipe'.
>>
>> Regards,
>> Michael
>>
>> [1]: 
>> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/share/man/man5/bsd.port.mk.5?sortby=date
>>
>>
> 
> while i don;t entirely object to this diff, i won;t be committing it
> either. we have no real hard or fast rules about having to use macros
> for quoting - i personally don;t see any benefit.

That's fine, but could you take a look at the bogus Ev at least?
Here's a standalone diff of it:

Index: mk.conf.5
===
RCS file: /cvs/src/share/man/man5/mk.conf.5,v
retrieving revision 1.28
diff -u -p -r1.28 mk.conf.5
--- mk.conf.5   30 Jul 2015 08:03:50 -  1.28
+++ mk.conf.5   2 Oct 2015 03:41:10 -
@@ -203,7 +203,7 @@ Do not build PIE objects or executables.
 Do not build profiled versions of system libraries.
 .It Ev PIPE
 If set to
-.Qq Ev -pipe ,
+.Qq -pipe ,
 .Xr gcc 1
 will be given the
 .Fl pipe


> 
> jmc
> 
>>
>> Index: mk.conf.5
>> ===
>> RCS file: /cvs/src/share/man/man5/mk.conf.5,v
>> retrieving revision 1.28
>> diff -u -p -r1.28 mk.conf.5
>> --- mk.conf.530 Jul 2015 08:03:50 -  1.28
>> +++ mk.conf.527 Sep 2015 19:34:24 -
>> @@ -75,10 +75,14 @@ Binary mode.
>>  Binary owner.
>>  .Bq root
>>  .It Ev BSDOBJDIR
>> -The real path to the system 'obj' tree, so that 'make obj' will work 
>> correctly.
>> +The real path to the system object tree, so that
>> +.Ql make obj
>> +will work correctly.
>>  .Bq Pa /usr/obj
>>  .It Ev BSDSRCDIR
>> -The real path to the system sources, so that 'make obj' will work correctly.
>> +The real path to the system sources, so that
>> +.Ql make obj
>> +will work correctly.
>>  .Bq Pa /usr/src
>>  .It Ev DIRMODE
>>  Mode for new directories.
>> @@ -160,7 +164,7 @@ National Language Support files owner.
>>  Mode for non-executable files.
>>  .Bq 444
>>  .It Ev XOBJDIR
>> -The real path to the 'obj' tree for building the X Window System.
>> +The real path to the object tree for building the X Window System.
>>  .Bq Pa /usr/xobj
>>  .It Ev XSRCDIR
>>  The real path to the X Window System sources.
>> @@ -203,7 +207,7 @@ Do not build PIE objects or executables.
>>  Do not build profiled versions of system libraries.
>>  .It Ev PIPE
>>  If set to
>> -.Qq Ev -pipe ,
>> +.Ql -pipe ,
>>  .Xr gcc 1
>>  will be given the
>>  .Fl pipe
>> @@ -218,20 +222,29 @@ Compile in support for S/key authenticat
>>  A space separated list of directories,
>>  relative to
>>  .Ev BSDSRCDIR ,
>> -to be skipped during "make build".
>> +to be skipped during
>> +.Ql make build .
>>  .It Ev SUDO
>>  Command run by
>>  .Xr make 1
>>  when doing certain operations requiring root privileges
>> -(e.g. the "make install" portion of "make build").
>> +(e.g. the
>> +.Ql make install
>> +portion of
>> +.Ql make build ) .
>>  If set to
>>  .Ev /usr/bin/doas ,
>> -this allows one to run "make build" as a user other than root
>> +this allows one to run
>> +.Ql make build
>> +as a user other than root
>>  (assuming doas is set up for that user).
>>  .It Ev SYS_INCLUDE
>>  Copy or symlink kernel include files into
>>  .Pa /usr/include .
>> -Possible values are "symlinks" or "copies"
>> +Possible values are
>> +.Ql symlinks
>> +or
>> +.Ql copies
>>  (which is the same as the variable being unset).
>>  .It Ev WARNINGS
>>  Adds appropriate warning flags (defined in
>>
> 



mk.conf.5: Use Ql where appropriate

2015-09-27 Thread Michael Reed
Hi all,

Instead of using a mix of single and double quotes
to denote command invocations and literal strings,
use Ql instead.  This was inspired by revision 1.425
of bsd.port.mk [1].

While doing the above, I also removed a seemingly bogus
use of `Ev' prepending `-pipe'.

Regards,
Michael

[1]: 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/share/man/man5/bsd.port.mk.5?sortby=date



Index: mk.conf.5
===
RCS file: /cvs/src/share/man/man5/mk.conf.5,v
retrieving revision 1.28
diff -u -p -r1.28 mk.conf.5
--- mk.conf.5   30 Jul 2015 08:03:50 -  1.28
+++ mk.conf.5   27 Sep 2015 19:34:24 -
@@ -75,10 +75,14 @@ Binary mode.
 Binary owner.
 .Bq root
 .It Ev BSDOBJDIR
-The real path to the system 'obj' tree, so that 'make obj' will work correctly.
+The real path to the system object tree, so that
+.Ql make obj
+will work correctly.
 .Bq Pa /usr/obj
 .It Ev BSDSRCDIR
-The real path to the system sources, so that 'make obj' will work correctly.
+The real path to the system sources, so that
+.Ql make obj
+will work correctly.
 .Bq Pa /usr/src
 .It Ev DIRMODE
 Mode for new directories.
@@ -160,7 +164,7 @@ National Language Support files owner.
 Mode for non-executable files.
 .Bq 444
 .It Ev XOBJDIR
-The real path to the 'obj' tree for building the X Window System.
+The real path to the object tree for building the X Window System.
 .Bq Pa /usr/xobj
 .It Ev XSRCDIR
 The real path to the X Window System sources.
@@ -203,7 +207,7 @@ Do not build PIE objects or executables.
 Do not build profiled versions of system libraries.
 .It Ev PIPE
 If set to
-.Qq Ev -pipe ,
+.Ql -pipe ,
 .Xr gcc 1
 will be given the
 .Fl pipe
@@ -218,20 +222,29 @@ Compile in support for S/key authenticat
 A space separated list of directories,
 relative to
 .Ev BSDSRCDIR ,
-to be skipped during "make build".
+to be skipped during
+.Ql make build .
 .It Ev SUDO
 Command run by
 .Xr make 1
 when doing certain operations requiring root privileges
-(e.g. the "make install" portion of "make build").
+(e.g. the
+.Ql make install
+portion of
+.Ql make build ) .
 If set to
 .Ev /usr/bin/doas ,
-this allows one to run "make build" as a user other than root
+this allows one to run
+.Ql make build
+as a user other than root
 (assuming doas is set up for that user).
 .It Ev SYS_INCLUDE
 Copy or symlink kernel include files into
 .Pa /usr/include .
-Possible values are "symlinks" or "copies"
+Possible values are
+.Ql symlinks
+or
+.Ql copies
 (which is the same as the variable being unset).
 .It Ev WARNINGS
 Adds appropriate warning flags (defined in



bsd.port.mk.5: restructure `clean' section

2015-09-26 Thread Michael Reed
The `clean' target takes optional arguments, so denote that in
the item header.  Additionally, the subtargets are fixed strings,
not variables, so change the use of Va to Cm to reflect that.


Index: bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.426
diff -u -p -r1.426 bsd.port.mk.5
--- bsd.port.mk.5   23 Sep 2015 01:38:36 -  1.426
+++ bsd.port.mk.5   26 Sep 2015 18:46:05 -
@@ -178,47 +178,49 @@ will try to fetch a version with the cor
 main archive site in the case of a checksum mismatch.
 .Ev NO_CHECKSUM
 can be used to avoid all checksumming steps.
-.It Cm clean
+.It Cm clean Ns Op Pf = Ar subtarget
 Clean ports contents.
-By default, it will clean the work directory.
-It can be invoked as
-make clean='[depends build bulk work fake flavors dist install sub package
-packages plist]'.
+If
+.Ar subtarget
+is omitted, it will clean the work directory.
+Otherwise,
+.Ar subtarget
+can be set to one of the following:
 .Bl -tag -width packages
-.It Va work
+.It Cm work
 Clean work directory.
-.It Va bulk
+.It Cm bulk
 Clean bulk cookie.
-.It Va build
+.It Cm build
 Clean the
 .Va WRKBUILD
 directory (only useful if
 .Va SEPARATE_BUILD
 is set).
-.It Va depends
+.It Cm depends
 Recurse into dependencies.
-.It Va dist
+.It Cm dist
 Clean distribution files.
-.It Va fake
+.It Cm fake
 Clean fake installation directory.
-.It Va flavors
+.It Cm flavors
 Clean all work directories.
-.It Va install
+.It Cm install
 Uninstall package.
-.It Va package
+.It Cm package
 Remove all copies of package file.
-.It Va plist
+.It Cm plist
 Remove registered packing lists of all subpackages.
-.It Va sub
+.It Cm sub
 With
-.Va install
+.Cm install
 or
-.Va package ,
+.Cm package ,
 clean subpackages as well.
-.It Va packages
+.It Cm packages
 Shorthand for
 .Sq sub package .
-.It Va all
+.It Cm all
 Shorthand for
 .Sq work flavors packages plist .
 .El



Re: afterboot.8 to reference ntpd(1) enabled by default

2015-09-25 Thread Michael Reed
Hi Rob,

No comment on if this is a good idea or not as I'm not an OpenBSD developer,
but I left a few comments inline regarding the mdoc semantics.

On 09/25/15 16:57, Rob Pierce wrote:
> Since ntpd(1) is now enabled by default do the following changes make sense?
> 
> Regards,
> 
> Index: afterboot.8
> ===
> RCS file: /cvs/src/share/man/man8/afterboot.8,v
> retrieving revision 1.149
> diff -u -p -r1.149 afterboot.8
> --- afterboot.8   24 Sep 2015 15:07:55 -  1.149
> +++ afterboot.8   26 Sep 2015 00:36:30 -
> @@ -124,22 +124,28 @@ Furthermore, the superuser's
>  should never contain the current directory
>  .Pq Dq \&. .
>  .Ss System date
> -Check the system date with the
> +.Xr ntpd 1

I think you meant section 8, not 1.
The port textproc/igor can, among other things, automatically check for
the existence of external references with the -x flag.

> +is now enabled by default to automatically synchronize clocks with remote
> +NTP servers.  You can use

Sentences should start on a new line; not sure if it makes a difference in
mandoc's output, but it's done in the vast majority of manuals (perhaps a
stylistic choice).

In any case, igor can check for this too.

> +.Xr ntpctl 1

1 -> 8

> +to check the status.
> +You can also search
> +.Pa /var/log/daemon
> +for
> +.Xr ntpd 1

1 -> 8

> +related events.
> +To change the time servers or other related settings see
> +.Xr ntpd.conf 8 .

8 -> 5

> +.Pp
> +You can check the system date using the
>  .Xr date 1
> -command.
> -If needed, change the date, and/or change the symbolic link of
> +command.  If needed, change the symbolic link of

Sentences should start on a new line.

>  .Pa /etc/localtime
>  to the correct time zone in the
>  .Pa /usr/share/zoneinfo
>  directory.
> -Alternatively,
> -.Xr ntpd 8
> -can be used to automatically synchronize clocks with remote NTP servers.
> -.Pp
> -Examples:
>  .Pp
> -Set the current date to January 27th, 1999 3:04pm:
> -.Dl # date 199901271504
> +For example:
>  .Pp
>  Set the time zone to Atlantic Standard Time:
>  .Dl # ln -fs /usr/share/zoneinfo/Canada/Atlantic /etc/localtime
> 

Regards,
Michael



banner(1): fix SYNOPSIS

2015-09-23 Thread Michael Reed
banner(1) without arguments works fine, so denote it as such
in the manual.



Index: src/usr.bin/banner/banner.1
===
RCS file: /cvs/src/usr.bin/banner/banner.1,v
retrieving revision 1.8
diff -u -p -r1.8 banner.1
--- src/usr.bin/banner/banner.1 6 Aug 2007 19:16:06 -   1.8
+++ src/usr.bin/banner/banner.1 23 Sep 2015 23:40:36 -
@@ -24,7 +24,7 @@
 .Nd print strings in large letters
 .Sh SYNOPSIS
 .Nm banner
-.Ar string ...
+.Op Ar string ...
 .Sh DESCRIPTION
 .Nm
 prints up to 10 characters of each



arch(1): small cleanup

2015-09-23 Thread Michael Reed
Hi all,

I test it out as both `arch' and `machine' and didn't observe
any differences.  Also, I figured I might as well convert exit(3)
to return while touching this code, as was done in [1].

Regard,
Michael

[1]: https://marc.info/?l=openbsd-tech&m=144095769912804&w=2



Index: src/usr.bin/arch/arch.c
===
RCS file: /cvs/src/usr.bin/arch/arch.c,v
retrieving revision 1.14
diff -u -p -r1.14 arch.c
--- src/usr.bin/arch/arch.c 8 Feb 2015 23:40:34 -   1.14
+++ src/usr.bin/arch/arch.c 23 Sep 2015 20:09:18 -
@@ -25,7 +25,6 @@
 
 #include  /* MACHINE MACHINE_ARCH */
 
-#include 
 #include 
 #include 
 #include 
@@ -73,13 +72,10 @@ main(int argc, char *argv[])
usage();
/* NOTREACHED */
}
-   if (!short_form) {
-   fputs("OpenBSD", stdout);
-   fputc('.', stdout);
-   }
-   fputs(arch, stdout);
-   fputc('\n', stdout);
-   exit(0);
+   if (!short_form)
+   fputs("OpenBSD.", stdout);
+   puts(arch);
+   return 0;
 }
 
 static void



bsd.port.mk.5: Remove unneeded args to Nm

2015-09-22 Thread Michael Reed
In bsd.port.mk.5, the use of arguments to Nm is inconsistent,
and when they are used it's seemingly redundant; this patch
fixes that.

I verified there's no change in the formatted manual with this:
$ diff <{mandoc bsd.port.mk.5.orig} <{mandoc bsd.port.mk.5}

Finally, if anyone is wondering, line 1219 is dealt with in
the other diff I just sent out.


Index: bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.422
diff -u -p -r1.422 bsd.port.mk.5
--- bsd.port.mk.5   21 Sep 2015 09:06:33 -  1.422
+++ bsd.port.mk.5   22 Sep 2015 20:15:22 -
@@ -48,14 +48,14 @@ and they do have manpages under
 Other
 .Bx
 variants, as well as older versions of
-.Nm bsd.port.mk ,
+.Nm ,
 include other targets and variables.
 Conversion methods are outlined here.
 .Pp
 Most variables and targets are documented, with very few exceptions.
 .Pp
 This documentation covers the current targets, variables and paths used by
-.Nm bsd.port.mk .
+.Nm .
 There is a separate section covering the fake framework, a section
 explaining flavors and multi-packages, and a section covering
 the generation of package information.
@@ -2089,7 +2089,7 @@ Set to
 .Sq Yes
 if platform does not support shared libraries.
 To be tested after including
-.Nm bsd.port.mk ,
+.Nm ,
 or
 .Xr bsd.port.arch.mk 5 ,
 if neither PFRAG.shared nor CONFIGURE_SHARED are enough.
@@ -4155,7 +4155,7 @@ Old requirement script.
 Was mostly unused anyway.
 .It Pa /usr/share/mk/bsd.port.mk
 Original location of
-.Nm bsd.port.mk .
+.Nm .
 The current file lives under
 .Pa ${PORTSDIR}/infrastructure/mk/bsd.port.mk ,
 whereas



bsd.port.mk.5: Two small tweaks

2015-09-22 Thread Michael Reed
I'm pretty sure the use of Nm was previously wrong, but let me
know if I'm off the mark.

Index: src/share/man/man5/bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.422
diff -u -p -r1.422 bsd.port.mk.5
--- src/share/man/man5/bsd.port.mk.521 Sep 2015 09:06:33 -  1.422
+++ src/share/man/man5/bsd.port.mk.522 Sep 2015 20:01:33 -
@@ -1216,7 +1216,7 @@ If set to
 every package build will verify that shared libraries are correctly
 registered.
 This is essentially the same as running
-.Nm make Ar lib-depends-check
+.Cm make lib-depends-check
 after each package build.
 Defaults to
 .Sq \&No ,
@@ -2567,7 +2567,7 @@ If set to true,
 .Ar checksum
 will analyze ${CHECKSUM_FILE}, and try retrieving files with the correct
 checksum off
-.Pa ftp.openbsd.org ,
+.Lk ftp.openbsd.org ,
 in the directory
 .Pa /pub/OpenBSD/distfiles/$cipher/$value/$file .
 .It Ev REORDER_DEPENDENCIES



ports.7: Ar -> Va

2015-09-21 Thread Michael Reed
Hi all,

The variables below take arguments, but are not arguments themselves.
Given that, change the markup accordingly.

Regards,
Michael



Index: src/share/man/man7/ports.7
===
RCS file: /cvs/src/share/man/man7/ports.7,v
retrieving revision 1.103
diff -u -p -r1.103 ports.7
--- src/share/man/man7/ports.7  24 Aug 2015 12:57:14 -  1.103
+++ src/share/man/man7/ports.7  21 Sep 2015 20:44:42 -
@@ -445,10 +445,10 @@ A few remarks may save a lot of time
 The default limits in
 .Xr login.conf 5
 are inappropriate for bulk builds.
-.Ar maxproc , openfiles , datasize
+.Va maxproc , openfiles , datasize
 should be cranked way up, especially for parallel builds.
 For instance, a lot of C++-based ports will require a
-.Ar datasize
+.Va datasize
 over 1G.
 .It
 cluster builds should have shared



ports.7: tweak wording + punctuation

2015-09-21 Thread Michael Reed
Hi,

I found the wording in ports.7 awkward in a few places,
which this patch aims to fix.  Besides that, there's
a few small punctuation changes.

I've tried to only touch low-hanging fruit to avoid any
bikeshedding, but if you think any change is too subjective
just let me know.

Regards,
Michael



Index: src/share/man/man7/ports.7
===
RCS file: /cvs/src/share/man/man7/ports.7,v
retrieving revision 1.103
diff -u -p -r1.103 ports.7
--- src/share/man/man7/ports.7  24 Aug 2015 12:57:14 -  1.103
+++ src/share/man/man7/ports.7  21 Sep 2015 20:40:20 -
@@ -140,8 +140,7 @@ apply.
 .Sh TARGETS
 Individual ports are controlled through a few documented targets.
 Some of these targets work recursively through subdirectories, so that
-someone can, for example, install all of the net
-ports.
+someone can, for example, install all of the net ports.
 .Pp
 The variable
 .Ev SKIPDIR
@@ -429,7 +428,8 @@ This shows up as undefined references in
 is no choice but to proceed the old way: deinstall the offending package
 and everything built on top of it, build and install new packages.
 .Sh BULK PACKAGE BUILDING
-Building any significant number of packages from the ports tree should use
+Building any significant number of packages from the ports tree should be done
+with
 .Xr dpb 1 ,
 a tool located inside the ports tree proper
 .Po
@@ -439,7 +439,7 @@ normally as
 In particular, it can take advantage of machine clusters (same architecture
 and same installation), and of multi-core machines.
 .Pp
-A few remarks may save a lot of time
+A few remarks may save a lot of time:
 .Bl -bullet
 .It
 The default limits in
@@ -451,7 +451,7 @@ For instance, a lot of C++-based ports w
 .Ar datasize
 over 1G.
 .It
-cluster builds should have shared
+Cluster builds should have shared
 .Ev PORTSDIR
 and local
 .Ev WRKOBJDIR .
@@ -461,10 +461,10 @@ partitions mounted
 .Sq noatime,async
 will help.
 .It
-as far as possible, the log directory should be local to the machine running
+As far as possible, the log directory should be local to the machine running
 .Xr dpb 1 .
 .It
-a full bulk will fetch over 20G of distfiles, create over 17G of packages.
+A full bulk will fetch over 20G of distfiles and create over 17G of packages.
 The largest work directories are about 10G each.
 .It
 Take notice of
@@ -634,7 +634,7 @@ Location of the ports tree
 .Pa /usr/ports ) .
 .It Ev DISTDIR
 Where to find/put distfiles, normally
-.Pa ${PORTSDIR}/distfiles
+.Pa ${PORTSDIR}/distfiles .
 .It Ev PACKAGE_REPOSITORY
 Used only for the
 .Cm package



bsd.port.mk.5: Use Xr where appropriate

2015-09-20 Thread Michael Reed
Index: src/share/man/man5/bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.421
diff -u -p -r1.421 bsd.port.mk.5
--- src/share/man/man5/bsd.port.mk.520 Sep 2015 18:20:37 -  1.421
+++ src/share/man/man5/bsd.port.mk.520 Sep 2015 19:48:04 -
@@ -291,10 +291,9 @@ to change behavior.
 Do not touch
 .Ar pre-fake
 unless you really know what you are doing.
-Described in a separate section below
-.Po
-.Qq THE FAKE FRAMEWORK
-.Pc .
+See the
+.Sx THE FAKE FRAMEWORK
+section below.
 .It Ar fake-wantlib-args
 Check
 .Ev WANTLIB
@@ -379,8 +378,8 @@ Top-level target, see
 .It Ar install
 Install the package after building.
 See the description of
-.Qq THE FAKE FRAMEWORK
-for the non-intuitive details of the way
+.Sx THE FAKE FRAMEWORK
+section for the non-intuitive details of the way
 .Ar {pre,do,post}-install
 hooks are actually used by the ports tree.
 .It Ar install-all
@@ -573,7 +572,7 @@ In
 .Ev MULTI_PACKAGES
 setups,
 see
-.Qq Flavors and multi-packages .
+.Sx FLAVORS AND MULTI_PACKAGES .
 .It Ar print-package-args
 Print all dependency-related information that will be passed as parameters
 to
@@ -885,7 +884,7 @@ In a
 .Ev MULTI_PACKAGES
 setup, some variables have settings specific to a given subpackage.
 See
-.Qq Flavors and multi-packages .
+.Sx FLAVORS AND MULTI_PACKAGES .
 .Bl -tag -width MASTER_SITES
 .It Ev show
 Invoked as make show=name, show the contents of ${name}.
@@ -1005,7 +1004,7 @@ and
 The actual list of packages that will be built, once architecture problems
 and pseudo-flavors have been taken into account.
 See
-.Qq Flavors and multi-packages .
+.Sx FLAVORS AND MULTI_PACKAGES .
 .It Ev BROKEN
 Define only for broken ports, set to reason the port is broken.
 See also
@@ -1584,8 +1583,8 @@ Exposed so that modules may provide thei
 .Ar do-install .
 Read-only,
 see
-.Qq THE FAKE FRAMEWORK
-for details.
+.Sx THE FAKE FRAMEWORK
+section for details.
 .It Ev FAKE_TARGET
 Target built by ${MAKE_PROGRAM} on fake invocation.
 Defaults to ${INSTALL_TARGET}.
@@ -2009,7 +2008,7 @@ See
 .It Ev MULTI_PACKAGES
 Set to a list of subpackage extensions for ports that create multiple packages.
 See
-.Qq Flavors and multi-packages
+.Sx FLAVORS AND MULTI_PACKAGES
 below.
 Especially read the part about
 .Ev ONLY_FOR_ARCHS
@@ -2117,7 +2116,7 @@ Can hold both processor-specific informa
 specific model information (e.g., macppc).
 This is subpackage dependent.
 Read the corresponding part of
-.Qq Flavors and multi-packages
+.Sx FLAVORS AND MULTI_PACKAGES
 if some subpackages should only be built on some architectures.
 .It Ev OSREV
 Revision number of
@@ -2272,7 +2271,7 @@ Special arguments to pass to
 .Xr pkg_create 1 ,
 in addition to the default ones.
 For mips64 and pic libraries, see
-.Qq The generation of package information .
+.Sx THE GENERATION OF PACKAGE INFORMATION .
 .It Ev PKG_CREATE
 User settings.
 Path to
@@ -2886,8 +2885,8 @@ Mostly the same as ${PREFIX}, except it 
 during
 .Ar fake .
 Refer to
-.Qq THE FAKE FRAMEWORK
-for details.
+.Sx THE FAKE FRAMEWORK
+section for details.
 .It Ev TRY_BROKEN
 User settings.
 If set to
@@ -3407,7 +3406,9 @@ get copied to
 .Pa ${WRKINST}
 at the end of
 .Ar fake
-(see the FILES section above for details).
+(see the
+.Sx FILES
+section above for details).
 .Sh FLAVORS AND MULTI_PACKAGES
 Starting with
 .Ox 2.7 ,



perlpod conversion: crypto.3

2015-09-19 Thread Michael Reed
Hi,

This was done with pod2mdoc + various manual tweaking.

Besides the macro changes, there are few differences between the
original manual's text.  This is done in order to ease review.
This is the reason why there are many references to non-existent
manuals, e.g., rc4(3), stack(3), and txt_db(3).

If wanted, I'll remove the non-existent references.

Regards,
Michael



Index: src/lib/libcrypto/man/Makefile
===
RCS file: /cvs/src/lib/libcrypto/man/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- src/lib/libcrypto/man/Makefile  17 Sep 2015 14:43:23 -  1.24
+++ src/lib/libcrypto/man/Makefile  19 Sep 2015 20:41:54 -
@@ -52,6 +52,7 @@ MAN=  \
BN_swap.3 \
BN_zero.3 \
BUF_MEM_new.3 \
+   crypto.3 \
 
 GENMAN= \
CONF_modules_free.3 \
@@ -170,7 +171,6 @@ GENMAN= \
X509_verify_cert.3 \
bn.3 \
bn_internal.3 \
-   crypto.3 \
d2i_ASN1_OBJECT.3 \
d2i_DHparams.3 \
d2i_DSAPublicKey.3 \
Index: src/lib/libcrypto/man/crypto.3
===
RCS file: src/lib/libcrypto/man/crypto.3
diff -N src/lib/libcrypto/man/crypto.3
--- /dev/null   1 Jan 1970 00:00:00 -
+++ src/lib/libcrypto/man/crypto.3  19 Sep 2015 20:41:54 -
@@ -0,0 +1,94 @@
+.Dd September 19, 2015
+.Dt CRYPTO 3
+.Os
+.Sh NAME
+.Nm crypto
+.Nd OpenSSL cryptographic library
+.Sh DESCRIPTION
+The OpenSSL
+.Nm
+library implements a wide range of cryptographic algorithms used in various
+Internet standards.
+The services provided by this library are used by the OpenSSL implementations
+of SSL, TLS and S/MIME, and they have also been used to implement SSH,
+OpenPGP, and other cryptographic standards.
+.Sh OVERVIEW
+.Nm libcrypto
+consists of a number of sub-libraries that implement the individual
+algorithms.
+.Pp
+The functionality includes symmetric encryption, public key cryptography and
+key agreement, certificate handling, cryptographic hash functions and a
+cryptographic pseudo-random number generator.
+.Bl -tag -width 3n
+.It SYMMETRIC CIPHERS
+.Xr blowfish 3 ,
+.Xr cast 3 ,
+.Xr des 3 ,
+.Xr idea 3 ,
+.Xr rc2 3 ,
+.Xr rc4 3 ,
+.Xr rc5 3
+.It PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT
+.Xr dsa 3 ,
+.Xr dh 3 ,
+.Xr rsa 3
+.It CERTIFICATES
+.Xr x509 3 ,
+.Xr x509v3 3
+.It AUTHENTICATION CODES, HASH FUNCTIONS
+.Xr hmac 3 ,
+.Xr md2 3 ,
+.Xr md4 3 ,
+.Xr md5 3 ,
+.Xr ripemd 3 ,
+.Xr sha 3
+.It AUXILIARY FUNCTIONS
+.Xr err 3 ,
+.Xr threads 3 ,
+.Xr rand 3 ,
+.Xr OPENSSL_VERSION_NUMBER 3
+.It INPUT/OUTPUT, DATA ENCODING
+.Xr asn1 3 ,
+.Xr bio 3 ,
+.Xr evp 3 ,
+.Xr pem 3 ,
+.Xr pkcs7 3 ,
+.Xr pkcs12 3
+.It INTERNAL FUNCTIONS
+.Xr bn 3 ,
+.Xr buffer 3 ,
+.Xr ec 3 ,
+.Xr lhash 3 ,
+.Xr objects 3 ,
+.Xr stack 3 ,
+.Xr txt_db 3
+.El
+.Sh NOTES
+Some of the newer functions follow a naming convention using the numbers
+0 and 1.
+For example the functions:
+.Bd -literal
+.Ft int
+.Fn X509_CRL_add0_revoked "X509_CRL *crl" "X509_REVOKED *rev"
+.Ft int
+.Fn X509_add1_trust_object "X509 *x" "ASN1_OBJECT *obj"
+.Ed
+.Pp
+The 0 version uses the supplied structure pointer directly in the parent and
+it will be freed up when the parent is freed.
+In the above example
+.Fa crl
+would be freed, but
+.Fa rev
+would not.
+.Pp
+The 1 version uses a copy of the supplied structure pointer (or in some cases
+increases its link count) in the parent and so both
+.Fa x
+and
+.Fa obj
+should be freed up.
+.Sh SEE ALSO
+.Xr openssl 1 ,
+.Xr ssl 3
Index: src/lib/libssl/src/doc/crypto/crypto.pod
===
RCS file: src/lib/libssl/src/doc/crypto/crypto.pod
diff -N src/lib/libssl/src/doc/crypto/crypto.pod
--- src/lib/libssl/src/doc/crypto/crypto.pod14 Sep 2015 01:45:03 -  
1.10
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,85 +0,0 @@
-=pod
-
-=head1 NAME
-
-crypto - OpenSSL cryptographic library
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-The OpenSSL B library implements a wide range of cryptographic
-algorithms used in various Internet standards. The services provided
-by this library are used by the OpenSSL implementations of SSL, TLS
-and S/MIME, and they have also been used to implement SSH, OpenPGP, and
-other cryptographic standards.
-
-=head1 OVERVIEW
-
-B consists of a number of sub-libraries that implement the
-individual algorithms.
-
-The functionality includes symmetric encryption, public key
-cryptography and key agreement, certificate handling, cryptographic
-hash functions and a cryptographic pseudo-random number generator.
-
-=over 4
-
-=item SYMMETRIC CIPHERS
-
-L, L, L,
-L, L, L, L
-
-=item PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT
-
-L, L, L
-
-=item CERTIFICATES
-
-L, L
-
-=item AUTHENTICATION CODES, HASH FUNCTIONS
-
-L, L, L,
-L, L,
-L
-
-=item AUXILIARY FUNCTIONS
-
-L, L, L,
-L
-
-=item INPUT/OUTPUT, DATA ENCODING
-
-L, L, L, L,
-L, L
-
-=item INTERNAL FUNCTIO

bsd.port.mk.5: fix an external reference

2015-09-19 Thread Michael Reed
Index: bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.420
diff -u -p -r1.420 bsd.port.mk.5
--- bsd.port.mk.5   16 Sep 2015 19:59:57 -  1.420
+++ bsd.port.mk.5   19 Sep 2015 19:13:18 -
@@ -560,7 +560,7 @@ Resolve
 .Ev WANTLIB
 against the ports tree itself and system libraries, without looking at built
 or installed packages, and writes a list of options suitable for
-.Xr pkg-create 1 .
+.Xr pkg_create 1 .
 See
 .Ar print-package-args .
 .It Ar prepare



Re: bsd.port.mk.5: Misc. tweaks

2015-09-19 Thread Michael Reed
Hi Ingo,

On 09/16/15 16:16, Ingo Schwarze wrote:
> Hum, mixing small and large changes is not a very good idea.
> When proposing a large change, it is best to send one self-contained
> patch doing nothing but that large change.

Sure; unlike the LKML, it doesn't seem to be common practice here to
submit multi part patches ([1/10], [2/10], ...) simultaneously, so I
just made one big patch.  I'll avoid doing that in the future.

> And before spending a lot of time on a large patch, it may be useful
> to ask beforehand whether it's wanted (preferably directly to the
> developer in charge of the area, not on tech@, including a small
> patch just demonstrating the idea).  Regarding manuals, you can
> also ping me if you fail to get feedback otherwise or simply need
> general guidance; usually (not always) i come round to answering
> such queries.  When i don't and it's important, try again after about
> ten days.

Thanks for the advice.

Regards,
Michael



bsd.port.mk.5: Misc. tweaks

2015-09-12 Thread Michael Reed
Hi all,

This patch consists of three small changes and one large one.
The small changes are as follows:

- In two places, replaced `...' style quoting with Sq, which is used
  throughout the manual.
- added missing comma after `e.g.'
- fixed spelling of `licencing' -> `licensing'

The large change is converting the list in DIAGNOSTICS from this:

  .Bl -diag
  .It ...
  ...

to this:

  .Bl -ohang
  .It Sy ...
  ...

The old style resulted in item bodies starting on the same line as the
title, while the new style doesn't.  This idea was taken from mandoc.1,
and I find it more readable, but I'll drop the change if people don't
agree.

Regards,
Michael



Index: bsd.port.mk.5
===
RCS file: /cvs/src/share/man/man5/bsd.port.mk.5,v
retrieving revision 1.418
diff -u -p -r1.418 bsd.port.mk.5
--- bsd.port.mk.5   30 Jul 2015 08:03:50 -  1.418
+++ bsd.port.mk.5   12 Sep 2015 21:42:03 -
@@ -216,9 +216,11 @@ or
 .Va package ,
 clean subpackages as well.
 .It Va packages
-Shorthand for `sub package'.
+Shorthand for
+.Sq sub package .
 .It Va all
-Shorthand for `work flavors packages plist'.
+Shorthand for
+.Sq work flavors packages plist .
 .El
 .It Ar clean-depends
 Shorthand for make clean=depends.
@@ -858,7 +860,7 @@ may not handle flavor and multi-packages
 .It Ar verbose-show
 Similar to
 .Ar show ,
-except that it prefixes each value with the variable name, e.g.
+except that it prefixes each value with the variable name, e.g.,
 .Li VAR=value .
 Also note that it does not show undefined variables, contrary to
 .Ar show
@@ -3095,23 +3097,23 @@ Note that some of these messages are act
 commands, but grouped here for convenience: easier to look for in
 .Xr dpb 1 Ns 's
 logs.
-.Bl -diag
-.It "Discovered old directory in ..."
+.Bl -ohang
+.It Sy "Discovered old directory in ..."
 This message comes from
 .Xr make-plist 1 .
 A directory was found in the PLIST that used to be needed but is no longer,
 because it's now accounted for through dependencies.
 Indicates the old directory has been removed.
-.It "Error: change in plist between ..."
+.It Sy "Error: change in plist between ..."
 Error message comes from
 .Xr register-plist 1 .
-.It "Error: duplicate item in packing-list"
+.It Sy "Error: duplicate item in packing-list"
 Error message comes from
 .Xr pkg_create 1 ,
 and will result from incorrect packing-lists, such as including several
 fragments with the same file, or having incorrect
 .Ev PKG_ARGS-sub .
-.It "Error: Libraries in packing-lists...and libraries from installed packages 
don't match"
+.It Sy "Error: Libraries in packing-lists...and libraries from installed 
packages don't match"
 The ports tree and the installed packages are out-of-sync.
 Mixing library information from both sources might produce packages that can't
 be installed elsewhere.
@@ -3121,18 +3123,18 @@ Developers may use
 .Ev PKG_CREATE_NO_CHECKS
 instead, assuming they understand the implications.
 See print-package-args (wantlib-args) for details.
-.It "Fatal: can't flavor a SUBDIR"
+.It Sy "Fatal: can't flavor a SUBDIR"
 A dependency mentions top_subdir,flavor.
 Flavor would then be ignored, as it is only applied to individual ports.
-.It "Fatal: can't subpackage a SUBDIR"
+.It Sy "Fatal: can't subpackage a SUBDIR"
 A dependency mentions top_subdir,-sub.
 Subpackage would then be ignored, as it is only applied to individual ports.
-.It "Fatal: flavor should never start with a digit"
+.It Sy "Fatal: flavor should never start with a digit"
 This would utterly confuse
 .Xr pkg_add 1 .
 See
 .Xr packages-specs 7 .
-.It "Fatal: inclusion of  from "
+.It Sy "Fatal: inclusion of  from "
 .Pa bsd.port.mk
 or
 .Pa bsd.port.subdir.mk
@@ -3144,7 +3146,7 @@ resulting in a double inclusion.
 This would lead to weird results, such as
 .Ev PKG_ARGS
 being defined twice.
-.It "Fatal: SUBPACKAGES should always begin with -: "
+.It Sy "Fatal: SUBPACKAGES should always begin with -: "
 That is the only way to differentiate between
 .Ev FLAVOR
 and
@@ -3152,33 +3154,33 @@ and
 in
 .Xr pkgpath 7
 specifications.
-.It "Fatal: building ports requires correctly installed X11"
+.It Sy "Fatal: building ports requires correctly installed X11"
 All file sets of the base OS, including xenocara, must be installed
 before building ports.
-.It "Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink"
+.It Sy "Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink"
 /usr/local/lib/X11/app-defaults is distributed as a symlink in the
 xshare*.tgz file set.
 If xenocara was not fully installed before packages were added, it may
 have been created as a directory instead.
-.It "Fatal: the licencing info for  is incomplete..."
+.It Sy "Fatal: the licensing info for  is incomplete..."
 Every port must have explicit defines of all
 .Ev PERMIT_*
 values.
-.It "Fatal: Use 'env FLAVOR=flavor make' instead"
+.It Sy "Fatal: Use 'env FLAVOR=flavor make' instead"
 Arguments

Re: ntpd(8): Make -n quieter

2015-08-31 Thread Michael Reed
On 08/31/15 07:36, Sebastian Benoit wrote:
> Michael Reed(m.r...@mykolab.com) on 2015.08.30 14:58:35 -0400:
>> Hi all,
>>
>> If ntpd is run with the -n flag, and /etc/ntpd.conf is parsed without
>> error, then "Configuration OK" is printed.  I don't think this is
>> particularly useful, as both a lack of an error message and an exit
>> value of 0 already indicate success in this case.  This seems to be the
>> case for most (many?) programs in the base system, such as doas(1).
> 
> I like the message. Why is it a problem?
> 
> /Benno
> 

It's admittedly not much of a problem, more just to follow the Unix
principle of saying nothing if there's nothing wrong.

Regards,
Michael



Re: ntpd(8): Make -n quieter

2015-08-30 Thread Michael Reed
On 08/30/15 14:58, Michael Reed wrote:
> Hi all,
> 
> If ntpd is run with the -n flag, and /etc/ntpd.conf is parsed without
> error, then "Configuration OK" is printed.  I don't think this is
> particularly useful, as both a lack of an error message and an exit
> value of 0 already indicate success in this case.  This seems to be the
> case for most (many?) programs in the base system, such as doas(1).
> 
> Given that, I've removed the message
> 
> Regards,
> Michael
> 
> 
> 
> Index: ntpd.c
> ===
> RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
> retrieving revision 1.94
> diff -u -p -r1.94 ntpd.c
> --- ntpd.c18 Jul 2015 00:53:44 -  1.94
> +++ ntpd.c30 Aug 2015 18:42:06 -
> @@ -159,7 +159,6 @@ main(int argc, char *argv[])
>   exit(1);
>  
>   if (lconf.noaction) {
> - fprintf(stderr, "configuration OK\n");
>   exit(0);
>   }
>  
> 

In case this idea is accepted, here's an updated patch which does
the same for radiusd(8).


Index: src/usr.sbin/ntpd/ntpd.c
===
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.94
diff -u -p -r1.94 ntpd.c
--- src/usr.sbin/ntpd/ntpd.c18 Jul 2015 00:53:44 -  1.94
+++ src/usr.sbin/ntpd/ntpd.c30 Aug 2015 21:57:53 -
@@ -159,7 +159,6 @@ main(int argc, char *argv[])
exit(1);
 
if (lconf.noaction) {
-   fprintf(stderr, "configuration OK\n");
exit(0);
}
 
Index: src/usr.sbin/radiusd/radiusd.c
===
RCS file: /cvs/src/usr.sbin/radiusd/radiusd.c,v
retrieving revision 1.7
diff -u -p -r1.7 radiusd.c
--- src/usr.sbin/radiusd/radiusd.c  25 Aug 2015 01:12:59 -  1.7
+++ src/usr.sbin/radiusd/radiusd.c  30 Aug 2015 21:57:53 -
@@ -142,7 +142,6 @@ main(int argc, char *argv[])
if (parse_config(conffile, radiusd) != 0)
errx(EX_DATAERR, "config error");
if (noaction) {
-   fprintf(stderr, "configuration OK\n");
exit(EXIT_SUCCESS);
}
 



ntpd(8): Make -n quieter

2015-08-30 Thread Michael Reed
Hi all,

If ntpd is run with the -n flag, and /etc/ntpd.conf is parsed without
error, then "Configuration OK" is printed.  I don't think this is
particularly useful, as both a lack of an error message and an exit
value of 0 already indicate success in this case.  This seems to be the
case for most (many?) programs in the base system, such as doas(1).

Given that, I've removed the message

Regards,
Michael



Index: ntpd.c
===
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.94
diff -u -p -r1.94 ntpd.c
--- ntpd.c  18 Jul 2015 00:53:44 -  1.94
+++ ntpd.c  30 Aug 2015 18:42:06 -
@@ -159,7 +159,6 @@ main(int argc, char *argv[])
exit(1);
 
if (lconf.noaction) {
-   fprintf(stderr, "configuration OK\n");
exit(0);
}
 



Re: [PATCH] doas authentication type

2015-08-26 Thread Michael Reed
Hi Renauld,

On 08/26/15 09:38, Renaud Allard wrote:
> I rewrote a little bit the patch to remove a small kind-of typo in the 
> manpage and remove too long lines.
> So with this patch, you add the user the right to choose the authentication 
> style and administratively, in login.conf, you can restrict it.
> 
> Any comments? OK?

I left some comments inline

> 
> Index: doas.1
> ===
> RCS file: /cvs/src/usr.bin/doas/doas.1,v
> retrieving revision 1.14
> diff -u -r1.14 doas.1
> --- doas.127 Jul 2015 17:57:06 -1.14
> +++ doas.126 Aug 2015 13:34:14 -
> @@ -40,6 +40,16 @@
>  .Pp
>  The options are as follows:
>  .Bl -tag -width tenletters
> +.It Fl a Ar style

The usage string under SYNOPSIS should be updated too.

> +The
> +.Fl a
> +(authentication style) option causes
> +.Nm
> +to use the specified authentication style when validating the user,
> +as allowed by /etc/login.conf.

I think the two instances of `/etc/login.conf' should be specified using
the Pa macro, so that doas(1) also shows up if `apropos Pa=/etc/login.conf'
is executed, which currently gives plenty of results.

> +The system administrator may specify a list of doas-specific
> +authentication methods by adding an ``auth-doas''

Instead of ``...'', I think Sq or Dq should be used.

> +entry in /etc/login.conf.
>  .It Fl C Ar config
>  Parse and check the configuration file
>  .Ar config ,

Regards,
Michael



[patch] ctags(1): make -w the default

2015-08-24 Thread Michael Reed
Hi all,

As mentioned in the `EXIT STATUS' section of the ctags manual,
duplicate objects are not considered errors.  Given that, I don't
think warnings about them should be printed by default, especially since
they can fill a whole terminal screen and aren't particularly useful,
at least to me.

Assuming people like this idea, perhaps the flag should be changed to
-W to avoid any confusion for users used to the current behavior.

Regards,
Michael



Index: ctags.1
===
RCS file: /cvs/src/usr.bin/ctags/ctags.1,v
retrieving revision 1.30
diff -u -p -r1.30 ctags.1
--- ctags.1 22 Aug 2015 06:46:00 -  1.30
+++ ctags.1 24 Aug 2015 20:19:37 -
@@ -105,7 +105,7 @@ $ ctags -v files | sort -f > index
 $ vgrind -x index
 .Ed
 .It Fl w
-Suppress warning diagnostics.
+Print warning diagnostics.
 .It Fl x
 .Nm
 produces a list of object
Index: ctags.c
===
RCS file: /cvs/src/usr.bin/ctags/ctags.c,v
retrieving revision 1.16
diff -u -p -r1.16 ctags.c
--- ctags.c 22 Aug 2015 04:23:07 -  1.16
+++ ctags.c 24 Aug 2015 20:19:37 -
@@ -56,7 +56,7 @@ long  lineftell;  /* ftell after getc( in
 intlineno; /* line number of current line */
 intdflag;  /* -d: non-macro defines */
 intvflag;  /* -v: vgrind style index output */
-intwflag;  /* -w: suppress warnings */
+intwflag;  /* -w: print warnings */
 intxflag;  /* -x: cxref style output */
 
 char   *curfile;   /* current input file name */
Index: ctags.h
===
RCS file: /cvs/src/usr.bin/ctags/ctags.h,v
retrieving revision 1.9
diff -u -p -r1.9 ctags.h
--- ctags.h 22 Aug 2015 04:23:07 -  1.9
+++ ctags.h 24 Aug 2015 20:19:37 -
@@ -67,7 +67,7 @@ extern long   lineftell;  /* ftell after g
 extern int lineno; /* line number of current line */
 extern int dflag;  /* -d: non-macro defines */
 extern int vflag;  /* -v: vgrind style index output */
-extern int wflag;  /* -w: suppress warnings */
+extern int wflag;  /* -w: print warnings */
 extern int xflag;  /* -x: cxref style output */
 extern bool_wht[], _itk[], _btk[];
 extern charlbuf[LINE_MAX];
Index: tree.c
===
RCS file: /cvs/src/usr.bin/ctags/tree.c,v
retrieving revision 1.12
diff -u -p -r1.12 tree.c
--- tree.c  22 Aug 2015 04:23:07 -  1.12
+++ tree.c  24 Aug 2015 20:19:37 -
@@ -98,14 +98,14 @@ add_node(NODE *node, NODE *cur_node)
dif = strcmp(node->entry, cur_node->entry);
if (!dif) {
if (node->file == cur_node->file) {
-   if (!wflag)
+   if (wflag)
fprintf(stderr, "Duplicate entry in file %s, "
"line %d: %s\nSecond entry ignored\n",
node->file, lineno, node->entry);
return;
}
if (!cur_node->been_warned)
-   if (!wflag)
+   if (wflag)
fprintf(stderr, "Duplicate entry in files %s "
"and %s: %s (Warning only)\n",
node->file, cur_node->file, node->entry);



[patch] radiusd: rm -h flag, fail earlier (and print usage) given an unknown option

2015-08-24 Thread Michael Reed
Hi all,

This patch removes the -h flag because it seems very rare in
OpenBSD programs, perhaps because options are usually already
documented in manuals, as is the case for radiusd.  Regardless
of the rest of the system, I don't think an -h flag does much
good for radiusd given how simple its options are.

Regarding the second part of this patch: passing unknown options
to radiusd won't make it exit ASAP, and the usage information
won't be printed, as shown here:

% ./radiusd -asdjsaljdksad
radiusd: unknown option -- a
radiusd: unknown option -- s
radiusd: unknown option -- j
radiusd: unknown option -- s
radiusd: unknown option -- a
radiusd: unknown option -- l
radiusd: unknown option -- j
radiusd: unknown option -- k
radiusd: unknown option -- s
radiusd: unknown option -- a
2015-08-24 15:43:43:WARNING: /etc/radiusd.conf: No such file or directory
radiusd: config error

This patch makes this happen instead:

% ./radiusd -asdjsaljdksad
radiusd: unknown option -- a
usage: radiusd [-dn] [-f file]

This is done 

Regards,
Michael



Index: radiusd.8
===
RCS file: /cvs/src/usr.sbin/radiusd/radiusd.8,v
retrieving revision 1.5
diff -u -p -r1.5 radiusd.8
--- radiusd.8   28 Jul 2015 08:41:30 -  1.5
+++ radiusd.8   24 Aug 2015 19:32:48 -
@@ -22,7 +22,7 @@
 .Nd Remote Authentication Dial In User Service (RADIUS) daemon
 .Sh SYNOPSIS
 .Nm radiusd
-.Op Fl dhn
+.Op Fl dn
 .Op Fl f Ar file
 .Sh DESCRIPTION
 The
@@ -39,8 +39,6 @@ instead of
 and produce some additional debugging output.
 .It Fl f Ar file
 Specify an alternative configuration file.
-.It Fl h
-Display usage text and exit.
 .It Fl n
 Configtest mode.
 Only check the configuration file for validity.
Index: radiusd.c
===
RCS file: /cvs/src/usr.sbin/radiusd/radiusd.c,v
retrieving revision 1.6
diff -u -p -r1.6 radiusd.c
--- radiusd.c   2 Aug 2015 23:27:50 -   1.6
+++ radiusd.c   24 Aug 2015 19:32:48 -
@@ -94,7 +94,7 @@ usage(void)
 {
extern char *__progname;
 
-   fprintf(stderr, "usage: %s [-dhn] [-f file]\n", __progname);
+   fprintf(stderr, "usage: %s [-dn] [-f file]\n", __progname);
exit(EX_USAGE);
 }
 
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
bool noaction = false;
struct passwd   *pw;
 
-   while ((ch = getopt(argc, argv, "df:nh")) != -1)
+   while ((ch = getopt(argc, argv, "df:n")) != -1)
switch (ch) {
case 'd':
debug++;
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
noaction = true;
break;
 
-   case 'h':
+   default:
usage();
/* NOTREACHED */
}



[patch] radiusctl: clean up usage info + `return' from main()

2015-08-24 Thread Michael Reed
Hi all,

This patch does the following:
- Removes references to the -h flag, which was removed from radiusctl(8)
  a while ago.
- When in main(), use `return' instead of exit(3), which reduces the
  size of radiusctl a bit.  I find this more elegant, but that's subjective,
  so please feel free to just apply the first part of the patch.

Regards,
Michael


Index: radiusctl.8
===
RCS file: /cvs/src/usr.sbin/radiusctl/radiusctl.8,v
retrieving revision 1.2
diff -u -p -r1.2 radiusctl.8
--- radiusctl.8 3 Aug 2015 07:45:05 -   1.2
+++ radiusctl.8 24 Aug 2015 18:58:47 -
@@ -23,7 +23,6 @@
 .Nd control the RADIUS protocol daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl h
 .Ar command
 .Op Ar argument ...
 .Sh DESCRIPTION
Index: radiusctl.c
===
RCS file: /cvs/src/usr.sbin/radiusctl/radiusctl.c,v
retrieving revision 1.3
diff -u -p -r1.3 radiusctl.c
--- radiusctl.c 3 Aug 2015 07:49:05 -   1.3
+++ radiusctl.c 24 Aug 2015 18:58:47 -
@@ -46,7 +46,7 @@ usage(void)
 {
extern char *__progname;
 
-   fprintf(stderr, "usage: %s [-h] command [argument ...]\n", __progname);
+   fprintf(stderr, "usage: %s command [argument ...]\n", __progname);
 }
 
 int
@@ -59,13 +59,13 @@ main(int argc, char *argv[])
switch (ch) {
default:
usage();
-   exit(EX_USAGE);
+   return (EX_USAGE);
}
argc -= optind;
argv += optind;
 
if ((result = parse(argc, argv)) == NULL)
-   exit(EXIT_FAILURE);
+   return (EXIT_FAILURE);
 
switch (result->action) {
case NONE:
@@ -75,7 +75,7 @@ main(int argc, char *argv[])
break;
}
 
-   exit(EXIT_SUCCESS);
+   return (EXIT_SUCCESS);
 }
 
 static void



[patch] ports.7 macro fixes

2015-08-18 Thread Michael Reed
Hi,

This is in the same vein as [1], which replaced the usage of `Ar' with
`Cm' where applicable.  Besides that, I unindented line 134 because
`-offset indent' is already being used, but that's it.

Regards,
Michael

[1]: https://marc.info/?l=openbsd-tech&m=143778713715847&w=2



Index: src/share/man/man7/ports.7
===
RCS file: /cvs/src/share/man/man7/ports.7,v
retrieving revision 1.102
diff -u -p -r1.102 ports.7
--- src/share/man/man7/ports.7  30 Jul 2015 08:03:50 -  1.102
+++ src/share/man/man7/ports.7  18 Aug 2015 16:47:40 -
@@ -80,19 +80,19 @@ The ports master Makefile, normally loca
 below)
 offers a few useful targets.
 .Bl -tag -width configure
-.It Ar index
+.It Cm index
 rebuild the ports complete index,
 .Pa /usr/ports/INDEX
-.It Ar pkglocatedb
+.It Cm pkglocatedb
 build a
 .Xr pkg_mklocatedb 1
 database file and place it in
 .Pa ${PORTSDIR}/packages/${MACHINE_ARCH}/ftp ,
 for use by
 .Xr locate 1 ,
-.It Ar print-index
+.It Cm print-index
 display the contents of the index in a user-friendly way,
-.It Ar search
+.It Cm search
 invoked with a key, e.g.,
 .Ic make search key=foo ,
 retrieve information relevant to a given port (obsolescent).
@@ -128,10 +128,10 @@ port maintained by a given person.
 .El
 .Pp
 For instance, to invoke
-.Ar clean
+.Cm clean
 on all ports in the x11 category, one can say:
 .Bd -literal -offset indent
-   $ make category=x11 clean
+$ make category=x11 clean
 .Ed
 .Pp
 The index search is done by a perl script, so all regular expressions from
@@ -201,17 +201,17 @@ with the target that failed to
 and proceed.
 .Pp
 Some targets that do this are
-.Ar all , build , checksum , clean ,
-.Ar configure , extract , fake ,
-.Ar fetch , install , distclean ,
-.Ar deinstall , reinstall , package , prepare ,
-.Ar link-categories , unlink-categories ,
-.Ar describe , show , regress ,
-.Ar lib-depends-check , homepage-links , manpages-check ,
-.Ar license-check , all-dir-depends , build-dir-depends ,
-.Ar run-dir-depends
+.Cm all , build , checksum , clean ,
+.Cm configure , extract , fake ,
+.Cm fetch , install , distclean ,
+.Cm deinstall , reinstall , package , prepare ,
+.Cm link-categories , unlink-categories ,
+.Cm describe , show , regress ,
+.Cm lib-depends-check , homepage-links , manpages-check ,
+.Cm license-check , all-dir-depends , build-dir-depends ,
+.Cm run-dir-depends
 and
-.Ar readmes .
+.Cm readmes .
 .Pp
 Target names starting with
 .Sq _
@@ -221,26 +221,26 @@ should not be invoked directly, and are 
 In the following list, each target will run the preceding targets
 in order automatically.
 That is,
-.Ar build
+.Cm build
 will be run
 .Pq if necessary
 by
-.Ar install ,
+.Cm install ,
 and so on all the way to
-.Ar fetch .
+.Cm fetch .
 In typical use, one will only run
-.Ar install
+.Cm install
 explicitly (as normal user, with
 .Ev SUDO
 defined in
 .Pa /etc/mk.conf ) ,
 or
-.Ar build
+.Cm build
 (as user), then
-.Ar install
+.Cm install
 (as root).
 .Bl -tag -width configure
-.It Ar fetch
+.It Cm fetch
 Fetch all of the files needed to build this port from the site(s)
 listed in
 .Ev MASTER_SITES .
@@ -253,7 +253,7 @@ Use
 with option
 .Fl F
 to quickly fetch distfiles for a subtree.
-.It Ar checksum
+.It Cm checksum
 Verify that the fetched distfile matches the one the port was tested against.
 Defining
 .Ev NO_CHECKSUM
@@ -270,7 +270,7 @@ $ make checksum REFETCH=true
 .Ed
 .Pp
 will try to get a set of distfiles that match the recorded checksum.
-.It Ar prepare
+.It Cm prepare
 Install
 any build dependencies of the current port.
 Defining
@@ -278,63 +278,63 @@ Defining
 to
 .Dv Yes
 will skip this step.
-.It Ar extract
+.It Cm extract
 Expand the distfile into a work directory.
-.It Ar patch
+.It Cm patch
 Apply any patches that are necessary for the port.
-.It Ar configure
+.It Cm configure
 Configure the port.
 Some ports will ask questions during this stage.
 See
 .Ev INTERACTIVE
 and
 .Ev BATCH .
-.It Ar build
+.It Cm build
 Build the port.
 This is the same as calling the
-.Ar all
+.Cm all
 target.
-.It Ar fake
+.It Cm fake
 Pretend to install the port under a subdirectory of the work directory.
-.It Ar package
+.It Cm package
 Create a binary package from the fake installation.
 The package is a .tgz file that can be used to
 install the port with
 .Xr pkg_add 1 .
-.It Ar install
+.It Cm install
 Install the resulting package.
 .El
 .Pp
 The following targets are not run during the normal install process.
 .Bl -tag -width fetch-list
-.It Ar print-build-depends , print-run-depends
+.It Cm print-build-depends , print-run-depends
 Print an ordered list of all the compile and run dependencies.
-.It Ar clean
+.It Cm clean
 Remove the expanded source code.
 This does not recurse to dependencies unless
 .Ev CLEANDEPENDS
 is defined to
 .Dv Yes .
-.It Ar distclean
+.It Cm distclean
 Remove the port's distfile(s).
 This does not recurse to dependencies.
-.It Ar regress
+.It Cm regres

vipw.8: small improvement

2015-08-10 Thread Michael Reed
Hi,

I figure that the text which this diff removes wasn't of much use
besides stating the obvious, as the meaning of list items in the
ENVIRONMENT section seems pretty consistent across the man pages.

Regards,
Michael


Index: src/usr.sbin/vipw/vipw.8
===
RCS file: /cvs/src/usr.sbin/vipw/vipw.8,v
retrieving revision 1.12
diff -u -p -r1.12 vipw.8
--- src/usr.sbin/vipw/vipw.813 Mar 2015 19:58:41 -  1.12
+++ src/usr.sbin/vipw/vipw.810 Aug 2015 19:24:26 -
@@ -77,8 +77,6 @@ Which type of cipher is used to encrypt 
 depends on the configuration in
 .Xr login.conf 5 .
 .Sh ENVIRONMENT
-If the following environment variable exists it will be utilized by
-.Nm vipw :
 .Bl -tag -width EDITOR
 .It Ev EDITOR
 The editor specified by the string



worm(6): exit earlier if given invalid arg

2015-08-10 Thread Michael Reed
Hi tech@,

I only have a very loose idea of what gets accepted or not when the tree
is "locked", so apologies if this should have been sent at a different
time.

If I launch worm(6) with an invalid argument, my terminal flashes once
before the strtonum error message is shown.  I assume this is because
various curses functions are called prior to the strtonum block, so the
patch below makes worm(6) quit sooner if an invalid argument is given.

I can reproduce this in st(1) if it's full-screened, as well as in xterm
(although it's less pronounced, not sure why).

Regards,
Michael

Index: worm.c
===
RCS file: /cvs/src/games/worm/worm.c,v
retrieving revision 1.28
diff -u -p -r1.28 worm.c
--- worm.c  9 Mar 2015 19:52:02 -   1.28
+++ worm.c  10 Aug 2015 19:06:06 -
@@ -93,6 +93,14 @@ main(int argc, char **argv)
struct pollfd pfd[1];
const char *errstr;
 
+   if (argc >= 2) {
+   start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
+   &errstr);
+   if (errstr) {
+   endwin();
+   errx(1, "length argument is %s.", errstr);
+   }
+   }
setbuf(stdout, outbuf);
signal(SIGINT, leave);
signal(SIGQUIT, leave);
@@ -110,14 +118,6 @@ main(int argc, char **argv)
growthscale = COLS * LINES / 2000;
if (growthscale == 0)
growthscale = 1;
-   if (argc >= 2) {
-   start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
-   &errstr);
-   if (errstr) {
-   endwin();
-   errx(1, "length argument is %s.", errstr);
-   }
-   }
stw = newwin(1, COLS-1, 0, 0);
tv = newwin(LINES-1, COLS-1, 1, 0);
box(tv, '*', '*');



Update afterboot(8) for new PermitRootLogin default

2015-07-31 Thread Michael Reed
Hi all,

I noticed that the default for the sshd_config option "PermitRootLogin"
changed from "yes" to "no" [1], but afterboot(8) still refers to it as
if "yes" is the default.

Perhaps the sub-section could be reworded a bit to clarify the new
default, but I'll leave that to the developers as I'm unsure what they want.

Regards,
Michael

[1]: http://www.openbsd.org/faq/current.html#20150428



Index: src/share/man/man8/afterboot.8
===
RCS file: /cvs/src/share/man/man8/afterboot.8,v
retrieving revision 1.147
diff -u -p -r1.147 afterboot.8
--- src/share/man/man8/afterboot.8  30 Jul 2015 08:03:49 -  1.147
+++ src/share/man/man8/afterboot.8  31 Jul 2015 23:02:11 -
@@ -90,12 +90,12 @@ If that option was not used, see the par
 .Sx Add new users
 below.
 .Pp
-To deny root logins over the network, edit the
+To permit root logins over the network, edit the
 .Pa /etc/ssh/sshd_config
 file and set
 .Cm PermitRootLogin
 to
-.Dq no
+.Dq yes
 (see
 .Xr sshd_config 5 ) .
 .Ss Root password



Re: doas man page improvements

2015-07-25 Thread Michael Reed
On 07/25/15 15:01, Jason McIntyre wrote:
> i do appreciate the mail - diffs are always welcome. but with markup i
> just find myslef less inclined to mark up everything because i can. it's
> only my opinion.
> 
> jmc


I've made a much smaller diff, including only the two bits you okay'd
and the keepenv bit, which you said still needs confirmation from
another developer. Thanks for all the feedback.

Regards,
Michael



Index: src/usr.bin/doas/doas.1
===
RCS file: /cvs/src/usr.bin/doas/doas.1,v
retrieving revision 1.10
diff -u -p -r1.10 doas.1
--- src/usr.bin/doas/doas.1 21 Jul 2015 17:49:33 -  1.10
+++ src/usr.bin/doas/doas.1 25 Jul 2015 20:19:59 -
@@ -65,6 +65,7 @@ The password was incorrect.
 The actual program is absent or not executable.
 .El
 .Sh SEE ALSO
+.Xr su 1 ,
 .Xr doas.conf 5
 .Sh HISTORY
 The
Index: src/usr.bin/doas/doas.conf.5
===
RCS file: /cvs/src/usr.bin/doas/doas.conf.5,v
retrieving revision 1.11
diff -u -p -r1.11 doas.conf.5
--- src/usr.bin/doas/doas.conf.523 Jul 2015 15:26:37 -  1.11
+++ src/usr.bin/doas/doas.conf.525 Jul 2015 20:19:59 -
@@ -57,12 +57,14 @@ The default is to reset the environment,
 .Ev USER
 and
 .Ev USERNAME .
-.It Ic keepenv { Oo variable names Oc Ic }
-Reset the environment, but keep the space-separated specified variables.
+.It Ic keepenv { Oo Ar variable ... Oc Ic }
+In addition to the variables mentioned above, keep the space-separated
+specified variables.
 .El
 .It Ar identity
 The username to match.
-Groups may be specified by prepending a colon (:).
+Groups may be specified by prepending a colon
+.Pq Sq \&: .
 Numeric IDs are also accepted.
 .It Ic as Ar target
 The target user the running user is allowed to run the command as.



Re: doas man page improvements

2015-07-25 Thread Michael Reed
Hi Jason,

I've left replies inline and a new patch at the bottom with the
following changes:
- dropped the subjective wording and markup changes
- dropped su.1 change

On 07/25/15 03:58, Jason McIntyre wrote:
>>  The default is root.
>> .El
>> +.Sh FILES
>> +.Bl -tag -width
>> /etc/doas.conff
>> +.It Pa /etc/doas.conf
>> +configuration file
>> +.El
> again it's correct, but doesn;t really add anything.>

Most every utility I looked through which used a configuration file in
/etc/ had an entry for it in FILES. I figure it's more obvious than a
comparatively small mention in SEE ALSO.

>> Index: src/usr.bin/doas/doas.conf.5
>> ===
>> RCS file: /cvs/src/usr.bin/doas/doas.conf.5,v
>> retrieving revision 1.11
>> diff -u -p -r1.11 doas.conf.5
>> --- src/usr.bin/doas/doas.conf.5 23 Jul 2015 15:26:37 -  1.11
>> +++ src/usr.bin/doas/doas.conf.5 25 Jul 2015 03:16:26 -
>> @@ -57,27 +57,32 @@ The default is to reset the environment,
>>  .Ev USER
>>  and
>>  .Ev USERNAME .
>> -.It Ic keepenv { Oo variable names Oc Ic }
>> -Reset the environment, but keep the space-separated specified variables.
>> +.It Ic keepenv { Oo Ar variable ... Oc Ic }
>> +In addition to the variables mentioned above, keep the space-separated
>> +specified variables.
> 
> is that correct? is there no way to totally reset your environment
> keeping only stuff you specify?

I couldn't manage to get around that:

~ $ cat /etc/doas.conf
permit keepenv { PKG_PATH CVSROOT } :wheel
~ $ doas env
Password:
DISPLAY=:0
HOME=/home/michael
LOGNAME=michael
MAIL=/var/mail/michael
PATH=...
TERM=st-256color
USER=michael
PKG_PATH=...
CVSROOT=...
~ $


>>  The default is root.
>>  .It Ic cmd Ar command
>> -The command the user is allowed or denied to run.
>> +The command the user is allowed or prohibited to run.
> 
> why this?

Denied sounds like it's already happened, where as I find `prohibited'
to be more clearly an opposite of `allowed'.

>>  .El
>>  .Pp
>>  The last matching rule determines the action taken.
>> @@ -109,7 +114,9 @@ variables
>>  .Ev PS1 ,
>>  and
>>  .Ev SSH_AUTH_SOCK ,
>> -and additionally permits tedu to run procmap as root without a password.
>> +and additionally permits tedu to run
>> +.Xr procmap 1
>> +as root without a password.
> 
> well it's not as if it helps to refer the reader to the procmap page.
> again it's not wrong, it just doesn;t feel like it adds anything helpful

Eh, it's admittedly not that helpful, but I don't see any downside to
it; it makes it clear that procmap(1) is a utility, which seem to be
marked up like above consistently in the tree.


Anyways, new (smaller) diff is below.

Regards,
Michael


Index: doas.1
===
RCS file: /cvs/src/usr.bin/doas/doas.1,v
retrieving revision 1.10
diff -u -p -r1.10 doas.1
--- doas.1  21 Jul 2015 17:49:33 -  1.10
+++ doas.1  25 Jul 2015 11:19:15 -
@@ -44,10 +44,17 @@ Execute the shell from
 or
 .Pa /etc/passwd .
 .It Fl u Ar user
-Execute the command as
+Execute
+.Ar command
+as
 .Ar user .
 The default is root.
 .El
+.Sh FILES
+.Bl -tag -width /etc/doas.conff
+.It Pa /etc/doas.conf
+configuration file
+.El
 .Sh EXIT STATUS
 .Ex -std doas
 It may fail for one of the following reasons:
@@ -65,6 +72,7 @@ The password was incorrect.
 The actual program is absent or not executable.
 .El
 .Sh SEE ALSO
+.Xr su 1 ,
 .Xr doas.conf 5
 .Sh HISTORY
 The
Index: doas.conf.5
===
RCS file: /cvs/src/usr.bin/doas/doas.conf.5,v
retrieving revision 1.11
diff -u -p -r1.11 doas.conf.5
--- doas.conf.5 23 Jul 2015 15:26:37 -  1.11
+++ doas.conf.5 25 Jul 2015 11:19:15 -
@@ -57,18 +57,20 @@ The default is to reset the environment,
 .Ev USER
 and
 .Ev USERNAME .
-.It Ic keepenv { Oo variable names Oc Ic }
-Reset the environment, but keep the space-separated specified variables.
+.It Ic keepenv { Oo Ar variable ... Oc Ic }
+In addition to the variables mentioned above, keep the space-separated
+specified variables.
 .El
 .It Ar identity
 The username to match.
-Groups may be specified by prepending a colon (:).
+Groups may be specified by prepending a colon
+.Pq Sq \&: .
 Numeric IDs are also accepted.
 .It Ic as Ar target
 The target user the running user is allowed to run the command as.
 The default is root.
 .It Ic cmd Ar command
-The command the user is allowed or denied to run.
+The command the user is allowed or prohibited to run.
 The default is all commands.
 Be advised that it's best to specify absolute paths.
 .It Ic args ...
@@ -109,7 +111,9 @@ variables
 .Ev PS1 ,
 and
 .Ev SSH_AUTH_SOCK ,
-and additionally permits tedu to run procmap as root without a password.
+and additionally permits tedu to run
+.Xr procmap 1
+as root without a password.
 .Bd -literal -offset indent
 # Non-exhaustive list of variables needed to
 # build release(8) and ports(7)



doas man page improvements

2015-07-24 Thread Michael Reed
Hi,

This makes some minor improvements to doas.1, doas.conf.5, and (just
barely) su.1.

A lot of this was just annotating `command` with Ar, which I find
helpful when reading man pages as immediately know it's an argument; not
sure what everyone else thinks.

According to apropos(1), there's a few more references to sudo(8), but
I've only dealt with the one in su.1 in order to match the corresponding
`SEE ALSO` section in doas.1.

Regards,
Michael


Index: src/usr.bin/doas/doas.1
===
RCS file: /cvs/src/usr.bin/doas/doas.1,v
retrieving revision 1.10
diff -u -p -r1.10 doas.1
--- src/usr.bin/doas/doas.1 21 Jul 2015 17:49:33 -  1.10
+++ src/usr.bin/doas/doas.1 25 Jul 2015 03:16:26 -
@@ -37,17 +37,26 @@ The options are as follows:
 Parse and check the configuration file
 .Ar config ,
 then exit.
-No command is executed.
+No
+.Ar command
+is executed.
 .It Fl s
 Execute the shell from
 .Ev SHELL
 or
 .Pa /etc/passwd .
 .It Fl u Ar user
-Execute the command as
+Execute
+.Ar command
+as
 .Ar user .
 The default is root.
 .El
+.Sh FILES
+.Bl -tag -width /etc/doas.conff
+.It Pa /etc/doas.conf
+configuration file
+.El
 .Sh EXIT STATUS
 .Ex -std doas
 It may fail for one of the following reasons:
@@ -65,6 +74,7 @@ The password was incorrect.
 The actual program is absent or not executable.
 .El
 .Sh SEE ALSO
+.Xr su 1 ,
 .Xr doas.conf 5
 .Sh HISTORY
 The
Index: src/usr.bin/doas/doas.conf.5
===
RCS file: /cvs/src/usr.bin/doas/doas.conf.5,v
retrieving revision 1.11
diff -u -p -r1.11 doas.conf.5
--- src/usr.bin/doas/doas.conf.523 Jul 2015 15:26:37 -  1.11
+++ src/usr.bin/doas/doas.conf.525 Jul 2015 03:16:26 -
@@ -57,27 +57,32 @@ The default is to reset the environment,
 .Ev USER
 and
 .Ev USERNAME .
-.It Ic keepenv { Oo variable names Oc Ic }
-Reset the environment, but keep the space-separated specified variables.
+.It Ic keepenv { Oo Ar variable ... Oc Ic }
+In addition to the variables mentioned above, keep the space-separated
+specified variables.
 .El
 .It Ar identity
 The username to match.
-Groups may be specified by prepending a colon (:).
+Groups may be specified by prepending a colon
+.Pq Sq \&: .
 Numeric IDs are also accepted.
 .It Ic as Ar target
-The target user the running user is allowed to run the command as.
+The target user that the running user is allowed to run the command as.
 The default is root.
 .It Ic cmd Ar command
-The command the user is allowed or denied to run.
+The command the user is allowed or prohibited to run.
 The default is all commands.
 Be advised that it's best to specify absolute paths.
 .It Ic args ...
-Arguments to command.
+Arguments to
+.Ar command .
 If specified, the command arguments provided by the user
 need to match for the command to be successful.
 Specifying
 .Ic args
-alone means that command should be run without any arguments.
+alone means that
+.Ar command
+should be run without any arguments.
 .El
 .Pp
 The last matching rule determines the action taken.
@@ -109,7 +114,9 @@ variables
 .Ev PS1 ,
 and
 .Ev SSH_AUTH_SOCK ,
-and additionally permits tedu to run procmap as root without a password.
+and additionally permits tedu to run
+.Xr procmap 1
+as root without a password.
 .Bd -literal -offset indent
 # Non-exhaustive list of variables needed to
 # build release(8) and ports(7)
Index: src/usr.bin/su/su.1
===
RCS file: /cvs/src/usr.bin/su/su.1,v
retrieving revision 1.30
diff -u -p -r1.30 su.1
--- src/usr.bin/su/su.1 24 Apr 2014 14:14:08 -  1.30
+++ src/usr.bin/su/su.1 25 Jul 2015 03:16:26 -
@@ -258,13 +258,13 @@ Same as above, but use S/Key for authent
 .Pp
 .Dl $ su -a skey -l foo
 .Sh SEE ALSO
+.Xr doas 1 ,
 .Xr login 1 ,
 .Xr setusercontext 3 ,
 .Xr group 5 ,
 .Xr login.conf 5 ,
 .Xr passwd 5 ,
-.Xr environ 7 ,
-.Xr sudo 8
+.Xr environ 7
 .Sh HISTORY
 A
 .Nm



rcctl.8 macro fixes

2015-07-24 Thread Michael Reed
Hi,

mdoc(7) states that the Cm macro should be used for "fixed strings
passed as arguments, unless Fl is more appropriate", which seems like a
better fit for the below cases than Ar.

Regards,
Michael

Index: rcctl.8
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.8,v
retrieving revision 1.20
diff -u -p -r1.20 rcctl.8
--- rcctl.8 15 Jul 2015 05:51:08 -  1.20
+++ rcctl.8 25 Jul 2015 01:09:05 -
@@ -86,21 +86,21 @@ but returns the default values.
 .It Cm ls Ar lsarg
 Display a list of services and daemons matching
 .Ar lsarg .
-.Ar lsargs
+.Ar lsarg
 can be one of:
 .Pp
 .Bl -tag -width started -offset indent -compact
-.It Ar all
+.It Cm all
 all services and daemons
-.It Ar faulty
+.It Cm faulty
 enabled but stopped daemons
-.It Ar off
+.It Cm off
 disabled services and daemons
-.It Ar on
+.It Cm on
 enabled services and daemons
-.It Ar started
+.It Cm started
 running daemons
-.It Ar stopped
+.It Cm stopped
 stopped daemons
 .El
 .It Cm order Op Ar daemons
@@ -162,7 +162,7 @@ exits with 0 if the daemon or service is
 .Nm Cm getdef Ar daemon | service Op Cm status
 exits with 0 if the daemon or service is enabled by default
 and 1 if it is not.
-.Nm Cm ls Ar faulty
+.Nm Cm ls faulty
 exits with 1 if an enabled daemon is not running.
 Otherwise, the
 .Nm