/*
- * "$Id: classes.c 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: classes.c 6649 2007-07-11 21:46:42Z mike $"
*
* Class 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 if we are displaying a printer or all classes...
*/
- if (!strcmp(argv[0], "/") || strstr(argv[0], "classes.cgi"))
- pclass = NULL;
- else
- pclass = argv[0];
+ if ((pclass = getenv("PATH_INFO")) != NULL)
+ {
+ pclass ++;
+
+ if (!*pclass)
+ pclass = NULL;
+ }
/*
* See who is logged in...
*/
- if ((user = getenv("REMOTE_USER")) == NULL)
- user = "guest";
+ user = getenv("REMOTE_USER");
/*
* Connect to the HTTP server...
void
show_all_classes(http_t *http, /* I - Connection to server */
- const char *user) /* I - Username */
+ const char *user) /* I - Username */
{
int i; /* Looping var */
ipp_t *request, /* IPP request */
request = ippNewRequest(CUPS_GET_CLASSES);
- 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, "classes.tmpl");
* Delete the response...
*/
+ cupsArrayDelete(classes);
ippDelete(response);
}
else
*/
cgiFormEncode(uri, pclass, sizeof(uri));
- snprintf(refresh, sizeof(refresh), "10;/classes/%s", uri);
+ snprintf(refresh, sizeof(refresh), "10;URL=/classes/%s", uri);
cgiSetVariable("refresh_page", refresh);
}
/*
- * End of "$Id: classes.c 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: classes.c 6649 2007-07-11 21:46:42Z mike $".
*/