You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
tbm-utils/source/main.c

42 lines
793 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <info.h>
#include <pack.h>
#include <sign.h>
#include <unpack.h>
#include <verify.h>
struct entry_point {
const char *cmd;
int (* main)(int argc, char *argv[]);
};
struct entry_point entries[] = {
{ "get-offset", do_get_offset },
{ "get-size", do_get_size },
{ "pack", do_pack },
{ "sign", do_sign },
{ "unpack", do_unpack },
{ "verify", do_verify },
{ NULL, NULL },
};
int main(int argc, char *argv[])
{
struct entry_point *entry;
if (argc < 2) {
fprintf(stderr, "usage: %s <command>\n", argv[0]);
return -1;
}
for (entry = entries; entry->cmd; ++entry) {
if (strcmp(entry->cmd, argv[1]) == 0)
return entry->main(argc, argv);
}
fprintf(stderr, "usage: %s <command>\n", argv[0]);
return -1;
}