diff options
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/config.h b/config.h new file mode 100644 index 0000000..96a42b7 --- /dev/null +++ b/config.h @@ -0,0 +1,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 */ |