Avoid unixisms. On MacOSX, we cannot assume that the user will use
a command-line option to set their name. Normally they will type a name if asked - but they won't be asked if we pull their username as a name.
This commit is contained in:
@@ -478,6 +478,10 @@ whoami() {
|
|||||||
*/
|
*/
|
||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
/* Unixisms just confuse the user */
|
||||||
|
(void) strncpy(plname, "player", sizeof(plname)-1);
|
||||||
|
#else
|
||||||
if (*plname) return FALSE;
|
if (*plname) return FALSE;
|
||||||
if(/* !*plname && */ (s = nh_getenv("USER")))
|
if(/* !*plname && */ (s = nh_getenv("USER")))
|
||||||
(void) strncpy(plname, s, sizeof(plname)-1);
|
(void) strncpy(plname, s, sizeof(plname)-1);
|
||||||
@@ -485,6 +489,7 @@ whoami() {
|
|||||||
(void) strncpy(plname, s, sizeof(plname)-1);
|
(void) strncpy(plname, s, sizeof(plname)-1);
|
||||||
if(!*plname && (s = getlogin()))
|
if(!*plname && (s = getlogin()))
|
||||||
(void) strncpy(plname, s, sizeof(plname)-1);
|
(void) strncpy(plname, s, sizeof(plname)-1);
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user