From fb74e7bef036d266b34fc93621d6889bfa31b61d Mon Sep 17 00:00:00 2001 From: DTB Date: Wed, 26 Jun 2024 13:45:36 -0600 Subject: [PATCH] dj(1), dj.1: Remove -A (use -a "\0") (see #101) --- docs/dj.1 | 10 +++------- src/dj.c | 7 +++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/dj.1 b/docs/dj.1 index 5de56eb..1494827 100644 --- a/docs/dj.1 +++ b/docs/dj.1 @@ -11,7 +11,7 @@ dj \(en disk jockey .SH SYNOPSIS dj -.RB ( -AHn ) +.RB ( -Hn ) .RB ( -a .RB [ byte ]) .RB ( -c @@ -67,12 +67,8 @@ 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 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 -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. +of an incomplete read from the input file. If the option argument is empty, the +null byte is used. .IP \fB-c\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. diff --git a/src/dj.c b/src/dj.c index af842a4..b45513e 100644 --- a/src/dj.c +++ b/src/dj.c @@ -265,7 +265,7 @@ parse(char *s){ static int usage(void){ - fprintf(stderr, "Usage: %s (-AHn) (-a [byte]) (-c [count])\n" + fprintf(stderr, "Usage: %s (-Hn) (-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); @@ -294,7 +294,7 @@ int main(int argc, char *argv[]){ if(argc > 0){ program_name = argv[0]; - while((c = getopt(argc, argv, "a:Ab:B:c:i:hHns:S:o:")) != -1) + while((c = getopt(argc, argv, "a:b:B:c:i:hHns:S:o:")) != -1) switch(c){ case 'i': case 'o': i = (c == 'o'); @@ -306,11 +306,10 @@ int main(int argc, char *argv[]){ break; terminate(io); return oserr(optarg); - case 'A': align = '\0'; break; case 'n': noerror = 1; break; case 'H': fmt_output = fmt_human; break; case 'a': - if(optarg[0] != '\0' && optarg[1] == '\0'){ + if(optarg[0] == '\0' || optarg[1] == '\0'){ align = optarg[0]; break; }