From d21d6255510d296f0decf43a3ffbb1d935b3a957 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Thu, 12 Jun 2025 10:54:55 +0300 Subject: Fix moments in fp.c As now there can be multiple folders rather than one, error is not some invalid path but rather when there're no files loaded. --- fp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fp.c b/fp.c index b553f0a..86c0cef 100644 --- a/fp.c +++ b/fp.c @@ -109,7 +109,7 @@ void loadpath(const char *path) errno = 0; DIR *dir = opendir(path); if (!dir) - err(1, "opendir(`%s')", path); + return; for (struct dirent *d; (d = readdir(dir));) { if (find(d->d_name)) @@ -151,6 +151,8 @@ int main(int argc, char **argv) for (int i = 2; i < argc; ++i) loadpath(argv[i]); + if (!amount) + errx(1, "no files to search from"); lines = atoi(argv[1]); lines = lines < 0 ? 0 : lines; lines = lines > amount - 1 ? amount - 1 : lines; -- cgit 1.4.1