1 /*-------------------------------------------------------------------------
4 * Displays available options under grand unified configuration scheme
6 * Options whose flag bits are set to GUC_NO_SHOW_ALL, GUC_NOT_IN_SAMPLE,
7 * or GUC_DISALLOW_IN_FILE are not displayed, unless the user specifically
8 * requests that variable by name
10 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
13 * $Header: /cvsroot/pgsql/src/backend/utils/misc/help_config.c,v 1.8 2003/10/18 22:59:09 petere Exp $
15 *-------------------------------------------------------------------------
23 #include "utils/guc.h"
24 #include "utils/guc_tables.h"
25 #include "utils/help_config.h"
29 * This union allows us to mix the numerous different types of structs
30 * that we are organizing.
34 struct config_generic generic;
35 struct config_bool bool;
36 struct config_real real;
37 struct config_int integer;
38 struct config_string string;
42 static void printMixedStruct(mixedStruct *structToPrint);
43 static bool displayStruct(mixedStruct *structToDisplay);
51 /* Initialize the guc_variables[] array */
52 build_guc_variables();
54 for (i = 0; i < num_guc_variables; i++)
56 mixedStruct *var = (mixedStruct *) guc_variables[i];
58 if (displayStruct(var))
59 printMixedStruct(var);
67 * This function will return true if the struct passed to it
68 * should be displayed to the user.
71 displayStruct(mixedStruct *structToDisplay)
73 return !(structToDisplay->generic.flags & (GUC_NO_SHOW_ALL |
75 GUC_DISALLOW_IN_FILE));
80 * This function prints out the generic struct passed to it. It will print out
81 * a different format, depending on what the user wants to see.
84 printMixedStruct(mixedStruct *structToPrint)
86 printf("%s\t%s\t%s\t",
87 structToPrint->generic.name,
88 GucContext_Names[structToPrint->generic.context],
89 gettext(config_group_names[structToPrint->generic.group]));
91 switch (structToPrint->generic.vartype)
95 printf("BOOLEAN\t%s\t\t\t",
96 (structToPrint->bool.reset_val == 0) ?
101 printf("INTEGER\t%d\t%d\t%d\t",
102 structToPrint->integer.reset_val,
103 structToPrint->integer.min,
104 structToPrint->integer.max);
108 printf("REAL\t%g\t%g\t%g\t",
109 structToPrint->real.reset_val,
110 structToPrint->real.min,
111 structToPrint->real.max);
115 printf("STRING\t%s\t\t\t",
116 structToPrint->string.boot_val);
120 fprintf(stderr, "internal error: unrecognized run-time parameter type\n");
125 (structToPrint->generic.short_desc == NULL) ? "" : gettext(structToPrint->generic.short_desc),
126 (structToPrint->generic.long_desc == NULL) ? "" : gettext(structToPrint->generic.long_desc));