aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-02-26 13:07:57 +0000
committerJoursoir <chat@joursoir.net>2021-02-26 13:07:57 +0000
commite6f8a3570b63724091c4cec78db609ad65963d65 (patch)
tree608b8a7e3cf61a226ec67db3911397319812b805 /src/main.c
parent9824208d05a2ba476cbb3f583fa2df3080a00967 (diff)
downloadlock-password-e6f8a3570b63724091c4cec78db609ad65963d65.tar.gz
lock-password-e6f8a3570b63724091c4cec78db609ad65963d65.tar.bz2
lock-password-e6f8a3570b63724091c4cec78db609ad65963d65.zip
create own function: tree
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 2 insertions, 12 deletions
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
{