@program cmd-@aname
1 9999 d
i
( cmd-@aname    v1.1    Jessy @ FurryMUCK    5/97, 3/01
  
  A small utility that lets you add an alias to an exit name without
  retyping the whole thing.
  
  INSTALLATION:
  
  Create a global action with a name such as `@aname' and link it 
  to this program.
  
  USE:
  
    @aname <action> = <alias name>
  
  cmd-@aname may be freely ported. Please comment any changes.
)
 
lvar ourString
 
$include $lib/match
  
: DoHelp  (  --  )                         (* show simple help screen *)
    
    " " .tell
		prog name " (#" strcat prog intostr strcat ")" strcat .tell
    " " .tell

    "This command adds an alias name to an existing exit/action." .tell
    "Syntax: $command <object> = <alias> 
		command @ "$command" subst .tell
;
  
: main
    
    dup "#help" swap stringpfx if               (* check: wants help? *)
        DoHelp exit
    then
    dup strip                                                (* parse *)
    dup "=" instr not if
      "Usage: $cmd ="
      command @ "$cmd" subst me @ swap notify exit
    then
    dup "=" instr strcut strip ourString !
    dup strlen 1 - strcut pop strip
    .noisy_match
    dup not if
        exit
    then                                 (* check: is target an exit? *)
    dup exit? not if
       ">>  This command is only for exits." .tell exit
    then      
    dup me @ controls not if                      (* check permission *)
       ">>  Permission denied." .tell exit
    then                                           (* check: ok name? *)
    ourString @ "{home|me|here|#*}" smatch if
       "That's a strange name for an action!" .tell exit
    then                                       (* append alias string *)
    dup dup name ";" strcat ourString @ strcat setname
    ">>  Name set to " swap name strcat .tell
;
.
c
q