home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / misc / parsarg.h < prev   
Text File  |  1998-06-08  |  2KB  |  63 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/misc/rcs/parsarg.h $
  15.  * $Revision: 1.1 $
  16.  * $Author: matt $
  17.  * $Date: 1993/09/09 17:32:14 $
  18.  *
  19.  * Header for parse_args() function
  20.  *
  21.  * $Log: parsarg.h $
  22.  * Revision 1.1  1993/09/09  17:32:14  matt
  23.  * Initial revision
  24.  * 
  25.  *
  26.  */
  27.  
  28.  
  29. /*
  30.  
  31.     Routine to parse the command line. Will also read and parse args 
  32.     from a file.
  33.  
  34.     parse_args() is called with argc & argv from main(), the function
  35.     to be called with each argument, and flags.  argc & argv are usually 
  36.     adjusted to not pass the first parameter (the program file name).  
  37.     Thus the general method of calling is:
  38.  
  39.         parse_args(argc-1,argv+1,hander_func,flags);
  40.  
  41.     handler_func() is then called with each parameter.
  42.  
  43.     If the PA_EXPAND flag is passed, all arguments which do not start
  44.     with '-' are assumed to be filenames and are expanded for wildcards,
  45.     with the handler function called for each match.  If a spec matches
  46.     nothing, the spec itself is passed to the handler func.
  47.  
  48.     Args that start with '@' are assumed to be argument files.  These
  49.     files are opened, and arguments are read from them just as if they
  50.     were specified on the command line.  Arg files can be nested.   
  51.  
  52. */
  53.  
  54. //Flags
  55.  
  56. #define PA_EXPAND    1    //wildcard expand args that don't start with '-'
  57.  
  58.  
  59. //Function
  60.  
  61. void parse_args(int argc,char **argv,void (*handler_func)(char *arg),int flags);
  62.  
  63.