* Constants...
*/
-# define _PPD_CACHE_VERSION 12 /* Version number in cache file */
+# define _PPD_CACHE_VERSION 13 /* Version number in cache file */
/*
extern int _cups_strcasecmp(const char *, const char *) _CUPS_PRIVATE;
extern int _cups_strncasecmp(const char *, const char *, size_t n) _CUPS_PRIVATE;
-extern int _cupsArrayStrcasecmp(const char *s, const char *t, void *data) _CUPS_PRIVATE;
-extern int _cupsArrayStrcmp(const char *s1, const char *s2, void *data) _CUPS_PRIVATE;
-extern char *_cupsArrayStrdup(const char *element, void *data) _CUPS_PRIVATE;
-extern void _cupsArrayFree(void *element, void *data) _CUPS_PRIVATE;
+extern int _cupsArrayStrcasecmp(const char *s, const char *t, void *data) _CUPS_PRIVATE;
+extern int _cupsArrayStrcmp(const char *s1, const char *s2, void *data) _CUPS_PRIVATE;
+extern char *_cupsArrayStrdup(const char *element, void *data) _CUPS_PRIVATE;
+extern void _cupsArrayFree(void *element, void *data) _CUPS_PRIVATE;
extern char *_cupsStrAlloc(const char *s) _CUPS_PRIVATE;
extern char *_cupsStrDate(char *buf, size_t bufsize, time_t timeval) _CUPS_PRIVATE;
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>Group </strong><em>group-name-or-number</em><br>
Specifies the group name or ID that will be used when executing external programs.
The default group is operating system specific but is usually "lp" or "nobody".
+</p>
+ <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>Languages </strong><em>LOCALE ... LOCALE</em><br>
+Lists the language locales that should be supported by the server.
+The default is English ("en") and the current system locale (if not English).
</p>
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>LogFileGroup </strong><em>group-name-or-number</em><br>
Specifies the group name or ID that will be used for log files.
.\" Licensed under Apache License v2.0. See the file "LICENSE" for more
.\" information.
.\"
-.TH cups-files.conf 5 "CUPS" "2021-03-06" "OpenPrinting"
+.TH cups-files.conf 5 "CUPS" "2024-04-16" "OpenPrinting"
.SH NAME
cups\-files.conf \- file and directory configuration file for cups
.SH DESCRIPTION
\fBGroup \fIgroup-name-or-number\fR
Specifies the group name or ID that will be used when executing external programs.
The default group is operating system specific but is usually "lp" or "nobody".
+.\"#Languages
+.TP 5
+\fBLanguages \fILOCALE ... LOCALE\fR
+Lists the language locales that should be supported by the server.
+The default is English ("en") and the current system locale (if not English).
.\"#LogFileGroup
.TP 5
\fBLogFileGroup \fIgroup-name-or-number\fR
char strings_file[1024]; // Strings file
+ // Make sure the strings directory is there...
+ if (cupsdCheckPermissions(ServerRoot, "strings", 0755, RunUser, Group, /*is_dir*/1, /*create_dir*/1) < 0)
+ return;
+
// Save each language...
for (lang = Languages; lang; lang = lang->next)
{
snprintf(strings_file, sizeof(strings_file), "%s/strings/%s.strings", ServerRoot, lang->language);
- _cupsMessageSave(strings_file, _CUPS_MESSAGE_STRINGS, lang->strings);
+
+ if (_cupsMessageSave(strings_file, _CUPS_MESSAGE_STRINGS, lang->strings))
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to save '%s': %s", strings_file, strerror(errno));
}
}
* information.
*/
-
-/*
- * Include necessary headers.
- */
-
#include <cups/cups-private.h>
#include <cups/file-private.h>
#include <cups/ppd-private.h>
/* server.c */
extern void cupsdStartServer(void);
extern void cupsdStopServer(void);
-
-extern int _cupsArrayStrcmp(const char *s1, const char *s2, void *data);
-extern char *_cupsArrayStrdup(const char *element, void *data);
-extern void _cupsArrayFree(void *element, void *data);
cupsdClearString(&p->port_monitor);
cupsdClearString(&p->op_policy);
cupsdClearString(&p->error_policy);
- cupsdClearString(&p->strings);
cupsdClearString(&p->alert);
cupsdClearString(&p->alert_description);
char cache_name[1024]; /* Cache filename */
struct stat cache_info; /* Cache file info */
struct stat conf_info; /* cupsd.conf file info */
+ struct stat files_info; /* cups-files.conf file info */
ppd_file_t *ppd; /* PPD file */
char ppd_name[1024]; /* PPD filename */
struct stat ppd_info; /* PPD file info */
if (stat(ConfigurationFile, &conf_info))
conf_info.st_mtime = 0;
+ if (stat(CupsFilesFile, &files_info))
+ files_info.st_mtime = 0;
+
snprintf(cache_name, sizeof(cache_name), "%s/%s.data", CacheDir, p->name);
if (stat(cache_name, &cache_info))
cache_info.st_mtime = 0;
_ppdCacheDestroy(p->pc);
p->pc = NULL;
- if (cache_info.st_mtime >= ppd_info.st_mtime && cache_info.st_mtime >= conf_info.st_mtime)
+ if (cache_info.st_mtime >= ppd_info.st_mtime && cache_info.st_mtime >= conf_info.st_mtime && cache_info.st_mtime >= files_info.st_mtime)
{
cupsdLogMessage(CUPSD_LOG_DEBUG, "load_ppd: Loading %s...", cache_name);
* Loaded successfully!
*/
- /*
- * Set `strings` (source for printer-strings-uri IPP attribute)
- * if printer's .strings file with localization exists.
- */
-
- if (!access(strings_name, R_OK))
- cupsdSetString(&p->strings, strings_name);
- else
- cupsdClearString(&p->strings);
-
return;
}
}
if (!p->pc)
cupsdLogMessage(CUPSD_LOG_WARN, "Unable to create cache of \"%s\": %s", ppd_name, cupsGetErrorString());
- cupsdWriteStrings();
+ cupsdMarkDirty(CUPSD_DIRTY_STRINGS);
ppdMarkDefaults(ppd);
*info, /* Description */
*organization, /* Organization name */
*organizational_unit, /* Organizational unit (department, etc.) */
- *strings, /* Strings file, if any */
*op_policy, /* Operation policy name */
*error_policy; /* Error policy */
cupsd_policy_t *op_policy_ptr; /* Pointer to operation policy */
if (DirtyFiles & CUPSD_DIRTY_SUBSCRIPTIONS)
cupsdSaveAllSubscriptions();
+ if (DirtyFiles & CUPSD_DIRTY_STRINGS)
+ cupsdWriteStrings();
+
DirtyFiles = CUPSD_DIRTY_NONE;
DirtyCleanTime = 0;
#define CUPSD_DIRTY_PRINTCAP 4 /* printcap is dirty */
#define CUPSD_DIRTY_JOBS 8 /* jobs.cache or "c" file(s) are dirty */
#define CUPSD_DIRTY_SUBSCRIPTIONS 16 /* subscriptions.conf is dirty */
+#define CUPSD_DIRTY_STRINGS 32 /* The .strings files are dirty */
/*