diff options
Diffstat (limited to 'gram.y')
-rw-r--r-- | gram.y | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -20,7 +20,8 @@ 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 */ int verbose; /* Verbose mode */ int error_count; /* Number of errors detected so far */ @@ -100,7 +101,7 @@ email : string YYERROR; } $$ = NULL; - read_include(&$$, $2); + freadlist(&$$, $2); } ; @@ -111,7 +112,7 @@ string: IDENT %% int -yyerror (char *s) +yyerror(char *s) { parserror(file_name, line_num, "%s", s); error_count++; @@ -174,15 +175,17 @@ usage() printf(" l enable lexical analizer debugging\n"); printf(" Upper-case variants are also accepted. Prepending\n"); 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"); printf(" -r Restrict alias file syntax to aliases only (i.e.\n"); printf(" prohibit use of pipes and file redirections\n"); printf(" -u Revert the effect of the previous -r option\n"); printf(" -v Verbose mode\n"); 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"); printf("Report bugs to <%s>\n", "gray@gnu.org"); } @@ -210,17 +213,14 @@ main(int argc, char **argv) int c; int file_count = 0; int true = 1; - char *cwfile = "/etc/mail/sendmail.cw"; SLIST *file_list; /* List of files to be read */ struct string_list *s; init_lex(); 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); yyparse(); file_count++; @@ -252,11 +252,9 @@ main(int argc, char **argv) } break; - 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) { for (s = file_list->head; s; s = s->next) { openaliases_prefix(optarg, s->str); @@ -285,24 +283,30 @@ main(int argc, char **argv) case 'V': version(); - exit (0); + exit(0); case 'w': 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; default: - exit (1); + exit(1); } } argc -= optind; argv += optind; - if (!cw_list) - read_include(&cw_list, cwfile); while (argc--) { openaliases(*argv++); yyparse(); |