ALT Linux repositórios
S: | 2.4.7-alt1 |
5.0: | 1.3.10-alt1 |
4.1: | 1.3.10-alt0.M41.4 |
+updates: | 1.3.9-alt1.M41.1 |
4.0: | 1.2.12-alt6.M40.9 |
+updates: | 1.2.12-alt6.M40.8 |
3.0: | 1.1.20-alt14.1 |
Group :: Sistema/Servidores
RPM: cups
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: ALT-1.7.0-docroot-i18n.patch
Download
Download
diff --git a/cgi-bin/help.c b/cgi-bin/help.c
index 75f70d9..ac71b7a 100644
--- a/cgi-bin/help.c
+++ b/cgi-bin/help.c
@@ -38,7 +38,8 @@ main(int argc, /* I - Number of command-line arguments */
int i; /* Looping var */
const char *query; /* Search query */
const char *cache_dir; /* CUPS_CACHEDIR environment variable */
- const char *docroot; /* CUPS_DOCROOT environment variable */
+ const char *docroot_env; /* CUPS_DOCROOT environment variable */
+ char docroot[1024];
const char *helpfile, /* Current help file */
*helptitle = NULL; /* Current help title */
const char *topic; /* Current topic */
@@ -49,6 +50,7 @@ main(int argc, /* I - Number of command-line arguments */
cups_file_t *fp; /* Help file */
char line[1024]; /* Line from file */
int printable; /* Show printable version? */
+ char *locale = NULL;
/*
@@ -75,8 +77,24 @@ main(int argc, /* I - Number of command-line arguments */
snprintf(filename, sizeof(filename), "%s/help.index", cache_dir);
- if ((docroot = getenv("CUPS_DOCROOT")) == NULL)
- docroot = CUPS_DOCROOT;
+ if ((docroot_env = getenv("CUPS_DOCROOT")) == NULL)
+ docroot_env = CUPS_DOCROOT;
+
+ if(getenv("LANG"))
+ {
+ snprintf(docroot, sizeof(docroot), "%s.%s", docroot_env, getenv("LANG"));
+ locale=docroot+strlen(docroot_env)+1;
+ if(access(docroot,R_OK|X_OK))
+ if(strrchr(locale, '.'))
+ *strrchr(locale, '.')='\0';
+ if(access(docroot,R_OK|X_OK))
+ if(strrchr(locale, '_'))
+ *strrchr(locale, '_')='\0';
+ if(access(docroot,R_OK|X_OK))
+ locale=NULL;
+ }
+ if(locale == NULL)
+ snprintf(docroot, sizeof(docroot), "%s", docroot_env);
snprintf(directory, sizeof(directory), "%s/help", docroot);