diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-17 20:57:05 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-17 20:57:05 +0200 |
commit | 361bb55f01ba28960a8127b0a16c1e7a7a8de61a (patch) | |
tree | ff0479af1c9283c8a0546025022ebc54616a9a75 /t/front.tc | |
parent | 2810ad72aeb973a898034d6875922284062c5ce0 (diff) | |
download | cforum-361bb55f01ba28960a8127b0a16c1e7a7a8de61a.tar.gz |
Rewrite mktpl script in C
The Perl version didn't handle multiple interpolations on the same line.
Diffstat (limited to 't/front.tc')
-rw-r--r-- | t/front.tc | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -1,16 +1,15 @@ printf("<h1>"); printf("%s", site.name ); -printf("</h1>\n"); - printf("Hello world!"); printf("\n<br>\nRequest method: "); +printf("</h1>\n<p>Thanks for the "); printf("%s", getenv("REQUEST_METHOD") ); -printf("<br>\n"); - char *a, *b, *bv; - a = nextparam(512); - printf("%s (%d)<br>", a, TRUNCATED(a)); - b = nextparam(512); - printf("%s (%d)<br>", b, TRUNCATED(b)); - bv = split(b); - printf("'%s' contains '%s'<br>", b, bv); - printf("Next: %s\n", nextparam(512)); - printf("Next: %s\n", nextparam(512)); -printf("\n"); +printf(" request!</p>\n<table border=\"1\">\n <tr style=\"font-weight: bold;\">\n <td style=\"width: 60px;\">Key</td>\n <td style=\"width: 140px;\">Value</td>\n </tr>\n "); + char *p, *v; + while(p = nextparam(GET, 512)){ + v = split(p); + printf("\n <tr>\n <td>"); +printf("%s", p ); +printf("</td>\n <td>"); +printf("%s", v ); +printf("</td>\n </tr>\n "); + } + printf("\n</table>"); |