Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Functions

help_config.c File Reference

#include "postgres.h"
#include <float.h>
#include <limits.h>
#include <unistd.h>
#include "utils/guc_tables.h"
#include "utils/help_config.h"
Include dependency graph for help_config.c:

Go to the source code of this file.

Data Structures

union  mixedStruct

Functions

static void printMixedStruct (mixedStruct *structToPrint)
static bool displayStruct (mixedStruct *structToDisplay)
void GucInfoMain (void)

Function Documentation

static bool displayStruct ( mixedStruct structToDisplay  )  [static]

Definition at line 76 of file help_config.c.

References config_generic::flags, mixedStruct::generic, GUC_NO_SHOW_ALL, and GUC_NOT_IN_SAMPLE.

Referenced by GucInfoMain().

{
    return !(structToDisplay->generic.flags & (GUC_NO_SHOW_ALL |
                                               GUC_NOT_IN_SAMPLE |
                                               GUC_DISALLOW_IN_FILE));
}

void GucInfoMain ( void   ) 

Definition at line 47 of file help_config.c.

References build_guc_variables(), displayStruct(), get_guc_variables(), GetNumConfigOptions(), i, and printMixedStruct().

Referenced by main().

{
    struct config_generic **guc_vars;
    int         numOpts,
                i;

    /* Initialize the guc_variables[] array */
    build_guc_variables();

    guc_vars = get_guc_variables();
    numOpts = GetNumConfigOptions();

    for (i = 0; i < numOpts; i++)
    {
        mixedStruct *var = (mixedStruct *) guc_vars[i];

        if (displayStruct(var))
            printMixedStruct(var);
    }

    exit(0);
}

static void printMixedStruct ( mixedStruct structToPrint  )  [static]

Definition at line 89 of file help_config.c.

References _, mixedStruct::_enum, mixedStruct::bool, config_enum::boot_val, config_string::boot_val, config_enum_lookup_by_value(), config_group_names, config_generic::context, mixedStruct::generic, config_generic::group, GucContext_Names, mixedStruct::integer, config_generic::long_desc, config_real::max, config_int::max, config_real::min, config_int::min, config_generic::name, NULL, PGC_BOOL, PGC_ENUM, PGC_INT, PGC_REAL, PGC_STRING, mixedStruct::real, config_real::reset_val, config_int::reset_val, config_bool::reset_val, config_generic::short_desc, mixedStruct::string, config_generic::vartype, and write_stderr.

Referenced by GucInfoMain().

{
    printf("%s\t%s\t%s\t",
           structToPrint->generic.name,
           GucContext_Names[structToPrint->generic.context],
           _(config_group_names[structToPrint->generic.group]));

    switch (structToPrint->generic.vartype)
    {

        case PGC_BOOL:
            printf("BOOLEAN\t%s\t\t\t",
                   (structToPrint->bool.reset_val == 0) ?
                   "FALSE" : "TRUE");
            break;

        case PGC_INT:
            printf("INTEGER\t%d\t%d\t%d\t",
                   structToPrint->integer.reset_val,
                   structToPrint->integer.min,
                   structToPrint->integer.max);
            break;

        case PGC_REAL:
            printf("REAL\t%g\t%g\t%g\t",
                   structToPrint->real.reset_val,
                   structToPrint->real.min,
                   structToPrint->real.max);
            break;

        case PGC_STRING:
            printf("STRING\t%s\t\t\t",
                   structToPrint->string.boot_val ? structToPrint->string.boot_val : "");
            break;

        case PGC_ENUM:
            printf("ENUM\t%s\t\t\t",
                   config_enum_lookup_by_value(&structToPrint->_enum,
                                             structToPrint->_enum.boot_val));
            break;

        default:
            write_stderr("internal error: unrecognized run-time parameter type\n");
            break;
    }

    printf("%s\t%s\n",
           (structToPrint->generic.short_desc == NULL) ? "" : _(structToPrint->generic.short_desc),
           (structToPrint->generic.long_desc == NULL) ? "" : _(structToPrint->generic.long_desc));
}