summaryrefslogtreecommitdiff
path: root/usr.sbin/popa3d/startup.c
diff options
context:
space:
mode:
authorCamiel Dobbelaar <camield@cvs.openbsd.org>2001-09-21 20:22:07 +0000
committerCamiel Dobbelaar <camield@cvs.openbsd.org>2001-09-21 20:22:07 +0000
commitf2234427fb48ac1ddff2888d88175a676f349d57 (patch)
treeafeb388eb8d1d7da514b1395ecb5fe6502adc2aa /usr.sbin/popa3d/startup.c
parentfa205f9135d5a17814a8cee8cd9022324337f970 (diff)
update to 0.4.9.4:
- stand-alone or inetd selectable from command-line (-D = daemon mode) - logging priorities more accurate - chroots to empty dir - tcp wrappers support
Diffstat (limited to 'usr.sbin/popa3d/startup.c')
-rw-r--r--usr.sbin/popa3d/startup.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/usr.sbin/popa3d/startup.c b/usr.sbin/popa3d/startup.c
new file mode 100644
index 00000000000..d554fbe992e
--- /dev/null
+++ b/usr.sbin/popa3d/startup.c
@@ -0,0 +1,66 @@
+/* $OpenBSD: startup.c,v 1.1 2001/09/21 20:22:06 camield Exp $ */
+
+/*
+ * Command line option parsing.
+ */
+
+#include "params.h"
+
+#if POP_OPTIONS
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* pop_root.c */
+extern int do_pop_startup(void);
+extern int do_pop_session(void);
+
+/* standalone.c */
+extern int do_standalone(void);
+
+#ifdef HAVE_PROGNAME
+extern char *__progname;
+#define progname __progname
+#else
+static char *progname;
+#endif
+
+static void usage(void)
+{
+ fprintf(stderr, "Usage: %s [-D]\n", progname);
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ int c;
+ int standalone = 0;
+
+#ifndef HAVE_PROGNAME
+ if (!(progname = argv[0]))
+ progname = POP_SERVER;
+#endif
+
+ while ((c = getopt(argc, argv, "D")) != -1) {
+ switch (c) {
+ case 'D':
+ standalone++;
+ break;
+
+ default:
+ usage();
+ }
+ }
+
+ if (optind != argc)
+ usage();
+
+ if (standalone)
+ return do_standalone();
+
+ if (do_pop_startup()) return 1;
+ return do_pop_session();
+}
+
+#endif