Text File

.\" @(#) mkmenus.1 1.7 95/05/28 19:10:51 .TH MKMENUS 1 .SH NAME mkmenus \- GN "menu" file maker. .SH SYNTAX .B mkmenus [ .B \-rc ] [ .B \-d start_dir ] [ .B \-f footer_name ] [ .B \-m menu_name ] [ .B \-x exclude_file ] .SH DESCRIPTION The .I gn Gopher/HTTP server uses .I .cache files to both generate its menu listings and authorize file access. These files normally are created by processing a hand-written .I menu file through the .I gn .I mkcache(1) utility. When .I gn is used to serve a large collection of files in a directory, writing (and maintaining!) the .I menu files is a tedious task. This utility automates that chore. .P When .I mkmenus is run, it generates a file called .I menu in the current directory. The .I menu file will list .I "almost" all of the files in that directory, in a format compatible with the .I gn .I mkcache(1) program. An exclusion list is maintained of things to leave out of the menu file. The default exclusion list includes ``menu'', ``menu.footer'', and any file ending in a ``~'' tilde. (The default exclusion list may have been customized by your local administrator.) .P The name displayed in the menu for an item is usually just the file name. If, however, the file ends with an ``.html'' extension, then .I mkmenus examines the file looking for a ``<TITLE>'' markup, extract its value, and uses that for the displayed name. .P Every item in the .I gn menu must be assigned a type: ``0'' for text documents, ``1'' for directories, ``I'' for images, and so on. The .I mkmenus utility always assigns directories type ``1''. For regular files, the .I gn_mime.types file (probably located in your .I gn library directory) is used to assign types to files, according to the file extension. When an extension is listed in the .I gn_mime.types file several times (as is ``.xbm'' and ``.eps'' in the distributed .I gn_mime.types file), the .I last entry will be selected. Any entry that is not matched by a suffix in the .I gn_mime.types file will be called a type ``0''. .P A file called .I menu.footer may be used to define a standard footer appended to the .I menu output. If a .I menu.footer file exists, then its contents are appended (verbatim) to the .I menu file in that directory. Further, if an entire directory tree is being processed recursively (c.f. the .B \-r option), then once a .I menu.footer file is encountered, it is retained as a default footer for all of the subdirectories. Additional .I menu.footer files may appear in any of those subdirectories to change the footer. .P The following options are available: .IP "\-r" Not only create a menu in this directory, but also recurse through all subdirectories encountered, creating menu files in the subdirectories as well. .IP "\-c" Also generate .I .cache files (by running the .I gn .I mkcache(1) utility) after the .I menu file has been created. .IP "\-d" This option is usually unnecessary. .IP "" The ``Path'' in a .I menu file must specify the pathname of an item relative to the root of the .I gn data tree. Normally, .I mkmenus automatically determines where it is running, relative to the root of the data tree, and uses that information in the menu. This determination will fail, for example, if symlinks are crossed to reach the current directory. This option tells .I mkmenus to suppress its automatic determination, and instead use the .I dir value specified. .IP "" Note that this option does .I not say to create a .I menu file in the specified directory. The .I mkmenus utility .I always creates the .I menu file in the current directory. This option should be used only when .I mkmenus is unable to determine the proper pathname to the current directory. .IP "\-m" Normally, the output is saved to a file called ``menu''. When this option is specified, the output will be saved to a file called .I menu_name instead. Also modifies the default exclusion list to include the indicated .I menu_name instead of ``menu''. .IP "\-f" Normally, if a file called ``menu.footer'' exists, it is appended to the output as a footer. When this option is specified, footer information will be taken from a file called .I footer_name instead. Also modifies the default exclusion list to include the indicated .I footer_name instead of ``menu.footer''. To suppress footer processing, use this option and specify the name of a file that you are sure doesn't exist. .IP "\-x" Appends .I pat to the exclusion list. This list specifies all of the items that should be excluded from the menu. The .I pat may include shell glob metacharacters (such as "*" and "?"), but be sure to protect them against shell expansion by quoting. Multiple .B \-x options may be specified to omit a list of items. .SH FILES .ta \w'gn_mime.types 'u .nf menu The output file produced in the current directory. menu.footer Footer to append to output file. gn_mime.types Probably in your \f2gn\fP library directory. mkcache When the ``\-c'' option is specified. .fi .SH SEE ALSO gn(8), mkcache(1) .SH BUGS The .I gn_mime.types file is meant to map a Gopher selector and file extension to content type. Here, we try to use it to map file extensions to Gopher selections. That's not at all the same thing, and thus undesired mappings may result. It so happens that the distributed .I gn_mime.types file generally does the right thing if we consider the last match. .P Since the footer files are appended verbatim, the only way to make a ``return to parent directory'' link is to hardcode the pathname of the parent directory into the footer. .P Maybe it would be better if we just produced .I .cache files directly. .SH AUTHOR .nf Chip Rosenthal Unicom Systems Development, Inc. <chip\s-1@\s+1chinacat.Unicom.COM> http://www.unicom.com/ .fi .P Using the .I gn_mime.types file was a nifty suggestion by Stephen C. Trier.