]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 21 Mar 2003 17:09:51 +0000 (17:09 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 21 Mar 2003 17:09:51 +0000 (17:09 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3510 7a7537e8-13f0-0310-91df-b6672ffda945

cgi-bin/admin.c
cgi-bin/classes.c
cgi-bin/ipp-var.c
cgi-bin/ipp-var.h
cgi-bin/jobs.c
cgi-bin/printers.c

index 132df461b7ba88f38e1053d80e8388f7b58d7d24..bc8d8721fa5dcc4ade113081244e61f5c2d446ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: admin.c,v 1.22.2.20 2003/01/07 18:26:18 mike Exp $"
+ * "$Id: admin.c,v 1.22.2.21 2003/03/21 17:09:50 mike Exp $"
  *
  *   Administration CGI for the Common UNIX Printing System (CUPS).
  *
@@ -233,7 +233,7 @@ do_am_class(http_t      *http,              /* I - HTTP connection */
 
       if ((response = cupsDoRequest(http, request, "/")) != NULL)
       {
-       ippSetCGIVars(response, NULL, NULL);
+       ippSetCGIVars(response, NULL, NULL, NULL);
        ippDelete(response);
       }
 
@@ -548,7 +548,7 @@ do_am_printer(http_t      *http,    /* I - HTTP connection */
       */
 
       if (oldinfo)
-       ippSetCGIVars(oldinfo, NULL, NULL);
+       ippSetCGIVars(oldinfo, NULL, NULL, NULL);
 
       cgiCopyTemplateLang(stdout, TEMPLATES, "modify-printer.tmpl", getenv("LANG"));
     }
@@ -610,7 +610,7 @@ do_am_printer(http_t      *http,    /* I - HTTP connection */
 
     if ((response = cupsDoRequest(http, request, "/")) != NULL)
     {
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
       ippDelete(response);
     }
 
@@ -776,7 +776,7 @@ do_am_printer(http_t      *http,    /* I - HTTP connection */
 
         strlcpy(make, var, sizeof(make));
 
-        ippSetCGIVars(response, "ppd-make", make);
+        ippSetCGIVars(response, "ppd-make", make, NULL);
        cgiCopyTemplateLang(stdout, TEMPLATES, "choose-model.tmpl",
                            getenv("LANG"));
       }
@@ -1547,5 +1547,5 @@ get_line(char *buf,       /* I - Line buffer */
 
 
 /*
- * End of "$Id: admin.c,v 1.22.2.20 2003/01/07 18:26:18 mike Exp $".
+ * End of "$Id: admin.c,v 1.22.2.21 2003/03/21 17:09:50 mike Exp $".
  */
index ae94d37a06ae5473d5690d9bd9aee581cac81039..1e4e66ac1859c8fa39cff87e54cd0e76bace70fe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: classes.c,v 1.18.2.6 2003/01/07 18:26:19 mike Exp $"
+ * "$Id: classes.c,v 1.18.2.7 2003/03/21 17:09:50 mike Exp $"
  *
  *   Class status CGI for the Common UNIX Printing System (CUPS).
  *
@@ -202,13 +202,16 @@ main(int  argc,                   /* I - Number of command-line arguments */
                    uri);
     }
 
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+                "requested-attributes", NULL, "all");
+
    /*
     * Do the request and get back a response...
     */
 
     if ((response = cupsDoRequest(http, request, "/")) != NULL)
     {
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
       ippDelete(response);
     }
 
@@ -259,7 +262,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
       if ((response = cupsDoRequest(http, request, "/")) != NULL)
       {
-       ippSetCGIVars(response, NULL, NULL);
+       ippSetCGIVars(response, NULL, NULL, NULL);
        ippDelete(response);
 
        cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
@@ -320,7 +323,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
                                       CUPS_DATADIR "/data/testprint.ps")) != NULL)
     {
       status = response->request.status.status_code;
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
 
       ippDelete(response);
     }
@@ -356,5 +359,5 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: classes.c,v 1.18.2.6 2003/01/07 18:26:19 mike Exp $".
+ * End of "$Id: classes.c,v 1.18.2.7 2003/03/21 17:09:50 mike Exp $".
  */
index 5fc6490eaa6ce3b3170617896a89103f64bf4632..8a146a4961ee64a6ecd07914a886d493f2927738 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-var.c,v 1.23.2.8 2003/03/14 21:43:29 mike Exp $"
+ * "$Id: ipp-var.c,v 1.23.2.9 2003/03/21 17:09:50 mike Exp $"
  *
  *   IPP variable routines for the Common UNIX Printing System (CUPS).
  *
@@ -86,13 +86,15 @@ ippSetServerVersion(void)
 void
 ippSetCGIVars(ipp_t      *response,    /* I - Response data to be copied... */
               const char *filter_name, /* I - Filter name */
-             const char *filter_value) /* I - Filter value */
+             const char *filter_value, /* I - Filter value */
+             const char *prefix)       /* I - Prefix for name or NULL */
 {
   int                  element;        /* Element in CGI array */
   ipp_attribute_t      *attr,          /* Attribute in response... */
                        *filter;        /* Filtering attribute */
   int                  i;              /* Looping var */
   char                 name[1024],     /* Name of attribute */
+                       *nameptr,       /* Pointer into name */
                        value[16384],   /* Value(s) */
                        *valptr;        /* Pointer into value */
   char                 method[HTTP_MAX_URI],
@@ -175,13 +177,21 @@ ippSetCGIVars(ipp_t      *response,       /* I - Response data to be copied... */
       if (attr->name == NULL)
         continue;
 
-      for (i = 0; attr->name[i]; i ++)
+      if (prefix)
+      {
+        snprintf(name, sizeof(name), "%s.", prefix);
+       nameptr = name + strlen(name);
+      }
+      else
+        nameptr = name;
+
+      for (i = 0; attr->name[i] && nameptr < (name + sizeof(name) - 1); i ++)
         if (attr->name[i] == '-')
-         name[i] = '_';
+         *nameptr++ = '_';
        else
-          name[i] = attr->name[i];
+          *nameptr++ = attr->name[i];
 
-      name[i] = '\0';
+      *nameptr = '\0';
 
      /*
       * Add "job_printer_name" variable if we have a "job_printer_uri"
@@ -303,6 +313,11 @@ ippSetCGIVars(ipp_t      *response,        /* I - Response data to be copied... */
                      sizeof(value) - (valptr - value));
              break;
 
+          case IPP_TAG_BEGIN_COLLECTION :
+              ippSetCGIVars(attr->values[i].collection, filter_name,
+                           filter_value, name);
+              break;
+
           default :
              break; /* anti-compiler-warning-code */
        }
