This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tsg-hasp-tools/platform/tool/hasp_verify_demo.c
2023-06-26 18:05:38 +08:00

49 lines
960 B
C

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "hasp_verify.h"
static void usage(char *cmd)
{
fprintf(stderr, "USAGE: %s [OPTIONS]\n", cmd);
fprintf(stderr, " -f -- set feature id\n");
fprintf(stderr, " -n -- set thread number\n");
fprintf(stderr, " -h -- show help\n");
}
int main(int argc, char **argv)
{
int opt;
uint64_t feature_id = 0;
uint64_t thread_number = 1;
while ((opt = getopt(argc, argv, "f:n:h")) != -1)
{
switch (opt)
{
case 'f':
feature_id = atoi(optarg);
break;
case 'n':
thread_number = atoi(optarg);
break;
case 'h': /* fall through */
default:
usage(argv[0]);
return 0;
}
}
for (int i = 0; i < thread_number; i++)
{
hasp_verify(feature_id);
}
while (1)
{
sleep(1);
}
return 0;
}