From: mike Date: Thu, 10 Jan 2013 16:51:07 +0000 (+0000) Subject: Add support for DEFINE-MATCH and DEFINE-NO-MATCH to STATUS directive. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b91c836db4ab26e145f828601b928c28d666b2a4;p=thirdparty%2Fcups.git Add support for DEFINE-MATCH and DEFINE-NO-MATCH to STATUS directive. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10788 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index 3c10a85fa2..57cb441e1d 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -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 diff --git a/CHANGES-IPPTOOL.txt b/CHANGES-IPPTOOL.txt index a0b9176daa..22264c5190 100644 --- a/CHANGES-IPPTOOL.txt +++ b/CHANGES-IPPTOOL.txt @@ -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 diff --git a/IPPTOOL.txt b/IPPTOOL.txt index 5aa027f1e5..93eda28c05 100644 --- a/IPPTOOL.txt +++ b/IPPTOOL.txt @@ -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. diff --git a/doc/help/man-ipptoolfile.html b/doc/help/man-ipptoolfile.html index 1c7c75b9e9..7011a97308 100644 --- a/doc/help/man-ipptoolfile.html +++ b/doc/help/man-ipptoolfile.html @@ -414,6 +414,14 @@ parallel attribute.

Status Predicates

The following predicates are understood following the STATUS test directive:
+
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. +
+
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. +
IF-DEFINED variable-name
Makes the STATUS apply only if the specified variable is defined. @@ -674,7 +682,7 @@ no notify-subscription-id has been seen. http://localhost:631/help

Copyright

-Copyright 2007-2012 by Apple Inc. +Copyright 2007-2013 by Apple Inc. diff --git a/man/ipptoolfile.man b/man/ipptoolfile.man index aea8d80cda..a4bba335e1 100644 --- a/man/ipptoolfile.man +++ b/man/ipptoolfile.man @@ -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$". .\" diff --git a/test/ipptool.c b/test/ipptool.c index 0e42414f7f..07c0b04351 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -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;