[hackers] [dmenu][patch] Rewrite manpages to use mdoc(7) format.

From: Stephen Gregoratto <dev_AT_sgregoratto.me>
Date: Tue, 20 Nov 2018 16:55:13 +1100

This expresses the same information in much simpler syntax, along with a
hefty line reduction. Tested using groff 1.22.3 & OpenBSD mandoc 1.14.4.
Also replaced the sed command with cp in the Makefile, as mdoc pages
are versioned by date.
---
 Makefile |   4 +-
 dmenu.1  | 245 ++++++++++++++++++++++---------------------------------
 stest.1  | 114 +++++++++++---------------
 3 files changed, 147 insertions(+), 216 deletions(-)
diff --git a/Makefile b/Makefile
index a03a95c..2231dd2 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -48,8 +48,8 @@ install: all
 	chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
 	chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
-	sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
-	sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1
+	cp dmenu.1 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
+	cp stest.1 $(DESTDIR)$(MANPREFIX)/man1/stest.1
 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1
 
diff --git a/dmenu.1 b/dmenu.1
index c065087..0ac46d0 100644
--- a/dmenu.1
+++ b/dmenu.1
_AT_@ -1,194 +1,143 @@
-.TH DMENU 1 dmenu\-VERSION
-.SH NAME
-dmenu \- dynamic menu
-.SH SYNOPSIS
-.B dmenu
-.RB [ \-bfiv ]
-.RB [ \-l
-.IR lines ]
-.RB [ \-m
-.IR monitor ]
-.RB [ \-p
-.IR prompt ]
-.RB [ \-fn
-.IR font ]
-.RB [ \-nb
-.IR color ]
-.RB [ \-nf
-.IR color ]
-.RB [ \-sb
-.IR color ]
-.RB [ \-sf
-.IR color ]
-.RB [ \-w
-.IR windowid ]
-.P
-.BR dmenu_run " ..."
-.SH DESCRIPTION
-.B dmenu
+.Dd November 20, 2018
+.Dt DMENU 1
+.Sh NAME
+.Nm dmenu
+.Nd dynamic menu
+.Sh SYNOPSIS
+.Nm dmenu
+.Op Fl bfiv
+.Op Fl l Ar lines
+.Op Fl m Ar monitor
+.Op Fl p Ar prompt
+.Op Fl fn Ar font
+.Op Fl nb Ar color
+.Op Fl nf Ar color
+.Op Fl sb Ar color
+.Op Fl sf Ar color
+.Op Fl w Ar windowid
+.Nm dmenu_run "..."
+.Sh DESCRIPTION
+.Nm dmenu
 is a dynamic menu for X, which reads a list of newline\-separated items from
-stdin.  When the user selects an item and presses Return, their choice is printed
-to stdout and dmenu terminates.  Entering text will narrow the items to those
+stdin. When the user selects an item and presses Return, their choice is printed
+to stdout and dmenu terminates. Entering text will narrow the items to those
 matching the tokens in the input.
-.P
-.B dmenu_run
+.Nm dmenu_run
 is a script used by
-.IR dwm (1)
+.Xr dwm 1
 which lists programs in the user's $PATH and runs the result in their $SHELL.
-.SH OPTIONS
-.TP
-.B \-b
-dmenu appears at the bottom of the screen.
-.TP
-.B \-f
-dmenu grabs the keyboard before reading stdin.  This is faster, but will lock up
-X until stdin reaches end\-of\-file.
-.TP
-.B \-i
-dmenu matches menu items case insensitively.
-.TP
-.BI \-l " lines"
-dmenu lists items vertically, with the given number of lines.
-.TP
-.BI \-m " monitor"
-dmenu is displayed on the monitor number supplied. Monitor numbers are starting
-from 0.
-.TP
-.BI \-p " prompt"
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl b
+.Nm
+appears at the bottom of the screen.
+.It Fl f
+grab the keyboard before reading from the standard input. This is faster,
+but will lock up X until the standard input reaches end\-of\-file.
+.It Fl i
+matches menu items case insensitively.
+.It Fl l Ar lines
+list items vertically, with the given number of
+.Ar lines "."
+.It Fl m Ar monitor
+.Nm
+is displayed on the monitor number supplied, starting from 0.
+.It Fl p Ar prompt
 defines the prompt to be displayed to the left of the input field.
