2 * Unix SMB/CIFS implementation.
4 * Copyright (C) Michael Adam 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "lib/cmdline/cmdline.h"
23 int main(int argc
, const char **argv
)
25 const char *config_file
= NULL
;
28 char *count_str
= NULL
;
33 struct poptOption long_options
[] = {
38 .argInfo
= POPT_ARG_STRING
,
41 .descrip
= "Load config <count> number of times"
43 POPT_COMMON_DEBUG_ONLY
48 TALLOC_CTX
*frame
= talloc_stackframe();
52 ok
= samba_cmdline_init(frame
,
53 SAMBA_CMDLINE_CONFIG_NONE
,
54 false /* require_smbconf */);
56 DBG_ERR("Failed to init cmdline parser!\n");
60 lp_set_cmdline("log level", "0");
62 pc
= samba_popt_get_context(getprogname(),
68 DBG_ERR("Failed to setup popt context!\n");
72 poptSetOtherOptionHelp(pc
, "[OPTION...] <config-file>");
74 while ((opt
= poptGetNextOpt(pc
)) != -1) {
76 case POPT_ERROR_BADOPT
:
77 fprintf(stderr
, "\nInvalid option %s: %s\n\n",
78 poptBadOption(pc
, 0), poptStrerror(opt
));
79 poptPrintUsage(pc
, stderr
, 0);
84 if (poptPeekArg(pc
)) {
85 config_file
= talloc_strdup(frame
, poptGetArg(pc
));
86 if (config_file
== NULL
) {
87 DBG_ERR("out of memory\n");
92 config_file
= get_dyn_CONFIGFILE();
97 if (count_str
!= NULL
) {
98 count
= atoi(count_str
);
101 for (i
=0; i
< count
; i
++) {
102 printf("call lp_load() #%d: ", i
+1);
103 if (!lp_load_with_registry_shares(config_file
)) {