[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r830 - GNUnet/src/conf
From: |
durner |
Subject: |
[GNUnet-SVN] r830 - GNUnet/src/conf |
Date: |
Mon, 30 May 2005 12:42:00 -0700 (PDT) |
Author: durner
Date: 2005-05-30 12:41:29 -0700 (Mon, 30 May 2005)
New Revision: 830
Modified:
GNUnet/src/conf/conf.c
GNUnet/src/conf/gconf.c
GNUnet/src/conf/lex.zconf.c
GNUnet/src/conf/mconf.c
GNUnet/src/conf/qconf.cc
GNUnet/src/conf/wizard.c
GNUnet/src/conf/wizard_curs.c
GNUnet/src/conf/zconf.l
Log:
support for localized config templates
Modified: GNUnet/src/conf/conf.c
===================================================================
--- GNUnet/src/conf/conf.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/conf.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -486,8 +486,6 @@
{
int i = 1;
struct stat tmpstat;
- const char * LANG;
- char * configFile;
if (ac > i && av[i][0] == '-') {
switch (av[i++][1]) {
@@ -530,22 +528,7 @@
}
}
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2))
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
- DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
- LANG,
- 2);
- }
-
- conf_parse(configFile);
+ conf_parse(DATADIR"/config.in");
switch (input_mode) {
case set_default:
Modified: GNUnet/src/conf/gconf.c
===================================================================
--- GNUnet/src/conf/gconf.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/gconf.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -1692,8 +1692,6 @@
int gconf_main(int ac, char *av[])
{
- const char * LANG;
- char * configFile;
struct menu *root;
#ifndef LKC_DIRECT_LINK
@@ -1728,26 +1726,11 @@
}
}
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2) == 0)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
-
DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
-
LANG,
-
2);
- }
-
/* This configurator is also called from the wizard configurator.
* Check whether the templates are already parsed. */
root = menu_get_root_menu(NULL);
if (!(root && root->prompt))
- conf_parse(configFile);
+ conf_parse(DATADIR"/config.in");
fixup_rootmenu(&rootmenu);
conf_read(NULL);
Modified: GNUnet/src/conf/lex.zconf.c
===================================================================
--- GNUnet/src/conf/lex.zconf.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/lex.zconf.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -3586,26 +3586,19 @@
}
/*
- * Try to open specified file with following names:
- * ./name
- * $(srctree)/name
- * The latter is used when srctree is separate from objtree
- * when compiling the kernel.
+ * Try to open specified file with $LANG appended
* Return NULL if file is not found.
*/
FILE *zconf_fopen(const char *name)
{
- char *env, fullname[PATH_MAX+1];
+ char configFile[PATH_MAX+1], lang[3];
FILE *f;
-
- f = FOPEN(name, "r");
- if (!f && name[0] != DIR_SEPARATOR) {
- env = getenv(SRCTREE);
- if (env) {
- sprintf(fullname, "%s/%s", env, name);
- f = FOPEN(fullname, "r");
- }
- }
+
+ strlcpy(lang, getenv("LANG"), 3);
+ snprintf(configFile, PATH_MAX + 1, "%s.%s", name, lang);
+ if (!(f = FOPEN(configFile, "r")))
+ f = FOPEN(name, "r");
+
return f;
}
Modified: GNUnet/src/conf/mconf.c
===================================================================
--- GNUnet/src/conf/mconf.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/mconf.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -821,30 +821,13 @@
{
char *mode;
int stat;
- const char * LANG;
- char * configFile;
struct menu *root;
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2) == 0)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
- DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
- LANG,
- 2);
- }
-
/* This configurator is also called from the wizard configurator.
* Check whether the templates are already parsed. */
root = menu_get_root_menu(NULL);
if (!(root && root->prompt))
- conf_parse(configFile);
+ conf_parse(DATADIR"/config.in");
conf_read(NULL);
Modified: GNUnet/src/conf/qconf.cc
===================================================================
--- GNUnet/src/conf/qconf.cc 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/qconf.cc 2005-05-30 19:41:29 UTC (rev 830)
@@ -1268,8 +1268,6 @@
int qconf_main(int ac, char** av)
{
ConfigMainWindow* v;
- const char * LANG;
- char * configFile;
#ifndef LKC_DIRECT_LINK
kconfig_load();
@@ -1288,24 +1286,8 @@
}
}
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2) == 0)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
- DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
- LANG,
- 2);
- }
+ conf_parse(DATADIR"/config.in");
- conf_parse(configFile);
- FREE(configFile);
-
fixup_rootmenu(&rootmenu);
conf_read(NULL);
//zconfdump(stdout);
Modified: GNUnet/src/conf/wizard.c
===================================================================
--- GNUnet/src/conf/wizard.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/wizard.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -245,9 +245,6 @@
int
wizard_main (int argc, char *argv[])
{
- const char * LANG;
- char * configFile;
-
#ifdef ENABLE_NLS
/* GTK uses UTF-8 encoding */
bind_textdomain_codeset(PACKAGE, "UTF-8");
@@ -260,23 +257,8 @@
gtk_set_locale ();
gtk_init (&argc, &argv);
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2) == 0)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
- DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
- LANG,
- 2);
- }
-
- conf_parse(configFile);
-
+ conf_parse(DATADIR"/config.in");
+
conf_read(NULL);
curwnd = create_assi_step1 ();
Modified: GNUnet/src/conf/wizard_curs.c
===================================================================
--- GNUnet/src/conf/wizard_curs.c 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/wizard_curs.c 2005-05-30 19:41:29 UTC (rev 830)
@@ -59,29 +59,12 @@
int wizard_curs_main(int argc, char *argv[])
{
- const char * LANG;
- char * configFile;
void *active_ptr = NULL;
int idx, ret, autostart = 0, adv = 0;
struct symbol *sym;
char *defval, *user_name = NULL, *group_name = NULL;
- LANG = getenv("LANG");
- if (LANG == NULL)
- LANG = "en";
- if (strncmp(LANG, "en", 2) == 0)
- LANG = NULL;
- configFile = MALLOC(strlen(DATADIR"/config.in") + 4);
- strcpy(configFile,
- DATADIR"/config.in");
- if (LANG != NULL) {
- strcat(configFile, ".");
- strncat(configFile,
- LANG,
- 2);
- }
-
- conf_parse(configFile);
+ conf_parse(DATADIR"/config.in");
conf_read(NULL);
Modified: GNUnet/src/conf/zconf.l
===================================================================
--- GNUnet/src/conf/zconf.l 2005-05-30 19:40:10 UTC (rev 829)
+++ GNUnet/src/conf/zconf.l 2005-05-30 19:41:29 UTC (rev 830)
@@ -263,26 +263,19 @@
/*
- * Try to open specified file with following names:
- * ./name
- * $(srctree)/name
- * The latter is used when srctree is separate from objtree
- * when compiling the kernel.
+ * Try to open specified file with $LANG appended
* Return NULL if file is not found.
*/
FILE *zconf_fopen(const char *name)
{
- char *env, fullname[PATH_MAX+1];
+ char configFile[PATH_MAX+1], lang[3];
FILE *f;
-
- f = FOPEN(name, "r");
- if (!f && name[0] != DIR_SEPARATOR) {
- env = getenv(SRCTREE);
- if (env) {
- sprintf(fullname, "%s/%s", env, name);
- f = FOPEN(fullname, "r");
- }
- }
+
+ strlcpy(lang, getenv("LANG"), 3);
+ snprintf(configFile, PATH_MAX + 1, "%s.%s", name, lang);
+ if (!(f = FOPEN(configFile, "r")))
+ f = FOPEN(name, "r");
+
return f;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r830 - GNUnet/src/conf,
durner <=