diff options
-rw-r--r-- | mbbsd/pfterm.c | 40 | ||||
-rw-r--r-- | mbbsd/screen.c | 35 |
2 files changed, 75 insertions, 0 deletions
diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c index d82a22ef..9c988ea2 100644 --- a/mbbsd/pfterm.c +++ b/mbbsd/pfterm.c @@ -322,10 +322,17 @@ void scroll (void); // scroll up void rscroll (void); // scroll down void scrl (int rows); +// output (ncurses flavor) +void addch (unsigned char c); // equivalent to outc() +void addstr (const char *s); // equivalent to outs() +void addnstr (const char *s, int n); + // output (non-ncurses) void outc (unsigned char c); void outs (const char *s); +void outns (const char *s, int n); void outstr (const char *str); // prepare and print a complete string. +void addstring (const char *str); // ncurses-like of outstr(). // readback int instr (char *str); @@ -982,6 +989,30 @@ rscroll() // output void +addch (unsigned char c) +{ + outc(c); +} + +void +addstr (const char *s) +{ + outs(s); +} + +void +addnstr(const char *s, int n) +{ + outns(s, n); +} + +void +addstring(const char *s) +{ + outstr(s); +} + +void outs(const char *s) { if (!s) @@ -990,6 +1021,15 @@ outs(const char *s) outc(*s++); } +void +outns(const char *s, int n) +{ + if (!s) + return; + while (*s && n-- > 0) + outc(*s++); +} + void outstr(const char *str) { diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 3de85631..88696f8a 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -449,6 +449,16 @@ outs(const char *str) } void +outns(const char *str, int n) +{ + if (!str) + return; + while (*str && n-- > 0) { + outc(*str++); + } +} + +void outstr(const char *str) { // XXX TODO cannot prepare DBCS-ready environment? @@ -457,6 +467,31 @@ outstr(const char *str) } void +addch(unsigned char c) +{ + outc(c); +} + +void +addstr(const char *s) +{ + outs(s); +} + +void +addnstr(const char *s, int n) +{ + outns(s, n); +} + +void +addstring(const char *s) +{ + outs(s); +} + + +void scroll(void) { scrollcnt++; |