aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-06-12 19:50:33 +0000
committerJoursoir <chat@joursoir.net>2021-06-12 19:50:33 +0000
commita05ceb98259b949dcc248c744c809df3a7d06233 (patch)
tree0a2a61fd5a37a4ea78a3a133503aa84405188503 /src
parent2ee1a06f24895ea9067d9b026057581ff715aec8 (diff)
downloadlock-password-a05ceb98259b949dcc248c744c809df3a7d06233.tar.gz
lock-password-a05ceb98259b949dcc248c744c809df3a7d06233.tar.bz2
lock-password-a05ceb98259b949dcc248c744c809df3a7d06233.zip
lpass: call the function of command without argv[0]
Diffstat (limited to 'src')
-rw-r--r--src/exec-cmd.c11
-rw-r--r--src/lpass.c4
2 files changed, 4 insertions, 11 deletions
diff --git a/src/exec-cmd.c b/src/exec-cmd.c
index 0751d29..6955a20 100644
--- a/src/exec-cmd.c
+++ b/src/exec-cmd.c
@@ -77,9 +77,6 @@ int cmd_insert(int argc, char *argv[])
}
}
- if(optind < argc) optind++; // for skip "insert"
- dbgprint("passname: %s\n", argv[optind]);
-
char *path = argv[optind];
if(path == NULL)
usageprint("%s", description);
@@ -158,7 +155,7 @@ int cmd_edit(int argc, char *argv[])
/* We expect tmpfs to be mounted at /dev/shm */
char path_tmpfile[] = "/dev/shm/lpass.XXXXXX";
char *editor, *password;
- char *path = argv[2];
+ char *path = argv[1];
if(!path)
usageprint("%s", description);
@@ -262,9 +259,6 @@ int cmd_generate(int argc, char *argv[])
}
}
- if(optind < argc) optind++; // for skip "generate"
- dbgprint("passname: %s\n", argv[optind]);
-
char *path = argv[optind];
if(path == NULL)
usageprint("%s", description);
@@ -308,7 +302,7 @@ int cmd_remove(int argc, char *argv[])
{
const char description[] = "rm passname\n";
int result;
- char *path = argv[2];
+ char *path = argv[1];
if(!path)
usageprint("%s", description);
@@ -350,7 +344,6 @@ int cmd_move(int argc, char *argv[])
}
}
- if(optind < argc) optind++; // for skip "move"
if(!argv[optind] || !argv[optind+1])
usageprint("%s", description);
diff --git a/src/lpass.c b/src/lpass.c
index d1ee817..a466d5d 100644
--- a/src/lpass.c
+++ b/src/lpass.c
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
struct cmd_struct *ptr = get_cmd(argv[1]);
if(ptr)
- return ptr->func(argc, argv);
+ return ptr->func(--argc, ++argv);
- return cmd_showtree(argc, argv);
+ return cmd_showtree(--argc, ++argv);
} \ No newline at end of file