]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Load cups into easysw/current.
authorjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 8 Mar 2006 00:32:35 +0000 (00:32 +0000)
committerjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 8 Mar 2006 00:32:35 +0000 (00:32 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@80 a1ca3aef-8c08-0410-bb20-df032aa958be

94 files changed:
Makedefs.in
Makefile
backend/Makefile
backend/ieee1394.c
backend/ipp.c
backend/lpd.c
backend/parallel.c
backend/scsi-irix.c
backend/scsi-linux.c
backend/serial.c
backend/socket.c
backend/usb-darwin.c
backend/usb-unix.c
berkeley/Makefile
berkeley/lpr.c
cgi-bin/Makefile
cgi-bin/admin.c
cgi-bin/ipp-var.c
conf/Makefile
conf/client.conf [deleted file]
config-scripts/cups-common.m4
cups/Dependencies
cups/Makefile
cups/adminutil.c [new file with mode: 0644]
cups/adminutil.h [new file with mode: 0644]
cups/cups.h
cups/emit.c
cups/encode.c
cups/getputfile.c
cups/globals.c
cups/globals.h
cups/http-addr.c
cups/http.c
cups/http.h
cups/i18n.h
cups/ipp-private.h
cups/ipp.c
cups/language.c
cups/libcups_s.exp
cups/mark.c
cups/md5-apple.h
cups/md5.c
cups/md5.h
cups/md5passwd.c
cups/page.c
cups/ppd.c
cups/ppd.h
cups/string.c
cups/string.h
cups/testadmin.c [new file with mode: 0644]
cups/testhttp.c
cups/util.c
data/Makefile
doc/Makefile
doc/cups-printable.css
doc/cups.css
doc/help/cgi.html [new file with mode: 0644]
doc/help/ref-cupsd-conf.html
doc/help/whatsnew.html
doc/index.html.in
doc/ja/index.html.in
filter/Makefile
fonts/Makefile
locale/Makefile
locale/cups.pot
locale/cups_ja.po
man/Makefile
monitor/Makefile
notifier/Makefile
notifier/mailto.c
packaging/LICENSE.rtf
packaging/installer.tif
packaging/installer.xcf.gz
pdftops/Makefile
ppd/Makefile
scheduler/Makefile
scheduler/auth.c
scheduler/conf.c
scheduler/ipp.c
scheduler/main.c
scheduler/printers.c
scheduler/sysman.c
scripting/php/Dependencies
scripting/php/Makefile
standards/Makefile
systemv/Dependencies
systemv/Makefile
systemv/cupsaddsmb.c
systemv/lp.c
templates/Makefile
templates/admin.tmpl
templates/edit-config.tmpl.in
test/Makefile
tools/testosx

index 4520f8b2f38994cc8e815f78c20553300ce01936..fc84a5354d946fa86988835326c0a54c468f01c6 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makedefs.in 5194 2006-02-27 20:57:07Z mike $"
+# "$Id: Makedefs.in 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Common makefile definitions for the Common UNIX Printing System (CUPS).
 #
@@ -40,6 +40,7 @@ MV            =       @MV@
 PHPCONFIG      =       @PHPCONFIG@
 RANLIB         =       @RANLIB@
 RM             =       @RM@ -f
+RMDIR          =       @RMDIR@
 SED            =       @SED@
 SHELL          =       /bin/sh
 STRIP          =       @STRIP@
@@ -215,5 +216,5 @@ DBUSDIR             =       @DBUSDIR@
 
 
 #
-# End of "$Id: Makedefs.in 5194 2006-02-27 20:57:07Z mike $"
+# End of "$Id: Makedefs.in 5229 2006-03-05 16:48:12Z mike $"
 #
index 3535a9fde90a399329c7ebd30439d54c95376d96..2913b9831634570d51459b65041e4f2389791dac 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5217 2006-03-02 21:24:01Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Top-level Makefile for the Common UNIX Printing System (CUPS).
 #
@@ -30,7 +30,8 @@ include Makedefs
 
 DIRS   =       cups backend berkeley cgi-bin filter locale man monitor \
                notifier pdftops scheduler systemv test \
-               $(PHPDIR)
+               $(PHPDIR) \
+               conf data doc fonts ppd templates
 
 
 #
@@ -76,32 +77,20 @@ install:    installhdrs
                echo Installing in $$dir... ;\
                (cd $$dir; $(MAKE) $(MFLAGS) install) || exit 1;\
        done
-       echo Installing in conf...
-       (cd conf; $(MAKE) $(MFLAGS) install)
-       echo Installing in data...
-       (cd data; $(MAKE) $(MFLAGS) install)
-       echo Installing in doc...
-       (cd doc; $(MAKE) $(MFLAGS) install)
-       echo Installing in fonts...
-       (cd fonts; $(MAKE) $(MFLAGS) install)
-       echo Installing in ppd...
-       (cd ppd; $(MAKE) $(MFLAGS) install)
-       echo Installing in templates...
-       (cd templates; $(MAKE) $(MFLAGS) install)
        echo Installing cups-config script...
-       $(INSTALL_DIR) $(BINDIR)
+       $(INSTALL_DIR) -m 755 $(BINDIR)
        $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config
        echo Installing startup script...
        if test "x$(INITDIR)" != "x"; then \
-               $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/init.d; \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
                $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
-               $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
                $(INSTALL_SCRIPT) init/cups.sh  $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
-               $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d; \
                $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
-               $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d; \
                $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
-               $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d; \
                $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
        fi
        if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
@@ -109,7 +98,7 @@ install:     installhdrs
                if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
                        $(INSTALL_SCRIPT) init/PrintingServices $(BUILDROOT)$(INITDDIR)/PrintingServices; \
                        $(INSTALL_DATA) init/StartupParameters.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
-                       $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
+                       $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
                        $(INSTALL_DATA) init/Localizable.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
                elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
                        $(INSTALL_DATA) init/org.cups.cupsd.plist $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
@@ -119,7 +108,7 @@ install:    installhdrs
        fi
        if test "x$(DBUSDIR)" != "x"; then \
                echo Installing cups.conf in $(DBUSDIR)...;\
-               $(INSTALL_DIR) $(BUILDROOT)$(DBUSDIR); \
+               $(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR); \
                $(INSTALL_DATA) packaging/cups-dbus.conf $(BUILDROOT)$(DBUSDIR)/cups.conf; \
        fi
 
@@ -136,6 +125,51 @@ installhdrs:
        (cd filter ; $(MAKE) $(MFLAGS) installhdrs) || exit 1;
 
 
+#
+# Uninstall object and target files...
+#
+
+uninstall:
+       for dir in $(DIRS); do\
+               echo Uninstalling in $$dir... ;\
+               (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
+       done
+       echo Uninstalling cups-config script...
+       $(RM) $(BINDIR)/cups-config
+       -$(RMDIR) $(BINDIR)
+       echo Uninstalling startup script...
+       if test "x$(INITDIR)" != "x"; then \
+               $(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
+               $(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
+               $(RM)  $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
+               $(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
+               $(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
+               $(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
+               $(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
+               $(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
+               $(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
+               $(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
+       fi
+       if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \
+               if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \
+                       $(RM) $(BUILDROOT)$(INITDDIR)/PrintingServices; \
+                       $(RM) $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \
+                       $(RM) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \
+                       $(RMDIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \
+               elif test "$(INITDDIR)" = "/System/Library/LaunchDaemons"; then \
+                       $(RM) $(BUILDROOT)$(DEFAULT_LAUNCHD_CONF); \
+               else \
+                       $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \
+               fi \
+               $(RMDIR) $(BUILDROOT)$(INITDDIR); \
+       fi
+       if test "x$(DBUSDIR)" != "x"; then \
+               echo Uninstalling cups.conf in $(DBUSDIR)...;\
+               $(RM) $(BUILDROOT)$(DBUSDIR)/cups.conf; \
+               $(RMDIR) $(BUILDROOT)$(DBUSDIR); \
+       fi
+
+
 #
 # Run the test suite...
 #
@@ -159,5 +193,5 @@ epm:
 
 
 #
-# End of "$Id: Makefile 5217 2006-03-02 21:24:01Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index bebaa471dd534b8b9a13ab63a3fedeb3a0ac9131..4267f21e5010974166996288865dce771b9fdaaa 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5131 2006-02-18 05:31:36Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Backend makefile for the Common UNIX Printing System (CUPS).
 #
@@ -72,6 +72,19 @@ install:     all
        $(LN) ipp $(SERVERBIN)/backend/http
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       for file in $(RBACKENDS) $(UBACKENDS); do \
+               $(RM) $(SERVERBIN)/backend/$$file; \
+       done
+       $(RM) $(SERVERBIN)/backend/http
+       -$(RMDIR) $(SERVERBIN)/backend
+       -$(RMDIR) $(SERVERBIN)
+
+
 #
 # betest
 #
@@ -179,5 +192,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5131 2006-02-18 05:31:36Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 0be2105813217566f408132596c114acfb065e91..3d88c7a08b650a69270cad41d34963c2667f9e8e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ieee1394.c 4494 2005-02-18 02:18:11Z mike $"
+ * "$Id: ieee1394.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   IEEE-1394 backend for the Common UNIX Printing System (CUPS).
  *
@@ -140,6 +140,8 @@ main(int  argc,             /* I - Number of command-line arguments (6 or 7) */
   * Try to open the printer device...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((dev = ieee1394_open(argv[0])) == NULL)
@@ -150,6 +152,8 @@ main(int  argc,             /* I - Number of command-line arguments (6 or 7) */
   }
   while (dev == NULL);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Now that we are "connected" to the port, ignore SIGTERM so that we
   * can finish out any page data the driver sends (e.g. to eject the
@@ -259,5 +263,5 @@ list_devices(void)
 
 
 /*
- * End of "$Id: ieee1394.c 4494 2005-02-18 02:18:11Z mike $".
+ * End of "$Id: ieee1394.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 07699d655e54ce68fa66cb9eb868bfdb6fe6d11e..878f634e1f3999c2e1131f18293e858fcd79d2f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c 5180 2006-02-26 01:31:45Z mike $"
+ * "$Id: ipp.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   IPP backend for the Common UNIX Printing System (CUPS).
  *
@@ -507,6 +507,8 @@ main(int  argc,                             /* I - Number of command-line args */
   * Try connecting to the remote server...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     fprintf(stderr, "INFO: Connecting to %s on port %d...\n", hostname, port);
@@ -563,6 +565,7 @@ main(int  argc,                             /* I - Number of command-line args */
   }
   while (http == NULL);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
   fprintf(stderr, "INFO: Connected to %s...\n", hostname);
 
  /*
@@ -1242,8 +1245,8 @@ compress_files(int  num_files,            /* I - Number of files */
     while ((bytes = cupsFileRead(in, buffer, sizeof(buffer))) > 0)
       if (cupsFileWrite(out, buffer, bytes) < bytes)
       {
-        fprintf(stderr, "ERROR: Unable to write %d bytes to \"%s\": %s\n",
-               bytes, filename, strerror(errno));
+        fprintf(stderr, "ERROR: Unable to write " CUPS_LLFMT " bytes to \"%s\": %s\n",
+               CUPS_LLCAST bytes, filename, strerror(errno));
         cupsFileClose(in);
         cupsFileClose(out);
        exit(CUPS_BACKEND_FAILED);
@@ -1615,5 +1618,5 @@ sigterm_handler(int sig)          /* I - Signal */
 
 
 /*
- * End of "$Id: ipp.c 5180 2006-02-26 01:31:45Z mike $".
+ * End of "$Id: ipp.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 30dea23725215992d21dddfd3d91f03d0af696a1..5a2f1c313dc96f281714737312ca081da2c46f97 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpd.c 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: lpd.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   Line Printer Daemon backend for the Common UNIX Printing System (CUPS).
  *
@@ -644,6 +644,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
     * First try to reserve a port for this connection...
     */
 
+    fputs("STATE: +connecting-to-device\n", stderr);
     fprintf(stderr, "INFO: Attempting to connect to host %s for printer %s\n",
             hostname, printer);
 
@@ -769,12 +770,15 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
 #ifdef __APPLE__
         recoverable = 1;
        fprintf(stderr, "WARNING: recoverable: "
+                       "Network host \'%s\' is busy, down, or "
+                       "unreachable; will retry in 30 seconds...\n",
+                hostname);
 #else
        fprintf(stderr, "WARNING: "
-#endif /* __APPLE__ */
                        "Network host \'%s\' is busy, down, or "
                        "unreachable; will retry in 30 seconds...\n",
                 hostname);
+#endif /* __APPLE__ */
        sleep(30);
       }
       else if (error == EADDRINUSE)
@@ -790,10 +794,11 @@ lpd_queue(const char *hostname,           /* I - Host to connect to */
 #ifdef __APPLE__
         recoverable = 1;
        perror("ERROR: recoverable: "
+              "Unable to connect to printer; will retry in 30 seconds...");
 #else
        perror("ERROR: "
-#endif /* __APPLE__ */
               "Unable to connect to printer; will retry in 30 seconds...");
+#endif /* __APPLE__ */
         sleep(30);
       }
     }
@@ -812,6 +817,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
     }
 #endif /* __APPLE__ */
 
+    fputs("STATE: -connecting-to-device\n", stderr);
     fprintf(stderr, "INFO: Connected to %s...\n", hostname);
     fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port,
             lport);
@@ -853,7 +859,7 @@ lpd_queue(const char *hostname,             /* I - Host to connect to */
       return (CUPS_BACKEND_FAILED);
     }
 
-    httpGetHostname(localhost, sizeof(localhost));
+    httpGetHostname(NULL, localhost, sizeof(localhost));
 
     snprintf(control, sizeof(control),
              "H%.31s\n"                /* RFC 1179, Section 7.2 - host name <= 31 chars */
@@ -1224,5 +1230,5 @@ sigterm_handler(int sig)          /* I - Signal */
 
 
 /*
- * End of "$Id: lpd.c 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: lpd.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 3731b378c54f952daccbc88572ba9669a78dc919..6acb8134fdc1a256f1df2d2b817c7233a4a31bad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: parallel.c 5194 2006-02-27 20:57:07Z mike $"
+ * "$Id: parallel.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   Parallel port backend for the Common UNIX Printing System (CUPS).
  *
@@ -202,6 +202,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   * Open the parallel port device...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
@@ -247,6 +249,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   }
   while (fd < 0);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Set any options provided...
   */
@@ -733,5 +737,5 @@ list_devices(void)
 
 
 /*
- * End of "$Id: parallel.c 5194 2006-02-27 20:57:07Z mike $".
+ * End of "$Id: parallel.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 097071c23efb4e3532a454a524ef102e3c125382..cec216e87e5ec036558b2e3d1cee2ce4e472891a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: scsi-irix.c 4703 2005-09-26 19:33:58Z mike $"
+ * "$Id: scsi-irix.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   IRIX SCSI printer support for the Common UNIX Printing System (CUPS).
  *
@@ -103,6 +103,8 @@ print_device(const char *resource,  /* I - SCSI device */
   * Open the SCSI device file...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
@@ -144,6 +146,8 @@ print_device(const char *resource,  /* I - SCSI device */
   }
   while (scsi_fd == -1);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Now that we are "connected" to the port, ignore SIGTERM so that we
   * can finish out any page data the driver sends (e.g. to eject the
@@ -227,5 +231,5 @@ print_device(const char *resource,  /* I - SCSI device */
 
 
 /*
- * End of "$Id: scsi-irix.c 4703 2005-09-26 19:33:58Z mike $".
+ * End of "$Id: scsi-irix.c 5241 2006-03-07 22:07:44Z mike $".
  */
index b5c1d1bef8bae076a3c49326216a96b65aef0ce5..75c9629dc4ec92f22acccf5543a17aad1931ceaa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: scsi-linux.c 4703 2005-09-26 19:33:58Z mike $"
+ * "$Id: scsi-linux.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   Linux SCSI printer support for the Common UNIX Printing System (CUPS).
  *
@@ -116,6 +116,8 @@ print_device(const char *resource,  /* I - SCSI device */
   * Open the SCSI device file...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((scsi_fd = open(resource, O_RDWR | O_EXCL)) == -1)
@@ -157,6 +159,8 @@ print_device(const char *resource,  /* I - SCSI device */
   }
   while (scsi_fd == -1);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Now that we are "connected" to the port, ignore SIGTERM so that we
   * can finish out any page data the driver sends (e.g. to eject the
@@ -245,5 +249,5 @@ print_device(const char *resource,  /* I - SCSI device */
 
 
 /*
- * End of "$Id: scsi-linux.c 4703 2005-09-26 19:33:58Z mike $".
+ * End of "$Id: scsi-linux.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 7d8abe786e9e35aaa226368ace8842e692c25579..17de8d8d31c18705889434bb01955f1cd6470358 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: serial.c 5194 2006-02-27 20:57:07Z mike $"
+ * "$Id: serial.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   Serial port backend for the Common UNIX Printing System (CUPS).
  *
@@ -223,6 +223,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   * Open the serial port device...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL | O_NDELAY)) == -1)
@@ -263,6 +265,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   }
   while (fd < 0);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Set any options provided...
   */
@@ -1130,5 +1134,5 @@ list_devices(void)
 
 
 /*
- * End of "$Id: serial.c 5194 2006-02-27 20:57:07Z mike $".
+ * End of "$Id: serial.c 5241 2006-03-07 22:07:44Z mike $".
  */
index ab541be6000082f91f6a628a3d29d2ff2f9f3407..1833be6fcfb70ff6eb9d2a00035044d62d5161eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: socket.c 5099 2006-02-13 02:46:10Z mike $"
+ * "$Id: socket.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   AppSocket backend for the Common UNIX Printing System (CUPS).
  *
@@ -256,6 +256,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
   while (copies > 0)
   {
+    fputs("STATE: +connecting-to-device\n", stderr);
+
     for (delay = 5;;)
     {
       if (!httpAddrConnect(addrlist, &fd))
@@ -304,6 +306,8 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
        break;
     }
 
+    fputs("STATE: -connecting-to-device\n", stderr);
+
    /*
     * Now that we are "connected" to the port, ignore SIGTERM so that we
     * can finish out any page data the driver sends (e.g. to eject the
@@ -488,5 +492,5 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
 
 
 /*
- * End of "$Id: socket.c 5099 2006-02-13 02:46:10Z mike $".
+ * End of "$Id: socket.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 5c2ee4f4f6425fcdad1fabf66a87c9a01af3a0d9..11009b27a176bd887ff7f7b901fae88c27be5d17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: usb-darwin.c 4548 2005-06-27 02:33:50Z mike $"
+ * "$Id: usb-darwin.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   USB port on Darwin backend for the Common UNIX Printing System (CUPS).
  *
@@ -674,6 +674,9 @@ int print_device(const char *uri, const char *hostname, const char *resource, co
     USBPrinterInfo         *activePrinter = NULL;
     USBPrinterClassContext  **classdriver;
     int                            countdown = INITIAL_LOG_INTERVAL;
+
+    fputs("STATE: +connecting-to-device\n", stderr);
+
     do
     {
        /* */
@@ -746,6 +749,8 @@ int print_device(const char *uri, const char *hostname, const char *resource, co
        return (status);
     }
     
+    fputs("STATE: -connecting-to-device\n", stderr);
+
     /*
     * Now that we are "connected" to the port, ignore SIGTERM so that we
     * can finish out any page data the driver sends (e.g. to eject the
@@ -1895,5 +1900,5 @@ static CFStringRef CreateEncodedCFString(CFStringRef string)
 }
 
 /*
- * End of "$Id: usb-darwin.c 4548 2005-06-27 02:33:50Z mike $".
+ * End of "$Id: usb-darwin.c 5241 2006-03-07 22:07:44Z mike $".
  */
index b28222202ce9b0692b473b5cedcc47effe219b0d..e034a0a2c81eda7db6f4b191638dbe44dfb5e0a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: usb-unix.c 5162 2006-02-24 03:15:13Z mike $"
+ * "$Id: usb-unix.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   USB port backend for the Common UNIX Printing System (CUPS).
  *
@@ -82,6 +82,8 @@ print_device(const char *uri,         /* I - Device URI */
   * Open the USB port device...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((fd = open_device(uri)) == -1)
@@ -127,6 +129,8 @@ print_device(const char *uri,               /* I - Device URI */
   }
   while (fd < 0);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Set any options provided...
   */
@@ -616,5 +620,5 @@ open_device(const char *uri)                /* I - Device URI */
 
 
 /*
- * End of "$Id: usb-unix.c 5162 2006-02-24 03:15:13Z mike $".
+ * End of "$Id: usb-unix.c 5241 2006-03-07 22:07:44Z mike $".
  */
index 6f438cda39e26e8257ae0f1d3d6bc2db35209832..eb16d025c31b06b26c2660f44097af6ebb124edf 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Berkeley commands makefile for the Common UNIX Printing System (CUPS).
 #
@@ -64,6 +64,19 @@ install:     all
        $(INSTALL_BIN) lpc $(SBINDIR)
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       $(RM) $(BINDIR)/lpq
+       $(RM) $(BINDIR)/lpr
+       $(RM) $(BINDIR)/lprm
+       $(RM) $(SBINDIR)/lpc
+       -$(RMDIR) $(SBINDIR)
+       -$(RMDIR) $(BINDIR)
+
+
 #
 # lpc
 #
@@ -108,5 +121,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index c909892e3e010fe1df9980ed23d1bc0537c1d154..f6b5fb3b7ef35cfeca23638c3553ca07bd4626bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $"
+ * "$Id: lpr.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   "lpr" command for the Common UNIX Printing System (CUPS).
  *
@@ -231,7 +231,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
 
              snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
-                      httpGetHostname(buffer, sizeof(buffer)));
+                      httpGetHostname(NULL, buffer, sizeof(buffer)));
              num_options = cupsAddOption("notify-recipient", email,
                                          num_options, &options);
            }
@@ -529,5 +529,5 @@ sighandler(int s)                   /* I - Signal number */
 
 
 /*
- * End of "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $".
+ * End of "$Id: lpr.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 7cce230f83f2808ea48b081509dfd64112723704..9497bb59fbdc42dd9e65988db4f90a9d69565ef9 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5145 2006-02-22 00:25:14Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   CGI makefile for the Common UNIX Printing System (CUPS).
 #
@@ -65,6 +65,17 @@ install:     all
        done
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       for file in $(CGIS); do \
+               $(RM) $(SERVERBIN)/cgi-bin/$$file; \
+       done
+       -$(RMDIR) $(SERVERBIN)/cgi-bin
+
+
 #
 # libcgi.a
 #
@@ -159,5 +170,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5145 2006-02-22 00:25:14Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 3547ee5fdb5989fbe19093f914213f5874f598ad..0b8597b6771f93742442d41001d5394815d1fce2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: admin.c 5107 2006-02-15 19:14:17Z mike $"
+ * "$Id: admin.c 5240 2006-03-07 21:55:29Z mike $"
  *
  *   Administration CGI for the Common UNIX Printing System (CUPS).
  *
@@ -43,6 +43,7 @@
  */
 
 #include "cgi-private.h"
+#include <cups/adminutil.h>
 #include <cups/file.h>
 #include <errno.h>
 #include <unistd.h>
@@ -1574,586 +1575,45 @@ do_config_server(http_t *http)         /* I - HTTP connection */
     * Save basic setting changes...
     */
 
-    http_status_t status;              /* PUT status */
-    cups_file_t        *cupsd;                 /* cupsd.conf file */
-    char       tempfile[1024];         /* Temporary new cupsd.conf */
-    int                tempfd;                 /* Temporary file descriptor */
-    cups_file_t        *temp;                  /* Temporary file */
-    char       line[1024],             /* Line from cupsd.conf file */
-               *value;                 /* Value on line */
-    const char *server_root;           /* Location of config files */
-    int                linenum,                /* Line number in file */
-               in_policy,              /* In a policy section? */
-               in_cancel_job,          /* In a cancel-job section? */
-               in_admin_location,      /* In the /admin location? */
-               in_conf_location,       /* In the /admin/conf location? */
-               in_root_location;       /* In the / location? */
-    int                remote_printers,        /* Show remote printers */
-               share_printers,         /* Share local printers */
-               remote_admin,           /* Remote administration allowed? */
-               user_cancel_any,        /* Cancel-job policy set? */
-               debug_logging;          /* LogLevel debug set? */
-    int                wrote_port_listen,      /* Wrote the port/listen lines? */
-               wrote_browsing,         /* Wrote the browsing lines? */
-               wrote_policy,           /* Wrote the policy? */
-               wrote_loglevel,         /* Wrote the LogLevel line? */
-               wrote_admin_location,   /* Wrote the /admin location? */
-               wrote_conf_location,    /* Wrote the /admin/conf location? */
-               wrote_root_location;    /* Wrote the / location? */
-    int                indent;                 /* Indentation */
-
-
-   /*
-    * Get form variables...
-    */
-
-    remote_printers = cgiGetVariable("REMOTE_PRINTERS") != NULL;
-    share_printers  = cgiGetVariable("SHARE_PRINTERS") != NULL;
-    remote_admin    = cgiGetVariable("REMOTE_ADMIN") != NULL;
-    user_cancel_any = cgiGetVariable("USER_CANCEL_ANY") != NULL;
-    debug_logging   = cgiGetVariable("DEBUG_LOGGING") != NULL;
-
-   /*
-    * Locate the cupsd.conf file...
-    */
-
-    if ((server_root = getenv("CUPS_SERVERROOT")) == NULL)
-      server_root = CUPS_SERVERROOT;
-
-    snprintf(line, sizeof(line), "%s/cupsd.conf", server_root);
-
-   /*
-    * Open the cupsd.conf file...
-    */
-
-    if ((cupsd = cupsFileOpen(line, "r")) == NULL)
-    {
-     /*
-      * Unable to open - log an error...
-      */
-
-      cgiStartHTML(cgiText(_("Change Settings")));
-      cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:")));
-      cgiSetVariable("ERROR", strerror(errno));
-      cgiCopyTemplateLang("error.tmpl");
-      cgiEndHTML();
-      
-      perror(line);
-      return;
-    }
-
-   /*
-    * Create a temporary file for the new cupsd.conf file...
-    */
-
-    if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
-    {
-      cgiStartHTML(cgiText(_("Change Settings")));
-      cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:")));
-      cgiSetVariable("ERROR", strerror(errno));
-      cgiCopyTemplateLang("error.tmpl");
-      cgiEndHTML();
-      
-      perror(tempfile);
-      cupsFileClose(cupsd);
-      return;
-    }
-
-    if ((temp = cupsFileOpenFd(tempfd, "w")) == NULL)
+    int                        num_settings;   /* Number of server settings */
+    cups_option_t      *settings;      /* Server settings */
+
+
+    num_settings = 0;
+    num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
+                                 cgiGetVariable("DEBUG_LOGGING") ? "1" : "0",
+                                num_settings, &settings);
+    num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
+                                 cgiGetVariable("REMOTE_ADMIN") ? "1" : "0",
+                                num_settings, &settings);
+    num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
+                                 cgiGetVariable("REMOTE_PRINTERS") ? "1" : "0",
+                                num_settings, &settings);
+    num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
+                                 cgiGetVariable("SHARE_PRINTERS") ? "1" : "0",
+                                num_settings, &settings);
+    num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
+                                 cgiGetVariable("USER_CANCEL_ANY") ? "1" : "0",
+                                num_settings, &settings);
+
+
+    if (!_cupsAdminSetServerSettings(http, num_settings, settings))
     {
       cgiStartHTML(cgiText(_("Change Settings")));
       cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:")));
-      cgiSetVariable("ERROR", strerror(errno));
-      cgiCopyTemplateLang("error.tmpl");
-      cgiEndHTML();
-      
-      perror(tempfile);
-      close(tempfd);
-      unlink(tempfile);
-      cupsFileClose(cupsd);
-      return;
-    }
-
-   /*
-    * Copy the old file to the new, making changes along the way...
-    */
-
-    in_admin_location    = 0;
-    in_cancel_job        = 0;
-    in_conf_location     = 0;
-    in_policy            = 0;
-    in_root_location     = 0;
-    linenum              = 0;
-    wrote_admin_location = 0;
-    wrote_browsing       = 0;
-    wrote_conf_location  = 0;
-    wrote_loglevel       = 0;
-    wrote_policy         = 0;
-    wrote_port_listen    = 0;
-    wrote_root_location  = 0;
-    indent               = 0;
-
-    while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
-    {
-      if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
-      {
-       if (!wrote_port_listen)
-       {
-          wrote_port_listen = 1;
-
-         if (share_printers || remote_admin)
-         {
-           cupsFilePuts(temp, "# Allow remote access\n");
-           cupsFilePrintf(temp, "Listen *:%d\n", ippPort());
-         }
-         else
-         {
-           cupsFilePuts(temp, "# Only listen for connections from the local machine.\n");
-           cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
-         }
-
-#ifdef CUPS_DEFAULT_DOMAINSOCKET
-          cupsFilePuts(temp, "Listen " CUPS_DEFAULT_DOMAINSOCKET "\n");
-#endif /* CUPS_DEFAULT_DOMAINSOCKET */
-       }
-      }
-      else if (!strcasecmp(line, "Browsing") ||
-               !strcasecmp(line, "BrowseAddress") ||
-               !strcasecmp(line, "BrowseAllow") ||
-               !strcasecmp(line, "BrowseDeny") ||
-               !strcasecmp(line, "BrowseOrder"))
-      {
-       if (!wrote_browsing)
-       {
-          wrote_browsing = 1;
-
-          if (remote_printers || share_printers)
-         {
-           if (remote_printers && share_printers)
-             cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n");
-           else if (remote_printers)
-             cupsFilePuts(temp, "# Show shared printers on the local network.\n");
-           else
-             cupsFilePuts(temp, "# Share local printers on the local network.\n");
-
-           cupsFilePuts(temp, "Browsing On\n");
-           cupsFilePuts(temp, "BrowseOrder allow,deny\n");
-
-           if (remote_printers)
-             cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
-
-           if (share_printers)
-             cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
-          }
-         else
-         {
-           cupsFilePuts(temp, "# Disable printer sharing and shared printers.\n");
-           cupsFilePuts(temp, "Browsing Off\n");
-         }
-       }
-      }
-      else if (!strcasecmp(line, "LogLevel"))
-      {
-        wrote_loglevel = 1;
-
-       if (debug_logging)
-       {
-          cupsFilePuts(temp, "# Show troubleshooting information in error_log.\n");
-         cupsFilePuts(temp, "LogLevel debug\n");
-       }
-       else
-       {
-          cupsFilePuts(temp, "# Show general information in error_log.\n");
-         cupsFilePuts(temp, "LogLevel info\n");
-       }
-      }
-      else if (!strcasecmp(line, "<Policy") && !strcasecmp(value, "default"))
-      {
-       in_policy = 1;
-
-       cupsFilePrintf(temp, "%s %s>\n", line, value);
-       indent += 2;
-      }
-      else if (!strcasecmp(line, "</Policy>"))
-      {
-       indent -= 2;
-        if (!wrote_policy)
-       {
-         wrote_policy = 1;
-
-          if (!user_cancel_any)
-           cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
-                              "  <Limit Cancel-Job>\n"
-                              "    Order deny,allow\n"
-                              "    Allow @SYSTEM\n"
-                              "    Allow @OWNER\n"
-                              "  </Limit>\n");
-        }
-
-       in_policy = 0;
-
-       cupsFilePuts(temp, "</Policy>\n");
-      }
-      else if (!strcasecmp(line, "<Location"))
-      {
-       indent += 2;
-        if (!strcmp(value, "/admin"))
-         in_admin_location = 1;
-        if (!strcmp(value, "/admin/conf"))
-         in_conf_location = 1;
-       else if (!strcmp(value, "/"))
-         in_root_location = 1;
-
-       cupsFilePrintf(temp, "%s %s>\n", line, value);
-      }
-      else if (!strcasecmp(line, "</Location>"))
-      {
-       indent -= 2;
-        if (in_admin_location)
-       {
-         wrote_admin_location = 1;
-
-         if (remote_admin)
-            cupsFilePuts(temp, "  # Allow remote administration...\n");
-         else
-            cupsFilePuts(temp, "  # Restrict access to the admin pages...\n");
-
-          cupsFilePuts(temp, "  Order allow,deny\n");
-
-         if (remote_admin)
-           cupsFilePuts(temp, "  Allow @LOCAL\n");
-         else
-           cupsFilePuts(temp, "  Allow localhost\n");
-       }
-        else if (in_conf_location)
-       {
-         wrote_conf_location = 1;
-
-         if (remote_admin)
-            cupsFilePuts(temp, "  # Allow remote access to the configuration files...\n");
-         else
-            cupsFilePuts(temp, "  # Restrict access to the configuration files...\n");
-
-          cupsFilePuts(temp, "  Order allow,deny\n");
-
-         if (remote_admin)
-           cupsFilePuts(temp, "  Allow @LOCAL\n");
-         else
-           cupsFilePuts(temp, "  Allow localhost\n");
-       }
-       else if (in_root_location)
-       {
-         wrote_root_location = 1;
-
-         if (remote_admin && share_printers)
-            cupsFilePuts(temp, "  # Allow shared printing and remote administration...\n");
-         else if (remote_admin)
-            cupsFilePuts(temp, "  # Allow remote administration...\n");
-         else if (share_printers)
-            cupsFilePuts(temp, "  # Allow shared printing...\n");
-         else
-            cupsFilePuts(temp, "  # Restrict access to the server...\n");
-
-          cupsFilePuts(temp, "  Order allow,deny\n");
-
-         if (remote_admin || share_printers)
-           cupsFilePuts(temp, "  Allow @LOCAL\n");
-         else
-           cupsFilePuts(temp, "  Allow localhost\n");
-       }
-
-       in_admin_location = 0;
-       in_conf_location  = 0;
-        in_root_location  = 0;
-
-       cupsFilePuts(temp, "</Location>\n");
-      }
-      else if (!strcasecmp(line, "<Limit") && in_policy)
-      {
-       /*
-       * See if the policy limit is for the Cancel-Job operation...
-       */
-
-       char    *valptr;                /* Pointer into value */
-
-
-       indent += 2;
-
-        if (!strcasecmp(value, "cancel-job"))
-       {
-        /*
-         * Don't write anything for this limit section...
-         */
-
-         in_cancel_job = 2;
-       }
-       else
-       {
-         cupsFilePrintf(temp, "  %s", line);
-
-         while (*value)
-         {
-           for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
-
-           if (*valptr)
-             *valptr++ = '\0';
-
-            if (!strcasecmp(value, "cancel-job"))
-           {
-            /*
-             * Write everything except for this definition...
-             */
-
-             in_cancel_job = 1;
-           }
-           else
-             cupsFilePrintf(temp, " %s", value);
-
-            for (value = valptr; isspace(*value & 255); value ++);
-         }
-
-         cupsFilePuts(temp, ">\n");
-        }
-      }
-      else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
-      {
-       indent -= 2;
-
-        if (in_cancel_job == 1)
-          cupsFilePuts(temp, "  </Limit>\n");
-
-        wrote_policy = 1;
-
-        if (!user_cancel_any)
-         cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
-                            "  <Limit Cancel-Job>\n"
-                            "    Order deny,allow\n"
-                            "    Require user @OWNER @SYSTEM\n"
-                            "  </Limit>\n");
-
-       in_cancel_job = 0;
-      }
-      else if ((in_admin_location || in_conf_location || in_root_location) &&
-               (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
-               !strcasecmp(line, "Order")))
-       continue;
-      else if (in_cancel_job == 2)
-        continue;
-      else if (!strcasecmp(line, "<Limit")  && value)
-       cupsFilePrintf(temp, "  %s %s>\n", line, value);
-      else if (line[0] == '<')
-      {
-        if (value)
-       {
-          cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
-         indent += 2;
-       }
-       else
-       {
-         if (line[1] == '/')
-           indent -= 2;
-
-         cupsFilePrintf(temp, "%*s%s\n", indent, "", line);
-       }
-      }
-      else if (value)
-       cupsFilePrintf(temp, "%*s%s %s\n", indent, "", line, value);
-      else
-       cupsFilePrintf(temp, "%*s%s\n", indent, "", line);
-    }
-
-   /*
-    * Write any missing info...
-    */
-
-    if (!wrote_browsing)
-    {
-      if (remote_printers || share_printers)
-      {
-       if (remote_printers && share_printers)
-         cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n");
-       else if (remote_printers)
-         cupsFilePuts(temp, "# Show shared printers on the local network.\n");
-       else
-         cupsFilePuts(temp, "# Share local printers on the local network.\n");
-
-       cupsFilePuts(temp, "Browsing On\n");
-       cupsFilePuts(temp, "BrowseOrder allow,deny\n");
-
-       if (remote_printers)
-         cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
-
-       if (share_printers)
-         cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
-      }
-      else
-      {
-       cupsFilePuts(temp, "# Disable printer sharing and shared printers.\n");
-       cupsFilePuts(temp, "Browsing Off\n");
-      }
-    }
-
-    if (!wrote_loglevel)
-    {
-      if (debug_logging)
-      {
-        cupsFilePuts(temp, "# Show troubleshooting information in error_log.\n");
-       cupsFilePuts(temp, "LogLevel debug\n");
-      }
-      else
-      {
-        cupsFilePuts(temp, "# Show general information in error_log.\n");
-       cupsFilePuts(temp, "LogLevel info\n");
-      }
-    }
-
-    if (!wrote_port_listen)
-    {
-      if (share_printers || remote_admin)
-      {
-       cupsFilePuts(temp, "# Allow remote access\n");
-       cupsFilePrintf(temp, "Listen *:%d\n", ippPort());
-      }
-      else
-      {
-       cupsFilePuts(temp, "# Only listen for connections from the local machine.\n");
-       cupsFilePrintf(temp, "Listen localhost:%d\n", ippPort());
-      }
-
-#ifdef CUPS_DEFAULT_DOMAINSOCKET
-      cupsFilePuts(temp, "Listen " CUPS_DEFAULT_DOMAINSOCKET "\n");
-#endif /* CUPS_DEFAULT_DOMAINSOCKET */
-    }
-
-    if (!wrote_root_location)
-    {
-      if (remote_admin && share_printers)
-        cupsFilePuts(temp, "# Allow shared printing and remote administration...\n");
-      else if (remote_admin)
-        cupsFilePuts(temp, "# Allow remote administration...\n");
-      else if (share_printers)
-        cupsFilePuts(temp, "# Allow shared printing...\n");
-      else
-        cupsFilePuts(temp, "# Restrict access to the server...\n");
-
-      cupsFilePuts(temp, "<Location />\n"
-                         "  Order allow,deny\n");
-
-      if (remote_admin || share_printers)
-       cupsFilePuts(temp, "  Allow @LOCAL\n");
-      else
-       cupsFilePuts(temp, "  Allow localhost\n");
-
-      cupsFilePuts(temp, "</Location>\n");
-    }
-
-    if (!wrote_admin_location)
-    {
-      if (remote_admin)
-        cupsFilePuts(temp, "# Allow remote administration...\n");
-      else
-        cupsFilePuts(temp, "# Restrict access to the admin pages...\n");
-
-      cupsFilePuts(temp, "<Location /admin>\n"
-                         "  Order allow,deny\n");
-
-      if (remote_admin)
-       cupsFilePuts(temp, "  Allow @LOCAL\n");
-      else
-       cupsFilePuts(temp, "  Allow localhost\n");
-
-      cupsFilePuts(temp, "</Location>\n");
-    }
-
-    if (!wrote_conf_location)
-    {
-      if (remote_admin)
-        cupsFilePuts(temp, "# Allow remote access to the configuration files...\n");
-      else
-        cupsFilePuts(temp, "# Restrict access to the configuration files...\n");
-
-      cupsFilePuts(temp, "<Location /admin/conf>\n"
-                         "  AuthType Basic\n"
-                         "  Require user @SYSTEM\n"
-                         "  Order allow,deny\n");
-
-      if (remote_admin)
-       cupsFilePuts(temp, "  Allow @LOCAL\n");
-      else
-       cupsFilePuts(temp, "  Allow localhost\n");
-
-      cupsFilePuts(temp, "</Location>\n");
-    }
-
-    if (!wrote_policy)
-    {
-      cupsFilePuts(temp, "<Policy default>\n"
-                         "  # Job-related operations must be done by the owner or an adminstrator...\n"
-                         "  <Limit Send-Document Send-URI Hold-Job Release-Job "
-                        "Restart-Job Purge-Jobs Set-Job-Attributes "
-                        "Create-Job-Subscription Renew-Subscription "
-                        "Cancel-Subscription Get-Notifications Reprocess-Job "
-                        "Cancel-Current-Job Suspend-Current-Job Resume-Job "
-                        "CUPS-Move-Job>\n"
-                         "    Require user @OWNER @SYSTEM\n"
-                         "    Order deny,allow\n"
-                         "  </Limit>\n"
-                         "  # All administration operations require an adminstrator to authenticate...\n"
-                        "  <Limit Pause-Printer Resume-Printer "
-                         "Set-Printer-Attributes Enable-Printer "
-                        "Disable-Printer Pause-Printer-After-Current-Job "
-                        "Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer "
-                        "Activate-Printer Restart-Printer Shutdown-Printer "
-                        "Startup-Printer Promote-Job Schedule-Job-After "
-                        "CUPS-Add-Printer CUPS-Delete-Printer "
-                        "CUPS-Add-Class CUPS-Delete-Class "
-                        "CUPS-Accept-Jobs CUPS-Reject-Jobs "
-                        "CUPS-Set-Default CUPS-Add-Device CUPS-Delete-Device>\n"
-                         "    AuthType Basic\n"
-                        "    Require user @SYSTEM\n"
-                         "    Order deny,allow\n"
-                         "</Limit>\n");
-
-      if (!user_cancel_any)
-       cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
-                          "  <Limit Cancel-Job>\n"
-                          "    Require user @OWNER @SYSTEM\n"
-                          "    Order deny,allow\n"
-                          "  </Limit>\n");
-
-      cupsFilePuts(temp, "  <Limit All>\n"
-                         "  Order deny,allow\n"
-                         "  </Limit>\n"
-                        "</Policy>\n");
-    }
-
-    cupsFileClose(cupsd);
-    cupsFileClose(temp);
-
-   /*
-    * Upload the configuration file to the server...
-    */
-
-    status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
-
-    if (status != HTTP_CREATED)
-    {
-      cgiSetVariable("MESSAGE", cgiText(_("Unable to upload cupsd.conf file:")));
-      cgiSetVariable("ERROR", httpStatus(status));
-      cgiStartHTML(cgiText(_("Change Settings")));
+      cgiSetVariable("ERROR", cupsLastErrorString());
       cgiCopyTemplateLang("error.tmpl");
     }
     else
     {
       cgiSetVariable("refresh_page", "5;/admin/?OP=redirect");
-
       cgiStartHTML(cgiText(_("Change Settings")));
       cgiCopyTemplateLang("restart.tmpl");
     }
 
-    cgiEndHTML();
+    cupsFreeOptions(num_settings, settings);
 
-    unlink(tempfile);
+    cgiEndHTML();
   }
   else if (cgiIsPOST())
   {
@@ -2482,14 +1942,11 @@ do_export(http_t *http)                 /* I - HTTP connection */
                *export_all;            /* Export all printers? */
   int          export_count,           /* Number of printers to export */
                printer_count;          /* Number of available printers */
+  const char   *name,                  /* What name to pull */
+               *dest;                  /* Current destination */
+  char         ppd[1024];              /* PPD file */
 
 
- /*
-  * Show header...
-  */
-
-  cgiStartHTML(cgiText(_("Export Printers to Samba")));
-
  /*
   * Get form data...
   */
@@ -2499,163 +1956,6 @@ do_export(http_t *http)                 /* I - HTTP connection */
   export_all   = cgiGetVariable("EXPORT_ALL");
   export_count = cgiGetSize("EXPORT_NAME");
 
-  if (username && *username && password && *password && export_count <= 1000)
-  {
-   /*
-    * Do export...
-    */
-
-    char       userpass[1024],         /* Username%password */
-               *argv[1005];            /* Arguments */
-    int                argc;                   /* Number of arguments */
-    int                pid;                    /* Process ID of child */
-    int                status;                 /* Status of command */
-
-
-    fputs("DEBUG: Export printers...\n", stderr);
-
-   /*
-    * Create the command-line for cupsaddsmb...
-    */
-
-    snprintf(userpass, sizeof(userpass), "%s%%%s", username, password);
-
-    argv[0] = "cupsaddsmb";
-    argv[1] = "-v";
-    argv[2] = "-U";
-    argv[3] = userpass;
-    argc    = 4;
-
-    if (export_all)
-      argv[argc ++] = "-a";
-    else
-    {
-      for (i = 0; i < export_count; i ++)
-        argv[argc ++] = (char *)cgiGetArray("EXPORT_NAME", i);
-    }
-
-    argv[argc] = NULL; 
-
-   /*
-    * Run the command...
-    */
-
-    if ((pid = fork()) == 0)
-    {
-     /*
-      * Child goes here...
-      */
-
-      close(0);
-      open("/dev/null", O_RDONLY);
-      close(1);
-      dup(2);
-
-      execvp("cupsaddsmb", argv);
-      perror("ERROR: Unable to execute cupsaddsmb");
-      exit(20);
-    }
-    else if (pid < 0)
-      cgiSetVariable("ERROR", cgiText(_("Unable to fork process!")));
-    else
-    {
-     /*
-      * Parent goes here, wait for child to finish...
-      */
-
-      while (wait(&status) < 0);
-
-      if (status)
-      {
-        char   message[1024];          /* Error message */
-
-
-       if (WIFEXITED(status))
-       {
-         switch (WEXITSTATUS(status))
-         {
-           case 1 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to connect to server!")));
-                break;
-
-           case 2 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to get printer "
-                                                 "attributes!")));
-                break;
-
-           case 3 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to convert PPD file!")));
-                break;
-
-           case 4 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to copy Windows 2000 "
-                                                 "printer driver files!")));
-                break;
-
-           case 5 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to install Windows "
-                                                 "2000 printer driver files!")));
-                break;
-
-           case 6 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to copy Windows 9x "
-                                                 "printer driver files!")));
-                break;
-
-           case 7 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to install Windows "
-                                                 "9x printer driver files!")));
-                break;
-
-           case 8 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to set Windows "
-                                                 "printer driver!")));
-                break;
-
-           case 9 :
-               cgiSetVariable("ERROR", cgiText(_("No printer drivers found!")));
-                break;
-
-           case 20 :
-               cgiSetVariable("ERROR", cgiText(_("Unable to execute "
-                                                 "cupsaddsmb command!")));
-                break;
-
-           default :
-               snprintf(message, sizeof(message),
-                         cgiText(_("cupsaddsmb failed with status %d")),
-                        WEXITSTATUS(status));
-
-                cgiSetVariable("ERROR", message);
-               break;
-          }
-       }
-        else
-       {
-          snprintf(message, sizeof(message),
-                   cgiText(_("cupsaddsmb crashed on signal %d")),
-                  WTERMSIG(status));
-
-          cgiSetVariable("ERROR", message);
-       }
-      }
-      else
-      {
-        cgiCopyTemplateLang("samba-exported.tmpl");
-       cgiEndHTML();
-       return;
-      }
-    }
-  }
-  else if (username && !*username)
-    cgiSetVariable("ERROR",
-                   cgiText(_("A Samba username is required to export "
-                            "printer drivers!")));
-  else if (username && (!password || !*password))
-    cgiSetVariable("ERROR",
-                   cgiText(_("A Samba password is required to export "
-                            "printer drivers!")));
-
  /*
   * Get list of available printers...
   */
@@ -2686,9 +1986,10 @@ do_export(http_t *http)                  /* I - HTTP connection */
 
       for (i = 0; i < printer_count; i ++)
       {
+        dest = cgiGetArray("PRINTER_NAME", i);
+
         for (j = 0; j < export_count; j ++)
-         if (!strcasecmp(cgiGetArray("PRINTER_NAME", i),
-                         cgiGetArray("EXPORT_NAME", j)))
+         if (!strcasecmp(dest, cgiGetArray("EXPORT_NAME", j)))
             break;
 
         cgiSetArray("PRINTER_EXPORT", i, j < export_count ? "Y" : "");
@@ -2696,10 +1997,67 @@ do_export(http_t *http)                 /* I - HTTP connection */
     }
   }
 
+ /*
+  * Export or get the printers to export...
+  */
+
+  if (username && *username && password && *password &&
+      (export_all || export_count > 0))
+  {
+   /*
+    * Do export...
+    */
+
+    fputs("DEBUG: Export printers...\n", stderr);
+
+    if (export_all)
+    {
+      name         = "PRINTER_NAME";
+      export_count = cgiGetSize("PRINTER_NAME");
+    }
+    else
+      name = "EXPORT_NAME";
+
+    for (i = 0; i < export_count; i ++)
+    {
+      dest = cgiGetArray(name, i);
+
+      if (!cupsAdminCreateWindowsPPD(http, dest, ppd, sizeof(ppd)))
+        break;
+
+      j = cupsAdminExportSamba(dest, ppd, "localhost", username, password,
+                               stderr);
+
+      unlink(ppd);
+
+      if (!j)
+        break;
+    }
+
+    if (i < export_count)
+      cgiSetVariable("ERROR", cupsLastErrorString());
+    else
+    {
+      cgiStartHTML(cgiText(_("Export Printers to Samba")));
+      cgiCopyTemplateLang("samba-exported.tmpl");
+      cgiEndHTML();
+      return;
+    }
+  }
+  else if (username && !*username)
+    cgiSetVariable("ERROR",
+                   cgiText(_("A Samba username is required to export "
+                            "printer drivers!")));
+  else if (username && (!password || !*password))
+    cgiSetVariable("ERROR",
+                   cgiText(_("A Samba password is required to export "
+                            "printer drivers!")));
+
  /*
   * Show form...
   */
 
+  cgiStartHTML(cgiText(_("Export Printers to Samba")));
   cgiCopyTemplateLang("samba-export.tmpl");
   cgiEndHTML();
 }
@@ -2712,10 +2070,10 @@ do_export(http_t *http)                 /* I - HTTP connection */
 static void
 do_menu(http_t *http)                  /* I - HTTP connection */
 {
-  cups_file_t  *cupsd;                 /* cupsd.conf file */
-  char         line[1024],             /* Line from cupsd.conf file */
-               *value;                 /* Value on line */
-  const char   *server_root;           /* Location of config files */
+  int          num_settings;           /* Number of server settings */
+  cups_option_t        *settings;              /* Server settings */
+  const char   *val;                   /* Setting value */
+  char         filename[1024];         /* Temporary filename */
   const char   *datadir;               /* Location of data files */
   ipp_t                *request,               /* IPP request */
                *response;              /* IPP response */
@@ -2723,165 +2081,37 @@ do_menu(http_t *http)                  /* I - HTTP connection */
 
 
  /*
-  * Locate the cupsd.conf file...
+  * Get the current server settings...
   */
 
-  if ((server_root = getenv("CUPS_SERVERROOT")) == NULL)
-    server_root = CUPS_SERVERROOT;
-
-  snprintf(line, sizeof(line), "%s/cupsd.conf", server_root);
-
-  cgiStartHTML(cgiText(_("Administration")));
-
-  printf("<!-- \"%s\" -->\n", line);
-
- /*
-  * Open the cupsd.conf file...
-  */
-
-  if ((cupsd = cupsFileOpen(line, "r")) == NULL)
+  if (!_cupsAdminGetServerSettings(http, &num_settings, &settings))
   {
-   /*
-    * Unable to open - log an error...
-    */
-
+    cgiStartHTML(cgiText(_("Administration")));
     cgiSetVariable("MESSAGE", cgiText(_("Unable to open cupsd.conf file:")));
-    cgiSetVariable("ERROR", strerror(errno));
+    cgiSetVariable("ERROR", cupsLastErrorString());
     cgiCopyTemplateLang("error.tmpl");
     cgiEndHTML();
-
-    perror(line);
   }
-  else
-  {
-   /*
-    * Read the file, keeping track of what settings are enabled...
-    */
 
-    int                remote_access = 0,      /* Remote access allowed? */
-               remote_admin = 0,       /* Remote administration allowed? */
-               browsing = 1,           /* Browsing enabled? */
-               browse_allow = 1,       /* Browse address set? */
-               browse_address = 0,     /* Browse address set? */
-               cancel_policy = 1,      /* Cancel-job policy set? */
-               debug_logging = 0;      /* LogLevel debug set? */
-    int                linenum = 0,            /* Line number in file */
-               in_policy = 0,          /* In a policy section? */
-               in_cancel_job = 0,      /* In a cancel-job section? */
-               in_admin_location = 0;  /* In the /admin location? */
+  if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("DEBUG_LOGGING", "CHECKED");
 
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("REMOTE_ADMIN", "CHECKED");
 
-    while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
-    {
-      if (!strcasecmp(line, "Port"))
-      {
-        remote_access = 1;
-      }
-      else if (!strcasecmp(line, "Listen"))
-      {
-        char   *port;                  /* Pointer to port number, if any */
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("REMOTE_PRINTERS", "CHECKED");
 
+  if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("SHARE_PRINTERS", "CHECKED");
 
-       if ((port = strrchr(value, ':')) != NULL)
-         *port = '\0';
-
-        if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1"))
-         remote_access = 1;
-      }
-      else if (!strcasecmp(line, "Browsing"))
-      {
-        browsing = !strcasecmp(value, "yes") || !strcasecmp(value, "on") ||
-                  !strcasecmp(value, "true");
-      }
-      else if (!strcasecmp(line, "BrowseAddress"))
-      {
-        browse_address = 1;
-      }
-      else if (!strcasecmp(line, "BrowseAllow"))
-      {
-        browse_allow = 1;
-      }
-      else if (!strcasecmp(line, "BrowseOrder"))
-      {
-        browse_allow = !strncasecmp(value, "deny,", 5);
-      }
-      else if (!strcasecmp(line, "LogLevel"))
-      {
-        debug_logging = !strncasecmp(value, "debug", 5);
-      }
-      else if (!strcasecmp(line, "<Policy") && !strcasecmp(value, "default"))
-      {
-        in_policy = 1;
-      }
-      else if (!strcasecmp(line, "</Policy>"))
-      {
-        in_policy = 0;
-      }
-      else if (!strcasecmp(line, "<Limit") && in_policy)
-      {
-       /*
-        * See if the policy limit is for the Cancel-Job operation...
-       */
-
-        char   *valptr;                /* Pointer into value */
-
-
-        while (*value)
-       {
-         for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
-
-         if (*valptr)
-           *valptr++ = '\0';
-
-          if (!strcasecmp(value, "cancel-job") || !strcasecmp(value, "all"))
-         {
-           in_cancel_job = 1;
-           break;
-         }
-
-          for (value = valptr; isspace(*value & 255); value ++);
-        }
-      }
-      else if (!strcasecmp(line, "</Limit>"))
-      {
-        in_cancel_job = 0;
-      }
-      else if (!strcasecmp(line, "Require") && in_cancel_job)
-      {
-        cancel_policy = 0;
-      }
-      else if (!strcasecmp(line, "<Location") && !strcasecmp(value, "/admin"))
-      {
-        in_admin_location = 1;
-      }
-      else if (!strcasecmp(line, "</Location>"))
-      {
-        in_admin_location = 0;
-      }
-      else if (!strcasecmp(line, "Allow") && in_admin_location &&
-               strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1"))
-      {
-        remote_admin = 1;
-      }
-    }
-
-    cupsFileClose(cupsd);
-
-    if (browsing && browse_allow)
-      cgiSetVariable("REMOTE_PRINTERS", "CHECKED");
-
-    if (remote_access && browsing && browse_address)
-      cgiSetVariable("SHARE_PRINTERS", "CHECKED");
-
-    if (remote_access && remote_admin)
-      cgiSetVariable("REMOTE_ADMIN", "CHECKED");
-
-    if (cancel_policy)
-      cgiSetVariable("USER_CANCEL_ANY", "CHECKED");
-
-    if (debug_logging)
-      cgiSetVariable("DEBUG_LOGGING", "CHECKED");
-  }
+  if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
+                           settings)) != NULL && atoi(val))
+    cgiSetVariable("USER_CANCEL_ANY", "CHECKED");
 
  /*
   * Get the list of printers and their devices...
@@ -3100,33 +2330,39 @@ do_menu(http_t *http)                   /* I - HTTP connection */
   if ((datadir = getenv("CUPS_DATADIR")) == NULL)
     datadir = CUPS_DATADIR;
 
-  snprintf(line, sizeof(line), "%s/drivers/pscript5.dll", datadir);
-  if (!access(line, 0))
+  snprintf(filename, sizeof(filename), "%s/drivers/pscript5.dll", datadir);
+  if (!access(filename, R_OK))
   {
    /*
     * Found Windows 2000 driver file, see if we have smbclient and
     * rpcclient...
     */
 
-    if (cupsFileFind("smbclient", getenv("PATH"), 1, line, sizeof(line)) &&
-        cupsFileFind("rpcclient", getenv("PATH"), 1, line, sizeof(line)))
+    if (cupsFileFind("smbclient", getenv("PATH"), 1, filename,
+                     sizeof(filename)) &&
+        cupsFileFind("rpcclient", getenv("PATH"), 1, filename,
+                    sizeof(filename)))
       cgiSetVariable("HAVE_SAMBA", "Y");
     else
     {
-      if (!cupsFileFind("smbclient", getenv("PATH"), 1, line, sizeof(line)))
+      if (!cupsFileFind("smbclient", getenv("PATH"), 1, filename,
+                        sizeof(filename)))
         fputs("ERROR: smbclient not found!\n", stderr);
 
-      if (!cupsFileFind("rpcclient", getenv("PATH"), 1, line, sizeof(line)))
+      if (!cupsFileFind("rpcclient", getenv("PATH"), 1, filename,
+                        sizeof(filename)))
         fputs("ERROR: rpcclient not found!\n", stderr);
     }
   }
   else
-    perror(line);
+    perror(filename);
 
  /*
   * Finally, show the main menu template...
   */
 
+  cgiStartHTML(cgiText(_("Administration")));
+
   cgiCopyTemplateLang("admin.tmpl");
 
   cgiEndHTML();
@@ -3610,5 +2846,5 @@ match_string(const char *a,               /* I - First string */
 
     
 /*
- * End of "$Id: admin.c 5107 2006-02-15 19:14:17Z mike $".
+ * End of "$Id: admin.c 5240 2006-03-07 21:55:29Z mike $".
  */
index fb598f84fc5370829168e3a38bd63a40f14fdf42..274c8e9b8d8e026e8a2c14f2126d32795923d27e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-var.c 5184 2006-02-26 15:13:44Z mike $"
+ * "$Id: ipp-var.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
  *
@@ -661,7 +661,7 @@ cgiRewriteURL(const char *uri,              /* I - Current URI */
     if ((server = getenv("SERVER_NAME")) == NULL)
       server = "";
 
-    httpGetHostname(servername, sizeof(servername));
+    httpGetHostname(NULL, servername, sizeof(servername));
 
    /*
     * Then flag whether we are using SSL on this connection...
@@ -1277,5 +1277,5 @@ cgiText(const char *message)              /* I - Message */
 
 
 /*
- * End of "$Id: ipp-var.c 5184 2006-02-26 15:13:44Z mike $".
+ * End of "$Id: ipp-var.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 82a796509bf1562908aa8245673de7372e4ba3b9..e806900af7af0fe2dd71c0ab6c546b932d6d27f8 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5185 2006-02-26 15:27:14Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Configuration file makefile for the Common UNIX Printing System (CUPS).
 #
@@ -28,7 +28,7 @@ include ../Makedefs
 # Config files...
 #
 
-KEEP   =       client.conf cupsd.conf
+KEEP   =       cupsd.conf
 REPLACE        =       mime.convs mime.types
 
 
@@ -46,6 +46,13 @@ all:
 clean:
 
 
+#
+# Dummy depend...
+#
+
+depend:
+
+
 #
 # Install files...
 #
@@ -81,5 +88,20 @@ install:     all
 
 
 #
-# End of "$Id: Makefile 5185 2006-02-26 15:27:14Z mike $".
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
+               $(RM) $(SERVERROOT)/$$file; \
+       done
+       -$(RMDIR) $(SERVERROOT)
+       -if test x$(PAMDIR) != x; then \
+               $(RM) $(BUILDROOT)$(PAMDIR)/cups; \
+               $(RMDIR) $(BUILDROOT)$(PAMDIR); \
+       fi
+
+
+#
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
diff --git a/conf/client.conf b/conf/client.conf
deleted file mode 100644 (file)
index dfe3321..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# "$Id: client.conf 4494 2005-02-18 02:18:11Z mike $"
-#
-#   Sample client configuration file for the Common UNIX Printing System
-#   (CUPS).
-#
-#   Copyright 1997-2005 by Easy Software Products, all rights reserved.
-#
-#   These coded instructions, statements, and computer programs are the
-#   property of Easy Software Products and are protected by Federal
-#   copyright law.  Distribution and use rights are outlined in the file
-#   "LICENSE.txt" which should have been included with this file.  If this
-#   file is missing or damaged please contact Easy Software Products
-#   at:
-#
-#       Attn: CUPS Licensing Information
-#       Easy Software Products
-#       44141 Airport View Drive, Suite 204
-#       Hollywood, Maryland 20636 USA
-#
-#       Voice: (301) 373-9600
-#       EMail: cups-info@cups.org
-#         WWW: http://www.cups.org
-#
-
-########################################################################
-#                                                                      #
-# This is the CUPS client configuration file.  This file is used to    #
-# define client-specific parameters, such as the default server or     #
-# default encryption settings.                                         #
-#                                                                      #
-########################################################################
-
-#
-# ServerName: the hostname of your server.  By default CUPS will use the
-# hostname of the system or the value of the CUPS_SERVER environment
-# variable.  ONLY ONE SERVER NAME MAY BE SPECIFIED AT A TIME.  To use
-# more than one server you must use a local scheduler with browsing
-# and possibly polling.
-#
-
-#ServerName myhost.domain.com
-
-#
-# Encryption: whether or not to use encryption; this depends on having
-# the OpenSSL library linked into the CUPS library.
-#
-# Possible values:
-#
-#     Always       - Always use encryption (SSL)
-#     Never        - Never use encryption
-#     Required     - Use TLS encryption upgrade
-#     IfRequested  - Use encryption if the server requests it
-#
-# The default value is "IfRequested".  This parameter can also be set
-# using the CUPS_ENCRYPTION environment variable.
-#
-
-#Encryption Always
-#Encryption Never
-#Encryption Required
-#Encryption IfRequested
-
-
-#
-# End of "$Id: client.conf 4494 2005-02-18 02:18:11Z mike $".
-#
index abad61d563440e73d010acaaece5d7042a1e632b..ccc3b460b2aa8e9ce559b354c73640f456233e6f 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-common.m4 5144 2006-02-21 20:44:01Z mike $"
+dnl "$Id: cups-common.m4 5229 2006-03-05 16:48:12Z mike $"
 dnl
 dnl   Common configuration stuff for the Common UNIX Printing System (CUPS).
 dnl
@@ -63,6 +63,7 @@ AC_PATH_PROG(LD,ld)
 AC_PATH_PROG(LN,ln)
 AC_PATH_PROG(MV,mv)
 AC_PATH_PROG(RM,rm)
+AC_PATH_PROG(RM,rmdir)
 AC_PATH_PROG(SED,sed)
 AC_PATH_PROG(STRIP,strip)
 
@@ -263,5 +264,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
 
 dnl
-dnl End of "$Id: cups-common.m4 5144 2006-02-21 20:44:01Z mike $".
+dnl End of "$Id: cups-common.m4 5229 2006-03-05 16:48:12Z mike $".
 dnl
index 9b68b129992b7f7a6cd25facdf1e4987cbc5d2a4..e979f03717970cdd990d84c138a542f56a49e8ba 100644 (file)
@@ -1,11 +1,13 @@
 # DO NOT DELETE
 
+adminutil.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
+adminutil.o: language.h globals.h string.h ../config.h i18n.h normalize.h
+adminutil.o: transcode.h debug.h
 array.o: array.h string.h ../config.h debug.h
 attr.o: ppd.h array.h file.h debug.h string.h ../config.h
 auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 auth.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
-backchannel.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
-backchannel.o: file.h language.h
+backchannel.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
 backend.o: backend.h string.h ../config.h
 custom.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 custom.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
@@ -13,28 +15,28 @@ dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 dest.o: array.h file.h language.h i18n.h normalize.h transcode.h
 dir.o: dir.h string.h ../config.h debug.h
 emit.o: ppd.h array.h file.h string.h ../config.h
-encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h file.h
-encode.o: language.h ipp-private.h debug.h
-file.o: http-private.h ../config.h http.h string.h md5.h ipp-private.h ipp.h
+encode.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
+encode.o: ipp-private.h string.h ../config.h debug.h
+file.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h string.h
 file.o: ../cups/debug.h file.h
-getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
-getputfile.o: file.h language.h debug.h
-globals.o: http-private.h ../config.h http.h string.h md5.h ipp-private.h
-globals.o: ipp.h globals.h cups.h ppd.h array.h file.h language.h i18n.h
+getputfile.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
+getputfile.o: string.h ../config.h debug.h
+globals.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
+globals.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
 globals.o: normalize.h transcode.h
-http.o: http-private.h ../config.h http.h string.h md5.h ipp-private.h ipp.h
-http.o: globals.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
+http.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
+http.o: string.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
 http.o: transcode.h debug.h
 http-addr.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 http-addr.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
-http-addrlist.o: http-private.h ../config.h http.h string.h md5.h
-http-addrlist.o: ipp-private.h ipp.h globals.h cups.h ppd.h array.h file.h
-http-addrlist.o: language.h i18n.h normalize.h transcode.h debug.h
+http-addrlist.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
+http-addrlist.o: globals.h string.h cups.h ppd.h array.h file.h language.h
+http-addrlist.o: i18n.h normalize.h transcode.h debug.h
 http-support.o: debug.h globals.h string.h ../config.h cups.h ipp.h http.h
 http-support.o: md5.h ppd.h array.h file.h language.h i18n.h normalize.h
 http-support.o: transcode.h
-ipp.o: http-private.h ../config.h http.h string.h md5.h ipp-private.h ipp.h
-ipp.o: globals.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
+ipp.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
+ipp.o: string.h cups.h ppd.h array.h file.h language.h i18n.h normalize.h
 ipp.o: transcode.h debug.h
 ipp-support.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 ipp-support.o: array.h file.h language.h i18n.h normalize.h transcode.h
@@ -45,15 +47,16 @@ language.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 language.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
 localize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 localize.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
-mark.o: ppd.h array.h file.h string.h ../config.h debug.h
+mark.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
+mark.o: ../config.h debug.h
 md5.o: md5.h string.h ../config.h
-md5passwd.o: http.h string.h ../config.h md5.h
+md5passwd.o: http.h md5.h string.h ../config.h
 normalize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 normalize.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
 notify.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 notify.o: array.h file.h language.h i18n.h normalize.h transcode.h
-options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h
-options.o: file.h language.h debug.h
+options.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h string.h
+options.o: ../config.h debug.h
 page.o: ppd.h array.h file.h string.h ../config.h
 ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h
 ppd.o: file.h language.h i18n.h normalize.h transcode.h debug.h
@@ -66,14 +69,16 @@ tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 tempfile.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
 transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 transcode.o: array.h file.h language.h i18n.h normalize.h transcode.h
-usersys.o: http-private.h ../config.h http.h string.h md5.h ipp-private.h
-usersys.o: ipp.h globals.h cups.h ppd.h array.h file.h language.h i18n.h
+usersys.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
+usersys.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
 usersys.o: normalize.h transcode.h
 util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
 util.o: array.h file.h language.h i18n.h normalize.h transcode.h debug.h
+testadmin.o: adminutil.h cups.h ipp.h http.h md5.h ppd.h array.h file.h
+testadmin.o: language.h string.h ../config.h
 testarray.o: ../cups/string.h ../config.h string.h array.h dir.h debug.h
 testfile.o: string.h ../config.h file.h debug.h
-testhttp.o: http.h string.h ../config.h md5.h
+testhttp.o: http.h md5.h string.h ../config.h
 testi18n.o: language.h array.h string.h ../config.h transcode.h normalize.h
 testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h
 testlang.o: i18n.h language.h array.h
index cbd6e36f45edef65ec7d763d4f205a97e638082b..750b80bc92071dc9194484a9504fe5c47d489c07 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5138 2006-02-21 10:49:06Z mike $"
+# "$Id: Makefile 5240 2006-03-07 21:55:29Z mike $"
 #
 #   API library Makefile for the Common UNIX Printing System (CUPS).
 #
@@ -31,6 +31,7 @@ include ../Makedefs
 #
 
 LIBOBJS        =       \
+               adminutil.o \
                array.o \
                attr.o \
                auth.o \
@@ -70,6 +71,7 @@ LIBOBJS       =       \
                util.o
 OBJS   =       \
                $(LIBOBJS) \
+               testadmin.o \
                testarray.o \
                testfile.o \
                testhttp.o \
@@ -85,6 +87,7 @@ OBJS  =       \
 #
 
 HEADERS        =       \
+               adminutil.h \
                array.h \
                cups.h \
                dir.h \
@@ -106,6 +109,7 @@ HEADERS     =       \
 TARGETS        =       \
                $(LIBCUPS) \
                libcups.a \
+               testadmin \
                testarray \
                testfile \
                testhttp \
@@ -169,6 +173,26 @@ installhdrs:
        done
 
 
+#
+# Uninstall object and target files...
+#
+
+uninstall:
+       $(RM) $(LIBDIR)/libcups.2.dylib
+       $(RM) $(LIBDIR)/libcups.a
+       $(RM) $(LIBDIR)/libcups.dylib
+       $(RM) $(LIBDIR)/libcups_s.a
+       $(RM) $(LIBDIR)/libcups.sl
+       $(RM) $(LIBDIR)/libcups.sl.2
+       $(RM) $(LIBDIR)/libcups.so
+       $(RM) $(LIBDIR)/libcups.so.2
+       -$(RMDIR) $(LIBDIR)
+       for file in $(HEADERS); do \
+               $(RM) $(INCLUDEDIR)/cups/$$file; \
+       done
+       -$(RMDIR) $(INCLUDEDIR)/cups
+
+
 #
 # libcups.so.2, libcups.sl.2
 #
@@ -230,6 +254,9 @@ libcups.a:  $(LIBOBJS)
 #
 # CUPS language bindings for various scripting languages...
 #
+# NOTE: Not currently used or functional - see the scripting/php directory
+#       for the hand-written bindings...
+#
 
 phpcups.so:    $(LIBCUPS) php_cups_wrap.o
        echo Linking $@...
@@ -248,6 +275,16 @@ php_cups_wrap.c:   cups.h
        swig -php -o $@ -module cups cups.h
 
 
+#
+# testadmin (dependency on static CUPS library is intentional)
+#
+
+testadmin:     testadmin.o libcups.a
+       echo Linking $@...
+       $(CC) $(LDFLAGS) -o $@ testadmin.o libcups.a \
+               $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
+
+
 #
 # testarray (dependency on static CUPS library is intentional)
 #
@@ -357,5 +394,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5138 2006-02-21 10:49:06Z mike $".
+# End of "$Id: Makefile 5240 2006-03-07 21:55:29Z mike $".
 #
diff --git a/cups/adminutil.c b/cups/adminutil.c
new file mode 100644 (file)
index 0000000..44ffe6e
--- /dev/null
@@ -0,0 +1,1900 @@
+/*
+ * "$Id: adminutil.c 5240 2006-03-07 21:55:29Z mike $"
+ *
+ *   Administration utility API definitions for the Common UNIX Printing
+ *   System (CUPS).
+ *
+ *   MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
+ *   CHANGE AT ANY TIME.  USE AT YOUR OWN RISK.
+ *
+ *   Copyright 2001-2006 by Easy Software Products.
+ *
+ *   These coded instructions, statements, and computer programs are the
+ *   property of Easy Software Products and are protected by Federal
+ *   copyright law.  Distribution and use rights are outlined in the file
+ *   "LICENSE.txt" which should have been included with this file.  If this
+ *   file is missing or damaged please contact Easy Software Products
+ *   at:
+ *
+ *       Attn: CUPS Licensing Information
+ *       Easy Software Products
+ *       44141 Airport View Drive, Suite 204
+ *       Hollywood, Maryland 20636 USA
+ *
+ *       Voice: (301) 373-9600
+ *       EMail: cups-info@cups.org
+ *         WWW: http://www.cups.org
+ *
+ *   This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ *   cupsAdminCreateWindowsPPD()   - Create the Windows PPD file for a printer.
+ *   cupsAdminExportSamba()        - Export a printer to Samba.
+ *   _cupsAdminGetServerSettings() - Get settings from the server.
+ *   _cupsAdminSetServerSettings() - Set settings on the server.
+ *   do_samba_command()            - Do a SAMBA command.
+ *   get_cupsd_conf()              - Get the current cupsd.conf file.
+ *   invalidate_cupsd_cache()      - Invalidate the cached cupsd.conf settings.
+ *   write_option()                - Write a CUPS option to a PPD file.
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "adminutil.h"
+#include "globals.h"
+#include "debug.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+
+/*
+ * Local functions...
+ */
+
+static int             do_samba_command(const char *command,
+                                        const char *address,
+                                        const char *subcommand,
+                                        const char *authfile,
+                                        FILE *logfile);
+static http_status_t   get_cupsd_conf(http_t *http, _cups_globals_t *cg,
+                                      time_t last_update, char *name,
+                                      int namelen, int *remote);
+static void            invalidate_cupsd_cache(_cups_globals_t *cg);
+static void            write_option(cups_file_t *dstfp, int order,
+                                    const char *name, const char *text,
+                                    const char *attrname,
+                                    ipp_attribute_t *suppattr,
+                                    ipp_attribute_t *defattr, int defval,
+                                    int valcount);
+
+
+/*
+ * 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
+ */
+
+char *                                 /* O - PPD file or NULL */
+cupsAdminCreateWindowsPPD(
+    http_t     *http,                  /* I - Connection to server */
+    const char *dest,                  /* I - Printer or class */
+    char       *buffer,                        /* I - Filename buffer */
+    int        bufsize)                        /* I - Size of filename buffer */
+{
+  const char           *src;           /* Source PPD filename */
+  cups_file_t          *srcfp,         /* Source PPD file */
+                       *dstfp;         /* Destination PPD file */
+  ipp_t                        *request,       /* IPP request */
+                       *response;      /* IPP response */
+  ipp_attribute_t      *suppattr,      /* IPP -supported attribute */
+                       *defattr;       /* IPP -default attribute */
+  cups_lang_t          *language;      /* Current language */
+  char                 line[256],      /* Line from PPD file */
+                       junk[256],      /* Extra junk to throw away */
+                       *ptr,           /* Pointer into line */
+                       uri[1024],      /* Printer URI */
+                       option[41],     /* Option */
+                       choice[41];     /* Choice */
+  int                  jcloption,      /* In a JCL option? */
+                       linenum;        /* Current line number */
+  time_t               curtime;        /* Current time */
+  struct tm            *curdate;       /* Current date */
+  static const char    *pattrs[] =     /* Printer attributes we want */
+                       {
+                         "job-hold-until-supported",
+                         "job-hold-until-default",
+                         "job-sheets-supported",
+                         "job-sheets-default",
+                         "job-priority-supported",
+                         "job-priority-default"
+                       };
+
+
+ /*
+  * Range check the input...
+  */
+
+  if (buffer)
+    *buffer = '\0';
+
+  if (!http || !dest || !buffer || bufsize < 2)
+    return (NULL);
+
+ /*
+  * Get the PPD file...
+  */
+
+  if ((src = cupsGetPPD2(http, dest)) == NULL)
+    return (NULL);
+
+ /*
+  * Get the supported banner pages, etc. for the printer...
+  */
+
+  request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
+
+  httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+                   "localhost", 0, "/printers/%s", dest);
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
+               "printer-uri", NULL, uri);
+
+  ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+                "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
+               NULL, pattrs);
+
+ /*
+  * Do the request and get back a response...
+  */
+
+  response = cupsDoRequest(http, request, "/");
+  if (!response || cupsLastError() > IPP_OK_CONFLICT)
+  {
+    unlink(src);
+    return (NULL);
+  }
+
+ /*
+  * Open the original PPD file...
+  */
+
+  if ((srcfp = cupsFileOpen(src, "rb")) == NULL)
+    return (NULL);
+
+ /*
+  * Create a temporary output file using the destination buffer...
+  */
+
+  if ((dstfp = cupsTempFile2(buffer, bufsize)) < 0)
+  {
+    cupsFileClose(srcfp);
+
+    unlink(src);
+
+    return (NULL);
+  }
+
+ /*
+  * Write a new header explaining that this isn't the original PPD...
+  */
+
+  cupsFilePuts(dstfp, "*PPD-Adobe: \"4.3\"\n");
+
+  curtime = time(NULL);
+  curdate = gmtime(&curtime);
+
+  cupsFilePrintf(dstfp, "*%% Modified on %04d%02d%02d%02d%02d%02d+0000 "
+                        "for CUPS Windows Driver\n",
+                curdate->tm_year + 1900, curdate->tm_mon + 1, curdate->tm_mday,
+                curdate->tm_hour, curdate->tm_min, curdate->tm_sec);
+
+ /*
+  * Read the existing PPD file, converting all PJL commands to CUPS
+  * job ticket comments...
+  */
+
+  jcloption = 0;
+  linenum   = 0;
+  language  = cupsLangDefault();
+
+  while (cupsFileGets(srcfp, line, sizeof(line)))
+  {
+    linenum ++;
+
+    if (!strncmp(line, "*PPD-Adobe:", 11))
+    {
+     /*
+      * Already wrote the PPD header...
+      */
+
+      continue;
+    }
+    else if (!strncmp(line, "*JCLBegin:", 10) ||
+             !strncmp(line, "*JCLToPSInterpreter:", 20) ||
+            !strncmp(line, "*JCLEnd:", 8) ||
+            !strncmp(line, "*Protocols:", 11))
+    {
+     /*
+      * Don't use existing JCL keywords; we'll create our own, below...
+      */
+
+      cupsFilePrintf(dstfp, "*%% Commented out for CUPS Windows Driver...\n"
+                            "*%%%s", line + 1);
+      continue;
+    }
+    else if (!strncmp(line, "*JCLOpenUI", 10))
+    {
+      jcloption = 1;
+      cupsFilePuts(dstfp, line);
+    }
+    else if (!strncmp(line, "*JCLCloseUI", 11))
+    {
+      jcloption = 0;
+      cupsFilePuts(dstfp, line);
+    }
+    else if (jcloption &&
+             strncmp(line, "*End", 4) &&
+             strncmp(line, "*Default", 8) &&
+             strncmp(line, "*OrderDependency", 16))
+    {
+      if ((ptr = strchr(line, ':')) == NULL)
+      {
+        snprintf(line, sizeof(line),
+                 _cupsLangString(language, _("Missing value on line %d!\n")),
+                 linenum);
+        _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
+
+        cupsFileClose(srcfp);
+        cupsFileClose(dstfp);
+
+       unlink(src);
+       unlink(buffer);
+
+        *buffer = '\0';
+
+       return (NULL);
+      }
+
+      if ((ptr = strchr(ptr, '\"')) == NULL)
+      {
+        snprintf(line, sizeof(line),
+                _cupsLangString(language,
+                                _("Missing double quote on line %d!\n")),
+                linenum);
+        _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
+
+        cupsFileClose(srcfp);
+        cupsFileClose(dstfp);
+
+       unlink(src);
+       unlink(buffer);
+
+        *buffer = '\0';
+
+       return (NULL);
+      }
+
+      if (sscanf(line, "*%40s%*[ \t]%40[^/]", option, choice) != 2)
+      {
+        snprintf(line, sizeof(line),
+                _cupsLangString(language,
+                                _("Bad option + choice on line %d!\n")),
+                linenum);
+        _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line);
+
+        cupsFileClose(srcfp);
+        cupsFileClose(dstfp);
+
+       unlink(src);
+       unlink(buffer);
+
+        *buffer = '\0';
+
+       return (NULL);
+      }
+
+      if (strchr(ptr + 1, '\"') == NULL)
+      {
+       /*
+        * Skip remaining...
+       */
+
+       while (cupsFileGets(srcfp, junk, sizeof(junk)) != NULL)
+       {
+         linenum ++;
+
+         if (!strncmp(junk, "*End", 4))
+           break;
+       }
+      }
+
+      snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
+               "%%cupsJobTicket: %s=%s\n\"\n*End\n", option, choice);
+
+      cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s", line);
+    }
+    else
+      cupsFilePuts(dstfp, line);
+  }
+
+  cupsFileClose(srcfp);
+  unlink(src);
+
+ /*
+  * Now add the CUPS-specific attributes and options...
+  */
+
+  cupsFilePuts(dstfp, "\n*% CUPS Job Ticket support and options...\n");
+  cupsFilePuts(dstfp, "*Protocols: PJL\n");
+  cupsFilePuts(dstfp, "*JCLBegin: \"%!PS-Adobe-3.0<0A>\"\n");
+  cupsFilePuts(dstfp, "*JCLToPSInterpreter: \"\"\n");
+  cupsFilePuts(dstfp, "*JCLEnd: \"\"\n");
+
+  cupsFilePuts(dstfp, "\n*OpenGroup: CUPS/CUPS Options\n\n");
+
+  if ((defattr = ippFindAttribute(response, "job-hold-until-default",
+                                  IPP_TAG_ZERO)) != NULL &&
+      (suppattr = ippFindAttribute(response, "job-hold-until-supported",
+                                   IPP_TAG_ZERO)) != NULL)
+    write_option(dstfp, 10, "cupsJobHoldUntil", "Hold Until", "job-hold-until",
+                 suppattr, defattr, 0, 1);
+
+  if ((defattr = ippFindAttribute(response, "job-priority-default",
+                                  IPP_TAG_INTEGER)) != NULL &&
+      (suppattr = ippFindAttribute(response, "job-priority-supported",
+                                   IPP_TAG_RANGE)) != NULL)
+    write_option(dstfp, 11, "cupsJobPriority", "Priority", "job-priority",
+                 suppattr, defattr, 0, 1);
+
+  if ((defattr = ippFindAttribute(response, "job-sheets-default",
+                                  IPP_TAG_ZERO)) != NULL &&
+      (suppattr = ippFindAttribute(response, "job-sheets-supported",
+                                   IPP_TAG_ZERO)) != NULL)
+  {
+    write_option(dstfp, 20, "cupsJobSheetsStart", "Start Banner",
+                 "job-sheets", suppattr, defattr, 0, 2);
+    write_option(dstfp, 21, "cupsJobSheetsEnd", "End Banner",
+                 "job-sheets", suppattr, defattr, 1, 2);
+  }
+
+  cupsFilePuts(dstfp, "*CloseGroup: CUPS\n");
+  cupsFileClose(dstfp);
+
+  ippDelete(response);
+
+  return (buffer);
+}
+
+
+/*
+ * 'cupsAdminExportSamba()' - Export a printer to Samba.
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsAdminExportSamba(
+    const char *dest,                  /* I - Destination to export */
+    const char *ppd,                   /* I - PPD file */
+    const char *samba_server,          /* I - Samba server */
+    const char *samba_user,            /* I - Samba username */
+    const char *samba_password,                /* I - Samba password */
+    FILE       *logfile)               /* I - Log file, if any */
+{
+  int                  status;         /* Status of smbclient/rpcclient commands */
+  int                  have_drivers;   /* Have drivers? */
+  char                 file[1024],     /* File to test for */
+                       authfile[1024], /* Temporary authentication file */
+                       address[1024],  /* Address for command */
+                       subcmd[1024],   /* Sub-command */
+                       message[1024];  /* Error message */
+  cups_file_t          *fp;            /* Authentication file */
+  cups_lang_t          *language;      /* Current language */
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Global data */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!dest || !ppd || !samba_server || !samba_user || !samba_password)
+  {
+    _cupsSetError(IPP_INTERNAL_ERROR, NULL);
+    return (0);
+  }
+
+ /*
+  * Create a temporary authentication file for Samba...
+  */
+
+  if ((fp = cupsTempFile2(authfile, sizeof(authfile))) == NULL)
+  {
+    _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+    return (0);
+  }
+
+  cupsFilePrintf(fp, "username = %s\n", samba_user);
+  cupsFilePrintf(fp, "password = %s\n", samba_password);
+  cupsFileClose(fp);
+
+ /*
+  * See which drivers are available; the new CUPS v6 and Adobe drivers
+  * depend on the Windows 2k PS driver, so copy that driver first:
+  *
+  * Files:
+  *
+  *     ps5ui.dll
+  *     pscript.hlp
+  *     pscript.ntf
+  *     pscript5.dll
+  */
+
+  have_drivers = 0;
+  language     = cupsLangDefault();
+
+  snprintf(file, sizeof(file), "%s/drivers/pscript5.dll", cg->cups_datadir);
+  if (!access(file, 0))
+  {
+    have_drivers |= 1;
+
+   /*
+    * Windows 2k driver is installed; do the smbclient commands needed
+    * to copy the Win2k drivers over...
+    */
+
+    snprintf(address, sizeof(address), "//%s/print$", samba_server);
+
+    snprintf(subcmd, sizeof(subcmd),
+             "mkdir W32X86;"
+            "put %s W32X86/%s.ppd;"
+            "put %s/drivers/ps5ui.dll W32X86/ps5ui.dll;"
+            "put %s/drivers/pscript.hlp W32X86/pscript.hlp;"
+            "put %s/drivers/pscript.ntf W32X86/pscript.ntf;"
+            "put %s/drivers/pscript5.dll W32X86/pscript5.dll",
+            ppd, dest, cg->cups_datadir, cg->cups_datadir,
+            cg->cups_datadir, cg->cups_datadir);
+
+    if ((status = do_samba_command("smbclient", address, subcmd,
+                                   authfile, logfile)) != 0)
+    {
+      snprintf(message, sizeof(message),
+               _cupsLangString(language,
+                              _("Unable to copy Windows 2000 printer "
+                                "driver files (%d)!")), status);
+
+      _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+      if (logfile)
+       _cupsLangPrintf(logfile, "%s\n", message);
+
+      unlink(authfile);
+
+      return (0);
+    }
+
+   /*
+    * See if we also have the CUPS driver files; if so, use them!
+    */
+
+    snprintf(file, sizeof(file), "%s/drivers/cupsps6.dll", cg->cups_datadir);
+    if (!access(file, 0))
+    {
+     /*
+      * Copy the CUPS driver files over...
+      */
+
+      snprintf(subcmd, sizeof(subcmd),
+               "put %s/drivers/cups6.ini W32X86/cups6.ini;"
+               "put %s/drivers/cupsps6.dll W32X86/cupsps6.dll;"
+              "put %s/drivers/cupsui6.dll W32X86/cupsui6.dll",
+              cg->cups_datadir, cg->cups_datadir, cg->cups_datadir);
+
+      if ((status = do_samba_command("smbclient", address, subcmd,
+                                     authfile, logfile)) != 0)
+      {
+       snprintf(message, sizeof(message),
+                _cupsLangString(language,
+                                _("Unable to copy CUPS printer driver "
+                                  "files (%d)!")), status);
+
+       _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+       if (logfile)
+         _cupsLangPrintf(logfile, "%s\n", message);
+
+        unlink(authfile);
+
+       return (0);
+      }
+      
+     /*
+      * Do the rpcclient command needed for the CUPS drivers...
+      */
+
+      snprintf(subcmd, sizeof(subcmd),
+               "adddriver \"Windows NT x86\" \"%s:"
+              "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
+              "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,"
+              "cups6.ini,cupsps6.dll,cupsui6.dll\"",
+              dest, dest, dest);
+    }
+    else
+    {
+     /*
+      * Don't have the CUPS drivers, so just use the standard Windows
+      * drivers...
+      */
+
+      snprintf(subcmd, sizeof(subcmd),
+               "adddriver \"Windows NT x86\" \"%s:"
+              "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
+              "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf\"",
+              dest, dest, dest);
+    }
+
+    if ((status = do_samba_command("rpcclient", samba_server, subcmd,
+                                   authfile, logfile)) != 0)
+    {
+      snprintf(message, sizeof(message),
+               _cupsLangString(language,
+                              _("Unable to install Windows 2000 printer "
+                                "driver files (%d)!")), status);
+
+      _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+      if (logfile)
+       _cupsLangPrintf(logfile, "%s\n", message);
+
+      unlink(authfile);
+
+      return (0);
+    }
+  }
+
+  snprintf(file, sizeof(file), "%s/drivers/ADOBEPS4.DRV", cg->cups_datadir);
+  if (!access(file, 0))
+  {
+    have_drivers |= 2;
+
+   /*
+    * Do the smbclient commands needed for the Adobe Win9x drivers...
+    */
+
+    snprintf(address, sizeof(address), "//%s/print$", samba_server);
+
+    snprintf(subcmd, sizeof(subcmd),
+             "mkdir WIN40;"
+            "put %s WIN40/%s.PPD;"
+            "put %s/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;"
+            "put %s/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;"
+            "put %s/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;"
+            "put %s/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;"
+            "put %s/drivers/PSMON.DLL WIN40/PSMON.DLL;",
+            ppd, dest, cg->cups_datadir, cg->cups_datadir,
+            cg->cups_datadir, cg->cups_datadir, cg->cups_datadir);
+
+    if ((status = do_samba_command("smbclient", address, subcmd,
+                                   authfile, logfile)) != 0)
+    {
+      snprintf(message, sizeof(message),
+               _cupsLangString(language,
+                              _("Unable to copy Windows 9x printer "
+                                "driver files (%d)!")), status);
+
+      _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+      if (logfile)
+       _cupsLangPrintf(logfile, "%s\n", message);
+
+      unlink(authfile);
+
+      return (0);
+    }
+
+   /*
+    * Do the rpcclient commands needed for the Adobe Win9x drivers...
+    */
+
+    snprintf(subcmd, sizeof(subcmd),
+            "adddriver \"Windows 4.0\" \"%s:ADOBEPS4.DRV:%s.PPD:NULL:"
+            "ADOBEPS4.HLP:PSMON.DLL:RAW:"
+            "ADOBEPS4.DRV,%s.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,"
+            "ICONLIB.DLL\"",
+            dest, dest, dest);
+
+    if ((status = do_samba_command("rpcclient", samba_server, subcmd,
+                                   authfile, logfile)) != 0)
+    {
+      snprintf(message, sizeof(message),
+               _cupsLangString(language,
+                              _("Unable to install Windows 9x printer "
+                                "driver files (%d)!")), status);
+
+      _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+      if (logfile)
+       _cupsLangPrintf(logfile, "%s\n", message);
+
+      unlink(authfile);
+
+      return (0);
+    }
+  }
+
+  if (logfile && !(have_drivers & 1))
+  {
+    if (!have_drivers)
+      strlcpy(message,
+              _cupsLangString(language,
+                             _("No Windows printer drivers are installed!")),
+              sizeof(message));
+    else
+      strlcpy(message,
+              _cupsLangString(language,
+                             _("Warning, no Windows 2000 printer drivers "
+                               "are installed!")),
+              sizeof(message));
+
+    _cupsSetError(IPP_INTERNAL_ERROR, message);
+    _cupsLangPrintf(logfile, "%s\n", message);
+  }
+
+  if (have_drivers == 0)
+    return (0);
+
+ /*
+  * Finally, associate the drivers we just added with the queue...
+  */
+
+  snprintf(subcmd, sizeof(subcmd), "setdriver %s %s", dest, dest);
+
+  if ((status = do_samba_command("rpcclient", samba_server, subcmd,
+                                 authfile, logfile)) != 0)
+  {
+    snprintf(message, sizeof(message),
+             _cupsLangString(language,
+                            _("Unable to set Windows printer driver (%d)!\n")),
+                            status);
+
+    _cupsSetError(IPP_INTERNAL_ERROR, message);
+
+    if (logfile)
+      _cupsLangPrintf(logfile, "%s\n", message);
+
+    unlink(authfile);
+
+    return (0);
+  }
+
+  unlink(authfile);
+
+  return (1);
+}
+
+
+/*
+ * '_cupsAdminGetServerSettings()' - Get settings from the server.
+ *
+ * The returned settings should be freed with cupsFreeOptions() when
+ * you are done with them.
+ *
+ * @since CUPS 1.2@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+_cupsAdminGetServerSettings(
+    http_t        *http,               /* I - Connection to server */
+    int           *num_settings,       /* O - Number of settings */
+    cups_option_t **settings)          /* O - Settings */
+{
+  int          i;                      /* Looping var */
+  cups_file_t  *cupsd;                 /* cupsd.conf file */
+  char         cupsdconf[1024];        /* cupsd.conf filename */
+  int          remote;                 /* Remote cupsd.conf file? */
+  http_status_t        status;                 /* Status of getting cupsd.conf */
+  char         line[1024],             /* Line from cupsd.conf file */
+               *value;                 /* Value on line */
+  cups_option_t        *setting;               /* Current setting */
+  _cups_globals_t *cg = _cupsGlobals();        /* Global data */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !num_settings || !settings)
+  {
+    _cupsSetError(IPP_INTERNAL_ERROR, NULL);
+
+    if (num_settings)
+      *num_settings = 0;
+
+    if (settings)
+      *settings = NULL;
+
+    return (0);
+  }
+
+  *num_settings = 0;
+  *settings     = NULL;
+
+ /*
+  * Get the cupsd.conf file...
+  */
+
+  if ((status = get_cupsd_conf(http, cg, cg->cupsd_update, cupsdconf,
+                               sizeof(cupsdconf), &remote)) == HTTP_OK)
+  {
+    if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
+      _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+  }
+  else
+    cupsd = NULL;
+
+  if (cupsd)
+  {
+   /*
+    * Read the file, keeping track of what settings are enabled...
+    */
+
+    int                remote_access = 0,      /* Remote access allowed? */
+               remote_admin = 0,       /* Remote administration allowed? */
+               browsing = 1,           /* Browsing enabled? */
+               browse_allow = 1,       /* Browse address set? */
+               browse_address = 0,     /* Browse address set? */
+               cancel_policy = 1,      /* Cancel-job policy set? */
+               debug_logging = 0;      /* LogLevel debug set? */
+    int                linenum = 0,            /* Line number in file */
+               in_location = 0,        /* In a location section? */
+               in_policy = 0,          /* In a policy section? */
+               in_cancel_job = 0,      /* In a cancel-job section? */
+               in_admin_location = 0;  /* In the /admin location? */
+
+
+    invalidate_cupsd_cache(cg);
+
+    cg->cupsd_update = time(NULL);
+    httpGetHostname(http, cg->cupsd_hostname, sizeof(cg->cupsd_hostname));
+
+    while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
+    {
+      if (!value)
+        continue;
+
+      if (!strcasecmp(line, "Port"))
+      {
+       remote_access = 1;
+      }
+      else if (!strcasecmp(line, "Listen"))
+      {
+       char    *port;                  /* Pointer to port number, if any */
+
+
+       if ((port = strrchr(value, ':')) != NULL)
+         *port = '\0';
+
+       if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1"))
+         remote_access = 1;
+      }
+      else if (!strcasecmp(line, "Browsing"))
+      {
+       browsing = !strcasecmp(value, "yes") || !strcasecmp(value, "on") ||
+                  !strcasecmp(value, "true");
+      }
+      else if (!strcasecmp(line, "BrowseAddress"))
+      {
+       browse_address = 1;
+      }
+      else if (!strcasecmp(line, "BrowseAllow"))
+      {
+       browse_allow = 1;
+      }
+      else if (!strcasecmp(line, "BrowseOrder"))
+      {
+       browse_allow = !strncasecmp(value, "deny,", 5);
+      }
+      else if (!strcasecmp(line, "LogLevel"))
+      {
+       debug_logging = !strncasecmp(value, "debug", 5);
+      }
+      else if (!strcasecmp(line, "<Policy") && !strcasecmp(value, "default"))
+      {
+       in_policy = 1;
+      }
+      else if (!strcasecmp(line, "</Policy>"))
+      {
+       in_policy = 0;
+      }
+      else if (!strcasecmp(line, "<Limit") && in_policy)
+      {
+       /*
+       * See if the policy limit is for the Cancel-Job operation...
+       */
+
+       char    *valptr;                /* Pointer into value */
+
+
+       while (*value)
+       {
+         for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+
+         if (*valptr)
+           *valptr++ = '\0';
+
+          if (!strcasecmp(value, "cancel-job") || !strcasecmp(value, "all"))
+         {
+           in_cancel_job = 1;
+           break;
+         }
+
+          for (value = valptr; isspace(*value & 255); value ++);
+       }
+      }
+      else if (!strcasecmp(line, "</Limit>"))
+      {
+       in_cancel_job = 0;
+      }
+      else if (!strcasecmp(line, "Require") && in_cancel_job)
+      {
+       cancel_policy = 0;
+      }
+      else if (!strcasecmp(line, "<Location"))
+      {
+        in_admin_location = !strcasecmp(value, "/admin");
+       in_location       = 1;
+      }
+      else if (!strcasecmp(line, "</Location>"))
+      {
+       in_admin_location = 0;
+       in_location       = 0;
+      }
+      else if (!strcasecmp(line, "Allow") && in_admin_location &&
+               strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1"))
+      {
+       remote_admin = 1;
+      }
+      else if (line[0] != '<' && !in_location && !in_policy)
+        cg->cupsd_num_settings = cupsAddOption(line, value,
+                                              cg->cupsd_num_settings,
+                                              &(cg->cupsd_settings));
+    }
+
+    cupsFileClose(cupsd);
+
+    cg->cupsd_num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
+                                           debug_logging ? "1" : "0",
+                                          cg->cupsd_num_settings,
+                                          &(cg->cupsd_settings));
+
+    cg->cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
+                                           (remote_access && remote_admin) ?
+                                              "1" : "0",
+                                          cg->cupsd_num_settings,
+                                          &(cg->cupsd_settings));
+
+    cg->cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
+                                           (browsing && browse_allow) ?
+                                              "1" : "0",
+                                          cg->cupsd_num_settings,
+                                          &(cg->cupsd_settings));
+
+    cg->cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
+                                           (remote_access && browsing &&
+                                           browse_address) ? "1" : "0",
+                                          cg->cupsd_num_settings,
+                                          &(cg->cupsd_settings));
+
+    cg->cupsd_num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
+                                           cancel_policy ? "1" : "0",
+                                          cg->cupsd_num_settings,
+                                          &(cg->cupsd_settings));
+  }
+  else if (status != HTTP_NOT_MODIFIED)
+    invalidate_cupsd_cache(cg);
+
+ /*
+  * Remove any temporary files and copy the settings array...
+  */
+
+  if (remote)
+    unlink(cupsdconf);
+
+  for (i = cg->cupsd_num_settings, setting = cg->cupsd_settings;
+       i > 0;
+       i --, setting ++)
+    *num_settings = cupsAddOption(setting->name, setting->value,
+                                  *num_settings, settings);
+
+  return (cg->cupsd_num_settings > 0);
+}
+
+
+/*
+ * '_cupsAdminSetServerSettings()' - Set settings on the server.
+ *
+ * @since CUPS 1.2@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+_cupsAdminSetServerSettings(
+    http_t        *http,               /* I - Connection to server */
+    int           num_settings,                /* I - Number of settings */
+    cups_option_t *settings)           /* I - Settings */
+{
+  int          i;                      /* Looping var */
+  http_status_t status;                        /* GET/PUT status */
+  cups_file_t  *cupsd;                 /* cupsd.conf file */
+  char         cupsdconf[1024];        /* cupsd.conf filename */
+  int          remote;                 /* Remote cupsd.conf file? */
+  char         tempfile[1024];         /* Temporary new cupsd.conf */
+  cups_file_t  *temp;                  /* Temporary file */
+  char         line[1024],             /* Line from cupsd.conf file */
+               *value;                 /* Value on line */
+  int          linenum,                /* Line number in file */
+               in_location,            /* In a location section? */
+               in_policy,              /* In a policy section? */
+               in_default_policy,      /* In the default policy section? */
+               in_cancel_job,          /* In a cancel-job section? */
+               in_admin_location,      /* In the /admin location? */
+               in_conf_location,       /* In the /admin/conf location? */
+               in_root_location;       /* In the / location? */
+  const char   *val;                   /* Setting value */
+  int          remote_printers,        /* Show remote printers */
+               share_printers,         /* Share local printers */
+               remote_admin,           /* Remote administration allowed? */
+               user_cancel_any,        /* Cancel-job policy set? */
+               debug_logging;          /* LogLevel debug set? */
+  int          wrote_port_listen,      /* Wrote the port/listen lines? */
+               wrote_browsing,         /* Wrote the browsing lines? */
+               wrote_policy,           /* Wrote the policy? */
+               wrote_loglevel,         /* Wrote the LogLevel line? */
+               wrote_admin_location,   /* Wrote the /admin location? */
+               wrote_conf_location,    /* Wrote the /admin/conf location? */
+               wrote_root_location;    /* Wrote the / location? */
+  int          indent;                 /* Indentation */
+  int          cupsd_num_settings;     /* New number of settings */
+  cups_option_t        *cupsd_settings,        /* New settings */
+               *setting;               /* Current setting */
+  _cups_globals_t *cg = _cupsGlobals();        /* Global data */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !num_settings || !settings)
+  {
+    _cupsSetError(IPP_INTERNAL_ERROR, NULL);
+
+    return (0);
+  }
+
+ /*
+  * Get the cupsd.conf file...
+  */
+
+  if ((status = get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
+                               &remote)) == HTTP_OK)
+  {
+    if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
+    {
+      _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+      return (0);
+    }
+  }
+  else
+    return (0);
+
+ /*
+  * Get basic settings...
+  */
+
+  if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
+                           settings)) != NULL)
+    debug_logging = atoi(val);
+  else
+    debug_logging = 0;
+
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
+                           settings)) != NULL)
+    remote_admin = atoi(val);
+  else
+    remote_admin = 0;
+
+  if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
+                           settings)) != NULL)
+    remote_printers = atoi(val);
+  else
+    remote_printers = 1;
+
+  if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
+                           settings)) != NULL)
+    share_printers = atoi(val);
+  else
+    share_printers = 0;
+
+  if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
+                           settings)) != NULL)
+    user_cancel_any = atoi(val);
+  else
+    user_cancel_any = 0;
+
+ /*
+  * Create a temporary file for the new cupsd.conf file...
+  */
+
+  if ((temp = cupsTempFile2(tempfile, sizeof(tempfile))) == NULL)
+  {
+    cupsFileClose(cupsd);
+
+    if (remote)
+      unlink(cupsdconf);
+
+    _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+    return (0);
+  }
+
+ /*
+  * Copy the old file to the new, making changes along the way...
+  */
+
+  cupsd_num_settings   = 0;
+  in_admin_location    = 0;
+  in_cancel_job        = 0;
+  in_conf_location     = 0;
+  in_default_policy    = 0;
+  in_location          = 0;
+  in_policy            = 0;
+  in_root_location     = 0;
+  linenum              = 0;
+  wrote_admin_location = 0;
+  wrote_browsing       = 0;
+  wrote_conf_location  = 0;
+  wrote_loglevel       = 0;
+  wrote_policy         = 0;
+  wrote_port_listen    = 0;
+  wrote_root_location  = 0;
+  indent               = 0;
+
+  while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
+  {
+    if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
+    {
+      if (!wrote_port_listen)
+      {
+        wrote_port_listen = 1;
+
+       if (share_printers || remote_admin)
+       {
+         cupsFilePuts(temp, "# Allow remote access\n");
+         cupsFilePrintf(temp, "Port %d\n", ippPort());
+       }
+       else
+       {
+         cupsFilePuts(temp, "# Only listen for connections from the local machine.\n");
+         cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
+       }
+
+#ifdef CUPS_DEFAULT_DOMAINSOCKET
+        if (!access(CUPS_DEFAULT_DOMAINSOCKET, 0))
+          cupsFilePuts(temp, "Listen " CUPS_DEFAULT_DOMAINSOCKET "\n");
+#endif /* CUPS_DEFAULT_DOMAINSOCKET */
+      }
+    }
+    else if (!strcasecmp(line, "Browsing") ||
+             !strcasecmp(line, "BrowseAddress") ||
+             !strcasecmp(line, "BrowseAllow") ||
+             !strcasecmp(line, "BrowseDeny") ||
+             !strcasecmp(line, "BrowseOrder"))
+    {
+      if (!wrote_browsing)
+      {
+        wrote_browsing = 1;
+
+        if (remote_printers || share_printers)
+       {
+         if (remote_printers && share_printers)
+           cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n");
+         else if (remote_printers)
+           cupsFilePuts(temp, "# Show shared printers on the local network.\n");
+         else
+           cupsFilePuts(temp, "# Share local printers on the local network.\n");
+
+         cupsFilePuts(temp, "Browsing On\n");
+         cupsFilePuts(temp, "BrowseOrder allow,deny\n");
+
+         if (remote_printers)
+           cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
+
+         if (share_printers)
+           cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
+        }
+       else
+       {
+         cupsFilePuts(temp, "# Disable printer sharing and shared printers.\n");
+         cupsFilePuts(temp, "Browsing Off\n");
+       }
+      }
+    }
+    else if (!strcasecmp(line, "LogLevel"))
+    {
+      wrote_loglevel = 1;
+
+      if (debug_logging)
+      {
+        cupsFilePuts(temp, "# Show troubleshooting information in error_log.\n");
+       cupsFilePuts(temp, "LogLevel debug\n");
+      }
+      else
+      {
+        cupsFilePuts(temp, "# Show general information in error_log.\n");
+       cupsFilePuts(temp, "LogLevel info\n");
+      }
+    }
+    else if (!strcasecmp(line, "<Policy"))
+    {
+      in_default_policy = !strcasecmp(value, "default");
+      in_policy         = 1;
+
+      cupsFilePrintf(temp, "%s %s>\n", line, value);
+      indent += 2;
+    }
+    else if (!strcasecmp(line, "</Policy>"))
+    {
+      indent -= 2;
+      if (!wrote_policy && in_default_policy)
+      {
+       wrote_policy = 1;
+
+        if (!user_cancel_any)
+         cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
+                            "  <Limit Cancel-Job>\n"
+                            "    Order deny,allow\n"
+                            "    Allow @SYSTEM\n"
+                            "    Allow @OWNER\n"
+                            "  </Limit>\n");
+      }
+
+      in_policy         = 0;
+      in_default_policy = 0;
+
+      cupsFilePuts(temp, "</Policy>\n");
+    }
+    else if (!strcasecmp(line, "<Location"))
+    {
+      in_location = 1;
+      indent += 2;
+      if (!strcmp(value, "/admin"))
+       in_admin_location = 1;
+      if (!strcmp(value, "/admin/conf"))
+       in_conf_location = 1;
+      else if (!strcmp(value, "/"))
+       in_root_location = 1;
+
+      cupsFilePrintf(temp, "%s %s>\n", line, value);
+    }
+    else if (!strcasecmp(line, "</Location>"))
+    {
+      in_location = 0;
+      indent -= 2;
+      if (in_admin_location)
+      {
+       wrote_admin_location = 1;
+
+       if (remote_admin)
+          cupsFilePuts(temp, "  # Allow remote administration...\n");
+       else
+          cupsFilePuts(temp, "  # Restrict access to the admin pages...\n");
+
+        cupsFilePuts(temp, "  Order allow,deny\n");
+
+       if (remote_admin)
+         cupsFilePuts(temp, "  Allow @LOCAL\n");
+       else
+         cupsFilePuts(temp, "  Allow localhost\n");
+      }
+      else if (in_conf_location)
+      {
+       wrote_conf_location = 1;
+
+       if (remote_admin)
+          cupsFilePuts(temp, "  # Allow remote access to the configuration files...\n");
+       else
+          cupsFilePuts(temp, "  # Restrict access to the configuration files...\n");
+
+        cupsFilePuts(temp, "  Order allow,deny\n");
+
+       if (remote_admin)
+         cupsFilePuts(temp, "  Allow @LOCAL\n");
+       else
+         cupsFilePuts(temp, "  Allow localhost\n");
+      }
+      else if (in_root_location)
+      {
+       wrote_root_location = 1;
+
+       if (remote_admin && share_printers)
+          cupsFilePuts(temp, "  # Allow shared printing and remote administration...\n");
+       else if (remote_admin)
+          cupsFilePuts(temp, "  # Allow remote administration...\n");
+       else if (share_printers)
+          cupsFilePuts(temp, "  # Allow shared printing...\n");
+       else
+          cupsFilePuts(temp, "  # Restrict access to the server...\n");
+
+        cupsFilePuts(temp, "  Order allow,deny\n");
+
+       if (remote_admin || share_printers)
+         cupsFilePuts(temp, "  Allow @LOCAL\n");
+       else
+         cupsFilePuts(temp, "  Allow localhost\n");
+      }
+
+      in_admin_location = 0;
+      in_conf_location  = 0;
+      in_root_location  = 0;
+
+      cupsFilePuts(temp, "</Location>\n");
+    }
+    else if (!strcasecmp(line, "<Limit") && in_default_policy)
+    {
+     /*
+      * See if the policy limit is for the Cancel-Job operation...
+      */
+
+      char     *valptr;                /* Pointer into value */
+
+
+      indent += 2;
+
+      if (!strcasecmp(value, "cancel-job"))
+      {
+       /*
+       * Don't write anything for this limit section...
+       */
+
+       in_cancel_job = 2;
+      }
+      else
+      {
+       cupsFilePrintf(temp, "  %s", line);
+
+       while (*value)
+       {
+         for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+
+         if (*valptr)
+           *valptr++ = '\0';
+
+          if (!strcasecmp(value, "cancel-job"))
+         {
+          /*
+           * Write everything except for this definition...
+           */
+
+           in_cancel_job = 1;
+         }
+         else
+           cupsFilePrintf(temp, " %s", value);
+
+          for (value = valptr; isspace(*value & 255); value ++);
+       }
+
+       cupsFilePuts(temp, ">\n");
+      }
+    }
+    else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
+    {
+      indent -= 2;
+
+      if (in_cancel_job == 1)
+        cupsFilePuts(temp, "  </Limit>\n");
+
+      wrote_policy = 1;
+
+      if (!user_cancel_any)
+       cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
+                          "  <Limit Cancel-Job>\n"
+                          "    Order deny,allow\n"
+                          "    Require user @OWNER @SYSTEM\n"
+                          "  </Limit>\n");
+
+      in_cancel_job = 0;
+    }
+    else if ((in_admin_location || in_conf_location || in_root_location) &&
+             (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
+             !strcasecmp(line, "Order")))
+      continue;
+    else if (in_cancel_job == 2)
+      continue;
+    else if (!strcasecmp(line, "<Limit")  && value)
+      cupsFilePrintf(temp, "  %s %s>\n", line, value);
+    else if (line[0] == '<')
+    {
+      if (value)
+      {
+        cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
+       indent += 2;
+      }
+      else
+      {
+       if (line[1] == '/')
+         indent -= 2;
+
+       cupsFilePrintf(temp, "%*s%s\n", indent, "", line);
+      }
+    }
+    else if (!in_policy && !in_location &&
+             (val = cupsGetOption(line, num_settings, settings)) != NULL &&
+             !cupsGetOption(line, cupsd_num_settings, cupsd_settings))
+    {
+     /*
+      * Add this directive to the list of directives we have written...
+      */
+
+      cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
+                                         &cupsd_settings);
+
+     /*
+      * Write the new value in its place, without indentation since we
+      * only support setting root directives, not in sections...
+      */
+
+      cupsFilePrintf(temp, "%s %s\n", line, value);
+    }
+    else if (value)
+    {
+      if (!in_policy && !in_location)
+      {
+       /*
+        * Record the non-policy, non-location directives that we find
+       * in the server settings, since we cache this info and record it
+       * in _cupsAdminGetServerSettings()...
+       */
+
+       cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
+                                           &cupsd_settings);
+      }
+
+      cupsFilePrintf(temp, "%*s%s %s\n", indent, "", line, value);
+    }
+    else
+      cupsFilePrintf(temp, "%*s%s\n", indent, "", line);
+  }
+
+ /*
+  * Write any missing info...
+  */
+
+  if (!wrote_browsing)
+  {
+    if (remote_printers || share_printers)
+    {
+      if (remote_printers && share_printers)
+       cupsFilePuts(temp, "# Enable printer sharing and shared printers.\n");
+      else if (remote_printers)
+       cupsFilePuts(temp, "# Show shared printers on the local network.\n");
+      else
+       cupsFilePuts(temp, "# Share local printers on the local network.\n");
+
+      cupsFilePuts(temp, "Browsing On\n");
+      cupsFilePuts(temp, "BrowseOrder allow,deny\n");
+
+      if (remote_printers)
+       cupsFilePuts(temp, "BrowseAllow @LOCAL\n");
+
+      if (share_printers)
+       cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
+    }
+    else
+    {
+      cupsFilePuts(temp, "# Disable printer sharing and shared printers.\n");
+      cupsFilePuts(temp, "Browsing Off\n");
+    }
+  }
+
+  if (!wrote_loglevel)
+  {
+    if (debug_logging)
+    {
+      cupsFilePuts(temp, "# Show troubleshooting information in error_log.\n");
+      cupsFilePuts(temp, "LogLevel debug\n");
+    }
+    else
+    {
+      cupsFilePuts(temp, "# Show general information in error_log.\n");
+      cupsFilePuts(temp, "LogLevel info\n");
+    }
+  }
+
+  if (!wrote_port_listen)
+  {
+    if (share_printers || remote_admin)
+    {
+      cupsFilePuts(temp, "# Allow remote access\n");
+      cupsFilePrintf(temp, "Port %d\n", ippPort());
+    }
+    else
+    {
+      cupsFilePuts(temp, "# Only listen for connections from the local machine.\n");
+      cupsFilePrintf(temp, "Listen 127.0.0.1:%d\n", ippPort());
+    }
+
+#ifdef CUPS_DEFAULT_DOMAINSOCKET
+    if (!access(CUPS_DEFAULT_DOMAINSOCKET, 0))
+      cupsFilePuts(temp, "Listen " CUPS_DEFAULT_DOMAINSOCKET "\n");
+#endif /* CUPS_DEFAULT_DOMAINSOCKET */
+  }
+
+  if (!wrote_root_location)
+  {
+    if (remote_admin && share_printers)
+      cupsFilePuts(temp, "# Allow shared printing and remote administration...\n");
+    else if (remote_admin)
+      cupsFilePuts(temp, "# Allow remote administration...\n");
+    else if (share_printers)
+      cupsFilePuts(temp, "# Allow shared printing...\n");
+    else
+      cupsFilePuts(temp, "# Restrict access to the server...\n");
+
+    cupsFilePuts(temp, "<Location />\n"
+                       "  Order allow,deny\n");
+
+    if (remote_admin || share_printers)
+      cupsFilePuts(temp, "  Allow @LOCAL\n");
+    else
+      cupsFilePuts(temp, "  Allow localhost\n");
+
+    cupsFilePuts(temp, "</Location>\n");
+  }
+
+  if (!wrote_admin_location)
+  {
+    if (remote_admin)
+      cupsFilePuts(temp, "# Allow remote administration...\n");
+    else
+      cupsFilePuts(temp, "# Restrict access to the admin pages...\n");
+
+    cupsFilePuts(temp, "<Location /admin>\n"
+                       "  Order allow,deny\n");
+
+    if (remote_admin)
+      cupsFilePuts(temp, "  Allow @LOCAL\n");
+    else
+      cupsFilePuts(temp, "  Allow localhost\n");
+
+    cupsFilePuts(temp, "</Location>\n");
+  }
+
+  if (!wrote_conf_location)
+  {
+    if (remote_admin)
+      cupsFilePuts(temp, "# Allow remote access to the configuration files...\n");
+    else
+      cupsFilePuts(temp, "# Restrict access to the configuration files...\n");
+
+    cupsFilePuts(temp, "<Location /admin/conf>\n"
+                       "  AuthType Basic\n"
+                       "  Require user @SYSTEM\n"
+                       "  Order allow,deny\n");
+
+    if (remote_admin)
+      cupsFilePuts(temp, "  Allow @LOCAL\n");
+    else
+      cupsFilePuts(temp, "  Allow localhost\n");
+
+    cupsFilePuts(temp, "</Location>\n");
+  }
+
+  if (!wrote_policy)
+  {
+    cupsFilePuts(temp, "<Policy default>\n"
+                       "  # Job-related operations must be done by the owner or an adminstrator...\n"
+                       "  <Limit Send-Document Send-URI Hold-Job Release-Job "
+                      "Restart-Job Purge-Jobs Set-Job-Attributes "
+                      "Create-Job-Subscription Renew-Subscription "
+                      "Cancel-Subscription Get-Notifications Reprocess-Job "
+                      "Cancel-Current-Job Suspend-Current-Job Resume-Job "
+                      "CUPS-Move-Job>\n"
+                       "    Require user @OWNER @SYSTEM\n"
+                       "    Order deny,allow\n"
+                       "  </Limit>\n"
+                       "  # All administration operations require an adminstrator to authenticate...\n"
+                      "  <Limit Pause-Printer Resume-Printer "
+                       "Set-Printer-Attributes Enable-Printer "
+                      "Disable-Printer Pause-Printer-After-Current-Job "
+                      "Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer "
+                      "Activate-Printer Restart-Printer Shutdown-Printer "
+                      "Startup-Printer Promote-Job Schedule-Job-After "
+                      "CUPS-Add-Printer CUPS-Delete-Printer "
+                      "CUPS-Add-Class CUPS-Delete-Class "
+                      "CUPS-Accept-Jobs CUPS-Reject-Jobs "
+                      "CUPS-Set-Default CUPS-Add-Device CUPS-Delete-Device>\n"
+                       "    AuthType Basic\n"
+                      "    Require user @SYSTEM\n"
+                       "    Order deny,allow\n"
+                       "</Limit>\n");
+
+    if (!user_cancel_any)
+      cupsFilePuts(temp, "  # Only the owner or an administrator can cancel a job...\n"
+                        "  <Limit Cancel-Job>\n"
+                        "    Require user @OWNER @SYSTEM\n"
+                        "    Order deny,allow\n"
+                        "  </Limit>\n");
+
+    cupsFilePuts(temp, "  <Limit All>\n"
+                       "  Order deny,allow\n"
+                       "  </Limit>\n"
+                      "</Policy>\n");
+  }
+
+  for (i = num_settings, setting = settings; i > 0; i --, setting ++)
+    if (setting->name[0] != '_' &&
+        !cupsGetOption(setting->name, cupsd_num_settings, cupsd_settings))
+    {
+     /*
+      * Add this directive to the list of directives we have written...
+      */
+
+      cupsd_num_settings = cupsAddOption(setting->name, setting->value,
+                                         cupsd_num_settings, &cupsd_settings);
+
+     /*
+      * Write the new value in its place, without indentation since we
+      * only support setting root directives, not in sections...
+      */
+
+      cupsFilePrintf(temp, "%s %s\n", setting->name, setting->value);
+    }
+
+  cupsFileClose(cupsd);
+  cupsFileClose(temp);
+
+ /*
+  * Upload the configuration file to the server...
+  */
+
+  status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
+
+  if (status == HTTP_CREATED)
+  {
+   /*
+    * Updated OK, add the basic settings...
+    */
+
+    cupsd_num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING,
+                                       debug_logging ? "1" : "0",
+                                      cupsd_num_settings, &cupsd_settings);
+    cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ADMIN,
+                                       remote_admin ? "1" : "0",
+                                      cupsd_num_settings, &cupsd_settings);
+    cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_PRINTERS,
+                                       remote_printers ? "1" : "0",
+                                      cupsd_num_settings, &cupsd_settings);
+    cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
+                                       share_printers ? "1" : "0",
+                                      cupsd_num_settings, &cupsd_settings);
+    cupsd_num_settings = cupsAddOption(CUPS_SERVER_USER_CANCEL_ANY,
+                                       user_cancel_any ? "1" : "0",
+                                      cupsd_num_settings, &cupsd_settings);
+
+   /*
+    * Save the new values...
+    */
+
+    invalidate_cupsd_cache(cg);
+
+    cg->cupsd_num_settings = cupsd_num_settings;
+    cg->cupsd_settings     = cupsd_settings;
+    cg->cupsd_update       = time(NULL);
+
+    httpGetHostname(http, cg->cupsd_hostname, sizeof(cg->cupsd_hostname));
+  }
+  else
+    cupsFreeOptions(cupsd_num_settings, cupsd_settings);
+
+ /*
+  * Remote our temp files and return...
+  */
+
+  if (remote)
+    unlink(cupsdconf);
+
+  unlink(tempfile);
+
+  return (status == HTTP_CREATED);
+}
+
+
+/*
+ * 'do_samba_command()' - Do a SAMBA command.
+ */
+
+static int                             /* O - Status of command */
+do_samba_command(const char *command,  /* I - Command to run */
+                 const char *address,  /* I - Address for command */
+                 const char *subcmd,   /* I - Sub-command */
+                const char *authfile,  /* I - Samba authentication file */
+                FILE *logfile)         /* I - Optional log file */
+{
+  int          status;                 /* Status of command */
+  int          pid;                    /* Process ID of child */
+
+
+  if (logfile)
+    _cupsLangPrintf(logfile,
+                    _("Running command: %s %s -N -A %s -c \'%s\'\n"),
+                   command, address, authfile, subcmd);
+
+  if ((pid = fork()) == 0)
+  {
+   /*
+    * Child goes here, redirect stdin/out/err and execute the command...
+    */
+
+    close(0);
+    open("/dev/null", O_RDONLY);
+
+    close(1);
+
+    if (logfile)
+      dup(fileno(logfile));
+    else
+      open("/dev/null", O_WRONLY);
+
+    close(2);
+    dup(1);
+
+    execlp(command, command, address, "-N", "-A", authfile, "-c", subcmd,
+           (char *)0);
+    exit(errno);
+  }
+  else if (pid < 0)
+  {
+    status = -1;
+
+    _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to run \"%s\": %s\n"),
+                    command, strerror(errno));
+  }
+  else
+  {
+   /*
+    * Wait for the process to complete...
+    */
+
+    while (wait(&status) != pid);
+  }
+
+  if (logfile)
+    _cupsLangPuts(logfile, "\n");
+
+  DEBUG_printf(("status=%d\n", status));
+
+  if (WIFEXITED(status))
+    return (WEXITSTATUS(status));
+  else
+    return (-WTERMSIG(status));
+}
+
+
+/*
+ * 'get_cupsd_conf()' - Get the current cupsd.conf file.
+ */
+
+static http_status_t                   /* O - Status of request */
+get_cupsd_conf(
+    http_t          *http,             /* I - Connection to server */
+    _cups_globals_t *cg,               /* I - Global data */
+    time_t          last_update,       /* I - Last update time for file */
+    char            *name,             /* I - Filename buffer */
+    int             namesize,          /* I - Size of filename buffer */
+    int             *remote)           /* O - Remote file? */
+{
+  int          fd;                     /* Temporary file descriptor */
+  struct stat  info;                   /* cupsd.conf file information */
+  http_status_t        status;                 /* Status of getting cupsd.conf */
+  char         host[HTTP_MAX_HOST];    /* Hostname for connection */
+
+
+ /*
+  * See if we already have the data we need...
+  */
+
+  httpGetHostname(http, host, sizeof(host));
+
+  if (strcasecmp(cg->cupsd_hostname, host))
+    invalidate_cupsd_cache(cg);
+
+  snprintf(name, namesize, "%s/cupsd.conf", cg->cups_serverroot);
+  *remote = 0;
+
+  if (!strcasecmp(host, "localhost") && !access(name, R_OK))
+  {
+   /*
+    * Read the local file rather than using HTTP...
+    */
+
+    if (stat(name, &info))
+    {
+      *name = '\0';
+
+      _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+
+      return (HTTP_SERVER_ERROR);
+    }
+    else if (last_update && info.st_mtime <= last_update)
+      status = HTTP_NOT_MODIFIED;
+    else
+      status = HTTP_OK;
+  }
+  else
+  {
+   /*
+    * Read cupsd.conf via a HTTP GET request...
+    */
+
+    if ((fd = cupsTempFd(name, sizeof(name))) < 0)
+    {
+      *name = '\0';
+
+      _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno));
+
+      invalidate_cupsd_cache(cg);
+
+      return (HTTP_SERVER_ERROR);
+    }
+
+    *remote = 1;
+
+    httpClearFields(http);
+
+    if (last_update)
+      httpSetField(http, HTTP_FIELD_IF_MODIFIED_SINCE,
+                   httpGetDateString(last_update));
+
+    status = cupsGetFd(http, "/admin/conf/cupsd.conf", fd);
+
+    close(fd);
+
+    if (status != HTTP_OK)
+    {
+      unlink(name);
+      *name = '\0';
+    }
+  }
+
+  return (status);
+}
+
+
+/*
+ * 'invalidate_cupsd_cache()' - Invalidate the cached cupsd.conf settings.
+ */
+
+static void
+invalidate_cupsd_cache(
+    _cups_globals_t *cg)               /* I - Global data */
+{
+  cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
+
+  cg->cupsd_hostname[0]  = '\0';
+  cg->cupsd_update       = 0;
+  cg->cupsd_num_settings = 0;
+  cg->cupsd_settings     = NULL;
+}
+
+
+/*
+ * 'write_option()' - Write a CUPS option to a PPD file.
+ */
+
+static void
+write_option(cups_file_t     *dstfp,   /* I - PPD file */
+             int             order,    /* I - Order dependency */
+             const char      *name,    /* I - Option name */
+            const char      *text,     /* I - Option text */
+             const char      *attrname,        /* I - Attribute name */
+             ipp_attribute_t *suppattr,        /* I - IPP -supported attribute */
+            ipp_attribute_t *defattr,  /* I - IPP -default attribute */
+            int             defval,    /* I - Default value number */
+            int             valcount)  /* I - Number of values */
+{
+  int  i;                              /* Looping var */
+
+
+  cupsFilePrintf(dstfp, "*JCLOpenUI *%s/%s: PickOne\n"
+                        "*OrderDependency: %d JCLSetup *%s\n",
+                 name, text, order, name);
+
+  if (defattr->value_tag == IPP_TAG_INTEGER)
+  {
+   /*
+    * Do numeric options with a range or list...
+    */
+
+    cupsFilePrintf(dstfp, "*Default%s: %d\n", name,
+                   defattr->values[defval].integer);
+
+    if (suppattr->value_tag == IPP_TAG_RANGE)
+    {
+     /*
+      * List each number in the range...
+      */
+
+      for (i = suppattr->values[0].range.lower;
+           i <= suppattr->values[0].range.upper;
+          i ++)
+      {
+        cupsFilePrintf(dstfp, "*%s %d: \"", name, i);
+
+        if (valcount == 1)
+         cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%d\n\"\n*End\n",
+                        attrname, i);
+        else if (defval == 0)
+         cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%d\"\n", attrname, i);
+        else if (defval < (valcount - 1))
+         cupsFilePrintf(dstfp, ",%d\"\n", i);
+        else
+         cupsFilePrintf(dstfp, ",%d\n\"\n*End\n", i);
+      }
+    }
+    else
+    {
+     /*
+      * List explicit numbers...
+      */
+
+      for (i = 0; i < suppattr->num_values; i ++)
+      {
+        cupsFilePrintf(dstfp, "*%s %d: \"", name, suppattr->values[i].integer);
+
+        if (valcount == 1)
+         cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%d\n\"\n*End\n", attrname,
+                 suppattr->values[i].integer);
+        else if (defval == 0)
+         cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%d\"\n", attrname,
+                 suppattr->values[i].integer);
+        else if (defval < (valcount - 1))
+         cupsFilePrintf(dstfp, ",%d\"\n", suppattr->values[i].integer);
+        else
+         cupsFilePrintf(dstfp, ",%d\n\"\n*End\n", suppattr->values[i].integer);
+      }
+    }
+  }
+  else
+  {
+   /*
+    * Do text options with a list...
+    */
+
+    cupsFilePrintf(dstfp, "*Default%s: %s\n", name,
+                   defattr->values[defval].string.text);
+
+    for (i = 0; i < suppattr->num_values; i ++)
+    {
+      cupsFilePrintf(dstfp, "*%s %s: \"", name,
+                     suppattr->values[i].string.text);
+
+      if (valcount == 1)
+       cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%s\n\"\n*End\n", attrname,
+               suppattr->values[i].string.text);
+      else if (defval == 0)
+       cupsFilePrintf(dstfp, "%%cupsJobTicket: %s=%s\"\n", attrname,
+               suppattr->values[i].string.text);
+      else if (defval < (valcount - 1))
+       cupsFilePrintf(dstfp, ",%s\"\n", suppattr->values[i].string.text);
+      else
+       cupsFilePrintf(dstfp, ",%s\n\"\n*End\n",
+                      suppattr->values[i].string.text);
+    }
+  }
+
+  cupsFilePrintf(dstfp, "*JCLCloseUI: *%s\n\n", name);
+}
+
+
+/*
+ * End of "$Id: adminutil.c 5240 2006-03-07 21:55:29Z mike $".
+ */
diff --git a/cups/adminutil.h b/cups/adminutil.h
new file mode 100644 (file)
index 0000000..8b66d1b
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * "$Id: adminutil.h 5235 2006-03-06 13:02:23Z mike $"
+ *
+ *   Administration utility API definitions for the Common UNIX Printing
+ *   System (CUPS).
+ *
+ *   MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
+ *   CHANGE AT ANY TIME.  USE AT YOUR OWN RISK.
+ *
+ *   Copyright 2001-2006 by Easy Software Products.
+ *
+ *   These coded instructions, statements, and computer programs are the
+ *   property of Easy Software Products and are protected by Federal
+ *   copyright law.  Distribution and use rights are outlined in the file
+ *   "LICENSE.txt" which should have been included with this file.  If this
+ *   file is missing or damaged please contact Easy Software Products
+ *   at:
+ *
+ *       Attn: CUPS Licensing Information
+ *       Easy Software Products
+ *       44141 Airport View Drive, Suite 204
+ *       Hollywood, Maryland 20636 USA
+ *
+ *       Voice: (301) 373-9600
+ *       EMail: cups-info@cups.org
+ *         WWW: http://www.cups.org
+ *
+ *   This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _CUPS_ADMINUTIL_H_
+#  define _CUPS_ADMINUTIL_H_
+
+/*
+ * Include necessary headers...
+ */
+
+#  include "cups.h"
+
+
+/*
+ * C++ magic...
+ */
+
+#  ifdef __cplusplus
+extern "C" {
+#  endif /* __cplusplus */
+
+
+/*
+ * Constants...
+ */
+
+#  define CUPS_SERVER_DEBUG_LOGGING    "_debug_logging"
+#  define CUPS_SERVER_REMOTE_ADMIN     "_remote_admin"
+#  define CUPS_SERVER_REMOTE_PRINTERS  "_remote_printers"
+#  define CUPS_SERVER_SHARE_PRINTERS   "_share_printers"
+#  define CUPS_SERVER_USER_CANCEL_ANY  "_user_cancel_any"
+
+
+/*
+ * Functions...
+ */
+
+extern int     cupsAdminExportSamba(const char *dest, const char *ppd,
+                                    const char *samba_server,
+                                    const char *samba_user,
+                                    const char *samba_password,
+                                    FILE *logfile);
+extern char    *cupsAdminCreateWindowsPPD(http_t *http, const char *dest,
+                                          char *buffer, int bufsize);
+
+extern int     _cupsAdminGetServerSettings(http_t *http,
+                                           int *num_settings,
+                                           cups_option_t **settings);
+extern int     _cupsAdminSetServerSettings(http_t *http,
+                                           int num_settings,
+                                           cups_option_t *settings);
+
+
+#  ifdef __cplusplus
+}
+#  endif /* __cplusplus */
+
+#endif /* !_CUPS_ADMINUTIL_H_ */
+
+/*
+ * End of "$Id: adminutil.h 5235 2006-03-06 13:02:23Z mike $".
+ */
index 17db3d1d0c1cc24ed69ee6a85fac333ebf898c22..64b389a08f6c2ee0729bdc3c34c52530cac047c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cups.h 5156 2006-02-23 04:24:32Z mike $"
+ * "$Id: cups.h 5233 2006-03-06 03:39:28Z mike $"
  *
  *   API definitions for the Common UNIX Printing System (CUPS).
  *
@@ -61,10 +61,10 @@ extern "C" {
  * Constants...
  */
 
-#  define CUPS_VERSION         1.0190
+#  define CUPS_VERSION         1.0200
 #  define CUPS_VERSION_MAJOR   1
 #  define CUPS_VERSION_MINOR   2
-#  define CUPS_VERSION_PATCH   -10
+#  define CUPS_VERSION_PATCH   0
 #  define CUPS_DATE_ANY                -1
 
 
@@ -244,5 +244,5 @@ extern cups_file_t  *cupsTempFile2(char *filename, int len);
 #endif /* !_CUPS_CUPS_H_ */
 
 /*
- * End of "$Id: cups.h 5156 2006-02-23 04:24:32Z mike $".
+ * End of "$Id: cups.h 5233 2006-03-06 03:39:28Z mike $".
  */
index f914f14d023a8fd3782e7e68a7c3d6f820a0bdc4..2aeda011484b5fa7b99bdd78a12dcec9364edefb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: emit.c 5086 2006-02-07 02:45:26Z mike $"
+ * "$Id: emit.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   PPD code emission routines for the Common UNIX Printing System (CUPS).
  *
  *   ppdCollect2()       - Collect all marked options that reside in the
  *                         specified section and minimum order.
  *   ppdEmit()           - Emit code for marked options to a file.
- *   ppdEmitAfterOrder() - Emit a subset of the code for marked options to a file.
+ *   ppdEmitAfterOrder() - Emit a subset of the code for marked options to a
+ *                         file.
  *   ppdEmitFd()         - Emit code for marked options to a file.
  *   ppdEmitJCL()        - Emit code for JCL options to a file.
  *   ppdEmitJCLEnd()     - Emit JCLEnd code to a file.
+ *   ppdEmitString()     - Get a string containing the code for marked options.
  *   ppd_handle_media()  - Handle media selection...
  *   ppd_sort()          - Sort options by ordering numbers...
  */
@@ -47,6 +49,7 @@
 #include "ppd.h"
 #include <stdlib.h>
 #include "string.h"
+#include <errno.h>
 
 #if defined(WIN32) || defined(__EMX__)
 #  include <io.h>
@@ -200,268 +203,40 @@ ppdEmitAfterOrder(
     ppd_file_t    *ppd,                        /* I - PPD file record */
     FILE          *fp,                 /* I - File to write to */
     ppd_section_t section,             /* I - Section to write */
-    int                  limit,                /* I - Non-zero to use min_order, 0 to include all */
-    float         min_order)           /* I - Lowest order dependency to include */
+    int                  limit,                /* I - Non-zero to use min_order */
+    float         min_order)           /* I - Lowest OrderDependency */
 {
-  int          i,                      /* Looping var */
-               count;                  /* Number of choices */
-  ppd_choice_t **choices;              /* Choices */
-  ppd_size_t   *size;                  /* Custom page size */
+  char *buffer;                        /* Option code */
+  int  status;                         /* Return status */
 
 
  /*
-  * Use PageSize or PageRegion as required...
+  * Range check input...
   */
 
-  ppd_handle_media(ppd);
+  if (!ppd || !fp)
+    return (-1);
 
  /*
-  * Collect the options we need to emit and emit them!
+  * Get the string...
   */
 
-  if ((count = ppdCollect2(ppd, section, min_order, &choices)) == 0)
-    return (0);
-
-  for (i = 0; i < count; i ++)
-    if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
-    {
-     /*
-      * Send wrapper commands to prevent printer errors for unsupported
-      * options...
-      */
-
-      if (fputs("[{\n", fp) < 0)
-      {
-        free(choices);
-        return (-1);
-      }
-
-     /*
-      * Send DSC comments with option...
-      */
-
-      if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
-           !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
-          !strcasecmp(choices[i]->choice, "Custom"))
-      {
-       /*
-        * Variable size; write out standard size options, using the
-       * parameter positions defined in the PPD file...
-       */
-
-        ppd_attr_t     *attr;          /* PPD attribute */
-       int             pos,            /* Position of custom value */
-                       orientation;    /* Orientation to use */
-       float           values[5];      /* Values for custom command */
-        int            isfloat[5];     /* Whether each value is float or int */
-
-        fputs("%%BeginFeature: *CustomPageSize True\n", fp);
-
-        size = ppdPageSize(ppd, "Custom");
-
-        memset(values, 0, sizeof(values));
-        memset(isfloat, 0, sizeof(isfloat));
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
-       {
-         pos = atoi(attr->value) - 1;
-
-          if (pos < 0 || pos > 4)
-           pos = 0;
-       }
-       else
-         pos = 0;
-
-       values[pos]  = size->width;
-       isfloat[pos] = 1;
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
-       {
-         pos = atoi(attr->value) - 1;
-
-          if (pos < 0 || pos > 4)
-           pos = 1;
-       }
-       else
-         pos = 1;
-
-       values[pos]  = size->length;
-       isfloat[pos] = 1;
-
-       /*
-        * According to the Adobe PPD specification, an orientation of 1
-       * will produce a print that comes out upside-down with the X
-       * axis perpendicular to the direction of feed, which is exactly
-       * what we want to be consistent with non-PS printers.
-       *
-       * We could also use an orientation of 3 to produce output that
-       * comes out rightside-up (this is the default for many large format
-       * printer PPDs), however for consistency we will stick with the
-       * value 1.
-       *
-       * If we wanted to get fancy, we could use orientations of 0 or
-       * 2 and swap the width and length, however we don't want to get
-       * fancy, we just want it to work consistently.
-       *
-       * The orientation value is range limited by the Orientation
-       * parameter definition, so certain non-PS printer drivers that
-       * only support an Orientation of 0 will get the value 0 as
-       * expected.
-       */
-
-        orientation = 1;
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize",
-                               "Orientation")) != NULL)
-       {
-         int min_orient, max_orient;   /* Minimum and maximum orientations */
-
-
-          if (sscanf(attr->value, "%d%*s%d%d", &pos, &min_orient,
-                    &max_orient) != 3)
-           pos = 4;
-         else
-         {
-           pos --;
-
-            if (pos < 0 || pos > 4)
-             pos = 4;
-
-            if (orientation > max_orient)
-             orientation = max_orient;
-           else if (orientation < min_orient)
-             orientation = min_orient;
-         }
-       }
-       else
-         pos = 4;
-
-       values[pos] = orientation;
-
-        for (pos = 0; pos < 5; pos ++)
-         if (isfloat[pos])
-           fprintf(fp, "%.2f\n", values[pos]);
-          else
-           fprintf(fp, "%.0f\n", values[pos]);
-
-       if (choices[i]->code == NULL)
-       {
-        /*
-         * This can happen with certain buggy PPD files that don't include
-         * a CustomPageSize command sequence...  We just use a generic
-         * Level 2 command sequence...
-         */
-
-         fputs(ppd_custom_code, fp);
-       }
-      }
-      else if (!strcasecmp(choices[i]->choice, "Custom"))
-      {
-       /*
-        * Custom option...
-       */
-
-        ppd_coption_t  *coption;       /* Custom option */
-       ppd_cparam_t    *cparam;        /* Custom parameter */
-        const char     *s;             /* Pointer into string value */
-
-
-       /*
-        * TODO: Support custom options with more than 1 parameter...
-       */
-
-        if ((coption = ppdFindCustomOption(ppd, choices[i]->option->keyword))
-               != NULL &&
-           (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) != NULL)
-       {
-         if (fprintf(fp, "%%%%BeginFeature: *Custom%s True\n",
-                     coption->keyword) < 0)
-         {
-            free(choices);
-            return (-1);
-         }
-
-          switch (cparam->type)
-         {
-           case PPD_CUSTOM_CURVE :
-           case PPD_CUSTOM_INVCURVE :
-           case PPD_CUSTOM_POINTS :
-           case PPD_CUSTOM_REAL :
-               if (fprintf(fp, "%f\n", cparam->current.custom_real) < 0)
-               {
-                 free(choices);
-                 return (-1);
-               }
-               break;
-
-           case PPD_CUSTOM_INT :
-               if (fprintf(fp, "%d\n", cparam->current.custom_int) < 0)
-               {
-                 free(choices);
-                 return (-1);
-               }
-               break;
-
-           case PPD_CUSTOM_PASSCODE :
-           case PPD_CUSTOM_PASSWORD :
-           case PPD_CUSTOM_STRING :
-               putc('(', fp);
-
-               for (s = cparam->current.custom_string; *s; s ++)
-                 if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
-                   fprintf(fp, "\\%03o", *s & 255);
-                 else
-                   putc(*s, fp);
-
-               if (fputs(")\n", fp) < 0)
-               {
-                 free(choices);
-                 return (-1);
-               }
-               break;
-          }
-       }
-      }
-      else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
-                       choices[i]->option->keyword,
-                      choices[i]->choice) < 0)
-      {
-        free(choices);
-        return (-1);
-      }
+  buffer = ppdEmitString(ppd, section, min_order);
 
-      if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
-      {
-        if (fputs(choices[i]->code, fp) < 0)
-        {
-          free(choices);
-          return (-1);
-        }
-
-        if (choices[i]->code[strlen(choices[i]->code) - 1] != '\n')
-          putc('\n', fp);
-      }
+ /*
+  * Write it as needed and return...
+  */
 
-      if (fputs("%%EndFeature\n", fp) < 0)
-      {
-        free(choices);
-        return (-1);
-      }
+  if (buffer)
+  {
+    status = fputs(buffer, fp) < 0 ? -1 : 0;
 
-      if (fputs("} stopped cleartomark\n", fp) < 0)
-      {
-        free(choices);
-        return (-1);
-      }
-    }
-    else if (fputs(choices[i]->code, fp) < 0)
-    {
-      free(choices);
-      return (-1);
-    }
+    free(buffer);
+  }
+  else
+    status = 0;
 
-  free(choices);
-  return (0);
+  return (status);
 }
 
 
@@ -474,194 +249,58 @@ ppdEmitFd(ppd_file_t    *ppd,            /* I - PPD file record */
           int           fd,            /* I - File to write to */
           ppd_section_t section)       /* I - Section to write */
 {
-  int          i,                      /* Looping var */
-               count,                  /* Number of choices */
-               custom_size;            /* Non-zero if this option is a custom size */
-  ppd_choice_t **choices;              /* Choices */
-  ppd_size_t   *size;                  /* Custom page size */
-  char         buf[1024];              /* Output buffer for feature */
+  char         *buffer,                /* Option code */
+               *bufptr;                /* Pointer into code */
+  size_t       buflength;              /* Length of option code */
+  ssize_t      bytes;                  /* Bytes written */
+  int          status;                 /* Return status */
 
 
  /*
-  * Use PageSize or PageRegion as required...
+  * Range check input...
   */
 
-  ppd_handle_media(ppd);
+  if (!ppd || fd < 0)
+    return (-1);
 
  /*
-  * Collect the options we need to emit and emit them!
+  * Get the string...
   */
 
-  if ((count = ppdCollect(ppd, section, &choices)) == 0)
-    return (0);
-
-  for (i = 0; i < count; i ++)
-    if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
-    {
-     /*
-      * Send wrapper commands to prevent printer errors for unsupported
-      * options...
-      */
-
-      if (write(fd, "[{\n", 3) < 1)
-      {
-        free(choices);
-        return (-1);
-      }
-
-     /*
-      * Send DSC comments with option...
-      */
-
-      if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
-           !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
-          !strcasecmp(choices[i]->choice, "Custom"))
-      {
-        custom_size = 1;
-
-       strcpy(buf, "%%BeginFeature: *CustomPageSize True\n");
-      }
-      else
-      {
-        custom_size = 0;
-
-       snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
-                choices[i]->option->keyword, choices[i]->choice);
-      }
-
-      if (write(fd, buf, strlen(buf)) < 1)
-      {
-        free(choices);
-        return (-1);
-      }
-
-      if (custom_size)
-      {
-       /*
-        * Variable size; write out standard size options, using the
-       * parameter positions defined in the PPD file...
-       */
-
-        ppd_attr_t     *attr;          /* PPD attribute */
-       int             pos,            /* Position of custom value */
-                       values[5],      /* Values for custom command */
-                       orientation;    /* Orientation to use */
-
-
-        size = ppdPageSize(ppd, "Custom");
-
-        memset(values, 0, sizeof(values));
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
-       {
-         pos = atoi(attr->value) - 1;
-
-          if (pos < 0 || pos > 4)
-           pos = 0;
-       }
-       else
-         pos = 0;
-
-       values[pos] = (int)size->width;
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
-       {
-         pos = atoi(attr->value) - 1;
-
-          if (pos < 0 || pos > 4)
-           pos = 1;
-       }
-       else
-         pos = 1;
-
-       values[pos] = (int)size->length;
-
-        if (size->width < size->length)
-         orientation = 1;
-       else
-         orientation = 0;
-
-       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize",
-                               "Orientation")) != NULL)
-       {
-         int min_orient, max_orient;   /* Minimum and maximum orientations */
-
-
-          if (sscanf(attr->value, "%d%*s%d%d", &pos, &min_orient,
-                    &max_orient) != 3)
-           pos = 4;
-         else
-         {
-           pos --;
-
-            if (pos < 0 || pos > 4)
-             pos = 4;
+  buffer = ppdEmitString(ppd, section, 0.0);
 
-            if (orientation > max_orient)
-             orientation = max_orient;
-           else if (orientation < min_orient)
-             orientation = min_orient;
-         }
-       }
-       else
-         pos = 4;
-
-       values[pos] = orientation;
-
-        snprintf(buf, sizeof(buf), "%d %d %d %d %d\n", values[0], values[1],
-                values[2], values[3], values[4]);
-
-       if (write(fd, buf, strlen(buf)) < 1)
-       {
-          free(choices);
-          return (-1);
-       }
-
-       if (choices[i]->code == NULL)
-       {
-        /*
-         * This can happen with certain buggy PPD files that don't include
-         * a CustomPageSize command sequence...  We just use a generic
-         * Level 2 command sequence...
-         */
-
-         if (write(fd, ppd_custom_code, strlen(ppd_custom_code)) < 1)
-         {
-            free(choices);
-            return (-1);
-         }
-       }
-      }
+ /*
+  * Write it as needed and return...
+  */
 
-      if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
-      {
-       if (write(fd, choices[i]->code, strlen(choices[i]->code)) < 1)
-       {
-          free(choices);
-          return (-1);
-       }
-      }
+  if (buffer)
+  {
+    buflength = strlen(buffer);
+    bufptr    = buffer;
+    bytes     = 0;
 
-      if (write(fd, "%%EndFeature\n", 13) < 1)
+    while (buflength > 0)
+    {
+      if ((bytes = write(fd, bufptr, buflength)) < 0)
       {
-        free(choices);
-        return (-1);
-      }
+        if (errno == EAGAIN || errno == EINTR)
+         continue;
 
-      if (write(fd, "} stopped cleartomark\n", 22) < 1)
-      {
-        free(choices);
-        return (-1);
+       break;
       }
-    }
-    else if (write(fd, choices[i]->code, strlen(choices[i]->code)) < 1)
-    {
-      free(choices);
-      return (-1);
+
+      buflength -= bytes;
+      bufptr    += bytes;
     }
 
-  free(choices);
-  return (0);
+    status = bytes < 0 ? -1 : 0;
+
+    free(buffer);
+  }
+  else
+    status = 0;
+
+  return (status);
 }
 
 
@@ -684,7 +323,7 @@ ppdEmitJCL(ppd_file_t *ppd,         /* I - PPD file record */
   * Range check the input...
   */
 
-  if (ppd == NULL || ppd->jcl_begin == NULL || ppd->jcl_ps == NULL)
+  if (!ppd || !ppd->jcl_begin || !ppd->jcl_ps)
     return (0);
 
  /*
@@ -780,24 +419,17 @@ int                                       /* O - 0 on success, -1 on failure */
 ppdEmitJCLEnd(ppd_file_t *ppd,         /* I - PPD file record */
               FILE       *fp)          /* I - File to write to */
 {
-  ppd_attr_t   *attr;                  /* PPD attributes */
-
-
  /*
   * Range check the input...
   */
 
-  if (ppd == NULL)
+  if (!ppd)
     return (0);
 
-  if (ppd->jcl_end == NULL)
+  if (!ppd->jcl_end)
   {
     if (ppd->num_filters == 0)
-      fputc(0x04, fp);
-
-    if ((attr = ppdFindAttr(ppd, "cupsProtocol", NULL)) != NULL &&
-        attr->value != NULL && !strcasecmp(attr->value, "TBCP"))
-      fputs("\033%-12345X", stdout);
+      putc(0x04, fp);
 
     return (0);
   }
@@ -828,6 +460,365 @@ ppdEmitJCLEnd(ppd_file_t *ppd,            /* I - PPD file record */
 }
 
 
+/*
+ * 'ppdEmitString()' - Get a string containing the code for marked options.
+ *
+ * When "min_order" is greater than zero, this function only includes options
+ * whose OrderDependency value is greater than or equal to "min_order".
+ * Otherwise, all options in the specified section are included in the
+ * returned string.
+ *
+ * The return string is allocated on the heap and should be freed using
+ * free() when you are done with it.
+ *
+ * @since CUPS 1.2@
+ */
+
+char *                                 /* O - String containing option code */
+ppdEmitString(ppd_file_t    *ppd,      /* I - PPD file record */
+              ppd_section_t section,   /* I - Section to write */
+             float         min_order)  /* I - Lowest OrderDependency */
+{
+  int          i, j,                   /* Looping vars */
+               count;                  /* Number of choices */
+  ppd_choice_t **choices;              /* Choices */
+  ppd_size_t   *size;                  /* Custom page size */
+  ppd_coption_t        *coption;               /* Custom option */
+  ppd_cparam_t *cparam;                /* Custom parameter */
+  size_t       bufsize;                /* Size of string buffer needed */
+  char         *buffer,                /* String buffer */
+               *bufptr,                /* Pointer into buffer */
+               *bufend;                /* End of buffer */
+  struct lconv *loc;                   /* Locale data */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!ppd)
+    return (NULL);
+
+ /*
+  * Use PageSize or PageRegion as required...
+  */
+
+  ppd_handle_media(ppd);
+
+ /*
+  * Collect the options we need to emit...
+  */
+
+  if ((count = ppdCollect2(ppd, section, min_order, &choices)) == 0)
+    return (NULL);
+
+ /*
+  * Count the number of bytes that are required to hold all of the
+  * option code...
+  */
+
+  for (i = 0, bufsize = 1; i < count; i ++)
+  {
+    if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
+    {
+      bufsize += 3;                    /* [{\n */
+
+      if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
+           !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
+          !strcasecmp(choices[i]->choice, "Custom"))
+      {
+        bufsize += 37;                 /* %%BeginFeature: *CustomPageSize True */
+        bufsize += 50;                 /* Five 9-digit numbers + newline */
+      }
+      else if (!strcasecmp(choices[i]->choice, "Custom") &&
+               (coption = ppdFindCustomOption(ppd,
+                                             choices[i]->option->keyword))
+                  != NULL)
+      {
+        bufsize += 23 + strlen(choices[i]->option->keyword);
+                                       /* %%BeginFeature: *keyword True */
+
+        
+        for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+            cparam;
+            cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
+       {
+          switch (cparam->type)
+         {
+           case PPD_CUSTOM_CURVE :
+           case PPD_CUSTOM_INVCURVE :
+           case PPD_CUSTOM_POINTS :
+           case PPD_CUSTOM_REAL :
+           case PPD_CUSTOM_INT :
+               bufsize += 10;
+               break;
+
+           case PPD_CUSTOM_PASSCODE :
+           case PPD_CUSTOM_PASSWORD :
+           case PPD_CUSTOM_STRING :
+               bufsize += 3 + 4 * strlen(cparam->current.custom_string);
+               break;
+          }
+       }
+      }
+      else
+        bufsize += 19 + strlen(choices[i]->option->keyword) +
+                  strlen(choices[i]->choice);
+                                       /* %%BeginFeature: *keyword choice */
+
+      bufsize += 13;                   /* %%EndFeature\n */
+      bufsize += 22;                   /* } stopped cleartomark\n */
+    }
+
+    if (choices[i]->code)
+      bufsize += strlen(choices[i]->code);
+    else
+      bufsize += strlen(ppd_custom_code);
+  }
+
+ /*
+  * Allocate memory...
+  */
+
+  if ((buffer = calloc(1, bufsize)) == NULL)
+  {
+    free(choices);
+    return (NULL);
+  }
+
+  bufend = buffer + bufsize - 1;
+  loc    = localeconv();
+
+ /*
+  * Copy the option code to the buffer...
+  */
+
+  for (i = 0, bufptr = buffer; i < count; i ++, bufptr += strlen(bufptr))
+    if (section != PPD_ORDER_EXIT && section != PPD_ORDER_JCL)
+    {
+     /*
+      * Add wrapper commands to prevent printer errors for unsupported
+      * options...
+      */
+
+      strlcpy(bufptr, "[{\n", bufend - bufptr + 1);
+      bufptr += 3;
+
+     /*
+      * Send DSC comments with option...
+      */
+
+      if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
+           !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
+          !strcasecmp(choices[i]->choice, "Custom"))
+      {
+       /*
+        * Variable size; write out standard size options, using the
+       * parameter positions defined in the PPD file...
+       */
+
+        ppd_attr_t     *attr;          /* PPD attribute */
+       int             pos,            /* Position of custom value */
+                       orientation;    /* Orientation to use */
+       float           values[5];      /* Values for custom command */
+
+
+        strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n",
+               bufend - bufptr + 1);
+        bufptr += 37;
+
+        size = ppdPageSize(ppd, "Custom");
+
+        memset(values, 0, sizeof(values));
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 0;
+       }
+       else
+         pos = 0;
+
+       values[pos] = size->width;
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
+       {
+         pos = atoi(attr->value) - 1;
+
+          if (pos < 0 || pos > 4)
+           pos = 1;
+       }
+       else
+         pos = 1;
+
+       values[pos] = size->length;
+
+       /*
+        * According to the Adobe PPD specification, an orientation of 1
+       * will produce a print that comes out upside-down with the X
+       * axis perpendicular to the direction of feed, which is exactly
+       * what we want to be consistent with non-PS printers.
+       *
+       * We could also use an orientation of 3 to produce output that
+       * comes out rightside-up (this is the default for many large format
+       * printer PPDs), however for consistency we will stick with the
+       * value 1.
+       *
+       * If we wanted to get fancy, we could use orientations of 0 or
+       * 2 and swap the width and length, however we don't want to get
+       * fancy, we just want it to work consistently.
+       *
+       * The orientation value is range limited by the Orientation
+       * parameter definition, so certain non-PS printer drivers that
+       * only support an Orientation of 0 will get the value 0 as
+       * expected.
+       */
+
+        orientation = 1;
+
+       if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize",
+                               "Orientation")) != NULL)
+       {
+         int min_orient, max_orient;   /* Minimum and maximum orientations */
+
+
+          if (sscanf(attr->value, "%d%*s%d%d", &pos, &min_orient,
+                    &max_orient) != 3)
+           pos = 4;
+         else
+         {
+           pos --;
+
+            if (pos < 0 || pos > 4)
+             pos = 4;
+
+            if (orientation > max_orient)
+             orientation = max_orient;
+           else if (orientation < min_orient)
+             orientation = min_orient;
+         }
+       }
+       else
+         pos = 4;
+
+       values[pos] = orientation;
+
+        for (pos = 0; pos < 5; pos ++)
+       {
+         bufptr    = _cupsStrFormatd(bufptr, bufend, values[pos], loc);
+         *bufptr++ = '\n';
+        }
+
+       if (!choices[i]->code)
+       {
+        /*
+         * This can happen with certain buggy PPD files that don't include
+         * a CustomPageSize command sequence...  We just use a generic
+         * Level 2 command sequence...
+         */
+
+         strlcpy(bufptr, ppd_custom_code, bufend - bufptr + 1);
+          bufptr += strlen(bufptr);
+       }
+      }
+      else if (!strcasecmp(choices[i]->choice, "Custom") &&
+               (coption = ppdFindCustomOption(ppd,
+                                             choices[i]->option->keyword))
+                  != NULL)
+      {
+       /*
+        * Custom option...
+       */
+
+        const char     *s;             /* Pointer into string value */
+
+
+        snprintf(bufptr, bufend - bufptr + 1,
+                "%%%%BeginFeature: *Custom%s True\n", coption->keyword);
+        bufptr += strlen(bufptr);
+
+        for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+            cparam;
+            cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
+       {
+          switch (cparam->type)
+         {
+           case PPD_CUSTOM_CURVE :
+           case PPD_CUSTOM_INVCURVE :
+           case PPD_CUSTOM_POINTS :
+           case PPD_CUSTOM_REAL :
+               bufptr    = _cupsStrFormatd(bufptr, bufend,
+                                           cparam->current.custom_real, loc);
+                *bufptr++ = '\n';
+               break;
+
+           case PPD_CUSTOM_INT :
+               snprintf(bufptr, bufend - bufptr + 1, "%d\n",
+                        cparam->current.custom_int);
+               bufptr += strlen(bufptr);
+               break;
+
+           case PPD_CUSTOM_PASSCODE :
+           case PPD_CUSTOM_PASSWORD :
+           case PPD_CUSTOM_STRING :
+               *bufptr++ = '(';
+
+               for (s = cparam->current.custom_string; *s; s ++)
+                 if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
+                 {
+                   snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
+                   bufptr += strlen(bufptr);
+                 }
+                 else
+                   *bufptr++ = *s;
+
+               *bufptr++ = ')';
+               *bufptr++ = '\n';
+               break;
+          }
+       }
+      }
+      else
+      {
+        snprintf(bufptr, bufend - bufptr + 1, "%%%%BeginFeature: *%s %s\n",
+                 choices[i]->option->keyword, choices[i]->choice);
+       bufptr += strlen(bufptr);
+      }
+
+      if (choices[i]->code && choices[i]->code[0])
+      {
+        j = strlen(choices[i]->code);
+       memcpy(bufptr, choices[i]->code, j);
+       bufptr += j;
+
+       if (choices[i]->code[j - 1] != '\n')
+         *bufptr++ = '\n';
+      }
+
+      strlcpy(bufptr, "%%EndFeature\n"
+                     "} stopped cleartomark\n", bufend - bufptr + 1);
+      bufptr += strlen(bufptr);
+    }
+    else
+    {
+      strlcpy(bufptr, choices[i]->code, bufend - bufptr + 1);
+      bufptr += strlen(bufptr);
+    }
+
+ /*
+  * Nul-terminate, free, and return...
+  */
+
+  *bufptr = '\0';
+
+  free(choices);
+
+  return (buffer);
+}
+
+
 /*
  * 'ppd_handle_media()' - Handle media selection...
  */
@@ -926,5 +917,5 @@ ppd_sort(ppd_choice_t **c1, /* I - First choice */
 
 
 /*
- * End of "$Id: emit.c 5086 2006-02-07 02:45:26Z mike $".
+ * End of "$Id: emit.c 5238 2006-03-07 04:41:42Z mike $".
  */
index b0bbdda5a0909d517861be2ead8fce7133452932..a57b0a8501d5e20880f82d2db80e1a18af57598d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: encode.c 5151 2006-02-22 22:43:17Z mike $"
+ * "$Id: encode.c 5230 2006-03-05 17:01:51Z mike $"
  *
  *   Option encoding routines for the Common UNIX Printing System (CUPS).
  *
@@ -341,7 +341,7 @@ cupsEncodeOptions2(
     * Allocate memory for the attribute values...
     */
 
-    if ((attr = _ipp_add_attr(ipp, count)) == NULL)
+    if ((attr = _ippAddAttr(ipp, count)) == NULL)
     {
      /*
       * Ran out of memory!
@@ -552,5 +552,5 @@ compare_ipp_options(_ipp_option_t *a,       /* I - First option */
 
 
 /*
- * End of "$Id: encode.c 5151 2006-02-22 22:43:17Z mike $".
+ * End of "$Id: encode.c 5230 2006-03-05 17:01:51Z mike $".
  */
index 6c534a70f0eceb8de2563df74f6e13651033d161..9dc7f7a9cd15b898db89c84a089d62294ee1ce6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: getputfile.c 5147 2006-02-22 16:37:44Z mike $"
+ * "$Id: getputfile.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Get/put file functions for the Common UNIX Printing System (CUPS).
  *
@@ -68,6 +68,8 @@ cupsGetFd(http_t     *http,           /* I - HTTP connection to server */
   int          bytes;                  /* Number of bytes read */
   char         buffer[8192];           /* Buffer for file */
   http_status_t        status;                 /* HTTP status from server */
+  char         if_modified_since[HTTP_MAX_VALUE];
+                                       /* If-Modified-Since header */
 
 
  /*
@@ -89,10 +91,14 @@ cupsGetFd(http_t     *http,         /* I - HTTP connection to server */
   * Then send GET requests to the HTTP server...
   */
 
+  strlcpy(if_modified_since, httpGetField(http, HTTP_FIELD_IF_MODIFIED_SINCE),
+          sizeof(if_modified_since));
+
   do
   {
     httpClearFields(http);
     httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
+    httpSetField(http, HTTP_FIELD_IF_MODIFIED_SINCE, if_modified_since);
 
     if (httpGet(http, resource))
     {
@@ -482,5 +488,5 @@ cupsPutFile(http_t     *http,               /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: getputfile.c 5147 2006-02-22 16:37:44Z mike $".
+ * End of "$Id: getputfile.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 3cbcadd1777a001d1962ccbdb6647eb2f0b7a2da..98d5cf1caf4694836ac38a33a655f3aa5cb58bad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: globals.c 5047 2006-02-02 05:14:15Z mike $"
+ * "$Id: globals.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Global variable access routines for the Common UNIX Printing System (CUPS).
  *
@@ -160,11 +160,13 @@ globals_destructor(void *value)           /* I - Data to free */
   if (cg->http)
     httpClose(cg->http);
 
-  _cups_sp_flush(cg);
+  _cupsStrFlush(cg);
   _cupsLangFlush(cg);
   _cupsCharmapFlush(cg);
   _cupsNormalizeMapsFlush(cg);
 
+  cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
+
   free(value);
 }
 
@@ -211,5 +213,5 @@ _cupsGlobals(void)
 
 
 /*
- * End of "$Id: globals.c 5047 2006-02-02 05:14:15Z mike $".
+ * End of "$Id: globals.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 1fae0efb2fbf18f1ad83055de951e1d9df4bdf61..15661d587389369b2e42a51088a2d1dfb0aefaf8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: globals.h 5138 2006-02-21 10:49:06Z mike $"
+ * "$Id: globals.h 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Global variable definitions for the Common UNIX Printing System (CUPS).
  *
@@ -66,6 +66,14 @@ typedef struct _cups_globals_s               /**** CUPS global state data ****/
                        *cups_statedir, /* CUPS_STATEDIR environment var */
                        *localedir;     /* LOCALDIR environment var */
 
+  /* adminutil.c */
+  time_t               cupsd_update;   /* Last time we got or set cupsd.conf */
+  char                 cupsd_hostname[HTTP_MAX_HOST];
+                                       /* Hostname for connection */
+  int                  cupsd_num_settings;
+                                       /* Number of server settings */
+  cups_option_t                *cupsd_settings;/* Server settings */
+
   /* http.c */
   char                 http_date[256]; /* Date+time buffer */
 
@@ -148,7 +156,7 @@ extern void         _cupsLangFlush(_cups_globals_t *cg);
 extern void            _cupsCharmapFlush(_cups_globals_t *cg);
 extern void            _cupsNormalizeMapsFlush(_cups_globals_t *cg);
 extern void            _cupsSetError(ipp_status_t status, const char *message);
-extern void            _cups_sp_flush(_cups_globals_t *cg);
+extern void            _cupsStrFlush(_cups_globals_t *cg);
 
 
 /*
@@ -161,5 +169,5 @@ extern void         _cups_sp_flush(_cups_globals_t *cg);
 #endif /* !_CUPS_GLOBALS_H_ */
 
 /*
- * End of "$Id: globals.h 5138 2006-02-21 10:49:06Z mike $".
+ * End of "$Id: globals.h 5235 2006-03-06 13:02:23Z mike $".
  */
index ec0f7b269035a022405488fa62551bd26eeabc7a..665829867c8b02aea15285d6910414ff71f485ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http-addr.c 5161 2006-02-24 03:11:46Z mike $"
+ * "$Id: http-addr.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   HTTP address routines for the Common UNIX Printing System (CUPS).
  *
@@ -490,35 +490,43 @@ httpGetHostByName(const char *name)       /* I - Hostname or IP address */
 
 
 /*
- * 'httpGetHostname()' - Get the FQDN for the local system.
+ * 'httpGetHostname()' - Get the FQDN for the connection or local system.
  *
- * This function uses both gethostname() and gethostbyname() to
- * get the local hostname with domain.
+ * When "http" points to a connected socket, return the hostname or
+ * address that was used in the call to httpConnect() or httpConnectEncrypt().
+ * Otherwise, return the FQDN for the local system using both gethostname()
+ * and gethostbyname() to get the local hostname with domain.
  *
  * @since CUPS 1.2@
  */
 
-const char *                           /* O - FQDN for this system */
-httpGetHostname(char *s,               /* I - String buffer for name */
-                int  slen)             /* I - Size of buffer */
+const char *                           /* O - FQDN for connection or system */
+httpGetHostname(http_t *http,          /* I - HTTP connection or NULL */
+                char   *s,             /* I - String buffer for name */
+                int    slen)           /* I - Size of buffer */
 {
   struct hostent       *host;          /* Host entry to get FQDN */
 
 
- /*
-  * Get the hostname...
-  */
-
-  gethostname(s, slen);
-
-  if (!strchr(s, '.'))
+  if (http)
+    strlcpy(s, http->hostname, slen);
+  else
   {
    /*
-    * The hostname is not a FQDN, so look it up...
+    * Get the hostname...
     */
 
-    if ((host = gethostbyname(s)) != NULL)
-      strlcpy(s, host->h_name, slen);
+    gethostname(s, slen);
+
+    if (!strchr(s, '.'))
+    {
+     /*
+      * The hostname is not a FQDN, so look it up...
+      */
+
+      if ((host = gethostbyname(s)) != NULL)
+       strlcpy(s, host->h_name, slen);
+    }
   }
 
  /*
@@ -530,5 +538,5 @@ httpGetHostname(char *s,            /* I - String buffer for name */
 
 
 /*
- * End of "$Id: http-addr.c 5161 2006-02-24 03:11:46Z mike $".
+ * End of "$Id: http-addr.c 5235 2006-03-06 13:02:23Z mike $".
  */
index dc0da38927b7446afd60b5d40e6f7c30308c6557..2e380988ea63ad8c0110f833213a617685cbaed3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.c 5222 2006-03-03 18:57:56Z mike $"
+ * "$Id: http.c 5226 2006-03-04 22:03:18Z mike $"
  *
  *   HTTP routines for the Common UNIX Printing System (CUPS).
  *
@@ -539,6 +539,8 @@ httpGetBlocking(http_t *http)               /* I - HTTP connection */
 
 /*
  * 'httpGetCookie()' - Get any cookie data from the response.
+ *
+ * @since CUPS 1.1.19@
  */
 
 const char *                           /* O - Cookie data or NULL */
@@ -2754,5 +2756,5 @@ http_write_ssl(http_t     *http,  /* I - HTTP connection */
 
 
 /*
- * End of "$Id: http.c 5222 2006-03-03 18:57:56Z mike $".
+ * End of "$Id: http.c 5226 2006-03-04 22:03:18Z mike $".
  */
index 6ff09a20fcd1c5e4c98a3a869e9a65fa773bf0b2..1c520b9320607e7d9551cbccd839ab0c59b1878a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.h 5147 2006-02-22 16:37:44Z mike $"
+ * "$Id: http.h 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Hyper-Text Transport Protocol definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -462,7 +462,7 @@ extern int          httpFlushWrite(http_t *http);
 extern int             httpGetBlocking(http_t *http);
 extern const char      *httpGetDateString2(time_t t, char *s, int slen);
 extern int             httpGetFd(http_t *http);
-extern const char      *httpGetHostname(char *s, int slen);
+extern const char      *httpGetHostname(http_t *http, char *s, int slen);
 extern off_t           httpGetLength2(http_t *http);
 extern http_status_t   httpGetStatus(http_t *http);
 extern char            *httpGetSubField2(http_t *http, http_field_t field,
@@ -491,5 +491,5 @@ extern ssize_t              httpWrite2(http_t *http, const char *buffer,
 #endif /* !_CUPS_HTTP_H_ */
 
 /*
- * End of "$Id: http.h 5147 2006-02-22 16:37:44Z mike $".
+ * End of "$Id: http.h 5235 2006-03-06 13:02:23Z mike $".
  */
index c2f3f474e0080ebe02257bd5faf48b22848cb067..e5658f2399ca3f9dbc584335d2a4c9e3cb17b63e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $"
+ * "$Id: i18n.h 5238 2006-03-07 04:41:42Z mike $"
  *
  *   (Private) localization support for the Common UNIX Printing System (CUPS).
  *
@@ -60,10 +60,6 @@ typedef struct _cups_message_s               /**** Message catalog entry ****/
  * Prototypes...
  */
 
-/**** New in CUPS 1.1.20 ****/
-extern void            _cupsRestoreLocale(int category, char *oldlocale);
-extern char            *_cupsSaveLocale(int category, const char *locale);
-
 /**** New in CUPS 1.2 ****/
 extern const char      *_cupsEncodingName(cups_encoding_t encoding);
 extern int             _cupsLangPrintf(FILE *fp, const char *message, ...)
@@ -84,5 +80,5 @@ extern const char     *_cupsMessageLookup(cups_array_t *a, const char *m);
 #endif /* !_CUPS_I18N_H_ */
 
 /*
- * End of "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $".
+ * End of "$Id: i18n.h 5238 2006-03-07 04:41:42Z mike $".
  */
index 37473987f7d08e2e343b2c9fa5fe6df34e91829e..af303f1da9314e965483b2175eb9cb557a30865b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $"
+ * "$Id: ipp-private.h 5230 2006-03-05 17:01:51Z mike $"
  *
  *   Private IPP definitions for the Common UNIX Printing System (CUPS).
  *
@@ -47,8 +47,8 @@ extern "C" {
  * Prototypes for private functions...
  */
 
-extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int);
-extern void            _ipp_free_attr(ipp_attribute_t *);
+extern ipp_attribute_t *_ippAddAttr(ipp_t *, int);
+extern void            _ippFreeAttr(ipp_attribute_t *);
 
 
 /*
@@ -61,5 +61,5 @@ extern void           _ipp_free_attr(ipp_attribute_t *);
 #endif /* !_CUPS_IPP_H_ */
 
 /*
- * End of "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $".
+ * End of "$Id: ipp-private.h 5230 2006-03-05 17:01:51Z mike $".
  */
index e9be31fe68cd664234edfa8c8676fe757cb998e2..d34c35ccbe7519be3a04b62feb71cab5fdea9c26 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c 5047 2006-02-02 05:14:15Z mike $"
+ * "$Id: ipp.c 5231 2006-03-05 17:22:27Z mike $"
  *
  *   Internet Printing Protocol support functions for the Common UNIX
  *   Printing System (CUPS).
@@ -57,8 +57,8 @@
  *                            connection.
  *   ippWriteFile()         - Write data for an IPP message to a file.
  *   ippWriteIO()           - Write data for an IPP message.
- *   _ipp_add_attr()        - Add a new attribute to the request.
- *   _ipp_free_attr()       - Free an attribute.
+ *   _ippAddAttr()          - Add a new attribute to the request.
+ *   _ippFreeAttr()         - Free an attribute.
  *   ipp_length()           - Compute the length of an IPP message or
  *                            collection value.
  *   ipp_read_http()        - Semi-blocking read on a HTTP connection...
@@ -111,10 +111,10 @@ ippAddBoolean(ipp_t      *ipp,            /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name              = _cups_sp_alloc(name);
+  attr->name              = _cupsStrAlloc(name);
   attr->group_tag         = group;
   attr->value_tag         = IPP_TAG_BOOLEAN;
   attr->values[0].boolean = value;
@@ -145,10 +145,10 @@ ippAddBooleans(ipp_t      *ipp,           /* I - IPP message */
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = IPP_TAG_BOOLEAN;
 
@@ -183,10 +183,10 @@ ippAddCollection(ipp_t      *ipp, /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name                 = _cups_sp_alloc(name);
+  attr->name                 = _cupsStrAlloc(name);
   attr->group_tag            = group;
   attr->value_tag            = IPP_TAG_BEGIN_COLLECTION;
   attr->values[0].collection = value;
@@ -220,10 +220,10 @@ ippAddCollections(
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = IPP_TAG_BEGIN_COLLECTION;
 
@@ -256,10 +256,10 @@ ippAddDate(ipp_t             *ipp,        /* I - IPP message */
   if (ipp == NULL || name == NULL || value == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = IPP_TAG_DATE;
   memcpy(attr->values[0].date, value, 11);
@@ -288,10 +288,10 @@ ippAddInteger(ipp_t      *ipp,            /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name              = _cups_sp_alloc(name);
+  attr->name              = _cupsStrAlloc(name);
   attr->group_tag         = group;
   attr->value_tag         = type;
   attr->values[0].integer = value;
@@ -320,10 +320,10 @@ ippAddIntegers(ipp_t      *ipp,           /* I - IPP message */
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = type;
 
@@ -356,14 +356,14 @@ ippAddOctetString(ipp_t      *ipp,        /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
  /*
   * Initialize the attribute data...
   */
 
-  attr->name                     = _cups_sp_alloc(name);
+  attr->name                     = _cupsStrAlloc(name);
   attr->group_tag                = group;
   attr->value_tag                = IPP_TAG_STRING;
   attr->values[0].unknown.length = datalen;
@@ -402,7 +402,7 @@ ippAddString(ipp_t      *ipp,               /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
  /*
@@ -432,13 +432,13 @@ ippAddString(ipp_t      *ipp,             /* I - IPP message */
   * Initialize the attribute data...
   */
 
-  attr->name                     = _cups_sp_alloc(name);
+  attr->name                     = _cupsStrAlloc(name);
   attr->group_tag                = group;
   attr->value_tag                = type;
   attr->values[0].string.charset = ((int)type & IPP_TAG_COPY) ? (char *)charset :
-                                   charset ? _cups_sp_alloc(charset) : NULL;
+                                   charset ? _cupsStrAlloc(charset) : NULL;
   attr->values[0].string.text    = ((int)type & IPP_TAG_COPY) ? (char *)value :
-                                   value ? _cups_sp_alloc(value) : NULL;
+                                   value ? _cupsStrAlloc(value) : NULL;
 
   return (attr);
 }
@@ -466,14 +466,14 @@ ippAddStrings(
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
  /*
   * Initialize the attribute data...
   */
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = type;
 
@@ -483,7 +483,7 @@ ippAddStrings(
   {
     if (i == 0)
       value->string.charset = ((int)type & IPP_TAG_COPY) ? (char *)charset :
-                                   charset ? _cups_sp_alloc(charset) : NULL;
+                                   charset ? _cupsStrAlloc(charset) : NULL;
     else
       value->string.charset = attr->values[0].string.charset;
 
@@ -495,10 +495,10 @@ ippAddStrings(
 
       if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C"))
        value->string.text = ((int)type & IPP_TAG_COPY) ? "en" :
-                                      _cups_sp_alloc("en");
+                                      _cupsStrAlloc("en");
       else
        value->string.text = ((int)type & IPP_TAG_COPY) ? (char *)values[i] :
-                                      _cups_sp_alloc(values[i]);
+                                      _cupsStrAlloc(values[i]);
     }
   }
 
@@ -523,10 +523,10 @@ ippAddRange(ipp_t      *ipp,              /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name                  = _cups_sp_alloc(name);
+  attr->name                  = _cupsStrAlloc(name);
   attr->group_tag             = group;
   attr->value_tag             = IPP_TAG_RANGE;
   attr->values[0].range.lower = lower;
@@ -556,10 +556,10 @@ ippAddRanges(ipp_t      *ipp,             /* I - IPP message */
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = IPP_TAG_RANGE;
 
@@ -594,10 +594,10 @@ ippAddResolution(ipp_t      *ipp, /* I - IPP message */
   if (ipp == NULL || name == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 1)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 1)) == NULL)
     return (NULL);
 
-  attr->name                       = _cups_sp_alloc(name);
+  attr->name                       = _cupsStrAlloc(name);
   attr->group_tag                  = group;
   attr->value_tag                  = IPP_TAG_RESOLUTION;
   attr->values[0].resolution.xres  = xres;
@@ -629,10 +629,10 @@ ippAddResolutions(ipp_t      *ipp,        /* I - IPP message */
   if (ipp == NULL || name == NULL || num_values < 1)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, num_values)) == NULL)
+  if ((attr = _ippAddAttr(ipp, num_values)) == NULL)
     return (NULL);
 
-  attr->name      = _cups_sp_alloc(name);
+  attr->name      = _cupsStrAlloc(name);
   attr->group_tag = group;
   attr->value_tag = IPP_TAG_RESOLUTION;
 
@@ -665,7 +665,7 @@ ippAddSeparator(ipp_t *ipp)         /* I - IPP message */
   if (ipp == NULL)
     return (NULL);
 
-  if ((attr = _ipp_add_attr(ipp, 0)) == NULL)
+  if ((attr = _ippAddAttr(ipp, 0)) == NULL)
     return (NULL);
 
   attr->group_tag = IPP_TAG_ZERO;
@@ -743,7 +743,7 @@ ippDelete(ipp_t *ipp)                       /* I - IPP message */
   for (attr = ipp->attrs; attr != NULL; attr = next)
   {
     next = attr->next;
-    _ipp_free_attr(attr);
+    _ippFreeAttr(attr);
   }
 
   free(ipp);
@@ -791,7 +791,7 @@ ippDeleteAttribute(
     * Free memory used by the attribute...
     */
 
-    _ipp_free_attr(current);
+    _ippFreeAttr(current);
   }
 }
 
@@ -1254,7 +1254,7 @@ ippReadIO(void       *src,                /* I - Data source */
             if (ipp->current)
              ipp->prev = ipp->current;
 
-           attr = ipp->current = _ipp_add_attr(ipp, 1);
+           attr = ipp->current = _ippAddAttr(ipp, 1);
 
            DEBUG_printf(("ippReadIO: membername, ipp->current=%p, ipp->prev=%p\n",
                          ipp->current, ipp->prev));
@@ -1280,14 +1280,14 @@ ippReadIO(void       *src,              /* I - Data source */
             if (ipp->current)
              ipp->prev = ipp->current;
 
-           attr = ipp->current = _ipp_add_attr(ipp, 1);
+           attr = ipp->current = _ippAddAttr(ipp, 1);
 
            DEBUG_printf(("ippReadIO: name=\'%s\', ipp->current=%p, ipp->prev=%p\n",
                          buffer, ipp->current, ipp->prev));
 
            attr->group_tag  = ipp->curtag;
            attr->value_tag  = tag;
-           attr->name       = _cups_sp_alloc((char *)buffer);
+           attr->name       = _cupsStrAlloc((char *)buffer);
            attr->num_values = 0;
          }
          else
@@ -1347,7 +1347,7 @@ ippReadIO(void       *src,                /* I - Data source */
                }
 
                buffer[n] = '\0';
-               value->string.text = _cups_sp_alloc((char *)buffer);
+               value->string.text = _cupsStrAlloc((char *)buffer);
                DEBUG_printf(("ippReadIO: value = \'%s\'\n",
                              value->string.text));
                break;
@@ -1427,13 +1427,13 @@ ippReadIO(void       *src,              /* I - Data source */
                  string[n] = '\0';
                 }
 
-               value->string.charset = _cups_sp_alloc((char *)string);
+               value->string.charset = _cupsStrAlloc((char *)string);
 
                 bufptr += 2 + n;
                n = (bufptr[0] << 8) | bufptr[1];
 
                bufptr[2 + n] = '\0';
-                value->string.text = _cups_sp_alloc((char *)bufptr + 2);
+                value->string.text = _cupsStrAlloc((char *)bufptr + 2);
                break;
 
             case IPP_TAG_BEGIN_COLLECTION :
@@ -1480,7 +1480,7 @@ ippReadIO(void       *src,                /* I - Data source */
                }
 
                buffer[n] = '\0';
-               attr->name = _cups_sp_alloc((char *)buffer);
+               attr->name = _cupsStrAlloc((char *)buffer);
 
                /*
                * Since collection members are encoded differently than
@@ -2400,17 +2400,17 @@ ippWriteIO(void       *dst,             /* I - Destination */
 
 
 /*
- * '_ipp_add_attr()' - Add a new attribute to the request.
+ * '_ippAddAttr()' - Add a new attribute to the request.
  */
 
 ipp_attribute_t *                      /* O - New attribute */
-_ipp_add_attr(ipp_t *ipp,              /* I - IPP message */
+_ippAddAttr(ipp_t *ipp,                /* I - IPP message */
               int   num_values)                /* I - Number of values */
 {
   ipp_attribute_t      *attr;          /* New attribute */
 
 
-  DEBUG_printf(("_ipp_add_attr(%p, %d)\n", ipp, num_values));
+  DEBUG_printf(("_ippAddAttr(%p, %d)\n", ipp, num_values));
 
   if (ipp == NULL || num_values < 0)
     return (NULL);
@@ -2430,24 +2430,24 @@ _ipp_add_attr(ipp_t *ipp,               /* I - IPP message */
     ipp->last = attr;
   }
 
-  DEBUG_printf(("_ipp_add_attr(): %p\n", attr));
+  DEBUG_printf(("_ippAddAttr(): %p\n", attr));
 
   return (attr);
 }
 
 
 /*
- * '_ipp_free_attr()' - Free an attribute.
+ * '_ippFreeAttr()' - Free an attribute.
  */
 
 void
-_ipp_free_attr(ipp_attribute_t *attr)  /* I - Attribute to free */
+_ippFreeAttr(ipp_attribute_t *attr)    /* I - Attribute to free */
 {
   int          i;                      /* Looping var */
   ipp_value_t  *value;                 /* Current value */
 
 
-  DEBUG_printf(("_ipp_free_attr(): %p\n", attr));
+  DEBUG_printf(("_ippFreeAttr(): %p\n", attr));
 
   switch (attr->value_tag)
   {
@@ -2463,7 +2463,7 @@ _ipp_free_attr(ipp_attribute_t *attr)     /* I - Attribute to free */
        for (i = 0, value = attr->values;
             i < attr->num_values;
             i ++, value ++)
-         _cups_sp_free(value->string.text);
+         _cupsStrFree(value->string.text);
        break;
 
     case IPP_TAG_TEXTLANG :
@@ -2473,8 +2473,8 @@ _ipp_free_attr(ipp_attribute_t *attr)     /* I - Attribute to free */
             i ++, value ++)
        {
          if (value->string.charset && i == 0)
-           _cups_sp_free(value->string.charset);
-         _cups_sp_free(value->string.text);
+           _cupsStrFree(value->string.charset);
+         _cupsStrFree(value->string.text);
        }
        break;
 
@@ -2506,7 +2506,7 @@ _ipp_free_attr(ipp_attribute_t *attr)     /* I - Attribute to free */
   }
 
   if (attr->name)
-    _cups_sp_free(attr->name);
+    _cupsStrFree(attr->name);
 
   free(attr);
 }
@@ -2798,5 +2798,5 @@ ipp_write_file(int         *fd,           /* I - File descriptor */
 
 
 /*
- * End of "$Id: ipp.c 5047 2006-02-02 05:14:15Z mike $".
+ * End of "$Id: ipp.c 5231 2006-03-05 17:22:27Z mike $".
  */
index 169c38af9157cb220a1f419ee84b813ec4920b0c..1d1533fd3f70f0f7d00c8a435116205b4d6435f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: language.c 5109 2006-02-15 20:11:10Z mike $"
+ * "$Id: language.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   I18N/language support for the Common UNIX Printing System (CUPS).
  *
@@ -38,8 +38,6 @@
  *   _cupsMessageFree()     - Free a messages array.
  *   _cupsMessageLoad()     - Load a .po file into a messages array.
  *   _cupsMessageLookup()   - Lookup a message string.
- *   _cupsRestoreLocale()   - Restore the original locale...
- *   _cupsSaveLocale()      - Set the locale and save a copy of the old locale...
  *   appleLangDefault()     - Get the default locale string.
  *   cups_cache_lookup()    - Lookup a language in the cache...
  *   cups_message_compare() - Compare two messages.
@@ -271,15 +269,12 @@ cupsLangGet(const char *language) /* I - Language or locale */
                        langname[16],   /* Requested language name */
                        country[16],    /* Country code */
                        charset[16],    /* Character set */
-#ifdef CODESET
                        *csptr,         /* Pointer to CODESET string */
-#endif /* CODESET */
                        *ptr,           /* Pointer into language/charset */
                        real[48],       /* Real language name */
                        filename[1024]; /* Filename for language locale file */
   cups_encoding_t      encoding;       /* Encoding to use */
   cups_lang_t          *lang;          /* Current language... */
-  char                 *oldlocale;     /* Old locale name */
   _cups_globals_t      *cg = _cupsGlobals();
                                        /* Pointer to library globals */
   static const char * const locale_encodings[] =
@@ -327,19 +322,38 @@ cupsLangGet(const char *language) /* I - Language or locale */
   DEBUG_printf(("cupsLangGet(language=\"%s\")\n", language ? language : "(null)"));
 
 #ifdef __APPLE__
+ /*
+  * Set the character set to UTF-8...
+  */
+
+  strcpy(charset, "UTF8");
+
  /*
   * Apple's setlocale doesn't give us the user's localization 
   * preference so we have to look it up this way...
   */
 
-  if (language == NULL)
+  if (!language)
     language = appleLangDefault();
+
 #else
-  if (language == NULL)
+ /*
+  * Set the charset to "unknown"...
+  */
+
+  charset[0] = '\0';
+
+ /*
+  * Use setlocale() to determine the currently set locale, and then
+  * fallback to environment variables to avoid setting the locale,
+  * since setlocale() is not thread-safe!
+  */
+
+  if (!language)
   {
    /*
     * First see if the locale has been set; if it is still "C" or
-    * "POSIX", set the locale to the default...
+    * "POSIX", use the environment to get the default...
     */
 
 #  ifdef LC_MESSAGES
@@ -352,14 +366,46 @@ cupsLangGet(const char *language) /* I - Language or locale */
                   ptr ? ptr : "(null)"));
 
     if (!ptr || !strcmp(ptr, "C") || !strcmp(ptr, "POSIX"))
-#  ifdef LC_MESSAGES
     {
-      ptr = setlocale(LC_MESSAGES, "");
-      setlocale(LC_CTYPE, "");
+     /*
+      * Get the character set from the LC_CTYPE locale setting...
+      */
+
+      if ((ptr = getenv("LC_CTYPE")) == NULL)
+        if ((ptr = getenv("LC_ALL")) == NULL)
+         if ((ptr = getenv("LANG")) == NULL)
+           ptr = "en_US";
+
+      if ((csptr = strchr(ptr, '.')) != NULL)
+      {
+       /*
+        * Extract the character set from the environment...
+       */
+
+       for (ptr = charset, csptr ++; *csptr; csptr ++)
+         if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
+           *ptr++ = *csptr;
+
+        *ptr = '\0';
+      }
+      else
+      {
+       /*
+        * Default to UTF-8...
+       */
+
+        strcpy(charset, "UTF8");
+      }
+
+     /*
+      * Get the locale for messages from the LC_MESSAGES locale setting...
+      */
+
+      if ((ptr = getenv("LC_MESSAGES")) == NULL)
+        if ((ptr = getenv("LC_ALL")) == NULL)
+         if ((ptr = getenv("LANG")) == NULL)
+           ptr = "en_US";
     }
-#  else
-      ptr = setlocale(LC_ALL, "");
-#  endif /* LC_MESSAGES */
 
     if (ptr)
     {
@@ -380,27 +426,19 @@ cupsLangGet(const char *language) /* I - Language or locale */
   if (!language)
   {
    /*
-    * Switch to the value of the "LANG" environment variable, and if
-    * that is NULL as well, use "C".
+    * Switch to the POSIX ("C") locale...
     */
 
-    if ((language = getenv("LANG")) == NULL)
-      language = "C";
+    language = "C";
   }
 
- /*
-  * Set the charset to "unknown"...
-  */
-
-  charset[0] = '\0';
-
 #ifdef CODESET
  /*
   * On systems that support the nl_langinfo(CODESET) call, use
   * this value as the character set...
   */
 
-  if ((csptr = nl_langinfo(CODESET)) != NULL)
+  if (!charset[0] && (csptr = nl_langinfo(CODESET)) != NULL)
   {
    /*
     * Copy all of the letters and numbers in the CODESET string...
@@ -417,22 +455,6 @@ cupsLangGet(const char *language)  /* I - Language or locale */
   }
 #endif /* CODESET */
 
- /*
-  * Set the locale back to POSIX while we do string ops, since
-  * apparently some buggy C libraries break ctype() for non-I18N
-  * chars...
-  */
-
-#if defined(__APPLE__)
-  /* The ctype bug isn't in Apple's libc */
-  (void)locale;                        /* anti-compiler-warning-code */
-  (void)oldlocale;             /* anti-compiler-warning-code */
-#elif !defined(LC_CTYPE)
-  oldlocale = _cupsSaveLocale(LC_ALL, "C");
-#else
-  oldlocale = _cupsSaveLocale(LC_CTYPE, "C");
-#endif /* __APPLE__ */
-
  /*
   * Parse the language string passed in to a locale string. "C" is the
   * standard POSIX locale and is copied unchanged.  Otherwise the
@@ -501,18 +523,6 @@ cupsLangGet(const char *language)  /* I - Language or locale */
     }
   }
 
- /*
-  * Restore the locale...
-  */
-
-#if defined(__APPLE__)
-  /* The ctype bug isn't in Apple's libc */
-#elif !defined(LC_CTYPE)
-  _cupsRestoreLocale(LC_ALL, oldlocale);
-#else
-  _cupsRestoreLocale(LC_CTYPE, oldlocale);
-#endif /* __APPLE__ */
-
   DEBUG_printf(("cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"\n",
                 langname, country, charset));
 
@@ -900,66 +910,6 @@ _cupsMessageLookup(cups_array_t *a,        /* I - Message array */
 }
 
 
-/*
- * '_cupsRestoreLocale()' - Restore the original locale...
- */
-
-void
-_cupsRestoreLocale(int  category,      /* I - Category */
-                   char *oldlocale)    /* I - Old locale or NULL */
-{
-  DEBUG_printf(("_cupsRestoreLocale(category=%d, oldlocale=\"%s\")\n",
-                category, oldlocale));
-
-  if (oldlocale)
-  {
-   /*
-    * Reset the locale and free the locale string...
-    */
-
-    setlocale(category, oldlocale);
-    free(oldlocale);
-  }
-}
-
-
-/*
- * '_cupsSaveLocale()' - Set the locale and save a copy of the old locale...
- */
-
-char *                                 /* O - Old locale or NULL */
-_cupsSaveLocale(int        category,   /* I - Category */
-                const char *locale)    /* I - New locale or NULL */
-{
-  char *oldlocale;                     /* Old locale */
-
-
-  DEBUG_printf(("_cupsSaveLocale(category=%d, locale=\"%s\")\n",
-                category, locale));
-
- /*
-  * Get the old locale and copy it...
-  */
-
-  if ((oldlocale = setlocale(category, NULL)) != NULL)
-    oldlocale = strdup(oldlocale);
-
-  DEBUG_printf(("    oldlocale=\"%s\"\n", oldlocale ? oldlocale : "(null)"));
-
- /*
-  * Set the new locale...
-  */
-
-  setlocale(category, locale);
-
- /*
-  * Return a copy of the old locale...
-  */
-
-  return (oldlocale);
-}
-
-
 #ifdef __APPLE__
 /*
  * Code & data to translate OSX's language names to their ISO 639-1 locale.
@@ -1296,5 +1246,5 @@ cups_unquote(char       *d,               /* O - Unquoted string */
 
 
 /*
- * End of "$Id: language.c 5109 2006-02-15 20:11:10Z mike $".
+ * End of "$Id: language.c 5238 2006-03-07 04:41:42Z mike $".
  */
index 000766cdf3a0b34fb07b37686ce523482b3717ec..bcf6d564b7aa1277f6a5790b61682a74ff45e5fa 100644 (file)
@@ -1,21 +1,27 @@
-_cups_hstrerror
-_cups_md5_append
-_cups_md5_finish
-_cups_md5_init
-_cups_strlcat
-_cups_strlcpy
+_cupsAdminGetServerSettings
+_cupsAdminSetServerSettings
+_cupsCharmapFlush
 _cupsEncodingName
 _cupsGetPassword
 _cupsGlobals
+_cupsLangFlush
 _cupsLangPrintf
 _cupsLangPuts
 _cupsLangString
+_cupsMD5Append
+_cupsMD5Finish
+_cupsMD5Init
 _cupsMessageFree
 _cupsMessageLoad
 _cupsMessageLookup
-_cupsRestoreLocale
-_cupsSaveLocale
-_httpReadCDSA
-_httpWriteCDSA
-_ipp_add_attr
-_ipp_free_attr
+_cupsNormalizeMapsFlush
+_cupsSetError
+_cupsStrAlloc
+_cups_strcpy
+_cupsStrFlush
+_cupsStrFree
+_cups_strlcat
+_cups_strlcpy
+_cupsStrStatistics
+_ippAddAttr
+_ippFreeAttr
index bb29bcbcfceac78eb56cb8422b11fbbf9d98099c..5cbac1b76cbf786acf9f9ee124d89c1494cece72 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: mark.c 5190 2006-02-27 02:42:07Z mike $"
+ * "$Id: mark.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   Option marking routines for the Common UNIX Printing System (CUPS).
  *
@@ -323,6 +323,7 @@ ppdMarkOption(ppd_file_t *ppd,              /* I - PPD file record */
   int          i, j;                   /* Looping vars */
   ppd_option_t *o;                     /* Option pointer */
   ppd_choice_t *c;                     /* Choice pointer */
+  struct lconv *loc;                   /* Locale data */
 
 
   DEBUG_printf(("ppdMarkOption(ppd=%p, option=\"%s\", choice=\"%s\")\n",
@@ -354,6 +355,7 @@ ppdMarkOption(ppd_file_t *ppd,              /* I - PPD file record */
   if ((o = ppdFindOption(ppd, option)) == NULL)
     return (0);
 
+  loc = localeconv();
 
   if (!strncasecmp(choice, "Custom.", 7))
   {
@@ -380,7 +382,7 @@ ppdMarkOption(ppd_file_t *ppd,              /* I - PPD file record */
 
       ppd_coption_t    *coption;       /* Custom option */
       ppd_cparam_t     *cparam;        /* Custom parameter */
-      char             units[33];      /* Custom points units */
+      char             *units;         /* Custom points units */
 
       if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
       {
@@ -392,24 +394,27 @@ ppdMarkOption(ppd_file_t *ppd,            /* I - PPD file record */
          case PPD_CUSTOM_CURVE :
          case PPD_CUSTOM_INVCURVE :
          case PPD_CUSTOM_REAL :
-             cparam->current.custom_real = atof(choice + 7);
+             cparam->current.custom_real = _cupsStrScand(choice + 7, NULL,
+                                                         loc);
              break;
 
          case PPD_CUSTOM_POINTS :
-             if (sscanf(choice + 7, "%f%s", &(cparam->current.custom_points),
-                        units) < 2)
-               strcpy(units, "pt");
-
-              if (!strcasecmp(units, "cm"))
-               cparam->current.custom_points *= 72.0 / 2.54;         
-              else if (!strcasecmp(units, "mm"))
-               cparam->current.custom_points *= 72.0 / 25.4;         
-              else if (!strcasecmp(units, "m"))
-               cparam->current.custom_points *= 72.0 / 0.0254;       
-              else if (!strcasecmp(units, "in"))
-               cparam->current.custom_points *= 72.0;        
-              else if (!strcasecmp(units, "ft"))
-               cparam->current.custom_points *= 12 * 72.0;           
+             cparam->current.custom_points = _cupsStrScand(choice + 7,
+                                                           &units, loc);
+
+              if (units)
+             {
+               if (!strcasecmp(units, "cm"))
+                 cparam->current.custom_points *= 72.0 / 2.54;       
+               else if (!strcasecmp(units, "mm"))
+                 cparam->current.custom_points *= 72.0 / 25.4;       
+               else if (!strcasecmp(units, "m"))
+                 cparam->current.custom_points *= 72.0 / 0.0254;             
+               else if (!strcasecmp(units, "in"))
+                 cparam->current.custom_points *= 72.0;              
+               else if (!strcasecmp(units, "ft"))
+                 cparam->current.custom_points *= 12 * 72.0;         
+              }
              break;
 
          case PPD_CUSTOM_INT :
@@ -436,7 +441,7 @@ ppdMarkOption(ppd_file_t *ppd,              /* I - PPD file record */
 
     ppd_coption_t      *coption;       /* Custom option */
     ppd_cparam_t       *cparam;        /* Custom parameter */
-    char               units[33];      /* Custom points units */
+    char               *units;         /* Custom points units */
     int                        num_vals;       /* Number of values */
     cups_option_t      *vals,          /* Values */
                        *val;           /* Value */
@@ -459,24 +464,27 @@ ppdMarkOption(ppd_file_t *ppd,            /* I - PPD file record */
          case PPD_CUSTOM_CURVE :
          case PPD_CUSTOM_INVCURVE :
          case PPD_CUSTOM_REAL :
-             cparam->current.custom_real = atof(val->value);
+             cparam->current.custom_real = _cupsStrScand(val->value, NULL,
+                                                         loc);
              break;
 
          case PPD_CUSTOM_POINTS :
-             if (sscanf(val->value, "%f%s", &(cparam->current.custom_points),
-                        units) < 2)
-               strcpy(units, "pt");
-
-              if (!strcasecmp(units, "cm"))
-               cparam->current.custom_points *= 72.0 / 2.54;         
-              else if (!strcasecmp(units, "mm"))
-               cparam->current.custom_points *= 72.0 / 25.4;         
-              else if (!strcasecmp(units, "m"))
-               cparam->current.custom_points *= 72.0 / 0.0254;       
-              else if (!strcasecmp(units, "in"))
-               cparam->current.custom_points *= 72.0;        
-              else if (!strcasecmp(units, "ft"))
-               cparam->current.custom_points *= 12 * 72.0;           
+             cparam->current.custom_points = _cupsStrScand(val->value, &units,
+                                                           loc);
+
+             if (units)
+             {
+               if (!strcasecmp(units, "cm"))
+                 cparam->current.custom_points *= 72.0 / 2.54;       
+               else if (!strcasecmp(units, "mm"))
+                 cparam->current.custom_points *= 72.0 / 25.4;       
+               else if (!strcasecmp(units, "m"))
+                 cparam->current.custom_points *= 72.0 / 0.0254;             
+               else if (!strcasecmp(units, "in"))
+                 cparam->current.custom_points *= 72.0;              
+               else if (!strcasecmp(units, "ft"))
+                 cparam->current.custom_points *= 12 * 72.0;         
+             }
              break;
 
          case PPD_CUSTOM_INT :
@@ -648,5 +656,5 @@ ppd_defaults(ppd_file_t  *ppd,      /* I - PPD file */
 
 
 /*
- * End of "$Id: mark.c 5190 2006-02-27 02:42:07Z mike $".
+ * End of "$Id: mark.c 5238 2006-03-07 04:41:42Z mike $".
  */
index d4770ccd17662166374277207146d1e24a7bcc0f..4284ad4ab6e54b9d5b1f78b492b9913bdb91d481 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: md5-apple.h 4695 2005-09-23 17:07:14Z mike $"
+ * "$Id: md5-apple.h 5232 2006-03-05 17:59:19Z mike $"
  *
  *   MD5 MacOS X compatibility header for the Common UNIX Printing
  *   System (CUPS).
  */
 
 void md5_init(_cups_md5_state_t *pms)
-     { _cups_md5_init(pms); }
+     { _cupsMD5Init(pms); }
 void md5_append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
-     { _cups_md5_append(pms, data, nbytes); }
+     { _cupsMD5Append(pms, data, nbytes); }
 void md5_finish(_cups_md5_state_t *pms, unsigned char digest[16])
-     { _cups_md5_finish(pms, digest); }
+     { _cupsMD5Finish(pms, digest); }
 
 /*
- * End of "$Id: md5-apple.h 4695 2005-09-23 17:07:14Z mike $".
+ * End of "$Id: md5-apple.h 5232 2006-03-05 17:59:19Z mike $".
  */
index a0469408ce2c102c1443ed0390880a3272ad8a87..9a3fab987cd1c79e8cb792e5c7b0e0cd8c5c69f7 100644 (file)
@@ -26,7 +26,7 @@
   ghost@aladdin.com
 
  */
-/*$Id: md5.c 4695 2005-09-23 17:07:14Z mike $ */
+/*$Id: md5.c 5232 2006-03-05 17:59:19Z mike $ */
 /*
   Independent implementation of MD5 (RFC 1321).
 
@@ -273,7 +273,7 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
 }
 
 void
-_cups_md5_init(_cups_md5_state_t *pms)
+_cupsMD5Init(_cups_md5_state_t *pms)
 {
     pms->count[0] = pms->count[1] = 0;
     pms->abcd[0] = 0x67452301;
@@ -283,7 +283,7 @@ _cups_md5_init(_cups_md5_state_t *pms)
 }
 
 void
-_cups_md5_append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
+_cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
 {
     const unsigned char *p = data;
     int left = nbytes;
@@ -321,7 +321,7 @@ _cups_md5_append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
 }
 
 void
-_cups_md5_finish(_cups_md5_state_t *pms, unsigned char digest[16])
+_cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16])
 {
     static const unsigned char pad[64] = {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -336,9 +336,9 @@ _cups_md5_finish(_cups_md5_state_t *pms, unsigned char digest[16])
     for (i = 0; i < 8; ++i)
        data[i] = (unsigned char)(pms->count[i >> 2] >> ((i & 3) << 3));
     /* Pad to 56 bytes mod 64. */
-    _cups_md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+    _cupsMD5Append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
     /* Append the length. */
-    _cups_md5_append(pms, data, 8);
+    _cupsMD5Append(pms, data, 8);
     for (i = 0; i < 16; ++i)
        digest[i] = (unsigned char)(pms->abcd[i >> 2] >> ((i & 3) << 3));
 }
index 72b338b504a293cb8241979e10dffef85ea569a3..3b0281c0f5e25e9f0eb033638cfa92639c32603b 100644 (file)
@@ -26,7 +26,7 @@
   ghost@aladdin.com
 
  */
-/*$Id: md5.h 4512 2005-05-12 19:47:56Z mike $ */
+/*$Id: md5.h 5232 2006-03-05 17:59:19Z mike $ */
 /*
   Independent implementation of MD5 (RFC 1321).
 
@@ -60,13 +60,13 @@ extern "C" {
 #  endif /* __cplusplus */
 
 /* Initialize the algorithm. */
-void _cups_md5_init(_cups_md5_state_t *pms);
+void _cupsMD5Init(_cups_md5_state_t *pms);
 
 /* Append a string to the message. */
-void _cups_md5_append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes);
+void _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes);
 
 /* Finish the message and return the digest. */
-void _cups_md5_finish(_cups_md5_state_t *pms, unsigned char digest[16]);
+void _cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16]);
 
 #  ifdef __cplusplus
 }  /* end extern "C" */
index 1b9029a29507ca060cbffd5d1109d251d868ca55..df8a75881088345e0e1a53098489d209c2ae4fb1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: md5passwd.c 4828 2005-11-11 12:53:38Z mike $"
+ * "$Id: md5passwd.c 5232 2006-03-05 17:59:19Z mike $"
  *
  *   MD5 password support for the Common UNIX Printing System (CUPS).
  *
@@ -59,9 +59,9 @@ httpMD5(const char *username,         /* I - User name */
   */
 
   snprintf(line, sizeof(line), "%s:%s:%s", username, realm, passwd);
-  _cups_md5_init(&state);
-  _cups_md5_append(&state, (unsigned char *)line, (int)strlen(line));
-  _cups_md5_finish(&state, sum);
+  _cupsMD5Init(&state);
+  _cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
+  _cupsMD5Finish(&state, sum);
 
  /*
   * Return the sum...
@@ -94,9 +94,9 @@ httpMD5Final(const char *nonce,               /* I - Server nonce value */
   */
 
   snprintf(line, sizeof(line), "%s:%s", method, resource);
-  _cups_md5_init(&state);
-  _cups_md5_append(&state, (unsigned char *)line, (int)strlen(line));
-  _cups_md5_finish(&state, sum);
+  _cupsMD5Init(&state);
+  _cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
+  _cupsMD5Finish(&state, sum);
   httpMD5String(sum, a2);
 
  /*
@@ -107,9 +107,9 @@ httpMD5Final(const char *nonce,             /* I - Server nonce value */
 
   snprintf(line, sizeof(line), "%s:%s:%s", md5, nonce, a2);
 
-  _cups_md5_init(&state);
-  _cups_md5_append(&state, (unsigned char *)line, (int)strlen(line));
-  _cups_md5_finish(&state, sum);
+  _cupsMD5Init(&state);
+  _cupsMD5Append(&state, (unsigned char *)line, (int)strlen(line));
+  _cupsMD5Finish(&state, sum);
 
   return (httpMD5String(sum, md5));
 }
@@ -147,5 +147,5 @@ httpMD5String(const unsigned char *sum,     /* I - MD5 sum data */
 
 
 /*
- * End of "$Id: md5passwd.c 4828 2005-11-11 12:53:38Z mike $".
+ * End of "$Id: md5passwd.c 5232 2006-03-05 17:59:19Z mike $".
  */
index 0c340297a39d82a17d4067d09ed1fbd64f886e32..f9ac4ef852b51668826d815325f0716b79b9bfca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: page.c 4494 2005-02-18 02:18:11Z mike $"
+ * "$Id: page.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   Page size functions for the Common UNIX Printing System (CUPS).
  *
  * 'ppdPageSize()' - Get the page size record for the given size.
  */
 
-ppd_size_t *                   /* O - Size record for page or NULL */
-ppdPageSize(ppd_file_t *ppd,   /* I - PPD file record */
-            const char *name)  /* I - Size name */
+ppd_size_t *                           /* O - Size record for page or NULL */
+ppdPageSize(ppd_file_t *ppd,           /* I - PPD file record */
+            const char *name)          /* I - Size name */
 {
-  int  i;                      /* Looping var */
-  float        w, l;                   /* Width and length of page */
-  char units[255];             /* Page size units... */
+  int          i;                      /* Looping var */
+  float                w, l;                   /* Width and length of page */
+  char         *nameptr;               /* Pointer into name */
+  struct lconv *loc;                   /* Locale data */
 
 
-  if (ppd == NULL)
+  if (!ppd)
     return (NULL);
 
-  if (name != NULL)
+  if (name)
   {
-    if (strncmp(name, "Custom.", 7) == 0 && ppd->variable_sizes)
+    if (!strncmp(name, "Custom.", 7) && ppd->variable_sizes)
     {
      /*
       * Find the custom page size...
       */
 
       for (i = 0; i < ppd->num_sizes; i ++)
-       if (strcmp("Custom", ppd->sizes[i].name) == 0)
+       if (!strcmp("Custom", ppd->sizes[i].name))
           break;
 
       if (i == ppd->num_sizes)
@@ -81,11 +82,16 @@ ppdPageSize(ppd_file_t *ppd,        /* I - PPD file record */
       *    Custom.WIDTHxLENGTH[pt]  - Size in points
       */
 
-      units[0] = '\0';
-      if (sscanf(name + 7, "%fx%f%254s", &w, &l, units) < 2)
+      loc = localeconv();
+      w   = _cupsStrScand(name + 7, &nameptr, loc);
+      if (!nameptr || *nameptr != 'x')
         return (NULL);
 
-      if (strcasecmp(units, "in") == 0)
+      l = _cupsStrScand(nameptr, &nameptr, loc);
+      if (!nameptr)
+        return (NULL);
+
+      if (!strcasecmp(nameptr, "in"))
       {
         ppd->sizes[i].width  = w * 72.0f;
        ppd->sizes[i].length = l * 72.0f;
@@ -94,7 +100,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
        ppd->sizes[i].right  = w * 72.0f - ppd->custom_margins[2];
        ppd->sizes[i].top    = l * 72.0f - ppd->custom_margins[3];
       }
-      else if (strcasecmp(units, "cm") == 0)
+      else if (!strcasecmp(nameptr, "cm"))
       {
         ppd->sizes[i].width  = w / 2.54f * 72.0f;
        ppd->sizes[i].length = l / 2.54f * 72.0f;
@@ -103,7 +109,7 @@ ppdPageSize(ppd_file_t *ppd,        /* I - PPD file record */
        ppd->sizes[i].right  = w / 2.54f * 72.0f - ppd->custom_margins[2];
        ppd->sizes[i].top    = l / 2.54f * 72.0f - ppd->custom_margins[3];
       }
-      else if (strcasecmp(units, "mm") == 0)
+      else if (!strcasecmp(nameptr, "mm"))
       {
         ppd->sizes[i].width  = w / 25.4f * 72.0f;
        ppd->sizes[i].length = l / 25.4f * 72.0f;
@@ -131,7 +137,7 @@ ppdPageSize(ppd_file_t *ppd,        /* I - PPD file record */
       */
 
       for (i = 0; i < ppd->num_sizes; i ++)
-       if (strcmp(name, ppd->sizes[i].name) == 0)
+       if (!strcasecmp(name, ppd->sizes[i].name))
           return (ppd->sizes + i);
     }
   }
@@ -187,5 +193,5 @@ ppdPageLength(ppd_file_t *ppd,      /* I - PPD file */
 
 
 /*
- * End of "$Id: page.c 4494 2005-02-18 02:18:11Z mike $".
+ * End of "$Id: page.c 5238 2006-03-07 04:41:42Z mike $".
  */
index c131493202f49cb5eb38f2bbcdc8f9666240ce9c..f55f8865d561db38cfda828000608996e4506443 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ppd.c 5200 2006-02-28 00:10:32Z mike $"
+ * "$Id: ppd.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   PPD file routines for the Common UNIX Printing System (CUPS).
  *
@@ -393,7 +393,6 @@ ppdOpen(FILE *fp)                   /* I - File to read from */
 ppd_file_t *                           /* O - PPD file record */
 ppdOpen2(cups_file_t *fp)              /* I - File to read from */
 {
-  char                 *oldlocale;     /* Old locale settings */
   int                  i, j, k;        /* Looping vars */
   int                  count;          /* Temporary count */
   ppd_file_t           *ppd;           /* PPD file record */
@@ -420,6 +419,7 @@ ppdOpen2(cups_file_t *fp)           /* I - File to read from */
   ppd_profile_t                *profile;       /* Pointer to color profile */
   char                 **filter;       /* Pointer to filter */
   cups_lang_t          *language;      /* Default language */
+  struct lconv         *loc;           /* Locale data */
   int                  ui_keyword;     /* Is this line a UI keyword? */
   _cups_globals_t      *cg = _cupsGlobals();
                                        /* Global data */
@@ -554,12 +554,7 @@ ppdOpen2(cups_file_t *fp)          /* I - File to read from */
   */
 
   language = cupsLangDefault();
-
-#ifdef LC_NUMERIC
-  oldlocale = _cupsSaveLocale(LC_NUMERIC, "C");
-#else
-  oldlocale = _cupsSaveLocale(LC_ALL, "C");
-#endif /* LC_NUMERIC */
+  loc      = localeconv();
 
  /*
   * Read lines from the PPD file and add them to the file record...
@@ -772,13 +767,18 @@ ppdOpen2(cups_file_t *fp)         /* I - File to read from */
       memset(profile, 0, sizeof(ppd_profile_t));
       strlcpy(profile->resolution, name, sizeof(profile->resolution));
       strlcpy(profile->media_type, text, sizeof(profile->media_type));
-      sscanf(string, "%f%f%f%f%f%f%f%f%f%f%f", &(profile->density),
-            &(profile->gamma),
-            profile->matrix[0] + 0, profile->matrix[0] + 1,
-            profile->matrix[0] + 2, profile->matrix[1] + 0,
-            profile->matrix[1] + 1, profile->matrix[1] + 2,
-            profile->matrix[2] + 0, profile->matrix[2] + 1,
-            profile->matrix[2] + 2);
+
+      profile->density      = _cupsStrScand(string, &sptr, loc);
+      profile->gamma        = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[0][0] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[0][1] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[0][2] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[1][0] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[1][1] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[1][2] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[2][0] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[2][1] = _cupsStrScand(sptr, &sptr, loc);
+      profile->matrix[2][2] = _cupsStrScand(sptr, &sptr, loc);
     }
     else if (!strcmp(keyword, "cupsFilter"))
     {
@@ -877,8 +877,8 @@ ppdOpen2(cups_file_t *fp)           /* I - File to read from */
       if (!strcmp(ctype, "curve"))
       {
         cparam->type = PPD_CUSTOM_CURVE;
-       cparam->minimum.custom_curve = atof(cminimum);
-       cparam->maximum.custom_curve = atof(cmaximum);
+       cparam->minimum.custom_curve = _cupsStrScand(cminimum, NULL, loc);
+       cparam->maximum.custom_curve = _cupsStrScand(cmaximum, NULL, loc);
       }
       else if (!strcmp(ctype, "int"))
       {
@@ -889,8 +889,8 @@ ppdOpen2(cups_file_t *fp)           /* I - File to read from */
       else if (!strcmp(ctype, "invcurve"))
       {
         cparam->type = PPD_CUSTOM_INVCURVE;
-       cparam->minimum.custom_invcurve = atof(cminimum);
-       cparam->maximum.custom_invcurve = atof(cmaximum);
+       cparam->minimum.custom_invcurve = _cupsStrScand(cminimum, NULL, loc);
+       cparam->maximum.custom_invcurve = _cupsStrScand(cmaximum, NULL, loc);
       }
       else if (!strcmp(ctype, "passcode"))
       {
@@ -907,14 +907,14 @@ ppdOpen2(cups_file_t *fp)         /* I - File to read from */
       else if (!strcmp(ctype, "points"))
       {
         cparam->type = PPD_CUSTOM_POINTS;
-       cparam->minimum.custom_points = atof(cminimum);
-       cparam->maximum.custom_points = atof(cmaximum);
+       cparam->minimum.custom_points = _cupsStrScand(cminimum, NULL, loc);
+       cparam->maximum.custom_points = _cupsStrScand(cmaximum, NULL, loc);
       }
       else if (!strcmp(ctype, "real"))
       {
         cparam->type = PPD_CUSTOM_REAL;
-       cparam->minimum.custom_real = atof(cminimum);
-       cparam->maximum.custom_real = atof(cmaximum);
+       cparam->minimum.custom_real = _cupsStrScand(cminimum, NULL, loc);
+       cparam->maximum.custom_real = _cupsStrScand(cmaximum, NULL, loc);
       }
       else if (!strcmp(ctype, "string"))
       {
@@ -948,9 +948,10 @@ ppdOpen2(cups_file_t *fp)          /* I - File to read from */
       }
     }
     else if (!strcmp(keyword, "HWMargins"))
-      sscanf(string, "%f%f%f%f", ppd->custom_margins + 0,
-             ppd->custom_margins + 1, ppd->custom_margins + 2,
-             ppd->custom_margins + 3);
+    {
+      for (i = 0, sptr = string; i < 4; i ++)
+        ppd->custom_margins[i] = _cupsStrScand(sptr, &sptr, loc);
+    }
     else if (!strncmp(keyword, "Custom", 6) && !strcmp(name, "True"))
     {
       ppd_coption_t    *coption;       /* Custom option */
@@ -1344,7 +1345,9 @@ ppdOpen2(cups_file_t *fp)         /* I - File to read from */
     else if (!strcmp(keyword, "OrderDependency") ||
              !strcmp(keyword, "NonUIOrderDependency"))
     {
-      if (sscanf(string, "%f%40s%40s", &order, name, keyword) != 3)
+      order = _cupsStrScand(string, &sptr, loc);
+
+      if (!sptr || sscanf(sptr, "%40s%40s", name, keyword) != 2)
       {
         cg->ppd_status = PPD_BAD_ORDER_DEPENDENCY;
 
@@ -1560,7 +1563,8 @@ ppdOpen2(cups_file_t *fp)         /* I - File to read from */
        goto error;
       }
 
-      sscanf(string, "%f%f", &(size->width), &(size->length));
+      size->width  = _cupsStrScand(string, &sptr, loc);
+      size->length = _cupsStrScand(sptr, NULL, loc);
 
       ppd_free(string);
       string = NULL;
@@ -1581,8 +1585,10 @@ ppdOpen2(cups_file_t *fp)                /* I - File to read from */
        goto error;
       }
 
-      sscanf(string, "%f%f%f%f", &(size->left), &(size->bottom),
-            &(size->right), &(size->top));
+      size->left   = _cupsStrScand(string, &sptr, loc);
+      size->bottom = _cupsStrScand(sptr, &sptr, loc);
+      size->right  = _cupsStrScand(sptr, &sptr, loc);
+      size->top    = _cupsStrScand(sptr, NULL, loc);
 
       ppd_free(string);
       string = NULL;
@@ -1643,12 +1649,6 @@ ppdOpen2(cups_file_t *fp)                /* I - File to read from */
 
   cupsLangFree(language);
 
-#ifdef LC_NUMERIC
-  _cupsRestoreLocale(LC_NUMERIC, oldlocale);
-#else
-  _cupsRestoreLocale(LC_ALL, oldlocale);
-#endif /* LC_NUMERIC */
-
 #ifdef DEBUG
   if (!feof(fp))
     printf("Premature EOF at %lu...\n", (unsigned long)ftell(fp));
@@ -1711,12 +1711,6 @@ ppdOpen2(cups_file_t *fp)                /* I - File to read from */
 
   cupsLangFree(language);
 
-#ifdef LC_NUMERIC
-  _cupsRestoreLocale(LC_NUMERIC, oldlocale);
-#else
-  _cupsRestoreLocale(LC_ALL, oldlocale);
-#endif /* LC_NUMERIC */
-
   return (NULL);
 }
 
@@ -2885,5 +2879,5 @@ ppd_read(cups_file_t    *fp,              /* I - File to read from */
 
 
 /*
- * End of "$Id: ppd.c 5200 2006-02-28 00:10:32Z mike $".
+ * End of "$Id: ppd.c 5238 2006-03-07 04:41:42Z mike $".
  */
index 2ec40c21ff7acaba0ed561fc9969ace1ab710356..d7688c3d5239f6deb93f739a8086257780a03701 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ppd.h 5190 2006-02-27 02:42:07Z mike $"
+ * "$Id: ppd.h 5238 2006-03-07 04:41:42Z mike $"
  *
  *   PostScript Printer Description definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -381,6 +381,8 @@ extern int          ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp,
                                          ppd_section_t section, int limit,
                                          float min_order);
 extern int             ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp);
+extern char            *ppdEmitString(ppd_file_t *ppd, ppd_section_t section,
+                                      float min_order);
 extern ppd_coption_t   *ppdFindCustomOption(ppd_file_t *ppd,
                                             const char *keyword);
 extern ppd_cparam_t    *ppdFindCustomParam(ppd_coption_t *opt,
@@ -403,5 +405,5 @@ extern ppd_file_t   *ppdOpen2(cups_file_t *fp);
 #endif /* !_CUPS_PPD_H_ */
 
 /*
- * End of "$Id: ppd.h 5190 2006-02-27 02:42:07Z mike $".
+ * End of "$Id: ppd.h 5238 2006-03-07 04:41:42Z mike $".
  */
index b30c77075edd64d85a953b34b8ade26378f54c67..b92773da320bc8f92456958a12bd0a4df7712976 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: string.c 5047 2006-02-02 05:14:15Z mike $"
+ * "$Id: string.c 5238 2006-03-07 04:41:42Z mike $"
  *
  *   String functions for the Common UNIX Printing System (CUPS).
  *
  *
  * Contents:
  *
- *   _cups_sp_alloc()      - Allocate/reference a string.
- *   _cups_sp_flush()      - Flush the string pool...
- *   _cups_sp_free()       - Free/dereference a string.
- *   _cups_sp_statistics() - Return allocation statistics for string pool.
+ *   _cupsStrAlloc()       - Allocate/reference a string.
+ *   _cupsStrFlush()       - Flush the string pool...
+ *   _cupsStrFormatd()     - Format a floating-point number.
+ *   _cupsStrFree()        - Free/dereference a string.
+ *   _cupsStrScand()       - Scan a string for a floating-point number.
+ *   _cupsStrStatistics()  - Return allocation statistics for string pool.
  *   _cups_strcpy()        - Copy a string allowing for overlapping strings.
  *   _cups_strdup()        - Duplicate a string.
  *   _cups_strcasecmp()    - Do a case-insensitive comparison.
@@ -57,11 +59,11 @@ static int  compare_sp_items(_cups_sp_item_t *a, _cups_sp_item_t *b);
 
 
 /*
- * '_cups_sp_alloc()' - Allocate/reference a string.
+ * '_cupsStrAlloc()' - Allocate/reference a string.
  */
 
 char *                                 /* O - String pointer */
-_cups_sp_alloc(const char *s)          /* I - String */
+_cupsStrAlloc(const char *s)           /* I - String */
 {
   _cups_globals_t      *cg;            /* Global data */
   _cups_sp_item_t      *item,          /* String pool item */
@@ -132,11 +134,11 @@ _cups_sp_alloc(const char *s)             /* I - String */
 
 
 /*
- * '_cups_sp_flush()' - Flush the string pool...
+ * '_cupsStrFlush()' - Flush the string pool...
  */
 
 void
-_cups_sp_flush(_cups_globals_t *cg)    /* I - Global data */
+_cupsStrFlush(_cups_globals_t *cg)     /* I - Global data */
 {
   _cups_sp_item_t      *item;          /* Current item */
 
@@ -154,11 +156,91 @@ _cups_sp_flush(_cups_globals_t *cg)       /* I - Global data */
 
 
 /*
- * '_cups_sp_free()' - Free/dereference a string.
+ * '_cupsStrFormatd()' - Format a floating-point number.
+ */
+
+char *                                 /* O - Pointer to end of string */
+_cupsStrFormatd(char         *buf,     /* I - String */
+                char         *bufend,  /* I - End of string buffer */
+               double       number,    /* I - Number to format */
+                struct lconv *loc)     /* I - Locale data */
+{
+  char         *bufptr,                /* Pointer into buffer */
+               temp[1024],             /* Temporary string */
+               *tempdec,               /* Pointer to decimal point */
+               *tempptr;               /* Pointer into temporary string */
+  const char   *dec;                   /* Decimal point */
+  int          declen;                 /* Length of decimal point */
+
+
+ /*
+  * Format the number using the "%.12f" format and then eliminate
+  * unnecessary trailing 0's.
+  */
+
+  snprintf(temp, sizeof(temp), "%.12f", number);
+  for (tempptr = temp + strlen(temp) - 1;
+       tempptr > temp && *tempptr == '0';
+       *tempptr-- = '\0');
+
+ /*
+  * Next, find the decimal point...
+  */
+
+  if (loc && loc->decimal_point)
+  {
+    dec    = loc->decimal_point;
+    declen = strlen(dec);
+  }
+  else
+  {
+    dec    = ".";
+    declen = 1;
+  }
+
+  if (declen == 1)
+    tempdec = strchr(temp, *dec);
+  else
+    tempdec = strstr(temp, dec);
+
+ /*
+  * Copy everything up to the decimal point...
+  */
+
+  if (tempdec)
+  {
+    for (tempptr = temp, bufptr = buf;
+         tempptr < tempdec && bufptr < bufend;
+        *bufptr++ = *tempptr++);
+
+    tempdec += declen;
+
+    if (*tempdec && bufptr < bufend)
+    {
+      *bufptr++ = '.';
+
+      while (*tempptr && bufptr < bufend)
+        *bufptr++ = *tempptr++;
+    }
+
+    *bufptr = '\0';
+  }
+  else
+  {
+    strlcpy(buf, temp, bufend - buf + 1);
+    bufptr = buf + strlen(buf);
+  }
+
+  return (bufptr);
+}
+
+
+/*
+ * '_cupsStrFree()' - Free/dereference a string.
  */
 
 void
-_cups_sp_free(const char *s)
+_cupsStrFree(const char *s)            /* I - String to free */
 {
   _cups_globals_t      *cg;            /* Global data */
   _cups_sp_item_t      *item,          /* String pool item */
@@ -211,12 +293,103 @@ _cups_sp_free(const char *s)
 
 
 /*
- * '_cups_sp_statistics()' - Return allocation statistics for string pool.
+ * '_cupsStrScand()' - Scan a string for a floating-point number.
+ *
+ * This function handles the locale-specific BS so that a decimal
+ * point is always the period (".")...
+ */
+
+double                                 /* O - Number */
+_cupsStrScand(const char   *buf,       /* I - Pointer to number */
+              char         **bufptr,   /* O - New pointer or NULL on error */
+              struct lconv *loc)       /* I - Locale data */
+{
+  char temp[1024],                     /* Temporary buffer */
+       *tempptr;                       /* Pointer into temporary buffer */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!buf)
+    return (0.0);
+
+ /*
+  * Skip leading whitespace...
+  */
+
+  while (isspace(*buf & 255))
+    buf ++;
+
+ /*
+  * Copy leading sign, numbers, period, and then numbers...
+  */
+
+  tempptr = temp;
+  if (*buf == '-' || *buf == '+')
+    *tempptr++ = *buf++;
+
+  while (isdigit(*buf & 255))
+    if (tempptr < (temp + sizeof(temp) - 1))
+      *tempptr++ = *buf++;
+    else
+    {
+      if (bufptr)
+       *bufptr = NULL;
+
+      return (0.0);
+    }
+
+  if (*buf == '.')
+  {
+    if (loc && loc->decimal_point)
+    {
+      strlcpy(tempptr, loc->decimal_point, sizeof(temp) - (tempptr - temp));
+      tempptr += strlen(tempptr);
+    }
+    else if (tempptr < (temp + sizeof(temp) - 1))
+      *tempptr++ = '.';
+    else
+    {
+      if (bufptr)
+        *bufptr = NULL;
+
+      return (0.0);
+    }
+
+    while (isdigit(*buf & 255))
+      if (tempptr < (temp + sizeof(temp) - 1))
+       *tempptr++ = *buf++;
+      else
+      {
+       if (bufptr)
+         *bufptr = NULL;
+
+       return (0.0);
+      }
+  }
+
+ /*
+  * Nul-terminate the temporary string and return the value...
+  */
+
+  if (bufptr)
+    *bufptr = (char *)buf;
+
+  *tempptr = '\0';
+
+  return (strtod(temp, NULL));
+}
+
+
+/*
+ * '_cupsStrStatistics()' - Return allocation statistics for string pool.
  */
 
 size_t                                 /* O - Number of strings */
-_cups_sp_statistics(size_t *alloc_bytes,/* O - Allocated bytes */
-                    size_t *total_bytes)/* O - Total string bytes */
+_cupsStrStatistics(size_t *alloc_bytes,        /* O - Allocated bytes */
+                   size_t *total_bytes)        /* O - Total string bytes */
 {
   size_t               count,          /* Number of strings */
                        abytes,         /* Allocated string bytes */
@@ -455,5 +628,5 @@ compare_sp_items(_cups_sp_item_t *a,        /* I - First item */
 
 
 /*
- * End of "$Id: string.c 5047 2006-02-02 05:14:15Z mike $".
+ * End of "$Id: string.c 5238 2006-03-07 04:41:42Z mike $".
  */
index 124cc7edea70e88652266d816f72a23e85ac79c4..1cec6aeecd02751bdbfc2deaddedacc79ed37a1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: string.h 5047 2006-02-02 05:14:15Z mike $"
+ * "$Id: string.h 5238 2006-03-07 04:41:42Z mike $"
  *
  *   String definitions for the Common UNIX Printing System (CUPS).
  *
@@ -36,6 +36,7 @@
 #  include <stdio.h>
 #  include <stdarg.h>
 #  include <ctype.h>
+#  include <locale.h>
 
 #  ifdef HAVE_STRING_H
 #    include <string.h>
@@ -129,9 +130,19 @@ extern int _cups_vsnprintf(char *, size_t, const char *, va_list);
  * String pool functions...
  */
 
-extern char    *_cups_sp_alloc(const char *s);
-extern void    _cups_sp_free(const char *s);
-extern size_t  _cups_sp_statistics(size_t *alloc_bytes, size_t *total_bytes);
+extern char    *_cupsStrAlloc(const char *s);
+extern void    _cupsStrFree(const char *s);
+extern size_t  _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
+
+
+/*
+ * Floating point number functions...
+ */
+
+extern char    *_cupsStrFormatd(char *buf, char *bufend, double number,
+                                struct lconv *loc);
+extern double  _cupsStrScand(const char *buf, char **bufptr,
+                             struct lconv *loc);
 
 
 /*
@@ -145,5 +156,5 @@ extern size_t       _cups_sp_statistics(size_t *alloc_bytes, size_t *total_bytes);
 #endif /* !_CUPS_STRING_H_ */
 
 /*
- * End of "$Id: string.h 5047 2006-02-02 05:14:15Z mike $".
+ * End of "$Id: string.h 5238 2006-03-07 04:41:42Z mike $".
  */
diff --git a/cups/testadmin.c b/cups/testadmin.c
new file mode 100644 (file)
index 0000000..0f2e1d0
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * "$Id: testadmin.c 5240 2006-03-07 21:55:29Z mike $"
+ *
+ *   Admin function test program for the Common UNIX Printing System (CUPS).
+ *
+ *   Copyright 2006 by Easy Software Products.
+ *
+ *   These coded instructions, statements, and computer programs are the
+ *   property of Easy Software Products and are protected by Federal
+ *   copyright law.  Distribution and use rights are outlined in the file
+ *   "LICENSE.txt" which should have been included with this file.  If this
+ *   file is missing or damaged please contact Easy Software Products
+ *   at:
+ *
+ *       Attn: CUPS Licensing Information
+ *       Easy Software Products
+ *       44141 Airport View Drive, Suite 204
+ *       Hollywood, Maryland 20636 USA
+ *
+ *       Voice: (301) 373-9600
+ *       EMail: cups-info@cups.org
+ *         WWW: http://www.cups.org
+ *
+ *   This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Contents:
+ *
+ *   main()          - Main entry.
+ *   show_settings() - Show settings in the array...
+ */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "adminutil.h"
+#include "string.h"
+
+
+/*
+ * Local functions...
+ */
+
+static void    show_settings(int num_settings, cups_option_t *settings);
+
+
+/*
+ * 'main()' - Main entry.
+ */
+
+int                                    /* O - Exit status */
+main(int  argc,                                /* I - Number of command-line args */
+     char *argv[])                     /* I - Command-line arguments */
+{
+  int          i,                      /* Looping var */
+               num_settings;           /* Number of settings */
+  cups_option_t        *settings;              /* Settings */
+  http_t       *http;                  /* Connection to server */
+
+
+ /*
+  * Connect to the server using the defaults...
+  */
+
+  http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
+
+ /*
+  * Set the current configuration if we have anything on the command-line...
+  */
+
+  if (argc > 1)
+  {
+    for (i = 1, num_settings = 0; i < argc; i ++)
+      num_settings = cupsParseOptions(argv[i], num_settings, &settings);
+
+    if (_cupsAdminSetServerSettings(http, num_settings, settings))
+    {
+      puts("New server settings:");
+      cupsFreeOptions(num_settings, settings);
+    }
+    else
+    {
+      printf("Server settings not changed: %s\n", cupsLastErrorString());
+      return (1);
+    }
+  }
+  else
+    puts("Current server settings:");
+
+ /*
+  * Get the current configuration...
+  */
+
+  if (_cupsAdminGetServerSettings(http, &num_settings, &settings))
+  {
+    show_settings(num_settings, settings);
+    cupsFreeOptions(num_settings, settings);
+    return (0);
+  }
+  else
+  {
+    printf("    %s\n", cupsLastErrorString());
+    return (1);
+  }
+}
+
+
+/*
+ * 'show_settings()' - Show settings in the array...
+ */
+
+static void
+show_settings(
+    int           num_settings,                /* I - Number of settings */
+    cups_option_t *settings)           /* I - Settings */
+{
+  while (num_settings > 0)
+  {
+    printf("    %s=%s\n", settings->name, settings->value);
+
+    settings ++;
+    num_settings --;
+  }
+}
+
+
+/*
+ * End of "$Id: testadmin.c 5240 2006-03-07 21:55:29Z mike $".
+ */
index 71b8709f9a448c28057e2ee533425f71df18bcd1..3fcffc65910d82f7e0e4183821379e6ecd00bbbb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: testhttp.c 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: testhttp.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   HTTP test program for the Common UNIX Printing System (CUPS).
  *
@@ -290,7 +290,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
     fputs("httpGetHostname(): ", stdout);
 
-    if (httpGetHostname(hostname, sizeof(hostname)))
+    if (httpGetHostname(NULL, hostname, sizeof(hostname)))
       printf("PASS (%s)\n", hostname);
     else
     {
@@ -515,5 +515,5 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: testhttp.c 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: testhttp.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 5a018b66f1c9fbec16ce6889358610f5a2ef27f4..aea6055a29de7a27c4a6bd4642ff8a0413cf30f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: util.c 5165 2006-02-24 21:20:30Z mike $"
+ * "$Id: util.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Printing utilities for the Common UNIX Printing System (CUPS).
  *
@@ -839,7 +839,7 @@ cupsGetPPD2(http_t     *http,               /* I - HTTP connection */
   * Remap local hostname to localhost...
   */
 
-  httpGetHostname(localhost, sizeof(localhost));
+  httpGetHostname(NULL, localhost, sizeof(localhost));
 
   if (!strcasecmp(localhost, hostname))
     strcpy(hostname, "localhost");
@@ -1641,5 +1641,5 @@ cups_get_printer_uri(
 
 
 /*
- * End of "$Id: util.c 5165 2006-02-24 21:20:30Z mike $".
+ * End of "$Id: util.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 88c344f258e0f876097c2b5e726547878e7dddfd..6910a11432ccdb06f5f2c1c20b1de5e78ea9933d 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5085 2006-02-06 13:27:53Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Datafile makefile for the Common UNIX Printing System (CUPS).
 #
@@ -133,6 +133,13 @@ all:
 clean:
 
 
+#
+# Dummy depend...
+#
+
+depend:
+
+
 #
 # Install files...
 #
@@ -158,5 +165,30 @@ install:   all
 
 
 #
-# End of "$Id: Makefile 5085 2006-02-06 13:27:53Z mike $".
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(BANNERS); do \
+               $(RM) $(DATADIR)/banners/$$file; \
+       done
+       for file in $(CHARMAPS); do \
+               $(RM) $(DATADIR)/charmaps/$$file; \
+       done
+       for file in $(CHARSETS); do \
+               $(RM) $(DATADIR)/charsets/$$file; \
+       done
+       for file in $(DATAFILES); do \
+               $(RM) $(DATADIR)/data/$$file; \
+       done
+       -$(RMDIR) $(DATADIR)/profiles
+       -$(RMDIR) $(DATADIR)/data
+       -$(RMDIR) $(DATADIR)/charsets
+       -$(RMDIR) $(DATADIR)/charmaps
+       -$(RMDIR) $(DATADIR)/banners
+       -$(RMDIR) $(DATADIR)
+
+
+#
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index ddfe235a331ddb02824c65c8d74771c6d6c0cd9b..de9b547824939f0dbe5541acfd1125a0678e7676 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5224 2006-03-04 02:00:43Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Documentation makefile for the Common UNIX Printing System (CUPS).
 #
@@ -40,7 +40,6 @@ WEBBUTTONS    =       \
                        images/button-add-class.gif \
                        images/button-add-printer.gif \
                        images/button-add-this-printer.gif \
-                       images/button-cancel.gif \
                        images/button-cancel-all-jobs.gif \
                        images/button-cancel-job.gif \
                        images/button-change-settings.gif \
@@ -188,6 +187,13 @@ all:
 clean:
 
 
+#
+# Dummy depend target...
+#
+
+depend:
+
+
 #
 # Install all documentation files...
 #
@@ -209,13 +215,40 @@ install:  all
                $(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
                if test -f $$lang/index.html; then \
                        $(INSTALL_MAN) $$lang/index.html $(DOCDIR)/$$lang; \
-               fi \
+               fi; \
                for file in $(WEBBUTTONS); do \
                        if test -f $$lang/$$file; then \
                                $(INSTALL_MAN) $$lang/$$file $(DOCDIR)/$$lang/images; \
-                       fi \
+                       fi; \
+               done \
+       done
+
+
+#
+# Unnstall all documentation files...
+#
+
+uninstall:
+       for file in $(WEBPAGES); do \
+               $(RM) $(DOCDIR)/$$file; \
+       done
+       for file in $(HELPFILES); do \
+               $(INSTALL_MAN) $(DOCDIR)/help/$$file; \
+       done
+       for file in $(WEBIMAGES) $(WEBBUTTONS); do \
+               $(INSTALL_MAN) $(DOCDIR)/images/$$file; \
+       done
+       -for lang in $(LANGUAGES); do \
+               $(RM) $(DOCDIR)/$$lang/index.html; \
+               for file in $(WEBBUTTONS); do \
+                       $(RM) $(DOCDIR)/$$lang/images/$$file; \
                done \
+               $(RMDIR) $(DOCDIR)/$$lang/images; \
+               $(RMDIR) $(DOCDIR)/$$lang; \
        done
+       -$(RMDIR) $(DOCDIR)/images
+       -$(RMDIR) $(DOCDIR)/help
+       -$(RMDIR) $(DOCDIR)
 
 
 #
index 5019a4aaf51b26dbd9a63c166a1df35876a193fa..a6544b8d11d2c4f04ed64cb3afc771ee8157e41a 100644 (file)
@@ -115,6 +115,10 @@ DD {
   margin-left: 54pt;
 }
 
+DL.category DT {
+  font-weight: bold;
+}
+
 P.summary {
   margin-left: 54pt;
   font-family: monospace;
index 298e66f392fcedd882a29d820ab81d839a5b3c90..53f5b8daa2e99dc5f732ca8a922b80571f658e62 100644 (file)
@@ -227,6 +227,10 @@ DD {
   margin-left: 54pt;
 }
 
+DL.category DT {
+  font-weight: bold;
+}
+
 P.summary {
   margin-left: 54pt;
   font-family: monospace;
diff --git a/doc/help/cgi.html b/doc/help/cgi.html
new file mode 100644 (file)
index 0000000..efb8efa
--- /dev/null
@@ -0,0 +1,91 @@
+<HTML>
+<!-- SECTION: Getting Started -->
+<HEAD>
+       <TITLE>Using CGI Programs</TITLE>
+</HEAD>
+<BODY>
+
+<P>CUPS has traditionally provided a dynamic web interface
+through dedicated CGI programs that are executed when users open
+special directories on the CUPS server. Each CGI performs
+administration, class, help, job, and printer functions as
+directed by the user, but the actual programs that are run and
+functions that are available are limited to those that were
+originally designed into the scheduler.</P>
+
+<P>Support is now available for CGI programs and specific
+scripting languages, currently Java, Perl, PHP, and Python.  The
+interpreters for these languages are currently configured at
+compile time.  Future versions may expand the interface to allow
+for generic support of scripting languages similar to the Apache
+"AddHandler" directive, but with external programs instead of
+modules.</P>
+
+<P>Table 1 shows the MIME media types that are reserved for the
+CGI support in CUPS. The names have been chosen to mirror those
+used by Apache:</P>
+
+<DIV CLASS="table"><TABLE SUMMARY="CGI MIME Media Types">
+<CAPTION>Table 1: CGI MIME Media Types</CAPTION>
+<TR>
+       <TH>MIME Media Type</TH>
+       <TH>Description</TH>
+</TR>
+<TR>
+       <TD>application/x-httpd-cgi</TD>
+       <TD>CGI script/program</TD>
+</TR>
+<TR>
+       <TD>application/x-httpd-java</TD>
+       <TD>Java program</TD>
+</TR>
+<TR>
+       <TD>application/x-httpd-perl</TD>
+       <TD>Perl script</TD>
+</TR>
+<TR>
+       <TD>application/x-httpd-php</TD>
+       <TD>PHP script</TD>
+</TR>
+<TR>
+       <TD>application/x-httpd-python</TD>
+       <TD>Python script</TD>
+</TR>
+</TABLE></DIV>
+
+<H2><A NAME="CONFIG">Configuring the Server</A></H2>
+
+<P>In order to enable the corresponding type, you must create a
+new <VAR>/etc/cups/cgi.types</VAR> file which maps the filename
+extensions to the appropriate MIME type, for example:</P>
+
+<PRE CLASS="command">
+application/x-httpd-cgi cgi
+application/x-httpd-java class
+application/x-httpd-perl pl
+application/x-httpd-php php
+application/x-httpd-python py
+</PRE>
+
+<P>CGI scripts/programs (application/x-httpd-cgi) also must have
+execution permissions to be treated as a CGI script or
+program.</P>
+
+<H2><A NAME="LIMITS">Limitations</A></H2>
+
+<P>CUPS implements most of the CGI/1.1 specification, with the
+following exceptions:</P>
+
+<UL>
+
+       <LI>No PATH_INFO or PATH_TRANSLATED support</LI>
+
+       <LI>Limited HTTP field support; only the Content-Length
+       (CONTENT_LENGTH), Cookie (HTTP_COOKIE), and User-Agent
+       (HTTP_USER_AGENT) fields are placed in environment
+       variables at this time</LI>
+
+</UL>
+
+</BODY>
+</HTML>
index ee69c1c05e9d958cd155b8c55ea5b95be12b3e66..2788879f75444ecc9478405801f045bd4e2c20d4 100644 (file)
@@ -14,6 +14,7 @@ BrowseLDAPServer
 BrowseLocalProtocols
 BrowseRemoteProtocols
 DefaultAuthType
+DefaultEncryption
 DefaultPolicy
 FilterNice
 JobRetryInterval
index 864ec23ff094773c73c0aa72c487798d7c718699..7b5f0e59fd7729843d931c983b65735ccf79c7b3 100644 (file)
 </HEAD>
 <BODY>
 
-<P>This document describes the new features in CUPS 1.2. If you
+<P>CUPS 1.2 adds over 90 changes and new features to CUPS 1.1.x.
+This page provides a high-level outline of these changes. If you
 have never used CUPS before, read the <A
-HREF="overview.html">"Overview of CUPS"</A> document instead.
-CUPS 1.2 adds many new features to CUPS 1.1.x:</P>
+HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
 
-<UL>
+<H2 CLASS="title"><A NAME="CHANGES">Changes in CUPS 1.2</A></H2>
 
-       <LI><A HREF="#NETWORKING">Networking</A></LI>
+<DL CLASS="category">
 
-       <LI><A HREF="#BROWSING">Printer Browsing</A></LI>
+       <DT>Networking</DT>
+       <DD><OL START="1">
 
-       <LI><A HREF="#WEB">Web Interface</A></LI>
+               <LI><EM>IPv6;</EM> CUPS now supports IPv6
+               connectivity when the host operating system
+               provides it</LI>
 
-       <LI><A HREF="#IPP">IPP Support</A></LI>
+               <LI><EM>Domain Sockets;</EM> CUPS now supports
+               the much faster UNIX domain sockets for local
+               printing</LI>
 
-       <LI><A HREF="#SCHEDULER">Scheduler</A></LI>
+               <LI><EM>Auto-SSL;</EM> CUPS now automatically
+               detects when a client is connecting with SSL
+               encryption, so it can support both unencrypted,
+               SSL-encrypted, and TLS-encrypted connections over
+               a single port</LI>
+
+       </OL></DD>
 
-       <LI><A HREF="#I18N">Localization and Internationalization</A></LI>
 
-       <LI><A HREF="#DRIVERS">Printer Drivers</A></LI>
+       <DT>Browsing</DT>
+       <DD><OL START="4">
+
+               <LI><EM>LDAP Support;</EM> CUPS now supports
+               printer sharing via the Lightweight Directory
+               Access Protocol, version 3</LI>
+
+               <LI><EM>Printer Lease Times;</EM> The server's
+               BrowseTimeout value is now included</LI>
+
+               <LI><EM>Network Default Options;</EM> The server
+               now advertises a printer's default options such
+               as job-sheets, media, and so forth</LI>
+
+               <LI><EM>Network Default Printer;</EM> CUPS now
+               advertises server-default printers so that
+               clients can choose the correct default network
+               printer</LI>
+
+               <LI><EM>"Delete Printer" Message;</EM> CUPS now
+               sends a final "delete printer" message to all
+               clients when a printer is deleted, allowing for
+               extremely long BrowseTimeout values without
+               side-effects</LI>
 
-       <LI><A HREF="#CUPSAPI">CUPS API</A></LI>
+               <LI><EM>BrowseLocalOptions and
+               BrowseRemoteOptions Support;</EM> You can
+               configure CUPS to use specific IPP options for
+               local and remote printers, for example to
+               compress print jobs that are sent over a slow WAN
+               link</LI>
 
-       <LI><A HREF="#CUPSIMAGE">CUPS Imaging API</A></LI>
+               <LI><EM>BrowseLocalProtocols and
+               BrowseRemoteProtocols Support;</EM> You can
+               configure CUPS to use different protocols for
+               advertising local shared printers and discovering
+               remote shared printers</LI>
 
-</UL>
+       </OL></DD>
 
 
-<H2 CLASS="title"><A NAME="NETWORKING">Networking</A></H2>
+       <DT>Web Interface</DT>
+       <DD><OL START="11">
 
-<--
-1. Networking
-   a. IPv6
-        i. Next-generation Internet support
-       ii. ????
-   b. Domain sockets
-        i. Enhanced performance under load for local clients.
-       ii. Authentication without passwords on platforms that support it.
--->
+               <LI><EM>Improved Look and Feel;</EM> The web
+               interface has improved readability and a more
+               consistent design</LI>
 
-<P>CUPS 1.2 adds support for IPv6 and domain sockets. The IPv6
-support allows CUPS to work with the next-generation Internet as
-well as taking advantage of automatic local network
-configuration. Domain sockets provide 5 to 10 times faster
-printing from the desktop.</P>
+               <LI><EM>New Searchable On-Line Help;</EM> The
+               on-line help has been reorganized into
+               categorized articles and references and can be
+               searched</LI>
 
+               <LI><EM>Add This Printer;</EM> The administration
+               page offers a new <VAR>Add This Printer</VAR>
+               button for automatically-discovered printers,
+               making printer configuration even easier than
+               before</LI>
 
-<H2 CLASS="title"><A NAME="BROWSING">Printer Browsing</A></H2>
+               <LI><EM>Export Printers to Samba;</EM> The
+               administration page now offers an <VAR>Export
+               Printers to Samba</VAR> button and function which
+               allows administrators to export printer drivers
+               to Windows clients via Samba</LI>
 
-<--
-2. Printer Browsing
-   a. CUPS browsing updates
-        i. "Delete" bit for printers
-       ii. "lease-time" for printers so that clients and servers don't need
-          the same browse timeout/interval settings
-      iii. Additional attributes/default options for network-wide defaults
-       iv. Network default printer
-        v. Ability to control send and receive protocols independently
-   b. Rendevous support
-   c. LDAP support
-   d. Per-printer sharing
--->
+               <LI><EM>Change Settings;</EM> The administration
+               page offers a new simple server settings form for
+               controlling common configuration settings such as
+               printer sharing and remote administration</LI>
+
+               <LI><EM>Edit Configuration File;</EM> The
+               administration page now provides a form for
+               editing the <VAR>cupsd.conf</VAR> file from your
+               web browser</LI>
+
+               <LI><EM>View Log Files;</EM> The administration
+               page now provides access to the
+               <VAR>access_log</VAR>, <VAR>error_log</VAR>, and
+               <VAR>page_log</VAR> log files</LI>
+
+               <LI><EM>Searchable Classes, Jobs, and
+               Printers;</EM> the class, job, and printer pages
+               can now be searched and shown in ascending or
+               descending order, with the results displayed in
+               groups of 10</LI>
+
+               <LI><EM>Links for Class Members;</EM> When
+               viewing a printer class, we now provide
+               hyperlinks to each of the class members -
+               previously only the names were shown</LI>
+
+               <LI><EM>Print Self-Test Page;</EM> When the
+               printer driver supports the CUPS command file
+               format, you can now print the printer's self-test
+               page</LI>
+
+               <LI><EM>Clean Print Heads;</EM> When the printer
+               driver supports the CUPS command file format, you
+               can now clean the printer's heads</LI>
+
+               <LI><EM>Set Default Options;</EM> You can now set
+               the default options for a printer, including the
+               new operation and error policies (the previous
+               incarnation of this was confusingly called
+               "Configure Printer")</LI>
+
+               <LI><EM>Set Default Printer;</EM> You can now
+               make a printer the default printer on the
+               network</LI>
+
+               <LI><EM>Set Allowed Users;</EM> You can now set
+               the list of users and/or groups that are allowed
+               or not allowed to access a printer or class</LI>
+
+               <LI><EM>Cancel All Jobs;</EM> You can now cancel
+               all jobs on a printer or class</LI>
+
+               <LI><EM>Move Job;</EM> You can now move an active
+               job to a different printer or class</LI>
+
+               <LI><EM>Move All Jobs;</EM> You can now move all
+               active jobs to a different printer or class</LI>
+
+               <LI><EM>Per-Printer Sharing;</EM> You can now
+               share (Publish) or hide (Unpublish) printers
+               individually</LI>
+
+               <LI><EM>Show All Jobs;</EM> You can now view all
+               jobs in addition to just the active or completed
+               jobs</LI>
+
+       </OL></DD>
+
+
+       <DT>IPP Support</DT>
+       <DD><OL START="30"></EM></LI>
+
+               <LI><EM>IPP Notifications;</EM> CUPS now supports
+               the complete IPP notification specification to
+               provide asynchronous event notification to
+               clients and users</LI>
+
+               <LI><EM>ippget Notification Scheme;</EM> CUPS now
+               supports the required <CODE>ippget</CODE> pull
+               method for event notification, allowing
+               applications to receive events asychronously</LI>
+
+               <LI><EM>mailto Notification Scheme;</EM> CUPS now
+               supports <CODE>mailto</CODE> recipients as
+               proposed by the Printer Working Group, allowing
+               users to receive event notifications via
+               email</LI>
+
+               <LI><EM>CUPS Extensions to IPP
+               Notifications;</EM> CUPS adds several server
+               events (start, stop, restart, and audit) that can
+               be monitored via the IPP notification
+               operations</LI>
+
+               <LI><EM>CUPS-Get-Printers Improvements;</EM> The
+               CUPS-Get-Printers operation now returns all
+               queues by default and filters the results based
+               on the <CODE>requesting-user-name</CODE>
+               attribute</LI>
+
+               <LI><EM>Proxy Authentication;</EM> CUPS provides
+               the new CUPS-Authenticate-Job operation to
+               support proxy authentication of print jobs</LI>
+
+               <LI><EM>Unique Job IDs;</EM> CUPS maintains a new
+               <CODE>job-uuid</CODE> attribute which provides a
+               unique identifier that can be used to track a job
+               on your network or anywhere in the world</LI>
+
+               <LI><EM>port-monitor;</EM> CUPS now supports the
+               per-printer <CODE>port-monitor</CODE> and
+               <CODE>port-monitor-supported</CODE> attributes
+               for device-specific data/transport encoding</LI>
+
+               <LI><EM>printer-op-policy;</EM> CUPS supports new
+               <CODE>printer-op-policy</CODE> and
+               <CODE>printer-op-policy-supported</CODE>
+               attributes which provide per-printer fine-grained
+               access control policies</LI>
+
+               <LI><EM>printer-error-policy;</EM> CUPS supports
+               new <CODE>printer-error-policy</CODE> and
+               <CODE>printer-error-policy-supported</CODE>
+               attributes which provide per-printer control over
+               job error handling</LI>
+
+               <LI><EM>printer-is-shared;</EM> CUPS supports a
+               new <CODE>printer-is-shared</CODE> attribute
+               which provides per-printer sharing</LI>
+
+               <LI><EM>printer-state-change-time;</EM> CUPS now
+               tracks the last time and date of a change to the
+               printer configuration, enabled/disabled state, or
+               accepting/rejecting state</LI>
+
+               <LI><EM>printer-uri-supported;</EM> CUPS now
+               reports the IP address or hostname used by the
+               client in the <CODE>printer-uri-supported</CODE>
+               attribute - this prevents hostname resolution
+               issues on complex networks</LI>
+
+               <LI><EM>requested-attributes;</EM> CUPS now fully
+               supports limiting of attributes by name or group
+               - previously CUPS would only limit common
+               attributes and did not support attribute group
+               names</LI>
+
+               <LI><EM>Default Job Template Attributes;</EM>
+               CUPS now supports arbitrary default job template
+               attributes and applies them to print jobs as
+               needed</LI>
+
+               <LI><EM>which-jobs;</EM> The Get-Jobs operation
+               now supports a <CODE>which-jobs</CODE> value of
+               "all" to return all jobs regardless of state</LI>
+
+               <LI><EM>document-format-supported;</EM> The
+               <CODE>document-format-supported</CODE> attribute
+               now reflects the formats that are actually
+               supported by the printer</LI>
+
+               <LI><EM>printer-type;</EM> The
+               <CODE>printer-type</CODE> attribute now provides
+               bits for "not shared", "authenticated", and
+               "supports commands"</LI>
+
+       </OL></DD>
+
+
+       <DT>Scheduler</DT>
+       <DD><OL START="48">
+
+               <LI><EM>Remote Printer Caching;</EM> The scheduler
+               now maintains a remote printer cache so that
+               remote printers are not lost when the scheduler
+               or system is restarted</LI>
+
+               <LI><EM>Job Caching;</EM> The scheduler now
+               maintains a job cache so that completed jobs do
+               not need to be loaded into memory all of the time
+               - jobs are loaded and unloaded automatically for
+               optimum performance and memory usage</LI>
+
+               <LI><EM>Other Performance Improvements;</EM>
+               Thanks to new CUPS API interfaces, the schedule
+               now uses less memory, less CPU, and scales to
+               even larger installations</LI>
+
+               <LI><EM>Improved Logging;</EM> CUPS now logs the
+               IPP operation and status in in the
+               <VAR>access_log</VAR> file</LI>
+
+               <LI><EM>Policies;</EM> CUPS now provides
+               per-printer and server access control policies
+               based on IPP operations in addition to the
+               traditional location-based access control
+               available in previous releases</LI>
+
+               <LI><EM>DefaultAuthType;</EM> In conjunction with
+               the new policy support, CUPS now supports a
+               default authentication type that is used for IPP
+               operations requiring a username</LI>
+
+               <LI><EM>DefaultEncryption;</EM> When
+               authenticating a request, CUPS now uses the
+               <CODE>DefaultEncryption</CODE> setting in
+               addition to any location or policy encryption
+               setting in effect</LI>
+
+               <LI><EM>Per-Printer
+               document-format-supported;</EM> CUPS now
+               maintains per-printer
+               <CODE>document-format-supported</CODE> attributes
+               that reflect the formats that can be printed by a
+               particular printer</LI>
+
+               <LI><EM>Server-side Default Options;</EM> CUPS
+               now supports server-side default options for each
+               printer or class that are applied to new
+               jobs</LI>
+
+               <LI><EM>POSIX ACL Support;</EM> CUPS now uses
+               POSIX ACLs, when available, to allows multiple
+               system groups to be used for local certificate
+               authentication</LI>
 
-<P>CUPS 1.2 adds support for Bonjour/mDNS and LDAP-based printer
-sharing. Printers can be shared or "published" individually,
-allowing a server to only share specific printers, and you can
-set which protocols to use for local and remote printers.
-Previously CUPS would share all or none of its printers and use
-the same protocols for local and remote printers.</P>
+               <LI><EM>RunAsUser Removed;</EM> The insecure
+               RunAsUser mode has been removed in favor of OS
+               mechanisms such as SELinux</LI>
 
-<H3>CUPS Browse Protocol</H3>
+               <LI><EM>Launchd Support;</EM> The schedule now
+               supports running via the MacOS X launchd program,
+               delaying cupsd startup until needed</LI>
+
+               <LI><EM>Dynamic Device Lookup;</EM> The scheduler
+               now queries the backends for devices as
+               needed - no more restarting to get new devices!</LI>
+
+               <LI><EM>Dynamic PPD/Printer Driver Lookup;</EM>
+               The scheduler now scans for PPD files and/or
+               printer drivers as needed - no more restarting
+               after installing drivers, and PPD files can be
+               generated dynamically!</LI>
 
-<P>The CUPS browse protocol has also been upgraded. New type
-bits, authenticated, default, and deleted, provide key
-information to clients. The "authenticated" type bit tells
-clients that the print queue requires authentication when
-printing. The "default" type bit tells clients that the print
-queue should be used as the default unless the user sets a
-different one. The "deleted" type bit is set when a printer is
-deleted from the server - this allows the client to remove its
-copy of a printer immediately rather than waiting for it to
-timeout.</P>
+               <LI><EM>Port Monitor Support;</EM> CUPS now
+               supports "port monitor" filters between the
+               printer driver filters and backend to do printer-
+               and device-specific encoding and transport
+               functions.</LI>
 
-<P>Previously, a change to the BrowseTimeout setting on the
-server had to be mirrored to each client. Browse packets now
-include printer lease time information which allows the server to
-use a different timeout setting than its clients, making
-configuration simpler and more reliable.</P>
+               <LI><EM>Multi-File Job Improvements;</EM> CUPS
+               now sends multi-file jobs in a single connection
+               to the printer or remote server, preserving the
+               order of jobs</LI>
 
-<P>Browse packets can also now contain connection options to be
-used when printing to the server. This allows the administrator
-to require encryption or compress print jobs for certain
-printers. This is most often used when printing over
-limited-bandwidth WAN connections.</P>
+               <LI><EM>Environment Variable Support;</EM> The
+               scheduler now supports setting environment
+               variables for filters and CGI programs via the
+               Apache <CODE>PassEnv</CODE> and
+               <CODE>SetEnv</CODE> directives</LI>
 
+               <LI><EM>Improved CGI Support;</EM> The scheduler
+               now supports more of the CGI/1.1
+               specification</LI>
 
-<H2 CLASS="title"><A NAME="WEB">Web Interface</A></H2>
+               <LI><EM>Log Files;</EM> Log files are now
+               accessible via HTTP requests using the
+               <VAR>/conf/log/filename</VAR> resource</LI>
 
-<!--
-3. Web Interface
-   a. cupsd.conf interface
-   b. Move-Job
-   c. Export printers to windows
-   d. Per-printer sharing controls
-   e. Per-printer access control lists 
-   f. Policy stuff
--->
+               <LI><EM>Power Management;</EM> The scheduler now
+               responds to power management events from the
+               operating system (currently MacOS X only)</LI>
 
-<P>The web interface features an all-new administration interface
-which provides ...</P>
+       </OL></DD>
 
 
-<H2 CLASS="title"><A NAME="IPP">IPP Support</A></H2>
-
-<!--
-4. IPP Support
-   a. Notifications
-   b. CUPS-Get-Devices/PPDs changes
-   c. CUPS-Autheticate-Job
-   d. Other stuff?
--->
-
-
-<H2 CLASS="title"><A NAME="SCHEDULER">Scheduler</A></H2>
-
-<!--
-5. Scheduler
-   a. Backchannel support
-   b. Port monitor support
-   c. Device monitor
-      i. Dynamic device discovery/management
-   d. All errors include a localized message.
-   e. Fine-grain policies, server default + per-printer
-   f. UTF-8 throughout
-   g. Optimizations
--->
-
-
-<H2 CLASS="title"><A NAME="I18N">Localization and Internationalization</A></H2>
-
-<!--
-6. I18N
-   a. Support for ... character sets
-   b. All commands and messages are localized
-   c. Character set transcoding
-   d. ... , and Japanese localizations
--->
-
-
-<H2 CLASS="title"><A NAME="DRIVERS">Printer Drivers</A></H2>
-
-<!--
-7. Drivers
-   a. New drivers
-   b. New driver interfaces
-   c. Port monitors
--->
-
-
-<H2 CLASS="title"><A NAME="CUPSAPI">CUPS API</A></H2>
-
-<!--
-8. CUPS API
-   a. New APIs (file, directory, array, URI)
-   b. PPD stuff
-   c. Language/charset stuff
-   d. Other enhancements
--->
-
-
-<H2 CLASS="title"><A NAME="CUPSIMAGE">CUPS Imaging API</A></H2>
-
-<!--
-9. CUPS Imaging API
-   a. New raster stuff
-   b. RIP support function
-   c. Image and zoom APIs
--->
+       <DT>LPD Client Support</DT>
+       <DD><OL START="68">
+
+               <LI><EM>Performance Improvements;</EM> CUPS no
+               longer loads every available printer before
+               accepting a print job</LI>
+
+               <LI><EM>Banner Support;</EM> Banner pages can now
+               be requested by an LPD client, with server-side
+               overrides as desired</LI>
+
+               <LI><EM>Multi-File Support;</EM> CUPS now creates
+               a single IPP job for multi-file LPD jobs</LI>
+
+       </OL></DD>
+
+
+       <DT>Localization and Internationalization</DT>
+       <DD><OL START="71">
+
+               <LI><EM>Command-Line Programs;</EM> All
+               command-line programs are now fully
+               localized</LI>
+
+               <LI><EM>Character Set Support;</EM> CUPS now
+               supports a wider range of character sets
+               including Big5 and Shift-JIS</LI>
+
+               <LI><EM>Globalized PPD Support;</EM> PPD files
+               can now contain multiple language
+               localizations</LI>
+
+       </OL></DD>
+
+
+       <DT>Printer Drivers</DT>
+       <DD><OL START="74">
+
+               <LI><EM>New Drivers;</EM> CUPS 1.2 adds Zebra
+               CPCL and EPL label printer drivers</LI>
+
+               <LI><EM>Driver Interfaces;</EM> CUPS now supports
+               driver interfaces which allow a driver to
+               advertise the printers it supports and
+               automatically generate the PPD file as
+               needed</LI>
+
+               <LI><EM>High-Definition Range Color;</EM> CUPS
+               1.2 adds 16-bit per channel color support</LI>
+
+               <LI><EM>Raster Compression;</EM> The CUPS raster
+               format has been updated to use data
+               compression for faster printing</LI>
+
+               <LI><EM>Extended Printer Attributes;</EM> The
+               CUPS raster format has been extended to support
+               additional per-page printer-specific
+               attributes</LI>
+
+               <LI><EM>Back-Channel Data Support;</EM> Printer
+               drivers can now read data back from the printer
+               device</LI>
+
+               <LI><EM>Custom PPD Options;</EM> PPD files can
+               now contain options that accept custom
+               values</LI>
+
+       </OL></DD>
+
+
+       <DT>CUPS API</DT>
+       <DD><OL START="81">
+
+               <LI><EM>Thread Safety;</EM> All of the CUPS API
+               is now thread-safe on systems that support POSIX
+               threads</LI>
+
+               <LI><EM>Performance Improvements;</EM> Many of
+               the existing APIs have been optimized for
+               speed</LI>
+
+               <LI><EM>Array API;</EM> The new array API
+               provides a generic array container and is used to
+               implement many of the new CUPS 1.2 features and
+               performance improvements</LI>
+
+               <LI><EM>Directory API;</EM> The new directory API
+               allows applications to portably list the contents
+               of a directory</LI>
+
+               <LI><EM>File API;</EM> The new file API supports
+               optionally-compressed file IO and simple socket
+               communications without the limitations of
+               stdio</LI>
+
+               <LI><EM>HTTP API;</EM> The HTTP API now provides
+               many new URI and address handling functions,
+               accessor functions to key <CODE>http_t</CODE>
+               information, write-buffering functions, and large
+               file APIs</LI>
+
+               <LI><EM>IPP API;</EM> The IPP API now provides
+               functions to encode arbitrary options, add
+               <CODE>octetString</CODE> attributes, create
+               common IPP requests, convert IPP status and
+               operation code values to/from strings, and read
+               and write IPP messages via callbacks.</LI>
+
+               <LI><EM>PPD API;</EM> The PPD API has been
+               updated with new functions to support reading
+               from CUPS files, localization of globalized PPD
+               files, emission of arbitrary ranges of options,
+               custom option support, enhanced JCL support, and
+               access to all options in the PPD file</LI>
+
+               <LI><EM>Error Handling;</EM> The CUPS API now
+               provides a convenience function to get the full
+               error message of the last request</LI>
+
+               <LI><EM>Back-Channel API;</EM> The new
+               back-channel API provides backends and filters
+               with access to information sent back from a
+               printer</LI>
+
+       </OL></DD>
+
+
+       <DT>CUPS Imaging API</DT>
+       <DD><OL START="91">
+
+               <LI><EM>Image API;</EM> The new image API
+               provides access to image files of arbitrary size
+               and is based on the CUPS 1.1.x private image
+               filter APIs</LI>
+
+               <LI><EM>Raster API;</EM> The raster API provides
+               new functions to read and write the version 2
+               raster page headers, and a new function to
+               generate a page header from marked PPD
+               options</LI>
+
+       </OL></DD>
+
+</DL>
 
 </BODY>
 </HTML>
index d082fa8accb25f7652a15e9e1e68616b1d9160a3..b1bf014459b428102728708af7a6d60d9cac59e3 100644 (file)
@@ -65,13 +65,13 @@ as perform system administration tasks. Click on any of the tabs above
 or on the buttons below to perform a task.</P>
 
 <P>
-<A HREF="/help/"><IMG SRC="/images/help.gif" CLASS="button" ALT="Help"></A>
-<A HREF="/admin?OP=add-class"><IMG SRC="/images/add-class.gif" CLASS="button" ALT="Add Class"></A>
-<A HREF="/admin?OP=add-printer"><IMG SRC="/images/add-printer.gif" CLASS="button" ALT="Add Printer"></A>
-<A HREF="/classes"><IMG SRC="/images/manage-classes.gif" CLASS="button" ALT="Manage Classes"></A>
-<A HREF="/jobs"><IMG SRC="/images/manage-jobs.gif" CLASS="button" ALT="Manage Jobs"></A>
-<A HREF="/printers"><IMG SRC="/images/manage-printers.gif" CLASS="button" ALT="Manage Printers"></A>
-<A HREF="/admin"><IMG SRC="/images/manage-server.gif" CLASS="button" ALT="Manage Server"></A>
+<A HREF="/help/"><IMG SRC="/images/button-help.gif" CLASS="button" ALT="Help"></A>
+<A HREF="/admin?OP=add-class"><IMG SRC="/images/button-add-class.gif" CLASS="button" ALT="Add Class"></A>
+<A HREF="/admin?OP=add-printer"><IMG SRC="/images/button-add-printer.gif" CLASS="button" ALT="Add Printer"></A>
+<A HREF="/classes"><IMG SRC="/images/button-manage-classes.gif" CLASS="button" ALT="Manage Classes"></A>
+<A HREF="/jobs"><IMG SRC="/images/button-manage-jobs.gif" CLASS="button" ALT="Manage Jobs"></A>
+<A HREF="/printers"><IMG SRC="/images/button-manage-printers.gif" CLASS="button" ALT="Manage Printers"></A>
+<A HREF="/admin"><IMG SRC="/images/button-manage-server.gif" CLASS="button" ALT="Manage Server"></A>
 </P>
 
 <P><I>If you are asked for a username and password, enter your login
index 5b348005ae9a29a3ae5e81c324d4b398ae48d23b..b87c016e5feba88ff50dd47869197815e15b28e1 100644 (file)
@@ -65,13 +65,13 @@ BORDER="0" ALT=""></A>
 ボタンをクリックしてください。</P>
 
 <P>
-<A HREF="/help/"><IMG SRC="/images/help.gif" CLASS="button" ALT="Help"></A>
-<A HREF="/admin?OP=add-class"><IMG SRC="/images/add-class.gif" CLASS="button" ALT="クラスの追加"></A>
-<A HREF="/admin?OP=add-printer"><IMG SRC="/images/add-printer.gif" CLASS="button" ALT="プリンタの追加"></A>
-<A HREF="/classes"><IMG SRC="/images/manage-classes.gif" CLASS="button" ALT="クラスの管理"></A>
-<A HREF="/jobs"><IMG SRC="/images/manage-jobs.gif" CLASS="button" ALT="ジョブの管理"></A>
-<A HREF="/printers"><IMG SRC="/images/manage-printers.gif" CLASS="button" ALT="プリンタの管理"></A>
-<A HREF="/admin"><IMG SRC="/images/manage-server.gif" CLASS="button" ALT="サーバの管理"></A>
+<A HREF="/help/"><IMG SRC="/images/button-help.gif" CLASS="button" ALT="Help"></A>
+<A HREF="/admin?OP=add-class"><IMG SRC="/images/button-add-class.gif" CLASS="button" ALT="クラスの追加"></A>
+<A HREF="/admin?OP=add-printer"><IMG SRC="/images/button-add-printer.gif" CLASS="button" ALT="プリンタの追加"></A>
+<A HREF="/classes"><IMG SRC="/images/button-manage-classes.gif" CLASS="button" ALT="クラスの管理"></A>
+<A HREF="/jobs"><IMG SRC="/images/button-manage-jobs.gif" CLASS="button" ALT="ジョブの管理"></A>
+<A HREF="/printers"><IMG SRC="/images/button-manage-printers.gif" CLASS="button" ALT="プリンタの管理"></A>
+<A HREF="/admin"><IMG SRC="/images/button-manage-server.gif" CLASS="button" ALT="サーバの管理"></A>
 </P>
 
 <P><I>ユーザ名とパスワードを尋ねられたら、あなたのユーザ名とパスワード、
index 06a31d5e165e9dbfd9ae1231b1f4739b7e472a16..6375bfbff43286fd2e9d1f01a10ad229ed13ce45 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5192 2006-02-27 03:08:47Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Filter makefile for the Common UNIX Printing System (CUPS).
 #
@@ -103,6 +103,31 @@ installhdrs:
        $(INSTALL_DATA) raster.h $(INCLUDEDIR)/cups
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       for file in $(FILTERS); do \
+               $(RM) $(SERVERBIN)/filter/$$file; \
+       done
+       $(RM) $(SERVERBIN)/filter/rastertodymo
+       -$(RMDIR) $(SERVERBIN)/filter
+       -$(RMDIR) $(SERVERBIN)
+       $(RM) $(LIBDIR)/libcupsimage.2.dylib
+       $(RM) $(LIBDIR)/libcupsimage.a
+       $(RM) $(LIBDIR)/libcupsimage.dylib
+       $(RM) $(LIBDIR)/libcupsimage_s.a
+       $(RM) $(LIBDIR)/libcupsimage.sl
+       $(RM) $(LIBDIR)/libcupsimage.sl.2
+       $(RM) $(LIBDIR)/libcupsimage.so
+       $(RM) $(LIBDIR)/libcupsimage.so.2
+       -$(RMDIR) $(LIBDIR)
+       $(RM) $(INCLUDEDIR)/cups/image.h
+       $(RM) $(INCLUDEDIR)/cups/raster.h
+       -$(RMDIR) $(INCLUDEDIR)/cups
+
+
 #
 # Automatic API help files...
 #
@@ -295,5 +320,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5192 2006-02-27 03:08:47Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index e22041de1ad3e258199ea241f37dd84af923d47e..b6c37c9e94a988e04210c753a20c08bc49095df1 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Fonts makefile for the Common UNIX Printing System (CUPS).
 #
@@ -46,6 +46,13 @@ all:
 clean:
 
 
+#
+# Dummy depend target...
+#
+
+depend:
+
+
 #
 # Install files...
 #
@@ -58,5 +65,16 @@ install:     all
 
 
 #
-# End of "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $".
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(FONTS); do \
+               $(RM) $(DATADIR)/fonts/$$file; \
+       done
+       $(RMDIR) $(DATADIR)/fonts
+
+
+#
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 1fef472e747139bfbb8afd1c5b2e4276be2add68..b20190daf2cdd813f3a46785495982f1b2607983 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5224 2006-03-04 02:00:43Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Locale file makefile for the Common UNIX Printing System (CUPS).
 #
@@ -65,6 +65,18 @@ install:     all
        done
 
 
+#
+# Uninstall files...
+#
+
+uninstall:
+       -for loc in $(LANGUAGES) ; do \
+               $(RM) $(LOCALEDIR)/$$loc/cups_$$loc.po ; \
+               $(RMDIR) $(LOCALEDIR)/$$loc ; \
+       done
+       -$(RMDIR) $(LOCALEDIR)
+
+
 #
 # pot - Creates/updates the cups.pot template file, and merges changes
 #       into existing message catalogs.
@@ -102,5 +114,5 @@ translate.o:        ../cups/http.h ../cups/i18n.h ../cups/language.h ../cups/string.h
 
 
 #
-# End of "$Id: Makefile 5224 2006-03-04 02:00:43Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 9697db30e54f53cb67f91ae54fa8db029ba4eaab..281af4666476df31ac70ced59010bcf34ffc0481 100644 (file)
@@ -29,7 +29,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.2\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2006-02-26 20:42-0500\n"
+"POT-Creation-Date: 2006-03-05 22:39-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -55,31 +55,32 @@ msgstr ""
 
 #: cups/ppd.c:656 cups/ppd.c:881 cups/ppd.c:1047 cups/ppd.c:662 cups/ppd.c:996
 #: cups/ppd.c:1169 cups/ppd.c:651 cups/ppd.c:983 cups/ppd.c:1148
+#: cups/ppd.c:972 cups/ppd.c:1137
 msgid "General"
 msgstr ""
 
 #: cups/ppd.c:704 cups/ppd.c:1105 cups/ppd.c:710 cups/ppd.c:1224
-#: cups/ppd.c:697 cups/ppd.c:1201
+#: cups/ppd.c:697 cups/ppd.c:1201 cups/ppd.c:1190
 msgid "Media Size"
 msgstr ""
 
 #: cups/ppd.c:706 cups/ppd.c:1107 cups/ppd.c:712 cups/ppd.c:1226
-#: cups/ppd.c:699 cups/ppd.c:1203
+#: cups/ppd.c:699 cups/ppd.c:1203 cups/ppd.c:1192
 msgid "Media Type"
 msgstr ""
 
 #: cups/ppd.c:708 cups/ppd.c:1109 cups/ppd.c:714 cups/ppd.c:1228
-#: cups/ppd.c:701 cups/ppd.c:1205
+#: cups/ppd.c:701 cups/ppd.c:1205 cups/ppd.c:1194
 msgid "Media Source"
 msgstr ""
 
 #: cups/ppd.c:710 cups/ppd.c:1111 cups/ppd.c:716 cups/ppd.c:1230
-#: cups/ppd.c:703 cups/ppd.c:1207
+#: cups/ppd.c:703 cups/ppd.c:1207 cups/ppd.c:1196
 msgid "Output Mode"
 msgstr ""
 
 #: cups/ppd.c:712 cups/ppd.c:1113 cups/ppd.c:718 cups/ppd.c:1232
-#: cups/ppd.c:705 cups/ppd.c:1209
+#: cups/ppd.c:705 cups/ppd.c:1209 cups/ppd.c:1198
 msgid "Resolution"
 msgstr ""
 
@@ -87,11 +88,11 @@ msgstr ""
 msgid "Variable"
 msgstr ""
 
-#: cups/ppd.c:1535 cups/ppd.c:1650 cups/ppd.c:1627
+#: cups/ppd.c:1535 cups/ppd.c:1650 cups/ppd.c:1627 cups/ppd.c:1616
 msgid "Yes"
 msgstr ""
 
-#: cups/ppd.c:1537 cups/ppd.c:1652 cups/ppd.c:1629
+#: cups/ppd.c:1537 cups/ppd.c:1652 cups/ppd.c:1629 cups/ppd.c:1618
 msgid "No"
 msgstr ""
 
@@ -100,12 +101,12 @@ msgid "Auto"
 msgstr ""
 
 #: scheduler/client.c:2247 scheduler/client.c:2251 scheduler/client.c:2274
-#: scheduler/client.c:2308
+#: scheduler/client.c:2308 scheduler/client.c:2349
 msgid "Enter your username and password or the root username and password to access this page."
 msgstr ""
 
 #: scheduler/client.c:2252 scheduler/client.c:2256 scheduler/client.c:2279
-#: scheduler/client.c:2313
+#: scheduler/client.c:2313 scheduler/client.c:2354
 msgid "You must use a https: URL to access this page."
 msgstr ""
 
@@ -703,6 +704,7 @@ msgstr ""
 #: systemv/lpmove.c:84 systemv/accept.c:106 systemv/cancel.c:93
 #: systemv/lpmove.c:89 berkeley/lpq.c:124 systemv/lp.c:136
 #: systemv/lpstat.c:116 berkeley/lpr.c:116 systemv/lp.c:140
+#: systemv/cupsaddsmb.c:98
 #, c-format
 msgid "%s: Sorry, no encryption support compiled in!\n"
 msgstr ""
@@ -2608,7 +2610,7 @@ msgid "Edit Configuration File"
 msgstr ""
 
 #: cgi-bin/admin.c:2135 cgi-bin/admin.c:2147 cgi-bin/admin.c:2179
-#: cgi-bin/admin.c:2191 cgi-bin/printers.c:219
+#: cgi-bin/admin.c:2191 cgi-bin/printers.c:219 cgi-bin/printers.c:224
 msgid "Unable to create temporary file:"
 msgstr ""
 
@@ -2732,15 +2734,17 @@ msgid "Unable to change printer-is-shared attribute:"
 msgstr ""
 
 #: cgi-bin/classes.c:161 cgi-bin/classes.c:208 cgi-bin/classes.c:159
-#: cgi-bin/classes.c:206
+#: cgi-bin/classes.c:206 cgi-bin/classes.c:164 cgi-bin/classes.c:211
 msgid "Classes"
 msgstr ""
 
 #: cgi-bin/classes.c:355 cgi-bin/classes.c:356 cgi-bin/classes.c:354
+#: cgi-bin/classes.c:359
 msgid "Unable to get class list:"
 msgstr ""
 
 #: cgi-bin/classes.c:454 cgi-bin/classes.c:455 cgi-bin/classes.c:453
+#: cgi-bin/classes.c:458
 msgid "Unable to get class status:"
 msgstr ""
 
@@ -2782,15 +2786,18 @@ msgid "Job operation failed:"
 msgstr ""
 
 #: cgi-bin/printers.c:161 cgi-bin/printers.c:208 cgi-bin/printers.c:211
-#: cgi-bin/printers.c:166 cgi-bin/printers.c:335
+#: cgi-bin/printers.c:166 cgi-bin/printers.c:335 cgi-bin/printers.c:171
+#: cgi-bin/printers.c:340
 msgid "Printers"
 msgstr ""
 
 #: cgi-bin/printers.c:362 cgi-bin/printers.c:366 cgi-bin/printers.c:518
+#: cgi-bin/printers.c:523
 msgid "Unable to get printer list:"
 msgstr ""
 
 #: cgi-bin/printers.c:461 cgi-bin/printers.c:468 cgi-bin/printers.c:628
+#: cgi-bin/printers.c:633
 msgid "Unable to get printer status:"
 msgstr ""
 
@@ -2882,11 +2889,11 @@ msgstr ""
 msgid "Unknown"
 msgstr ""
 
-#: cups/ppd.c:1033 cups/ppd.c:1020
+#: cups/ppd.c:1033 cups/ppd.c:1020 cups/ppd.c:1009
 msgid "Custom"
 msgstr ""
 
-#: cups/ppd.c:1259 cups/ppd.c:1236
+#: cups/ppd.c:1259 cups/ppd.c:1236 cups/ppd.c:1225
 msgid "JCL"
 msgstr ""
 
@@ -2894,17 +2901,17 @@ msgstr ""
 msgid "No authentication information provided!"
 msgstr ""
 
-#: systemv/cupsaddsmb.c:440
+#: systemv/cupsaddsmb.c:440 systemv/cupsaddsmb.c:252
 #, c-format
 msgid "Password for %s required to access %s via SAMBA: "
 msgstr ""
 
-#: systemv/cupsaddsmb.c:451
+#: systemv/cupsaddsmb.c:451 cups/adminutil.c:626
 #, c-format
 msgid "Running command: %s %s -N -U '%s%%%s' -c '%s'\n"
 msgstr ""
 
-#: systemv/cupsaddsmb.c:479
+#: systemv/cupsaddsmb.c:479 cups/adminutil.c:656
 #, c-format
 msgid "cupsaddsmb: Unable to run \"%s\": %s\n"
 msgstr ""
@@ -3251,7 +3258,7 @@ msgstr ""
 msgid "%s: Invalid destination name in list \"%s\"!\n"
 msgstr ""
 
-#: systemv/lpstat.c:571
+#: systemv/lpstat.c:571 systemv/cupsaddsmb.c:156 systemv/cupsaddsmb.c:177
 #, c-format
 msgid "%s: Unable to connect to server\n"
 msgstr ""
@@ -3330,7 +3337,7 @@ msgstr ""
 msgid "cupsd: Unknown argument \"%s\" - aborting!\n"
 msgstr ""
 
-#: scheduler/main.c:2315 scheduler/main.c:2329
+#: scheduler/main.c:2315 scheduler/main.c:2329 scheduler/main.c:2304
 msgid ""
 "Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
 "\n"
@@ -3354,15 +3361,16 @@ msgstr ""
 msgid "        WARN    Non-Windows PPD files should use lines ending with only LF, not CR LF!\n"
 msgstr ""
 
-#: cgi-bin/printers.c:218 cgi-bin/printers.c:289
+#: cgi-bin/printers.c:218 cgi-bin/printers.c:289 cgi-bin/printers.c:223
+#: cgi-bin/printers.c:294
 msgid "Printer Maintenance"
 msgstr ""
 
-#: cgi-bin/printers.c:292
+#: cgi-bin/printers.c:292 cgi-bin/printers.c:297
 msgid "Unable to send maintenance job:"
 msgstr ""
 
-#: systemv/cupsaddsmb.c:566
+#: systemv/cupsaddsmb.c:566 systemv/cupsaddsmb.c:233
 #, c-format
 msgid "cupsaddsmb: No PPD file for printer \"%s\" - %s\n"
 msgstr ""
@@ -3402,6 +3410,77 @@ msgstr ""
 msgid "      **FAIL**  Bad cupsFilter value \"%s\"!\n"
 msgstr ""
 
+#: cgi-bin/help.c:98 cgi-bin/help.c:139 cgi-bin/help.c:149 cgi-bin/help.c:179
+msgid "Help"
+msgstr ""
+
+#: cups/adminutil.c:233
+#, c-format
+msgid "Missing value on line %d!\n"
+msgstr ""
+
+#: cups/adminutil.c:249
+#, c-format
+msgid "Missing double quote on line %d!\n"
+msgstr ""
+
+#: cups/adminutil.c:266
+#, c-format
+msgid "Bad option + choice on line %d!\n"
+msgstr ""
+
+#: cups/adminutil.c:417
+#, c-format
+msgid "Unable to copy Windows 2000 printer driver files (%d)!\n"
+msgstr ""
+
+#: cups/adminutil.c:445
+#, c-format
+msgid "Unable to copy CUPS printer driver files (%d)!\n"
+msgstr ""
+
+#: cups/adminutil.c:480
+#, c-format
+msgid "Unable to install Windows 2000 printer driver files (%d)!\n"
+msgstr ""
+
+#: cups/adminutil.c:514
+#, c-format
+msgid "Unable to copy Windows 9x printer driver files (%d)!\n"
+msgstr ""
+
+#: cups/adminutil.c:536
+#, c-format
+msgid "Unable to install Windows 9x printer driver files (%d)!\n"
+msgstr ""
+
+#: cups/adminutil.c:547
+msgid "No Windows printer drivers are installed!\n"
+msgstr ""
+
+#: cups/adminutil.c:550
+msgid "Warning, no Windows 2000 printer drivers are installed!\n"
+msgstr ""
+
+#: cups/adminutil.c:568
+#, c-format
+msgid "Unable to set Windows printer driver (%d)!\n"
+msgstr ""
+
+#: systemv/cupsaddsmb.c:278
+msgid ""
+"Usage: cupsaddsmb [options] printer1 ... printerN\n"
+"       cupsaddsmb [options] -a\n"
+"\n"
+"Options:\n"
+"  -E               Encrypt the connection to the server\n"
+"  -H samba-server  Use the named SAMBA server\n"
+"  -U samba-user    Authenticate using the named SAMBA user\n"
+"  -a               Export all printers\n"
+"  -h cups-server   Use the named CUPS server\n"
+"  -v               Be verbose (show commands)\n"
+msgstr ""
+
 
 #
 # End of "$Id$".
index cf0517f09d81b840517d6d9c7f2f7f5577b43bbe..677c70806c44049b1d1a0cf970b9ff906122e9d4 100644 (file)
@@ -25,7 +25,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.2\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2006-02-26 20:42-0500\n"
+"POT-Creation-Date: 2006-03-05 22:39-0500\n"
 "PO-Revision-Date: 2006-02-17 11:17+0900\n"
 "Last-Translator: Kenshi Muto <kmuto@debian.org>\n"
 "Language-Team: Japanese <LL@li.org>\n"
@@ -51,31 +51,32 @@ msgstr "補助"
 
 #: cups/ppd.c:656 cups/ppd.c:881 cups/ppd.c:1047 cups/ppd.c:662 cups/ppd.c:996
 #: cups/ppd.c:1169 cups/ppd.c:651 cups/ppd.c:983 cups/ppd.c:1148
+#: cups/ppd.c:972 cups/ppd.c:1137
 msgid "General"
 msgstr "一般"
 
 #: cups/ppd.c:704 cups/ppd.c:1105 cups/ppd.c:710 cups/ppd.c:1224
-#: cups/ppd.c:697 cups/ppd.c:1201
+#: cups/ppd.c:697 cups/ppd.c:1201 cups/ppd.c:1190
 msgid "Media Size"
 msgstr "用紙サイズ"
 
 #: cups/ppd.c:706 cups/ppd.c:1107 cups/ppd.c:712 cups/ppd.c:1226
-#: cups/ppd.c:699 cups/ppd.c:1203
+#: cups/ppd.c:699 cups/ppd.c:1203 cups/ppd.c:1192
 msgid "Media Type"
 msgstr "用紙形式"
 
 #: cups/ppd.c:708 cups/ppd.c:1109 cups/ppd.c:714 cups/ppd.c:1228
-#: cups/ppd.c:701 cups/ppd.c:1205
+#: cups/ppd.c:701 cups/ppd.c:1205 cups/ppd.c:1194
 msgid "Media Source"
 msgstr "給紙"
 
 #: cups/ppd.c:710 cups/ppd.c:1111 cups/ppd.c:716 cups/ppd.c:1230
-#: cups/ppd.c:703 cups/ppd.c:1207
+#: cups/ppd.c:703 cups/ppd.c:1207 cups/ppd.c:1196
 msgid "Output Mode"
 msgstr "出力モード"
 
 #: cups/ppd.c:712 cups/ppd.c:1113 cups/ppd.c:718 cups/ppd.c:1232
-#: cups/ppd.c:705 cups/ppd.c:1209
+#: cups/ppd.c:705 cups/ppd.c:1209 cups/ppd.c:1198
 msgid "Resolution"
 msgstr "解像度"
 
@@ -83,11 +84,11 @@ msgstr "解像度"
 msgid "Variable"
 msgstr "可変"
 
-#: cups/ppd.c:1535 cups/ppd.c:1650 cups/ppd.c:1627
+#: cups/ppd.c:1535 cups/ppd.c:1650 cups/ppd.c:1627 cups/ppd.c:1616
 msgid "Yes"
 msgstr "はい"
 
-#: cups/ppd.c:1537 cups/ppd.c:1652 cups/ppd.c:1629
+#: cups/ppd.c:1537 cups/ppd.c:1652 cups/ppd.c:1629 cups/ppd.c:1618
 msgid "No"
 msgstr "いいえ"
 
@@ -96,7 +97,7 @@ msgid "Auto"
 msgstr "自動"
 
 #: scheduler/client.c:2247 scheduler/client.c:2251 scheduler/client.c:2274
-#: scheduler/client.c:2308
+#: scheduler/client.c:2308 scheduler/client.c:2349
 msgid ""
 "Enter your username and password or the root username and password to access "
 "this page."
@@ -105,7 +106,7 @@ msgstr ""
 "のユーザ名とパスワードを入力してください。"
 
 #: scheduler/client.c:2252 scheduler/client.c:2256 scheduler/client.c:2279
-#: scheduler/client.c:2313
+#: scheduler/client.c:2313 scheduler/client.c:2354
 msgid "You must use a https: URL to access this page."
 msgstr "このページにアクセスするためには、https: URL を使う必要があります。"
 
@@ -734,6 +735,7 @@ msgstr "lpq: サーバに連絡できません!\n"
 #: systemv/lpmove.c:84 systemv/accept.c:106 systemv/cancel.c:93
 #: systemv/lpmove.c:89 berkeley/lpq.c:124 systemv/lp.c:136
 #: systemv/lpstat.c:116 berkeley/lpr.c:116 systemv/lp.c:140
+#: systemv/cupsaddsmb.c:98
 #, c-format
 msgid "%s: Sorry, no encryption support compiled in!\n"
 msgstr "%s: すみません、暗号化サポートはコンパイル時に組み込まれていません!\n"
@@ -2835,7 +2837,7 @@ msgid "Edit Configuration File"
 msgstr "設定ファイルの編集"
 
 #: cgi-bin/admin.c:2135 cgi-bin/admin.c:2147 cgi-bin/admin.c:2179
-#: cgi-bin/admin.c:2191 cgi-bin/printers.c:219
+#: cgi-bin/admin.c:2191 cgi-bin/printers.c:219 cgi-bin/printers.c:224
 msgid "Unable to create temporary file:"
 msgstr "テンポラリファイルを作成できません:"
 
@@ -2959,15 +2961,17 @@ msgid "Unable to change printer-is-shared attribute:"
 msgstr "printer-is-shared 属性を変更できません:"
 
 #: cgi-bin/classes.c:161 cgi-bin/classes.c:208 cgi-bin/classes.c:159
-#: cgi-bin/classes.c:206
+#: cgi-bin/classes.c:206 cgi-bin/classes.c:164 cgi-bin/classes.c:211
 msgid "Classes"
 msgstr "クラス"
 
 #: cgi-bin/classes.c:355 cgi-bin/classes.c:356 cgi-bin/classes.c:354
+#: cgi-bin/classes.c:359
 msgid "Unable to get class list:"
 msgstr "クラスリストを取得できません:"
 
 #: cgi-bin/classes.c:454 cgi-bin/classes.c:455 cgi-bin/classes.c:453
+#: cgi-bin/classes.c:458
 msgid "Unable to get class status:"
 msgstr "クラスの状態を取得できません:"
 
@@ -3009,15 +3013,18 @@ msgid "Job operation failed:"
 msgstr "ジョブ操作に失敗しました:"
 
 #: cgi-bin/printers.c:161 cgi-bin/printers.c:208 cgi-bin/printers.c:211
-#: cgi-bin/printers.c:166 cgi-bin/printers.c:335
+#: cgi-bin/printers.c:166 cgi-bin/printers.c:335 cgi-bin/printers.c:171
+#: cgi-bin/printers.c:340
 msgid "Printers"
 msgstr "プリンタ"
 
 #: cgi-bin/printers.c:362 cgi-bin/printers.c:366 cgi-bin/printers.c:518
+#: cgi-bin/printers.c:523
 msgid "Unable to get printer list:"
 msgstr "プリンタリストを取得できません:"
 
 #: cgi-bin/printers.c:461 cgi-bin/printers.c:468 cgi-bin/printers.c:628
+#: cgi-bin/printers.c:633
 msgid "Unable to get printer status:"
 msgstr "プリンタの状態を取得できません:"
 
@@ -3109,11 +3116,11 @@ msgstr "不正なカスタムパラメータ"
 msgid "Unknown"
 msgstr "未知"
 
-#: cups/ppd.c:1033 cups/ppd.c:1020
+#: cups/ppd.c:1033 cups/ppd.c:1020 cups/ppd.c:1009
 msgid "Custom"
 msgstr "カスタム"
 
-#: cups/ppd.c:1259 cups/ppd.c:1236
+#: cups/ppd.c:1259 cups/ppd.c:1236 cups/ppd.c:1225
 msgid "JCL"
 msgstr "JCL"
 
@@ -3121,17 +3128,17 @@ msgstr "JCL"
 msgid "No authentication information provided!"
 msgstr "認証情報が提供されていません!"
 
-#: systemv/cupsaddsmb.c:440
+#: systemv/cupsaddsmb.c:440 systemv/cupsaddsmb.c:252
 #, c-format
 msgid "Password for %s required to access %s via SAMBA: "
 msgstr "SAMBA 経由で %2$s にアクセスするのに必要な %1$s のパスワード: "
 
-#: systemv/cupsaddsmb.c:451
+#: systemv/cupsaddsmb.c:451 cups/adminutil.c:626
 #, c-format
 msgid "Running command: %s %s -N -U '%s%%%s' -c '%s'\n"
 msgstr "コマンドを実行中: %s %s -N -U '%s%%%s' -c '%s'\n"
 
-#: systemv/cupsaddsmb.c:479
+#: systemv/cupsaddsmb.c:479 cups/adminutil.c:656
 #, c-format
 msgid "cupsaddsmb: Unable to run \"%s\": %s\n"
 msgstr "cupsaddsmb: \"%s\" を実行できません: %s\n"
@@ -3512,7 +3519,7 @@ msgstr "%s: エラー - '-b' オプションのあとに宛先を指定する必
 msgid "%s: Invalid destination name in list \"%s\"!\n"
 msgstr "%s: リスト \"%s\" に無効な宛先名があります!\n"
 
-#: systemv/lpstat.c:571
+#: systemv/lpstat.c:571 systemv/cupsaddsmb.c:156 systemv/cupsaddsmb.c:177
 #, c-format
 msgid "%s: Unable to connect to server\n"
 msgstr "%s: サーバに接続できません\n"
@@ -3593,7 +3600,7 @@ msgstr "cupsd: \"%c\" は未知のオプションです - 停止します!\n"
 msgid "cupsd: Unknown argument \"%s\" - aborting!\n"
 msgstr "cupsd: \"%s\" は未知の引数です - 停止します!\n"
 
-#: scheduler/main.c:2315 scheduler/main.c:2329
+#: scheduler/main.c:2315 scheduler/main.c:2329 scheduler/main.c:2304
 msgid ""
 "Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
 "\n"
@@ -3630,17 +3637,18 @@ msgstr ""
 "        警告    非 Windows PPD ファイルは、CR LF でなく LF のみを行末に使うべ"
 "きです!\n"
 
-#: cgi-bin/printers.c:218 cgi-bin/printers.c:289
+#: cgi-bin/printers.c:218 cgi-bin/printers.c:289 cgi-bin/printers.c:223
+#: cgi-bin/printers.c:294
 #, fuzzy
 msgid "Printer Maintenance"
 msgstr "プリンタは共有されていません!"
 
-#: cgi-bin/printers.c:292
+#: cgi-bin/printers.c:292 cgi-bin/printers.c:297
 #, fuzzy
 msgid "Unable to send maintenance job:"
 msgstr "ジョブを移動できません"
 
-#: systemv/cupsaddsmb.c:566
+#: systemv/cupsaddsmb.c:566 systemv/cupsaddsmb.c:233
 #, fuzzy, c-format
 msgid "cupsaddsmb: No PPD file for printer \"%s\" - %s\n"
 msgstr ""
@@ -3685,3 +3693,88 @@ msgstr ""
 #, c-format
 msgid "      **FAIL**  Bad cupsFilter value \"%s\"!\n"
 msgstr ""
+
+#: cgi-bin/help.c:98 cgi-bin/help.c:139 cgi-bin/help.c:149 cgi-bin/help.c:179
+msgid "Help"
+msgstr ""
+
+#: cups/adminutil.c:233
+#, fuzzy, c-format
+msgid "Missing value on line %d!\n"
+msgstr "cupsaddsmb: %d 行に値がありません!\n"
+
+#: cups/adminutil.c:249
+#, fuzzy, c-format
+msgid "Missing double quote on line %d!\n"
+msgstr "cupsaddsmb: %d 行に二重引用符がありません!\n"
+
+#: cups/adminutil.c:266
+#, fuzzy, c-format
+msgid "Bad option + choice on line %d!\n"
+msgstr "cupsaddsmb: %d 行に不正なオプションと選択があります!\n"
+
+#: cups/adminutil.c:417
+#, fuzzy, c-format
+msgid "Unable to copy Windows 2000 printer driver files (%d)!\n"
+msgstr "Windows 2000 プリンタドライバファイルをコピーできません!"
+
+#: cups/adminutil.c:445
+#, fuzzy, c-format
+msgid "Unable to copy CUPS printer driver files (%d)!\n"
+msgstr "cupsaddsmb: CUPS プリンタドライバファイルをコピーできません (%d)!\n"
+
+#: cups/adminutil.c:480
+#, fuzzy, c-format
+msgid "Unable to install Windows 2000 printer driver files (%d)!\n"
+msgstr "Windows 2000 プリンタドライバファイルをインストールできません!"
+
+#: cups/adminutil.c:514
+#, fuzzy, c-format
+msgid "Unable to copy Windows 9x printer driver files (%d)!\n"
+msgstr "Windows 9x プリンタドライバファイルをコピーできません!"
+
+#: cups/adminutil.c:536
+#, fuzzy, c-format
+msgid "Unable to install Windows 9x printer driver files (%d)!\n"
+msgstr "Windows 9x プリンタドライバファイルをインストールできません!"
+
+#: cups/adminutil.c:547
+#, fuzzy
+msgid "No Windows printer drivers are installed!\n"
+msgstr "cupsaddsmb: Windows プリンタドライバがインストールされていません!\n"
+
+#: cups/adminutil.c:550
+#, fuzzy
+msgid "Warning, no Windows 2000 printer drivers are installed!\n"
+msgstr ""
+"cupsaddsmb: 警告: Windows 2000 プリンタドライバがインストールされていませ"
+"ん!\n"
+
+#: cups/adminutil.c:568
+#, fuzzy, c-format
+msgid "Unable to set Windows printer driver (%d)!\n"
+msgstr "Windows プリンタドライバを設定できません!"
+
+#: systemv/cupsaddsmb.c:278
+#, fuzzy
+msgid ""
+"Usage: cupsaddsmb [options] printer1 ... printerN\n"
+"       cupsaddsmb [options] -a\n"
+"\n"
+"Options:\n"
+"  -E               Encrypt the connection to the server\n"
+"  -H samba-server  Use the named SAMBA server\n"
+"  -U samba-user    Authenticate using the named SAMBA user\n"
+"  -a               Export all printers\n"
+"  -h cups-server   Use the named CUPS server\n"
+"  -v               Be verbose (show commands)\n"
+msgstr ""
+"Usage: cupsaddsmb [オプション] プリンタ1 ... プリンタN\n"
+"       cupsaddsmb [オプション] -a\n"
+"\n"
+"Options:\n"
+"  -H sambaサーバ   指定の SAMBA サーバを使う\n"
+"  -U sambaユーザ   指定の SAMBA ユーザ名で認証する\n"
+"  -a               すべてのプリンタをエキスポートする\n"
+"  -h cupsサーバ    指定の CUPS サーバを使う\n"
+"  -v               冗長にする (コマンドを表示する)\n"
index 62e551da827f6fc027769383b89fdb6f2e1f2225..7599458d80cbaf5a9afafad1611b035bc5095b60 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5182 2006-02-26 04:10:27Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Man page makefile for the Common UNIX Printing System (CUPS).
 #
@@ -127,6 +127,31 @@ install:   all
        $(LN) cupsenable.$(MAN8EXT) $(AMANDIR)/man$(MAN8DIR)/cupsdisable.$(MAN8EXT)
 
 
+#
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(MAN1); do \
+               $(RM) $(MANDIR)/man1/$$file; \
+       done
+       -$(RMDIR) $(MANDIR)/man1
+       for file in $(MAN5); do \
+               $(RM) $(MANDIR)/man5/$$file; \
+       done
+       -$(RMDIR) $(MANDIR)/man5
+       for file in $(MAN7); do \
+               $(RM) $(MANDIR)/man7/$$file; \
+       done
+       -$(RMDIR) $(MANDIR)/man7
+       for file in $(MAN8); do \
+               $(RM) $(AMANDIR)/man$(MAN8DIR)/$$file; \
+       done
+       $(RM) $(AMANDIR)/man$(MAN8DIR)/reject.$(MAN8EXT)
+       $(RM) $(AMANDIR)/man$(MAN8DIR)/cupsdisable.$(MAN8EXT)
+       -$(RMDIR) $(AMANDIR)/man$(MAN8DIR)
+
+
 #
 # Make html versions of man pages...
 #
@@ -155,5 +180,5 @@ mantohtml:  mantohtml.o
 
 
 #
-# End of "$Id: Makefile 5182 2006-02-26 04:10:27Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index a689220c9273b108be105225574eb70488119bdc..e7ae20c7a79736e28adc7a8419a0b6f2d7c1fcfe 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5087 2006-02-07 03:43:29Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Port monitor makefile for the Common UNIX Printing System (CUPS).
 #
@@ -65,6 +65,18 @@ install:     all
        done
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       for file in $(TARGETS); do \
+               $(RM) $(SERVERBIN)/monitor/$$file; \
+       done
+       -$(RMDIR) $(SERVERBIN)/monitor
+       -$(RMDIR) $(SERVERBIN)
+
+
 #
 # bcp
 #
@@ -91,5 +103,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5087 2006-02-07 03:43:29Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 09fc0bc447f52f8801dfacf720fb5440a2fefe1c..ecfd7a51f4ca50185156517bcf78e932d9f31e7c 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Notifier makefile for the Common UNIX Printing System (CUPS).
 #
@@ -55,6 +55,18 @@ install:     all
        done
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       for file in $(TARGETS); do \
+               $(RM) $(SERVERBIN)/notifier/$$file; \
+       done
+       -$(RMDIR) $(SERVERBIN)/notifier
+       -$(RMDIR) $(SERVERBIN)
+
+
 #
 # Update dependencies (without system header dependencies...)
 #
@@ -87,5 +99,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index e90a9eeca5fc2ca242ed024529c5ff2aa05dd277..afa1a30d01d13a9f39ba98322aa57025628cf1d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: mailto.c 4961 2006-01-20 22:19:13Z mike $"
+ * "$Id: mailto.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   "mailto" notifier for the Common UNIX Printing System (CUPS).
  *
@@ -274,7 +274,8 @@ email_message(const char *to,               /* I - Recipient of message */
 
     fprintf(stderr, "DEBUG: Connected to \"%s\"...\n", mailtoSMTPServer);
 
-    cupsFilePrintf(fp, "HELO %s\r\n", httpGetHostname(hostbuf, sizeof(hostbuf)));
+    cupsFilePrintf(fp, "HELO %s\r\n",
+                   httpGetHostname(NULL, hostbuf, sizeof(hostbuf)));
     fprintf(stderr, "DEBUG: >>> HELO %s\n", hostbuf);
 
     if (!cupsFileGets(fp, response, sizeof(response)) || atoi(response) >= 500)
@@ -413,7 +414,7 @@ load_configuration(void)
     strlcpy(mailtoFrom, server_admin, sizeof(mailtoFrom));
   else
     snprintf(mailtoFrom, sizeof(mailtoFrom), "root@%s",
-             httpGetHostname(line, sizeof(line)));
+             httpGetHostname(NULL, line, sizeof(line)));
 
   strlcpy(mailtoSendmail, "/usr/sbin/sendmail", sizeof(mailtoSendmail));
 
@@ -794,5 +795,5 @@ print_attributes(ipp_t *ipp,                /* I - IPP request */
 
 
 /*
- * End of "$Id: mailto.c 4961 2006-01-20 22:19:13Z mike $".
+ * End of "$Id: mailto.c 5235 2006-03-06 13:02:23Z mike $".
  */
index c8d9fd24881d1d54883e29c975796a15ea638117..5f38337e224b1f4c97a9a1671a6202d555df5655 100644 (file)
@@ -92,8 +92,8 @@ The GNU LGPL relaxes the "link-to" restriction, allowing you to develop applicat
 The Common UNIX Printing System provides a "pdftops" filter that is based on the Xpdf software. For binary distribution licensing of this software, please contact:\
 \pard\pardeftab720\ql\qnatural
 \cf0 Derek B. Noonburg\
-Email: {\field{\*\fldinst{HYPERLINK "mailto:derekn@foolabs.com"}}{\fldrslt \cf2 \ul \ulc2 derekn@foolabs.com}}\
-WWW: {\field{\*\fldinst{HYPERLINK "http://www.foolabs.com/xpdf/"}}{\fldrslt \cf2 \ul \ulc2 http://www.foolabs.com/xpdf/}}\
+Email: {\field{\*\fldinst{HYPERLINK "mailto:derekn@glyphandcog.com"}}{\fldrslt \cf2 \ul \ulc2 derekn@foolabs.com}}\
+WWW: {\field{\*\fldinst{HYPERLINK "http://www.glyphandcog.com/"}}{\fldrslt \cf2 \ul \ulc2 http://www.glyphandcog.com/}}\
 \pard\pardeftab720\sa280\ql\qnatural
 
 \f0\b\fs28 \cf0 Support\
index f88d7282daace8820f4ff4321cea3e28e0e55bf2..158840a157a9f53da8165d7ea81101f7aa3681db 100644 (file)
Binary files a/packaging/installer.tif and b/packaging/installer.tif differ
index 632fd19f11e3853c0ba0a9fb97688bb0c58b9f7e..25650c2ea33ae9dc0848025213332e5c402d1058 100644 (file)
Binary files a/packaging/installer.xcf.gz and b/packaging/installer.xcf.gz differ
index 9be45f5afd30986e0053c903c36641a6fe4454cf..139190a852487f8dc6f96a3a05b754479b3d1a50 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   pdftops filter Makefile for the Common UNIX Printing System (CUPS).
 #
@@ -126,6 +126,16 @@ install:   all
        $(INSTALL_BIN) pdftops $(SERVERBIN)/filter
 
 
+#
+# Uninstall the filter...
+#
+
+uninstall:
+       $(RM) $(SERVERBIN)/filter/pdftops
+       -$(RMDIR) $(SERVERBIN)/filter
+       -$(RMDIR) $(SERVERBIN)
+
+
 #
 # pdftops
 #
@@ -154,5 +164,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 4554e38432a42fd125ad85f3da0e614cfa2e8b16..0307dc54b24cd589c9a4e43b1dde29dede122b36 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   PPD file makefile for the Common UNIX Printing System (CUPS).
 #
@@ -48,6 +48,13 @@ all:
 clean:
 
 
+#
+# Dummy depend...
+#
+
+depend:
+
+
 #
 # Install files...
 #
@@ -60,5 +67,17 @@ install:     all
 
 
 #
-# End of "$Id: Makefile 5065 2006-02-03 16:55:30Z mike $".
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(FILES); do \
+               $(RM) $(DATADIR)/model/$$file; \
+       done
+       -$(RMDIR) $(DATADIR)/model
+       -$(RMDIR) $(DATADIR)
+
+
+#
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index de9cecfbb7af36dfffb95ae0d0b27e7b0eff4942..403997bb98c4455e00b905fe1bbe765cfbcfd743 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5157 2006-02-23 20:58:57Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Scheduler Makefile for the Common UNIX Printing System (CUPS).
 #
@@ -148,6 +148,31 @@ install:   all
 #      -chgrp $(CUPS_GROUP) $(CACHEDIR)/ppd
 
 
+#
+# Uninstall the scheduler...
+#
+
+uninstall:     all
+       $(RM) $(SBINDIR)/cupsd
+       $(RM) $(SERVERBIN)/daemon/cups-deviced
+       $(RM) $(SERVERBIN)/daemon/cups-driverd
+       $(RM) $(SERVERBIN)/daemon/cups-lpd
+       $(RM) $(SERVERBIN)/daemon/cups-polld
+       -$(RMDIR) $(STATEDIR)/certs
+       -$(RMDIR) $(STATEDIR)
+       -$(RMDIR) $(SERVERROOT)/ppd
+       -$(RMDIR) $(SERVERROOT)/interfaces
+       -$(RMDIR) $(SERVERROOT)
+       -$(RMDIR) $(SERVERBIN)/driver
+       -$(RMDIR) $(SERVERBIN)/daemon
+       -$(RMDIR) $(SERVERBIN)
+       -$(RMDIR) $(SBINDIR)
+       -$(RMDIR) $(REQUESTS)/tmp
+       -$(RMDIR) $(REQUESTS)
+       -$(RMDIR) $(LOGDIR)
+       -$(RMDIR) $(CACHEDIR)
+
+
 #
 # Make the scheduler executable, "cupsd".
 #
@@ -249,5 +274,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5157 2006-02-23 20:58:57Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 7843fe15b3a2a96606cec9c22cc193b8484f3397..83aa9c113f4d3f3379ef58791aaa1fd51b1ac3ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: auth.c 5222 2006-03-03 18:57:56Z mike $"
+ * "$Id: auth.c 5232 2006-03-05 17:59:19Z mike $"
  *
  *   Authorization routines for the Common UNIX Printing System (CUPS).
  *
@@ -1962,45 +1962,45 @@ cups_crypt(const char *pw,              /* I - Password string */
 
     pwlen = strlen(pw);
 
-    _cups_md5_init(&state);
-    _cups_md5_append(&state, (unsigned char *)pw, pwlen);
-    _cups_md5_append(&state, (unsigned char *)salt, salt_end - salt);
+    _cupsMD5Init(&state);
+    _cupsMD5Append(&state, (unsigned char *)pw, pwlen);
+    _cupsMD5Append(&state, (unsigned char *)salt, salt_end - salt);
 
-    _cups_md5_init(&state2);
-    _cups_md5_append(&state2, (unsigned char *)pw, pwlen);
-    _cups_md5_append(&state2, (unsigned char *)salt + 3, salt_end - salt - 3);
-    _cups_md5_append(&state2, (unsigned char *)pw, pwlen);
-    _cups_md5_finish(&state2, digest);
+    _cupsMD5Init(&state2);
+    _cupsMD5Append(&state2, (unsigned char *)pw, pwlen);
+    _cupsMD5Append(&state2, (unsigned char *)salt + 3, salt_end - salt - 3);
+    _cupsMD5Append(&state2, (unsigned char *)pw, pwlen);
+    _cupsMD5Finish(&state2, digest);
 
     for (i = pwlen; i > 0; i -= 16)
-      _cups_md5_append(&state, digest, i > 16 ? 16 : i);
+      _cupsMD5Append(&state, digest, i > 16 ? 16 : i);
 
     for (i = pwlen; i > 0; i >>= 1)
-      _cups_md5_append(&state, (unsigned char *)((i & 1) ? "" : pw), 1);
+      _cupsMD5Append(&state, (unsigned char *)((i & 1) ? "" : pw), 1);
 
-    _cups_md5_finish(&state, digest);
+    _cupsMD5Finish(&state, digest);
 
     for (i = 0; i < 1000; i ++)
     {
-      _cups_md5_init(&state);
+      _cupsMD5Init(&state);
 
       if (i & 1)
-        _cups_md5_append(&state, (unsigned char *)pw, pwlen);
+        _cupsMD5Append(&state, (unsigned char *)pw, pwlen);
       else
-        _cups_md5_append(&state, digest, 16);
+        _cupsMD5Append(&state, digest, 16);
 
       if (i % 3)
-        _cups_md5_append(&state, (unsigned char *)salt + 3, salt_end - salt - 3);
+        _cupsMD5Append(&state, (unsigned char *)salt + 3, salt_end - salt - 3);
 
       if (i % 7)
-        _cups_md5_append(&state, (unsigned char *)pw, pwlen);
+        _cupsMD5Append(&state, (unsigned char *)pw, pwlen);
 
       if (i & 1)
-        _cups_md5_append(&state, digest, 16);
+        _cupsMD5Append(&state, digest, 16);
       else
-        _cups_md5_append(&state, (unsigned char *)pw, pwlen);
+        _cupsMD5Append(&state, (unsigned char *)pw, pwlen);
 
-      _cups_md5_finish(&state, digest);
+      _cupsMD5Finish(&state, digest);
     }
 
    /*
@@ -2156,5 +2156,5 @@ to64(char          *s,                    /* O - Output string */
 
 
 /*
- * End of "$Id: auth.c 5222 2006-03-03 18:57:56Z mike $".
+ * End of "$Id: auth.c 5232 2006-03-05 17:59:19Z mike $".
  */
index ccb02579caf5b8b14384a91a2d2a85207377ae90..7965c70dccbf1b24cee9794e241fcae6338b14e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: conf.c 5222 2006-03-03 18:57:56Z mike $"
+ * "$Id: conf.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   Configuration routines for the Common UNIX Printing System (CUPS).
  *
@@ -271,7 +271,7 @@ cupsdReadConfiguration(void)
   * String options...
   */
 
-  cupsdSetString(&ServerName, httpGetHostname(temp, sizeof(temp)));
+  cupsdSetString(&ServerName, httpGetHostname(NULL, temp, sizeof(temp)));
   cupsdSetStringf(&ServerAdmin, "root@%s", temp);
   cupsdSetString(&ServerBin, CUPS_SERVERBIN);
   cupsdSetString(&RequestRoot, CUPS_REQUESTS);
@@ -930,7 +930,7 @@ cupsdReadConfiguration(void)
     if (NumMimeTypes)
     {
       for (i = 0; i < NumMimeTypes; i ++)
-       _cups_sp_free(MimeTypes[i]);
+       _cupsStrFree(MimeTypes[i]);
 
       free(MimeTypes);
     }
@@ -972,11 +972,11 @@ cupsdReadConfiguration(void)
     {
       snprintf(mimetype, sizeof(mimetype), "%s/%s", type->super, type->type);
 
-      MimeTypes[i] = _cups_sp_alloc(mimetype);
+      MimeTypes[i] = _cupsStrAlloc(mimetype);
     }
 
     if (i < NumMimeTypes)
-      MimeTypes[i] = _cups_sp_alloc("application/octet-stream");
+      MimeTypes[i] = _cupsStrAlloc("application/octet-stream");
 
     if (LogLevel == CUPSD_LOG_DEBUG2)
     {
@@ -3237,5 +3237,5 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
 
 
 /*
- * End of "$Id: conf.c 5222 2006-03-03 18:57:56Z mike $".
+ * End of "$Id: conf.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 3c50525df7c0537d12a0f77043687bc02c4963d6..db9e0652934152888474c0d9885e7ee68ca45bd2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp.c 5164 2006-02-24 20:40:00Z mike $"
+ * "$Id: ipp.c 5232 2006-03-05 17:59:19Z mike $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -426,8 +426,8 @@ cupsdProcessIPPRequest(
            * Remote unauthenticated user masquerading as local root...
            */
 
-           _cups_sp_free(username->values[0].string.text);
-           username->values[0].string.text = _cups_sp_alloc(RemoteRoot);
+           _cupsStrFree(username->values[0].string.text);
+           username->values[0].string.text = _cupsStrAlloc(RemoteRoot);
          }
        }
 
@@ -1342,8 +1342,8 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
   else
   {
     attr->group_tag = IPP_TAG_JOB;
-    _cups_sp_free(attr->name);
-    attr->name = _cups_sp_alloc("job-originating-user-name");
+    _cupsStrFree(attr->name);
+    attr->name = _cupsStrAlloc("job-originating-user-name");
   }
 
   if ((attr = ippFindAttribute(job->attrs, "job-originating-host-name",
@@ -1381,11 +1381,11 @@ add_job(cupsd_client_t  *con,           /* I - Client connection */
 
            for (i = 0; i < attr->num_values; i ++)
            {
-             _cups_sp_free(attr->values[i].string.text);
+             _cupsStrFree(attr->values[i].string.text);
              attr->values[i].string.text = NULL;
              if (attr->values[i].string.charset)
              {
-               _cups_sp_free(attr->values[i].string.charset);
+               _cupsStrFree(attr->values[i].string.charset);
                attr->values[i].string.charset = NULL;
              }
             }
@@ -1400,7 +1400,7 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
 
       attr->value_tag             = IPP_TAG_NAME;
       attr->num_values            = 1;
-      attr->values[0].string.text = _cups_sp_alloc(con->http.hostname);
+      attr->values[0].string.text = _cupsStrAlloc(con->http.hostname);
     }
 
     attr->group_tag = IPP_TAG_JOB;
@@ -1496,8 +1496,8 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
 
       attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
                            2, NULL, NULL);
-      attr->values[0].string.text = _cups_sp_alloc(printer->job_sheets[0]);
-      attr->values[1].string.text = _cups_sp_alloc(printer->job_sheets[1]);
+      attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
+      attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
     }
 
     job->job_sheets = attr;
@@ -1899,7 +1899,7 @@ add_job_subscriptions(
       * Free and remove this attribute...
       */
 
-      _ipp_free_attr(attr);
+      _ippFreeAttr(attr);
 
       if (prev)
         prev->next = next;
@@ -1948,9 +1948,9 @@ add_job_uuid(cupsd_client_t *con, /* I - Client connection */
   snprintf(uuid, sizeof(uuid), "%s:%s:%d:%d", ServerName, con->servername,
           con->serverport, job->id);
 
-  _cups_md5_init(&md5state);
-  _cups_md5_append(&md5state, (unsigned char *)uuid, strlen(uuid));
-  _cups_md5_finish(&md5state, md5sum);
+  _cupsMD5Init(&md5state);
+  _cupsMD5Append(&md5state, (unsigned char *)uuid, strlen(uuid));
+  _cupsMD5Finish(&md5state, md5sum);
 
  /*
   * Format the UUID URI using the MD5 sum and job ID.
@@ -3283,7 +3283,7 @@ copy_attribute(
        else
        {
           for (i = 0; i < attr->num_values; i ++)
-           toattr->values[i].string.text = _cups_sp_alloc(attr->values[i].string.text);
+           toattr->values[i].string.text = _cupsStrAlloc(attr->values[i].string.text);
        }
         break;
 
@@ -3336,12 +3336,12 @@ copy_attribute(
          {
            if (!i)
               toattr->values[i].string.charset =
-                 _cups_sp_alloc(attr->values[i].string.charset);
+                 _cupsStrAlloc(attr->values[i].string.charset);
            else
               toattr->values[i].string.charset =
                  toattr->values[0].string.charset;
 
-           toattr->values[i].string.text = _cups_sp_alloc(attr->values[i].string.text);
+           toattr->values[i].string.text = _cupsStrAlloc(attr->values[i].string.text);
           }
         }
         break;
@@ -6251,18 +6251,18 @@ hold_job(cupsd_client_t  *con,          /* I - Client connection */
     * Free the old hold value and copy the new one over...
     */
 
-    _cups_sp_free(attr->values[0].string.text);
+    _cupsStrFree(attr->values[0].string.text);
 
     if (newattr)
     {
       attr->value_tag = newattr->value_tag;
       attr->values[0].string.text =
-          _cups_sp_alloc(newattr->values[0].string.text);
+          _cupsStrAlloc(newattr->values[0].string.text);
     }
     else
     {
       attr->value_tag = IPP_TAG_KEYWORD;
-      attr->values[0].string.text = _cups_sp_alloc("indefinite");
+      attr->values[0].string.text = _cupsStrAlloc("indefinite");
     }
 
    /*
@@ -6779,9 +6779,9 @@ print_job(cupsd_client_t  *con,           /* I - Client connection */
 
       if (format)
       {
-         _cups_sp_free(format->values[0].string.text);
+         _cupsStrFree(format->values[0].string.text);
 
-       format->values[0].string.text = _cups_sp_alloc(mimetype);
+       format->values[0].string.text = _cupsStrAlloc(mimetype);
       }
       else
         ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
@@ -7056,7 +7056,7 @@ read_ps_job_ticket(cupsd_client_t *con)   /* I - Client connection */
       if (con->request->last == attr2)
         con->request->last = prev2;
 
-      _ipp_free_attr(attr2);
+      _ippFreeAttr(attr2);
     }
 
    /*
@@ -7279,10 +7279,10 @@ release_job(cupsd_client_t  *con,       /* I - Client connection */
 
   if (attr)
   {
-    _cups_sp_free(attr->values[0].string.text);
+    _cupsStrFree(attr->values[0].string.text);
 
     attr->value_tag = IPP_TAG_KEYWORD;
-    attr->values[0].string.text = _cups_sp_alloc("no-hold");
+    attr->values[0].string.text = _cupsStrAlloc("no-hold");
   }
 
  /*
@@ -7803,8 +7803,8 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
 
       if (format)
       {
-       _cups_sp_free(format->values[0].string.text);
-       format->values[0].string.text = _cups_sp_alloc(mimetype);
+       _cupsStrFree(format->values[0].string.text);
+       format->values[0].string.text = _cupsStrAlloc(mimetype);
       }
       else
         ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
@@ -8385,7 +8385,7 @@ set_job_attrs(cupsd_client_t  *con,       /* I - Client connection */
       if (job->attrs->last == attr2)
         job->attrs->last = job->attrs->prev;
 
-      _ipp_free_attr(attr2);
+      _ippFreeAttr(attr2);
 
      /*
       * Then copy the attribute...
@@ -8424,7 +8424,7 @@ set_job_attrs(cupsd_client_t  *con,       /* I - Client connection */
         if (attr2 == job->attrs->last)
          job->attrs->last = job->attrs->prev;
 
-        _ipp_free_attr(attr2);
+        _ippFreeAttr(attr2);
       }
     }
     else
@@ -9094,5 +9094,5 @@ validate_user(cupsd_job_t    *job,        /* I - Job */
 
 
 /*
- * End of "$Id: ipp.c 5164 2006-02-24 20:40:00Z mike $".
+ * End of "$Id: ipp.c 5232 2006-03-05 17:59:19Z mike $".
  */
index b0b581cdec8980676b126e0cf67eac709a3de541..b325a413916c837837c237c79b3b1f59c6cf56af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: main.c 5216 2006-03-02 17:47:53Z mike $"
+ * "$Id: main.c 5231 2006-03-05 17:22:27Z mike $"
  *
  *   Scheduler main loop for the Common UNIX Printing System (CUPS).
  *
@@ -980,7 +980,7 @@ main(int  argc,                             /* I - Number of command-line args */
                      mem.fsmblks + mem.fordblks);
 #endif /* HAVE_MALLINFO */
 
-      string_count = _cups_sp_statistics(&alloc_bytes, &total_bytes);
+      string_count = _cupsStrStatistics(&alloc_bytes, &total_bytes);
       cupsdLogMessage(CUPSD_LOG_DEBUG2,
                       "stringpool: " CUPS_LLFMT " strings, "
                      CUPS_LLFMT " allocated, " CUPS_LLFMT " total bytes",
@@ -2313,5 +2313,5 @@ usage(int status)                 /* O - Exit status */
 
 
 /*
- * End of "$Id: main.c 5216 2006-03-02 17:47:53Z mike $".
+ * End of "$Id: main.c 5231 2006-03-05 17:22:27Z mike $".
  */
index 96ccbcaa858727bb6dde4718a2ac129954c17e36..8efd1396a9c55d1f7b55256cf38bf8eeee2d4749 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: printers.c 5178 2006-02-26 00:24:23Z mike $"
+ * "$Id: printers.c 5231 2006-03-05 17:22:27Z mike $"
  *
  *   Printer routines for the Common UNIX Printing System (CUPS).
  *
@@ -454,12 +454,12 @@ cupsdCreateCommonData(void)
       cupsd_banner_t   *banner;        /* Current banner */
 
 
-      attr->values[0].string.text = _cups_sp_alloc("none");
+      attr->values[0].string.text = _cupsStrAlloc("none");
 
       for (i = 1, banner = (cupsd_banner_t *)cupsArrayFirst(Banners);
           banner;
           i ++, banner = (cupsd_banner_t *)cupsArrayNext(Banners))
-       attr->values[i].string.text = _cups_sp_alloc(banner->name);
+       attr->values[i].string.text = _cupsStrAlloc(banner->name);
     }
   }
   else
@@ -552,7 +552,7 @@ cupsdCreateCommonData(void)
   attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME,
                        "printer-op-policy-supported", NumPolicies, NULL, NULL);
   for (i = 0; i < NumPolicies; i ++)
-    attr->values[i].string.text = _cups_sp_alloc(Policies[i]->name);
+    attr->values[i].string.text = _cupsStrAlloc(Policies[i]->name);
 }
 
 
@@ -1568,9 +1568,9 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
 
     if (attr != NULL)
     {
-      attr->values[0].string.text = _cups_sp_alloc(Classification ?
+      attr->values[0].string.text = _cupsStrAlloc(Classification ?
                                           Classification : p->job_sheets[0]);
-      attr->values[1].string.text = _cups_sp_alloc(Classification ?
+      attr->values[1].string.text = _cupsStrAlloc(Classification ?
                                           Classification : p->job_sheets[1]);
     }
   }
@@ -1638,7 +1638,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
        for (i = 0; i < p->num_printers; i ++)
        {
           if (attr != NULL)
-            attr->values[i].string.text = _cups_sp_alloc(p->printers[i]->uri);
+            attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->uri);
 
          p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
         }
@@ -1649,7 +1649,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
        if (attr != NULL)
        {
          for (i = 0; i < p->num_printers; i ++)
-            attr->values[i].string.text = _cups_sp_alloc(p->printers[i]->name);
+            attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->name);
         }
       }
     }
@@ -1767,20 +1767,20 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
 
            if (input_slot != NULL)
              for (i = 0; i < input_slot->num_choices; i ++, val ++)
-               val->string.text = _cups_sp_alloc(input_slot->choices[i].choice);
+               val->string.text = _cupsStrAlloc(input_slot->choices[i].choice);
 
            if (media_type != NULL)
              for (i = 0; i < media_type->num_choices; i ++, val ++)
-               val->string.text = _cups_sp_alloc(media_type->choices[i].choice);
+               val->string.text = _cupsStrAlloc(media_type->choices[i].choice);
 
            if (media_quality != NULL)
              for (i = 0; i < media_quality->num_choices; i ++, val ++)
-               val->string.text = _cups_sp_alloc(media_quality->choices[i].choice);
+               val->string.text = _cupsStrAlloc(media_quality->choices[i].choice);
 
            if (page_size != NULL)
            {
              for (i = 0; i < page_size->num_choices; i ++, val ++)
-               val->string.text = _cups_sp_alloc(page_size->choices[i].choice);
+               val->string.text = _cupsStrAlloc(page_size->choices[i].choice);
 
              ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
                           "media-default", NULL, page_size->defchoice);
@@ -1815,7 +1815,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
            for (i = 0, val = attr->values;
                 i < output_bin->num_choices;
                 i ++, val ++)
-             val->string.text = _cups_sp_alloc(output_bin->choices[i].choice);
+             val->string.text = _cupsStrAlloc(output_bin->choices[i].choice);
           }
        }
 
@@ -1920,19 +1920,19 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
         attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
                             "port-monitor-supported", i, NULL, NULL);
 
-        attr->values[0].string.text = _cups_sp_alloc("none");
+        attr->values[0].string.text = _cupsStrAlloc("none");
 
         for (i = 1, ppdattr = ppdFindAttr(ppd, "cupsPortMonitor", NULL);
             ppdattr;
             i ++, ppdattr = ppdFindNextAttr(ppd, "cupsPortMonitor", NULL))
-         attr->values[i].string.text = _cups_sp_alloc(ppdattr->value);
+         attr->values[i].string.text = _cupsStrAlloc(ppdattr->value);
 
         if (ppd->protocols)
        {
          if (strstr(ppd->protocols, "TBCP"))
-           attr->values[i].string.text = _cups_sp_alloc("tbcp");
+           attr->values[i].string.text = _cupsStrAlloc("tbcp");
          else if (strstr(ppd->protocols, "BCP"))
-           attr->values[i].string.text = _cups_sp_alloc("bcp");
+           attr->values[i].string.text = _cupsStrAlloc("bcp");
        }
 
        /*
@@ -2949,7 +2949,7 @@ add_printer_formats(cupsd_printer_t *p)   /* I - Printer */
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer_formats: %d types, %d filters",
                   mimeNumTypes(MimeDatabase), mimeNumFilters(MimeDatabase));
 
-  types[0] = _cups_sp_alloc("application/octet-stream");
+  types[0] = _cupsStrAlloc("application/octet-stream");
 
   for (num_types = 1, type = mimeFirstType(MimeDatabase);
        type;
@@ -2968,7 +2968,7 @@ add_printer_formats(cupsd_printer_t *p)   /* I - Printer */
                       p->name, mimetype, cupsArrayCount(filters));
 
       cupsArrayDelete(filters);
-      types[num_types] = _cups_sp_alloc(mimetype);
+      types[num_types] = _cupsStrAlloc(mimetype);
       num_types ++;
     }
     else
@@ -2993,7 +2993,7 @@ add_printer_formats(cupsd_printer_t *p)   /* I - Printer */
   */
 
   for (i = 0; i < num_types; i ++)
-    _cups_sp_free(types[i]);
+    _cupsStrFree(types[i]);
 
   free(types);
 }
@@ -3351,5 +3351,5 @@ write_irix_state(cupsd_printer_t *p)      /* I - Printer to update */
 
 
 /*
- * End of "$Id: printers.c 5178 2006-02-26 00:24:23Z mike $".
+ * End of "$Id: printers.c 5231 2006-03-05 17:22:27Z mike $".
  */
index e32b13dcb6814b8cba908959509886f5c0c43d23..a0edfbd315bd7a79837bd0e0eae4b238bf5ee421 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: sysman.c 5095 2006-02-09 16:22:48Z mike $"
+ * "$Id: sysman.c 5241 2006-03-07 22:07:44Z mike $"
  *
  *   System management definitions for the Common UNIX Printing System (CUPS).
  *
@@ -264,6 +264,7 @@ cupsdStopSystemMonitor(void)
 void
 cupsdUpdateSystemMonitor(void)
 {
+  int                  i;              /* Looping var */
   cupsd_sysevent_t     sysevent;       /* The system event */
   cupsd_printer_t      *p;             /* Printer information */
 
@@ -278,14 +279,25 @@ cupsdUpdateSystemMonitor(void)
     if (sysevent.event & SYSEVENT_CANSLEEP)
     {
      /*
-      * If there are any active printers cancel the sleep request...
+      * If there are active printers that don't have the connecting-to-device
+      * printer-state-reason then cancel the sleep request (i.e. this reason
+      * indicates a job that is not yet connected to the printer)...
       */
 
       for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
            p;
           p = (cupsd_printer_t *)cupsArrayNext(Printers))
+      {
         if (p->job)
-          break;
+        {
+         for (i = 0; i < p->num_reasons; i ++)
+           if (!strcmp(p->reasons[i], "connecting-to-device"))
+             break;
+
+         if (!p->num_reasons || i >= p->num_reasons)
+           break;
+        }
+      }
 
       if (p)
       {
@@ -747,5 +759,5 @@ sysEventTimerNotifier(
 
 
 /*
- * End of "$Id: sysman.c 5095 2006-02-09 16:22:48Z mike $".
+ * End of "$Id: sysman.c 5241 2006-03-07 22:07:44Z mike $".
  */
index f674ca767cbd4018a0e2cf972203a364257ee766..d17772edc4ad68015528b0c8042696f3421e1a69 100644 (file)
@@ -1,6 +1,6 @@
 # DO NOT DELETE
 
-phpcups.o: phpcups.h ../../cups/cups.h ../../cups/ipp.h ../../cups/http.h
-phpcups.o: ../../cups/md5.h ../../cups/ppd.h ../../cups/array.h
-phpcups.o: ../../cups/file.h ../../cups/language.h ../../cups/language.h
-phpcups.o: ../../cups/string.h ../../config.h ../../cups/debug.h
+phpcups.o: ../../cups/string.h ../../config.h phpcups.h ../../cups/cups.h
+phpcups.o: ../../cups/ipp.h ../../cups/http.h ../../cups/md5.h
+phpcups.o: ../../cups/ppd.h ../../cups/array.h ../../cups/file.h
+phpcups.o: ../../cups/language.h ../../cups/language.h ../../cups/debug.h
index 398c2714ec85b8a0afbcb839df2df0e1ec759ab5..acf6f2d2789c557359461a5455e48a07d36b3d9a 100644 (file)
@@ -45,14 +45,14 @@ OBJS        =       phpcups.o
 # Targets in this directory...
 #
 
-TARGETS        =       phpcups.so
+PHPCUPS        =       phpcups.so
 
 
 #
 # Make all targets...
 #
 
-all:   $(TARGETS)
+all:   $(PHPCUPS)
 
 
 #
@@ -60,7 +60,7 @@ all:  $(TARGETS)
 #
 
 clean:
-       $(RM) $(OBJS) $(TARGETS)
+       $(RM) $(OBJS) $(PHPCUPS)
 
 
 #
@@ -76,9 +76,18 @@ depend:
 #
 
 install:       all
-       echo Installing $(TARGETS) in $(PHPDIR)
+       echo Installing $(PHPCUPS) in $(PHPDIR)
        $(INSTALL_DIR) $(PHPDIR)
-       cp $(TARGETS) $(PHPDIR)
+       $(INSTALL_BIN) $(PHPCUPS) $(PHPDIR)
+
+
+#
+# Uninstall object and target files...
+#
+
+uninstall:
+       $(RM) $(PHPDIR)/$(PHPCUPS)
+       -$(RMDIR) $(PHPDIR)
 
 
 #
index b9c4c76f1936634207e9f1cba2671910bbecedfd..c93db938ba4c6fca2b3e1f967d2c38acd9bc29b9 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5143 2006-02-21 19:13:01Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Standards makefile for the Common UNIX Printing System (CUPS).
 #
@@ -100,6 +100,13 @@ depend:
 install:       all
 
 
+#
+# Uninstall files...
+#
+
+uninstall:
+
+
 #
 # rfctohtml - make html versions of RFCs...
 #
@@ -110,5 +117,5 @@ rfctohtml:  rfctohtml.o ../cups/libcups.a
 
 
 #
-# End of "$Id: Makefile 5143 2006-02-21 19:13:01Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index d24772b5c3b8c7468899dc373985100e13aba14a..1879b63b39993132551dfe293cd58f550dac18c5 100644 (file)
@@ -6,10 +6,10 @@ accept.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
 cancel.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
 cancel.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
 cancel.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
-cupsaddsmb.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
-cupsaddsmb.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
-cupsaddsmb.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
-cupsaddsmb.o: ../cups/debug.h
+cupsaddsmb.o: ../cups/string.h ../config.h ../cups/adminutil.h ../cups/cups.h
+cupsaddsmb.o: ../cups/ipp.h ../cups/http.h ../cups/md5.h ../cups/ppd.h
+cupsaddsmb.o: ../cups/array.h ../cups/file.h ../cups/language.h
+cupsaddsmb.o: ../cups/i18n.h ../cups/debug.h
 cupstestppd.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
 cupstestppd.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
 cupstestppd.o: ../cups/file.h ../cups/language.h ../cups/i18n.h
index 9cc85ea21232baeaa64e49a3daa1899e8f9df23e..268518c84085a88f79cd59d5c552e67311185026 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5222 2006-03-03 18:57:56Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   System V commands makefile for the Common UNIX Printing System (CUPS).
 #
@@ -80,6 +80,29 @@ install:     all
        $(INSTALL_BIN) -m 4755 -o $(CUPS_USER) -g $(CUPS_GROUP) lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR)
 
 
+#
+# Uninstall all targets...
+#
+
+uninstall:
+       $(RM) $(BINDIR)/cancel
+       $(RM) $(BINDIR)/cupstestppd
+       $(RM) $(BINDIR)/lp
+       $(RM) $(BINDIR)/lpoptions
+       $(RM) $(BINDIR)/lppasswd
+       $(RM) $(BINDIR)/lpstat
+       -$(RMDIR) $(BINDIR)
+       $(RM) $(SBINDIR)/accept
+       $(RM) $(SBINDIR)/cupsaddsmb
+       $(RM) $(SBINDIR)/cupsdisable
+       $(RM) $(SBINDIR)/cupsenable
+       $(RM) $(SBINDIR)/lpadmin
+       $(RM) $(SBINDIR)/lpinfo
+       $(RM) $(SBINDIR)/lpmove
+       $(RM) $(SBINDIR)/reject
+       -$(RMDIR) $(SBINDIR)
+
+
 #
 # accept
 #
@@ -191,5 +214,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 5222 2006-03-03 18:57:56Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 4d0bdc15e3185a154bf4849340010f70b718cba0..a69e113f10e17873a06a4da20d09583965009977 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cupsaddsmb.c 5187 2006-02-26 20:36:03Z mike $"
+ * "$Id: cupsaddsmb.c 5233 2006-03-06 03:39:28Z mike $"
  *
  *   "cupsaddsmb" command for the Common UNIX Printing System (CUPS).
  *
  *
  * Contents:
  *
- *   main()             - Export printers on the command-line.
- *   convert_ppd()      - Convert a PPD file to a form usable by any of the
- *                        Windows PostScript printer drivers.
- *   do_samba_command() - Do a SAMBA command, asking for a password as needed.
- *   export_dest()      - Export a destination to SAMBA.
- *   ppd_gets()         - Get a CR and/or LF-terminated line.
- *   usage()            - Show program usage and exit...
- *   write_option()     - Write a CUPS option to a PPD file.
+ *   main()        - Export printers on the command-line.
+ *   export_dest() - Export a destination to SAMBA.
+ *   usage()       - Show program usage and exit...
  */
 
 /*
@@ -40,7 +35,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <cups/string.h>
-#include <cups/cups.h>
+#include <cups/adminutil.h>
 #include <cups/i18n.h>
 #include <cups/debug.h>
 #include <errno.h>
@@ -63,16 +58,8 @@ const char   *SAMBAUser,
  * Local functions...
  */
 
-int    convert_ppd(const char *src, char *dst, int dstsize, ipp_t *info);
-int    do_samba_command(const char *command, const char *address,
-                        const char *subcommand);
-int    export_dest(const char *dest);
-char   *ppd_gets(FILE *fp, char *buf, int  buflen);
+int    export_dest(http_t *http, const char *dest);
 void   usage(void);
-int    write_option(FILE *dstfp, int order, const char *name,
-                    const char *text, const char *attrname,
-                    ipp_attribute_t *suppattr, ipp_attribute_t *defattr,
-                    int defval, int valcount);
 
 
 /*
@@ -86,6 +73,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   int          i, j;                   /* Looping vars */
   int          status;                 /* Status from export_dest() */
   int          export_all;             /* Export all printers? */
+  http_t       *http;                  /* Connection to server */
   int          num_dests;              /* Number of printers */
   cups_dest_t  *dests;                 /* Printers */
 
@@ -94,15 +82,31 @@ main(int  argc,                             /* I - Number of command-line arguments */
   * Parse command-line arguments...
   */
 
-  export_all = 0;
-
+  export_all    = 0;
+  http          = NULL;
   SAMBAUser     = cupsUser();
   SAMBAPassword = NULL;
   SAMBAServer   = NULL;
 
   for (i = 1; i < argc; i ++)
-    if (!strcmp(argv[i], "-a"))
-      export_all = 1;
+    if (!strcmp(argv[i], "-E"))
+    {
+#ifdef HAVE_SSL
+      cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
+#else
+      _cupsLangPrintf(stderr,
+                     _("%s: Sorry, no encryption support compiled in!\n"),
+                     argv[0]);
+#endif /* HAVE_SSL */
+    }
+    else if (!strcmp(argv[i], "-H"))
+    {
+      i ++;
+      if (i >= argc)
+        usage();
+
+      SAMBAServer = argv[i];
+    }
     else if (!strcmp(argv[i], "-U"))
     {
       char     *sep;                   /* Separator for password */
@@ -126,14 +130,8 @@ main(int  argc,                            /* I - Number of command-line arguments */
         SAMBAPassword = sep;
       }
     }
-    else if (!strcmp(argv[i], "-H"))
-    {
-      i ++;
-      if (i >= argc)
-        usage();
-
-      SAMBAServer = argv[i];
-    }
+    else if (!strcmp(argv[i], "-a"))
+      export_all = 1;
     else if (!strcmp(argv[i], "-h"))
     {
       i ++;
@@ -146,15 +144,40 @@ main(int  argc,                           /* I - Number of command-line arguments */
       Verbosity = 1;
     else if (argv[i][0] != '-')
     {
+      if (!http)
+      {
+       /*
+       * Connect to the server...
+       */
+
+       if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption())) == NULL)
+       {
+         _cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), argv[0]);
+         exit(1);
+       }
+      }
+
       if (SAMBAServer == NULL)
        SAMBAServer = cupsServer();
 
-      if ((status = export_dest(argv[i])) != 0)
+      if ((status = export_dest(http, argv[i])) != 0)
        return (status);
     }
     else
       usage();
 
+ /*
+  * Connect to the server...
+  */
+
+  if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                 cupsEncryption())) == NULL)
+  {
+    _cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), argv[0]);
+    exit(1);
+  }
+
  /*
   * See if the user specified "-a"...
   */
@@ -168,12 +191,12 @@ main(int  argc,                           /* I - Number of command-line arguments */
     if (SAMBAServer == NULL)
       SAMBAServer = cupsServer();
 
-    num_dests = cupsGetDests(&dests);
+    num_dests = cupsGetDests2(http, &dests);
 
     for (j = 0, status = 0; j < num_dests; j ++)
       if (!dests[j].instance)
       {
-        if ((status = export_dest(dests[j].name)) != 0)
+        if ((status = export_dest(http, dests[j].name)) != 0)
          break;
       }
 
@@ -187,710 +210,60 @@ main(int  argc,                          /* I - Number of command-line arguments */
 }
 
 
-/*
- * 'convert_ppd()' - Convert a PPD file to a form usable by any of the
- *                   Windows PostScript printer drivers.
- */
-
-int                                    /* O - 0 on success, 1 on failure */
-convert_ppd(const char *src,           /* I - Source (original) PPD */
-            char       *dst,           /* O - Destination PPD */
-           int        dstsize,         /* I - Size of destination buffer */
-           ipp_t      *info)           /* I - Printer attributes */
-{
-  FILE                 *srcfp,         /* Source file */
-                       *dstfp;         /* Destination file */
-  int                  dstfd;          /* Destination file descriptor */
-  ipp_attribute_t      *suppattr,      /* IPP -supported attribute */
-                       *defattr;       /* IPP -default attribute */
-  char                 line[256],      /* Line from PPD file */
-                       junk[256],      /* Extra junk to throw away */
-                       *ptr,           /* Pointer into line */
-                       option[41],     /* Option */
-                       choice[41];     /* Choice */
-  int                  jcloption,      /* In a JCL option? */
-                       linenum;        /* Current line number */
-  time_t               curtime;        /* Current time */
-  struct tm            *curdate;       /* Current date */
-
-
- /*
-  * Open the original PPD file...
-  */
-
-  if ((srcfp = fopen(src, "rb")) == NULL)
-    return (1);
-
- /*
-  * Create a temporary output file using the destination buffer...
-  */
-
-  if ((dstfd = cupsTempFd(dst, dstsize)) < 0)
-  {
-    fclose(srcfp);
-
-    return (1);
-  }
-
-  if ((dstfp = fdopen(dstfd, "w")) == NULL)
-  {
-   /*
-    * Unable to convert to FILE *...
-    */
-
-    close(dstfd);
-
-    fclose(srcfp);
-
-    return (1);
-  }
-
- /*
-  * Write a new header explaining that this isn't the original PPD...
-  */
-
-  fputs("*PPD-Adobe: \"4.3\"\n", dstfp);
-
-  curtime = time(NULL);
-  curdate = gmtime(&curtime);
-
-  fprintf(dstfp, "*%% Modified on %04d%02d%02d%02d%02d%02d+0000 by cupsaddsmb\n",
-          curdate->tm_year + 1900, curdate->tm_mon + 1, curdate->tm_mday,
-          curdate->tm_hour, curdate->tm_min, curdate->tm_sec);
-
- /*
-  * Read the existing PPD file, converting all PJL commands to CUPS
-  * job ticket comments...
-  */
-
-  jcloption = 0;
-  linenum   = 0;
-
-  while (ppd_gets(srcfp, line, sizeof(line)) != NULL)
-  {
-    linenum ++;
-
-    if (!strncmp(line, "*PPD-Adobe:", 11))
-    {
-     /*
-      * Already wrote the PPD header...
-      */
-
-      continue;
-    }
-    else if (!strncmp(line, "*JCLBegin:", 10) ||
-             !strncmp(line, "*JCLToPSInterpreter:", 20) ||
-            !strncmp(line, "*JCLEnd:", 8) ||
-            !strncmp(line, "*Protocols:", 11))
-    {
-     /*
-      * Don't use existing JCL keywords; we'll create our own, below...
-      */
-
-      fprintf(dstfp, "*%% Commented out by cupsaddsmb...\n*%%%s", line + 1);
-      continue;
-    }
-    else if (!strncmp(line, "*JCLOpenUI", 10))
-    {
-      jcloption = 1;
-      fputs(line, dstfp);
-    }
-    else if (!strncmp(line, "*JCLCloseUI", 11))
-    {
-      jcloption = 0;
-      fputs(line, dstfp);
-    }
-    else if (jcloption &&
-             strncmp(line, "*End", 4) &&
-             strncmp(line, "*Default", 8) &&
-             strncmp(line, "*OrderDependency", 16))
-    {
-      if ((ptr = strchr(line, ':')) == NULL)
-      {
-        _cupsLangPrintf(stderr,
-                       _("cupsaddsmb: Missing value on line %d!\n"), linenum);
-        fclose(srcfp);
-        fclose(dstfp);
-        close(dstfd);
-       unlink(dst);
-       return (1);
-      }
-
-      if ((ptr = strchr(ptr, '\"')) == NULL)
-      {
-        _cupsLangPrintf(stderr,
-                       _("cupsaddsmb: Missing double quote on line %d!\n"),
-                       linenum);
-        fclose(srcfp);
-        fclose(dstfp);
-        close(dstfd);
-       unlink(dst);
-       return (1);
-      }
-
-      if (sscanf(line, "*%40s%*[ \t]%40[^/]", option, choice) != 2)
-      {
-        _cupsLangPrintf(stderr,
-                       _("cupsaddsmb: Bad option + choice on line %d!\n"),
-                       linenum);
-        fclose(srcfp);
-        fclose(dstfp);
-        close(dstfd);
-       unlink(dst);
-       return (1);
-      }
-
-      if (strchr(ptr + 1, '\"') == NULL)
-      {
-       /*
-        * Skip remaining...
-       */
-
-       while (ppd_gets(srcfp, junk, sizeof(junk)) != NULL)
-       {
-         linenum ++;
-
-         if (!strncmp(junk, "*End", 4))
-           break;
-       }
-      }
-
-      snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
-               "%%cupsJobTicket: %s=%s\n\"\n*End\n", option, choice);
-
-      fprintf(dstfp, "*%% Changed by cupsaddsmb...\n%s", line);
-    }
-    else
-      fputs(line, dstfp);
-  }
-
-  fclose(srcfp);
-
- /*
-  * Now add the CUPS-specific attributes and options...
-  */
-
-  fputs("\n*% CUPS Job Ticket support and options...\n", dstfp);
-  fputs("*Protocols: PJL\n", dstfp);
-  fputs("*JCLBegin: \"%!PS-Adobe-3.0<0A>\"\n", dstfp);
-  fputs("*JCLToPSInterpreter: \"\"\n", dstfp);
-  fputs("*JCLEnd: \"\"\n", dstfp);
-
-  fputs("\n*OpenGroup: CUPS/CUPS Options\n\n", dstfp);
-
-  if ((defattr = ippFindAttribute(info, "job-hold-until-default",
-                                  IPP_TAG_ZERO)) != NULL &&
-      (suppattr = ippFindAttribute(info, "job-hold-until-supported",
-                                   IPP_TAG_ZERO)) != NULL)
-    write_option(dstfp, 10, "cupsJobHoldUntil", "Hold Until", "job-hold-until",
-                 suppattr, defattr, 0, 1);
-
-  if ((defattr = ippFindAttribute(info, "job-priority-default",
-                                  IPP_TAG_INTEGER)) != NULL &&
-      (suppattr = ippFindAttribute(info, "job-priority-supported",
-                                   IPP_TAG_RANGE)) != NULL)
-    write_option(dstfp, 11, "cupsJobPriority", "Priority", "job-priority",
-                 suppattr, defattr, 0, 1);
-
-  if ((defattr = ippFindAttribute(info, "job-sheets-default",
-                                  IPP_TAG_ZERO)) != NULL &&
-      (suppattr = ippFindAttribute(info, "job-sheets-supported",
-                                   IPP_TAG_ZERO)) != NULL)
-  {
-    write_option(dstfp, 20, "cupsJobSheetsStart", "Start Banner",
-                 "job-sheets", suppattr, defattr, 0, 2);
-    write_option(dstfp, 21, "cupsJobSheetsEnd", "End Banner",
-                 "job-sheets", suppattr, defattr, 1, 2);
-  }
-
-  fputs("*CloseGroup: CUPS\n", dstfp);
-
-  fclose(dstfp);
-  close(dstfd);
-
-  return (0);
-}
-
-
-/*
- * 'do_samba_command()' - Do a SAMBA command, asking for
- *                        a password as needed.
- */
-
-int                                    /* O - Status of command */
-do_samba_command(const char *command,  /* I - Command to run */
-                 const char *address,  /* I - Address for command */
-                 const char *subcmd)   /* I - Sub-command */
-{
-  int          status;                 /* Status of command */
-  char         temp[4096];             /* Command/prompt string */
-  int          pid;                    /* Process ID of child */
-
-
-  DEBUG_printf(("do_samba_command(command=\"%s\", address=\"%s\", subcmd=\"%s\")\n",
-               command, address, subcmd));
-  DEBUG_printf(("SAMBAUser=\"%s\", SAMBAPassword=\"%s\"\n", SAMBAUser,
-                SAMBAPassword));
-
-  for (status = 1; status; )
-  {
-    if (!SAMBAPassword)
-    {
-      snprintf(temp, sizeof(temp),
-               _("Password for %s required to access %s via SAMBA: "),
-              SAMBAUser, SAMBAServer);
-
-      if ((SAMBAPassword = cupsGetPassword(temp)) == NULL)
-       break;
-    }
-
-    snprintf(temp, sizeof(temp), "%s%%%s", SAMBAUser, SAMBAPassword);
-
-    if (Verbosity)
-      _cupsLangPrintf(stdout,
-                      _("Running command: %s %s -N -U \'%s%%%s\' -c \'%s\'\n"),
-                     command, address, SAMBAUser, SAMBAPassword, subcmd);
-
-    if ((pid = fork()) == 0)
-    {
-     /*
-      * Child goes here, redirect stdin/out/err and execute the command...
-      */
-
-      close(0);
-      open("/dev/null", O_RDONLY);
-
-      if (!Verbosity)
-      {
-        close(1);
-       open("/dev/null", O_WRONLY);
-       close(2);
-       dup(1);
-      }
-
-      execlp(command, command, address, "-N", "-U", temp, "-c", subcmd,
-             (char *)0);
-      exit(errno);
-    }
-    else if (pid < 0)
-    {
-      status = -1;
-
-      _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to run \"%s\": %s\n"),
-                      command, strerror(errno));
-    }
-    else
-    {
-     /*
-      * Wait for the process to complete...
-      */
-
-      while (wait(&status) != pid);
-    }
-
-    DEBUG_printf(("status=%d\n", status));
-
-    if (Verbosity)
-      _cupsLangPuts(stdout, "\n");
-
-    if (status)
-    {
-      if (SAMBAPassword[0])
-        SAMBAPassword = NULL;
-      else
-        break;
-    }
-  }
-
-  return (status);
-}
-
-
 /*
  * 'export_dest()' - Export a destination to SAMBA.
  */
 
 int                                    /* O - 0 on success, non-zero on error */
-export_dest(const char *dest)          /* I - Destination to export */
+export_dest(http_t     *http,          /* I - Connection to server */
+            const char *dest)          /* I - Destination to export */
 {
-  int                  status;         /* Status of smbclient/rpcclient commands */
-  int                  have_drivers;   /* Have drivers? */
-  const char           *ppdfile;       /* PPD file for printer drivers */
-  char                 newppd[1024],   /* New PPD file for printer drivers */
-                       file[1024],     /* File to test for */
-                       address[1024],  /* Address for command */
-                       uri[1024],      /* Printer URI */
-                       subcmd[1024];   /* Sub-command */
-  const char           *datadir;       /* CUPS_DATADIR */
-  http_t               *http;          /* Connection to server */
-  ipp_t                        *request,       /* IPP request */
-                       *response;      /* IPP response */
-  static const char    *pattrs[] =     /* Printer attributes we want */
-                       {
-                         "job-hold-until-supported",
-                         "job-hold-until-default",
-                         "job-sheets-supported",
-                         "job-sheets-default",
-                         "job-priority-supported",
-                         "job-priority-default"
-                       };
+  int          status;                 /* Status of export */
+  char         ppdfile[1024],          /* PPD file for printer drivers */
+               prompt[1024];           /* Password prompt */
 
 
  /*
-  * Get the location of the printer driver files...
+  * Get the Windows PPD file for the printer...
   */
 
-  if ((datadir = getenv("CUPS_DATADIR")) == NULL)
-    datadir = CUPS_DATADIR;
-
- /*
-  * Open a connection to the scheduler...
-  */
-
-  if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL)
-  {
-    _cupsLangPrintf(stderr,
-                    _("cupsaddsmb: Unable to connect to server \"%s\" for "
-                     "%s - %s\n"),
-                   cupsServer(), dest, strerror(errno));
-    return (1);
-  }
-
- /*
-  * Get the PPD file...
-  */
-
-  if ((ppdfile = cupsGetPPD2(http, dest)) == NULL)
+  if (!cupsAdminCreateWindowsPPD(http, dest, ppdfile, sizeof(ppdfile)))
   {
     _cupsLangPrintf(stderr,
                     _("cupsaddsmb: No PPD file for printer \"%s\" - "
                      "%s\n"),
                    dest, cupsLastErrorString());
-    httpClose(http);
-    return (0);
-  }
-
- /*
-  * Append the supported banner pages to the PPD file...
-  */
-
-  request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
-
-  httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
-                   "localhost", 0, "/printers/%s", dest);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
-               "printer-uri", NULL, uri);
-
-  ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-                "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
-               NULL, pattrs);
-
- /*
-  * Do the request and get back a response...
-  */
-
-  if ((response = cupsDoRequest(http, request, "/")) != NULL)
-  {
-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "cupsaddsmb: %s - %s\n", dest,
-                      cupsLastErrorString());
-      ippDelete(response);
-      httpClose(http);
-      unlink(ppdfile);
-      return (2);
-    }
-  }
-  else
-  {
-    _cupsLangPrintf(stderr, "cupsaddsmb: %s - %s\n", dest,
-                    cupsLastErrorString());
-    httpClose(http);
-    unlink(ppdfile);
-    return (2);
+    return (1);
   }
 
  /*
-  * Convert the PPD file to the Windows driver format...
+  * Try to export it...
   */
 
-  if (convert_ppd(ppdfile, newppd, sizeof(newppd), response))
+  for (status = 0; !status;)
   {
-    _cupsLangPrintf(stderr,
-                    _("cupsaddsmb: Unable to convert PPD file for %s - %s\n"),
-                   dest, strerror(errno));
-    ippDelete(response);
-    httpClose(http);
-    unlink(ppdfile);
-    return (3);
-  }
-
-  ippDelete(response);
-  httpClose(http);
-
- /*
-  * Remove the old PPD and point to the new one...
-  */
-
-  unlink(ppdfile);
-
-  ppdfile = newppd;
-
- /*
-  * See which drivers are available; the new CUPS v6 and Adobe drivers
-  * depend on the Windows 2k PS driver, so copy that driver first:
-  *
-  * Files:
-  *
-  *     ps5ui.dll
-  *     pscript.hlp
-  *     pscript.ntf
-  *     pscript5.dll
-  */
-
-  have_drivers = 0;
-
-  snprintf(file, sizeof(file), "%s/drivers/pscript5.dll", datadir);
-  if (!access(file, 0))
-  {
-    have_drivers |= 1;
-
-   /*
-    * Windows 2k driver is installed; do the smbclient commands needed
-    * to copy the Win2k drivers over...
-    */
-
-    snprintf(address, sizeof(address), "//%s/print$", SAMBAServer);
-
-    snprintf(subcmd, sizeof(subcmd),
-             "mkdir W32X86;"
-            "put %s W32X86/%s.ppd;"
-            "put %s/drivers/ps5ui.dll W32X86/ps5ui.dll;"
-            "put %s/drivers/pscript.hlp W32X86/pscript.hlp;"
-            "put %s/drivers/pscript.ntf W32X86/pscript.ntf;"
-            "put %s/drivers/pscript5.dll W32X86/pscript5.dll",
-            ppdfile, dest, datadir, datadir, datadir, datadir);
-
-    if ((status = do_samba_command("smbclient", address, subcmd)) != 0)
-    {
-      _cupsLangPrintf(stderr,
-                      _("cupsaddsmb: Unable to copy Windows 2000 printer "
-                       "driver files (%d)!\n"),
-                      status);
-      unlink(ppdfile);
-      return (4);
-    }
-
    /*
-    * See if we also have the CUPS driver files; if so, use them!
+    * Get the password, as needed...
     */
 
-    snprintf(file, sizeof(file), "%s/drivers/cupsps6.dll", datadir);
-    if (!access(file, 0))
-    {
-     /*
-      * Copy the CUPS driver files over...
-      */
-
-      snprintf(subcmd, sizeof(subcmd),
-               "put %s/drivers/cups6.ini W32X86/cups6.ini;"
-               "put %s/drivers/cupsps6.dll W32X86/cupsps6.dll;"
-              "put %s/drivers/cupsui6.dll W32X86/cupsui6.dll",
-              datadir, datadir, datadir);
-
-      if ((status = do_samba_command("smbclient", address, subcmd)) != 0)
-      {
-       _cupsLangPrintf(stderr,
-                       _("cupsaddsmb: Unable to copy CUPS printer driver "
-                         "files (%d)!\n"),
-                       status);
-       unlink(ppdfile);
-       return (4);
-      }
-      
-     /*
-      * Do the rpcclient command needed for the CUPS drivers...
-      */
-
-      snprintf(subcmd, sizeof(subcmd),
-               "adddriver \"Windows NT x86\" \"%s:"
-              "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
-              "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,"
-              "cups6.ini,cupsps6.dll,cupsui6.dll\"",
-              dest, dest, dest);
-    }
-    else
-    {
-     /*
-      * Don't have the CUPS drivers, so just use the standard Windows
-      * drivers...
-      */
-
-      snprintf(subcmd, sizeof(subcmd),
-               "adddriver \"Windows NT x86\" \"%s:"
-              "pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
-              "pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf\"",
-              dest, dest, dest);
-    }
-
-    if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0)
+    if (!SAMBAPassword)
     {
-      _cupsLangPrintf(stderr,
-                      _("cupsaddsmb: Unable to install Windows 2000 printer "
-                       "driver files (%d)!\n"),
-                     status);
-      unlink(ppdfile);
-      return (5);
-    }
-  }
-
-  snprintf(file, sizeof(file), "%s/drivers/ADOBEPS4.DRV", datadir);
-  if (!access(file, 0))
-  {
-    have_drivers |= 2;
-
-   /*
-    * Do the smbclient commands needed for the Adobe Win9x drivers...
-    */
-
-    snprintf(address, sizeof(address), "//%s/print$", SAMBAServer);
-
-    snprintf(subcmd, sizeof(subcmd),
-             "mkdir WIN40;"
-            "put %s WIN40/%s.PPD;"
-            "put %s/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;"
-            "put %s/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;"
-            "put %s/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;"
-            "put %s/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;"
-            "put %s/drivers/PSMON.DLL WIN40/PSMON.DLL;",
-            ppdfile, dest, datadir, datadir, datadir, datadir, datadir);
+      snprintf(prompt, sizeof(prompt),
+               _("Password for %s required to access %s via SAMBA: "),
+              SAMBAUser, SAMBAServer);
 
-    if ((status = do_samba_command("smbclient", address, subcmd)) != 0)
-    {
-      _cupsLangPrintf(stderr,
-                      _("cupsaddsmb: Unable to copy Windows 9x printer "
-                       "driver files (%d)!\n"),
-                     status);
-      unlink(ppdfile);
-      return (6);
+      if ((SAMBAPassword = cupsGetPassword(prompt)) == NULL)
+       break;
     }
 
-   /*
-    * Do the rpcclient commands needed for the Adobe Win9x drivers...
-    */
-
-    snprintf(subcmd, sizeof(subcmd),
-            "adddriver \"Windows 4.0\" \"%s:ADOBEPS4.DRV:%s.PPD:NULL:"
-            "ADOBEPS4.HLP:PSMON.DLL:RAW:"
-            "ADOBEPS4.DRV,%s.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,"
-            "ICONLIB.DLL\"",
-            dest, dest, dest);
-
-    if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0)
-    {
-      _cupsLangPrintf(stderr,
-                      _("cupsaddsmb: Unable to install Windows 9x printer "
-                       "driver files (%d)!\n"),
-                     status);
-      unlink(ppdfile);
-      return (7);
-    }
+    status = cupsAdminExportSamba(dest, ppdfile, SAMBAServer,
+                                  SAMBAUser, SAMBAPassword,
+                                 Verbosity ? stderr : NULL);
   }
 
   unlink(ppdfile);
 
-  if (have_drivers == 0)
-  {
-    _cupsLangPuts(stderr,
-                  _("cupsaddsmb: No Windows printer drivers are installed!\n"));
-    return (9);
-  }
-  else if (have_drivers == 2)
-    _cupsLangPuts(stderr,
-                  _("cupsaddsmb: Warning, no Windows 2000 printer drivers "
-                   "are installed!\n"));
-
- /*
-  * Finally, associate the drivers we just added with the queue...
-  */
-
-  snprintf(subcmd, sizeof(subcmd), "setdriver %s %s", dest, dest);
-
-  if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0)
-  {
-    _cupsLangPrintf(stderr,
-                    _("cupsaddsmb: Unable to set Windows printer driver (%d)!\n"),
-                   status);
-    return (8);
-  }
-
-  return (0);
-}
-
-
-/*
- * 'ppd_gets()' - Get a CR and/or LF-terminated line.
- */
-
-char *                                 /* O - Line read or NULL on eof/error */
-ppd_gets(FILE *fp,                     /* I - File to read from*/
-         char *buf,                    /* O - String buffer */
-        int  buflen)                   /* I - Size of string buffer */
-{
-  int          ch;                     /* Character from file */
-  char         *ptr,                   /* Current position in line buffer */
-               *end;                   /* End of line buffer */
-
-
- /*
-  * Range check input...
-  */
-
-  if (!fp || !buf || buflen < 2 || feof(fp))
-    return (NULL);
-
- /*
-  * Now loop until we have a valid line...
-  */
-
-  for (ptr = buf, end = buf + buflen - 1; ptr < end ;)
-  {
-    if ((ch = getc(fp)) == EOF)
-    {
-      if (ptr == buf)
-        return (NULL);
-      else
-        break;
-    }
-
-    *ptr++ = ch;
-
-    if (ch == '\r')
-    {
-     /*
-      * Check for CR LF...
-      */
-
-      if ((ch = getc(fp)) != '\n')
-        ungetc(ch, fp);
-      else if (ptr < end)
-        *ptr++ = ch;
-
-      break;
-    }
-    else if (ch == '\n')
-    {
-     /*
-      * Line feed ends a line...
-      */
-
-      break;
-    }
-  }
-
-  *ptr = '\0';
-
-  return (buf);
+  return (!status);
 }
 
 
@@ -906,6 +279,7 @@ usage(void)
                  "       cupsaddsmb [options] -a\n"
                  "\n"
                  "Options:\n"
+                 "  -E               Encrypt the connection to the server\n"
                  "  -H samba-server  Use the named SAMBA server\n"
                  "  -U samba-user    Authenticate using the named SAMBA user\n"
                  "  -a               Export all printers\n"
@@ -916,115 +290,5 @@ usage(void)
 
 
 /*
- * 'write_option()' - Write a CUPS option to a PPD file.
- */
-
-int                                    /* O - 0 on success, 1 on failure */
-write_option(FILE            *dstfp,   /* I - PPD file */
-             int             order,    /* I - Order dependency */
-             const char      *name,    /* I - Option name */
-            const char      *text,     /* I - Option text */
-             const char      *attrname,        /* I - Attribute name */
-             ipp_attribute_t *suppattr,        /* I - IPP -supported attribute */
-            ipp_attribute_t *defattr,  /* I - IPP -default attribute */
-            int             defval,    /* I - Default value number */
-            int             valcount)  /* I - Number of values */
-{
-  int  i;                              /* Looping var */
-
-
-  if (!dstfp || !name || !text || !suppattr || !defattr)
-    return (1);
-
-  fprintf(dstfp, "*JCLOpenUI *%s/%s: PickOne\n"
-                 "*OrderDependency: %d JCLSetup *%s\n",
-          name, text, order, name);
-
-  if (defattr->value_tag == IPP_TAG_INTEGER)
-  {
-   /*
-    * Do numeric options with a range or list...
-    */
-
-    fprintf(dstfp, "*Default%s: %d\n", name, defattr->values[defval].integer);
-
-    if (suppattr->value_tag == IPP_TAG_RANGE)
-    {
-     /*
-      * List each number in the range...
-      */
-
-      for (i = suppattr->values[0].range.lower;
-           i <= suppattr->values[0].range.upper;
-          i ++)
-      {
-        fprintf(dstfp, "*%s %d: \"", name, i);
-
-        if (valcount == 1)
-         fprintf(dstfp, "%%cupsJobTicket: %s=%d\n\"\n*End\n", attrname, i);
-        else if (defval == 0)
-         fprintf(dstfp, "%%cupsJobTicket: %s=%d\"\n", attrname, i);
-        else if (defval < (valcount - 1))
-         fprintf(dstfp, ",%d\"\n", i);
-        else
-         fprintf(dstfp, ",%d\n\"\n*End\n", i);
-      }
-    }
-    else
-    {
-     /*
-      * List explicit numbers...
-      */
-
-      for (i = 0; i < suppattr->num_values; i ++)
-      {
-        fprintf(dstfp, "*%s %d: \"", name, suppattr->values[i].integer);
-
-        if (valcount == 1)
-         fprintf(dstfp, "%%cupsJobTicket: %s=%d\n\"\n*End\n", attrname,
-                 suppattr->values[i].integer);
-        else if (defval == 0)
-         fprintf(dstfp, "%%cupsJobTicket: %s=%d\"\n", attrname,
-                 suppattr->values[i].integer);
-        else if (defval < (valcount - 1))
-         fprintf(dstfp, ",%d\"\n", suppattr->values[i].integer);
-        else
-         fprintf(dstfp, ",%d\n\"\n*End\n", suppattr->values[i].integer);
-      }
-    }
-  }
-  else
-  {
-   /*
-    * Do text options with a list...
-    */
-
-    fprintf(dstfp, "*Default%s: %s\n", name,
-            defattr->values[defval].string.text);
-
-    for (i = 0; i < suppattr->num_values; i ++)
-    {
-      fprintf(dstfp, "*%s %s: \"", name, suppattr->values[i].string.text);
-
-      if (valcount == 1)
-       fprintf(dstfp, "%%cupsJobTicket: %s=%s\n\"\n*End\n", attrname,
-               suppattr->values[i].string.text);
-      else if (defval == 0)
-       fprintf(dstfp, "%%cupsJobTicket: %s=%s\"\n", attrname,
-               suppattr->values[i].string.text);
-      else if (defval < (valcount - 1))
-       fprintf(dstfp, ",%s\"\n", suppattr->values[i].string.text);
-      else
-       fprintf(dstfp, ",%s\n\"\n*End\n", suppattr->values[i].string.text);
-    }
-  }
-
-  fprintf(dstfp, "*JCLCloseUI: *%s\n\n", name);
-
-  return (0);
-}
-
-
-/*
- * End of "$Id: cupsaddsmb.c 5187 2006-02-26 20:36:03Z mike $".
+ * End of "$Id: cupsaddsmb.c 5233 2006-03-06 03:39:28Z mike $".
  */
index 6946280ae1997161ac30a7ea8c2798029f8750bd..ee2ac802bd8216448eb4d8d37efa1c4da10ca07c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lp.c 4974 2006-01-25 07:04:33Z mike $"
+ * "$Id: lp.c 5235 2006-03-06 13:02:23Z mike $"
  *
  *   "lp" command for the Common UNIX Printing System (CUPS).
  *
@@ -287,7 +287,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
 
              snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(),
-                      httpGetHostname(buffer, sizeof(buffer)));
+                      httpGetHostname(NULL, buffer, sizeof(buffer)));
              num_options = cupsAddOption("notify-recipient", email,
                                          num_options, &options);
            }
@@ -838,5 +838,5 @@ sighandler(int s)                   /* I - Signal number */
 
 
 /*
- * End of "$Id: lp.c 4974 2006-01-25 07:04:33Z mike $".
+ * End of "$Id: lp.c 5235 2006-03-06 13:02:23Z mike $".
  */
index 8eded7d396dba9d08a80425bb8247bf791667bbe..b374ddda35f2d6805be8c90a9c50c4c5ed8c69e4 100644 (file)
@@ -1,5 +1,5 @@
 #
-# "$Id: Makefile 5222 2006-03-03 18:57:56Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   Template makefile for the Common UNIX Printing System (CUPS).
 #
@@ -108,6 +108,13 @@ all:
 clean:
 
 
+#
+# Dummy depend...
+#
+
+depend:
+
+
 #
 # Install files...
 #
@@ -128,5 +135,22 @@ install: all
 
 
 #
-# End of "$Id: Makefile 5222 2006-03-03 18:57:56Z mike $".
+# Uninstall files...
+#
+
+uninstall:
+       for file in $(FILES); do \
+               $(RM) $(DATADIR)/templates/$$file; \
+       done
+       for lang in $(LANGUAGES); do \
+               for file in $(FILES); do \
+                       $(RM) $(DATADIR)/templates/$$lang/$$file; \
+               done \
+               $(RMDIR) $(DATADIR)/templates/$$lang; \
+       done
+       -$(RMDIR) $(DATADIR)/templates
+
+
+#
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 0c34c4939bba9c09966561b8be05decbb8375e4f..6a23d703a1f6bf4ea8a4dc1a26c716ba583688e1 100644 (file)
@@ -1,4 +1,4 @@
-<TABLE CELLPADDING="0" CELLSPACING="0" CLASS="button" WIDTH="100%">
+<TABLE CELLPADDING="0" CELLSPACING="0" WIDTH="100%" SUMMARY="Administration Tasks">
 <TR><TD VALIGN="TOP" NOWRAP>
 
 <H2 CLASS="title">Printers</H2>
index 775938cf61a640cc618696ef59e4a6a80d198ad5..d6019d3bdca42ede105ea05a87a6dd4b02d16017 100644 (file)
@@ -81,10 +81,10 @@ function reset_config()
 
 <TEXTAREA NAME="CUPSDCONF" COLS="80" ROWS="25">{CUPSDCONF}</TEXTAREA>
 
-<P><INPUT TYPE="IMAGE" SRC="/images/save-changes.gif"
+<P><INPUT TYPE="IMAGE" SRC="/images/button-save-changes.gif"
 ALT="Save Changes"> <A
 HREF="javascript:reset_config();"><IMG
-SRC="/images/use-default-config.gif" CLASS="button"
+SRC="/images/button-use-default-config.gif" CLASS="button"
 ALT="Use Default Configuration File"></A></P>
 
 </FORM>
index 86d3ad2dd13630d130a59c5b3ecbd5f85ab18255..de2fd5713db975fc003396903cadcfd20de4eccb 100644 (file)
@@ -1,9 +1,9 @@
 #
-# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $"
+# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $"
 #
 #   IPP test makefile for the Common UNIX Printing System (CUPS).
 #
-#   Copyright 1997-2005 by Easy Software Products, all rights reserved.
+#   Copyright 1997-2006 by Easy Software Products, all rights reserved.
 #
 #   These coded instructions, statements, and computer programs are the
 #   property of Easy Software Products and are protected by Federal
@@ -55,6 +55,13 @@ depend:
 install: all
 
 
+#
+# Unnstall all targets...
+#
+
+uninstall:
+
+
 #
 # ipptest
 #
@@ -73,5 +80,5 @@ include Dependencies
 
 
 #
-# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $".
+# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $".
 #
index 98891cb2535c321dafaa30fc5e6b8e12740da13e..9193b8a3de4a69df6f6119d346d9d57ac1ec3c59 100755 (executable)
@@ -3,7 +3,7 @@
 if test ! -f tools/testosx; then
        echo "Run this script from the top-level CUPS source directory, e.g.:"
        echo ""
-       echo "    tools/testosx"
+       echo "    tools/testosx [version]"
        echo ""
        exit 1
 fi
@@ -11,6 +11,12 @@ fi
 # Get the current working copy version...
 rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
 
+if test $# = 0; then
+       version="1.2svn-r$rev"
+else
+       version=$1
+fi
+
 # Setup an install directory...
 user=`whoami`
 topdir=`pwd`
@@ -57,10 +63,10 @@ fi
 chmod 755 $pkgdir/Resources/postflight
 
 # Tag the current revision in the plist and web interface files...
-sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
+sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
        -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
        <packaging/cups-desc.plist.in >packaging/cups-desc.plist
-sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
+sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
        -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
        <packaging/cups-info.plist.in >packaging/cups-info.plist
 
@@ -91,7 +97,7 @@ $PackageMaker -build -v -p cups.pkg \
 
 # Create a disk image...
 echo Creating MacOS X disk image...
-hdiutil create -ov -srcfolder cups.pkg cups-1.2svn-r$rev.dmg
+hdiutil create -ov -srcfolder cups.pkg cups-$version.dmg
 
 # Cleanup temp files...
 echo Removing temporary files...