NAME
mothra – retrieve and display World–Wide Web files

SYNOPSIS
mothra [ –dvak ] [ –m mtpt ] [ url ]

DESCRIPTION
Mothra uses webfs(4) to retrieve and display files from the World–Wide Web, by name or through hypertext links. Web names, called URLs, have a peculiar syntax:
http://9front.org/
https://code.9front.org/hg/plan9front/
http://cat–v.org/

The part up to the first colon gives the protocol for retrieving the file. http:, Hyper–Text Transfer Protocol, is the usual way of accessing web files.

// begins the Internet address of the server where the file resides. The address may contain a colon and a TCP port number, which overrides the default port number for the service. Next comes a file name. Finally, the file name may be followed by # and a string giving a label within the file where the display should begin.

Mothra starts with the url given on the command line, defaulting to the environment variable $url.

There are a number of options:
a    Alt display. Starts in alt display mode, see menu commands table below.
k    Kill images. Don't fetch/display images.
m    Specify the webfs(4) mountpoint with –m mtpt. The default is /mnt/web.
–v    
Verbose mode. Causes HTML errors to be printed on file–descriptor 2.
d    Enables debug mode.

The display contains the last message from mothra, a box where typed commands appear, a scrollable list of previously visited files, the title and URL of the current file, and the scrollable text of the current file.

Button 1 selects and displays a file, either from the list of previously visited pages or from a link (indicated by underlined text or a boxed image) in the current file. Button 2 shows the URL of a file, but does not retrieve or display it. Button 3 pops up a menu of commands:
alt display   Collapse or expand the navigation boxes at the top of the browser window.
moth mode     Enter moth mode and switch to the moth cursor. If the HREF of an image link is different from the URL of the image itself, a link to the HREF will be printed on the right side of the image. Clicking an image or link with mouse button 1 prompts the user to save a copy of the file in the current directory.
Clicking mouse button 2 sets the target as the current URL. Clicking the moth mode menu option again exits moth mode.
snarf         Copy the current entry text or selected page text to snarf buffer. If nothing is selected, the current URL is copied.
paste         Paste the snarf buffer to the current text entry.
plumb         Plumb the current URL.
search        Search for a regular expression in the current page.
save hit      Save the current URL to the hit list.
hit list      Retrieve and display the hit list.
exit          Ask for confirmation and quit.

The typed commands are:
a               Toggle alt display.
d text            Search for the given text at DuckDuckGo.
g url            Go to the page with the given URL.
j n              Jump to page n from the list of previously viewed pages.
k               Toggle killing of images.
m               Enter or exit moth mode.
r               Reload the current page.
s file            Save the current page in the given file.
W file            Capture a screenshot of the entire browser window in the given file.
w file            Capture a screenshot of the content area in the given file.
q               Quit.

When mothra retrieves a direct link to a file that is not an HTML document (for example a GIF or JPEG image), it will start up an appropriate viewer, for example page (see page(1)) for most image files.

FILES
$home/lib/mothra/hit.html the hit list

SOURCE
/sys/src/cmd/mothra

SEE ALSO
webfs(4)

BUGS
Files are saved in the form received, not in the form suggested by the name in an s command. A directory index saved from moth mode may be written in the local directory as a file named index. Sanitizing remote file names for the local file system is imperfect.

Mothra is distributed in a preliminary state; it has more than its share of bugs. Note that mothra, like the other Guardian Monsters, has no particular concern for humanity.

HISTORY
Mothra first appeared in Plan 9 from Bell Labs (1995). It was later modified for inclusion in 9front (September, 2011).