2005-01-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* lib/command.h: Document behavior of argv_concat function.
* lib/command.c: (argv_concat) Calculate total string length first so
we can call malloc just once (instead of realloc'ing to add each
string element).
(do_echo,config_logmsg) Allow for possible NULL return value from
argv_concat.
diff --git a/lib/command.h b/lib/command.h
index 8fdec98..eba919c 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -322,7 +322,11 @@
void install_element (enum node_type, struct cmd_element *);
void sort_node ();
-char *argv_concat (const char **, int, int);
+/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
+ string with a space between each element (allocated using
+ XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */
+char *argv_concat (const char **argv, int argc, int shift);
+
vector cmd_make_strvec (const char *);
void cmd_free_strvec (vector);
vector cmd_describe_command ();