drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / os2 / pdcgetsc.c
blobd712dadfa84bd73c0383c1c98718f9c8a250d876
1 /* Public Domain Curses */
3 #include "pdcos2.h"
5 RCSID("$Id: pdcgetsc.c,v 1.39 2008/07/14 04:24:51 wmcbrine Exp $")
7 /* return width of screen/viewport */
9 int PDC_get_columns(void)
11 #ifdef EMXVIDEO
12 int rows = 0;
13 #else
14 VIOMODEINFO modeInfo = {0};
15 #endif
16 int cols = 0;
17 const char *env_cols;
19 PDC_LOG(("PDC_get_columns() - called\n"));
21 #ifdef EMXVIDEO
22 v_dimen(&cols, &rows);
23 #else
24 modeInfo.cb = sizeof(modeInfo);
25 VioGetMode(&modeInfo, 0);
26 cols = modeInfo.col;
27 #endif
28 env_cols = getenv("COLS");
30 if (env_cols)
31 cols = min(atoi(env_cols), cols);
33 PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
35 return cols;
38 /* get the cursor size/shape */
40 int PDC_get_cursor_mode(void)
42 #ifdef EMXVIDEO
43 int curstart = 0, curend = 0;
44 #else
45 VIOCURSORINFO cursorInfo;
46 #endif
47 PDC_LOG(("PDC_get_cursor_mode() - called\n"));
49 #ifdef EMXVIDEO
50 v_getctype(&curstart, &curend);
51 return (curstart << 8) | curend;
52 #else
53 VioGetCurType (&cursorInfo, 0);
55 return (cursorInfo.yStart << 8) | cursorInfo.cEnd;
56 #endif
59 /* return number of screen rows */
61 int PDC_get_rows(void)
63 #ifdef EMXVIDEO
64 int cols = 0;
65 #else
66 VIOMODEINFO modeInfo = {0};
67 #endif
68 int rows = 0;
69 const char *env_rows;
71 PDC_LOG(("PDC_get_rows() - called\n"));
73 /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
74 /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
76 #ifdef EMXVIDEO
77 v_dimen(&cols, &rows);
78 #else
79 modeInfo.cb = sizeof(modeInfo);
80 VioGetMode(&modeInfo, 0);
81 rows = modeInfo.row;
82 #endif
83 env_rows = getenv("LINES");
85 if (env_rows)
86 rows = min(atoi(env_rows), rows);
88 PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
90 return rows;