From eed1ed13614ac7678d860eca96a246fe4515ee69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Sat, 25 May 2024 17:40:41 +0900 Subject: [PATCH] =?utf8?q?=E3=82=84=E3=81=AF=E3=82=8A=E6=88=90=E5=8A=9F?= =?utf8?q?=E3=81=A0=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/delpass.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/src/delpass.c b/src/delpass.c index 2fe2285..61a1eaf 100644 --- a/src/delpass.c +++ b/src/delpass.c @@ -57,35 +57,6 @@ void freetokens(char **tokens, int numtokens) { free(tokens); } -bool dirisempty(char *path) { - struct dirent *entry; - int res = false; - - DIR *dir = opendir(path); - if (dir == NULL) { - perror("opendir"); - return false; - } - - while ((entry = readdir(dir))) { - if ( - entry->d_name[0] == '.' && - entry->d_name[1] == '\0' && - entry->d_name[1] == '.' && - entry->d_name[2] == '\0' - ) { - continue; - } - - res++; - break; - } - - closedir(dir); - - return res != 0; -} - int delpass(char *file, int force) { char *lang = getlang(); @@ -187,14 +158,8 @@ int delpass(char *file, int force) { break; } - // ディレクトリが空じゃない場合、やめろ - if (!dirisempty(passpath)) { - break; - } - + // ディレクトリが空じゃない場合、削除を止める if (rmdir(passpath) == -1) { - if (strncmp(lang, "en", 2) == 0) perror("Failed to deleding directory"); - else perror("ディレクトリを削除に失敗"); break; } -- 2.43.0