home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SYSTEM / APATH23.ZIP / APATH.DOC < prev   
Encoding:
Text File  |  1992-04-02  |  16.7 KB  |  361 lines

  1. APATH           Copyright (c) 1992    Walt Stoneburner
  2. v2.3            All Rights Reserved.  
  3.  
  4. Altering the current PATH environment variable can be a pain at times,
  5. especially when the changes are minor.  APATH was designed to allow the PATH
  6. variable to be manipulated quickly and easily without the overhead of extra
  7. environment variables or terribly complex batch files.
  8.  
  9. APATH is ideal for modifying the path in everyday batch files, some makefiles,
  10. LAN administration login/logout files, from the command line, etc.
  11.  
  12. The ability to remove directories from the PATH environment variable
  13. until needed should result in quicker searches of the path.  Software that
  14. requires its directory be in the path can be activated by a simple batch file
  15. which makes a path addition, runs the software, and later removes the excess
  16. baggage.
  17.  
  18. Entering APATH without arguments provides brief usage information. It also
  19. shows off the copyright message.
  20.  
  21.  
  22. Usage:
  23.         APATH [/M] [+|-]path[;path...]
  24.  
  25.                 /M              Changes affect the master environment.
  26.                                 No parameter changes the parent environment.
  27.  
  28.                 path            Multiple directories may be specified,
  29.                                 separated by semicolons.  If a directory
  30.                                 is not already part of the PATH, it will be
  31.                                 prepended (placed in front).  If it is part of
  32.                                 the PATH, the path addition will be ignored.
  33.  
  34.                 +path           Same as above, but the specified directory
  35.                                 will be appended to the end of the PATH.
  36.  
  37.                 -path           The specified directory will be removed from
  38.                                 the PATH variable.  If the directory can not
  39.                                 be found, the deletion will be ignored.
  40.  
  41.         Multiple prepends, appends, and deletes may be specified on a
  42.         single line.  Only the first character of each directory sequence
  43.         may be a - or +.
  44.  
  45.  
  46. APATH can return status information via the DOS errorlevel.
  47.  
  48. An errorlevel of 1 is returned if the path could not be changed successfully
  49. (note that this errorlevel is not returned if you try to add an
  50. already-existing element to the path, or delete one which didn't exist to
  51. begin with; it's only returned if something awful happens).  APATH returns an
  52. errorlevel of 0 if the command completes without incident.
  53.  
  54. Examples:
  55.         APATH C:\UTIL                   Prepend C:\UTIL to front of PATH.
  56.  
  57.         APATH +C:\UTIL                  Append C:\UTIL to end of PATH.
  58.  
  59.         APATH -C:\UTIL                  Remove C:\UTIL from PATH.
  60.  
  61.  
  62.         APATH /M C:\UTIL;C:\TMP         Prepend C:\UTIL then C:\TMP to PATH
  63.                                         in master environment only.
  64.  
  65.         APATH +C:\UTIL;C:\BIN -D:\TMP F:\USR\LIB
  66.                                         Append C:\UTIL then C:\BIN,
  67.                                         Delete D:\TMP, and
  68.                                         Prepend F:\USR\LIB to PATH.
  69.  
  70. Note:   The prepend function will effectively reverse the order of the
  71.         specified directories.   e.g.  APATH A;B;C  will make  PATH=C;B;A
  72.         This is because A is prepended, then B is prepended in front
  73.         of the A, and finally C is prepended in front of B.
  74.  
  75.         Using the + to append will produce arguments in the same order
  76.         as they are specified on the command line.
  77.         
  78.  
  79. Other Examples Involving APATH:
  80.  
  81.     Starting Windows, in a WIN.BAT file:
  82.       apath c:\aldus;c:\excel;c:\winword;c:\windows
  83.       if errorlevel 1 goto opps
  84.       win %1 %2 %3 %4 %5
  85.       apath -c:\aldus;c:\excel;c:\winword;c:\windows
  86.       goto quit
  87.       :oops
  88.       Echo could not adjust path!
  89.       :quit
  90.  
  91.     Kill the whole path to impress the girls; anyone can type  PATH =
  92.       apath -%path%
  93.  
  94.     Kill redundant entries in the path (works for short paths):
  95.       apath -%path% +%path%
  96.  
  97.     Reverse the order of the path (just because!):
  98.       apath -%path% %path%
  99.  
  100.     LAN login:
  101.       net use f: \\moocow\c-drive
  102.       apath f:\util
  103.  
  104.     LAN logout:
  105.       net logout \\buckaroo
  106.       apath -g:\sound
  107.  
  108.     In a "makefile":
  109.       y_tab.c : grammar.y
  110.         apath d:\usr\bin
  111.         yacc grammer.y
  112.         apath -d:\usr\bin
  113.  
  114.  
  115.  
  116. A Word About Makefiles
  117.  
  118.   Some MAKE programs store a copy of the PATH at runtime, thus with each line
  119.   executed in a shell uses a copy of the path when invoked. If APATH doesn't
  120.   seem to work, try using the /M parameter to change the master environment.
  121.   If this still doesn't work, try using a MAKE which isn't brain-damaged.
  122.  
  123.  
  124. Warning to Power Users
  125.  
  126.   I'm sure some wiseass will try to break the software by trying something
  127.   like this:
  128.     APATH %path% %path% %path% %path% %path% ...
  129.  
  130.   Good news for wiseasses everywhere!  Most likely you'll get the weird result
  131.   you're looking for because COMMAND.COM doesn't have enough room to pass the
  132.   whole command line to the program.
  133.  
  134.   My tests have shown that only 128 bytes get passed to APATH from the 
  135.   command line.  And one of those is the space after the command and the 
  136.   other is the return key.  So, really you have only 126 bytes in an
  137.   argument.  Internal DOS commands do not seem to have this restriction.
  138.   Anything after the 126th character magically disappears, so you could
  139.   get part of a directory name appended!
  140.  
  141.   If you get into problems where APATH is acting funny for large arguments,
  142.   break up your command into multiple APATH commands.  While I've provided
  143.   for a 4K path in the program (in case anyone modifies their shell), DOS is
  144.   limited to 128 bytes and 4DOS appears to have a larger 256 byte maximum for
  145.   the size of an environment variable.
  146.  
  147.   The idea is that after using APATH (with some batch files) you'll have
  148.   a much shorter path.  80 characters or less is quite reasonable and will
  149.   offer in return a better response time if you happen to enter a bad
  150.   command making DOS go searching your disk for something that isn't there.
  151.  
  152.  
  153. A Word About Shells
  154.  
  155.   Some shells with evaluate %path% on the command line, such as 4DOS and
  156.   its mutant sister, NDOS.  Others will only evaluate %path% while in a
  157.   batch file.
  158.  
  159.   The only problem I've ever had with APATH is specifying multiple, large
  160.   arguments using the above command line expansion in conjunction with 
  161.   MS-DOS as the underlying operating system.  The path used to get corrupted
  162.   by extra garbage characters being inserted as a path.  I traced the problem
  163.   to how MS-DOS puts parameters in the _PSP segment; under the right
  164.   conditions a non-terminated string can result, screwing up
  165.   most parsing routines.  The problem has a workaround in APATH v2.3.
  166.  
  167.   Note that DR-DOS doesn't have this PSP problem, so prior versions
  168.   of APATH will work fine under this operating system.
  169.  
  170.   However, you don't have to toss MS-DOS to use older versions of APATH 
  171.   (like you really would); just keep the total length of the command-line
  172.   arguments to 127 bytes or less per command line and applications will work
  173.   fine, not just APATH.
  174.   
  175.   [ I suspect everyone knows that 4DOS is owned by Rex Conn and JP Software,
  176.     that NDOS (a subset of 4DOS and the addition of the Norton Utilites) is
  177.     owned by Symantic Corp, that MS-DOS is owned by Microsoft, that DR-DOS
  178.     is owned by Digital Research, and that APATH is owned by Walt Stoneburner.
  179.  
  180.     Don't you think these 'ownership' paragraphs are a bore?  Look guys, if
  181.     people don't know who you are, you need to spend a little more of that
  182.     green stuff in marketing!  Get a life.  Enough said. ]
  183.  
  184.  
  185.  
  186. Version History
  187.  
  188.   v1.0  APATH developed; did extensive testing and multiple revisions
  189.         before first public release.  Appends, Deletes [-], and Prepends [+]
  190.         directories to the PATH environment variable.  Modifies the parent
  191.         environment.  APATH was written completely in assembly language in an
  192.         effort to keep size down and speed up.  
  193.  
  194.   v2.0  Reversed meaning of + to mean append and made default prepend.
  195.         [Code size increased to 2546 bytes long.]
  196.  
  197.   v2.1  Reduced code size 800 bytes [code size now 1746 bytes long].
  198.  
  199.   v2.2  Added /M for master environment.  Reduced source code 15 bytes
  200.         [now 1731 bytes long].  Bug fix for empty environment.
  201.  
  202.   v2.3  Reduced code size by 41 more bytes [now 1690 bytes long; 8 from a
  203.         restructure of the code, and 47 from hand optimizations, and
  204.         added 14 for new features]!  Increased buffer size; that should allow
  205.         for some hefty command lines.  This should also prevent bug reports 
  206.         from people complaining about really-really long paths if anyone 
  207.         writes a shell or operating system supporting them.  Added error
  208.         levels.  Found MS-DOS _PSP bug and built workaround for it.
  209.  
  210.  
  211. Thank You List
  212.  
  213.   Many thanks to Doug "Power User" Austin who beta-tested the software,
  214.   gave me better insight on making the user interface better, corrected
  215.   some documentation errors, and laughed at the jokes in the documentation
  216.   without a lot of prodding.  He has the talent for finding the non-trivial-
  217.   obvious mistakes during development.  He also handled a lot of the
  218.   distribution of earlier versions... and got a whole minute of upload credit
  219.   for this small file.
  220.  
  221.   Thanks to Tamara "So What's It Do?" Harrison for calling each night to
  222.   make sure I wasn't sitting on my duff.  ...usually I was.  She offered
  223.   a lot of support even when the nature of the utility wasn't clear or
  224.   completely defined yet.  Is that something or what?
  225.  
  226.   Thanks to Phillip "Now What You Need..." Wherry, who inspired me that
  227.   people ought to be able to put things at the end of the path.  He also
  228.   made a few minor revisions to the documentation.
  229.  
  230.  
  231.                                       
  232. Disclaimer & Other Legal Stuff
  233.  
  234.   NO LIABILITY FOR CONSEQUENTIAL DAMAGES
  235.   In no event whatsoever shall the author, suppliers of APATH, or basically
  236.   anyone in the universe, be held liable for any damages whatsoever 
  237.   (including, without limitation to, damages for loss of business profits,
  238.   business interruption, loss of business information, other pecuniary
  239.   loss, paper cuts, or the destruction of the galaxy) arising out of the use,
  240.   abuse, misuse, or inability to use this program, even if the author has 
  241.   been advised of the possibility of such damages.  If you are uncomfortable
  242.   with the above, please do not use the program or send any money.  Look,
  243.   this program was written for personal use; it worked well for me, so I'm
  244.   virtually giving it away; I don't want my tush sued off because I was
  245.   just being generous.  (This bag is not a toy!)
  246.  
  247.   NO WARRANTY EXPRESSED OR IMPLIED
  248.   While you are free to try out the software for 30 days, do not send any
  249.   money until you are satisfied with the program.  Monies cannot be
  250.   returned.  No warranty or guarantee is provided that the software will
  251.   operate as stated in this manual.
  252.  
  253.   GRANT OF LICENSE
  254.   After sending the registration card below, you are free to use APATH
  255.   on as many personal machines as you can possibly get your hands on from
  256.   now until the Return of Christ.  Businesses are site licensed for a finite
  257.   number of copies executing simultaneously on different machines (see 
  258.   registration card).
  259.  
  260.   COPYRIGHT
  261.   This software is owned by Walt Stoneburner.  You are free to
  262.   modify and patch this version to suit your needs.  However, please do not
  263.   redistribute the patched version; you may redistribute the patch and/or
  264.   instructions for making the patch.  I would prefer that people obtain clean
  265.   copies in the event we choose to offer technical support.
  266.  
  267.   TECHNICAL SUPPORT
  268.   We make no claims or promises for offering technical support.  However,
  269.   if you write me, I'll consider it.  If you bribe me, I'll take you
  270.   very seriously.
  271.  
  272.   OTHER RESTRICTIONS
  273.   Don't hurt anyone.  It isn't nice.  Look both ways before crossing the
  274.   street.  Kids, don't smoke or do drugs.  And if you're gonna drink and
  275.   drive, get your parents' permission first.
  276.  
  277.   CUSTOMER REMEDIES
  278.   Take an aspirin.  Read the directions.  Read them again.  Aside from that, I
  279.   can't help you.
  280.   
  281.  
  282.  
  283. EMail Addresses
  284.  
  285.   If you'd like to write and try to weasel support, technical information,
  286.   or source code from the author, he can -indirectly- be reached by the
  287.   following EMail addresses.  
  288.  
  289.   Please state clearly that your message pertains to APATH (give the
  290.   version number).  These friendly people below will get the message to me
  291.   one way or another and are not necessarily responsible for answering
  292.   your pleas.  They are certainly not responsible if anything goes wrong.
  293.  
  294.     CompuServe:   70651,2707  or  72137,1152
  295.     Internet:     70651.2707@compuserve.com  or  psw@mitre.org
  296.     GEnie:        AUSI-DGATE  or  A.GARIES
  297.  
  298.         
  299. Registration
  300.  
  301.   If you are an individual and are using APATH for personal use, you're in luck...
  302.   Using APATH will cost you nothing, however, I would like you to send the
  303.   registration form below in anyhow.  By not charging a fee to individuals,
  304.   I'm hopeful you'll feel more inclined to let me know you are using
  305.   something I've written, and that I should therefore devote more free time to
  306.   projects like this.
  307.  
  308.   If you are a company, well... you're not as lucky as the individuals above.
  309.   However I know that you will most likely want a site license or something
  310.   like that.  And I'm willing to do that... cheap.  Very cheap!  (See below.)
  311.  
  312.   So... on with the paper work.
  313.  
  314.                 Please fill out below and send to:
  315.  
  316.                         APATH Registration
  317.                         c/o Walt Stoneburner
  318.                         9307 Lundy Court
  319.                         Burke, Virginia  22015
  320.  
  321.  
  322. +----------------------------------------------------------------------------+
  323. |                                                                            |
  324. | APATH v2.3     Copyright (c) Walt Stoneburner                 Mar 31, 1992 |
  325. | Registration   All Rights Reserved.                                        |
  326. |                                                                            |
  327. | Name:  ________________________________    [ ]  My personal use,           |
  328. |                                                 no charge.  Thanks!        |
  329. | Company:  _____________________________                                    |
  330. |                                            [ ]  My personal use; I've      |
  331. | Address:  _____________________________         enclosed $5 or more, send  |
  332. |                                                 commented source code      |
  333. |           _____________________________                                    |
  334. |                                            [ ]  Company site license       |
  335. |           _____________________________          1 - 19 users : $1.00/copy |
  336. |                                                 20 - 49 users : $0.75/copy |
  337. | Phone:    _____________________________         50 - infinity : $0.50/copy |
  338. | Optional  [ Circle:  DAY  NIGHT  WORK ]                (up to $100)        |
  339. |                                                                            |
  340. | [ ]  Or...  we would like to distribute APATH with our products.  Enclosed |
  341. |      is $100 which gives us an infinite site license for this product and  |
  342. |      your permission to distribute this and future upgrades of APATH as    |
  343. |      they become publicly accessible.                                      |
  344. |                                                                            |
  345. | ( )  I am interested in other        ( )  I would be interested in Beta    |
  346. |      things you develop[ed] when          testing software as it is being  |
  347. |      they become available.               developed.                       |
  348. |                                                                            |
  349. | EMail Address:  ________________________________________________________   |
  350. |                                                                            | 
  351. | Comments / How Are You Using APATH:                                        |
  352. |                                                                            |
  353. | ________________________________________________________________________   |
  354. |                                                                            |
  355. | ________________________________________________________________________   |
  356. |                                                                            |
  357. | ________________________________________________________________________   |
  358. |                                                                            |
  359. +----------------------------------------------------------------------------+
  360.  
  361.