/*
- * "$Id: jobs.c 6889 2007-08-29 22:23:35Z mike $"
+ * Job status CGI for CUPS.
*
- * Job status CGI for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
*
- * Copyright 2007 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * 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:
- *
- * main() - Main entry for CGI.
- * do_job_op() - Do a job operation.
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
*/
/*
*/
int /* O - Exit status */
-main(int argc, /* I - Number of command-line arguments */
- char *argv[]) /* I - Command-line arguments */
+main(void)
{
http_t *http; /* Connection to the server */
const char *op; /* Operation name */
*/
cgiSetVariable("SECTION", "jobs");
+ cgiSetVariable("REFRESH_PAGE", "");
/*
* Connect to the HTTP server...
char url[1024]; /* Encoded URL */
- strcpy(url, "5;URL=");
+ strlcpy(url, "5;URL=", sizeof(url));
cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
cgiSetVariable("refresh_page", url);
}
+ else if (cupsLastError() == IPP_NOT_AUTHORIZED)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
cgiStartHTML(cgiText(_("Jobs")));
if (cupsLastError() > IPP_OK_CONFLICT)
- cgiShowIPPError(_("Job operation failed:"));
+ cgiShowIPPError(_("Job operation failed"));
else if (op == IPP_CANCEL_JOB)
cgiCopyTemplateLang("job-cancel.tmpl");
else if (op == IPP_HOLD_JOB)
cgiEndHTML();
}
-
-
-/*
- * End of "$Id: jobs.c 6889 2007-08-29 22:23:35Z mike $".
- */