dhcpd-pools  3.0
ISC dhcpd lease usage analyser
Data Structures | Macros | Functions | Variables
quotearg.c File Reference
#include <config.h>
#include "quotearg.h"
#include "quote.h"
#include "minmax.h"
#include "xalloc.h"
#include "c-strcaseeq.h"
#include "localcharset.h"
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <wctype.h>
#include "gettext.h"
Include dependency graph for quotearg.c:

Data Structures

struct  quoting_options
 
struct  slotvec
 

Macros

#define _(msgid)   gettext (msgid)
 
#define N_(msgid)   msgid
 
#define SIZE_MAX   ((size_t) -1)
 
#define INT_BITS   (sizeof (int) * CHAR_BIT)
 
#define FALLTHROUGH   ((void) 0)
 
#define STORE(c)
 
#define START_ESC()
 
#define END_ESC()
 

Functions

struct quoting_optionsclone_quoting_options (struct quoting_options *o)
 
enum quoting_style get_quoting_style (struct quoting_options const *o)
 
void set_quoting_style (struct quoting_options *o, enum quoting_style s)
 
int set_char_quoting (struct quoting_options *o, char c, int i)
 
int set_quoting_flags (struct quoting_options *o, int i)
 
void set_custom_quoting (struct quoting_options *o, char const *left_quote, char const *right_quote)
 
static struct quoting_options quoting_options_from_style (enum quoting_style style)
 
static char const * gettext_quote (char const *msgid, enum quoting_style s)
 
static size_t quotearg_buffer_restyled (char *buffer, size_t buffersize, char const *arg, size_t argsize, enum quoting_style quoting_style, int flags, unsigned int const *quote_these_too, char const *left_quote, char const *right_quote)
 
size_t quotearg_buffer (char *buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o)
 
char * quotearg_alloc (char const *arg, size_t argsize, struct quoting_options const *o)
 
char * quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, struct quoting_options const *o)
 
void quotearg_free (void)
 
static char * quotearg_n_options (int n, char const *arg, size_t argsize, struct quoting_options const *options)
 
char * quotearg_n (int n, char const *arg)
 
char * quotearg_n_mem (int n, char const *arg, size_t argsize)
 
char * quotearg (char const *arg)
 
char * quotearg_mem (char const *arg, size_t argsize)
 
char * quotearg_n_style (int n, enum quoting_style s, char const *arg)
 
char * quotearg_n_style_mem (int n, enum quoting_style s, char const *arg, size_t argsize)
 
char * quotearg_style (enum quoting_style s, char const *arg)
 
char * quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize)
 
char * quotearg_char_mem (char const *arg, size_t argsize, char ch)
 
char * quotearg_char (char const *arg, char ch)
 
char * quotearg_colon (char const *arg)
 
char * quotearg_colon_mem (char const *arg, size_t argsize)
 
char * quotearg_n_style_colon (int n, enum quoting_style s, char const *arg)
 
char * quotearg_n_custom (int n, char const *left_quote, char const *right_quote, char const *arg)
 
char * quotearg_n_custom_mem (int n, char const *left_quote, char const *right_quote, char const *arg, size_t argsize)
 
char * quotearg_custom (char const *left_quote, char const *right_quote, char const *arg)
 
char * quotearg_custom_mem (char const *left_quote, char const *right_quote, char const *arg, size_t argsize)
 
char const * quote_n_mem (int n, char const *arg, size_t argsize)
 
char const * quote_mem (char const *arg, size_t argsize)
 
char const * quote_n (int n, char const *arg)
 
char const * quote (char const *arg)
 

Variables

char const *const quoting_style_args []
 
enum quoting_style const quoting_style_vals []
 
static struct quoting_options default_quoting_options
 
static char slot0 [256]
 
static int nslots = 1
 
static struct slotvec slotvec0 = {sizeof slot0, slot0}
 
static struct slotvecslotvec = &slotvec0
 
struct quoting_options quote_quoting_options
 

Macro Definition Documentation

◆ _

#define _ (   msgid)    gettext (msgid)

Referenced by gettext_quote().

◆ END_ESC

