logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

probe-size.sh (380B)


  1. set -e
  2. if [ "$#" -lt 3 ] ; then
  3. printf 'usage: %s var out command...\n' "$0" >&2
  4. exit 2
  5. fi
  6. var=$1
  7. out=$2
  8. shift 2
  9. for size in 8 4 2 1 ; do
  10. echo "==> trying $var=$size..." >&2
  11. if "$@" -D "$var=$size" ; then
  12. echo '==> success' >&2
  13. echo "#define $var $size" >"$out"
  14. exit 0
  15. fi
  16. done 2>"$out.log"
  17. cat "$out.log"
  18. printf "%s: could not determine %s\n" "$0" "$var" >&2
  19. exit 1