farbfeld

suckless image format with conversion tools
git clone git://git.suckless.org/farbfeld
Log | Files | Refs | README | LICENSE

commit e9db1f49b75b183c8aeda321ca54aff5b436a4f6
parent 48c52a1f4889858ae3466f1987b522e426b6ddf3
Author: FRIGN <dev@frign.de>
Date:   Mon, 19 Sep 2016 22:51:45 +0200

2ff: use trap to remove temporary file

This also frees us from having to store the return value somewhere.

Diffstat:
M2ff | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/2ff b/2ff @@ -5,6 +5,8 @@ if [ "$#" -ne 0 ]; then fi TMP=$(mktemp) +trap 'rm "$TMP"' EXIT + cat > "$TMP" if [ "$(dd if="$TMP" bs=1 count=8 2>/dev/null)" = "farbfeld" ]; then @@ -26,11 +28,9 @@ image/jpeg) ;; esac -ret=$? -rm "$TMP" - -if [ $ret -ne 0 ]; then +if [ $? -ne 0 ]; then printf "%s: failed to convert from %s\n" "$0" "$FORMAT" >&2 + exit 1 fi -exit $ret +exit 0