Corrected EFArgs() so that "ext2spice run -help" works as advertised;

e.g., "-h" or "-help" is now recognized as a valid option instead of
printing a usage message by way of throwing an error.
This commit is contained in:
Tim Edwards
2019-10-16 09:17:58 -04:00
parent 8b0a9275a8
commit 46f3f44849
2 changed files with 30 additions and 15 deletions
+15 -5
View File
@@ -160,6 +160,15 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
HierName *hierName;
FILE *f;
char usage_text[] =
"Standard arguments: [-R] [-C] [-r rthresh] [-c cthresh] [-v]\n"
"[-p searchpath] [-s sym=value] [-S symfile] [-t trimchars]\n"
#ifdef MAGIC_WRAPPER
"[rootfile]\n";
#else
"[-T techname] rootfile\n";
#endif
if (err_result != NULL) *err_result = FALSE;
/* Hash table of nodes we're going to watch if -N given */
@@ -270,6 +279,11 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
case 'z':
efHNStats = TRUE;
break;
case 'h':
if (argsProc != NULL) (*argsProc)(&argc, &argv, cdata);
TxPrintf(usage_text);
if (err_result != NULL) *err_result = TRUE;
return NULL;
/*** Try a caller-supplied argument processing function ***/
default:
@@ -312,19 +326,15 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
realIn[cp - inname] = '\0';
inname = realIn;
}
return inname;
usage:
TxError("Standard arguments: [-R] [-C] [-r rthresh] [-c cthresh] [-v]\n"
"[-p searchpath] [-s sym=value] [-S symfile] [-t trimchars]\n"
TxError(usage_text);
#ifdef MAGIC_WRAPPER
"[rootfile]\n");
if (err_result != NULL) *err_result = TRUE;
return NULL;
#else
"[-T techname] rootfile\n");
exit (1);
/*NOTREACHED*/
#endif