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
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
#include "system/filesys.h"
#include "lib/cmdline/popt_common.h"
#include "lib/socket/socket.h"
+#include "param/param.h"
/***********************************************
int main(int argc, const char *argv[])
{
int s;
- static BOOL silent_mode = False;
+ static int silent_mode = 0;
int ret = 0;
poptContext pc;
- static const char *term_code = "";
/*
- static BOOL show_all_parameters = False;
- static char *parameter_name = NULL;
- static const char *section_name = NULL;
+ static int show_all_parameters = 0;
static char *new_local_machine = NULL;
*/
+ static const char *section_name = NULL;
+ static char *parameter_name = NULL;
static const char *cname;
static const char *caddr;
static int show_defaults;
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"suppress-prompt", 's', POPT_ARG_VAL, &silent_mode, 1, "Suppress prompt for enter"},
+ {"suppress-prompt", 0, POPT_ARG_NONE, &silent_mode, 1, "Suppress prompt for enter"},
{"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
/*
We need support for smb.conf macros before this will work again
{"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
-*/ {"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters with encoding"},
+*/
/*
These are harder to do with the new code structure
- {"show-all-parameters", '\0', POPT_ARG_VAL, &show_all_parameters, True, "Show the parameters, type, possible values" },
- {"parameter-name", '\0', POPT_ARG_STRING, ¶meter_name, 0, "Limit testparm to a named parameter" },
- {"section-name", '\0', POPT_ARG_STRING, §ion_name, 0, "Limit testparm to a named section" },
+ {"show-all-parameters", '\0', POPT_ARG_NONE, &show_all_parameters, 1, "Show the parameters, type, possible values" },
*/
+ {"section-name", '\0', POPT_ARG_STRING, §ion_name, 0, "Limit testparm to a named section" },
+ {"parameter-name", '\0', POPT_ARG_STRING, ¶meter_name, 0, "Limit testparm to a named parameter" },
{"client-name", '\0', POPT_ARG_STRING, &cname, 0, "Client DNS name for 'hosts allow' checking (should match reverse lookup)"},
{"client-ip", '\0', POPT_ARG_STRING, &caddr, 0, "Client IP address for 'hosts allow' checking"},
+ POPT_COMMON_SAMBA
POPT_COMMON_VERSION
- POPT_TABLEEND
+ { NULL }
};
setup_logging(NULL, DEBUG_STDERR);
fflush(stdout);
getc(stdin);
}
- lp_dump(stdout, show_defaults, lp_numservices());
+ if (section_name || parameter_name) {
+ BOOL isGlobal = False;
+ if (!section_name) {
+ section_name = GLOBAL_NAME;
+ isGlobal = True;
+ } else if ((isGlobal=!strwicmp(section_name, GLOBAL_NAME)) == 0 &&
+ (s=lp_servicenumber(section_name)) == -1) {
+ fprintf(stderr,"Unknown section %s\n",
+ section_name);
+ return(1);
+ }
+ if (!parameter_name) {
+ if (isGlobal == True) {
+ lp_dump(stdout, show_defaults, 0);
+ } else {
+ lp_dump_one(stdout, show_defaults, s);
+ }
+ } else {
+ ret = !lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
+ }
+ } else {
+ lp_dump(stdout, show_defaults, lp_numservices());
+ }
+ return(ret);
}
if(cname && caddr){