-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)
/*
- * "$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).
*
* 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 *);
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] == '+')
{
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"),
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)
break;
case 'h' : /* Connect to host */
- if (http != NULL)
+ if (http)
+ {
httpClose(http);
+ http = NULL;
+ }
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
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;
}
+/*
+ * '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.
*/
/*
- * 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 $".
*/
/*
- * "$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).
*
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")));
/*
- * 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 $".
*/
/*
- * "$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.
*
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] = '_';
/*
- * 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 $".
*/
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
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
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
#
-# "$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).
#
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
#
-# End of "$Id: Makefile 5303 2006-03-18 01:05:59Z mike $".
+# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $".
#
/*
- * "$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).
*
* 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);
}
/*
- * 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 $".
*/
/*
- * "$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).
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:
*
/*
- * 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 $".
*/
/*
- * "$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).
*
#include "http-private.h"
#include "globals.h"
+#include "debug.h"
#include <stdlib.h>
* Initialize the global data exactly once...
*/
+ DEBUG_printf(("_cupsGlobals(): globals_key_once=%d\n", globals_key_once));
+
pthread_once(&globals_key_once, globals_init);
/*
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...
*/
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
*/
globals_init()
{
pthread_key_create(&globals_key, globals_destructor);
+
+ DEBUG_printf(("globals_init(): globals_key=%x(%u)\n", globals_key,
+ globals_key));
}
_cups_globals_t *cg; /* Global data */
+ DEBUG_printf(("globals_destructor(value=%p)\n", value));
+
cg = (_cups_globals_t *)value;
httpClose(cg->http);
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);
/*
- * 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 $".
*/
/*
- * "$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).
*
/* 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
/* 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 */
/* Default printer */
char ppd_filename[HTTP_MAX_URI];
/* PPD filename */
-
- /* string.c */
- cups_array_t *stringpool; /* String pool */
} _cups_globals_t;
* 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);
/*
#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 $".
*/
/*
- * "$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).
*
# 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);
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);
/*
- * 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 $".
*/
/*
- * "$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.
*
*port = strtol(uri + 1, (char **)&uri, 10);
- if (*uri != '/')
+ if (*uri != '/' && *uri)
{
*port = 0;
return (HTTP_URI_BAD_PORT);
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 :
/*
- * 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 $".
*/
/*
- * "$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).
*
* Include necessary headers...
*/
+# include <stdio.h>
# include "transcode.h"
# ifdef __cplusplus
* 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);
#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 $".
*/
/*
- * "$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).
*
#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...
*/
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 */
* 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...
free(lang);
}
- cg->lang_cache = NULL;
+ lang_cache = NULL;
+
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&lang_mutex);
+#endif /* HAVE_PTHREAD_H */
}
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 */
}
{
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))
{
* 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);
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);
}
/*
* 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;
*/
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
{
* Return...
*/
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&lang_mutex);
+#endif /* HAVE_PTHREAD_H */
+
return (lang);
}
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 */
}
* 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,
/*
- * 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 $".
*/
/*
- * "$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).
*
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 */
}
/*
- * 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;
}
}
/*
- * 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 $".
*/
/*
- * "$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).
*
#include <stdlib.h>
#include <limits.h>
+#include "array.h"
#include "debug.h"
#include "string.h"
-#include "globals.h"
+#ifdef HAVE_PTHREAD_H
+# include <pthread.h>
+#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 */
/*
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 */
* 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...
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...
item->ref_count ++;
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&sp_mutex);
+#endif /* HAVE_PTHREAD_H */
+
return (item->str);
}
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);
if (!item->str)
{
free(item);
+
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&sp_mutex);
+#endif /* HAVE_PTHREAD_H */
+
return (NULL);
}
* 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);
}
*/
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 */
}
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 */
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...
* 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 */
}
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.
tbytes += item->ref_count * len;
}
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&sp_mutex);
+#endif /* HAVE_PTHREAD_H */
+
/*
* Return values...
*/
/*
- * 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 $".
*/
/*
- * "$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).
*
*/
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);
#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 $".
*/
/*
- * "$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).
*
/* 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, "",
/*
- * 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 $".
*/
/*
- * "$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).
*
* 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.
#include <time.h>
+/*
+ * 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...
*/
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);
*/
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 */
*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;
free(vmap);
}
- cg->vmap_cache = NULL;
+ vmap_cache = NULL;
+
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&map_mutex);
+#endif /* HAVE_PTHREAD_H */
}
{
_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;
}
}
* 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 */
}
_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));
}
/*
- * 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);
}
const int maxout, /* I - Max output */
const cups_encoding_t encoding) /* I - Encoding */
{
+ int bytes; /* Number of bytes converted */
+
+
/*
* Check for valid arguments...
*/
* 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);
}
const int maxout, /* I - Max output */
const cups_encoding_t encoding) /* I - Encoding */
{
+ int bytes; /* Number of bytes converted */
+
+
/*
* Check for valid arguments...
*/
* 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);
}
* 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);
/*
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
*/
- _cupsCharmapFree(encoding);
+ cmap->used --;
return (cupsUTF32ToUTF8(dest, work, maxout));
}
* 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);
/*
*dest = '\0';
- _cupsCharmapFree(encoding);
+ cmap->used --;
return ((int)(dest - start));
}
* 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);
/*
*dest = '\0';
- _cupsCharmapFree(encoding);
+ vmap->used --;
return ((int)(dest - start));
}
* 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);
/*
*workptr = 0;
- _cupsCharmapFree(encoding);
+ vmap->used --;
/*
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
}
+/*
+ * '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.
*/
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);
}
}
{
cupsFileClose(fp);
DEBUG_puts(" Unable to allocate memory!");
+
return (NULL);
}
* 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));
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",
* 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);
}
}
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
DEBUG_printf((" Unable to open file: %s\n", strerror(errno)));
+
return (NULL);
}
if ((mapcount = get_charmap_count(fp)) <= 0)
{
DEBUG_puts(" Unable to get charmap count!");
+
return (NULL);
}
{
cupsFileClose(fp);
DEBUG_puts(" Unable to allocate memory!");
+
return (NULL);
}
* 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));
/*
- * 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 $"
*/
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=
+Name[es]=Administrar impresión
+Comment[es]=Interfaz Web de CUPS
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
-Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products,
+Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
Todos los derechos reservados.</SMALL></P>
</TD>
#
-# "$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).
#
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
#
-# End of "$Id: Makefile 5311 2006-03-19 13:21:42Z mike $".
+# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $".
#
/*
- * "$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).
*
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;
}
{
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)
*/
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...
{
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;
}
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;
}
{
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) ||
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))
/*
- * 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 $".
*/
"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 <riopedre@tiscali.es>\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"
"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!"
"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
"s:%d%s</A>."
msgstr ""
+"Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://%"
+"s:%d%s</A>."
-#, 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"
" 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"
+
"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 <kmuto@debian.org>\n"
"Language-Team: Japanese <LL@li.org>\n"
"MIME-Version: 1.0\n"
msgid ""
"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
"s:%d%s</A>."
-msgstr ""
+msgstr "このページには URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A> を使ってアクセスする必要があります。"
-#, 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"
" 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"
#
-# "$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).
$CUPS_PRIMARY_SYSTEM_GROUP=@CUPS_PRIMARY_SYSTEM_GROUP@
$CUPS_PERM=0@CUPS_CONFIG_FILE_PERM@
+$INSTALLSTATIC=@INSTALLSTATIC@
+
$MAN1EXT=@MAN1EXT@
$MAN5EXT=@MAN5EXT@
$MAN8EXT=@MAN8EXT@
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
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 $".
#
#
-# "$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).
#
%{?_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@
%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
/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
/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
#
-# 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 $".
#
/*
- * "$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.
*
else
snprintf(locale, sizeof(locale), "%s.%s",
con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset);
-
+
con->language = cupsLangGet(locale);
}
else
*/
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
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);
* 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)
/*
- * 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 $".
*/
/*
- * "$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).
*
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;
+ }
}
/*
/*
- * 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 $".
*/
/*
- * "$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).
*
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...
/*
- * 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 $".
*/
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
-Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products,
+Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
Todos los derechos reservados.</SMALL></P>
</TD>
--- /dev/null
+#!/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