diff options
author | sijanec <anton@sijanec.eu> | 2021-04-04 22:52:39 +0200 |
---|---|---|
committer | sijanec <anton@sijanec.eu> | 2021-04-04 22:52:39 +0200 |
commit | 4916ba77785633cd0d74a05802d0fc08764f40dc (patch) | |
tree | 747e53b5e64dbaaba71dbef5033424f2c5166067 /src/httpd.c | |
parent | fixed dependency on stdin to pause (diff) | |
download | sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar.gz sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar.bz2 sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar.lz sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar.xz sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.tar.zst sear.c-4916ba77785633cd0d74a05802d0fc08764f40dc.zip |
Diffstat (limited to '')
-rw-r--r-- | src/httpd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/httpd.c b/src/httpd.c index bf5c3d1..656ad92 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -9,13 +9,17 @@ char * sc_queryhtml (struct sc_query * q) { /* remember to free returned string string##_sizeof = (string##_written+wanted+1)*SC_REALLOC_K; \ string = realloc(string, string##_sizeof); \ } -#define SC_HRF "<div class=result><h4><a href=\"%s\">%s</a></h4><p>%s</p></div>" +#define SC_HRF "<div class=result id=result%lu><h4><a href=\"%s\" accesskey=%lu>%s</a> " \ + "<span class=breadcrumb>%s</span></h4><p>%s</p></div>" +#define SC_HRA i, safeurl, i, safetitle, safebreadcrumbs, safebody char * safetitle = htmlspecialchars(q->results[i]->title); char * safebody = htmlspecialchars(q->results[i]->desc); char * safeurl = htmlspecialchars(q->results[i]->url); - size_t ws = snprintf(NULL, 0, SC_HRF, safeurl, safetitle, safebody); + char * safebreadcrumbs = htmlspecialchars(q->results[i]->breadcrumbs); + size_t ws = snprintf(NULL, 0, SC_HRF, SC_HRA); SC_HRC(resultshtml, ws); - resultshtml_written += sprintf(resultshtml+resultshtml_written, SC_HRF, safeurl, safetitle, safebody); + resultshtml_written += sprintf(resultshtml+resultshtml_written, SC_HRF, SC_HRA); + free(safebreadcrumbs); free(safetitle); free(safebody); free(safeurl); |