<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.
<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>
.\"
.\" 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
.\" 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
.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
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007-2012 by Apple Inc.
+Copyright 2007-2013 by Apple Inc.
.\"
.\" End of "$Id$".
.\"
*
* 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
{
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 */
_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") &&
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;
}
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;
}
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;
}
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)
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;