comparison mcabber/src/help.c @ 882:c3c2f7a0c5d5

autoconf: use datadir, not datarootdir Fix changeset b38760d9ec2d, I didn't see there was a datadir variable.
author Mikael Berthe <mikael@lilotux.net>
date Sat, 27 May 2006 18:53:56 +0200
parents b38760d9ec2d
children 94bb9e40e40b
comparison
equal deleted inserted replaced
881:618967a008a2 882:c3c2f7a0c5d5
33 33
34 // get_lang() 34 // get_lang()
35 // Return the language code string (a 2-letters string). 35 // Return the language code string (a 2-letters string).
36 static const char *get_lang(void) { 36 static const char *get_lang(void) {
37 static const char *lang_str = DEFAULT_LANG; 37 static const char *lang_str = DEFAULT_LANG;
38 #ifdef DATA_ROOT_DIR 38 #ifdef DATA_DIR
39 static char lang[3]; 39 static char lang[3];
40 const char *opt_l; 40 const char *opt_l;
41 opt_l = settings_opt_get("lang"); 41 opt_l = settings_opt_get("lang");
42 if (opt_l && strlen(opt_l) == 2 && isalpha(opt_l[0]) && isalpha(opt_l[1])) { 42 if (opt_l && strlen(opt_l) == 2 && isalpha(opt_l[0]) && isalpha(opt_l[1])) {
43 strncpy(lang, opt_l, sizeof(lang)); 43 strncpy(lang, opt_l, sizeof(lang));
44 mc_strtolower(lang); 44 mc_strtolower(lang);
45 lang_str = lang; 45 lang_str = lang;
46 } 46 }
47 #endif /* DATA_ROOT_DIR */ 47 #endif /* DATA_DIR */
48 return lang_str; 48 return lang_str;
49 } 49 }
50 50
51 // help_process(string) 51 // help_process(string)
52 // Display help about the "string" command. 52 // Display help about the "string" command.
53 // If string is null, display general help. 53 // If string is null, display general help.
54 // Return 0 in case of success. 54 // Return 0 in case of success.
55 int help_process(char *string) 55 int help_process(char *string)
56 { 56 {
57 #ifndef DATA_ROOT_DIR 57 #ifndef DATA_DIR
58 scr_LogPrint(LPRINT_NORMAL, "Help isn't available."); 58 scr_LogPrint(LPRINT_NORMAL, "Help isn't available.");
59 return -1; 59 return -1;
60 #else 60 #else
61 const char *lang; 61 const char *lang;
62 FILE *fp; 62 FILE *fp;
73 } 73 }
74 } 74 }
75 75
76 // Look for help file 76 // Look for help file
77 lang = get_lang(); 77 lang = get_lang();
78 helpfiles_dir = g_strdup_printf("%s/mcabber/help", DATA_ROOT_DIR); 78 helpfiles_dir = g_strdup_printf("%s/mcabber/help", DATA_DIR);
79 if (string && *string) { 79 if (string && *string) {
80 p = g_strdup(string); 80 p = g_strdup(string);
81 mc_strtolower(p); 81 mc_strtolower(p);
82 filename = g_strdup_printf("%s/%s/hlp_%s.txt", helpfiles_dir, lang, p); 82 filename = g_strdup_printf("%s/%s/hlp_%s.txt", helpfiles_dir, lang, p);
83 g_free(p); 83 g_free(p);
107 } 107 }
108 fclose(fp); 108 fclose(fp);
109 g_free(data); 109 g_free(data);
110 110
111 return 0; 111 return 0;
112 #endif /* DATA_ROOT_DIR */ 112 #endif /* DATA_DIR */
113 } 113 }
114 114
115 115
116 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ 116 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */