diff --git a/docs/dj.1 b/docs/dj.1 index 7d28ac8..5de56eb 100644 --- a/docs/dj.1 +++ b/docs/dj.1 @@ -11,7 +11,7 @@ dj \(en disk jockey .SH SYNOPSIS dj -.RB ( -AdHnq ) +.RB ( -AHn ) .RB ( -a .RB [ byte ]) .RB ( -c @@ -76,18 +76,11 @@ with a null byte instead of a character. .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. -.IP \fB-d\fP -Prints invocation information before program execution as described in the -DIAGNOSTICS section. Each invocation increments the debug level of the -program. .IP \fB-H\fP Prints diagnostics messages in a human-readable manner as described in the DIAGNOSTICS section. .IP \fB-n\fP Retries failed reads once before exiting. -.IP \fB-q\fP -Suppresses error messages which print when a read or write is partial or -empty. Each invocation decrements the debug level of the program. .\" .SH STANDARD INPUT @@ -100,10 +93,8 @@ one or more of the input files is \(lq-\(rq. .\" .SH DIAGNOSTICS -On a partial or empty read, unless the -.B -q -option is specified, a diagnostic message is printed. Then, the program exits -unless the +On a partial or empty read a diagnostic message is printed. Then, the program +exits unless the .B -n option is specified. @@ -128,20 +119,6 @@ option may be specified. In this event, the following format is used instead: {ASCII line feed} .RE -If the -.B -d -option is specified, debug information will be printed at the beginning of -execution. This output contains information regarding how the program was -invoked. The following example is the result of running the program with -.B -d -as the only argument: - -.RS -argv0=dj -in= ibs=1024 skip=0 align=ff count=0 -out= obs=1024 seek=0 debug= 3 noerror=0 -.RE - In non-recoverable errors that don\(cqt pertain to the read-write cycle, a diagnostic message is printed and the program exits with the appropriate .BR sysexits.h (3) diff --git a/src/dj.c b/src/dj.c index 8a6732c..27c160a 100644 --- a/src/dj.c +++ b/src/dj.c @@ -59,14 +59,6 @@ struct Io{ /* pointer to chosen formatting */ /* (-H) */ static char *fmt_output; /* fmt_asv (default) or fmt_human (-H) */ -/* (-dq) */ static char debug; /* - * -d increments dj -qq | 0 - no diagnostic output whatsoever - * -q decrements dj -q | 1 - typical output without - * | notifications on partial reads or - * | writes - * dj | 2 - typical output (default) - * dj -d | 3 - verbose status messages */ - /* (-n) */ static char noerror; /* 0 - exits on partial reads or writes * (default) * 1 - retries on partial reads/writes @@ -84,7 +76,6 @@ static int write_flags = O_WRONLY | O_CREAT; /* dd(1). */ #define setdefaults do{ \ align = -1; \ count = 0; \ - debug = 2; \ fmt_output = fmt_asv; \ noerror = 0; \ ep[0].fl = read_flags; \ @@ -284,14 +275,13 @@ oserr(char *s){ } /* Prints statistics regarding the use of dj, particularly partially and - * completely read and written records, accessing debug, ep, and fmt_output. */ + * completely read and written records, accessing ep and fmt_output. */ static void output(void){ - if(debug >= 1) - fprintf(stderr, fmt_output, - ep[0].rec, ep[0].prec, ep[1].rec, ep[1].prec, - ep[0].bytes, ep[1].bytes); + fprintf(stderr, fmt_output, + ep[0].rec, ep[0].prec, ep[1].rec, ep[1].prec, + ep[0].bytes, ep[1].bytes); return; } @@ -342,10 +332,8 @@ int main(int argc, char *argv[]){ terminate(ep); return oserr(optarg); case 'A': align = '\0'; break; - case 'd': ++debug; break; case 'n': noerror = 1; break; case 'H': fmt_output = fmt_human; break; - case 'q': --debug; break; case 'a': if(optarg[0] != '\0' && optarg[1] == '\0'){ align = optarg[0]; @@ -367,15 +355,6 @@ int main(int argc, char *argv[]){ } } - if(debug >= 3) - fprintf(stderr, - "argv0=%s\n" - "in=%s\tibs=%d\tskip=%ld\talign=%hhx\tcount=%d\n" - "out=%s\tobs=%d\tseek=%ld\tdebug=%2d\tnoerror=%d\n", - program_name, - ep[0].fn, ep[0].bs, ep[0].seek, align, count, - ep[1].fn, ep[1].bs, ep[1].seek, debug, noerror); - if(argc > optind){ terminate(ep); return usage(); @@ -404,10 +383,8 @@ int main(int argc, char *argv[]){ break; else if(ep[0].bufuse < ep[0].bs){ ++ep[0].prec; - if(debug >= 2){ - fprintf(stderr, "%s: Partial read:\n\t", program_name); - output(); - } + fprintf(stderr, "%s: Partial read:\n\t", program_name); + output(); if(!noerror) count = 1; if(align >= 0) @@ -432,10 +409,8 @@ int main(int argc, char *argv[]){ break; }else if(c > ep[1].bufuse && ep[1].bufuse > 0){ ep[1].prec += 1; - if(debug >= 2){ - fprintf(stderr, "%s: Partial write:\n\t", program_name); - output(); - } + fprintf(stderr, "%s: Partial write:\n\t", program_name); + output(); if(!noerror) count = 1; }else if(ep[1].bufuse == 0 && c < ep[1].bs)