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); }
const char * mfn_kill(MFUNARGS) { int i = atoi(argv[0]); if (i > 0) { if (in_timequeue(i)) { if (!control_process(perms, i)) { ABORT_MPI("KILL",NOPERM_MESG); } i = dequeue_process(i); } else { i = 0; } } else if (i == 0) { i = dequeue_prog(perms, 0); } else { ABORT_MPI("KILL","Invalid process ID"); } sprintf(buf, "%d", i); return buf; }
void do_dequeue(int descr, dbref player, const char *arg1) { char buf[BUFFER_LEN]; int count; dbref match; struct match_data md; timequeue tmp, ptr = tqhead; if (*arg1 == '\0') { notify_nolisten(player, "What event do you want to dequeue?", 1); } else { if (!string_compare(arg1, "all")) { if (!Wizard(OWNER(player))) { notify_nolisten(player, "Permission denied", 1); return; } while (ptr) { tmp = ptr; tqhead = ptr = ptr->next; free_timenode(tmp); process_count--; } tqhead = NULL; muf_event_dequeue(NOTHING, 0); notify_nolisten(player, "Time queue cleared.", 1); } else { if (!number(arg1)) { init_match(descr, player, arg1, NOTYPE, &md); match_absolute(&md); match_everything(&md); match = noisy_match_result(&md); if (match == NOTHING) { notify_nolisten(player, "I don't know what you want to dequeue!", 1); return; } if (!valid_objref(match)) { notify_nolisten(player, "I don't recognize that object.", 1); return; } if ((!Wizard(OWNER(player))) && (OWNER(match) != OWNER(player))) { notify_nolisten(player, "Permission denied.", 1); return; } count = dequeue_prog(match, 0); if (!count) { notify_nolisten(player, "That program wasn't in the time queue.", 1); return; } if (count > 1) { snprintf(buf, sizeof(buf), "%d processes dequeued.", count); } else { snprintf(buf, sizeof(buf), "Process dequeued."); } notify_nolisten(player, buf, 1); } else { if ((count = atoi(arg1))) { if (!(control_process(player, count))) { notify_nolisten(player, "Permission denied.", 1); return; } if (!(dequeue_process(count))) { notify_nolisten(player, "No such process!", 1); return; } process_count--; notify_nolisten(player, "Process dequeued.", 1); } else { notify_nolisten(player, "What process do you want to dequeue?", 1); } } } } return; }