changeset 37174:165576e1efe3

pmccabe2html: fix portability issues Allow awk versions other than Gawk. Correct wrong HTML tag closures.
author Mats Erik Andersson <gnu@gisladisker.se>
date Thu, 19 Sep 2013 19:47:29 +0200
parents b9e3879bc28f
children 70de437ab0f3
files ChangeLog build-aux/pmccabe2html
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Sep 18 18:04:26 2013 +0200
+++ b/ChangeLog	Thu Sep 19 19:47:29 2013 +0200
@@ -1,3 +1,16 @@
+2013-09-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	pmccabe2html: Portability to other awk versions.
+	The functions systime() and strftime() are available
+	in Gawk only.  Properly close two HTML-tags 'style'
+	and 'span'.
+	* build-aux/pmccabe2html (BEGIN): Store timing
+	strings in EPOCH_TIME and CHRONOS_TIME.  Replace
+	systime() in HTML_COMMENT.
+	(html_header): Correctly close tag 'style'.
+	(END): Replace strftime() by CHRONOS_TIME.  Close
+	tag 'span' correctly, not as 'div'.
+
 2013-09-17  Mats Erik Andersson  <gnu@gisladisker.se>  (tiny change)
 
 	getgroups: statement without effect
--- a/build-aux/pmccabe2html	Wed Sep 18 18:04:26 2013 +0200
+++ b/build-aux/pmccabe2html	Thu Sep 19 19:47:29 2013 +0200
@@ -47,6 +47,10 @@
 
 # Prologue & configuration
 BEGIN {
+    # Portable lookup of present time.
+    "date +%s" | getline epoch_time
+    "date" | getline chronos_time
+
     section_global_stats_p = 1
     section_function_cyclo_p = 1
 
@@ -69,7 +73,7 @@
 Copyright (c) 2007, 2008 Free Software Foundation, Inc."
     html_doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \
 \"http://www.w3.org/TR/html401/loose.dtd\">"
-    html_comment = "<!-- Generated by gnulib's pmccabe2html at " systime() " -->"
+    html_comment = "<!-- Generated by gnulib's pmccabe2html at " epoch_time " -->"
     html_title = "Cyclomatic Complexity report for " package_name
 
     # Wiki options
@@ -211,7 +215,7 @@
 	    print cssline
 	}
         print "-->"
-	print "</style />"
+	print "</style>"
 	close(css)
     }
     print "</head>"
@@ -852,12 +856,12 @@
     if (output_lang == "html")
     {
         print "<div class=\"page_title\">" package_name " Cyclomatic Complexity Report</div>"
-        print "<p>Report generated at: <span class=\"report_timestamp\">" strftime() "</div></p>"
+        print "<p>Report generated at: <span class=\"report_timestamp\">" chronos_time "</span></p>"
     }
     if (output_lang == "wiki")
     {
         print "==" package_name " Cyclomatic Complexity Report=="
-        print "Report generated at: '''" strftime() "'''"
+        print "Report generated at: '''" chronos_time "'''"
     }
 
     if (section_global_stats_p)