home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PERL4036.ZIP / lib / perldb.pl < prev    next >
Perl Script  |  1993-02-08  |  16KB  |  596 lines

  1. package DB;
  2.  
  3. # modified Perl debugger, to be run from Emacs in perldb-mode
  4. # Ray Lischner (uunet!mntgfx!lisch) as of 5 Nov 1990
  5. # Johan Vromans -- upgrade to 4.0 pl 10
  6.  
  7. $header = '$RCSfile: perldb.pl,v $$Revision: 4.0.1.3 $$Date: 92/06/08 13:43:57 $';
  8. #
  9. # This file is automatically included if you do perl -d.
  10. # It's probably not useful to include this yourself.
  11. #
  12. # Perl supplies the values for @line and %sub.  It effectively inserts
  13. # a do DB'DB(<linenum>); in front of every place that can
  14. # have a breakpoint.  It also inserts a do 'perldb.pl' before the first line.
  15. #
  16. # $Log:    perldb.pl,v $
  17. # Revision 4.0.1.3  92/06/08  13:43:57  lwall
  18. # patch20: support for MSDOS folded into perldb.pl
  19. # patch20: perldb couldn't debug file containing '-', such as STDIN designator
  20. # Revision 4.0.1.2  91/11/05  17:55:58  lwall
  21. # patch11: perldb.pl modified to run within emacs in perldb-mode
  22. # Revision 4.0.1.1  91/06/07  11:17:44  lwall
  23. # patch4: added $^P variable to control calling of perldb routines
  24. # patch4: debugger sometimes listed wrong number of lines for a statement
  25. # Revision 4.0  91/03/20  01:25:50  lwall
  26. # 4.0 baseline.
  27. # Revision 3.0.1.6  91/01/11  18:08:58  lwall
  28. # patch42: @_ couldn't be accessed from debugger
  29. # Revision 3.0.1.5  90/11/10  01:40:26  lwall
  30. # patch38: the debugger wouldn't stop correctly or do action routines
  31. # Revision 3.0.1.4  90/10/15  17:40:38  lwall
  32. # patch29: added caller
  33. # patch29: the debugger now understands packages and evals
  34. # patch29: scripts now run at almost full speed under the debugger
  35. # patch29: more variables are settable from debugger
  36. # Revision 3.0.1.3  90/08/09  04:00:58  lwall
  37. # patch19: debugger now allows continuation lines
  38. # patch19: debugger can now dump lists of variables
  39. # patch19: debugger can now add aliases easily from prompt
  40. # Revision 3.0.1.2  90/03/12  16:39:39  lwall
  41. # patch13: perl -d didn't format stack traces of *foo right
  42. # patch13: perl -d wiped out scalar return values of subroutines
  43. # Revision 3.0.1.1  89/10/26  23:14:02  lwall
  44. # patch1: RCS expanded an unintended $Header in lib/perldb.pl
  45. # Revision 3.0  89/10/18  15:19:46  lwall
  46. # 3.0 baseline
  47. # Revision 2.0  88/06/05  00:09:45  root
  48. # Baseline version 2.0.
  49. #
  50.  
  51. if (-e "/dev/tty") {
  52.     $console = "/dev/tty";
  53.     $rcfile=".perldb";
  54. }
  55. else {
  56.     $console = "con";
  57.     $rcfile="perldb.ini";
  58. }
  59.  
  60. open(IN, "<$console") || open(IN,  "<&STDIN");    # so we don't dingle stdin
  61. open(OUT,">$console") || open(OUT, ">&STDOUT");    # so we don't dongle stdout
  62. select(OUT);
  63. $| = 1;                # for DB'OUT
  64. select(STDOUT);
  65. $| = 1;                # for real STDOUT
  66. $sub = '';
  67.  
  68. # Is Perl being run from Emacs?
  69. $emacs = $main'ARGV[$[] eq '-emacs';
  70. shift(@main'ARGV) if $emacs;
  71.  
  72. $header =~ s/.Header: ([^,]+),v(\s+\S+\s+\S+).*$/$1$2/;
  73. print OUT "\nLoading DB routines from $header\n";
  74. print OUT ("Emacs support ",
  75.        $emacs ? "enabled" : "available",
  76.        ".\n");
  77. print OUT "\nEnter h for help.\n\n";
  78.  
  79. sub DB {
  80.     &save;
  81.     ($package, $filename, $line) = caller;
  82.     $usercontext = '($@, $!, $[, $,, $/, $\) = @saved;' .
  83.     "package $package;";        # this won't let them modify, alas
  84.     local($^P) = 0;            # don't debug our own evals
  85.     local(*dbline) = "_<$filename";
  86.     $max = $#dbline;
  87.     if (($stop,$action) = split(/\0/,$dbline{$line})) {
  88.     if ($stop eq '1') {
  89.         $signal |= 1;
  90.     }
  91.     else {
  92.         $evalarg = "\$DB'signal |= do {$stop;}"; &eval;
  93.         $dbline{$line} =~ s/;9($|\0)/$1/;
  94.     }
  95.     }
  96.     if ($single || $trace || $signal) {
  97.     if ($emacs) {
  98.         print OUT "\032\032$filename:$line:0\n";
  99.     } else {
  100.         print OUT "$package'" unless $sub =~ /'/;
  101.         print OUT "$sub($filename:$line):\t",$dbline[$line];
  102.         for ($i = $line + 1; $i <= $max && $dbline[$i] == 0; ++$i) {
  103.         last if $dbline[$i] =~ /^\s*(}|#|\n)/;
  104.         print OUT "$sub($filename:$i):\t",$dbline[$i];
  105.         }
  106.     }
  107.     }
  108.     $evalarg = $action, &eval if $action;
  109.     if ($single || $signal) {
  110.     $evalarg = $pre, &eval if $pre;
  111.     print OUT $#stack . " levels deep in subroutine calls!\n"
  112.         if $single & 4;
  113.     $start = $line;
  114.       CMD:
  115.     while ((print OUT "  DB<", $#hist+1, "> "), $cmd=&gets) {
  116.         {
  117.         $single = 0;
  118.         $signal = 0;
  119.         $cmd eq '' && exit 0;
  120.         chop($cmd);
  121.         $cmd =~ s/\\$// && do {
  122.             print OUT "  cont: ";
  123.             $cmd .= &gets;
  124.             redo CMD;
  125.         };
  126.         $cmd =~ /^q$/ && exit 0;
  127.         $cmd =~ /^$/ && ($cmd = $laststep);
  128.         push(@hist,$cmd) if length($cmd) > 1;
  129.         ($i) = split(/\s+/,$cmd);
  130.         eval "\$cmd =~ $alias{$i}", print OUT $@ if $alias{$i};
  131.         $cmd =~ /^h$/ && do {
  132.             print OUT "
  133. T        Stack trace.
  134. s        Single step.
  135. n        Next, steps over subroutine calls.
  136. r        Return from current subroutine.
  137. c [line]    Continue; optionally inserts a one-time-only breakpoint 
  138.         at the specified line.
  139. <CR>        Repeat last n or s.
  140. l min+incr    List incr+1 lines starting at min.
  141. l min-max    List lines.
  142. l line        List line;
  143. l        List next window.
  144. -        List previous window.
  145. w line        List window around line.
  146. l subname    List subroutine.
  147. f filename    Switch to filename.
  148. /pattern/    Search forwards for pattern; final / is optional.
  149. ?pattern?    Search backwards for pattern.
  150. L        List breakpoints and actions.
  151. S        List subroutine names.
  152. t        Toggle trace mode.
  153. b [line] [condition]
  154.         Set breakpoint; line defaults to the current execution line; 
  155.         condition breaks if it evaluates to true, defaults to \'1\'.
  156. b subname [condition]
  157.         Set breakpoint at first line of subroutine.
  158. d [line]    Delete breakpoint.
  159. D        Delete all breakpoints.
  160. a [line] command
  161.         Set an action to be done before the line is executed.
  162.         Sequence is: check for breakpoint, print line if necessary,
  163.         do action, prompt user if breakpoint or step, evaluate line.
  164. A        Delete all actions.
  165. V [pkg [vars]]    List some (default all) variables in package (default current).
  166. X [vars]    Same as \"V currentpackage [vars]\".
  167. < command    Define command before prompt.
  168. > command    Define command after prompt.
  169. ! number    Redo command (default previous command).
  170. ! -number    Redo number\'th to last command.
  171. H -number    Display last number commands (default all).
  172. q or ^D        Quit.
  173. p expr        Same as \"print DB'OUT expr\" in current package.
  174. = [alias value]    Define a command alias, or list current aliases.
  175. command        Execute as a perl statement in current package.
  176.  
  177. ";
  178.             next CMD; };
  179.         $cmd =~ /^t$/ && do {
  180.             $trace = !$trace;
  181.             print OUT "Trace = ".($trace?"on":"off")."\n";
  182.             next CMD; };
  183.         $cmd =~ /^S$/ && do {
  184.             foreach $subname (sort(keys %sub)) {
  185.             print OUT $subname,"\n";
  186.             }
  187.             next CMD; };
  188.         $cmd =~ s/^X\b/V $package/;
  189.         $cmd =~ /^V$/ && do {
  190.             $cmd = 'V $package'; };
  191.         $cmd =~ /^V\b\s*(\S+)\s*(.*)/ && do {
  192.             $packname = $1;
  193.             @vars = split(' ',$2);
  194.             do 'dumpvar.pl' unless defined &main'dumpvar;
  195.             if (defined &main'dumpvar) {
  196.             &main'dumpvar($packname,@vars);
  197.             }
  198.             else {
  199.             print DB'OUT "dumpvar.pl not available.\n";
  200.             }
  201.             next CMD; };
  202.         $cmd =~ /^f\b\s*(.*)/ && do {
  203.             $file = $1;
  204.             if (!$file) {
  205.             print OUT "The old f command is now the r command.\n";
  206.             print OUT "The new f command switches filenames.\n";
  207.             next CMD;
  208.             }
  209.             if (!defined $_main{'_<' . $file}) {
  210.             if (($try) = grep(m#^_<.*$file#, keys %_main)) {
  211.                 $file = substr($try,2);
  212.                 print "\n$file:\n";
  213.             }
  214.             }
  215.             if (!defined $_main{'_<' . $file}) {
  216.             print OUT "There's no code here anything matching $file.\n";
  217.             next CMD;
  218.             }
  219.             elsif ($file ne $filename) {
  220.             *dbline = "_<$file";
  221.             $max = $#dbline;
  222.             $filename = $file;
  223.             $start = 1;
  224.             $cmd = "l";
  225.             } };
  226.         $cmd =~ /^l\b\s*(['A-Za-z_]['\w]*)/ && do {
  227.             $subname = $1;
  228.             $subname = "main'" . $subname unless $subname =~ /'/;
  229.             $subname = "main" . $subname if substr($subname,0,1) eq "'";
  230.             ($file,$subrange) = split(/:/,$sub{$subname});
  231.             if ($file ne $filename) {
  232.             *dbline = "_<$file";
  233.             $max = $#dbline;
  234.             $filename = $file;
  235.             }
  236.             if ($subrange) {
  237.             if (eval($subrange) < -$window) {
  238.                 $subrange =~ s/-.*/+/;
  239.             }
  240.             $cmd = "l $subrange";
  241.             } else {
  242.             print OUT "Subroutine $1 not found.\n";
  243.             next CMD;
  244.             } };
  245.         $cmd =~ /^w\b\s*(\d*)$/ && do {
  246.             $incr = $window - 1;
  247.             $start = $1 if $1;
  248.             $start -= $preview;
  249.             $cmd = 'l ' . $start . '-' . ($start + $incr); };
  250.         $cmd =~ /^-$/ && do {
  251.             $incr = $window - 1;
  252.             $cmd = 'l ' . ($start-$window*2) . '+'; };
  253.         $cmd =~ /^l$/ && do {
  254.             $incr = $window - 1;
  255.             $cmd = 'l ' . $start . '-' . ($start + $incr); };
  256.         $cmd =~ /^l\b\s*(\d*)\+(\d*)$/ && do {
  257.             $start = $1 if $1;
  258.             $incr = $2;
  259.             $incr = $window - 1 unless $incr;
  260.             $cmd = 'l ' . $start . '-' . ($start + $incr); };
  261.         $cmd =~ /^l\b\s*(([\d\$\.]+)([-,]([\d\$\.]+))?)?/ && do {
  262.             $end = (!$2) ? $max : ($4 ? $4 : $2);
  263.             $end = $max if $end > $max;
  264.             $i = $2;
  265.             $i = $line if $i eq '.';
  266.             $i = 1 if $i < 1;
  267.             if ($emacs) {
  268.             print OUT "\032\032$filename:$i:0\n";
  269.             $i = $end;
  270.             } else {
  271.             for (; $i <= $end; $i++) {
  272.                 print OUT "$i:\t", $dbline[$i];
  273.                 last if $signal;
  274.             }
  275.             }
  276.             $start = $i;    # remember in case they want more
  277.             $start = $max if $start > $max;
  278.             next CMD; };
  279.         $cmd =~ /^D$/ && do {
  280.             print OUT "Deleting all breakpoints...\n";
  281.             for ($i = 1; $i <= $max ; $i++) {
  282.             if (defined $dbline{$i}) {
  283.                 $dbline{$i} =~ s/^[^\0]+//;
  284.                 if ($dbline{$i} =~ s/^\0?$//) {
  285.                 delete $dbline{$i};
  286.                 }
  287.             }
  288.             }
  289.             next CMD; };
  290.         $cmd =~ /^L$/ && do {
  291.             for ($i = 1; $i <= $max; $i++) {
  292.             if (defined $dbline{$i}) {
  293.                 print OUT "$i:\t", $dbline[$i];
  294.                 ($stop,$action) = split(/\0/, $dbline{$i});
  295.                 print OUT "  break if (", $stop, ")\n" 
  296.                 if $stop;
  297.                 print OUT "  action:  ", $action, "\n" 
  298.                 if $action;
  299.                 last if $signal;
  300.             }
  301.             }
  302.             next CMD; };
  303.         $cmd =~ /^b\b\s*(['A-Za-z_]['\w]*)\s*(.*)/ && do {
  304.             $subname = $1;
  305.             $cond = $2 || '1';
  306.             $subname = "$package'" . $subname unless $subname =~ /'/;
  307.             $subname = "main" . $subname if substr($subname,0,1) eq "'";
  308.             ($filename,$i) = split(/:/, $sub{$subname});
  309.             $i += 0;
  310.             if ($i) {
  311.             *dbline = "_<$filename";
  312.             ++$i while $dbline[$i] == 0 && $i < $#dbline;
  313.             $dbline{$i} =~ s/^[^\0]*/$cond/;
  314.             } else {
  315.             print OUT "Subroutine $subname not found.\n";
  316.             }
  317.             next CMD; };
  318.         $cmd =~ /^b\b\s*(\d*)\s*(.*)/ && do {
  319.             $i = ($1?$1:$line);
  320.             $cond = $2 || '1';
  321.             if ($dbline[$i] == 0) {
  322.             print OUT "Line $i not breakable.\n";
  323.             } else {
  324.             $dbline{$i} =~ s/^[^\0]*/$cond/;
  325.             }
  326.             next CMD; };
  327.         $cmd =~ /^d\b\s*(\d+)?/ && do {
  328.             $i = ($1?$1:$line);
  329.             $dbline{$i} =~ s/^[^\0]*//;
  330.             delete $dbline{$i} if $dbline{$i} eq '';
  331.             next CMD; };
  332.         $cmd =~ /^A$/ && do {
  333.             for ($i = 1; $i <= $max ; $i++) {
  334.             if (defined $dbline{$i}) {
  335.                 $dbline{$i} =~ s/\0[^\0]*//;
  336.                 delete $dbline{$i} if $dbline{$i} eq '';
  337.             }
  338.             }
  339.             next CMD; };
  340.         $cmd =~ /^<\s*(.*)/ && do {
  341.             $pre = do action($1);
  342.             next CMD; };
  343.         $cmd =~ /^>\s*(.*)/ && do {
  344.             $post = do action($1);
  345.             next CMD; };
  346.         $cmd =~ /^a\b\s*(\d+)(\s+(.*))?/ && do {
  347.             $i = $1;
  348.             if ($dbline[$i] == 0) {
  349.             print OUT "Line $i may not have an action.\n";
  350.             } else {
  351.             $dbline{$i} =~ s/\0[^\0]*//;
  352.             $dbline{$i} .= "\0" . do action($3);
  353.             }
  354.             next CMD; };
  355.         $cmd =~ /^n$/ && do {
  356.             $single = 2;
  357.             $laststep = $cmd;
  358.             last CMD; };
  359.         $cmd =~ /^s$/ && do {
  360.             $single = 1;
  361.             $laststep = $cmd;
  362.             last CMD; };
  363.         $cmd =~ /^c\b\s*(\d*)\s*$/ && do {
  364.             $i = $1;
  365.             if ($i) {
  366.             if ($dbline[$i] == 0) {
  367.                 print OUT "Line $i not breakable.\n";
  368.                 next CMD;
  369.             }
  370.             $dbline{$i} =~ s/(\0|$)/;9$1/;    # add one-time-only b.p.
  371.             }
  372.             for ($i=0; $i <= $#stack; ) {
  373.             $stack[$i++] &= ~1;
  374.             }
  375.             last CMD; };
  376.         $cmd =~ /^r$/ && do {
  377.             $stack[$#stack] |= 2;
  378.             last CMD; };
  379.         $cmd =~ /^T$/ && do {
  380.             local($p,$f,$l,$s,$h,$a,@a,@sub);
  381.             for ($i = 1; ($p,$f,$l,$s,$h,$w) = caller($i); $i++) {
  382.             @a = @args;
  383.             for (@a) {
  384.                 if (/^StB\000/ && length($_) == length($_main{'_main'})) {
  385.                 $_ = sprintf("%s",$_);
  386.                 }
  387.                 else {
  388.                 s/'/\\'/g;
  389.                 s/([^\0]*)/'$1'/ unless /^-?[\d.]+$/;
  390.                 s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
  391.                 s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
  392.                 }
  393.             }
  394.             $w = $w ? '@ = ' : '$ = ';
  395.             $a = $h ? '(' . join(', ', @a) . ')' : '';
  396.             push(@sub, "$w&$s$a from file $f line $l\n");
  397.             last if $signal;
  398.             }
  399.             for ($i=0; $i <= $#sub; $i++) {
  400.             last if $signal;
  401.             print OUT $sub[$i];
  402.             }
  403.             next CMD; };
  404.         $cmd =~ /^\/(.*)$/ && do {
  405.             $inpat = $1;
  406.             $inpat =~ s:([^\\])/$:$1:;
  407.             if ($inpat ne "") {
  408.             eval '$inpat =~ m'."\n$inpat\n";    
  409.             if ($@ ne "") {
  410.                 print OUT "$@";
  411.                 next CMD;
  412.             }
  413.             $pat = $inpat;
  414.             }
  415.             $end = $start;
  416.             eval '
  417.             for (;;) {
  418.             ++$start;
  419.             $start = 1 if ($start > $max);
  420.             last if ($start == $end);
  421.             if ($dbline[$start] =~ m'."\n$pat\n".'i) {
  422.                 if ($emacs) {
  423.                 print OUT "\032\032$filename:$start:0\n";
  424.                 } else {
  425.                 print OUT "$start:\t", $dbline[$start], "\n";
  426.                 }
  427.                 last;
  428.             }
  429.             } ';
  430.             print OUT "/$pat/: not found\n" if ($start == $end);
  431.             next CMD; };
  432.         $cmd =~ /^\?(.*)$/ && do {
  433.             $inpat = $1;
  434.             $inpat =~ s:([^\\])\?$:$1:;
  435.             if ($inpat ne "") {
  436.             eval '$inpat =~ m'."\n$inpat\n";    
  437.             if ($@ ne "") {
  438.                 print OUT "$@";
  439.                 next CMD;
  440.             }
  441.             $pat = $inpat;
  442.             }
  443.             $end = $start;
  444.             eval '
  445.             for (;;) {
  446.             --$start;
  447.             $start = $max if ($start <= 0);
  448.             last if ($start == $end);
  449.             if ($dbline[$start] =~ m'."\n$pat\n".'i) {
  450.                 if ($emacs) {
  451.                 print OUT "\032\032$filename:$start:0\n";
  452.                 } else {
  453.                 print OUT "$start:\t", $dbline[$start], "\n";
  454.                 }
  455.                 last;
  456.             }
  457.             } ';
  458.             print OUT "?$pat?: not found\n" if ($start == $end);
  459.             next CMD; };
  460.         $cmd =~ /^!+\s*(-)?(\d+)?$/ && do {
  461.             pop(@hist) if length($cmd) > 1;
  462.             $i = ($1?($#hist-($2?$2:1)):($2?$2:$#hist));
  463.             $cmd = $hist[$i] . "\n";
  464.             print OUT $cmd;
  465.             redo CMD; };
  466.         $cmd =~ /^!(.+)$/ && do {
  467.             $pat = "^$1";
  468.             pop(@hist) if length($cmd) > 1;
  469.             for ($i = $#hist; $i; --$i) {
  470.             last if $hist[$i] =~ $pat;
  471.             }
  472.             if (!$i) {
  473.             print OUT "No such command!\n\n";
  474.             next CMD;
  475.             }
  476.             $cmd = $hist[$i] . "\n";
  477.             print OUT $cmd;
  478.             redo CMD; };
  479.         $cmd =~ /^H\b\s*(-(\d+))?/ && do {
  480.             $end = $2?($#hist-$2):0;
  481.             $hist = 0 if $hist < 0;
  482.             for ($i=$#hist; $i>$end; $i--) {
  483.             print OUT "$i: ",$hist[$i],"\n"
  484.                 unless $hist[$i] =~ /^.?$/;
  485.             };
  486.             next CMD; };
  487.         $cmd =~ s/^p( .*)?$/print DB'OUT$1/;
  488.         $cmd =~ /^=/ && do {
  489.             if (local($k,$v) = ($cmd =~ /^=\s*(\S+)\s+(.*)/)) {
  490.             $alias{$k}="s~$k~$v~";
  491.             print OUT "$k = $v\n";
  492.             } elsif ($cmd =~ /^=\s*$/) {
  493.             foreach $k (sort keys(%alias)) {
  494.                 if (($v = $alias{$k}) =~ s~^s\~$k\~(.*)\~$~$1~) {
  495.                 print OUT "$k = $v\n";
  496.                 } else {
  497.                 print OUT "$k\t$alias{$k}\n";
  498.                 };
  499.             };
  500.             };
  501.             next CMD; };
  502.         }
  503.         $evalarg = $cmd; &eval;
  504.         print OUT "\n";
  505.     }
  506.     if ($post) {
  507.         $evalarg = $post; &eval;
  508.     }
  509.     }
  510.     ($@, $!, $[, $,, $/, $\) = @saved;
  511. }
  512.  
  513. sub save {
  514.     @saved = ($@, $!, $[, $,, $/, $\);
  515.     $[ = 0; $, = ""; $/ = "\n"; $\ = "";
  516. }
  517.  
  518. # The following takes its argument via $evalarg to preserve current @_
  519.  
  520. sub eval {
  521.     eval "$usercontext $evalarg; &DB'save";
  522.     print OUT $@;
  523. }
  524.  
  525. sub action {
  526.     local($action) = @_;
  527.     while ($action =~ s/\\$//) {
  528.     print OUT "+ ";
  529.     $action .= &gets;
  530.     }
  531.     $action;
  532. }
  533.  
  534. sub gets {
  535.     local($.);
  536.     <IN>;
  537. }
  538.  
  539. sub catch {
  540.     $signal = 1;
  541. }
  542.  
  543. sub sub {
  544.     push(@stack, $single);
  545.     $single &= 1;
  546.     $single |= 4 if $#stack == $deep;
  547.     if (wantarray) {
  548.     @i = &$sub;
  549.     $single |= pop(@stack);
  550.     @i;
  551.     }
  552.     else {
  553.     $i = &$sub;
  554.     $single |= pop(@stack);
  555.     $i;
  556.     }
  557. }
  558.  
  559. $single = 1;            # so it stops on first executable statement
  560. @hist = ('?');
  561. $SIG{'INT'} = "DB'catch";
  562. $deep = 100;        # warning if stack gets this deep
  563. $window = 10;
  564. $preview = 3;
  565.  
  566. @stack = (0);
  567. @ARGS = @ARGV;
  568. for (@args) {
  569.     s/'/\\'/g;
  570.     s/(.*)/'$1'/ unless /^-?[\d.]+$/;
  571. }
  572.  
  573. if (-f $rcfile) {
  574.     do "./$rcfile";
  575. }
  576. elsif (-f "$ENV{'LOGDIR'}/$rcfile") {
  577.     do "$ENV{'LOGDIR'}/$rcfile";
  578. }
  579. elsif (-f "$ENV{'HOME'}/$rcfile") {
  580.     do "$ENV{'HOME'}/$rcfile";
  581. }
  582.  
  583. 1;
  584.