]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS trunk, r7566.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 15 May 2008 01:42:36 +0000 (01:42 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 15 May 2008 01:42:36 +0000 (01:42 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@761 a1ca3aef-8c08-0410-bb20-df032aa958be

44 files changed:
CHANGES.txt
Makefile
backend/Makefile
backend/mdns.c
backend/network.c
berkeley/Makefile
cgi-bin/Makefile
conf/Makefile
cups/Makefile
cups/file.c
cups/http-support.c
cups/language.c
cups/localize.c
cups/testfile.c
cups/testhttp.c
cups/testppd.c
cups/transcode.c
data/Makefile
doc/Makefile
doc/cups.css
doc/index.html.in
driver/Makefile
filter/Makefile
fonts/Makefile
locale/Makefile
man/Makefile
man/filter.man
monitor/Makefile
notifier/Makefile
ppdc/Makefile
scheduler/Makefile
scheduler/auth.c
scheduler/conf.h
scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
scheduler/printers.h
scheduler/statbuf.c
scripting/php/Makefile
standards/Makefile
systemv/Makefile
templates/Makefile
templates/header.tmpl.in
test/Makefile

index bb2c8d68e8ea9c9f1841b86dae34e09b39daa1ee..64b2990935fcbd2672bfb14ea1639cef73388e4a 100644 (file)
@@ -1,8 +1,10 @@
-CHANGES.txt - 2008-04-30
+CHANGES.txt - 2008-05-14
 ------------------------
 
 CHANGES IN CUPS V1.4b1
 
+       - Filters can now send PPD: messages to stderr to set PPD
+         keywords like DefaultPageSize while a job is printing.
        - Added a mdns backend for discovery and printing to printers
          that advertise themselves via DNS-SD (Bonjour)
        - The ipp, lpd, and socket backends now support DNS-SD service
index 3b2c44eade67c24ab7610f1d41346e800f5c5dfa..733c86b5328102579bc35037055ddace91288025 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,13 +31,32 @@ DIRS        =       cups filter backend berkeley cgi-bin driver locale man monitor \
 
 all:
        chmod +x cups-config
+       echo Using ARCHFLAGS="$(ARCHFLAGS)"
        echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
        echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
+       echo Using DSOFLAGS="$(DSOFLAGS)"
        echo Using LDFLAGS="$(LDFLAGS)"
        echo Using LIBS="$(LIBS)"
        for dir in $(DIRS); do\
                echo Making all in $$dir... ;\
-               (cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
+               (cd $$dir ; $(MAKE) $(MFLAGS) all) || exit 1;\
+       done
+
+
+#
+# Make library targets...
+#
+
+libs:
+       echo Using ARCHFLAGS="$(ARCHFLAGS)"
+       echo Using ALL_CFLAGS="$(ALL_CFLAGS)"
+       echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)"
+       echo Using DSOFLAGS="$(DSOFLAGS)"
+       echo Using LDFLAGS="$(LDFLAGS)"
+       echo Using LIBS="$(LIBS)"
+       for dir in $(DIRS); do\
+               echo Making all in $$dir... ;\
+               (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\
        done
 
 
@@ -189,10 +208,10 @@ install-headers:
 # Install programs...
 #
 
-install-exec:
+install-exec:  all
        for dir in $(DIRS); do\
                echo Installing programs in $$dir... ;\
-               (cd $$dir; $(MAKE) $(MFLAGS) all install-exec) || exit 1;\
+               (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\
        done
 
 
@@ -200,10 +219,10 @@ install-exec:
 # Install libraries...
 #
 
-install-libs:
+install-libs:  libs
        for dir in $(DIRS); do\
                echo Installing libraries in $$dir... ;\
-               (cd $$dir; $(MAKE) $(MFLAGS) all install-libs) || exit 1;\
+               (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\
        done
 
 
index 45bf74c25ef6317f433d7928d6238e50f6f9fea0..a5e1db3a7fa665d2f6d88b6ae295f7ab602a1bef 100644 (file)
@@ -33,6 +33,13 @@ OBJS =       ipp.o lpd.o mdns.o pap.o parallel.o scsi.o serial.o snmp.o \
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #
index f7f78aae64fede4e8c1336424355064ef7b20539..36782679ed2e2563bcede39b2944302885cd834d 100644 (file)
@@ -262,10 +262,9 @@ main(int  argc,                            /* I - Number of command-line args */
          DNSServiceRefDeallocate(device->ref);
          device->ref = 0;
 
-          httpAssembleURIf(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
-                         schemes[device->type], NULL,
-                         device->cups_shared ? "cups" : "", 0,
-                         "/%s", device->fullName);
+          httpAssembleURI(HTTP_URI_CODING_ALL, device_uri, sizeof(device_uri),
+                         schemes[device->type], NULL, device->fullName, 0,
+                         device->cups_shared ? "/cups" : "/");
 
           printf("network %s \"%s\" \"%s\"\n", device_uri,
                 device->make_and_model ? device->make_and_model : "Unknown",
index 68d346f121c1f3ece4232831564b063bbf0c88d0..d83ea9ccfab341edec7523b15191079cb7d72dbd 100644 (file)
@@ -197,12 +197,11 @@ backendResolveURI(char **argv)            /* I - Command-line arguments */
   * Resolve it as needed...
   */
 
-  if (strstr(resource, "._tcp") || strstr(hostname, "._tcp"))
+  if (strstr(hostname, "._tcp"))
   {
 #ifdef HAVE_DNSSD
     DNSServiceRef      ref;            /* DNS-SD service reference */
-    char               *full_name,     /* Full (service) name */
-                       *regtype,       /* Pointer to type in hostname */
+    char               *regtype,       /* Pointer to type in hostname */
                        *domain;        /* Pointer to domain in hostname */
     static char                resolved_uri[HTTP_MAX_URI];
                                        /* Resolved device URI */
@@ -211,12 +210,7 @@ backendResolveURI(char **argv)             /* I - Command-line arguments */
     * Separate the hostname into service name, registration type, and domain...
     */
 
-    if (strstr(resource, "._tcp"))
-      full_name = resource + 1;
-    else
-      full_name = hostname;
-
-    regtype = strchr(full_name, '.');
+    regtype = strchr(hostname, '.');
     *regtype++ = '\0';
 
     domain = regtype + strlen(regtype) - 1;
@@ -234,9 +228,9 @@ backendResolveURI(char **argv)              /* I - Command-line arguments */
 
     fprintf(stderr,
             "DEBUG: Resolving service \"%s\", regtype \"%s\", domain \"%s\"\n",
-           full_name, regtype, domain ? domain : "(null)");
+           hostname, regtype, domain ? domain : "(null)");
 
-    if (DNSServiceResolve(&ref, 0, 0, full_name, regtype, domain,
+    if (DNSServiceResolve(&ref, 0, 0, hostname, regtype, domain,
                          resolve_callback,
                          resolved_uri) == kDNSServiceErr_NoError)
     {
index 504796ce5803077ab033c799695934fab634935d..7531c01ddf6558c6d1cd9cd809774160e206e9c7 100644 (file)
@@ -26,6 +26,13 @@ OBJS =       lpc.o lpq.o lpr.o lprm.o
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #
index 9a49370f696c1486768b1d4f628d0c62957cdc18..d0c0c01555ff34818c7f7250cb9a44a88b10a0ef 100644 (file)
@@ -42,14 +42,17 @@ CGIS        =       \
                help.cgi \
                jobs.cgi \
                printers.cgi
-TARGETS        =       \
+LIBTARGETS =   \
                libcupscgi.a \
                $(LIBCUPSCGI) \
                $(LIB32CUPSCGI) \
                $(LIB32CUPSCGI) \
-               $(CGIS) \
                testcgi \
-               testhi \
+               testhi
+
+TARGETS        =       \
+               $(LIBTARGETS) \
+               $(CGIS) \
                testtemplate
 
 
@@ -60,6 +63,13 @@ TARGETS      =       \
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Clean all object files...
 #
@@ -352,8 +362,10 @@ printers.cgi:      printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
 
 testcgi:       testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a ../cups/libcups.a \
-               $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
+               ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
+       echo Testing CGI API...
+       ./testcgi
 
 
 #
@@ -362,8 +374,10 @@ testcgi:   testcgi.o ../Makedefs libcupscgi.a ../cups/libcups.a
 
 testhi:        testhi.o ../Makedefs libcupscgi.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testhi.o libcupscgi.a ../cups/libcups.a \
-               $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
+               ../cups/libcups.a $(COMMONLIBS) $(SSLLIBS) $(LIBZ) $(LIBGSSAPI)
+       echo Testing help index API...
+       ./testhi
 
 
 #
index 60154aa0e7e0086913d07159a91952a4529a4724..90ab0cd543bae232e49d6da31ce162ccd235199b 100644 (file)
@@ -30,6 +30,13 @@ REPLACE      =       mime.convs mime.types
 all:
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index 95a3769f8e3d3d708ff359f55b9d19ec03ace785..48e6cedfa1011acb1a90d248cc81a7486a0441ea 100644 (file)
@@ -108,20 +108,23 @@ HEADERS   =       \
 # Targets in this directory...
 #
 
-TARGETS        =       \
+LIBTARGETS =   \
                $(LIBCUPS) \
                $(LIB32CUPS) \
                $(LIB64CUPS) \
                libcups.a \
-               testadmin \
                testarray \
-               testcups \
                testfile \
                testhttp \
                testi18n \
                testipp \
                testlang \
-               testppd \
+               testppd
+
+TARGETS        =       \
+               $(LIBTARGETS) \
+               testadmin \
+               testcups \
                testsnmp
 
 
@@ -132,6 +135,13 @@ TARGETS    =       \
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Remove object and target files...
 #
@@ -382,8 +392,10 @@ testadmin: testadmin.o libcups.a
 
 testarray:     testarray.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testarray.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testarray.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running array API tests...
+       ./testarray
 
 
 #
@@ -402,8 +414,10 @@ testcups:  testcups.o libcups.a
 
 testfile:      testfile.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testfile.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testfile.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running file API tests...
+       ./testfile
 
 
 #
@@ -412,8 +426,10 @@ testfile:  testfile.o libcups.a
 
 testhttp:      testhttp.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testhttp.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhttp.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running HTTP API tests...
+       ./testhttp
 
 
 #
@@ -422,8 +438,10 @@ testhttp:  testhttp.o libcups.a
 
 testipp:       testipp.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testipp.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testipp.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running IPP API tests...
+       ./testipp
 
 
 #
@@ -432,8 +450,10 @@ testipp:   testipp.o libcups.a
 
 testi18n:      testi18n.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testi18n.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testi18n.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running internationalization API tests...
+       ./testi18n
 
 
 #
@@ -442,8 +462,10 @@ testi18n:  testi18n.o libcups.a
 
 testlang:      testlang.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testlang.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testlang.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running language API tests...
+       ./testlang
 
 
 #
@@ -452,8 +474,10 @@ testlang:  testlang.o libcups.a
 
 testppd:       testppd.o libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testppd.o libcups.a \
                $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       echo Running PPD API tests...
+       ./testppd
 
 
 #
index 28453952a83b3c8d1acb8b9c7deb882859b4d64b..d3726cf53448e4513f1e5dbff484dffb61537c63 100644 (file)
@@ -1413,7 +1413,11 @@ cupsFileRewind(cups_file_t *fp)          /* I - CUPS file */
   }
 #endif /* HAVE_LIBZ */
 
-  lseek(fp->fd, 0, SEEK_SET);
+  if (lseek(fp->fd, 0, SEEK_SET))
+  {
+    DEBUG_printf(("cupsFileRewind: lseek failed: %s\n", strerror(errno)));
+    return (-1);
+  }
 
   fp->bufpos = 0;
   fp->pos    = 0;
@@ -1692,7 +1696,7 @@ off_t                                     /* O - File position */
 cupsFileTell(cups_file_t *fp)          /* I - CUPS file */
 {
   DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
-  DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+  DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST (fp ? fp->pos : -1)));
 
   return (fp ? fp->pos : 0);
 }
@@ -1867,7 +1871,7 @@ cups_fill(cups_file_t *fp)                /* I - CUPS file */
                 fp->ptr, fp->end, fp->buf, CUPS_LLCAST fp->bufpos, fp->eof));
 
   if (fp->ptr && fp->end)
-    fp->bufpos += fp->end - fp->ptr;
+    fp->bufpos += fp->end - fp->buf;
 
 #ifdef HAVE_LIBZ
   DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
@@ -1915,7 +1919,8 @@ cups_fill(cups_file_t *fp)                /* I - CUPS file */
        fp->ptr = fp->buf;
        fp->end = fp->buf + bytes;
 
-        DEBUG_printf(("    returning " CUPS_LLFMT "!\n", CUPS_LLCAST bytes));
+        DEBUG_printf(("cups_fill: Returning " CUPS_LLFMT "!\n",
+                     CUPS_LLCAST bytes));
 
        return (bytes);
       }
index a8d58b0bec6d1ff7b6f062485b8b1190c17a601e..145f199940ffd595034bcd8769c88da15abcc838 100644 (file)
@@ -195,15 +195,17 @@ httpAssembleURI(
 
    /*
     * Then add the hostname.  Since IPv6 is a particular pain to deal
-    * with, we have several special cases to deal with...  If we get
+    * with, we have several special cases to deal with.  If we get
     * an IPv6 address with brackets around it, assume it is already in
-    * URI format...
+    * URI format.  Since DNS-SD service names can sometimes look like
+    * raw IPv6 addresses, we specifically look for "._tcp" in the name,
+    * too...
     */
 
-    if (host[0] != '[' && strchr(host, ':'))
+    if (host[0] != '[' && strchr(host, ':') && !strstr(host, "._tcp"))
     {
      /*
-      * We have an IPv6 address...
+      * We have a raw IPv6 address...
       */
 
       if (strchr(host, '%'))
@@ -263,7 +265,7 @@ httpAssembleURI(
       * Otherwise, just copy the host string...
       */
 
-      ptr = http_copy_encode(ptr, host, end, NULL, NULL,
+      ptr = http_copy_encode(ptr, host, end, ":/?#[]@", NULL,
                              encoding & HTTP_URI_CODING_HOSTNAME);
 
       if (!ptr)
index eb041b0ca41b600d1b868c7ececd44386f18e396..2949b350761133d51637a45e82520fa6b2cd6cf4 100644 (file)
@@ -441,8 +441,13 @@ cupsLangGet(const char *language)  /* I - Language or locale */
   * preference so we have to look it up this way...
   */
 
-  if (!language && (language = getenv("LANG")) == NULL)
-    language = appleLangDefault();
+  if (!language)
+  {
+    if ((language = getenv("LANG")) == NULL)
+      language = appleLangDefault();
+
+    DEBUG_printf(("cupsLangGet: language=\"%s\"\n", language));
+  }
 
 #else
  /*
@@ -705,6 +710,8 @@ cupsLangGet(const char *language)   /* I - Language or locale */
     pthread_mutex_unlock(&lang_mutex);
 #endif /* HAVE_PTHREAD_H */
 
+    DEBUG_printf(("cupsLangGet: Using cached copy of \"%s\"...\n", real));
+
     return (lang);
   }
 
@@ -892,14 +899,21 @@ _cupsMessageLoad(const char *filename)    /* I - Message catalog to load */
   */
 
   if ((a = cupsArrayNew((cups_array_func_t)cups_message_compare, NULL)) == NULL)
+  {
+    DEBUG_puts("_cupsMessageLoad: Unable to allocate array!");
     return (NULL);
+  }
 
  /*
   * Open the message catalog file...
   */
 
   if ((fp = cupsFileOpen(filename, "r")) == NULL)
+  {
+    DEBUG_printf(("_cupsMessageLoad: Unable to open file: %s\n",
+                  strerror(errno)));
     return (a);
+  }
 
  /*
   * Read messages from the catalog file until EOF...
@@ -1050,6 +1064,9 @@ _cupsMessageLoad(const char *filename)    /* I - Message catalog to load */
 
   cupsFileClose(fp);
 
+  DEBUG_printf(("_cupsMessageLoad: Returning %d messages...\n",
+                cupsArrayCount(a)));
+
   return (a);
 }
 
index 17453961c219df5d605ee8b0720d11b79773a9a6..3136d4b7e64764fbe0144486b0becbcc8f2b3a15 100644 (file)
@@ -574,7 +574,7 @@ _ppdLocalizedAttr(ppd_file_t *ppd,  /* I - PPD file */
   snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll_CC, keyword);
   if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL)
   {
-    snprintf(lkeyword, sizeof(lkeyword), "%2s.%s", ll_CC, keyword);
+    snprintf(lkeyword, sizeof(lkeyword), "%2.2s.%s", ll_CC, keyword);
     attr = ppdFindAttr(ppd, lkeyword, spec);
 
     if (!attr)
index d8a1b88c9535d7c57879684471921087e6bfa302..2140765c971d1392d9f749830b858e3f9cff4a33 100644 (file)
@@ -17,6 +17,7 @@
  * Contents:
  *
  *   main()             - Main entry.
+ *   count_lines()      - Count the number of lines in a file.
  *   random_tests()     - Do random access tests.
  *   read_write_tests() - Perform read/write tests.
  */
@@ -43,6 +44,7 @@
  * Local functions...
  */
 
+static int     count_lines(cups_file_t *fp);
 static int     random_tests(void);
 static int     read_write_tests(int compression);
 
@@ -57,8 +59,10 @@ main(int  argc,                              /* I - Number of command-line arguments */
 {
   int          status;                 /* Exit status */
   char         filename[1024];         /* Filename buffer */
+  cups_file_t  *fp;                    /* File pointer */
   int          fds[2];                 /* Open file descriptors */
   cups_file_t  *fdfile;                /* File opened with cupsFileOpenFd() */
+  int          count;                  /* Number of lines in file */
 
 
   if (argc == 1)
@@ -119,6 +123,55 @@ main(int  argc,                            /* I - Number of command-line arguments */
       puts("PASS");
     }
 
+   /*
+    * Count lines in euc-jp.txt, rewind, then count again.
+    */
+
+    fputs("\ncupsFileOpen(\"../data/euc-jp.txt\", \"r\"): ", stdout);
+
+    if ((fp = cupsFileOpen("../data/euc-jp.txt", "r")) == NULL)
+    {
+      puts("FAIL");
+      status ++;
+    }
+    else
+    {
+      puts("PASS");
+      fputs("cupsFileGets: ", stdout);
+
+      if ((count = count_lines(fp)) != 15184)
+      {
+        printf("FAIL (got %d lines, expected 15184)\n", count);
+       status ++;
+      }
+      else
+      {
+        puts("PASS");
+       fputs("cupsFileRewind: ", stdout);
+
+       if (cupsFileRewind(fp) != 0)
+       {
+         puts("FAIL");
+         status ++;
+       }
+       else
+       {
+         puts("PASS");
+         fputs("cupsFileGets: ", stdout);
+
+         if ((count = count_lines(fp)) != 15184)
+         {
+           printf("FAIL (got %d lines, expected 15184)\n", count);
+           status ++;
+         }
+         else
+           puts("PASS");
+        }
+      }
+
+      cupsFileClose(fp);
+    }
+
    /*
     * Test path functions...
     */
@@ -153,10 +206,8 @@ main(int  argc,                            /* I - Number of command-line arguments */
     * Cat the filename on the command-line...
     */
 
-    cups_file_t        *fp;                    /* File pointer */
     char       line[1024];             /* Line from file */
 
-
     if ((fp = cupsFileOpen(argv[1], "r")) == NULL)
     {
       perror(argv[1]);
@@ -180,6 +231,23 @@ main(int  argc,                            /* I - Number of command-line arguments */
 }
 
 
+/*
+ * 'count_lines()' - Count the number of lines in a file.
+ */
+
+static int                             /* O - Number of lines */
+count_lines(cups_file_t *fp)           /* I - File to read from */
+{
+  int  count;                          /* Number of lines */
+  char line[1024];                     /* Line buffer */
+
+
+  for (count = 0; cupsFileGets(fp, line, sizeof(line)); count ++);
+
+  return (count);
+}
+
+
 /*
  * 'random_tests()' - Do random access tests.
  */
index 37f850c9b3fa56bc475e5577d7c4554b62e84349..fa9282f4a09b0a7b6a515651e3b212583c17af33 100644 (file)
@@ -93,6 +93,8 @@ static uri_test_t     uri_tests[] =   /* URI test data */
                            "ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 },
                          { HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400",
                            "http", "", "server", "/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400", 80, 0 },
+                         { HTTP_URI_OK, "lpd://Acme%20Laser%20(01%3A23%3A45).local._tcp._printer/",
+                           "lpd", "", "Acme Laser (01:23:45).local._tcp._printer", "/", 515, 0 },
 
                          /* Missing scheme */
                          { HTTP_URI_MISSING_SCHEME, "/path/to/file/index.html",
index 9efa851f5a32e5af2a3923accaf4ed33cff36de8..46e070c62885b969ecf5b400c1b444bf489294ee 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <cups/string.h>
+#include <sys/stat.h>
 #include <errno.h>
 #include "ppd.h"
 #ifdef WIN32
@@ -106,6 +107,25 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
   if (argc == 1)
   {
+   /*
+    * Setup directories for locale stuff...
+    */
+
+    if (access("locale", 0))
+    {
+      mkdir("locale", 0777);
+      mkdir("locale/fr", 0777);
+      symlink("../../../locale/cups_fr.po", "locale/fr/cups_fr.po");
+      mkdir("locale/zh_TW", 0777);
+      symlink("../../../locale/cups_zh_TW.po", "locale/zh_TW/cups_zh_TW.po");
+    }
+
+    putenv("LOCALEDIR=locale");
+
+   /*
+    * Do tests with test.ppd...
+    */
+
     fputs("ppdOpenFile: ", stdout);
 
     if ((ppd = ppdOpenFile("test.ppd")) != NULL)
index 036106edc9d1bcebcfe45d0b9a4f60f1c915f456..7a79b2a550b6c40214d4b22d6888c388384d7767 100644 (file)
@@ -473,11 +473,18 @@ cupsUTF8ToUTF32(
   * Check for valid arguments and clear output...
   */
 
+  DEBUG_printf(("cupsUTF8ToUTF32(dest=%p, src=\"%s\", maxout=%d)\n", dest,
+                src ? (const char *)src : "(null)", maxout));
+
   if (dest)
     *dest = 0;
 
   if (!dest || !src || maxout < 1 || maxout > CUPS_MAX_USTRING)
+  {
+    DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad arguments)");
+
     return (-1);
+  }
 
  /*
   * Convert input UTF-8 to output UTF-32 (and insert BOM)...
@@ -500,6 +507,8 @@ cupsUTF8ToUTF32(
       */
 
       *dest++ = ch;
+
+      DEBUG_printf(("cupsUTF8ToUTF32: %02x => %08X\n", src[-1], ch));
       continue;
     }
     else if ((ch & 0xe0) == 0xc0)
@@ -509,8 +518,12 @@ cupsUTF8ToUTF32(
       */
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = ((ch & 0x1f) << 6) | (next & 0x3f);
 
@@ -519,9 +532,16 @@ cupsUTF8ToUTF32(
       */
 
       if (ch32 < 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       *dest++ = ch32;
+
+      DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x => %08X\n",
+                    src[-2], src[-1], (unsigned)ch32));
     }
     else if ((ch & 0xf0) == 0xe0)
     {
@@ -530,14 +550,22 @@ cupsUTF8ToUTF32(
       */
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = ((ch & 0x0f) << 6) | (next & 0x3f);
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = (ch32 << 6) | (next & 0x3f);
 
@@ -546,9 +574,16 @@ cupsUTF8ToUTF32(
       */
 
       if (ch32 < 0x800)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       *dest++ = ch32;
+
+      DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x %02x => %08X\n",
+                    src[-3], src[-2], src[-1], (unsigned)ch32));
     }
     else if ((ch & 0xf8) == 0xf0)
     {
@@ -557,20 +592,32 @@ cupsUTF8ToUTF32(
       */
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = ((ch & 0x07) << 6) | (next & 0x3f);
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = (ch32 << 6) | (next & 0x3f);
 
       next = *src++;
-      if (!next)
+      if ((next & 0xc0) != 0x80)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       ch32 = (ch32 << 6) | (next & 0x3f);
 
@@ -579,9 +626,16 @@ cupsUTF8ToUTF32(
       */
 
       if (ch32 < 0x10000)
+      {
+        DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
        return (-1);
+      }
 
       *dest++ = ch32;
+
+      DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x %02x %02x => %08X\n",
+                    src[-4], src[-3], src[-2], src[-1], (unsigned)ch32));
     }
     else
     {
@@ -589,6 +643,8 @@ cupsUTF8ToUTF32(
       * More than 4-octet (invalid UTF-8 sequence)...
       */
 
+      DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+
       return (-1);
     }
 
@@ -602,7 +658,9 @@ cupsUTF8ToUTF32(
 
   *dest = 0;
 
-  return (i);
+  DEBUG_printf(("cupsUTF8ToUTF32: Returning %d characters\n", maxout - 1 - i));
+
+  return (maxout - 1 - i);
 }
 
 
@@ -638,11 +696,18 @@ cupsUTF32ToUTF8(
   * Check for valid arguments and clear output...
   */
 
+  DEBUG_printf(("cupsUTF32ToUTF8(dest=%p, src=%p, maxout=%d)\n", dest, src,
+                maxout));
+
   if (dest)
     *dest = '\0';
 
   if (!dest || !src || maxout < 1)
+  {
+    DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (bad args)");
+
     return (-1);
+  }
 
  /*
   * Check for leading BOM in UTF-32 and inverted BOM...
@@ -651,6 +716,8 @@ cupsUTF32ToUTF8(
   start = dest;
   swap  = *src == 0xfffe0000;
 
+  DEBUG_printf(("cupsUTF32ToUTF8: swap=%d\n", swap));
+
   if (*src == 0xfffe0000 || *src == 0xfeff)
     src ++;
 
@@ -675,7 +742,11 @@ cupsUTF32ToUTF8(
     */
 
     if (ch > 0x10ffff)
+    {
+      DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (character out of range)");
+
       return (-1);
+    }
 
    /*
     * Convert UTF-32 character to UTF-8 character(s)...
@@ -689,6 +760,8 @@ cupsUTF32ToUTF8(
 
       *dest++ = (cups_utf8_t)ch;
       i --;
+
+      DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x\n", (unsigned)ch, dest[-1]));
     }
     else if (ch < 0x800)
     {
@@ -697,11 +770,18 @@ cupsUTF32ToUTF8(
       */
 
       if (i < 2)
+      {
+        DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (too long 2)");
+
         return (-1);
+      }
 
       *dest++ = (cups_utf8_t)(0xc0 | ((ch >> 6) & 0x1f));
       *dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
       i -= 2;
+
+      DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x\n", (unsigned)ch,
+                    dest[-2], dest[-1]));
     }
     else if (ch < 0x10000)
     {
@@ -710,12 +790,19 @@ cupsUTF32ToUTF8(
       */
 
       if (i < 3)
+      {
+        DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (too long 3)");
+
         return (-1);
+      }
 
       *dest++ = (cups_utf8_t)(0xe0 | ((ch >> 12) & 0x0f));
       *dest++ = (cups_utf8_t)(0x80 | ((ch >> 6) & 0x3f));
       *dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
       i -= 3;
+
+      DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x %02x\n", (unsigned)ch,
+                    dest[-3], dest[-2], dest[-1]));
     }
     else
     {
@@ -731,11 +818,16 @@ cupsUTF32ToUTF8(
       *dest++ = (cups_utf8_t)(0x80 | ((ch >> 6) & 0x3f));
       *dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
       i -= 4;
+
+      DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x %02x %02x\n",
+                    (unsigned)ch, dest[-4], dest[-3], dest[-2], dest[-1]));
     }
   }
 
   *dest = '\0';
 
+  DEBUG_printf(("cupsUTF32ToUTF8: Returning %d\n", (int)(dest - start)));
+
   return ((int)(dest - start));
 }
 
@@ -922,19 +1014,30 @@ conv_utf8_to_vbcs(
                *workptr;               /* Pointer into string */
 
 
+  DEBUG_printf(("conv_utf8_to_vbcs(dest=%p, src=\"%s\", maxout=%d, "
+                "encoding=%d)\n", dest, src, maxout, encoding));
+
  /*
   * Find legacy charset map in cache...
   */
 
   if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
+  {
+    DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (no charmap)");
+
     return (-1);
+  }
 
  /*
   * Convert input UTF-8 to internal UCS-4 (and insert BOM)...
   */
 
   if (cupsUTF8ToUTF32(work, src, CUPS_MAX_USTRING) < 0)
+  {
+    DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (Unable to convert to UTF-32)");
+
     return (-1);
+  }
 
  /*
   * Convert internal UCS-4 to VBCS legacy charset (and delete BOM)...
@@ -943,8 +1046,6 @@ conv_utf8_to_vbcs(
   for (start = dest, workptr = work + 1; *workptr && maxout > 1; maxout --)
   {
     unichar = *workptr++;
-    if (!unichar)
-      break;
 
    /*
     * Convert ASCII verbatim (optimization)...
@@ -953,6 +1054,10 @@ conv_utf8_to_vbcs(
     if (unichar < 0x80)
     {
       *dest++ = (cups_sbcs_t)unichar;
+
+      DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X\n", (unsigned)unichar,
+                    dest[-1]));
+
       continue;
     }
 
@@ -977,7 +1082,11 @@ conv_utf8_to_vbcs(
     if (legchar > 0xffffff)
     {
       if (maxout < 5)
+      {
+        DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (out of space)");
+
         return (-1);
+      }
 
       *dest++ = (cups_sbcs_t)(legchar >> 24);
       *dest++ = (cups_sbcs_t)(legchar >> 16);
@@ -985,17 +1094,27 @@ conv_utf8_to_vbcs(
       *dest++ = (cups_sbcs_t)legchar;
 
       maxout -= 3;
+
+      DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X %02X %02X\n",
+                    (unsigned)unichar, dest[-4], dest[-3], dest[-2], dest[-1]));
     }
     else if (legchar > 0xffff)
     {
       if (maxout < 4)
+      {
+        DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (out of space)");
+
         return (-1);
+      }
 
       *dest++ = (cups_sbcs_t)(legchar >> 16);
       *dest++ = (cups_sbcs_t)(legchar >> 8);
       *dest++ = (cups_sbcs_t)legchar;
 
       maxout -= 2;
+
+      DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X %02X\n",
+                    (unsigned)unichar, dest[-3], dest[-2], dest[-1]));
     }
     else if (legchar > 0xff)
     {
@@ -1003,6 +1122,16 @@ conv_utf8_to_vbcs(
       *dest++ = (cups_sbcs_t)legchar;
 
       maxout --;
+
+      DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X\n",
+                    (unsigned)unichar, dest[-2], dest[-1]));
+    }
+    else
+    {
+      *dest++ = legchar;
+
+      DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X\n",
+                    (unsigned)unichar, dest[-1]));
     }
   }
 
@@ -1010,6 +1139,9 @@ conv_utf8_to_vbcs(
 
   vmap->used --;
 
+  DEBUG_printf(("conv_utf8_to_vbcs: Returning %d characters\n",
+                (int)(dest - start)));
+
   return ((int)(dest - start));
 }
 
@@ -1038,8 +1170,15 @@ conv_vbcs_to_utf8(
   * Find legacy charset map in cache...
   */
 
+  DEBUG_printf(("conv_vbcs_to_utf8(dest=%p, src=%p, maxout=%d, encoding=%d)\n",
+                dest, src, maxout, encoding));
+
   if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
+  {
+    DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (NULL vmap)");
+
     return (-1);
+  }
 
  /*
   * Convert input legacy charset to internal UCS-4 (and insert BOM)...
@@ -1058,6 +1197,9 @@ conv_vbcs_to_utf8(
     if (legchar < 0x80)
     {
       *workptr++ = (cups_utf32_t)legchar;
+
+      DEBUG_printf(("conv_vbcs_to_utf8: %02X => %08X\n", src[-1],
+                    (unsigned)legchar));
       continue;
     }
 
@@ -1068,7 +1210,11 @@ conv_vbcs_to_utf8(
     if (vmap->lead2char[(int)leadchar] == leadchar)
     {
       if (!*src)
+      {
+        DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string)");
+
        return (-1);
+      }
 
       legchar = (legchar << 8) | *src++;
   
@@ -1084,6 +1230,9 @@ conv_vbcs_to_utf8(
        *workptr++ = 0xfffd;
       else
        *workptr++ = (cups_utf32_t)*crow;
+
+      DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X => %08X\n",
+                    src[-2], src[-1], (unsigned)workptr[-1]));
       continue;
     }
 
@@ -1094,7 +1243,11 @@ conv_vbcs_to_utf8(
     if (vmap->lead3char[(int)leadchar] == leadchar)
     {
       if (!*src || !src[1])
+      {
+        DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string 2)");
+
        return (-1);
+      }
 
       legchar = (legchar << 8) | *src++;
       legchar = (legchar << 8) | *src++;
@@ -1102,14 +1255,22 @@ conv_vbcs_to_utf8(
     else if (vmap->lead4char[(int)leadchar] == leadchar)
     {
       if (!*src || !src[1] || !src[2])
+      {
+        DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string 3)");
+
        return (-1);
+      }
 
       legchar = (legchar << 8) | *src++;
       legchar = (legchar << 8) | *src++;
       legchar = (legchar << 8) | *src++;
     }
     else
+    {
+      DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (bad character)");
+
       return (-1);
+    }
 
    /*
     * Find 3-byte or 4-byte legacy character...
@@ -1129,12 +1290,22 @@ conv_vbcs_to_utf8(
       *workptr++ = 0xfffd;
     else
       *workptr++ = wide2uni->unichar;
+
+    if (vmap->lead3char[(int)leadchar] == leadchar)
+      DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X %02X => %08X\n",
+                   src[-3], src[-2], src[-1], (unsigned)workptr[-1]));
+    else
+      DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X %02X %02X => %08X\n",
+                   src[-4], src[-3], src[-2], src[-1], (unsigned)workptr[-1]));
   }
 
   *workptr = 0;
 
   vmap->used --;
 
+  DEBUG_printf(("conv_vbcs_to_utf8: Converting %d UTF-32 characters to UTF-8\n",
+                (int)(workptr - work)));
+
  /*
   * Convert internal UCS-4 to output UTF-8 (and delete BOM)...
   */
@@ -1204,6 +1375,8 @@ get_charmap(
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 
 
+  DEBUG_printf(("get_charmap(encoding=%d)\n", encoding));
+
  /*
   * Get the data directory and charset map name...
   */
@@ -1211,7 +1384,7 @@ get_charmap(
   snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
           cg->cups_datadir, _cupsEncodingName(encoding));
 
-  DEBUG_printf(("    filename=\"%s\"\n", filename));
+  DEBUG_printf(("get_charmap: filename=\"%s\"\n", filename));
 
  /*
   * Read charset map input file into cache...
@@ -1281,12 +1454,15 @@ get_sbcs_charmap(
   * See if we already have this SBCS charset map loaded...
   */
 
+  DEBUG_printf(("get_sbcs_charmap(encoding=%d, filename=\"%s\")\n", encoding,
+                filename));
+
   for (cmap = cmap_cache; cmap; cmap = cmap->next)
   {
     if (cmap->encoding == encoding)
     {
       cmap->used ++;
-      DEBUG_printf(("    returning existing cmap=%p\n", cmap));
+      DEBUG_printf(("get_sbcs_charmap: Returning existing cmap=%p\n", cmap));
 
       return ((void *)cmap);
     }
@@ -1297,7 +1473,11 @@ get_sbcs_charmap(
   */
 
   if ((fp = cupsFileOpen(filename, "r")) == NULL)
+  {
+    DEBUG_printf(("get_sbcs_charmap: Returning NULL (%s)\n", strerror(errno)));
+
     return (NULL);
+  }
 
  /*
   * Allocate memory for SBCS charset map...
@@ -1306,7 +1486,7 @@ get_sbcs_charmap(
   if ((cmap = (_cups_cmap_t *)calloc(1, sizeof(_cups_cmap_t))) == NULL)
   {
     cupsFileClose(fp);
-    DEBUG_puts("    Unable to allocate memory!");
+    DEBUG_puts("get_sbcs_charmap: Returning NULL (Unable to allocate memory)");
 
     return (NULL);
   }
@@ -1378,7 +1558,7 @@ get_sbcs_charmap(
   cmap->next = cmap_cache;
   cmap_cache = cmap;
 
-  DEBUG_printf(("    returning new cmap=%p\n", cmap));
+  DEBUG_printf(("get_sbcs_charmap: Returning new cmap=%p\n", cmap));
 
   return (cmap);
 
@@ -1392,7 +1572,7 @@ get_sbcs_charmap(
 
   cupsFileClose(fp);
 
-  DEBUG_puts("    Error, returning NULL!");
+  DEBUG_puts("get_sbcs_charmap: Returning NULL (Read/format error)");
 
   return (NULL);
 }
@@ -1434,7 +1614,7 @@ get_vbcs_charmap(
     if (vmap->encoding == encoding)
     {
       vmap->used ++;
-      DEBUG_printf(("    returning existing vmap=%p\n", vmap));
+      DEBUG_printf(("get_vbcs_charmap: Returning existing vmap=%p\n", vmap));
 
       return ((void *)vmap);
     }
@@ -1446,7 +1626,7 @@ get_vbcs_charmap(
 
   if ((fp = cupsFileOpen(filename, "r")) == NULL)
   {
-    DEBUG_printf(("    Unable to open file: %s\n", strerror(errno)));
+    DEBUG_printf(("get_vbcs_charmap: Returning NULL (%s)\n", strerror(errno)));
 
     return (NULL);
   }
@@ -1457,14 +1637,14 @@ get_vbcs_charmap(
 
   if ((mapcount = get_charmap_count(fp)) <= 0)
   {
-    DEBUG_puts("    Unable to get charmap count!");
+    DEBUG_puts("get_vbcs_charmap: Unable to get charmap count!");
 
     cupsFileClose(fp);
 
     return (NULL);
   }
 
-  DEBUG_printf(("    mapcount=%d\n", mapcount));
+  DEBUG_printf(("get_vbcs_charmap: mapcount=%d\n", mapcount));
 
  /*
   * Allocate memory for DBCS/VBCS charset map...
@@ -1472,7 +1652,7 @@ get_vbcs_charmap(
 
   if ((vmap = (_cups_vmap_t *)calloc(1, sizeof(_cups_vmap_t))) == NULL)
   {
-    DEBUG_puts("    Unable to allocate memory!");
+    DEBUG_puts("get_vbcs_charmap: Unable to allocate memory!");
 
     cupsFileClose(fp);
 
@@ -1516,22 +1696,20 @@ get_vbcs_charmap(
     * Save lead char of 2/3/4-byte legacy char...
     */
 
-    if (legchar > 0xff && legchar <= 0xffff)
+    if (legchar > 0xffffff)
     {
-      leadchar                  = (cups_sbcs_t)(legchar >> 8);
-      vmap->lead2char[leadchar] = leadchar;
+      leadchar                  = (cups_sbcs_t)(legchar >> 24);
+      vmap->lead4char[leadchar] = leadchar;
     }
-
-    if (legchar > 0xffff && legchar <= 0xffffff)
+    else if (legchar > 0xffff)
     {
       leadchar                  = (cups_sbcs_t)(legchar >> 16);
       vmap->lead3char[leadchar] = leadchar;
     }
-
-    if (legchar > 0xffffff)
+    else if (legchar > 0xff)
     {
-      leadchar                  = (cups_sbcs_t)(legchar >> 24);
-      vmap->lead4char[leadchar] = leadchar;
+      leadchar                  = (cups_sbcs_t)(legchar >> 8);
+      vmap->lead2char[leadchar] = leadchar;
     }
 
    /*
@@ -1618,10 +1796,10 @@ get_vbcs_charmap(
   * Add it to the cache and return...
   */
 
-  vmap->next     = vmap_cache;
+  vmap->next = vmap_cache;
   vmap_cache = vmap;
 
-  DEBUG_printf(("    returning new vmap=%p\n", vmap));
+  DEBUG_printf(("get_vbcs_charmap: Returning new vmap=%p\n", vmap));
 
   return (vmap);
 
@@ -1635,7 +1813,7 @@ get_vbcs_charmap(
 
   cupsFileClose(fp);
 
-  DEBUG_puts("    Error, returning NULL!");
+  DEBUG_puts("get_vbcs_charmap: Returning NULL (Read/format error)");
 
   return (NULL);
 }
index 810be4c90a116f17583264f0c474ab5d5f3aa515..3722a172a4d4d492048ecd24c758a8f2d87e24ca 100644 (file)
@@ -92,6 +92,13 @@ PPDCFILES =  \
 all:
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index 122d91561aba2eb1cafc30d6da2ce3edd5e0e755..950f4bb8cc1779e7bb8a78b1c10f80370fcce579 100644 (file)
@@ -125,6 +125,13 @@ HELPFILES  =       \
 all:
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Remove all generated files...
 #
index faaef123a1b9b3cd6458396c72776bce92a7d98c..637f3d885beacd4d24e9ad6af405e756e069877e 100644 (file)
@@ -91,8 +91,7 @@ TD.body {
 }
 
 TD.sel, TD.unsel {
-  border-left: thin solid #aaaaaa;
-  font-size: 120%;
+  border-left: thin solid #cccccc;
   padding: 0px 5px;
   text-align: center;
   vertical-align: middle;
@@ -107,24 +106,9 @@ TD.unsel {
   background: url(images/unsel.gif);
 }
 
-TD.sel A, TD.sel A:hover {
-  color: white;
-  font-weight: normal;
-  text-decoration: none;
-}
-
-TD.unsel A, TD.unsel A:visited {
-  color: #333333;
-  font-weight: normal;
-}
-
-TD.unsel:hover {
-  background: url(images/unsel-hover.gif);
-  color: white;
-}
-
-TD.unsel A:link:hover, TD.unsel A:visited:hover, TD.unsel A:active {
-  color: white;
+TD.sel A, TD.sel A:hover, TD.unsel A:link:hover, TD.unsel A:visited:hover,
+TD.unsel A:active, TD.unsel A, TD.unsel A:visited {
+  color: #666666;
   font-weight: normal;
   text-decoration: none;
 }
@@ -280,7 +264,7 @@ DIV.sidebar P.l2 {
 
 TABLE.inset {
   background: #f0f0f0;
-  border: inset 1px #eeeeee;
+  border: thin solid #e0e0e0;
   padding: 0;
   /* These are not implemented by all browsers, but that's OK */
   border-radius: 5px;
index 401df41c05a4639fa6287e2e8c7aff240efa6eca..c5aa362631b046519300a41d80a6c7f1119d565a 100644 (file)
@@ -10,9 +10,9 @@
 <TABLE CLASS="page" SUMMARY="{title}">
 <TR><TD CLASS="body">
 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
-<TR HEIGHT="32">
+<TR HEIGHT="36">
 <TD><A HREF="http://www.cups.org/" TARGET="_blank"><IMG
-SRC="/images/left.gif" WIDTH="64" HEIGHT="32" BORDER="0" ALT=""></A></TD>
+SRC="/images/left.gif" WIDTH="64" HEIGHT="36" BORDER="0" ALT=""></A></TD>
 <TD CLASS="sel"><A HREF="/">&nbsp;&nbsp;Home&nbsp;&nbsp;</A></TD>
 <TD CLASS="unsel"><A HREF="/admin">&nbsp;&nbsp;Administration&nbsp;&nbsp;</A></TD>
 <TD CLASS="unsel"><A HREF="/classes/">&nbsp;&nbsp;Classes&nbsp;&nbsp;</A></TD>
@@ -22,10 +22,9 @@ SRC="/images/left.gif" WIDTH="64" HEIGHT="32" BORDER="0" ALT=""></A></TD>
 <TD CLASS="unsel" WIDTH="100%"><FORM ACTION="/help/" METHOD="GET"><INPUT
 TYPE="SEARCH" NAME="QUERY" SIZE="20" PLACEHOLDER="Search Help"
 AUTOSAVE="org.cups.help" RESULTS="20"></FORM></TD>
-<TD><IMG SRC="/images/right.gif" WIDTH="16" HEIGHT="32" ALT=""></TD>
+<TD><IMG SRC="/images/right.gif" WIDTH="4" HEIGHT="36" ALT=""></TD>
 </TR>
 </TABLE>
-<IMG SRC="/images/shadow.png" WIDTH="100%" HEIGHT="4" ALT="">
 
 <H1>Common UNIX Printing System @CUPS_VERSION@@CUPS_REVISION@</H1>
 
index f94ec6fc126a1ffe8ebfb50003a0c0cc025a8be7..accaacc13548e8753fe3109cc8f60d777e0065ce 100644 (file)
@@ -49,18 +49,20 @@ OBJS                = \
                $(LIB32OBJS) \
                $(LIB64OBJS)
 
-TARGETS                = \
+LIBTARGETS =   \
                $(LIBCUPSDRIVER) \
                $(LIB32CUPSDRIVER) \
                $(LIB64CUPSDRIVER) \
                libcupsdriver.a \
-               commandtoescpx \
-               commandtopclx \
-               rastertoescpx \
-               rastertopclx \
                testcmyk \
                testdither \
                testrgb
+TARGETS =      \
+               $(LIBTARGETS) \
+               commandtoescpx \
+               commandtopclx \
+               rastertoescpx \
+               rastertopclx
 
 
 #
@@ -70,6 +72,13 @@ TARGETS              = \
 all:           $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Clean everything...
 #
@@ -273,12 +282,13 @@ rastertopclx:             rastertopclx.o pcl-common.o $(LIBCUPSDRIVER) \
 
 testcmyk:              testcmyk.o libcupsdriver.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testcmyk.o libcupsdriver.a ../cups/libcups.a \
-               $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcmyk.o libcupsdriver.a \
+               ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
        if test ! -d test; then \
                mkdir test; \
        fi
-       ./testcmyk > test/testcmyk.log 2>&1 || echo "CMYK tests failed!"
+       echo Running CMYK API tests...
+       ./testcmyk > test/testcmyk.log
 
 
 #
@@ -287,19 +297,20 @@ testcmyk:         testcmyk.o libcupsdriver.a ../cups/libcups.a
 
 testdither:            testdither.o libcupsdriver.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testdither.o libcupsdriver.a ../cups/libcups.a \
-               $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testdither.o libcupsdriver.a \
+               ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
        if test ! -d test; then \
                mkdir test; \
        fi
-       ./testdither > test/0-255.pgm 2>test/0-255.log || echo "Dither 0-255 test failed!"
-       ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log || echo "Dither 0-127-255 test failed!"
-       ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log || echo "Dither 0-85-170-255 test failed!"
-       ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log || echo "Dither 0-63-127-170-198-227-255 test failed!"
-       ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log || echo "Dither 0-210-383 test failed!"
-       ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log || echo "Dither 0-82-255 test failed!"
-       ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log || echo "Dither 0-510 test failed!"
-       ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log || echo "Dither 0-1020 test failed!"
+       echo Running dither API tests...
+       ./testdither > test/0-255.pgm 2>test/0-255.log
+       ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log
+       ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log
+       ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log
+       ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log
+       ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log
+       ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log
+       ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log
 
 
 #
@@ -308,11 +319,12 @@ testdither:               testdither.o libcupsdriver.a ../cups/libcups.a
 
 testrgb:               testrgb.o libcupsdriver.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testrgb.o libcupsdriver.a ../cups/libcups.a \
-               $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testrgb.o libcupsdriver.a \
+               ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
        if test ! -d test; then \
                mkdir test; \
        fi
+       echo Running RGB API tests...
        ./testrgb > test/testrgb.log 2>&1 || echo "RGB tests failed!"
 
 
index 09df33085ec3e400dce7281d8dce1cbf1160cf2c..61d578ce7f552f9a12dac878f228e297af906639 100644 (file)
 include ../Makedefs
 
 
-FILTERS        =       commandtops gziptoany hpgltops texttops pstops $(IMGFILTERS) \
-               $(PDFTOPS) rastertolabel rastertoepson rastertohp
-TARGETS        =       $(FILTERS) \
+FILTERS        =       \
+               commandtops \
+               gziptoany \
+               hpgltops \
+               texttops \
+               pstops \
+               $(IMGFILTERS) \
+               $(PDFTOPS) \
+               rastertolabel \
+               rastertoepson \
+               rastertohp
+LIBTARGETS =   \
                $(LIBCUPSIMAGE) \
                libcupsimage.a \
                $(LIB32CUPSIMAGE) \
                $(LIB64CUPSIMAGE) \
-               rasterbench \
-               testimage \
                testraster
+TARGETS        =       \
+               $(LIBTARGETS) \
+               $(FILTERS) \
+               rasterbench \
+               testimage
 
 HPGLOBJS =     hpgl-attr.o hpgl-config.o hpgl-main.o hpgl-prolog.o \
                hpgl-char.o hpgl-input.o hpgl-polygon.o hpgl-vector.o
@@ -52,6 +64,13 @@ OBJS =       $(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Clean all object files...
 #
@@ -408,8 +427,11 @@ rastertohp:        rastertohp.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
 
 testraster:    testraster.o ../cups/libcups.a libcupsimage.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testraster.o libcupsimage.a ../cups/libcups.a \
-               $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) $(SSLLIBS) $(LIBGSSAPI)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o libcupsimage.a \
+               ../cups/libcups.a $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
+               $(SSLLIBS) $(LIBGSSAPI)
+       echo Running raster API tests...
+       ./testraster
 
 
 #
index dedf74ef286a21c94ac8556cbd08b6eb40832291..4aee789134cde939528d76ff33f0aa8b4bef248b 100644 (file)
@@ -30,6 +30,13 @@ FONTS        =       Courier Courier-Bold Courier-BoldOblique Courier-Oblique \
 all:
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index 1eba2b2e701ba8cc6b6c9f89fad9f73317fef13c..a948cf991dc6632c43ae48994638126c691ad891 100644 (file)
@@ -27,6 +27,13 @@ TARGETS      =       checkpo po2strings strings2po translate
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index 8588d346ab155a0b3d3509c5b512159a82734706..ee93d94cc85305a0c5070e6edd08d13c98d35bda 100644 (file)
@@ -75,6 +75,13 @@ MAN8 =       accept.$(MAN8EXT) \
 all:   $(MAN1) $(MAN5) $(MAN7) $(MAN8) html
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index 9131da09c5eae432e83b87b0140e8057eecb6ca0..17849f661aff86cef29ed1546995679c276b82fd 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\"   filter man page for the Common UNIX Printing System (CUPS).
 .\"
-.\"   Copyright 2007 by Apple Inc.
+.\"   Copyright 2007-2008 by Apple Inc.
 .\"   Copyright 1997-2007 by Easy Software Products.
 .\"
 .\"   These coded instructions, statements, and computer programs are the
@@ -12,7 +12,7 @@
 .\"   which should have been included with this file.  If this file is
 .\"   file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH filter 7 "Common UNIX Printing System" "6 July 2007" "Apple Inc."
+.TH filter 7 "Common UNIX Printing System" "14 May 2008" "Apple Inc."
 .SH NAME
 filter \- cups file conversion filter interface
 .SH SYNOPSIS
@@ -101,6 +101,13 @@ Adds an entry to the current \fIPageLog\fR. The first form adds
 #-copies to the job-media-sheets-completed attribute. The second
 form sets the job-media-sheets-completed attribute to #-pages.
 
+.TP 5
+PPD: Keyword=Value ... KeywordN=Value
+.br
+Sets the named keywords in the printer's PPD file. This is typically
+used to update default option keywords such as DefaultPageSize and
+the various installable options in the PPD file.
+
 .TP 5
 STATE: printer-state-reason [printer-state-reason ...]
 .TP 5
index a1c75b65db32c9d98ad294046082780b6c9d0257..8f3b583187df0f5a940a0bd5d58454fe22b85146 100644 (file)
@@ -29,6 +29,13 @@ OBJS =       bcp.o tbcp.o
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #
index 812fcbd69d5852583bf738e78ff520a6aeec41f2..365a620399d8bbf0db5451cd028e34aaae5a6713 100644 (file)
@@ -27,6 +27,13 @@ OBJS =       mailto.o rss.o testnotify.o
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #
index 24611c4376bfbacd211228cd3958296ed3afaf13..aed8208ddc2a7a37ac9de818f9f7999cdeb78d8e 100644 (file)
@@ -56,13 +56,15 @@ OBJS =              \
                ppdi.o \
                ppdmerge.o \
                ppdpo.o
-TARGETS        =       \
+LIBTARGETS =   \
                $(LIBCUPSPPDC) \
                $(LIB32CUPSPPDC) \
                $(LIB64CUPSPPDC) \
                libcupsppdc.a \
+               ppdc-static
+TARGETS        =       \
+               $(LIBTARGETS) \
                drv \
-               ppdc-static \
                ppdc \
                ppdhtml \
                ppdi \
@@ -77,6 +79,13 @@ TARGETS      =       \
 all:           $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Clean everything...
 #
@@ -275,8 +284,8 @@ ppdc:                       ppdc.o $(LIBCUPSPPDC) ../cups/$(LIBCUPS)
 
 ppdc-static:           ppdc.o libcupsppdc.a  ../cups/libcups.a foo.drv foo-fr.po
        echo Linking $@...
-       $(CXX) $(LDFLAGS) -o ppdc-static ppdc.o libcupsppdc.a ../cups/libcups.a \
-               $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+       $(CXX) $(ARCHFLAGS) $(LDFLAGS) -o ppdc-static ppdc.o libcupsppdc.a \
+               ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
        echo Testing PPD compiler...
        ./ppdc-static -l en,fr -I ../data foo.drv
        ./ppdc-static -l en,fr -z -I ../data foo.drv
index e359e05cb6458bbd21f11f00fdb028ff4764b94c..256a93a0f84b612c39f6b80c429e21ccaafbd3bf 100644 (file)
@@ -62,20 +62,24 @@ OBJS        =       \
                testspeed.o \
                testsub.o \
                util.o
+
+LIBTARGETS =   \
+               $(LIBCUPSMIME) \
+               $(LIB32CUPSMIME) \
+               $(LIB64CUPSMIME) \
+               libcupsmime.a \
+               testmime
+
 TARGETS        =       \
+               $(LIBTARGETS) \
                cupsd \
                cupsfilter \
                cups-deviced \
                cups-driverd \
                cups-lpd \
                cups-polld \
-               $(LIBCUPSMIME) \
-               $(LIB32CUPSMIME) \
-               $(LIB64CUPSMIME) \
-               libcupsmime.a \
                testdirsvc \
                testlpd \
-               testmime \
                testspeed \
                testsub
 
@@ -87,6 +91,13 @@ TARGETS      =       \
 all:           $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:          $(LIBTARGETS)
+
+
 #
 # Clean all object files...
 #
@@ -480,8 +491,10 @@ testlpd:   testlpd.o ../cups/libcups.a cups-lpd
 
 testmime:      testmime.o libcupsmime.a ../cups/libcups.a
        echo Linking $@...
-       $(CC) $(LDFLAGS) -o $@ testmime.o libcupsmime.a ../cups/libcups.a \
-               $(COMMONLIBS) $(LIBZ) $(SSLLIBS) $(LIBGSSAPI)
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testmime.o libcupsmime.a \
+               ../cups/libcups.a $(COMMONLIBS) $(LIBZ) $(SSLLIBS) $(LIBGSSAPI)
+       echo Running MIME tests...
+       ./testmime
 
 
 #
index 9516f28babfaacdef99b6083fbdc584e17cfee22..8d551abf044cd25d7e9ad1ab820ff8965f3fcc26 100644 (file)
@@ -1404,12 +1404,24 @@ cupsdCheckGroup(
   * Check group membership through MacOS X membership API...
   */
 
-  if (user && group)
+  if (group)
+  {
+    if (mbr_gid_to_uuid(group->gr_gid, groupuuid))
+      uuid_clear(groupuuid);
+  }
+  else if (groupname[0] == '#')
+  {
+    if (uuid_parse((char *)groupname + 1, groupuuid))
+      uuid_clear(groupuuid);
+  }
+  else
+    uuid_clear(groupuuid);
+
+  if (user && !uuid_is_null(groupuuid))
     if (!mbr_uid_to_uuid(user->pw_uid, useruuid))
-      if (!mbr_gid_to_uuid(group->gr_gid, groupuuid))
-       if (!mbr_check_membership(useruuid, groupuuid, &is_member))
-         if (is_member)
-           return (1);
+      if (!mbr_check_membership(useruuid, groupuuid, &is_member))
+       if (is_member)
+         return (1);
 #endif /* HAVE_MBR_UID_TO_UUID */
 
  /*
index 764cc622a5a9626c65e8dedfb4e04d737b7baef8..30f87f64cc0ea1800fa954e3ea4f580ef76678b5 100644 (file)
@@ -21,7 +21,8 @@
 
 typedef enum
 {
-  CUPSD_LOG_ATTR = -3,                 /* Used internally for attributes */
+  CUPSD_LOG_PPD = -4,                  /* Used internally for PPD keywords */
+  CUPSD_LOG_ATTR,                      /* Used internally for attributes */
   CUPSD_LOG_STATE,                     /* Used internally for state-reasons */
   CUPSD_LOG_PAGE,                      /* Used internally for page logging */
   CUPSD_LOG_NONE,
index f660dc29bdd6474277f56f8df8c02bd10c18d867..23f55f5628e0a02dfcfaa21969d20527c3e37c58 100644 (file)
@@ -2970,7 +2970,11 @@ apple_init_profile(
         language = (char *)cupsArrayNext(languages))
     {
       if (iccfile)
-        attr = _ppdLocalizedAttr(ppd, "cupsICCProfile", name, language);
+      {
+        if ((attr = _ppdLocalizedAttr(ppd, "cupsICCProfile", name,
+                                     language)) == NULL)
+         attr = _ppdLocalizedAttr(ppd, "APTiogaProfile", name, language);
+      }
       else
         attr = _ppdLocalizedAttr(ppd, "ColorModel", name, language);
 
@@ -3030,6 +3034,7 @@ apple_register_profiles(
   ppd_file_t           *ppd;           /* PPD file */
   ppd_attr_t           *attr,          /* cupsICCProfile attributes */
                        *profileid_attr;/* cupsProfileID attribute */
+  const char           *profile_key;   /* Profile keyword */
   ppd_option_t         *cm_option;     /* Color model option */
   ppd_choice_t         *cm_choice,     /* Color model choice */
                        *q1_choice,     /* ColorModel (or other) qualifier */
@@ -3074,9 +3079,15 @@ apple_register_profiles(
   * See if we have any profiles...
   */
 
-  for (num_profiles = 0, attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
-       attr;
-       attr = ppdFindNextAttr(ppd, "cupsICCProfile", NULL))
+  if ((attr = ppdFindAttr(ppd, "APTiogaProfile", NULL)) != NULL)
+    profile_key = "APTiogaProfile";
+  else
+  {
+    attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
+    profile_key = "cupsICCProfile";
+  }
+
+  for (num_profiles = 0; attr; attr = ppdFindNextAttr(ppd, profile_key, NULL))
     if (attr->spec[0] && attr->value && attr->value[0])
     {
       if (attr->value[0] != '/')
@@ -3091,6 +3102,7 @@ apple_register_profiles(
       num_profiles ++;
     }
 
+  
  /*
   * If we have profiles, add them...
   */
@@ -3138,9 +3150,9 @@ apple_register_profiles(
     languages              = _ppdGetLanguages(ppd);
 
     for (profile = profiles->profiles,
-             attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
+             attr = ppdFindAttr(ppd, profile_key, NULL);
         attr;
-        attr = ppdFindNextAttr(ppd, "cupsICCProfile", NULL))
+        attr = ppdFindNextAttr(ppd, profile_key, NULL))
       if (attr->spec[0] && attr->value && attr->value[0])
       {
        /*
@@ -3156,16 +3168,21 @@ apple_register_profiles(
         if (access(iccfile, 0))
          continue;
 
-        cupsArraySave(ppd->sorted_attrs);
+        if (profile_key[0] == 'c')
+       {
+         cupsArraySave(ppd->sorted_attrs);
 
-       if ((profileid_attr = ppdFindAttr(ppd, "cupsProfileID",
-                                         attr->spec)) != NULL &&
-            profileid_attr->value && isdigit(profileid_attr->value[0] & 255))
-          profile_id = (unsigned)strtoul(profileid_attr->value, NULL, 10);
-       else
-         profile_id = _ppdHashName(attr->spec);
+         if ((profileid_attr = ppdFindAttr(ppd, "cupsProfileID",
+                                           attr->spec)) != NULL &&
+             profileid_attr->value && isdigit(profileid_attr->value[0] & 255))
+           profile_id = (unsigned)strtoul(profileid_attr->value, NULL, 10);
+         else
+           profile_id = _ppdHashName(attr->spec);
 
-       cupsArrayRestore(ppd->sorted_attrs);
+         cupsArrayRestore(ppd->sorted_attrs);
+        }
+       else
+         profile_id = atoi(attr->spec);
 
         apple_init_profile(ppd, languages, profile, profile_id, attr->spec,
                           attr->text[0] ? attr->text : attr->spec, iccfile);
@@ -4166,8 +4183,13 @@ check_quotas(cupsd_client_t  *con,       /* I - Client connection */
        */
 
 #ifdef HAVE_MBR_UID_TO_UUID
-       if ((mbr_err = mbr_group_name_to_uuid((char *)p->users[i] + 1,
-                                             grp_uuid)) != 0)
+        if (p->users[i][1] == '#')
+       {
+         if (uuid_parse((char *)p->users[i] + 2, grp_uuid))
+           uuid_clear(grp_uuid);
+       }
+       else if ((mbr_err = mbr_group_name_to_uuid((char *)p->users[i] + 1,
+                                                  grp_uuid)) != 0)
        {
         /*
          * Invalid ACL entries are ignored for matching; just record a
@@ -4181,28 +4203,27 @@ check_quotas(cupsd_client_t  *con,      /* I - Client connection */
                          "Access control entry \"%s\" not a valid group name; "
                          "entry ignored", p->users[i]);
        }
-       else
-       {
-         if ((mbr_err = mbr_check_membership(usr_uuid, grp_uuid,
-                                             &is_member)) != 0)
-         {
-          /*
-           * At this point, there should be no errors, but check anyways...
-           */
-
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "check_quotas: group \"%s\" membership check "
-                           "failed (err=%d)", p->users[i] + 1, mbr_err);
-            is_member = 0;
-         }
 
-         /*
-         * Stop if we found a match...
+       if ((mbr_err = mbr_check_membership(usr_uuid, grp_uuid,
+                                           &is_member)) != 0)
+       {
+        /*
+         * At this point, there should be no errors, but check anyways...
          */
 
-         if (is_member)
-           break;
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "check_quotas: group \"%s\" membership check "
+                         "failed (err=%d)", p->users[i] + 1, mbr_err);
+         is_member = 0;
        }
+
+       /*
+       * Stop if we found a match...
+       */
+
+       if (is_member)
+         break;
+
 #else
         if (cupsdCheckGroup(username, pw, p->users[i] + 1))
          break;
@@ -4211,8 +4232,13 @@ check_quotas(cupsd_client_t  *con,       /* I - Client connection */
 #ifdef HAVE_MBR_UID_TO_UUID
       else
       {
-        if ((mbr_err = mbr_user_name_to_uuid((char *)p->users[i],
-                                            usr2_uuid)) != 0)
+        if (p->users[i][0] == '#')
+       {
+         if (uuid_parse((char *)p->users[i] + 1, usr2_uuid))
+           uuid_clear(usr2_uuid);
+        }
+        else if ((mbr_err = mbr_user_name_to_uuid((char *)p->users[i],
+                                                 usr2_uuid)) != 0)
        {
         /*
          * Invalid ACL entries are ignored for matching; just record a
@@ -4226,20 +4252,18 @@ check_quotas(cupsd_client_t  *con,      /* I - Client connection */
                          "Access control entry \"%s\" not a valid user name; "
                          "entry ignored", p->users[i]);
        }
-       else
-       {
-         if ((mbr_err = mbr_check_membership(usr_uuid, usr2_uuid,
-                                             &is_member)) != 0)
-          {
-           cupsdLogMessage(CUPSD_LOG_DEBUG,
-                           "check_quotas: User \"%s\" identity check failed "
-                           "(err=%d)", p->users[i], mbr_err);
-           is_member = 0;
-         }
 
-         if (is_member)
-           break;
+       if ((mbr_err = mbr_check_membership(usr_uuid, usr2_uuid,
+                                           &is_member)) != 0)
+       {
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "check_quotas: User \"%s\" identity check failed "
+                         "(err=%d)", p->users[i], mbr_err);
+         is_member = 0;
        }
+
+       if (is_member)
+         break;
       }
 #else
       else if (!strcasecmp(username, p->users[i]))
index 0e4e94af934fc563cd80d8aa4bbd599695f94aaa..5795a881e535a14c339eee53880bbf1e11fad3d8 100644 (file)
@@ -3779,6 +3779,23 @@ update_job(cupsd_job_t *job)             /* I - Job to check */
 
       cupsFreeOptions(num_attrs, attrs);
     }
+    else if (loglevel == CUPSD_LOG_PPD)
+    {
+     /*
+      * Set attribute(s)...
+      */
+
+      int              num_keywords;   /* Number of keywords */
+      cups_option_t    *keywords;      /* Keywords */
+
+
+      num_keywords = cupsParseOptions(message, 0, &keywords);
+
+      if (cupsdUpdatePrinterPPD(job->printer, num_keywords, keywords))
+        cupsdSetPrinterAttrs(job->printer);
+
+      cupsFreeOptions(num_keywords, keywords);
+    }
 #ifdef __APPLE__
     else if (!strncmp(message, "recoverable:", 12))
     {
index 8cd2e6e4a5a7c545027c1e9c05e2e97d1b8cbbc2..640f02ac287f01b4f9d156690c7fd01dabd7f2a2 100644 (file)
@@ -2856,6 +2856,118 @@ cupsdStopPrinter(cupsd_printer_t *p,    /* I - Printer to stop */
 }
 
 
+/*
+ * 'cupsdUpdatePrinterPPD()' - Update keywords in a printer's PPD file.
+ */
+
+int                                    /* O - 1 if successful, 0 otherwise */
+cupsdUpdatePrinterPPD(
+    cupsd_printer_t *p,                        /* I - Printer */
+    int             num_keywords,      /* I - Number of keywords */
+    cups_option_t   *keywords)         /* I - Keywords */
+{
+  int          i;                      /* Looping var */
+  cups_file_t  *src,                   /* Original file */
+               *dst;                   /* New file */
+  char         srcfile[1024],          /* Original filename */
+               dstfile[1024],          /* New filename */
+               line[1024],             /* Line from file */
+               keystring[41];          /* Keyword from line */
+  cups_option_t        *keyword;               /* Current keyword */
+
+
+  cupsdLogMessage(CUPSD_LOG_INFO, "Updating keywords in PPD file for %s...",
+                  p->name);
+
+ /*
+  * Get the old and new PPD filenames...
+  */
+
+  snprintf(srcfile, sizeof(srcfile), "%s/ppd/%s.ppd.O", ServerRoot, p->name);
+  snprintf(dstfile, sizeof(srcfile), "%s/ppd/%s.ppd", ServerRoot, p->name);
+
+ /*
+  * Rename the old file and open the old and new...
+  */
+
+  if (rename(dstfile, srcfile))
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to backup PPD file for %s: %s",
+                    p->name, strerror(errno));
+    return (0);
+  }
+
+  if ((src = cupsFileOpen(srcfile, "r")) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open PPD file \"%s\": %s",
+                    srcfile, strerror(errno));
+    rename(srcfile, dstfile);
+    return (0);
+  }
+
+  if ((dst = cupsFileOpen(dstfile, "w")) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create PPD file \"%s\": %s",
+                    dstfile, strerror(errno));
+    cupsFileClose(src);
+    rename(srcfile, dstfile);
+    return (0);
+  }
+
+ /*
+  * Copy the first line and then write out all of the keywords...
+  */
+
+  if (!cupsFileGets(src, line, sizeof(line)))
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to read PPD file \"%s\": %s",
+                    srcfile, strerror(errno));
+    cupsFileClose(src);
+    cupsFileClose(dst);
+    rename(srcfile, dstfile);
+    return (0);
+  }
+
+  cupsFilePrintf(dst, "%s\n", line);
+
+  for (i = num_keywords, keyword = keywords; i > 0; i --, keyword ++)
+  {
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "*%s: %s", keyword->name, keyword->value);
+    cupsFilePrintf(dst, "*%s: %s\n", keyword->name, keyword->value);
+  }
+
+ /*
+  * Then copy the rest of the PPD file, dropping any keywords we changed.
+  */
+
+  while (cupsFileGets(src, line, sizeof(line)))
+  {
+   /*
+    * Skip keywords we've already set...
+    */
+
+    if (sscanf(line, "*%40[^:]:", keystring) == 1 &&
+        cupsGetOption(keystring, num_keywords, keywords))
+      continue;
+
+   /*
+    * Otherwise write the line...
+    */
+
+    cupsFilePrintf(dst, "%s\n", line);
+  }
+
+ /*
+  * Close files and return...
+  */
+
+  cupsFileClose(src);
+  cupsFileClose(dst);
+
+  return (1);
+}
+
+
 /*
  * 'cupsdUpdatePrinters()' - Update printers after a partial reload.
  */
index d28789bf16c1a74b1ff3e1a01e7cef25b65c9451..b14b1b19680d05d5e88925494263350cf6e7fedf 100644 (file)
@@ -162,6 +162,9 @@ extern void         cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s,
                                             int update);
 #define                        cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
 extern void            cupsdStopPrinter(cupsd_printer_t *p, int update);
+extern int             cupsdUpdatePrinterPPD(cupsd_printer_t *p,
+                                             int num_keywords,
+                                             cups_option_t *keywords);
 extern void            cupsdUpdatePrinters(void);
 extern cupsd_quota_t   *cupsdUpdateQuota(cupsd_printer_t *p,
                                          const char *username, int pages,
index 699a5c8b0bdf765a35338578ceaf4d267947076a..a650f867b375e696433310dd82f84fdfd9167e06 100644 (file)
@@ -266,6 +266,11 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,    /* I - Status buffer */
     *loglevel = CUPSD_LOG_ATTR;
     message   = sb->buffer + 5;
   }
+  else if (!strncmp(sb->buffer, "PPD:", 4))
+  {
+    *loglevel = CUPSD_LOG_PPD;
+    message   = sb->buffer + 4;
+  }
   else
   {
     *loglevel = CUPSD_LOG_DEBUG;
index b2135802c4177c8055fdcec47a1c6cc20bad1ce7..36b5766af450895e14b2274099132d35c7b525d8 100644 (file)
@@ -45,6 +45,13 @@ PHPCUPS      =       phpcups.so
 all:   $(PHPCUPS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Remove object and target files...
 #
index 74d87853e22a3f7fc90a87e7759bbc4caaf77ab4..23b498f20fbafe667598a684a383ce455c3e29bc 100644 (file)
@@ -68,6 +68,13 @@ RFCS =       \
 all:   rfctohtml $(RFCS:.txt=.html)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
@@ -131,7 +138,7 @@ uninstall:
 #
 
 rfctohtml:     rfctohtml.o ../cups/libcups.a
-       $(CC) $(LDFLAGS) -o $@ rfctohtml.o ../cups/libcups.a \
+       $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ rfctohtml.o ../cups/libcups.a \
                $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
 
 
index ee9290bb935e72084718b0c7c91341b956a9907b..4c5775e8f29f662a29f18a020d65052d988b8155 100644 (file)
@@ -29,6 +29,13 @@ OBJS =       accept.o cancel.o cupsaddsmb.o cupsctl.o cupstestdsc.o \
 all:   $(TARGETS)
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #
index ea2c1084f16b1fd9ad69c6c05bfda744f9bdb290..3bd01c847dd6b78963cf7e8a0d44436a2d026b3b 100644 (file)
@@ -96,6 +96,13 @@ FILES        =       \
 all:
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all config and object files...
 #
index ea1c47fe50455f13bcbc877e810fb59c97a5a8d8..5b87d36cc25258d334d8675956b78b6dd33a2a71 100644 (file)
@@ -11,9 +11,9 @@
 <TABLE CLASS="page" SUMMARY="{title}">
 <TR><TD CLASS="body">
 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
-<TR HEIGHT="32">
+<TR HEIGHT="36">
 <TD><A HREF="http://www.cups.org/" TARGET="_blank"><IMG
-SRC="/images/left.gif" WIDTH="64" HEIGHT="32" BORDER="0" ALT=""></A></TD>
+SRC="/images/left.gif" WIDTH="64" HEIGHT="36" BORDER="0" ALT=""></A></TD>
 <TD CLASS="unsel"><A HREF="/">&nbsp;&nbsp;Home&nbsp;&nbsp;</A></TD>
 <TD CLASS="{SECTION=admin?:un}sel"><A HREF="/admin">&nbsp;&nbsp;Administration&nbsp;&nbsp;</A></TD>
 <TD CLASS="{SECTION=classes?:un}sel"><A HREF="/classes/">&nbsp;&nbsp;Classes&nbsp;&nbsp;</A></TD>
@@ -23,9 +23,8 @@ SRC="/images/left.gif" WIDTH="64" HEIGHT="32" BORDER="0" ALT=""></A></TD>
 <TD CLASS="unsel" WIDTH="100%"><FORM ACTION="/help/" METHOD="GET"><INPUT
 TYPE="SEARCH" NAME="QUERY" SIZE="20" PLACEHOLDER="Search Help"
 VALUE="{SECTION=help?{?QUERY}:}" AUTOSAVE="org.cups.help" RESULTS="20"></FORM></TD>
-<TD><IMG SRC="/images/right.gif" WIDTH="16" HEIGHT="32" ALT=""></TD>
+<TD><IMG SRC="/images/right.gif" WIDTH="4" HEIGHT="36" ALT=""></TD>
 </TR>
 </TABLE>
-<IMG SRC="/images/shadow.png" WIDTH="100%" HEIGHT="4" ALT="">
 
 <H1>{title}</H1>
index 49fabb3ded7c41d00f7a33419f8b69b9b078cfaf..99f8fa9600a88d06cd0fc3c9bcafdd9e3136df2e 100644 (file)
@@ -23,6 +23,13 @@ include ../Makedefs
 all:   ipptest
 
 
+#
+# Make library targets...
+#
+
+libs:
+
+
 #
 # Clean all object files...
 #