From 2a57d730276ed5565ca2252376bc47ddaccf5b0a Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 21 Nov 2001 03:58:32 +0000 Subject: remove autogenerated files rename scripts/dirlist.in to scripts/dirlist.cgi.in --- scripts/w3mman/w3mman | 41 ------- scripts/w3mman/w3mman2html.cgi | 252 ----------------------------------------- 2 files changed, 293 deletions(-) delete mode 100644 scripts/w3mman/w3mman delete mode 100644 scripts/w3mman/w3mman2html.cgi (limited to 'scripts/w3mman') diff --git a/scripts/w3mman/w3mman b/scripts/w3mman/w3mman deleted file mode 100644 index 44aba2f..0000000 --- a/scripts/w3mman/w3mman +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/local/bin/perl - -@W3M = split(' ', 'w3m'); -$ENV{'MAN'} = 'man'; -$SCRIPT = 'file:///$LIB/w3mman2html.cgi'; - -sub usage { - ($_ = $0) =~ s@.*/@@; - print STDERR "$_ [-M ] [[
] ]\n"; - print STDERR "$_ [-M ] [-k ]\n"; - exit 1; -} - -$query = ""; -while (@ARGV) { - $_ = shift @ARGV; - if (/^-M$/) { - @ARGV || &usage(); - $ENV{'MANPATH'} = shift @ARGV; - } elsif (/^-k$/) { - @ARGV || &usage(); - $query = "?keyword=" . &form_encode(shift @ARGV); - } elsif (/^-/) { - &usage(); - } elsif (/^\d/ || $_ eq 'n') { - @ARGV || &usage(); - $query = "?quit=ok&man=" . &form_encode(shift @ARGV); - $query .= "§ion=" . &form_encode($_); - } else { - $query = "?quit=ok&man=" . &form_encode($_); - } -} - -exec @W3M, "$SCRIPT$query"; - -sub form_encode { - local($_) = @_; - s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg; - return $_; -} - diff --git a/scripts/w3mman/w3mman2html.cgi b/scripts/w3mman/w3mman2html.cgi deleted file mode 100644 index 0f75502..0000000 --- a/scripts/w3mman/w3mman2html.cgi +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/local/bin/perl - -$MAN = $ENV{'MAN'} || 'man'; -$QUERY = $ENV{'QUERY_STRING'} || $ARGV[0]; -$SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0; -$CGI = "file://$SCRIPT_NAME"; -$CGI2 = "file:"; -# $CGI2 = "file:///\$LIB/hlink.cgi?"; -$SQUEEZE = 1; - -if ($QUERY =~ /\=/) { - for (split('&', $QUERY)) { - ($v, $q) = split('=', $_, 2); - $query{$v} = &form_decode($q); - } -} else { - $QUERY =~ s/^man=//; - $query{"man"} = &form_decode($QUERY); -} - -if (! $query{"man"}) { - if ($query{"keyword"}) { - $keyword = $query{"keyword"}; - $k = &html_quote($keyword); - print < -man -k $k - -

man -k $k

