-static int kill_tincd = 0;
-
-char *confbase = NULL; /* directory in which all config files are */
-char *configfilename = NULL; /* configuration file name */
-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 },
- { NULL, 0, NULL, 0 }
+int kill_tincd = 0;
+
+/* If nonzero, generate public/private keypair for this host/net. */
+int generate_keys = 0;
+
+/* If nonzero, use null ciphers and skip all key exchanges. */
+bool bypass_security = false;
+
+/* If nonzero, disable swapping for this process. */
+bool do_mlock = false;
+
+/* 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;
+
+/* If nonzero, write log entries to a separate file. */
+bool use_logfile = false;
+
+char *identname = NULL; /* program name for syslog */
+char *pidfilename = NULL; /* pid file location */
+char *logfilename = NULL; /* log file location */
+char **g_argv; /* a copy of the cmdline arguments */
+
+static int status;
+
+static struct option const long_options[] = {
+ {"config", required_argument, NULL, 'c'},
+ {"kill", optional_argument, NULL, 'k'},
+ {"net", required_argument, NULL, 'n'},
+ {"help", no_argument, NULL, 1},
+ {"version", no_argument, NULL, 2},
+ {"no-detach", no_argument, NULL, 'D'},
+ {"generate-keys", optional_argument, NULL, 'K'},
+ {"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},
+ {"pidfile", required_argument, NULL, 5},
+ {NULL, 0, NULL, 0}