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.
39 lines
711 B
39 lines
711 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.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[] = {
|
|
{ "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;
|
|
}
|
|
|