diff srogue/rip.c @ 119:458df24e973d

srogue: use functions from mdport.c. Shell escape, passwd entries, terminal settings, and most signal handling is now done with the more portable md_* functions.
author John "Elwin" Edwards
date Wed, 30 Apr 2014 14:46:30 -0700
parents ee250e3646fd
children 78fa1d0e5d25
line wrap: on
line diff
--- a/srogue/rip.c	Sun Apr 27 08:29:14 2014 -0700
+++ b/srogue/rip.c	Wed Apr 30 14:46:30 2014 -0700
@@ -14,11 +14,9 @@
  * See the file LICENSE.TXT for full copyright and licensing information.
  */
 
-#include <signal.h>
 #include <ctype.h>
 #include <string.h>
 #include <sys/types.h>
-#include <pwd.h>
 #include <fcntl.h>
 #include "rogue.h"
 #include "rogue.ext"
@@ -127,8 +125,7 @@
 	reg FILE *outf;
 	char *packend;
 
-	signal(SIGINT, byebye);
-	signal(SIGQUIT, byebye);
+	md_onsignal_exit();
 	if (aflag != WINNER) {
 		if (aflag == CHICKEN)
 			packend = "when you chickened out";
@@ -213,8 +210,7 @@
             encwrite((char *) scoreline, 100, outf);
         }
 	fclose(outf);
-	signal(SIGINT, byebye);
-	signal(SIGQUIT, byebye);
+	md_onsignal_exit();
 	clear();
 	refresh();
 	endwin();
@@ -300,12 +296,7 @@
 			}
 			printf(" [Exp: %d/%ld]",scp->sc_explvl,scp->sc_exppts);
 			if (showname) {
-				struct passwd *pp, *getpwuid();
-
-				if ((pp = getpwuid(scp->sc_uid)) == NULL)
-					printf(" (%d)\n", scp->sc_uid);
-				else
-					printf(" (%s)\n", pp->pw_name);
+				printf(" (%s)\n", md_getrealname(scp->sc_uid));
 			}
 			else
 				printf("\n");