diff options
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r-- | source3/param/loadparm.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d35ca97292..bec5f03cd8 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2694,7 +2694,7 @@ static BOOL do_parameter(char *pszParmName, char *pszParmValue) /*************************************************************************** print a parameter of the specified type ***************************************************************************/ -static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) +static void print_parameter(struct parm_struct *p, void *ptr, FILE * f, char *(*dos_to_ext)(char *, BOOL)) { int i; switch (p->type) @@ -2733,14 +2733,22 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) case P_GSTRING: case P_UGSTRING: - if ((char *)ptr) - fprintf(f, "%s", (char *)ptr); + if ((char *)ptr) { + if (p->flags & FLAG_DOS_STRING) + fprintf(f, "%s", dos_to_ext((char *)ptr, False)); + else + fprintf(f, "%s", (char *)ptr); + } break; case P_STRING: case P_USTRING: - if (*(char **)ptr) - fprintf(f, "%s", *(char **)ptr); + if (*(char **)ptr) { + if(p->flags & FLAG_DOS_STRING) + fprintf(f,"%s",dos_to_ext(*(char **)ptr, False)); + else + fprintf(f, "%s", *(char **)ptr); + } break; case P_SEP: break; @@ -2895,7 +2903,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, char *(*dos_to_ext)(char *, BOOL)) { int i; fprintf(f, "# Global parameters\n[global]\n"); @@ -2908,7 +2916,7 @@ static void dump_globals(FILE * f) if (defaults_saved && is_default(i)) continue; fprintf(f, "\t%s = ", parm_table[i].label); - print_parameter(&parm_table[i], parm_table[i].ptr, f); + print_parameter(&parm_table[i], parm_table[i].ptr, f, dos_to_ext); fprintf(f, "\n"); } } @@ -2929,7 +2937,7 @@ BOOL lp_is_default(int snum, struct parm_struct *parm) /*************************************************************************** Display the contents of a single services record. ***************************************************************************/ -static void dump_a_service(service * pService, FILE * f) +static void dump_a_service(service * pService, FILE * f, char *(*dos_to_ext)(char *, BOOL)) { int i; if (pService != &sDefault) @@ -2960,7 +2968,7 @@ static void dump_a_service(service * pService, FILE * f) fprintf(f, "\t%s = ", parm_table[i].label); print_parameter(&parm_table[i], - ((char *)pService) + pdiff, f); + ((char *)pService) + pdiff, f, dos_to_ext); fprintf(f, "\n"); } } @@ -3330,7 +3338,7 @@ int lp_numservices(void) /*************************************************************************** Display the contents of the services array in human-readable form. ***************************************************************************/ -void lp_dump(FILE * f, BOOL show_defaults, int maxtoprint) +void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint, char *(*dos_to_ext)(char *, BOOL)) { int iService; @@ -3339,24 +3347,24 @@ void lp_dump(FILE * f, BOOL show_defaults, int maxtoprint) defaults_saved = False; } - dump_globals(f); + dump_globals(f, dos_to_ext); - dump_a_service(&sDefault, f); + dump_a_service(&sDefault, f, dos_to_ext); for (iService = 0; iService < maxtoprint; iService++) - lp_dump_one(f, show_defaults, iService); + lp_dump_one(f, show_defaults, iService, dos_to_ext); } /*************************************************************************** Display the contents of one service in human-readable form. ***************************************************************************/ -void lp_dump_one(FILE * f, BOOL show_defaults, int snum) +void lp_dump_one(FILE * f, BOOL show_defaults, int snum, char *(*dos_to_ext)(char *, BOOL)) { if (VALID(snum)) { if (iSERVICE(snum).szService[0] == '\0') return; - dump_a_service(pSERVICE(snum), f); + dump_a_service(pSERVICE(snum), f, dos_to_ext); } } |