[hackers] [st][patch v2] Rewrite manpage to use mdoc(7) format.

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

This expresses the same information in a simpler syntax, along with a
30 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 |   2 +-
 st.1     | 252 ++++++++++++++++++++++++-------------------------------
 2 files changed, 112 insertions(+), 142 deletions(-)
diff --git a/Makefile b/Makefile
index 0b3cecd..992e25d 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -45,7 +45,7 @@ install: st
 	cp -f st $(DESTDIR)$(PREFIX)/bin
 	chmod 755 $(DESTDIR)$(PREFIX)/bin/st
 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
-	sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
+	cp st.1 $(DESTDIR)$(MANPREFIX)/man1/st.1
 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
 	tic -sx st.info
 	_AT_echo Please see the README file regarding the terminfo entry of st.
diff --git a/st.1 b/st.1
index e8d6059..85e7ad6 100644
--- a/st.1
+++ b/st.1
_AT_@ -1,176 +1,146 @@
-.TH ST 1 st\-VERSION
-.SH NAME
-st \- simple terminal
-.SH SYNOPSIS
-.B st
-.RB [ \-aiv ]
-.RB [ \-c
-.IR class ]
-.RB [ \-f
-.IR font ]
-.RB [ \-g
-.IR geometry ]
-.RB [ \-n
-.IR name ]
-.RB [ \-o
-.IR iofile ]
-.RB [ \-T
-.IR title ]
-.RB [ \-t
-.IR title ]
-.RB [ \-l
-.IR line ]
-.RB [ \-w
-.IR windowid ]
-.RB [[ \-e ]
-.IR command
-.RI [ arguments ...]]
-.PP
-.B st
-.RB [ \-aiv ]
-.RB [ \-c
-.IR class ]
-.RB [ \-f
-.IR font ]
-.RB [ \-g
-.IR geometry ]
-.RB [ \-n
-.IR name ]
-.RB [ \-o
-.IR iofile ]
-.RB [ \-T
-.IR title ]
-.RB [ \-t
-.IR title ]
-.RB [ \-w
-.IR windowid ]
-.RB \-l
-.IR line
-.RI [ stty_args ...]
-.SH DESCRIPTION
-.B st
+.Dd November 20, 2018
+.Dt ST 1
+.Os
+.Sh NAME
+.Nm st
+.Nd simple terminal
+.Sh SYNOPSIS
+.Nm
+.Op Fl aiv
+.Op Fl c Ar class
+.Op Fl f Ar font
+.Op Fl g Ar geometry
+.Op Fl n Ar name
+.Op Fl o Ar iofile
+.Op Fl T Ar title
+.Op Fl t Ar title
+.Op Fl l Ar line
+.Op Fl w Ar windowid
+.Oo
+.Op Fl e
+.Ar command
+.Op Ar arguments ...
+.Oc
+.Nm
+.Op Fl aiv
+.Op Fl c Ar class
+.Op Fl f Ar font
+.Op Fl g Ar geometry
+.Op Fl n Ar name
+.Op Fl o Ar iofile
+.Op Fl T Ar title
+.Op Fl t Ar title
+.Op Fl w Ar windowid
+.Fl l Ar line
+.Op Ar stty_args ...
+.Sh DESCRIPTION
+.Nm
 is a simple terminal emulator.
-.SH OPTIONS
-.TP
-.B \-a
-disable alternate screens in terminal
-.TP
-.BI \-c " class"
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl a
+disable alternate screens in terminal.
+.It Fl c Ar class
 defines the window class (default $TERM).
-.TP
-.BI \-f " font"
+.It Fl f Ar font
 defines the
-.I font
-to use when st is run.
-.TP
-.BI \-g " geometry"
-defines the X11 geometry string.
-The form is [=][<cols>{xX}<rows>][{+-}<xoffset>{+-}<yoffset>]. See
-.BR XParseGeometry (3)
+.Ar font
+to use when
+.Nm
+is run.
+.It Fl g Ar geometry
+defines the X11 geometry string. The form is
+[=][<cols>{xX}<rows>][{+-}<xoffset>{+-}<yoffset>]. See
+.Xr XParseGeometry 3
 for further details.
-.TP
-.B \-i
-will fixate the position given with the -g option.
-.TP
-.BI \-n " name"
+.It Fl i
+will fixate the position given with the
+.Fl g
+option.
+.It Fl n Ar name
 defines the window instance name (default $TERM).
-.TP
-.BI \-o " iofile"
+.It Fl o Ar iofile
 writes all the I/O to
-.I iofile.
+.Ar iofile "."
 This feature is useful when recording st sessions. A value of "-" means
 standard output.
