1 #include <unistd.h>
2 #include "strerr.h"
3 #include "readwrite.h"
4 #include "substdio.h"
5 #include "subfd.h"
6 #include "subdb.h"
7 #include "exit.h"
8 #include "fmt.h"
9 #include "getconfopt.h"
10 #include "messages.h"
11 #include "die.h"
12 #include "idx.h"
13 #include "config.h"
14 #include "auto_version.h"
15 
16 const char FATAL[] = "ezmlm-rmtab: fatal: ";
17 const char USAGE[] =
18 "ezmlm-rmtab: usage: ezmlm-rmtab [-mM] [-S subdb | dir]";
19 
20 static const char *flagsubdb = 0;
21 
22 static struct option options[] = {
23   OPT_CSTR_FLAG(flagsubdb,'m',0,0),
24   OPT_CSTR_FLAG(flagsubdb,'M',"std",0),
25   OPT_CSTR(flagsubdb,'S',0),
26   OPT_END
27 };
28 
main(int argc,char ** argv)29 int main(int argc,char **argv)
30 {
31   const char *dir;
32   const char *r;
33 
34   getconfopt(argc,argv,options,-1,&dir);
35   if (dir == 0 && flagsubdb == 0)
36     strerr_die2x(100,FATAL,"must specify either -S or dir");
37 
38   initsub(flagsubdb);
39   if ((r = rmtab()) != 0)
40     strerr_die3x(100,FATAL,"could not remove tables: ",r);
41   _exit(0);
42 }
43