1 /* Public Domain Curses */
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)
14 VIOMODEINFO modeInfo
= {0};
19 PDC_LOG(("PDC_get_columns() - called\n"));
22 v_dimen(&cols
, &rows
);
24 modeInfo
.cb
= sizeof(modeInfo
);
25 VioGetMode(&modeInfo
, 0);
28 env_cols
= getenv("COLS");
31 cols
= min(atoi(env_cols
), cols
);
33 PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols
));
38 /* get the cursor size/shape */
40 int PDC_get_cursor_mode(void)
43 int curstart
= 0, curend
= 0;
45 VIOCURSORINFO cursorInfo
;
47 PDC_LOG(("PDC_get_cursor_mode() - called\n"));
50 v_getctype(&curstart
, &curend
);
51 return (curstart
<< 8) | curend
;
53 VioGetCurType (&cursorInfo
, 0);
55 return (cursorInfo
.yStart
<< 8) | cursorInfo
.cEnd
;
59 /* return number of screen rows */
61 int PDC_get_rows(void)
66 VIOMODEINFO modeInfo
= {0};
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 */
77 v_dimen(&cols
, &rows
);
79 modeInfo
.cb
= sizeof(modeInfo
);
80 VioGetMode(&modeInfo
, 0);
83 env_rows
= getenv("LINES");
86 rows
= min(atoi(env_rows
), rows
);
88 PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows
));