/*
- * "$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:
*
* See who is logged in...
*/
- if ((user = getenv("REMOTE_USER")) == NULL)
- user = "guest";
+ user = getenv("REMOTE_USER");
/*
* Connect to the HTTP 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);
}
fprintf(stderr, "DEBUG: show_all_printers(http=%p, user=\"%s\")\n",
- http, user);
+ http, user ? user : "(null)");
/*
* Show the standard header...
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");
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
*/
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);
}
/*
- * 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 $".
*/