summaryrefslogtreecommitdiff
path: root/libterm/term_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libterm/term_io.c')
-rw-r--r--libterm/term_io.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/libterm/term_io.c b/libterm/term_io.c
index 1a934f9..5ef682b 100644
--- a/libterm/term_io.c
+++ b/libterm/term_io.c
@@ -6,6 +6,7 @@ int term_fprint( screen_mode_e mode, FILE *f )
if (f == NULL)
return -1;
+ ERROR("\n");
switch ( mode )
{
case SCREEN_MODE_80x25:
@@ -19,12 +20,31 @@ int term_fprint( screen_mode_e mode, FILE *f )
return ret;
}
+int term_print( term_screen *ts, const char *s, size_t n)
+{
+ int ret=0;
+
+ if ( ts == NULL )
+ return -1;
+
+ if ( s == NULL )
+ return -1;
+
+ if ( n < 1 )
+ return -1;
+
+ if ( n > 80*25 )
+ return -1;
+
+ ret = write( ts->ofd, s, n );
+
+ return ret;
+}
//print data to terminal starting from x,y
-int term_print( term_screen *ts, const char *buf, size_t size,
+int term_print_xy( term_screen *ts, const char *buf, size_t size,
int init_column, int init_row )
{
- int pos_column=0, pos_row=0;
int ret=-1;
if ( buf == NULL )
{
@@ -50,6 +70,24 @@ int term_print( term_screen *ts, const char *buf, size_t size,
return ret;
}
+int term_draw_hline( term_screen *ts, int pc, int pr, const int sz, char ch)
+{
+ int ret=0;
+ char buf[sz]; memset( buf, ch, sz );
+
+ if ( sz > 0)
+ {
+ term_cur_set_c( ts, pc );
+ term_cur_set_r( ts, pr );
+ write( ts->ofd, buf, sz );
+ } else
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
+
//read one character from stream
int term_getc( term_screen *ts )
{