GENEDIT - Generalized Editor - Version 1.0
By Leo J. Beadle

User's Guide


History/Purpose

    I wrote GENEDIT in response to a need I had at my job to change users 
    configurations without physically going to their machine.  Many changes 
    administrators need to make are simply in the autoexec.bat, config.sys, 
    or one of the windows INI files.  All of these are plain text and anyone 
    with any knowledge of a text editor can make simple changes.  The problem 
    is that many of our users are not comfortable enough to even use a simple 
    editor like EDIT.COM.  So I figured if I could edit the files when they 
    logon via a logon script I could save everyone some grief. Hence GENEDIT 
    was born. It has evolved over the last couple of years and through the 
    urging of some friends I have decided to make it available as shareware 
    to the rest of the world.  I hope you find it as useful as I have these 
    past few years. As I have already alluded to, the purpose is to make 
    changes to DOS text files via a one line command.  In the description 
    of the usage of the commands I give examples showing this utility.

Syntax/Usage
	
The basic syntax of execution is as follows:
	GENEDIT FILENAME FUNCTION [Parm1 Parm2 Parm3 Parm4]
where
      FILENAME is the text file you want to edit. It is best to include 
      the entire path and drive so you won't have to be in the directory 
      where the file resides.

      FUNCTION is the operation you want performed. Add, Delete, Replace 
      Lines, Change strings, or Find string occurrences.

      [Parm1 Parm2 Parm3 Parm4] is the strings passed to the program 
      depending on the function chosen. This is best explained on a case 
      by case basis. 
       NOTE1: Since a blank is used to delimit parms/functions embedded 
       spaces are NOT allowed in any of the parameters. Use a tilde(~) 
       where you intend a space and it will be converted to space before 
       any operation is performed.
       NOTE2: In order to specify a string that contains DOS redirection 
       use a $G or $O for DOS output redirection and a $L or $I for DOS 
       input redirection. These symbols are replaced with '>' or '<' prior 
       to any operation is performed.
       NOTE3: In order to specify a string that contains DOS environment 
       variables such as %PATH% use $P for the percent sign. (i.e. $ppath$p) 
       The $p will be replaced with % before any operation is performed.


LINE LEVEL FUNCTIONS:

Function A - To add a new line to the file. 
     Parm1 - The new line to add. This is the minimum required for this 
     function. If no other parms are specified, the line is added at the 
     bottom of the file. If Parm2 is specified it must be one of three 
     things: 1) BOF - for bottom of file (default) 2) TOF - for top of 
     file or 3) id_text - text string which uniquely identifies a line 
     in the file that the new line will be added before or after. If 
     Parm3 is specified it must be A or B for after or before with 
     after(A) being the default.

Examples:
   GENEDIT c:\autoexec.bat a set~temp=c:\temp bof
   (adds the line "set temp=c:\temp" to autoexec as the last line in 
   the file)
   GENEDIT c:\autoexec.bat a set~temp=c:\temp 
   (same as previous (bof is the default))
   GENEDIT c:\autoexec.bat a set~temp=c:\temp c:\windows\net~start a
   (adds the line after the line "c:\windows\net start")
   GENEDIT c:\autoexec.bat a set~temp=c:\temp c:\windows\netstart 
   (same as previous (a - after is default) note also that spaces/case 
   is not relevant on the search
   spaces are removed and lines converted to all caps before the match 
   is attempted) 
   GENEDIT c:\autoexec.bat a set~temp=c:\temp c:\windows\net~start b
   (adds line before the line c:\windows\net start)

Function R - To replace a line with a another line.
 Parm1 - identifies the line to be replaced with Parm2. If Parm3 is 
 specified, values of 'II','IC','SC', and 'SI' are allowed with 'II' 
 being the default.
 Their meanings/uses are as follows:
 'II' - Ignore spaces and case. If the phrases in Parm1 are found in 
 the same order regardless of the number of spaces or case, the line 
 is replaced with Parm2.
 'IC' - Ignore spaces, preserve case. If the phrases in Parm1 are found 
 in the same order regardless of the number of spaces but preserving case, 
 the line is replaced with Parm2.
 'SC' - Preserve spacing and case. This is the exact match option. The Parm1 
 has to be found exactly as is with no alterations in order for it to be 
 replaced with Parm2.
 'SI' - Preserve spacing, ignore case. If Parm1 is found regardless of case 
 but using the same spacing, it is replaced with Parm2
 Parm4 may optionally be specified to limit the number of times the line is 
 replaced. The default is '*' which means every line that qualifies is 
 replaced. Specify a number to limit the replacement to the first n matching 
 lines.
     NOTE: This is an entire line operation. You cannot use this function 
     to change part of a line to something else. Use the 'C' function 
     instead.

