diff options
Diffstat (limited to 'split.c')
-rw-r--r-- | split.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -39,13 +39,14 @@ static char *nextsuffix(size_t n, char s[]) return s; } - for (size_t i = n - 1; ; i--) { - s[i] = *(strchr(alphabet, s[i]) + 1); - if (s[i] == '\0') { - if (i == 0) { + n--; + for (;;) { + s[n] = *(strchr(alphabet, s[n]) + 1); + if (s[n] == '\0') { + if (n == 0) { return NULL; } - s[i] = alphabet[0]; + s[n--] = alphabet[0]; } else { break; } |