summaryrefslogtreecommitdiffabout
path: root/gram.y
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-06 16:50:45 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-03-06 16:50:45 (GMT)
commit248a97fbf0656d12839ca8986287d216820c9849 (patch) (side-by-side diff)
treee23c9635b7c752ca1b6ed95ecabc1590a18c548b /gram.y
parent8f8a1c98f84669306d1489ddc5d55b6f589df9be (diff)
downloadalck-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') (more/less context) (ignore whitespace changes)
-rw-r--r--gram.y44
1 files changed, 24 insertions, 20 deletions
diff --git a/gram.y b/gram.y
index 4da7cb2..271c50d 100644
--- a/gram.y
+++ b/gram.y
@@ -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();

Return to:

Send suggestions and report system problems to the System administrator.