projects
/
apps
/
madtty.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
a
[apps/madtty.git]
/
rote.c
diff --git
a/rote.c
b/rote.c
index
6d61820
..
442e1d0
100644
(file)
--- a/
rote.c
+++ b/
rote.c
@@
-22,7
+22,9
@@
Copyright (c) 2004 Bruno T. C. de Oliveira
#include "rote.h"
#include "roteprivate.h"
#include <stdlib.h>
#include "rote.h"
#include "roteprivate.h"
#include <stdlib.h>
+#ifdef USE_PTY
#include <pty.h>
#include <pty.h>
+#endif
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
@@
-41,6
+43,9
@@
RoteTerm *rote_vt_create(int rows, int cols) {
rt->rows = rows;
rt->cols = cols;
rt->rows = rows;
rt->cols = cols;
+ /* default mode is replace */
+ rt->insert = false;
+
/* create the cell matrix */
rt->cells = (RoteCell**) malloc(sizeof(RoteCell*) * rt->rows);
for (i = 0; i < rt->rows; i++) {
/* create the cell matrix */
rt->cells = (RoteCell**) malloc(sizeof(RoteCell*) * rt->rows);
for (i = 0; i < rt->rows; i++) {
@@
-89,6
+94,8
@@
void rote_vt_destroy(RoteTerm *rt) {
free(rt);
}
free(rt);
}
+#ifdef USE_NCURSES
+
static void default_cur_set_attr(WINDOW *win, unsigned char attr) {
int cp = ROTE_ATTR_BG(attr) * 8 + 7 - ROTE_ATTR_FG(attr);
if (!cp) wattrset(win, A_NORMAL);
static void default_cur_set_attr(WINDOW *win, unsigned char attr) {
int cp = ROTE_ATTR_BG(attr) * 8 + 7 - ROTE_ATTR_FG(attr);
if (!cp) wattrset(win, A_NORMAL);
@@
-98,9
+105,13
@@
static void default_cur_set_attr(WINDOW *win, unsigned char attr) {
if (ROTE_ATTR_BLINK(attr)) wattron(win, A_BLINK);
}
if (ROTE_ATTR_BLINK(attr)) wattron(win, A_BLINK);
}
+#endif
+
static inline unsigned char ensure_printable(unsigned char ch)
{ return ch >= 32 ? ch : 32; }
static inline unsigned char ensure_printable(unsigned char ch)
{ return ch >= 32 ? ch : 32; }
+#ifdef USE_NCURSES
+
void rote_vt_draw(RoteTerm *rt, WINDOW *win, int srow, int scol,
void (*cur_set_attr)(WINDOW*,unsigned char)) {
void rote_vt_draw(RoteTerm *rt, WINDOW *win, int srow, int scol,
void (*cur_set_attr)(WINDOW*,unsigned char)) {
@@
-119,6
+130,10
@@
void rote_vt_draw(RoteTerm *rt, WINDOW *win, int srow, int scol,
wmove(win, srow + rt->crow, scol + rt->ccol);
}
wmove(win, srow + rt->crow, scol + rt->ccol);
}
+#endif
+
+#ifdef USE_PTY
+
pid_t rote_vt_forkpty(RoteTerm *rt, const char *command) {
struct winsize ws;
pid_t childpid;
pid_t rote_vt_forkpty(RoteTerm *rt, const char *command) {
struct winsize ws;
pid_t childpid;
@@
-155,6
+170,8
@@
void rote_vt_forsake_child(RoteTerm *rt) {
rt->childpid = 0;
}
rt->childpid = 0;
}
+#endif
+
void rote_vt_update(RoteTerm *rt) {
fd_set ifs;
struct timeval tvzero;
void rote_vt_update(RoteTerm *rt) {
fd_set ifs;
struct timeval tvzero;