We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f772a5e commit fa34156Copy full SHA for fa34156
4 files changed
CHANGES.md
@@ -26,6 +26,7 @@ libcups v3.0b1 (Month DD, YYYY)
26
- Added, modernized, and promoted the localization interfaces to public API
27
(Issue #24)
28
- Added public JSON API (Issue #31)
29
+- Added new `basename` variable for use in ipptool files (Issue #44)
30
- Updated the CUPS API for consistency.
31
- Fixed ipptool's handling of EXPECT for member attributes (Issue #4)
32
- Fixed ipptool's support for octetString values (Issue #23)
doc/ipptoolfile.html
@@ -699,6 +699,12 @@ <h3 id="ipptoolfile-5.description.variables">Variables</h3>
699
</p>
700
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>$ENV[</strong><em>name</em><strong>]</strong><br>
701
Inserts the value of the named environment variable, or an empty string if the environment variable is not defined.
702
+</p>
703
+ <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>$basename</strong><br>
704
+Inserts the base filename (without directory path) of the path provided to
705
+<strong>ipptool</strong>(8)
706
+
707
+with the <em>-f</em> option.
708
709
<p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>$date-current</strong><br>
710
Inserts the current date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ").
man/ipptoolfile.5
@@ -669,6 +669,11 @@ Inserts a single "$" character.
669
\fB$ENV[\fIname\fB]\fR
670
671
.TP 5
672
+\fB$basename\fR
673
674
+.BR ipptool (8)
675
+with the \fI-f\fR option.
676
+.TP 5
677
\fB$date-current\fR
678
Inserts the current date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ").
679
tools/ipptool.c
@@ -267,7 +267,8 @@ main(int argc, /* I - Number of command-line args */
267
*value, /* Pointer to value */
268
filename[1024], /* Real filename */
269
testname[1024]; /* Real test filename */
270
- const char *ext, /* Extension on filename */
+ const char *base, /* Base filename */
271
+ *ext, /* Extension on filename */
272
*testfile; /* Test file to use */
273
int interval, /* Test interval in microseconds */
274
repeat; /* Repeat count */
@@ -528,6 +529,11 @@ main(int argc, /* I - Number of command-line args */
528
529
530
ippFileSetVar(data->parent, "filename", filename);
531
532
+ if ((base = strrchr(filename, '/')) != NULL)
533
+ ippFileSetVar(data->parent, "basename", base + 1);
534
+ else
535
+ ippFileSetVar(data->parent, "basename", filename);
536
537
if ((ext = strrchr(filename, '.')) != NULL)
538
{
539
// Guess the MIME media type based on the extension...
0 commit comments