ladybird/Userland/mkdir.cpp
Andreas Kling de4604ac95 Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^)
There are various limitations because of missing functionality.
2018-11-18 15:02:16 +01:00

22 lines
379 B
C++

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: mkdir <path>\n");
return 1;
}
int rc = mkdir(argv[1], 0755);
if (rc < 0) {
perror("mkdir");
return 1;
}
return 0;
}