1 /*$Id: ezmlm-sub.c,v 1.18 1999/08/02 02:57:57 lindberg Exp $*/
2 /*$Name: ezmlm-idx-040 $*/
14 #define FATAL "ezmlm-sub: fatal: "
16 void *psql
= (void *) 0;
19 substdio ssin
= SUBSTDIO_FDBUF(read
,0,inbuf
,sizeof(inbuf
));
25 "ezmlm-sub: usage: ezmlm-sub [-mMvV] [-h hash] [-n] dir "
26 "[box@domain [name]] ...");
42 int flagmysql
= 1; /* use mysql if supported */
47 while ((opt
= getopt(argc
,argv
,"h:HmMnNvV")) != opteof
)
49 case 'h': (void) scan_ulong(optarg
,&u
); forcehash
= 0; break;
50 case 'H': forcehash
= -1; break;
51 case 'm': flagmysql
= 1; break;
52 case 'M': flagmysql
= 0; break;
53 case 'n': flagname
= 1; break;
54 case 'N': flagname
= 0; break;
56 case 'V': strerr_die2x(0,
57 "ezmlm-sub version: ezmlm-0.53+",EZIDX_VERSION
);
63 if (!dir
) die_usage();
66 strerr_die2x(100,FATAL
,ERR_SLASH
);
69 strerr_die4sys(111,FATAL
,ERR_SWITCH
,dir
,": ");
71 if (forcehash
== 0) forcehash
= (int) u
;
75 /* allow repeats and last addr doesn't need comment */
76 while ((addr
= argv
[optind
++])) {
77 (void) subscribe(dir
,addr
,1,argv
[optind
],"+manual",
78 flagmysql
,forcehash
,(char *) 0,FATAL
);
79 if (!argv
[optind
++]) break;
83 while ((addr
= argv
[optind
++]))
84 (void) subscribe(dir
,addr
,1,"","+manual",flagmysql
,
85 forcehash
,(char *) 0,FATAL
);
89 if (getln(&ssin
,&line
,&match
,'\n') == -1)
90 strerr_die2sys(111,FATAL
,ERR_READ_INPUT
);
92 if (line
.len
== 1 || *line
.s
== '#') continue;
93 line
.s
[line
.len
- 1] = '\0';
100 } else if (ch
== ' ' || ch
== '\t' || ch
== ',') break;
108 (void) subscribe(dir
,line
.s
,1,comment
,"+manual",flagmysql
,
109 forcehash
,(char *) 0,FATAL
);