aboutsummaryrefslogtreecommitdiff
path: root/bin/rdsquashfs/describe.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rdsquashfs/describe.c')
-rw-r--r--bin/rdsquashfs/describe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/rdsquashfs/describe.c b/bin/rdsquashfs/describe.c
index 924bedc..8f45243 100644
--- a/bin/rdsquashfs/describe.c
+++ b/bin/rdsquashfs/describe.c
@@ -6,7 +6,7 @@
*/
#include "rdsquashfs.h"
-static int print_name(const sqfs_tree_node_t *n)
+static int print_name(const sqfs_tree_node_t *n, bool dont_escape)
{
char *start, *ptr, *name = sqfs_tree_node_get_path(n);
@@ -21,7 +21,8 @@ static int print_name(const sqfs_tree_node_t *n)
return -1;
}
- if (strchr(name, ' ') == NULL && strchr(name, '"') == NULL) {
+ if (dont_escape || (strchr(name, ' ') == NULL &&
+ strchr(name, '"') == NULL)) {
fputs(name, stdout);
} else {
fputc('"', stdout);
@@ -59,7 +60,7 @@ static int print_simple(const char *type, const sqfs_tree_node_t *n,
const char *extra)
{
printf("%s ", type);
- if (print_name(n))
+ if (print_name(n, false))
return -1;
print_perm(n);
if (extra != NULL)
@@ -91,11 +92,11 @@ int describe_tree(const sqfs_tree_node_t *root, const char *unpack_root)
return print_simple("file", root, NULL);
fputs("file ", stdout);
- if (print_name(root))
+ if (print_name(root, false))
return -1;
print_perm(root);
printf(" %s/", unpack_root);
- if (print_name(root))
+ if (print_name(root, true))
return -1;
fputc('\n', stdout);
break;