]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - tools/ipptool.c
Fix `EXPECT !name WITH-VALUE ...` tests.
[thirdparty/cups.git] / tools / ipptool.c
index 847dfb586e94c7374273ecfdfcfe87b1e79680a5..e54b78ad38a257e4db6a1147798a56dbb3f9a26e 100644 (file)
@@ -240,6 +240,8 @@ main(int  argc,                             /* I - Number of command-line args */
 
   _ippVarsInit(&vars, NULL, (_ipp_ferror_cb_t)error_cb, (_ipp_ftoken_cb_t)token_cb);
 
+  _ippVarsSet(&vars, "date-start", iso_date(ippTimeToDate(time(NULL))));
+
  /*
   * We need at least:
   *
@@ -1446,7 +1448,7 @@ do_test(_ipp_file_t      *f,              /* I - IPP data file */
              _ippVarsSet(vars, expect->define_no_match, "1");
            else if (!expect->define_match && !expect->define_value)
            {
-             if (found && expect->not_expect)
+             if (found && expect->not_expect && !expect->with_value && !expect->with_value_from)
                add_stringf(data->errors, "NOT EXPECTED: %s", expect->name);
              else if (!found && !(expect->not_expect || expect->optional))
                add_stringf(data->errors, "EXPECTED: %s", expect->name);
@@ -3992,6 +3994,8 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
       data->transfer      = data->def_transfer;
       data->version       = data->def_version;
 
+      _ippVarsSet(vars, "date-current", iso_date(ippTimeToDate(time(NULL))));
+
       f->attrs     = ippNew();
       f->group_tag = IPP_TAG_ZERO;
     }
@@ -4003,6 +4007,7 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
 
       if (_ippFileReadToken(f, name, sizeof(name)) && _ippFileReadToken(f, temp, sizeof(temp)))
       {
+        _ippVarsSet(vars, "date-current", iso_date(ippTimeToDate(time(NULL))));
         _ippVarsExpand(vars, value, temp, sizeof(value));
        _ippVarsSet(vars, name, value);
       }
@@ -4022,6 +4027,7 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
       {
         if (!_ippVarsGet(vars, name))
         {
+          _ippVarsSet(vars, "date-current", iso_date(ippTimeToDate(time(NULL))));
          _ippVarsExpand(vars, value, temp, sizeof(value));
          _ippVarsSet(vars, name, value);
        }
@@ -4040,6 +4046,7 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
 
       if (_ippFileReadToken(f, temp, sizeof(temp)))
       {
+        _ippVarsSet(vars, "date-current", iso_date(ippTimeToDate(time(NULL))));
         _ippVarsExpand(vars, data->file_id, temp, sizeof(data->file_id));
       }
       else