void prim_interp(PRIM_PROTOTYPE) { struct inst *oper1 = NULL; /* prevents re-entrancy issues! */ struct inst *oper2 = NULL; /* prevents re-entrancy issues! */ struct inst *oper3 = NULL; /* prevents re-entrancy issues! */ struct inst *rv = NULL; char buf[BUFFER_LEN]; struct frame *tmpfr; CHECKOP(3); oper3 = POP(); /* string -- top stack argument */ oper2 = POP(); /* dbref -- trigger */ oper1 = POP(); /* dbref -- Program to run */ if (!valid_object(oper1) || Typeof(oper1->data.objref) != TYPE_PROGRAM) abort_interp("Bad program reference. (1)"); if (!valid_object(oper2)) abort_interp("Bad object. (2)"); if (oper3->type != PROG_STRING) abort_interp("Expected a string. (3)"); if ((mlev < 3) && !permissions(ProgUID, oper2->data.objref)) abort_interp("Permission denied."); if (fr->level > 8) abort_interp("Interp call loops not allowed."); CHECKREMOTE(oper2->data.objref); strcpyn(buf, sizeof(buf), match_args); strcpyn(match_args, sizeof(match_args), DoNullInd(oper3->data.string)); tmpfr = interp(fr->descr, player, LOCATION(player), oper1->data.objref, oper2->data.objref, PREEMPT, STD_HARDUID, 0); if (tmpfr) { rv = interp_loop(player, oper1->data.objref, tmpfr, 1); } strcpyn(match_args, sizeof(match_args), buf); CLEAR(oper3); CLEAR(oper2); CLEAR(oper1); if (rv) { if (rv->type < PROG_STRING) { push(arg, top, rv->type, MIPSCAST(&rv->data.number)); } else { push(arg, top, rv->type, MIPSCAST(rv->data.string)); } } else { PushNullStr; } }
void prim_interp(PRIM_PROTOTYPE) { struct inst *oper1, *oper2, *oper3, *rv = NULL; char buf[BUFFER_LEN]; struct frame *tmpfr; CHECKOP(3); oper3 = POP(); /* string -- top stack argument */ oper2 = POP(); /* dbref -- trigger */ oper1 = POP(); /* dbref -- Program to run */ if (!valid_object(oper1) || Typeof(oper1->data.objref) != TYPE_PROGRAM) abort_interp("Bad program reference. (1)"); if (!valid_object(oper2)) abort_interp("Bad object. (2)"); if (oper3->type != PROG_STRING) abort_interp("Need string arguement. (3)"); if (!permissions(mlev, ProgUID, oper2->data.objref)) abort_interp(tp_noperm_mesg); if (fr->level > 8) abort_interp("Interp call loops not allowed."); CHECKREMOTE(oper2->data.objref); strcpy(buf, match_args); strcpy(match_args, oper3->data.string ? oper3->data.string->data : ""); interp_set_depth(fr); tmpfr = interp(fr->descr, player, DBFETCH(player)->location, oper1->data.objref, oper2->data.objref, PREEMPT, STD_HARDUID, 0); if (tmpfr) { rv = interp_loop(player, oper1->data.objref, tmpfr, 1); } strcpy(match_args, buf); CLEAR(oper3); CLEAR(oper2); CLEAR(oper1); if (rv) { if (rv->type < PROG_STRING) { push(arg, top, rv->type, MIPSCAST(&rv->data.number)); } else { push(arg, top, rv->type, MIPSCAST(rv->data.string)); } } else { PushNullStr; } }
void next_timequeue_event(void) { struct frame *tmpfr; int tmpbl, tmpfg; timequeue lastevent, event; int maxruns = 0; int forced_pid = 0; time_t rtime; time(&rtime); lastevent = tqhead; while ((lastevent) && (rtime >= lastevent->when) && (maxruns < 10)) { lastevent = lastevent->next; maxruns++; } while (tqhead && (tqhead != lastevent) && (maxruns--)) { if (tqhead->typ == TQ_MUF_TYP && tqhead->subtyp == TQ_MUF_READ) { break; } event = tqhead; tqhead = tqhead->next; process_count--; forced_pid = event->eventnum; event->eventnum = 0; if (event->typ == TQ_MPI_TYP) { char cbuf[BUFFER_LEN]; int ival; strcpyn(match_args, sizeof(match_args), event->str3 ? event->str3 : ""); strcpyn(match_cmdname, sizeof(match_cmdname), event->command ? event->command : ""); ival = (event->subtyp & TQ_MPI_OMESG) ? MPI_ISPUBLIC : MPI_ISPRIVATE; if (event->subtyp & TQ_MPI_BLESSED) { ival |= MPI_ISBLESSED; } if (event->subtyp & TQ_MPI_LISTEN) { ival |= MPI_ISLISTENER; do_parse_mesg(event->descr, event->uid, event->trig, event->called_data, "(MPIlisten)", cbuf, sizeof(cbuf), ival); } else if ((event->subtyp & TQ_MPI_SUBMASK) == TQ_MPI_DELAY) { do_parse_mesg(event->descr, event->uid, event->trig, event->called_data, "(MPIdelay)", cbuf, sizeof(cbuf), ival); } else { do_parse_mesg(event->descr, event->uid, event->trig, event->called_data, "(MPIqueue)", cbuf, sizeof(cbuf), ival); } if (*cbuf) { if (!(event->subtyp & TQ_MPI_OMESG)) { notify_filtered(event->uid, event->uid, cbuf, 1); } else { char bbuf[BUFFER_LEN]; dbref plyr; snprintf(bbuf, sizeof(bbuf), ">> %.4000s %.*s", NAME(event->uid), (int)(4000 - strlen(NAME(event->uid))), pronoun_substitute(event->descr, event->uid, cbuf)); plyr = DBFETCH(event->loc)->contents; for (; plyr != NOTHING; plyr = DBFETCH(plyr)->next) { if (Typeof(plyr) == TYPE_PLAYER && plyr != event->uid) notify_filtered(event->uid, plyr, bbuf, 0); } } } } else if (event->typ == TQ_MUF_TYP) { if (Typeof(event->called_prog) == TYPE_PROGRAM) { if (event->subtyp == TQ_MUF_DELAY) { /* Uncomment when DBFETCH "does" something */ /* FIXME: DBFETCH(event->uid); */ tmpbl = PLAYER_BLOCK(event->uid); tmpfg = (event->fr->multitask != BACKGROUND); interp_loop(event->uid, event->called_prog, event->fr, 0); if (!tmpfg) { PLAYER_SET_BLOCK(event->uid, tmpbl); } } else if (event->subtyp == TQ_MUF_TIMER) { struct inst temp; temp.type = PROG_INTEGER; temp.data.number = event->when; event->fr->timercount--; muf_event_add(event->fr, event->called_data, &temp, 0); } else if (event->subtyp == TQ_MUF_TREAD) { handle_read_event(event->descr, event->uid, NULL); } else { strcpyn(match_args, sizeof(match_args), event->called_data ? event->called_data : ""); strcpyn(match_cmdname, sizeof(match_cmdname), event->command ? event->command : ""); tmpfr = interp(event->descr, event->uid, event->loc, event->called_prog, event->trig, BACKGROUND, STD_HARDUID, forced_pid); if (tmpfr) { interp_loop(event->uid, event->called_prog, tmpfr, 0); } } } } event->fr = NULL; free_timenode(event); } }
void handle_read_event(int descr, dbref player, const char *command) { struct frame *fr; timequeue ptr, lastevent; int flag, typ, nothing_flag; int oldflags; dbref prog; nothing_flag = 0; if (command == NULL) { nothing_flag = 1; } oldflags = FLAGS(player); FLAGS(player) &= ~(INTERACTIVE | READMODE); ptr = tqhead; lastevent = NULL; while (ptr) { if (ptr->typ == TQ_MUF_TYP && (ptr->subtyp == TQ_MUF_READ || ptr->subtyp == TQ_MUF_TREAD) && ptr->uid == player) { break; } lastevent = ptr; ptr = ptr->next; } /* * When execution gets to here, either ptr will point to the * READ event for the player, or else ptr will be NULL. */ if (ptr) { /* remember our program, and our execution frame. */ fr = ptr->fr; if (fr == NULL) { log_status("WARNING: handle_read_event(): NULL frame ! Ignored."); return; } if (!fr->brkpt.debugging || fr->brkpt.isread) { if (!fr->wantsblanks && command && !*command) { FLAGS(player) = oldflags; return; } } typ = ptr->subtyp; prog = ptr->called_prog; if (command) { /* remove the READ timequeue node from the timequeue */ process_count--; if (lastevent) { lastevent->next = ptr->next; } else { tqhead = ptr->next; } } /* remember next timequeue node, to check for more READs later */ lastevent = ptr; ptr = ptr->next; /* Make SURE not to let the program frame get freed. We need it. */ lastevent->fr = NULL; if (command) { /* * Free up the READ timequeue node * we just removed from the queue. */ free_timenode(lastevent); } if (fr->brkpt.debugging && !fr->brkpt.isread) { /* We're in the MUF debugger! Call it with the input line. */ if (command) { if (muf_debugger(descr, player, prog, command, fr)) { /* MUF Debugger exited. Free up the program frame & exit */ prog_clean(fr); return; } } else { if (muf_debugger(descr, player, prog, "", fr)) { /* MUF Debugger exited. Free up the program frame & exit */ prog_clean(fr); return; } } } else { /* This is a MUF READ event. */ if (command && !string_compare(command, BREAK_COMMAND)) { /* Whoops! The user typed @Q. Free the frame and exit. */ prog_clean(fr); return; } if ((fr->argument.top >= STACK_SIZE) || (nothing_flag && fr->argument.top >= STACK_SIZE - 1)) { /* * Uh oh! That MUF program's stack is full! * Print an error, free the frame, and exit. */ notify_nolisten(player, "Program stack overflow.", 1); prog_clean(fr); return; } /* * Everything looks okay. Lets stuff the input line * on the program's argument stack as a string item. */ fr->argument.st[fr->argument.top].type = PROG_STRING; fr->argument.st[fr->argument.top++].data.string = alloc_prog_string(command ? command : ""); if (typ == TQ_MUF_TREAD) { if (nothing_flag) { fr->argument.st[fr->argument.top].type = PROG_INTEGER; fr->argument.st[fr->argument.top++].data.number = 0; } else { fr->argument.st[fr->argument.top].type = PROG_INTEGER; fr->argument.st[fr->argument.top++].data.number = 1; } } } /* * When using the MUF Debugger, the debugger will set the * INTERACTIVE bit on the user, if it does NOT want the MUF * program to resume executing. */ flag = (FLAGS(player) & INTERACTIVE); if (!flag && fr) { interp_loop(player, prog, fr, 0); /* WORK: if more input is pending, send the READ mufevent again. */ /* WORK: if no input is pending, clear READ mufevent from all of this player's programs. */ } /* * Check for any other READ events for this player. * If there are any, set the READ related flags. */ while (ptr) { if (ptr->typ == TQ_MUF_TYP && (ptr->subtyp == TQ_MUF_READ || ptr->subtyp == TQ_MUF_TREAD)) { if (ptr->uid == player) { FLAGS(player) |= (INTERACTIVE | READMODE); } } ptr = ptr->next; } } }
void propqueue(int descr, dbref player, dbref where, dbref trigger, dbref what, dbref xclude, const char *propname, const char *toparg, int mlev, int mt) { const char *tmpchar; const char *pname; dbref the_prog; char buf[BUFFER_LEN]; char exbuf[BUFFER_LEN]; the_prog = NOTHING; tmpchar = NULL; /* queue up program referred to by the given property */ if (((the_prog = get_property_dbref(what, propname)) != NOTHING) || (tmpchar = get_property_class(what, propname))) { if ((tmpchar && *tmpchar) || the_prog != NOTHING) { if (tmpchar) { if (*tmpchar == '&') { the_prog = AMBIGUOUS; } else if (*tmpchar == NUMBER_TOKEN && number(tmpchar + 1)) { the_prog = (dbref) atoi(++tmpchar); } else if (*tmpchar == REGISTERED_TOKEN) { the_prog = find_registered_obj(what, tmpchar); } else if (number(tmpchar)) { the_prog = (dbref) atoi(tmpchar); } else { the_prog = NOTHING; } } else { if (the_prog == AMBIGUOUS) the_prog = NOTHING; } if (the_prog != AMBIGUOUS) { if (the_prog < 0 || the_prog >= db_top) { the_prog = NOTHING; } else if (Typeof(the_prog) != TYPE_PROGRAM) { the_prog = NOTHING; } else if ((OWNER(the_prog) != OWNER(player)) && !(FLAGS(the_prog) & LINK_OK)) { the_prog = NOTHING; } else if (MLevel(the_prog) < mlev) { the_prog = NOTHING; } else if (MLevel(OWNER(the_prog)) < mlev) { the_prog = NOTHING; } else if (the_prog == xclude) { the_prog = NOTHING; } } if (propq_level < 8) { propq_level++; if (the_prog == AMBIGUOUS) { char cbuf[BUFFER_LEN]; int ival; strcpyn(match_args, sizeof(match_args), ""); strcpyn(match_cmdname, sizeof(match_cmdname), toparg); ival = (mt == 0) ? MPI_ISPUBLIC : MPI_ISPRIVATE; if (Prop_Blessed(what, propname)) ival |= MPI_ISBLESSED; do_parse_mesg(descr, player, what, tmpchar + 1, "(MPIqueue)", cbuf, sizeof(cbuf), ival); if (*cbuf) { if (mt) { notify_filtered(player, player, cbuf, 1); } else { char bbuf[BUFFER_LEN]; dbref plyr; snprintf(bbuf, sizeof(bbuf), ">> %.4000s", pronoun_substitute(descr, player, cbuf)); plyr = DBFETCH(where)->contents; while (plyr != NOTHING) { if (Typeof(plyr) == TYPE_PLAYER && plyr != player) notify_filtered(player, plyr, bbuf, 0); plyr = DBFETCH(plyr)->next; } } } } else if (the_prog != NOTHING) { struct frame *tmpfr; strcpyn(match_args, sizeof(match_args), toparg ? toparg : ""); strcpyn(match_cmdname, sizeof(match_cmdname), "Queued event."); tmpfr = interp(descr, player, where, the_prog, trigger, BACKGROUND, STD_HARDUID, 0); if (tmpfr) { interp_loop(player, the_prog, tmpfr, 0); } } propq_level--; } else { notify_nolisten(player, "Propqueue stopped to prevent infinite loop.", 1); } } } strcpyn(buf, sizeof(buf), propname); if (is_propdir(what, buf)) { strcatn(buf, sizeof(buf), "/"); while ((pname = next_prop_name(what, exbuf, sizeof(exbuf), buf))) { strcpyn(buf, sizeof(buf), pname); propqueue(descr, player, where, trigger, what, xclude, buf, toparg, mlev, mt); } } }
void process_command(int descr, dbref player, char *command) { char *arg1; char *arg2; char *full_command, *commandline=command, *commandstuff; char *p; /* utility */ char pbuf[BUFFER_LEN]; char xbuf[BUFFER_LEN]; char ybuf[BUFFER_LEN]; const char *path; struct frame *tmpfr; if (command == 0) abort(); /* robustify player */ if (player < 0 || player >= db_top || (Typeof(player) != TYPE_PLAYER && Typeof(player) != TYPE_THING)) { log_status("process_command: bad player %d\n", player); return; } if ((tp_log_commands || (tp_log_guests && Guest(OWNER(player)))) && (!(FLAGS(player)&(INTERACTIVE | READMODE)))) { log_command("%s%s%s%s(%d) in %s(%d):%s %s\n", Mage(OWNER(player)) ? "WIZ: " : "", (Typeof(player) != TYPE_PLAYER) ? NAME(player) : "", (Typeof(player) != TYPE_PLAYER) ? " by " : "", NAME(OWNER(player)), (int) player, NAME(DBFETCH(player)->location), (int) DBFETCH(player)->location, (FLAGS(player) & INTERACTIVE) ? " [interactive]" : " ", command); } if (FLAGS(player) & INTERACTIVE) { interactive(descr, player, command); return; } /* eat leading whitespace */ while (*command && isspace(*command)) command++; commandstuff = command; /* check for single-character commands */ if (*command == SAY_TOKEN || *command == '\'') { sprintf(pbuf, "say %s", command + 1); command = &pbuf[0]; } else if (*command == POSE_TOKEN || *command == ';') { sprintf(pbuf, "pose %s", command + 1); command = &pbuf[0]; } else if ((*command == '|' || (*commandstuff++ == '\\' && *commandstuff == '\\') ) && can_move(descr, player, "spoof", 0)) { if(*command = '\\') sprintf(pbuf, "spoof %s", command + 2); else sprintf(pbuf, "spoof %s", command + 1); command = &pbuf[0]; } /* if player is a wizard, and uses overide token to start line...*/ /* ... then do NOT run actions, but run the command they specify. */ if (!strcmp(command, WHO_COMMAND)) { char xxbuf[BUFFER_LEN]; strcpy(xxbuf, "@"); strcat(xxbuf, WHO_COMMAND); strcat(xxbuf, " "); strcat(xxbuf, command + sizeof(WHO_COMMAND) - 1); if (can_move(descr, player, xxbuf, 5)) { do_move(descr, player, xxbuf, 5); } else { pdump_who_users(descr, command + sizeof(WHO_COMMAND) - 1); } return; } if (!( *command == OVERIDE_TOKEN && TMage(player) )) { if( can_move(descr, player, command, 0) ) { do_move(descr, player, command, 0); /* command is exact match for exit */ *match_args = 0; *match_cmdname = 0; return; } } if (*command == OVERIDE_TOKEN && TMage(player)) command++; full_command = strcpy(xbuf, command); for (; *full_command && !isspace(*full_command); full_command++); if (*full_command) full_command++; /* find arg1 -- move over command word */ command = strcpy(ybuf, command); for (arg1 = command; *arg1 && !isspace(*arg1); arg1++); /* truncate command */ if (*arg1) *arg1++ = '\0'; /* remember command for programs */ strcpy(match_cmdname, command); /* move over spaces */ while (*arg1 && isspace(*arg1)) arg1++; /* find end of arg1, start of arg2 */ for (arg2 = arg1; *arg2 && *arg2 != ARG_DELIMITER; arg2++); /* truncate arg1 */ for (p = arg2 - 1; p >= arg1 && isspace(*p); p--) *p = '\0'; /* go past delimiter if present */ if (*arg2) *arg2++ = '\0'; while (*arg2 && isspace(*arg2)) arg2++; strcpy(match_cmdname, command); strcpy(match_args, full_command); switch (command[0]) { case '@': switch (command[1]) { case 'a': case 'A': /* @action, @attach */ switch (command[2]) { case 'c': case 'C': Matched("@action"); do_action(descr, player, arg1, arg2); break; case 'r': case 'R': if (string_compare(command, "@armageddon")) goto bad; do_armageddon(player, full_command); break; case 't': case 'T': Matched("@attach"); do_attach(descr, player, arg1, arg2); break; case 'n': case 'N': Matched("@ansidescribe"); do_ansidescribe(descr, player, arg1, arg2); break; default: goto bad; } break; case 'b': case 'B': Matched("@boot"); do_boot(player, arg1); break; case 'c': case 'C': /* chown, contents, create */ switch (command[2]) { case 'h': case 'H': switch (command[3]) { case 'l': case 'L': Matched("@chlock"); do_chlock(descr, player, arg1, arg2); break; case 'o': case 'O': Matched("@chown"); do_chown(descr, player, arg1, arg2); break; default: goto bad; } break; case 'o': case 'O': switch (command[4]) { case 'l': case 'L': Matched("@conlock"); do_conlock(descr, player, arg1, arg2); break; case 't': case 'T': Matched("@contents"); do_contents(descr, player, arg1, arg2); break; default: goto bad; } break; case 'r': case 'R': if (string_compare(command, "@credits")) { Matched("@create"); do_create(player, arg1, arg2); } else { do_credits(player); } break; default: goto bad; } break; case 'd': case 'D': /* describe, dequeue, dig, or dump */ switch (command[2]) { case 'b': case 'B': Matched("@dbginfo"); do_serverdebug(descr, player, arg1, arg2); break; case 'e': case 'E': #ifdef DELTADUMPS if(command[3] == 'l' || command[3] == 'L') { Matched("@delta"); do_delta(player); } else #endif { if( (command[3] == 's' || command[3] == 'S') && (command[4] == 't' || command[4] == 'T') ) { Matched("@destroy"); do_recycle(descr, player, arg1); } else { Matched("@describe"); do_describe(descr, player, arg1, arg2); } } break; case 'i': case 'I': Matched("@dig"); do_dig(descr, player, arg1, arg2); break; #ifdef DELTADUMPS case 'l': case 'L': Matched("@dlt"); do_delta(player); break; #endif case 'o': case 'O': Matched("@doing"); if (!tp_who_doing) goto bad; do_doing(descr, player, arg1, arg2); break; case 'r': case 'R': Matched("@drop"); do_drop_message(descr, player, arg1, arg2); break; case 'u': case 'U': Matched("@dump"); do_dump(player, full_command); break; default: goto bad; } break; case 'e': case 'E': switch (command[2]) { case 'd': case 'D': Matched("@edit"); do_edit(descr, player, arg1); break; case 'n': case 'N': Matched("@entrances"); do_entrances(descr, player, arg1, arg2); break; case 'x': case 'X': Matched("@examine"); sane_dump_object(player, arg1); break; default: goto bad; } break; case 'f': case 'F': /* fail, find, force, or frob */ switch (command[2]) { case 'a': case 'A': Matched("@fail"); do_fail(descr, player, arg1, arg2); break; case 'i': case 'I': if(command[3] == 'x' || command[3] == 'X') { Matched("@fixwizbits"); do_fixw(player, full_command); } else { Matched("@find"); do_find(player, arg1, arg2); } break; case 'l': case 'L': Matched("@flock"); do_flock(descr, player, arg1, arg2); break; case 'o': case 'O': Matched("@force"); do_force(descr, player, arg1, arg2); break; case 'r': case 'R': if (string_compare(command, "@frob")) goto bad; do_frob(descr, player, arg1, arg2); break; default: goto bad; } break; case 'h': case 'H': switch (command[2]) { case 'T': case 't': Matched("@htmldescribe"); do_htmldescribe(descr, player, arg1, arg2); break; default: Matched("@hopper"); do_hopper(player, arg1); break; } break; case 'i': case 'I': switch(command[2]) { case 'h': case 'H': Matched("@ihtmldescribe"); do_ihtmldescribe(descr, player, arg1, arg2); break; case 'a': case 'A': Matched("@iansidescribe"); do_iansidescribe(descr, player, arg1, arg2); break; default: Matched("@idescribe"); do_idescribe(descr, player, arg1, arg2); break; } break; case 'k': case 'K': Matched("@kill"); do_dequeue(descr, player, arg1); break; case 'l': case 'L': /* lock or link */ switch (command[2]) { case 'i': case 'I': switch (command[3]) { case 'n': case 'N': Matched("@link"); do_link(descr, player, arg1, arg2); break; case 's': case 'S': Matched("@list"); match_and_list(descr, player, arg1, arg2, 1); break; default: goto bad; } break; case 'o': case 'O': Matched("@lock"); do_lock(descr, player, arg1, arg2); break; default: goto bad; } break; case 'm': case 'M': switch (command[2]) { case 'e': case 'E': Matched("@memory"); do_memory(player); break; case 'c': case 'C': switch (command[4]) { case '2': Matched("@mcp2muf"); match_and_list(descr, player, arg1, arg2, 0); break; default: Matched("@mcp"); do_prog(descr, player, arg1, 1); break; } default: goto bad; } break; case 'n': case 'N': /* @name or @newpassword */ switch (command[2]) { case 'a': case 'A': Matched("@name"); do_name(descr, player, arg1, arg2); break; case 'e': case 'E': if (string_compare(command, "@newpassword")) goto bad; do_newpassword(player, arg1, arg2); break; default: goto bad; } break; case 'o': case 'O': switch (command[2]) { case 'd': case 'D': Matched("@odrop"); do_odrop(descr, player, arg1, arg2); break; case 'e': case 'E': Matched("@oecho"); do_oecho(descr, player, arg1, arg2); break; case 'f': case 'F': Matched("@ofail"); do_ofail(descr, player, arg1, arg2); break; case 'p': case 'P': Matched("@open"); do_open(descr, player, arg1, arg2); break; case 's': case 'S': Matched("@osuccess"); do_osuccess(descr, player, arg1, arg2); break; case 'w': case 'W': Matched("@owned"); do_owned(player, arg1, arg2); break; default: goto bad; } break; case 'p': case 'P': switch (command[2]) { case 'a': case 'A': Matched("@password"); do_password(player, arg1, arg2); break; case 'c': case 'C': Matched("@pcreate"); do_pcreate(player, arg1, arg2); break; case 'e': case 'E': Matched("@pecho"); do_pecho(descr, player, arg1, arg2); break; case 'r': case 'R': if (string_prefix("@program", command)) { do_prog(descr, player, arg1, 0); break; } else if (string_prefix("@proginfo", command)) { do_proginfo(player, arg1); break; } else { Matched("@propset"); do_propset(descr, player, arg1, arg2); break; } case 's': case 'S': Matched("@ps"); list_events(player); break; case 'u': case 'U': Matched("@purge"); do_purge(descr, player, arg1, arg2); break; default: goto bad; } break; case 'r': case 'R': switch (command[3]) { case 'c': case 'C': Matched("@recycle"); do_recycle(descr, player, arg1); break; case 's': case 'S': if (!string_compare(command, "@restart")) { do_restart(player, full_command); } else if (!string_compare(command, "@restrict")) { do_restrict(player, arg1); } else { goto bad; } break; default: goto bad; } break; case 's': case 'S': /* set, shutdown, success */ switch (command[2]) { case 'a': case 'A': if (!string_compare(command, "@sanity")) { sanity(player); } else if (!string_compare(command, "@sanchange")) { sanechange(player, full_command); } else if (!string_compare(command, "@sanfix")) { sanfix(player); } else { goto bad; } break; case 'e': case 'E': Matched("@set"); do_set(descr, player, arg1, arg2); break; case 'h': case 'H': if (!string_compare(command, "@shout")) { do_wall(player, full_command); break; } if (string_compare(command, "@shutdown")) goto bad; do_shutdown(player, arg1); break; case 't': case 'T': Matched("@stats"); do_stats(player, arg1); break; case 'u': case 'U': Matched("@success"); do_success(descr, player, arg1, arg2); break; case 'w': case 'W': Matched("@sweep"); do_sweep(descr, player, arg1); break; default: goto bad; } break; case 't': case 'T': switch (command[2]) { case 'e': case 'E': Matched("@teleport"); do_teleport(descr, player, arg1, arg2); break; case 'o': case 'O': if (string_compare(command, "@toad")) goto bad; do_frob(descr, player, arg1, arg2); break; case 'r': case 'R': Matched("@trace"); do_trace(descr, player, arg1, atoi(arg2)); break; case 'u': case 'U': Matched("@tune"); do_tune(player, arg1, arg2); break; default: goto bad; } break; case 'u': case 'U': switch (command[2]) { case 'N': case 'n': if (string_prefix(command, "@unlink")) { do_unlink(descr, player, arg1); } else if (string_prefix(command, "@unlock")) { do_unlock(descr, player, arg1); } else if (string_prefix(command, "@uncompile")) { do_uncompile(player); } else { goto bad; } break; #ifndef NO_USAGE_COMMAND case 'S': case 's': Matched("@usage"); do_usage(player); break; #endif default: goto bad; break; } break; case 'v': case 'V': Matched("@version"); anotify_nolisten2(player, CRIMSON "ProtoMUCK " PROTOBASE PURPLE " (" RED VERSION WHITE " -- " AQUA NEONVER PURPLE ")" ); break; case 'w': case 'W': if (string_compare(command, "@wall")) goto bad; do_wall(player, full_command); break; default: goto bad; } break; case '&': do_mush_set(descr, player, arg1, arg2, command); break; case 'd': case 'D': switch (command[1]) { case 'b': case 'B': Matched("dboot"); do_dboot(player, arg1); break; case 'i': case 'I': Matched("dinfo"); do_dinfo(player, arg1); break; case 'r': case 'R': Matched("drop"); do_drop(descr, player, arg1, arg2); break; case 'w': case 'W': Matched("dwall"); do_dwall(player, arg1, arg2); break; default: goto bad; } break; case 'e': case 'E': switch (command[1]) { case 'm': case 'M': Matched("emote"); do_pose(descr, player, full_command); break; case 'x': case 'X': case '\0': Matched("examine"); do_examine(descr, player, arg1, arg2); break; default: goto bad; } break; case 'g': case 'G': /* get, give, go, or gripe */ switch (command[1]) { case 'e': case 'E': Matched("get"); do_get(descr, player, arg1, arg2); break; case 'i': case 'I': Matched("give"); do_give(descr, player, arg1, atoi(arg2)); break; case 'o': case 'O': Matched("goto"); do_move(descr, player, arg1, 0); break; case 'r': case 'R': if(command[2]=='i' || command[2]=='I') { if (string_compare(command, "gripe")) goto bad; do_gripe(player, full_command); break; } default: goto bad; } break; case 'h': case 'H': switch (command[1]) { case 'a': case 'A': Matched("hand"); do_drop(descr, player, arg1, arg2); break; case 'e': case 'E': Matched("help"); do_help(player, arg1, arg2); break; default: goto bad; } break; case 'i': case 'I': if (string_compare(command, "info")) { Matched("inventory"); do_inventory(player); } else { do_info(player, arg1, arg2); } break; case 'l': case 'L': if (string_prefix("look", command)) { do_look_at(descr, player, arg1, arg2); break; } else { Matched("leave"); do_leave(descr, player); break; } case 'm': case 'M': if (string_prefix(command, "move")) { do_move(descr, player, arg1, 0); break; } else if (!string_compare(command, "motd")) { do_motd(player, full_command); break; } else if (!string_compare(command, "mpi")) { do_mpihelp(player, arg1, arg2); break; } else { if (string_compare(command, "man")) goto bad; do_man(player, arg1, arg2); } break; case 'n': case 'N': /* news */ Matched("news"); do_news(player, arg1, arg2); break; case 'p': case 'P': switch (command[1]) { case 'a': case 'A': case '\0': Matched("page"); do_page(descr, player, arg1, arg2); break; case 'o': case 'O': Matched("pose"); do_pose(descr, player, full_command); break; case 'u': case 'U': Matched("put"); do_drop(descr, player, arg1, arg2); break; default: goto bad; } break; case 'r': case 'R': switch (command[1]) { case 'e': case 'E': if(command[2] == 'q' || command[2] == 'Q'){ Matched("request"); request(player, NULL, commandline); } else { Matched("read"); /* undocumented alias for look */ do_look_at(descr, player, arg1, arg2); } break; default: goto bad; } break; case 's': case 'S': /* say, "score" */ switch (command[1]) { case 'a': case 'A': Matched("say"); do_say(descr, player, full_command); break; case 'c': case 'C': case '\0': if( command[1] && (command[2] == 'a' || command[2] == 'A' )) { Matched("scan"); do_sweep(descr, player, arg1); } else { Matched("score"); do_score(player, 1); } break; default: goto bad; } break; case 't': case 'T': switch (command[1]) { case 'a': case 'A': Matched("take"); do_get(descr, player, arg1, arg2); break; case 'h': case 'H': Matched("throw"); do_drop(descr, player, arg1, arg2); break; default: goto bad; } break; case 'w': case 'W': switch (command[1]){ case 'c': case 'C': Matched("wc"); do_wizchat(player, full_command); break; case 'i': case 'I': Matched("wizchat"); do_wizchat(player, arg1); break; case 'h': case 'H': case '\0': Matched("whisper"); do_whisper(descr, player, arg1, arg2); break; default: goto bad; } break; default: bad: if ( Typeof(tp_huh_command) == TYPE_PROGRAM && !(player == -1)) { tmpfr = interp(descr, player, DBFETCH(player)->location, tp_huh_command, (dbref)-4, FOREGROUND, STD_REGUID); if (!tmpfr) goto bad2; (void) interp_loop(player, tp_huh_command, tmpfr, 0); } else { bad2: anotify_fmt(player, CINFO "%s",tp_huh_mesg); if (tp_log_failed_commands && !controls(player, DBFETCH(player)->location)) { log_status("HUH from %s(%d) in %s(%d)[%s]: %s %s\n", NAME(player), player, NAME(DBFETCH(player)->location), DBFETCH(player)->location, NAME(OWNER(DBFETCH(player)->location)), command, full_command); } } break; } }