/*
- * "$Id: client.c 6799 2007-08-15 19:33:36Z mike $"
+ * "$Id: client.c 6999 2007-09-28 19:46:53Z mike $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
snprintf(filename, len, "%s%s", ServerRoot, con->uri + 11);
else if (!strncmp(con->uri, "/admin/log/", 11))
{
- if (!strcmp(con->uri + 11, "access_log") && AccessLog[0] == '/')
+ if (!strncmp(con->uri + 11, "access_log", 10) && AccessLog[0] == '/')
strlcpy(filename, AccessLog, len);
- else if (!strcmp(con->uri + 11, "error_log") && ErrorLog[0] == '/')
+ else if (!strncmp(con->uri + 11, "error_log", 9) && ErrorLog[0] == '/')
strlcpy(filename, ErrorLog, len);
- else if (!strcmp(con->uri + 11, "page_log") && PageLog[0] == '/')
+ else if (!strncmp(con->uri + 11, "page_log", 8) && PageLog[0] == '/')
strlcpy(filename, PageLog, len);
else
return (NULL);
script_name[1024], /* SCRIPT_NAME environment variable */
server_name[1024], /* SERVER_NAME environment variable */
server_port[1024]; /* SERVER_PORT environment variable */
+ ipp_attribute_t *attr; /* attributes-natural-language attribute */
/*
else
auth_type[0] = '\0';
- if (con->language)
- snprintf(lang, sizeof(lang), "LANG=%s.UTF-8", con->language->language);
+ if (con->request &&
+ (attr = ippFindAttribute(con->request, "attributes-natural-language",
+ IPP_TAG_LANGUAGE)) != NULL)
+ {
+ switch (strlen(attr->values[0].string.text))
+ {
+ default :
+ /*
+ * This is an unknown or badly formatted language code; use
+ * the POSIX locale...
+ */
+
+ strcpy(lang, "LANG=C");
+ break;
+
+ case 2 :
+ /*
+ * Just the language code (ll)...
+ */
+
+ snprintf(lang, sizeof(lang), "LANG=%s.UTF8",
+ attr->values[0].string.text);
+ break;
+
+ case 5 :
+ /*
+ * Language and country code (ll-cc)...
+ */
+
+ snprintf(lang, sizeof(lang), "LANG=%c%c_%c%c.UTF8",
+ attr->values[0].string.text[0],
+ attr->values[0].string.text[1],
+ toupper(attr->values[0].string.text[3] & 255),
+ toupper(attr->values[0].string.text[4] & 255));
+ break;
+ }
+ }
+ else if (con->language)
+ snprintf(lang, sizeof(lang), "LANG=%s.UTF8", con->language->language);
else
strcpy(lang, "LANG=C");
/*
- * End of "$Id: client.c 6799 2007-08-15 19:33:36Z mike $".
+ * End of "$Id: client.c 6999 2007-09-28 19:46:53Z mike $".
*/