summaryrefslogtreecommitdiffstats
path: root/libterm
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-03-24 20:16:29 +0900
committerFreeArtMan <dos21h@gmail.com>2015-03-24 20:16:29 +0900
commitf1fb9827faec228246062f2cd8e38f0dd3338e3a (patch)
tree4b142676d0f7dbfb2decd2eb9886372d7c1fb34d /libterm
parentc1e6c1341ace1f61569e6d1d0dbfb36cb192113c (diff)
downloadmicrobbs-f1fb9827faec228246062f2cd8e38f0dd3338e3a.tar.gz
microbbs-f1fb9827faec228246062f2cd8e38f0dd3338e3a.zip
Added ini file support
Diffstat (limited to 'libterm')
-rw-r--r--libterm/Makefile2
-rw-r--r--libterm/term.c11
-rw-r--r--libterm/term.h3
3 files changed, 14 insertions, 2 deletions
diff --git a/libterm/Makefile b/libterm/Makefile
index 457eea6..36e9932 100644
--- a/libterm/Makefile
+++ b/libterm/Makefile
@@ -1,7 +1,7 @@
PROJECT=libterm
CC=gcc
LD=ld
-CFLAGS=
+CFLAGS=-g3
make:
$(CC) $(CFLAGS) -c term.c
diff --git a/libterm/term.c b/libterm/term.c
index 532dc92..241b650 100644
--- a/libterm/term.c
+++ b/libterm/term.c
@@ -250,17 +250,26 @@ exit_error:
}
+#include <assert.h>
//clean terminal with escape command
int term_clr_scr( term_screen *ts )
{
int ret = 0;
- if ( write( ts->ofd, T_ESC "[H" T_ESC "[2J", 7 ) <= 0 ){};
+ char s[] = T_ESC "[H" T_ESC "[2J";
+
+
+ ASSERT( strlen(s)>0 );
+ ASSERT( ts != NULL );
+ ASSERT( ts->ofd > 0 );
+
+ if ( write( ts->ofd, s, strlen(s) ) <= 0 ){};
return ret;
}
+
//set terminal default input/output behavior
int term_set_raw_mode( term_screen *ts )
{
diff --git a/libterm/term.h b/libterm/term.h
index 51af31d..878cda4 100644
--- a/libterm/term.h
+++ b/libterm/term.h
@@ -12,10 +12,13 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
+#include <assert.h>
#include "screen_modes.h"
#include "debug.h"
+#define ASSERT assert
+
enum TERM_KEY_ACTION {
KEY_NULL = 0, /* NULL */
CTRL_A = 1, /* Ctrl+a */