diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/blue-background.lss | 95 | ||||
-rw-r--r-- | samples/bright-blue.lss | 77 | ||||
-rw-r--r-- | samples/cernrules.txt | 640 | ||||
-rw-r--r-- | samples/home.htm | 31 | ||||
-rw-r--r-- | samples/installdirs.html | 18 | ||||
-rw-r--r-- | samples/jumps.htm | 33 | ||||
-rw-r--r-- | samples/jumpsUnix.html | 56 | ||||
-rw-r--r-- | samples/jumpsVMS.html | 28 | ||||
-rwxr-xr-x | samples/keepviewer | 20 | ||||
-rw-r--r-- | samples/lynx-demo.cfg | 46 | ||||
-rw-r--r-- | samples/lynx-keymaps | 161 | ||||
-rw-r--r-- | samples/lynx.bat | 31 | ||||
-rw-r--r-- | samples/lynx.com | 59 | ||||
-rw-r--r-- | samples/lynx.ico | bin | 0 -> 5174 bytes | |||
-rw-r--r-- | samples/lynx.lss | 115 | ||||
-rw-r--r-- | samples/lynx_bookmarks.htm | 13 | ||||
-rwxr-xr-x | samples/lynxdump | 16 | ||||
-rw-r--r-- | samples/mailcap | 99 | ||||
-rwxr-xr-x | samples/mailto-form.pl | 280 | ||||
-rw-r--r-- | samples/midnight.lss | 84 | ||||
-rw-r--r-- | samples/mild-colors.lss | 59 | ||||
-rw-r--r-- | samples/mime.types | 26 | ||||
-rwxr-xr-x | samples/oldlynx | 24 | ||||
-rw-r--r-- | samples/oldlynx.bat | 44 | ||||
-rw-r--r-- | samples/opaque.lss | 48 |
25 files changed, 2103 insertions, 0 deletions
diff --git a/samples/blue-background.lss b/samples/blue-background.lss new file mode 100644 index 0000000..9c5d492 --- /dev/null +++ b/samples/blue-background.lss @@ -0,0 +1,95 @@ +# From: Sergey Svishchev <svs@ropnet.ru> +# Notes: +# I use this in OS/2 VIO window, and occasionally on Linux console. + +# Setting the normal and default types lets us keep (almost) the same colors +# whether the terminal's default colors are white-on-black or black-on-white. +# It is not exact since the default "white" is not necessarily the same color +# as the ANSI lightgray, but is as close as we can get in a standard way. +# +# If you really want the terminal's default colors, and if lynx is built using +# ncurses' default-color support, remove these two lines: +normal: normal: lightgray: blue +default: normal: white: blue + +# Normal type styles correspond to HTML tags. +# +# The next line (beginning with "em") means: use bold if mono, otherwise +# brightblue on <defaultbackground> +em: bold: brightgreen: blue +strong: bold: brightred: blue +b: bold: white: blue +i: bold: yellow: blue +alink: reverse: white: cyan +a: bold: cyan: blue +img: dim: gray: blue +status: reverse: white: green +fig: normal: gray: blue +caption: reverse: brown: blue +hr: normal: yellow: blue +blockquote: normal: brightblue: blue +#ul:normal: brown:blue +address: normal: magenta: blue +#title: normal:magenta:blue +tt: dim: gray: blue +h1: bold: yellow: blue +label: normal: magenta: blue +value: normal: green: blue +q: normal: yellow: magenta +small: dim: gray: blue +big: bold: yellow: blue +sup: bold: yellow: blue +sub: dim: gray: blue + +# glitch fixes +area: normal: lightgray: blue +body: normal: lightgray: blue +br: normal: lightgray: blue +center: normal: lightgray: blue +center.header: normal: lightgray: blue +div: normal: lightgray: blue +font: normal: lightgray: blue +font.letter: normal: lightgray: blue +h2: normal: lightgray: blue +h3: normal: lightgray: blue +h4: normal: lightgray: blue +h5: normal: lightgray: blue +h6: normal: lightgray: blue +head: normal: lightgray: blue +link: normal: lightgray: blue +map: normal: lightgray: blue +meta: normal: lightgray: blue +p: normal: lightgray: blue +table: normal: lightgray: blue +td: normal: lightgray: blue +tr: normal: lightgray: blue +title: normal: lightgray: blue + +form: normal: lightgray: blue +input: normal: lightgray: blue +input.submit: normal: cyan: blue +select: normal: lightgray: blue +option: normal: lightgray: blue + +pre: normal: lightgray: blue +dd: normal: lightgray: blue +dt: normal: lightgray: blue +ul: normal: lightgray: blue +li: normal: lightgray: blue + +base: normal: lightgray: blue +iframe: normal: lightgray: blue +cite: normal: yellow: blue + +span.htmlsrc_comment:normal: green: blue +span.htmlsrc_tag:normal: brightgreen: blue +span.htmlsrc_attrib:normal: brightcyan: blue +span.htmlsrc_attrval:normal: white: blue +span.htmlsrc_abracket:normal: brightgreen: blue +span.htmlsrc_entity:normal: white: blue +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal: red: blue +span.htmlsrc_badtag:normal: red: blue +span.htmlsrc_badattr:normal: red: blue +span.htmlsrc_sgmlspecial:normal: yellow: blue diff --git a/samples/bright-blue.lss b/samples/bright-blue.lss new file mode 100644 index 0000000..534e9c1 --- /dev/null +++ b/samples/bright-blue.lss @@ -0,0 +1,77 @@ +# From: Ilya Zakharevich <ilya@math.ohio-state.edu> +# +# Colors: black, red, green, brown, blue, magenta, cyan, +# lightgray, gray, brightred, brightgreen, yellow, brightblue, +# brightmagenta, brightcyan, white. +# +# On some terminals combination of background and foreground of different +# brightness is not supported. +# +# Normal type styles correspond to HTML tags. +# +# default should be the *last* line +normal: normal: brightcyan: blue +default: normal: brightcyan: blue + +# match "link": +input: normal: green +textarea: normal: white: cyan + +input.type.submit:normal: blue: black +# type-less input is the same as type=text (similar to textarea) +input.type.: normal: white: cyan +input.type.text:normal: white: cyan +input.type.password:normal: white: cyan +input.type.file:normal: brightred: cyan + +# Shows gray on black?! +edit.current:normal: yellow: lightgray +#edit.current:normal:yellow:white +edit.active:normal: black: white +edit.active.marked:normal: white: black +edit.prompt:normal: white: gray +edit.prompt.marked:normal: black: white +edit.active.arrow:normal: red: white +edit.prompt.arrow:normal: red: gray +edit.active.pad:normal: red: lightgray +edit.prompt.pad:normal: white: black + +option:normal: red: black +#alink:normal:red:green + +scroll.arrow: bold: white: default +scroll.noarrow: normal: black: default +scroll.bar: bold: white +#scroll.back:reverse:green:red + +status: reverse: yellow: black +h1: bold: yellow: black +em: bold: white +title: normal: magenta: black +i: bold: white +table: normal: white +blockquote: normal: white + +menu.bg: normal: black: lightgray +menu.frame: normal: black: lightgray +menu.entry: normal: white: gray +menu.n: normal: white: gray +menu.active: normal: white: black +menu.sb: normal: brightred: lightgray + +forwbackw.arrow:bold: red: default +hot.paste: normal: brightred: gray + +# FIXME: what are these? +em.a: reverse: black: blue +em.b: reverse: white: black +font.letter: normal: default: black +link.blue: bold: white: brightblue +link.blue.prev: bold: yellow: brightblue +li.blue: bold: blue: black +link.blue.next: bold: blue: black + +INCLUDE:lynx.lss + +# default should be the *last* line +#?default: normal: brightcyan: blue diff --git a/samples/cernrules.txt b/samples/cernrules.txt new file mode 100644 index 0000000..6df8b30 --- /dev/null +++ b/samples/cernrules.txt @@ -0,0 +1,640 @@ +# This files contains examples and an explanation for the RULESFILE / RULE +# feature. +# +# Rules for Lynx are experimental. They provide a rudimentary capability +# for URL rejection and substitution based on string matching. +# Most users and most installations will not need this feature, it is here +# in case you find it useful. Note that this may change or go away in +# future releases of Lynx; if you find it useful, consider describing your +# use of it in a message to <lynx-dev@nongnu.org>. +# +# Syntax: +# ======= +# Summary of common forms: +# +# Fail URL1 +# Map URL1 URL2 [CONDITION] +# Pass URL1 [URL2] [CONDITION] +# Redirect URL1 URL2 [CONDITION] +# RedirectPerm URL1 URL2 [CONDITION] +# UseProxy URL1 PROXYURL [CONDITION] +# UseProxy URL1 "none" [CONDITION] +# +# Alert URL1 MESSAGE [CONDITION] +# AlwaysAlert URL1 MESSAGE [CONDITION] +# UserMsg URL1 MESSAGE [CONDITION] +# InfoMsg URL1 MESSAGE [CONDITION] +# Progress URL1 MESSAGE [CONDITION] +# +# As you may have guessed, comments are introduced by a '#' character. +# Rules have the general form +# Operator Operand1 [Operand2] [CONDITION] +# with words separated by whitespace. Words containing space can be quoted +# with "double quotes". Although normally this should not be necessary +# necessary for URLs, it has to be used for MESSAGE Operands in Alert etc. +# See below for an explanation of the optional CONDITION. +# +# Recognized operators are +# +# Fail URL1 +# Reject access to this URL, stop processing further rules. +# +# Map URL1 URL2 +# Change the current URL to URL2, then continue processing. +# +# Pass URL1 [URL2] +# Accept this URL and stop processing further rules; if URL2 +# is given, apply this as the last mapping. +# See the next item for reasons why you generally don't want to "pass" +# a changed URL. +# +# RedirectTemp URL1 URL2 +# RedirectPerm URL1 URL2 +# Redirect [STATUS] URL1 URL2 +# Stop processing further rules and redirect to URL2, just as if lynx had +# received a HTTP redirection with URL2 as the new location. This means that +# URL2 is subject to any applicable permission checking, if it passes a new +# request will be issued (which may result in a new round of rules checking, +# with a new "current URL") or the new URL might be taken from the cache, and, +# after successful loading, lynx's idea of what the loaded document's URL is +# will be fully updated. All this does not happen if you just "pass" a changed +# URL (or let it fall through), so this is generally the preferred way for +# substituting URLs. +# If the RedirectPerm variant is used, or if the optional word is supplied and +# is either "permanent" or "301", act as if lynx had received a permanent +# redirection (with HTTP status 301). In most cases this will not make a +# noticeable difference. Lynx may cache the location in a special way for 301 +# redirections, so that the redirection is followed immediately the next time +# the same original URL is accessed, without re-checking of rules. Therefore +# the permanent variant should never be used if the desired outcome of rules +# processing depends on variable conditions (see CONDITIONS below) or on +# setting a special flag (see next item). +# +# PermitRedirection URL1 +# Mark following redirection as permitted, and continue processing. Some +# redirection locations are normally not allowed, because permitting them in a +# response from an arbitrary remote server would open a security hole, and +# others are not allowed if certain restrictions options are in effect. Among +# redirection locations normally always forbidden are lynxprog: and lynxexec: +# schemes. With "default" anonymous restrictions in effect, many URL schemes +# are disallowed if the user would not be allowed to use them with 'g'oto. +# This rule allows to override the permission checking if rules processing ends +# with a Redirect (including the RedirectPerm or RedirectTemp forms). It is +# ignored otherwise, in particular, it does not influence acceptance if rules +# processing ends with a "Pass" and a real redirection is received in the +# subsequent HTTP request. If redirections are chained, it only applies to the +# redirection that ends the same rules cycle. Note that the new URL is still +# subject to other permission checks that are not specific to redirections; but +# using this rule may still weaken the expected effect of -anonymous, +# -validate, -realm, and other restriction options, including TRUSTED_EXEC and +# similar in lynx.cfg, so be careful where you redirect to if restrictions are +# important! +# +# UseProxy URL1 PROXYURL +# Stop processing further rules, and force access through the proxy given by +# PROXYURL. PROXYURL should have the same form as required for foo_proxy +# environment variables and lynx.cfg options, i.e., (unless you are trying to +# do something unusual) "http://some.proxy-server.dom:port/". This rule +# overrides any use of a proxy (or external gateway) that might otherwise apply +# because of environment variables or lynx.cfg options, it also overrides any +# "no_proxy" settings. +# +# UseProxy URL1 none +# Mark request as NOT using any proxy (or external gateway), and continue +# processing(!). For a request marked this way, any subsequent UseProxy +# rule with a PROXYURL will be ignored, and any use of a proxy (or external +# gateway) that might otherwise apply because of environment variables or +# lynx.cfg options will be overridden. Note that the marking will not +# survive a Redirect rule (since that will result, if successful, in a +# new request). +# +# Alert URL1 MESSAGE +# AlwaysAlert URL1 MESSAGE +# UserMsg URL1 MESSAGE +# InfoMsg URL1 MESSAGE +# Progress URL1 MESSAGE +# These produce various kinds of statusline messages, differing in whether +# a pause is enforced and in its duration, immediately when the rule is +# applied. AlwaysAlert shows the message text even in non-interactive mode +# (-dump, -source, etc.). Rule processing continues after the message is +# shown. As usual, these rules only apply if URL1 matches. MESSAGE is +# the text to be displayed, it can contain one occurrence of "%s" which +# will be replaced by the current URL, literal '%' characters should be +# doubled as "%%". +# +# Rules are processed sequentially first to last for each request, a rule +# applies if the current URL matches URL1. The current URL is initially the +# URL for the resource the user is trying to access, but may change as the +# result of applied Map rules. case-sensitive (!) string comparison is used, +# in addition URL1 can contain one '*' which is interpreted as a wildcard +# matching 0 or more characters. So if for example +# "http://example.com/dir/doc.html" is requested, it would match any of +# the following: +# Pass http:* +# Pass http://example.com/*.html +# Pass http://example.com/* +# Pass http://example* +# Pass http://*/doc.html +# but not: +# Pass http://example/* +# Pass http://Example.COM/dir/doc.html +# Pass http://Example.COM/* +# +# If a URL2 is given and also contains a '*', that character will be +# replaced by whatever matched in URL1. Processing stops with the +# first matching "Fail" or "Pass" or when the end of the rules is reached. +# If the end is reached without a "Fail" or "Pass", the URL is allowed +# (equivalent to a final "Pass *"). +# +# The requested URL will have been transformed to Lynx's normal +# representation. This means that local file resources should be +# expected in the form "file://localhost/<path using slash separators>", +# not in the machine's native representation for filenames. +# +# Anyone with experience configuring the venerable CERN httpd server will +# recognize some of the syntax - in fact, the code implementing rules goes +# back to a common ancestor. But note the differences: all URLs and URL- +# patterns here have to be given as absolute URLs, even for local files. +# (Absolute URLs don't imply proxying.) +# +# CONDITIONS +# ---------- +# All rules mentioned can be followed by an optional CONDITION, which can +# be used to further restrict when the rule should be applied (in addition +# to the match on URL1). A CONDITION takes one of the forms +# "if" CONDITIONFLAG +# "unless" CONDITIONFLAG +# and currently two condition flags are recognized: +# "userspecified" (or abbreviated "userspec") +# "redirected" +# To explain these, first some terms need to be defined. A "request" +# is... +# +# A user action (like following a link, or entering a 'g'oto URL) can either be +# rejected immediately (for example, because of restrictions in effect, or +# because of invalid input), or can generate a "request". For the purpose of +# this discussion, a "request" is the sequence of processing done by lynx, +# which might ultimately lead to an actual network request and loading and +# display of data; a request can also result in rejection (for example, some +# restrictions are checked at this stage), or in a redirection. A redirection +# in turn can be rejected (which makes the request fail), or can automatically +# generate a new request. A "request chain" is the sequence of one or more +# requests triggered by the same user event that are chained together by +# redirections. +# For each request, some URL schemes are handled (or rejected) specially, see +# Limitation 1 below, the others are passed to the generic access code. Rules +# processing occurs at the beginning of the generic access code, before a +# request is dispatched to the scheme-specific protocol module (but after +# checking whether the request can be satisfied by re-displaying an already +# cached document). +# With these definitions, the meaning of the possible CONDITIONFLAGS: +# +# if redirected +# The rule applies if the current request results from a redirection; +# whether that was a real HTTP redirection or one generated by a rule +# in the previous request makes no difference. In other words, the +# condition is true if the current request is not the first one in the +# request chain. +# +# if userspecified +# The rule applies if the initial URL of the request chain was specified +# by the user. Lynx marks a request as "user specified" for URLs that +# come from 'g'oto prompts, as well as for following links in a bookmark +# or Jump file and some other special (lynx-generated) pages that may +# contain URLs that were typed in by the user. +# Note that this is not a property of the request, but of the whole request +# chain (based on where the first request's URL came from). The current +# URL may differ from what the user typed +# - because of initial fixups, including conversion of Guess-URLs and file +# paths to full URLs, +# - because of Map rules applied, and/or +# - because of a previous redirection. +# So to make reasonably sure a suspicious or potentially dangerous URL has +# been entered by the user, i.e. is not a link or external redirection +# location that cannot be trusted, a combination of "userspecified" and +# "redirected" flags should be used, for example +# Fail URL1 unless userspecified +# Fail URL1 if redirected +# ... +# +# CAVEAT +# ====== +# First, to squash any false expectations, an example for what NOT TO DO. +# It might be expected that a rule like +# Fail file://localhost/etc/passwd # <- DON'T RELY ON THIS +# could be used to prevent access to the file "/etc/passwd". This might +# fool a naive user, but the more sophisticated user could still gain +# access, by experimenting with other forms like (@@@ untested) +# "file://<machine's domain name>/etc/passwd" or "/etc//passwd" +# or "/etc/p%61asswd" or "/etc/passwd?" or "/etc/passwd#X" and so on. +# There are many URL forms for accessing the same resource, and Lynx +# just doesn't guarantee that URLs for the same resource will look the +# same way. +# +# The same reservation applies to any attempts to block access to unwanted +# sites and so on. This isn't the right place for implementing it. +# (Lynx has a number of mechanisms documented elsewhere to restrict access, +# see the INSTALLATION file, lynx.cfg, lynx -help, lynx -restrictions.) +# +# Some more useful applications: +# +# 1. Disabling URLs by access scheme +# ---------------------------------- +# Fail gopher:* +# Fail finger:* +# Fail lynxcgi:* +# Fail LYNXIMGMAP:* +# This should work (but no guarantees) because Lynx canonicalizes +# the case of recognized access schemes and does not interpret +# %-escaping in the scheme part (@@@ always?) +# +# Note that for many access schemes Lynx already has mechanisms to +# restrict access (see lynx.cfg, -help, -restrictions, etc.), others +# have to be specifically enabled. Those mechanisms should be used +# in preference. +# Note especially Limitation 1 below. +# This can be used for the remaining cases, or in addition by the +# more paranoid. Note that disabling "file:*" will also make many +# of the special pages generated by lynx as temporary files (INFO, +# history, ...) inaccessible, on the other hand it doesn't prevent +# _writing_ of various temp files - probably not what you want. +# +# You could also direct access for a scheme to a brief text explaining +# why it's not available: +# Redirect news:* http://localhost/texts/newsserver-is-broken.html +# +# 2. Preventing accidental access +# ------------------------------- +# If there is a page or site you don't want to access for whatever +# reason (say there's a link to it that crashes Lynx [don't forget to +# report a bug], or if that starts sending you a 5 Mb file you don't +# want, or you just don't like the people...), you can prevent yourself +# from accidentally accessing it: +# Fail http://bad.site.com/* +# +# 3. Compressed files +# ------------------- +# You have downloaded a bunch of HTML documents, and compressed them +# to save space. Then you discover that links between the files don't +# work, because they all use the names of the uncompressed files. The +# following kind of rule will allow you to navigate, invisibly accessing +# the compressed files: +# Map file://localhost/somedir/*.html file://localhost/somedir/*.html.gz +# or, perhaps better: +# Redirect file://localhost/somedir/*.html file://localhost/somedir/*.html.gz +# +# 4. Use local copies +# ------------------- +# You have downloaded a tree of HTML documents, but there are many links +# between them that still point to the remote location. You want to access +# the local copies instead, after all that's why you downloaded them. You +# could start editing the HTML, but the following might be simpler: +# Map http://remote.com/docs/*.html file://localhost/home/me/docs/*.html +# Or even combine this with compressing the files: +# Map http://remote.com/docs/*.html file://localhost/home/me/docs/*.html.gz +# +# Again, replacing the "Map" with "Redirect" is probably better - it will +# allow you to see the _real_ location on the lynx INFO screen or in the +# HISTORY list, will avoid duplicates in the cache if the same document is +# loaded with two different URLs, and may allow you to 'e'dit the local +# from within lynx if you feel like it. +# +# 5. Broken links etc. +# -------------------- +# A user has moved from http://www.siteA.com/~jdoe to http://siteB.org/john, +# or http://www.provider.com/company/ has moved to their own server +# http://www.company.com, but there are still links to the old location +# all over the place; they now are broken or lead to a stupid "this page +# has moved, please update your bookmarks. Refresh in 5 seconds" page +# which you're tired of seeing. This will not fix your bookmarks, and +# it will let you see the outdated URLs for longer (Limitation 3 below), +# but for a quick fix: +# Redirect http://www.siteA.com/~jdoe/* http://siteB.org/john/* +# Redirect http://www.provider.com/company/* http://www.company.com/* +# +# You could use "Map" instead of "Redirect", but this would let you see the +# outdated URLs for longer and even bookmark them, and you are likely to +# create invalid links if not all documents from a site are mapped +# (Limitation 3). +# +# 6. DNS troubles +# --------------- +# A special case of broken links. If a site is inaccessible because the +# name cannot be resolved (your or their name server is broken, or the +# name registry once again made a mistake, or they really didn't pay in +# time...) but you still somehow know the address; or if name lookups are +# just too slow: +# Map http://www.somesite.com/* http://10.1.2.3/* +# (You could do the equivalent more cleanly by adding an entry to the hosts +# file, if you have access to it.) +# +# Or, if a name resolves to several addresses of which one is down, and the +# DNS hasn't caught up: +# Map http://www.w3.org/* http://www12.w3.org/* +# +# Note that this can break access to some name-based virtually hosted sites. +# +# In this case use of "Map" is probably preferred over "Redirect", as long +# as the URL on the left side contains the real and preferred hostname or +# the problem is only temporary. +# +# 7. Avoid redirections +# --------------------- +# Some sites have a habit to provide links that don't go to the destination +# directly but always force redirection via some intermediate URL. The +# delay imposed by this, especially for users with slower connections and +# for overloaded servers, can be avoided if the intermediate URLs always +# follow some simple pattern: we can then anticipate the redirect that will +# inevitably follow and generate it internally. For example, +# Redirect http://lwn.net/cgi-bin/vr/* http://* +# +# Warning: The page authors may not like this circumvention. Often the +# redirection is wanted by them to track access, sometimes in connection +# with cookies. Some sites may employ mechanisms that defeat the shortcut. +# It is your responsibility to decide whether use of this feature is +# acceptable. (But note that the same effect can be achieved anyway for +# any link by editing the URL, e.g. with the ELGOTO ('E') key in Lynx, so +# a shortcut like this does not create some new kind of intrusion.) +# +# 8. Detailed proxy selection +# --------------------------- +# Basic use for this one should be obvious, if you have a need for it. +# It simply allows selecting use (or non-use) of proxies on a more detailed +# level than the traditional <scheme>_proxy and no_proxy variables, as well +# as using different proxies for different sites. +# For example, to request access through an anonymizing proxy for all pages +# on a "suspicious" site: +# UseProxy http://suspicious.site/* http://anonymyzing.proxy.dom/ +# (as long as all URLs really have a matching form, not some alternative +# like <http://suspicious.site:80/> or <http://SuSpIcIoUs.site/>!) +# +# To access some site through a local squid proxy, running on the same host +# as lynx, except for some image types (say because you rarely access images +# with lynx anyway, and if you do, you don't want them cached by the proxy): +# UseProxy http://some.site/*.gif none +# UseProxy http://some.site/*.jpg none +# UseProxy http://some.site/* http://localhost:3128/ +# Note that order is important here. +# +# To exempt a local address from all proxying: +# UseProxy http://local.site/* none +# +# Note however that for some purposes the "no_proxy" setting may be better +# suited than "UseProxy ... none", because of its different matching logic +# (see comments in lynx.cfg). +# +# 9. Invent your own scheme +# ------------------------- +# Suppose you want to teach lynx to handle a completely new URL scheme. +# If what's required for the new scheme is already available in lynx in +# _some_ way, this may be possible with some inventive use of rules. +# As an example, let's assume you want to introduce a simple "man:" scheme +# for showing manual pages, so (for a Unix-like system, at least) "man:lynx" +# would display the same help information as the "man lynx" command and so +# on (we ignore section numbers etc. for simplicity here). +# First, since lynx doesn't know anything about a "man:" scheme, it will +# normally reject any such URLs at an early stage. However, a trick exists +# to bypass that hurdle: define a man_proxy environment variable *outside of +# lynx, before starting lynx* (it won't work in lynx.cfg), the actual value +# is unimportant and won't actually be used. For example, in your shell: +# export man_proxy=X +# +# If you already have some kind of HTTP-accessible man gateway available, +# the task then probably just amounts to transforming the URL into the right +# form. For one such gateway (in this case, a CGI script running on the +# local machine), the rule +# Redirect man:* http://localhost/cgi-bin/dwww?type=runman&location=*/ +# or, alternatively, +# UseProxy man:* none +# Map man:* http://localhost/cgi-bin/dwww?type=runman&location=*/ +# does it, for other setups the right-hand side just has to be modified +# appropriately. The "UseProxy" is to make sure the bogus man_proxy gets +# ignored. +# +# If no CGI-like access is available, you might want to invoke your system's +# man command directly for a man: URL. Here is some discussion of how this +# could be done, and why ultimately you may not want to do it; this is also +# an opportunity to show examples for how some of the rules and conditions +# can be used that haven't been discussed in detail elsewhere. +# Lynx provides the lynxexec: (and the similar lynxprog:) scheme for running +# (nearly) arbitrary commands locally. At the heart of employing it for +# man: would be a rule like this: +# Redirect man:* "lynxexec:/usr/bin/man *" +# (It is a peculiarity of this scheme that the literal space and quoting +# are necessary here. Also note that Map cannot be used here instead of +# Redirect, since lynxexec, as a special kind of URL, needs to be handled +# "early" in a request.) +# Of course, execution of arbitrary commands is a potentially dangerous +# thing. lynxexec has to be specifically enabled at compile time and in +# lynx.cfg (or with command line options), and there are various levels +# of control, too much to go into here. It is assumed in the following that +# lynxexec has been enabled to the degree necessary (allow /usr/bin/man +# execution) but hopefully not too much. +# What needs to be prevented is that allowing local execution of the man +# command might unintentionally open up unwanted execution of other commands, +# possibly by some trick that could be exploited. For example, redirecting +# man:* as above, the URL "man:lynx;rm -r *" could result in the command +# "man lynx;rm -r *" executed by the system, with obvious disastrous results. +# (This particular example won't actually work, for several reasons; but +# for the purpose of discussion let's assume it did, there may be similar +# ones that do.) +# Because of such dangers, redirection to a lynxexec: is normally never +# accepted by lynx. We need at least a PermitRedirection rule to override +# this protective limitation: +# PermitRedirection man:* +# Redirect man:* "lynxexec:/usr/bin/man *" +# But now we have potentially opened up local execution more than is +# acceptable via the man: scheme, so this needs to be examined. +# There are two aspects to security here: (1) restricting the user, and (2) +# protecting the user. The first could also be phrased as protecting the +# system from the user; the second as preventing lynx (and the system) from +# doing things the user doesn't really want. Aspect (1) is very important +# for setups providing anonymous guest accounts and similarly restricted +# environments. (Otherwise shell access is normally allowed, and trying to +# protect the system in lynx would be rather pointless.) As far as access +# to some URLs is concerned, the difference can be characterized in terms of +# which sources of URLs are trusted enough to allow access: for (1), only +# links occurring in a limited number of documents are trusted enough for +# some (or all) URLs, user input at 'g'oto prompts and the like is not (if +# not completely disabled). For (2) and assuming a user with normal shell +# privileges, the user may be trusted enough to accept any URL explicitly +# entered, but URLs from arbitrary external sources are not - someone might +# try to use them to trick the user (by following an innocent-looking link) +# or lynx (by following a redirection) into doing something undesirable. +# +# In the following we are concerned with (2); it is assumed that providers +# of anonymous accounts would not want to follow this path, and would have +# no need for additional schemes that imply local execution anyway. (For +# one thing, with the man example they would have to carefully check that +# users cannot break out of the man command to a local shell prompt.) +# +# Getting back to the example, it was already mentioned that lynx does not +# allow redirections to lynxexec. In fact this continues to be disallowed +# for real redirection received from HTTP servers. But we have introduced +# a new man: scheme, and the lynx code that does the redirection checking +# doesn't know anything about special considerations for man: URLs, so +# an external HTTP server might send a redirection message with "Location: +# man:<something>", which lynx would allow, and which would in turn be +# redirected by our rule to "lynxexec:/usr/bin/man <something>". Unless +# we are 100% sure that either this can never happen or that the lynxexec +# URL resulting from this can have no harmful effect, this needs to be +# prevented. It can be done by checking for the "redirected" condition, +# either by putting something like (the first line is of course optional) +# Alert man:* "Redirection to man: not allowed" if redirected +# Fail man:* if redirected +# somewhere before the Redirect rule, or, reversing the logic, by adding +# a condition to the redirection rules, i.e. they become +# PermitRedirection man:* unless redirected +# Redirect man:* "lynxexec:/usr/bin/man *" unless redirected +# (actually, putting the condition on either one of the rules would be +# sufficient). The second variant assumes that the attempted access to +# man: via redirection will ultimately fail because there is no other way +# to handle such URLs. +# +# The above should take care of rejecting man: URLs from redirections, but +# what about regular links in HTML (like <A HREF="man:...">)? As long as +# it can be assumed that the user will always inspect each and every link +# before following it, and never follow a link that can have harmful effect, +# no further restrictions are necessary. But this is a very big assumption, +# unrealistic except perhaps in some single-user setups where the user is +# is identical with the rule writer. So normally most links have to be +# regarded as suspect, and only URLs entered by the user can be accepted: +# Alert man:* "Redirection to man: not allowed" if redirected +# Fail man:* if redirected +# Alert man:* "Link to man: not allowed" unless userspecified +# Fail man:* unless userspecified +# +# With these restrictions we have limited the ways our new man: scheme can +# be used rather severely, to the point where its usefulness is questionable. +# In addition to 'g'oto prompts, it may work in Jump files; also, should +# links to man:<something> appear in HTML text, the user could retype them +# manually or use the ELGOTO ('E') command with some trivial editing (like +# adding a space) to "confirm" the URL. Even if the precautions outlined +# above are followed: THIS TEXT DOES NOT IMPLY ANY PROMISE THAT, BY FOLLOWING +# THE EXAMPLES, LYNX WILL BE SAFE. On the other hand, some of the precautions +# *may* not be necessary: it is possible that careful use of TRUSTED_EXEC +# options in lynx.cfg could offer enough protection while making the new +# scheme more useful. +# +# If all this seems a bit too scary, that's intentional; it should be noted +# that these considerations are not in general necessary for "harmless" URL +# schemes, but appropriate for this "extreme" example. One last remark +# regarding the hypothetical man scheme: instead of implementing it through +# "lynxexec:" or "lynxprog:", it would be somewhat safer to use "lynxcgi:" +# instead if it is supported. A simple lynxcgi script would have to write +# the man page to stdout (either converted to text/html or as plain text, +# preceded by an appropriate Content-Type header line), and all necessary +# checking for special shell characters would be done within the script - +# lynx does not use the system() function to run the script. +# +# Other Limitations +# ================= +# First, see CAVEAT above. There are other limitations: +# +# 1. Applicable URL schemes +# ------------------------- +# Rules processing does not apply to all URL schemes. Some are +# handled differently from the generic access code, therefore rules +# for such URLs will never be "seen". This limitation applies at +# least to lynxexec:, lynxprog:, mailto:, LYNXHIST:, LYNXMESSAGES:, +# LYNXCFG:, and LYNXCOMPILEOPTS: URLs. You shouldn't be tempted +# to try to redirect most of these schemes anyway, but this also +# makes it impossible to disable them with "Fail" rules. +# +# Also, a scheme has to be known to Lynx in order to get as far as +# applying rules - you cannot just define your own new foobar: scheme +# and then map it to something here, but see Application 9, above, +# for a workaround. +# +# 2. No re-checking +# ----------------- +# When a URL is mapped to a different one, the new URL is not checked +# again for compliance with most restrictions established by -anonymous, +# -restrictions, lynx.cfg and so on. This can be regarded as a feature: +# it allows specific exceptions. Of course it means that users for +# whom any restrictions must be enforced cannot have write access to a +# personal rules file, but that should be obvious anyway! +# This limitation does not applies if "Redirect" is used, in that case +# the new URL will always be re-examined. +# +# 3. Mappings are invisible +# ------------------------- +# Changing the URL with "Map" or "Pass" rules will in general not be +# visible to the user, because it happens at a late stage of processing +# a request (similar to directing a request through a proxy). One +# can think of two kinds of URL for every resource: a "Document URL" as +# the user sees it (on INFO page, history list, status line, etc.), and +# a "physical URL" used for the actual access. Rules change only the +# physical URL. This is different from the effect of HTTP redirection. +# Often this is bad, sometimes it may be desirable. +# +# Changing the URL can create broken links if a document has relative URLs, +# since they are taken to be relative to the "Document URL" (if no BASE tag +# is present) when the HTML is parsed. +# +# This limitation does not apply if "Redirect" is used - the new location +# will be visible to the user, and will be used by lynx for resolving +# relative URLs within the document. +# +# 4. Interaction with proxying +# ---------------------------- +# Rules processing is done after most other access checks, but before +# proxy (and gateway) settings are examined. A "Fail" rule works +# as expected, but when the URL has been mapped to a different one, +# the subsequent proxy checking can get confused. If it decides that +# access is through a proxy or gateway, it will generally use the +# original URL to construct the "physical" URL, effectively overriding +# the mapping rules. If the mapping is to a different access scheme +# or hostname, proxy checking could also be fooled to use a proxy when +# it shouldn't, to not use one when it should, or (if different proxies +# are used for different schemes) to use the wrong proxy. So "just +# don't do that"; in some cases setting the no_proxy variable will help. +# Example 3 happens to work nicely if there is a http_proxy but no +# ftp_proxy. +# +# This limitation does not come into play if a "UseProxy" rule is applied, +# in either of its two forms: with a PROXYURL, proxying is fully under +# the control of the rules author, and with "none", subsequent proxy +# and gateway checking is completely disabled. It is therefore a good +# idea to combine any "Map" and "Pass" rules that might result in passing +# the changed URL with explicit "UseProxy" rules, if the rules file is +# expected to be used together with proxying; or else always use "Redirect" +# instead of simple passing. +# +# 5. Case-sensitive matching +# -------------------------- +# The matching logic is generic string-based. It doesn't know anything +# about URL syntax, and so it cannot know in which parts of a URL case +# matters and where it doesn't. As a result, all comparisons are case- +# sensitive. If (a limited number of) case variations of a URL need +# to be dealt with, several rules can be used instead of one. +# In particular, this makes "UseProxy ... none" in some ways more limited +# than a no_proxy setting. +# +# 6. Redirection differences +# -------------------------- +# For some URLs lynx does never check after a request whether a redirection +# occurs; that makes the "Redirect" rule useless for such URLs (in addition +# to those mentioned under limitation 1.). Some of them are some gopher +# types, telnet: and similar in most situations, newspost: and similar, +# lynxcgi:, and some other private types. Trying to redirect these will +# make access fail. You probable don't want to change such URLs anyway, +# but if you feel you must, try using "Map" and "Pass" instead. +# +# The -noredir command line option only applies for real HTTP redirection +# responses, Redirect rules are still applied. Also for certain other +# command line options (-mime_header, -head) and command keys (HEAD) lynx +# shows the redirection message (or part of it) in case of a real HTTP +# redirection, instead of following the redirection. Here, too, a Redirect +# rule remains effective (there is no redirection message to show, after all). +# +# 7. URLs required +# ---------------- +# Full absolute URLs (modulo possible "*" matching wildcards) are required +# in rules. Strings like "www.somewhere.com" or "/some/dir/some.file" or +# "www.somewhere.com/some/dir/some.file" are not URLs. Lynx may accept +# them as user input, as abbreviated forms for URLs; but by the time the +# rules get checked, those have been converted to full URLs, if they can +# be recognized. This also means that rules cannot influence which strings +# typed at a 'g'oto prompt are recognized for URLs - rules processing kicks +# in later. diff --git a/samples/home.htm b/samples/home.htm new file mode 100644 index 0000000..b262821 --- /dev/null +++ b/samples/home.htm @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ $LynxId: home.htm,v 1.4 2008/01/06 20:53:04 tom Exp $
+ vile:dos
+ -->
+<html>
+ <head>
+ <title>
+ :: hello ::
+ </title>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ </head>
+ <body>
+ <table width="100%" summary="Lynx home page" align="right">
+ <tr>
+ <td width="100%" align="right">
+ <b>Lynx browser...</b>
+ <p>
+
+ </p>
+ <p>
+ ...for quicker & saver browsing...
+ </p>
+ <p>
+ Light-height, fast and secure text browser.
+ </p>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/samples/installdirs.html b/samples/installdirs.html new file mode 100644 index 0000000..c3f63c4 --- /dev/null +++ b/samples/installdirs.html @@ -0,0 +1,18 @@ +<HTML> +<TITLE>File Management Install Targets</TITLE> +<!-- This is an example file for the Lynx dired "install" functionality. + Lynx needs to be compiled with dired support and OK_INSTALL defined. + For the dired "install" function to work, this file has to exist + in the HOME directory under the name ".installdirs.html" or (for + 8+3, i.e. DOS-like, filesystems) "instdirs.htm". + --> +<BODY> +<H1>Install Target directories</H1> +<UL> +<LH>Choose destination:</LH> +<LI><A HREF="LYNXDIRED://INSTALL_DEST/~/">install in Home directory</A> +<LI><A HREF="LYNXDIRED://INSTALL_DEST/~/bin">install in ~/bin</A> +<LI><A HREF="LYNXDIRED://INSTALL_DEST/tmp">install in /tmp</A> +</UL> +</BODY> +</HTML> diff --git a/samples/jumps.htm b/samples/jumps.htm new file mode 100644 index 0000000..57ac56c --- /dev/null +++ b/samples/jumps.htm @@ -0,0 +1,33 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> + +<html> +<head> + <meta name="generator" content= + "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org"> + <meta http-equiv="content-type" content= + "text/html; charset=us-ascii"> + + <title>Jumps file</title> +</head> + +<body> + <dl> + <dt>?</dt> + + <dd><a href="file://localhost/Programme/lynx/jumps.htm">This + Shortcut List</a></dd> + + <dt>g</dt> + + <dd><a href="http://www.google.com/">Google</a></dd> + + <dt>nf</dt> + + <dd><a href="http://newsforge.com/">newsforge</a></dd> + + <dt>sf</dt> + + <dd><a href="http://sourceforge.net/">sourceforge</a></dd> + </dl> +</body> +</html> diff --git a/samples/jumpsUnix.html b/samples/jumpsUnix.html new file mode 100644 index 0000000..77b1fea --- /dev/null +++ b/samples/jumpsUnix.html @@ -0,0 +1,56 @@ +<html> +<head> +<title>Shortcut List</title> +<link rev="made" href="mailto:WebMaster@foo.blah.dom"> +</head> +<body> + <h1>Shortcut List</h1> + This is a sample jumps file created in the early days of Lynx: + you should use it as a template, replacing with your own choices. + See Users Guide for details of how the `j' command works. +<p> + *** IMPORTANT *** If you want to use `?' with `j' to recall + your own list of abbreviations, you must make sure + you always have the correct URL corresponding to `?' below: + otherwise, Lynx may display an incorrect list with misleading results. +<p> + *** ALSO *** The entries must be in alphabetic order, with `?' first: + otherwise, Lynx may not be able to find them all. +<p> + <b>Name</b> <b>Link</b> +<!-- The list *MUST* be kept SORTED, one entry per line --> +<dl compact> +<dt>?<dd><a href="file://localhost/CFN/info/jumps.html">This Shortcut List</a> +<dt>agreement<dd><a href="file://localhost/CFN/UserAgree.html">Chebucto FreeNet User Agreement</a> +<dt>board<dd><a href="file://localhost/CFN/BOD.html">MetroCAN Board of Directors</a> +<dt>browser<dd><a href="file://localhost/~/">Personal File Browser</a> +<dt>docteam<dd><a href="file://localhost/CFN/SAT/WorkArea.html">Documentation Team Work Area</a> +<dt>events<dd><a href="file://localhost/CFN/Utilities/search-events.html">Search all event schedules by time and keyword</a> +<dt>files<dd><a href="file://localhost/~/">Personal File Browser</a> +<dt>forward<dd><a href="lynxexec:/cfn/bin/mail-forward">Forward your mail</a> +<dt>freenets<dd><a href="http://duke.usask.ca/~scottp/free.html">FreeNets around the World</a> +<dt>help<dd><a href="file://localhost/CFN/Help/UserHelpDesk.html">Help Desk</a> +<dt>home<dd><a href="file://localhost/CFN/Home.html">Chebucto FreeNet Home Page</a> +<dt>info<dd><a href="file://localhost/CFN/Utilities/FindingInfo.html">Finding Information</a> +<dt>ip<dd><a href="file://localhost/CFN/IP/InformationProvider.html">Information Providers Committee</a> +<dt>lists<dd><a href="file://localhost/CFN/Services/MailListHome.html">Mailing Lists and Archives</a> +<dt>mail<dd><a href="lynxprog:/cfn/bin/mail">Read and/or send mail</a> +<dt>metrocan<dd><a href="file://localhost/CFN/MetroCAN.html">Metro*CAN Society</a> +<dt>new<dd><a href="file://localhost/CFN/Current/WhatsNew.html">What's New</a> +<dt>news<dd><a href="lynxprog:/cfn/bin/news">Read and Send News</a> +<dt>newsgroups<dd><a href="file://localhost/CFN/Current/newsgroups.html">List Global Newsgroups</a> +<dt>password<dd><a href="lynxexec:/cfn/bin/passwd">Change your password</a> +<dt>people<dd><a href="file://localhost/CFN/Utilities/search-user.html">Find other people</a> +<dt>profile<dd><a href="lynxprog:/cfn/bin/editor public_html/Profile.html">Update your personal profile</a> +<dt>quota<dd><a href="lynxexec:/cfn/bin/quota">View your disk usage and quota</a> +<dt>recent<dd><a href="http://www.cfn.cs.dal.ca/cgi-bin/recent">Recently Changed Documents on CFN</a> +<dt>register<dd><a href="file://localhost/CFN/AccountRegister.html">New User Registration</a> +<dt>search<dd><a href="file://localhost/CFN/Utilities/search-all.html">Search every document on CFN by keyword.</a> +<dt>technical<dd><a href="file://localhost/CFN/Technical/Technical.html">Metro*CAN Technical Committee</a> +<dt>terminal<dd><a href="lynxexec:/cfn/bin/set-term">Set your terminal type</a> +<dt>volunteer<dd><a href="file://localhost/CFN/Membership/NewVolunteer.html">Volunteer with CFN</a> +<dt>who<dd><a href="http://www.cfn.cs.dal.ca/cgi-bin/cfn-who">Find out who is online now</a> +<dt>xsearch<dd><a href="file://localhost/CFN/Utilities/xsearch.html">Search every document on CFN by keyword.</a> +</dl> +</body> +</html> diff --git a/samples/jumpsVMS.html b/samples/jumpsVMS.html new file mode 100644 index 0000000..b68412f --- /dev/null +++ b/samples/jumpsVMS.html @@ -0,0 +1,28 @@ +<html> +<head> +<title>Shortcut List</title> +<link rev="made" href="mailto:WebMaster@foo.blah.dom"> +</head> +<body> + <h1>Shortcut List</h1> + Following is a list of shortcut names and the target links associated + with them. In Lynx, pressing J followed by one of these shortcut names + will jump you directly to the link. This list will expand over time.<p> + <b>Name</b> <b>Link</b> +<!-- The list *MUST* be kept SORTED, one entry per line --> +<dl compact> +<dt>?<dd><a href="file://localhost/Lynx_Dir/jumps.html">This Shortcut List</a> +<dt>freenets<dd><a href="http://duke.usask.ca/~scottp/free.html">FreeNets around the World</a> +<dt>genhelp<dd><a href="http://www.wfeb.edu/HELP/@GCGHELP:GENHELP">GCG GenHelp</a> +<dt>genman<dd><a href="http://www.wfeb.edu/HELP/@GCGHELP:GENMANUAL">GCG GenManual</a> +<dt>home<dd><a href="http://www.wfeb.edu/">WFEB Home Page</a> +<dt>mail<dd><a href="lynxprog:mail">Read and/or send mail</a> +<dt>multinet<dd><a href="http://www.wfeb.edu/HELP/@MULTINET:MULTINET">MultiNet Help</a> +<dt>news<dd><a href="lynxprog:news">Read and Send News</a> +<dt>swing<dd><a href="lynxprog:swing sys$login">SWING File/Directory Manager</a> +<dt>swinghelp<dd><a href="http://www.wfeb.edu/HELP/@CSWING:CSWING/SWING">SWING Help</a> +<dt>vmshelp<dd><a href="http://www.wfeb.edu/HELP">VMS Help</a> +<dt>who<dd><a href="lynxexec:show users">Find out who is online now</a> +</dl> +</body> +</html> diff --git a/samples/keepviewer b/samples/keepviewer new file mode 100755 index 0000000..f5c0b2c --- /dev/null +++ b/samples/keepviewer @@ -0,0 +1,20 @@ +#!/bin/sh +# This script can be invoked as a wrapper for an external viewer by lynx, e.g., +# given this line in lynx.cfg +# XLOADIMAGE_COMMAND:keepviewer xli %s & +# it will invoke xli on a hardlink to the file (which is assumed to be in the +# temporary directory created by lynx), and clean up when the viewer exits. +# +# Parameters: +# $1 is viewer +# $2 is filename +if test $# = 2 ; then + chmod 600 $2 + myfile=`echo $2 | sed -e 's@\(.*/tmp/\)\([^/]*/\)\?\(.*\)@\1my\3@'` + ln $2 $myfile || exit 1 + trap "rm -f $myfile" 0 1 2 5 15 + eval $1 $myfile +else + echo "Usage: keepviewer <viewer> <filename>" + exit 1 +fi diff --git a/samples/lynx-demo.cfg b/samples/lynx-demo.cfg new file mode 100644 index 0000000..3a7fe88 --- /dev/null +++ b/samples/lynx-demo.cfg @@ -0,0 +1,46 @@ +# $LynxId: lynx-demo.cfg,v 1.6 2018/07/08 15:22:44 tom Exp $
+# vile:cfgmode
+# From: claudio santambrogio <claudio.santambrogio@tiscali.it>
+
+STARTFILE:file://localhost/~/home.htm
+HELPFILE:file://localhost/~/help/lynx_help_main.html.gz
+DEFAULT_INDEX_FILE:https://lynx.invisible-island.net/
+
+CHARACTER_SET:cp850
+ASSUME_CHARSET:utf-8
+
+FORCE_SSL_COOKIES_SECURE:TRUE
+COOKIE_REJECT_DOMAINS:ad.doubleclick.net
+PERSISTENT_COOKIES:TRUE
+COOKIE_FILE:~/.lynx_cookies
+COOKIE_SAVE_FILE:~/.lynx_cookies
+
+DEFAULT_CACHE_SIZE:100
+DEFAULT_VIRTUAL_MEMORY_SIZE:5120000
+SOURCE_CACHE:memory
+
+DEFAULT_USER_MODE:INTERMEDIATE
+VERBOSE_IMAGES:FALSE
+MAKE_PSEUDO_ALTS_FOR_INLINES:FALSE
+MINIMAL_COMMENTS:TRUE
+
+COLOR:0:lightgray:black
+COLOR:1:red:black
+COLOR:2:yellow:blue
+COLOR:4:green:black
+COLOR:5:brown:black
+COLOR:6:brightred:black
+COLOR:7:white:brightgreen
+
+PRETTYSRC:TRUE
+HTMLSRC_TAGNAME_XFORM:0
+HTMLSRC_ATTRNAME_XFORM:0
+
+# set these to empty strings to eliminate dependency on external programs
+CHMOD_PATH:
+COPY_PATH:
+MKDIR_PATH:
+MV_PATH:
+RMDIR_PATH:
+RM_PATH:
+TOUCH_PATH:
diff --git a/samples/lynx-keymaps b/samples/lynx-keymaps new file mode 100644 index 0000000..2801bb7 --- /dev/null +++ b/samples/lynx-keymaps @@ -0,0 +1,161 @@ +# $LynxId: lynx-keymaps,v 1.7 2013/10/13 20:40:00 tom Exp $ +# +# This is a sample key sequence definition file. It is used by Lynx when +# built with ncurses or slang, to augment the definitions from your terminal's +# termcap or terminfo description. + +# (Lynx implements this mechanism only if USE_KEYMAPS is defined during +# compilation, which has nothing to do with the KEYMAP directives in lynx.cfg, +# see source file LYCurses.h.) + +# Lines that start with a '#' are comment lines. Blank lines are ignored. + +# The 'setkey' function may be used in two ways: +# +# 1. setkey ESC-SEQUENCE KEYSYM +# 2. setkey ESC-SEQUENCE KEYSYM_NAME +# +# where KEYSYM is an integer. A keysym is essentially with the lynx.cfg +# file calls a 'keystroke', but I think that keysym is a more appropriate +# name. The keysym is an integer and may be expressed in various ways: +# +# as a decimal integer: 97 +# hexadecimal: 0x61 +# Octal: 0141 +# as an ASCII character: 'a' +# +# Some keysyms may be expressed symbolically as a keysym name using the +# second form. The currently recognized symbolic names are: +# +# UPARROW +# DNARROW +# RTARROW +# LTARROW +# PGDOWN +# PGUP +# HOME +# END +# F1 +# F2 +# F3 +# F4 +# F5 +# F6 +# F7 +# F8 +# F9 +# F10 +# F11 +# F12 +# DO_KEY +# FIND_KEY +# SELECT_KEY +# INSERT_KEY +# REMOVE_KEY +# DO_NOTHING +# +# It does not matter if your keyboard does not have some of the keys +# implied by the above names. The fact is that lynx uses these keys as an +# an intermediate representation. +# +# The ESC-SEQUENCE should be enclosed in double quotes. The '^' character +# is special and indicates a control character, e.g., ^K is Ctrl-K. An ESC +# character (ascii 27) may be represented as ^[. As an example, many +# terminals have arrow keys that emit 'ESC [ A' for the UP arrow. This may +# be represented as the escape sequence "^[[A". The default keymapping is +# given below: +# +setkey "\033[A" UPARROW +setkey "\033OA" UPARROW +setkey "\033[B" DNARROW +setkey "\033OB" DNARROW +setkey "\033[C" RTARROW +setkey "\033OC" RTARROW +setkey "\033[D" LTARROW +setkey "\033OD" LTARROW +setkey "\033[1~" FIND_KEY +setkey "\033[2~" INSERT_KEY +setkey "\033[3~" REMOVE_KEY +setkey "\033[4~" SELECT_KEY +setkey "\033[5~" PGUP +setkey "\033[6~" PGDOWN +setkey "\033[8~" END +setkey "\033[7~" HOME +setkey "\033[28~" F1 +setkey "\033[29~" DO_KEY +# +# All other keys map to themselves, e.g, +# +setkey "a" 'a' +# +# Now suppose that your terminal produces different escape sequences for +# HOME and END. In particular, suppose that the home key produces 'ESC [ +# H' and that the end key produces 'ESC [ K'. Then these may be defined to +# map to lynx HOME and END keys via +# +setkey "^[[H" HOME +setkey "^[[K" END +# +# Similarly, we may map emacs-like sequences to these functions: +# +setkey "^[<" HOME +setkey "^[>" END +# +# Note that it may be impossible to map several sequences to the same +# keysym (NCURSES only?), in that case the mapping occurring last wins. +# +# The following maps a sequence commonly used for Shift+Tab to the +# corresponding code. It should not be needed if the terminfo file +# has the correct info for kcbt. +# +setkey "^[[Z" 0x10F +# +# Other special escapes: +# \a bell +# \b backspace +# \f form-feed +# \n newline (line-feed) +# \r carriage-return +# \t tab +# \v vertical tab +# \<number> octal number, up to 3 digits, e.g., "\033". +# \d<number> decimal number, up to 3 digits, e.g., "\d99" +# \x<number> hexadecimal number, up to 2 digits, e.g., "\xFF" +# +# For Unix-systems (which have termcap or terminfo) you may also use symbols +# that refer to the termcap/terminfo, by referencing the name bracketed by +# "^(" and ")", e.g., +setkey "^(cuu1)" UPARROW +setkey "^(up)" UPARROW +# +# The following extension, introduced after lynx2.8.2, allows to force +# recognition of meta (ESC) prefixes - especially useful with the +# "Bash-like" lineeditor binding. Its use is unnecessary in most +# cases if Lynx was built with ncurses, but is probably necessary for +# all keys that should recognize ESC as a prefix if Lynx was built with +# slang. +# +# setkey ESC-SEQUENCE Meta-LETTER +# setkey ESC-SEQUENCE Meta-KEYSYM +# setkey ESC-SEQUENCE Meta-KEYSYM_NAME +# +# for example +#setkey "\033b" Meta-b +#setkey "\033e" Meta-'e' +#setkey "\033\033[28~" Meta-F1 +# +# The following extensions, introduced after lynx2.8.2, allow mapping +# escape sequences directly to key commands (lynxactioncodes). +# +# setkey ESC-SEQUENCE LAC:LYNX_ACTION +# setkey ESC-SEQUENCE LAC:LYNX_ACTION:LYNX_EDITACTION +# +# where LYNX_ACTION is a key command specified as for lynx.cfg KEYMAP +# options and as listed on the KEYMAP ('K') screen, and LYNX_EDITACTION +# is a line-editor action specified as for KEYMAP and as listed in Line +# Editor help pages. Using this form makes remapping according to user +# preference with KEYMAP impossible, and should thus be used sparingly +# (in general, use KEYMAP with PASS instead, if the goal is to force +# recognition of a key in form text fields). For example: +# +#setkey "\033e" LAC:EDITTEXTAREA:PASS diff --git a/samples/lynx.bat b/samples/lynx.bat new file mode 100644 index 0000000..417cd74 --- /dev/null +++ b/samples/lynx.bat @@ -0,0 +1,31 @@ +@echo off
+@rem $LynxId: lynx.bat,v 1.9 2018/03/21 16:10:36 tom Exp $
+@rem demonstrate lynx with color-style
+setlocal
+
+ set TERM=vt100
+rem Set HOME to make URLs in config work, though this prevents -trace
+ set HOME=%~dp0
+ set PATH=%HOME%;%PATH%
+
+rem We need a temporary directory
+ if not "x%LYNX_TEMP_SPACE%"=="x" goto :do_cfg
+ if "x%TEMP%"=="x" set LYNX_TEMP_SPACE=%TEMP%
+ if not "x%TEMP%"=="x" goto :do_cfg
+ if "x%TMP%"=="x" set LYNX_TEMP_SPACE=%TMP%
+ if not "x%TMP%"=="x" goto :do_cfg
+
+ set LYNX_TEMP_SPACE=%HOMEDRIVE%%HOMEPATH%tmp
+ mkdir "%LYNX_TEMP_SPACE%"
+ if not errorlevel 0 goto :do_cfg
+
+ echo Cannot make temp-directory
+ goto :eof
+
+:do_cfg
+ set LYNX_CFG_PATH=%HOME%
+ set LYNX_CFG=%HOME%lynx-demo.cfg
+ set LYNX_LSS=%HOME%lynx.lss
+
+ lynx.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
+endlocal
diff --git a/samples/lynx.com b/samples/lynx.com new file mode 100644 index 0000000..568d3e2 --- /dev/null +++ b/samples/lynx.com @@ -0,0 +1,59 @@ +$ ! LYNX.COM +$ ! sets up lynx as a command so that it will accept command line arguments +$ ! It is assumed that this file is located in the same place as the LYNX +$ ! Image. If it is not then you must change the lynx symbol. +$ ! Written by Danny Mayer, Digital Equipment Corporation +$ ! +$ ! +$ THIS_PATH = F$PARSE(F$ENV("PROCEDURE"),,,"DEVICE") + - + F$PARSE(F$ENV("PROCEDURE"),,,"DIRECTORY") +$ alpha = F$GETSYI("HW_MODEL") .GT. 1023 +$ ! +$ CPU := VAX +$ IF alpha THEN CPU :== AXP +$ lynx:==$'THIS_PATH'lynx_'CPU'.exe +$! +$! fill in another gateway if you wish +$! +$define "WWW_wais_GATEWAY" "http://www.w3.org:8001" +$! +$! fill in your NNTP news server here +$! +$ !define "NNTPSERVER" "news" +$ ! +$ ! Set up the Proxy Information Here +$ ! +$ ! no_proxy environmental variable +$ ! The no_proxy environmental variable is checked to get the list of +$ ! of hosts for which the proxy server is not consulted. +$ ! NOTE: THE no_proxy VARIABLE MUST BE IN LOWER CASE. On VMS systems +$ ! this is accomplished by defining a logical name in double-quotes. +$ ! +$ ! The no_proxy environmental variable is a comma-separated or +$ ! space-separated list of machine or domain names, with optional +$ ! :port part. If no :port part is present, it applies to all ports +$ ! on that domain. +$ ! +$ ! Example: +$ ! define "no_proxy" "cern.ch,some.domain:8001" +$ ! +$ ! +$ define "no_proxy" "yourorg.com" ! Use only for outside of yourorg +$ ! +$ ! proxy server environmental variables +$ ! In Lynx, each protocol needs an environmental variable defined for +$ ! it in order for it to use a proxy server set up for that protocol. +$ ! The proxy environmental variable is of the form: +$ ! protocol_proxy where protocol is the protocol name part of the URL, +$ ! for example: http or ftp. NOTE: the protocol server proxy variable +$ ! MUST BE IN LOWER CASE. +$ ! Example: +$ ! define "http_proxy" "http://your_proxy.yourorg:8080/" +$ ! +$ Proxy_Server = "http://your_proxy.yourorg:8080/" +$ define "http_proxy" "''Proxy_Server'" +$ define "ftp_proxy" "''Proxy_Server'" +$ define "gopher_proxy" "''Proxy_Server'" +$ define "news_proxy" "''Proxy_Server'" +$ define "wais_proxy" "''Proxy_Server'" +$ ! diff --git a/samples/lynx.ico b/samples/lynx.ico Binary files differnew file mode 100644 index 0000000..2bde5f8 --- /dev/null +++ b/samples/lynx.ico diff --git a/samples/lynx.lss b/samples/lynx.lss new file mode 100644 index 0000000..2d02eb1 --- /dev/null +++ b/samples/lynx.lss @@ -0,0 +1,115 @@ +# Setting the normal and default types lets us keep (almost) the same colors +# whether the terminal's default colors are white-on-black or black-on-white. +# It is not exact since the default "white" is not necessarily the same color +# as the ANSI lightgray, but is as close as we can get in a standard way. +# +# If you really want the terminal's default colors, and if lynx is built using +# ncurses' default-color support, remove these two lines: +normal: normal: lightgray:black +default: normal: white:black + +# Normal type styles correspond to HTML tags. +# +# The next line (beginning with "em") means: use bold if mono, otherwise +# brightblue on <defaultbackground> +em: bold: brightblue +strong: bold: brightred +b: bold: red +i: bold: brightblue +a: bold: green +img: dim: brown +fig: normal: gray +caption: reverse: brown +hr: normal: yellow +blockquote: normal: brightblue +ul: normal: brown +address: normal: magenta +title: normal: magenta +tt: dim: brightmagenta: black +h1: bold: yellow: blue +label: normal: magenta +q: normal: yellow: magenta +small: dim: default +big: bold: yellow +sup: bold: yellow +sub: dim: gray +li: normal: magenta +code: normal: cyan +cite: normal: cyan + +table: normal: brightcyan +tr: bold: brown +td: normal: default +br: normal: default + +# Special styles - not corresponding directly to HTML tags +# alert - status bar, when message begins "Alert". +# alink - active link +# normal - default attributes +# status - status bar +# whereis - whereis search target +# +#normal:normal:default:blue +alink: reverse: yellow: black +status: reverse: yellow: blue +alert: bold: yellow: red +whereis: reverse+underline: magenta: cyan +# currently not used +#value:normal:green + +menu.bg: normal: black: lightgray +menu.frame: normal: black: lightgray +menu.entry: normal: lightgray: black +menu.n: normal: red: gray +menu.active: normal: yellow: black +menu.sb: normal: brightred: lightgray + +forwbackw.arrow:reverse +hot.paste: normal: brightred: gray + +# Styles with classes - <ul class=red> etc. +ul.red: underline: brightred +ul.blue: bold: brightblue +li.red: reverse: red: yellow +li.blue: bold: blue +strong.a: bold: black: red +em.a: reverse: black: blue +strong.b: bold: white: red +em.b: reverse: white: blue +strong.debug: reverse: green +font.letter: normal: white: blue +input.submit: normal: cyan +tr.baone: bold: yellow +tr.batwo: bold: green +tr.bathree: bold: red +# +# Special handling for link. +link: normal: white +link.green: bold: brightgreen +link.red: bold: black: red +link.blue: bold: white: blue +link.toc: bold: black: white +# Special cases for link - the rel or title is appended after the class. +# <link rel=next class=red href="1"> +link.red.next: bold: red +link.red.prev: bold: yellow: red +link.blue.prev: bold: yellow: blue +link.blue.next: bold: blue +link.green.toc: bold: white: green +# +# Define styles that will be used when syntax highlighting is requested +# (commandline option -prettysrc). +span.htmlsrc_comment:normal: white +span.htmlsrc_tag:normal: white +#If you don't like that the tag name and attribute name are displayed +#in different colors, comment the following line. +span.htmlsrc_attrib:normal: cyan +span.htmlsrc_attrval:normal: magenta +span.htmlsrc_abracket:normal: white +span.htmlsrc_entity:normal: white +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal: red +span.htmlsrc_badtag:normal: red +span.htmlsrc_badattr:normal: red +span.htmlsrc_sgmlspecial:normal: yellow diff --git a/samples/lynx_bookmarks.htm b/samples/lynx_bookmarks.htm new file mode 100644 index 0000000..378f28c --- /dev/null +++ b/samples/lynx_bookmarks.htm @@ -0,0 +1,13 @@ +<head>
+<meta http-equiv="content-type" content="text/html;charset=windows-1252">
+<title>Bookmark file</title>
+</head>
+ You can delete links by the 'R' key<br>
+<ol>
+<li><a href="https://lynx.invisible-island.net/">Lynx homepage</a>
+<li><a href="http://home.pacific.net.sg/~kennethkwok/lynx/">Lynx Browser for Windows 9x/NT/2000/XP</a>
+<li><a href="http://www.fdisk.com/doslynx/lynxport.htm">Lynx for DOS 386 and Win32</a>
+<li><a href="http://www.chass.utoronto.ca/~purslow/lhfb.html">Lynx Help for Beginners</a>
+<li><a href="http://www.hicom.net/~oedipus/weave.html">HTML Authoring and Accessibility Resources for Lynx</a>
+<li><a href="http://perso.club-internet.fr/dominique.guebey/tekno/lynx.htm">La page navigateur LYNX</a>
+<li><a href="https://lynx.invisible-island.net/release/">Current Lynx Release</a>
diff --git a/samples/lynxdump b/samples/lynxdump new file mode 100755 index 0000000..a0e9ae2 --- /dev/null +++ b/samples/lynxdump @@ -0,0 +1,16 @@ +#!/bin/sh +# lynx -dump w/o numbers +: ${TMPDIR-/tmp} +: ${HOME-`pwd`} +oldmask=`umask` +umask 077 +MYTMP=$TMPDIR/mytmp$$ +mkdir $MYTMP || exit 1 +trap 'cd /; rm -rf $MYTMP' 0 1 2 5 15 +if test $HOME/.lynxrc ; then + cp $HOME/.lynxrc $MYTMP/.lynxrc +fi +echo 'keypad_mode=NUMBERS_AS_ARROWS' >> $MYTMP/.lynxrc +HOME=$MYTMP; export HOME +umask $oldmask +lynx -justify -dump -force_html -with_backspaces -nolist $* diff --git a/samples/mailcap b/samples/mailcap new file mode 100644 index 0000000..8f47338 --- /dev/null +++ b/samples/mailcap @@ -0,0 +1,99 @@ +# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore) +# +# Permission to use, copy, modify, and distribute this material +# for any purpose and without fee is hereby granted, provided +# that the above copyright notice and this permission notice +# appear in all copies, and that the name of Bellcore not be +# used in advertising or publicity pertaining to this +# material without the specific, prior written permission +# of an authorized representative of Bellcore. BELLCORE +# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY +# OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", +# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. +# +# Prototype Mailcap file +# Note that support for text & multipart are "built in" to metamail, +# as are rudimentary support for message, and application. +# However, any of these may be overridden in mailcap. +# +# Note that users may override or extend this with a .mailcap +# file in their own directory. However, there is NO NEED +# for them to copy entries from this file, as metamail will +# pick up entries from both the system and personal mailcap files. +# + +# NOTE: This file has been heavily modified for use as an example +# configuration file for Lynx + +# In the samples given test=test -n "$DISPLAY" is used to +# determine if the current session is X capable by checking +# for the existence of a DISPLAY environment variable. +# Lynx actually uses a getenv() call for DISPLAY (DECW$DISPLAY +# on VMS) when it encounters test=test -n "$DISPLAY" or +# test=test -z "$DISPLAY" in a viewer assignment, instead of +# spawning to execute "test" via a system() call, i.e., those +# two strings, respectively, are handled equivalently to the +# :XWINDOWS and :NON_XWINDOWS flags for VIEWER: assignments +# in lynx.cfg. Any system without the DISPLAY (or DECW$DISPLAY) +# environment variable will be assumed to be Non-X. + +# You can append a ';' followed by "q=#.#", e.g., ; q=0.002 +# to set the quality parameter for the Content-Type, which can be +# included in the Accept: header Lynx sends to http servers (the +# default quality value is 1.0, and Lynx appends the parameter +# to the Content-Type only if the value is less than 1.0). + +# You can append a ';' followed by "mxb=#", e.g., ; mxb=1000000 +# to set the maxbytes parameter for the Content-Type, which can be +# included in the Accept: header Lynx sends to http servers (the +# default maxbytes value is 0, meaning no maximum, and Lynx appends +# the parameter to the Content-Type only if the value exceeds 0). + +# The following line is for sites where xv understands jpeg but xloadimage +# is preferred. +# +# the test line specifies that this viewer should only be used if +# the display variable is set. +image/jpeg; xv %s; test=test -n "$DISPLAY" + +# The following sends all other image subtypes to xloadimage +#image/*; xloadimage %s; ; test=test -n "$DISPLAY" + +# The following sends all other image subtypes to xv +image/*; xv %s; ; test=test -n "$DISPLAY" + + +# If you have an interactive Postscript interpreter, you should think carefully +# before replacing lpr with it in the following line, because PostScript +# can be an enormous security hole. It is RELATIVELY harmless +# when sent to the printer... + +# This one is for NON-X +#application/postscript; lpr %s \; echo SENT FILE TO PRINTER; ;test=test -z "$DISPLAY" + +# This one is for X. It's already the default via src/HTInit.c. +#application/postscript; ghostview %s; ; test=test -n "$DISPLAY" + +# The following should be commented out if you do NOT have safe-tcl +# and should be uncommented if you DO have safe-tcl +#application/safe-tcl; swish -safe -messaging -f %s + +# A common problem with the mailcap mechanism is getting differential +# behavior from different programs. This problem is compounded by the fact +# that some programs, notably Mosaic, do not implement the "test" clause in +# mailcap files. If you are using Lynx and X Mosaic together you should +# place all X-centric entries before non-X entries. X Mosaic will use +# whichever entry is defined first so further entries will be ignored. +# +# Lynx exports the environment variable LYNX_VERSION, so it can be tested +# by scripts to determine if Lynx is running or not. However, the string +# test=test -n "$LYNX_VERSION" +# is handled simply as a flag which yields success when Lynx encounters it +# in the mailcap file (i.e., Lynx does not bother to execute "test" via a +# system() call to find out if it's running, because it obviously is). +# Inclusion of the string for that test can be used to prevent other +# software which reads the mailcap file from acting on assignments intended +# only for Lynx. The string +# test=test -z "$LYNX_VERSION" +# similarly is treated by Lynx simply as a flag which yields failure. + diff --git a/samples/mailto-form.pl b/samples/mailto-form.pl new file mode 100755 index 0000000..5afffc8 --- /dev/null +++ b/samples/mailto-form.pl @@ -0,0 +1,280 @@ +#! /usr/bin/perl -w +# Some scripts for handling mailto URLs within lynx via an interactive form +# +# Warning: this is a quick demo, to show what kinds of things are possible +# by hooking some external commands into lynx. Use at your own risk. +# +# Requirements: +# +# - Perl and CGI.pm. +# - A "sendmail" command for actually sending mail (if you need some +# other interface, change the code below in sub sendit appropriately). +# - Lynx compiled with support for lynxcgi, that means EXEC_CGI must have +# been defined at compilation, usually done with +# ./configure --enable-cgi-links +# - Lynx must have support for CERN-style rules as of 2.8.3, which must +# not have been disabled at compilation (it is enabled by default). +# +# Instructions: +# (This is for people without lynxcgi experience; if you are already +# use lynxcgi, you don't have to follow everything literally, use +# common sense for picking appropriate file locations in your situation.) +# +# - Make a subdirectory 'lynxcgi' under you home directory, i.e. +# mkdir ~/lynxcgi +# - Put this three script file mailto-form.pl there and make it +# executable. For example, +# cp mailto-form.pl ~/lynxcgi +# chmod a+x ~/lynxcgi/mailto-form.pl +# - Edit mailto-form.pl (THIS FILE), there are some strings that +# that need to be changed, see ### Configurable variables ### +# below. +# - Allow lynx to execute lynxcgi files in that directory, for example, +# put in your lynx.cfg file: +# TRUSTED_LYNXCGI:<tab>/home/myhomedir/lynxcgi/mailto-form.pl +# where <tab> is a real TAB character and you have to put the real +# location of your directory in place of "myhomedir", of course. +# The '~' abbreviation cannot be used. +# You could also just enable execution of all lynxcgi scripts, by +# not having any TRUSTED_LYNXCGI options in lynx.cfg at all, but +# that can't be recommended. +# - Tell lynx to actually use the lynxcgi scripts for mailto URLs. +# There are two variants: +# a) Redirect "mailto" +# Requires patched lynx, currently not yet in the developent code. +# Use the following two lines in the file that is configured as +# RULESFILE in lynxcfg: +# PermitRedirection mailto:* +# Redirect mailto:* lynxcgi:/home/myhomedir/lynxcgi/mailto-form.pl?from=myname@myhost&to=* +# You can also put them directly in lynx.cfg, prefixing each with +# "RULE:". Replace ""myhomedir", "myname", and "myhost" with your +# correct values, of course. +# b) Redirect "xmailto" +# Requires defining a fake proxy before starting lynx, like +# export xmailto_proxy=dummy # or for csh: setenv xmailto_proxy dummy +# Requires that you change "mailto" to "xmailto" each time you want +# to activate a mailto link. This can be done conveniently with +# a few keys: 'E', ^A, 'x', Enter. +# Use the following two lines in the file that is configured as +# RULESFILE in lynxcfg: +# PermitRedirection xmailto:* +# Redirect xmailto:* lynxcgi:/home/myhomedir/lynxcgi/mailto-form.pl?from=myname@myhost&to=* +# You can also put them directly in lynx.cfg, prefixing each with +# "RULE:". Replace ""myhomedir", "myname", and "myhost" with your +# correct values, of course. +# +# Limitations: +# +# - Only applies to mailto URLs that appear as links or are entered at +# a 'g'oto prompt. Does not apply to other ways of sending mail, like +# the 'c' (COMMENT) key, mailto as a FORM action, or mailing a file +# from the 'P'rinting Options screen. +# - Nothing is done for charset labelling, content-transfer-encoding +# of non-ASCII characters, and other MIME niceties. +# +# Klaus Weide 20000712 + +######################################################################## +########## Configurable variables ###################################### + +$SENDMAIL = '/usr/sbin/sendmail'; +# The location of your sendmail binary +$SELFURL = 'lynxcgi:/home/lynxdev/lynxcgi/mailto-form.pl'; +# Where this script lives in URL space +$SEND_TOKEN = '/vJhOp6eQ'; +# When found in the PATH_INFO part of the URL, +# this causes the script to actually send mail +# by calling $SENDMAIL instead of just throwing +# up a form. CHANGE IT! And don't tell anyone! +# Treat it like a password. +# Must start with '/', probably should have only +# alphanumeric ASCII characters. + +## Also, make sure the first line of this script points +## to your PERL binary + +########## Nothing else to change - I hope ############################# +######################################################################## + +use CGI; + +$|=1; + +### Upcase first character +##sub ucfirst { +## s/^./\U$1/; +##} + +# If there are multiple occurrences of the same thing, how to join them +# into one string +%joiner = (from => ', ', + to => ', ', + cc => ', ', + subject => '; ', + body => "\n\n" + ); +sub joiner { + my ($key) = @_; + if ($joiner{$key}) { + $joiner{$key}; + } else { + " "; + } +} + +# Here we check whether this script is called for actual sending, rather +# than form generation. If so, all the rest is handled by sub sendit, below. +$pathinfo = $ENV{'PATH_INFO'}; +if (defined($pathinfo) && $pathinfo eq $SEND_TOKEN) { + $q = new CGI; + print $q->header('text/plain'); + sendit(); + exit; +} + +$method = $ENV{'REQUEST_METHOD'}; +$querystring = $ENV{'QUERY_STRING'}; +if ($querystring) { + if ($method && $method eq "POST" && $ENV{'CONTENT_LENGTH'}) { + $querystring =~ s/((^|\&)to=[^?&]*)\?/$1&/; + $q0 = new CGI; + $q = new CGI($querystring); + @fields = $q0->param(); + foreach $key (@fields) { + @vals = $q0->param($key); +# print "Content-type: text/html\n\n"; +# print "Appending $key to \$q...\n"; + $q->append($key, @vals); +# print "<H2>Current Values in \$q0</H2>\n"; +# print $q0->dump; +# print "<H2>Current Values in \$q</H2>\n"; +# print $q->dump; + + } + + } else { + $querystring =~ s/((^|\&)to=[^?&]*)\?/$1&/; + $q = new CGI($querystring); + } +} else { + $q = new CGI; +} + +print $q->header; + +$long_title = $ENV{'QUERY_STRING'}; +$long_title =~ s/^from=([^&]*)\&to=//; +$long_title = "someone" unless $long_title; +$long_title = "Compose mail for $long_title"; +if (length($long_title) > 72) { + $title = substr($long_title,0,72) . "..."; +} else { + $title = $long_title; +} +$long_title =~ s/&/&/g; +$long_title =~ s/</</g; +print + $q->start_html($title), "\n", + $q->h1($long_title), "\n", + $q->start_form(-method=>'POST', -action => $SELFURL . $SEND_TOKEN), "\n"; + +print "<TABLE>\n"; +@fields = $q->param(); +foreach $key (@fields) { + @vals = $q->param($key); + if (scalar(@vals) != 1) { + print "multiple values " . scalar(@vals) ." for $key!\n"; + $q->param($key, join (joiner($key), @vals)); + } +} +foreach $key (@fields) { + $_ = lc($key); + if ($_ ne $key) { + print "noncanonical case for $key!\n"; + $val=$q->param($key); + $q->delete($key); + if (!$q->param($_)) { + $q->param($_, $val); + } else { + $q->param($_, $q->param($_) . joiner($_) . "$val"); + } + } +} +foreach $key ('from', 'to', 'cc', 'subject') { + print $q->Tr, + $q->td(ucfirst($key) . ":"), + $q->td($q->textfield(-name=>$key, + -size=>60, + -default=>$q->param($key))), "\n"; + $q->delete($key); +} + +# Also pass on any unrecognized header fields that were specified. +# This may not be a good idea for general use! +# At least some dangerous header fields may have to be suppressed. +@keys = $q->param(); +if (scalar(@keys) > (($q->param('body')) ? 1 : 0)) { + print "<TR><TD colspan=2><EM>Additional headers:</EM>\n"; + foreach $key ($q->param()) { + if ($key ne 'body') { + print $q->Tr, + $q->td(ucfirst($key) . ":"), + $q->td($q->textfield(-name=>$key, + -size=>60, + -default=>$q->param($key))), "\n"; + } + } +} +print "</TABLE>\n"; +print $q->textarea(-name=>'body', + -default=>$q->param('body')), "\n"; +print "<PRE>\n\n</PRE>", "\n", + $q->submit(-value=>"Send the message"), "\n", + $q->endform, "\n"; + +print "\n"; +exit; + +# This is for header field values. +sub sanitize_field_value { + my($val) = @_; + $val =~ s/\0/./g; + $val =~ s/\r\n/\n/g; + $val =~ s/\r/\n/g; + $val =~ s/\n*$//g; + $val =~ s/\n+/\n/g; + $val =~ s/\n(\S)/\n\t$1/g; + $val; +} + +sub sendit { + open (MAIL, "| $SENDMAIL -t -oi -v") || die ("$0: Can't run sendmail: $!\n"); + @fields = $q->param(); + foreach $key (@fields) { + @vals = $q->param($key); + if (scalar(@vals) != 1) { + print "multiple values " . scalar(@vals) ." for $key!\n"; + $q->param($key, join (joiner($key), @vals)); + } + } + foreach $key (@fields) { + if ($key ne 'body') { + if ($key =~ /[^A-Za-z0-9_-]/) { + print "$0: Ignoring malformed header field named '$key'!\n"; + next; + } + print MAIL ucfirst($key) . ": " . + sanitize_field_value($q->param($key)) . "\n" + or die ("$0: Feeding header to sendmail failed: $!\n"); + } + } + print MAIL "\n" + or die ("$0: Ending header for sendmail failed: $!\n"); + print MAIL $q->param('body'), "\n" + or die ("$0: Feeding body to sendmail failed: $!\n"); + close(MAIL) + or warn $! ? "Error closing pipe to sendmail: $!" + : ($? & 127) ? ("Sendmail killed by signal " . ($? & 127) . + ($? & 127) ? ", core dumped" : "") + : "Return value " . ($? >> 8) . " from sendmail"; +} diff --git a/samples/midnight.lss b/samples/midnight.lss new file mode 100644 index 0000000..8ecb772 --- /dev/null +++ b/samples/midnight.lss @@ -0,0 +1,84 @@ +# From: claudio santambrogio <claudio.santambrogio@tiscali.it> + +em:bold:green:blue +strong:bold:red:blue +b:bold:white:blue +i:bold:yellow:blue +alink:reverse:brightgreen:blue
+a:bold:cyan:blue +img:dim:gray:blue +status:reverse:brightblue:blue
+forwbackw.arrow:bold:brightblue:blue
+alert:bold:red:blue +fig:normal:gray:blue +caption:reverse:brown:blue +hr:normal:yellow:blue +blockquote:normal:brightblue:blue +#ul:normal:brown:blue +address:normal:magenta:blue +title:normal:grey:blue +tt:dim:gray:blue +h1:bold:brightblue:blue +label:normal:magenta:blue +value:normal:green:blue +high:bold:brightmagenta:blue +q:normal:yellow:magenta +small:dim:gray:blue +big:bold:yellow:blue +sup:bold:yellow:blue +sub:dim:gray:blue +lh:bold:yellow:magenta + +area:normal:default:blue +body:normal:default:blue +br:normal:default:blue +center:normal:default:blue +center.header:normal:default:blue +div:normal:default:blue +font:normal:default:blue +font.letter:normal:default:blue +h2:normal:default:blue +h3:normal:default:blue +h4:normal:default:blue +h5:normal:default:blue +h6:normal:default:blue +head:normal:default:blue +link:normal:default:blue +map:normal:default:blue +meta:normal:default:blue +p:normal:default:blue +table:normal:default:blue +td:normal:default:blue +tr:normal:default:blue +title:normal:default:blue + +form:normal:default:blue +input:normal:default:blue +input.submit:normal:cyan:blue +select:normal:default:blue +option:normal:default:blue + +pre:normal:default:blue +dd:normal:default:blue +dt:normal:default:blue +ul:normal:default:blue +li:normal:default:blue + +base:normal:default:blue +iframe:normal:red:blue +cite:normal:yellow:blue + +span.htmlsrc_comment:normal:green:blue +span.htmlsrc_tag:normal:brightgreen:blue +span.htmlsrc_attrib:normal:cyan:blue +span.htmlsrc_attrval:normal:white:blue +span.htmlsrc_abracket:normal:brightgreen:blue +span.htmlsrc_entity:normal:white:blue +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal:red:blue +span.htmlsrc_badtag:normal:red:blue +span.htmlsrc_badattr:normal:red:blue +span.htmlsrc_sgmlspecial:normal:yellow:blue
+
+normal:normal:default:blue
\ No newline at end of file diff --git a/samples/mild-colors.lss b/samples/mild-colors.lss new file mode 100644 index 0000000..2807e50 --- /dev/null +++ b/samples/mild-colors.lss @@ -0,0 +1,59 @@ +# From: Vlad Harchev <hvv@hippo.ru> +# Setting the normal and default types lets us keep (almost) the same colors +# whether the terminal's default colors are white-on-black or black-on-white. +# It is not exact since the default "white" is not necessarily the same color +# as the ANSI lightgray, but is as close as we can get in a standard way. +# +# If you really want the terminal's default colors, and if lynx is built using +# ncurses' default-color support, remove these two lines: +normal: normal: lightgray:black +default: normal: white:black + +# Notes: +# better for eyes - it sets black background with mild colors that +# have approximately the same intensity. +# +# grey normal text on black background with green links and brightgreen +# highlighted links. +em: bold: cyan +strong: bold: cyan +dt: bold: cyan +var: bold: cyan +samp: bold: cyan +b: bold: cyan +i: bold: cyan +alink: reverse: brightgreen: black +a: bold: green +img: dim: cyan: black +status: reverse: cyan: black +fig: normal: gray +caption: reverse: cyan +hr: normal: gray +blockquote: normal: cyan: black +address: normal: cyan +title: normal: cyan: black +tt: normal: white: black +h1: bold: cyan: black +label: normal: cyan +value: normal: cyan +q: normal: cyan +small: dim: cyan +big: bold: cyan +sup: bold: cyan +sub: dim: cyan +code: normal: cyan + +span.htmlsrc_comment:normal:white +span.htmlsrc_tag:normal:cyan +##the following makes no difference (except increasing the speed) since tag +##is already in cyan. +#span.htmlsrc_attrib:normal:cyan +#span.htmlsrc_attrval:normal:magenta +span.htmlsrc_abracket:normal:cyan +span.htmlsrc_entity:normal:white +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal:red +span.htmlsrc_badtag:normal:red +span.htmlsrc_badattr:normal:red +span.htmlsrc_sgmlspecial:normal:yellow diff --git a/samples/mime.types b/samples/mime.types new file mode 100644 index 0000000..6393c30 --- /dev/null +++ b/samples/mime.types @@ -0,0 +1,26 @@ +# example mime.types file. +# see the NCSA X Mosaic documentation at +# http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/extension-map.html +# for more details +# [Lynx uses mime.types mapping for ftp and local files only, +# http server does specify MIME type in the Content-Type header]. + +application/postscript ai eps ps +application/rtf rtf +application/x-tex tex +application/x-texinfo texinfo texi +application/x-troff t tr roff +audio/basic au snd +audio/x-aiff aif aiff aifc +audio/x-wav wav +image/gif gif +image/ief ief +image/jpeg jpeg jpg jpe +image/tiff tiff tif +image/x-xwindowdump xwd +text/html html +text/plain txt c cc h +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-msvideo avi +video/x-sgi-movie movie diff --git a/samples/oldlynx b/samples/oldlynx new file mode 100755 index 0000000..79721b1 --- /dev/null +++ b/samples/oldlynx @@ -0,0 +1,24 @@ +#!/bin/sh +# invoke lynx built with color-style, overriding the color options to use the +# non-color-style scheme -TD + +my_cfg=${TMPDIR:-/tmp}/lynxcfg$$ +my_lss=${TMPDIR:-/tmp}/lynxlss$$ +trap "rm -f $my_lss $my_cfg" 0 1 2 5 15 + +echo >$my_lss + +rm -f "$my_cfg" +echo "DEFAULT_COLORS:off" >>$my_cfg +if test -n "$LYNX_CFG" ; then + echo "include:$LYNX_CFG" >>$my_cfg +fi +echo "COLOR_STYLE:" >>$my_cfg +echo "NESTED_TABLES:off" >>$my_cfg + +LYNX_CFG=$my_cfg +export LYNX_CFG +LYNX_LSS=$my_lss +export LYNX_LSS + +${LYNX_PROG-lynx} "$@" diff --git a/samples/oldlynx.bat b/samples/oldlynx.bat new file mode 100644 index 0000000..976b3a8 --- /dev/null +++ b/samples/oldlynx.bat @@ -0,0 +1,44 @@ +@ECHO off
+@rem $LynxId: oldlynx.bat,v 1.8 2018/03/21 16:08:49 tom Exp $
+@rem demonstrate lynx without color-style
+setlocal
+
+ set TERM=vt100
+rem Set HOME to make URLs in config work, though this prevents -trace
+ set HOME=%~dp0
+ set PATH=%HOME%;%PATH%
+
+rem We need a temporary directory
+ if not "x%LYNX_TEMP_SPACE%"=="x" goto :do_cfg
+ if "x%TEMP%"=="x" set LYNX_TEMP_SPACE=%TEMP%
+ if not "x%TEMP%"=="x" goto :do_cfg
+ if "x%TMP%"=="x" set LYNX_TEMP_SPACE=%TMP%
+ if not "x%TMP%"=="x" goto :do_cfg
+
+ set LYNX_TEMP_SPACE=%HOMEDRIVE%%HOMEPATH%tmp
+ mkdir "%LYNX_TEMP_SPACE%"
+ if not errorlevel 0 goto :do_cfg
+
+ echo Cannot make temp-directory
+ goto :eof
+
+:do_cfg
+ lynx.exe -help 2>&1 | find "-lss" >NUL
+ if not errorlevel 1 goto :do_cfg2
+ echo This copy of Lynx was not compiled with color-style.
+ goto :eof
+
+:do_cfg2
+ set LYNX_CFG_PATH=%HOME%
+ set LYNX_CFG=%LYNX_TEMP_SPACE%\oldlynx.cfg
+ set LYNX_LSS=
+
+ echo DEFAULT_COLORS:off >>"%LYNX_CFG%"
+ echo include:lynx-demo.cfg >>"%LYNX_CFG%"
+ echo COLOR_STYLE: >>"%LYNX_CFG%"
+ echo NESTED_TABLES:off >>"%LYNX_CFG%"
+
+:do_exe
+ lynx.exe -lss="" %1 %2 %3 %4 %5 %6 %7 %8 %9
+ erase %LYNX_CFG%
+endlocal
diff --git a/samples/opaque.lss b/samples/opaque.lss new file mode 100644 index 0000000..80e3969 --- /dev/null +++ b/samples/opaque.lss @@ -0,0 +1,48 @@ +# From: claudio santambrogio <claudio.santambrogio@tiscali.it> + +em:bold:cyan +strong:bold:cyan +dt:bold:cyan +var:bold:cyan +samp:bold:cyan +b:bold:cyan +i:bold:cyan +alink:reverse:brightgreen:red +a:bold:green +img:dim:cyan:default +status:reverse:cyan:default +fig:normal:gray +caption:reverse:cyan +hr:normal:gray +blockquote:normal:cyan:default +address:normal:cyan +title:normal:cyan:default +tt:normal:white:default +h1:bold:cyan:default +label:normal:cyan +value:normal:cyan +high:bold:cyan +q:normal:cyan +small:dim:cyan +big:bold:cyan +sup:bold:cyan +sub:dim:cyan +lh:bold:cyan +code:normal:cyan +alert:bold:red +normal:normal:brown:black + +span.htmlsrc_comment:normal:white +span.htmlsrc_tag:normal:cyan +##the following makes no difference (except increasing the speed) since tag +##is already in cyan. +#span.htmlsrc_attrib:normal:cyan +#span.htmlsrc_attrval:normal:magenta +span.htmlsrc_abracket:normal:cyan +span.htmlsrc_entity:normal:green +##span.htmlsrc_href: +##span.htmlsrc_entire: +span.htmlsrc_badseq:normal:red +span.htmlsrc_badtag:normal:red +span.htmlsrc_badattr:normal:red +span.htmlsrc_sgmlspecial:normal:yellow |