hdt: remove call to legacy getnumcols (menu)
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Thu, 3 Sep 2009 21:31:27 +0000 (14:31 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Thu, 3 Sep 2009 21:31:27 +0000 (14:31 -0700)
Use getscreensize instead.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
com32/hdt/hdt-menu.c

index e3521dc..55031d6 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include "hdt-menu.h"
+#include <unistd.h>
 
 int start_menu_mode(struct s_hardware *hardware, char *version_string)
 {
@@ -86,7 +87,7 @@ TIMEOUTCODE ontimeout()
 /* Keyboard handler for the menu system */
 void keys_handler(t_menuitem * mi, unsigned int scancode)
 {
-  char nc;
+  int nr, nc;
 
   if ((scancode >> 8) == F1) {  // If scancode of F1
     runhelpsystem(mi->helpid);
@@ -97,7 +98,11 @@ void keys_handler(t_menuitem * mi, unsigned int scancode)
    */
   if (((scancode & 0xFF) == 0x09) && (mi->action == OPT_RUN)) {
 //(isallowed(username,"editcmd") || isallowed(username,"root"))) {
-    nc = getnumcols();
+    if (getscreensize(1, &nr, &nc)) {
+        /* Unknown screen size? */
+        nc = 80;
+        nr = 24;
+    }
     /* User typed TAB and has permissions to edit command line */
     gotoxy(EDITPROMPT, 1);
     csprint("Command line:", 0x07);