aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

commit 2c4bc429eaee715549ccaa797617320d81dc2043
parent 84fdd4779b7cbf5d5956dfb115b682e354fbe294
Author: xplshn <anto@xplshn.com.ar>
Date:   Wed, 17 Jun 2026 00:01:07 -0300

update docs

Signed-off-by: xplshn <anto@xplshn.com.ar>

Diffstat:
Mcmd/extra/b3sum.c | 10++++------
Mcmd/linux/blkdiscard.c | 8+++-----
Mcmd/linux/chvt.c | 8+++-----
Mcmd/linux/ctrlaltdel.c | 8+++-----
Mcmd/linux/depmod.c | 15+++++++--------
Mcmd/linux/eject.c | 8+++-----
Mcmd/linux/freeramdisk.c | 7++-----
Mcmd/linux/fsfreeze.c | 8+++-----
Mcmd/linux/hwclock.c | 8+++-----
Mcmd/linux/insmod.c | 8+++-----
Mcmd/linux/lsmod.c | 7++-----
Mcmd/linux/lsusb.c | 7++-----
Mcmd/linux/mkswap.c | 8+++-----
Mcmd/linux/modprobe.c | 84++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mcmd/linux/mount.c | 12+++++-------
Mcmd/linux/mountpoint.c | 8+++-----
Mcmd/linux/pivot_root.c | 8+++-----
Mcmd/linux/readahead.c | 8+++-----
Mcmd/linux/rmmod.c | 15+++++++--------
Mcmd/linux/swaplabel.c | 10++++------
Mcmd/linux/swapoff.c | 8+++-----
Mcmd/linux/swapon.c | 8+++-----
Mcmd/linux/switch_root.c | 10++++------
Mcmd/linux/sysctl.c | 10++++------
Mcmd/linux/tunctl.c | 10++++------
Mcmd/linux/umount.c | 10++++------
Mcmd/linux/unshare.c | 8+++-----
Mcmd/linux/vtallow.c | 8+++-----
Mcmd/net/host.c | 10++++------
Mcmd/net/httpd.c | 12+++++-------
Mcmd/net/ifconfig.c | 8+++-----
Mcmd/net/ip.c | 56++++++++++++++++++++++----------------------------------
Mcmd/net/netcat.c | 10++++------
Mcmd/net/ping.c | 18++++++++----------
Mcmd/net/tftp.c | 12+++++-------
Mcmd/net/wget.c | 17++++++++---------
Mcmd/posix/basename.c | 8+++-----
Mcmd/posix/cal.c | 13+++++--------
Mcmd/posix/cat.c | 31+++++++++++++++----------------
Mcmd/posix/chgrp.c | 8+++-----
Mcmd/posix/chmod.c | 8+++-----
Mcmd/posix/chown.c | 8+++-----
Mcmd/posix/cksum.c | 8+++-----
Mcmd/posix/cmp.c | 8+++-----
Mcmd/posix/comm.c | 8+++-----
Mcmd/posix/cp.c | 8+++-----
Mcmd/posix/cut.c | 12+++++-------
Mcmd/posix/date.c | 10++++------
Mcmd/posix/dd.c | 8+++-----
Mcmd/posix/df.c | 7++-----
Mcmd/posix/dirname.c | 8+++-----
Mcmd/posix/du.c | 10++++------
Mcmd/posix/echo.c | 7++-----
Mcmd/posix/ed.c | 10++++------
Mcmd/posix/env.c | 10++++------
Mcmd/posix/expand.c | 10++++------
Mcmd/posix/expr.c | 7++-----
Mcmd/posix/false.c | 7++-----
Mcmd/posix/find.c | 8+++-----
Mcmd/posix/fold.c | 11+++++------
Mcmd/posix/getconf.c | 10++++------
Mcmd/posix/grep.c | 64+++++++++++++++++++++++++++++++++++++++++-----------------------
Mcmd/posix/head.c | 11+++++------
Mcmd/posix/id.c | 8+++-----
Mcmd/posix/join.c | 21+++++++++------------
Mcmd/posix/kill.c | 8+++-----
Mcmd/posix/link.c | 8+++-----
Mcmd/posix/ln.c | 8+++-----
Mcmd/posix/logger.c | 12+++++-------
Mcmd/posix/logname.c | 7++-----
Mcmd/posix/ls.c | 9++++-----
Mcmd/posix/mesg.c | 8+++-----
Mcmd/posix/mkdir.c | 10++++------
Mcmd/posix/mkfifo.c | 10++++------
Mcmd/posix/mv.c | 8+++-----
Mcmd/posix/nice.c | 10++++------
Mcmd/posix/nl.c | 27++++++++++++---------------
Mcmd/posix/nohup.c | 8+++-----
Mcmd/posix/od.c | 35++++++++++++++++-------------------
Mcmd/posix/paste.c | 10++++------
Mcmd/posix/pathchk.c | 8+++-----
Mcmd/posix/pax.c | 29+++++++++++++----------------
Mcmd/posix/printf.c | 8+++-----
Mcmd/posix/ps.c | 7++-----
Mcmd/posix/pwd.c | 7++-----
Mcmd/posix/readlink.c | 8+++-----
Mcmd/posix/renice.c | 10++++------
Mcmd/posix/rm.c | 8+++-----
Mcmd/posix/rmdir.c | 8+++-----
Mcmd/posix/sed.c | 12+++++-------
Mcmd/posix/sleep.c | 8+++-----
Mcmd/posix/sort.c | 14++++++--------
Mcmd/posix/split.c | 14++++++--------
Mcmd/posix/tail.c | 11+++++------
Mcmd/posix/tee.c | 8+++-----
Mcmd/posix/test.c | 7++-----
Mcmd/posix/time.c | 8+++-----
Mcmd/posix/touch.c | 13+++++--------
Mcmd/posix/tr.c | 8+++-----
Mcmd/posix/true.c | 7++-----
Mcmd/posix/tsort.c | 8+++-----
Mcmd/posix/tty.c | 7++-----
Mcmd/posix/uname.c | 7++-----
Mcmd/posix/unexpand.c | 10++++------
Mcmd/posix/uniq.c | 11++++-------
Mcmd/posix/unlink.c | 8+++-----
Mcmd/posix/uudecode.c | 10++++------
Mcmd/posix/uuencode.c | 8+++-----
Mcmd/posix/wc.c | 8+++-----
Mcmd/posix/who.c | 7++-----
Mcmd/posix/xargs.c | 20+++++++++-----------
Mcmd/pseudo/base64.c | 10++++------
Mcmd/pseudo/chroot.c | 8+++-----
Mcmd/pseudo/clear.c | 7++-----
Mcmd/pseudo/cols.c | 10++++------
Mcmd/pseudo/cron.c | 9+++------
Mcmd/pseudo/dmesg.c | 9+++------
Mcmd/pseudo/fallocate.c | 12+++++-------
Mcmd/pseudo/flock.c | 8+++-----
Mcmd/pseudo/free.c | 7++-----
Mcmd/pseudo/getty.c | 8+++-----
Mcmd/pseudo/halt.c | 7++-----
Mcmd/pseudo/hostname.c | 8+++-----
Mcmd/pseudo/killall5.c | 12+++++-------
Mcmd/pseudo/last.c | 8+++-----
Mcmd/pseudo/lastlog.c | 7++-----
Mcmd/pseudo/login.c | 8+++-----
Mcmd/pseudo/md5sum.c | 8+++-----
Mcmd/pseudo/mktemp.c | 10++++------
Mcmd/pseudo/nologin.c | 7++-----
Mcmd/pseudo/pagesize.c | 7++-----
Mcmd/pseudo/pidof.c | 10++++------
Mcmd/pseudo/printenv.c | 8+++-----
Mcmd/pseudo/pwdx.c | 8+++-----
Mcmd/pseudo/respawn.c | 12+++++-------
Mcmd/pseudo/rev.c | 8+++-----
Mcmd/pseudo/seq.c | 11++++-------
Mcmd/pseudo/setsid.c | 8+++-----
Mcmd/pseudo/sha1sum.c | 8+++-----
Mcmd/pseudo/sha224sum.c | 8+++-----
Mcmd/pseudo/sha256sum.c | 8+++-----
Mcmd/pseudo/sha384sum.c | 8+++-----
Mcmd/pseudo/sha512-224sum.c | 8+++-----
Mcmd/pseudo/sha512-256sum.c | 8+++-----
Mcmd/pseudo/sha512sum.c | 8+++-----
Mcmd/pseudo/sponge.c | 8+++-----
Mcmd/pseudo/stat.c | 9+++------
Mcmd/pseudo/tar.c | 21++++++++++-----------
Mcmd/pseudo/truncate.c | 10++++------
Mcmd/pseudo/uptime.c | 7++-----
Mcmd/pseudo/watch.c | 10++++------
Mcmd/pseudo/which.c | 8+++-----
Mcmd/pseudo/whoami.c | 7++-----
Mcmd/pseudo/xinstall.c | 16+++++++---------
Mcmd/pseudo/yes.c | 8+++-----
Mcmd/xsi/mknod.c | 12+++++-------
Mcmd/xsi/passwd.c | 8+++-----
Mcmd/xsi/su.c | 8+++-----
158 files changed, 701 insertions(+), 1024 deletions(-)

