MudOSa4DGD/
MudOSa4DGD/bin/
MudOSa4DGD/data/
MudOSa4DGD/doc/
MudOSa4DGD/doc/driver/
MudOSa4DGD/doc/efun/bitstrings/
MudOSa4DGD/doc/efun/command/
MudOSa4DGD/doc/efun/communication/
MudOSa4DGD/doc/efun/heart_beat/
MudOSa4DGD/doc/efun/interactive/
MudOSa4DGD/doc/efun/inventory/
MudOSa4DGD/doc/efun/living/
MudOSa4DGD/doc/efun/mappings/
MudOSa4DGD/doc/efun/strings/
MudOSa4DGD/doc/efun/uid/
MudOSa4DGD/doc/funs/
MudOSa4DGD/doc/language/
MudOSa4DGD/mudlib/dgd/doc/
MudOSa4DGD/mudlib/dgd/lib/include/dgd/
MudOSa4DGD/mudlib/dgd/lib/std/
MudOSa4DGD/mudlib/dgd/lib/sys/
MudOSa4DGD/mudlib/dgd/log/
MudOSa4DGD/mudlib/log/
MudOSa4DGD/mudlib/std/include/
MudOSa4DGD/mudlib/std/obj/
/*
 * illegal.c
 *
 * SFUN: Illegal operation encountered (security)
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */

#include <objects.h>


/* handle illegal operation */
static varargs void illegal(string msg) {
  if (1) {
    /* security check passed */
    object ob;
    string extra;

    ob=previous_object();
    if (!msg) {
      /* default illegal message */
      msg = "Illegal "+previous_function()+" in "+
        file_name()+".";
    }
    else
      msg += "  ("+previous_function()+" in "+
        file_name()+")";

    /* about source */
    extra = "\n   ";
    extra += ob ? "Called by: "+file_name(ob) : "";
    extra += ", "+previous_function(1)+"()";
#ifdef MUDOS_USER_ID
    extra += " (uid/euid: "+
      getuid(ob)+"/"+geteuid(ob)+")";
    extra += this_player1() ? 
	    "\n   TP1="+geteuid(this_player1()) :
	      "";
#endif

    /* log to file <message> (uid/euid: xxxx/yyyy TP: Zzzz) */
    log_file("ILLEGAL", "\n-->"+msg+extra+"\n");

#ifdef INFORM_DRIVER
    /* report this */
    DRIVER->notify(msg+extra);
#endif

#if 0
    /* finally handle as a catched error */
    catch(error(msg));
#endif
  }
  return;
}