From cc3e2244796a54a394d534e19149bc53fe2b3b71 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 13 Jan 2014 22:18:32 +0100 Subject: Debugging improvements --- src/sc_parse.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/sc_parse.c') diff --git a/src/sc_parse.c b/src/sc_parse.c index 328e397..b94f548 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -135,22 +135,25 @@ void sc_block_free(SCBlock *bl) static void recursive_show_sc_blocks(const char *prefix, const SCBlock *bl) { while ( bl != NULL ) { + show_sc_block(bl, prefix); + bl = bl->next; + } +} - printf("%s", prefix); - if ( bl->name != NULL ) printf("\\%s ", bl->name); - if ( bl->options != NULL ) printf("[%s] ", bl->options); - if ( bl->contents != NULL ) printf("{%s}", bl->contents); - printf("\n"); - - if ( bl->child != NULL ) { - char new_prefix[strlen(prefix)+3]; - strcpy(new_prefix, " "); - strcat(new_prefix, prefix); - recursive_show_sc_blocks(new_prefix, bl->child); - } - bl = bl->next; +void show_sc_block(const SCBlock *bl, const char *prefix) +{ + printf("%s", prefix); + if ( bl->name != NULL ) printf("\\%s ", bl->name); + if ( bl->options != NULL ) printf("[%s] ", bl->options); + if ( bl->contents != NULL ) printf("{%s}", bl->contents); + printf("\n"); + if ( bl->child != NULL ) { + char new_prefix[strlen(prefix)+3]; + strcpy(new_prefix, " "); + strcat(new_prefix, prefix); + recursive_show_sc_blocks(new_prefix, bl->child); } } -- cgit v1.2.3