Merge branch 'usage-text'

This commit is contained in:
Emma Tebibyte 2024-06-29 17:20:19 -06:00
commit 881df1bb18
Signed by: emma
GPG Key ID: 06FA419A1698C270
17 changed files with 45 additions and 63 deletions

View File

@ -11,25 +11,17 @@ dj \(en disk jockey
.SH SYNOPSIS .SH SYNOPSIS
dj dj
.RB ( -AdHnq ) .RB [ -AdHnq ]
.RB ( -a .RB [ -a\ byte ]
.RB [ byte ]) .RB [ -c\ count ]
.RB ( -c
.RB [ count ])
.RB ( -i .RB [ -i\ file ]
[\fBinput file\fP]) .RB [ -b\ block_size ]
.RB ( -b .RB [ -s\ offset ]
[\fBinput block size\fP])
.RB ( -s
[\fBinput offset\fP])
.RB ( -o .RB [ -o\ file ]
[\fBoutput file\fP]) .RB [ -B\ block_size ]
.RB ( -B .RB [ -S\ offset ]
[\fBoutput block size\fP])
.RB ( -S
[\fBoutput offset\fP])
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION
@ -47,25 +39,25 @@ immediately subsequent to the specified byte.
.\" .\"
.SH OPTIONS .SH OPTIONS
.IP \fB-i\fP .IP \fB-i\fP\ \fIfile\fP
Takes a file path as an argument and opens it for use as an input. Takes a file path as an argument and opens it for use as an input.
.IP \fB-b\fP .IP \fB-b\fP\ \fIblock_size\fP
Takes a numeric argument as the size in bytes of the input buffer, the default Takes a numeric argument as the size in bytes of the input buffer, the default
being 1024. being 1024.
.IP \fB-s\fP .IP \fB-s\fP\ \fIoffset\fP
Takes a numeric argument as the number of bytes to skip into the input Takes a numeric argument as the number of bytes to skip into the input
before starting to read. If the standard input is used, bytes read to this point before starting to read. If the standard input is used, bytes read to this point
are discarded. are discarded.
.IP \fB-o\fP .IP \fB-o\fP\ \fIfile\fP
Takes a file path as an argument and opens it for use as an output. Takes a file path as an argument and opens it for use as an output.
.IP \fB-B\fP .IP \fB-B\fP\ \fIblock_size\fP
Does the same as Does the same as
.B -b .B -b
but for the output buffer. but for the output buffer.
.IP \fB-S\fP .IP \fB-S\fP\ \fIoffset\fP
Seeks a number of bytes through the output before starting to write from Seeks a number of bytes through the output before starting to write from
the input. If the output is a stream, null characters are printed. the input. If the output is a stream, null characters are printed.
.IP \fB-a\fP .IP \fB-a\fP\ \fIbyte\fP
Accepts a single literal byte with which the input buffer is padded in the event Accepts a single literal byte with which the input buffer is padded in the event
of an incomplete read from the input file. of an incomplete read from the input file.
.IP \fB-A\fP .IP \fB-A\fP
@ -73,7 +65,7 @@ Specifying this option pads the input buffer with null bytes in the event of an
incomplete read. This is equivalent to specifying incomplete read. This is equivalent to specifying
.B -a .B -a
with a null byte instead of a character. with a null byte instead of a character.
.IP \fB-c\fP .IP \fB-c\fP\ \fIcount\fP
Specifies a number of reads to make. The default is 0, in which case the Specifies a number of reads to make. The default is 0, in which case the
input is read until a partial or empty read is made. input is read until a partial or empty read is made.
.IP \fB-d\fP .IP \fB-d\fP

View File

@ -22,7 +22,7 @@ Performs operations on specified fields in data read from the standard input.
.\" .\"
.SH OPTIONS .SH OPTIONS
.IP \fB-d\fP .IP \fB-d\fP\ \fIdelimiter\fP
Sets a delimiter by which the input data will be split into fields. The default Sets a delimiter by which the input data will be split into fields. The default
is an ASCII record separator. is an ASCII record separator.
.\" .\"

View File

@ -11,9 +11,7 @@ intcmp \(en compare integers
.SH SYNOPSIS .SH SYNOPSIS
intcmp intcmp
.RB ( -egl ) .RB [ -egl ]\ integer\ integer...
.RB [ integer ]
.RB [ integer... ]
.SH DESCRIPTION .SH DESCRIPTION
Compare integers to each other. Compare integers to each other.
.\" .\"

View File

@ -10,11 +10,9 @@ mm \(en middleman
.SH SYNOPSIS .SH SYNOPSIS
mm mm
.RB ( -aenu ) .RB [ -aenu ]
.RB ( -i .RB [ -i\ input ]
.RB [ input ]) .RB [ -o\ output ]
.RB ( -o
.RB [ output ])
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION
@ -26,10 +24,10 @@ Catenate input files and write them to the start of each output file or stream.
Opens subsequent outputs for appending rather than updating. Opens subsequent outputs for appending rather than updating.
.IP \fB-e\fP .IP \fB-e\fP
Use the standard error as an output. Use the standard error as an output.
.IP \fB-i\fP .IP \fB-i\fP\ \fIinput\fP
Opens a path as an input. If one or more of the input files is \(lq-\(rq or if Opens a path as an input. If one or more of the input files is \(lq-\(rq or if
no inputs are specified, the standard input shall be used. no inputs are specified, the standard input shall be used.
.IP \fB-o\fP .IP \fB-o\fP\ \fIoutput\fP
Opens a path as an output. If one or more of the output files is \(lq-\(rq or if Opens a path as an output. If one or more of the output files is \(lq-\(rq or if
no outputs are specified, the standard output shall be used. no outputs are specified, the standard output shall be used.
.IP \fB-u\fP .IP \fB-u\fP

View File

@ -11,7 +11,7 @@ npc \(en show non-printing characters
.SH SYNOPSIS .SH SYNOPSIS
npc npc
.RB ( -et ) .RB [ -et ]
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -10,8 +10,8 @@ scrut \(en scrutinize file properties
.SH SYNOPSIS .SH SYNOPSIS
scrut scrut
.RB ( -LSbcdefgkprsuwx ) .RB [ -LSbcdefgkprsuwx ]
.RB [ file... ] .B file...
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -11,8 +11,7 @@ str \(en test string arguments
.SH SYNOPSIS .SH SYNOPSIS
str str
.RB [ type ] .B type string...
.RB [ string... ]
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -11,8 +11,7 @@ strcmp \(en compare strings
.SH SYNOPSIS .SH SYNOPSIS
strcmp strcmp
.RM [ string ] .B string string...
.RB [ strings... ]
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -11,11 +11,8 @@ swab \(en swap bytes
.SH SYNOPSIS .SH SYNOPSIS
swab swab
.RB ( -f ) .RB [ -f ]
.RB ( -w .RB [ -w\ word_size ]
.R [
.B word size
.R ])
.\" .\"
.SH DESCRIPTION .SH DESCRIPTION
@ -25,11 +22,10 @@ Swap the latter and former halves of a block of bytes.
.IP \fB-f\fP .IP \fB-f\fP
Ignore SIGINT signal. Ignore SIGINT signal.
.IP \fB-w\fP .IP \fB-w\fP\ \fIword_size\fP
Configures the word size; that is, the size in bytes of the block size Configures the word size; that is, the size in bytes of the block size on which
on which to operate. The default word size is 2. The word size must be to operate. The default word size is 2. The word size must be cleanly divisible
cleanly divisible by 2, otherwise the block of bytes being processed can\(cqt be by 2, otherwise the block of bytes being processed can\(cqt be halved.
halved.
.\" .\"
.SH EXAMPLES .SH EXAMPLES

View File

@ -313,9 +313,9 @@ parse(char *s){
static int static int
usage(void){ usage(void){
fprintf(stderr, "Usage: %s (-AdfHqQ) (-a [byte]) (-c [count])\n" fprintf(stderr, "Usage: %s [-AdfHqQ] [-a byte] [-c count]\n"
"\t(-i [input file]) (-b [input block size]) (-s [input offset])\n" "\t[-i file] [-b block_size] [-s offset]\n"
"\t(-o [output file]) (-B [output block size]) (-S [output offset])\n", "\t[-o file] [-B block_size] [-S offset]\n",
program_name); program_name);
return EX_USAGE; return EX_USAGE;

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[]){
if(optind + 2 /* ref cmp */ > argc){ if(optind + 2 /* ref cmp */ > argc){
usage: fprintf(stderr, usage: fprintf(stderr,
"Usage: %s (-eghl) [integer] [integer...]\n", "Usage: %s [-egl] integer integer...\n",
argv[0] == NULL ? program_name : argv[0]); argv[0] == NULL ? program_name : argv[0]);
return EX_USAGE; return EX_USAGE;
} }

View File

@ -110,7 +110,7 @@ oserr(char *s, char *r){
* returns an exit status appropriate for a usage error. */ * returns an exit status appropriate for a usage error. */
int usage(char *s){ int usage(char *s){
fprintf(stderr, "Usage: %s (-aenu) (-i [input])... (-o [output])...\n", s); fprintf(stderr, "Usage: %s [-aenu] [-i input]... [-o output]...\n", s);
return EX_USAGE; return EX_USAGE;
} }

View File

@ -39,7 +39,7 @@ int main(int argc, char *argv[]){
} }
if(argc > optind){ if(argc > optind){
usage: fprintf(stderr, "Usage: %s (-eht)\n", argv[0]); usage: fprintf(stderr, "Usage: %s [-et]\n", argv[0]);
return EX_USAGE; return EX_USAGE;
} }

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[]){
if(ops[i] == 'e') if(ops[i] == 'e')
continue; continue;
else if(ops[i] == 'h'){ else if(ops[i] == 'h'){
usage: fprintf(stderr, "Usage: %s (-%s) [file...]\n", usage: fprintf(stderr, "Usage: %s [-%s] file...\n",
argv[0] == NULL argv[0] == NULL
? program_name ? program_name
: argv[0], : argv[0],

View File

@ -56,7 +56,7 @@ int main(int argc, char *argv[]){
goto pass; goto pass;
} }
fprintf(stderr, "Usage: %s [type] [string...]\n", fprintf(stderr, "Usage: %s type string...\n",
argv[0] == NULL ? program_name : argv[0]); argv[0] == NULL ? program_name : argv[0]);
return EX_USAGE; return EX_USAGE;

View File

@ -8,7 +8,7 @@ int main(int argc, char *argv[]){
int i; int i;
if(argc < 3){ if(argc < 3){
fprintf(stderr, "Usage: %s [string] [string...]\n", fprintf(stderr, "Usage: %s string string...\n",
argv[0] == NULL ? program_name : argv[0]); argv[0] == NULL ? program_name : argv[0]);
return EX_USAGE; return EX_USAGE;
} }

View File

@ -35,7 +35,7 @@ fn oserr(s: &str, e: Error) -> ExitCode {
} }
fn usage(s: &str) -> ExitCode { fn usage(s: &str) -> ExitCode {
eprintln!("Usage: {} (-f) (-w [wordsize])", s); eprintln!("Usage: {} [-f] [-w word_size]", s);
ExitCode::from(EX_USAGE as u8) ExitCode::from(EX_USAGE as u8)
} }