diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-18 21:38:04 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-18 21:38:04 +0100 |
| commit | 1cf15bbbdc2f20eab0a14259dab1c6aab678249f (patch) | |
| tree | c456427854dd2ec193c928d9189aeca9429f5021 /FICS | |
| parent | c7fc654916c3fb6c04aac80d572c37ae6e1a8ca3 (diff) | |
Made pprintf_highlight() void
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/utils.c | 17 | ||||
| -rw-r--r-- | FICS/utils.h | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/FICS/utils.c b/FICS/utils.c index cbfce51..ac13e7c 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -391,12 +391,12 @@ pprintf_dohightlight(int p) pprintf(p, "\033[2m"); } -PUBLIC int +PUBLIC void pprintf_highlight(int p, char *format, ...) { - char tmp[10 * MAX_LINE_SIZE]; - int retval; - va_list ap; + char tmp[10 * MAX_LINE_SIZE] = { '\0' }; + int retval; + va_list ap; pprintf_dohightlight(p); @@ -404,11 +404,16 @@ pprintf_highlight(int p, char *format, ...) retval = vsnprintf(tmp, sizeof tmp, format, ap); va_end(ap); - net_send_string(parray[p].socket, tmp, 1); + if (is_too_long(retval, sizeof tmp)) { + warnx("%s: error: vsnprintf() truncated", __func__); + return; + } + + if (net_send_string(parray[p].socket, tmp, 1) == -1) + warnx("%s: send error", __func__); if (parray[p].highlight) pprintf(p, "\033[0m"); - return retval; } PRIVATE void diff --git a/FICS/utils.h b/FICS/utils.h index 95335ad..b0b9dad 100644 --- a/FICS/utils.h +++ b/FICS/utils.h @@ -94,7 +94,7 @@ extern int mail_string_to_user(int, char *, char *); extern int pcommand(int, char *, ...) PRINTFLIKE(2); extern int pmore_file(int); extern void pprintf(int, const char *, ...) PRINTFLIKE(2); -extern int pprintf_highlight(int, char *, ...) PRINTFLIKE(2); +extern void pprintf_highlight(int, char *, ...) PRINTFLIKE(2); extern void pprintf_noformat(int, char *, ...) PRINTFLIKE(2); extern void pprintf_prompt(int, char *, ...) PRINTFLIKE(2); extern int printablestring(char *); |
