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.
This commit is contained in:
Rob Gowin 2022-07-26 11:20:22 -04:00
parent ca23e6c394
commit 46ec9a0bb6
4 changed files with 15 additions and 6 deletions

View File

@ -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 ;
}

14
spawn.c
View File

@ -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
}

4
tcap.c
View File

@ -6,6 +6,8 @@
* modified by Petri Kutvonen
*/
#if TERMCAP
#include <stdlib.h>
#include <string.h>
@ -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 */

View File

@ -228,6 +228,7 @@ int ttgetc( void) {
}
return kbdq & 255;
#endif
return 0;
}
#if TYPEAH