24 lines
530 B
C++
24 lines
530 B
C++
#include <os/ArgumentParser.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
StringView path;
|
|
StringView mode_string;
|
|
|
|
os::ArgumentParser parser;
|
|
parser.add_positional_argument(path, "path"_sv, true);
|
|
parser.add_positional_argument(mode_string, "mode"_sv, "755"_sv);
|
|
parser.parse(argc, argv);
|
|
|
|
mode_t mode = (mode_t)strtoul(mode_string.chars(), NULL, 8);
|
|
|
|
if (mkdir(path.chars(), mode) < 0)
|
|
{
|
|
perror("mkdir");
|
|
return 1;
|
|
}
|
|
}
|