From e6f8a3570b63724091c4cec78db609ad65963d65 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Fri, 26 Feb 2021 13:07:57 +0000 Subject: create own function: tree --- src/main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 6f27dbc..4ac64a2 100644 --- a/src/main.c +++ b/src/main.c @@ -20,6 +20,7 @@ #include "handerror.h" #include "implementation.h" #include "exec-cmd.h" +#include "tree.h" enum constants { maxlen_texteditor = 16, @@ -35,7 +36,6 @@ enum constants { #define LOCKPASS_DIR ".lock-password/" #define GPGKEY_FILE ".gpg-key" -#define TREE_OUTPUT_FILE ".tree" #define TEXTEDITOR_FILE ".text-editor" #define usageprint(...) \ @@ -500,19 +500,9 @@ int cmd_showtree(int argc, char *argv[]) if(flag_copy) errprint("You must type a passname, not a directory\n"); - char *arg1[] = {"tree", "-C", "--noreport", path, "-o", TREE_OUTPUT_FILE, NULL}; - easyFork("tree", arg1); - - char *arg2[] = {"sed", "-i", "-E", "s/\\.gpg(\\x1B\\[[0-9]+m)?( ->|$)/\\1\\2/g", TREE_OUTPUT_FILE, NULL}; - easyFork("sed", arg2); // remove .gpg at the pass name - if(strcmp(path, ".") == 0) printf("Password Manager\n"); else printf("Password Manager/%s\n", path); - - char *arg3[] = {"tail", "-n", "+2", TREE_OUTPUT_FILE, NULL}; - easyFork("tail", arg3); // remove working directory from output - - remove(TREE_OUTPUT_FILE); + tree(path, ""); } else { -- cgit v1.2.3-18-g5258