summaryrefslogtreecommitdiff
path: root/plugins/ddb_input_uade2/uade-2.13/src/frontends/common/support.h
blob: 1b32fe92238035e7460f6c849c9a843723f90917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _UADE_SUPPORT_H_
#define _UADE_SUPPORT_H_

#include <stdio.h>

#define UADE_LINESIZE 1024

#define uadeerror(fmt, args...) do { fprintf(stderr, "uade: " fmt, ## args); exit(1); } while (0)

#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))


char *xbasename(const char *path);

int get_two_ws_separated_fields(char **key, char **value, char *s);

int skipnws(const char *s, int i);

int skip_and_terminate_word(char *s, int i);

int skipws(const char *s, int i);

char **read_and_split_lines(size_t *nitems, size_t *lineno, FILE *f,
			    const char *delim);

/* Same as fgets(), but guarantees that feof() or ferror() have happened
   when xfgets() returns NULL */
char *xfgets(char *s, int size, FILE *stream);

#endif