-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
46 lines (36 loc) · 706 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
42
43
44
45
46
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#define ACG_RAND_NO_ALG
#include "acg/sys.h"
#include "acg/types.h"
#include "acg/istr.h"
#include "acg/ds.h"
#include "acg/rand.h"
#include "acg/rule10.h"
#include "namegen.h"
VBUF(names, istr, 64);
static int exists(const istr name)
{
VBUF_FOREACH(names, istr) {
if (*istr == name)
return 1;
}
return 0;
}
int main(int argc, char **argv)
{
init_interns();
srand(time(0));
const u32 n = MAX(1, MIN(64, argc > 1 ? atoi(argv[1]) : 8));
for (u32 i = 0; i < n; ++i) {
istr name = NULL;
do {
name = gen_name();
} while (exists(name));
printf("\t%s\n", name);
*VBUF_PUSH(names) = name;
}
exit(0);
}