最新ルールに従う様に

このコミットが含まれているのは:
守矢諏訪子 2024-02-03 19:37:46 +09:00
コミット 0aaf5f12b2
1個のファイルの変更28行の追加28行の削除

ファイルの表示

@ -18,7 +18,10 @@ void listpass(char* basePath, int level) {
} }
while ((entry = readdir(dir)) != NULL) { while ((entry = readdir(dir)) != NULL) {
if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) { if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
continue;
}
char path[1000]; char path[1000];
int needed = snprintf(path, sizeof(path), "%s/%s", basePath, entry->d_name); int needed = snprintf(path, sizeof(path), "%s/%s", basePath, entry->d_name);
if (needed >= (int)sizeof(path) || needed < 0) { if (needed >= (int)sizeof(path) || needed < 0) {
@ -44,13 +47,10 @@ void listpass(char* basePath, int level) {
} else if (S_ISREG(statbuf.st_mode)) { } else if (S_ISREG(statbuf.st_mode)) {
char* filename = entry->d_name; char* filename = entry->d_name;
char* ext = strstr(filename, ".gpg"); char* ext = strstr(filename, ".gpg");
if (ext) { if (ext) *ext = '\0';
*ext = '\0';
}
printf("|-- %s\n", filename); printf("|-- %s\n", filename);
} }
} }
}
closedir(dir); closedir(dir);
} }