diff options
Diffstat (limited to 'src/bin/psql/print.h')
-rw-r--r-- | src/bin/psql/print.h | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/src/bin/psql/print.h b/src/bin/psql/print.h index d24e41e8530..64d0271f505 100644 --- a/src/bin/psql/print.h +++ b/src/bin/psql/print.h @@ -7,52 +7,58 @@ #include <stdio.h> #include <libpq-fe.h> -enum printFormat { - PRINT_NOTHING = 0, /* to make sure someone initializes this */ - PRINT_UNALIGNED, - PRINT_ALIGNED, - PRINT_HTML, - PRINT_LATEX - /* add your favourite output format here ... */ +enum printFormat +{ + PRINT_NOTHING = 0, /* to make sure someone initializes this */ + PRINT_UNALIGNED, + PRINT_ALIGNED, + PRINT_HTML, + PRINT_LATEX + /* add your favourite output format here ... */ }; -typedef struct _printTableOpt { - enum printFormat format; /* one of the above */ - bool expanded; /* expanded/vertical output (if supported by output format) */ - bool pager; /* use pager for output (if to stdout and stdout is a tty) */ - bool tuples_only; /* don't output headers, row counts, etc. */ - unsigned short int border; /* Print a border around the table. 0=none, 1=dividing lines, 2=full */ - char *fieldSep; /* field separator for unaligned text mode */ - char *tableAttr; /* attributes for HTML <table ...> */ -} printTableOpt; +typedef struct _printTableOpt +{ + enum printFormat format; /* one of the above */ + bool expanded; /* expanded/vertical output (if supported + * by output format) */ + bool pager; /* use pager for output (if to stdout and + * stdout is a tty) */ + bool tuples_only; /* don't output headers, row counts, etc. */ + unsigned short int border; /* Print a border around the table. + * 0=none, 1=dividing lines, 2=full */ + char *fieldSep; /* field separator for unaligned text mode */ + char *tableAttr; /* attributes for HTML <table ...> */ +} printTableOpt; /* * Use this to print just any table in the supported formats. * - title is just any string (NULL is fine) * - headers is the column headings (NULL ptr terminated). It must be given and - * complete since the column count is generated from this. + * complete since the column count is generated from this. * - cells are the data cells to be printed. Now you know why the correct - * column count is important + * column count is important * - footers are lines to be printed below the table * - align is an 'l' or an 'r' for every column, if the output format needs it. - * (You must specify this long enough. Otherwise anything could happen.) + * (You must specify this long enough. Otherwise anything could happen.) */ -void -printTable(const char * title, char ** headers, char ** cells, char ** footers, - const char * align, - const printTableOpt * opt, FILE * fout); +void printTable(const char *title, char **headers, char **cells, char **footers, + const char *align, + const printTableOpt * opt, FILE *fout); -typedef struct _printQueryOpt { - printTableOpt topt; /* the options above */ - char * nullPrint; /* how to print null entities */ - bool quote; /* quote all values as much as possible */ - char * title; /* override title */ - char ** footers; /* override footer (default is "(xx rows)") */ -} printQueryOpt; +typedef struct _printQueryOpt +{ + printTableOpt topt; /* the options above */ + char *nullPrint; /* how to print null entities */ + bool quote; /* quote all values as much as possible */ + char *title; /* override title */ + char **footers; /* override footer (default is "(xx + * rows)") */ +} printQueryOpt; /* * Use this to print query results @@ -60,7 +66,7 @@ typedef struct _printQueryOpt { * It calls the printTable above with all the things set straight. */ void -printQuery(PGresult * result, const printQueryOpt * opt, FILE * fout); + printQuery(PGresult *result, const printQueryOpt * opt, FILE *fout); -#endif /* PRINT_H */ +#endif /* PRINT_H */ |