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
Notes: sideshowbarker 2024-07-19 04:11:49 +09:00

View file

@ -24,16 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibCore/ArgsParser.h>
#include <serenity.h>
#include <string.h>
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: %s <module name>\n", argv[0]);
return 0;
}
const char* name = argv[1];
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");