home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 July & August / PCWorld_2003-07-08_cd.bin / Software / Vyzkuste / mysql / data1.cab / Development / include / my_getopt.h < prev    next >
C/C++ Source or Header  |  2003-05-17  |  3KB  |  55 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. enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
  20.             GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC };
  21. enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
  22.  
  23. struct my_option
  24. {
  25.   const char *name;                     /* Name of the option */
  26.   int        id;                        /* unique id or short option */
  27.   const char *comment;                  /* option comment, for autom. --help */
  28.   gptr       *value;                    /* The variable value */
  29.   gptr       *u_max_value;              /* The user def. max variable value */
  30.   const char **str_values;              /* Pointer to possible values */
  31.   enum get_opt_var_type var_type;
  32.   enum get_opt_arg_type arg_type;
  33.   longlong   def_value;                 /* Default value */
  34.   longlong   min_value;                 /* Min allowed value */
  35.   longlong   max_value;                 /* Max allowed value */
  36.   longlong   sub_size;                  /* Subtract this from given value */
  37.   long       block_size;                /* Value should be a mult. of this */
  38.   int        app_type;                  /* To be used by an application */
  39. };
  40.  
  41. extern char *disabled_my_option;
  42. extern my_bool my_getopt_print_errors;
  43.  
  44. extern int handle_options (int *argc, char ***argv, 
  45.                const struct my_option *longopts, 
  46.                my_bool (*get_one_option)(int,
  47.                              const struct my_option *,
  48.                              char *));
  49. extern void my_print_help(const struct my_option *options);
  50. extern void my_print_variables(const struct my_option *options);
  51.  
  52. ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
  53. my_bool getopt_compare_strings(const char *s, const char *t, uint length);
  54. C_MODE_END
  55.