about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-06-12 10:54:55 +0300
committerNakidai <nakidai@disroot.org>2025-06-12 10:54:55 +0300
commitd21d6255510d296f0decf43a3ffbb1d935b3a957 (patch)
treef50547fbb35080566ffa8297a17ef4d7735306d0
parent3f22a12a3073bb602a6d7a645442bf0bc173240f (diff)
downloadfp-d21d6255510d296f0decf43a3ffbb1d935b3a957.tar.gz
fp-d21d6255510d296f0decf43a3ffbb1d935b3a957.zip
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.
-rw-r--r--fp.c4
1 files changed, 3 insertions, 1 deletions
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;