- # strip out any nasty characters like $@%&|. and double // etc.
- $cmd =~ s/[%\@\$&\\.`~]//og;
- $cmd =~ s|//|/|og;
-
- # split the command up into parts
- my @part = split /[\/\b]+/, $cmd;
-
- # the bye command - temporary probably
- if ($part[0] =~ /^b/io) {
- $self->user_finish();
- $self->state('bye');
- return;
+ # split the command line up into parts, the first part is the command
+ my ($cmd, $args) = $cmdline =~ /^([\w\/]+)\s*(.*)/o;
+
+ if ($cmd) {
+
+ # first expand out the entry to a command
+ $cmd = search($cmd);
+
+ my @ans = $self->eval_file($main::localcmd, $cmd, $args);
+ @ans = $self->eval_file($main::cmd, $cmd, $args) if !$ans[0];
+ if ($ans[0]) {
+ shift @ans;
+ $self->send(@ans) if @ans > 0;
+ } else {
+ shift @ans;
+ if (@ans > 0) {
+ $self->msg('e2', @ans);
+ } else {
+ $self->msg('e1');
+ }
+ }
+ } else {
+ $self->msg('e1');