diff options
author | ajs <ajs> | 2005-01-28 20:28:35 +0000 |
---|---|---|
committer | ajs <ajs> | 2005-01-28 20:28:35 +0000 |
commit | 818cc87c6eeca942be55ed4082e3d7e53cdf8477 (patch) | |
tree | 0ff079842f82921d2786f3bc316cbac2dcd5e856 /lib/command.h | |
parent | 05e4bf5fd8f9c112699c3b98e89cf717f6890547 (diff) | |
download | quagga-818cc87c6eeca942be55ed4082e3d7e53cdf8477.tar.bz2 quagga-818cc87c6eeca942be55ed4082e3d7e53cdf8477.tar.xz |
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.
Diffstat (limited to 'lib/command.h')
-rw-r--r-- | lib/command.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/command.h b/lib/command.h index 8fdec98f..eba919cb 100644 --- a/lib/command.h +++ b/lib/command.h @@ -322,7 +322,11 @@ void install_default (enum node_type); 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 (); |