Skip to content

Commit 0d120ef

Browse files
committed
do not bother with different exit codes
1 parent b710ade commit 0d120ef

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

main.c

100644100755
+11-21
Original file line numberDiff line numberDiff line change
@@ -424,27 +424,17 @@ static void printhelp(FILE *out,const char *progname)
424424
fflush(out);
425425
}
426426

427-
enum {
428-
Q_ADDITIONAL = 101,
429-
Q_UNRECOGNISED,
430-
Q_NOSTATISTICS,
431-
Q_FAILOPENOUTPUT,
432-
Q_FAILTHREAD,
433-
Q_FAILTIME,
434-
Q_FAILOPENINPUT,
435-
} ;
436-
437427
static void e_additional()
438428
{
439429
fprintf(stderr,"additional argument required\n");
440-
exit(Q_ADDITIONAL);
430+
exit(1);
441431
}
442432

443433
#ifndef STATISTICS
444434
static void e_nostatistics()
445435
{
446436
fprintf(stderr,"statistics support not compiled in\n");
447-
exit(Q_NOSTATISTICS);
437+
exit(1);
448438
}
449439
#endif
450440

@@ -526,7 +516,7 @@ int main(int argc,char **argv)
526516
if (*arg == '-') {
527517
if (numargit > 1) {
528518
fprintf(stderr,"unrecognised argument: -\n");
529-
exit(Q_UNRECOGNISED);
519+
exit(1);
530520
}
531521
++arg;
532522
if (!*arg)
@@ -537,7 +527,7 @@ int main(int argc,char **argv)
537527
}
538528
else {
539529
fprintf(stderr,"unrecognised argument: --%s\n",arg);
540-
exit(Q_UNRECOGNISED);
530+
exit(1);
541531
}
542532
numargit = 0;
543533
}
@@ -644,14 +634,14 @@ int main(int argc,char **argv)
644634
hostname = 0;
645635
if (hostname && strlen(hostname) != ONION_LEN) {
646636
fprintf(stderr,"bad onion argument length\n");
647-
exit(Q_UNRECOGNISED);
637+
exit(1);
648638
}
649639
}
650640
}
651641
}
652642
else {
653643
fprintf(stderr,"unrecognised argument: -%c\n",*arg);
654-
exit(Q_UNRECOGNISED);
644+
exit(1);
655645
}
656646
if (numargit)
657647
goto nextarg;
@@ -664,13 +654,13 @@ int main(int argc,char **argv)
664654
fout = fopen(outfile,!outfileoverwrite ? "a" : "w");
665655
if (!fout) {
666656
perror("failed to open output file");
667-
exit(Q_FAILOPENOUTPUT);
657+
exit(1);
668658
}
669659
}
670660

671661
if (!fout && yamloutput) {
672662
fprintf(stderr,"nil output with yaml mode does not make sense\n");
673-
exit(Q_FAILOPENOUTPUT); // define new err code?
663+
exit(1);
674664
}
675665

676666
if (workdir)
@@ -694,7 +684,7 @@ int main(int argc,char **argv)
694684
fin = fopen(infile,"r");
695685
if (!fin) {
696686
fprintf(stderr,"failed to open input file\n");
697-
return Q_FAILOPENINPUT;
687+
return 1;
698688
}
699689
}
700690
tret = yamlin_parseandcreate(fin,sname,hostname);
@@ -775,7 +765,7 @@ int main(int argc,char **argv)
775765
tret = pthread_create(&VEC_BUF(threads,i),tattrp,fastkeygen ? dofastwork : dowork,tp);
776766
if (tret) {
777767
fprintf(stderr,"error while making " FSZ "th thread: %s\n",i,strerror(tret));
778-
exit(Q_FAILTHREAD);
768+
exit(1);
779769
}
780770
}
781771

@@ -790,7 +780,7 @@ int main(int argc,char **argv)
790780
u64 istarttime,inowtime,ireporttime = 0,elapsedoffset = 0;
791781
if (clock_gettime(CLOCK_MONOTONIC,&nowtime) < 0) {
792782
perror("failed to get time");
793-
exit(Q_FAILTIME);
783+
exit(1);
794784
}
795785
istarttime = (1000000 * (u64)nowtime.tv_sec) + ((u64)nowtime.tv_nsec / 1000);
796786
#endif

0 commit comments

Comments
 (0)