:retab
This commit is contained in:
parent
8537a9a127
commit
1a764d6a14
9 changed files with 332 additions and 329 deletions
25
src/conf.c
25
src/conf.c
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
@ -12,18 +13,18 @@ char
|
||||||
|
|
||||||
config_path = NULL;
|
config_path = NULL;
|
||||||
|
|
||||||
if ((path = getenv("XDG_CONFIG_HOME"))) {
|
if ((path = strdup(getenv("XDG_CONFIG_HOME")))) {
|
||||||
config_path = calloc(
|
size_t len = strlen(path) + strlen("/wom/init.lua") + 1;
|
||||||
strlen(path) + strlen("/wom/init.lua") + 1,
|
config_path = calloc(len, sizeof(char));
|
||||||
sizeof(char)
|
if (config_path) {
|
||||||
);
|
snprintf(config_path, len, "%s%s", path, "/wom/init.lua");
|
||||||
config_path = strcat(path, "/wom/init.lua");
|
}
|
||||||
} else if ((path = getenv("HOME"))) {
|
} else if ((path = strdup(getenv("HOME")))) {
|
||||||
config_path = calloc(
|
size_t len = strlen(path) + strlen("/.config/wom/init.lua") + 1;
|
||||||
strlen(path) + strlen("/.config/wom/init.lua") + 1,
|
config_path = calloc(len, sizeof(char));
|
||||||
sizeof(char)
|
if (config_path) {
|
||||||
);
|
snprintf(config_path, len, "%s%s", path, "/wom/init.lua");
|
||||||
config_path = strcat(path, "/.config/wom/init.lua");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config_path;
|
return config_path;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <cargs.h>
|
#include <cargs.h>
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "log.h"
|
||||||
#include "lua/wom.h"
|
#include "lua/wom.h"
|
||||||
#include "lua/wom_fs.h"
|
#include "lua/wom_fs.h"
|
||||||
#include "subcmds.h"
|
#include "subcmds.h"
|
||||||
|
|
|
||||||
|
|
@ -89,13 +89,14 @@ subcmds_dev(void *, int argc, char *argv[])
|
||||||
strcat(wpath, "dev");
|
strcat(wpath, "dev");
|
||||||
|
|
||||||
editor = getenv("EDITOR");
|
editor = getenv("EDITOR");
|
||||||
|
puts(getenv("XDG_CONFIG_DIR"));
|
||||||
|
return;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
execvp(editor, (char *[]){ editor, wpath, NULL });
|
execvp(editor, (char *[]){ editor, wpath, NULL });
|
||||||
goto free_stuff;
|
goto free_stuff;
|
||||||
}
|
}
|
||||||
printf("Failed to open editor\n");
|
printf("Failed to open editor\n");
|
||||||
free_stuff:
|
free_stuff:
|
||||||
free(editor);
|
|
||||||
free(wpath);
|
free(wpath);
|
||||||
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
|
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
|
||||||
printf("Help text\n");
|
printf("Help text\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue