Di_string

## Data Structures

struct | di_rstring
| raw string More...

## Functions

int | di_snprintfcat (char *str, size_t size, const char *format,...)
char * | di_stradup (const char *s, size_t n)

## Detailed Description

## Function Documentation

## di_snprintfcat()

int di_snprintfcat | ( | char * | str,
|  | size_t | size,
|  | const char * | format,
|  |  | ...
| ) |  |

cat resolved format to str

Parameters

  str | string
  size | len of str
  format | printf compatible string

Returns
  append chars

{
va_list ap;
int retval;
size_t len = strlen (str);
va_start (ap, format);
retval = vsnprintf (str + len, size - len, format, ap);
va_end (ap);
return retval;
}

## di_stradup()

char * di_stradup | ( | const char * | s,
|  | size_t | n
| ) |  |

Copies n bytes from s, without calculating the length of s itself.

Parameters

  s | source
  n | len of source without delimiter

Returns
  malloced string

{
size_t len = n + 1;
char *string = di_new (char, len);
string[n] = '\0';
return memcpy (string, s, n);
}
di_new
#define di_new(struct_type, n_structs)
Definition mem.h:73

References di_new.

Referenced by di_packages_get_package_new().