summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/util.h b/util.h
index 6115dcf..3ce5e41 100644
--- a/util.h
+++ b/util.h
@@ -1,6 +1,5 @@
-#include <sys/types.h>
-
#include <stdio.h>
+#include <time.h>
#ifdef __OpenBSD__
#include <unistd.h>
@@ -9,6 +8,13 @@
#define unveil(p1,p2) 0
#endif
+/* ctype-like macros, but always compatible with ASCII / UTF-8 */
+#define ISALPHA(c) ((((unsigned)c) | 32) - 'a' < 26)
+#define ISCNTRL(c) ((c) < ' ' || (c) == 0x7f)
+#define ISDIGIT(c) (((unsigned)c) - '0' < 10)
+#define ISSPACE(c) ((c) == ' ' || ((((unsigned)c) - '\t') < 5))
+#define TOLOWER(c) ((((unsigned)c) - 'A' < 26) ? ((c) | 32) : (c))
+
#undef strcasestr
char *strcasestr(const char *, const char *);
#undef strlcat
@@ -20,8 +26,8 @@ size_t strlcpy(char *, const char *, size_t);
#define PAD_TRUNCATE_SYMBOL "\xe2\x80\xa6" /* symbol: "ellipsis" */
#define UTF_INVALID_SYMBOL "\xef\xbf\xbd" /* symbol: "replacement" */
#else
-#define PAD_TRUNCATE_SYMBOL "." /* symbol: "ellipsis" */
-#define UTF_INVALID_SYMBOL "?" /* symbol: "replacement" */
+#define PAD_TRUNCATE_SYMBOL "."
+#define UTF_INVALID_SYMBOL "?"
#endif
/* feed info */
@@ -64,6 +70,8 @@ int uri_hasscheme(const char *);
int uri_makeabs(struct uri *, struct uri *, struct uri *);
int uri_parse(const char *, struct uri *);
+void checkfileerror(FILE *, const char *, int);
+time_t getcomparetime(void);
void parseline(char *, char *[FieldLast]);
void printutf8pad(FILE *, const char *, size_t, int);
int strtotime(const char *, time_t *);