linuxinstall/src/sandbox.c

36 lines
623 B
C
Raw Normal View History

#include "sandbox.h"
#include "utils.h"
2024-02-16 17:13:52 +01:00
#include "command.h"
2024-02-15 19:42:22 +01:00
#include <stdarg.h>
#include <stdio.h>
2024-02-15 19:42:22 +01:00
#include <stdlib.h>
2024-02-16 17:13:52 +01:00
#include <string.h>
int main(int argc, char* argv[]) {
2024-02-16 17:13:52 +01:00
if (argc < 2) {
show_help();
return 0;
}
2024-02-16 16:53:02 +01:00
2024-02-16 17:13:52 +01:00
Command* command = find_command(argv[1]);
if (command == NULL) {
log_message(LOG_ERROR, "Unknown command '%s'.", argv[1]);
return 1;
}
2024-02-16 16:53:02 +01:00
2024-02-16 17:13:52 +01:00
switch (command->id) {
case CMD_HELP:
return cmd_help(argc - 2, argv + 2);
case CMD_VERSION:
return cmd_version(argc - 2, argv + 2);
2024-02-16 17:19:56 +01:00
2024-02-16 17:13:52 +01:00
default:
log_message(LOG_ERROR, "Command '%s' is not implemented.", command->name);
break;
}
2024-02-16 16:53:02 +01:00
2024-02-16 17:13:52 +01:00
return 0;
2024-02-16 16:53:02 +01:00
}