-.TP
-.BI \-fn " font"
+.It Fl fn Ar font
 defines the font or font set used.
-.TP
-.BI \-nb " color"
+.It Fl nb Ar color
 defines the normal background color.
-.IR #RGB ,
-.IR #RRGGBB ,
+.Ar #RGB ","
+.Ar #RRGGBB ","
 and X color names are supported.
-.TP
-.BI \-nf " color"
+.It Fl nf Ar color
 defines the normal foreground color.
-.TP
-.BI \-sb " color"
+.It Fl sb Ar color
 defines the selected background color.
-.TP
-.BI \-sf " color"
+.It Fl sf Ar color
 defines the selected foreground color.
-.TP
-.B \-v
-prints version information to stdout, then exits.
-.TP
-.BI \-w " windowid"
+.It Fl v
+prints version information to the standard output, then exits.
+.It Fl w Ar windowid
 embed into windowid.
-.SH USAGE
-dmenu is completely controlled by the keyboard.  Items are selected using the
+.El
+.Sh USAGE
+dmenu is completely controlled by the keyboard. Items are selected using the
 arrow keys, page up, page down, home, and end.
-.TP
-.B Tab
+.Bl -tag -width Ds
+.It Sy Tab
 Copy the selected item to the input field.
-.TP
-.B Return
-Confirm selection.  Prints the selected item to stdout and exits, returning
+.It Sy Return
+Confirm selection. Prints the selected item to stdout and exits, returning
 success.
-.TP
-.B Ctrl-Return
-Confirm selection.  Prints the selected item to stdout and continues.
-.TP
-.B Shift\-Return
-Confirm input.  Prints the input text to stdout and exits, returning success.
-.TP
-.B Escape
+.It Sy Ctrl-Return
+Confirm selection. Prints the selected item to stdout and continues.
+.It Sy Shift\-Return
+Confirm input. Prints the input text to stdout and exits, returning success.
+.It Sy Escape
 Exit without selecting an item, returning failure.
-.TP
-.B Ctrl-Left
+.It Sy Ctrl-Left
 Move cursor to the start of the current word
-.TP
-.B Ctrl-Right
+.It Sy Ctrl-Right
 Move cursor to the end of the current word
-.TP
-.B C\-a
+.It C\-a
 Home
-.TP
-.B C\-b
+.It C\-b
 Left
-.TP
-.B C\-c
+.It C\-c
 Escape
-.TP
-.B C\-d
+.It C\-d
 Delete
-.TP
-.B C\-e
+.It C\-e
 End
-.TP
-.B C\-f
+.It C\-f
 Right
-.TP
-.B C\-g
+.It C\-g
 Escape
-.TP
-.B C\-h
+.It C\-h
 Backspace
-.TP
-.B C\-i
+.It C\-i
 Tab
-.TP
-.B C\-j
+.It C\-j
 Return
-.TP
-.B C\-J
+.It C\-J
 Shift-Return
-.TP
-.B C\-k
+.It C\-k
 Delete line right
-.TP
-.B C\-m
+.It C\-m
 Return
-.TP
-.B C\-M
+.It C\-M
 Shift-Return
-.TP
-.B C\-n
+.It C\-n
 Down
-.TP
-.B C\-p
+.It C\-p
 Up
-.TP
-.B C\-u
+.It C\-u
 Delete line left
-.TP
-.B C\-w
+.It C\-w
 Delete word left
-.TP
-.B C\-y
+.It C\-y
 Paste from primary X selection
-.TP
-.B C\-Y
+.It C\-Y
 Paste from X clipboard
-.TP
-.B M\-b
+.It M\-b
 Move cursor to the start of the current word
-.TP
-.B M\-f
+.It M\-f
 Move cursor to the end of the current word
