diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-06 18:50:45 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-06 18:50:45 +0200 |
commit | 248a97fbf0656d12839ca8986287d216820c9849 (patch) | |
tree | e23c9635b7c752ca1b6ed95ecabc1590a18c548b /gram.y | |
parent | 8f8a1c98f84669306d1489ddc5d55b6f589df9be (diff) | |
download | alck-248a97fbf0656d12839ca8986287d216820c9849.tar.gz alck-248a97fbf0656d12839ca8986287d216820c9849.tar.bz2 |
Remove site-specific defaults. Improve local-domain options.
* alck.1: Update.
* alck.h (read_include): Remove.
(freadlist, preadlist): New protos.
* gram.y (usage): Update output.
(main): Change -f to -T. Add -W option (read
class w from a command stdout). Change handling
of the -w option.
Remove cwfile - there's no longer a default for -w.
* lex.l (read_include): Rename to freadlist and rewrite.
(preadlist): New function.
Diffstat (limited to 'gram.y')
-rw-r--r-- | gram.y | 38 |
1 files changed, 21 insertions, 17 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); } ; @@ -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); @@ -289,8 +287,16 @@ main(int argc, char **argv) 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: @@ -301,8 +307,6 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (!cw_list) - read_include(&cw_list, cwfile); while (argc--) { openaliases(*argv++); yyparse(); |