argparse.c

Reference Documentation

product_line_custom
IntelĀ® PAC
Napatech SmartNIC
category
Reference Information
Napatech Software Suite: examples/common/argparse.c File Reference
argparse.c File Reference
#include "argparse.h"

Go to the source code of this file.

Functions

static const char * prefix_skip (const char *str, const char *prefix)
 
static int prefix_cmp (const char *str, const char *prefix)
 
static void argparse_error (struct argparse *This, const struct argparse_option *opt, const char *reason)
 
static int argparse_getvalue (struct argparse *This, const struct argparse_option *opt, int flags)
 
static void argparse_options_check (const struct argparse_option *options)
 
static int argparse_short_opt (struct argparse *This, const struct argparse_option *options)
 
static int argparse_long_opt (struct argparse *This, const struct argparse_option *options)
 
int argparse_init (struct argparse *This, struct argparse_option *options, const char *const *usage, int flags)
 
int argparse_parse (struct argparse *This, int argc, const char **argv)
 
void argparse_usage (struct argparse *This)
 
int argparse_help_cb (struct argparse *This, const struct argparse_option *option, int terminate)
 

Macros

#define OPT_UNSET   1
 

Function Documentation

static const char* prefix_skip ( const char *  str,
const char *  prefix 
)
static

Definition at line 16 of file argparse.c.

Referenced by argparse_long_opt().

static int prefix_cmp ( const char *  str,
const char *  prefix 
)
static

Definition at line 23 of file argparse.c.

Referenced by argparse_long_opt().

static void argparse_error ( struct argparse This,
const struct argparse_option opt,
const char *  reason 
)
static

Definition at line 33 of file argparse.c.

Referenced by argparse_getvalue().

static int argparse_getvalue ( struct argparse This,
const struct argparse_option opt,
int  flags 
)
static

Definition at line 46 of file argparse.c.

Referenced by argparse_long_opt(), and argparse_short_opt().

static void argparse_options_check ( const struct argparse_option options)
static

Definition at line 137 of file argparse.c.

Referenced by argparse_parse().

static int argparse_short_opt ( struct argparse This,
const struct argparse_option options 
)
static

Definition at line 157 of file argparse.c.

Referenced by argparse_parse().

static int argparse_long_opt ( struct argparse This,
const struct argparse_option options 
)
static

Definition at line 169 of file argparse.c.

Referenced by argparse_parse().

int argparse_init ( struct argparse This,
struct argparse_option options,
const char *const *  usage,
int  flags 
)
void argparse_usage ( struct argparse This)
Examples:
bypass/watchdog/bypass_watchdog_example.c, and net/readcapfile/readcapfile_example.c.

Definition at line 286 of file argparse.c.

Referenced by argparse_help_cb(), argparse_parse(), and main().

int argparse_help_cb ( struct argparse This,
const struct argparse_option option,
int  terminate 
)

Definition at line 388 of file argparse.c.

Macro Definition Documentation

#define OPT_UNSET   1

Copyright (C) 2012-2015 Yecheng Fu <cofyc.jackson at gmail dot com> All rights reserved.

Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Note: Some small changes has been made by Natatech.

Definition at line 13 of file argparse.c.

Referenced by argparse_getvalue(), and argparse_long_opt().