summaryrefslogtreecommitdiffstats
path: root/config.h
blob: 96a42b7d6aab1e63f0162e3daf6906a0e488f3f7 (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef CONFIG_H
#define CONFIG_H
#include <strings.h>

#define CLEN 512

#define DUMPSTR(N, S) fprintf(stderr, "%-15s: %s\n", N, S);
#define DUMPCFG() \
	DUMPSTR("DbLoc", kdbloc); \
	DUMPSTR("ContentDir", kcontentdir); \
	DUMPSTR("LinkPreset", klinkpreset); \
	DUMPSTR("Autoedit", kautoedit); \
	DUMPSTR("Autoexport", kautoexport); \
	DUMPSTR("SkullExport", kskullexport); \
	DUMPSTR("RssTitle", krsstitle); \
	DUMPSTR("RssDescription", krssdescription); \
	DUMPSTR("RssLink", krsslink); \
	DUMPSTR("RssExport", krssexport); \
	DUMPSTR("PostsExport", kpostsexport); \

char *storepointer(const char *, int *);

extern char kdbloc[];
extern char kcontentdir[];
extern char klinkpreset[];
extern char kautoedit[];
extern char kautoexport[];

extern char kskullexport[];

extern char krsstitle[];
extern char krssdescription[];
extern char krsslink[];
extern char krssexport[];

extern char kpostsexport[];

#ifdef MAIN
char kdbloc[CLEN] = "sm.tsv";
char kcontentdir[CLEN] = "content";
char klinkpreset[CLEN] = "https://previousplan.org/%";
char kautoedit[CLEN] = "True";
char kautoexport[CLEN] = "False";

char kskullexport[CLEN] = "export";

char krsstitle[CLEN] = "Previous Plan!";
char krssdescription[CLEN] = "Previous Plan! Blog";
char krsslink[CLEN] = "https://previousplan.org/rss.xml";
char krssexport[CLEN] = "export/rss.xml";

char kpostsexport[CLEN] = "export/posts.html";

char *
storepointer(const char *key, int *ispath)
{
	*ispath = 0;
	if (!strcasecmp(key, "DbLoc")) {
		*ispath = 1;
		return kdbloc;
	}
	if (!strcasecmp(key, "ContentDir")) {
		*ispath = 1;
		return kcontentdir;
	}
	if (!strcasecmp(key, "LinkPreset"))
		return klinkpreset;
	if (!strcasecmp(key, "Autoedit"))
		return kautoedit;
	if (!strcasecmp(key, "Autoexport"))
		return kautoexport;
	if (!strcasecmp(key, "SkullExport")) {
		*ispath = 1;
		return kskullexport;
	}
	if (!strcasecmp(key, "RssTitle"))
		return krsstitle;
	if (!strcasecmp(key, "RssDescription"))
		return krssdescription;
	if (!strcasecmp(key, "RssLink"))
		return krsslink;
	if (!strcasecmp(key, "RssExport")) {
		*ispath = 1;
		return krssexport;
	}
	if (!strcasecmp(key, "PostsExport")) {
		*ispath = 1;
		return kpostsexport;
	}
	return NULL;
}
#endif

#endif /* ! CONFIG_H */