List of which.cgi

このファイルは、実行が許可されています。
Fri Jun 22 07:01:35 2018

戻る

TEXTAREA で表示(カット&ペーストむき)

#!/usr/local/bin/perl5
#    
# which.cgi
#    
# 2000/05/27 Ver.0.01   man.cgi から which 版を作成
#    
# (c) 2000 がま <gama@mvg.biglobe.ne.jp>
# 
# ----------------------------------------------------------------------
# usage:
#       which.cgi
#
# ----------------------------------------------------------------------
####   $which  ='/usr/ucb/which';          # which の所在  変更 2001/09/20
$which  ='/bin/which';                  # which の所在  変更 2001/09/20
$back   ='tools.htm';                   # 終了時の飛び先
# PATH を設定する ------------------------------------------------------
$ENV{'PATH'}    =  '/bin'
                . ':/usr/bin'
                . ':/usr/ucb'
                . ':/etc'
                . ':/usr/etc'
                . ':/usr/lib'
                . ':/usr/local/bin'
                . ':/usr/local/X11R6/bin'
                . ':/usr/local/bin/mh'
                . ':/usr/local/lib'
                . ':/usr/local/lib/mh'
                . ':/usr/local/sbin'
                . ':/usr/local/libexec'
                . ':/usr/local/canna/bin'
                ;
# ----------------------------------------------------------------------
$title =$ENV{'QUERY_STRING'};
$title =~ s/cmd=//;
$title =~ s/\+/ /g;
$title =~ s/%(..)/pack('c',hex($1))/ge;
$title =~ s/[^\w\ ]//g;                 # 英数字,"_",空白以外を削除
# ----------------------------------------------------------------------
$|=1;
print "Content-type: text/html\n\n";
print '<HTML><HEAD><TITLE>which</TITLE><BODY>';
print "<STRONG>which $title</STRONG>\n\n";
print '<HR>';
print "<PRE>\n";
if ($title) {
    open(PROC,"$which $title 2>&1 |");  # 実行
    while (<PROC>) {                    # 結果を読み出す
        chomp;
        print $_,"\n";
    }
    close(PROC);
}
# ----------------------------------------------------------------------
print "</PRE>\n";
print '<HR>';
print '<FORM ACTION="which.cgi" METHOD="GET">';
print 'which <INPUT TYPE="text" NAME="cmd" SIZE=80 VALUE="' . $cmd . '">';
print '<INPUT TYPE="submit" VALUE="Send">';
print '</FORM>';
print '<HR>';
print '<A HREF="',$back,'">終了</A>';
print '<HR>';
print '</BODY></HTML>';

戻る