Загрузить файлы в «src»

This commit is contained in:
8nlight 2023-10-12 16:17:40 +03:00
parent 6d6b837df3
commit a3ddb1ca51
2 changed files with 23 additions and 2 deletions

View File

@ -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) {

21
src/mv.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
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;
}