aboutsummaryrefslogtreecommitdiffstats
path: root/com32/cmenu/complex.c
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-03 14:16:17 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-03 14:16:17 -0700
commit6e64433a5db40467759ca858d8f998d52d921b5f (patch)
tree7fbf0d45f647465fb34894c2c4c9d0367cdcf091 /com32/cmenu/complex.c
parentbe67a5d4fa9705b36fe36bebed708a0a2e95946b (diff)
downloadsyslinux-6e64433a5db40467759ca858d8f998d52d921b5f.tar.gz
syslinux-6e64433a5db40467759ca858d8f998d52d921b5f.tar.xz
syslinux-6e64433a5db40467759ca858d8f998d52d921b5f.zip
cmenu: use getscreensize to access number of rows/columns
The simple menu system already uses getscreensize. Another step towards unification. Impact: exported getnumcols and getnumrows are now deprecated. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/cmenu/complex.c')
-rw-r--r--com32/cmenu/complex.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/com32/cmenu/complex.c b/com32/cmenu/complex.c
index fb68a319..4bd74d54 100644
--- a/com32/cmenu/complex.c
+++ b/com32/cmenu/complex.c
@@ -21,6 +21,7 @@
#include "des.h"
#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
/* Global variables */
char infoline[160];
@@ -67,7 +68,7 @@ TIMEOUTCODE ontimeout()
void keys_handler(t_menuitem * mi, unsigned int scancode)
{
- char nc;
+ int nc, nr;
if ((scancode >> 8) == F1) { // If scancode of F1
runhelpsystem(mi->helpid);
@@ -76,7 +77,11 @@ void keys_handler(t_menuitem * mi, unsigned int scancode)
// and user has privileges to edit it, edit it in place.
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);
@@ -91,11 +96,15 @@ t_handler_return login_handler(t_menuitem * mi)
(void)mi; // Unused
char pwd[40];
char login[40];
- char nc;
+ int nc, nr;
t_handler_return rv;
if (mi->item == loginstr) { /* User wants to login */
- nc = getnumcols();
+ if (getscreensize(1, &nr, &nc)) {
+ /* Unknown screen size? */
+ nc = 80;
+ nr = 24;
+ }
gotoxy(PWDPROMPT, 1);
csprint("Enter Username: ", 0x07);
getstring(login, sizeof username);
@@ -133,10 +142,14 @@ t_handler_return login_handler(t_menuitem * mi)
void msys_handler(t_menusystem * ms, t_menuitem * mi)
{
- char nc;
+ int nc, nr;
void *v;
- nc = getnumcols(); // Get number of columns
+ if (getscreensize(1, &nr, &nc)) {
+ /* Unknown screen size? */
+ nc = 80;
+ nr = 24;
+ }
gotoxy(PWDLINE, PWDCOLUMN);
csprint("User: ", PWDATTR);
cprint(ms->fillchar, ms->fillattr, sizeof username);