home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR4 / XEQ150.ZIP / XEQ.DOC < prev   
Text File  |  1993-08-28  |  16KB  |  374 lines

  1. comment *
  2.                    XEQ
  3.                -----
  4.        XEQ - COM File Library and Command Executor
  5.  
  6. This program allows COM files to be stored inside XEQ's code and executed
  7. by the command:
  8.     XEQ command
  9. For example, if BEEP.COM has been added to XEQ then:
  10.     XEQ BEEP
  11. will execute the BEEP program stored inside XEQ. The original BEEP.COM
  12. can be removed from the hard disk (onto a backup floppy!!!). If the
  13. specified command is not in XEQ it is passed to the DOS for execution as
  14. if directly typed at the DOS prompt.
  15.  
  16. PURPOSE
  17.     The purpose is to prevent wasted hard-disk space by those pesky
  18. little COM files we don't seem to be able to do without. When hard disks
  19. are formatted they are given an allocation size (called a cluster size)
  20. and this is typically 2048 or 4096 bytes. So when you save a 7 byte
  21. COM file like BEEP.COM, it takes up a full cluster. By combining these
  22. COM files into this program or LIBRARY, several COM files can be stored
  23. in one file (the XEQ program itself) and still be accessed without this waste
  24. in hard disk space.
  25.  
  26. In order to make the body of XEQ as small as possible, only a limited
  27. number of options are available. They are
  28.  
  29.     XEQ [/R]<command> Execute <command> if it is in the library
  30.                 or passes it to DOS for execution if not
  31.     XEQ /A<command>   Add <command>.COM to library if not existent
  32.     XEQ /D<command>   Delete command from library if existent
  33.     XEQ /E<command>   Extract command from library to .COM file if existent
  34.     XEQ /L          List the <commands> in the library
  35.     XEQ /H          Display HELP information
  36.     XEQ           Attempt to run internal AUTOXEQ.COM, else HELP
  37.     XEQ /P<parms>      As above but passed <parms> to AUTOXEQ.COM
  38.     XEQ /C[<command>] Suppress the reprocessing of the command line
  39.     XEQ /F          Freeze library
  40.  
  41. COMMAND DETAILS
  42.  
  43. /R - run a command
  44.  
  45. If no switch is given, the /R is assumed. If the given command name
  46. is in the library it is executed directly from there. XEQ internally
  47. relocates the stored file in memory so that the memory image is
  48. identical to the image if it had been loaded from the COM file on
  49. disk. This includes the way DOS loaded a COM file and the pretests
  50. for argument suitability and register set up. Thus ALL COM files
  51. should execute normally when run from within XEQ.
  52.  
  53. If the command is not found in XEQ then the string is passed to a DOS
  54. shell for execution. A second copy of COMMAND.COM is spawned with the
  55. command added after the /C switch. Therefore the command can be an
  56. internal, external, batch, EXE or COM file. (NOTE: SEE TSR LIMITATION
  57. BELOW.)
  58.  
  59. /A - add a command
  60.  
  61. Adds a COM file to the XEQ library. The filename given must either
  62. have no extension or .COM and the name part can contain standard DOS
  63. wildcards. A drive and/or path may be given to the target file.
  64. If the file is already in the library it will not be added. A warning
  65. message is given in this eventuality. Similarly if there is
  66. insufficient room to add a file, the addition of this file will be
  67. skipped with a warning. When wildcards exist, XEQ will attempt to add
  68. all files even if a given file cannot be found or is too big. Any attempt
  69. to add the current XEQ.COM file to itself (even if renamed under
  70. DOS3.x) will be prevented. (In DOS 2.x this safety feature can be
  71. thwarted by renaming XEQ.COM. A file called XEQ.COM is the only one
  72. excluded from being added.)
  73.  
  74. /D - delete a command
  75.  
  76. Removes the named command from the library. The filename given must either
  77. have no extension or .COM and the name part can contain standard DOS
  78. wildcards. A prompt asks for confirmation of the delete. 'Y' will
  79. delete the command, 'N' will skip deleting the command, 'G' will GO
  80. and delete this command and all further matching ones without asking
  81. again and 'A' will abort the entire delete process. Obviously 'G' is final
  82. and cannot be aborted once selected. Abort will cancel the effect of
  83. any 'Y' answers previously, AND NO COMMANDS WILL HAVE BEEN DELETED.
  84.  
  85. /E - extract a COM file
  86.  
  87. When the /E switch is used to extract a COM file, a full path for the
  88. resulting file may be specified. If the file already exists at that location,
  89. extraction does not occur. The filename given must either
  90. have no extension or .COM and the name part can contain standard DOS
  91. wildcards. The extracted file has the same date stamp as the COM file it was
  92. originally stored from. The file is NOT deleted from the library.
  93.  
  94. /L - list the library files
  95.  
  96. Displays a list of all files stored in XEQ. The original time and
  97. date stamp are displayed along with the file's byte size. At the end
  98. of the list the remaining space in XEQ is displayed, along with an
  99. indication of how much space has been saved by using XEQ (and
  100. deleting the original COM files). This computation is based upon
  101. the following:
  102.  
  103. DOS 2.x
  104. The value is the difference between the total clusters used by
  105. XEQ.COM on the default drive and the sum of all the clusters which
  106. would have been used on the default drive if each command was in its
  107. own COM file.
  108. The results can be misleading if say, you run XEQ/L while
  109. the drive default points to a floppy with a cluster size of 1024, but
  110. the DOS path executed XEQ.COM from the harddisk with a different
  111. cluster size. In this case the savings indicated are the bytes saved
  112. IF XEQ.COM WAS LOCATED ON THE DEFAULT DRIVE.
  113.  
  114. DOS 3.x
  115. The value is as above, but uses the cluster size of the drive it
  116. found XEQ.COM on and assumes that the COM files would have been on
  117. that drive if they were in separate files.
  118. Under DOS 3.x the savings always relate to the drive the path found
  119. XEQ.COM on and is independent of the default drive cluster size.
  120.  
  121. /H - Display the help screen
  122.  
  123. NO ARGUMENTS
  124. XEQ will try to find internal command AUTOXEQ.COM and if found will
  125. execute it. This can be any COM file so named. Arguments can be supplied
  126. using the /P command. If no such internal file exists, then HELP is
  127. displayed.
  128.  
  129. This feature can make XEQ perform a certain action if no arguments
  130. are supplied to it.
  131.  
  132. /P Run AUTOXEQ with parameters
  133. This performs as with NO ARGUMENTS above, but also passes the given
  134. parameters to the AUTOXEQ internal program. For example, if LIST.COM
  135. was stored in XEQ.COM as AUTOXEQ, then XEQ /PXEQ.DOC will start
  136. LIST.COM and pass it the file name XEQ.DOC.
  137.  
  138. /C Run the command but do not reprocess the command line Normally
  139. when XEQ is run without the /C switch, both the command line is
  140. reprocessed and the final program name is inserted for PMAP etc.
  141. (see below). If the command is not present then AUTOXEQ is run, if it
  142. is present in the library. When the /C switch is present, the
  143. original command line from the DOS prompt is passed to the final
  144. program and the program name returned by the program as argument 0 is
  145. the original XEQ name.  For example:
  146.  
  147. If the DOS line is:
  148.  
  149. C> XEQ pgm arg1
  150.  
  151. then <pgm> sees only 1 argument <arg1> and the internally stored
  152. program name is <pgm>. If <pgm> was in C, argv[0] = pgm and argv[1] =
  153. arg1.
  154.  
  155. If the DOS line is:
  156.  
  157. C> XEQ /C pgm arg1
  158.  
  159. then <pgm> sees 3 arguments </C> <pgm> and <arg1> and the internally
  160. stored program name is <XEQ>. If <pgm> was in C, argv[0]=XEQ,
  161. argv[1]=/C, argv[2]=pgm and argv[3]=arg1.
  162.  
  163. The primary purpose of the /C switch is to allow programs resident in
  164. XEQ to ascertain where they originally came from, when this is desirable.
  165.  
  166.  
  167. /F Freeze the library.  If you enter this switch and then answer Y,
  168. the library file will be frozen. This means ALL commands are
  169. inoperative except the /R or implied /R.  This prevents, among other
  170. things, an end-user of the library from seeing or changing its
  171. contents. A frozen library cannot be readily unfrozen.  In an
  172. emergency you can use a BINARY file editor (or DEBUG/SYMDEB) to
  173. change a single BYTE as follows:
  174.  
  175.     VERSION            OFFSET        OLD    NEW
  176.       1.40             05BFH         1     8
  177.  
  178. WARNING! This is version specific data.    
  179.  
  180. LIMITATIONS
  181.  
  182.     As a COM file can only be 64K long, COM files cannot
  183. be added to XEQ if this figure would be violated, as XEQ is a COM file
  184. itself. The /L command indicates the amount of space left and any
  185. attempt to add a file which would exceed the 64k limit is prevented. Any
  186. number of COM files can be added until this number is reached.
  187.         When a command is added or deleted from XEQ, a new copy of XEQ must
  188. be rewritten to disk. How it is written back depends on the version of DOS
  189. you are running.
  190.  
  191. DOS 2.x users
  192.  
  193. The revised library is always written to the current drive and directory as
  194. XEQ.COM, regardless of where the original copy of XEQ was found
  195. (it may have been loaded from elsewhere because of DOS's path
  196. capability). Therefore to update the original copy of XEQ, the /D or /A
  197. commands should be performed in the drive and directory of the
  198. original. If not, then the original copy of XEQ will still exist in its
  199. original location and the updated version in the current drive and
  200. directory. The new version of XEQ will always be called XEQ.COM, regardless
  201. of whether the original program was called XEQ.COM or not.
  202.  
  203. DOS3.x users
  204.  
  205. The revised library will be written over the original using the original's
  206. name. Thus doing a proper update of the original. The library can be given
  207. any name and this will be retained during the updating.
  208.  
  209. MULTIPLE LIBRARIES
  210.  
  211. For DOS 2.x user it is recommended that only one library XEQ.COM exist on the
  212. system. As adding or deleting from a renamed library file results in
  213. the new copy being called XEQ.COM on the current drive, care would
  214. have to be taken to prevent the overwriting of a legitimate XEQ.COM,
  215. and the new XEQ.COM would have to be renamed to the original name of
  216. the revised library.
  217.  
  218. For DOS 3.x users multiple libraries are more feasible as the updated library
  219. is always the original file no matter what it was called or where it
  220. was located. Thus maintaining multiple libraries is much simpler. CED
  221. (see below) can be used to avoid the need to remember which library
  222. contains a given command.
  223.  
  224. TERMINATE & STAY RESIDENT PROGRAMS
  225.  
  226. TSR programs can be stored inside XEQ and will install just like the
  227. original program. HOWEVER, NEVER RUN A TSR PROGRAM THROUGH XEQ WHICH
  228. IS NOT STORED IN XEQ. When XEQ cannot find a program it passes the name to
  229. DOS to run in a shell. If this program is a TSR it will freeze more
  230. memory than needed. XEQ has no way of knowing if a program it is
  231. about to execute externally is a TSR.
  232.  
  233. Beginning with version 1.10, XEQ will put the name of the file being
  234. run into the space between the end of the environment table and the
  235. start of the program. This is where DOS 3.x puts the running program
  236. name and XEQ will only duplicate this when running under DOS3.x. The
  237. purpose of this is to allow the running program to know its own name
  238. and to let TSR memory map programs like MAP.COM and MAPMEM.COM show
  239. the real program name which is resident.
  240.  
  241. A limitation exists for this however. The name stored is of the form
  242. d:\path\filename.COM. The space available to store this string cannot
  243. be increased and is set by the original running of XEQ. So if XEQ is
  244. the name of the comm library, the name of the actual program stored
  245. can only use the first 3 letters, truncating the full name. If this
  246. is important to you, the solution is to rename the library to a
  247. filename of 8 letters.  This will ensure sufficient space for any
  248. revision to any other name.  Starting with version 1.3 this is the
  249. mode of operation. Earlier versions destroyed the path information
  250. and this gave trouble to programs expecting to be able to recover the
  251. full drive, path and name information from argv[0] (in C) or %0 (in
  252. compiled batch files).
  253.  
  254. Starting with version 1.30, the final program name is also correctly
  255. set for such memory mapping programs as PMAP.
  256.  
  257. ARGUMENTS AND THE /C AND /P COMMANDS
  258.  
  259. The way XEQ processes arguments can be confusing, especially when the
  260. /C and/or /P switches are used. The limitation above added further
  261. problems. To help, I have included a simple program called ARGS.COM
  262. which will display the arguments passed to it.  This can be put into
  263. XEQ (as either ARGS.COM, or renamed to AUTOXEQ.COM) to see how these
  264. switches change the process.  Some examples of the resulting output
  265. are shown below. This example assumes that ARGS.COM is stored in
  266. XEQ.COM as both ARGS.COM and AUTOEXEC.COM.
  267.  
  268. e:\XEQ>xeq
  269. Arg[0] = E:\XEQ\AUT.COM
  270.  
  271. e:\XEQ>xeq args
  272. Arg[0] = E:\XEQ\ARG.COM
  273.  
  274. e:\XEQ>xeq /c
  275. Arg[0] = E:\XEQ\XEQ.COM
  276. Arg[1] = AUTOXEQ
  277.  
  278. e:\XEQ>xeq /p test
  279. Arg[0] = E:\XEQ\AUT.COM
  280. Arg[1] = TEST
  281.  
  282. e:\XEQ>xeq /c /p test
  283. Arg[0] = E:\XEQ\XEQ.COM
  284. Arg[1] = AUTOXEQ
  285. Arg[2] = test
  286.  
  287. The first example shows the limitation detailed above. Because the
  288. base program name (XEQ.COM) has only 3 letters to the left of the
  289. period, only 3 characters from the AUTOXEQ.COM nme can be returned.
  290.  
  291. Note also that in the last example, the /C must be the first argument on
  292. the line.
  293.  
  294. USAGE TIP
  295.  
  296. The CED utility and its synonym feature can make the use of XEQ
  297. transparent in use. For example, if BEEP.COM is stored inside XEQ then a 
  298. synonym like
  299.     SYN BEEP XEQ BEEP
  300. will cause BEEP to be run out of the XEQ file just by entering BEEP.
  301.  
  302. DISCLAIMER
  303.  
  304.     Hardwood Software Associates guarantees XEQ.COM will do NOTHING
  305. useful at all. You use it at your own risk (make backups of the COM files
  306. stored within XEQ before deleting them from your hard disk). However, it
  307. seems to perform as described here and may be of use to you.
  308.  
  309.     Colin J. Stearman [71036,256]
  310.     Senior Associate
  311.     HS Associates
  312.     143 Ash Street
  313.     Hopkinton, MA 01748
  314.  
  315. ======================================================================
  316.             EDIT LOG
  317.     REV    DATE        NAME        DETAIL
  318.     1.01    14-MAR-87    C.STEARMAN    Fixed bug if COM file name
  319.                         is one character
  320.     1.02    27-MAR-87       C.STEARMAN    Aligned file size column
  321.                         Added disk bytes saved calc
  322.     1.03    1-APR-87        C.STEARMAN      Fixed bug if in list if file
  323.                         was longer than 9999 bytes.
  324.                         Fixed error in saved space
  325.                         computation
  326.     1.10    2-APR-87    C.STEARMAN    Under DOS 3.x updating writes
  327.                         to original file. Also updates
  328.                         command name in environment 
  329.                         for MAP, added wildcard,
  330.                         fixed yet another space
  331.                         computation bug, used local
  332.                         stack for external run only
  333.     1.11   13-APR-87        C.STEARMAN    Revised space saved compute,
  334.                         see note above
  335.     1.12   16-APR-87        C.STEARMAN      Fixed bug in load_run module
  336.                         which did not initialize stack
  337.                         correctly. Bug manifested it-
  338.                         self when MODE was run
  339.                         internally. Returned bad
  340.                         parameters message
  341.         1.13   22-APR-87       C.STEARMAN       Fixed wrong message of file
  342.                         not found in /A
  343.                         Improved construction of PSP
  344.                         when running internals. May
  345.                         clean up some compatability
  346.                         problems. Fixed drive validity
  347.                         test. If wild cards in argu-
  348.                         ments, did not set AX correct-
  349.                         ly per DOS loaded.
  350.     1.14  29-APR-87       C.STEARMAN        Fixed bug when executing ext-
  351.                         ernal commands. Local stack
  352.                         trashed passed command string.
  353.                         Also stack crash caused by
  354.                         allowing XEQ.COM to grow to
  355.                         large. Caused random crashes.
  356.                         Added confirm delete
  357.     1.15 30-MAY-87          C.STEARMAN    Cleaned up help screen and
  358.                         identified which library file
  359.                         was accessed. Fixed bug in
  360.                         extract where a 1 character
  361.                         filename did not have .COM
  362.                         added to it.
  363.     1.20 15-MAR-91          C.STEARMAN    Added /H and the search for 
  364.                         internal command AUTOXEQ.COM
  365.     1.21 24-MAR-91          C.STEARMAN    Added /P for parameters to
  366.                         AUTOXEQ.COM
  367.     1.30 24-APR-91          C.STEARMAN    Modified storage method for
  368.                         program name to include path,
  369.                         added program name for PMAP
  370.     1.31 24-APR-91          C.STEARMAN    Added the /C switch
  371.     1.40 01-FEB-92          C.STEARMAN    Added /F switch
  372. ======================================================================
  373. *
  374.