1
0
forked from bonsai/harakit

dj(1), dj.1: remove the unnecessary -d and -q

This commit is contained in:
dtb
2024-06-26 11:36:52 -06:00
parent 4b3333d8d3
commit d3f5246242
2 changed files with 11 additions and 59 deletions

View File

@@ -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)