summary refs log tree commit diff
path: root/progs/mount
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-02-15 10:51:57 +0200
committerWlodekM <[email protected]>2025-02-15 10:51:57 +0200
commit545c5f85c38de8ddb8c026bf3b76658c8d8f3d6b (patch)
treea9df68df52ff273715b595efc7cd4cb20f7859a3 /progs/mount
parent967d5cd81a190f6aa7ac44c269d60ae3a1071464 (diff)
fix some stuff; add some coreutils
Diffstat (limited to 'progs/mount')
-rw-r--r--progs/mount/mount.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/progs/mount/mount.c b/progs/mount/mount.c
new file mode 100644
index 0000000..296dd42
--- /dev/null
+++ b/progs/mount/mount.c
@@ -0,0 +1,25 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mount.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+int main(int argc, char *argv[]) {
+    if (argc != 4) {
+        fprintf(stderr, "usag: %s <source> <target> <filesystem type>\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    const char *source = argv[1];
+    const char *target = argv[2];
+    const char *fstype = argv[3];
+
+    if (mount(source, target, fstype, 0, NULL) == -1) {
+        fprintf(stderr, "mount failed: %s\n", strerror(errno));
+        return EXIT_FAILURE;
+    }
+
+    printf("Mounted %s on %s with type %s\n", source, target, fstype);
+    return EXIT_SUCCESS;
+}
\ No newline at end of file