aboutsummaryrefslogtreecommitdiff
path: root/src/cmdline.opt
blob: 5d6eafe6c55b4424b79b4c29791a89e8dc32a327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#define EX_USAGE 1

OPTIONS_BEGIN("direvent",
              [<GNU direvent monitors changes in directories>],
              [<[CONFIG]>],
              [<gnu>],
              [<copyright_year=2012-2014>],
              [<copyright_holder=Sergey Poznyakoff>])

OPTION(debug,d,,
       [<increase debug level>])
BEGIN       
	opt_debug_level++;
END

OPTION(,l,PRIO,
       [<log everything with priority PRIO and higher to the stderr, as well as to the syslog>])
BEGIN
	if (strcmp(optarg, "none") == 0)
		log_to_stderr = -1;
	else
		log_to_stderr = get_priority(optarg);
END
       
OPTION(facility,F,NAME,
       [<set syslog facility>])
BEGIN       
	opt_facility = get_facility(optarg);
END

OPTION(foreground,f,,
       [<remain in foreground>])
BEGIN       
	opt_foreground++;
END

OPTION(self-test,T,PROG,
       [<self-test mode>])
BEGIN
	self_test_prog = optarg;
END	

OPTION(pidfile,P,FILE,
       [<set PID file>])
BEGIN       
	opt_pidfile = optarg;
END	

OPTION(lint,t,,,
       [<check configuration file and exit>])
BEGIN       
	lint_only = 1;
END

OPTION(user,u,USER,,
       [<run as this user>])
BEGIN
	opt_user = optarg;
	if (!getpwnam(opt_user)) {
		diag(LOG_CRIT, "no such user: %s", opt_user);
		exit(1);
	}
END
	      
OPTION(config-help,H,,
       [<show configuration file summary>])
BEGIN
	config_help();
	exit(0);
END
	   

OPTIONS_END

static void
help_hook(FILE *fp)
{
	fprintf(fp,
		"The optional CONFIG argument supplies the name of the "
		"configuration file\n"
	        "to use instead of %s.\n\n", DEFAULT_CONFFILE); 

	fprintf(fp, "This direvent uses %s interface.\n\n", INTERFACE);
}

void
parse_options(int argc, char *argv[], int *index)
{
	proginfo.print_help_hook = help_hook;
	GETOPT(argc, argv, *index)
}
  

Return to:

Send suggestions and report system problems to the System administrator.