2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2020-08-05 20:30:18 +02:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2019-01-28 04:16:01 +01:00
|
|
|
#include <errno.h>
|
2019-06-07 11:49:31 +02:00
|
|
|
#include <stdio.h>
|
2019-01-28 04:16:01 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2020-02-18 10:45:23 +01:00
|
|
|
if (pledge("stdio cpath", nullptr) < 0) {
|
|
|
|
perror("pledge");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-08-05 20:30:18 +02:00
|
|
|
const char* path;
|
|
|
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
args_parser.add_positional_argument(path, "Directory to remove", "path");
|
|
|
|
args_parser.parse(argc, argv);
|
|
|
|
|
|
|
|
int rc = rmdir(path);
|
2019-01-28 04:16:01 +01:00
|
|
|
if (rc < 0) {
|
|
|
|
perror("rmdir");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|