-.TP
-.BI \-T " title"
+.It Fl T Ar title
 defines the window title (default 'st').
-.TP
-.BI \-t " title"
+.It Fl t Ar title
 defines the window title (default 'st').
-.TP
-.BI \-w " windowid"
+.It Fl w Ar windowid
 embeds st within the window identified by
-.I windowid
-.TP
-.BI \-l " line"
+.Ar windowid "."
+.It Fl l Ar line
 use a tty
-.I line
+.Ar line
 instead of a pseudo terminal.
-.I line
+.Ar line
 should be a (pseudo-)serial device (e.g. /dev/ttyS0 on Linux for serial port
 0).
-When this flag is given
-remaining arguments are used as flags for
-.BR stty(1).
+When this flag is given remaining arguments are used as flags for
+.Xr stty 1 .
 By default st initializes the serial line to 8 bits, no parity, 1 stop bit
 and a 38400 baud rate. The speed is set by appending it as last argument
 (e.g. 'st -l /dev/ttyS0 115200'). Arguments before the last one are
-.BR stty(1)
+.Xr stty 1
 flags. If you want to set odd parity on 115200 baud use for example 'st -l
 /dev/ttyS0 parenb parodd 115200'. Set the number of bits by using for
 example 'st -l /dev/ttyS0 cs7 115200'. See
-.BR stty(1)
+.Xr stty 1
 for more arguments and cases.
-.TP
-.B \-v
-prints version information to stderr, then exits.
-.TP
-.BI \-e " command " [ " arguments " "... ]"
-st executes
-.I command
-instead of the shell.  If this is used it
-.B must be the last option
-on the command line, as in xterm / rxvt.
-This option is only intended for compatibility,
-and all the remaining arguments are used as a command
-even without it.
-.SH SHORTCUTS
-.TP
-.B Break
-Send a break in the serial line.
-Break key is obtained in PC keyboards
-pressing at the same time control and pause.
-.TP
-.B Ctrl-Print Screen
-Toggle if st should print to the
-.I iofile.
-.TP
-.B Shift-Print Screen
+.It Fl v
+prints version information to the standard error, then exits.
+.It Fl e Ar command Op Ar arguments ...
+.Nm
+executes
+.Ar command
+instead of the shell. If this is used it
+.Sy must be the last option
+on the command line, as in xterm/rxvt.
+This option is only intended for compatibility, and all the
+remaining arguments are used as a command even without it.
+.El
+.Sh SHORTCUTS
+.Bl -tag -width Ds
+.It Sy Break
+Send a break in the serial line. The break key is obtained in PC keyboards
+by pressing control and pause at the same time.
+.It Sy Ctrl-Print Screen
+Toggle if
+.Nm
+should print to the
+.Ar iofile "."
+.It Sy Shift-Print Screen
 Print the full screen to the
-.I iofile.
-.TP
-.B Print Screen
+.Ar iofile "."
+.It Sy Print Screen
 Print the selection to the
-.I iofile.
-.TP
-.B Ctrl-Shift-Page Up
+.Ar iofile "."
+.It Sy Ctrl-Shift-Page Up
 Increase font size.
-.TP
-.B Ctrl-Shift-Page Down
+.It Sy Ctrl-Shift-Page Down
 Decrease font size.
-.TP
-.B Ctrl-Shift-Home
+.It Sy Ctrl-Shift-Home
 Reset to default font size.
-.TP
-.B Ctrl-Shift-y
+.It Sy Ctrl-Shift-y
 Paste from primary selection (middle mouse button).
-.TP
-.B Ctrl-Shift-c
+.It Sy Ctrl-Shift-c
 Copy the selected text to the clipboard selection.
-.TP
-.B Ctrl-Shift-v
+.It Sy Ctrl-Shift-v
 Paste from the clipboard selection.
-.SH CUSTOMIZATION
-.B st
+.El
+.Sh CUSTOMIZATION
+.Nm
 can be customized by creating a custom config.h and (re)compiling the source
 code. This keeps it fast, secure and simple.
-.SH AUTHORS
+.Sh AUTHORS
 See the LICENSE file for the authors.
-.SH LICENSE
+.Sh LICENSE
 See the LICENSE file for the terms of redistribution.
-.SH SEE ALSO
-.BR tabbed (1),
-.BR utmp (1),
-.BR stty (1)
-.SH BUGS
+.Sh SEE ALSO
+.Xr tabbed 1 ,
+.Xr utmp 1 ,
+.Xr stty 1 .
+.Sh BUGS
 See the TODO file in the distribution.
-
-- 
2.19.1
Received on Tue Nov 20 2018 - 06:39:38 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 20 2018 - 06:48:20 CET