suckless-quark/util.h
Laslo Hunhold 3c7049e906
Use pledge(2) and unveil(2) on OpenBSD
It has been on my todo-list for a long time. I tested it on
OpenBSD 6.5.

Thanks Richard Ulmer for the reminder.

Signed-off-by: Laslo Hunhold <dev@frign.de>
2019-09-23 16:56:28 +02:00

60 lines
1.1 KiB
C

/* See LICENSE file for copyright and license details. */
#ifndef UTIL_H
#define UTIL_H
#include <regex.h>
#include <stddef.h>
#include <time.h>
#include "arg.h"
/* main server struct */
struct vhost {
char *chost;
char *regex;
char *dir;
char *prefix;
regex_t re;
};
struct map {
char *chost;
char *from;
char *to;
};
extern struct server {
char *host;
char *port;
char *docindex;
int listdirs;
struct vhost *vhost;
size_t vhost_len;
struct map *map;
size_t map_len;
} s;
#undef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#undef LEN
#define LEN(x) (sizeof (x) / sizeof *(x))
extern char *argv0;
void warn(const char *, ...);
void die(const char *, ...);
void epledge(const char *, const char *);
void eunveil(const char *, const char *);
#define TIMESTAMP_LEN 30
char *timestamp(time_t, char buf[TIMESTAMP_LEN]);
int esnprintf(char *, size_t, const char *, ...);
void *reallocarray(void *, size_t, size_t);
long long strtonum(const char *, long long, long long, const char **);
#endif /* UTIL_H */