aboutsummaryrefslogtreecommitdiff
path: root/t/front.tc
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-17 20:57:05 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-17 20:57:05 +0200
commit361bb55f01ba28960a8127b0a16c1e7a7a8de61a (patch)
treeff0479af1c9283c8a0546025022ebc54616a9a75 /t/front.tc
parent2810ad72aeb973a898034d6875922284062c5ce0 (diff)
downloadcforum-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.tc25
1 files changed, 12 insertions, 13 deletions
diff --git a/t/front.tc b/t/front.tc
index 89e665a..3307c21 100644
--- a/t/front.tc
+++ b/t/front.tc
@@ -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>");