

		    Executing Programs from Links

Lynx  can  start programs  when links   are  activated.   For example,
activating the link

	<!man -k print :21>Find info on printing

would start man on the local  system.  man would operate as  usual and
control   would return  to  Lynx when  man  terminated.  Users who are
preparing Lynx documents that do not need to run programs  may skip to
the section titled "Lynx as a Gopher Client".

The general syntax  for starting   programs and scripts  on the  local
system is:

	link_delimiter   !   program_path   program_arguments
		token_delimiter   character_count
			end_link_delimiter

	or

	link_delimiter   !   program_path   program_arguments   \>LYNX
		token_delimiter   character_count
			token_delimiter   target_string
 				end_link_delimiter

In the first case the specified program is started and control reverts
to Lynx when the program terminates.  In  the second case, the program
is executed and all program output is placed in a temporary file.  (On
UN*X systems this file is created in /tmp with a  unique name based on
the PID of the executing program).  The temporary file is treated as a
normal Lynx hypertext file, and may  be searched for targets specified
in the link.  For example, a link like:

	<!man -k print \> LYNX :21:print>Find info on printing

instructs Lynx to execute the command

			man -k print

and capture the resulting output in a  temporary file.  Lynx will then
display  the  file beginning  with   the first segment  containing the
string  "print" and underline  every  occurrence  of that string.  The
temporary file will be deleted when Lynx exits.

Note that any  character used  by  Lynx   to delimit link  information
(e.g., the link and target  delimiters, the colon,  or the at-sign (@)
appearing in a command to be executed must  be preceded by a backslash
(\).  This is the reason that >LYNX is preceded by  a backslash in the
example above.

Users  creating distributed Lynx documents  must exercise caution when
executing programs within Lynx.  Programs started from Lynx links will
execute on the  same system on which  Lynx  is running,  which is  not
necessarily   the system  on which the   Lynx file   is  stored.   For
instance, the links  used as examples  in this section  would probably
not execute properly if activated by  a Lynx client running  on a VMS,
PC, or Macintosh system (since most of these  systems typically do not
provide a man command).

Users  reading  distributed  documents   must also   exercise caution.
Suppose, for  example,  and  information  provider creates  a document
containing the link

	<!rm *> Click here for a big surprise.

A user activating this link could  have files in her current directory
deleted.    For this   reason,  local  file execution  is  disabled by
default, and users who enable it should be careful.

The ability to execute some local commands is so useful, however, that
Lynx provides  several standard local    file execution links.   These
standard links include support for telnet, tn3270  and rlogin, and are
defined   by specifying   one of the  strings   "TELNET", "TN3270", or
"RLOGIN" as a program_path argument in the local execution link syntax
presented above.  Such links should look something like:

	<!TELNET  hostname  [port_number]>
	<!TN3270  hostname  [port_number]>
	<!RLOGIN  hostname  [-user=xxxxx]   [-password=yyyyy]>

where  the square brackets([]) indicate that  an argument is optional.
For  example, the port_number arguments  are  not  necessary  (and the
square brackets never actually appear in a link).


