K&R textio/*.c: bulk forward reference function prototype conversion

K&R obsolete syntax removal for C23 compatibility series
This commit is contained in:
Darryl L. Miles 2025-01-31 17:13:02 +00:00 committed by Tim Edwards
parent 8cce1bdb7e
commit 906e02c898
5 changed files with 149 additions and 131 deletions

View File

@ -137,8 +137,8 @@ static TxCommand *lisp_cur_cmd = NULL;
*/ */
bool bool
FD_IsZero(fdmask) FD_IsZero(
const fd_set *fdmask; const fd_set *fdmask)
{ {
int i; int i;
for (i = 0; i <= TX_MAX_OPEN_FILES; i++) for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
@ -147,9 +147,9 @@ FD_IsZero(fdmask)
} }
void void
FD_OrSet(fdmask, dst) FD_OrSet(
const fd_set *fdmask; const fd_set *fdmask,
fd_set *dst; fd_set *dst)
{ {
int i; int i;
for (i = 0; i <= TX_MAX_OPEN_FILES; i++) for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
@ -175,8 +175,8 @@ FD_OrSet(fdmask, dst)
*/ */
void void
TxReleaseButton(but) TxReleaseButton(
int but; int but)
{ {
TxCurButtons &= ~but; TxCurButtons &= ~but;
} }
@ -198,8 +198,8 @@ TxReleaseButton(but)
*/ */
void void
TxPrintEvent(event) TxPrintEvent(
TxInputEvent *event; TxInputEvent *event)
{ {
TxError("Input event at %p\n ", (void *) event); TxError("Input event at %p\n ", (void *) event);
if (event->txe_button == TX_EOF) { if (event->txe_button == TX_EOF) {
@ -249,8 +249,8 @@ TxPrintEvent(event)
*/ */
void void
TxPrintCommand(cmd) TxPrintCommand(
TxCommand *cmd; TxCommand *cmd)
{ {
int i, j; int i, j;
char TxTemp[200]; char TxTemp[200];
@ -302,7 +302,7 @@ TxPrintCommand(cmd)
*/ */
TxInputEvent * TxInputEvent *
TxNewEvent() TxNewEvent(void)
{ {
TxInputEvent *event; TxInputEvent *event;
event = (TxInputEvent *) DQPopFront(&txFreeEvents); event = (TxInputEvent *) DQPopFront(&txFreeEvents);
@ -333,8 +333,8 @@ TxNewEvent()
*/ */
void void
TxAddEvent(event) TxAddEvent(
TxInputEvent *event; TxInputEvent *event)
{ {
ASSERT(event != NULL, "TxAddEvent"); ASSERT(event != NULL, "TxAddEvent");
DQPushRear(&txInputEvents, (ClientData) event); DQPushRear(&txInputEvents, (ClientData) event);
@ -358,8 +358,8 @@ TxAddEvent(event)
*/ */
void void
TxFreeEvent(event) TxFreeEvent(
TxInputEvent *event; TxInputEvent *event)
{ {
ASSERT(event != NULL, "TxFreeEvent"); ASSERT(event != NULL, "TxFreeEvent");
DQPushRear(&txFreeEvents, (ClientData) event); DQPushRear(&txFreeEvents, (ClientData) event);
@ -382,7 +382,7 @@ TxFreeEvent(event)
*/ */
TxCommand * TxCommand *
TxNewCommand() TxNewCommand(void)
{ {
TxCommand *command; TxCommand *command;
command = (TxCommand *) DQPopFront(&txFreeCommands); command = (TxCommand *) DQPopFront(&txFreeCommands);
@ -410,8 +410,8 @@ TxNewCommand()
*/ */
void void
TxFreeCommand(command) TxFreeCommand(
TxCommand *command; TxCommand *command)
{ {
ASSERT(command != NULL, "TxFreeCommand"); ASSERT(command != NULL, "TxFreeCommand");
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
@ -453,17 +453,17 @@ TxFreeCommand(command)
*/ */
void void
TxAddInputDevice(fdmask, inputProc, cdata) TxAddInputDevice(
const fd_set *fdmask; /* A mask of file descriptors that this const fd_set *fdmask, /* A mask of file descriptors that this
* device will handle. * device will handle.
*/ */
void (*inputProc)(); /* A routine to call. This routine will void (*inputProc)(), /* A routine to call. This routine will
* be passed a single file descriptor that * be passed a single file descriptor that
* is ready, and should read that file and * is ready, and should read that file and
* add events(s) by calling TxNewEvent() * add events(s) by calling TxNewEvent()
* followed by TxAddEvent(). * followed by TxAddEvent().
*/ */
ClientData cdata; /* Will be passed back to the proc whenever ClientData cdata) /* Will be passed back to the proc whenever
* it is called. * it is called.
*/ */
{ {
@ -482,10 +482,10 @@ TxAddInputDevice(fdmask, inputProc, cdata)
} }
void void
TxAdd1InputDevice(fd, inputProc, cdata) TxAdd1InputDevice(
int fd; int fd,
void (*inputProc)(); void (*inputProc)(),
ClientData cdata; ClientData cdata)
{ {
fd_set fs; fd_set fs;
FD_ZERO(&fs); FD_ZERO(&fs);
@ -508,8 +508,8 @@ TxAdd1InputDevice(fd, inputProc, cdata)
*/ */
void void
TxDeleteInputDevice(fdmask) TxDeleteInputDevice(
const fd_set *fdmask; /* A mask of file descriptors that are const fd_set *fdmask) /* A mask of file descriptors that are
* no longer active. * no longer active.
*/ */
{ {
@ -520,8 +520,8 @@ TxDeleteInputDevice(fdmask)
} }
void void
TxDelete1InputDevice(fd) TxDelete1InputDevice(
int fd; int fd)
{ {
int i, j; int i, j;
@ -554,8 +554,10 @@ TxDelete1InputDevice(fd)
*/ */
void void
TxSetPoint(x, y, wid) TxSetPoint(
int x, y, wid; int x,
int y,
int wid)
{ {
txHaveCurrentPoint = TRUE; txHaveCurrentPoint = TRUE;
txCurrentPoint.p_x = x; txCurrentPoint.p_x = x;
@ -581,8 +583,8 @@ TxSetPoint(x, y, wid)
*/ */
int int
TxGetPoint(tx_p) TxGetPoint(
Point *tx_p; Point *tx_p)
{ {
if (txHaveCurrentPoint) if (txHaveCurrentPoint)
{ {
@ -609,7 +611,7 @@ TxGetPoint(tx_p)
*/ */
void void
TxClearPoint() TxClearPoint(void)
{ {
txHaveCurrentPoint = FALSE; txHaveCurrentPoint = FALSE;
} }
@ -633,9 +635,9 @@ unsigned char txLogFlags;
*/ */
void void
TxLogStart(fileName, mw) TxLogStart(
char *fileName; char *fileName,
MagWindow *mw; /* Window commands are logged from */ MagWindow *mw) /* Window commands are logged from */
{ {
if (txLogFile != NULL) if (txLogFile != NULL)
{ {
@ -703,7 +705,7 @@ TxLogStart(fileName, mw)
*/ */
void void
TxLogStop() TxLogStop(void)
{ {
if (txLogFile != NULL) if (txLogFile != NULL)
{ {
@ -729,7 +731,7 @@ TxLogStop()
*/ */
void void
TxLogUpdate() TxLogUpdate(void)
{ {
if (txLogFile == NULL) if (txLogFile == NULL)
{ {
@ -763,7 +765,7 @@ TxLogUpdate()
*/ */
void void
TxLogSuspend() TxLogSuspend(void)
{ {
if (txLogFile == NULL) if (txLogFile == NULL)
return; return;
@ -786,7 +788,7 @@ TxLogSuspend()
*/ */
void void
TxLogResume() TxLogResume(void)
{ {
if (txLogFile == NULL) if (txLogFile == NULL)
return; return;
@ -809,8 +811,8 @@ TxLogResume()
*/ */
void void
txLogCommand(cmd) txLogCommand(
TxCommand *cmd; TxCommand *cmd)
{ {
static char *txButTable[] = static char *txButTable[] =
{ {
@ -923,11 +925,11 @@ txLogCommand(cmd)
*/ */
bool bool
TxGetInputEvent(block, returnOnSigWinch) TxGetInputEvent(
bool block; /* If TRUE, we will wait for an event. Otherwise, we bool block, /* If TRUE, we will wait for an event. Otherwise, we
* just poll. * just poll.
*/ */
bool returnOnSigWinch; bool returnOnSigWinch)
/* If we get a Sig-Winch signal, should we abondon /* If we get a Sig-Winch signal, should we abondon
* our quest to read an input event and return * our quest to read an input event and return
* immediately instead? * immediately instead?
@ -1011,10 +1013,10 @@ TxGetInputEvent(block, returnOnSigWinch)
*/ */
void void
TxParseString(str, q, event) TxParseString(
char *str; /* The string to be parsed. */ char *str, /* The string to be parsed. */
DQueue *q; /* Add to the tail of this queue. */ DQueue *q, /* Add to the tail of this queue. */
TxInputEvent *event; /* An event to supply the point, window ID, TxInputEvent *event) /* An event to supply the point, window ID,
* etc. . If NULL, we will use the last * etc. . If NULL, we will use the last
* event processed. * event processed.
*/ */
@ -1068,12 +1070,12 @@ TxParseString(str, q, event)
*/ */
void void
txGetInteractiveCommand(block, queue) txGetInteractiveCommand(
bool block; /* If TRUE, then wait until we have a command. bool block, /* If TRUE, then wait until we have a command.
* If FALSE, then get one only if input is * If FALSE, then get one only if input is
* available. * available.
*/ */
DQueue *queue; /* Queue to receive the new commands. */ DQueue *queue) /* Queue to receive the new commands. */
{ {
static char inputLine[TX_MAX_CMDLEN] = ""; static char inputLine[TX_MAX_CMDLEN] = "";
TxInputEvent *event; TxInputEvent *event;
@ -1233,9 +1235,9 @@ txGetInteractiveCommand(block, queue)
*/ */
void void
txGetFileCommand(f, queue) txGetFileCommand(
FILE *f; /* File to read. */ FILE *f, /* File to read. */
DQueue *queue; /* Queue to receive the new commands. */ DQueue *queue) /* Queue to receive the new commands. */
{ {
char inputLine[TX_MAX_CMDLEN]; char inputLine[TX_MAX_CMDLEN];
char *linep; char *linep;
@ -1308,7 +1310,8 @@ txGetFileCommand(f, queue)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
void void
TxRebuildCommand(TxCommand *cmd) TxRebuildCommand(
TxCommand *cmd)
{ {
char *cptr, *tptr, c; char *cptr, *tptr, c;
@ -1344,11 +1347,11 @@ TxRebuildCommand(TxCommand *cmd)
*/ */
int int
TxTclDispatch(clientData, argc, argv, quiet) TxTclDispatch(
ClientData clientData; ClientData clientData,
int argc; int argc,
char *argv[]; char *argv[],
bool quiet; bool quiet)
{ {
int result; int result;
int n, asize; int n, asize;
@ -1448,8 +1451,8 @@ TxTclDispatch(clientData, argc, argv, quiet)
*/ */
void void
TxDispatch(f) TxDispatch(
FILE *f; /* Read commands from this file instead of FILE *f) /* Read commands from this file instead of
* from the mouse or keyboard. * from the mouse or keyboard.
*/ */
{ {
@ -1641,7 +1644,7 @@ done:
*/ */
void void
txCommandsInit() txCommandsInit(void)
{ {
txZeroTime.tv_sec = 0; txZeroTime.tv_sec = 0;
txZeroTime.tv_usec = 0; txZeroTime.tv_usec = 0;

View File

@ -295,7 +295,7 @@ char *txReprint2 = NULL;
*/ */
void void
TxReprint() TxReprint(void)
{ {
(void) txFprintfBasic(stdout, "\n"); (void) txFprintfBasic(stdout, "\n");
if (txReprint1 != NULL) (void) txFprintfBasic(stdout, "%s", txReprint1); if (txReprint1 != NULL) (void) txFprintfBasic(stdout, "%s", txReprint1);
@ -322,10 +322,10 @@ TxReprint()
*/ */
int int
TxDialog(prompt, responses, deflt) TxDialog(
char *prompt; char *prompt,
char *responses[]; char *responses[],
int deflt; int deflt)
{ {
int code; int code;
int maxresp; int maxresp;
@ -368,8 +368,8 @@ TxDialog(prompt, responses, deflt)
*/ */
void void
TxSetPrompt(ch) TxSetPrompt(
char ch; char ch)
{ {
txPromptChar = ch; txPromptChar = ch;
} }
@ -392,7 +392,7 @@ TxSetPrompt(ch)
*/ */
void void
TxPrompt() TxPrompt(void)
{ {
static char lastPromptChar; static char lastPromptChar;
static char prompts[2]; static char prompts[2];
@ -428,7 +428,7 @@ TxPrompt()
*/ */
void void
TxRestorePrompt() TxRestorePrompt(void)
{ {
if (txHavePrompt) if (txHavePrompt)
{ {
@ -454,7 +454,7 @@ TxRestorePrompt()
void void
TxUnPrompt() TxUnPrompt(void)
{ {
int i, tlen; int i, tlen;
@ -495,7 +495,7 @@ TxUnPrompt()
*/ */
int int
TxGetChar() TxGetChar(void)
{ {
int ch; int ch;
extern DQueue txInputEvents, txFreeEvents; extern DQueue txInputEvents, txFreeEvents;
@ -561,7 +561,10 @@ TxPrefix(void)
*/ */
char ** char **
magic_completion_function(char *text, int start, int end) magic_completion_function(
char *text,
int start,
int end)
{ {
CPFunction *completion_func = (CPFunction *)NULL; CPFunction *completion_func = (CPFunction *)NULL;
char **matches, **tokens; char **matches, **tokens;
@ -738,7 +741,9 @@ update_cellname_hash(void)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
char * char *
istyle_completion_function(char *text, int state) istyle_completion_function(
char *text,
int state)
{ {
extern CIFReadKeep *cifReadStyleList; extern CIFReadKeep *cifReadStyleList;
static CIFReadKeep *style; static CIFReadKeep *style;
@ -772,7 +777,9 @@ istyle_completion_function(char *text, int state)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
char * char *
ostyle_completion_function(char *text, int state) ostyle_completion_function(
char *text,
int state)
{ {
extern CIFKeep *CIFStyleList; extern CIFKeep *CIFStyleList;
static CIFKeep *style; static CIFKeep *style;
@ -806,7 +813,9 @@ ostyle_completion_function(char *text, int state)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
char * char *
cellname_completion_function(char *text, int state) cellname_completion_function(
char *text,
int state)
{ {
extern HashTable dbCellDefTable; extern HashTable dbCellDefTable;
static int len; static int len;
@ -849,7 +858,9 @@ cellname_completion_function(char *text, int state)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
char * char *
macro_completion_function(char *text, int state) macro_completion_function(
char *text,
int state)
{ {
extern HashTable MacroClients; extern HashTable MacroClients;
static HashSearch hs, mc_hs; static HashSearch hs, mc_hs;
@ -896,7 +907,9 @@ macro_completion_function(char *text, int state)
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
char * char *
list_completion_function(char *text, int state) list_completion_function(
char *text,
int state)
{ {
static int list_index, len; static int list_index, len;
char *match; char *match;
@ -983,11 +996,11 @@ make_techtype_list(void)
*/ */
char * char *
TxGetLineWPrompt(dest, maxChars, prompt, prefix) TxGetLineWPrompt(
char *dest; char *dest,
int maxChars; int maxChars,
char *prompt; char *prompt,
char *prefix; char *prefix)
{ {
char *res, *hist_res, *tmp; char *res, *hist_res, *tmp;
int return_nothing = 0; int return_nothing = 0;
@ -1070,10 +1083,10 @@ TxGetLineWPrompt(dest, maxChars, prompt, prefix)
*/ */
char * char *
TxGetLinePrompt(dest, maxChars, prompt) TxGetLinePrompt(
char *dest; char *dest,
int maxChars; int maxChars,
char *prompt; char *prompt)
{ {
return TxGetLineWPrompt(dest, maxChars, prompt, NULL); return TxGetLineWPrompt(dest, maxChars, prompt, NULL);
} }
@ -1101,10 +1114,10 @@ TxGetLinePrompt(dest, maxChars, prompt)
*/ */
char * char *
TxGetLinePfix(dest, maxChars, prefix) TxGetLinePfix(
char *dest; char *dest,
int maxChars; int maxChars,
char *prefix; char *prefix)
{ {
int i; int i;
char *ret; char *ret;
@ -1186,9 +1199,9 @@ TxGetLinePfix(dest, maxChars, prefix)
*/ */
char * char *
TxGetLine(dest, maxChars) TxGetLine(
char *dest; char *dest,
int maxChars; int maxChars)
{ {
return TxGetLinePfix(dest, maxChars, NULL); return TxGetLinePfix(dest, maxChars, NULL);
} }
@ -1211,9 +1224,8 @@ TxGetLine(dest, maxChars)
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
void void
txGetTermState(buf) txGetTermState(
struct termio *buf; struct termio *buf)
{ {
ioctl( fileno( stdin ), TCGETA, buf); ioctl( fileno( stdin ), TCGETA, buf);
} }
@ -1221,8 +1233,8 @@ txGetTermState(buf)
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN) #elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
void void
txGetTermState(buf) txGetTermState(
struct termios *buf; struct termios *buf)
{ {
(void) tcgetattr(fileno(stdin), buf); (void) tcgetattr(fileno(stdin), buf);
} }
@ -1230,8 +1242,8 @@ txGetTermState(buf)
#else #else
void void
txGetTermState(buf) txGetTermState(
txTermState *buf; txTermState *buf)
{ {
ASSERT(TxStdinIsatty, "txGetTermState"); ASSERT(TxStdinIsatty, "txGetTermState");
/* save the current terminal characteristics */ /* save the current terminal characteristics */
@ -1256,14 +1268,15 @@ txGetTermState(buf)
*/ */
void void
txSetTermState(buf) txSetTermState(
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
struct termio *buf; struct termio *buf
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN) #elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
struct termios *buf; struct termios *buf
#else #else
txTermState *buf; txTermState *buf
#endif /* SYSV */ #endif /* SYSV */
)
{ {
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
ioctl( fileno(stdin), TCSETAF, buf ); ioctl( fileno(stdin), TCSETAF, buf );
@ -1295,14 +1308,15 @@ txSetTermState(buf)
*/ */
void void
txInitTermRec(buf) txInitTermRec(
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
struct termio *buf; struct termio *buf
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN) #elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
struct termios *buf; struct termios *buf
#else #else
txTermState *buf; txTermState *buf
#endif /* SYSV */ #endif /* SYSV */
)
{ {
#if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__) || defined(EMSCRIPTEN) #if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__) || defined(EMSCRIPTEN)
buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */ buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
@ -1346,7 +1360,7 @@ static bool haveCloseState = FALSE;
*/ */
void void
txSaveTerm() txSaveTerm(void)
{ {
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
ioctl( fileno( stdin ), TCGETA, &closeTermState); ioctl( fileno( stdin ), TCGETA, &closeTermState);
@ -1394,7 +1408,7 @@ txSaveTerm()
*/ */
void void
TxSetTerminal() TxSetTerminal(void)
{ {
#if defined(SYSV) || defined(CYGWIN) #if defined(SYSV) || defined(CYGWIN)
struct termio buf; struct termio buf;
@ -1438,7 +1452,8 @@ TxSetTerminal()
*/ */
void void
TxResetTerminal(bool force) TxResetTerminal(
bool force)
{ {
#ifdef MAGIC_WRAPPER #ifdef MAGIC_WRAPPER
/* If using Tk console, don't mess with the terminal settings; */ /* If using Tk console, don't mess with the terminal settings; */

View File

@ -81,7 +81,7 @@ extern char **magic_command_list;
*/ */
void void
TxInit() TxInit(void)
{ {
static char sebuf[BUFSIZ]; static char sebuf[BUFSIZ];
@ -101,7 +101,7 @@ TxInit()
#ifdef USE_READLINE #ifdef USE_READLINE
void void
TxInitReadline() TxInitReadline(void)
{ {
int i, j; int i, j;
const char * const *commandTable; const char * const *commandTable;

View File

@ -45,8 +45,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
*/ */
void void
TxMore(mesg) TxMore(
char *mesg; char *mesg)
{ {
char prompt[512]; char prompt[512];
char line[512]; char line[512];

View File

@ -205,7 +205,7 @@ TxPrintString(const char *fmt, ...)
*/ */
bool bool
TxPrintOn() TxPrintOn(void)
{ {
bool oldValue = txPrintFlag; bool oldValue = txPrintFlag;
@ -228,7 +228,7 @@ TxPrintOn()
*/ */
bool bool
TxPrintOff() TxPrintOff(void)
{ {
bool oldValue = txPrintFlag; bool oldValue = txPrintFlag;
@ -253,7 +253,7 @@ TxPrintOff()
*/ */
void void
TxFlushErr() TxFlushErr(void)
{ {
(void) fflush(stderr); (void) fflush(stderr);
} }
@ -261,7 +261,7 @@ TxFlushErr()
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void void
TxFlushOut() TxFlushOut(void)
{ {
(void) fflush(stdout); (void) fflush(stdout);
} }
@ -269,7 +269,7 @@ TxFlushOut()
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void void
TxFlush() TxFlush(void)
{ {
TxFlushOut(); TxFlushOut();
TxFlushErr(); TxFlushErr();
@ -300,13 +300,13 @@ TxFlush()
*/ */
void void
TxError(const char *fmt, ...) { TxError(const char *fmt, ...)
{
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
TxErrorV(fmt, args); TxErrorV(fmt, args);
va_end(args); va_end(args);
} }
void void
TxErrorV(const char *fmt, va_list args) TxErrorV(const char *fmt, va_list args)
{ {
@ -351,7 +351,7 @@ TxErrorV(const char *fmt, va_list args)
*/ */
void void
TxUseMore() TxUseMore(void)
{ {
int pipeEnds[2]; int pipeEnds[2];
int moreRunning = TRUE; int moreRunning = TRUE;
@ -440,7 +440,7 @@ done:
*/ */
void void
TxStopMore() TxStopMore(void)
{ {
/* TxMoreFile may be NULL if the "more" executable was not found */ /* TxMoreFile may be NULL if the "more" executable was not found */
if (TxMoreFile == NULL) return; if (TxMoreFile == NULL) return;