24 lines
497 B
C++
24 lines
497 B
C++
#include <os/ArgumentParser.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
StringView user;
|
|
StringView path;
|
|
|
|
os::ArgumentParser parser;
|
|
parser.add_positional_argument(user, "user"_sv, true);
|
|
parser.add_positional_argument(path, "path"_sv, true);
|
|
parser.parse(argc, argv);
|
|
|
|
u32 id = (u32)strtoul(user.chars(), NULL, 0);
|
|
|
|
if (chown(path.chars(), id, id) < 0)
|
|
{
|
|
perror("chown");
|
|
return 1;
|
|
}
|
|
}
|