From d6ae789d922e30aa25c55e01e1523d451be2016b Mon Sep 17 00:00:00 2001 From: jlovell Date: Tue, 4 Apr 2006 20:09:25 +0000 Subject: [PATCH] Load cups into easysw/current. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@113 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 38 ++++++- berkeley/lpq.c | 66 ++++++++---- cgi-bin/admin.c | 16 ++- cgi-bin/template.c | 6 +- config-scripts/cups-common.m4 | 9 +- cups/Makefile | 10 +- cups/auth.c | 10 +- cups/dest.c | 14 ++- cups/globals.c | 20 ++-- cups/globals.h | 15 +-- cups/http-addrlist.c | 8 +- cups/http-support.c | 10 +- cups/i18n.h | 6 +- cups/language.c | 104 +++++++++++++----- cups/request.c | 77 ++++++------- cups/string.c | 118 +++++++++++++++----- cups/string.h | 5 +- cups/testhttp.c | 6 +- cups/transcode.c | 197 +++++++++++++++++++++++++--------- desktop/cups.desktop | 2 + doc/es/index.html.in | 2 +- filter/Makefile | 10 +- filter/pstops.c | 43 ++++++-- locale/cups_es.po | 60 ++++++++--- locale/cups_ja.po | 52 ++++++--- packaging/cups.list.in | 8 +- packaging/cups.spec.in | 32 ++++-- scheduler/client.c | 38 +++++-- scheduler/conf.c | 28 +++-- scheduler/dirsvc.c | 20 +++- templates/es/trailer.tmpl | 2 +- tools/listpublic | 12 +++ 32 files changed, 750 insertions(+), 294 deletions(-) create mode 100755 tools/listpublic diff --git a/CHANGES.txt b/CHANGES.txt index 50e084f3c..dd1be6a43 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,42 @@ -CHANGES.txt - 2006-03-24 +CHANGES.txt - 2006-04-03 ------------------------ +CHANGES IN CUPS V1.2 + + - The PostScript filter now handles files that start with + an incomplete PJL header (PR #6076) + - The web interface language selection code did not try + the generic language localization (STR #1531) + - The language cache, string pool, and transcoding caches + are now process global instead of per-thread to avoid + problems with GNOME and to allow for data sharing + between threads (STR #1530) + - Fixed a CUPS 1.1.x compatibility bug (STR #1528) + - The web interface redirection after certain printer + administration tasks was broken (STR #1516) + - Web interface authorization could get stuck (STR #1512) + - Localization updates (STR #1513, STR #1518, STR #1520) + - The pstops filter didn't work with some files (STR + #1523) + - "./configure --enable-static" didn't work (STR #1522) + - The scheduler was not using the configured default + Group (STR #1521) + - The web interface still did not show the localized time + and date for some locales and systems (STR #1509) + - httpAddrGetList() would crash on systems without + getaddrinfo(). + - Socket URIs without a trailing slash would cause the + port number to not be accepted (STR #1519) + - Local raw and System V printers were not advertised as + such for printer browsing (STR #1502) + - The RPM spec file incorrectly put duplicate copies of + the Japanese and Spanish web interface templates in the + main cups package (STR #1517) + - cupsSetDests() did not explicitly set the permissions + of the /etc/cups/lpoptions file (STR #1508) + - The lpq command crashed with the -h option (STR #1515) + + CHANGES IN CUPS V1.2rc1 - Documentation updates (STR #1497, STR #1498) diff --git a/berkeley/lpq.c b/berkeley/lpq.c index d1d06db1d..8040340a7 100644 --- a/berkeley/lpq.c +++ b/berkeley/lpq.c @@ -1,5 +1,5 @@ /* - * "$Id: lpq.c 5023 2006-01-29 14:39:44Z mike $" + * "$Id: lpq.c 5345 2006-03-28 16:00:17Z mike $" * * "lpq" command for the Common UNIX Printing System (CUPS). * @@ -49,6 +49,7 @@ * Local functions... */ +static http_t *connect_server(const char *, http_t *); static int show_jobs(const char *, http_t *, const char *, const char *, const int, const int); static void show_printer(const char *, http_t *, const char *); @@ -76,35 +77,23 @@ main(int argc, /* I - Number of command-line arguments */ int num_dests; /* Number of destinations */ cups_dest_t *dests; /* Destinations */ cups_lang_t *language; /* Language */ -#ifdef HAVE_SSL - http_encryption_t encryption; /* Encryption? */ -#endif /* HAVE_SSL */ - language = cupsLangDefault(); - /* - * Connect to the scheduler... - */ - - if ((http = httpConnectEncrypt(cupsServer(), ippPort(), - cupsEncryption())) == NULL) - { - _cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]); - return (1); - } /* * Check for command-line options... */ + http = NULL; dest = NULL; user = NULL; id = 0; interval = 0; longstatus = 0; all = 0; - num_dests = cupsGetDests(&dests); + language = cupsLangDefault(); + num_dests = 0; for (i = 1; i < argc; i ++) if (argv[i][0] == '+') @@ -115,10 +104,10 @@ main(int argc, /* I - Number of command-line arguments */ { case 'E' : /* Encrypt */ #ifdef HAVE_SSL - encryption = HTTP_ENCRYPT_REQUIRED; + cupsSetEncryption(HTTP_ENCRYPT_REQUIRED); if (http) - httpEncryption(http, encryption); + httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), @@ -166,6 +155,11 @@ main(int argc, /* I - Number of command-line arguments */ if ((instance = strchr(dest, '/')) != NULL) *instance++ = '\0'; + http = connect_server(argv[0], http); + + if (num_dests == 0) + num_dests = cupsGetDests2(http, &dests); + if (cupsGetDest(dest, instance, num_dests, dests) == NULL) { if (instance) @@ -186,8 +180,11 @@ main(int argc, /* I - Number of command-line arguments */ break; case 'h' : /* Connect to host */ - if (http != NULL) + if (http) + { httpClose(http); + http = NULL; + } if (argv[i][2] != '\0') cupsSetServer(argv[i] + 2); @@ -225,8 +222,13 @@ main(int argc, /* I - Number of command-line arguments */ else user = argv[i]; + http = connect_server(argv[0], http); + if (dest == NULL && !all) { + if (num_dests == 0) + num_dests = cupsGetDests2(http, &dests); + for (i = 0; i < num_dests; i ++) if (dests[i].is_default) dest = dests[i].name; @@ -294,6 +296,30 @@ main(int argc, /* I - Number of command-line arguments */ } +/* + * 'connect_server()' - Connect to the server as necessary... + */ + +static http_t * /* O - New HTTP connection */ +connect_server(const char *command, /* I - Command name */ + http_t *http) /* I - Current HTTP connection */ +{ + if (!http) + { + http = httpConnectEncrypt(cupsServer(), ippPort(), + cupsEncryption()); + + if (http == NULL) + { + _cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command); + exit(1); + } + } + + return (http); +} + + /* * 'show_jobs()' - Show jobs. */ @@ -651,5 +677,5 @@ usage(void) /* - * End of "$Id: lpq.c 5023 2006-01-29 14:39:44Z mike $". + * End of "$Id: lpq.c 5345 2006-03-28 16:00:17Z mike $". */ diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index e50a20797..a3d4d7f3b 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1,5 +1,5 @@ /* - * "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $" + * "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $" * * Administration CGI for the Common UNIX Printing System (CUPS). * @@ -132,12 +132,20 @@ main(int argc, /* I - Number of command-line arguments */ if (!strcmp(op, "redirect")) { const char *url; /* Redirection URL... */ + char prefix[1024]; /* URL prefix */ + if (getenv("HTTPS")) + snprintf(prefix, sizeof(prefix), "https://%s:%s", + getenv("SERVER_NAME"), getenv("SERVER_PORT")); + else + snprintf(prefix, sizeof(prefix), "http://%s:%s", + getenv("SERVER_NAME"), getenv("SERVER_PORT")); + if ((url = cgiGetVariable("URL")) != NULL) - printf("Location: %s\n\n", url); + printf("Location: %s%s\n\n", prefix, url); else - puts("Location: /admin\n"); + printf("Location: %s/admin\n\n", prefix); } else if (!strcmp(op, "start-printer")) do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer"))); @@ -2859,5 +2867,5 @@ match_string(const char *a, /* I - First string */ /* - * End of "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $". + * End of "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $". */ diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 774d7fe8f..229c599c3 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -1,5 +1,5 @@ /* - * "$Id: template.c 5113 2006-02-16 12:02:44Z mike $" + * "$Id: template.c 5352 2006-03-29 16:26:38Z mike $" * * CGI template function. * @@ -110,7 +110,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */ if ((lang = getenv("LANG")) != NULL) { for (i = 0; lang[i] && i < 15; i ++) - if (isalnum(lang[i] & 255)) + if (isalnum(lang[i] & 255) || lang[i] == '_') locale[i] = tolower(lang[i]); else if (lang[i] == '-') locale[i] = '_'; @@ -638,5 +638,5 @@ cgi_puts(const char *s, /* I - String to output */ /* - * End of "$Id: template.c 5113 2006-02-16 12:02:44Z mike $". + * End of "$Id: template.c 5352 2006-03-29 16:26:38Z mike $". */ diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index d726af567..0da11e4ea 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $" +dnl "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -79,9 +79,10 @@ fi dnl Static library option... INSTALLSTATIC="" -AC_ARG_ENABLE(install_static, [ --enable-static install static libraries, default=no]) +AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no]) -if test x$enable_install_static = xyes; then +if test x$enable_static = xyes; then + echo Installing static libraries... INSTALLSTATIC="installstatic" fi @@ -264,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT) dnl -dnl End of "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $". +dnl End of "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $". dnl diff --git a/cups/Makefile b/cups/Makefile index 92a78cfcc..5951bb125 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5303 2006-03-18 01:05:59Z mike $" +# "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $" # # API library Makefile for the Common UNIX Printing System (CUPS). # @@ -172,10 +172,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64) installstatic: $(INSTALL_DIR) -m 755 $(LIBDIR) - if test $(LIBCUPS) != "libcups.a"; then \ - $(INSTALL_LIB) libcups.a $(LIBDIR); \ - $(RANLIB) $(LIBDIR)/libcups.a; \ - fi + $(INSTALL_LIB) libcups.a $(LIBDIR) + $(RANLIB) $(LIBDIR)/libcups.a installhdrs: $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups @@ -443,5 +441,5 @@ include Dependencies # -# End of "$Id: Makefile 5303 2006-03-18 01:05:59Z mike $". +# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $". # diff --git a/cups/auth.c b/cups/auth.c index 681728fb3..1cf1ced72 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -1,5 +1,5 @@ /* - * "$Id: auth.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: auth.c 5359 2006-03-30 16:09:30Z mike $" * * Authentication functions for the Common UNIX Printing System (CUPS). * @@ -92,9 +92,13 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */ * See if we can do local authentication... */ - if (!cups_local_auth(http)) + if (http->digest_tries < 3 && !cups_local_auth(http)) { DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring)); + + if (http->status == HTTP_UNAUTHORIZED) + http->digest_tries ++; + return (0); } @@ -245,5 +249,5 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */ /* - * End of "$Id: auth.c 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: auth.c 5359 2006-03-30 16:09:30Z mike $". */ diff --git a/cups/dest.c b/cups/dest.c index 81e02faf8..a91e39847 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1,5 +1,5 @@ /* - * "$Id: dest.c 5182 2006-02-26 04:10:27Z mike $" + * "$Id: dest.c 5346 2006-03-28 16:05:19Z mike $" * * User-defined destination (and option) support for the Common UNIX * Printing System (CUPS). @@ -531,6 +531,16 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */ return (-1); } +#ifndef WIN32 + /* + * Set the permissions to 0644 when saving to the /etc/cups/lpoptions + * file... + */ + + if (!getuid()) + fchmod(fileno(fp), 0644); +#endif /* !WIN32 */ + /* * Write each printer; each line looks like: * @@ -998,5 +1008,5 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ /* - * End of "$Id: dest.c 5182 2006-02-26 04:10:27Z mike $". + * End of "$Id: dest.c 5346 2006-03-28 16:05:19Z mike $". */ diff --git a/cups/globals.c b/cups/globals.c index 61f44ce1b..65427b4f0 100644 --- a/cups/globals.c +++ b/cups/globals.c @@ -1,5 +1,5 @@ /* - * "$Id: globals.c 5319 2006-03-21 15:28:29Z mike $" + * "$Id: globals.c 5366 2006-04-02 16:11:04Z mike $" * * Global variable access routines for the Common UNIX Printing System (CUPS). * @@ -37,6 +37,7 @@ #include "http-private.h" #include "globals.h" +#include "debug.h" #include @@ -101,6 +102,8 @@ _cupsGlobals(void) * Initialize the global data exactly once... */ + DEBUG_printf(("_cupsGlobals(): globals_key_once=%d\n", globals_key_once)); + pthread_once(&globals_key_once, globals_init); /* @@ -109,6 +112,8 @@ _cupsGlobals(void) if ((globals = (_cups_globals_t *)pthread_getspecific(globals_key)) == NULL) { + DEBUG_puts("_cupsGlobals: allocating memory for thread..."); + /* * No, allocate memory as set the pointer for the key... */ @@ -116,6 +121,8 @@ _cupsGlobals(void) globals = calloc(1, sizeof(_cups_globals_t)); pthread_setspecific(globals_key, globals); + DEBUG_printf((" globals=%p\n", globals)); + /* * Initialize variables that have non-zero values */ @@ -142,6 +149,9 @@ static void globals_init() { pthread_key_create(&globals_key, globals_destructor); + + DEBUG_printf(("globals_init(): globals_key=%x(%u)\n", globals_key, + globals_key)); } @@ -156,6 +166,8 @@ globals_destructor(void *value) /* I - Data to free */ _cups_globals_t *cg; /* Global data */ + DEBUG_printf(("globals_destructor(value=%p)\n", value)); + cg = (_cups_globals_t *)value; httpClose(cg->http); @@ -163,10 +175,6 @@ globals_destructor(void *value) /* I - Data to free */ for (i = 0; i < 3; i ++) cupsFileClose(cg->stdio_files[i]); - _cupsStrFlush(cg); - _cupsLangFlush(cg); - _cupsCharmapFlush(cg); - cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings); free(value); @@ -215,5 +223,5 @@ _cupsGlobals(void) /* - * End of "$Id: globals.c 5319 2006-03-21 15:28:29Z mike $". + * End of "$Id: globals.c 5366 2006-04-02 16:11:04Z mike $". */ diff --git a/cups/globals.h b/cups/globals.h index b78440bb1..819d2bd6f 100644 --- a/cups/globals.h +++ b/cups/globals.h @@ -1,5 +1,5 @@ /* - * "$Id: globals.h 5319 2006-03-21 15:28:29Z mike $" + * "$Id: globals.h 5366 2006-04-02 16:11:04Z mike $" * * Global variable definitions for the Common UNIX Printing System (CUPS). * @@ -95,7 +95,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ /* Unknown error statuses */ /* language.c */ - cups_lang_t *lang_cache; /* Language string cache */ cups_lang_t *lang_default; /* Default language */ # ifdef __APPLE__ # ifdef HAVE_CF_LOCALE_ID @@ -113,10 +112,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ /* tempfile.c */ char tempfile[1024]; /* cupsTempFd/File buffer */ - /* transcode.c */ - _cups_cmap_t *cmap_cache; /* SBCS Charmap Cache */ - _cups_vmap_t *vmap_cache; /* VBCS Charmap Cache */ - /* usersys.c */ http_encryption_t encryption; /* Encryption setting */ char user[65], /* User name */ @@ -134,9 +129,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ /* Default printer */ char ppd_filename[HTTP_MAX_URI]; /* PPD filename */ - - /* string.c */ - cups_array_t *stringpool; /* String pool */ } _cups_globals_t; @@ -144,12 +136,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ * Prototypes... */ -extern void _cupsCharmapFlush(_cups_globals_t *cg); extern const char *_cupsGetPassword(const char *prompt); extern _cups_globals_t *_cupsGlobals(void); -extern void _cupsLangFlush(_cups_globals_t *cg); extern void _cupsSetError(ipp_status_t status, const char *message); -extern void _cupsStrFlush(_cups_globals_t *cg); /* @@ -162,5 +151,5 @@ extern void _cupsStrFlush(_cups_globals_t *cg); #endif /* !_CUPS_GLOBALS_H_ */ /* - * End of "$Id: globals.h 5319 2006-03-21 15:28:29Z mike $". + * End of "$Id: globals.h 5366 2006-04-02 16:11:04Z mike $". */ diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index a6f06133e..4638fb84b 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -1,5 +1,5 @@ /* - * "$Id: http-addrlist.c 5103 2006-02-14 19:27:42Z mike $" + * "$Id: http-addrlist.c 5351 2006-03-29 15:36:15Z mike $" * * HTTP address list routines for the Common UNIX Printing System (CUPS). * @@ -411,7 +411,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p # ifdef AF_INET6 if (host->h_addrtype == AF_INET6) { - first->addr.ipv6.sin6_family = AF_INET6; + temp->addr.ipv6.sin6_family = AF_INET6; memcpy(&(temp->addr.ipv6), host->h_addr_list[i], sizeof(temp->addr.ipv6)); temp->addr.ipv6.sin6_port = htons(portnum); @@ -419,7 +419,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p else # endif /* AF_INET6 */ { - first->addr.ipv4.sin_family = AF_INET; + temp->addr.ipv4.sin_family = AF_INET; memcpy(&(temp->addr.ipv4), host->h_addr_list[i], sizeof(temp->addr.ipv4)); temp->addr.ipv4.sin_port = htons(portnum); @@ -593,5 +593,5 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p /* - * End of "$Id: http-addrlist.c 5103 2006-02-14 19:27:42Z mike $". + * End of "$Id: http-addrlist.c 5351 2006-03-29 15:36:15Z mike $". */ diff --git a/cups/http-support.c b/cups/http-support.c index ea5e06de1..72bd4bde2 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -1,5 +1,5 @@ /* - * "$Id: http-support.c 5149 2006-02-22 19:10:22Z mike $" + * "$Id: http-support.c 5360 2006-03-30 17:02:17Z mike $" * * HTTP support routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -1057,7 +1057,7 @@ httpSeparateURI( *port = strtol(uri + 1, (char **)&uri, 10); - if (*uri != '/') + if (*uri != '/' && *uri) { *port = 0; return (HTTP_URI_BAD_PORT); @@ -1141,6 +1141,10 @@ httpStatus(http_status_t status) /* I - HTTP status code */ return ("Accepted"); case HTTP_NO_CONTENT : return ("No Content"); + case HTTP_MOVED_PERMANENTLY : + return ("Moved Permanently"); + case HTTP_SEE_OTHER : + return ("See Other"); case HTTP_NOT_MODIFIED : return ("Not Modified"); case HTTP_BAD_REQUEST : @@ -1312,5 +1316,5 @@ http_copy_encode(char *dst, /* O - Destination buffer */ /* - * End of "$Id: http-support.c 5149 2006-02-22 19:10:22Z mike $". + * End of "$Id: http-support.c 5360 2006-03-30 17:02:17Z mike $". */ diff --git a/cups/i18n.h b/cups/i18n.h index 4d38ceece..58de0eae5 100644 --- a/cups/i18n.h +++ b/cups/i18n.h @@ -1,5 +1,5 @@ /* - * "$Id: i18n.h 5294 2006-03-15 21:09:32Z mike $" + * "$Id: i18n.h 5366 2006-04-02 16:11:04Z mike $" * * (Private) localization support for the Common UNIX Printing System (CUPS). * @@ -31,6 +31,7 @@ * Include necessary headers... */ +# include # include "transcode.h" # ifdef __cplusplus @@ -90,6 +91,7 @@ typedef struct _cups_vmap_s /**** VBCS Charmap Struct ****/ * Prototypes... */ +extern void _cupsCharmapFlush(void); extern void _cupsCharmapFree(const cups_encoding_t encoding); extern void *_cupsCharmapGet(const cups_encoding_t encoding); extern const char *_cupsEncodingName(cups_encoding_t encoding); @@ -111,5 +113,5 @@ extern const char *_cupsMessageLookup(cups_array_t *a, const char *m); #endif /* !_CUPS_I18N_H_ */ /* - * End of "$Id: i18n.h 5294 2006-03-15 21:09:32Z mike $". + * End of "$Id: i18n.h 5366 2006-04-02 16:11:04Z mike $". */ diff --git a/cups/language.c b/cups/language.c index d654b4c22..fa11f87cb 100644 --- a/cups/language.c +++ b/cups/language.c @@ -1,5 +1,5 @@ /* - * "$Id: language.c 5243 2006-03-08 02:29:48Z mike $" + * "$Id: language.c 5366 2006-04-02 16:11:04Z mike $" * * I18N/language support for the Common UNIX Printing System (CUPS). * @@ -65,6 +65,18 @@ #endif /* HAVE_COREFOUNDATION_H */ +/* + * Local globals... + */ + +#ifdef HAVE_PTHREAD_H +static pthread_mutex_t lang_mutex = PTHREAD_MUTEX_INITIALIZER; + /* Mutex to control access to cache */ +#endif /* HAVE_PTHREAD_H */ +static cups_lang_t *lang_cache = NULL; + /* Language string cache */ + + /* * Local functions... */ @@ -203,17 +215,6 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */ void cupsLangFlush(void) -{ - _cupsLangFlush(_cupsGlobals()); -} - - -/* - * '_cupsLangFlush()' - Flush all language data out of the cache. - */ - -void -_cupsLangFlush(_cups_globals_t *cg) /* I - Global data */ { cups_lang_t *lang, /* Current language */ *next; /* Next language */ @@ -223,7 +224,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */ * Free all languages in the cache... */ - for (lang = cg->lang_cache; lang != NULL; lang = next) +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + + for (lang = lang_cache; lang != NULL; lang = next) { /* * Free all messages... @@ -239,7 +244,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */ free(lang); } - cg->lang_cache = NULL; + lang_cache = NULL; + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -252,8 +261,16 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */ void cupsLangFree(cups_lang_t *lang) /* I - Language to free */ { +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + if (lang != NULL && lang->used > 0) lang->used --; + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -558,14 +575,27 @@ cupsLangGet(const char *language) /* I - Language or locale */ { snprintf(real, sizeof(real), "%s_%s", langname, country); - if ((lang = cups_cache_lookup(real, encoding)) != NULL) - return (lang); - snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir, real, real); } else + { + strcpy(real, langname); filename[0] = '\0'; /* anti-compiler-warning-code */ + } + +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + + if ((lang = cups_cache_lookup(langname, encoding)) != NULL) + { +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + + return (lang); + } if (!country[0] || access(filename, 0)) { @@ -573,9 +603,6 @@ cupsLangGet(const char *language) /* I - Language or locale */ * Country localization not available, look for generic localization... */ - if ((lang = cups_cache_lookup(langname, encoding)) != NULL) - return (lang); - snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir, langname, langname); @@ -587,11 +614,8 @@ cupsLangGet(const char *language) /* I - Language or locale */ DEBUG_printf(("access(\"%s\", 0): %s\n", filename, strerror(errno))); - strcpy(real, "C"); snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir); } - else - strcpy(real, langname); } /* @@ -599,7 +623,7 @@ cupsLangGet(const char *language) /* I - Language or locale */ * record... */ - for (lang = cg->lang_cache; lang != NULL; lang = lang->next) + for (lang = lang_cache; lang != NULL; lang = lang->next) if (lang->used == 0) break; @@ -610,10 +634,16 @@ cupsLangGet(const char *language) /* I - Language or locale */ */ if ((lang = calloc(sizeof(cups_lang_t), 1)) == NULL) + { +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + return (NULL); + } - lang->next = cg->lang_cache; - cg->lang_cache = lang; + lang->next = lang_cache; + lang_cache = lang; } else { @@ -646,6 +676,10 @@ cupsLangGet(const char *language) /* I - Language or locale */ * Return... */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&lang_mutex); +#endif /* HAVE_PTHREAD_H */ + return (lang); } @@ -668,7 +702,21 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */ if (!lang || !message) return (message); +#ifdef HAVE_PTHREAD_H + { + const char *s; /* Localized message */ + + pthread_mutex_lock(&lang_mutex); + + s = _cupsMessageLookup(lang->strings, message); + + pthread_mutex_unlock(&lang_mutex); + + return (s); + } +#else return (_cupsMessageLookup(lang->strings, message)); +#endif /* HAVE_PTHREAD_H */ } @@ -1166,7 +1214,7 @@ cups_cache_lookup(const char *name,/* I - Name of locale */ * Loop through the cache and return a match if found... */ - for (lang = _cupsGlobals()->lang_cache; lang != NULL; lang = lang->next) + for (lang = lang_cache; lang != NULL; lang = lang->next) { DEBUG_printf(("cups_cache_lookup: lang=%p, language=\"%s\", encoding=%d(%s)\n", lang, lang->language, lang->encoding, @@ -1248,5 +1296,5 @@ cups_unquote(char *d, /* O - Unquoted string */ /* - * End of "$Id: language.c 5243 2006-03-08 02:29:48Z mike $". + * End of "$Id: language.c 5366 2006-04-02 16:11:04Z mike $". */ diff --git a/cups/request.c b/cups/request.c index 5f44ad961..4839bd3f1 100644 --- a/cups/request.c +++ b/cups/request.c @@ -1,5 +1,5 @@ /* - * "$Id: request.c 5147 2006-02-22 16:37:44Z mike $" + * "$Id: request.c 5362 2006-03-31 15:26:12Z mike $" * * IPP utilities for the Common UNIX Printing System (CUPS). * @@ -64,6 +64,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */ ipp_t *response; /* IPP response data */ size_t length; /* Content-Length value */ http_status_t status; /* Status of HTTP request */ + int got_status; /* Did we get the status? */ ipp_state_t state; /* State of IPP processing */ FILE *file; /* File to send */ struct stat fileinfo; /* File information */ @@ -184,54 +185,58 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */ } /* - * Wait up to 1 second for a 100-continue response... + * Send the IPP data... */ - if (httpWait(http, 1000)) - status = httpUpdate(http); - else - status = HTTP_CONTINUE; + DEBUG_puts("cupsDoFileRequest: ipp write..."); - if (status == HTTP_CONTINUE) + request->state = IPP_IDLE; + status = HTTP_CONTINUE; + got_status = 0; + + while ((state = ippWrite(http, request)) != IPP_DATA) + if (state == IPP_ERROR) + break; + else if (httpCheck(http)) + { + got_status = 1; + + if ((status = httpUpdate(http)) != HTTP_CONTINUE) + break; + } + + if (!got_status) { /* - * Send the IPP data... + * Wait up to 1 second to get the 100-continue response... */ - DEBUG_puts("cupsDoFileRequest: ipp write..."); + if (httpWait(http, 1000)) + status = httpUpdate(http); + } + else if (httpCheck(http)) + status = httpUpdate(http); - request->state = IPP_IDLE; + if (status == HTTP_CONTINUE && state == IPP_DATA && filename) + { + DEBUG_puts("cupsDoFileRequest: file write..."); - while ((state = ippWrite(http, request)) != IPP_DATA) - if (state == IPP_ERROR) - break; - else if (httpCheck(http)) + /* + * Send the file... + */ + + rewind(file); + + while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0) + { + if (httpCheck(http)) { if ((status = httpUpdate(http)) != HTTP_CONTINUE) break; } - if (state == IPP_DATA && filename) - { - DEBUG_puts("cupsDoFileRequest: file write..."); - - /* - * Send the file... - */ - - rewind(file); - - while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0) - { - if (httpCheck(http)) - { - if ((status = httpUpdate(http)) != HTTP_CONTINUE) - break; - } - - if (httpWrite2(http, buffer, bytes) < bytes) - break; - } + if (httpWrite2(http, buffer, bytes) < bytes) + break; } } @@ -458,5 +463,5 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */ /* - * End of "$Id: request.c 5147 2006-02-22 16:37:44Z mike $". + * End of "$Id: request.c 5362 2006-03-31 15:26:12Z mike $". */ diff --git a/cups/string.c b/cups/string.c index 79ea73b05..733304a82 100644 --- a/cups/string.c +++ b/cups/string.c @@ -1,5 +1,5 @@ /* - * "$Id: string.c 5286 2006-03-13 16:32:28Z mike $" + * "$Id: string.c 5368 2006-04-02 19:23:50Z mike $" * * String functions for the Common UNIX Printing System (CUPS). * @@ -46,9 +46,24 @@ #include #include +#include "array.h" #include "debug.h" #include "string.h" -#include "globals.h" +#ifdef HAVE_PTHREAD_H +# include +#endif /* HAVE_PTHREAD_H */ + + +/* + * Local globals... + */ + +#ifdef HAVE_PTHREAD_H +static pthread_mutex_t sp_mutex = PTHREAD_MUTEX_INITIALIZER; + /* Mutex to control access to pool */ +#endif /* HAVE_PTHREAD_H */ +static cups_array_t *stringpool = NULL; + /* Global string pool */ /* @@ -65,7 +80,6 @@ static int compare_sp_items(_cups_sp_item_t *a, _cups_sp_item_t *b); char * /* O - String pointer */ _cupsStrAlloc(const char *s) /* I - String */ { - _cups_globals_t *cg; /* Global data */ _cups_sp_item_t *item, /* String pool item */ key; /* Search key */ @@ -81,13 +95,21 @@ _cupsStrAlloc(const char *s) /* I - String */ * Get the string pool... */ - cg = _cupsGlobals(); +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + + if (!stringpool) + stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL); - if (!cg->stringpool) - cg->stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL); + if (!stringpool) + { +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ - if (!cg->stringpool) return (NULL); + } /* * See if the string is already in the pool... @@ -95,7 +117,7 @@ _cupsStrAlloc(const char *s) /* I - String */ key.str = (char *)s; - if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL) + if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL) { /* * Found it, return the cached string... @@ -103,6 +125,10 @@ _cupsStrAlloc(const char *s) /* I - String */ item->ref_count ++; +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + return (item->str); } @@ -112,7 +138,13 @@ _cupsStrAlloc(const char *s) /* I - String */ item = (_cups_sp_item_t *)calloc(1, sizeof(_cups_sp_item_t)); if (!item) + { +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + return (NULL); + } item->ref_count = 1; item->str = strdup(s); @@ -120,6 +152,11 @@ _cupsStrAlloc(const char *s) /* I - String */ if (!item->str) { free(item); + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + return (NULL); } @@ -127,7 +164,11 @@ _cupsStrAlloc(const char *s) /* I - String */ * Add the string to the pool and return it... */ - cupsArrayAdd(cg->stringpool, item); + cupsArrayAdd(stringpool, item); + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ return (item->str); } @@ -138,20 +179,32 @@ _cupsStrAlloc(const char *s) /* I - String */ */ void -_cupsStrFlush(_cups_globals_t *cg) /* I - Global data */ +_cupsStrFlush(void) { _cups_sp_item_t *item; /* Current item */ - for (item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool); + DEBUG_printf(("_cupsStrFlush(cg=%p)\n", cg)); + DEBUG_printf((" %d strings in array\n", cupsArrayCount(stringpool))); + +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + + for (item = (_cups_sp_item_t *)cupsArrayFirst(stringpool); item; - item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool)) + item = (_cups_sp_item_t *)cupsArrayNext(stringpool)) { free(item->str); free(item); } - cupsArrayDelete(cg->stringpool); + cupsArrayDelete(stringpool); + stringpool = NULL; + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -242,7 +295,6 @@ _cupsStrFormatd(char *buf, /* I - String */ void _cupsStrFree(const char *s) /* I - String to free */ { - _cups_globals_t *cg; /* Global data */ _cups_sp_item_t *item, /* String pool item */ key; /* Search key */ @@ -255,21 +307,28 @@ _cupsStrFree(const char *s) /* I - String to free */ return; /* - * Get the string pool... + * Check the string pool... + * + * We don't need to lock the mutex yet, as we only want to know if + * the stringpool is initialized. The rest of the code will still + * work if it is initialized before we lock... */ - cg = _cupsGlobals(); - - if (!cg->stringpool) + if (!stringpool) return; /* * See if the string is already in the pool... */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + key.str = (char *)s; - if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL) + if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL && + item->str == s) { /* * Found it, dereference... @@ -283,12 +342,16 @@ _cupsStrFree(const char *s) /* I - String to free */ * Remove and free... */ - cupsArrayRemove(cg->stringpool, item); + cupsArrayRemove(stringpool, item); free(item->str); free(item); } } + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -402,19 +465,20 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */ tbytes, /* Total string bytes */ len; /* Length of string */ _cups_sp_item_t *item; /* Current item */ - _cups_globals_t *cg; /* Global data */ /* * Loop through strings in pool, counting everything up... */ - cg = _cupsGlobals(); +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ for (count = 0, abytes = 0, tbytes = 0, - item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool); + item = (_cups_sp_item_t *)cupsArrayFirst(stringpool); item; - item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool)) + item = (_cups_sp_item_t *)cupsArrayNext(stringpool)) { /* * Count allocated memory, using a 64-bit aligned buffer as a basis. @@ -426,6 +490,10 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */ tbytes += item->ref_count * len; } +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&sp_mutex); +#endif /* HAVE_PTHREAD_H */ + /* * Return values... */ @@ -634,5 +702,5 @@ compare_sp_items(_cups_sp_item_t *a, /* I - First item */ /* - * End of "$Id: string.c 5286 2006-03-13 16:32:28Z mike $". + * End of "$Id: string.c 5368 2006-04-02 19:23:50Z mike $". */ diff --git a/cups/string.h b/cups/string.h index 1cec6aeec..6c5ae823f 100644 --- a/cups/string.h +++ b/cups/string.h @@ -1,5 +1,5 @@ /* - * "$Id: string.h 5238 2006-03-07 04:41:42Z mike $" + * "$Id: string.h 5366 2006-04-02 16:11:04Z mike $" * * String definitions for the Common UNIX Printing System (CUPS). * @@ -131,6 +131,7 @@ extern int _cups_vsnprintf(char *, size_t, const char *, va_list); */ extern char *_cupsStrAlloc(const char *s); +extern void _cupsStrFlush(void); extern void _cupsStrFree(const char *s); extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes); @@ -156,5 +157,5 @@ extern double _cupsStrScand(const char *buf, char **bufptr, #endif /* !_CUPS_STRING_H_ */ /* - * End of "$Id: string.h 5238 2006-03-07 04:41:42Z mike $". + * End of "$Id: string.h 5366 2006-04-02 16:11:04Z mike $". */ diff --git a/cups/testhttp.c b/cups/testhttp.c index ade392dfe..5a9a86ed9 100644 --- a/cups/testhttp.c +++ b/cups/testhttp.c @@ -1,5 +1,5 @@ /* - * "$Id: testhttp.c 5344 2006-03-26 13:57:00Z mike $" + * "$Id: testhttp.c 5350 2006-03-29 15:26:44Z mike $" * * HTTP test program for the Common UNIX Printing System (CUPS). * @@ -114,6 +114,8 @@ static uri_test_t uri_tests[] = /* URI test data */ /* Missing resource */ { HTTP_URI_MISSING_RESOURCE, "socket://[::192.168.2.1]", "socket", "", "::192.168.2.1", "/", 9100, 0 }, + { HTTP_URI_MISSING_RESOURCE, "socket://192.168.1.1:9101", + "socket", "", "192.168.1.1", "/", 9101 }, /* Bad URI */ { HTTP_URI_BAD_URI, "", @@ -517,5 +519,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: testhttp.c 5344 2006-03-26 13:57:00Z mike $". + * End of "$Id: testhttp.c 5350 2006-03-29 15:26:44Z mike $". */ diff --git a/cups/transcode.c b/cups/transcode.c index 04f4f8bdd..8e9f3133b 100644 --- a/cups/transcode.c +++ b/cups/transcode.c @@ -1,5 +1,5 @@ /* - * "$Id: transcode.c 5300 2006-03-17 19:50:14Z mike $" + * "$Id: transcode.c 5366 2006-04-02 16:11:04Z mike $" * * Transcoding support for the Common UNIX Printing System (CUPS). * @@ -37,6 +37,7 @@ * conv_vbcs_to_utf8() - Convert legacy DBCS/VBCS to UTF-8. * free_sbcs_charmap() - Free memory used by a single byte character set. * free_vbcs_charmap() - Free memory used by a variable byte character set. + * get_charmap() - Lookup or get a character set map (private). * get_charmap_count() - Count lines in a charmap file. * get_sbcs_charmap() - Get SBCS Charmap. * get_vbcs_charmap() - Get DBCS/VBCS Charmap. @@ -53,6 +54,20 @@ #include +/* + * Local globals... + */ + +#ifdef HAVE_PTHREAD_H +static pthread_mutex_t map_mutex = PTHREAD_MUTEX_INITIALIZER; + /* Mutex to control access to maps */ +#endif /* HAVE_PTHREAD_H */ +static _cups_cmap_t *cmap_cache = NULL; + /* SBCS Charmap Cache */ +static _cups_vmap_t *vmap_cache = NULL; + /* VBCS Charmap Cache */ + + /* * Local functions... */ @@ -76,6 +91,7 @@ static int conv_vbcs_to_utf8(cups_utf8_t *dest, const cups_encoding_t encoding); static void free_sbcs_charmap(_cups_cmap_t *sbcs); static void free_vbcs_charmap(_cups_vmap_t *vbcs); +static void *get_charmap(const cups_encoding_t encoding); static int get_charmap_count(cups_file_t *fp); static _cups_cmap_t *get_sbcs_charmap(const cups_encoding_t encoding, const char *filename); @@ -88,7 +104,7 @@ static _cups_vmap_t *get_vbcs_charmap(const cups_encoding_t encoding, */ void -_cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */ +_cupsCharmapFlush(void) { _cups_cmap_t *cmap, /* Legacy SBCS / Unicode Charset Map */ *cnext; /* Next Legacy SBCS Charset Map */ @@ -96,24 +112,28 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */ *vnext; /* Next Legacy VBCS Charset Map */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + /* * Loop through SBCS charset map cache, free all memory... */ - for (cmap = cg->cmap_cache; cmap; cmap = cnext) + for (cmap = cmap_cache; cmap; cmap = cnext) { cnext = cmap->next; free_sbcs_charmap(cmap); } - cg->cmap_cache = NULL; + cmap_cache = NULL; /* * Loop through DBCS/VBCS charset map cache, free all memory... */ - for (vmap = cg->vmap_cache; vmap; vmap = vnext) + for (vmap = vmap_cache; vmap; vmap = vnext) { vnext = vmap->next; @@ -122,7 +142,11 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */ free(vmap); } - cg->vmap_cache = NULL; + vmap_cache = NULL; + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -138,21 +162,23 @@ _cupsCharmapFree( { _cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */ _cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */ - _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ /* * See if we already have this SBCS charset map loaded... */ - for (cmap = cg->cmap_cache; cmap; cmap = cmap->next) +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + + for (cmap = cmap_cache; cmap; cmap = cmap->next) { if (cmap->encoding == encoding) { if (cmap->used > 0) cmap->used --; - - return; + break; } } @@ -160,15 +186,19 @@ _cupsCharmapFree( * See if we already have this DBCS/VBCS charset map loaded... */ - for (vmap = cg->vmap_cache; vmap; vmap = vmap->next) + for (vmap = vmap_cache; vmap; vmap = vmap->next) { if (vmap->encoding == encoding) { if (vmap->used > 0) vmap->used --; - return; + break; } } + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ } @@ -185,8 +215,7 @@ void * /* O - Charset map pointer */ _cupsCharmapGet( const cups_encoding_t encoding) /* I - Encoding */ { - char filename[1024]; /* Filename for charset map file */ - _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + void *charmap; /* Charset map pointer */ DEBUG_printf(("_cupsCharmapGet(encoding=%d)\n", encoding)); @@ -202,24 +231,20 @@ _cupsCharmapGet( } /* - * Get the data directory and charset map name... + * Lookup or get the charset map pointer and return... */ - snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt", - cg->cups_datadir, _cupsEncodingName(encoding)); +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ - DEBUG_printf((" filename=\"%s\"\n", filename)); + charmap = get_charmap(encoding); - /* - * Read charset map input file into cache... - */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ - if (encoding < CUPS_ENCODING_SBCS_END) - return (get_sbcs_charmap(encoding, filename)); - else if (encoding < CUPS_ENCODING_VBCS_END) - return (get_vbcs_charmap(encoding, filename)); - else - return (NULL); + return (charmap); } @@ -239,6 +264,9 @@ cupsCharsetToUTF8( const int maxout, /* I - Max output */ const cups_encoding_t encoding) /* I - Encoding */ { + int bytes; /* Number of bytes converted */ + + /* * Check for valid arguments... */ @@ -270,15 +298,25 @@ cupsCharsetToUTF8( * Convert input legacy charset to UTF-8... */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + if (encoding < CUPS_ENCODING_SBCS_END) - return (conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding)); + bytes = conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding); else if (encoding < CUPS_ENCODING_VBCS_END) - return (conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding)); + bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding); else { - puts(" Bad encoding, returning -1"); - return (-1); + DEBUG_puts(" Bad encoding, returning -1"); + bytes = -1; } + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + + return (bytes); } @@ -298,6 +336,9 @@ cupsUTF8ToCharset( const int maxout, /* I - Max output */ const cups_encoding_t encoding) /* I - Encoding */ { + int bytes; /* Number of bytes converted */ + + /* * Check for valid arguments... */ @@ -325,12 +366,22 @@ cupsUTF8ToCharset( * Convert input UTF-8 to legacy charset... */ +#ifdef HAVE_PTHREAD_H + pthread_mutex_lock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + if (encoding < CUPS_ENCODING_SBCS_END) - return (conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding)); + bytes = conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding); else if (encoding < CUPS_ENCODING_VBCS_END) - return (conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding)); + bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding); else - return (-1); + bytes = -1; + +#ifdef HAVE_PTHREAD_H + pthread_mutex_unlock(&map_mutex); +#endif /* HAVE_PTHREAD_H */ + + return (bytes); } @@ -675,7 +726,7 @@ conv_sbcs_to_utf8( * Find legacy charset map in cache... */ - if ((cmap = (_cups_cmap_t *)_cupsCharmapGet(encoding)) == NULL) + if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL) return (-1); /* @@ -714,7 +765,7 @@ conv_sbcs_to_utf8( * Convert internal UCS-4 to output UTF-8 (and delete BOM)... */ - _cupsCharmapFree(encoding); + cmap->used --; return (cupsUTF32ToUTF8(dest, work, maxout)); } @@ -743,7 +794,7 @@ conv_utf8_to_sbcs( * Find legacy charset map in cache... */ - if ((cmap = (_cups_cmap_t *) _cupsCharmapGet(encoding)) == NULL) + if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL) return (-1); /* @@ -790,7 +841,7 @@ conv_utf8_to_sbcs( *dest = '\0'; - _cupsCharmapFree(encoding); + cmap->used --; return ((int)(dest - start)); } @@ -820,7 +871,7 @@ conv_utf8_to_vbcs( * Find legacy charset map in cache... */ - if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL) + if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL) return (-1); /* @@ -902,7 +953,7 @@ conv_utf8_to_vbcs( *dest = '\0'; - _cupsCharmapFree(encoding); + vmap->used --; return ((int)(dest - start)); } @@ -932,7 +983,7 @@ conv_vbcs_to_utf8( * Find legacy charset map in cache... */ - if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL) + if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL) return (-1); /* @@ -1027,7 +1078,7 @@ conv_vbcs_to_utf8( *workptr = 0; - _cupsCharmapFree(encoding); + vmap->used --; /* * Convert internal UCS-4 to output UTF-8 (and delete BOM)... @@ -1080,6 +1131,46 @@ free_vbcs_charmap(_cups_vmap_t *vmap) /* I - Character set */ } +/* + * 'get_charmap()' - Lookup or get a character set map (private). + * + * This code handles single-byte (SBCS), double-byte (DBCS), and + * variable-byte (VBCS) character sets _without_ charset escapes... + * This code does not handle multiple-byte character sets (MBCS) + * (such as ISO-2022-JP) with charset switching via escapes... + */ + + +void * /* O - Charset map pointer */ +get_charmap( + const cups_encoding_t encoding) /* I - Encoding */ +{ + char filename[1024]; /* Filename for charset map file */ + _cups_globals_t *cg = _cupsGlobals(); /* Global data */ + + + /* + * Get the data directory and charset map name... + */ + + snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt", + cg->cups_datadir, _cupsEncodingName(encoding)); + + DEBUG_printf((" filename=\"%s\"\n", filename)); + + /* + * Read charset map input file into cache... + */ + + if (encoding < CUPS_ENCODING_SBCS_END) + return (get_sbcs_charmap(encoding, filename)); + else if (encoding < CUPS_ENCODING_VBCS_END) + return (get_vbcs_charmap(encoding, filename)); + else + return (NULL); +} + + /* * 'get_charmap_count()' - Count lines in a charmap file. */ @@ -1129,19 +1220,19 @@ get_sbcs_charmap( cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */ cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */ char line[256]; /* Line from charset map file */ - _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ /* * See if we already have this SBCS charset map loaded... */ - for (cmap = cg->cmap_cache; cmap; cmap = cmap->next) + for (cmap = cmap_cache; cmap; cmap = cmap->next) { if (cmap->encoding == encoding) { cmap->used ++; DEBUG_printf((" returning existing cmap=%p\n", cmap)); + return ((void *)cmap); } } @@ -1161,6 +1252,7 @@ get_sbcs_charmap( { cupsFileClose(fp); DEBUG_puts(" Unable to allocate memory!"); + return (NULL); } @@ -1228,8 +1320,8 @@ get_sbcs_charmap( * Add it to the cache and return... */ - cmap->next = cg->cmap_cache; - cg->cmap_cache = cmap; + cmap->next = cmap_cache; + cmap_cache = cmap; DEBUG_printf((" returning new cmap=%p\n", cmap)); @@ -1273,7 +1365,6 @@ get_vbcs_charmap( char line[256]; /* Line from charset map file */ int i; /* Loop variable */ int wide; /* 32-bit legacy char */ - _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ DEBUG_printf(("get_vbcs_charmap(encoding=%d, filename=\"%s\")\n", @@ -1283,12 +1374,13 @@ get_vbcs_charmap( * See if we already have this DBCS/VBCS charset map loaded... */ - for (vmap = cg->vmap_cache; vmap; vmap = vmap->next) + for (vmap = vmap_cache; vmap; vmap = vmap->next) { if (vmap->encoding == encoding) { vmap->used ++; DEBUG_printf((" returning existing vmap=%p\n", vmap)); + return ((void *)vmap); } } @@ -1300,6 +1392,7 @@ get_vbcs_charmap( if ((fp = cupsFileOpen(filename, "r")) == NULL) { DEBUG_printf((" Unable to open file: %s\n", strerror(errno))); + return (NULL); } @@ -1310,6 +1403,7 @@ get_vbcs_charmap( if ((mapcount = get_charmap_count(fp)) <= 0) { DEBUG_puts(" Unable to get charmap count!"); + return (NULL); } @@ -1323,6 +1417,7 @@ get_vbcs_charmap( { cupsFileClose(fp); DEBUG_puts(" Unable to allocate memory!"); + return (NULL); } @@ -1465,8 +1560,8 @@ get_vbcs_charmap( * Add it to the cache and return... */ - vmap->next = cg->vmap_cache; - cg->vmap_cache = vmap; + vmap->next = vmap_cache; + vmap_cache = vmap; DEBUG_printf((" returning new vmap=%p\n", vmap)); @@ -1489,5 +1584,5 @@ get_vbcs_charmap( /* - * End of "$Id: transcode.c 5300 2006-03-17 19:50:14Z mike $" + * End of "$Id: transcode.c 5366 2006-04-02 16:11:04Z mike $" */ diff --git a/desktop/cups.desktop b/desktop/cups.desktop index 11fe2662f..a273a579f 100644 --- a/desktop/cups.desktop +++ b/desktop/cups.desktop @@ -17,3 +17,5 @@ Type=Application X-DCOP-ServiceType= X-KDE-SubstituteUID=false X-KDE-Username= +Name[es]=Administrar impresión +Comment[es]=Interfaz Web de CUPS diff --git a/doc/es/index.html.in b/doc/es/index.html.in index f80a3f1f1..e14c40267 100644 --- a/doc/es/index.html.in +++ b/doc/es/index.html.in @@ -133,7 +133,7 @@ WIDTH="15" HEIGHT="15" ALT="">

Common UNIX Printing System, CUPS, y el logo de CUPS son marcas registradas de Easy Software -Products. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products, +Products. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products. Todos los derechos reservados.

diff --git a/filter/Makefile b/filter/Makefile index 9aeca718d..79b7fecb2 100644 --- a/filter/Makefile +++ b/filter/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5311 2006-03-19 13:21:42Z mike $" +# "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $" # # Filter makefile for the Common UNIX Printing System (CUPS). # @@ -107,10 +107,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64) installstatic: $(INSTALL_DIR) -m 755 $(LIBDIR) - -if test $(LIBCUPSIMAGE) != "libcupsimage.a"; then \ - $(INSTALL_LIB) libcupsimage.a $(LIBDIR); \ - $(RANLIB) $(LIBDIR)/libcupsimage.a; \ - fi + $(INSTALL_LIB) libcupsimage.a $(LIBDIR); + $(RANLIB) $(LIBDIR)/libcupsimage.a; installhdrs: $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups @@ -373,5 +371,5 @@ include Dependencies # -# End of "$Id: Makefile 5311 2006-03-19 13:21:42Z mike $". +# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $". # diff --git a/filter/pstops.c b/filter/pstops.c index 72612191f..4be662155 100644 --- a/filter/pstops.c +++ b/filter/pstops.c @@ -1,5 +1,5 @@ /* - * "$Id: pstops.c 5326 2006-03-23 19:33:35Z mike $" + * "$Id: pstops.c 5369 2006-04-03 15:09:58Z mike $" * * PostScript filter for the Common UNIX Printing System (CUPS). * @@ -307,10 +307,13 @@ main(int argc, /* I - Number of command-line args */ fputs("DEBUG: Skipping PJL header...\n", stderr); - while (strstr(line, "ENTER LANGUAGE") == NULL) + while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2)) if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0) break; + if (!strncmp(line, "%!", 2)) + break; + if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0) break; } @@ -590,6 +593,12 @@ copy_comments(cups_file_t *fp, /* I - File to read from */ { if (saw_bounding_box) fputs("ERROR: Duplicate %%BoundingBox: comment seen!\n", stderr); + else if (strstr(line + 14, "(atend)")) + { + /* + * Do nothing for now but use the default imageable area... + */ + } else if (sscanf(line + 14, "%d%d%d%d", doc->bounding_box + 0, doc->bounding_box + 1, doc->bounding_box + 2, doc->bounding_box + 3) != 4) @@ -738,14 +747,26 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */ */ fprintf(stderr, "DEBUG: Before copy_prolog - %s", line); - copy_prolog(fp, doc, ppd, line, linelen, linesize); + linelen = copy_prolog(fp, doc, ppd, line, linelen, linesize); /* * Then the document setup section... */ fprintf(stderr, "DEBUG: Before copy_setup - %s", line); - copy_setup(fp, doc, ppd, line, linelen, linesize); + linelen = copy_setup(fp, doc, ppd, line, linelen, linesize); + + /* + * Copy until we see %%Page:... + */ + + while (strncmp(line, "%%Page:", 7) && strncmp(line, "%%Trailer", 9)) + { + fwrite(line, 1, linelen, stdout); + + if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0) + break; + } /* * Then process pages until we have no more... @@ -778,9 +799,9 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */ { pageinfo = (pstops_page_t *)cupsArrayLast(doc->pages); - start_nup(doc, doc->number_up - 1, 0, doc->bounding_box); + start_nup(doc, doc->number_up, 0, doc->bounding_box); doc_puts(doc, "showpage\n"); - end_nup(doc, doc->number_up - 1); + end_nup(doc, doc->number_up); pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset; } @@ -802,9 +823,9 @@ copy_dsc(cups_file_t *fp, /* I - File to read from */ printf("%%%%Page: (filler) %d\n", doc->page); } - start_nup(doc, doc->number_up - 1, 0, doc->bounding_box); + start_nup(doc, doc->number_up, 0, doc->bounding_box); doc_puts(doc, "showpage\n"); - end_nup(doc, doc->number_up - 1); + end_nup(doc, doc->number_up); pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset; } @@ -1368,7 +1389,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */ { if (level == 0 && (!strncmp(line, "%%Page:", 7) || - !strncmp(line, "%%Trailer:", 10) || + !strncmp(line, "%%Trailer", 9) || !strncmp(line, "%%EOF", 5))) break; else if (!strncmp(line, "%%BeginDocument", 15) || @@ -2400,7 +2421,7 @@ skip_page(cups_file_t *fp, /* I - File to read from */ while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0) { if (level == 0 && - (!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer:", 10))) + (!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer", 9))) break; else if (!strncmp(line, "%%BeginDocument", 15) || !strncmp(line, "%ADO_BeginApplication", 21)) @@ -2870,5 +2891,5 @@ start_nup(pstops_doc_t *doc, /* I - Document information */ /* - * End of "$Id: pstops.c 5326 2006-03-23 19:33:35Z mike $". + * End of "$Id: pstops.c 5369 2006-04-03 15:09:58Z mike $". */ diff --git a/locale/cups_es.po b/locale/cups_es.po index b81c73eb6..fb94d4d55 100644 --- a/locale/cups_es.po +++ b/locale/cups_es.po @@ -23,12 +23,12 @@ msgstr "" "Project-Id-Version: CUPS 1.2\n" "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n" "POT-Creation-Date: 2006-03-23 21:52-0500\n" -"PO-Revision-Date: 2006-03-13 17:36+0100\n" +"PO-Revision-Date: 2006-03-25 21:48+0100\n" "Last-Translator: Juan Pablo González Riopedre \n" "Language-Team: Spanish\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Transfer-Encoding: 8bit" msgid "Options Installed" msgstr "Opciones instaladas" @@ -77,10 +77,10 @@ msgid "" "this page." msgstr "" "Introduzca su nombre de usuario y contraseña o el nombre de usuario y " -"contraseña de root para poder acceder a esta página" +"contraseña de root para poder acceder a esta página." msgid "You must use a https: URL to access this page." -msgstr "Debe escribir una URL https para acceder a esta página." +msgstr "Debe escribir un URL https para acceder a esta página." #, c-format msgid "Bad request version number %d.%d!" @@ -2863,94 +2863,112 @@ msgid "" "You must access this page using the URL https://%" "s:%d%s." msgstr "" +"Debe acceder a esta página usando el URL https://%" +"s:%d%s." -#, fuzzy, c-format +#, c-format msgid "Unsupported format '%s'!" -msgstr "No se admite el uso del formato '%s/%s'." +msgstr "No se admite el uso del formato '%s'." -#, fuzzy msgid "FAIL\n" -msgstr " FALLO\n" +msgstr "FALLO\n" #, c-format msgid "" " Line %d is longer than 255 characters (%d)!\n" " REF: Page 25, Line Length\n" msgstr "" +" La línea %d es más larga de 255 caracteres (%d).\n" +" REF: Página 25, Longitud de Línea\n" msgid "" " Missing %!PS-Adobe-3.0 on first line!\n" " REF: Page 17, 3.1 Conforming Documents\n" msgstr "" +" Falta %!PS-Adobe-3.0 en la primera línea.\n" +" REF: Página 17, 3.1 Conformidad de documentos\n" #, c-format msgid "" " Bad %%%%Pages: on line %d!\n" " REF: Page 43, %%%%Pages:\n" msgstr "" +" %%%%Pages: incorrecto en línea %d.\n" +" REF: Página 43, %%%%Pages:\n" #, c-format msgid "" " Bad %%%%BoundingBox: on line %d!\n" " REF: Page 39, %%%%BoundingBox:\n" msgstr "" +" %%%%BoundingBox: incorrecto en línea %d.\n" +" REF: Página 39, %%%%BoundingBox:\n" #, c-format msgid "" " Bad %%%%Page: on line %d!\n" " REF: Page 53, %%%%Page:\n" msgstr "" +" %%%%Page: incorrecto en línea %d.\n" +" REF: Página 53, %%%%Page:\n" #, c-format msgid "" " Missing or bad %%BoundingBox: comment!\n" " REF: Page 39, %%BoundingBox:\n" msgstr "" +" Falta comentario %%BoundingBox: o incorrecto.\n" +" REF: Página 39, %%BoundingBox:\n" #, c-format msgid "" " Missing or bad %%Pages: comment!\n" " REF: Page 43, %%Pages:\n" msgstr "" +" Falta comentario %%Pages: o incorrecto.\n" +" REF: Página 43, %%Pages:\n" #, c-format msgid "" " Missing %%EndComments comment!\n" " REF: Page 41, %%EndComments\n" msgstr "" +" Falta comentario %%EndComments.\n" +" REF: Página 41, %%EndComments\n" #, c-format msgid "" " Missing or bad %%Page: comments!\n" " REF: Page 53, %%Page:\n" msgstr "" +" Falta comentario %%Page: o incorrecto.\n" +" REF: Página 53, %%Page:\n" #, c-format msgid " Too many %%EndDocument comments!\n" -msgstr "" +msgstr " Demasiados comentarios %%EndDocument.\n" #, c-format msgid " Too many %%BeginDocument comments!\n" -msgstr "" +msgstr " Demasiados comentarios %%BeginDocument.\n" #, c-format msgid " Saw %d lines that exceeded 255 characters!\n" -msgstr "" +msgstr " Se han visto %d líneas que exceden de 255 caracteres.\n" -#, fuzzy msgid "PASS\n" -msgstr " PASA\n" +msgstr "PASA\n" msgid " Warning: file contains binary data!\n" -msgstr "" +msgstr " Advertencia: el archivo contiene datos binarios.\n" #, c-format msgid " Warning: obsolete DSC version %.1f in file!\n" -msgstr "" +msgstr " Advertencia: versión DSC %.1f obsoleta en el archivo.\n" #, c-format msgid " Warning: no %%EndComments comment in file!\n" -msgstr "" +msgstr " Advertencia: no hay comentario %%EndComments en el archivo.\n" msgid "" "Usage: cupstestdsc [options] filename.ps [... filename.ps]\n" @@ -2963,3 +2981,13 @@ msgid "" " Note: this program only validates the DSC comments, not the PostScript " "itself.\n" msgstr "" +"Uso: cupstestdsc [opciones] nombre_archivo.ps [... nombre_archivo.ps]\n" +" cupstestdsc [opciones] -\n" +"\n" +"Opciones:\n" +"\n" +" -h Muestra cómo se usa el programa\n" +"\n" +" Nota: este programa sólo valida los comentarios DSC, no el PostScript " +"en sí mismo.\n" + diff --git a/locale/cups_ja.po b/locale/cups_ja.po index 0a6f7d2f5..6f151ba28 100644 --- a/locale/cups_ja.po +++ b/locale/cups_ja.po @@ -26,7 +26,7 @@ msgstr "" "Project-Id-Version: CUPS 1.2\n" "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n" "POT-Creation-Date: 2006-03-23 21:52-0500\n" -"PO-Revision-Date: 2006-03-14 09:29+0900\n" +"PO-Revision-Date: 2006-03-29 23:44+0900\n" "Last-Translator: Kenshi Muto \n" "Language-Team: Japanese \n" "MIME-Version: 1.0\n" @@ -2798,95 +2798,111 @@ msgstr "ジョブ #%d はすでに完了しています - キャンセルでき msgid "" "You must access this page using the URL https://%" "s:%d%s." -msgstr "" +msgstr "このページには URL https://%s:%d%s を使ってアクセスする必要があります。" -#, fuzzy, c-format +#, c-format msgid "Unsupported format '%s'!" -msgstr "'%s/%s' はサポートされていない形式です!" +msgstr "'%s' はサポートされていない形式です!" -#, fuzzy msgid "FAIL\n" -msgstr " 失敗\n" +msgstr "失敗\n" #, c-format msgid "" " Line %d is longer than 255 characters (%d)!\n" " REF: Page 25, Line Length\n" msgstr "" +" %d 行が 255文字より長くなっています (%d)!\n" +" REF: 25 ページ、Line Length\n" msgid "" " Missing %!PS-Adobe-3.0 on first line!\n" " REF: Page 17, 3.1 Conforming Documents\n" msgstr "" +" 先頭行に %!PS-Adobe-3.0 がありません!\n" +" REF: 17 ページ、3.1 Conforming Documents\n" #, c-format msgid "" " Bad %%%%Pages: on line %d!\n" " REF: Page 43, %%%%Pages:\n" msgstr "" +" 不正な %%%%Pages: (%d 行)!\n" +" REF: 43 ページ、%%%%Pages:\n" #, c-format msgid "" " Bad %%%%BoundingBox: on line %d!\n" " REF: Page 39, %%%%BoundingBox:\n" msgstr "" +" 不正な %%%%BoundingBox: (%d 行)!\n" +" REF: 39 ページ、%%%%BoundingBox:\n" #, c-format msgid "" " Bad %%%%Page: on line %d!\n" " REF: Page 53, %%%%Page:\n" msgstr "" +" 不正な %%%%Page: (%d 行)!\n" +" REF: 53 ページ、%%%%Page:\n" #, c-format msgid "" " Missing or bad %%BoundingBox: comment!\n" " REF: Page 39, %%BoundingBox:\n" msgstr "" +" %%BoundingBox: コメントが見つからないか不正です!\n" +" REF: 39 ページ、%%BoundingBox:\n" #, c-format msgid "" " Missing or bad %%Pages: comment!\n" " REF: Page 43, %%Pages:\n" msgstr "" +" %%Pages: コメントが見つからないか不正です!\n" +" REF: 43 ページ、%%Pages:\n" #, c-format msgid "" " Missing %%EndComments comment!\n" " REF: Page 41, %%EndComments\n" msgstr "" +" %%EndComments コメントが見つかりません!\n" +" REF: 41 ページ、%%EndComments\n" #, c-format msgid "" " Missing or bad %%Page: comments!\n" " REF: Page 53, %%Page:\n" msgstr "" +" %Page: コメントが見つからないか不正です!\n" +" REF: 53 ページ、%%Page:\n" #, c-format msgid " Too many %%EndDocument comments!\n" -msgstr "" +msgstr " %%EndDocument コメントが多すぎます!\n" #, c-format msgid " Too many %%BeginDocument comments!\n" -msgstr "" +msgstr " %%BeginDocument コメントが多すぎます!\n" #, c-format msgid " Saw %d lines that exceeded 255 characters!\n" -msgstr "" +msgstr " 255文字を超える %d 行が見つかりました!\n" -#, fuzzy msgid "PASS\n" -msgstr " 合格\n" +msgstr "合格\n" msgid " Warning: file contains binary data!\n" -msgstr "" +msgstr " 警告: ファイルにバイナリデータが含まれています!\n" #, c-format msgid " Warning: obsolete DSC version %.1f in file!\n" -msgstr "" +msgstr " 警告: ファイルは時代遅れの DSC バージョン %.1f です!\n" #, c-format msgid " Warning: no %%EndComments comment in file!\n" -msgstr "" +msgstr " 警告: ファイルに %%EndComments コメントがありません!\n" msgid "" "Usage: cupstestdsc [options] filename.ps [... filename.ps]\n" @@ -2899,3 +2915,11 @@ msgid "" " Note: this program only validates the DSC comments, not the PostScript " "itself.\n" msgstr "" +"使い方: cupstestdsc [オプション] ファイル名.ps [... ファイル名.ps]\n" +" cupstestdsc [オプション] -\n" +"\n" +"オプション:\n" +"\n" +" -h プログラムの使い方を表示する\n" +"\n" +" 注意: このプログラムは DSC コメントを検証するだけで、PostScript 自身を検証するものではありません。\n" diff --git a/packaging/cups.list.in b/packaging/cups.list.in index 5fad905f9..965c8e5b3 100644 --- a/packaging/cups.list.in +++ b/packaging/cups.list.in @@ -1,5 +1,5 @@ # -# "$Id: cups.list.in 5328 2006-03-23 20:23:19Z mike $" +# "$Id: cups.list.in 5354 2006-03-29 20:55:15Z mike $" # # ESP Package Manager (EPM) file list for the Common UNIX Printing # System (CUPS). @@ -162,6 +162,8 @@ $CUPS_GROUP=@CUPS_GROUP@ $CUPS_PRIMARY_SYSTEM_GROUP=@CUPS_PRIMARY_SYSTEM_GROUP@ $CUPS_PERM=0@CUPS_CONFIG_FILE_PERM@ +$INSTALLSTATIC=@INSTALLSTATIC@ + $MAN1EXT=@MAN1EXT@ $MAN5EXT=@MAN5EXT@ $MAN8EXT=@MAN8EXT@ @@ -422,8 +424,10 @@ f 0644 root sys $INCLUDEDIR/cups/md5.h cups/md5.h f 0644 root sys $INCLUDEDIR/cups/ppd.h cups/ppd.h f 0644 root sys $INCLUDEDIR/cups/raster.h filter/raster.h +%if $INSTALLSTATIC f 0644 root sys $LIBDIR/libcups.a cups/libcups.a f 0644 root sys $LIBDIR/libcupsimage.a filter/libcupsimage.a +%endif d 0755 root sys $DOCDIR/help - f 0644 root sys $DOCDIR/help doc/help/api*.html @@ -519,5 +523,5 @@ f 0644 root sys $AMANDIR/man$MAN8DIR/cups-lpd.$MAN8EXT man/cups-lpd.$MAN8EXT i 0755 root sys cups init/cups.sh # -# End of "$Id: cups.list.in 5328 2006-03-23 20:23:19Z mike $". +# End of "$Id: cups.list.in 5354 2006-03-29 20:55:15Z mike $". # diff --git a/packaging/cups.spec.in b/packaging/cups.spec.in index b056c6e71..11eac813a 100644 --- a/packaging/cups.spec.in +++ b/packaging/cups.spec.in @@ -1,5 +1,5 @@ # -# "$Id: cups.spec.in 5317 2006-03-21 02:35:37Z mike $" +# "$Id: cups.spec.in 5364 2006-04-01 01:32:50Z mike $" # # RPM "spec" file for the Common UNIX Printing System (CUPS). # @@ -37,6 +37,10 @@ %{?_with_php: %define _php --with-php} %{!?_with_php: %define _php --without-php} +%{!?_with_static: %{!?_without_static: %define _without_static --without-static}} +%{?_with_static: %define _static --enable-static} +%{!?_with_static: %define _static --disable-static} + Summary: Common UNIX Printing System Name: cups Version: @CUPS_VERSION@ @@ -127,10 +131,10 @@ UNIX %build %ifarch x86_64 -./configure --enable-32bit %{_dbus} %{_php} +./configure --enable-32bit %{_dbus} %{_php} %{_static} %else CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS" \ - ./configure %{_dbus} %{_php} + ./configure %{_dbus} %{_php} %{_static} %endif # If we got this far, all prerequisite libraries must be here. make @@ -244,7 +248,20 @@ rm -rf $RPM_BUILD_ROOT /usr/sbin/* %dir /usr/share/cups -/usr/share/cups/* +%dir /usr/share/cups/banners +/usr/share/cups/banners/* +%dir /usr/share/cups/charmaps +/usr/share/cups/charmaps/* +%dir /usr/share/cups/charsets +/usr/share/cups/charsets/* +%dir /usr/share/cups/data +/usr/share/cups/data/* +%dir /usr/share/cups/fonts +/usr/share/cups/fonts/* +%dir /usr/share/cups/model +/usr/share/cups/model/* +%dir /usr/share/cups/templates +/usr/share/cups/templates/*.tmpl %dir /usr/share/doc/cups /usr/share/doc/cups/*.* %dir /usr/share/doc/cups/help @@ -312,9 +329,12 @@ rm -rf $RPM_BUILD_ROOT /usr/bin/cups-config %dir /usr/include/cups /usr/include/cups/* -#/usr/lib/*.a /usr/lib*/*.so +%if %{?_with_static:1}%{!?_with_static:0} +/usr/lib*/*.a +%endif + %dir /usr/share/doc/cups/help /usr/share/doc/cups/help/api*.html /usr/share/doc/cups/help/spec*.html @@ -360,5 +380,5 @@ rm -rf $RPM_BUILD_ROOT # -# End of "$Id: cups.spec.in 5317 2006-03-21 02:35:37Z mike $". +# End of "$Id: cups.spec.in 5364 2006-04-01 01:32:50Z mike $". # diff --git a/scheduler/client.c b/scheduler/client.c index 5f533780f..1780b2207 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,5 +1,5 @@ /* - * "$Id: client.c 5335 2006-03-24 02:56:20Z mike $" + * "$Id: client.c 5367 2006-04-02 19:00:00Z mike $" * * Client routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -957,7 +957,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ else snprintf(locale, sizeof(locale), "%s.%s", con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset); - + con->language = cupsLangGet(locale); } else @@ -2246,7 +2246,11 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ */ if (!strncasecmp(buf, "Location:", 9)) + { cupsdSendHeader(con, HTTP_SEE_OTHER, NULL); + if (httpPrintf(HTTP(con), "Content-Length: 0\r\n") < 0) + return (0); + } else if (!strncasecmp(buf, "Status:", 7)) cupsdSendError(con, atoi(buf + 7)); else @@ -2826,9 +2830,9 @@ get_file(cupsd_client_t *con, /* I - Client connection */ else return (NULL); } - else if (con->language != NULL) + else if (con->language) snprintf(filename, len, "%s/%s%s", DocumentRoot, con->language->language, - con->uri); + con->uri); else snprintf(filename, len, "%s%s", DocumentRoot, con->uri); @@ -2840,16 +2844,30 @@ get_file(cupsd_client_t *con, /* I - Client connection */ * then fallback to the default one... */ - if ((status = stat(filename, filestats)) != 0 && con->language != NULL) + if ((status = stat(filename, filestats)) != 0 && con->language && + strncmp(con->uri, "/ppd/", 5) && + strncmp(con->uri, "/admin/conf/", 12) && + strncmp(con->uri, "/admin/log/", 11)) { /* - * Drop the language prefix and try the current directory... + * Drop the country code... */ - if (strncmp(con->uri, "/ppd/", 5) && - strncmp(con->uri, "/admin/conf/", 12) && - strncmp(con->uri, "/admin/log/", 11)) + char ll[3]; /* Short language name */ + + + strlcpy(ll, con->language->language, sizeof(ll)); + snprintf(filename, len, "%s/%s%s", DocumentRoot, ll, con->uri); + + if ((ptr = strchr(filename, '?')) != NULL) + *ptr = '\0'; + + if ((status = stat(filename, filestats)) != 0) { + /* + * Drop the language prefix and try the root directory... + */ + snprintf(filename, len, "%s%s", DocumentRoot, con->uri); if ((ptr = strchr(filename, '?')) != NULL) @@ -3787,5 +3805,5 @@ send_file(cupsd_client_t *con, /* I - Client connection */ /* - * End of "$Id: client.c 5335 2006-03-24 02:56:20Z mike $". + * End of "$Id: client.c 5367 2006-04-02 19:00:00Z mike $". */ diff --git a/scheduler/conf.c b/scheduler/conf.c index e7d64858a..430698472 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -1,5 +1,5 @@ /* - * "$Id: conf.c 5289 2006-03-14 11:54:45Z mike $" + * "$Id: conf.c 5353 2006-03-29 20:31:58Z mike $" * * Configuration routines for the Common UNIX Printing System (CUPS). * @@ -338,22 +338,34 @@ cupsdReadConfiguration(void) endpwent(); /* - * Find the default group (nobody)... + * Find the default group... */ - group = getgrnam("nobody"); + group = getgrnam(CUPS_DEFAULT_GROUP); endgrent(); - if (group != NULL) + if (group) Group = group->gr_gid; else { /* - * Use the (historical) NFS nobody group ID (-2 as a 16-bit twos- - * complement number...) + * Fallback to group "nobody"... */ - Group = 65534; + group = getgrnam("nobody"); + endgrent(); + + if (group) + Group = group->gr_gid; + else + { + /* + * Use the (historical) NFS nobody group ID (-2 as a 16-bit twos- + * complement number...) + */ + + Group = 65534; + } } /* @@ -3239,5 +3251,5 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ /* - * End of "$Id: conf.c 5289 2006-03-14 11:54:45Z mike $". + * End of "$Id: conf.c 5353 2006-03-29 20:31:58Z mike $". */ diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index 02461f447..72fef6351 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -1,5 +1,5 @@ /* - * "$Id: dirsvc.c 5330 2006-03-23 21:07:20Z mike $" + * "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $" * * Directory services routines for the Common UNIX Printing System (CUPS). * @@ -2471,8 +2471,20 @@ send_cups_browse(cupsd_printer_t *p) /* I - Printer to send */ dequote(location, p->location, sizeof(location)); dequote(info, p->info, sizeof(info)); - dequote(make_model, p->make_model ? p->make_model : "Unknown", - sizeof(make_model)); + + if (p->make_model) + dequote(make_model, p->make_model, sizeof(make_model)); + else if (p->type & CUPS_PRINTER_CLASS) + { + if (p->num_printers > 0 && p->printers[0]->make_model) + strlcpy(make_model, p->printers[0]->make_model, sizeof(make_model)); + else + strlcpy(make_model, "Local Printer Class", sizeof(make_model)); + } + else if (p->raw) + strlcpy(make_model, "Local Raw Printer", sizeof(make_model)); + else + strlcpy(make_model, "Local System V Printer", sizeof(make_model)); /* * Send a packet to each browse address... @@ -3116,5 +3128,5 @@ slp_url_callback( /* - * End of "$Id: dirsvc.c 5330 2006-03-23 21:07:20Z mike $". + * End of "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $". */ diff --git a/templates/es/trailer.tmpl b/templates/es/trailer.tmpl index 47ba506a2..55f44824e 100644 --- a/templates/es/trailer.tmpl +++ b/templates/es/trailer.tmpl @@ -8,7 +8,7 @@ WIDTH="15" HEIGHT="15" ALT="">

Common UNIX Printing System, CUPS, y el logo de CUPS son marcas registradas de Easy Software -Products. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products, +Products. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products. Todos los derechos reservados.

diff --git a/tools/listpublic b/tools/listpublic new file mode 100755 index 000000000..d864e7ee6 --- /dev/null +++ b/tools/listpublic @@ -0,0 +1,12 @@ +#!/bin/sh +# +# List public API symbols... +# + +for function in `nm -g *.so | grep "T " | awk '{print $3}' | grep -v '^_' | sort`; do + found=`grep $function\( *.h | grep -v DEPRECATED` + + if test "x$found" != x; then + echo $function + fi +done -- 2.39.2