char *shell;
fd_set rdset;
char buf[1024];
+ struct timeval tv;
if(!(shell = getenv("SHELL"))) {
shell = "/bin/sh";
FD_SET(pty, &rdset);
FD_SET(xfd, &rdset);
+ tv.tv_sec = 0;
+ tv.tv_usec = 250000;
+
XFlush(miniglut_x11_display());
- while(select(maxfd + 1, &rdset, 0, 0, 0) == -1 && errno == EINTR);
+ while(select(maxfd + 1, &rdset, 0, 0, &tv) == -1 && errno == EINTR);
+
+ glutPostRedisplay();
if(FD_ISSET(pty, &rdset)) {
rdsz = read(pty, buf, sizeof buf);
glutPostRedisplay();
}
}
- if(FD_ISSET(xfd, &rdset)) {
+ /*if(FD_ISSET(xfd, &rdset)) {*/
glutMainLoopEvent();
- }
+ /*}*/
}
return 0;
{
int i, j;
unsigned char *scrptr = scrbuf;
+ unsigned int msec = glutGet(GLUT_ELAPSED_TIME);
glClearColor(0.1, 0.1, 0.1, 1);
glClear(GL_COLOR_BUFFER_BIT);
}
text_end();
+ if(cursor_vis && (!cursor_blink || ((msec >> 9) & 1))) {
+ int y = 23 - cursor_y;
+
+ glLogicOp(GL_XOR);
+ glEnable(GL_COLOR_LOGIC_OP);
+
+ glColor3f(1, 1, 1);
+ glRectf(cursor_x + 0.1f, y + 1.0 / 9.0, cursor_x + 1, y + 0.95f);
+
+ glDisable(GL_COLOR_LOGIC_OP);
+ }
+
glutSwapBuffers();
}
static void reshape(int x, int y)
{
- printf("RESHAPE\n");
win_width = x;
win_height = y;
static unsigned char shifted[] = {
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
- "\040\041\042\043\044\045\046\047\050\051\052\053<_>?"
+ "\040\041\042\043\044\045\046\"\050\051\052\053<_>?"
")!@#$%^&*(;:<+>?"
"@ABCDEFGHIJKLMNO"
"PQRSTUVWXYZ{|}^_"
static void clearscr(void);
static void scroll(void);
-int cursor_x, cursor_y, cursor_vis;
+int cursor_x, cursor_y, cursor_vis, cursor_blink;
unsigned char scrbuf[TERM_COLS * TERM_ROWS];
void term_init(void)
{
+ cursor_vis = 1;
+ cursor_blink = 0;
clearscr();
}
{
static int cbuf[8], clen;
+ /*
if(isprint(c)) {
printf(" %c", c);
} else {
printf(" %x", (unsigned int)c);
}
fflush(stdout);
+ */
if(clen) {
if(cbuf[0] == 0x1b) {
clen = 0;
return 1;
}
+ cbuf[clen++] = c;
+ return 0;
}
}
break;
case '\n':
- if(cursor_y >= TERM_ROWS) {
+ if(cursor_y >= TERM_ROWS - 1) {
scroll();
+ cursor_y = TERM_ROWS - 1;
} else {
cursor_y++;
}
#define TERM_COLS 80
#define TERM_ROWS 24
-extern int cursor_x, cursor_y, cursor_vis;
+extern int cursor_x, cursor_y, cursor_vis, cursor_blink;
extern unsigned char scrbuf[TERM_COLS * TERM_ROWS];
void term_init(void);