The world's most popular open source database
#include <my_global.h>#include <my_sys.h>#include <m_string.h>#include <my_getopt.h>#include <help_start.h>#include <help_end.h>Include dependency graph for my_print_defaults.c:

Go to the source code of this file.
Functions | |
| static void | usage (my_bool version) |
| static my_bool | get_one_option (int optid, const struct my_option *opt __attribute__((unused)), char *argument __attribute__((unused))) |
| static int | get_options (int *argc, char ***argv) |
| int | main (int argc, char **argv) |
Variables | |
| const char * | config_file = "my" |
| uint | verbose = 0 |
| uint | opt_defaults_file_used = 0 |
| const char * | default_dbug_option = "d:t:o,/tmp/my_print_defaults.trace" |
| static struct my_option | my_long_options [] |
| static my_bool get_one_option | ( | int | optid, | |
| const struct my_option *opt | __attribute__((unused)), | |||
| char *argument | __attribute__((unused)) | |||
| ) | [static] |
Definition at line 96 of file my_print_defaults.c.
References DBUG_PUSH, default_dbug_option, exit, opt_defaults_file_used, usage(), and verbose.
00098 { 00099 switch (optid) { 00100 case 'c': 00101 opt_defaults_file_used= 1; 00102 break; 00103 case 'n': 00104 exit(0); 00105 case 'I': 00106 case '?': 00107 usage(0); 00108 exit(0); 00109 case 'v': 00110 verbose++; 00111 break; 00112 case 'V': 00113 usage(1); 00114 exit(0); 00115 case '#': 00116 DBUG_PUSH(argument ? argument : default_dbug_option); 00117 break; 00118 } 00119 return 0; 00120 }
Here is the call graph for this function:

| static int get_options | ( | int * | argc, | |
| char *** | argv | |||
| ) | [static] |
Definition at line 123 of file my_print_defaults.c.
References exit, get_one_option(), handle_options(), my_long_options, and usage().
00124 { 00125 int ho_error; 00126 00127 if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) 00128 exit(ho_error); 00129 00130 if (*argc < 1) 00131 { 00132 usage(0); 00133 return 1; 00134 } 00135 return 0; 00136 }
Here is the call graph for this function:

| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 139 of file my_print_defaults.c.
References config_file, count, error, exit, free_defaults(), get_defaults_options(), get_options(), load_default_groups, load_defaults(), memcpy, my_free, MY_INIT, my_malloc(), MY_WME, MYF, opt_defaults_file_used, and verbose.
00140 { 00141 int count, error, args_used; 00142 char **load_default_groups, *tmp_arguments[6]; 00143 char **argument, **arguments, **org_argv; 00144 char *defaults, *extra_defaults, *group_suffix; 00145 MY_INIT(argv[0]); 00146 00147 org_argv= argv; 00148 args_used= get_defaults_options(argc, argv, &defaults, &extra_defaults, 00149 &group_suffix); 00150 00151 /* Copy defaults-xxx arguments & program name */ 00152 count=args_used+1; 00153 arguments= tmp_arguments; 00154 memcpy((char*) arguments, (char*) org_argv, count * sizeof(*org_argv)); 00155 arguments[count]= 0; 00156 00157 /* Check out the args */ 00158 if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*), 00159 MYF(MY_WME)))) 00160 exit(1); 00161 if (get_options(&argc,&argv)) 00162 exit(1); 00163 memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv)); 00164 00165 if ((error= load_defaults(config_file, (const char **) load_default_groups, 00166 &count, &arguments))) 00167 { 00168 if (verbose && opt_defaults_file_used) 00169 { 00170 if (error == 1) 00171 fprintf(stderr, "WARNING: Defaults file '%s' not found!\n", 00172 config_file); 00173 /* This error is not available now. For the future */ 00174 if (error == 2) 00175 fprintf(stderr, "WARNING: Defaults file '%s' is not a regular file!\n", 00176 config_file); 00177 } 00178 error= 2; 00179 } 00180 00181 for (argument= arguments+1 ; *argument ; argument++) 00182 puts(*argument); 00183 my_free((char*) load_default_groups,MYF(0)); 00184 free_defaults(arguments); 00185 00186 exit(error); 00187 }
Here is the call graph for this function:

| static void usage | ( | my_bool | version | ) | [static] |
Definition at line 77 of file my_print_defaults.c.
References config_file, MACHINE_TYPE, my_long_options, my_print_default_files(), my_print_help(), my_print_variables(), my_progname, and SYSTEM_TYPE.
00078 { 00079 printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, 00080 MACHINE_TYPE); 00081 if (version) 00082 return; 00083 puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); 00084 puts("Prints all arguments that is give to some program using the default files"); 00085 printf("Usage: %s [OPTIONS] groups\n", my_progname); 00086 my_print_help(my_long_options); 00087 my_print_default_files(config_file); 00088 my_print_variables(my_long_options); 00089 printf("\nExample usage:\n%s --config-file=my client mysql\n", my_progname); 00090 }
Here is the call graph for this function:

| const char* config_file = "my" |
| const char* default_dbug_option = "d:t:o,/tmp/my_print_defaults.trace" |
Definition at line 33 of file my_print_defaults.c.
struct my_option my_long_options[] [static] |
Definition at line 35 of file my_print_defaults.c.
Definition at line 32 of file my_print_defaults.c.
1.4.7