-.TP
-.B M\-g
+.It M\-g
 Home
-.TP
-.B M\-G
+.It M\-G
 End
-.TP
-.B M\-h
+.It M\-h
 Up
-.TP
-.B M\-j
+.It M\-j
 Page down
-.TP
-.B M\-k
+.It M\-k
 Page up
-.TP
-.B M\-l
+.It M\-l
 Down
-.SH SEE ALSO
-.IR dwm (1),
-.IR stest (1)
+.El
+.Sh SEE ALSO
+.Xr dwm 1 ,
+.Xr stest 1
diff --git a/stest.1 b/stest.1
index 2667d8a..762c612 100644
--- a/stest.1
+++ b/stest.1
_AT_@ -1,90 +1,72 @@
-.TH STEST 1 dmenu\-VERSION
-.SH NAME
-stest \- filter a list of files by properties
-.SH SYNOPSIS
-.B stest
-.RB [ -abcdefghlpqrsuwx ]
-.RB [ -n
-.IR file ]
-.RB [ -o
-.IR file ]
+.Dd November 20, 2018
+.Dt STEST 1
+.Sh NAME
+.Nm stest
+.Nd filter a list of files by properties
+.Sh SYNOPSIS
+.Nm
+.Op Fl abcdefghlpqrsuwx
+.Op Fl n Ar file
+.Op Fl o Ar file
+.Op file ...
 .RI [ file ...]
-.SH DESCRIPTION
-.B stest
+.Sh DESCRIPTION
+.Nm
 takes a list of files and filters by the files' properties, analogous to
-.IR test (1).
-Files which pass all tests are printed to stdout. If no files are given, stest
-reads files from stdin.
-.SH OPTIONS
-.TP
-.B \-a
+.Xr test 1 .
+Files which pass all tests are printed to the standard output.
+If no files are given, stest reads files from the standard input.
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl a
 Test hidden files.
-.TP
-.B \-b
+.It Fl b
 Test that files are block specials.
-.TP
-.B \-c
+.It Fl c
 Test that files are character specials.
-.TP
-.B \-d
+.It Fl d
 Test that files are directories.
-.TP
-.B \-e
+.It Fl e
 Test that files exist.
-.TP
-.B \-f
+.It Fl f
 Test that files are regular files.
-.TP
-.B \-g
+.It Fl g
 Test that files have their set-group-ID flag set.
-.TP
-.B \-h
+.It Fl h
 Test that files are symbolic links.
-.TP
-.B \-l
+.It Fl l
 Test the contents of a directory given as an argument.
-.TP
-.BI \-n " file"
+.It Fl n Ar file
 Test that files are newer than
-.IR file .
-.TP
-.BI \-o " file"
+.Ar file "."
+.It Fl o Ar file
 Test that files are older than
-.IR file .
-.TP
-.B \-p
+.Ar file "."
+.It Fl p
 Test that files are named pipes.
-.TP
-.B \-q
+.It Fl q
 No files are printed, only the exit status is returned.
-.TP
-.B \-r
+.It Fl r
 Test that files are readable.
-.TP
-.B \-s
+.It Fl s
 Test that files are not empty.
-.TP
-.B \-u
+.It Fl u
 Test that files have their set-user-ID flag set.
-.TP
-.B \-v
+.It Fl v
 Invert the sense of tests, only failing files pass.
-.TP
-.B \-w
+.It Fl w
 Test that files are writable.
-.TP
-.B \-x
+.It Fl x
 Test that files are executable.
-.SH EXIT STATUS
-.TP
-.B 0
+.El
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It Sy 0
 At least one file passed all tests.
-.TP
-.B 1
+.It Sy 1
 No files passed all tests.
-.TP
-.B 2
+.It Sy 2
 An error occurred.
-.SH SEE ALSO
-.IR dmenu (1),
-.IR test (1)
+.Sh SEE ALSO
+.Xr dmenu 1 ,
+.Xr test 1
-- 
2.19.1
Received on Tue Nov 20 2018 - 06:55:13 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 20 2018 - 07:00:22 CET