2006-02-11 Zoltan Varga <vargaz@gmail.com>
+ * console-io.c (ves_icall_System_ConsoleDriver_GetTtySize): New icall
+ to obtain the terminal size using an ioctl.
+
* object.c (mono_nullable_init): Revert this as nullable reference
types are not valid.
(mono_nullable_box): Ditto.
return FALSE;
}
+MonoBoolean
+ves_icall_System_ConsoleDriver_GetTtySize (HANDLE handle, gint32 *width, gint32 *height)
+{
+ return FALSE;
+}
+
#else
static struct termios initial_attr;
return TRUE;
}
+
+MonoBoolean
+ves_icall_System_ConsoleDriver_GetTtySize (HANDLE handle, gint32 *width, gint32 *height)
+{
+#ifdef TIOCGWINSZ
+ struct winsize ws;
+ int res;
+
+ res = ioctl (GPOINTER_TO_INT (handle), TIOCGWINSZ, &ws);
+
+ if (!res) {
+ *width = ws.ws_col;
+ *height = ws.ws_row;
+ return TRUE;
+ }
+ else
+ return FALSE;
+#else
+ return FALSE;
#endif
+}
+#endif /* !PLATFORM_WIN32 */
MonoBoolean ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean echo);
MonoBoolean ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break);
MonoBoolean ves_icall_System_ConsoleDriver_TtySetup (MonoString *teardown);
+MonoBoolean ves_icall_System_ConsoleDriver_GetTtySize (HANDLE handle, gint32 *width, gint32 *height);
G_END_DECLS
utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
value = g_getenv (utf8_name);
+
g_free (utf8_name);
if (value == 0)
};
static const IcallEntry consoledriver_icalls [] = {
+ {"GetTtySize", ves_icall_System_ConsoleDriver_GetTtySize },
{"InternalKeyAvailable", ves_icall_System_ConsoleDriver_InternalKeyAvailable },
{"Isatty", ves_icall_System_ConsoleDriver_Isatty },
{"SetBreak", ves_icall_System_ConsoleDriver_SetBreak },