From: Peep P. <so...@us...> - 2004-07-21 11:57:48
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8714 Modified Files: main.c Log Message: General cleanup; frame pointer is set correctly before applying crash Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- main.c 20 Jun 2004 14:04:56 -0000 1.21 +++ main.c 21 Jul 2004 11:57:22 -0000 1.22 @@ -34,6 +34,7 @@ extern object_t *master; static char *conf_file; time_t startup_time; +extern variable_t *fp, *sp; void crash(int sig, char *reason, int retval) { @@ -47,11 +48,14 @@ signal(SIGPIPE, SIG_IGN); #ifdef DEBUG /* We generally do not want to debug the crash function. Causes unnecessary spam. */ - dont_debug_interpreter = 1; + dont_debug_interpreter = 0; #endif if(master) { - if(!apply(master, "crash", "i", sig)) + int ret; + fp = sp; + ret = apply(master, "crash", "i", sig); + if(!ret) fprintf(stderr, "master::crash() failed.\n"); else fprintf(stderr, "master::crash() called successfully.\n"); @@ -79,19 +83,18 @@ void usage(char *s) { printf("Usage: %s [options] [configuration file]\n", s); - printf("\tOptions:\n\t\t-d:\n\t\t Increase debug level\n" - "\t\t-?\n\t\t-v:\n\t\t Show version and quit\n"); + printf("\tOptions:\n\ + \t\t-d:\n\ + \t\t Increase debug level\n\ + \t\t-?\n\ + \t\t-v:\n\ + \t\t Show version and quit\n"); exit(5); } void print_version(void) { - printf("%s on %s", PACKAGE_STRING, PLATFORM); -#ifdef __GNUC__ - printf(", gcc %s", __VERSION__); -#endif - putchar('\n'); - + printf("%s for %s starting at %s", PACKAGE_STRING, PLATFORM, ctime(&startup_time)); #ifdef ARCH_README printf("Your computer architecture is not fully supported. " "Please read README.ARCH in the source directory.\n"); @@ -155,6 +158,9 @@ int main(int argc, char **argv) { parse_args(argc, argv); + + time(&startup_time); + srand(startup_time); print_version(); #ifndef ALLOW_ROOT @@ -183,17 +189,14 @@ check_logfile(); dfuns_init(); /* init_interpreter();*/ - + master = load_object(conf.master); if(!master) crash(0, "Master object doesn't load", 3); - master->numref++; +/* master->numref++; Is this really necessary? */ net_listen(conf.port); - time(&startup_time); - printf("Started at %s", ctime(&startup_time)); - srand(startup_time); printf("Accepting connections on port %d.\n", conf.port); net_loop(); return 0; |