From 46ec9a0bb65040edf2a49930b50a98952f1dc4ff Mon Sep 17 00:00:00 2001 From: Rob Gowin Date: Tue, 26 Jul 2022 11:20:22 -0400 Subject: [PATCH] Simple changes for porting to non-UNIX systems. input.c: The tmpf variable is defined inside an #if UNIX block at line 506, but used outside of an #if UNIX block at line 696. Added #if UNIX there. spawn.c: - For spawncli(), return FALSE if neither USB ot BSD is defined. - In spawn() and execprg(), move declarations inside USB | BSD block. tcap.c: Move #if TERMCAP to avoid curses.h include on non-TERMCAP systems. termio.c: For ttgetc(), return 0 if neither USG nor BSD is defined. --- input.c | 2 ++ spawn.c | 14 ++++++++++---- tcap.c | 4 ++-- termio.c | 1 + 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/input.c b/input.c index 96012f2..626e44c 100644 --- a/input.c +++ b/input.c @@ -693,10 +693,12 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar) } TTflush() ; +#if UNIX if( tmpf != NULL) { fclose( tmpf) ; unlink( tmp) ; } +#endif return retval ; } diff --git a/spawn.c b/spawn.c index d7a3e2f..10eafc8 100644 --- a/spawn.c +++ b/spawn.c @@ -69,6 +69,8 @@ BINDABLE( spawncli) { term.t_nrow = term.t_ncol = 0; #endif return TRUE; +#else + return FALSE; #endif } @@ -100,14 +102,14 @@ void rtfrmshell(void) * done. Bound to "C-X !". */ BINDABLE( spawn) { - int s ; - char *line ; /* don't allow this command if restricted */ if( restflag) return resterr(); #if USG | BSD + int s ; + char *line ; s = newmlarg( &line, "!", 0) ; if( s != TRUE) return s ; @@ -129,6 +131,8 @@ BINDABLE( spawn) { TTkopen(); sgarbf = TRUE; return TRUE; +#else + return FALSE; #endif } @@ -139,14 +143,14 @@ BINDABLE( spawn) { */ BINDABLE( execprg) { - int s ; - char *line ; /* don't allow this command if restricted */ if( restflag) return resterr() ; #if USG | BSD + int s ; + char *line ; s = newmlarg( &line, "$", 0) ; if( s != TRUE) return s ; @@ -164,6 +168,8 @@ BINDABLE( execprg) { while ((s = tgetc()) != '\r' && s != ' '); sgarbf = TRUE; return TRUE; +#else + return FALSE; #endif } diff --git a/tcap.c b/tcap.c index 53f829e..e244a24 100644 --- a/tcap.c +++ b/tcap.c @@ -6,6 +6,8 @@ * modified by Petri Kutvonen */ +#if TERMCAP + #include #include @@ -24,8 +26,6 @@ #include "display.h" #include "termio.h" -#if TERMCAP - boolean eolexist = TRUE ; /* does clear to EOL exist */ boolean revexist = FALSE ; /* does reverse video exist? */ boolean sgarbf = TRUE ; /* TRUE if screen is garbage */ diff --git a/termio.c b/termio.c index 3ed67b0..5975ae6 100644 --- a/termio.c +++ b/termio.c @@ -228,6 +228,7 @@ int ttgetc( void) { } return kbdq & 255; #endif + return 0; } #if TYPEAH