#define END_ESC ( )
Value:
do \
{ \
if (pending_shell_escape_end && ! escaping) \
{ \
STORE ('\''); \
STORE ('\''); \
pending_shell_escape_end = false; \
} \
} \
while (0)

Referenced by quotearg_buffer_restyled().

◆ FALLTHROUGH

#define FALLTHROUGH   ((void) 0)

◆ INT_BITS

#define INT_BITS   (sizeof (int) * CHAR_BIT)

◆ N_

#define N_ (   msgid)    msgid

◆ SIZE_MAX

#define SIZE_MAX   ((size_t) -1)

◆ START_ESC

#define START_ESC ( )
Value:
do \
{ \
if (elide_outer_quotes) \
goto force_outer_quoting_style; \
escaping = true; \
&& ! pending_shell_escape_end) \
{ \
STORE ('\''); \
STORE ('$'); \
STORE ('\''); \
pending_shell_escape_end = true; \
} \
STORE ('\\'); \
} \
while (0)
Definition: quotearg.h:74
quoting_style
Definition: quotearg.h:32

Referenced by quotearg_buffer_restyled().

◆ STORE

#define STORE (   c)
Value:
do \
{ \
if (len < buffersize) \
buffer[len] = (c); \
len++; \
} \
while (0)

Referenced by quotearg_buffer_restyled().

Function Documentation

◆ clone_quoting_options()

struct quoting_options* clone_quoting_options ( struct quoting_options o)
Here is the call graph for this function:

◆ get_quoting_style()

enum quoting_style get_quoting_style ( struct quoting_options const *  o)

◆ gettext_quote()

static char const* gettext_quote ( char const *  msgid,
enum quoting_style  s 
)
static

Referenced by quotearg_buffer_restyled().

Here is the call graph for this function:

◆ quote()

char const* quote ( char const *  arg)

Referenced by field_selector(), parse_command_line_opts(), parse_config(), return_limit(), and strtod_or_err().

Here is the call graph for this function:

◆ quote_mem()

char const* quote_mem ( char const *  arg,
size_t  argsize 
)
Here is the call graph for this function:

◆ quote_n()

char const* quote_n ( int  n,
char const *  arg 
)

Referenced by quote().

Here is the call graph for this function:

◆ quote_n_mem()

char const* quote_n_mem ( int  n,
char const *  arg,
size_t  argsize 
)

Referenced by quote_mem(), and quote_n().

Here is the call graph for this function:

◆ quotearg()

char* quotearg ( char const *  arg)
Here is the call graph for this function:

◆ quotearg_alloc()

char* quotearg_alloc ( char const *  arg,
size_t  argsize,
struct quoting_options const *  o 
)
Here is the call graph for this function:

◆ quotearg_alloc_mem()

char* quotearg_alloc_mem ( char const *  arg,
size_t  argsize,
size_t *  size,
struct quoting_options const *  o 
)

Referenced by quotearg_alloc().

Here is the call graph for this function:

◆ quotearg_buffer()

size_t quotearg_buffer ( char *  buffer,
size_t  buffersize,
char const *  arg,
size_t  argsize,
struct quoting_options const *  o 
)
Here is the call graph for this function:

◆ quotearg_buffer_restyled()

static size_t quotearg_buffer_restyled ( char *  buffer,
size_t  buffersize,
char const *  arg,
size_t  argsize,
enum quoting_style  quoting_style,
int  flags,
unsigned int const *  quote_these_too,
char const *  left_quote,
char const *  right_quote 
)
static

Referenced by quotearg_alloc_mem(), quotearg_buffer(), and quotearg_n_options().

Here is the call graph for this function:

◆ quotearg_char()

char* quotearg_char ( char const *  arg,
char  ch 
)

Referenced by quotearg_colon().

Here is the call graph for this function:

◆ quotearg_char_mem()

char* quotearg_char_mem ( char const *  arg,
size_t  argsize,
char  ch 
)

Referenced by quotearg_char(), and quotearg_colon_mem().

Here is the call graph for this function:

◆ quotearg_colon()

char* quotearg_colon ( char const *  arg)

Referenced by close_stdout().

Here is the call graph for this function:

◆ quotearg_colon_mem()

