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 | 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--) { |