#	$eterna: edit,v 1.2 2001/08/12 15:57:11 mrg Exp $
#
# Blame this on Mycroft!mycroft@gnu.ai.mit.edu (Charles Hannum).
# 4-20-93

eval if (V < 19930420)
{
	alias xtype {
		if (rmatch($0 -lit*) > 0) { type $^\^^1- } { type $^\^^* }
	}
	echo *** edit: WARNING an XTYPE alias has been made. Use at your own
	echo *** edit: risk. Upgrade your client to ircII2.2.2 ASAP
}


alias edit {
  @ edit.name = toupper($0)
  @ edit.doer = [echo *** Unknown alias: $edit.name]
  ^on ^window "% % *" {
    if (mid(0 1 $2) == [	]) {
      @ edit.n = index(	 $mid(1 -1 $2-))
      @ edit.s = mid(1 $edit.n $2-)
      # Note:  This should be in $edit.doer, but a bug in ircII prevents it.
      type ^U
      @ edit.doer = [xtype -literal /alias $^\edit.s $^\mid(${(edit.n+2)} -1 $2-)]
      if (edit.name == edit.s) {
        ^on ^window "% % *"
      } {
        ^on ^window "% % *" @ edit.doer = [echo *** Ambiguous alias: $edit.name]
      }
    }
  }
  ^on ^window *
  alias $edit.name
  ^on window -"% % *"
  ^on window -"*"
  $edit.doer
  ^purge edit
}
