projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement usage
[apps/pfixtools.git]
/
main-postlicyd.c
diff --git
a/main-postlicyd.c
b/main-postlicyd.c
index
fe4a851
..
04172dd
100644
(file)
--- a/
main-postlicyd.c
+++ b/
main-postlicyd.c
@@
-38,6
+38,8
@@
#include "epoll.h"
#include "threads.h"
#include "epoll.h"
#include "threads.h"
+#define DAEMON_NAME "postlicyd"
+
/* administrivia {{{ */
static int main_initialize(void)
/* administrivia {{{ */
static int main_initialize(void)
@@
-59,6
+61,15
@@
static void main_shutdown(void)
module_init(main_initialize);
module_exit(main_shutdown);
module_init(main_initialize);
module_exit(main_shutdown);
+void usage(void)
+{
+ fputs("usage: "DAEMON_NAME" [options] config\n"
+ "\n"
+ "Options:\n"
+ " -p <pidfile> file to write our pid to\n"
+ , stderr);
+}
+
/* }}} */
void *job_run(int fd, void *data)
/* }}} */
void *job_run(int fd, void *data)
@@
-100,11
+111,16
@@
int main(int argc, char *argv[])
pidfile = optarg;
break;
default:
pidfile = optarg;
break;
default:
-
//
usage();
+ usage();
return EXIT_FAILURE;
}
}
return EXIT_FAILURE;
}
}
+ if (argc - optind != 1) {
+ usage();
+ return EXIT_FAILURE;
+ }
+
if (pidfile) {
f = fopen(pidfile, "w");
if (!f) {
if (pidfile) {
f = fopen(pidfile, "w");
if (!f) {