fix dev subcmd editor
This commit is contained in:
parent
1a764d6a14
commit
408de3a337
1 changed files with 8 additions and 11 deletions
|
|
@ -84,19 +84,16 @@ subcmds_dev(void *, int argc, char *argv[])
|
|||
add(cwd);
|
||||
}
|
||||
} else if (strcmp(argv[1], "edit") == 0) {
|
||||
wpath = calloc(strlen(conf_state_path()) + 4, sizeof(char));
|
||||
strcpy(wpath, conf_state_path());
|
||||
strcat(wpath, "dev");
|
||||
|
||||
editor = getenv("EDITOR");
|
||||
puts(getenv("XDG_CONFIG_DIR"));
|
||||
return;
|
||||
if (editor) {
|
||||
execvp(editor, (char *[]){ editor, wpath, NULL });
|
||||
goto free_stuff;
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
printf("Failed to open editor\n");
|
||||
free_stuff:
|
||||
wpath = calloc(strlen(conf_state_path()) + strlen(editor) + 5, sizeof(char));
|
||||
strcat(wpath, editor);
|
||||
strcat(wpath, " ");
|
||||
strcat(wpath, conf_state_path());
|
||||
strcat(wpath, "dev");
|
||||
system(wpath);
|
||||
free(wpath);
|
||||
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
|
||||
printf("Help text\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue