aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2025-10-17 03:17:03 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2025-10-17 03:17:03 +0200
commit95fb9015f44774778e2d1143b289c76dcdfb4842 (patch)
tree1f67cebf072f10b8ca46b4f27c0e34d525f2f4bd
parentd2bce07f9f68c46850721d5fbc167b574be7a8a0 (diff)
Added a self test
-rw-r--r--FICS/copyfile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/FICS/copyfile.c b/FICS/copyfile.c
index 787db11..524a036 100644
--- a/FICS/copyfile.c
+++ b/FICS/copyfile.c
@@ -12,6 +12,8 @@
#include "copyfile.h"
+#define SELF_TEST 0
+
bool
fics_copyfile(const char *p1, const char *p2)
{
@@ -75,3 +77,13 @@ is_regular_file(const char *path)
return false;
return (stat(path, &sb) == 0 && S_ISREG(sb.st_mode));
}
+
+#if SELF_TEST
+int
+main(int argc, char *argv[])
+{
+ if (argc != 3)
+ errx(1, "bogus number of args");
+ return (fics_copyfile(argv[1], argv[2]) ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+#endif