-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
41 lines (37 loc) · 834 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h> /* stderr, fprintf */
#include <stdlib.h> /* strtoll */
#include <string.h> /* strlen */
#include <getopt.h> /* getopt */
#include "blue.h"
static int
usage(void){
fprintf(stderr, "Usage: blue CHECKSUM FILESIZE\n");
fprintf(stderr, "Searches for file(s) by md5 checksum and size\n");
return 1;
}
int
main(int argc, char *argv[])
{
int ret = 0;
if (argc != 3 || strlen(argv[1]) != 32)
{
ret = usage();
}
else
{
char *endptr;
long long size = strtoll(argv[2], &endptr, 10);
if (size == 0 || *endptr != '\0' )
{
ret = usage();
}
else
{
SIGNATURE sign;
sign.hash = argv[1];
sign.size = size;
BlueSearch(sign, "./");
}
}
return ret;
}