diff --git a/cmd/extra/b3sum.c b/cmd/extra/b3sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -b3sum: compute blake3 checksums -usage: b3sum [-bct] [-l length] [file ...] -compute and check blake3 message digests -*/ #include "util.h" #include "arg.h" @@ -3968,6 +3963,9 @@ check(const char *name, FILE *file) return ret; } +// ?man b3sum: compute blake3 checksums +// ?man arguments: file ... +// ?man compute and check blake3 message digests int main(int argc, char *argv[]) { @@ -3986,7 +3984,7 @@ main(int argc, char *argv[]) case 'c': func = check; break; - // ?man -l length: output digest length in bytes + // ?man -l:str: -l length: output digest length in bytes case 'l': outlen = strtoul(EARGF(usage()), &end, 10); if (*end) diff --git a/cmd/linux/blkdiscard.c b/cmd/linux/blkdiscard.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -blkdiscard: discard sectors on a device -usage: blkdiscard device -discard sectors on a block device -*/ #include <sys/ioctl.h> #include <sys/mount.h> @@ -28,6 +23,9 @@ usage(void) eprintf("usage: %s device\n", argv0); } +// ?man blkdiscard: discard sectors on a device +// ?man arguments: device +// ?man discard sectors on a block device int main(int argc, char *argv[]) { diff --git a/cmd/linux/chvt.c b/cmd/linux/chvt.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -chvt: change foreground virtual terminal -usage: chvt num -change the active virtual terminal -*/ #include <sys/ioctl.h> #include <sys/types.h> @@ -35,6 +30,9 @@ usage(void) eprintf("usage: %s num\n", argv0); } +// ?man chvt: change foreground virtual terminal +// ?man arguments: num +// ?man change the active virtual terminal int main(int argc, char *argv[]) { diff --git a/cmd/linux/ctrlaltdel.c b/cmd/linux/ctrlaltdel.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ctrlaltdel: set ctrl-alt-del function -usage: ctrlaltdel -h | -s -set the behavior of the ctrl-alt-del key combination -*/ #include <sys/syscall.h> @@ -20,6 +15,9 @@ usage(void) eprintf("usage: %s -h | -s\n", argv0); } +// ?man ctrlaltdel: set ctrl-alt-del function +// ?man arguments: -h | -s +// ?man set the behavior of the ctrl-alt-del key combination int main(int argc, char *argv[]) { diff --git a/cmd/linux/depmod.c b/cmd/linux/depmod.c @@ -1,12 +1,4 @@ -/* ?man -depmod: generate modules.dep and map files -usage: depmod [-n] [-b basedir] [version] -depmod generates modules.dep containing dependency information for modprobe - -// ?man -n: dry run print results to stdout instead of writing files -// ?man -b basedir: use basedir as prefix for module directories -*/ #include "fs.h" #include "util.h" @@ -268,6 +260,11 @@ usage(void) eprintf("usage: %s [-n] [-b basedir] [version]\n", argv0); } +// ?man depmod: generate modules.dep and map files +// ?man arguments: version +// ?man depmod generates modules.dep containing dependency information for modprobe +// ?man // ?man -n: dry run print results to stdout instead of writing files +// ?man // ?man -b basedir: use basedir as prefix for module directories int main(int argc, char *argv[]) { @@ -284,9 +281,11 @@ main(int argc, char *argv[]) FILE *f_dep, *f_alias, *f_sym; ARGBEGIN { + // ?man -n: specify n option case 'n': nflag = 1; break; + // ?man -b:dir: specify b option case 'b': basedir = EARGF(usage()); break; diff --git a/cmd/linux/eject.c b/cmd/linux/eject.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -eject: eject removable media -usage: eject [-t] [device ...] -eject optical discs or other removable storage media -*/ #include <sys/ioctl.h> #include <sys/stat.h> @@ -53,6 +48,9 @@ usage(void) eprintf("usage: %s [-t] [device ...]\n", argv0); } +// ?man eject: eject removable media +// ?man arguments: device ... +// ?man eject optical discs or other removable storage media int main(int argc, char *argv[]) { diff --git a/cmd/linux/freeramdisk.c b/cmd/linux/freeramdisk.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -freeramdisk: free ramdisk memory -usage: freeramdisk -free memory associated with a ramdisk device -*/ #include <sys/ioctl.h> #include <sys/mount.h> @@ -23,6 +18,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man freeramdisk: free ramdisk memory +// ?man free memory associated with a ramdisk device int main(int argc, char *argv[]) { diff --git a/cmd/linux/fsfreeze.c b/cmd/linux/fsfreeze.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -fsfreeze: suspend access to a filesystem -usage: fsfreeze (-f | -u) mountpoint -freeze or unfreeze a filesystem to allow safe backups -*/ #include <sys/ioctl.h> #include <sys/stat.h> @@ -26,6 +21,9 @@ usage(void) eprintf("usage: %s (-f | -u) mountpoint\n", argv0); } +// ?man fsfreeze: suspend access to a filesystem +// ?man arguments: (-f | -u) mountpoint +// ?man freeze or unfreeze a filesystem to allow safe backups int main(int argc, char *argv[]) { diff --git a/cmd/linux/hwclock.c b/cmd/linux/hwclock.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -hwclock: query or set the hardware clock -usage: hwclock [-rsw] [-u] [dev] -view or adjust the hardware real time clock -*/ #include <sys/ioctl.h> #include <sys/stat.h> @@ -119,6 +114,9 @@ usage(void) eprintf("usage: %s [-rsw] [-u] [dev]\n", argv0); } +// ?man hwclock: query or set the hardware clock +// ?man arguments: dev +// ?man view or adjust the hardware real time clock int main(int argc, char *argv[]) { diff --git a/cmd/linux/insmod.c b/cmd/linux/insmod.c @@ -1,9 +1,4 @@ -/* ?man -insmod: insert a module into the Linux kernel -usage: insmod filename [args...] -insmod inserts a kernel module from filename into the running kernel -*/ #include <sys/stat.h> #include <sys/syscall.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s filename [args...]\n", argv0); } +// ?man insmod: insert a module into the Linux kernel +// ?man arguments: filename [args... +// ?man insmod inserts a kernel module from filename into the running kernel int main(int argc, char *argv[]) { diff --git a/cmd/linux/lsmod.c b/cmd/linux/lsmod.c @@ -1,9 +1,4 @@ -/* ?man -lsmod: show the status of modules in the Linux kernel -usage: lsmod -lsmod formats and displays /proc/modules, showing currently loaded modules -*/ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -20,6 +15,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man lsmod: show the status of modules in the Linux kernel +// ?man lsmod formats and displays /proc/modules, showing currently loaded modules int main(int argc, char *argv[]) { diff --git a/cmd/linux/lsusb.c b/cmd/linux/lsusb.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -lsusb: list usb devices -usage: lsusb -display information about usb buses and connected devices -*/ #include <limits.h> #include <stdio.h> @@ -52,6 +47,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man lsusb: list usb devices +// ?man display information about usb buses and connected devices int main(int argc, char *argv[]) { diff --git a/cmd/linux/mkswap.c b/cmd/linux/mkswap.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mkswap: set up a swap area -usage: mkswap device -initialize a linux swap area on a device or file -*/ #include <sys/stat.h> @@ -37,6 +32,9 @@ usage(void) eprintf("usage: %s device\n", argv0); } +// ?man mkswap: set up a swap area +// ?man arguments: device +// ?man initialize a linux swap area on a device or file int main(int argc, char *argv[]) { diff --git a/cmd/linux/modprobe.c b/cmd/linux/modprobe.c @@ -1,15 +1,4 @@ -/* ?man -modprobe: add or remove modules from the Linux kernel -usage: modprobe [-alqrv] [module [symbol=value ...]] - -modprobe loads or removes kernel modules from the running system. -It reads modules.dep, modules.alias, and modules.symbols from the appropriate -/lib/modules/release directory to resolve module names and dependencies, -loading prerequisites first. - -Without -r, modprobe loads the named module (and any required dependencies) -into the kernel. -*/ + #include "arg.h" #include "fs.h" #include "util.h" @@ -545,6 +534,14 @@ usage(void) "module [symbol=value ...]\n", argv0); } +// ?man modprobe: add or remove modules from the Linux kernel +// ?man arguments: module [symbol=value ... +// ?man modprobe loads or removes kernel modules from the running system. +// ?man It reads modules.dep, modules.alias, and modules.symbols from the appropriate +// ?man /lib/modules/release directory to resolve module names and dependencies, +// ?man loading prerequisites first. +// ?man Without -r, modprobe loads the named module (and any required dependencies) +// ?man into the kernel. int main(int argc, char *argv[]) { @@ -554,37 +551,46 @@ main(int argc, char *argv[]) int i, ret = 0; ARGBEGIN { + // ?man -a: specify a option case 'a': // ?man -a: Load all modules named on the command line (rather than stopping after the first). aflag = 1; break; + // ?man -r: specify r option case 'r': // ?man -r: Remove the named modules from the kernel. Dependencies are not automatically removed. rflag = 1; break; + // ?man -q: specify q option case 'q': // ?man -q: Quiet mode. Suppress error messages. qflag = 1; break; + // ?man -v: specify v option case 'v': // ?man -v: Verbose mode. Print each action taken. vflag = 1; break; + // ?man -l: specify l option case 'l': // ?man -l: List available modules matching the optional _pattern_ (a fnmatch(3) glob). lflag = 1; break; #if FEATURE_MODPROBE_SHOW_DEPENDS + // ?man -D: specify D option case 'D': // ?man -D: Print the sequence of insmod commands that would be used to load the module, without actually loading anything. Dflag = 1; break; #endif #if FEATURE_MODPROBE_BLACKLIST + // ?man -b: specify b option case 'b': // ?man -b: Skip modules listed as blacklist in /etc/modprobe.d/. bflag = 1; break; #endif #if FEATURE_MODPROBE_SYSLOG + // ?man -s: specify s option case 's': // ?man -s: Log messages to syslog(3) (facility LOG_DAEMON) instead of standard error. sflag = 1; break; #endif #if FEATURE_MODPROBE_DIR_OVERRIDE + // ?man -d:file: specify d option case 'd': // ?man -d dir: Use dir as the base directory for module files instead of /lib/modules/release. strlist_append(&moddirs, EARGF(usage())); break; @@ -658,33 +664,33 @@ end: if (fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>")) ret = 2; - /* ?man - ## FILES - - `/etc/modprobe.conf` - : Global configuration file. - - Files under `/etc/modprobe.d/` - : Per-module configuration snippets. - - `/lib/modules/`_release_`/modules.dep` - : Module dependency map generated by `depmod(8)`. - - ## EXIT STATUS - - 0 - : Success. - - 1 - : Module not found or kernel rejected the operation. - - 2 - : I/O error on stdout or stdin. - - ## SEE ALSO - - insmod(8), rmmod(8), lsmod(8), depmod(8) - */ + // ?man + // ?man ## FILES + // ?man + // ?man `/etc/modprobe.conf` + // ?man : Global configuration file. + // ?man + // ?man Files under `/etc/modprobe.d/` + // ?man : Per-module configuration snippets. + // ?man + // ?man `/lib/modules/`_release_`/modules.dep` + // ?man : Module dependency map generated by `depmod(8)`. + // ?man + // ?man ## EXIT STATUS + // ?man + // ?man 0 + // ?man : Success. + // ?man + // ?man 1 + // ?man : Module not found or kernel rejected the operation. + // ?man + // ?man 2 + // ?man : I/O error on stdout or stdin. + // ?man + // ?man ## SEE ALSO + // ?man + // ?man insmod(8), rmmod(8), lsmod(8), depmod(8) + // ?man return ret; } diff --git a/cmd/linux/mount.c b/cmd/linux/mount.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mount: mount a filesystem -usage: mount [-BMRan] [-t fstype] [-o options] [source] [target] -mount a filesystem to the directory tree -*/ #include <sys/mount.h> #include <sys/stat.h> @@ -195,6 +190,9 @@ usage(void) argv0); } +// ?man mount: mount a filesystem +// ?man arguments: source] [target +// ?man mount a filesystem to the directory tree int main(int argc, char *argv[]) { @@ -223,12 +221,12 @@ main(int argc, char *argv[]) case 'a': aflag = 1; break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': estrlcat(fsopts, EARGF(usage()), sizeof(fsopts)); parseopts(fsopts, &flags, data, sizeof(data)); break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': types = EARGF(usage()); break; diff --git a/cmd/linux/mountpoint.c b/cmd/linux/mountpoint.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mountpoint: check if a directory is a mountpoint -usage: mountpoint [-dqx] target -determine if a directory is a mountpoint -*/ #include <sys/stat.h> #include <sys/sysmacros.h> @@ -24,6 +19,9 @@ usage(void) eprintf("usage: %s [-dqx] target\n", argv0); } +// ?man mountpoint: check if a directory is a mountpoint +// ?man arguments: target +// ?man determine if a directory is a mountpoint int main(int argc, char *argv[]) { diff --git a/cmd/linux/pivot_root.c b/cmd/linux/pivot_root.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pivot_root: change the root filesystem -usage: pivot_root new-root put-old -change the root filesystem of the current process -*/ #include <sys/syscall.h> @@ -20,6 +15,9 @@ usage(void) eprintf("usage: %s new-root put-old\n", argv0); } +// ?man pivot_root: change the root filesystem +// ?man arguments: new-root put-old +// ?man change the root filesystem of the current process int main(int argc, char *argv[]) { diff --git a/cmd/linux/readahead.c b/cmd/linux/readahead.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -readahead: read files into page cache -usage: readahead file... -preload file contents into the page cache -*/ #include <fcntl.h> #include <limits.h> @@ -19,6 +14,9 @@ usage(void) eprintf("usage: %s file...\n", argv0); } +// ?man readahead: read files into page cache +// ?man arguments: file... +// ?man preload file contents into the page cache int main(int argc, char *argv[]) { diff --git a/cmd/linux/rmmod.c b/cmd/linux/rmmod.c @@ -1,12 +1,4 @@ -/* ?man -rmmod: remove a module from the Linux kernel -usage: rmmod [-fw] module... -rmmod removes a kernel module from the running kernel - -// ?man -f: force removal of a module even if it is busy or in use -// ?man -w: wait for the module to become unused before removing -*/ #include <sys/syscall.h> #include <fcntl.h> @@ -24,6 +16,11 @@ usage(void) eprintf("usage: %s [-fw] module...\n", argv0); } +// ?man rmmod: remove a module from the Linux kernel +// ?man arguments: module... +// ?man rmmod removes a kernel module from the running kernel +// ?man // ?man -f: force removal of a module even if it is busy or in use +// ?man // ?man -w: wait for the module to become unused before removing int main(int argc, char *argv[]) { @@ -32,9 +29,11 @@ main(int argc, char *argv[]) int flags = O_NONBLOCK; ARGBEGIN { + // ?man -f: specify f option case 'f': flags |= O_TRUNC; break; + // ?man -w: specify w option case 'w': flags &= ~O_NONBLOCK; break; diff --git a/cmd/linux/swaplabel.c b/cmd/linux/swaplabel.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -swaplabel: print or change swap label -usage: swaplabel [-L label] device -display or modify the label and uuid of a swap device -*/ #include <sys/types.h> @@ -29,6 +24,9 @@ usage(void) eprintf("usage: %s [-L label] device\n", argv0); } +// ?man swaplabel: print or change swap label +// ?man arguments: device +// ?man display or modify the label and uuid of a swap device int main(int argc, char *argv[]) { @@ -40,7 +38,7 @@ main(int argc, char *argv[]) int i; ARGBEGIN { - // ?man -L: specify option flag + // ?man -L:str: specify option flag case 'L': setlabel = 1; label = EARGF(usage()); diff --git a/cmd/linux/swapoff.c b/cmd/linux/swapoff.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -swapoff: disable swap devices -usage: swapoff -a | device -disable paging and swapping on specified devices -*/ #include <sys/swap.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s -a | device\n", argv0); } +// ?man swapoff: disable swap devices +// ?man arguments: -a | device +// ?man disable paging and swapping on specified devices int main(int argc, char *argv[]) { diff --git a/cmd/linux/swapon.c b/cmd/linux/swapon.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -swapon: enable swap devices -usage: swapon [-dp] -a | device -enable paging and swapping on specified devices -*/ #include <sys/swap.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s [-dp] -a | device\n", argv0); } +// ?man swapon: enable swap devices +// ?man arguments: -a | device +// ?man enable paging and swapping on specified devices int main(int argc, char *argv[]) { diff --git a/cmd/linux/switch_root.c b/cmd/linux/switch_root.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -switch_root: switch to another root filesystem -usage: switch_root [-c console] [newroot] [init] (PID 1) -switch to another filesystem as the root of the mount tree -*/ #include <sys/mount.h> #include <sys/stat.h> @@ -71,6 +66,9 @@ usage(void) eprintf("usage: %s [-c console] [newroot] [init] (PID 1)\n", argv0); } +// ?man switch_root: switch to another root filesystem +// ?man arguments: newroot] [init] (PID 1) +// ?man switch to another filesystem as the root of the mount tree int main(int argc, char *argv[]) { @@ -80,7 +78,7 @@ main(int argc, char *argv[]) struct statfs stfs; ARGBEGIN { - // ?man -c: print count or perform stdout action + // ?man -c:str: print count or perform stdout action case 'c': console = EARGF(usage()); break; diff --git a/cmd/linux/sysctl.c b/cmd/linux/sysctl.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sysctl: configure kernel parameters -usage: sysctl [-p file] variable[=value]... -view and modify kernel parameters at runtime -*/ #include <fcntl.h> #include <limits.h> @@ -165,6 +160,9 @@ usage(void) eprintf("usage: %s [-p file] variable[=value]...\n", argv0); } +// ?man sysctl: configure kernel parameters +// ?man arguments: variable[=value]... +// ?man view and modify kernel parameters at runtime int main(int argc, char *argv[]) { @@ -176,7 +174,7 @@ main(int argc, char *argv[]) int r = 0; ARGBEGIN { - // ?man -p: preserve file attributes + // ?man -p:file: preserve file attributes case 'p': file = EARGF(usage()); break; diff --git a/cmd/linux/tunctl.c b/cmd/linux/tunctl.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tunctl: configure tun/tap interfaces -usage: tunctl [-dtT] [-u owner] [device] -create or destroy tun/tap network interfaces -*/ #include <sys/ioctl.h> #include <sys/socket.h> @@ -35,6 +30,9 @@ usage(void) eprintf("usage: %s [-dtT] [-u owner] [device]\n", argv0); } +// ?man tunctl: configure tun/tap interfaces +// ?man arguments: device +// ?man create or destroy tun/tap network interfaces int main(int argc, char *argv[]) { @@ -59,7 +57,7 @@ main(int argc, char *argv[]) case 'T': Tflag = 1; break; - // ?man -u: unbuffered output + // ?man -u:str: unbuffered output case 'u': owner = EARGF(usage()); break; diff --git a/cmd/linux/umount.c b/cmd/linux/umount.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -umount: unmount filesystems -usage: umount [-lfn] [-O options] target... -unmount a filesystem from the directory tree -*/ #include <sys/mount.h> @@ -130,6 +125,9 @@ usage(void) exit(1); } +// ?man umount: unmount filesystems +// ?man arguments: target... +// ?man unmount a filesystem from the directory tree int main(int argc, char *argv[]) { @@ -158,7 +156,7 @@ main(int argc, char *argv[]) case 'n': break; #if FEATURE_UMOUNT_OPTIONS - // ?man -O: specify option flag + // ?man -O:str: specify option flag case 'O': oflag = EARGF(usage()); break; diff --git a/cmd/linux/unshare.c b/cmd/linux/unshare.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -unshare: run program in new namespaces -usage: unshare [-muinpU] cmd [args...] -run a program with some namespaces unshared from the parent -*/ #include <sched.h> #include <stdio.h> @@ -20,6 +15,9 @@ usage(void) eprintf("usage: %s [-muinpU] cmd [args...]\n", argv0); } +// ?man unshare: run program in new namespaces +// ?man arguments: cmd [args... +// ?man run a program with some namespaces unshared from the parent int main(int argc, char *argv[]) { diff --git a/cmd/linux/vtallow.c b/cmd/linux/vtallow.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -vtallow: allow non-root vt access -usage: vtallow n | y -allow non-root users to access virtual terminal devices -*/ #include <sys/types.h> #include <sys/stat.h> @@ -28,6 +23,9 @@ usage(void) eprintf("usage: %s n | y\n", argv0); } +// ?man vtallow: allow non-root vt access +// ?man arguments: n | y +// ?man allow non-root users to access virtual terminal devices int main(int argc, char *argv[]) { diff --git a/cmd/net/host.c b/cmd/net/host.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -host: dns lookup utility -usage: host [-t type] name [server] -look up hostnames and IP addresses using dns -*/ #include "util.h" #include "arg.h" @@ -262,6 +257,9 @@ parse_response(const unsigned char *resp, int resp_len, const char *query_name) return 0; } +// ?man host: dns lookup utility +// ?man arguments: name [server +// ?man look up hostnames and IP addresses using dns int main(int argc, char *argv[]) { @@ -276,7 +274,7 @@ main(int argc, char *argv[]) int i, r; ARGBEGIN { - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tflag = EARGF(usage()); break; diff --git a/cmd/net/httpd.c b/cmd/net/httpd.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -httpd: simple http daemon -usage: httpd [-e string] [-d string] [-v] [dir] -serve static files over http -*/ #include "util.h" #include "arg.h" @@ -256,6 +251,9 @@ serve_file: close(fd); } +// ?man httpd: simple http daemon +// ?man arguments: dir +// ?man serve static files over http int main(int argc, char *argv[]) { @@ -264,11 +262,11 @@ main(int argc, char *argv[]) char *enc; ARGBEGIN { - // ?man -e: specify expression or pattern + // ?man -e:str: specify expression or pattern case 'e': eflag = EARGF(usage()); break; - // ?man -d: specify directory + // ?man -d:str: specify directory case 'd': dflag = EARGF(usage()); break; diff --git a/cmd/net/ifconfig.c b/cmd/net/ifconfig.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ifconfig: configure network interfaces -usage: ifconfig [-a] [interface [action ...]] -configure network interface parameters and view stats -*/ #include <arpa/inet.h> #include <ctype.h> @@ -102,6 +97,9 @@ list_interfaces(int all) free(ifaces); } +// ?man ifconfig: configure network interfaces +// ?man arguments: interface [action ... +// ?man configure network interface parameters and view stats int main(int argc, char *argv[]) { diff --git a/cmd/net/ip.c b/cmd/net/ip.c @@ -1,39 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ip: show or configure routing and devices -usage: ip [addr | link | route] [args...] -configure and view network devices, routing, and tunnels - -## COMMANDS - -### addr [show | list [dev <device>]] -show interface addresses - -### addr add <ip>/<prefix> dev <device> -add address to interface - -### addr del <ip>/<prefix> dev <device> -delete address from interface - -### addr flush dev <device> -flush all addresses from interface - -### link [show | list [dev <device>]] -show interface link states - -### link set <interface> [up | down | mtu <mtu> | address <mac> | arp on|off | multicast on|off | allmulticast on|off | promisc on|off | name <newname> | txqueuelen <qlen>] -configure interface settings - -### route [show | list] -show routing table - -### route add <prefix> [via <gateway>] [dev <device>] [metric <metric>] -add route to routing table - -### route del <prefix> [via <gateway>] [dev <device>] [metric <metric>] -delete route from routing table -*/ #include <arpa/inet.h> #include <ctype.h> @@ -379,6 +345,28 @@ do_route(int argc, char *argv[]) return 1; } +// ?man ip: show or configure routing and devices +// ?man arguments: addr | link | route] [args... +// ?man configure and view network devices, routing, and tunnels +// ?man ## COMMANDS +// ?man ### addr [show | list [dev <device>]] +// ?man show interface addresses +// ?man ### addr add <ip>/<prefix> dev <device> +// ?man add address to interface +// ?man ### addr del <ip>/<prefix> dev <device> +// ?man delete address from interface +// ?man ### addr flush dev <device> +// ?man flush all addresses from interface +// ?man ### link [show | list [dev <device>]] +// ?man show interface link states +// ?man ### link set <interface> [up | down | mtu <mtu> | address <mac> | arp on|off | multicast on|off | allmulticast on|off | promisc on|off | name <newname> | txqueuelen <qlen>] +// ?man configure interface settings +// ?man ### route [show | list] +// ?man show routing table +// ?man ### route add <prefix> [via <gateway>] [dev <device>] [metric <metric>] +// ?man add route to routing table +// ?man ### route del <prefix> [via <gateway>] [dev <device>] [metric <metric>] +// ?man delete route from routing table int main(int argc, char *argv[]) { diff --git a/cmd/net/netcat.c b/cmd/net/netcat.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -netcat: read and write data across network connections -usage: netcat [-lu] [-p localport] [host] [port] -arbitrary data transmission over tcp or udp -*/ #include <sys/socket.h> #include <sys/types.h> @@ -53,6 +48,9 @@ resolve(const char *host, const char *port, int family, int socktype, return 0; } +// ?man netcat: read and write data across network connections +// ?man arguments: host] [port +// ?man arbitrary data transmission over tcp or udp int main(int argc, char *argv[]) { @@ -76,7 +74,7 @@ main(int argc, char *argv[]) case 'l': lflag = 1; break; - // ?man -p: preserve file attributes + // ?man -p:str: preserve file attributes case 'p': local_port = EARGF(usage()); break; diff --git a/cmd/net/ping.c b/cmd/net/ping.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ping: send icmp echo requests -usage: ping [-c count] [-i interval] [-s size] [-t ttl] [-w deadline] [-q] host -send icmp echo requests to verify network connectivity -*/ #include "util.h" #include "arg.h" @@ -107,6 +102,9 @@ print_stats(const char *host, int sent, int received, double min_rtt, double max } } +// ?man ping: send icmp echo requests +// ?man arguments: host +// ?man send icmp echo requests to verify network connectivity int main(int argc, char *argv[]) { @@ -143,23 +141,23 @@ main(int argc, char *argv[]) socklen_t fromlen; ARGBEGIN { - // ?man -c: print count or perform stdout action + // ?man -c:str: print count or perform stdout action case 'c': cflag = EARGF(usage()); break; - // ?man -i: interactive mode or prompt for confirmation + // ?man -i:str: interactive mode or prompt for confirmation case 'i': iflag = EARGF(usage()); break; - // ?man -s: silent mode or print summary + // ?man -s:str: silent mode or print summary case 's': sflag = EARGF(usage()); break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tflag = EARGF(usage()); break; - // ?man -w: wait for completion + // ?man -w:str: wait for completion case 'w': wflag = EARGF(usage()); break; diff --git a/cmd/net/tftp.c b/cmd/net/tftp.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tftp: tftp client -usage: tftp -h host [-p port] [-x | -c] file -transfer files to and from a remote tftp server -*/ #include <sys/time.h> #include <sys/types.h> @@ -253,6 +248,9 @@ usage(void) eprintf("usage: %s -h host [-p port] [-x | -c] file\n", argv0); } +// ?man tftp: tftp client +// ?man arguments: -h host file +// ?man transfer files to and from a remote tftp server int main(int argc, char *argv[]) { @@ -263,11 +261,11 @@ main(int argc, char *argv[]) int ret; ARGBEGIN { - // ?man -h: suppress headers or print help + // ?man -h:str: suppress headers or print help case 'h': host = EARGF(usage()); break; - // ?man -p: preserve file attributes + // ?man -p:str: preserve file attributes case 'p': port = EARGF(usage()); break; diff --git a/cmd/net/wget.c b/cmd/net/wget.c @@ -1,10 +1,5 @@ /* see license file for copyright and license details */ -/* ?man -wget: retrieve files from the web -usage: wget [-cqS] [-O file] [-P dir] [-T timeout] [-U user_agent] [-post-data data] [-post-file file] [-header header] [-no-check-certificate] [-spider] url -download files over http or https -*/ #include "util.h" #include "arg.h" @@ -298,6 +293,9 @@ req_printf(struct TlsSocket *ts, const char *fmt, ...) tls_write(ts, buf, len); } +// ?man wget: retrieve files from the web +// ?man arguments: url +// ?man download files over http or https int main(int argc, char *argv[]) { @@ -329,19 +327,19 @@ main(int argc, char *argv[]) size_t i; ARGBEGIN { - // ?man -O: specify output file path + // ?man -O:str: specify output file path case 'O': Oflag = EARGF(usage()); break; - // ?man -P: specify output directory prefix + // ?man -P:str: specify output directory prefix case 'P': Pflag = EARGF(usage()); break; - // ?man -T: set network read and connect timeout + // ?man -T:num: set network read and connect timeout case 'T': timeout_sec = estrtonum(EARGF(usage()), 0, 100000); break; - // ?man -U: set User-Agent header + // ?man -U:str: set User-Agent header case 'U': user_agent = EARGF(usage()); break; @@ -357,6 +355,7 @@ main(int argc, char *argv[]) case 'S': Sflag = 1; break; + // ?man --: specify - option case '-': if (strcmp(argv[0], "-no-check-certificate") == 0) { no_check_certificate = 1; diff --git a/cmd/posix/basename.c b/cmd/posix/basename.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -basename: strip directory and suffix from filenames -usage: basename path [suffix] -print filename with leading directories and optional suffix removed -*/ #include <libgen.h> #include <stdio.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s path [suffix]\n", argv0); } +// ?man basename: strip directory and suffix from filenames +// ?man arguments: path [suffix +// ?man print filename with leading directories and optional suffix removed int main(int argc, char *argv[]) { diff --git a/cmd/posix/cal.c b/cmd/posix/cal.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cal: display a calendar -usage: cal [-1 | -3 | -y | -n num] -print a formatted calendar of the specified month or year -*/ #include <limits.h> #include <stdint.h> @@ -156,6 +151,8 @@ usage(void) #endif } +// ?man cal: display a calendar +// ?man print a formatted calendar of the specified month or year int main(int argc, char *argv[]) { @@ -194,11 +191,11 @@ main(int argc, char *argv[]) year--; } break; - // ?man -c: print count or perform stdout action + // ?man -c:num: print count or perform stdout action case 'c': ncols = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)SIZE_MAX, (unsigned long long)LLONG_MAX)); break; - // ?man -f: force the operation + // ?man -f:num: force the operation case 'f': fday = estrtonum(EARGF(usage()), 0, 6); break; @@ -206,7 +203,7 @@ main(int argc, char *argv[]) case 'm': /* Monday */ fday = 1; break; - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': nmons = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)SIZE_MAX, (unsigned long long)LLONG_MAX)); break; diff --git a/cmd/posix/cat.c b/cmd/posix/cat.c @@ -1,12 +1,6 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cat: concatenate files and print to standard output -usage: cat [-u] [file ...] -cat reads each file in sequence and writes it to standard output -if no file is given, or a file is -, standard input is read -*/ #include <fcntl.h> #include <string.h> @@ -20,12 +14,17 @@ usage(void) eprintf("usage: %s [-u] [file ...]\n", argv0); } +// ?man cat: concatenate files and print to standard output +// ?man arguments: file ... +// ?man cat reads each file in sequence and writes it to standard output +// ?man if no file is given, or a file is -, standard input is read int main(int argc, char *argv[]) { int fd, ret = 0; ARGBEGIN { + // ?man -u: specify u option case 'u': // ?man -u: ignored; accepted for posix compatibility; output is always unbuffered break; @@ -58,16 +57,16 @@ main(int argc, char *argv[]) } } - /* ?man - ## Exit status - - cat exits 0 on success, and >0 if an error occurs reading any file - or writing to standard output - - ## See also - - cp(1), dd(1) - */ + // ?man + // ?man ## Exit status + // ?man + // ?man cat exits 0 on success, and >0 if an error occurs reading any file + // ?man or writing to standard output + // ?man + // ?man ## See also + // ?man + // ?man cp(1), dd(1) + // ?man return ret; } diff --git a/cmd/posix/chgrp.c b/cmd/posix/chgrp.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -chgrp: change group ownership -usage: chgrp [-h] [-R [-H | -L | -P]] group file ... -change the group ownership of files and directories -*/ #include <sys/stat.h> @@ -43,6 +38,9 @@ usage(void) eprintf("usage: %s [-h] [-R [-H | -L | -P]] group file ...\n", argv0); } +// ?man chgrp: change group ownership +// ?man arguments: group file ... +// ?man change the group ownership of files and directories int main(int argc, char *argv[]) { diff --git a/cmd/posix/chmod.c b/cmd/posix/chmod.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -chmod: change file modes -usage: chmod [-R] mode file ... -change the file mode bits of files and directories -*/ #include <fcntl.h> #include <sys/stat.h> @@ -38,6 +33,9 @@ usage(void) eprintf("usage: %s [-R] mode file ...\n", argv0); } +// ?man chmod: change file modes +// ?man arguments: mode file ... +// ?man change the file mode bits of files and directories int main(int argc, char *argv[]) { diff --git a/cmd/posix/chown.c b/cmd/posix/chown.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -chown: change ownership -usage: chown [-h] [-R [-H | -L | -P]] owner[:[group]] file ... -change the user and group ownership of files and directories -*/ #include <errno.h> #include <fcntl.h> @@ -49,6 +44,9 @@ usage(void) argv0, argv0); } +// ?man chown: change ownership +// ?man arguments: owner[:[group]] file ... +// ?man change the user and group ownership of files and directories int main(int argc, char *argv[]) { diff --git a/cmd/posix/cksum.c b/cmd/posix/cksum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cksum: checksum and count bytes -usage: cksum [file ...] -print crc checksum and byte counts for files -*/ #include <fcntl.h> #include <inttypes.h> @@ -105,6 +100,9 @@ usage(void) eprintf("usage: %s [file ...]\n", argv0); } +// ?man cksum: checksum and count bytes +// ?man arguments: file ... +// ?man print crc checksum and byte counts for files int main(int argc, char *argv[]) { diff --git a/cmd/posix/cmp.c b/cmd/posix/cmp.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cmp: compare two files -usage: cmp [-l | -s] file1 file2 -compare two files byte by byte -*/ #include <stdio.h> #include <stdlib.h> @@ -18,6 +13,9 @@ usage(void) enprintf(2, "usage: %s [-l | -s] file1 file2\n", argv0); } +// ?man cmp: compare two files +// ?man arguments: file1 file2 +// ?man compare two files byte by byte int main(int argc, char *argv[]) { diff --git a/cmd/posix/comm.c b/cmd/posix/comm.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -comm: compare two sorted files -usage: comm [-123] file1 file2 -compare two sorted files line by line -*/ #include <stdio.h> #include <stdlib.h> @@ -36,6 +31,9 @@ usage(void) eprintf("usage: %s [-123] file1 file2\n", argv0); } +// ?man comm: compare two sorted files +// ?man arguments: file1 file2 +// ?man compare two sorted files line by line int main(int argc, char *argv[]) { diff --git a/cmd/posix/cp.c b/cmd/posix/cp.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cp: copy files and directories -usage: cp [-afipv] [-R [-H | -L | -P]] source ... dest -copy files and directories to a destination -*/ #include <sys/stat.h> @@ -17,6 +12,9 @@ usage(void) eprintf("usage: %s [-afipv] [-R [-H | -L | -P]] source ... dest\n", argv0); } +// ?man cp: copy files and directories +// ?man arguments: source ... dest +// ?man copy files and directories to a destination int main(int argc, char *argv[]) { diff --git a/cmd/posix/cut.c b/cmd/posix/cut.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cut: cut out fields from lines -usage: cut -b list [-n] [file ...] -print selected parts of lines from files -*/ #include <stdio.h> #include <stdlib.h> @@ -166,6 +161,9 @@ usage(void) argv0, argv0, argv0); } +// ?man cut: cut out fields from lines +// ?man arguments: -b list [file ... +// ?man print selected parts of lines from files int main(int argc, char *argv[]) { @@ -177,12 +175,12 @@ main(int argc, char *argv[]) case 'b': // ?man -c: print count or perform stdout action case 'c': - // ?man -f: force the operation + // ?man -f:mode: force the operation case 'f': mode = ARGC(); parselist(EARGF(usage())); break; - // ?man -d: specify directory + // ?man -d:str: specify directory case 'd': delim = EARGF(usage()); if (!*delim) diff --git a/cmd/posix/date.c b/cmd/posix/date.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -date: print or set system date and time -usage: date [-u] [-d time] [+format | mmddHHMM[[CC]yy]] -display or configure the system date and time -*/ #include <ctype.h> #include <stdio.h> @@ -68,6 +63,9 @@ setdate(const char *s, struct tm *now) eprintf("clock_settime:"); } +// ?man date: print or set system date and time +// ?man arguments: +format | mmddHHMM[[CC]yy +// ?man display or configure the system date and time int main(int argc, char *argv[]) { @@ -80,7 +78,7 @@ main(int argc, char *argv[]) eprintf("time:"); ARGBEGIN { - // ?man -d: specify directory + // ?man -d:num: specify directory case 'd': t = estrtonum(EARGF(usage()), 0, LLONG_MAX); break; diff --git a/cmd/posix/dd.c b/cmd/posix/dd.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -dd: convert and copy a file -usage: dd [operand...] -copy a file while performing conversions -*/ #include <ctype.h> #include <fcntl.h> @@ -78,6 +73,9 @@ summary(void) fprintf(stderr, "%"PRIdMAX"+%"PRIdMAX" records out\n", (intmax_t)ofull, (intmax_t)opart); } +// ?man dd: convert and copy a file +// ?man arguments: operand... +// ?man copy a file while performing conversions int main(int argc, char *argv[]) { diff --git a/cmd/posix/df.c b/cmd/posix/df.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -df: report disk space usage -usage: df [-a] -display free and used disk space on filesystems -*/ #include <sys/statvfs.h> @@ -96,6 +91,8 @@ usage(void) eprintf("usage: %s [-a]\n", argv0); } +// ?man df: report disk space usage +// ?man display free and used disk space on filesystems int main(int argc, char *argv[]) { diff --git a/cmd/posix/dirname.c b/cmd/posix/dirname.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -dirname: strip non-directory suffix from filename -usage: dirname path -print the directory portion of a pathname -*/ #include <libgen.h> #include <stdio.h> @@ -17,6 +12,9 @@ usage(void) eprintf("usage: %s path\n", argv0); } +// ?man dirname: strip non-directory suffix from filename +// ?man arguments: path +// ?man print the directory portion of a pathname int main(int argc, char *argv[]) { diff --git a/cmd/posix/du.c b/cmd/posix/du.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -du: estimate file space usage -usage: du [-a | -s] [-d depth] [-h] [-k] [-H | -L | -P] [-x] [file ...] -display disk space used by files and directories -*/ #include <sys/stat.h> #include <sys/types.h> @@ -115,6 +110,9 @@ usage(void) eprintf("usage: %s [-a | -s] [-d depth] [-h] [-k] [-H | -L | -P] [-x] [file ...]\n", argv0); } +// ?man du: estimate file space usage +// ?man arguments: file ... +// ?man display disk space used by files and directories int main(int argc, char *argv[]) { @@ -128,7 +126,7 @@ main(int argc, char *argv[]) case 'a': aflag = 1; break; - // ?man -d: specify directory + // ?man -d:num: specify directory case 'd': dflag = 1; maxdepth = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); diff --git a/cmd/posix/echo.c b/cmd/posix/echo.c @@ -1,15 +1,12 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -echo: write arguments to stdout -usage: echo -print the specified arguments to standard output -*/ #include <stdio.h> #include <string.h> #include "util.h" +// ?man echo: write arguments to stdout +// ?man print the specified arguments to standard output int main(int argc, char *argv[]) { diff --git a/cmd/posix/ed.c b/cmd/posix/ed.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ed: line editor -usage: ed [-s] [-p] [file] -simple text line editor -*/ #include <sys/stat.h> #include <fcntl.h> @@ -1705,11 +1700,14 @@ init(char *fname) clearundo(); } +// ?man ed: line editor +// ?man arguments: file +// ?man simple text line editor int main(int argc, char *argv[]) { ARGBEGIN { - // ?man -p: preserve file attributes + // ?man -p:str: preserve file attributes case 'p': prompt = EARGF(usage()); optprompt = 1; diff --git a/cmd/posix/env.c b/cmd/posix/env.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -env: run command in modified environment -usage: env [-i] [-u var] ... [var=value] ... [cmd [arg ...]] -set environment variables and run a command -*/ #include <errno.h> #include <stdio.h> @@ -22,6 +17,9 @@ usage(void) eprintf("usage: %s [-i] [-u var] ... [var=value] ... [cmd [arg ...]]\n", argv0); } +// ?man env: run command in modified environment +// ?man arguments: ... [var=value] ... [cmd [arg ... +// ?man set environment variables and run a command int main(int argc, char *argv[]) { @@ -32,7 +30,7 @@ main(int argc, char *argv[]) case 'i': *environ = NULL; break; - // ?man -u: unbuffered output + // ?man -u:str: unbuffered output case 'u': if (unsetenv(EARGF(usage())) < 0) eprintf("unsetenv:"); diff --git a/cmd/posix/expand.c b/cmd/posix/expand.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -expand: convert tabs to spaces -usage: expand [-i] [-t tablist] [file ...] -convert tab characters to space characters -*/ #include <stdint.h> #include <stdlib.h> @@ -92,6 +87,9 @@ usage(void) eprintf("usage: %s [-i] [-t tablist] [file ...]\n", argv0); } +// ?man expand: convert tabs to spaces +// ?man arguments: file ... +// ?man convert tab characters to space characters int main(int argc, char *argv[]) { @@ -104,7 +102,7 @@ main(int argc, char *argv[]) case 'i': iflag = 1; break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tl = EARGF(usage()); if (!*tl) diff --git a/cmd/posix/expr.c b/cmd/posix/expr.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -expr: evaluate expression -usage: expr -evaluate a command line expression and print the result -*/ #include <limits.h> #include <stdio.h> @@ -239,6 +234,8 @@ parse(char *expr[], int numexpr) return (valp->str && *valp->str) || valp->num; } +// ?man expr: evaluate expression +// ?man evaluate a command line expression and print the result int main(int argc, char *argv[]) { diff --git a/cmd/posix/false.c b/cmd/posix/false.c @@ -1,11 +1,8 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -false: return unsuccessful exit status -usage: false -exit with status 1 representing failure -*/ +// ?man false: return unsuccessful exit status +// ?man exit with status 1 representing failure int main(void) { diff --git a/cmd/posix/find.c b/cmd/posix/find.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -find: search for files -usage: find [-H | -L] path ... [expression ...] -search for files in a directory hierarchy -*/ #include "config.h" #include "util.h" @@ -1425,6 +1420,9 @@ usage(void) eprintf("usage: %s [-H | -L] path ... [expression ...]\n", argv0); } +// ?man find: search for files +// ?man arguments: path ... [expression ... +// ?man search for files in a directory hierarchy int main(int argc, char **argv) { diff --git a/cmd/posix/fold.c b/cmd/posix/fold.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -fold: wrap lines to fit width -usage: fold [-bs] [-w num | -num] [FILE ...] -wrap input lines to fit a specified width -*/ #include <ctype.h> #include <stdint.h> @@ -89,6 +84,9 @@ usage(void) eprintf("usage: %s [-bs] [-w num | -num] [FILE ...]\n", argv0); } +// ?man fold: wrap lines to fit width +// ?man arguments: FILE ... +// ?man wrap input lines to fit a specified width int main(int argc, char *argv[]) { @@ -104,10 +102,11 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; - // ?man -w: wait for completion + // ?man -w:num: wait for completion case 'w': width = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; + // ?man ARGNUM: specify RGNUM option ARGNUM: if (!(width = ARGNUMF())) eprintf("illegal width value, too small\n"); diff --git a/cmd/posix/getconf.c b/cmd/posix/getconf.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -getconf: query configuration variables -usage: getconf [-v spec] var [path] -query system configuration variables -*/ #include <errno.h> #include <unistd.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-v spec] var [path]\n", argv0); } +// ?man getconf: query configuration variables +// ?man arguments: var [path +// ?man query system configuration variables int main(int argc, char *argv[]) { @@ -36,7 +34,7 @@ main(int argc, char *argv[]) char *str; ARGBEGIN { - // ?man -v: verbose mode; show progress + // ?man -v:str: verbose mode; show progress case 'v': /* ignore */ EARGF(usage()); diff --git a/cmd/posix/grep.c b/cmd/posix/grep.c @@ -1,11 +1,4 @@ -/* ?man -grep: search files for a pattern -usage: grep [-EFHchilnqsvwx] [-e pattern] [-f file] [pattern] [file ...] -grep searches the named input files for lines matching the given pattern -if no files are named, or a file is -, standard input is searched -by default, matching lines are written to standard output -*/ #include "config.h" #include "queue.h" #include "util.h" @@ -250,6 +243,11 @@ usage(void) " [-e pattern] [-f file] [pattern] [file ...]\n", argv0); } +// ?man grep: search files for a pattern +// ?man arguments: pattern] [file ... +// ?man grep searches the named input files for lines matching the given pattern +// ?man if no files are named, or a file is -, standard input is searched +// ?man by default, matching lines are written to standard output int main(int argc, char *argv[]) { @@ -262,45 +260,54 @@ main(int argc, char *argv[]) ARGBEGIN { #if FEATURE_GREP_CONTEXT + // ?man -A:num: specify A option case 'A': // ?man -A num: print num lines of trailing context after each match Aflag = estrtonum(EARGF(usage()), 0, LONG_MAX); break; + // ?man -B:num: specify B option case 'B': // ?man -B num: print num lines of leading context before each match Bflag = estrtonum(EARGF(usage()), 0, LONG_MAX); break; + // ?man -C:num: specify C option case 'C': // ?man -C num: print num lines of context before and after each match; equivalent to -A num -B num Aflag = Bflag = estrtonum(EARGF(usage()), 0, LONG_MAX); break; + // ?man ARGNUM: specify RGNUM option ARGNUM: Aflag = Bflag = ARGNUMF(); break; #endif #if FEATURE_GREP_MAX_COUNT + // ?man -m:num: specify m option case 'm': // ?man -m num: stop reading a file after num matching lines mval = estrtonum(EARGF(usage()), 0, LONG_MAX); break; #endif + // ?man -E: specify E option case 'E': // ?man -E: interpret pattern as an extended regular expression Eflag = 1; Fflag = 0; flags |= REG_EXTENDED; break; + // ?man -F: specify F option case 'F': // ?man -F: interpret pattern as a list of fixed strings separated by newlines Fflag = 1; Eflag = 0; flags &= ~REG_EXTENDED; break; + // ?man -H: specify H option case 'H': // ?man -H: always print the file name with matching lines Hflag = 1; hflag = 0; break; + // ?man -e:file: specify e option case 'e': // ?man -e pattern: specify a pattern to match; may be given multiple times arg = EARGF(usage()); @@ -310,6 +317,7 @@ main(int argc, char *argv[]) efshut(fp, arg); eflag = 1; break; + // ?man -f:file: specify f option case 'f': // ?man -f file: read patterns from file, one per line arg = EARGF(usage()); @@ -320,41 +328,51 @@ main(int argc, char *argv[]) efshut(fp, arg); fflag = 1; break; + // ?man -h: specify h option case 'h': // ?man -h: never print file names with matching lines hflag = 1; Hflag = 0; break; + // ?man -c: specify c option case 'c': // ?man -c: print only a count of matching lines per file /* FALLTHROUGH */ + // ?man -l: specify l option case 'l': // ?man -l: print only the names of files with at least one matching line /* FALLTHROUGH */ + // ?man -n: specify n option case 'n': // ?man -n: prefix each matching line with its line number within its file /* FALLTHROUGH */ + // ?man -q: specify q option case 'q': // ?man -q: quiet mode; exit immediately with status 0 on first match and write nothing mode = ARGC(); break; + // ?man -i: specify i option case 'i': // ?man -i: perform case-insensitive matching flags |= REG_ICASE; iflag = 1; break; + // ?man -s: specify s option case 's': // ?man -s: suppress error messages about nonexistent or unreadable files sflag = 1; break; + // ?man -v: specify v option case 'v': // ?man -v: invert the sense of matching to select non-matching lines vflag = 1; break; + // ?man -w: specify w option case 'w': // ?man -w: match only whole words wflag = 1; break; + // ?man -x: specify x option case 'x': // ?man -x: match only whole lines xflag = 1; @@ -405,22 +423,22 @@ main(int argc, char *argv[]) if (fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>")) match = Error; - /* ?man - ## Exit status - - 0 - : one or more lines matched in at least one file - - 1 - : no lines matched in any file - - 2 - : an error occurred - - ## See also - - sed(1), awk(1) - */ + // ?man + // ?man ## Exit status + // ?man + // ?man 0 + // ?man : one or more lines matched in at least one file + // ?man + // ?man 1 + // ?man : no lines matched in any file + // ?man + // ?man 2 + // ?man : an error occurred + // ?man + // ?man ## See also + // ?man + // ?man sed(1), awk(1) + // ?man return match; } diff --git a/cmd/posix/head.c b/cmd/posix/head.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -head: output first part of files -usage: head [-num | -n num] [file ...] -print the first lines or bytes of files -*/ #include <stdint.h> #include <stdio.h> @@ -35,6 +30,9 @@ usage(void) eprintf("usage: %s [-num | -n num] [file ...]\n", argv0); } +// ?man head: output first part of files +// ?man arguments: file ... +// ?man print the first lines or bytes of files int main(int argc, char *argv[]) { @@ -43,10 +41,11 @@ main(int argc, char *argv[]) int ret = 0, newline = 0, many = 0; ARGBEGIN { - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': n = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; + // ?man ARGNUM: specify RGNUM option ARGNUM: n = ARGNUMF(); break; diff --git a/cmd/posix/id.c b/cmd/posix/id.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -id: print user and group ids -usage: id [-n] [-g | -u | -G] [user | uid] -display real and effective user and group identities -*/ #include <sys/types.h> @@ -140,6 +135,9 @@ usage(void) eprintf("usage: %s [-n] [-g | -u | -G] [user | uid]\n", argv0); } +// ?man id: print user and group ids +// ?man arguments: user | uid +// ?man display real and effective user and group identities int main(int argc, char *argv[]) { diff --git a/cmd/posix/join.c b/cmd/posix/join.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -join: join lines on common field -usage: join [-1 field] [-2 field] [-o list] [-e string] -join lines of two sorted files on a common field -*/ #include <ctype.h> #include <stdint.h> @@ -456,6 +451,8 @@ join(FILE *fa, FILE *fb, size_t jfa, size_t jfb) } +// ?man join: join lines on common field +// ?man join lines of two sorted files on a common field int main(int argc, char *argv[]) { @@ -465,15 +462,15 @@ main(int argc, char *argv[]) char *fno; ARGBEGIN { - // ?man -1: specify option flag + // ?man -1:num: specify option flag case '1': jf[0] = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -2: specify option flag + // ?man -2:num: specify option flag case '2': jf[1] = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -a: print or show all entries + // ?man -a:str: print or show all entries case 'a': fno = EARGF(usage()); if (strcmp(fno, "1") == 0) @@ -483,21 +480,21 @@ main(int argc, char *argv[]) else usage(); break; - // ?man -e: specify expression or pattern + // ?man -e:str: specify expression or pattern case 'e': replace = EARGF(usage()); break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': oflag = 1; initolist(&output); makeolist(&output, EARGF(usage())); break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': sep = EARGF(usage()); break; - // ?man -v: verbose mode; show progress + // ?man -v:str: verbose mode; show progress case 'v': pairs = 0; fno = EARGF(usage()); diff --git a/cmd/posix/kill.c b/cmd/posix/kill.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -kill: send signal to process -usage: kill [-s signame | -num | -signame] pid ... -send a specified signal to processes by pid -*/ #include "sig.h" #include "util.h" @@ -49,6 +44,9 @@ usage(void) " %s -l [num]\n", argv0, argv0); } +// ?man kill: send signal to process +// ?man arguments: pid ... +// ?man send a specified signal to processes by pid int main(int argc, char *argv[]) { diff --git a/cmd/posix/link.c b/cmd/posix/link.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -link: create a link to a file -usage: link target name -create a hard link to an existing file -*/ #include <unistd.h> @@ -16,6 +11,9 @@ usage(void) eprintf("usage: %s target name\n", argv0); } +// ?man link: create a link to a file +// ?man arguments: target name +// ?man create a hard link to an existing file int main(int argc, char *argv[]) { diff --git a/cmd/posix/ln.c b/cmd/posix/ln.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ln: make links between files -usage: ln [-f] [-L | -P | -s] target [name] -create hard or symbolic links between files -*/ #include <sys/stat.h> @@ -23,6 +18,9 @@ usage(void) " %s [-f] [-L | -P | -s] target ... dir\n", argv0, argv0); } +// ?man ln: make links between files +// ?man arguments: target [name +// ?man create hard or symbolic links between files int main(int argc, char *argv[]) { diff --git a/cmd/posix/logger.c b/cmd/posix/logger.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -logger: log messages -usage: logger [-is] [-p priority] [-t tag] [message ...] -add messages to the system log -*/ #include <stdio.h> #include <stdlib.h> @@ -50,6 +45,9 @@ usage(void) eprintf("usage: %s [-is] [-p priority] [-t tag] [message ...]\n", argv0); } +// ?man logger: log messages +// ?man arguments: message ... +// ?man add messages to the system log int main(int argc, char *argv[]) { @@ -62,7 +60,7 @@ main(int argc, char *argv[]) case 'i': logflags |= LOG_PID; break; - // ?man -p: preserve file attributes + // ?man -p:str: preserve file attributes case 'p': priority = decodepri(EARGF(usage())); break; @@ -70,7 +68,7 @@ main(int argc, char *argv[]) case 's': logflags |= LOG_PERROR; break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tag = EARGF(usage()); break; diff --git a/cmd/posix/logname.c b/cmd/posix/logname.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -logname: print login name -usage: logname -display the user login name -*/ #include <stdio.h> #include <unistd.h> @@ -17,6 +12,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man logname: print login name +// ?man display the user login name int main(int argc, char *argv[]) { diff --git a/cmd/posix/ls.c b/cmd/posix/ls.c @@ -1,10 +1,5 @@ /* see license file for copyright and license details */ -/* ?man -ls: list directory contents -usage: ls [-1ACacdFfGghiLlnopqRrtUu] [--color[=always|never|auto]] [file ...] -list information about files and directories -*/ #include <sys/stat.h> #include <sys/types.h> @@ -556,6 +551,9 @@ usage(void) eprintf("usage: %s [-1ACacdFfGghiLlnopqRrtUu] [--color[=always|never|auto]] [file ...]\n", argv0); } +// ?man ls: list directory contents +// ?man arguments: [file ... +// ?man list information about files and directories int main(int argc, char *argv[]) { @@ -708,6 +706,7 @@ main(int argc, char *argv[]) uflag = 1; cflag = 0; break; + // ?man --: specify - option case '-': #if FEATURE_LS_COLOR // ?man --color [when]: control coloring diff --git a/cmd/posix/mesg.c b/cmd/posix/mesg.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mesg: control write access -usage: mesg [n|y] -allow or disallow other users to write to the terminal -*/ #include <sys/stat.h> #include <sys/types.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s [n|y]\n", argv0); } +// ?man mesg: control write access +// ?man arguments: n|y +// ?man allow or disallow other users to write to the terminal int main(int argc, char *argv[]) { diff --git a/cmd/posix/mkdir.c b/cmd/posix/mkdir.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mkdir: create directories -usage: mkdir [-p] [-m mode] name ... -create directories at specified paths -*/ #include <sys/stat.h> @@ -19,6 +14,9 @@ usage(void) eprintf("usage: %s [-p] [-m mode] name ...\n", argv0); } +// ?man mkdir: create directories +// ?man arguments: name ... +// ?man create directories at specified paths int main(int argc, char *argv[]) { @@ -33,7 +31,7 @@ main(int argc, char *argv[]) case 'p': pflag = 1; break; - // ?man -m: set file mode bits for created directories + // ?man -m:mode: set file mode bits for created directories case 'm': mode = parsemode(EARGF(usage()), 0777, mask); break; diff --git a/cmd/posix/mkfifo.c b/cmd/posix/mkfifo.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mkfifo: make fifos -usage: mkfifo [-m mode] name ... -create named pipes at specified paths -*/ #include <sys/stat.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s [-m mode] name ...\n", argv0); } +// ?man mkfifo: make fifos +// ?man arguments: name ... +// ?man create named pipes at specified paths int main(int argc, char *argv[]) { @@ -25,7 +23,7 @@ main(int argc, char *argv[]) int ret = 0; ARGBEGIN { - // ?man -m: specify mode or limit + // ?man -m:mode: specify mode or limit case 'm': mode = parsemode(EARGF(usage()), mode, umask(0)); break; diff --git a/cmd/posix/mv.c b/cmd/posix/mv.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mv: move or rename files -usage: mv [-f] source ... dest -move or rename files and directories -*/ #include <sys/stat.h> @@ -48,6 +43,9 @@ usage(void) eprintf("usage: %s [-f] source ... dest\n", argv0); } +// ?man mv: move or rename files +// ?man arguments: source ... dest +// ?man move or rename files and directories int main(int argc, char *argv[]) { diff --git a/cmd/posix/nice.c b/cmd/posix/nice.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -nice: run command with modified priority -usage: nice [-n inc] cmd [arg ...] -run a command with modified scheduling priority -*/ #include <sys/resource.h> @@ -28,13 +23,16 @@ usage(void) eprintf("usage: %s [-n inc] cmd [arg ...]\n", argv0); } +// ?man nice: run command with modified priority +// ?man arguments: cmd [arg ... +// ?man run a command with modified scheduling priority int main(int argc, char *argv[]) { int val = 10, r, savederrno; ARGBEGIN { - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': val = estrtonum(EARGF(usage()), PRIO_MIN, PRIO_MAX); break; diff --git a/cmd/posix/nl.c b/cmd/posix/nl.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -nl: number lines -usage: nl [-p] [-b type] [-d delim] [-f type] -number the lines of files -*/ #include <limits.h> #include <stdint.h> @@ -123,6 +118,8 @@ getlinetype(char *type, regex_t *preg) return type[0]; } +// ?man nl: number lines +// ?man number the lines of files int main(int argc, char *argv[]) { @@ -132,7 +129,7 @@ main(int argc, char *argv[]) char *d, *formattype, *formatblit; ARGBEGIN { - // ?man -d: specify directory + // ?man -d:str: specify directory case 'd': switch (utflen((d = EARGF(usage())))) { case 0: @@ -151,27 +148,27 @@ main(int argc, char *argv[]) break; } break; - // ?man -f: force the operation + // ?man -f:str: force the operation case 'f': type[0] = getlinetype(EARGF(usage()), preg); break; - // ?man -b: specify block size or base directory + // ?man -b:str: specify block size or base directory case 'b': type[1] = getlinetype(EARGF(usage()), preg + 1); break; - // ?man -h: suppress headers or print help + // ?man -h:str: suppress headers or print help case 'h': type[2] = getlinetype(EARGF(usage()), preg + 2); break; - // ?man -i: interactive mode or prompt for confirmation + // ?man -i:num: interactive mode or prompt for confirmation case 'i': incr = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -l: list in long format + // ?man -l:num: list in long format case 'l': blines = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -n: print line numbers or counts + // ?man -n:str: print line numbers or counts case 'n': formattype = EARGF(usage()); estrlcpy(format, "%", sizeof(format)); @@ -193,16 +190,16 @@ main(int argc, char *argv[]) case 'p': pflag = 1; break; - // ?man -s: silent mode or print summary + // ?man -s:str: silent mode or print summary case 's': sep = EARGF(usage()); seplen = unescape(sep); break; - // ?man -v: verbose mode; show progress + // ?man -v:num: verbose mode; show progress case 'v': startnum = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -w: wait for completion + // ?man -w:num: wait for completion case 'w': width = estrtonum(EARGF(usage()), 1, INT_MAX); break; diff --git a/cmd/posix/nohup.c b/cmd/posix/nohup.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -nohup: run command immune to hangups -usage: nohup cmd [arg ...] -run a command that persists after logging out -*/ #include <sys/stat.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s cmd [arg ...]\n", argv0); } +// ?man nohup: run command immune to hangups +// ?man arguments: cmd [arg ... +// ?man run a command that persists after logging out int main(int argc, char *argv[]) { diff --git a/cmd/posix/od.c b/cmd/posix/od.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -od: dump files in formats -usage: od [-bdosvx] [-A addressformat] -display file contents in octal, hex, or other formats -*/ #include "queue.h" #include "util.h" @@ -219,6 +214,8 @@ usage(void) "[-j skip] [-t outputformat] [file ...]\n", argv0); } +// ?man od: dump files in formats +// ?man display file contents in octal, hex, or other formats int main(int argc, char *argv[]) { @@ -229,7 +226,7 @@ main(int argc, char *argv[]) big_endian = (*(uint16_t *)"\0\xff" == 0xff); ARGBEGIN { - // ?man -A: specify option flag + // ?man -A:str: specify option flag case 'A': s = EARGF(usage()); if (strlen(s) != 1 || !strchr("doxn", s[0])) @@ -252,12 +249,12 @@ main(int argc, char *argv[]) big_endian = (ARGC() == 'E'); break; #endif - // ?man -j: specify option flag + // ?man -j:str: specify option flag case 'j': if ((skip = parseoffset(EARGF(usage()))) < 0) usage(); break; - // ?man -N: specify option flag + // ?man -N:str: specify option flag case 'N': if ((max = parseoffset(EARGF(usage()))) < 0) usage(); @@ -270,24 +267,24 @@ main(int argc, char *argv[]) case 's': addtype('d', 2); break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': s = EARGF(usage()); for (; *s; s++) { switch (*s) { - // ?man -a: print or show all entries + // ?man -a: print or show all entries case 'a': - // ?man -c: print count or perform stdout action + // ?man -c: print count or perform stdout action case 'c': addtype(*s, 1); break; - // ?man -d: specify directory + // ?man -d: specify directory case 'd': - // ?man -o: specify output file + // ?man -o: specify output file case 'o': - // ?man -u: unbuffered output + // ?man -u: unbuffered output case 'u': - // ?man -x: hex format or match whole lines + // ?man -x: hex format or match whole lines case 'x': fmt_char = *s; if (isdigit((unsigned char)*(s + 1))) { @@ -295,22 +292,22 @@ main(int argc, char *argv[]) s = end - 1; } else { switch (*(s + 1)) { - // ?man -C: specify option flag + // ?man -C: specify option flag case 'C': len = sizeof(char); s++; break; - // ?man -S: specify option flag + // ?man -S: specify option flag case 'S': len = sizeof(short); s++; break; - // ?man -I: specify option flag + // ?man -I: specify option flag case 'I': len = sizeof(int); s++; break; - // ?man -L: specify option flag + // ?man -L: specify option flag case 'L': len = sizeof(long); s++; diff --git a/cmd/posix/paste.c b/cmd/posix/paste.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -paste: merge lines of files -usage: paste [-s] [-d list] file ... -merge corresponding lines of files side by side -*/ #include <stdlib.h> #include <string.h> @@ -91,6 +86,9 @@ usage(void) eprintf("usage: %s [-s] [-d list] file ...\n", argv0); } +// ?man paste: merge lines of files +// ?man arguments: file ... +// ?man merge corresponding lines of files side by side int main(int argc, char *argv[]) { @@ -105,7 +103,7 @@ main(int argc, char *argv[]) case 's': seq = 1; break; - // ?man -d: specify directory + // ?man -d:str: specify directory case 'd': delim = EARGF(usage()); delim_bytelen = unescape(delim); diff --git a/cmd/posix/pathchk.c b/cmd/posix/pathchk.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pathchk: check pathnames -usage: pathchk [-pP] filename... -verify that pathnames are valid and portable -*/ #include <sys/stat.h> @@ -85,6 +80,9 @@ usage(void) eprintf("usage: %s [-pP] filename...\n", argv0); } +// ?man pathchk: check pathnames +// ?man arguments: filename... +// ?man verify that pathnames are valid and portable int main(int argc, char *argv[]) { diff --git a/cmd/posix/pax.c b/cmd/posix/pax.c @@ -1,9 +1,4 @@ -/* ?man -pax: portable archive interchange -usage: pax -read, write, and list member files of archive files -*/ /* taken from: https://github.com/michaelforney/pax */ #ifndef _GNU_SOURCE @@ -2337,6 +2332,8 @@ handle_append(const char *filename, const char *algo, const char *format) } } +// ?man pax: portable archive interchange +// ?man read, write, and list member files of archive files int main(int argc, char *argv[]) { @@ -2356,7 +2353,7 @@ main(int argc, char *argv[]) case 'a': aflag = 1; break; - // ?man -b: specify block size or base directory + // ?man -b:str: specify block size or base directory case 'b': EARGF(usage()); break; @@ -2368,7 +2365,7 @@ main(int argc, char *argv[]) case 'd': dflag = 1; break; - // ?man -f: force the operation + // ?man -f:str: force the operation case 'f': name = EARGF(usage()); break; @@ -2404,23 +2401,23 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': parseopts(EARGF(usage())); break; - // ?man -p: preserve file attributes + // ?man -p:str: preserve file attributes case 'p': for (arg = EARGF(usage()); *arg; ++arg) { switch (*arg) { - // ?man -a: print or show all entries + // ?man -a: print or show all entries case 'a': preserve &= ~ATIME; break; - // ?man -e: specify expression or pattern + // ?man -e: specify expression or pattern case 'e': preserve = ~0; break; - // ?man -m: specify mode or limit + // ?man -m: specify mode or limit case 'm': preserve &= ~MTIME; break; - // ?man -o: specify output file + // ?man -o: specify output file case 'o': preserve |= UID | GID; break; - // ?man -p: preserve file attributes + // ?man -p: preserve file attributes case 'p': preserve |= MODE; break; default: fatal("unknown -p option"); } @@ -2430,7 +2427,7 @@ main(int argc, char *argv[]) case 'r': mode |= READ; break; - // ?man -s: silent mode or print summary + // ?man -s:str: silent mode or print summary case 's': parsereplstr(EARGF(usage())); break; @@ -2450,7 +2447,7 @@ main(int argc, char *argv[]) case 'w': mode |= WRITE; break; - // ?man -x: hex format or match whole lines + // ?man -x:str: hex format or match whole lines case 'x': format = EARGF(usage()); break; diff --git a/cmd/posix/printf.c b/cmd/posix/printf.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -printf: format and print data -usage: printf format [arg ...] -format and print arguments to standard output -*/ #include <ctype.h> #include <errno.h> @@ -79,6 +74,9 @@ usage(void) eprintf("usage: %s format [arg ...]\n", argv0); } +// ?man printf: format and print data +// ?man arguments: format [arg ... +// ?man format and print arguments to standard output int main(int argc, char *argv[]) { diff --git a/cmd/posix/ps.c b/cmd/posix/ps.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -ps: report process status -usage: ps [-aAdef] -display information about active system processes -*/ #include <sys/ioctl.h> #include <sys/sysinfo.h> @@ -155,6 +150,8 @@ usage(void) eprintf("usage: %s [-aAdef]\n", argv0); } +// ?man ps: report process status +// ?man display information about active system processes int main(int argc, char *argv[]) { diff --git a/cmd/posix/pwd.c b/cmd/posix/pwd.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pwd: print working directory -usage: pwd [-LP] -display the pathname of the current working directory -*/ #include <sys/stat.h> @@ -34,6 +29,8 @@ usage(void) eprintf("usage: %s [-LP]\n", argv0); } +// ?man pwd: print working directory +// ?man display the pathname of the current working directory int main(int argc, char *argv[]) { diff --git a/cmd/posix/readlink.c b/cmd/posix/readlink.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -readlink: print value of symlink -usage: readlink [-fn] path -display the target of a symbolic link -*/ #include <limits.h> #include <stdio.h> @@ -24,6 +19,9 @@ usage(void) #endif } +// ?man readlink: print value of symlink +// ?man arguments: path +// ?man display the target of a symbolic link int main(int argc, char *argv[]) { diff --git a/cmd/posix/renice.c b/cmd/posix/renice.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -renice: alter priority of processes -usage: renice -n num [-g | -p | -u] id ... -change the scheduling priority of running processes -*/ #include <sys/resource.h> @@ -47,6 +42,9 @@ usage(void) eprintf("usage: %s -n num [-g | -p | -u] id ...\n", argv0); } +// ?man renice: alter priority of processes +// ?man arguments: -n num id ... +// ?man change the scheduling priority of running processes int main(int argc, char *argv[]) { @@ -57,7 +55,7 @@ main(int argc, char *argv[]) int who; ARGBEGIN { - // ?man -n: print line numbers or counts + // ?man -n:str: print line numbers or counts case 'n': adj = EARGF(usage()); break; diff --git a/cmd/posix/rm.c b/cmd/posix/rm.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -rm: remove files -usage: rm [-f] [-iRr] file ... -remove files and directory hierarchies -*/ #include <fcntl.h> #include <string.h> @@ -51,6 +46,9 @@ forbidden(char *path, struct stat *root) return 0; } +// ?man rm: remove files +// ?man arguments: file ... +// ?man remove files and directory hierarchies int main(int argc, char *argv[]) { diff --git a/cmd/posix/rmdir.c b/cmd/posix/rmdir.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -rmdir: remove empty directories -usage: rmdir [-p] dir ... -remove empty directories from the filesystem -*/ #include <libgen.h> #include <string.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s [-p] dir ...\n", argv0); } +// ?man rmdir: remove empty directories +// ?man arguments: dir ... +// ?man remove empty directories from the filesystem int main(int argc, char *argv[]) { diff --git a/cmd/posix/sed.c b/cmd/posix/sed.c @@ -1,9 +1,4 @@ -/* ?man -sed: stream editor -usage: sed [-nrE] script [file ...] -stream editor for filtering and transforming text -*/ /* FIXME: summary * decide whether we enforce valid UTF-8, right now it's enforced in certain @@ -1754,6 +1749,9 @@ old_next(void) pc = prog - 1; } +// ?man sed: stream editor +// ?man arguments: script [file ... +// ?man stream editor for filtering and transforming text int main(int argc, char *argv[]) { @@ -1771,13 +1769,13 @@ main(int argc, char *argv[]) case 'E': gflags.E = 1; break; - // ?man -e: specify expression or pattern + // ?man -e:str: specify expression or pattern case 'e': arg = EARGF(usage()); compile(arg, 0); script = 1; break; - // ?man -f: force the operation + // ?man -f:str: force the operation case 'f': arg = EARGF(usage()); compile(arg, 1); diff --git a/cmd/posix/sleep.c b/cmd/posix/sleep.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sleep: delay for a duration -usage: sleep num -pause execution for a specified amount of time -*/ #include <unistd.h> @@ -16,6 +11,9 @@ usage(void) eprintf("usage: %s num\n", argv0); } +// ?man sleep: delay for a duration +// ?man arguments: num +// ?man pause execution for a specified amount of time int main(int argc, char *argv[]) { diff --git a/cmd/posix/sort.c b/cmd/posix/sort.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sort: sort lines -usage: sort [-Cbcdfimnru -sort or merge lines of text files -*/ #include "queue.h" #include "text.h" @@ -400,6 +395,9 @@ usage(void) "] [-o outfile] [-t delim] [-k def]... [file ...]\n", argv0); } +// ?man sort: sort lines +// ?man arguments: -Cbcdfimnru +// ?man sort or merge lines of text files int main(int argc, char *argv[]) { @@ -434,7 +432,7 @@ main(int argc, char *argv[]) case 'i': global_flags |= MOD_I; break; - // ?man -k: specify option flag + // ?man -k:str: specify option flag case 'k': addkeydef(EARGF(usage()), global_flags); break; @@ -450,7 +448,7 @@ main(int argc, char *argv[]) case 'n': global_flags |= MOD_N; break; - // ?man -o: specify output file + // ?man -o:file: specify output file case 'o': outfile = EARGF(usage()); break; @@ -464,7 +462,7 @@ main(int argc, char *argv[]) sflag = 1; break; #endif - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': fieldsep = EARGF(usage()); if (!*fieldsep) diff --git a/cmd/posix/split.c b/cmd/posix/split.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -split: split file into pieces -usage: split [-a num] [-b num[k|m|g] | -l num] [-d] -split a file into fixed-size pieces -*/ #include <ctype.h> #include <stdint.h> @@ -51,6 +46,9 @@ usage(void) "[file [prefix]]\n", argv0); } +// ?man split: split file into pieces +// ?man arguments: | -l num +// ?man split a file into fixed-size pieces int main(int argc, char *argv[]) { @@ -60,11 +58,11 @@ main(int argc, char *argv[]) char name[NAME_MAX + 1], *prefix = "x", *file = NULL; ARGBEGIN { - // ?man -a: print or show all entries + // ?man -a:num: print or show all entries case 'a': slen = estrtonum(EARGF(usage()), 0, INT_MAX); break; - // ?man -b: specify block size or base directory + // ?man -b:str: specify block size or base directory case 'b': always = 1; if ((size = parseoffset(EARGF(usage()))) < 0) @@ -77,7 +75,7 @@ main(int argc, char *argv[]) base = 10; start = '0'; break; - // ?man -l: list in long format + // ?man -l:num: list in long format case 'l': always = 0; size = estrtonum(EARGF(usage()), 1, MIN(LLONG_MAX, SSIZE_MAX)); diff --git a/cmd/posix/tail.c b/cmd/posix/tail.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tail: output last part of files -usage: tail [-f] [-c num | -m num | -n num | -num] [file ...] -print the last lines or bytes of files -*/ #include <sys/stat.h> @@ -159,6 +154,9 @@ usage(void) eprintf("usage: %s [-f] [-c num | -m num | -n num | -num] [file ...]\n", argv0); } +// ?man tail: output last part of files +// ?man arguments: file ... +// ?man print the last lines or bytes of files int main(int argc, char *argv[]) { @@ -178,7 +176,7 @@ main(int argc, char *argv[]) case 'c': // ?man -m: specify mode or limit case 'm': - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': mode = ARGC(); numstr = EARGF(usage()); @@ -187,6 +185,7 @@ main(int argc, char *argv[]) if (strchr(numstr, '+')) tail = dropinit; break; + // ?man ARGNUM: specify RGNUM option ARGNUM: n = ARGNUMF(); break; diff --git a/cmd/posix/tee.c b/cmd/posix/tee.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tee: duplicate input -usage: tee [-ai] [file ...] -read from standard input and write to standard output and files -*/ #include <fcntl.h> #include <signal.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s [-ai] [file ...]\n", argv0); } +// ?man tee: duplicate input +// ?man arguments: file ... +// ?man read from standard input and write to standard output and files int main(int argc, char *argv[]) { diff --git a/cmd/posix/test.c b/cmd/posix/test.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -test: evaluate condition -usage: test -check file types and compare values, returning 0 or 1 -*/ #include <sys/stat.h> @@ -236,6 +231,8 @@ fourarg(char *argv[]) return 0; /* not reached */ } +// ?man test: evaluate condition +// ?man check file types and compare values, returning 0 or 1 int main(int argc, char *argv[]) { diff --git a/cmd/posix/time.c b/cmd/posix/time.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -time: time command execution -usage: time [-p] cmd [arg ...] -run a command and report its execution duration -*/ #include <sys/times.h> #include <sys/wait.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s [-p] cmd [arg ...]\n", argv0); } +// ?man time: time command execution +// ?man arguments: cmd [arg ... +// ?man run a command and report its execution duration int main(int argc, char *argv[]) { diff --git a/cmd/posix/touch.c b/cmd/posix/touch.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -touch: change file timestamps -usage: touch [-acm] [-d time | -r ref_file | -t time | -T time] -update the access and modification times of files -*/ #include <sys/stat.h> @@ -112,6 +107,8 @@ usage(void) "file ...\n", argv0); } +// ?man touch: change file timestamps +// ?man update the access and modification times of files int main(int argc, char *argv[]) { @@ -129,7 +126,7 @@ main(int argc, char *argv[]) break; // ?man -d: specify directory case 'd': - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': times[0].tv_sec = parsetime(EARGF(usage())); times[0].tv_nsec = 0; @@ -138,7 +135,7 @@ main(int argc, char *argv[]) case 'm': mflag = 1; break; - // ?man -r: operate recursively + // ?man -r:str: operate recursively case 'r': ref = EARGF(usage()); if (stat(ref, &st) < 0) @@ -146,7 +143,7 @@ main(int argc, char *argv[]) times[0] = st.st_atim; times[1] = st.st_mtim; break; - // ?man -T: specify option flag + // ?man -T:num: specify option flag case 'T': times[0].tv_sec = estrtonum(EARGF(usage()), 0, LLONG_MAX); times[0].tv_nsec = 0; diff --git a/cmd/posix/tr.c b/cmd/posix/tr.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tr: translate characters -usage: tr [-cCds] set1 [set2] -translate, squeeze, or delete characters from standard input -*/ #include <stdlib.h> @@ -194,6 +189,9 @@ usage(void) eprintf("usage: %s [-cCds] set1 [set2]\n", argv0); } +// ?man tr: translate characters +// ?man arguments: set1 [set2 +// ?man translate, squeeze, or delete characters from standard input int main(int argc, char *argv[]) { diff --git a/cmd/posix/true.c b/cmd/posix/true.c @@ -1,11 +1,8 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -true: return successful exit status -usage: true -exit with status 0 representing success -*/ +// ?man true: return successful exit status +// ?man exit with status 0 representing success int main(void) { diff --git a/cmd/posix/tsort.c b/cmd/posix/tsort.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tsort: topological sort -usage: tsort [file] -perform a topological sort on input pairs -*/ #include <stdio.h> #include <string.h> @@ -185,6 +180,9 @@ usage(void) enprintf(2, "usage: %s [file]\n", argv0); } +// ?man tsort: topological sort +// ?man arguments: file +// ?man perform a topological sort on input pairs int main(int argc, char *argv[]) { diff --git a/cmd/posix/tty.c b/cmd/posix/tty.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -tty: print terminal filename -usage: tty -display the filename of the terminal connected to stdin -*/ #include <stdio.h> #include <unistd.h> @@ -17,6 +12,8 @@ usage(void) enprintf(2, "usage: %s\n", argv0); } +// ?man tty: print terminal filename +// ?man display the filename of the terminal connected to stdin int main(int argc, char *argv[]) { diff --git a/cmd/posix/uname.c b/cmd/posix/uname.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -uname: print system info -usage: uname [-amnrsv] -display system hostname, kernel name, release, and architecture -*/ #include <sys/utsname.h> @@ -18,6 +13,8 @@ usage(void) eprintf("usage: %s [-amnrsv]\n", argv0); } +// ?man uname: print system info +// ?man display system hostname, kernel name, release, and architecture int main(int argc, char *argv[]) { diff --git a/cmd/posix/unexpand.c b/cmd/posix/unexpand.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -unexpand: convert spaces to tabs -usage: unexpand [-a] [-t tablist] [file ...] -convert space characters to tab characters -*/ #include <stdint.h> #include <stdlib.h> @@ -135,6 +130,9 @@ usage(void) eprintf("usage: %s [-a] [-t tablist] [file ...]\n", argv0); } +// ?man unexpand: convert spaces to tabs +// ?man arguments: file ... +// ?man convert space characters to tab characters int main(int argc, char *argv[]) { @@ -143,7 +141,7 @@ main(int argc, char *argv[]) char *tl = "8"; ARGBEGIN { - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tl = EARGF(usage()); if (!*tl) diff --git a/cmd/posix/uniq.c b/cmd/posix/uniq.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -uniq: report duplicate lines -usage: uniq [-c] [-d | -u] [-f fields] [-s chars] -filter out repeated lines from sorted files -*/ #include <ctype.h> #include <stdio.h> @@ -104,6 +99,8 @@ usage(void) " [input [output]]\n", argv0); } +// ?man uniq: report duplicate lines +// ?man filter out repeated lines from sorted files int main(int argc, char *argv[]) { @@ -124,11 +121,11 @@ main(int argc, char *argv[]) case 'u': uflag = 1; break; - // ?man -f: force the operation + // ?man -f:num: force the operation case 'f': fskip = estrtonum(EARGF(usage()), 0, INT_MAX); break; - // ?man -s: silent mode or print summary + // ?man -s:num: silent mode or print summary case 's': sskip = estrtonum(EARGF(usage()), 0, INT_MAX); break; diff --git a/cmd/posix/unlink.c b/cmd/posix/unlink.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -unlink: remove a file -usage: unlink file -call the unlink system call to remove a file -*/ #include <unistd.h> @@ -16,6 +11,9 @@ usage(void) eprintf("usage: %s file\n", argv0); } +// ?man unlink: remove a file +// ?man arguments: file +// ?man call the unlink system call to remove a file int main(int argc, char *argv[]) { diff --git a/cmd/posix/uudecode.c b/cmd/posix/uudecode.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -uudecode: decode uuencoded file -usage: uudecode [-m] [-o output] [file] -decode a file created by uuencode -*/ #include <sys/stat.h> @@ -231,6 +226,9 @@ usage(void) eprintf("usage: %s [-m] [-o output] [file]\n", argv0); } +// ?man uudecode: decode uuencoded file +// ?man arguments: file +// ?man decode a file created by uuencode int main(int argc, char *argv[]) { @@ -245,7 +243,7 @@ main(int argc, char *argv[]) case 'm': mflag = 1; /* accepted but unused (autodetect file type) */ break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': oflag = 1; ofname = EARGF(usage()); diff --git a/cmd/posix/uuencode.c b/cmd/posix/uuencode.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -uuencode: encode binary file -usage: uuencode [-m] [file] name -encode a binary file into ascii text -*/ #include <sys/stat.h> @@ -103,6 +98,9 @@ usage(void) eprintf("usage: %s [-m] [file] name\n", argv0); } +// ?man uuencode: encode binary file +// ?man arguments: file] name +// ?man encode a binary file into ascii text int main(int argc, char *argv[]) { diff --git a/cmd/posix/wc.c b/cmd/posix/wc.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -wc: count lines, words, and bytes -usage: wc [-c | -m] [-lw] [file ...] -display the number of lines, words, and bytes in files -*/ #include <string.h> @@ -73,6 +68,9 @@ usage(void) eprintf("usage: %s [-c | -m] [-lw] [file ...]\n", argv0); } +// ?man wc: count lines, words, and bytes +// ?man arguments: file ... +// ?man display the number of lines, words, and bytes in files int main(int argc, char *argv[]) { diff --git a/cmd/posix/who.c b/cmd/posix/who.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -who: show logged in users -usage: who [-ml] -display a list of users currently logged into the system -*/ #include <stdio.h> #include <stdlib.h> @@ -22,6 +17,8 @@ usage(void) eprintf("usage: %s [-ml]\n", argv0); } +// ?man who: show logged in users +// ?man display a list of users currently logged into the system int main(int argc, char *argv[]) { diff --git a/cmd/posix/xargs.c b/cmd/posix/xargs.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -xargs: build and run command lines -usage: xargs [-0prtx] [-E eofstr] [-I replstr] [-L maxlines] [-n -execute commands built from standard input arguments -*/ #include <sys/wait.h> @@ -268,6 +263,9 @@ usage(void) argv0); } +// ?man xargs: build and run command lines +// ?man arguments: -n +// ?man execute commands built from standard input arguments int main(int argc, char *argv[]) { @@ -289,7 +287,7 @@ main(int argc, char *argv[]) case '0': nulflag = 1; break; - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': nflag = 1; maxargs = @@ -303,7 +301,7 @@ main(int argc, char *argv[]) case 'r': rflag = 1; break; - // ?man -s: silent mode or print summary + // ?man -s:num: silent mode or print summary case 's': argmaxsz = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)SIZE_MAX, (unsigned long long)LLONG_MAX)); @@ -316,11 +314,11 @@ main(int argc, char *argv[]) case 'x': xflag = 1; break; - // ?man -E: specify option flag + // ?man -E:str: specify option flag case 'E': eofstr = EARGF(usage()); break; - // ?man -I: specify option flag + // ?man -I:str: specify option flag case 'I': Iflag = 1; xflag = 1; @@ -328,13 +326,13 @@ main(int argc, char *argv[]) maxargs = 1; replstr = EARGF(usage()); break; - // ?man -L: specify option flag + // ?man -L:num: specify option flag case 'L': Lflag = 1; maxlines = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)SIZE_MAX, (unsigned long long)LLONG_MAX)); break; - // ?man -P: specify option flag + // ?man -P:num: specify option flag case 'P': maxprocs = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)SIZE_MAX, (unsigned long long)LLONG_MAX)); diff --git a/cmd/pseudo/base64.c b/cmd/pseudo/base64.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -base64: encode or decode base64 -usage: base64 [-d] [-i] [-w cols] [file] -encode or decode data in base64 format -*/ #include "util.h" #include "arg.h" @@ -135,6 +130,9 @@ decode_stream(FILE *fp, int iflag) eprintf("input is truncated\n"); } +// ?man base64: encode or decode base64 +// ?man arguments: file +// ?man encode or decode data in base64 format int main(int argc, char *argv[]) { @@ -157,7 +155,7 @@ main(int argc, char *argv[]) case 'i': iflag = 1; break; - // ?man -w: wait for completion + // ?man -w:num: wait for completion case 'w': wrap = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SSIZE_MAX)); break; diff --git a/cmd/pseudo/chroot.c b/cmd/pseudo/chroot.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -chroot: run command in new root -usage: chroot dir [cmd [arg ...]] -run a command or shell with a substitute root directory -*/ #include <errno.h> #include <stdlib.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s dir [cmd [arg ...]]\n", argv0); } +// ?man chroot: run command in new root +// ?man arguments: dir [cmd [arg ... +// ?man run a command or shell with a substitute root directory int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/clear.c b/cmd/pseudo/clear.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -clear: clear terminal screen -usage: clear -clear the terminal screen and scrollback buffer -*/ #include <stdio.h> @@ -16,6 +11,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man clear: clear terminal screen +// ?man clear the terminal screen and scrollback buffer int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/cols.c b/cmd/pseudo/cols.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cols: format columns -usage: cols [-c num] [file ...] -format standard input into vertical columns -*/ #include <sys/ioctl.h> @@ -24,6 +19,9 @@ usage(void) eprintf("usage: %s [-c num] [file ...]\n", argv0); } +// ?man cols: format columns +// ?man arguments: file ... +// ?man format standard input into vertical columns int main(int argc, char *argv[]) { @@ -35,7 +33,7 @@ main(int argc, char *argv[]) char *p; ARGBEGIN { - // ?man -c: print count or perform stdout action + // ?man -c:num: print count or perform stdout action case 'c': cflag = 1; chars = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); diff --git a/cmd/pseudo/cron.c b/cmd/pseudo/cron.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -cron: cron daemon -usage: cron [-f file] [-n] -daemon to run scheduled background commands -*/ #include <sys/types.h> #include <sys/wait.h> @@ -495,6 +490,8 @@ usage(void) eprintf("usage: %s [-f file] [-n]\n", argv0); } +// ?man cron: cron daemon +// ?man daemon to run scheduled background commands int main(int argc, char *argv[]) { @@ -509,7 +506,7 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; - // ?man -f: force the operation + // ?man -f:str: force the operation case 'f': config = EARGF(usage()); break; diff --git a/cmd/pseudo/dmesg.c b/cmd/pseudo/dmesg.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -dmesg: print kernel ring buffer -usage: dmesg [-Ccr] [-n level] -display or control the kernel ring buffer messages -*/ #include <stdio.h> #include <stdlib.h> @@ -36,6 +31,8 @@ usage(void) eprintf("usage: %s [-Ccr] [-n level]\n", argv0); } +// ?man dmesg: print kernel ring buffer +// ?man display or control the kernel ring buffer messages int main(int argc, char *argv[]) { @@ -57,7 +54,7 @@ main(int argc, char *argv[]) // ?man -r: operate recursively case 'r': break; - // ?man -n: print line numbers or counts + // ?man -n:num: print line numbers or counts case 'n': level = estrtol(EARGF(usage()), 10); if (set_console_level(level) < 0) diff --git a/cmd/pseudo/fallocate.c b/cmd/pseudo/fallocate.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -fallocate: preallocate file space -usage: fallocate [-o num] -l num file ... -preallocate or deallocate space to a file -*/ #include <sys/stat.h> @@ -23,6 +18,9 @@ usage(void) eprintf("usage: %s [-o num] -l num file ...\n", argv0); } +// ?man fallocate: preallocate file space +// ?man arguments: -l num file ... +// ?man preallocate or deallocate space to a file int main(int argc, char *argv[]) { @@ -30,11 +28,11 @@ main(int argc, char *argv[]) off_t size = 0, offset = 0; ARGBEGIN { - // ?man -l: list in long format + // ?man -l:num: list in long format case 'l': size = estrtonum(EARGF(usage()), 1, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; - // ?man -o: specify output file + // ?man -o:num: specify output file case 'o': offset = estrtonum(EARGF(usage()), 0, MIN((unsigned long long)LLONG_MAX, (unsigned long long)SIZE_MAX)); break; diff --git a/cmd/pseudo/flock.c b/cmd/pseudo/flock.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -flock: manage locks -usage: flock [-nosux] file cmd [arg ...] -acquire or release locks from shell scripts -*/ #include <sys/file.h> #include <sys/wait.h> @@ -22,6 +17,9 @@ usage(void) eprintf("usage: %s [-nosux] file cmd [arg ...]\n", argv0); } +// ?man flock: manage locks +// ?man arguments: file cmd [arg ... +// ?man acquire or release locks from shell scripts int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/free.c b/cmd/pseudo/free.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -free: display memory usage -usage: free [-bkmg] -display the amount of free and used memory in the system -*/ #include <stdio.h> #include <stdlib.h> @@ -28,6 +23,8 @@ usage(void) eprintf("usage: %s [-bkmg]\n", argv0); } +// ?man free: display memory usage +// ?man display the amount of free and used memory in the system int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/getty.c b/cmd/pseudo/getty.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -getty: set terminal mode -usage: getty [tty] [term] [cmd] [args...] -set terminal line discipline, speed, and mode -*/ #include <sys/ioctl.h> #include <sys/stat.h> @@ -31,6 +26,9 @@ usage(void) eprintf("usage: %s [tty] [term] [cmd] [args...]\n", argv0); } +// ?man getty: set terminal mode +// ?man arguments: tty] [term] [cmd] [args... +// ?man set terminal line discipline, speed, and mode int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/halt.c b/cmd/pseudo/halt.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -halt: halt or reboot -usage: halt [-pr] -halt, poweroff, or reboot the machine -*/ #include <sys/syscall.h> @@ -21,6 +16,8 @@ usage(void) eprintf("usage: %s [-pr]\n", argv0); } +// ?man halt: halt or reboot +// ?man halt, poweroff, or reboot the machine int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/hostname.c b/cmd/pseudo/hostname.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -hostname: show or set hostname -usage: hostname [name] -display or configure the system hostname -*/ #include <stdio.h> #include <string.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s [name]\n", argv0); } +// ?man hostname: show or set hostname +// ?man arguments: name +// ?man display or configure the system hostname int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/killall5.c b/cmd/pseudo/killall5.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -killall5: send signal to all processes -usage: killall5 [-o pid1 -send a signal to all processes except kernel threads -*/ #include <dirent.h> #include <limits.h> @@ -42,6 +37,9 @@ usage(void) eprintf("usage: %s [-o pid1,pid2,..,pidN] [-s signal]\n", argv0); } +// ?man killall5: send signal to all processes +// ?man arguments: -o pid1 +// ?man send a signal to all processes except kernel threads int main(int argc, char *argv[]) { @@ -56,7 +54,7 @@ main(int argc, char *argv[]) size_t i; ARGBEGIN { - // ?man -s: silent mode or print summary + // ?man -s:str: silent mode or print summary case 's': v = EARGF(usage()); sig = strtol(v, &end, 0); @@ -71,7 +69,7 @@ main(int argc, char *argv[]) if (i == LEN(sigs)) eprintf("%s: unknown signal\n", v); break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': oflag = 1; arg = EARGF(usage()); diff --git a/cmd/pseudo/last.c b/cmd/pseudo/last.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -last: show last logged in users -usage: last [user] -display a list of recent user logins -*/ #include <errno.h> #include <libgen.h> @@ -26,6 +21,9 @@ usage(void) eprintf("usage: %s [user]\n", argv0); } +// ?man last: show last logged in users +// ?man arguments: user +// ?man display a list of recent user logins int main(int argc, char **argv) { diff --git a/cmd/pseudo/lastlog.c b/cmd/pseudo/lastlog.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -lastlog: report recent logins -usage: lastlog -display the most recent login times of users -*/ #include <errno.h> #include <paths.h> @@ -51,6 +46,8 @@ lastlog(char *user) user, ll.ll_line, ll.ll_host, ctime(&lltime)); } +// ?man lastlog: report recent logins +// ?man display the most recent login times of users int main(int argc, char **argv) { diff --git a/cmd/pseudo/login.c b/cmd/pseudo/login.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -login: begin terminal session -usage: login [-p] username -authenticate and start a session on the system -*/ #include <sys/ioctl.h> #include <sys/types.h> @@ -74,6 +69,9 @@ usage(void) eprintf("usage: %s [-p] username\n", argv0); } +// ?man login: begin terminal session +// ?man arguments: username +// ?man authenticate and start a session on the system int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/md5sum.c b/cmd/pseudo/md5sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -md5sum: compute md5 checksums -usage: md5sum [-c] [file ...] -compute and check md5 message digests -*/ #include <stdio.h> #include <stdlib.h> @@ -28,6 +23,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man md5sum: compute md5 checksums +// ?man arguments: file ... +// ?man compute and check md5 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/mktemp.c b/cmd/pseudo/mktemp.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mktemp: create temporary file -usage: mktemp [-dqtu] [-p directory] [template] -create a temporary file or directory safely -*/ #include <libgen.h> #include <stdio.h> @@ -20,6 +15,9 @@ usage(void) eprintf("usage: %s [-dqtu] [-p directory] [template]\n", argv0); } +// ?man mktemp: create temporary file +// ?man arguments: template +// ?man create a temporary file or directory safely int main(int argc, char *argv[]) { @@ -33,7 +31,7 @@ main(int argc, char *argv[]) case 'd': dflag = 1; break; - // ?man -p: preserve file attributes + // ?man -p:dir: preserve file attributes case 'p': pflag = 1; pdir = EARGF(usage()); diff --git a/cmd/pseudo/nologin.c b/cmd/pseudo/nologin.c @@ -1,15 +1,12 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -nologin: politely refuse login -usage: nologin -politely refuse a login attempt by exiting with status 1 -*/ #include <fcntl.h> #include <stdio.h> #include <unistd.h> +// ?man nologin: politely refuse login +// ?man politely refuse a login attempt by exiting with status 1 int main(void) { diff --git a/cmd/pseudo/pagesize.c b/cmd/pseudo/pagesize.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pagesize: print system page size -usage: pagesize -display the size of a page in memory -*/ #include <stdio.h> #include <stdlib.h> @@ -18,6 +13,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man pagesize: print system page size +// ?man display the size of a page in memory int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/pidof.c b/cmd/pseudo/pidof.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pidof: find process ids -usage: pidof [-o pid1 -find the process identity numbers of running programs -*/ #include <sys/types.h> @@ -33,6 +28,9 @@ usage(void) eprintf("usage: %s [-o pid1,pid2,...pidN] [-s] [program...]\n", argv0); } +// ?man pidof: find process ids +// ?man arguments: -o pid1 +// ?man find the process identity numbers of running programs int main(int argc, char *argv[]) { @@ -50,7 +48,7 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': oflag = 1; arg = EARGF(usage()); diff --git a/cmd/pseudo/printenv.c b/cmd/pseudo/printenv.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -printenv: print environment variables -usage: printenv [var ...] -display all or part of the current environment -*/ #include <stdio.h> #include <stdlib.h> @@ -19,6 +14,9 @@ usage(void) eprintf("usage: %s [var ...]\n", argv0); } +// ?man printenv: print environment variables +// ?man arguments: var ... +// ?man display all or part of the current environment int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/pwdx.c b/cmd/pseudo/pwdx.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -pwdx: print working directory of process -usage: pwdx pid... -display the current working directory of a process by pid -*/ #include <errno.h> #include <limits.h> @@ -20,6 +15,9 @@ usage(void) eprintf("usage: %s pid...\n", argv0); } +// ?man pwdx: print working directory of process +// ?man arguments: pid... +// ?man display the current working directory of a process by pid int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/respawn.c b/cmd/pseudo/respawn.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -respawn: restart command on exit -usage: respawn [-l fifo] [-d N] cmd [args...] -run a command and restart it automatically when it exits -*/ #include <sys/stat.h> #include <sys/time.h> @@ -36,6 +31,9 @@ usage(void) eprintf("usage: %s [-l fifo] [-d N] cmd [args...]\n", argv0); } +// ?man respawn: restart command on exit +// ?man arguments: cmd [args... +// ?man run a command and restart it automatically when it exits int main(int argc, char *argv[]) { @@ -49,11 +47,11 @@ main(int argc, char *argv[]) int polln; ARGBEGIN { - // ?man -d: specify directory + // ?man -d:num: specify directory case 'd': delay = estrtol(EARGF(usage()), 0); break; - // ?man -l: list in long format + // ?man -l:str: list in long format case 'l': fifo = EARGF(usage()); break; diff --git a/cmd/pseudo/rev.c b/cmd/pseudo/rev.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -rev: reverse lines -usage: rev [file ...] -reverse the order of characters in each line of input -*/ #include <stdio.h> #include <string.h> @@ -46,6 +41,9 @@ rev(FILE *fp) } } +// ?man rev: reverse lines +// ?man arguments: file ... +// ?man reverse the order of characters in each line of input int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/seq.c b/cmd/pseudo/seq.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -seq: print sequence of numbers -usage: seq [-f fmt] [-s sep] [-w] -print a sequence of numbers from start to end -*/ #include <stdio.h> #include <stdlib.h> @@ -84,6 +79,8 @@ usage(void) "[startnum [step]] endnum\n", argv0); } +// ?man seq: print sequence of numbers +// ?man print a sequence of numbers from start to end int main(int argc, char *argv[]) { @@ -93,13 +90,13 @@ main(int argc, char *argv[]) const char *starts = "1", *steps = "1", *ends = "1", *sep = "\n"; ARGBEGIN { - // ?man -f: force the operation + // ?man -f:str: force the operation case 'f': if (!validfmt(tmp=EARGF(usage()))) eprintf("%s: invalid format\n", tmp); fmt = tmp; break; - // ?man -s: silent mode or print summary + // ?man -s:str: silent mode or print summary case 's': sep = EARGF(usage()); break; diff --git a/cmd/pseudo/setsid.c b/cmd/pseudo/setsid.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -setsid: run in new session -usage: setsid [-f] cmd [arg ...] -run a program in a new session -*/ #include <errno.h> #include <unistd.h> @@ -19,6 +14,9 @@ usage(void) eprintf("usage: %s [-f] cmd [arg ...]\n", argv0); } +// ?man setsid: run in new session +// ?man arguments: cmd [arg ... +// ?man run a program in a new session int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha1sum.c b/cmd/pseudo/sha1sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha1sum: compute sha1 checksums -usage: sha1sum [-c] [file ...] -compute and check sha1 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha1sum: compute sha1 checksums +// ?man arguments: file ... +// ?man compute and check sha1 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha224sum.c b/cmd/pseudo/sha224sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha224sum: compute sha224 checksums -usage: sha224sum [-c] [file ...] -compute and check sha224 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha224sum: compute sha224 checksums +// ?man arguments: file ... +// ?man compute and check sha224 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha256sum.c b/cmd/pseudo/sha256sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha256sum: compute sha256 checksums -usage: sha256sum [-c] [file ...] -compute and check sha256 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha256sum: compute sha256 checksums +// ?man arguments: file ... +// ?man compute and check sha256 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha384sum.c b/cmd/pseudo/sha384sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha384sum: compute sha384 checksums -usage: sha384sum [-c] [file ...] -compute and check sha384 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha384sum: compute sha384 checksums +// ?man arguments: file ... +// ?man compute and check sha384 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha512-224sum.c b/cmd/pseudo/sha512-224sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha512-224sum: compute sha512/224 checksums -usage: sha512-224sum [-c] [file ...] -compute and check sha512/224 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha512-224sum: compute sha512/224 checksums +// ?man arguments: file ... +// ?man compute and check sha512/224 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha512-256sum.c b/cmd/pseudo/sha512-256sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha512-256sum: compute sha512/256 checksums -usage: sha512-256sum [-c] [file ...] -compute and check sha512/256 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha512-256sum: compute sha512/256 checksums +// ?man arguments: file ... +// ?man compute and check sha512/256 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sha512sum.c b/cmd/pseudo/sha512sum.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sha512sum: compute sha512 checksums -usage: sha512sum [-c] [file ...] -compute and check sha512 message digests -*/ #include <stdint.h> #include <stdio.h> @@ -27,6 +22,9 @@ usage(void) eprintf("usage: %s [-c] [file ...]\n", argv0); } +// ?man sha512sum: compute sha512 checksums +// ?man arguments: file ... +// ?man compute and check sha512 message digests int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/sponge.c b/cmd/pseudo/sponge.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -sponge: soak up input -usage: sponge file -soak up standard input and write to a file -*/ #include <fcntl.h> #include <stdlib.h> @@ -18,6 +13,9 @@ usage(void) eprintf("usage: %s file\n", argv0); } +// ?man sponge: soak up input +// ?man arguments: file +// ?man soak up standard input and write to a file int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/stat.c b/cmd/pseudo/stat.c @@ -1,9 +1,4 @@ -/* ?man -stat: display file status -usage: stat [-L] [-t] -display file or filesystem status information -*/ #include "config.h" #include "util.h" @@ -461,6 +456,8 @@ usage(void) " [file...]\n", argv0); } +// ?man stat: display file status +// ?man display file or filesystem status information int main(int argc, char *argv[]) { @@ -494,7 +491,7 @@ main(int argc, char *argv[]) break; #endif #if FEATURE_STAT_FORMAT - // ?man -c: print count or perform stdout action + // ?man -c:str: print count or perform stdout action case 'c': format = EARGF(usage()); break; diff --git a/cmd/pseudo/tar.c b/cmd/pseudo/tar.c @@ -1,10 +1,4 @@ -/* ?man -tar: tape archiver -usage: tar [x | t | -x | -t] [-C dir] [-J | -Z | -a | -j | -z] [-m] [-p] [-O] [-k] [-T file] [-X file] [--strip-components num] [-f file] [file ...] - tar [c | -c] [-C dir] [-J | -Z | -a | -j | -z] [-h] [-T file] [-X file] path ... [-f file] -manipulate tape archive files -*/ #include "config.h" #include "fs.h" @@ -806,6 +800,10 @@ usage(void) #endif } +// ?man tar: tape archiver +// ?man arguments: x | t | -x | -t] [file ... +// ?man tar [c | -c] [-C dir] [-J | -Z | -a | -j | -z] [-h] [-T file] [-X file] path ... [-f file] +// ?man manipulate tape archive files int main(int argc, char *argv[]) { @@ -836,11 +834,11 @@ main(int argc, char *argv[]) case 't': mode = ARGC(); break; - // ?man -C: specify option flag + // ?man -C:dir: specify option flag case 'C': dir = EARGF(usage()); break; - // ?man -f: specify archive file + // ?man -f:file: specify archive file case 'f': file = EARGF(usage()); break; @@ -887,19 +885,19 @@ main(int argc, char *argv[]) break; #endif #if FEATURE_TAR_FILES_FROM - // ?man -T file: read filenames from file + // ?man -T:file: -T file: read filenames from file case 'T': load_files_from_file(EARGF(usage())); break; #endif #if FEATURE_TAR_EXCLUDE_FROM - // ?man -X file: exclude patterns in file + // ?man -X:file: -X file: exclude patterns in file case 'X': load_excludes_from_file(EARGF(usage())); break; #endif #if FEATURE_TAR_STRIP_COMPONENTS - // ?man -strip-components num: strip num components + // ?man -s:num: -strip-components num: strip num components case 's': if (strcmp(argv[0], "strip-components") == 0) { argv[0] = "s"; @@ -913,6 +911,7 @@ main(int argc, char *argv[]) } break; #endif + // ?man --:num: specify - option case '-': #if FEATURE_TAR_EXCLUDE if (strncmp(argv[0], "-exclude=", 9) == 0) { diff --git a/cmd/pseudo/truncate.c b/cmd/pseudo/truncate.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -truncate: set file size -usage: truncate [-c] -s size file... -shrink or extend a file to a specified size -*/ #include <sys/stat.h> @@ -21,6 +16,9 @@ usage(void) eprintf("usage: %s [-c] -s size file...\n", argv0); } +// ?man truncate: set file size +// ?man arguments: -s size file... +// ?man shrink or extend a file to a specified size int main(int argc, char *argv[]) { @@ -29,7 +27,7 @@ main(int argc, char *argv[]) long size = 0; ARGBEGIN { - // ?man -s: silent mode or print summary + // ?man -s:num: silent mode or print summary case 's': sflag = 1; size = estrtol(EARGF(usage()), 10); diff --git a/cmd/pseudo/uptime.c b/cmd/pseudo/uptime.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -uptime: show system uptime -usage: uptime -display how long the system has been running and load averages -*/ #include <stdio.h> #include <stdlib.h> @@ -24,6 +19,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man uptime: show system uptime +// ?man display how long the system has been running and load averages int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/watch.c b/cmd/pseudo/watch.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -watch: execute periodically -usage: watch [-t] [-n interval] command -run a program periodically, showing output fullscreen -*/ #include <errno.h> #include <stdio.h> @@ -19,6 +14,9 @@ usage(void) eprintf("usage: %s [-t] [-n interval] command\n", argv0); } +// ?man watch: execute periodically +// ?man arguments: command +// ?man run a program periodically, showing output fullscreen int main(int argc, char *argv[]) { @@ -32,7 +30,7 @@ main(int argc, char *argv[]) // ?man -t: sort or specify timestamp case 't': break; - // ?man -n: print line numbers or counts + // ?man -n:str: print line numbers or counts case 'n': period = strtof(EARGF(usage()), &end); if (*end != '\0' || errno != 0) diff --git a/cmd/pseudo/which.c b/cmd/pseudo/which.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -which: locate a command -usage: which [-a] name ... -find the path of executable files in PATH -*/ #include <sys/stat.h> #include <sys/types.h> @@ -75,6 +70,9 @@ usage(void) eprintf("usage: %s [-a] name ...\n", argv0); } +// ?man which: locate a command +// ?man arguments: name ... +// ?man find the path of executable files in PATH int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/whoami.c b/cmd/pseudo/whoami.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -whoami: print effective user name -usage: whoami -display the effective user name of the current process -*/ #include <errno.h> #include <stdio.h> @@ -19,6 +14,8 @@ usage(void) eprintf("usage: %s\n", argv0); } +// ?man whoami: print effective user name +// ?man display the effective user name of the current process int main(int argc, char *argv[]) { diff --git a/cmd/pseudo/xinstall.c b/cmd/pseudo/xinstall.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -xinstall: copy files and set attributes -usage: xinstall [-g group] [-o owner] [-m mode] (-d dir ... | [-D] (-t dest source ... | source ... dest)) -copy files and set their permissions and ownership -*/ #include <grp.h> #include <pwd.h> @@ -89,6 +84,9 @@ usage(void) eprintf("usage: %s [-g group] [-o owner] [-m mode] (-d dir ... | [-D] (-t dest source ... | source ... dest))\n", argv0); } +// ?man xinstall: copy files and set attributes +// ?man arguments: (-d dir ... | (-t dest source ... | source ... dest)) +// ?man copy files and set their permissions and ownership int main(int argc, char *argv[]) { @@ -119,19 +117,19 @@ main(int argc, char *argv[]) case 's': /* no-op for compatibility */ break; - // ?man -g: specify option flag + // ?man -g:str: specify option flag case 'g': gflag = EARGF(usage()); break; - // ?man -o: specify output file + // ?man -o:str: specify output file case 'o': oflag = EARGF(usage()); break; - // ?man -m: specify mode or limit + // ?man -m:str: specify mode or limit case 'm': mflag = EARGF(usage()); break; - // ?man -t: sort or specify timestamp + // ?man -t:str: sort or specify timestamp case 't': tflag = EARGF(usage()); break; diff --git a/cmd/pseudo/yes.c b/cmd/pseudo/yes.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -yes: output string repeatedly -usage: yes [string] -output a string repeatedly until terminated -*/ #include <stdio.h> @@ -16,6 +11,9 @@ usage(void) eprintf("usage: %s [string]\n", argv0); } +// ?man yes: output string repeatedly +// ?man arguments: string +// ?man output a string repeatedly until terminated int main(int argc, char *argv[]) { diff --git a/cmd/xsi/mknod.c b/cmd/xsi/mknod.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -mknod: create special files -usage: mknod [-m mode] name b|c|u major minor -create block or character special files -*/ #include <sys/stat.h> #include <sys/types.h> @@ -28,6 +23,9 @@ usage(void) argv0, argv0); } +// ?man mknod: create special files +// ?man arguments: name b|c|u major minor +// ?man create block or character special files int main(int argc, char *argv[]) { @@ -35,8 +33,8 @@ main(int argc, char *argv[]) dev_t dev; ARGBEGIN { - // ?man -m: specify mode or limit - case 'm': +// ?man -m:mode: specify mode or limit +case 'm': mode = parsemode(EARGF(usage()), mode, umask(0)); break; default: diff --git a/cmd/xsi/passwd.c b/cmd/xsi/passwd.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -passwd: change user password -usage: passwd [username] -update a user authentication password -*/ #include <sys/ioctl.h> #include <sys/stat.h> @@ -163,6 +158,9 @@ usage(void) eprintf("usage: %s [username]\n", argv0); } +// ?man passwd: change user password +// ?man arguments: username +// ?man update a user authentication password int main(int argc, char *argv[]) { diff --git a/cmd/xsi/su.c b/cmd/xsi/su.c @@ -1,10 +1,5 @@ /* See LICENSE file for copyright and license details. */ -/* ?man -su: run command with substitute user id -usage: su [-lp] [username] -run a shell or command with another user id -*/ #include <sys/types.h> @@ -30,6 +25,9 @@ usage(void) eprintf("usage: %s [-lp] [username]\n", argv0); } +// ?man su: run command with substitute user id +// ?man arguments: username +// ?man run a shell or command with another user id int main(int argc, char *argv[]) {