Thu, 09 Jul 2015 17:22:55 +0200
-a option wasn't working correctly in recursive mode
dav/main.c | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Thu Jul 09 17:15:35 2015 +0200 +++ b/dav/main.c Thu Jul 09 17:22:55 2015 +0200 @@ -401,9 +401,7 @@ DavResource *child = ls->children; while(child) { - if(child->name[0] != '.' || show_all) { - print_func(child, a); - } + print_func(child, a); child = child->next; } @@ -509,6 +507,10 @@ void ls_print_list_elm(DavResource *res, CmdArgs *a) { int recursive = cmd_getoption(a, "recursive") ? 1 : 0; + int show_all = cmd_getoption(a, "all") ? 1 : 0; + if(res->name[0] == '.' && !show_all) { + return; + } char flags[16]; memset(flags, '-', 15); @@ -552,7 +554,10 @@ if(recursive) { DavResource *child = res->children; while(child) { - ls_print_list_elm(child, a); + //ls_print_list_elm(child, a); + if(child->name[0] != '.' || show_all) { + ls_print_list_elm(child, a); + } child = child->next; } } @@ -560,6 +565,11 @@ void ls_print_elm(DavResource *res, CmdArgs *a) { int recursive = cmd_getoption(a, "recursive") ? 1 : 0; + int show_all = cmd_getoption(a, "all") ? 1 : 0; + if(res->name[0] == '.' && !show_all) { + return; + } + char *name = recursive ? res->path+1 : res->name; printf("%s\n", name); if(recursive) {