-static int show_version;
-
-/* If nonzero, it will attempt to kill a running tincd and exit. */
-static int kill_tincd = 0;
-
-/* If zero, don't detach from the terminal. */
-static int do_detach = 1;
-
-char *identname; /* program name for syslog */
-char *netname = NULL; /* name of the vpn network */
-char *pidfilename; /* pid file location */
-static pid_t ppid; /* pid of non-detached part */
-char **g_argv; /* a copy of the cmdline arguments */
-
-void cleanup_and_exit(int);
-int detach(void);
-int kill_other(void);
-void make_names(void);
-RETSIGTYPE parent_exit(int a);
-void setup_signals(void);
-int write_pidfile(void);
-
-static struct option const long_options[] =
-{
- { "kill", no_argument, NULL, 'k' },
- { "net", required_argument, NULL, 'n' },
- { "timeout", required_argument, NULL, 'p' },
- { "help", no_argument, &show_help, 1 },
- { "version", no_argument, &show_version, 1 },
- { "no-detach", no_argument, &do_detach, 0 },
- { NULL, 0, NULL, 0 }
+static bool show_version = false;
+
+/* If nonzero, use null ciphers and skip all key exchanges. */
+bool bypass_security = false;
+
+#ifdef HAVE_MLOCKALL
+/* If nonzero, disable swapping for this process. */
+static bool do_mlock = false;
+#endif
+
+#ifndef HAVE_MINGW
+/* If nonzero, chroot to netdir after startup. */
+static bool do_chroot = false;
+
+/* If !NULL, do setuid to given user after startup */
+static const char *switchuser = NULL;
+#endif
+
+/* If nonzero, write log entries to a separate file. */
+bool use_logfile = false;
+
+/* If nonzero, use syslog instead of stderr in no-detach mode. */
+bool use_syslog = false;
+
+char **g_argv; /* a copy of the cmdline arguments */
+
+static int status = 1;
+
+static struct option const long_options[] = {
+ {"config", required_argument, NULL, 'c'},
+ {"net", required_argument, NULL, 'n'},
+ {"help", no_argument, NULL, 1},
+ {"version", no_argument, NULL, 2},
+ {"no-detach", no_argument, NULL, 'D'},
+ {"debug", optional_argument, NULL, 'd'},
+ {"bypass-security", no_argument, NULL, 3},
+ {"mlock", no_argument, NULL, 'L'},
+ {"chroot", no_argument, NULL, 'R'},
+ {"user", required_argument, NULL, 'U'},
+ {"logfile", optional_argument, NULL, 4},
+ {"syslog", no_argument, NULL, 's'},
+ {"pidfile", required_argument, NULL, 5},
+ {"option", required_argument, NULL, 'o'},
+ {NULL, 0, NULL, 0}