Using FLIST with a kept subprocess to examine unviewable files -------------------------------------------------------------- This version includes an option to use a DCL sub-process of the FLIST process for analysing files that cannot be directly viewed meaningfully (such as ZIP files, backup savesets. .EXE images, etc.). Use of this option is controlled by a new global variable named "flist$cmd_use_process". If you do NOT want this option, set this variable to FALSE, either in the source code 'FLIST.TPU' before compiling, or in your FLIST_INIT file. If you do this, then FLIST will function in the old way, just warning you of its type, then asking if you really want to view, and if yes, displaying the raw data on the screen. The way this is designed is so that hitting the RETURN key to view, and hitting the 'V' key to view, work slightly differently. With the previous version, these two keys performed an identical function, namely 'View this file with the standard FLIST viewer'. With the new option, there is a difference: 'V' will use the normal FLIST viewer to view the file regardless of its extension (giving a warning if it is a suspect type). This is exactly as in the previous version. RET will first check the file extension against a known list of extensions, and if found, use a pre-defined DCL command to view its contents. If the extension is not one on the list, then use the standard viewer, exactly like the 'V' command. Extracting from container files ------------------------------- Many of the unreadable file types are container files, holding other files, e.g. BACKUP savesets, ZIP, etc. The subprocess viewer provides an option to extract files from these container files. Place the cursor on the chosen file, and the 'X' key will extract it from the container file using a pre-defined extract command. The chosen file will then be extracted, so that when you finish viewing the container, and return to the normal flist window, you can refresh (gold-R) to see all the files you have extracted. FLIST will put a reminder message to this effect on the display window. This message is defined in the variable 'flist$cmd_extract_mess' and can be customised (or nulled out) in the flist.init file, if preferred. If the file type does not have an 'extract' function, (such as .EXE files), then hitting X will return the error message 'Cannot extract from this file type'. Using a 'special extension' viewer with GOLD-V ---------------------------------------------- Sometimes a file with a non-standard name can be recognised (either by its contents or its name) as being of a known type. e.g. a file that starts with 'PK' followed by a large pile of pseudo-random looking bytes is probably a ZIP file; or a file named 'PCAL.ALPHA_EXE' is almost certainly a .EXE image file. To use the appropriate viewer, a new key has been set up - Gold-V. To use it, place the cursor on the filename (PCAL.ALPHA_EXE, say), and press Gold-V. FLIST will ask for an extension (for this example enter EXE). FLIST will then view this file using the viewer associated with the entered file type. Defining the special file types and associated commands ------------------------------------------------------- All the information about the special file extensions and their associated commands is held in a separate file, which is read in during FLIST initialisation. This file is defined either by the logical name FLIST_EXTENSION_FILE or, if there is no such logical name, the filename SYS$LOGIN:FLIST_EXTENSION_FILE.INIT. Each group of "/"-delimited extensions is defined by a variable 'file_type'. Each of these has up to 3 associated variables. 'list_command' - This variable defines the DCL syntax for the list command. This must always be present. 'extract_command' - This defines the syntax for the extract command. If absent, then no extract command is available. 'extract_position' - This defines the character position in the displayed line of the listing where the filename of the file to be extracted starts. If absent (and extract_command is present) then this defaults to a value of 1. I have written a prototype version of this file, including some typical examples of extensions and commands that are commonly useful with FLIST, surrounded with lots of comments, to explain how to use it. For more details about how to edit this file, read its in-line comments. These describe how to set up any new file types you wish to add, or remove or change any you are not happy with. If you are adding more, to help with debugging the DCL commands, I have included a logical name - FLIST_DCL_VERIFY. If this is set to 1, then verify is set ON in the subprocess, so the list buffer will also include echoes of all the DCL commands entered, so you can analyze what went wrong with the command. How it all works (if you are interested) ---------------------------------------- 1. Initialisation During startup (after reading and processing the FLIST_INIT file), check the value of 'flist$cmd_use_process'. If set to TRUE, search for either a file defined by the logical name FLIST_EXTENSION_FILE, or there is if no such logical name, a file named SYS$LOGIN:FLIST_EXTENSION_FILE.INIT. If no such file is found, reset the value of the controlling variable 'flist$cmd_use_process' to FALSE, and abandon the special-file startup, starting up normally. If found, read all the extensions into a special extension buffer, and write 2 arrays - an array of 'list' commands and an array of 'extract' commands. Note that the subprocess is not started at initialisation, but only the first time it is needed. This is to avoid unnecessary process creation if you do not need to view any 'special' files. 2. Viewing a file When you hit 'return' on a file name. It first checks the value of 'flist$cmd_use_process'. If FALSE, just view normally. If TRUE, look for the extension (surrounded by slashes '/' to avoid a fit with an incomplete file-type) in the extension buffer. If not found, just view normally. If found, use the line number it was found on as the index into the command arrays created at initialisation to get the DCL commands (the view and the extract commands). If not started, start up the DCL subprocess. Send the command to this DCL process, and copy the DCL output into the display buffer for viewing. Happy FLISTing, John Powers