From 314649d316f881cb2b7f78d0b79f3e9d8ca34e94 Mon Sep 17 00:00:00 2001 From: nishi Date: Mon, 29 Jan 2024 06:22:05 +0000 Subject: [PATCH] w3b welcome page git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@133 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/w3b/w3b.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Example/w3b/w3b.c b/Example/w3b/w3b.c index 8927089..83edee2 100644 --- a/Example/w3b/w3b.c +++ b/Example/w3b/w3b.c @@ -119,7 +119,7 @@ int nl; int start = 0; void html_handler(char* tagname, char* attr) { - if(nl - start > termh - 1) return; + if(nl - start > termh - 3) return; if(strcasecmp(tagname, "title") == 0) { title = true; } else if(strcasecmp(tagname, "/title") == 0) { @@ -143,8 +143,7 @@ void html_handler(char* tagname, char* attr) { if(nl >= start) printf("\n"); nl++; } else if(strcasecmp(tagname, "/h1") == 0) { - if(nl >= start) - if(nl >= start) printf("\n"); + if(nl >= start) printf("\n"); nl++; } else if(strcasecmp(tagname, "h2") == 0) { if(nl >= start) printf("\n"); @@ -201,7 +200,7 @@ void text_handler(char* data) { titlebuf = __W3_Concat(tmp, data); free(tmp); } else { - if(nl - start > termh - 1) return; + if(nl - start > termh - 3) return; char* text = malloc(strlen(data) + 64); int i; char* fmt_data = malloc(strlen(data) * 2); @@ -276,8 +275,8 @@ void render_site() { int main(int argc, char** argv) { int i; - databuf = NULL; - datalen = 0; + databuf = __W3_Strdup("Welcome to W3B

Welcome to W3B


W3B is a test application for the LibW3, which works as a basic browser."); + datalen = strlen(databuf); char* url = NULL; for(i = 1; i < argc; i++) { if(strcmp(argv[i], "--version") == 0) { -- 2.43.0