Cleanup window_help(). Use strlcat rather than strmcat.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@422 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-10-26 16:43:49 +00:00
parent 37f59831a2
commit 6094d62550

View File

@@ -4320,17 +4320,18 @@ static window_ops options [] = {
static Window *window_help (Window *window, char **args, char *usage) static Window *window_help (Window *window, char **args, char *usage)
{ {
int i, c = 0; int i, c = 0, done = 0;
char buffer[BIG_BUFFER_SIZE+1]; char *cmd;
char *arg = NULL; char buffer[BIG_BUFFER_SIZE];
int done = 0;
*buffer = 0; *buffer = 0;
if (!(arg = next_arg(*args, args))) cmd = next_arg(*args, args);
if (!cmd)
{ {
for (i = 0; options[i].command; i++) for (i = 0; options[i].command; i++)
{ {
strmcat(buffer, options[i].command, BIG_BUFFER_SIZE); strlcat(buffer, options[i].command, sizeof buffer);
strmcat(buffer, space, BIG_BUFFER_SIZE); strlcat(buffer, space, sizeof buffer);
if (++c == 5) if (++c == 5)
{ {
put_it("%s", convert_output_format("$G $[13]0 $[13]1 $[13]2 $[13]3 $[13]4", "%s", buffer)); put_it("%s", convert_output_format("$G $[13]0 $[13]1 $[13]2 $[13]3 $[13]4", "%s", buffer));
@@ -4346,10 +4347,10 @@ int done = 0;
{ {
for (i = 0; options[i].command; i++) for (i = 0; options[i].command; i++)
{ {
if (!my_stricmp(options[i].command, arg)) if (!my_stricmp(options[i].command, cmd))
{ {
sprintf(buffer, "WINDOW %s", arg); snprintf(buffer, sizeof buffer, "WINDOW %s", cmd);
userage(buffer, options[i].usage?options[i].usage:" - No help available"); userage(buffer, options[i].usage ? options[i].usage : " - No help available");
done++; done++;
} }
} }