Define for generic usernames which prompt for name
Instead of hard-coding the "play", "player", etc. usernames which will prompt the user for their name, allow defining the names in config.h
This commit is contained in:
@@ -316,6 +316,11 @@
|
|||||||
#endif /* CHDIR */
|
#endif /* CHDIR */
|
||||||
|
|
||||||
|
|
||||||
|
/* If GENERIC_USERNAMES is defined, and the user name is found
|
||||||
|
* in that list, prompt for username instead.
|
||||||
|
* A public server should probably disable this. */
|
||||||
|
#define GENERIC_USERNAMES "play player game games nethack nethacker"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Section 3: Definitions that may vary with system type.
|
* Section 3: Definitions that may vary with system type.
|
||||||
|
|||||||
+6
-3
@@ -1332,12 +1332,15 @@ plnamesuffix()
|
|||||||
char *sptr, *eptr;
|
char *sptr, *eptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef GENERIC_USERNAMES
|
||||||
/* some generic user names will be ignored in favor of prompting */
|
/* some generic user names will be ignored in favor of prompting */
|
||||||
i = (int)strlen(plname);
|
i = (int)strlen(plname);
|
||||||
if ((i >= 4 && !strncmpi(plname, "player", i)) || /* play[er] */
|
eptr = GENERIC_USERNAMES;
|
||||||
(i >= 4 && !strncmpi(plname, "games", i)) || /* game[s] */
|
sptr = strstri(eptr, plname);
|
||||||
(i >= 7 && !strncmpi(plname, "nethacker", i))) /* nethack[er] */
|
if (sptr && ((sptr == eptr && (sptr[i] == ' ' || sptr[i] == '\0'))
|
||||||
|
|| sptr[i] == ' ' || sptr[i] == '\0'))
|
||||||
*plname = '\0'; /* call askname() */
|
*plname = '\0'; /* call askname() */
|
||||||
|
#endif
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!*plname) askname(); /* fill plname[] if necessary */
|
if (!*plname) askname(); /* fill plname[] if necessary */
|
||||||
|
|||||||
Reference in New Issue
Block a user