# Command Line Syntax

The generic syntax is:

    	www [ options ]  [ docaddress [ keywords ]]

Please note that some of the command line options have been moved to the new Command Line Tool.

With no arguments, and if the Line Mode Browser has not been customized then it automatically tries the following locations:

1. ~/WWW/default.html
2. /usr/local/lib/WWW/default.html
3. http://www.w3.org/

## Options

The order of the options is not important and options can in fact be specified on either side of any docaddress. Currently available options are:-

### Getting Help

-help or -?
  Load this file from directly into the browser
-v [ a | b | c | g | p | s | t | u ]
  Verbose mode: Gives a running commentary on the program's attempts to read data in various ways. This can also be turned on and off during normal execution, see Existing Commands. As the amount of verbose output from the Browser and the Library is substantial, the `-v` option can now be followed by zero, one or more of the following flags (without space) in order to differentiate the verbose output generated:
  - a: Anchor relevant information
  - b: Bindings to local file system
  - c: Cache trace
  - g: SGML trace
  - p: Protocol module information
  - s: SGML/HTML relevant information
  - t: Thread trace
  - u: URI relevant information

  The `-v` option without any appended options shows all trace messages. An example is

      	-vpt

  showing thread and protocol trace messages

-version
  Prints out the version number of the software, and the version number of the WWW library, and exits.

### Main Modes of execution

-
  A minus sign with no trailing characters indicates that the program will accept HTML format input from the standard input. This allows www to be used as a filter from html to plain text for example. Relative links in the input are parsed as though the address of the document was that of the home page (or docaddress if specified). Implies non-interactive mode.
-h host
  Establish a telnet connection to the remote host specified. This implies a "secure mode" execution where all references to the local file system are canceled.
-listrefs
  Adds a list of the addresses of all documents references to the end of the HTML file. This mode forces non-interactive mode.
-n
  Non-interactive mode. Outputs the formatted document to the standard output, then exits. Pages are delimited with form feed (FF) characters.
-o [ file ]
  Redirects output to specified file. The default value is "www-out". This mode forced non-interactive mode
-single
  Singlethreaded mode. If this flag is set then the browser uses blocking, non interruptible I/O in interactive mode. Non-interactive mode always uses blocking I/O.

### Data format conversions (non-interactive)

-reformat
  The output is to be in HTML, "canonicalized" so that line breaks will be put in common places. Comments, processing instructions, etc, will be stripped. This feature allows HTML files produced by different editors to be compared.
-raw
  This command line option returns the output completely untouched exactly as it is received by the protocol module. For example, in the case of FTP, this format returns raw ASCII objects for directory listings; for HTTP, everything including the header is returned, for Gopher, a raw ASCII object is returned for a menu etc.
-source
  Display the original source (without any MIME-headers) of a document instead of parsing it.
-from [ format ]
  Only if the Line mode Browser is executed as a filter (using the "-" option), this option indicates the desired input format. The default value is "text/html".
-to [ format ]
  Format is the output format for www. Default value is "www/present" but may be changed according to the HTTP-specifications. Two common output formats are "www/source" that is the source without MIME-headers and "www/mime" that is the source with the MIME-header if any. Though also "text/latex" is possible which generates a LaTeX version of the (HTML) document. This can then be compiled using latex and put out as Postscript. Default value is presenting the output to the user.

### Screen options

-p [ n ]
  where "n" is a number, specifies the page length. If "n" is not specified then the page is set to length infinite (useful for printouts). Default page size is 24 or is automatically set on some systems.
-w [ n ]
  where n is a number, specifies the page width in columns. The default is 78, 79 or 80 depending on the system. (v1.0 or later)

### Anchor formats

-a <format>
  Specifies the printf-style format string to be used when printing references. Must contain the two characters "%d" where the numbers should occur. Be sure to escape or quote any special characters you use. For example under Unix:

      	www -a \<%d\>

      	www -a "(Type %d)"

-na
  Hides anchor positions in the text. Useful, when printing out the document. The option can also be used together with the `-p` option with no number specified (infinite page length).

### Directory Listings

-d 1*( t | b | r | n | s | y )
  This directive can be used to modify the directory listing layout. More than one option can be specified but they might be mutually exclusive. The following options are available (withour space):
  - t: Place any readme file at the top of the list (default)
  - b: Place any readme file at the bottom of the list
  - r: Ignore any readme file
  - n: Directory listings are not allowed
  - s: Directory listings are only allowed in the directories where a file ".www_browsable" is located. The content of the file is of no importance.
  - y: Directory listings are always allowed (default)

  An example is

      	-dts

  makes selective directory listings and places a README file at the top

### Persistent Cache

-nocache
  Disables the persistent cache. By default the cache is used so use this flag if you really don't want it.
-disconnected
  Sets the persistent cache to run in disconnected mode. That is, if the object is not already cached then we don't go get it.
-x 1*( i | n | a )
  There are various ways of handling Expires header when met in a history list or in a local cache. Either it can be Ignored all together, the user can be Notified with a warning, or the document can be reloaded Automatically. The default action is to ignore expired documents.
-r <file>
  Rule file, a.k.a. configuration file. If this is specified, a rule file may be used to map URLs, and to set up other aspects of the behavior of the browser. Many rule files may be given with successive -r options, and a default rule file name may be given using the WWW_CONFIG environment variable.
-timeout <n>
  Timeout in milli-seconds on sockets

### Configuration Options

-l [ file ]
  Specifies a log file with a list of visited documents. The default value is "www-log"
-r <file>
  Rule file, a.k.a. configuration file. If this is specified, a rule file may be used to map URLs, and to set up other aspects of the behavior of the browser. Many rule files may be given with successive -r options, and a default rule file name may be given using the WWW_CONFIG environment variable.
-timeout <n>
  Timeout in milli-seconds on sockets

## docaddress

If present, the next argument (docaddress) is the hypertext address , of the document at which you want to start browsing. You may want to define an alias for www followed by name of your favorite index.

## keywords

Any further command line arguments are taken as keywords. The first argument must refer to an index in this case. The index is searched for entries matching the keywords, and a list of matching entries is displayed.