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:
parent
8b0a9275a8
commit
46f3f44849
|
|
@ -1147,6 +1147,17 @@ spcmainArgs(pargc, pargv)
|
||||||
char **argv = *pargv, *cp;
|
char **argv = *pargv, *cp;
|
||||||
int argc = *pargc;
|
int argc = *pargc;
|
||||||
|
|
||||||
|
char usage_text[] = "Usage: ext2spice "
|
||||||
|
"[-B] [-o spicefile] [-M|-m] [-y cap_digits] "
|
||||||
|
"[-J flat|hier]\n"
|
||||||
|
"[-f spice2|spice3|hspice|ngspice] [-M] [-m] "
|
||||||
|
#ifdef MAGIC_WRAPPER
|
||||||
|
"[file]\n";
|
||||||
|
#else
|
||||||
|
"[-j device:sdRclass[/subRclass]/defaultSubstrate]\n"
|
||||||
|
"file\n\n or else see options to extcheck(1)\n";
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (argv[0][1])
|
switch (argv[0][1])
|
||||||
{
|
{
|
||||||
case 'd':
|
case 'd':
|
||||||
|
|
@ -1243,6 +1254,9 @@ spcmainArgs(pargc, pargv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* MAGIC_WRAPPER */
|
#endif /* MAGIC_WRAPPER */
|
||||||
|
case 'h': /* -h or -help, as suggested by "ext2spice help" */
|
||||||
|
TxPrintf(usage_text);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
TxError("Unrecognized flag: %s\n", argv[0]);
|
TxError("Unrecognized flag: %s\n", argv[0]);
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
@ -1253,16 +1267,7 @@ spcmainArgs(pargc, pargv)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
TxError("Usage: ext2spice [-B] [-o spicefile] [-M|-m] [-y cap_digits] "
|
TxError(usage_text);
|
||||||
"[-J flat|hier]\n"
|
|
||||||
"[-f spice2|spice3|hspice|ngspice] [-M] [-m] "
|
|
||||||
#ifdef MAGIC_WRAPPER
|
|
||||||
"[file]\n"
|
|
||||||
#else
|
|
||||||
"[-j device:sdRclass[/subRclass]/defaultSubstrate]\n"
|
|
||||||
"file\n\n or else see options to extcheck(1)\n"
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,15 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
|
||||||
HierName *hierName;
|
HierName *hierName;
|
||||||
FILE *f;
|
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;
|
if (err_result != NULL) *err_result = FALSE;
|
||||||
|
|
||||||
/* Hash table of nodes we're going to watch if -N given */
|
/* 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':
|
case 'z':
|
||||||
efHNStats = TRUE;
|
efHNStats = TRUE;
|
||||||
break;
|
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 ***/
|
/*** Try a caller-supplied argument processing function ***/
|
||||||
default:
|
default:
|
||||||
|
|
@ -312,19 +326,15 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
|
||||||
realIn[cp - inname] = '\0';
|
realIn[cp - inname] = '\0';
|
||||||
inname = realIn;
|
inname = realIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return inname;
|
return inname;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
TxError("Standard arguments: [-R] [-C] [-r rthresh] [-c cthresh] [-v]\n"
|
TxError(usage_text);
|
||||||
"[-p searchpath] [-s sym=value] [-S symfile] [-t trimchars]\n"
|
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
"[rootfile]\n");
|
|
||||||
if (err_result != NULL) *err_result = TRUE;
|
if (err_result != NULL) *err_result = TRUE;
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
"[-T techname] rootfile\n");
|
|
||||||
exit (1);
|
exit (1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue