#!@PERL@ # $Id: w3mhelp.cgi.in,v 1.14 2002/11/10 11:59:15 ukai Exp $ if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) { $CYGPATH = 1; } $helpdir = "@HELP_DIR@"; if ($CYGPATH) { $helpdir = &cygwin_pathconv($helpdir); } unshift(@INC, $helpdir); @docdirs = split(" ", "@DOCDIRS@"); require "w3mhelp-funcname.pl"; require "w3mhelp-funcdesc.en.pl"; $lang = 'en'; %htmlesc = ( '<', '<', '>', '>', '&', '&' ); $RC_DIR = '@RC_DIR@'; $RC_DIR =~ s/^~/$ENV{'HOME'}/; if ($CYGPATH) { $RC_DIR = &cygwin_pathconv("$RC_DIR"); } $keymap = "$RC_DIR/keymap"; $version = '*unknown*'; if (defined($ENV{'QUERY_STRING'})) { print "QUERY_STRING=$ENV{'QUERY_STRING'}\n"; if ($ENV{'QUERY_STRING'} =~ /(^|&)version=([^&]*)/) { $version = $2; $version =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge; $version =~ s/w3m\///; } if ($ENV{'QUERY_STRING'} =~ /(^|&)lang=([^&]*)/) { local($tlang) = $2; $tlang =~ s/\+|%([0-9A-Fa-f][0-9A-Fa-f])/$& eq '+' ? ' ' : pack('C', hex($1))/ge; $tlang =~ tr/A-Z/a-z/; if ($tlang !~ /^[a-z][a-z]$/) { $tlang = 'en'; } print "tlang=$tlang\n"; eval {require "w3mhelp-funcdesc.$tlang.pl";}; if (defined(%funcdesc)) { $lang = $tlang; } } } %f = %keyfunc; %keyfunc = (); while (($key, $fname) = each %f) { $key = &norm_key($key); $keyfunc{$key} = $fname; } if (-f $keymap) { open(KEYMAP, "< $keymap") || die "cannot open keymap: $keymap, $!"; &load_keymap(*KEYMAP, $func); close(KEYMAP); } local (%funckeydesc, $key, $fname, $desc); %funcname = (%funcname, %buf_funcname, %lineedit_funcname); %funcdesc = (%funcdesc, %buf_funcdesc, %lineedit_funcdesc); while (($fname, $desc) = each %funcdesc) { $funckeydesc{$funcname{$fname}} = "$desc\n"; } while (($key, $fname) = each %keyfunc) { $funckeydesc{$funcname{$fname}} .= "$key,"; } while (($key, $fname) = each %buf_keyfunc) { $funckeydesc{$funcname{$fname}} .= "$key,"; } while (($key, $fname) = each %lineedit_keyfunc) { $funckeydesc{$funcname{$fname}} .= "$key,"; } print < w3m help page
******* w3m (WWW-wo-Miru) Version $version by A.ITO ********
***** Key assign table *****
HEADING $q_version = $version; $q_version =~ s/[^A-Za-z0-9_\$\.\-]/sprintf('%%%02X', ord($&))/ge; $script = "$d[2] version
\n"; } } &show_keymap("Page/Cursor motion", split(" ", "pgFore pgBack movR movL movD movU ldown1 lup1 shiftl shiftr col1L col1R linbeg linend ctrCsrH ctrCsrV goLine goLineF goLineL movRW movLW topA lastA nextA prevA nextR nextRD nextL nextRD nextLU nextD nextU")); &show_keymap("Hyperlink operation", split(" ", "followA tabA svA followI svI submitForm curURL peekURL peekIMG pginfo curlno chkURL chkWORD chkNMID rFrame extbrz linkbrz")); &show_keymap("File/Stream operation", split(" ", "goURL gorURL tabURL tabrURL ldfile readsh pipesh")); &show_keymap("Buffer operation", split(" ", "backBf selMn selBuf vwSrc svSrc svBuf editBf editScr reload rdrwSc dispI stopI")); &show_keymap("Tab operation", split(" ", "newT closeT nextT prevT tabMn tabR tabL")); &show_keymap("Bookmark operation", split(" ", "ldBmark adBmark")); &show_keymap("Search", split(" ", "srchfor srchbak srchnxt srchprv isrchfor isrchbak")); &show_keymap("Dictionary look-up", split(" ", "dictword dictwordat")); &show_keymap("Mark operation", split(" ", "_mark nextMk prevMk reMark")); &show_keymap("Miscellany", split(" ", "mainMn ldhelp ldOpt cooLst ldHist msgs msToggle wrapToggle setAlarm setOpt setEnv execsh susp qquitfm quitfm defKey")); &show_keymap("Buffer selection mode", split(" ", "buffer_next buffer_prev buffer_delete buffer_go")); &show_keymap("Line-edit mode", split(" ", "lineedit_forward lineedit_back lineedit_backspace lineedit_delete lineedit_kill_after lineedit_kill_before lineedit_top lineedit_bottom lineedit_prev lineedit_next lineedit_editor lineedit_complete lineedit_accept")); print < PAGE exit 0; sub load_keymap { local(*FH) = shift; local($func) = @_; while () { next if /^#/; next if /^\s*$/; ($keymap, $key, $fname, $data) = split; next if $data; next unless $keymap =~ /keymap/; $fname =~ tr/a-z/A-Z/; next unless (defined($funcdesc{$fname})); $key = &norm_key($key); $keyfunc{$key} = $fname; } } sub norm_key { local($_) = @_; s/\\(.)/$1/g; s/^\^(.)/C-$1/; s/^(C-\[|M-)/ESC-/; if (/^ESC-\[/) { /^ESC-\[A$/ && return "UP"; /^ESC-\[B$/ && return "DOWN"; /^ESC-\[C$/ && return "RIGHT"; /^ESC-\[D$/ && return "LEFT"; s/^ESC-/\^\[/; return $_; } s/^ESC-\^(.)/ESC-C-$1/; s/^(ESC-)?C-[iI]/${1}TAB/; s/^(ESC-)?C-\?/${1}DEL/; return $_; } sub show_keymap { local($head, @list) = @_; local($fid); local($attr) = " WIDTH=140"; if (defined($title{$head})) { $head = $title{$head}; $head =~ s/[<>&]/$htmlesc{$&}/ge; } print <$head PAGE foreach $fid (@list) { local ($desc, $keys) = split("\n", $funckeydesc{$fid}, 2); $keys =~ s/,$//; $keys = '' if ($keys eq ''); $keys =~ s/[<>&]/$htmlesc{$&}/ge; $desc =~ s/[<>&]/$htmlesc{$&}/ge; print <$keys PAGE $attr = ""; } print "
$desc
\n"; } sub cygwin_pathconv { local($_) = @_; local(*CYGPATH); open(CYGPATH, '-|') || exec('cygpath', '-w', $_); $_ = ; close(CYGPATH); s/\r?\n$//; s!\\!/!g; s!/$!!; return $_; }