mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-12-05 21:27:13 -06:00
do not bother with different exit codes
This commit is contained in:
32
main.c
Normal file → Executable file
32
main.c
Normal file → Executable file
@@ -424,27 +424,17 @@ static void printhelp(FILE *out,const char *progname)
|
|||||||
fflush(out);
|
fflush(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
|
||||||
Q_ADDITIONAL = 101,
|
|
||||||
Q_UNRECOGNISED,
|
|
||||||
Q_NOSTATISTICS,
|
|
||||||
Q_FAILOPENOUTPUT,
|
|
||||||
Q_FAILTHREAD,
|
|
||||||
Q_FAILTIME,
|
|
||||||
Q_FAILOPENINPUT,
|
|
||||||
} ;
|
|
||||||
|
|
||||||
static void e_additional()
|
static void e_additional()
|
||||||
{
|
{
|
||||||
fprintf(stderr,"additional argument required\n");
|
fprintf(stderr,"additional argument required\n");
|
||||||
exit(Q_ADDITIONAL);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STATISTICS
|
#ifndef STATISTICS
|
||||||
static void e_nostatistics()
|
static void e_nostatistics()
|
||||||
{
|
{
|
||||||
fprintf(stderr,"statistics support not compiled in\n");
|
fprintf(stderr,"statistics support not compiled in\n");
|
||||||
exit(Q_NOSTATISTICS);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -526,7 +516,7 @@ int main(int argc,char **argv)
|
|||||||
if (*arg == '-') {
|
if (*arg == '-') {
|
||||||
if (numargit > 1) {
|
if (numargit > 1) {
|
||||||
fprintf(stderr,"unrecognised argument: -\n");
|
fprintf(stderr,"unrecognised argument: -\n");
|
||||||
exit(Q_UNRECOGNISED);
|
exit(1);
|
||||||
}
|
}
|
||||||
++arg;
|
++arg;
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
@@ -537,7 +527,7 @@ int main(int argc,char **argv)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,"unrecognised argument: --%s\n",arg);
|
fprintf(stderr,"unrecognised argument: --%s\n",arg);
|
||||||
exit(Q_UNRECOGNISED);
|
exit(1);
|
||||||
}
|
}
|
||||||
numargit = 0;
|
numargit = 0;
|
||||||
}
|
}
|
||||||
@@ -644,14 +634,14 @@ int main(int argc,char **argv)
|
|||||||
hostname = 0;
|
hostname = 0;
|
||||||
if (hostname && strlen(hostname) != ONION_LEN) {
|
if (hostname && strlen(hostname) != ONION_LEN) {
|
||||||
fprintf(stderr,"bad onion argument length\n");
|
fprintf(stderr,"bad onion argument length\n");
|
||||||
exit(Q_UNRECOGNISED);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,"unrecognised argument: -%c\n",*arg);
|
fprintf(stderr,"unrecognised argument: -%c\n",*arg);
|
||||||
exit(Q_UNRECOGNISED);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (numargit)
|
if (numargit)
|
||||||
goto nextarg;
|
goto nextarg;
|
||||||
@@ -664,13 +654,13 @@ int main(int argc,char **argv)
|
|||||||
fout = fopen(outfile,!outfileoverwrite ? "a" : "w");
|
fout = fopen(outfile,!outfileoverwrite ? "a" : "w");
|
||||||
if (!fout) {
|
if (!fout) {
|
||||||
perror("failed to open output file");
|
perror("failed to open output file");
|
||||||
exit(Q_FAILOPENOUTPUT);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fout && yamloutput) {
|
if (!fout && yamloutput) {
|
||||||
fprintf(stderr,"nil output with yaml mode does not make sense\n");
|
fprintf(stderr,"nil output with yaml mode does not make sense\n");
|
||||||
exit(Q_FAILOPENOUTPUT); // define new err code?
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workdir)
|
if (workdir)
|
||||||
@@ -694,7 +684,7 @@ int main(int argc,char **argv)
|
|||||||
fin = fopen(infile,"r");
|
fin = fopen(infile,"r");
|
||||||
if (!fin) {
|
if (!fin) {
|
||||||
fprintf(stderr,"failed to open input file\n");
|
fprintf(stderr,"failed to open input file\n");
|
||||||
return Q_FAILOPENINPUT;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tret = yamlin_parseandcreate(fin,sname,hostname);
|
tret = yamlin_parseandcreate(fin,sname,hostname);
|
||||||
@@ -775,7 +765,7 @@ int main(int argc,char **argv)
|
|||||||
tret = pthread_create(&VEC_BUF(threads,i),tattrp,fastkeygen ? dofastwork : dowork,tp);
|
tret = pthread_create(&VEC_BUF(threads,i),tattrp,fastkeygen ? dofastwork : dowork,tp);
|
||||||
if (tret) {
|
if (tret) {
|
||||||
fprintf(stderr,"error while making " FSZ "th thread: %s\n",i,strerror(tret));
|
fprintf(stderr,"error while making " FSZ "th thread: %s\n",i,strerror(tret));
|
||||||
exit(Q_FAILTHREAD);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,7 +780,7 @@ int main(int argc,char **argv)
|
|||||||
u64 istarttime,inowtime,ireporttime = 0,elapsedoffset = 0;
|
u64 istarttime,inowtime,ireporttime = 0,elapsedoffset = 0;
|
||||||
if (clock_gettime(CLOCK_MONOTONIC,&nowtime) < 0) {
|
if (clock_gettime(CLOCK_MONOTONIC,&nowtime) < 0) {
|
||||||
perror("failed to get time");
|
perror("failed to get time");
|
||||||
exit(Q_FAILTIME);
|
exit(1);
|
||||||
}
|
}
|
||||||
istarttime = (1000000 * (u64)nowtime.tv_sec) + ((u64)nowtime.tv_nsec / 1000);
|
istarttime = (1000000 * (u64)nowtime.tv_sec) + ((u64)nowtime.tv_nsec / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user