From 3acc70b2704f5244fe4ad96b65a3286c42d47f79 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 26 Oct 2022 06:43:47 +0200 Subject: [PATCH] Fixed a nasty macro expansion bug. --- main.c | 12 ++++++++++++ snac.c | 7 +++++++ snac.h | 3 +-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ffd4875..2046909 100644 --- a/main.c +++ b/main.c @@ -54,6 +54,7 @@ char *get_argv(int *argi, int argc, char *argv[]) #define GET_ARGV() get_argv(&argi, argc, argv) +d_char *html_timeline(snac *snac, char *list, int local); int main(int argc, char *argv[]) { @@ -131,6 +132,17 @@ int main(int argc, char *argv[]) return 0; } + if (strcmp(cmd, "timeline") == 0) { + xs *list = local_list(&snac, 0xfffffff); + xs *body = html_timeline(&snac, list, 1); + + printf("%s\n", body); + user_free(&snac); + srv_free(); + + return 0; + } + if ((url = GET_ARGV()) == NULL) return usage(); diff --git a/snac.c b/snac.c index d26fd3f..4de34f0 100644 --- a/snac.c +++ b/snac.c @@ -30,6 +30,13 @@ int srv_running = 0; int dbglevel = 0; +int valid_status(int status) +/* is this HTTP status valid? */ +{ + return status >= 200 && status <= 299; +} + + d_char *tid(int offset) /* returns a time-based Id */ { diff --git a/snac.h b/snac.h index 260feae..779e298 100644 --- a/snac.h +++ b/snac.h @@ -14,10 +14,9 @@ extern int dbglevel; extern const char *susie; -#define valid_status(status) ((status) >= 200 && (status) <= 299) - #define L(s) (s) +int valid_status(int status); d_char *tid(int offset); double ftime(void);