#!/usr/bin/env sh
-# @(#)🏠📂 HOMEDIR sh/diffio.sh 2026-03-23T02:16:54Z
+# @(#)🏠📂 HOMEDIR sh/diffio.sh 2026-04-05T19:29:49Z
# SPDX-FileCopyrightText: 2026 Lady <https://www.ladys.computer/about/#lady>
# SPDX-License-Identifier: MPL-2.0
exit 9
fi
-## If there is no output file, then the transform is expected to fail.
-## Otherwise, the transformed output is diffed with the result.
+## If there is no output file, it is treated as empty.
-if ! "${cmd_TEST}" -f "${inputfile}"
+if ! "${cmd_TEST}" -f "${outputfile}"
then :
- if "${cmd_TRANSFORM}" <"${infile}" >/dev/null 2>/dev/null
- then :
- "${cmd_PRINTF}" '%s\n' \
- 'diffio: Expected transform failure, but it succeeded.' \
- >&2
- exit 10
- else :
- "${cmd_PRINTF}" '%s\n' \
- 'diffio: Transform did not succeed, as expected.' \
- >&2
- fi
-else :
- "${cmd_TRANSFORM}" <"${inputfile}" 2>/dev/null |
- "${cmd_DIFF}" -U 1 - "${outputfile}" |
- "${cmd_SED}" '1,2d'
+ outputfile=/dev/null
fi
+
+## The transformed output is diffed with the result.
+
+"${cmd_TRANSFORM}" <"${inputfile}" |
+"${cmd_DIFF}" -U 1 "${outputfile}" - |
+"${cmd_SED}" '1,2d'