cleanup libdirutils
This commit is contained in:
parent
b6c2e38bd5
commit
326750158e
5
ke/TODO
5
ke/TODO
|
@ -1,10 +1,13 @@
|
||||||
[X] goto-line
|
[X] goto-line
|
||||||
[ ] text-corruption bug
|
[X] text-corruption bug
|
||||||
[ ] alt-modifiers
|
[ ] alt-modifiers
|
||||||
[ ] refresh-screen
|
[ ] refresh-screen
|
||||||
[ ] functions -> keymapping?
|
[ ] functions -> keymapping?
|
||||||
[X] rendering: need to skip over control characters like we do with tabs
|
[X] rendering: need to skip over control characters like we do with tabs
|
||||||
[X] control-d -> delete
|
[X] control-d -> delete
|
||||||
|
[ ] control-g -> exit buf prompt
|
||||||
|
[ ] load-file prompt on dirty buffer
|
||||||
|
[ ] multiple files
|
||||||
|
|
||||||
What would it take for ke to be your daily drives?
|
What would it take for ke to be your daily drives?
|
||||||
+ C-u
|
+ C-u
|
||||||
|
|
|
@ -10,8 +10,8 @@ MANDIR ?= $MANDIR
|
||||||
|
|
||||||
CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
|
CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
|
||||||
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
||||||
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable
|
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable -g
|
||||||
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include
|
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include -O0
|
||||||
CFLAGS += OS_CFLAGS
|
CFLAGS += OS_CFLAGS
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "kst/dirlist.h"
|
#include "kst/dirlist.h"
|
||||||
|
|
||||||
|
|
||||||
static int _parent_exists(const char *);
|
int _parent_exists(const char *);
|
||||||
static int _rmdirs(const char *);
|
int _rmdirs(const char *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determines whether a directory exists.
|
* Determines whether a directory exists.
|
||||||
|
@ -144,11 +144,12 @@ _parent_exists(const char *path)
|
||||||
int
|
int
|
||||||
_rmdirs(const char *path)
|
_rmdirs(const char *path)
|
||||||
{
|
{
|
||||||
char child[FILENAME_MAX + 1];
|
char child[FILENAME_MAX + 1];
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
int fail = EXIT_FAILURE;
|
int fail = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
printf("_rmdirs(%s)\n", path);
|
||||||
if (NULL == (dirp = opendir(path))) {
|
if (NULL == (dirp = opendir(path))) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +163,6 @@ _rmdirs(const char *path)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
snprintf(child, FILENAME_MAX, "%s/%s", path, dp->d_name);
|
|
||||||
if (DT_DIR == dp->d_type) {
|
if (DT_DIR == dp->d_type) {
|
||||||
fail = _rmdirs(child);
|
fail = _rmdirs(child);
|
||||||
if (EXIT_FAILURE == fail) {
|
if (EXIT_FAILURE == fail) {
|
||||||
|
@ -178,12 +177,16 @@ _rmdirs(const char *path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (-1 == closedir(dirp))
|
|
||||||
|
if (-1 == closedir(dirp)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (EXIT_FAILURE == fail) {
|
if (EXIT_FAILURE == fail) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
else if (-1 == rmdir(path)) {
|
|
||||||
|
if (-1 == rmdir(path)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue