diff options
Diffstat (limited to 'home/.local')
-rwxr-xr-x | home/.local/bin/mins | 4 | ||||
-rwxr-xr-x | home/.local/bin/nasd | 15 | ||||
-rwxr-xr-x | home/.local/bin/whinclude | 11 |
3 files changed, 25 insertions, 5 deletions
diff --git a/home/.local/bin/mins b/home/.local/bin/mins new file mode 100755 index 00000000..9cbd5fa8 --- /dev/null +++ b/home/.local/bin/mins @@ -0,0 +1,4 @@ +#!/bin/sh +exec dc <<EOF +$1 60~rn[h]nn[m]p +EOF 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" diff --git a/home/.local/bin/whinclude b/home/.local/bin/whinclude new file mode 100755 index 00000000..26445cdc --- /dev/null +++ b/home/.local/bin/whinclude @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +echo "#include <${1}>" | +cc ${CFLAGS:-} -E -x c - | +sed -En ' + /^# [0-9]+ "[^<]/{ + s/.*"([^"]+)".*/\1/p + q + } +' |