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"
22 #include "lib/param/param.h"
24 int main(int argc
, const char **argv
)
26 const char *config_file
= NULL
;
29 char *count_str
= NULL
;
34 struct poptOption long_options
[] = {
39 .argInfo
= POPT_ARG_STRING
,
42 .descrip
= "Load config <count> number of times"
44 POPT_COMMON_DEBUG_ONLY
49 TALLOC_CTX
*frame
= talloc_stackframe();
50 struct loadparm_context
*lp_ctx
= NULL
;
54 ok
= samba_cmdline_init(frame
,
55 SAMBA_CMDLINE_CONFIG_NONE
,
56 false /* require_smbconf */);
58 DBG_ERR("Failed to init cmdline parser!\n");
62 lp_ctx
= samba_cmdline_get_lp_ctx();
63 lpcfg_set_cmdline(lp_ctx
, "log level", "0");
65 pc
= samba_popt_get_context(getprogname(),
71 DBG_ERR("Failed to setup popt context!\n");
75 poptSetOtherOptionHelp(pc
, "[OPTION...] <config-file>");
77 while ((opt
= poptGetNextOpt(pc
)) != -1) {
79 case POPT_ERROR_BADOPT
:
80 fprintf(stderr
, "\nInvalid option %s: %s\n\n",
81 poptBadOption(pc
, 0), poptStrerror(opt
));
82 poptPrintUsage(pc
, stderr
, 0);
87 if (poptPeekArg(pc
)) {
88 config_file
= talloc_strdup(frame
, poptGetArg(pc
));
89 if (config_file
== NULL
) {
90 DBG_ERR("out of memory\n");
95 config_file
= get_dyn_CONFIGFILE();
100 if (count_str
!= NULL
) {
101 count
= atoi(count_str
);
104 for (i
=0; i
< count
; i
++) {
105 printf("call lp_load() #%d: ", i
+1);
106 if (!lp_load_with_registry_shares(config_file
)) {