2 * Copyright (C) 2006-2009 Andre Noll <maan@systemlinux.org>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file string.h exported sybmols from string.c */
9 /** A string buffer used for para_printf(). */
11 /** The buffer. May be \p NULL. */
13 /** The size of \a buf. */
15 /** The maximal size this buffer may grow. Zero means unlimited. */
17 /** The next para_printf() will write at this offset. */
20 * If an attempt to print into this buffer is made that would need to
21 * grow \a buf to a size larger than \a max_size, then this function is
24 int (*max_size_handler)(char *buf, size_t size, void *private_data);
25 /** Passed to max_size_handler(). */
29 __must_check __malloc void *para_realloc(void *p, size_t size);
30 __must_check __malloc void *para_malloc(size_t size);
31 __must_check __malloc void *para_calloc(size_t size);
32 __must_check __malloc char *para_strdup(const char *s);
33 __must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
34 __must_check __malloc char *para_strcat(char *a, const char *b);
35 __must_check __malloc char *para_dirname(const char *name);
36 __must_check const char *para_basename(const char *name);
38 __must_check __malloc char *para_tmpname(void);
39 __must_check __malloc char *para_logname(void);
40 __must_check __malloc char *para_homedir(void);
41 __must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim);
42 __malloc char *para_hostname(void);
43 __printf_2_3 int para_printf(struct para_buffer *b, const char *fmt, ...);
44 /** Used for for_each_line() and for_each_line_ro(). */
45 typedef int line_handler_t(char *, void *);
46 int for_each_line(char *buf, size_t size, line_handler_t *line_handler,
48 int for_each_line_ro(char *buf, size_t size, line_handler_t *line_handler,
50 int para_atoi64(const char *str, int64_t *result);
51 int para_atoi32(const char *str, int32_t *value);
52 int get_loglevel_by_name(const char *txt);