configure: Add option to only create read-only sessions for #84

This commit is contained in:
Pariksheet Nanda 2020-06-06 11:08:10 -04:00
parent cbec43f56d
commit 895d142928
2 changed files with 15 additions and 1 deletions

View file

@ -65,6 +65,15 @@ if test "x$found_static" = xyes; then
])
fi
# Is this a readonly session build?
AC_ARG_ENABLE(
session-write,
AC_HELP_STRING(--disable-session-write, create read-only sessions)
)
if test "x${enable_session_write}" = xno; then
CFLAGS="$CFLAGS -DTMATE_SESSION_RO"
fi
# Is this gcc?
AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes)

View file

@ -5,7 +5,12 @@ static void handle_notify(__unused struct tmate_session *session,
struct tmate_unpacker *uk)
{
char *msg = unpack_string(uk);
tmate_status_message("%s", msg);
#ifdef TMATE_SESSION_RO
if (!strstr(msg, "session: "))
tmate_status_message("%s", msg);
#else
tmate_status_message("%s", msg);
#endif
free(msg);
}