/*
- * "$Id: ipp-var.c 7940 2008-09-16 00:45:16Z mike $"
+ * "$Id$"
*
* CGI <-> IPP variable routines for CUPS.
*
*nameptr = '\0';
if (!strncmp(name, "printer_state_history", 21))
- strcpy(name, "printer_state_history");
+ strlcpy(name, "printer_state_history", sizeof(name));
/*
* Possibly add it to the list of attributes...
ipp_t *request, /* Get-Job-Attributes request */
*response; /* Get-Job-Attributes response */
ipp_attribute_t *attr; /* Current job attribute */
- static const char const *job_attrs[] =/* Job attributes we want */
+ static const char * const job_attrs[] =/* Job attributes we want */
{
"job-state",
"job-printer-state-message"
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
"ipp://localhost/");
- if ((which_jobs = cgiGetVariable("which_jobs")) != NULL)
+ if ((which_jobs = cgiGetVariable("which_jobs")) != NULL && *which_jobs)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which_jobs);
if (first < 0)
first = 0;
- if ((var = cgiGetVariable("ORDER")) != NULL)
+ if ((var = cgiGetVariable("ORDER")) != NULL && *var)
ascending = !_cups_strcasecmp(var, "asc");
else
- ascending = !which_jobs || !_cups_strcasecmp(which_jobs, "not-completed");
+ ascending = !which_jobs || !*which_jobs ||
+ !_cups_strcasecmp(which_jobs, "not-completed");
section = cgiGetVariable("SECTION");
/*
- * End of "$Id: ipp-var.c 7940 2008-09-16 00:45:16Z mike $".
+ * End of "$Id$".
*/