+/*$ @basename{PATH}
+ *
+ * Expands to the UNQUOTED basename of PATH.
+ */
+static int exp_basename(int attribute((unused)) nargs,
+ char **args,
+ struct sink attribute((unused)) *output,
+ void attribute((unused)) *u) {
+ return sink_writes(output, d_basename(args[0])) < 0 ? -1 : 0;
+}
+
+/*$ @dirname{PATH}
+ *
+ * Expands to the UNQUOTED directory name of PATH.
+ */
+static int exp_dirname(int attribute((unused)) nargs,
+ char **args,
+ struct sink attribute((unused)) *output,
+ void attribute((unused)) *u) {
+ return sink_writes(output, d_dirname(args[0])) < 0 ? -1 : 0;
+}
+
+/*$ @q{STRING}
+ *
+ * Expands to STRING.
+ */
+static int exp_q(int attribute((unused)) nargs,
+ char **args,
+ struct sink attribute((unused)) *output,
+ void attribute((unused)) *u) {
+ return sink_writes(output, args[0]) < 0 ? -1 : 0;
+}
+