diff options
Diffstat (limited to 'gram.y')
-rw-r--r-- | gram.y | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -22,3 +22,4 @@ char *program_name; SLIST *cw_list; /* List of domain names pertaining to Sendmail 'w' class */ -static int restricted; /* prohibit use of `special' aliases (pipes, + +static int restricted; /* prohibit the use of `special' aliases (pipes, file redirections and includes */ @@ -102,3 +103,3 @@ email : string $$ = NULL; - read_include(&$$, $2); + freadlist(&$$, $2); } @@ -113,3 +114,3 @@ string: IDENT int -yyerror (char *s) +yyerror(char *s) { @@ -176,3 +177,3 @@ usage() printf(" a letter with '-' reverts its sense\n"); - printf(" -f FILE Read names of alias files from FILE\n"); + printf(" -T FILE Read names of alias files from FILE\n"); printf(" -h Display this help list\n"); @@ -183,4 +184,6 @@ usage() printf(" -V print program version and exit\n"); - printf(" -w FILE Read contents of Sendmail `w' class from the given\n"); - printf(" file.\n"); + printf(" -w FILE Read local domain names from the FILE\n"); + printf(" -W PROG Run PROG and read local domain names from" + " its stdout\n"); + printf("\n"); @@ -212,3 +215,2 @@ main(int argc, char **argv) int true = 1; - char *cwfile = "/etc/mail/sendmail.cw"; SLIST *file_list; /* List of files to be read */ @@ -218,7 +220,5 @@ main(int argc, char **argv) program_name = argv[0]; - while ((c = getopt(argc, argv, "-d:f:hp:ruVvw:")) != EOF) { + while ((c = getopt(argc, argv, "-d:hp:rT:uVvW:w:")) != EOF) { switch (c) { case 1: - if (!cw_list) - read_include(&cw_list, cwfile); openaliases(optarg); @@ -254,7 +254,5 @@ main(int argc, char **argv) - case 'f': - if (!cw_list) - read_include(&cw_list, cwfile); + case 'T': file_list = NULL; - read_include(&file_list, optarg); + freadlist(&file_list, optarg); if (file_list) { @@ -287,3 +285,3 @@ main(int argc, char **argv) version(); - exit (0); + exit(0); @@ -291,4 +289,12 @@ main(int argc, char **argv) if (file_count) - error("-w must be used before first non-option argument"); - cwfile = optarg; + error("-w must be used before the first " + "non-option argument or -T option"); + freadlist(&cw_list, optarg); + break; + + case 'W': + if (file_count) + error("-W must be used before the first " + "non-option argument or -T option"); + preadlist(&cw_list, optarg); break; @@ -296,3 +302,3 @@ main(int argc, char **argv) default: - exit (1); + exit(1); } @@ -303,4 +309,2 @@ main(int argc, char **argv) - if (!cw_list) - read_include(&cw_list, cwfile); while (argc--) { |