simplified
[spider.git] / perl / DXCommandmode.pm
index 95039af60ef5ef477ddc77333660a246610c830a..5f89ac2369f7e28b48bec355ceacb12ad0627278 100644 (file)
@@ -437,8 +437,10 @@ sub run_cmd
        $args = "" unless defined $args;
                
        if ($cmd) {
-               # strip out // on command only
+               # strip out // and .. on command only
                $cmd =~ s|//|/|g;
+               $cmd =~ s|^/||g;                # no leading / either
+               $cmd =~ s|[^-\w/]||g;   # and no funny characters
                                        
                my ($path, $fcmd);
                        
@@ -454,7 +456,7 @@ sub run_cmd
                        
                # first expand out the entry to a command
                ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
-               ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
+               ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
 
                if ($path && $cmd) {
                        dbg("path: $cmd cmd: $fcmd") if isdbg('command');