Examples:
 GENEDIT c:\config.sys R device=c:\dos\himem.sys device=c:\windows\himem.sys
	(replaces memory manager line to use windows version instead of DOS)
	GENEDIT c:\config.sys R DEVICE=C:\DOS\EMM386.EXE~RAM~/X=C800-CBFF...
		DEVICE=C:\DOS\EMM386~NOEMS~/X=C800-CBFF SC 1
	(changes the expanded memory manager line to not use EMS services. 
	This line uses strict spacing and case sensitivity. It also changes 
	only the first occurrence. What if the user has two spaces after RAM 
	and before the exclusion? The answer is that the match will fail 
	and the line will not be replaced.  Be careful when using strict 
	space and case requirements.)


Function D - To delete a line or lines.
  Parm1 is the identifying text that locates the line to be deleted. 
  Parm2 is equivalent to Parm3 on function 'R' above. In other words it 
  is the space/case switch. Parm3 is equivalent to Parm4 on function 'R' 
  above. In other words it is the number of lines switch.
  Examples:
  GENEDIT c:\windows\system.ini D emmexclude=A000-FFFF
  (deletes every line that says emmexclude=A000-FFFF regardless of case 
  or spacing. A better way to delete the emmexclude line is to use DP with 
  just emmexclude= so that you get the line no matter what the exclude region 
  the user has specified)

Functions AP,RP,DP
	Correspond to the Add, Replace, Delete functions above with the 
	looser 'partial' match option. For example, if you want to add a 
	line after the path statement in the autoexec, you probably don't 
	know everyone's exact path line, so use the AP and specify the 
	id_text as "PATH=". The first line GENEDIT finds with path= will 
	match and the line will be added after/before that line. Take this 
	same logic for Replace/Delete and you have RP and DP.

STRING LEVEL FUNCTIONS

Function C - To change text within lines.
  Parm1 is the text you want replaced with Parm2. Parms 3 and 4 allow you 
  to perform the replacement only if the two strings are found on the same 
  line. If Parm3/4 are not specified, every occurrence is replaced. This 
  change is *NOT* case sensitive. Use CC for case sensitive changes.
  Example:
  GENEDIT c:\autoexec.bat C \\prtsrvr\prt1 \\PRTSRVR\PRT2 net use
  (changes the string \\prtsrvr\prt1 to \\PRTSRVR\PRT2 if the two words 'net' 
  and 'use' are also found on the line. The case of \\prtsrvr\prt1 is not 
  restricted. Every line containing the match will be changed.)
	
Function CC - To change text within lines preserving case.
  Same as C with case sensitivity.
  Example:
  GENEDIT c:\autoexec.bat CC \\prtsrvr\prt1 \\PRTSRVR\PRT2
  (changes the string \\prtsrvr\prt1 to \\PRTSRVR\PRT2 if the first string 
  is found exactly as specified. All lines containing matches will have the 
  string replaced.

Function F - To find text within lines.
  Parm1 is the text to find. Parm2 is equivalent to Parm3 on function 'R' 
  above. In other words it is the space/case switch. The F function is the 
  only function that does no changes to the file. It simply searches the 
  file for occurrences of Parm1 and returns the number of matches in the 
  DOS errorlevel so you can test it in a batch file. This is useful if you 
  want to see if you have already made changes to a particular users files 
  or if he qualifies for the change before you make the attempt.

Miscellaneous Information

GENEDIT makes a backup copy of the original file if any changes are made. 
The name of the backup file is the same as the original with a three digit 
numeric ending.  I.E. autoexec.bat will be backed up as autoexec.001. If 
that file exist, it increments until it finds an open number. The backup 
file is placed in the same directory as the original.

GENEDIT also writes errors to a file called GENEDIT.LOG in the same 
directory as the file being manipulated. The reason for this is that I 
wanted the program to not alert the users as to what was happening in the 
background unless I tell them. If you have ever manned a help desk you 
understand this philosophy completely. If no errors are encountered, no 
log records are written.



Licensing

	GENEDIT is shareware. You are hereby granted license to 
	use/evaluate the program for 30 days. If at the end of 30 days 
	you decide you do not have a need for the program you are 
	required to remove it from your system(s). If you decide it 
	worthy of use in your environment, a fee of $20.00 US is 
	required to be sent to the author at the address below. You 
	will receive an official proof of license as well as be put 
	on the mailing list for any future upgrades at a discount. 
	Please include your complete address when you register.

Author's Address

	Leo J. Beadle
	167 Lakeview Loop
	Kinder, LA  70648
	(318) 738-5052 
	CompuServe: 103167,1605
	Internet: 103167.1605@compuserve.com

Warranty

	The enclosed software and accompanying written materials are 
	provided "AS IS." The author hereby expressly disclaims all 
	warranties, express or implied, including any implied warranty 
	of merchantability or fitness for a particular purpose with 
	respect to this software. Although the author has taken measures 
	to ensure the accuracy of the information available, no warranty 
	of accuracy, express or implied, is extended to you.
