|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 4941 (0x134d) Types: TextFile Names: »mudprog.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Abermud/mudprog.c«
/* ** Two Phase Game System */ #define DATA_DEF #include "kernel.h" #include <signal.h> #ifdef KICKOFFGUEST #include <time.h> #endif /* KICKOFFGUEST */ #ifdef RCSID static char RCS[] = "$Header: mudprog.c,v 1.1 89/03/13 09:37:03 rsalz Exp $"; #endif /* RCSID */ char *dirns[6] = {"North", "East ", "South", "West ", "Up ", "Down "}; char *txt1 = ""; char *txt2 = ""; char *localname; char in_ms[81] = "has arrived."; char min_ms[81] = "appears with an ear-splitting bang."; char mout_ms[81] = "vanishes in a puff of smoke."; char out_ms[81] = ""; char prm_str[128] = "$"; char wd_her[16] = " "; char wd_him[16] = " "; char wd_it[64] = " "; char wd_th2[64] = " "; char wd_them[16] = " "; char wd_there[128] = " "; char wordbuf[128] = " "; int cms = 1; int iskb = 1; int fighting = -1; int mynum = -1; int ob1 = -1; int ob2 = -1; int pl1 = -1; int pl2 = -1; int prep = -1; int snoopd = -1; int snoopt = -1; static int sig_active; int op(name) char *name; { return EQ(name, MASTERUSER); } main(argc, argv) int argc; char *argv[]; { char x[32]; time_t a; if (argc != 2) { printf("Args!\n"); exit(1); } userid = getuid(); sys_uid = geteuid(); localname = cuserid((char *)NULL); time(&a); srand((int)a); chdir(GAME_DIR); sig_init(); bootstrap(); printf("Entering Game ....\n"); strcpy(x, argv[1]); if (EQ(x, "Phantom")) sprintf(globme, "The %s", x); else strcpy(globme, x); if (fobn(globme) != -1) crapup("I can't call you that, it clashes with an object in the game"); printf("Hello %s\n", globme); mudlog("GAME ENTRY: %s[%s]", globme, localname); setstdin(); keysetup(); talker(globme); } crapup(str) char *str; { static char *dashes = "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"; pbfr(); if (aliased) { bprintf("%s\n", str); unalias(); error(); return; } key_mode = pr_due = 0; /* So we dont get a prompt after the * exit */ keysetback(); printf("\n%s\n\n%s\n\n%s\n", dashes, str, dashes); sleep(5); exit(0); } sig_alon() { sig_active = 1; signal(SIGALRM, sig_occur); alarm(IO_INTER); } unblock_alarm() { signal(SIGALRM, sig_occur); if (sig_active) alarm(IO_INTER); } block_alarm() { signal(SIGALRM, SIG_IGN); } sig_aloff() { sig_active = 0; signal(SIGALRM, SIG_IGN); alarm(0); } #ifdef KICKOFFGUEST tisyschk() { static int timewarn; time_t x; struct tm *a; time(&x); a = localtime(&x); if (!timewarn) { if (a->tm_wday >= 1 && a->tm_wday <= 5) { if (a->tm_hour == 7) { bprintf("ABERMUD is closing shortly\n"); timewarn++; return; } } else if (a->tm_hour == 9) { bprintf("ABERMUD is closing shortly\n"); timewarn++; return; } } if (timewarn && a->tm_min > 2) { loseme(); crapup("AberMUD has closed"); } } #endif /* KICKOFFGUEST */ sig_occur() { if (!sig_active) return; sig_aloff(); openworld(); interrupt = 1; rte(); interrupt = 0; on_timing(); closeworld(); key_reprint(); sig_alon(); #ifdef KICKOFFGUEST if (userid == GUESTID) tisyschk(); #endif /* KICKOFFGUEST */ } #ifdef SCREWQUOTA /* UNTESTED */ sig_reboot() { /* Process has exceeded virtual time limit - ie the final kick off comes * soon. Therefore it forks and kills off the old process the new one * gets a whole new set of cpu time..... * Good innit! */ switch (fork()) { case -1: crapup("Panic: System Error - Fork Failed"); case 0: exit(0); } fcntl(fileno(stdin), F_SETOWN, getpid()); return; } #endif /* SCREWQUOTA */ ohdear() { zapped = 1; setplev(mynum, 10001); crashcom(); printf("Something very unpleasant has just happened.\n"); exit(0); } sig_init() { signal(SIGHUP, sig_oops); signal(SIGSEGV, ohdear); signal(SIGINT, SIG_IGN); signal(SIGTERM, sig_ctrlc); signal(SIGTSTP,SIG_IGN); signal(SIGQUIT,SIG_IGN); signal(SIGQUIT, sig_ctrlc); #ifdef SCREWQUOTA signal(SIGXCPU, sig_reboot); #endif /* SCREWQUOTA */ } sig_oops() { sig_aloff(); loseme(); keysetback(); exit(255); } sig_ctrlc() { printf("^C\n"); } setstdin() { } fetchprmpt(level) int level; { FILE *a; char c, x[128]; int l; if ((a = fopen(LEV_PRM, "r")) == NULL) { strcpy(prm_str, "?"); return; } while (fgets(x, sizeof x, a)) { sscanf(x, "%c:%d:%s", &c, &l, prm_str); if (l == level) { if (c == 'Y') { fgets(in_ms, sizeof in_ms, a); fgets(out_ms, sizeof out_ms, a); fgets(min_ms, sizeof min_ms, a); fgets(mout_ms, sizeof mout_ms, a); *strchr(mout_ms, '\n') = 0; *strchr(min_ms, '\n') = 0; *strchr(in_ms, '\n') = 0; *strchr(out_ms, '\n') = 0; } fclose(a); return; } } fclose(a); strcpy(prm_str, ">"); }