]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/printers.c
Load cups into easysw/current.
[thirdparty/cups.git] / cgi-bin / printers.c
index 74b950d56d3a1479643f41ab2ca4e212ef2388db..068547cb4f009181185c303ab365deb8fa5206d8 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: printers.c 5202 2006-02-28 19:37:03Z mike $"
+ * "$Id: printers.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   Printer status CGI for the Common UNIX Printing System (CUPS).
  *
+ *   Copyright 2007 by Apple Inc.
  *   Copyright 1997-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
+ *   property of Apple Inc. 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
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  * Contents:
  *
@@ -98,8 +89,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
   * See who is logged in...
   */
 
-  if ((user = getenv("REMOTE_USER")) == NULL)
-    user = "guest";
+  user = getenv("REMOTE_USER");
 
  /*
   * Connect to the HTTP server...
@@ -287,7 +277,7 @@ print_command(http_t     *http,             /* I - Connection to server */
     */
 
     cgiFormEncode(uri, resource, sizeof(uri));
-    snprintf(refresh, sizeof(refresh), "2;%s", uri);
+    snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
     cgiSetVariable("refresh_page", refresh);
   }
 
@@ -331,7 +321,7 @@ show_all_printers(http_t     *http, /* I - Connection to server */
 
 
   fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
-          http, user);
+          http, user ? user : "(null)");
 
  /*
   * Show the standard header...
@@ -357,8 +347,9 @@ show_all_printers(http_t     *http, /* I - Connection to server */
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM,
                 "printer-type-mask", CUPS_PRINTER_CLASS);
 
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, user);
+  if (user)
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+                "requesting-user-name", NULL, user);
 
   cgiGetAttributes(request, "printers.tmpl");
 
@@ -543,7 +534,7 @@ show_printer(http_t     *http,              /* I - Connection to server */
 
 
   fprintf(stderr, "DEBUG: show_printer(http=%p, printer=\"%s\")\n",
-          http, printer);
+          http, printer ? printer : "(null)");
 
  /*
   * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
@@ -594,7 +585,7 @@ show_printer(http_t     *http,              /* I - Connection to server */
       */
 
       cgiFormEncode(uri, printer, sizeof(uri));
-      snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri);
+      snprintf(refresh, sizeof(refresh), "10;URL=/printers/%s", uri);
       cgiSetVariable("refresh_page", refresh);
     }
 
@@ -638,5 +629,5 @@ show_printer(http_t     *http,              /* I - Connection to server */
 
 
 /*
- * End of "$Id: printers.c 5202 2006-02-28 19:37:03Z mike $".
+ * End of "$Id: printers.c 6649 2007-07-11 21:46:42Z mike $".
  */