char* quotearg_colon_mem ( char const *  arg,
size_t  argsize 
)
Here is the call graph for this function:

◆ quotearg_custom()

char* quotearg_custom ( char const *  left_quote,
char const *  right_quote,
char const *  arg 
)
Here is the call graph for this function:

◆ quotearg_custom_mem()

char* quotearg_custom_mem ( char const *  left_quote,
char const *  right_quote,
char const *  arg,
size_t  argsize 
)
Here is the call graph for this function:

◆ quotearg_free()

void quotearg_free ( void  )

◆ quotearg_mem()

char* quotearg_mem ( char const *  arg,
size_t  argsize 
)
Here is the call graph for this function:

◆ quotearg_n()

char* quotearg_n ( int  n,
char const *  arg 
)

Referenced by quotearg().

Here is the call graph for this function:

◆ quotearg_n_custom()

char* quotearg_n_custom ( int  n,
char const *  left_quote,
char const *  right_quote,
char const *  arg 
)

Referenced by quotearg_custom().

Here is the call graph for this function:

◆ quotearg_n_custom_mem()

char* quotearg_n_custom_mem ( int  n,
char const *  left_quote,
char const *  right_quote,
char const *  arg,
size_t  argsize 
)

Referenced by quotearg_custom_mem(), and quotearg_n_custom().

Here is the call graph for this function:

◆ quotearg_n_mem()

char* quotearg_n_mem ( int  n,
char const *  arg,
size_t  argsize 
)

Referenced by quotearg_mem().

Here is the call graph for this function:

◆ quotearg_n_options()

static char* quotearg_n_options ( int  n,
char const *  arg,
size_t  argsize,
struct quoting_options const *  options 
)
static

◆ quotearg_n_style()

char* quotearg_n_style ( int  n,
enum quoting_style  s,
char const *  arg 
)

Referenced by quotearg_style().

Here is the call graph for this function:

◆ quotearg_n_style_colon()

char* quotearg_n_style_colon ( int  n,
enum quoting_style  s,
char const *  arg 
)
Here is the call graph for this function:

◆ quotearg_n_style_mem()

char* quotearg_n_style_mem ( int  n,
enum quoting_style  s,
char const *  arg,
size_t  argsize 
)

Referenced by quotearg_style_mem().

Here is the call graph for this function:

◆ quotearg_style()

char* quotearg_style ( enum quoting_style  s,
char const *  arg 
)
Here is the call graph for this function:

◆ quotearg_style_mem()

char* quotearg_style_mem ( enum quoting_style  s,
char const *  arg,
size_t  argsize 
)
Here is the call graph for this function:

◆ quoting_options_from_style()

static struct quoting_options quoting_options_from_style ( enum quoting_style  style)
static

◆ set_char_quoting()

int set_char_quoting ( struct quoting_options o,
char  c,
int  i 
)

◆ set_custom_quoting()

void set_custom_quoting ( struct quoting_options o,
char const *  left_quote,
char const *  right_quote 
)

Referenced by quotearg_n_custom_mem().

◆ set_quoting_flags()

int set_quoting_flags ( struct quoting_options o,
int  i 
)

◆ set_quoting_style()

void set_quoting_style ( struct quoting_options o,
enum quoting_style  s 
)

Variable Documentation

◆ default_quoting_options

struct quoting_options default_quoting_options
static

◆ nslots

int nslots = 1
static

◆ quote_quoting_options

struct quoting_options quote_quoting_options
Initial value:
=
{
0,
{ 0 },
}
Definition: quotearg.h:170
#define NULL
Definition: stddef.in.h:72

◆ quoting_style_args

char const* const quoting_style_args[]
Initial value:
=
{
"literal",
"shell",
"shell-always",
"shell-escape",
"shell-escape-always",
"c",
"c-maybe",
"escape",
"locale",
"clocale",
0
}

◆ quoting_style_vals

enum quoting_style const quoting_style_vals[]
Initial value:

◆ slot0

char slot0[256]
static

◆ slotvec

struct slotvec* slotvec = &slotvec0
static

◆ slotvec0

struct slotvec slotvec0 = {sizeof slot0, slot0}
static