From 077c41cc60316c44d2f3f85e14fe15acd22ccc1f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Oct 2000 23:35:55 +0000 Subject: Fix for printf attribute from Mattias Gronlund Added "codepage directory" patch from Peter.Polkinghorne@brunel.ac.uk Jeremy. (This used to be commit e49566c2e21fcd16980e5110495645c5ae5a36da) --- source3/include/debug.h | 4 ++-- source3/include/proto.h | 1 + source3/include/smb.h | 4 ++-- source3/lib/charset.c | 8 ++++---- source3/param/loadparm.c | 4 ++++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source3/include/debug.h b/source3/include/debug.h index e59a45cba1..3130bc379d 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -40,12 +40,12 @@ #ifdef HAVE_STDARG_H int Debug1( char *, ... ) #ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) + __attribute__ ((format (__printf__, 1, 2))) #endif ; BOOL dbgtext( char *, ... ) #ifdef __GNUC__ - __attribute__ ((format (printf, 1, 2))) + __attribute__ ((format (__printf__, 1, 2))) #endif ; #else diff --git a/source3/include/proto.h b/source3/include/proto.h index b29e3aa788..c1c1cd8e35 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1370,6 +1370,7 @@ char *lp_winbind_gid(void); char *lp_template_homedir(void); char *lp_template_shell(void); char *lp_winbind_separator(void); +char *lp_codepagedir(void); char *lp_ldap_server(void); char *lp_ldap_suffix(void); char *lp_ldap_filter(void); diff --git a/source3/include/smb.h b/source3/include/smb.h index 4d4aef088e..1bc1d3fba4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1286,7 +1286,7 @@ struct bitmap { #ifdef HAVE_STDARG_H int slprintf(char *str, int n, char *format, ...) #ifdef __GNUC__ - __attribute__ ((format (printf, 3, 4))) + __attribute__ ((format (__printf__, 3, 4))) #endif ; #else @@ -1296,7 +1296,7 @@ int slprintf(); #ifdef HAVE_STDARG_H int fdprintf(int fd, char *format, ...) #ifdef __GNUC__ - __attribute__ ((format (printf, 2, 3))) + __attribute__ ((format (__printf__, 2, 3))) #endif ; #else diff --git a/source3/lib/charset.c b/source3/lib/charset.c index 3d081246fd..fcaca79b88 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -195,13 +195,13 @@ static codepage_p load_client_codepage( int client_codepage ) DEBUG(5, ("load_client_codepage: loading codepage %d.\n", client_codepage)); - if(strlen(CODEPAGEDIR) + 14 > sizeof(codepage_file_name)) + if(strlen(lp_codepagedir()) + 14 > sizeof(codepage_file_name)) { DEBUG(0,("load_client_codepage: filename too long to load\n")); return NULL; } - pstrcpy(codepage_file_name, CODEPAGEDIR); + pstrcpy(codepage_file_name, lp_codepagedir()); pstrcat(codepage_file_name, "/"); pstrcat(codepage_file_name, "codepage."); slprintf(&codepage_file_name[strlen(codepage_file_name)], @@ -348,13 +348,13 @@ void codepage_initialise(int client_codepage) #ifdef KANJI DEBUG(6,("codepage_initialise: loading dynamic codepage file %s/codepage.%d \ for code page %d failed. Using default client codepage 932\n", - CODEPAGEDIR, client_codepage, client_codepage)); + lp_codepagedir(), client_codepage, client_codepage)); cp = cp_932; client_codepage = KANJI_CODEPAGE; #else /* KANJI */ DEBUG(6,("codepage_initialise: loading dynamic codepage file %s/codepage.%d \ for code page %d failed. Using default client codepage 850\n", - CODEPAGEDIR, client_codepage, client_codepage)); + lp_codepagedir(), client_codepage, client_codepage)); cp = cp_850; client_codepage = MSDOS_LATIN_1_CODEPAGE; #endif /* KANJI */ diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 525c1931cc..452c207dfb 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -135,6 +135,7 @@ typedef struct char *szGroupnameMap; #endif /* USING_GROUPNAME_MAP */ char *szCharacterSet; + char *szCodePageDir; char *szLogonScript; char *szLogonPath; char *szLogonDrive; @@ -627,6 +628,7 @@ static struct parm_struct parm_table[] = { {"coding system", P_STRING, P_GLOBAL, &Globals.szCodingSystem, handle_coding_system, NULL, 0}, {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, handle_client_code_page, NULL, 0}, + {"code page directory", P_STRING, P_GLOBAL, &Globals.szCodePageDir, NULL, NULL, 0}, {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT | FLAG_DOS_STRING}, {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT | FLAG_DOS_STRING}, {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_DOS_STRING}, @@ -1136,6 +1138,7 @@ static void init_globals(void) string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile"); string_set(&Globals.szNameResolveOrder, "lmhosts host wins bcast"); + string_set(&Globals.szCodePageDir, CODEPAGEDIR); Globals.bLoadPrinters = True; Globals.bUseRhosts = False; @@ -1384,6 +1387,7 @@ FN_GLOBAL_STRING(lp_winbind_gid, &Globals.szWinbindGID) FN_GLOBAL_STRING(lp_template_homedir, &Globals.szTemplateHomedir) FN_GLOBAL_STRING(lp_template_shell, &Globals.szTemplateShell) FN_GLOBAL_STRING(lp_winbind_separator, &Globals.szWinbindSeparator) +FN_GLOBAL_STRING(lp_codepagedir,&Globals.szCodePageDir) #ifdef WITH_LDAP FN_GLOBAL_STRING(lp_ldap_server, &Globals.szLdapServer); FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix); -- cgit