hterm: use \033 instead of \e
POSIX printf doesn't support \e escape sequence.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
Change-Id: I47065055ea12b28d6f21469510b01255080746b2
Reviewed-on: https://chromium-review.googlesource.com/611777
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/etc/hterm-notify.sh b/hterm/etc/hterm-notify.sh
index ecdeffe..a932045 100755
--- a/hterm/etc/hterm-notify.sh
+++ b/hterm/etc/hterm-notify.sh
@@ -14,7 +14,7 @@
# Usage: [title] [body]
notify_tmux() {
local title="${1-}" body="${2-}"
- printf '\ePtmux;\e\e]777;notify;%s;%s\a\e\\' "${title}" "${body}"
+ printf '\033Ptmux;\033\033]777;notify;%s;%s\a\033\\' "${title}" "${body}"
}
# Send a notification.
@@ -29,14 +29,14 @@
if [ -n "${TMUX-}" ]; then
notify_tmux "${title}" "${body}"
else
- printf '\eP\e\e]777;notify;%s;%s\a\e\\' "${title}" "${body}"
+ printf '\033P\033\033]777;notify;%s;%s\a\033\\' "${title}" "${body}"
fi
;;
tmux*)
notify_tmux "${title}" "${body}"
;;
*)
- printf '\e]777;notify;%s;%s\a' "${title}" "${body}"
+ printf '\033]777;notify;%s;%s\a' "${title}" "${body}"
;;
esac
}
diff --git a/hterm/etc/osc52.sh b/hterm/etc/osc52.sh
index 202d6b5..afa9055 100755
--- a/hterm/etc/osc52.sh
+++ b/hterm/etc/osc52.sh
@@ -33,7 +33,7 @@
#
# This is for `tmux` sessions which filters OSC 52 locally.
get_osc52_tmux() {
- printf "%b" "\ePtmux;\e\e]52;c;$(base64 | tr -d '\n')\a\e\\"
+ printf "%b" "\033Ptmux;\033\033]52;c;$(base64 | tr -d '\n')\a\033\\"
}
# This function base64's the entire source, wraps it in a single OSC 52,
diff --git a/nassh/doc/FAQ.md b/nassh/doc/FAQ.md
index f5e8cf1..bff6358 100644
--- a/nassh/doc/FAQ.md
+++ b/nassh/doc/FAQ.md
@@ -989,9 +989,9 @@
to send (and remember to escape the escapes).
# A DCS sequence terminated by a ST.
- $ printf '\eP...\e\\'
+ $ printf '\033P...\033\\'
# Send a notification straight to hterm.
- $ printf '\eP\e\e]777;notify;title;body\a\e\\'
+ $ printf '\033P\033\033]777;notify;title;body\a\033\\'
Under [tmux](https://github.com/tmux/tmux/blob/master/tools/ansicode.txt),
you can use a DCS sequence too, but using the `tmux` subcommand. Replace
@@ -999,9 +999,9 @@
escapes).
# A DCS sequence terminated by a ST.
- $ printf '\ePtmux;...\e\\'
+ $ printf '\033Ptmux;...\033\\'
# Send a notification straight to hterm.
- $ printf '\ePtmux;\e\e]777;notify;title;body\a\e\\'
+ $ printf '\033Ptmux;\033\033]777;notify;title;body\a\033\\'
There is an [hterm-notify.sh] helper script available as well: