@q @program asys-rename 1 99999 d i ( asys-rename v1.2 Jessy @ FurryMUCK 6/97, 2/99 asys-rename runs Argo +rename command, which is used to change the name or names of an Argo command in a way that handles Argo props necessary for other commands to work as before. INSTALLATION: asys-rename uses the default Argo installation method. Port and install lib-argo. Set asys-rename W. Type '+install asys-rename' to install this program and its action. USAGE: +rename = Command names can include aliases. The first name in the string is the one that will be displayed on the +commands list. See lib-argo and the Argo manual for further information. asys-rename may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $include $lib/argo lvar scratch (* workspace var *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourArg (* inital arg string, unmodified *) lvar ourCom (* string: 'official' name of command *) : DoInstall ( -- ) (* install program into Argo system *) caller program? not if (* confirm installation method *) ">> Programs must be installed via the " "+install" GetCommandName strcat " command." strcat Tell exit then prog "@a/version" getpropstr if (* confirm re-install *) ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-rename" setprop RecOldActions #0 "+rename" newexit dup scratch ! (* create command *) prog setlink prog "@a/version" thisVersion setprop (* set version *) scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+rename" scratch @ setprop (* register command *) #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+rename" setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) prog "@a/name" getpropstr if #0 "@a/prog_list/" prog "@a/name" getpropstr strcat getprop not if ">> " prog name strcat " is not currently installed." strcat Tell pid kill then else ">> " prog name strcat " is not currently installed." strcat Tell pid kill then ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadYesNo not if ">> Aborted." Tell pid kill Then background "@a/comm_list/+rename" RemoveCommand #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell "asys-rename (#" prog intostr strcat ")" strcat Tell " " Tell command @ " is a staff-only command is used to rename Argo commands. Argo " "commands should not be renamed with the MUCK @name command, as " "this does not manipulate the props necessary in order for the " "Argo system to keep track of command names for such purposes as " "the +commands list or the +uninstall command." strcat strcat strcat strcat strcat Tell " " Tell "Syntax: " command @ strcat " = " strcat "" strcat Tell " " Tell "You can use +rename to give a command that includes aliases -- " "for example '+rename +staff=+staff;+monitors;+monitor'. The " "first name in the string is the command name that will appear " "in the commands list." strcat strcat strcat Tell ; : ShowSyntax ( -- ) (* display command syntax *) ">> Syntax: " command @ strcat " = " strcat Tell ; : GetShortName ( s -- s' ) (* return first command name in s *) dup ";" instr dup if 1 - strcut pop else pop then ; : DoRename ( -- ) (* rename a command *) (* check permission *) StaffCheck not if ">> Permission denied." Tell exit then (* check syntax *) ourArg @ not if ShowSyntax exit then ourArg @ "=" instr not if ShowSyntax exit then (* rename; add new +commands prop; add pointer in old +com prop *) ourArg @ "=" explode 2 = if swap strip ourCounter ! match dup if dup name scratch ! dup "@a/newname" ourCounter @ GetShortName setprop #0 "@a/comm_list/" scratch @ strcat "go to " OurCounter @ GetShortName strcat setprop #0 "@a/comm_list/" ourCounter @ GetShortName strcat 3 pick setprop ourCounter @ setname ">> Renamed." Tell ">> Please edit the online manual as appropriate." Tell else ">> Command not found." strcat then else ShowSyntax exit then ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! ourArg @ if ourArg @ "#" stringpfx if "#help" ourArg @ stringpfx if DoHelp else "#enable" ourArg @ stringpfx if DoEnable else "#disable" ourArg @ stringpfx if DoDisable else "#version" ourArg @ stringpfx if DoVersion else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then exit then then me @ ArgoPermCheck Disabled? DoRename ; . c q @set asys-rename=W