From 7e1692800b205720c2b8a97c7edaf47bc7997093 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 31 Jan 2025 17:15:29 +0000 Subject: [PATCH] textio: contify various APIs --- textio/textio.h | 6 +++--- textio/textioInt.h | 2 +- textio/txCommands.c | 4 ++-- textio/txInput.c | 14 +++++++------- textio/txMore.c | 2 +- textio/txcommands.h | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/textio/textio.h b/textio/textio.h index 20749454..c749ea7e 100644 --- a/textio/textio.h +++ b/textio/textio.h @@ -74,10 +74,10 @@ extern void TxPrintf(const char *, ...) ATTR_FORMAT_PRINTF_1; extern char *TxPrintString(const char *, ...) ATTR_FORMAT_PRINTF_1; /* input procedures */ -extern char *TxGetLinePrompt(char *dest, int maxChars, char *prompt); +extern char *TxGetLinePrompt(char *dest, int maxChars, const char *prompt); extern char *TxGetLine(char *line, int len); extern int TxGetChar(void); -extern int TxDialog(char *prompt, char *(responses[]), int defresp); +extern int TxDialog(const char *prompt, const char * const *responses, int defresp); /* prompting procedures */ extern void TxSetPrompt(char ch); @@ -96,7 +96,7 @@ extern char TxInterruptChar; /* The current interrupt character */ extern void TxDispatch(FILE *f); /* C99 compat */ -extern void TxMore(char *mesg); +extern void TxMore(const char *mesg); extern void txGetFileCommand(FILE *f, DQueue *queue); /* variables that tell if stdin and stdout are to a terminal */ diff --git a/textio/textioInt.h b/textio/textioInt.h index 7bdf0f5a..a012b49e 100644 --- a/textio/textioInt.h +++ b/textio/textioInt.h @@ -58,7 +58,7 @@ extern void txFprintfBasic(FILE *f, const char *fmt, ...) ATTR_FORMAT_PRINTF_2; /* C99 compat */ extern void txCommandsInit(void); extern int TranslateChar(int key); -extern char *TxGetLineWPrompt(char *dest, int maxChars, char *prompt, char *prefix); +extern char *TxGetLineWPrompt(char *dest, int maxChars, const char *prompt, const char *prefix); #ifdef MAGIC_WRAPPER /* tcltk/tclmagic.c has a function implementation prototype mimics vfprintf() mapping diff --git a/textio/txCommands.c b/textio/txCommands.c index 5f5afb4c..3284c3cf 100644 --- a/textio/txCommands.c +++ b/textio/txCommands.c @@ -636,7 +636,7 @@ unsigned char txLogFlags; void TxLogStart( - char *fileName, + const char *fileName, MagWindow *mw) /* Window commands are logged from */ { if (txLogFile != NULL) @@ -1014,7 +1014,7 @@ TxGetInputEvent( void TxParseString( - char *str, /* The string to be parsed. */ + const 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 diff --git a/textio/txInput.c b/textio/txInput.c index d4099664..dd3dc4d1 100644 --- a/textio/txInput.c +++ b/textio/txInput.c @@ -261,7 +261,7 @@ static const struct cmd_spec { /* Characters for input processing. Set to -1 if not defined */ -char *TxGetLinePfix(); +char *TxGetLinePfix(char *dest, int maxChars, const char *prefix); char txEraseChar = -1; /* Erase line (e.g. ^H) */ char txKillChar = -1; /* Kill line (e.g. ^U or ^X) */ @@ -323,8 +323,8 @@ TxReprint(void) int TxDialog( - char *prompt, - char *responses[], + const char *prompt, + const char * const *responses, int deflt) { int code; @@ -999,8 +999,8 @@ char * TxGetLineWPrompt( char *dest, int maxChars, - char *prompt, - char *prefix) + const char *prompt, + const char *prefix) { char *res, *hist_res, *tmp; int return_nothing = 0; @@ -1086,7 +1086,7 @@ char * TxGetLinePrompt( char *dest, int maxChars, - char *prompt) + const char *prompt) { return TxGetLineWPrompt(dest, maxChars, prompt, NULL); } @@ -1117,7 +1117,7 @@ char * TxGetLinePfix( char *dest, int maxChars, - char *prefix) + const char *prefix) { int i; char *ret; diff --git a/textio/txMore.c b/textio/txMore.c index f0651274..756ba13a 100644 --- a/textio/txMore.c +++ b/textio/txMore.c @@ -46,7 +46,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ void TxMore( - char *mesg) + const char *mesg) { char prompt[512]; char line[512]; diff --git a/textio/txcommands.h b/textio/txcommands.h index 1bcf64f5..7b9bcc29 100644 --- a/textio/txcommands.h +++ b/textio/txcommands.h @@ -131,7 +131,7 @@ extern void TxClearPoint(void); /* Routines to handle command logging. */ -extern void TxLogStart(char *fileName, MagWindow *mw); +extern void TxLogStart(const char *fileName, MagWindow *mw); extern void TxLogStop(void); extern void TxLogUpdate(void); extern void TxLogSuspend(void); @@ -155,7 +155,7 @@ extern void TxReleaseButton(int but); extern void TxPrintCommand(TxCommand *cmd); extern TxCommand *TxNewCommand(void); extern void TxFreeCommand(TxCommand *command); -extern void TxParseString(char *str, void *q, void *event); +extern void TxParseString(const char *str, void *q, void *event); extern void TxDispatch(FILE *f); extern void TxRebuildCommand(TxCommand *cmd); extern int TxCommandNumber; /* Serial number of current command. */