/**************************************************************************** Simple gopher protocol client for the PANDA TOPS-20 operating system. Copyright (C) 2024 Robert Cunnings NW8L * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Usage: gc [-c [cache_dir]] [-k] -g hostname [port] [selector] gc [-c [cache_dir]] [-k] -m [filename] gc -V The "-g" switch commands the program to connect to a gopher server. The host name can be followed by optional port number and gopher selector arguments. The default port number is 70. Alternatively, the "-m" switch tells the program to open a menu file stored on disk. The 'filename' argument is optional; the default is "gc-favs.gcm". The optional "-c" switch enables automatic caching of menu and text items downloaded from the server. This greatly speeds up moving back and forth through a series of previously visited links. The optional 'cache_dir' argument specifies a subdirectory holding cache files, e.g. "gc -c <.cache>" to keep cache files out of the way. The optional "-k" switch enables the cache "auto kill" feature. This is meant to be used together with the "-c" switch. It automatically kills the cache file for a page when backing up from it with the 'b' command at the "gc>" prompt. As you move forward through a series of pages with the 'f' and 'g' commands, cache files are created to speed up the reverse traversal of the series. Then, when moving back to the starting point with the 'b' command, the cache files are deleted along the way to conserve disk space. The "-V" switch prints the gc version number and exits. After a gopher menu or text item is fetched and displayed, the following keyboard commands are available at the "gc>" prompt. This appears after paging to the end of the text or menu. You can also press CTRL/O before reaching the end to stop paging, followed by ENTER to show the prompt. 'q' - (q)uit the program. 'd' - re(d)raw the current page starting over from the top. 'r' - (r)eload the current page. Downloads the page from the server, overwriting the copy in the cache, then redraws it. 'b' - move (b)ack to the previous page. The cached copy will be loaded. 'h' - open the current host's (h)ome menu. 'i' - Show (i)nfo for current page. Host, port, selector, item type, number of bytes, and name of the cache file are shown. 'iN' - Show (i)nfo for menu item where N is the link number of the item, in range 1 to 999. Host, port, selector, item type and name of the cache file (if one exists) are shown. 'fN' - move (f)orward where N is a link number in range 1 to 999. Works only for links to displayable item types '0' (text) and '1' (menu). 's' - (s)ave to disk the content of the current page. Enter a file name at the prompt. An empty name cancels the operation. 'sN' - (s)ave to disk where N is the link number of the item to save, in range 1 to 999. Enter a file name at the prompt. An empty name cancels the operation. 'c' - (c)ache the current page, useful if gc was started with caching disabled. Overwrites any existing cache file for the page. 'k' - (k)ill cached copy of current page. When caching is enabled, use this to save disk space if you don't plan to revisit the page. 'g host [port] [selector]' - (g)o to gopher server "host". The host name may be followed by an optional port number and optional selector. The default port number is 70. 'a [filename]' - (a)dd the current page to the favorites menu. An optional file name argument can be used to specify a favorites file to store it to. Enter a title for the favorites menu link at the prompt. 'v [filename]' - (v)iew the favorites menu. An optional file name argument can be used to specify the favorites file to view. '?' - show list of available commands. A history of pages visited is kept to enable the "back" command. The size of the history buffer is defined by the HISTORY_SIZE macro. It is a circular buffer - when it's full, backing up past the oldest page takes you to the newest page. When item types '0' (text) and '1' (menu) are downloaded, they are cached on disk in files with extension ".gcc". Subsequent views of the page are served from the cache to save time and bandwidth. When viewing a page, you can use the 'r' (reload) command to force a download from the server to over- write the cached copy. You can use the 'k' (kill) command to delete the page from the cache to save disk space if you won't be visiting it again. All cache files can be deleted with "del *.gcc" to free up disk space. Note: this program attempts to be compatible with KCC-6 on Panda TOPS-20. To compile, use 'cc -i=extend gc trmcap' to build an executable that runs with extended addressing. This increases the amount of dynamic memory available for buffering downloaded text. Ignore the "Missing function prototype" advisories generated by the termcap library during compilation. ****************************************************************************/ .