Close PR#1542. Don't just assume 24 lines, get the tty size.

Some things may still display text on the 24th line, but that's because
they've always been screens designed to fit into a minimal real-estate
and have hardwired assumptions about the dimensions.  They'll be a little
harder to make dynamic.
This commit is contained in:
jkh 1996-08-01 10:58:54 +00:00
parent 8ff2c20061
commit af06a2d9e6
18 changed files with 84 additions and 48 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.22 1996/07/05 08:35:53 jkh Exp $
* $Id: dmenu.c,v 1.23 1996/07/11 18:37:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -171,7 +171,10 @@ menu_height(DMenu *menu, int n)
int max;
char *t;
for (t = menu->prompt, max = MAX_MENU; *t; t++) {
max = MAX_MENU;
if (StatusLine > 24)
max += StatusLine - 24;
for (t = menu->prompt; *t; t++) {
if (*t == '\n')
--max;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
* $Id: globals.c,v 1.13 1996/04/28 20:53:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,6 +50,7 @@ Boolean OnVTY; /* Are we on a VTY? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
int StatusLine; /* Where to stick our status messages */
/*
* Yes, I know some of these are already automatically initialized as

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: msg.c,v 1.37 1996/07/10 11:38:28 jkh Exp $
* $Id: msg.c,v 1.38 1996/07/31 06:20:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -39,9 +39,6 @@
#include <sys/ioctl.h>
#include <machine/console.h>
#define VTY_STATLINE 24
#define TTY_STATLINE 23
Boolean
isDebug(void)
{
@ -64,7 +61,7 @@ msgYap(char *fmt, ...)
va_end(args);
attrs = getattrs(stdscr);
attrset(A_REVERSE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
}
@ -81,7 +78,7 @@ msgInfo(char *fmt, ...)
attrs = getattrs(stdscr);
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
move(StatusLine, 0);
clrtoeol();
return;
}
@ -98,9 +95,9 @@ msgInfo(char *fmt, ...)
}
line[80] = '\0';
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line);
mvaddstr(StatusLine, 0, line);
attrset(attrs);
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79);
move(StatusLine, 79);
refresh();
}
@ -120,7 +117,7 @@ msgWarn(char *fmt, ...)
attrs = getattrs(stdscr);
beep();
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -143,7 +140,7 @@ msgError(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -166,7 +163,7 @@ msgFatal(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
addstr(" - ");
addstr("PRESS ANY KEY TO ");
if (getpid() == 1)

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.76 1996/07/31 06:20:59 jkh Exp $
* $Id: sysinstall.h,v 1.77 1996/07/31 09:29:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -295,6 +295,7 @@ extern unsigned int XF86Dists; /* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern int BootMgr; /* Which boot manager to use */
extern int StatusLine; /* Where to print our status messages */
extern DMenu MenuInitial; /* Initial installation menu */
extern DMenu MenuFixit; /* Fixit repair menu */
extern DMenu MenuMBRType; /* Type of MBR to write on the disk */

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.61 1996/07/08 08:54:34 jkh Exp $
* $Id: system.c,v 1.62 1996/07/10 11:38:29 jkh Exp $
*
* Jordan Hubbard
*
@ -58,6 +58,7 @@ systemInitialize(int argc, char **argv)
{
int i;
signal(SIGINT, SIG_IGN);
globalsInit();

View File

@ -23,11 +23,15 @@
#include "sysinstall.h"
#define VTY_STATUS_LINE 24
#define TTY_STATUS_LINE 23
int
set_termcap(void)
{
char *term;
int stat;
struct ttysize ts;
OnVTY = FALSE;
term = getenv("TERM");
@ -76,5 +80,10 @@ set_termcap(void)
}
OnVTY = TRUE;
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
ts.ts_lines = OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE;
}
StatusLine = ts.ts_lines;
return 0;
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.22 1996/07/05 08:35:53 jkh Exp $
* $Id: dmenu.c,v 1.23 1996/07/11 18:37:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -171,7 +171,10 @@ menu_height(DMenu *menu, int n)
int max;
char *t;
for (t = menu->prompt, max = MAX_MENU; *t; t++) {
max = MAX_MENU;
if (StatusLine > 24)
max += StatusLine - 24;
for (t = menu->prompt; *t; t++) {
if (*t == '\n')
--max;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
* $Id: globals.c,v 1.13 1996/04/28 20:53:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,6 +50,7 @@ Boolean OnVTY; /* Are we on a VTY? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
int StatusLine; /* Where to stick our status messages */
/*
* Yes, I know some of these are already automatically initialized as

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: msg.c,v 1.37 1996/07/10 11:38:28 jkh Exp $
* $Id: msg.c,v 1.38 1996/07/31 06:20:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -39,9 +39,6 @@
#include <sys/ioctl.h>
#include <machine/console.h>
#define VTY_STATLINE 24
#define TTY_STATLINE 23
Boolean
isDebug(void)
{
@ -64,7 +61,7 @@ msgYap(char *fmt, ...)
va_end(args);
attrs = getattrs(stdscr);
attrset(A_REVERSE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
}
@ -81,7 +78,7 @@ msgInfo(char *fmt, ...)
attrs = getattrs(stdscr);
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
move(StatusLine, 0);
clrtoeol();
return;
}
@ -98,9 +95,9 @@ msgInfo(char *fmt, ...)
}
line[80] = '\0';
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line);
mvaddstr(StatusLine, 0, line);
attrset(attrs);
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79);
move(StatusLine, 79);
refresh();
}
@ -120,7 +117,7 @@ msgWarn(char *fmt, ...)
attrs = getattrs(stdscr);
beep();
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -143,7 +140,7 @@ msgError(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -166,7 +163,7 @@ msgFatal(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
addstr(" - ");
addstr("PRESS ANY KEY TO ");
if (getpid() == 1)

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.76 1996/07/31 06:20:59 jkh Exp $
* $Id: sysinstall.h,v 1.77 1996/07/31 09:29:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -295,6 +295,7 @@ extern unsigned int XF86Dists; /* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern int BootMgr; /* Which boot manager to use */
extern int StatusLine; /* Where to print our status messages */
extern DMenu MenuInitial; /* Initial installation menu */
extern DMenu MenuFixit; /* Fixit repair menu */
extern DMenu MenuMBRType; /* Type of MBR to write on the disk */

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.61 1996/07/08 08:54:34 jkh Exp $
* $Id: system.c,v 1.62 1996/07/10 11:38:29 jkh Exp $
*
* Jordan Hubbard
*
@ -58,6 +58,7 @@ systemInitialize(int argc, char **argv)
{
int i;
signal(SIGINT, SIG_IGN);
globalsInit();

View File

@ -23,11 +23,15 @@
#include "sysinstall.h"
#define VTY_STATUS_LINE 24
#define TTY_STATUS_LINE 23
int
set_termcap(void)
{
char *term;
int stat;
struct ttysize ts;
OnVTY = FALSE;
term = getenv("TERM");
@ -76,5 +80,10 @@ set_termcap(void)
}
OnVTY = TRUE;
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
ts.ts_lines = OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE;
}
StatusLine = ts.ts_lines;
return 0;
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.22 1996/07/05 08:35:53 jkh Exp $
* $Id: dmenu.c,v 1.23 1996/07/11 18:37:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -171,7 +171,10 @@ menu_height(DMenu *menu, int n)
int max;
char *t;
for (t = menu->prompt, max = MAX_MENU; *t; t++) {
max = MAX_MENU;
if (StatusLine > 24)
max += StatusLine - 24;
for (t = menu->prompt; *t; t++) {
if (*t == '\n')
--max;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: globals.c,v 1.12 1996/04/13 13:31:38 jkh Exp $
* $Id: globals.c,v 1.13 1996/04/28 20:53:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -50,6 +50,7 @@ Boolean OnVTY; /* Are we on a VTY? */
Variable *VarHead; /* The head of the variable chain */
Device *mediaDevice; /* Where we're installing from */
int BootMgr; /* Which boot manager we're using */
int StatusLine; /* Where to stick our status messages */
/*
* Yes, I know some of these are already automatically initialized as

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: msg.c,v 1.37 1996/07/10 11:38:28 jkh Exp $
* $Id: msg.c,v 1.38 1996/07/31 06:20:58 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -39,9 +39,6 @@
#include <sys/ioctl.h>
#include <machine/console.h>
#define VTY_STATLINE 24
#define TTY_STATLINE 23
Boolean
isDebug(void)
{
@ -64,7 +61,7 @@ msgYap(char *fmt, ...)
va_end(args);
attrs = getattrs(stdscr);
attrset(A_REVERSE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
}
@ -81,7 +78,7 @@ msgInfo(char *fmt, ...)
attrs = getattrs(stdscr);
/* NULL is a special convention meaning "erase the old stuff" */
if (!fmt) {
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0);
move(StatusLine, 0);
clrtoeol();
return;
}
@ -98,9 +95,9 @@ msgInfo(char *fmt, ...)
}
line[80] = '\0';
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line);
mvaddstr(StatusLine, 0, line);
attrset(attrs);
move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79);
move(StatusLine, 79);
refresh();
}
@ -120,7 +117,7 @@ msgWarn(char *fmt, ...)
attrs = getattrs(stdscr);
beep();
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -143,7 +140,7 @@ msgError(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
attrset(attrs);
refresh();
if (OnVTY && isDebug())
@ -166,7 +163,7 @@ msgFatal(char *fmt, ...)
beep();
attrs = getattrs(stdscr);
attrset(ATTR_TITLE);
mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, errstr);
mvaddstr(StatusLine, 0, errstr);
addstr(" - ");
addstr("PRESS ANY KEY TO ");
if (getpid() == 1)

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.76 1996/07/31 06:20:59 jkh Exp $
* $Id: sysinstall.h,v 1.77 1996/07/31 09:29:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -295,6 +295,7 @@ extern unsigned int XF86Dists; /* Which XFree86 dists we want */
extern unsigned int XF86ServerDists; /* The XFree86 servers we want */
extern unsigned int XF86FontDists; /* The XFree86 fonts we want */
extern int BootMgr; /* Which boot manager to use */
extern int StatusLine; /* Where to print our status messages */
extern DMenu MenuInitial; /* Initial installation menu */
extern DMenu MenuFixit; /* Fixit repair menu */
extern DMenu MenuMBRType; /* Type of MBR to write on the disk */

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: system.c,v 1.61 1996/07/08 08:54:34 jkh Exp $
* $Id: system.c,v 1.62 1996/07/10 11:38:29 jkh Exp $
*
* Jordan Hubbard
*
@ -58,6 +58,7 @@ systemInitialize(int argc, char **argv)
{
int i;
signal(SIGINT, SIG_IGN);
globalsInit();

View File

@ -23,11 +23,15 @@
#include "sysinstall.h"
#define VTY_STATUS_LINE 24
#define TTY_STATUS_LINE 23
int
set_termcap(void)
{
char *term;
int stat;
struct ttysize ts;
OnVTY = FALSE;
term = getenv("TERM");
@ -76,5 +80,10 @@ set_termcap(void)
}
OnVTY = TRUE;
}
if (ioctl(0, TIOCGSIZE, &ts) == -1) {
msgDebug("Unable to get terminal size - errno %d\n", errno);
ts.ts_lines = OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE;
}
StatusLine = ts.ts_lines;
return 0;
}