PARSARG.H 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. Routine to parse the command line. Will also read and parse args
  29. from a file.
  30. parse_args() is called with argc & argv from main(), the function
  31. to be called with each argument, and flags. argc & argv are usually
  32. adjusted to not pass the first parameter (the program file name).
  33. Thus the general method of calling is:
  34. parse_args(argc-1,argv+1,hander_func,flags);
  35. handler_func() is then called with each parameter.
  36. If the PA_EXPAND flag is passed, all arguments which do not start
  37. with '-' are assumed to be filenames and are expanded for wildcards,
  38. with the handler function called for each match. If a spec matches
  39. nothing, the spec itself is passed to the handler func.
  40. Args that start with '@' are assumed to be argument files. These
  41. files are opened, and arguments are read from them just as if they
  42. were specified on the command line. Arg files can be nested.
  43. */
  44. //Flags
  45. #define PA_EXPAND 1 //wildcard expand args that don't start with '-'
  46. //Function
  47. void parse_args(int argc,char **argv,void (*handler_func)(char *arg),int flags);