-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnickhash.c
More file actions
89 lines (61 loc) · 1.25 KB
/
Copy pathnickhash.c
File metadata and controls
89 lines (61 loc) · 1.25 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <nicklib.h>
#include <getpars.h>
#include "mcmcpars.h"
#include "globals.h"
#include "admutils.h"
#define WVERSION "100"
extern int verbose ;
int qtmode = NO ;
int dolower = NO ;
char *iname = NULL ;
void readcommands(int argc, char **argv) ;
int main(int argc, char **argv)
{
char **names ;
int n, z ;
char ss[10] ;
// printf("hello world!\n") ;
readcommands(argc, argv) ;
if (iname == NULL) {
printf("Usage: nickhash -i <yourfile> [-l]\n") ;
return -1 ;
}
n = numlines(iname) ;
ZALLOC(names, n, char *) ;
n = getlist(iname, names) ;
z = hasharr(names, n) ;
sprintf(ss, "%08X", z) ;
if (dolower) mklower(ss) ;
printf("%s", ss) ;
printnl() ;
return 0 ;
}
void readcommands(int argc, char **argv)
{
int i ;
while ((i = getopt (argc, argv, "i:lvV")) != -1) {
switch (i)
{
case 'i':
iname = strdup(optarg) ;
break;
case 'v':
printf("version: %s\n", WVERSION) ;
break ;
case 'V':
verbose = YES ;
break ;
case 'l':
dolower = YES ;
break ;
}
}
return ;
}