+# find a cmd reference
+# this is really for use in user written stubs
+#
+# use the result as a symbolic reference:-
+#
+# no strict 'refs';
+# @out = &$r($self, $line);
+#
+sub find_cmd_ref
+{
+ my $cmd = shift;
+ my $r;
+
+ if ($cmd) {
+
+ # first expand out the entry to a command
+ my ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
+ ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
+
+ # make sure it is loaded
+ $r = find_cmd_name($path, $fcmd);
+ }
+ return $r;
+}
+
+#
+# this bit of magic finds a command in the offered directory
+sub find_cmd_name {