]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/ipp-var.c
Update svn:keyword properties.
[thirdparty/cups.git] / cgi-bin / ipp-var.c
index 1251e89a695e7e1bff55f24a9e801b31b409e2fe..38120da080168c98d85fb4cdf0200ad6f218fd3d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-var.c 7940 2008-09-16 00:45:16Z mike $"
+ * "$Id$"
  *
  *   CGI <-> IPP variable routines for CUPS.
  *
@@ -129,7 +129,7 @@ cgiGetAttributes(ipp_t      *request,       /* I - IPP request */
       *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...
@@ -554,7 +554,7 @@ cgiPrintCommand(http_t     *http,   /* I - Connection to server */
   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"
@@ -1432,7 +1432,7 @@ cgiShowJobs(http_t     *http,             /* I - Connection to server */
     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);
 
@@ -1480,10 +1480,11 @@ cgiShowJobs(http_t     *http,           /* I - Connection to server */
     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");
 
@@ -1588,5 +1589,5 @@ cgiText(const char *message)              /* I - Message */
 
 
 /*
- * End of "$Id: ipp-var.c 7940 2008-09-16 00:45:16Z mike $".
+ * End of "$Id$".
  */