]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add support for DEFINE-MATCH and DEFINE-NO-MATCH to STATUS directive.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 10 Jan 2013 16:51:07 +0000 (16:51 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 10 Jan 2013 16:51:07 +0000 (16:51 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10788 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.6.txt
CHANGES-IPPTOOL.txt
IPPTOOL.txt
doc/help/man-ipptoolfile.html
man/ipptoolfile.man
test/ipptool.c

index 3c10a85fa25383dbd6768aee285391f7d2697cfb..57cb441e1dd36d4199f286b8d06e1d1478185a8e 100644 (file)
@@ -7,6 +7,8 @@ CHANGES IN CUPS V1.6.2
        - Security: All file, directory, user, and group settings are now stored
          in a separate cups-files.conf configuration file that cannot be set
          through the CUPS web interface or APIs (STR #4223)
+       - The ipptool program now supports DEFINE-MATCH and DEFINE-NO-MATCH
+         predicates for STATUS directives.
        - Fixed a problem with local Kerberos authentication (STR #4140)
        - Coverity scan: fixed some minor issues (STR #4242)
        - The scheduler did not remove color profiles after deleting a printer
index a0b9176daa8f5b73ca127553179d902485f19450..22264c5190b8be212db149a23b7b75495b179608 100644 (file)
@@ -1,17 +1,19 @@
-CHANGES-IPPTOOL.txt - 2012-11-16
+CHANGES-IPPTOOL.txt - 2013-01-10
 --------------------------------
 
 This file provides a list of changes to the ipptool binary distribution posted
 on cups.org.
 
 
-2012-MM-DD
+2013-MM-DD
 
-       - ipptool did not support octetString values.
+       - Added support for DEFINE-MATCH and DEFINE-NO-MATCH as STATUS
+         predicates.
+       - Added support for octetString values.
+       - Added support for document compression in Print-Job and Send-Document
+         requests.
        - Fixed REPEAT-MATCH for STATUS and EXPECT - was incorrectly erroring
          out.
-       - ipptool did not support compressing documents in Print-Job or
-         Send-Document requests.
 
 
 2012-02-28
index 5aa027f1e5cd0237656f7626e44e80d63c76592a..93eda28c0579c1b29414b71d392d96daa1d12984 100644 (file)
@@ -1,4 +1,4 @@
-IPPTOOL.txt - 2012-11-16
+IPPTOOL.txt - 2013-01-10
 ------------------------
 
 See the file CHANGES-IPPTOOL.txt for a list of changes to this software.
@@ -174,7 +174,7 @@ REPORTING BUGS
 
 LEGAL STUFF
 
-    CUPS is Copyright 2007-2012 by Apple Inc.  CUPS and the CUPS logo are
+    CUPS is Copyright 2007-2013 by Apple Inc.  CUPS and the CUPS logo are
     trademarks of Apple Inc.
 
     The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
index 1c7c75b9e94633bd190f1e01130ad211f5a21a03..7011a973084b4bc37ec11dbd31ef552eed12186a 100644 (file)
@@ -414,6 +414,14 @@ parallel attribute.
 <h2 class="title"><a name="STATUS_PREDICATES">Status Predicates</a></h2>
 The following predicates are understood following the STATUS test directive:
 <dl>
+<dt>DEFINE-MATCH variable-name
+</dt>
+<dd>Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test.
+</dd>
+<dt>DEFINE-NO-MATCH variable-name
+</dt>
+<dd>Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test.
+</dd>
 <dt>IF-DEFINED variable-name
 </dt>
 <dd>Makes the STATUS apply only if the specified variable is defined.
@@ -674,7 +682,7 @@ no notify-subscription-id has been seen.
 <a href='http://localhost:631/help'>http://localhost:631/help</a>
 
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
-Copyright 2007-2012 by Apple Inc.
+Copyright 2007-2013 by Apple Inc.
 
 </body>
 </html>
index aea8d80cda29bbf8cf99c2df972d7ed29221a681..a4bba335e1595d1634b80dabbd05cf743f781cca 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\"   ipptoolfile man page for CUPS.
 .\"
-.\"   Copyright 2010-2012 by Apple Inc.
+.\"   Copyright 2010-2013 by Apple Inc.
 .\"
 .\"   These coded instructions, statements, and computer programs are the
 .\"   property of Apple Inc. and are protected by Federal copyright
@@ -11,7 +11,7 @@
 .\"   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/".
 .\"
-.TH ipptoolfile 5 "CUPS" "3 December 2012" "Apple Inc."
+.TH ipptoolfile 5 "CUPS" "10 January 2013" "Apple Inc."
 .SH NAME
 ipptoolfile \- ipptool file format
 
@@ -332,6 +332,12 @@ Requires that at least one value of the EXPECT attribute matches the regular exp
 .SH STATUS PREDICATES
 The following predicates are understood following the STATUS test directive:
 .TP 5
+DEFINE-MATCH variable-name
+Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test.
+.TP 5
+DEFINE-NO-MATCH variable-name
+Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test.
+.TP 5
 IF-DEFINED variable-name
 Makes the STATUS apply only if the specified variable is defined.
 .TP 5
@@ -571,7 +577,7 @@ Inserts the username from the URI provided to \fIipptool\fR, if any.
 http://localhost:631/help
 
 .SH COPYRIGHT
-Copyright 2007-2012 by Apple Inc.
+Copyright 2007-2013 by Apple Inc.
 .\"
 .\" End of "$Id$".
 .\"
index 0e42414f7f18af485f7a34e6a4f46cb76679ac7c..07c0b043518cfa5ffb82794d134c1898b3784527 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   ipptool command for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -113,7 +113,10 @@ typedef struct _cups_status_s              /**** Status info ****/
 {
   ipp_status_t status;                 /* Expected status code */
   char         *if_defined,            /* Only if variable is defined */
-               *if_not_defined;        /* Only if variable is not defined */
+               *if_not_defined,        /* Only if variable is not defined */
+               *define_match,          /* Variable to define on match */
+               *define_no_match,       /* Variable to define on no-match */
+               *define_value;          /* Variable to define with value */
   int          repeat_limit,           /* Maximum number of times to repeat */
                repeat_match,           /* Repeat the test when it does not match */
                repeat_no_match;        /* Repeat the test when it matches */
@@ -1185,7 +1188,9 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
           _cups_strcasecmp(token, "WITH-VALUE"))
         last_expect = NULL;
 
-      if (_cups_strcasecmp(token, "IF-DEFINED") &&
+      if (_cups_strcasecmp(token, "DEFINE-MATCH") &&
+          _cups_strcasecmp(token, "DEFINE-NO-MATCH") &&
+         _cups_strcasecmp(token, "IF-DEFINED") &&
           _cups_strcasecmp(token, "IF-NOT-DEFINED") &&
           _cups_strcasecmp(token, "REPEAT-LIMIT") &&
           _cups_strcasecmp(token, "REPEAT-MATCH") &&
@@ -1936,10 +1941,12 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
 
        if (last_expect)
          last_expect->define_match = strdup(token);
+       else if (last_status)
+         last_status->define_match = strdup(token);
        else
        {
-         print_fatal_error("DEFINE-MATCH without a preceding EXPECT on line "
-                           "%d.", linenum);
+         print_fatal_error("DEFINE-MATCH without a preceding EXPECT or STATUS "
+                           "on line %d.", linenum);
          pass = 0;
          goto test_exit;
        }
@@ -1956,10 +1963,12 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
 
        if (last_expect)
          last_expect->define_no_match = strdup(token);
+       else if (last_status)
+         last_status->define_no_match = strdup(token);
        else
        {
-         print_fatal_error("DEFINE-NO-MATCH without a preceding EXPECT on "
-                           "line %d.", linenum);
+         print_fatal_error("DEFINE-NO-MATCH without a preceding EXPECT or "
+                           "STATUS on line %d.", linenum);
          pass = 0;
          goto test_exit;
        }
@@ -1978,8 +1987,8 @@ do_tests(_cups_vars_t *vars,              /* I - Variables */
          last_expect->define_value = strdup(token);
        else
        {
-         print_fatal_error("DEFINE-VALUE without a preceding EXPECT on line "
-                           "%d.", linenum);
+         print_fatal_error("DEFINE-VALUE without a preceding EXPECT on "
+                           "line %d.", linenum);
          pass = 0;
          goto test_exit;
        }
@@ -2707,11 +2716,23 @@ do_tests(_cups_vars_t *vars,            /* I - Variables */
                repeat_count < statuses[i].repeat_limit)
              repeat_test = 1;
 
-           break;
+            if (statuses[i].define_match)
+              set_variable(vars, statuses[i].define_match, "1");
+
+            break;
          }
-         else if (statuses[i].repeat_no_match &&
-                  repeat_count < statuses[i].repeat_limit)
-           repeat_test = 1;
+         else
+         {
+           if (statuses[i].repeat_no_match &&
+               repeat_count < statuses[i].repeat_limit)
+             repeat_test = 1;
+
+            if (statuses[i].define_no_match)
+            {
+              set_variable(vars, statuses[i].define_no_match, "1");
+              break;
+            }
+          }
        }
 
        if (i == num_statuses && num_statuses > 0)
@@ -3062,6 +3083,10 @@ do_tests(_cups_vars_t *vars,             /* I - Variables */
         free(statuses[i].if_defined);
       if (statuses[i].if_not_defined)
         free(statuses[i].if_not_defined);
+      if (statuses[i].define_match)
+        free(statuses[i].define_match);
+      if (statuses[i].define_no_match)
+        free(statuses[i].define_no_match);
     }
     num_statuses = 0;