r25026: Move param/param.h out of includes.h
[jelmer/samba4-debian.git] / source / utils / testparm.c
index fd990221ed54c7464019ff75b3f2d287a434c9cb..e0ebe48d638f8a9f5e1bf541e50f8587c90e0e5e 100644 (file)
@@ -9,7 +9,7 @@
    
    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,
@@ -18,8 +18,7 @@
    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/>.
 */
 
 /*
@@ -37,6 +36,7 @@
 #include "system/filesys.h"
 #include "lib/cmdline/popt_common.h"
 #include "lib/socket/socket.h"
+#include "param/param.h"
 
 
 /***********************************************
@@ -75,12 +75,11 @@ static int do_global_checks(void)
  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 int show_all_parameters = 0;
        static char *new_local_machine = NULL;
 */
        static const char *section_name = NULL;
@@ -91,15 +90,15 @@ static int do_global_checks(void)
 
        struct poptOption long_options[] = {
                POPT_AUTOHELP
-               {"suppress-prompt", '\0', 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" },
+               {"show-all-parameters", '\0', POPT_ARG_NONE, &show_all_parameters, 1, "Show the parameters, type, possible values" },
 */
                {"section-name", '\0', POPT_ARG_STRING, &section_name, 0, "Limit testparm to a named section" },
                {"parameter-name", '\0', POPT_ARG_STRING, &parameter_name, 0, "Limit testparm to a named parameter" },
@@ -107,7 +106,7 @@ static int do_global_checks(void)
                {"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);
@@ -215,7 +214,7 @@ static int do_global_checks(void)
                                        lp_dump_one(stdout, show_defaults, s);
                                }
                        } else {
-                               ret = lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
+                               ret = !lp_dump_a_parameter(s, parameter_name, stdout, isGlobal);
                        }
                } else {
                        lp_dump(stdout, show_defaults, lp_numservices());