Move generic usernames to sysconf

This commit is contained in:
Pasi Kallinen
2016-06-13 11:01:05 +03:00
parent 3f5116fbd4
commit 942ee14d0f
6 changed files with 23 additions and 16 deletions

View File

@@ -2263,6 +2263,9 @@ int src;
free((genericptr_t) sysopt.debugfiles);
sysopt.debugfiles = dupstr(bufp);
}
} else if (src == SET_IN_SYS && match_varname(buf, "GENERICUSERS", 12)) {
if (sysopt.genericusers) free(sysopt.genericusers);
sysopt.genericusers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) {
if (sysopt.support)
free((genericptr_t) sysopt.support);

View File

@@ -1700,18 +1700,17 @@ plnamesuffix()
char *sptr, *eptr;
int i;
#ifdef GENERIC_USERNAMES
{
/* some generic user names will be ignored in favor of prompting */
const char *uptr = GENERIC_USERNAMES;
i = (int) strlen(plname);
if ((sptr = strstri(uptr, plname)) != 0
&& (sptr == uptr || sptr[-1] == ' ')
&& (sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */
/* some generic user names will be ignored in favor of prompting */
if (sysopt.genericusers) {
if (*sysopt.genericusers == '*') *plname = '\0';
else {
i = (int)strlen(plname);
if ((sptr = strstri(sysopt.genericusers, plname)) != 0
&& (sptr == sysopt.genericusers || sptr[-1] == ' ')
&& (sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */
}
}
#endif
do {
if (!*plname)

View File

@@ -35,6 +35,7 @@ sys_early_init()
sysopt.env_dbgfl = 0; /* haven't checked getenv("DEBUGFILES") yet */
sysopt.shellers = (char *) 0;
sysopt.explorers = (char *) 0;
sysopt.genericusers = (char *) 0;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
/* record file */
@@ -94,6 +95,9 @@ sysopt_release()
if (sysopt.debugfiles)
free((genericptr_t) sysopt.debugfiles),
sysopt.debugfiles = (char *) 0;
if (sysopt.genericusers)
free((genericptr_t) sysopt.genericusers),
sysopt.genericusers = (char *) 0;
#ifdef PANICTRACE
if (sysopt.gdbpath)
free((genericptr_t) sysopt.gdbpath), sysopt.gdbpath = (char *) 0;