termcap.c (167260) | termcap.c (179244) |
---|---|
1/* 2 * Copyright (c) 1994, Paul Richards. 3 * 4 * All rights reserved. 5 * 6 * This software may be used, modified, copied, distributed, and sold, in both 7 * source and binary form provided that the above copyright and these terms 8 * are retained, verbatim, as the first lines of this file. Under no 9 * circumstances is the author responsible for the proper functioning of this 10 * software, nor does the author assume any responsibility for damages 11 * incurred with its use. 12 * | 1/* 2 * Copyright (c) 1994, Paul Richards. 3 * 4 * All rights reserved. 5 * 6 * This software may be used, modified, copied, distributed, and sold, in both 7 * source and binary form provided that the above copyright and these terms 8 * are retained, verbatim, as the first lines of this file. Under no 9 * circumstances is the author responsible for the proper functioning of this 10 * software, nor does the author assume any responsibility for damages 11 * incurred with its use. 12 * |
13 * $FreeBSD: head/usr.sbin/sysinstall/termcap.c 167260 2007-03-06 09:32:41Z kevlo $ | 13 * $FreeBSD: head/usr.sbin/sysinstall/termcap.c 179244 2008-05-23 14:24:33Z ed $ |
14 */ 15 16#include "sysinstall.h" 17#include <stdarg.h> 18#include <fcntl.h> 19#include <sys/errno.h> 20#include <sys/ioctl.h> 21#include <sys/consio.h> --- 48 unchanged lines hidden (view full) --- 70 } 71} 72 73int 74set_termcap(void) 75{ 76 char *term; 77 int stat; | 14 */ 15 16#include "sysinstall.h" 17#include <stdarg.h> 18#include <fcntl.h> 19#include <sys/errno.h> 20#include <sys/ioctl.h> 21#include <sys/consio.h> --- 48 unchanged lines hidden (view full) --- 70 } 71} 72 73int 74set_termcap(void) 75{ 76 char *term; 77 int stat; |
78 struct ttysize ts; | 78 struct winsize ws; |
79 80 term = getenv("TERM"); 81 stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); 82 83 if (!RunningAsInit) { 84 if (isDebug()) 85 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); 86 else --- 49 unchanged lines hidden (view full) --- 136 if (setenv("TERM", "cons25-m", 1) < 0) 137 return -1; 138 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 139 return -1; 140 } 141 } 142#endif 143 } | 79 80 term = getenv("TERM"); 81 stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); 82 83 if (!RunningAsInit) { 84 if (isDebug()) 85 DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); 86 else --- 49 unchanged lines hidden (view full) --- 136 if (setenv("TERM", "cons25-m", 1) < 0) 137 return -1; 138 if (setenv("TERMCAP", termcap_cons25_m, 1) < 0) 139 return -1; 140 } 141 } 142#endif 143 } |
144 if (ioctl(0, TIOCGSIZE, &ts) == -1) { | 144 if (ioctl(0, TIOCGWINSZ, &ws) == -1) { |
145 msgDebug("Unable to get terminal size - errno %d\n", errno); | 145 msgDebug("Unable to get terminal size - errno %d\n", errno); |
146 ts.ts_lines = 0; | 146 ws.ws_row = 0; |
147 } | 147 } |
148 StatusLine = ts.ts_lines ? ts.ts_lines - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE); | 148 StatusLine = ws.ws_row ? ws.ws_row - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE); |
149 return 0; 150} | 149 return 0; 150} |