PostgreSQL Source Code  git master
option_utils.c File Reference
#include "postgres_fe.h"
#include "fe_utils/option_utils.h"
Include dependency graph for option_utils.c:

Go to the source code of this file.

Functions

void handle_help_version_opts (int argc, char *argv[], const char *fixed_progname, help_handler hlp)
 

Function Documentation

◆ handle_help_version_opts()

void handle_help_version_opts ( int  argc,
char *  argv[],
const char *  fixed_progname,
help_handler  hlp 
)

Definition at line 22 of file option_utils.c.

References get_progname(), and printf.

Referenced by main().

24 {
25  if (argc > 1)
26  {
27  if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
28  {
29  hlp(get_progname(argv[0]));
30  exit(0);
31  }
32  if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
33  {
34  printf("%s (PostgreSQL) " PG_VERSION "\n", fixed_progname);
35  exit(0);
36  }
37  }
38 }
const char * get_progname(const char *argv0)
Definition: path.c:453
#define printf(...)
Definition: port.h:222