1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:37:44 +00:00

Userland: Use Core::ArgsParser for 'modunload'

This commit is contained in:
Linus Groh 2020-08-05 20:57:53 +02:00 committed by Andreas Kling
parent ca799fe4ab
commit 3cc5ed642e

View file

@ -24,16 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <LibCore/ArgsParser.h>
#include <serenity.h> #include <serenity.h>
#include <string.h> #include <string.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
if (argc != 2) { const char* name = nullptr;
printf("usage: %s <module name>\n", argv[0]);
return 0; Core::ArgsParser args_parser;
} args_parser.add_positional_argument(name, "Name of the module to unload", "name");
const char* name = argv[1]; args_parser.parse(argc, argv);
int rc = module_unload(name, strlen(name)); int rc = module_unload(name, strlen(name));
if (rc < 0) { if (rc < 0) {
perror("module_unload"); perror("module_unload");