commit bf63f986ff1a433ab6cce5287d51c191036f0a65 from: Russ Cox date: Tue Aug 06 13:42:10 2013 UTC 9term: set TERM=dumb instead of TERM=9term Everyone seems to assume that TERM != dumb implies ANSI escape codes are okay. In fact, many people assume that unconditionally, but it is easier to argue back about TERM=dumb than TERM=9term. This applies to acme win too, because they share the code. Set termprog=9term or termprog=win for clients who need to know. R=rsc CC=r https://codereview.appspot.com/12532043 commit - 2bc9a13faf0abcfa43cddc8c226b2f742b764c4a commit + bf63f986ff1a433ab6cce5287d51c191036f0a65 blob - c0be6f7f58c4b9ce99fa20a486442709d53a4f00 blob + 5cf46decbbe9a4df3492a512e6b8614c944aa506 --- src/cmd/9term/9term.c +++ src/cmd/9term/9term.c @@ -15,6 +15,7 @@ #include "fns.h" #include "term.h" +const char *termprog = "9term"; int use9wm; int mainpid; int mousepid; blob - 6b91c8698380a0c1aacb8ec7c13bcf7115c62fc3 blob + 9bfefdaa08291b41cf939bebb2d620a234f2944f --- src/cmd/9term/rcstart.c +++ src/cmd/9term/rcstart.c @@ -77,7 +77,16 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) */ notifyoff("sys: window size change"); - putenv("TERM", "9term"); + // This used to be TERM=9term but we don't know of anything that cares. + // Worse, various cc have started assuming that TERM != dumb implies + // the ability to understand ANSI escape codes. 9term will squelch them + // but acme win does not. + putenv("TERM", "dumb"); + + // Set $termprog to 9term or win for those who care about what kind of + // dumb terminal this is. + putenv("termprog", (char*)termprog); + pid = fork(); switch(pid){ case 0: blob - e7a1f6b24de43d657aeb4aaa69e59be6b95f50e5 blob + 6041275a5bf0441639c1220702b6a2ffa2dfb9cf --- src/cmd/9term/term.h +++ src/cmd/9term/term.h @@ -10,3 +10,4 @@ extern int loginshell; extern void echoed(char*, int); extern int echocancel(char*, int); extern int dropcrnl(char*, int); +extern const char *termprog; blob - e08e032c3999b90059ed5c79d00e70daf9008af6 blob + decfece7a81f5eb6d9e69dcae1f35ebe98928ee2 --- src/cmd/9term/win.c +++ src/cmd/9term/win.c @@ -5,6 +5,7 @@ #include <9pclient.h> #include "term.h" +const char *termprog = "win"; #define EVENTSIZE 256 #define STACK 32768