]> skyeroc.xyz Git - dgamelaunch/commitdiff
Use setproctitle(3), if available, to hide autologin password and show logged
authorJilles Tjoelker <jilles@stack.nl>
Mon, 28 Jun 2004 19:41:06 +0000 (19:41 +0000)
committerJilles Tjoelker <jilles@stack.nl>
Mon, 28 Jun 2004 19:41:06 +0000 (19:41 +0000)
in user and whether they are playing.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@325 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

configure.ac
dgamelaunch.c

index ea1b74eb71161581973f1bfb2ebebd2bb02d05e7..cec25a78a8c104d28b91ccca7f984ff593bba48b 100644 (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
index 036d71cd604d6c69ee5d3ced835d02cf04f89646..0a4da9ef006e1995a2a9e9cfca534f82d4c2d6f3 100644 (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);