]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - test/ipptest.c
Load cups into easysw/current.
[thirdparty/cups.git] / test / ipptest.c
index 1f4a966bae5f62e78418ebde6ee61121c1337181..252e1dffdff20be626493ba9e2d255ebe6ebce0c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id$"
+ * "$Id: ipptest.c 5878 2006-08-24 15:55:42Z mike $"
  *
  *   IPP test command for the Common UNIX Printing System (CUPS).
  *
@@ -122,6 +122,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   int          status;                 /* Status of tests... */
   const char   *uri;                   /* URI to use */
   const char   *testfile;              /* Test file to use */
+  int          interval;               /* Test interval */
 
 
  /*
@@ -133,6 +134,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   uri      = NULL;
   testfile = NULL;
   status   = 0;
+  interval = 0;
 
   for (i = 1; i < argc; i ++)
   {
@@ -140,6 +142,15 @@ main(int  argc,                            /* I - Number of command-line arguments */
     {
       if (!strcmp(argv[i], "-v"))
         Verbosity ++;
+      else if (!strcmp(argv[i], "-i"))
+      {
+        i++;
+
+       if (i >= argc)
+         usage(NULL);
+       else
+         interval = atoi(argv[i]);
+      }
       else
         usage(argv[i]);
     }
@@ -173,6 +184,19 @@ main(int  argc,                            /* I - Number of command-line arguments */
   if (!uri || !testfile)
     usage(NULL);
 
+ /*
+  * Loop if the interval is set...
+  */
+
+  if (interval)
+  {
+    for (;;)
+    {
+      sleep(interval);
+      do_tests(uri, testfile);
+    }
+  }
+
  /*
   * Exit...
   */
@@ -814,7 +838,9 @@ print_attr(ipp_attribute_t *attr)   /* I - Attribute to print */
     return;
   }
 
-  printf("        %s (%s) = ", attr->name, get_tag_string(attr->value_tag));
+  printf("        %s (%s%s) = ", attr->name,
+         attr->num_values > 1 ? "1setOf " : "",
+        get_tag_string(attr->value_tag));
 
   switch (attr->value_tag)
   {
@@ -890,12 +916,13 @@ usage(const char *option)         /* I - Option string or NULL */
   fputs("Usage: ipptest [options] URL testfile [ ... testfileN ]\n", stderr);
   fputs("Options:\n", stderr);
   fputs("\n", stderr);
-  fputs("-v     Show all attributes in response, even on success.\n", stderr);
+  fputs("-i N    Repeat the last test file once every N seconds.\n", stderr);
+  fputs("-v      Show all attributes in response, even on success.\n", stderr);
 
   exit(1);
 }
 
 
 /*
- * End of "$Id$".
+ * End of "$Id: ipptest.c 5878 2006-08-24 15:55:42Z mike $".
  */