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.
This commit is contained in:
John "Elwin" Edwards 2014-04-30 14:46:30 -07:00
parent de1e0f2759
commit 791df4324f
10 changed files with 34 additions and 115 deletions

View file

@ -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 @@ int amount, aflag;
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 @@ int amount, aflag;
encwrite((char *) scoreline, 100, outf);
}
fclose(outf);
signal(SIGINT, byebye);
signal(SIGQUIT, byebye);
md_onsignal_exit();
clear();
refresh();
endwin();
@ -300,12 +296,7 @@ int showname;
}
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");