-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
53 lines (39 loc) · 995 Bytes
/
utils.h
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 <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <netdb.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#define INVALID 1
#define TOOSMALL 2
#define TOOLARGE 3
long long
strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp);
void *
xmalloc(size_t size);
static int
hexchar(const char *s);
int
a2port(const char *s);
static char *
urldecode(const char *src);
char *
hpdelim2(char **cp, char *delim);
int
valid_domain(char *name, int makelower, const char **errstr);
char *
cleanhostname(char *host);
char *
xstrdup(const char *str);
int
parse_uri(const char *scheme, const char *uri, char **userp, char **hostp,
int *portp, char **pathp);
int
parse_ssh_uri(const char *uri, char **userp, char **hostp, int *portp);
int
parse_user_host_port(const char *s, char **userp, char **hostp, int *portp);
size_t
strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize);