remove deep_copy function, rename initncurses to initcurses

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@169 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-01-26 08:29:04 +00:00
parent 4ca56b17c3
commit a095001e0a
4 changed files with 20 additions and 33 deletions

View File

@ -539,7 +539,7 @@ inprogressmenu ()
refresh (); refresh ();
endwin (); endwin ();
ttyplay_main (ttyrecname, 1, 0); ttyplay_main (ttyrecname, 1, 0);
initncurses (); initcurses ();
} }
} }
@ -747,6 +747,8 @@ freefile ()
/* free existing mem, clear existing entries */ /* free existing mem, clear existing entries */
for (i = 0; i < f_num; i++) for (i = 0; i < f_num; i++)
{
if (users[i] != me)
{ {
free (users[i]->password); free (users[i]->password);
free (users[i]->username); free (users[i]->username);
@ -754,6 +756,7 @@ freefile ()
free (users[i]->env); free (users[i]->env);
free (users[i]); free (users[i]);
} }
}
if (users) if (users)
free (users); free (users);
@ -765,7 +768,7 @@ freefile ()
/* ************************************************************* */ /* ************************************************************* */
void void
initncurses () initcurses ()
{ {
initscr (); initscr ();
cbreak (); cbreak ();
@ -777,20 +780,6 @@ initncurses ()
/* ************************************************************* */ /* ************************************************************* */
struct dg_user *
deep_copy (struct dg_user *src)
{
struct dg_user *dest = malloc (sizeof (struct dg_user));
dest->username = strdup (src->username);
dest->email = strdup (src->email);
dest->env = strdup (src->env);
dest->password = strdup (src->password);
dest->flags = src->flags;
return dest;
}
void void
loginprompt () loginprompt ()
{ {
@ -826,7 +815,7 @@ loginprompt ()
if ((me_index = userexist (user_buf)) != -1) if ((me_index = userexist (user_buf)) != -1)
{ {
me = deep_copy (users[me_index]); me = users[me_index];
error = 0; error = 0;
} }
} }
@ -1457,7 +1446,7 @@ main (int argc, char** argv)
if (readfile (0)) if (readfile (0))
graceful_exit (110); graceful_exit (110);
initncurses (); initcurses ();
while ((userchoice != 'p') | (!loggedin)) while ((userchoice != 'p') | (!loggedin))
{ {
drawmenu (); drawmenu ();

View File

@ -71,8 +71,7 @@ extern int changepw (void);
extern void domailuser (char *username); extern void domailuser (char *username);
extern void drawmenu (void); extern void drawmenu (void);
extern void freefile (void); extern void freefile (void);
extern void initncurses (void); extern void initcurses (void);
extern struct dg_user *deep_copy (struct dg_user *src);
extern void loginprompt (void); extern void loginprompt (void);
extern void newuser (void); extern void newuser (void);
extern int passwordgood (char *cpw); extern int passwordgood (char *cpw);

11
ee.c
View File

@ -49,7 +49,7 @@
| proprietary information which is protected by | proprietary information which is protected by
| copyright. All rights are reserved. | copyright. All rights are reserved.
| |
| $Header: /var/cvs/dgamelaunch/ee.c,v 1.8 2004/01/26 08:09:39 joshk Exp $ | $Header: /var/cvs/dgamelaunch/ee.c,v 1.9 2004/01/26 08:29:04 joshk Exp $
| |
*/ */
@ -62,7 +62,7 @@ char *ee_long_notice[] = {
"copyright. All rights are reserved." "copyright. All rights are reserved."
}; };
char *version = "@(#) ee, version 1.4.1 $Revision: 1.8 $"; char *version = "@(#) ee, version 1.4.1 $Revision: 1.9 $";
#include <curses.h> #include <curses.h>
#include <signal.h> #include <signal.h>
@ -2846,14 +2846,13 @@ struct menu_entries menu_list[];
if (input == -1) if (input == -1)
exit(0); exit(0);
if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || if (isalnum(tolower(input)))
((input >= '0') && (input <= '9')))
{ {
if ((tolower(input) >= 'a') && (tolower(input) <= 'z')) if (isalpha(tolower(input)))
{ {
temp = 1 + tolower(input) - 'a'; temp = 1 + tolower(input) - 'a';
} }
else if ((input >= '0') && (input <= '9')) else if (isdigit(input))
{ {
temp = (2 + 'z' - 'a') + (input - '0'); temp = (2 + 'z' - 'a') + (input - '0');
} }

View File

@ -47,7 +47,7 @@
#include "stripgfx.h" #include "stripgfx.h"
extern void domailuser (char *); extern void domailuser (char *);
extern void initncurses (void); extern void initcurses (void);
extern char *chosen_name; extern char *chosen_name;
extern int loggedin; extern int loggedin;
@ -208,7 +208,7 @@ ttypread (FILE * fp, Header * h, char **buf, int pread)
case 'm': case 'm':
if (loggedin) if (loggedin)
{ {
initncurses (); initcurses ();
domailuser (chosen_name); domailuser (chosen_name);
/* XXX jilles: just quit out after mail for now */ /* XXX jilles: just quit out after mail for now */
#if 0 #if 0