equal
deleted
inserted
replaced
|
1 |
|
2 /* |
|
3 * error handling |
|
4 */ |
|
5 |
|
6 // perror + exit |
1 void die (const char *msg); |
7 void die (const char *msg); |
|
8 |
|
9 // fprintf + newline |
2 void error (const char *fmt, ...); |
10 void error (const char *fmt, ...); |
|
11 |
|
12 // fprintf + strerror + newline |
3 void perr (const char *fmt, ...); |
13 void perr (const char *fmt, ...); |
|
14 |
|
15 // fprintf + strerror + newline + exit |
4 void perr_exit (const char *fmt, ...); |
16 void perr_exit (const char *fmt, ...); |
|
17 |
|
18 // fprintf + newline + exit |
5 void err_exit (const char *fmt, ...); |
19 void err_exit (const char *fmt, ...); |
6 |
20 |
|
21 /* |
|
22 * Parse a host:port string. |
|
23 * |
|
24 * Valid formats: |
|
25 * host |
|
26 * host:port |
|
27 * [host] |
|
28 * [host]:port |
|
29 * |
|
30 * The contents of the given hostport string *will* be modified. |
|
31 * |
|
32 * The value of *port will be set to NULL if no port was given. |
|
33 * |
|
34 * Returns 0 and sets *host if succesfull, nonzero otherwise. |
|
35 * |
|
36 */ |
|
37 int parse_hostport (char *hostport, char **host, char **port); |
7 |
38 |