═══ 1. Introduction ═══ This program is a text based file viewer with some really neat features thrown in. I have tried to find a good text based free file viewer in the past but have had little luck. I am also sick of every man and his dog trying to get money for something they spent the weekend on so this is why I will let anyone use this program without any fee. I don't intend to ever convert this program to PM as there are many times when you can't run PM programs (one of the reasons I wrote this program in the first place)... I do intend to keep the executable relatively small. (C)opyright This program is (C)opyright by Dennis Bareis 1996. All rights reserved. ═══ 2. Starting VFILE ═══ VFILE.EXE will determine what mode the screen is in and will adjust itself accordingly, for example I frequently use it in 132 columns by 43 lines mode. Command Line Syntax The command line is fairly simple as follows: VFILE[.EXE] FileName|* [/Options|-Options] If "*" is specified instead of a filename, then the input is read from stdin, that is its assumed you are piping the input in. Each option begins with either "/" or "-" and it does not matter which is used or even if you use both, they can also be specified via environment variables. Examples 1. dir | vfile * /gap -EOF 2. vfile.exe c:\config.sys ═══ 2.1. VFILE.EXE Options ═══ How to specify VFILE options There are many options that you can set prior to starting VFILE.EXE, these can be set either on the command line or in the environment. An option begins with either "/" or "-" and it does not matter which is used or even if you use both. Options are processed in the following order: 1. "VFILE" Environment variable. 2. The command line 3. Any environment variables specified with the "/EnvVar" Command. Color Switches  /BarColor  /BoxColor  /DefaultLineColor  /FoundColor  /PastEofColor  /StatusLineColor  /TransparentBar  /Unknown Option Other Switches  /ColumnShift  /EnvVar  /EOF  /FileText  /Gap  /Hex  /PastEofCharacter  /TabWidth  ./: Example The following is a possible batch file (it gets passed the filename) which starts VFILE is 132x43 line mode with certain options: @echo off set VFILE=/EOF set VFILE_1=/GAP /TransparentBar mode 132,43 & vfile %1 /error:28 /warning:28 & mode 80,25 ═══ 2.1.1. /BarColor ═══ /BarColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option specifies the color you wish to use for the current line or position bar. Example For example if you wish a yellow on purple (magenta) bar: /BarColor:94 ═══ 2.1.2. /BoxColor ═══ /BoxColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option specifies the color you wish to use for VFILE's border. Example For example if you wish a yellow on blue border: /BoxColor:31 ═══ 2.1.3. /ColumnShift ═══ /ColumnShift This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option allows you to adjust how much the screen moves when you use the left & right arrow keys. Example For example if you wish to move one column at a time, the following command would allow this: /ColumnShift:1 ═══ 2.1.4. /DefaultLineColor ═══ /DefaultLineColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option can be used to override the default color used to display each line in the VFILE.EXE window. Lines containing specific text can be displayed in a different color. Example For example to set the default color to high intensity white on blue you could specify: /DefaultLineColor:31 ═══ 2.1.5. /EnvVar ═══ /EnvVar This option like all options can be specified either in the environment or on the VFILE.EXE command line. VFILE.EXE always searches for the environment variable "VFILE" for options during startup. It is possible that this does not cover all your requirements, for example you may have many different rexx scripts which load VFILE, well you can now (if you wish) seperately configure each batch file through the environment in config.sys. This could be used if the batch file was on a network server as another example. Example Assuming I wish to search the environment variable "VFILE_P_CMD" for commands configured in config.sys then the following is a possibility: address cmd 'vfile ' || FileName || ' /EnvVar:VFILE_P_CMD' ; ═══ 2.1.6. /Eof ═══ /Eof This option like all options can be specified either in the environment or on the VFILE.EXE command line. Normally you see the start of the loaded file when you first enter VFILE, this switch allows you to initially see the end of the file, as the file is loaded into memory it may take a little while before you get to the end of the file. Example /Eof ═══ 2.1.7. /FileText ═══ /FileText This option like all options can be specified either in the environment or on the VFILE.EXE command line. Sometimes the name of the file being displayed is not important and you would rather have a descriptive name shown to a user. Example We would rather show the user the text "STARTUP LOG" rather than the logs filename: "/FileText:STARTUP LOG" ═══ 2.1.8. /FoundColor ═══ /FoundColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option can be used to override the default color used highlight found text when the find options are used. Example For example to highlight found text in high intensity white on green: /FoundColor:47 ═══ 2.1.9. /Gap ═══ /Gap This option like all options can be specified either in the environment or on the VFILE.EXE command line. Normally VFILE displays each line hard up to both left and right borders, if you would rather have a space seperating the line from the border then use this option. Example /Gap ═══ 2.1.10. /Hex ═══ /Hex This option like all options can be specified either in the environment or on the VFILE.EXE command line. VFILE normally begins in character mode, to start in hex mode you can specify this switch. Example /Hex ═══ 2.1.11. /PastEofCharacter ═══ /PastEofCharacter This option like all options can be specified either in the environment or on the VFILE.EXE command line. You can if you wish to mark the region beyond the end of the file by a specific color and character. This option allows you to change the character while the /PastEofColor switch could be used to change the color. Example For example to specify a space is to be used rather than the default dot: "/PastEofCharacter: " ═══ 2.1.12. /PastEofColor ═══ /PastEofColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. You can if you wish to mark the region beyond the end of the file by a specific color and character. This option allows you to change the color while the /PastEofCharacter switch could be used to change the character. Example For example to specify high intensity white on white: /PastEofColor:127 ═══ 2.1.13. /StatusLineColor ═══ /StatusLineColor This option like all options can be specified either in the environment or on the VFILE.EXE command line. This allows you to change the color of the status line, this is the line that contains the current line & column etc. Example For example to specify high intensity cyan on cyan: /StatusLineColor:59 ═══ 2.1.14. /TabWidth ═══ /TabWidth This option like all options can be specified either in the environment or on the VFILE.EXE command line. This option controls the tab width which VFILE uses when expanding tabs, the default is 8. If you specify 0, then tabs are not expanded and you will see them in character mode. Example To change the tab setting to 4 characters: /TabWidth:4 ═══ 2.1.15. /TransparentBar ═══ /TransparentBar This option like all options can be specified either in the environment or on the VFILE.EXE command line. Normally the color of the text at the current location (bar color) is that specified by the /BarColor switch. This option if specified will change the color of the bar so the background is as specified by the /BarColor switch, while the foreground is that of the line below the bar. Example /TransparentBar ═══ 2.1.16. /Unknown Option ═══ /Unknown Option This option like all options can be specified either in the environment or on the VFILE.EXE command line. Any option that is unknown is assumed to be a command to specify a highlight for a line. Normally each line of a file is displayed in the default color (or than specified with the /DefaultLineColor option). This command allows you to specify that if a line contains a string that it should be highlighted in a particular color. It is recommended that the background color be the same for all lines and you may also wish to try the /TransparentBar option. If highlighted lines are being displayed then you may find all occurances easily by using the Tab & Shift+Tab keys. Example For example if you wish to highlight lines that contain the strings "error" & "warning" (in any case), the following could be used: /error:28 /WARNING:20 ═══ 2.1.17. ./: ═══ /: This option like all options can be specified either in the environment or on the VFILE.EXE command line. This switch allows you to change the seperator character which is used to seperate a switch from it's parameter, for example in "/TabWidth:4". There may be times when you need to change it for example when you wish to highlight lines that contain a string which includes one or more colons! highlight for a line. Of course if you change the colon character to something else say a "^", then you will need to use the new character to change it again. Example For example if you wish to highlight lines that contain the strings "error:" & "warning" (in any case), the following could be used: /:~ /error:~28 /~: /WARNING:20 ═══ 3. The Status Line ═══ The status line shows you where you are and what file you are in, you can modify the way the status line displays with the /StatusLineColor & /FileText switches. The status line may also briefly show an error message and is also used to prompt for user input (for example to request a search string). ARROWS ON RIGHT On the right hand side you will see up to 4 arrows which indicate that there is more data to be seen if you move in the direction indicated. The size of the arrows also has meaning, while text is still being loaded into VFILE the arrows are fat, otherwise they are thin. ═══ 4. Keys ═══ This section describes all of the keys that you can used while displaying a file in VFILE.EXE. If you are interested in the keys which you can use while being prompted for information, these are not described below, please refer to the section "Prompts for Information" Esc Press the Escape key to exit VFILE.EXE. Arrow Keys (Up & Down) These arrow keys move the currently highlighted line forwards or backwards through the loaded file. Arrow Keys (Left & Right) These arrow keys move left or right to view information that may be off the screen. Scrolling only occurs if required. The amount of scrolling per keypress can be configured with the /ColumnShift option. Ctrl+Left & Ctrl+Right Arrows These keys will move you as far left and as far right as it is possible to go. Home This key moves you to the start of the file. End This key moves you to the end of the file. If the file has not yet completed loading you will see screens flash until EOF is reached. You can abort this process by pressing any key, the key pressed is actioned! PgUp - Page UP If you are positioned at the first line in the window, you will see the next screen as a result, otherwise the current line is positioned to the start of the screen. PgDn - Page Down If you are positioned at the last line in the window, you will see the previous screen as a result, otherwise the current line is positioned to the end of the screen. Tab + Shift+Tab These keys will be of no use unless you have specified that lines containing certain strings be highlighted. These keys will then move you to the next or previous highlighted line. Alt+0 to Alt+9 There are 10 bookmarks available in hex mode and another 10 in character mode. Pressing the Alt key plus a number allows you to set a bookmark 0 to 9. 0 to 9 If you have previously set a bookmark you can return to it by simply pressing the correct digit. Enter This key centers the current line on the screen. G Key This key allows you to select a specific line in the loaded file to goto. H Key This toggles the current display mode between character mode and hex mode. Note that this key will not be available if the input was piped in as the input must be reloaded to change modes. Also note that you can set the initial mode to hex by specifying the /Hex option. ═══ 5. Prompts for Information ═══ Prompts for Information At times you will be prompted for information such as the address of a line to goto or a search string. In this case the following keys are available: Esc This key will first clear the line, once clear it will cancel the command which is requesting the prompted information. ALT+U This command can be used to undo a drastic change to the text you are typing in, a second undo will undo the undo! More to go... DB$ ═══ 6. Examples ═══ Examples 1. P.CMD (REXX Script) This is a rexx procedure which I use so that the output of a command automatically gets displayed in a window of my choosing, for example I could type "P dir c:\" or "P PSTAT", the output is piped into vfile.exe. An lines that contain the strings "error", "warning" or "SYS0" are highlighted, you will be able to use the Tab & Shift+Tab keys to find all occurances of highlighted lines. The rexx command itself follows: /* Takes output from a command and displays it in a window */ /*--- Get passed command and obtain copy without double quotes (for display only) ---*/ PassedCommand = arg(1); CommandWithoutDoubleQuotes = translate(PassedCommand, "`", '"'); /*--- Set up the commands to be executed ------------------------------------*/ CmdScreen43x132 = 'mode 132,43'; CmdPipeOutput = PassedCommand || ' 2>&1 | c:\utilp\vfile.exe * /gap /TransparentBar /error:28 /SYS0:28 /warning:29 "/FileText:' || CommandWithoutDoubleQuotes || '"'; CmdScreen25x80 = 'mode CO80,25'; /*--- Change mode and execute the command -----------------------------------*/ address cmd '@' || CmdScreen43x132 || ' & ' || CmdPipeOutput || ' & ' || CmdScreen25x80; ═══ 7. Support ═══ Support If you have a problem, please check to see if this is a known bug and try to find a simple way of reproducing it. Then contact Dennis Bareis on "dbareis@ozemail.com.au". If you use my this product it could not hurt to let me know as it might encourage me to put more work into it... ═══ 7.1. Known Bugs ═══  Start pgm, immediately press tab, PV results, maybe the call ViwFindNextSelectableLine() does not handle lines past end.  Not sure but looks to me as if search can find something in a non selectable line and then try to move bar to it, it should move below or above with the approprtiate non-selectable line of screen and highlighted, this would probably also require changes to find next & previous.  Need to put stdin in binary mode if displaying piped data for hex display. Note syntax display warns user...  Don't display movement arrows when status = question/prompt!  Can PV while expanding tabs (past 2000 I assume...)  MOD_V1_2.doc dies but only when tab=8, not 7,9, or 20!, probably tab expansion bug but maybe not... ═══ 7.2. Planned Improvements ═══ The following improvements I will look at when I get keen and have some time: General  Allow specification of wildcards such as "*.TXT" or "+*.TXT" the "+" means search subdirectories. results are shown sorted with full directories. When ENTER is pressed and then esc, the same line is highlighted allowing DOWNARROW+ENTER to choose next, search string is kept.  Add "strings" mode, maybe toggle with char & hex?  /NoControl for no controls chars such as formfeeds in char mode.  /MaxLineLength:512.  If a line is continued (no terminating newline) then we should add a non-selectable line <> (what color?)  Allow save of file to new name and limited editing?  Add /NoCopyright flag.  ALT+L = find next line where data is on screen (from left column onwards).  /ColumnShift:1 or /ColumnShift:10%  If found (marked text is on edge move screen to show...  Autodetect hex file (if /HEX or /CHAR not used), Read 512 bytes and count values below x20 and probably above x80.  When searching and found line is near top when searching up or bottom when searching down, move in appropriate direction to be 1/3 from end.  & move screen width left & right.  Have a /HexHigh to allow extended ASCII to be displayed  Add ',' to display line & column # as well as "up to line #...  /KeyLineColor & /KeyLineHighlightColor:  /KeyBeepFreq /KeyBeepDur  H=Goto (goto Line or hex address?) key.  Add regular expression  CTRL down/up for look for next highlighted line (message if none).  /xxxColor:Text|number|hex number (0x??), maybe like /barcolor:YB  /PrintDevice (what to spool to, use Splxxx cmds etc)  /PrintInit (what to output at start of job)  /PrintLine (what to output at start of each line)  /Epson (fairly generic settings)  /HpLaserJet3 (fairly generic settings)  Transparent color for all overlays (search etc)....  Handle space in VFILE env var options ~=space  Save search history (when we have cmd recall).  Create help .inf, user gets seitched to it when they press F1=Help  We look for the help file, if not found, don't display f1=help. Also VFILE_HELP env var to handle cases where not in path etc.  Attach .INF to .EXE as resource and create a command to generate also can we tell if view file failed to find the file?  Make code multithreaded, may not be so hard if basically all the second thread does is the io and the 1st times out after say 1/3 sec.  /INI command means bookmarks etc are saved, APP=VFILE KEY=BookMarks-Config.sys etc... Improve currently working code (remove hacks!)  fix "Hex" function key to swap modes on fly code (hack at moment).  Search function - make get string better....  Fix code which handles EOF in hex display so it uses common code and handles errors etc. Questions  Do we wish to toggle between F12=Hex and F12=Character?  Do we wish to handle partial load of files into memory and caching etc.