summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-06 02:13:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:46 -0500
commit03ab3429090a9fccc8778d949cd9d92042575558 (patch)
tree9778b002e200913d3c59b0bcfcd890c7e2a8a312 /source4/param
parent37bc6b5f813d5c2ace7486a38331748dd86f121d (diff)
downloadsamba-03ab3429090a9fccc8778d949cd9d92042575558.tar.gz
samba-03ab3429090a9fccc8778d949cd9d92042575558.tar.bz2
samba-03ab3429090a9fccc8778d949cd9d92042575558.zip
r12729: Implement the --section-name option, for dumping only one section.
Andrew Bartlett (This used to be commit 3c49dd9219b12f5ed229ba108a02b85a18146df8)
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c35
-rw-r--r--source4/param/loadparm.h14
2 files changed, 33 insertions, 16 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 08abc3aa48..6e7716b1f2 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -66,18 +66,6 @@
static BOOL bLoaded = False;
-#ifndef GLOBAL_NAME
-#define GLOBAL_NAME "global"
-#endif
-
-#ifndef PRINTERS_NAME
-#define PRINTERS_NAME "printers"
-#endif
-
-#ifndef HOMES_NAME
-#define HOMES_NAME "homes"
-#endif
-
/* some helpful bits */
#define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
#define VALID(i) ServicePtrs[i]->valid
@@ -706,6 +694,12 @@ static void init_globals(void)
do_parameter("tls cafile", "tls/ca.pem", NULL);
do_parameter_var("js include", "%s/js", dyn_LIBDIR);
do_parameter_var("setup directory", "%s/setup", dyn_LIBDIR);
+
+ for (i = 0; parm_table[i].label; i++) {
+ if (!(parm_table[i].flags & FLAG_CMDLINE)) {
+ parm_table[i].flags |= FLAG_DEFAULT;
+ }
+ }
}
static TALLOC_CTX *lp_talloc;
@@ -1886,6 +1880,17 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
break;
}
+ if (parm_table[parmnum].flags & FLAG_DEFAULT) {
+ parm_table[parmnum].flags &= ~FLAG_DEFAULT;
+ /* we have to also unset FLAG_DEFAULT on aliases */
+ for (i=parmnum-1;i>=0 && parm_table[i].ptr == parm_table[parmnum].ptr;i--) {
+ parm_table[i].flags &= ~FLAG_DEFAULT;
+ }
+ for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].ptr == parm_table[parmnum].ptr;i++) {
+ parm_table[i].flags &= ~FLAG_DEFAULT;
+ }
+ }
+
return (True);
}
@@ -2151,7 +2156,7 @@ static BOOL is_default(int i)
Display the contents of the global structure.
***************************************************************************/
-static void dump_globals(FILE *f)
+static void dump_globals(FILE *f, BOOL show_defaults)
{
int i;
struct param_opt *data;
@@ -2162,7 +2167,7 @@ static void dump_globals(FILE *f)
if (parm_table[i].class == P_GLOBAL &&
parm_table[i].ptr &&
(i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
- if (defaults_saved && is_default(i))
+ if (!show_defaults && (parm_table[i].flags & FLAG_DEFAULT))
continue;
fprintf(f, "\t%s = ", parm_table[i].label);
print_parameter(&parm_table[i], parm_table[i].ptr, f);
@@ -2441,7 +2446,7 @@ void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
if (show_defaults)
defaults_saved = False;
- dump_globals(f);
+ dump_globals(f, show_defaults);
dump_a_service(&sDefault, f);
diff --git a/source4/param/loadparm.h b/source4/param/loadparm.h
index 16444c84a2..1bb0ed6618 100644
--- a/source4/param/loadparm.h
+++ b/source4/param/loadparm.h
@@ -68,6 +68,18 @@ struct parm_struct {
#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */
#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */
-#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
+#define FLAG_DEFAULT 0x4000 /* this option was a default */
#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */
+#ifndef GLOBAL_NAME
+#define GLOBAL_NAME "global"
+#endif
+
+#ifndef PRINTERS_NAME
+#define PRINTERS_NAME "printers"
+#endif
+
+#ifndef HOMES_NAME
+#define HOMES_NAME "homes"
+#endif
+