mirror of
https://codeberg.org/scip/diceware.git
synced 2025-12-17 10:50:57 +01:00
format
This commit is contained in:
23
dictfile.c
23
dictfile.c
@@ -35,24 +35,20 @@ int *incr_dicedigit(int *digits) {
|
||||
digits[2] = 100;
|
||||
if (digits[1] == 6000) {
|
||||
digits[1] = 1000;
|
||||
digits[0] += 10000; /* may overflow to 71111, must be catched by caller */
|
||||
}
|
||||
else
|
||||
digits[0] +=
|
||||
10000; /* may overflow to 71111, must be catched by caller */
|
||||
} else
|
||||
digits[1] += 1000;
|
||||
}
|
||||
else
|
||||
} else
|
||||
digits[2] += 100;
|
||||
}
|
||||
else
|
||||
} else
|
||||
digits[3] += 10;
|
||||
}
|
||||
else
|
||||
} else
|
||||
digits[4]++;
|
||||
|
||||
return digits;
|
||||
}
|
||||
|
||||
|
||||
int get_dicenum(int *digits) {
|
||||
/*
|
||||
get the actual number of an array of dice digits
|
||||
@@ -103,15 +99,13 @@ char **fetch_dict(char *dictfile) {
|
||||
for (i = 0; i < 6666; i++)
|
||||
words[i] = NULL;
|
||||
|
||||
|
||||
LOOP:
|
||||
while ((linelen = getline(&line, &len, DICT)) != -1) {
|
||||
if (!dontjump) {
|
||||
if (jump > 0) {
|
||||
jump--;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
jump = rand_lim(32);
|
||||
}
|
||||
}
|
||||
@@ -138,7 +132,8 @@ char **fetch_dict(char *dictfile) {
|
||||
digits = incr_dicedigit(digits);
|
||||
pos = get_dicenum(digits);
|
||||
|
||||
/* this is what pos gets next after 66666, which is max reachable with 5 dices */
|
||||
/* this is what pos gets next after 66666, which is max reachable with 5
|
||||
* dices */
|
||||
if (pos == 71111)
|
||||
break;
|
||||
} /* endif word 4<=>10 */
|
||||
|
||||
Reference in New Issue
Block a user