diff options
| author | Chong Yidong | 2008-11-02 23:16:33 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-11-02 23:16:33 +0000 |
| commit | a336ee5bc032c489e7de491f4eeddb8ea28ed6a9 (patch) | |
| tree | 926d8ddd1691c790c6bc351464bf4ae2fa22b0cf /lib-src | |
| parent | 273b9028637f6af2ed95adc349e2e02155f98800 (diff) | |
| download | emacs-a336ee5bc032c489e7de491f4eeddb8ea28ed6a9.tar.gz emacs-a336ee5bc032c489e7de491f4eeddb8ea28ed6a9.zip | |
Fix last change.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index a2479b3d6bf..c1d0c01eea4 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -995,6 +995,57 @@ strprefix (char *prefix, char *string) | |||
| 995 | return !strncmp (prefix, string, strlen (prefix)); | 995 | return !strncmp (prefix, string, strlen (prefix)); |
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | /* Get tty name and type. If successful, return the type in TTY_TYPE | ||
| 999 | and the name in TTY_NAME, and return 1. Otherwise, fail if NOABORT | ||
| 1000 | is zero, or return 0 if NOABORT is non-zero. */ | ||
| 1001 | |||
| 1002 | int | ||
| 1003 | find_tty (char **tty_type, char **tty_name, int noabort) | ||
| 1004 | { | ||
| 1005 | char *type = egetenv ("TERM"); | ||
| 1006 | char *name = ttyname (fileno (stdout)); | ||
| 1007 | |||
| 1008 | if (!name) | ||
| 1009 | { | ||
| 1010 | if (noabort) | ||
| 1011 | return 0; | ||
| 1012 | else | ||
| 1013 | { | ||
| 1014 | message (TRUE, "%s: could not get terminal name\n", progname); | ||
| 1015 | fail (); | ||
| 1016 | } | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | if (!type) | ||
| 1020 | { | ||
| 1021 | if (noabort) | ||
| 1022 | return 0; | ||
| 1023 | else | ||
| 1024 | { | ||
| 1025 | message (TRUE, "%s: please set the TERM variable to your terminal type\n", | ||
| 1026 | progname); | ||
| 1027 | fail (); | ||
| 1028 | } | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | if (strcmp (type, "eterm") == 0) | ||
| 1032 | { | ||
| 1033 | if (noabort) | ||
| 1034 | return 0; | ||
| 1035 | else | ||
| 1036 | { | ||
| 1037 | /* This causes nasty, MULTI_KBOARD-related input lockouts. */ | ||
| 1038 | message (TRUE, "%s: opening a frame in an Emacs term buffer" | ||
| 1039 | " is not supported\n", progname); | ||
| 1040 | fail (); | ||
| 1041 | } | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | *tty_name = name; | ||
| 1045 | *tty_type = type; | ||
| 1046 | return 1; | ||
| 1047 | } | ||
| 1048 | |||
| 998 | 1049 | ||
| 999 | #if !defined (NO_SOCKETS_IN_FILE_SYSTEM) | 1050 | #if !defined (NO_SOCKETS_IN_FILE_SYSTEM) |
| 1000 | 1051 | ||
| @@ -1085,58 +1136,6 @@ handle_sigtstp (int signalnum) | |||
| 1085 | } | 1136 | } |
| 1086 | 1137 | ||
| 1087 | 1138 | ||
| 1088 | /* Get tty name and type. If successful, return the type in TTY_TYPE | ||
| 1089 | and the name in TTY_NAME, and return 1. Otherwise, fail if NOABORT | ||
| 1090 | is zero, or return 0 if NOABORT is non-zero. */ | ||
| 1091 | |||
| 1092 | int | ||
| 1093 | find_tty (char **tty_type, char **tty_name, int noabort) | ||
| 1094 | { | ||
| 1095 | char *type = egetenv ("TERM"); | ||
| 1096 | char *name = ttyname (fileno (stdout)); | ||
| 1097 | |||
| 1098 | if (!name) | ||
| 1099 | { | ||
| 1100 | if (noabort) | ||
| 1101 | return 0; | ||
| 1102 | else | ||
| 1103 | { | ||
| 1104 | message (TRUE, "%s: could not get terminal name\n", progname); | ||
| 1105 | fail (); | ||
| 1106 | } | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | if (!type) | ||
| 1110 | { | ||
| 1111 | if (noabort) | ||
| 1112 | return 0; | ||
| 1113 | else | ||
| 1114 | { | ||
| 1115 | message (TRUE, "%s: please set the TERM variable to your terminal type\n", | ||
| 1116 | progname); | ||
| 1117 | fail (); | ||
| 1118 | } | ||
| 1119 | } | ||
| 1120 | |||
| 1121 | if (strcmp (type, "eterm") == 0) | ||
| 1122 | { | ||
| 1123 | if (noabort) | ||
| 1124 | return 0; | ||
| 1125 | else | ||
| 1126 | { | ||
| 1127 | /* This causes nasty, MULTI_KBOARD-related input lockouts. */ | ||
| 1128 | message (TRUE, "%s: opening a frame in an Emacs term buffer" | ||
| 1129 | " is not supported\n", progname); | ||
| 1130 | fail (); | ||
| 1131 | } | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | *tty_name = name; | ||
| 1135 | *tty_type = type; | ||
| 1136 | return 1; | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | |||
| 1140 | /* Set up signal handlers before opening a frame on the current tty. */ | 1139 | /* Set up signal handlers before opening a frame on the current tty. */ |
| 1141 | 1140 | ||
| 1142 | void | 1141 | void |