summaryrefslogtreecommitdiff
path: root/libterm/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'libterm/term.c')
-rw-r--r--libterm/term.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/libterm/term.c b/libterm/term.c
new file mode 100644
index 0000000..5d2a44f
--- /dev/null
+++ b/libterm/term.c
@@ -0,0 +1,54 @@
+#include "term.h"
+
+int term_init_data( term_screen *term )
+{
+ int ret=0;
+
+ term->term_col = term_get_col();
+ if (term->term_col == -1) ret = -1;
+
+ term->term_row = term_get_row();
+ if (term->term_row == -1) ret = -1;
+
+ term->mode = SCREEN_MODE_80x24;
+
+ return ret;
+}
+
+
+int term_get_col( )
+{
+ int ret=-1;
+ int fret=-1;
+
+ struct winsize w;
+
+
+ fret = ioctl(0, TIOCGWINSZ, &w );
+ if ( fret == 0 )
+ {
+ return w.ws_col;
+ }
+
+
+ return -1;
+}
+
+
+int term_get_row( )
+{
+ int ret=-1;
+ int fret=-1;
+
+ struct winsize w;
+
+
+ fret = ioctl(0, TIOCGWINSZ, &w );
+ if ( fret == 0 )
+ {
+ return w.ws_row;
+ }
+
+ return -1;
+}
+