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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#include <stdio.h>
#include <time.h>
#ifdef __OpenBSD__
#include <unistd.h>
#else
#define pledge(p1,p2) 0
#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
size_t strlcat(char *, const char *, size_t);
#undef strlcpy
size_t strlcpy(char *, const char *, size_t);
#ifndef SFEED_DUMBTERM
#define PAD_TRUNCATE_SYMBOL "\xe2\x80\xa6" /* symbol: "ellipsis" */
#define UTF_INVALID_SYMBOL "\xef\xbf\xbd" /* symbol: "replacement" */
#else
#define PAD_TRUNCATE_SYMBOL "."
#define UTF_INVALID_SYMBOL "?"
#endif
/* feed info */
struct feed {
char *name; /* feed name */
unsigned long totalnew; /* amount of new items per feed */
unsigned long total; /* total items */
/* sfeed_curses */
char *path; /* path to feed or NULL for stdin */
FILE *fp; /* file pointer */
};
/* URI */
struct uri {
char proto[48]; /* scheme including ":" or "://" */
char userinfo[256]; /* username [:password] */
char host[256];
char port[6]; /* numeric port */
char path[1024];
char query[1024];
char fragment[1024];
};
enum {
FieldUnixTimestamp = 0, FieldTitle, FieldLink, FieldContent,
FieldContentType, FieldId, FieldAuthor, FieldEnclosure, FieldCategory,
FieldLast
};
/* hint for compilers and static analyzers that a function exits */
#ifndef __dead
#define __dead
#endif
__dead void err(int, const char *, ...);
__dead void errx(int, const char *, ...);
int uri_format(char *, size_t, struct uri *);
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);
void parseline(char *, char *[FieldLast]);
void printutf8pad(FILE *, const char *, size_t, int);
int strtotime(const char *, time_t *);
void xmlencode(const char *, FILE *);
|