aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuanma Barranquero2011-05-02 05:57:02 +0200
committerJuanma Barranquero2011-05-02 05:57:02 +0200
commite16e55d4a02105b03434e1434e1a13562503d0f2 (patch)
tree30a62057d6922870851cf0884e31b9fc3d8eca75 /src
parent9f5e78f7d565d4d779d8ed2715ef72ff70c10e45 (diff)
downloademacs-e16e55d4a02105b03434e1434e1a13562503d0f2.tar.gz
emacs-e16e55d4a02105b03434e1434e1a13562503d0f2.zip
src/sysdep.c (get_tty_size) [WINDOWSNT]: Implement.
Fixes: debbugs:8596
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/sysdep.c26
2 files changed, 22 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2137c133f54..1231099fff3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12011-05-02 Juanma Barranquero <lekktu@gmail.com> 12011-05-02 Juanma Barranquero <lekktu@gmail.com>
2 2
3 * sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596)
4
52011-05-02 Juanma Barranquero <lekktu@gmail.com>
6
3 * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon) 7 * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon)
4 (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again) 8 (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again)
5 (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake) 9 (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake)
diff --git a/src/sysdep.c b/src/sysdep.c
index ea9a25cc6e7..462e03879c6 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1125,8 +1125,7 @@ tabs_safe_p (int fd)
1125void 1125void
1126get_tty_size (int fd, int *widthp, int *heightp) 1126get_tty_size (int fd, int *widthp, int *heightp)
1127{ 1127{
1128 1128#if defined TIOCGWINSZ
1129#ifdef TIOCGWINSZ
1130 1129
1131 /* BSD-style. */ 1130 /* BSD-style. */
1132 struct winsize size; 1131 struct winsize size;
@@ -1139,8 +1138,7 @@ get_tty_size (int fd, int *widthp, int *heightp)
1139 *heightp = size.ws_row; 1138 *heightp = size.ws_row;
1140 } 1139 }
1141 1140
1142#else 1141#elif defined TIOCGSIZE
1143#ifdef TIOCGSIZE
1144 1142
1145 /* SunOS - style. */ 1143 /* SunOS - style. */
1146 struct ttysize size; 1144 struct ttysize size;
@@ -1153,16 +1151,28 @@ get_tty_size (int fd, int *widthp, int *heightp)
1153 *heightp = size.ts_lines; 1151 *heightp = size.ts_lines;
1154 } 1152 }
1155 1153
1156#else 1154#elif defined WINDOWSNT
1157#ifdef MSDOS 1155
1156 CONSOLE_SCREEN_BUFFER_INFO info;
1157 if (GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info))
1158 {
1159 *widthp = info.srWindow.Right - info.srWindow.Left + 1;
1160 *heightp = info.srWindow.Bottom - info.srWindow.Top + 1;
1161 }
1162 else
1163 *widthp = *heightp = 0;
1164
1165#elif defined MSDOS
1166
1158 *widthp = ScreenCols (); 1167 *widthp = ScreenCols ();
1159 *heightp = ScreenRows (); 1168 *heightp = ScreenRows ();
1169
1160#else /* system doesn't know size */ 1170#else /* system doesn't know size */
1171
1161 *widthp = 0; 1172 *widthp = 0;
1162 *heightp = 0; 1173 *heightp = 0;
1174
1163#endif 1175#endif
1164#endif /* not SunOS-style */
1165#endif /* not BSD-style */
1166} 1176}
1167 1177
1168/* Set the logical window size associated with descriptor FD 1178/* Set the logical window size associated with descriptor FD