summaryrefslogtreecommitdiff
path: root/source3/lib/popt_common.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-10-05 05:43:44 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-10-05 05:43:44 +0000
commit7ee8de012b38d517a3ebccd377b13fe79b9e4103 (patch)
tree342737cf2882c4727fefa4c57a2fd6b1fff3f0eb /source3/lib/popt_common.c
parentf86f4a4b66f772538185cd7a7aac26c4d9135379 (diff)
downloadsamba-7ee8de012b38d517a3ebccd377b13fe79b9e4103.tar.gz
samba-7ee8de012b38d517a3ebccd377b13fe79b9e4103.tar.bz2
samba-7ee8de012b38d517a3ebccd377b13fe79b9e4103.zip
Add more common options to popt_common - and start using
the ones for debuglevel and configuration file in pdbedit (This used to be commit cb0d03a393d9009c3e16b9d05d88c171de9a9414)
Diffstat (limited to 'source3/lib/popt_common.c')
-rw-r--r--source3/lib/popt_common.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index bbc17cb704..1a63405b72 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -3,6 +3,7 @@
Common popt routines
Copyright (C) Tim Potter 2001,2002
+ Copyright (C) Jelmer Vernooij 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,29 +22,76 @@
#include "includes.h"
-/* Handle -d,--debuglevel command line option */
+/* Handle command line options:
+ * -d,--debuglevel
+ * -s,--configfile
+ * -O,--socket-options
+ */
-static void debug_callback(poptContext con,
+extern pstring user_socket_options;
+extern BOOL AllowDebugChange;
+extern pstring global_myname;
+
+static void popt_common_callback(poptContext con,
enum poptCallbackReason reason,
const struct poptOption *opt,
const char *arg, const void *data)
{
- extern BOOL AllowDebugChange;
-
switch(opt->val) {
case 'd':
if (arg) {
debug_parse_levels(arg);
AllowDebugChange = False;
}
+ break;
+ case 'V':
+ printf( "Version %s\n", VERSION );
+ exit(0);
+ break;
+
+ case 'O':
+ pstrcpy(user_socket_options,arg);
+ break;
+
+ case 's':
+ pstrcpy(dyn_CONFIGFILE, arg);
+ break;
+
+ case 'n':
+ pstrcpy(global_myname,arg);
+ strupper(global_myname);
break;
}
}
struct poptOption popt_common_debug[] = {
- { NULL, 0, POPT_ARG_CALLBACK, debug_callback },
- { "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Set debug level",
+ { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
+ { "debuglevel", 'd', POPT_ARG_STRING, dyn_CONFIGFILE, 'd', "Set debug level",
"DEBUGLEVEL" },
{ 0 }
};
+
+struct poptOption popt_common_configfile[] = {
+ { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
+ { "configfile", 's', POPT_ARG_STRING, NULL, 's', "Use alternative configuration file" },
+ { 0 }
+};
+
+struct poptOption popt_common_socket_options[] = {
+ { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
+ {"socket-options", 'O', POPT_ARG_STRING, NULL, 'O', "socket options to use" },
+ { 0 }
+};
+
+struct poptOption popt_common_version[] = {
+ { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
+ {"version", 'V', POPT_ARG_NONE, NULL, 'V', "Print version" },
+ { 0 }
+};
+
+struct poptOption popt_common_netbios_name[] = {
+ { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
+ {"netbiosname", 'n', POPT_ARG_STRING, NULL, 'n', "Primary netbios name"},
+ { 0 }
+};