summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-13 15:34:08 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-13 15:34:08 -0800
commita79dc66234f32de6fdf1d16b69129f5722f824e9 (patch)
tree1fca3aa270ab4fece064ff9e636e11eff510c641 /src
parent167914b351409d752e6405735212f859b4b42c25 (diff)
downloadvyatta-cfg-a79dc66234f32de6fdf1d16b69129f5722f824e9.tar.gz
vyatta-cfg-a79dc66234f32de6fdf1d16b69129f5722f824e9.zip
Simplify the debug code
dump_log doesn't need allocate whole buffer, just print in steps.
Diffstat (limited to 'src')
-rw-r--r--src/cli_new.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index ae48903..dc6b760 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -2138,24 +2138,13 @@ const char *type_to_name(vtw_type_e type) {
void dump_log(int argc, char **argv)
{
int i;
- int len;
- char *cp;
- len = 0;
- for (i=0; i<argc;++i)
- len += strlen(argv[i]);
- len += argc;
- cp = my_malloc(len, "dump_log");
- len = 0;
- for (i=0; i<argc;++i){
- strcpy(cp+len, argv[i]);
- len += strlen(argv[i]);
- cp[len]= ' ';
- ++len;
+ printf("Command:");
+ for (i = 0; i < argc; ++i) {
+ putchar(' ');
+ puts(argv[i]);
}
- cp[len-1]=0;
- printf("Command: %s\n",cp);
- my_free(cp);
+ putchar('\n');
}
#endif