Use setproctitle(3), if available, to hide autologin password and show logged

in user and whether they are playing.


git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@325 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Jilles Tjoelker 2004-06-28 19:41:06 +00:00
parent 20b453bfde
commit dc7b46bbfe
2 changed files with 17 additions and 1 deletions

View File

@ -77,6 +77,6 @@ AC_ARG_WITH(config-file,
AC_DEFINE_UNQUOTED(DEFCONFIG, "$configfile", [Path to the default config file.])
AC_CHECK_FUNCS([openpty setenv])
AC_CHECK_FUNCS([openpty setenv setproctitle])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

View File

@ -792,6 +792,9 @@ autologin (char* user, char *pass)
{
loggedin = 1;
snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
#ifdef HAVE_SETPROCTITLE
setproctitle ("%s", me->username);
#endif
}
}
}
@ -854,6 +857,9 @@ loginprompt (int from_ttyplay)
{
loggedin = 1;
snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
#ifdef HAVE_SETPROCTITLE
setproctitle ("%s", me->username);
#endif
}
else
{
@ -1002,6 +1008,9 @@ newuser ()
loggedin = 1;
snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
#ifdef HAVE_SETPROCTITLE
setproctitle ("%s", me->username);
#endif
if (access (rcfilename, R_OK) == -1)
write_canned_rcfile (rcfilename);
@ -1701,6 +1710,9 @@ main (int argc, char** argv)
size_t len = strlen(argv[optind]);
memset(argv[optind++], 0, len);
}
#ifdef HAVE_SETPROCTITLE
setproctitle ("(not logged in)");
#endif
create_config();
@ -1803,6 +1815,10 @@ main (int argc, char** argv)
while (!purge_stale_locks())
menuloop();
#ifdef HAVE_SETPROCTITLE
setproctitle ("%s [playing]", me->username);
#endif
endwin ();
signal(SIGWINCH, SIG_DFL);