tty xputc()

Another part of github issue 227.  Casting a function pointer when
passing it to another function is iffy when lying about the return
type.  tputs() expects a routine which returns int, so give it one.
Other xputc() usage is equivalent to putchar(), so define xputc()
with the same function signature as that has.

The tputs() declarations in system.h should probably be changed
(third argument is a function which takes an int rather than
unspecified parameters) but I've left them alone.  I made that change
to tputs() in sys/share/tclib.c though.

NT and MSDOS changes are untested.  tclib.c compiles ok with clang-
as-gcc on OSX but hasn't been tested with the port that uses it (VMS).
This commit is contained in:
PatR
2019-10-05 16:49:34 -07:00
parent f7bf56555e
commit 0d76f68f2c
6 changed files with 54 additions and 59 deletions

View File

@@ -114,16 +114,7 @@ E void FDECL(tty_startup, (int *, int *));
#ifndef NO_TERMS
E void NDECL(tty_shutdown);
#endif
#if defined(apollo)
/* Apollos don't widen old-style function definitions properly -- they try to
* be smart and use the prototype, or some such strangeness. So we have to
* define UNWIDENDED_PROTOTYPES (in tradstdc.h), which makes CHAR_P below a
* char. But the tputs termcap call was compiled as if xputc's argument
* actually would be expanded. So here, we have to make an exception. */
E void FDECL(xputc, (int));
#else
E void FDECL(xputc, (CHAR_P));
#endif
E int FDECL(xputc, (int));
E void FDECL(xputs, (const char *));
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
E void FDECL(xputg, (int, int, unsigned));