Example #1
0
void
prim_force(PRIM_PROTOTYPE)
{
	struct inst *oper1 = NULL; /* prevents re-entrancy issues! */
	struct inst *oper2 = NULL; /* prevents re-entrancy issues! */

	int i;

	/* d s -- */
	CHECKOP(2);
	oper1 = POP();				/* string to @force */
	oper2 = POP();				/* player dbref */
	if (mlev < 4)
		abort_interp("Wizbit only primitive.");
	if (fr->level > 8)
		abort_interp("Interp call loops not allowed.");
	if (oper1->type != PROG_STRING)
		abort_interp("Non-string argument (2).");
	if (oper2->type != PROG_OBJECT)
		abort_interp("Non-object argument (1).");
	ref = oper2->data.objref;
	if (ref < 0 || ref >= db_top)
		abort_interp("Invalid object to force. (1)");
	if (Typeof(ref) != TYPE_PLAYER && Typeof(ref) != TYPE_THING)
		abort_interp("Object to force not a thing or player. (1)");
	if (0 == strcmp(DoNullInd(oper1->data.string), ""))
		abort_interp("Empty command argument (2).");
	if (index(oper1->data.string->data, '\r'))
		abort_interp("Carriage returns not allowed in command string. (2).");
#ifdef GOD_PRIV
	if (God(oper2->data.objref) && !God(OWNER(program)))
		abort_interp("Cannot force god (1).");
#endif
	force_prog = program;
	force_level++;
	process_command(dbref_first_descr(oper2->data.objref), oper2->data.objref,
					oper1->data.string->data);
	force_level--;
	force_prog = NOTHING;

	for (i = 1; i <= fr->caller.top; i++) {
		if (Typeof(fr->caller.st[i]) != TYPE_PROGRAM) {
#ifdef DEBUG
			char str[BUFFER_LEN];
			snprintf(str,BUFFER_LEN,"[debug] prim_force: fr->caller.st[%d] isn't a program.",i);
			notify_nolisten(player,str,1);
#endif /* DEBUG */
			do_abort_silent();
		}
	}

	CLEAR(oper1);
	CLEAR(oper2);
}
Example #2
0
void 
prim_kill(PRIM_PROTOTYPE)
{
    /* i -- i */
    CHECKOP(1);
    oper1 = POP();
    if (oper1->type != PROG_INTEGER)
	abort_interp("Non-integer argument (1)");
    if (oper1->data.number == fr->pid) {
	do_abort_silent();
    } else {
	if (mlev < LMAGE) {
	    if (!control_process(ProgUID, oper1->data.number)) {
		abort_interp(tp_noperm_mesg);
            }
        }
        result = dequeue_process(oper1->data.number);
    }
    CLEAR(oper1);
    PushInt(result);
}