From 6c98653cca6b98d31c400228c087a0ade2a4ced1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 24 Nov 2019 21:38:29 -0800 Subject: Some speculative fixes/improvements for mac `read` command use. --- bb.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bb.h') diff --git a/bb.h b/bb.h index e64671d..9752cd8 100644 --- a/bb.h +++ b/bb.h @@ -279,8 +279,12 @@ ASK ";\n" " [ $# -lt 2 ] && printf '\033[31;1mNot enough args to ask!\033[0m\n' && return 1;\n" " printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n" " tput cvvis >/dev/tty;\n" +#ifdef __APPLE__ +" read -e $1 /dev/tty;\n" +#else " read $1 /dev/tty;\n" #endif +#endif "}\n" "ask1() {\n" #ifdef ASK1 @@ -289,7 +293,11 @@ ASK1 ";\n" " tput civis >/dev/tty;\n" " printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n" " stty -icanon -echo >/dev/tty;\n" +#ifdef __APPLE__ +" read -n 1 $1 /dev/tty;\n" +#else " eval \"$1=\\$(dd bs=1 count=1 2>/dev/null /dev/tty;\n" " tput cvvis >/dev/tty;\n" #endif -- cgit v1.2.3