home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / mySQL / mysql-5.0.1-alpha-snapshot-win / data1.cab / Development / include / my_getopt.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-07-28  |  2.7 KB  |  70 lines

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.  
  3.    This program is free software; you can redistribute it and/or modify
  4.    it under the terms of the GNU General Public License as published by
  5.    the Free Software Foundation; either version 2 of the License, or
  6.    (at your option) any later version.
  7.  
  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU General Public License
  14.    along with this program; if not, write to the Free Software
  15.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  16.  
  17. C_MODE_START
  18.  
  19. #define GET_NO_ARG     1
  20. #define GET_BOOL       2
  21. #define GET_INT        3
  22. #define GET_UINT       4
  23. #define GET_LONG       5
  24. #define GET_ULONG      6
  25. #define GET_LL         7
  26. #define GET_ULL        8
  27. #define GET_STR        9
  28. #define GET_STR_ALLOC 10
  29. #define GET_DISABLED  11
  30.  
  31. #define GET_ASK_ADDR     128
  32. #define GET_TYPE_MASK     127
  33.  
  34. enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
  35.  
  36. struct my_option
  37. {
  38.   const char *name;                     /* Name of the option */
  39.   int        id;                        /* unique id or short option */
  40.   const char *comment;                  /* option comment, for autom. --help */
  41.   gptr       *value;                    /* The variable value */
  42.   gptr       *u_max_value;              /* The user def. max variable value */
  43.   const char **str_values;              /* Pointer to possible values */
  44.   ulong     var_type;
  45.   enum get_opt_arg_type arg_type;
  46.   longlong   def_value;                 /* Default value */
  47.   longlong   min_value;                 /* Min allowed value */
  48.   longlong   max_value;                 /* Max allowed value */
  49.   longlong   sub_size;                  /* Subtract this from given value */
  50.   long       block_size;                /* Value should be a mult. of this */
  51.   int        app_type;                  /* To be used by an application */
  52. };
  53.  
  54. extern char *disabled_my_option;
  55. extern my_bool my_getopt_print_errors;
  56.  
  57. extern int handle_options (int *argc, char ***argv, 
  58.                const struct my_option *longopts, 
  59.                my_bool (*get_one_option)(int,
  60.                              const struct my_option *,
  61.                              char *));
  62. extern void my_print_help(const struct my_option *options);
  63. extern void my_print_variables(const struct my_option *options);
  64. extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
  65.                                const struct my_option *));
  66.  
  67. ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
  68. my_bool getopt_compare_strings(const char *s, const char *t, uint length);
  69. C_MODE_END
  70.