Eneboo - Documentación para desarrolladores
src/libmysql_std/include/my_getopt.h
Ir a la documentación de este archivo.
00001 /* Copyright (C) 2002-2004 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
00015 
00016 #ifndef _my_getopt_h
00017 #define _my_getopt_h
00018 
00019 C_MODE_START
00020 
00021 #define GET_NO_ARG     1
00022 #define GET_BOOL       2
00023 #define GET_INT        3
00024 #define GET_UINT       4
00025 #define GET_LONG       5
00026 #define GET_ULONG      6
00027 #define GET_LL         7
00028 #define GET_ULL        8
00029 #define GET_STR        9
00030 #define GET_STR_ALLOC 10
00031 #define GET_DISABLED  11
00032 
00033 #define GET_ASK_ADDR     128
00034 #define GET_TYPE_MASK    127
00035 
00036 enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
00037 
00038 struct my_option
00039 {
00040   const char *name;                     /* Name of the option */
00041   int        id;                        /* unique id or short option */
00042   const char *comment;                  /* option comment, for autom. --help */
00043   gptr       *value;                    /* The variable value */
00044   gptr       *u_max_value;              /* The user def. max variable value */
00045   const char **str_values;              /* Pointer to possible values */
00046   ulong     var_type;
00047   enum get_opt_arg_type arg_type;
00048   longlong   def_value;                 /* Default value */
00049   longlong   min_value;                 /* Min allowed value */
00050   longlong   max_value;                 /* Max allowed value */
00051   longlong   sub_size;                  /* Subtract this from given value */
00052   long       block_size;                /* Value should be a mult. of this */
00053   int        app_type;                  /* To be used by an application */
00054 };
00055 
00056 typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
00057 typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
00058 
00059 extern char *disabled_my_option;
00060 extern my_bool my_getopt_print_errors;
00061 extern my_error_reporter my_getopt_error_reporter;
00062 
00063 extern int handle_options (int *argc, char ***argv, 
00064                            const struct my_option *longopts, my_get_one_option);
00065 extern void my_print_help(const struct my_option *options);
00066 extern void my_print_variables(const struct my_option *options);
00067 extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
00068                                                            const struct my_option *));
00069 
00070 ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
00071 my_bool getopt_compare_strings(const char *s, const char *t, uint length);
00072 
00073 C_MODE_END
00074 
00075 #endif /* _my_getopt_h */
00076 
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'