2 Unix SMB/CIFS implementation.
5 Copyright (C) Tim Potter 2001,2002
6 Copyright (C) Jelmer Vernooij 2002
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* Handle command line options:
34 extern pstring user_socket_options;
35 extern BOOL AllowDebugChange;
37 static void popt_common_callback(poptContext con,
38 enum poptCallbackReason reason,
39 const struct poptOption *opt,
40 const char *arg, const void *data)
45 /* Find out basename of current program */
46 pname = strrchr_m(poptGetInvocationName(con),'/');
49 pname = poptGetInvocationName(con);
53 if (reason == POPT_CALLBACK_REASON_PRE) {
54 pstr_sprintf(logfile, "%s/log.%s", dyn_LOGFILEBASE, pname);
55 lp_set_logfile(logfile);
62 debug_parse_levels(arg);
63 AllowDebugChange = False;
68 printf( "Version %s\n", VERSION );
74 pstrcpy(user_socket_options,arg);
80 pstrcpy(dyn_CONFIGFILE, arg);
86 set_global_myname(arg);
92 pstr_sprintf(logfile, "%s/log.%s", arg, pname);
93 lp_set_logfile(logfile);
99 struct poptOption popt_common_debug[] = {
100 { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
101 { "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Set debug level",
106 struct poptOption popt_common_configfile[] = {
107 { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
108 { "configfile", 's', POPT_ARG_STRING, NULL, 's', "Use alternative configuration file" },
112 struct poptOption popt_common_socket_options[] = {
113 { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
114 {"socket-options", 'O', POPT_ARG_STRING, NULL, 'O', "socket options to use" },
118 struct poptOption popt_common_version[] = {
119 { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
120 {"version", 'V', POPT_ARG_NONE, NULL, 'V', "Print version" },
124 struct poptOption popt_common_netbios_name[] = {
125 { NULL, 0, POPT_ARG_CALLBACK, popt_common_callback },
126 {"netbiosname", 'n', POPT_ARG_STRING, NULL, 'n', "Primary netbios name"},
130 struct poptOption popt_common_log_base[] = {
131 { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE, popt_common_callback },
132 { "log-basename", 'l', POPT_ARG_STRING, NULL, 'l', "Basename for log/debug files"},