From 1fc2d9c88af77c3af81b6bd461e6b019b97d2dbb Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 20 Jul 2024 23:17:36 +0200 Subject: *: moving files --- src/cmd/mv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/cmd/mv.c (limited to 'src/cmd/mv.c') 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 +#include +#include + +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; + } +} -- cgit v1.2.3