@@ -312,7 +327,8 @@ ippSetCGIVars(ipp_t      *response, /* I - Response data to be copied... */
       * Add the element...
       */
 
-      cgiSetArray(name, element, value);
+      if (attr->value_tag != IPP_TAG_BEGIN_COLLECTION)
+        cgiSetArray(name, element, value);
 
 /*      fprintf(stderr, "DEBUG: %s[%d]=\"%s\"\n", name, element, value);*/
     }
@@ -324,5 +340,5 @@ ippSetCGIVars(ipp_t      *response, /* I - Response data to be copied... */
 
 
 /*
- * End of "$Id: ipp-var.c,v 1.23.2.8 2003/03/14 21:43:29 mike Exp $".
+ * End of "$Id: ipp-var.c,v 1.23.2.9 2003/03/21 17:09:50 mike Exp $".
  */
index 8e1d7745e57ddca2ba0e4013d2ba0e2b4fec11e6..2333c40d9cfc109903ba16fec39133c25f154baf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-var.h,v 1.5.2.2 2003/01/07 18:26:19 mike Exp $"
+ * "$Id: ipp-var.h,v 1.5.2.3 2003/03/21 17:09:51 mike Exp $"
  *
  *   IPP variable definitions for the Common UNIX Printing System (CUPS).
  *
@@ -26,7 +26,6 @@
  * Include necessary headers...
  */
 
-#include <ctype.h>
 #include <cups/cups.h>
 #include <cups/debug.h>
 #include <cups/language.h>
@@ -47,9 +46,9 @@
 
 extern char    *ippGetTemplateDir(void);
 extern void    ippSetServerVersion(void);
-extern void    ippSetCGIVars(ipp_t *, const char *, const char *);
+extern void    ippSetCGIVars(ipp_t *, const char *, const char *, const char *);
 
 
 /*
- * End of "$Id: ipp-var.h,v 1.5.2.2 2003/01/07 18:26:19 mike Exp $".
+ * End of "$Id: ipp-var.h,v 1.5.2.3 2003/03/21 17:09:51 mike Exp $".
  */
index 684683343aa0799fa9c7c231bb01a417ac426a44..abf8cb54c39a930a115f29b2c12d575908fd0359 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: jobs.c,v 1.15.2.8 2003/01/07 18:26:19 mike Exp $"
+ * "$Id: jobs.c,v 1.15.2.9 2003/03/21 17:09:51 mike Exp $"
  *
  *   Job status CGI for the Common UNIX Printing System (CUPS).
  *
@@ -145,7 +145,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
     if ((response = cupsDoRequest(http, request, "/")) != NULL)
     {
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
       ippDelete(response);
 
       cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
@@ -255,5 +255,5 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
 
 
 /*
- * End of "$Id: jobs.c,v 1.15.2.8 2003/01/07 18:26:19 mike Exp $".
+ * End of "$Id: jobs.c,v 1.15.2.9 2003/03/21 17:09:51 mike Exp $".
  */
index e5b63c146959055d73222dd7ffda4750dfbe9442..ea6728fee85af84193522686c36857c9e5cba200 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: printers.c,v 1.21.2.7 2003/01/07 18:26:20 mike Exp $"
+ * "$Id: printers.c,v 1.21.2.8 2003/03/21 17:09:51 mike Exp $"
  *
  *   Printer status CGI for the Common UNIX Printing System (CUPS).
  *
@@ -202,13 +202,16 @@ main(int  argc,                   /* I - Number of command-line arguments */
                    uri);
     }
 
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+                "requested-attributes", NULL, "all");
+
    /*
     * Do the request and get back a response...
     */
 
     if ((response = cupsDoRequest(http, request, "/")) != NULL)
     {
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
       ippDelete(response);
     }
 
@@ -259,7 +262,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
       if ((response = cupsDoRequest(http, request, "/")) != NULL)
       {
-       ippSetCGIVars(response, NULL, NULL);
+       ippSetCGIVars(response, NULL, NULL, NULL);
        ippDelete(response);
 
        cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
@@ -320,7 +323,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
                                       CUPS_DATADIR "/data/testprint.ps")) != NULL)
     {
       status = response->request.status.status_code;
-      ippSetCGIVars(response, NULL, NULL);
+      ippSetCGIVars(response, NULL, NULL, NULL);
 
       ippDelete(response);
     }
@@ -356,5 +359,5 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: printers.c,v 1.21.2.7 2003/01/07 18:26:20 mike Exp $".
+ * End of "$Id: printers.c,v 1.21.2.8 2003/03/21 17:09:51 mike Exp $".
  */