summaryrefslogtreecommitdiff
path: root/Userland/Utilities/modunload.cpp
blob: 2d7d03975945406970b8130d0bc67ef887a0bd07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibCore/ArgsParser.h>
#include <serenity.h>
#include <string.h>

int main(int argc, char** argv)
{
    const char* name = nullptr;

    Core::ArgsParser args_parser;
    args_parser.add_positional_argument(name, "Name of the module to unload", "name");
    args_parser.parse(argc, argv);

    int rc = module_unload(name, strlen(name));
    if (rc < 0) {
        perror("module_unload");
        return 1;
    }
    return 0;
}