PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_getopt.h File Reference
#include <unistd.h>
Include dependency graph for pg_getopt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int getopt (int nargc, char *const *nargv, const char *ostr)
 

Variables

PGDLLIMPORT charoptarg
 
PGDLLIMPORT int optind
 
PGDLLIMPORT int opterr
 
PGDLLIMPORT int optopt
 

Function Documentation

◆ getopt()

int getopt ( int  nargc,
char *const nargv,
const char ostr 
)
extern

Definition at line 67 of file getopt.c.

68{
69 static bool active = false;
70 static pg_getopt_ctx ctx;
71 int result;
72
73 if (!active)
74 {
75 pg_getopt_start(&ctx, nargc, nargv, ostr);
76 ctx.opterr = opterr;
77 active = true;
78 }
79
80 result = pg_getopt_next(&ctx);
81 opterr = ctx.opterr;
82 optind = ctx.optind;
83 optopt = ctx.optopt;
84 optarg = ctx.optarg;
85 if (result == -1)
86 active = false;
87 return result;
88}
uint32 result
int optopt
Definition getopt.c:48
int optind
Definition getopt.c:47
char * optarg
Definition getopt.c:49
int opterr
Definition getopt.c:46
int pg_getopt_next(pg_getopt_ctx *ctx)
void pg_getopt_start(pg_getopt_ctx *ctx, int nargc, char *const *nargv, const char *ostr)

References pg_getopt_ctx::optarg, optarg, pg_getopt_ctx::opterr, opterr, pg_getopt_ctx::optind, optind, pg_getopt_ctx::optopt, optopt, pg_getopt_next(), pg_getopt_start(), and result.

Referenced by main().

Variable Documentation

◆ optarg

◆ opterr

PGDLLIMPORT int opterr
extern

Definition at line 46 of file getopt.c.

Referenced by getopt(), and getopt_long().

◆ optind

◆ optopt

PGDLLIMPORT int optopt
extern

Definition at line 48 of file getopt.c.

Referenced by getopt(), and getopt_long().