1
0

fix synopses

This commit is contained in:
dtb 2023-12-16 08:20:57 -07:00
parent 16d642aff6
commit 3fb84937bd
2 changed files with 9 additions and 4 deletions

View File

@ -7,7 +7,7 @@ peek \(en read from standard input, furtively
.SH SYNOPSIS .SH SYNOPSIS
peek peek
.RB ( -1eno ) .RB ( -1enot )
.RB ( -p .RB ( -p
.RB [ program .RB [ program
.RB [ arguments... ]]) .RB [ arguments... ]])

View File

@ -47,9 +47,14 @@ int main(int argc, char *argv[]){
default: goto usage; default: goto usage;
} }
if((argc > optind && outputs[2] == 0) /* If -p is used there must be additional arguments. This is to support
|| (!(argc > optind) && outputs[2] != 0)){ * arbitrary arguments to the command specified but has the side-effect
usage: fprintf(stderr, "Usage: %s (-1eno)" * of being inconsistent with other programs in that the usage
* 'peek -p1n cat' would work, where usually the 'cat' program would
* have to be specified immediately after -p as in 'peek -1np cat'.
* This is fine, though, because all intended usages work fine. */
if((argc > optind) == (outputs[2] == 0)){
usage: fprintf(stderr, "Usage: %s (-1enot)"
" (-p [program [arguments...]])\n", " (-p [program [arguments...]])\n",
argv[0] == NULL ? program_name : argv[0]); argv[0] == NULL ? program_name : argv[0]);
return EX_USAGE; return EX_USAGE;