summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
authorradiohotline <radiohotline@disroot.org>2026-03-14 16:20:47 +0300
committerradiohotline <radiohotline@disroot.org>2026-03-14 16:20:47 +0300
commitaad798d9df7417009fa4438aac61ac8e0e4ded36 (patch)
tree7729ac68c07e183215687d585203d89e862666e1 /src/cp.c
first commit
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cp.c b/src/cp.c
new file mode 100644
index 0000000..573677d
--- /dev/null
+++ b/src/cp.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+int main(int argc, char* argv[]) {
+ FILE *input, *output;
+ char ch;
+
+ if (argv[2] == NULL) {
+ printf("specify a destination\n");
+ return 1;
+ }
+
+ input = fopen(argv[1], "r");
+ output = fopen(argv[2], "a");
+
+ if (input == NULL || output == NULL) {
+ printf("failed to open the file dingus\n");
+ return 1;
+ } else {
+ while ((ch = fgetc(input)) != EOF) {
+ fputc(ch, output);
+ }
+ }
+
+ fclose(input);
+ fclose(output);
+
+ return 0;
+}