aboutsummaryrefslogtreecommitdiff
path: root/i3-config-wizard
diff options
context:
space:
mode:
authorDeiz <silverwraithii@gmail.com>2015-03-28 14:30:35 -0400
committerDeiz <silverwraithii@gmail.com>2015-03-29 14:45:42 -0400
commit4daed31c3e0bfb314f83050fe77a310eec11eb5a (patch)
tree721dd73260994e8784eba63c1dde17ecc8cc7a83 /i3-config-wizard
parentd5f329694d8cea70a7005729f4eea08ff9ad33a7 (diff)
downloadi3-4daed31c3e0bfb314f83050fe77a310eec11eb5a.tar.gz
i3-4daed31c3e0bfb314f83050fe77a310eec11eb5a.zip
Move resolve_tilde and get_config_path into libi3
Diffstat (limited to 'i3-config-wizard')
-rw-r--r--i3-config-wizard/main.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c
index 35770dc9..673259b9 100644
--- a/i3-config-wizard/main.c
+++ b/i3-config-wizard/main.c
@@ -462,38 +462,6 @@ void debuglog(char *fmt, ...) {
}
/*
- * This function resolves ~ in pathnames.
- * It may resolve wildcards in the first part of the path, but if no match
- * or multiple matches are found, it just returns a copy of path as given.
- *
- */
-static char *resolve_tilde(const char *path) {
- static glob_t globbuf;
- char *head, *tail, *result;
-
- tail = strchr(path, '/');
- head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
-
- int res = glob(head, GLOB_TILDE, NULL, &globbuf);
- free(head);
- /* no match, or many wildcard matches are bad */
- if (res == GLOB_NOMATCH || globbuf.gl_pathc != 1)
- result = strdup(path);
- else if (res != 0) {
- err(1, "glob() failed");
- } else {
- head = globbuf.gl_pathv[0];
- result = calloc(1, strlen(head) + (tail ? strlen(tail) : 0) + 1);
- strncpy(result, head, strlen(head));
- if (tail)
- strncat(result, tail, strlen(tail));
- }
- globfree(&globbuf);
-
- return result;
-}
-
-/*
* Handles expose events, that is, draws the window contents.
*
*/