Index: man/ipptoolfile.man =================================================================== --- man/ipptoolfile.man (revision 9768) +++ man/ipptoolfile.man (working copy) @@ -3,7 +3,7 @@ .\" .\" ipptoolfile man page for CUPS. .\" -.\" Copyright 2010 by Apple Inc. +.\" Copyright 2010-2011 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" "6 August 2010" "Apple Inc." +.TH ipptoolfile 5 "CUPS" "11 May 2011" "Apple Inc." .SH NAME ipptoolfile \- ipptool file format @@ -74,6 +74,10 @@ Defines the named variable to the given value. This is equivalent to specifying "-d variable-name=value" on the \fIipptool\fR command-line. .TP 5 +DEFINE-DEFAULT variable-name value +Defines the named variable to the given value if it does not already have a +value. +.TP 5 IGNORE-ERRORS yes .TP 5 IGNORE-ERRORS no @@ -87,6 +91,20 @@ current test file, while the second form includes a file from the \fIipptool\fR include directory. .TP 5 +INCLUDE-IF-DEFINED name "filename" +.TP 5 +INCLUDE-IF-DEFINED name +Includes another test file if the named variable is defined. The first form +includes a file relative to the current test file, while the second form +includes a file from the \fIipptool\fR include directory. +.TP 5 +INCLUDE-IF-NOT-DEFINED name "filename" +.TP 5 +INCLUDE-IF-NOT-DEFINED name +Includes another test file if the named variable is not defined. The first form +includes a file relative to the current test file, while the second form +includes a file from the \fIipptool\fR include directory. +.TP 5 SKIP-IF-DEFINED variable-name .TP 5 SKIP-IF-NOT-DEFINED variable-name @@ -487,7 +505,7 @@ http://localhost:631/help .SH COPYRIGHT -Copyright 2007-2010 by Apple Inc. +Copyright 2007-2011 by Apple Inc. .\" .\" End of "$Id$". .\" Index: test/ipptool.c =================================================================== --- test/ipptool.c (revision 9768) +++ test/ipptool.c (working copy) @@ -714,6 +714,29 @@ continue; } + else if (!strcmp(token, "DEFINE-DEFAULT")) + { + /* + * DEFINE-DEFAULT name value + */ + + if (get_token(fp, attr, sizeof(attr), &linenum) && + get_token(fp, temp, sizeof(temp), &linenum)) + { + expand_variables(vars, token, temp, sizeof(token)); + if (!get_variable(vars, attr)) + set_variable(vars, attr, token); + } + else + { + print_fatal_error("Missing DEFINE-DEFAULT name and/or value on line " + "%d.", linenum); + pass = 0; + goto test_exit; + } + + continue; + } else if (!strcmp(token, "IGNORE-ERRORS")) { /* @@ -767,6 +790,76 @@ show_header = 1; continue; } + else if (!strcmp(token, "INCLUDE-IF-DEFINED")) + { + /* + * INCLUDE-IF-DEFINED name "filename" + * INCLUDE-IF-DEFINED name + */ + + if (get_token(fp, attr, sizeof(attr), &linenum) && + get_token(fp, temp, sizeof(temp), &linenum)) + { + /* + * Map the filename to and then run the tests... + */ + + if (get_variable(vars, attr) && + !do_tests(vars, get_filename(testfile, filename, temp, + sizeof(filename)))) + { + pass = 0; + + if (!IgnoreErrors) + goto test_exit; + } + } + else + { + print_fatal_error("Missing INCLUDE-IF-DEFINED name or filename on line " + "%d.", linenum); + pass = 0; + goto test_exit; + } + + show_header = 1; + continue; + } + else if (!strcmp(token, "INCLUDE-IF-NOT-DEFINED")) + { + /* + * INCLUDE-IF-NOT-DEFINED name "filename" + * INCLUDE-IF-NOT-DEFINED name + */ + + if (get_token(fp, attr, sizeof(attr), &linenum) && + get_token(fp, temp, sizeof(temp), &linenum)) + { + /* + * Map the filename to and then run the tests... + */ + + if (!get_variable(vars, attr) && + !do_tests(vars, get_filename(testfile, filename, temp, + sizeof(filename)))) + { + pass = 0; + + if (!IgnoreErrors) + goto test_exit; + } + } + else + { + print_fatal_error("Missing INCLUDE-IF-NOT-DEFINED name or filename on " + "line %d.", linenum); + pass = 0; + goto test_exit; + } + + show_header = 1; + continue; + } else if (!strcmp(token, "SKIP-IF-DEFINED")) { /* @@ -780,7 +873,8 @@ } else { - print_fatal_error("Missing SKIP-IF-DEFINED value on line %d.", linenum); + print_fatal_error("Missing SKIP-IF-DEFINED variable on line %d.", + linenum); pass = 0; goto test_exit; } @@ -798,7 +892,7 @@ } else { - print_fatal_error("Missing SKIP-IF-NOT-DEFINED value on line %d.", + print_fatal_error("Missing SKIP-IF-NOT-DEFINED variable on line %d.", linenum); pass = 0; goto test_exit;