/** * A "keypress" handling function for askfor_aux, that handles the special * case of '*' for a new random "name" and passes any other "keypress" * through to the default "editing" handler. */ static bool get_name_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, struct keypress keypress, bool firsttime) { bool result; switch (keypress.code) { case '*': { *len = randname_make(RANDNAME_TOLKIEN, 4, 8, buf, buflen, name_sections); my_strcap(buf); *curs = 0; result = false; break; } default: { result = askfor_aux_keypress(buf, buflen, curs, len, keypress, firsttime); break; } } return result; }
int main(int argc, char *argv[]) { int i; char name[256]; Rand_value = time(NULL); for (i = 0; i < 20; i++) { randname_make(RANDNAME_TOLKIEN, 5, 9, name, 256, name_sections); my_strcap(name); printf("%s\n", name); } return 0; }
int main(int argc, char *argv[]) { int i; char name[256]; Rand_value = time(NULL); for (i = 0; i < 20; i++) { randname_make(RANDNAME_TOLKIEN, 5, 9, name, 256, name_sections); name[0] = toupper((unsigned char) name[0]); printf("%s\n", name); } return 0; }