summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-01-29 22:56:12 -0500
committerJune McEnroe <june@causal.agency>2022-01-29 22:56:12 -0500
commitae27c1dd9ee08c9b2b4aa9832a19d8f73e93ddb8 (patch)
treefe443ac393b2f04f49ea3c7719d8e0733be7e6c8
parentAdd Convenience Store Woman (diff)
downloadsrc-ae27c1dd9ee08c9b2b4aa9832a19d8f73e93ddb8.tar.gz
src-ae27c1dd9ee08c9b2b4aa9832a19d8f73e93ddb8.zip
Allow arguments to nasd script
Diffstat (limited to '')
-rwxr-xr-xhome/.local/bin/nasd15
1 files changed, 10 insertions, 5 deletions
diff --git a/home/.local/bin/nasd b/home/.local/bin/nasd
index d64b2c3a..60241395 100755
--- a/home/.local/bin/nasd
+++ b/home/.local/bin/nasd
@@ -2,8 +2,13 @@
 set -eu
 
 dir=$(mktemp -d)
-echo 'bits 64' > "${dir}/input"
-cat >> "${dir}/input"
-nasm -o "${dir}/output" "${dir}/input" || true
-ndisasm -b 64 "${dir}/output" || true
-rm -r "$dir"
+trap 'rm -r "$dir"' EXIT
+
+echo 'bits 64' >"${dir}/input"
+for ins; do
+	printf '%s\n' "$ins" >>"${dir}/input"
+done
+[ $# -eq 0 ] && cat >>"${dir}/input"
+
+nasm -o "${dir}/output" "${dir}/input"
+ndisasm -b 64 "${dir}/output"