home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / cmdline / comndlin.doc next >
Text File  |  1989-08-09  |  5KB  |  90 lines

  1.     ┌───────────────────────────────────────────────────────────────────────┐
  2.     │ Author: Jon R. Meyer           Compiler: QB 4.x and up and            │
  3.     │         484 Neal Ave S.                  Bascom 6                     │
  4.     │         Afton, MN  55001                                              │
  5.     │ Date:   August 8, 1989         Release : 1.0                          │
  6.     │                                                                       │
  7.     │                    Copyright(C) 1989 Jon R. Meyer                     │
  8.     ├───────────────────────────────────────────────────────────────────────┤
  9.     │                                                                       │
  10.     │   Name: ComndLin          Type: SUB                  Level: BASIC     │
  11.     │                                                                       │
  12.     │   Syntax: CALL ComndLin(arg$(), qty%)                                 │
  13.     └───────────────────────────────────────────────────────────────────────┘
  14.  
  15.     This will read the command line into an array for return to calling
  16.     program.  Whatever is on the command line will be parsed and returned
  17.     with all leading and trailing blanks removed.  Any delimiter that you
  18.     instruct the user to specify WILL NOT BE REMOVED from each argument
  19.     in the array. No special character is required other than a space in
  20.     between each argument.
  21.  
  22.      Example:                   MYPROG /A /BC
  23.  
  24.     will return 2 items in the array, "/A" and "/BC". If so instructed,
  25.     you could just as easily instruct the user to start the program with:
  26.  
  27.                           MYPROG A BC or MYPROG -A -BC
  28.  
  29.     It will be up to you to determine which, if any, delimiter is used, just
  30.     remember, ComndLin only parses the command line it does not strip
  31.     "special" characters (other than blanks) from it.
  32.  
  33.        The string array ARG$ should be dimensioned to the MAXIMUM number
  34.     of command line arguments that you expect or that your application
  35.     has available or allows (in case ALL of them are called).
  36.  
  37.        Qty% tells the routine the offset in the array to start storing
  38.     the different arguments ie qty% = 4 would place the first retrieved
  39.     argument in ARG$(4).  This is to allow placement in a config array and
  40.     to allow for OPTION BASE 0 and 1.
  41.  
  42.     Example:
  43.  
  44.     MyProg -a -v -m -ex         'Sample program Command Line
  45.  
  46.     max = 6        'where max = maximum number of parameter calls possible
  47.     DIM arg$(max)
  48.     qty% = 3       'where qty% = starting point in array to store first param.
  49.     CALL comndlin(arg$(), qty%)
  50.  
  51.     Qty% returns the number of elements in the array starting at position 3,
  52.     and arg$() holds the command line parameters.
  53.  
  54.     Return :
  55.  
  56.     qty% = 6               'The last arg # in the array
  57.     arg$(3) = "-a"
  58.     arg$(4) = "-v"
  59.     arg$(5) = "-m"
  60.     arg$(6) = "-ex"
  61.  
  62.  
  63.      This routine is for whomever wants to use it. I am not charging (at this
  64.      time) anything as long it is used for personal use or freeware programs.
  65.      If this routine is to be used in any packages that is to be sold to the
  66.      public (either commercially or as registered shareware), I feel it is
  67.      only fair that I be informed of this use. I also feel that it would be
  68.      appropriate in this case to send me a small donation (A couple of bucks
  69.      tops but atleast your name and address and a free copy of your program).
  70.      I am not in this to make money but if someone else is going to make money
  71.      from my work, I should get at least a little something from it.
  72.  
  73.      As you may have noticed, I did not include the source code for this
  74.      routine. The reason for this is to protect thise routine and the others
  75.      that I have or may develop from time to time from any changes which may
  76.      cause them to no longer function the way they are documented.  I am
  77.      willing to accept any comments or suggestions for changes but I will
  78.      have the final say (obviously) on what happens. I do not intend to make
  79.      changes which would cause this routine not to function as originally
  80.      documented unless it is felt that the changes will only improve the
  81.      routine. Of course if this happens, I will make note of it so please
  82.      read the documentation.
  83.  
  84.      I do have one thing that I would like to ask of anyone who might decide
  85.      to use this routine, let me know what you think of it.  I like praise
  86.      but I can also take criticism.  You can either send me a note at
  87.      the address above leave a note for me on PC Library BBS in Minneapolis.
  88.      The number is 612-435-8058.
  89.  
  90.