aboutsummaryrefslogtreecommitdiff
path: root/src/defs.h
blob: 3b4dbaf2d65c812e78fc7613ebd4dc84101c3927 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdarg.h>

#ifndef DEFAULT_ADDRESS
# define DEFAULT_ADDRESS "127.0.0.1"
#endif
#ifndef DEFAULT_SERVICE
# define DEFAULT_SERVICE "8080"
#endif
#ifndef SYSCONFDIR
# define SYSCONFDIR "/etc"
#endif
#ifndef LOCALSTATEDIR
# define LOCALSTATEDIR "/var/lib"
#endif
#ifndef PACKAGESTATEDIR
# define PACKAGESTATEDIR LOCALSTATEDIR "/" PACKAGE
#endif
#define DEFAULT_CONFIG_FILE SYSCONFDIR "/" PACKAGE ".conf"
#define LOCAL_IP_LIST_FILE PACKAGESTATEDIR "/ip-list"
#define CRED_FILE_NAME ".ping903.cred"

#define COPYLEFT "\
Copyright (C) 2020 Sergey Poznyakoff\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n\
\n"

void emalloc_die(void);
void *emalloc(size_t s);
void *ecalloc(size_t n, size_t s);
char *estrdup(char const *s);
void *e2nrealloc(void *p, size_t *pn, size_t s);

extern char *progname;

void vlogger(int prio, char const *fmt, va_list ap);
void fatal(char const *fmt, ...);
void error(char const *fmt, ...);
void info(char const *fmt, ...);
void syslog_enable(void);
void set_progname(char const *arg);
int set_log_facility(char const *arg);

enum {
	STRSPLIT_OK,
	STRSPLIT_NOMEM,
	STRSPLIT_ERR
};

int strsplit(char const *str, int max, int *ret_ac, char ***ret_av,
	     char **endp);
void argcv_free(int ac, char **av);

Return to:

Send suggestions and report system problems to the System administrator.