& @decompile
@decompile[</switch>] <object>[/<attribute-pattern>]
- @decompile/tf <object>/<attrib>
+ @decompile/prefix <object>[/<attribute-pattern>]=<prefix>
This command produces a list of the commands that you would have to
enter in order to recreate <object>. Useful for either copying objects
from one MUSH to another, or for making logs of important objects to
protect against an accidental @nuke or a crash.
+ When the /prefix switch is specified, and a prefix is given, all output
+ lines will be prefixed with <prefix>. Good for creating client-side
+ scripts to edit code with.
+
You can either @decompile an entire object, or just certain parts of it.
To @decompile just a few attributes, for example, you could type:
(continued in help @decompile3)
& @decompile3
- @decompile/tf <object>/<attribute>
+ @decompile/tf <object>[/<attribute>]
+
+ Supplying the /tf switch makes @decompile act exactly as if you typed:
+ @decompile/prefix <object>[/<attribute>]=FugueEdit >%b
- The /tf switch is useful only for users of the popular "TinyFugue"
- client program (available from ftp.tcp.com in the directory
- /pub/muds/Clients/tinyfugue). If you do have this program, this
- switch is invaluable for editing code online, because it will grab the
- code to set that attribute and put it into your buffer.
+ You can use a string other than "FugueEdit > " by setting your TFPREFIX
+ attribute. You are strongly urged to do so. Using @decompile/tf with
+ the default prefix presents the opportunity for a malicious player
+ to load your TinyFugue command line with a harmful command for you to
+ execute inadvertently.
- To use @dec/tf, first type this command into TinyFugue:
+ The /tf switch is handy for grabbing code and placing it right
+ into your input window. To do this:
- /def -ag -mglob -p100 -t"FugueEdit > *" fe = /grab %-2
+ In TinyFugue:
+ /def -ag -mglob -p100 -t"FugueEdit > *" fe = /grab %-2
- (you can also put this into your .tfrc so it will automatically
- be entered every time you start TinyFugue (tf).) This command works
- just like the 'FugueEdit' object originally created by van@TinyTIM.
+ In SimpleMU:
+ Set your Options -> Grab Password
+ @set me=tfprefix:<grabpassword>FugueEdit >%b
- You can use a string other than "FugueEdit > " by setting your
- TFPREFIX attribute. This is probably a good idea.
See also: CLIENTS, ATTRIBUTES, WILDCARDS, MUSHCODE
& @describe
@describe <object> [=<description>]
enum ent_type { ENT_EXITS, ENT_THINGS, ENT_PLAYERS, ENT_ROOMS, ENT_ALL };
extern void do_entrances(dbref player, const char *where, char **argv,
enum ent_type val);
-enum dec_type { DEC_NORMAL, DEC_DB, DEC_TF, DEC_FLAG, DEC_ATTR };
-extern void do_decompile
- (dbref player, const char *name, enum dec_type dbflag, int skipdef);
+enum dec_type { DEC_NORMAL, DEC_DB, DEC_FLAG, DEC_ATTR };
+extern void do_decompile(dbref player, const char *name, const char *prefix,
+ enum dec_type dbflag, int skipdef);
/* From move.c */
extern void do_get(dbref player, const char *what);
PLAYERS
PORT
POWERS
+PREFIX
PRESERVE
PRINT
PRIVS
}
COMMAND (cmd_decompile) {
- if (SW_ISSET(sw, SWITCH_DB))
- do_decompile(player, arg_left, DEC_DB, SW_ISSET(sw, SWITCH_SKIPDEFAULTS));
- else if (SW_ISSET(sw, SWITCH_TF))
- do_decompile(player, arg_left, DEC_TF, SW_ISSET(sw, SWITCH_SKIPDEFAULTS));
+ char prefix[BUFFER_LEN];
+ int sd = SW_ISSET(sw, SWITCH_SKIPDEFAULTS);
+ *prefix = '\0';
+ if (SW_ISSET(sw, SWITCH_TF)) {
+ /* @dec/tf overrides @dec/prefix */
+ ATTR *a;
+ if (((a = atr_get_noparent(player, "TFPREFIX")) != NULL) &&
+ AL_STR(a) && *AL_STR(a)) {
+ strcpy(prefix, atr_value(a));
+ } else {
+ strcpy(prefix, "FugueEdit > ");
+ }
+ } else if (SW_ISSET(sw, SWITCH_PREFIX)) {
+ strcpy(prefix, arg_right);
+ }
+ if (SW_ISSET(sw, SWITCH_DB) || SW_ISSET(sw, SWITCH_TF))
+ do_decompile(player, arg_left, prefix, DEC_DB, sd);
else if (SW_ISSET(sw, SWITCH_FLAGS))
- do_decompile(player, arg_left, DEC_FLAG, SW_ISSET(sw, SWITCH_SKIPDEFAULTS));
+ do_decompile(player, arg_left, prefix, DEC_FLAG, sd);
else if (SW_ISSET(sw, SWITCH_ATTRIBS))
- do_decompile(player, arg_left, DEC_ATTR, SW_ISSET(sw, SWITCH_SKIPDEFAULTS));
+ do_decompile(player, arg_left, prefix, DEC_ATTR, sd);
else
- do_decompile(player, arg_left, DEC_NORMAL,
- SW_ISSET(sw, SWITCH_SKIPDEFAULTS));
+ do_decompile(player, arg_left, prefix, DEC_NORMAL, sd);
}
COMMAND (cmd_teach) {
#endif
{"@DBCK", NULL, cmd_dbck, CMD_T_ANY, "POWER^SITE"},
- {"@DECOMPILE", "DB TF FLAGS ATTRIBS SKIPDEFAULTS", cmd_decompile,
+ {"@DECOMPILE", "DB PREFIX TF FLAGS ATTRIBS SKIPDEFAULTS", cmd_decompile,
CMD_T_ANY, NULL},
{"@DESTROY", "OVERRIDE", cmd_destroy, CMD_T_ANY, NULL},
* \param skipdef if true, skip showing default flags on attributes/locks.
*/
void
-do_decompile(dbref player, const char *name, enum dec_type dbflag, int skipdef)
+do_decompile(dbref player, const char *name, const char *prefix,
+ enum dec_type dbflag, int skipdef)
{
dbref thing;
const char *object = NULL;
char *attrib;
- ATTR *a;
char dbnum[40];
/* @decompile must always have an argument */
if (attrib && *attrib) {
switch (dbflag) {
case DEC_DB:
- decompile_atrs(player, thing, dbnum, attrib, "", skipdef);
- break;
- case DEC_TF:
- if (((a = atr_get_noparent(player, "TFPREFIX")) != NULL) &&
- AL_STR(a) && *AL_STR(a)) {
- decompile_atrs(player, thing, dbnum, attrib, atr_value(a), skipdef);
- } else
- decompile_atrs(player, thing, dbnum, attrib, "FugueEdit > ", skipdef);
+ decompile_atrs(player, thing, dbnum, attrib, prefix, skipdef);
break;
default:
if (IsRoom(thing))
- decompile_atrs(player, thing, "here", attrib, "", skipdef);
+ decompile_atrs(player, thing, "here", attrib, prefix, skipdef);
else
- decompile_atrs(player, thing, Name(thing), attrib, "", skipdef);
+ decompile_atrs(player, thing, Name(thing), attrib, prefix, skipdef);
break;
}
return;
} else
object = Name(thing);
if (dbflag != DEC_ATTR)
- notify_format(player, "@create %s", object);
+ notify_format(player, "%s@create %s", prefix, object);
break;
case TYPE_ROOM:
if (dbflag == DEC_DB) {
} else
object = "here";
if (dbflag != DEC_ATTR)
- notify_format(player, "@dig/teleport %s", Name(thing));
+ notify_format(player, "%s@dig/teleport %s", prefix, Name(thing));
break;
case TYPE_EXIT:
if (dbflag == DEC_DB) {
} else {
object = shortname(thing);
if (dbflag != DEC_ATTR)
- notify_format(player, "@open %s", Name(thing));
+ notify_format(player, "%s@open %s", prefix, Name(thing));
}
break;
case TYPE_DIVISION:
object = shortname(thing);
}
if (dbflag != DEC_ATTR)
- notify_format(player, "@division/create %s", object);
+ notify_format(player, "%s@division/create %s", prefix, object);
break;
}
if (dbflag != DEC_ATTR) {
if (Mobile(thing)) {
if (GoodObject(Home(thing)))
- notify_format(player, "@link %s = #%d", object, Home(thing));
+ notify_format(player, "%s@link %s = #%d", prefix, object, Home(thing));
else if (Home(thing) == HOME)
- notify_format(player, "@link %s = HOME", object);
+ notify_format(player, "%s@link %s = HOME", prefix, object);
} else {
if (GoodObject(Destination(thing)))
- notify_format(player, "@link %s = #%d", object, Destination(thing));
+ notify_format(player, "%s@link %s = #%d", prefix, object,
+ Destination(thing));
else if (Destination(thing) == AMBIGUOUS)
- notify_format(player, "@link %s = VARIABLE", object);
+ notify_format(player, "%s@link %s = VARIABLE", prefix, object);
else if (Destination(thing) == HOME)
- notify_format(player, "@link %s = HOME", object);
+ notify_format(player, "%s@link %s = HOME", prefix, object);
}
if (GoodObject(Zone(thing)))
- notify_format(player, "@chzone %s = #%d", object, Zone(thing));
+ notify_format(player, "%s@chzone %s = #%d", prefix, object, Zone(thing));
if (GoodObject(Parent(thing)))
- notify_format(player, "@parent %s = #%d", object, Parent(thing));
+ notify_format(player, "%s@parent %s=#%d", prefix, object, Parent(thing));
if (GoodObject(SDIV(thing).object) && IsDivision(SDIV(thing).object))
- notify_format(player, "@division %s = #%d", object, SDIV(thing).object);
+ notify_format(player, "%s@division %s = #%d", prefix, object,
+ SDIV(thing).object);
decompile_locks(player, thing, object, skipdef);
decompile_flags(player, thing, object);
decompile_powers(player, thing, object);
}
if (dbflag != DEC_FLAG) {
- decompile_atrs(player, thing, object, "**", "", skipdef);
+ decompile_atrs(player, thing, object, "**", prefix, skipdef);
}
}