summaryrefslogtreecommitdiff
path: root/src/cmd/mv.c
diff options
context:
space:
mode:
authordzwdz2024-07-20 23:17:36 +0200
committerdzwdz2024-07-20 23:17:36 +0200
commit1fc2d9c88af77c3af81b6bd461e6b019b97d2dbb (patch)
tree56d19935958983882872495f556bdb74c8ae26b8 /src/cmd/mv.c
parente88aee660ea668cc96d8a5a11060b6e02b2f0fd7 (diff)
*: moving files
Diffstat (limited to 'src/cmd/mv.c')
-rw-r--r--src/cmd/mv.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/mv.c b/src/cmd/mv.c
new file mode 100644
index 0000000..e7bcc46
--- /dev/null
+++ b/src/cmd/mv.c
@@ -0,0 +1,17 @@
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+int
+main(int argc, const char *argv[])
+{
+ if (argc != 3) {
+ fprintf(stderr, "usage: mv from to\n");
+ return 1;
+ }
+
+ if (rename(argv[1], argv[2]) < 0) {
+ fprintf(stderr, "mv: %s\n", strerror(errno));
+ return 1;
+ }
+}