util.h - frontends - front-ends for some sites (experiment)
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
util.h (1016B)
---
1 #ifndef __OpenBSD__
2 #define pledge(p1,p2) 0
3 #define unveil(p1,p2) 0
4 #endif
5
6 /* ctype-like macros, but always compatible with ASCII / UTF-8 */
7 #define ISALPHA(c) ((((unsigned)c) | 32) - 'a' < 26)
8 #define ISCNTRL(c) ((c) < ' ' || (c) == 0x7f)
9 #define ISDIGIT(c) (((unsigned)c) - '0' < 10)
10 #define ISSPACE(c) ((c) == ' ' || ((((unsigned)c) - '\t') < 5))
11 #define TOLOWER(c) ((((unsigned)c) - 'A' < 26) ? ((c) | 32) : (c))
12
13 #undef strlcat
14 size_t strlcat(char *, const char *, size_t);
15 #undef strlcpy
16 size_t strlcpy(char *, const char *, size_t);
17
18 int decodeparam(char *buf, size_t bufsiz, const char *s);
19 int durationstr(long secs, char *buf, size_t bufsiz);
20 int friendlytime(time_t now, time_t t);
21 char *getparam(const char *query, const char *s);
22 void gophertext(FILE *fp, const char *s, size_t len);
23 int hexdigit(int c);
24 size_t printnumsep(const char *s);
25 int uriencode(const char *s, char *buf, size_t bufsiz);
26 int utf8pad(char *buf, size_t bufsiz, const char *s, size_t len, int pad);
27 void xmlencode(const char *s);