# String Manipulation API.

## Files
file | rpmstring.h

| String manipulation helper functions.
## Defines
#define | appendStringBuf(sb, s) appendStringBufAux(sb, s, 0)
#define | appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1)
## Typedefs
typedef struct StringBufRec * | StringBuf
## Functions
static int | rislower (int c)
| Locale insensitive islower(3).
static int | risupper (int c)
| Locale insensitive isupper(3).
static int | risalpha (int c)
| Locale insensitive isalpha(3).
static int | risdigit (int c)
| Locale insensitive isdigit(3).
static int | risalnum (int c)
| Locale insensitive isalnum(3).
static int | risblank (int c)
| Locale insensitive isblank(3).
static int | risspace (int c)
| Locale insensitive isspace(3).
static int | rtolower (int c)
| Locale insensitive tolower(3).
static int | rtoupper (int c)
| Locale insensitive toupper(3).
int | rstrcasecmp (const char *s1, const char *s2)
| Locale insensitive strcasecmp(3).
int | rstrncasecmp (const char *s1, const char *s2, size_t n)
| Locale insensitive strncasecmp(3).
int | rasprintf (char **strp, const char *fmt,...)
| asprintf() clone
char * | rstrcat (char **dest, const char *src)
| Concatenate two strings with dynamically (re)allocated memory.
char * | rstrscat (char **dest, const char *arg,...)
| Concatenate multiple strings with dynamically (re)allocated memory.
size_t | rstrlcpy (char *dest, const char *src, size_t n)
| strlcpy() clone: Copy src to string dest of size n.
char * | stripTrailingChar (char *s, char c)
| Remove occurences of trailing character from string.
StringBuf | newStringBuf (void)
StringBuf | freeStringBuf (StringBuf sb)
void | truncStringBuf (StringBuf sb)
char * | getStringBuf (StringBuf sb)
void | stripTrailingBlanksStringBuf (StringBuf sb)
void | appendStringBufAux (StringBuf sb, const char *s, int nl)

## Define Documentation

#define appendLineStringBuf | ( | sb,
|  | s |  | ) | appendStringBufAux(sb, s, 1)

Definition at line 213 of file rpmstring.h.

#define appendStringBuf | ( | sb,
|  | s |  | ) | appendStringBufAux(sb, s, 0)

Definition at line 209 of file rpmstring.h.

## Typedef Documentation

typedef struct StringBufRec* StringBuf

Definition at line 185 of file rpmstring.h.

## Function Documentation

void appendStringBufAux | ( | StringBuf | sb,
|  | const char * | s,
|  | int | nl |
| ) |  |  |

StringBuf freeStringBuf | ( | StringBuf | sb | ) |

char* getStringBuf | ( | StringBuf | sb | ) |

StringBuf newStringBuf | ( | void |  | ) |

int rasprintf | ( | char ** | strp,
|  | const char * | fmt,
|  |  | ... |
| ) |  |  |

asprintf() clone

Referenced by buildForTarget(), and getTarSpec().

static int risalnum | ( | int | c | ) | `[inline, static]`

Locale insensitive isalnum(3).

Definition at line 54 of file rpmstring.h.

References risalpha(), and risdigit().

static int risalpha | ( | int | c | ) | `[inline, static]`

Locale insensitive isalpha(3).

Definition at line 38 of file rpmstring.h.

References rislower(), and risupper().

Referenced by risalnum().

static int risblank | ( | int | c | ) | `[inline, static]`

Locale insensitive isblank(3).

Definition at line 62 of file rpmstring.h.

Referenced by risspace().

static int risdigit | ( | int | c | ) | `[inline, static]`

Locale insensitive isdigit(3).

Definition at line 46 of file rpmstring.h.

Referenced by risalnum().

static int rislower | ( | int | c | ) | `[inline, static]`

Locale insensitive islower(3).

Definition at line 22 of file rpmstring.h.

Referenced by risalpha(), and rtoupper().

static int risspace | ( | int | c | ) | `[inline, static]`

Locale insensitive isspace(3).

Definition at line 70 of file rpmstring.h.

References risblank().

static int risupper | ( | int | c | ) | `[inline, static]`

Locale insensitive isupper(3).

Definition at line 30 of file rpmstring.h.

Referenced by risalpha(), and rtolower().

int rstrcasecmp | ( | const char * | s1,
|  | const char * | s2 |
| ) |  |  |

Locale insensitive strcasecmp(3).

char* rstrcat | ( | char ** | dest,
|  | const char * | src |
| ) |  |  |

Concatenate two strings with dynamically (re)allocated memory.

Parameters:

  | dest | pointer to destination string
  | src | source string

Returns:
  realloc'd dest with src appended

size_t rstrlcpy | ( | char * | dest,
|  | const char * | src,
|  | size_t | n |
| ) |  |  |

strlcpy() clone: Copy src to string dest of size n.

At most n-1 characters will be copied. Always zero-terminates (unless n == 0). Length of src is returned; if retval >= n, truncation occurred.

Parameters:

  | dest | destination buffer
  | src | string to copy
  | n | destination buffer size

Returns:
  length of src string

int rstrncasecmp | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | n |
| ) |  |  |

Locale insensitive strncasecmp(3).

char* rstrscat | ( | char ** | dest,
|  | const char * | arg,
|  |  | ... |
| ) |  |  |

Concatenate multiple strings with dynamically (re)allocated memory.

Parameters:

  | dest | pointer to destination string
  | arg | NULL terminated list of strings to concatenate

Returns:
  realloc'd dest with strings appended

Referenced by buildForTarget(), and main().

static int rtolower | ( | int | c | ) | `[inline, static]`

Locale insensitive tolower(3).

Definition at line 78 of file rpmstring.h.

References risupper().

static int rtoupper | ( | int | c | ) | `[inline, static]`

Locale insensitive toupper(3).

Definition at line 86 of file rpmstring.h.

References rislower().

void stripTrailingBlanksStringBuf | ( | StringBuf | sb | ) |

char* stripTrailingChar | ( | char * | s,
|  | char | c |
| ) |  |  |

Remove occurences of trailing character from string.

Parameters:

  | s | string
  | c | character to strip

Returns:
  string

void truncStringBuf | ( | StringBuf | sb | ) |