From e341c38cd63941e65ee32a91c9c9c653d4b761fb Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 29 Jun 2024 05:18:20 -0600 Subject: [PATCH 1/3] docs, src: updates usage text for utilities --- docs/dj.1 | 26 +++++++++----------------- docs/intcmp.1 | 4 +--- docs/mm.1 | 8 +++----- docs/npc.1 | 2 +- docs/scrut.1 | 4 ++-- docs/str.1 | 3 +-- docs/strcmp.1 | 3 +-- docs/swab.1 | 14 +++++--------- src/dj.c | 6 +++--- src/intcmp.c | 2 +- src/mm.c | 2 +- src/npc.c | 2 +- src/scrut.c | 2 +- src/str.c | 2 +- src/strcmp.c | 2 +- src/swab.rs | 2 +- 16 files changed, 33 insertions(+), 51 deletions(-) diff --git a/docs/dj.1 b/docs/dj.1 index 7031ccf..4b0b5b1 100644 --- a/docs/dj.1 +++ b/docs/dj.1 @@ -11,25 +11,17 @@ dj \(en disk jockey .SH SYNOPSIS dj -.RB ( -AdHnq ) -.RB ( -a -.RB [ byte ]) -.RB ( -c -.RB [ count ]) +.RB [ -AdHnq ] +.RB [ -a\ byte ] +.RB [ -c\ count ] -.RB ( -i -[\fBinput file\fP]) -.RB ( -b -[\fBinput block size\fP]) -.RB ( -s -[\fBinput offset\fP]) +.RB [ -i\ input_file ] +.RB [ -b\ input_block_size ] +.RB [ -s\ input_offset ] -.RB ( -o -[\fBoutput file\fP]) -.RB ( -B -[\fBoutput block size\fP]) -.RB ( -S -[\fBoutput offset\fP]) +.RB [ -o\ output_file ] +.RB [ -B\ output_block_size ] +.RB [ -S\ output_offset ] .\" .SH DESCRIPTION diff --git a/docs/intcmp.1 b/docs/intcmp.1 index 034a4fd..b90f23a 100644 --- a/docs/intcmp.1 +++ b/docs/intcmp.1 @@ -11,9 +11,7 @@ intcmp \(en compare integers .SH SYNOPSIS intcmp -.RB ( -egl ) -.RB [ integer ] -.RB [ integer... ] +.RB [ -egl ]\ integer\ integer... .SH DESCRIPTION Compare integers to each other. .\" diff --git a/docs/mm.1 b/docs/mm.1 index 2ff9f44..735f9df 100644 --- a/docs/mm.1 +++ b/docs/mm.1 @@ -10,11 +10,9 @@ mm \(en middleman .SH SYNOPSIS mm -.RB ( -aenu ) -.RB ( -i -.RB [ input ]) -.RB ( -o -.RB [ output ]) +.RB [ -aenu ] +.RB [ -i\ input ] +.RB [ -o\ output ] .\" .SH DESCRIPTION diff --git a/docs/npc.1 b/docs/npc.1 index 3e7af39..5acee9e 100644 --- a/docs/npc.1 +++ b/docs/npc.1 @@ -11,7 +11,7 @@ npc \(en show non-printing characters .SH SYNOPSIS npc -.RB ( -et ) +.RB [ -et ] .\" .SH DESCRIPTION diff --git a/docs/scrut.1 b/docs/scrut.1 index 56383b8..2b95bee 100644 --- a/docs/scrut.1 +++ b/docs/scrut.1 @@ -10,8 +10,8 @@ scrut \(en scrutinize file properties .SH SYNOPSIS scrut -.RB ( -LSbcdefgkprsuwx ) -.RB [ file... ] +.RB [ -LSbcdefgkprsuwx ] +.B file... .\" .SH DESCRIPTION diff --git a/docs/str.1 b/docs/str.1 index 22ffea1..1a4d8e4 100644 --- a/docs/str.1 +++ b/docs/str.1 @@ -11,8 +11,7 @@ str \(en test string arguments .SH SYNOPSIS str -.RB [ type ] -.RB [ string... ] +.B type string... .\" .SH DESCRIPTION diff --git a/docs/strcmp.1 b/docs/strcmp.1 index 0ad21b2..c99c8c8 100644 --- a/docs/strcmp.1 +++ b/docs/strcmp.1 @@ -11,8 +11,7 @@ strcmp \(en compare strings .SH SYNOPSIS strcmp -.RM [ string ] -.RB [ strings... ] +.B string string... .\" .SH DESCRIPTION diff --git a/docs/swab.1 b/docs/swab.1 index 72f0f19..e589c10 100644 --- a/docs/swab.1 +++ b/docs/swab.1 @@ -11,11 +11,8 @@ swab \(en swap bytes .SH SYNOPSIS swab -.RB ( -f ) -.RB ( -w -.R [ -.B word size -.R ]) +.RB [ -f ] +.RB [ -w\ word_size ] .\" .SH DESCRIPTION @@ -26,10 +23,9 @@ Swap the latter and former halves of a block of bytes. .IP \fB-f\fP Ignore SIGINT signal. .IP \fB-w\fP -Configures the word size; that is, the size in bytes of the block size -on which to operate. The default word size is 2. The word size must be -cleanly divisible by 2, otherwise the block of bytes being processed can\(cqt be -halved. +Configures the word size; that is, the size in bytes of the block size on which +to operate. The default word size is 2. The word size must be cleanly divisible +by 2, otherwise the block of bytes being processed can\(cqt be halved. .\" .SH EXAMPLES diff --git a/src/dj.c b/src/dj.c index 8a6732c..3885012 100644 --- a/src/dj.c +++ b/src/dj.c @@ -313,9 +313,9 @@ parse(char *s){ static int usage(void){ - fprintf(stderr, "Usage: %s (-AdfHqQ) (-a [byte]) (-c [count])\n" - "\t(-i [input file]) (-b [input block size]) (-s [input offset])\n" - "\t(-o [output file]) (-B [output block size]) (-S [output offset])\n", + fprintf(stderr, "Usage: %s [-AdfHqQ] [-a byte] [-c count]\n" + "\t[-i input_file] [-b input_block_size] [-s input_offset]\n" + "\t[-o output_file] [-B output_block_size] [-S output_offset]\n", program_name); return EX_USAGE; diff --git a/src/intcmp.c b/src/intcmp.c index 408474b..1fd278d 100644 --- a/src/intcmp.c +++ b/src/intcmp.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]){ if(optind + 2 /* ref cmp */ > argc){ usage: fprintf(stderr, - "Usage: %s (-eghl) [integer] [integer...]\n", + "Usage: %s [-eghl] integer integer...\n", argv[0] == NULL ? program_name : argv[0]); return EX_USAGE; } diff --git a/src/mm.c b/src/mm.c index dc337b7..e905b35 100644 --- a/src/mm.c +++ b/src/mm.c @@ -110,7 +110,7 @@ oserr(char *s, char *r){ * returns an exit status appropriate for a usage error. */ 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; } diff --git a/src/npc.c b/src/npc.c index 8b97180..6b5e5f0 100644 --- a/src/npc.c +++ b/src/npc.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]){ } if(argc > optind){ -usage: fprintf(stderr, "Usage: %s (-eht)\n", argv[0]); +usage: fprintf(stderr, "Usage: %s [-eht]\n", argv[0]); return EX_USAGE; } diff --git a/src/scrut.c b/src/scrut.c index c5b675f..d85d243 100644 --- a/src/scrut.c +++ b/src/scrut.c @@ -66,7 +66,7 @@ int main(int argc, char *argv[]){ if(ops[i] == 'e') continue; else if(ops[i] == 'h'){ -usage: fprintf(stderr, "Usage: %s (-%s) [file...]\n", +usage: fprintf(stderr, "Usage: %s [-%s] file...\n", argv[0] == NULL ? program_name : argv[0], diff --git a/src/str.c b/src/str.c index ae03b1d..b4725eb 100644 --- a/src/str.c +++ b/src/str.c @@ -56,7 +56,7 @@ int main(int argc, char *argv[]){ goto pass; } - fprintf(stderr, "Usage: %s [type] [string...]\n", + fprintf(stderr, "Usage: %s type string...\n", argv[0] == NULL ? program_name : argv[0]); return EX_USAGE; diff --git a/src/strcmp.c b/src/strcmp.c index acb4946..33b73c2 100644 --- a/src/strcmp.c +++ b/src/strcmp.c @@ -8,7 +8,7 @@ int main(int argc, char *argv[]){ int i; if(argc < 3){ - fprintf(stderr, "Usage: %s [string] [string...]\n", + fprintf(stderr, "Usage: %s string string...\n", argv[0] == NULL ? program_name : argv[0]); return EX_USAGE; } diff --git a/src/swab.rs b/src/swab.rs index ca944d9..471f92b 100644 --- a/src/swab.rs +++ b/src/swab.rs @@ -35,7 +35,7 @@ fn oserr(s: &str, e: Error) -> 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) } From 07a12ba81c29e06775eb129a187a4db358cac4a2 Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 29 Jun 2024 05:28:23 -0600 Subject: [PATCH 2/3] docs, src: fixing man page and usage text readability --- docs/dj.1 | 28 ++++++++++++++-------------- docs/fop.1 | 2 +- docs/mm.1 | 4 ++-- docs/swab.1 | 2 +- src/dj.c | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/dj.1 b/docs/dj.1 index 4b0b5b1..43c2750 100644 --- a/docs/dj.1 +++ b/docs/dj.1 @@ -15,13 +15,13 @@ dj .RB [ -a\ byte ] .RB [ -c\ count ] -.RB [ -i\ input_file ] -.RB [ -b\ input_block_size ] -.RB [ -s\ input_offset ] +.RB [ -i\ file ] +.RB [ -b\ block_size ] +.RB [ -s\ offset ] -.RB [ -o\ output_file ] -.RB [ -B\ output_block_size ] -.RB [ -S\ output_offset ] +.RB [ -o\ file ] +.RB [ -B\ block_size ] +.RB [ -S\ offset ] .\" .SH DESCRIPTION @@ -39,25 +39,25 @@ immediately subsequent to the specified byte. .\" .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. -.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 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 before starting to read. If the standard input is used, bytes read to this point 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. -.IP \fB-B\fP +.IP \fB-B\fP\ \fIblock_size\fP Does the same as .B -b 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 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 of an incomplete read from the input file. .IP \fB-A\fP @@ -65,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 .B -a 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 input is read until a partial or empty read is made. .IP \fB-d\fP diff --git a/docs/fop.1 b/docs/fop.1 index d777c68..b96033a 100644 --- a/docs/fop.1 +++ b/docs/fop.1 @@ -22,7 +22,7 @@ Performs operations on specified fields in data read from the standard input. .\" .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 is an ASCII record separator. .\" diff --git a/docs/mm.1 b/docs/mm.1 index 735f9df..2916aa7 100644 --- a/docs/mm.1 +++ b/docs/mm.1 @@ -24,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. .IP \fB-e\fP 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 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 no outputs are specified, the standard output shall be used. .IP \fB-u\fP diff --git a/docs/swab.1 b/docs/swab.1 index e589c10..42eef95 100644 --- a/docs/swab.1 +++ b/docs/swab.1 @@ -22,7 +22,7 @@ Swap the latter and former halves of a block of bytes. .IP \fB-f\fP 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 on which to operate. The default word size is 2. The word size must be cleanly divisible by 2, otherwise the block of bytes being processed can\(cqt be halved. diff --git a/src/dj.c b/src/dj.c index 3885012..beafde8 100644 --- a/src/dj.c +++ b/src/dj.c @@ -314,8 +314,8 @@ static int usage(void){ fprintf(stderr, "Usage: %s [-AdfHqQ] [-a byte] [-c count]\n" - "\t[-i input_file] [-b input_block_size] [-s input_offset]\n" - "\t[-o output_file] [-B output_block_size] [-S output_offset]\n", + "\t[-i file] [-b block_size] [-s offset]\n" + "\t[-o file] [-B block_size] [-S offset]\n", program_name); return EX_USAGE; From 17455baeab063443a69d1e73848465ebdc25d254 Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 29 Jun 2024 06:38:55 -0600 Subject: [PATCH 3/3] intcmp(1), npc(1): removes vestigial option --- src/intcmp.c | 2 +- src/npc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intcmp.c b/src/intcmp.c index 1fd278d..d6dff0d 100644 --- a/src/intcmp.c +++ b/src/intcmp.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]){ if(optind + 2 /* ref cmp */ > argc){ usage: fprintf(stderr, - "Usage: %s [-eghl] integer integer...\n", + "Usage: %s [-egl] integer integer...\n", argv[0] == NULL ? program_name : argv[0]); return EX_USAGE; } diff --git a/src/npc.c b/src/npc.c index 6b5e5f0..1f96668 100644 --- a/src/npc.c +++ b/src/npc.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]){ } if(argc > optind){ -usage: fprintf(stderr, "Usage: %s [-eht]\n", argv[0]); +usage: fprintf(stderr, "Usage: %s [-et]\n", argv[0]); return EX_USAGE; }