-
    -EOF - $keyword =~ s:([^\w./]):\\$1:g; - open(F, "$MAN -k $keyword 2> /dev/null |"); - @line = (); - while() { - chop; - $_ = &html_quote($_); - s/(\s+-.*)$//; - $title = $1; - s@(\w[\w.\-]*(\s*\,\s*\w[\w.\-]*)*)\s*(\([\dn]\w*\))@&keyword_ref($1, $3)@ge; - print "
  • $_$title\n"; - } - close(F); - print < - - -EOF - exit; - } - print < -man - -
    - -
    Manual: -
    Section: -
    Keyword: -
    -
    -
    - - -EOF - exit; -} - -$man = $query{"man"}; -if ($man =~ s/\((\w+)\)$//) { - $section = $1; - $man_section = "$man($1)"; -} elsif ($query{"section"}) { - $section = $query{"section"}; - $man_section = "$man($section)"; -} else { - $section = ""; - $man_section = "$man"; -} - -$section =~ s:([^\w./]):\\$1:g; -$man =~ s:([^\w./]):\\$1:g; -open(F, "$MAN $section $man 2> /dev/null |"); -$ok = 0; -undef $header; -$blank = -1; -while() { - if (! defined($header)) { - /^\s*$/ && next; - $header = $_; - $space = $header; - chop $space; - $space =~ s/\S.*//; - } elsif ($_ eq $header) { # delete header - $blank = -1; - next; - } elsif (!/\010/ && /^$space[\w\200-\377].*\s\S/o) { # delete footer - $blank = -1; - next; - } - if ($SQUEEZE) { - if (/^\s*$/) { - $blank || $blank++; - next; - } elsif ($blank) { - $blank > 0 && print "\n"; - $blank = 0; - } - } - - s/\&/\&/g; - s/\/\>/g; - - s@([\200-\377].)(\010{1,2}\1)+@$1@g; - s@(\&\w+;|.)(\010\1)+@$1@g; - s@__\010{1,2}((\)?[\200-\377].(\)?)@$1@g; - s@_\010((\)?(\&\w+\;|.)(\)?)@$1@g; - s@((\)?[\200-\377].(\)?)\010{1,2}__@$1@g; - s@((\)?(\&\w+\;|.)(\)?)\010_@$1@g; - s@.\010(.)@$1@g; - - s@\\\_\\\@_@g; - s@\\_\\@_@g; - s@\\@@g; - s@\\@@g; - - if (! $ok) { - /^No/ && last; - print < -man $man_section - -
    -EOF
    -    print;
    -    $ok = 1;
    -    next;
    -  }
    -
    -  s@(http|ftp)://[\w.\-/~]+[\w/]@$&@g;
    -  s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1$2$3@g;
    -  s@(\W)(\~?/[\w.][/\w.\-]*)@$1 . &file_ref($2)@ge;
    -  s@(include(<\/?[bu]\>|\s)*\<)([/\w.\-]+)@$1 . &include_ref($3)@ge;
    -  s@(\w[\w.\-]*)((\)*)(\([\dm]\w*\))@$1$2$4@g;
    -  print;
    -}
    -close(F);
    -if (! $ok) {
    -  if ($query{'quit'}) {
    -    print STDERR "No manual entry for $man_section.\n";
    -    print <
    -man $man_section
    -
    -
    -EOF
    -  print "No manual entry for $man_section.\n";
    -}
    -print <
    -
    -
    -EOF
    -
    -sub is_command {
    -  local($_) = @_;
    -  local($p);
    -
    -  (! -d && -x) || return 0;
    -  if (! defined(%PATH)) {
    -    for $p (split(":", $ENV{'PATH'})) {
    -      $p =~ s@/+$@@;
    -      $PATH{$p} = 1;
    -    }
    -  }
    -  s@/[^/]*$@@;
    -  return defined($PATH{$_});
    -}
    -
    -sub file_ref {
    -  local($_) = @_;
    -
    -  if (&is_command($_)) {
    -    ($man = $_) =~ s@.*/@@;
    -    return "$_";
    -  }
    -  if (/^\~/ || -f || -d) {
    -    return "$_";
    -  }
    -  return $_;
    -}
    -
    -sub include_ref {
    -  local($_) = @_;
    -  local($d);
    -
    -  for $d (
    -	"/usr/include",
    -	"/usr/local/include",
    -	"/usr/X11R6/include",
    -	"/usr/X11/include",
    -	"/usr/X/include",
    -	"/usr/include/X11"
    -  ) {
    -    -f "$d/$_" && return "$_";
    -  }
    -  return $_;
    -}
    -
    -sub keyword_ref {
    -  local($_, $s) = @_;
    -  local(@a) = ();
    -
    -  for (split(/\s*,\s*/)) {
    -    push(@a, "$_");
    -  }
    -  return join(", ", @a) . $s;
    -}
    -
    -sub html_quote {
    -  local($_) = @_;
    -  local(%QUOTE) = (
    -    '<', '<',
    -    '>', '>',
    -    '&', '&',
    -    '"', '"',
    -  );
    -  s/[<>&"]/$QUOTE{$&}/g;
    -  return $_;
    -}
    -
    -sub form_decode {
    -  local($_) = @_;
    -  s/\+/ /g;
    -  s/%([\da-f][\da-f])/pack('c', hex($1))/egi;
    -  return $_;
    -}
    -
    -- 
    cgit v1.2.3