diff --git a/src/chroot.c b/src/chroot.c index 5fd4a02..9d25aae 100644 --- a/src/chroot.c +++ b/src/chroot.c @@ -6,8 +6,8 @@ int main(const int argc, const char **argv) { if (argc <= 2) { - fprintf(stderr, "chroot [dir] [\"command arg\"]\n"); - return 1; + printf("chroot [dir] [\"command arg\"]\n"); + return 0; } if (chroot(argv[1]) == -1) { diff --git a/src/mv.c b/src/mv.c new file mode 100644 index 0000000..c376a2e --- /dev/null +++ b/src/mv.c @@ -0,0 +1,21 @@ +#include +#include +#include +#include +#include + +int main(const int argc, char **argv) { + if (argc <= 2) { + printf("mv: missing operand\n"); + return 1; + } + + for (int i = 1; i < argc; i++) { + if (rename(argv[i], argv[argc]) < 0) { + fprintf(stderr, "mv: %s\n", strerror(errno)); + return 1; + } + } + + return 0; +}