Download raw body.
bgplg: modernize html
The attached diff modernizes the html output from bgplg(8):
* Switch to html 5
* Unify usage of " vs ' in html tags
* Drop trailing / for single tags, type=text/css and <!-- ... --> for
css - not needed in html 5
* Move style definitions from bgplg.head to bgplg.css
* Make screen scaling more friendly for mobile devices
The output passes the W3 validator. If you like the changes, I can
also provide more incremental diffs.
Thanks.
Index: bgplg.c
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 bgplg.c
--- bgplg.c 5 Mar 2018 10:53:37 -0000 1.19
+++ bgplg.c 4 Feb 2024 13:40:00 -0000
@@ -260,17 +260,17 @@ main(void)
printf("Content-Type: %s\n"
"Cache-Control: no-cache\n\n"
- "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
- "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
- "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
+ "<!doctype html>\n"
+ "<html lang=\"en\">\n"
"<head>\n"
- "<title>%s</title>\n",
+ "<title>%s</title>\n"
+ "<meta name=\"viewport\" "
+ "content=\"width=device-width, initial-scale=1\">",
CONTENT_TYPE, myname);
if (stat(INC_STYLE, &st) == 0) {
- printf("<style type='text/css'><!--\n");
+ printf("<style>\n");
lg_incl(INC_STYLE);
- printf("--></style>\n");
+ printf("</style>\n");
}
if (stat(INC_HEAD, &st) != 0 || lg_incl(INC_HEAD) != 0) {
printf("</head>\n"
@@ -308,8 +308,8 @@ main(void)
}
printf("</select>\n"
- "<input type='text' value='%s' name='req'/>\n"
- "<input type='submit' value='submit'/>\n"
+ "<input type=\"text\" value=\"%s\" name=\"req\">\n"
+ "<input type=\"submit\" value=\"submit\">\n"
"</div>\n"
"</form>\n"
"<pre>\n", req ? req : "");
@@ -375,7 +375,7 @@ main(void)
if (stat(INC_FOOT, &st) != 0 || lg_incl(INC_FOOT) != 0)
printf("<hr/>\n");
- printf("<div class='footer'>\n"
+ printf("<div class=\"footer\">\n"
"</div>\n"
"</body>\n"
"</html>\n");
Index: bgplg.css
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.css,v
retrieving revision 1.3
diff -u -p -u -r1.3 bgplg.css
--- bgplg.css 12 Dec 2006 11:43:50 -0000 1.3
+++ bgplg.css 4 Feb 2024 13:40:00 -0000
@@ -5,4 +5,17 @@
img {
border: none;
border-width: 0px;
+ max-width: 100%;
+}
+body {
+ text-align: center;
+}
+pre {
+ overflow: auto;
+}
+.container {
+ margin: 0px auto;
+ text-align: left;
+ width: 1200px;
+ max-width: 100%;
}
Index: bgplg.foot
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.foot,v
retrieving revision 1.1
diff -u -p -u -r1.1 bgplg.foot
--- bgplg.foot 11 Dec 2006 23:10:10 -0000 1.1
+++ bgplg.foot 4 Feb 2024 13:40:00 -0000
@@ -1,2 +1,2 @@
</div>
-<hr/>
+<hr>
Index: bgplg.head
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.head,v
retrieving revision 1.3
diff -u -p -u -r1.3 bgplg.head
--- bgplg.head 30 Mar 2012 14:31:18 -0000 1.3
+++ bgplg.head 4 Feb 2024 13:40:00 -0000
@@ -1,6 +1,6 @@
</head>
-<body style="text-align: center">
-<div style="margin: 0px auto; text-align: left; width: 800px;">
+<body>
+<div class="container">
<a href="http://www.openbgp.org/">
-<img src="/bgplg/openbgpd.gif" alt="OpenBGPD"/>
+<img src="/bgplg/openbgpd.gif" alt="OpenBGPD">
</a>
bgplg: modernize html