diff --git a/src/conio/cterm.c b/src/conio/cterm.c index f8a8db4531901aa97fc698da80411336f608211d..c463386094edac9daed54e9e90dde24045510dcf 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -870,6 +870,8 @@ void cterm_init(int height, int width, int xpos, int ypos, int backlines, unsign cterm.backpos=0; cterm.backlines=backlines; cterm.scrollback=scrollback; + cterm.log=LOG_NONE; + cterm.logfile=NULL; if(cterm.scrollback!=NULL) memset(cterm.scrollback,0,cterm.width*2*cterm.backlines); textattr(cterm.attr); @@ -893,6 +895,8 @@ void ctputs(char *buf) _wscroll=0; cx=wherex(); cy=wherey(); + if(cterm.log==LOG_ASCII) + fputs(buf, cterm.logfile); for(p=buf;*p;p++) { switch(*p) { case '\r': @@ -987,6 +991,8 @@ char *cterm_write(unsigned char *buf, int buflen, char *retbuf, int retsize, int case 0: break; default: + if(cterm.log==LOG_RAW) + fwrite(buf, buflen, 1, cterm.logfile); prn[0]=0; for(j=0;j<buflen;j++) { ch[0]=buf[j]; diff --git a/src/conio/cterm.h b/src/conio/cterm.h index 4149077c4dafe3140c6ea944424179052c6aa0ab..61cf760ec69ae2f3920fe16fdf5d08cc1834f87e 100644 --- a/src/conio/cterm.h +++ b/src/conio/cterm.h @@ -34,12 +34,20 @@ #ifndef _CTERM_H_ #define _CTERM_H_ +#include <stdio.h> /* FILE* */ + enum { CTERM_MUSIC_NORMAL ,CTERM_MUSIC_LEGATO ,CTERM_MUSIC_STACATTO }; +enum { + LOG_NONE + ,LOG_ASCII + ,LOG_RAW +}; + struct cterminal { int height; int width; @@ -63,6 +71,8 @@ struct cterminal { int backlines; int xpos; int ypos; + int log; + FILE* logfile; }; #ifdef __cplusplus