awk: check presence of parameters
This commit is contained in:
parent
307ad7b3b0
commit
14367afaf7
1 changed files with 12 additions and 0 deletions
|
@ -70,6 +70,7 @@ main(argc, argv, envp) char **argv, *envp;
|
|||
else {
|
||||
argc--; s = *++argv;
|
||||
}
|
||||
if (s == NULL) usage();
|
||||
pfp = efopen(s, "r");
|
||||
s += strlen(s) - 1;
|
||||
break;
|
||||
|
@ -93,6 +94,8 @@ main(argc, argv, envp) char **argv, *envp;
|
|||
}
|
||||
*/
|
||||
|
||||
if (pfp == NULL && srcprg == NULL) usage();
|
||||
|
||||
while (*xargv != NULL && strchr(*xargv, '=') != NULL) {
|
||||
setvar(*xargv++);
|
||||
xargc--;
|
||||
|
@ -139,3 +142,12 @@ onint(i)
|
|||
closeall();
|
||||
exit(0x80 | i);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [options] [-f <rulefile> | <rules>] [inputfiles]\n", cmd);
|
||||
closeall();
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue