diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-25 18:33:42 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-25 18:33:42 +0100 |
commit | a9ff83947cf3bd70fc6fa9cca62c088c17e26a11 (patch) | |
tree | cfac260e21d0a31bdb93a09d4978fc13f1009073 /FICS/utils.c | |
parent | 3eecc290f013e7e1aecbf31dfe236436c072e4d0 (diff) |
Improved pprintf_prompt()
Diffstat (limited to 'FICS/utils.c')
-rw-r--r-- | FICS/utils.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/FICS/utils.c b/FICS/utils.c index 6cf0285..e8f4168 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -299,23 +299,20 @@ PUBLIC int psprintf_highlight(int p, char *s, char *format,...) return retval; } -PUBLIC int pprintf_prompt(int p, char *format,...) +PUBLIC int +pprintf_prompt(int p, char *format,...) { - char tmp[10 * MAX_LINE_SIZE]; /* Make sure you can handle 10 lines worth of - stuff */ - int retval; - va_list ap; + char tmp[10 * MAX_LINE_SIZE]; + int retval; + va_list ap; - va_start(ap, format); + va_start(ap, format); + retval = vsnprintf(tmp, sizeof tmp, format, ap); + va_end(ap); - retval = vsprintf(tmp, format, ap); - if (strlen(tmp) > 10 * MAX_LINE_SIZE) { - fprintf(stderr, "FICS: pprintf_prompt buffer overflow\n"); - } - net_send_string(parray[p].socket, tmp, 1); - net_send_string(parray[p].socket, parray[p].prompt, 1); - va_end(ap); - return retval; + net_send_string(parray[p].socket, tmp, 1); + net_send_string(parray[p].socket, parray[p].prompt, 1); + return retval; } PUBLIC int |