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

View File

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

View File

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

View File

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

View File

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