cleanup printing, improve debugging

cleanup printing, improve debugging

--- getBBoxCatalogFrom-sitemap.awk
+++ getBBoxCatalogFrom-sitemap.awk
@@ -50,8 +50,8 @@
     split ($0,fld,"\"")
     contentType = fld[2]
     contentId = fld[4]
-    # print "contentType = " contentType  > "/dev/stderr"
-    # print "contentId = " contentId  > "/dev/stderr"
+    # print "contentType = " contentType > "/dev/stderr"
+    # print "contentId = " contentId > "/dev/stderr"
     # Make sure no fields will be carried over due to missing keys
     sortkey = ""
     title = ""
@@ -79,7 +79,7 @@
 /<title locale="en-US">/ {
     split ($0,fld,"[<>]")
     title = fld[3]
-    # print "title = " title  > "/dev/stderr"
+    # print "title = " title > "/dev/stderr"
 }

 # Grab genre
@@ -87,7 +87,7 @@
 /<genre>/ {
     split ($0,fld,"[<>]")
     genre = fld[3]
-    # print "genre = " genre  > "/dev/stderr"
+    # print "genre = " genre > "/dev/stderr"
 }

 # Grab description
@@ -95,7 +95,7 @@
 /<description>/ {
     split ($0,fld,"[<>]")
     description = fld[3]
-    # print "description = " description  > "/dev/stderr"
+    # print "description = " description > "/dev/stderr"
 }

 # Grab rating
@@ -103,7 +103,7 @@
 /<rating systemCode=/ {
     split ($0,fld,"[<>]")
     rating = fld[3]
-    # print "rating = " rating  > "/dev/stderr"
+    # print "rating = " rating > "/dev/stderr"
 }

 # Grab type
@@ -111,7 +111,7 @@
 /<type>/ {
     split ($0,fld,"[<>]")
     showType = fld[3]
-    # print "showType = " showType  > "/dev/stderr"
+    # print "showType = " showType > "/dev/stderr"
 }

 # Grab duration
@@ -138,9 +138,9 @@
     sub (/original/,"",dateType)
     originalDate = fld[3]
     year = substr (originalDate,1,4)
-    # print "dateType = " dateType  > "/dev/stderr"
-    # print "originalDate = " originalDate  > "/dev/stderr"
-    # print "year = " year  > "/dev/stderr"
+    # print "dateType = " dateType > "/dev/stderr"
+    # print "originalDate = " originalDate > "/dev/stderr"
+    # print "year = " year > "/dev/stderr"
 }

 # Grab showContentId
@@ -148,7 +148,7 @@
 /<showContentId>/ {
     split ($0,fld,"[<>]")
     showContentId = fld[3]
-    # print "showContentId = " showContentId  > "/dev/stderr"
+    # print "showContentId = " showContentId > "/dev/stderr"
 }

 # Grab seasonContentId
@@ -156,7 +156,7 @@
 /<seasonContentId>/ {
     split ($0,fld,"[<>]")
     seasonContentId = fld[3]
-    # print "seasonContentId = " seasonContentId  > "/dev/stderr"
+    # print "seasonContentId = " seasonContentId > "/dev/stderr"
 }

 # Grab seasonNumber
@@ -164,7 +164,7 @@
 /<seasonNumber>/ {
     split ($0,fld,"[<>]")
     seasonNumber = fld[3]
-    # print "seasonNumber = " seasonNumber  > "/dev/stderr"
+    # print "seasonNumber = " seasonNumber > "/dev/stderr"
 }

 # Grab episodeNumber
@@ -172,7 +172,7 @@
 /<episodeNumber>/ {
     split ($0,fld,"[<>]")
     episodeNumber = fld[3]
-    # print "episodeNumber = " episodeNumber  > "/dev/stderr"
+    # print "episodeNumber = " episodeNumber > "/dev/stderr"
 }

 # Grab EntityId from artwork
@@ -181,7 +181,7 @@
     sub (/.*EntityId='/,"")
     sub (/&apos.*/,"")
     EntityId = "_" $0
-    # print "EntityId = " EntityId  > "/dev/stderr"
+    # print "EntityId = " EntityId > "/dev/stderr"
 }

 # Do any special end of item processing, then print raw data spreadsheet row
@@ -198,10 +198,10 @@
             printf ("==> Changed title '%s' to 'Porridge (2016-2017)'\n", title) >> ERROR_FILE
             title = "Porridge (2016-2017)"
         }
-        # print "==> title = " title  > "/dev/stderr"
-        # print "==> contentId = " contentId  > "/dev/stderr"
-        # print "==> EntityId = " EntityId  > "/dev/stderr"
-        # print "---"  > "/dev/stderr"
+        # print "==> title = " title > "/dev/stderr"
+        # print "==> contentId = " contentId > "/dev/stderr"
+        # print "==> EntityId = " EntityId > "/dev/stderr"
+        # print "---" > "/dev/stderr"
     }

     # "A Midsummer Night's Dream" needs to be revised to avoid duplicate names
@@ -215,8 +215,8 @@
             printf ("==> Changed title '%s' to 'A Midsummer Night\'s Dream (2016)'\n", title) >> ERROR_FILE
             title = "A Midsummer Night's Dream (2016)"
         }
-        # print "==> title = " title  > "/dev/stderr"
-        # print "==> EntityId = " EntityId  > "/dev/stderr"
+        # print "==> title = " title > "/dev/stderr"
+        # print "==> EntityId = " EntityId > "/dev/stderr"
     }

     # "Maigret" needs to be revised to clarify timeframe
@@ -230,73 +230,86 @@
             printf ("==> Changed title '%s' to 'Maigret (2016–2017)'\n", title) >> ERROR_FILE
             title = "Maigret (2016–2017)"
         }
-        # print "==> title = " title  > "/dev/stderr"
-        # print "==> originalDate = " originalDate  > "/dev/stderr"
-        # print "==> contentId = " contentId  > "/dev/stderr"
-        # print "==> EntityId = " EntityId  > "/dev/stderr"
-        # print "---"  > "/dev/stderr"
+        # print "==> title = " title > "/dev/stderr"
+        # print "==> originalDate = " originalDate > "/dev/stderr"
+        # print "==> contentId = " contentId > "/dev/stderr"
+        # print "==> EntityId = " EntityId > "/dev/stderr"
+        # print "---" > "/dev/stderr"
     }

     if (EntityId == "") {
         missingEntityIds += 1
-        printf ("==> Missing EntityId for %s %s '%s' in show %s\n", contentType, contentId, title, \
-                showContentId) >> ERROR_FILE
+        printf ("==> Missing EntityId for %s %s '%s' in show %s at line %d\n", contentType, contentId,
+                title, showContentId, firstLineNum) >> ERROR_FILE
         # Add missing EntityId
         if (contentId == "p07gnw9f") {
             EntityId = "_23842"
             printf ("==> Added EntityId %s for %s %s '%s' in show %s\n", EntityId, contentType, contentId,
                     title, showContentId) >> ERROR_FILE
-            # print "==> EntityId = " EntityId  > "/dev/stderr"
+            # print "==> EntityId = " EntityId > "/dev/stderr"
         }
     }

     if (contentType == "movie") {
+        countMovies += 1
+        # print "\ntv_movie" > "/dev/stderr"
         # Wish I didn't have to do this, but "movie" is too common to be in a key field
         contentType = "tv_movie"
         sortkey = sprintf ("%s (1) %s M%s", title, originalDate, EntityId)
-        # print "movie sortkey = " sortkey  > "/dev/stderr"
+        # print "sortkey = " sortkey > "/dev/stderr"
     }

     if (contentType == "tv_show") {
+        countShows += 1
         # print "\ntv_show" > "/dev/stderr"
-        numShows += 1
-        showArray[numShows] = contentId
-        titleArray[numShows] = title
+        showArray[countShows] = contentId
+        titleArray[countShows] = title
         sortkey = sprintf ("%s (1) S%s", title, EntityId)
         # print "sortkey = " sortkey > "/dev/stderr"
     }

     if (contentType == "tv_season") {
+        #xxx
+        countSeasons += 1
         # print "\ntv_season" > "/dev/stderr"
-        for ( i = 1; i <= numShows; i++ ) {
+        for ( i = 1; i <= countShows; i++ ) {
             if (showArray[i] == showContentId) {
                 showTitle = titleArray[i]
                 break
             }
         }
         sortkey = sprintf ("%s (2) S%02d", showTitle, seasonNumber)
-        # print "sortkey = " sortkey  > "/dev/stderr"
+        # Check that showContentId was actually found - if not, put parens around showTitle in sortkey
+        if (showArray[i] != showContentId) {
+            missingShowContentIds += 1
+            printf ("==> Missing showContentId for %s %s '%s' in show %s at line %d\n", contentType,
+                    contentId, title, showContentId, firstLineNum) >> ERROR_FILE
+            sortkey = sprintf ("(%s) (2) S%02d", showTitle, seasonNumber)
+        }
+        # print "sortkey = " sortkey > "/dev/stderr"
         # Compose title
     }

     if (contentType == "tv_episode") {
-        # xxx
+        countEpisodes += 1
         # print "\ntv_episode" > "/dev/stderr"
-        for ( i = 1; i <= numShows; i++ ) {
+        for ( i = 1; i <= countShows; i++ ) {
             if (showArray[i] == showContentId) {
                 showTitle = titleArray[i]
                 break
             }
         }
-        # Need to check that showContentId was actually found
+        sortkey = sprintf ("%s (2) S%02dE%03d %s", showTitle, seasonNumber, episodeNumber,
+                showContentId)
+        # Check that showContentId was actually found - if not, put parens around showTitle in sortkey
         if (showArray[i] != showContentId) {
             missingShowContentIds += 1
-            printf ("==> Missing showContentId for %s %s '%s' in show %s\n", contentType, contentId, title, \
-                showContentId) >> ERROR_FILE
-        }
-        sortkey = sprintf ("%s (2) S%02dE%03d %s", showTitle, seasonNumber, \
-                episodeNumber, showContentId)
-        # print "sortkey = " sortkey  > "/dev/stderr"
+            printf ("==> Missing showContentId for %s %s '%s' in show %s at line %d\n", contentType,
+                    contentId, title, showContentId, firstLineNum) >> ERROR_FILE
+            sortkey = sprintf ("(%s) (2) S%02dE%03d %s", showTitle, seasonNumber, episodeNumber,
+                    showContentId)
+        }
+        # print "sortkey = " sortkey > "/dev/stderr"
         # Compose title
     }

@@ -305,26 +318,35 @@
     # printf ("Content_Type\tContent_ID\tEntity_ID\tGenre\tShow_Type\tDate_Type\tOriginal_Date\t")
     # printf ("Show_ID\tSeason_ID\tSn_#\tEp_#\t1st_#\tLast_#\n")

-    printf ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%06d\t%06d\n", \
-            sortkey, title, numSeasons, numEpisodes, duration, year, rating, description, \
-            contentType, contentId, EntityId, genre, showType, dateType, originalDate, \
+    printf ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%06d\t%06d\n",
+            sortkey, title, numSeasons, numEpisodes, duration, year, rating, description,
+            contentType, contentId, EntityId, genre, showType, dateType, originalDate,
             showContentId, seasonContentId, seasonNumber, episodeNumber, firstLineNum, lastLineNum)
 }

 END {
     printf ("In getBBoxCatalogFrom-sitemap.awk\n") > "/dev/stderr"
+
     if (missingEntityIds > 0 ) {
-        missingEntityIds == 1 ? field = "EntityId" : field = "EntityIds"
-        printf ("    %2d missing %s in %s\n", missingEntityIds, field, FILENAME) > "/dev/stderr"
+        missingEntityIds == 1 ? plural = "EntityId" : plural = "EntityIds"
+        printf ("    %2d missing %s in %s\n", missingEntityIds, plural, FILENAME) > "/dev/stderr"
     }
     #
     if (missingShowContentIds > 0 ) {
-        missingShowContentIds == 1 ? field = "showContentId" : field = "showContentIds"
-        printf ("    %2d missing %s in %s\n", missingShowContentIds, field, FILENAME) > "/dev/stderr"
+        missingShowContentIds == 1 ? plural = "showContentId" : plural = "showContentIds"
+        printf ("    %2d missing %s in %s\n", missingShowContentIds, plural, FILENAME) > "/dev/stderr"
     }
     #
     if (revisedTitles > 0 ) {
-        revisedTitles == 1 ? field = "title" : field = "titles"
-        printf ("    %2d %s revised in %s\n", revisedTitles, field, FILENAME) > "/dev/stderr"
-    }
-}
+        revisedTitles == 1 ? plural = "title" : plural = "titles"
+        printf ("    %2d %s revised in %s\n", revisedTitles, plural, FILENAME) > "/dev/stderr"
+    }
+
+    countMovies == 1 ? pluralMovies = "movie" : pluralMovies = "movies"
+    countShows == 1 ? pluralShows = "show" : pluralShows = "shows"
+    countSeasons == 1 ? pluralSeasons = "season" : pluralSeasons = "seasons"
+    countEpisodes == 1 ? pluralEpisodes = "episode" : pluralEpisodes = "episodes"
+    #
+    printf ("\n    Processed %d %s, %d %s, %d %s, %d %s\n", countMovies, pluralMovies, countShows,
+            pluralShows, countSeasons, pluralSeasons, countEpisodes, pluralEpisodes) > "/dev/stderr"
+}


Change column names back to long version.

git-svn-id: 293778eaa97c8c94097d610b1bd5133a8f478f36@22341 4f837ed2-42f5-46e7-a7a5-fa17313484d4


Translate: make download_audio() support local files (fix for Bing TTS)

--- include/Translate.awk
+++ include/Translate.awk
@@ -149,11 +149,14 @@
     url = _TTSUrl(text, tl)

     if (Option["download-audio-as"])
-        curl(url, Option["download-audio-as"])
-    else {
+        output = Option["download-audio-as"]
+    else
         output = text " [" Option["engine"] "] (" Option["narrator"] ").ts"
+
+    if (url ~ /^\//)
+        system("mv -- " parameterize(url) " " parameterize(output))
+    else
         curl(url, output)
-    }
 }

 # Get the translation of a string.


Commons: header comment

Commons: header comment

--- include/Commons.awk
+++ include/Commons.awk
@@ -1,3 +1,8 @@
+####################################################################
+# Commons.awk                                                      #
+#                                                                  #
+# Commonly used functions for string and array operations, logging.#
+####################################################################

 # Initialize `UrlEncoding`.
 # See: <https://en.wikipedia.org/wiki/Percent-encoding>
@@ -223,7 +228,7 @@
     print AnsiCode["gray"] text AnsiCode[0] > "/dev/stderr"
 }

-# Debug an array.
+# Log an array.
 function da(array, formatString, sortedIn,
             ####
             i, j, saveSortedIn) {


INTEGRATION: CWS i18naddloc (1.3.2); FILE MERGED 2004/06/14 15:14:33 er 1.3.2.1: #i18069# entities may be indented, preceded by leading blanks

--- i18npool/source/localedata/data/currency-check.awk
+++ i18npool/source/localedata/data/currency-check.awk
@@ -74,7 +74,7 @@
                 bFormatAuto = 0
         }
     }
-    else if ( $0 ~ /^<FormatCode>.*\[\$.*-[0-9a-fA-F]+\]/ ||
+    else if ( $0 ~ /^[[:blank:]]*<FormatCode>.*\[\$.*-[0-9a-fA-F]+\]/ ||
             (sMatchReplace && $0 ~ sMatchReplace ) )
     {
         if ( sReplaceFrom )
@@ -147,7 +147,7 @@
         else
             bSymbolCompati = 0
     }
-    else if ( $0 ~ /^<CurrencySymbol>/ )
+    else if ( $0 ~ /^[[:blank:]]*<CurrencySymbol>/ )
     {
         split( $0, arr, /<|>/ )
         if ( sRefCurrencyFromLocale )


ahrf.awk: Implement <br> (not validated, will be done tomorrow)


minor

minor

--- lib/obs.awk
+++ lib/obs.awk
@@ -144,7 +144,10 @@
   while ((getline < "obsdata/data.csv") > 0)
 	{
 	  parseXML(++n,$0);
-	  if (XML[n,"tag"] == f["tag"]) XML[n, "match"] = 1; tagDataFound = 1;
+	  if (XML[n,"tag"] == f["tag"])
+		{
+		  XML[n, "match"] = 1; tagDataFound = 1;
+		}
 	}

   if ((f["tag"] != "") && (tagDataFound != 1))


MFC: Allow KMOD with hypens and dots.

MFC: Allow KMOD with hypens and dots.

--- sys/tools/fw_stub.awk
+++ sys/tools/fw_stub.awk
@@ -118,6 +118,8 @@

 cfilename = opt_c;
 ctmpfilename = cfilename ".tmp";
+modname = opt_m;
+gsub(/[-\.]/, "_", modname);

 printc("#include <sys/param.h>\
 #include <sys/errno.h>\
@@ -139,7 +141,7 @@
 }

 printc("\nstatic int\n"\
-opt_m "_fw_modevent(module_t mod, int type, void *unused)\
+modname "_fw_modevent(module_t mod, int type, void *unused)\
 {\
 	const struct firmware *fp, *parent;\
 	int error;\
@@ -206,14 +208,14 @@
 	return (EINVAL);\
 }\
 \
-static moduledata_t " opt_m "_fw_mod = {\
-        \"" opt_m "_fw\",\
-        " opt_m "_fw_modevent,\
+static moduledata_t " modname "_fw_mod = {\
+        \"" modname "_fw\",\
+        " modname "_fw_modevent,\
         0\
 };\
-DECLARE_MODULE(" opt_m "_fw, " opt_m "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
-MODULE_VERSION(" opt_m "_fw, 1);\
-MODULE_DEPEND(" opt_m "_fw, firmware, 1, 1, 1);\
+DECLARE_MODULE(" modname "_fw, " modname "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\
+MODULE_VERSION(" modname "_fw, 1);\
+MODULE_DEPEND(" modname "_fw, firmware, 1, 1, 1);\
 ");

 if (opt_c)


2014-06-21 20:39: parsegaspriceshtml.awk: Rearranged much code. Delete leading spaces.

--- parsegaspriceshtml.awk
+++ parsegaspriceshtml.awk
@@ -27,6 +27,7 @@
    sub("
[ ]*$","")
    sub("&","\\&")
    address[i,ai[i]]=$0
+   sub("^[ ]*","",address[i,ai[i]])
    # print "address["ai[i]"]="address[i,ai[i]]
    ai[i]++
 }
@@ -58,24 +59,13 @@

 inGasPriceRecord && /<a href="\/Profile[.]aspx[?]member=/ {
    sub("^.*<a href=\"/Profile[.]aspx[?]member=","")
-   sub("\".*$","")
-   reporter[i]=$0
-   # print
-}
-
-inGasPriceRecord && expectRelativeTime {
-   expectRelativeTime=False
-   sub("^[ ]*","")
-   sub("[ ]ago[ ]*$","")
-   timeAgo[i]=$0
-   # print
-}
-
-inGasPriceRecord && / ",",")
+   sub("<.*$","")
+   split($0,foo,",")
+   reporter[i]=foo[1]
+   time[i]=foo[2]
+   timeAgo[i]=foo[3]
    # print
 }


Languages: add getDisplay(code)

Languages: add getDisplay(code)

--- include/Languages.awk
+++ include/Languages.awk
@@ -1231,6 +1231,11 @@
 # Return the endonym of a language.
 function getEndonym(code) {
     return Locale[getCode(code)]["endonym"]
+}
+
+# Return the string for displaying the endonym of a language.
+function getDisplay(code) {
+    return Locale[getCode(code)]["display"]
 }

 # Return formatted text for "translations of".


Translate: postResponse()

Translate: postResponse()

--- include/Translate.awk
+++ include/Translate.awk
@@ -128,6 +128,46 @@
     return assert(content, "[ERROR] Null response.")
 }

+# Send an HTTP POST request and return response from an online translator.
+function postResponse(text, sl, tl, hl, type,
+                      ####
+                      content, contentLength, contentType, group,
+                      header, isBody, reqBody, url) {
+    url = _PostRequestUrl(text, sl, tl, hl, type)
+    contentType = _PostRequestContentType(text, sl, tl, hl, type)
+    reqBody = _PostRequestBody(text, sl, tl, hl, type)
+    if (DumpContentengths[reqBody])
+        contentLength = DumpContentengths[reqBody]
+    else
+        contentLength = DumpContentengths[reqBody] = dump(reqBody, group)
+
+    header = "POST " url " HTTP/1.1\r\n"                  \
+        "Host: " HttpHost "\r\n"                          \
+        "Connection: close\r\n"                           \
+        "Content-Length: " contentLength "\r\n"           \
+        "Content-Type: " contentType "\r\n"     # must!
+    if (Option["user-agent"])
+        header = header "User-Agent: " Option["user-agent"] "\r\n"
+    if (Cookie)
+        header = header "Cookie: " Cookie "\r\n"
+    if (HttpAuthUser && HttpAuthPass)
+        # TODO: digest auth
+        header = header "Proxy-Authorization: Basic " HttpAuthCredentials "\r\n"
+
+    content = NULLSTR; isBody = 0
+    print (header "\r\n" reqBody) |& HttpService
+    while ((HttpService |& getline) > 0) {
+        if (isBody)
+            content = content ? content "\r\n" $0 : $0
+        else if (length($0) <= 1)
+            isBody = 1
+        l(sprintf("%4s bytes > %s", length($0), $0))
+    }
+    close(HttpService)
+
+    return assert(content, "[ERROR] Null response.")
+}
+
 # Print a string (to output file or terminal pager).
 function p(string) {
     if (Option["view"])


don't hardcode array indexes and add a line that's in some files

--- utils/remove_license_block-helper.awk
+++ utils/remove_license_block-helper.awk
@@ -9,24 +9,25 @@
 	PRE_BLOCK = "(/\\* *|# *(/\\* *)?)?";
 	POST_BLOCK = " *(\\*/)?";

-	BLOCK[ 0] = PRE_BLOCK "\\*\\*\\*\\*\\* BEGIN LICENSE BLOCK \\*\\*\\*\\*\\*";
-	BLOCK[ 1] = X;
-	BLOCK[ 2] = X "BBN Address and AS Number PKI Database/repository software";
-	BLOCK[ 3] = X "Version [^ ]*";
-	BLOCK[ 4] = X;
-	BLOCK[ 5] = X "US government users are permitted unrestricted rights as";
-	BLOCK[ 6] = X "defined in the FAR.";
-	BLOCK[ 7] = X;
-	BLOCK[ 8] = X "This software is distributed on an \"AS IS\" basis, WITHOUT";
-	BLOCK[ 9] = X "WARRANTY OF ANY KIND, either express or implied.";
-	BLOCK[10] = X;
-	BLOCK[11] = X "Copyright .*";
-	BLOCK[12] = X;
-	BLOCK[13] = X "Contributor(\\(s\\)|s)?: .*";
-	BLOCK[14] = X;
-	BLOCK[15] = X "\\*\\*\\*\\*\\* END LICENSE BLOCK \\*\\*\\*\\*\\*" POST_BLOCK;
+	BLOCK_END = 0;

-	BLOCK_END = 15;
+	BLOCK[BLOCK_END++] = PRE_BLOCK "\\*\\*\\*\\*\\* BEGIN LICENSE BLOCK \\*\\*\\*\\*\\*";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "BBN Address and AS Number PKI Database/repository software";
+	BLOCK[BLOCK_END++] = X "Version [^ ]*";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "US government users are permitted unrestricted rights as";
+	BLOCK[BLOCK_END++] = X "defined in the FAR.";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "This software is distributed on an \"AS IS\" basis, WITHOUT";
+	BLOCK[BLOCK_END++] = X "WARRANTY OF ANY KIND, either express or implied.";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "Copyright .*";
+	BLOCK[BLOCK_END++] = X "All Rights Reserved.";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "Contributor(\\(s\\)|s)?: .*";
+	BLOCK[BLOCK_END++] = X;
+	BLOCK[BLOCK_END++] = X "\\*\\*\\*\\*\\* END LICENSE BLOCK \\*\\*\\*\\*\\*" POST_BLOCK;
 }

 {


Fix getMHzFromSitemap after site changed

44:15

Has been split into 6 lines.

--- getMHzFromSitemap.awk
+++ getMHzFromSitemap.awk
@@ -172,17 +172,28 @@
 }

 # Episode Duration(s)
+# Used to be on one line
 #
44:15

+#
+# Now it's on six
+#

+#      47:58
+#

 # Extract the duration
-/<div class="duration-container/ {
-    split ($0,fld,"[<>]")
-    episodeDuration = fld[3]
-    gsub (/ /,"",episodeDuration)
+/<div class="duration-container/,/<\/div>/ {
+    gsub (/ /,"")
+    if ($0 ~ /[[:digit:]]+:[[:digit:]]+/)
+        episodeDuration = $0
     # Spreadsheets decipher 2 part durations as time-of-day so make sure they're 3 parts
     if (split (episodeDuration, tm, ":") == 2)
         episodeDuration = "00:" episodeDuration
-    # print "==> episodeDuration = " episodeDuration > "/dev/stderr"
-    next
+    if ($0 ~ /<\/div>/) {
+        # print "==> episodeDuration = " episodeDuration > "/dev/stderr"
+        next
+    }
 }

 # Episode Title(s)


Languages: add Uyghur language

Languages: add Uyghur language

--- include/Languages.awk
+++ include/Languages.awk
@@ -366,6 +366,20 @@
     Locale["tt"]["iso"]                = "tat"
     Locale["tt"]["glotto"]             = "tata1255"
     Locale["tt"]["script"]             = "Cyrl"
+
+    #? Uyghur
+    Locale["ug"]["name"]               = "Uyghur"
+    Locale["ug"]["endonym"]            = "ئۇيغۇر تىلى"
+    #Locale["ug"]["translations-of"]
+    #Locale["ug"]["definitions-of"]
+    #Locale["ug"]["synonyms"]
+    #Locale["ug"]["examples"]
+    #Locale["ug"]["see-also"]
+    Locale["ug"]["family"]             = "Turkic"
+    Locale["ug"]["iso"]                = "uig"
+    Locale["ug"]["glotto"]             = "uigh1240"
+    Locale["ug"]["script"]             = "Arab"
+    Locale["ug"]["rtl"]                = "true" # RTL language

     #1 Afrikaans
     Locale["af"]["name"]               = "Afrikaans"


Languages: add Twi

Languages: add Twi

--- include/Languages.awk
+++ include/Languages.awk
@@ -1641,6 +1641,20 @@
     Locale["tk"]["iso"]                = "tuk"
     Locale["tk"]["glotto"]             = "turk1304"
     Locale["tk"]["script"]             = "Latn"
+
+    # Twi
+    Locale["tw"]["name"]               = "Twi"
+    Locale["tw"]["name2"]              = "Akan Kasa"
+    Locale["tw"]["endonym"]            = "Twi"
+    #Locale["tw"]["translations-of"]
+    #Locale["tw"]["definitions-of"]
+    #Locale["tw"]["synonyms"]
+    #Locale["tw"]["examples"]
+    #Locale["tw"]["see-also"]
+    Locale["tw"]["family"]             = "Atlantic-Congo"
+    Locale["tw"]["iso"]                = "twi"
+    Locale["tw"]["glotto"]             = "akua1239"
+    Locale["tw"]["script"]             = "Latn"

     #98 Ukrainian
     Locale["uk"]["name"]               = "Ukrainian"


Languages: show Wikipedia article in getDetails()

--- include/Languages.awk
+++ include/Languages.awk
@@ -1359,23 +1359,26 @@
 }

 # Return detailed information of a language as a string.
-function getDetails(code,    group, ws, iso) {
+function getDetails(code,    group, iso, language, script) {
     if (code == "auto" || !getCode(code))
         return prettify("languages", sprintf("%-22s%s\n", "Unknown code", ansi("bold", code)))

-    ws = scriptName(getScript(code))
-    if (isRTL(code)) ws = ws " (R-to-L)"
+    script = scriptName(getScript(code))
+    if (isRTL(code)) script = script " (R-to-L)"
     split(getISO(code), group, "-")
     iso = group[1]
+    split(getName(code), group, " ")
+    language = group[1]
     return sprintf("%s\n", prettify("translation", getDisplay(code)))   \
-        prettify("languages",                                           \
+        prettify("languages",
                  sprintf("%-22s%s\n", "Name", ansi("bold", getName(code))) \
                  sprintf("%-22s%s\n", "Family", ansi("bold", getFamily(code))) \
-                 sprintf("%-22s%s\n", "Writing system", ansi("bold", ws)) \
+                 sprintf("%-22s%s\n", "Writing system", ansi("bold", script)) \
                  sprintf("%-22s%s\n", "Code", ansi("bold", getCode(code))) \
                  sprintf("%-22s%s\n", "ISO 639-3", ansi("bold", iso))   \
                  sprintf("%-22s%s\n", "Ethnologue", ansi("bold", "http://www.ethnologue.com/language/" iso)) \
-                 sprintf("%-22s%s", "Glottolog", ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code))))
+                 sprintf("%-22s%s\n", "Glottolog", ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code))) \
+                 sprintf("%-22s%s", "Wikipedia", ansi("bold", "http://en.wikipedia.org/wiki/" language "_language")))
 }

 # Add /slashes/ for IPA phonemic notations and (parentheses) for others.


Languages: add Sepedi

Languages: add Sepedi

--- include/Languages.awk
+++ include/Languages.awk
@@ -1333,6 +1333,21 @@
     Locale["gd"]["glotto"]             = "scot1245"
     Locale["gd"]["script"]             = "Latn"

+    #80 Sepedi (Northern Sotho)
+    Locale["nso"]["name"]              = "Sepedi"
+    Locale["nso"]["name2"]             = "Pedi"
+    Locale["nso"]["name3"]             = "Northern Sotho"
+    Locale["nso"]["endonym"]           = "Sepedi"
+    #Locale["nso"]["translations-of"]
+    #Locale["nso"]["definitions-of"]
+    #Locale["nso"]["synonyms"]
+    #Locale["nso"]["examples"]
+    #Locale["nso"]["see-also"]
+    Locale["nso"]["family"]            = "Atlantic-Congo"
+    Locale["nso"]["iso"]               = "nso"
+    Locale["nso"]["glotto"]            = "nort3233"
+    Locale["nso"]["script"]            = "Latn"
+
     #79a Serbian, Cyrillic alphabet
     Locale["sr-Cyrl"]["name"]          = "Serbian (Cyrillic)"
     Locale["sr-Cyrl"]["endonym"]       = "српски"
@@ -1362,6 +1377,8 @@

     #80 Sesotho (Southern Sotho)
     Locale["st"]["name"]               = "Sesotho"
+    Locale["st"]["name2"]              = "Sotho"
+    Locale["st"]["name3"]              = "Southern Sotho"
     Locale["st"]["endonym"]            = "Sesotho"
     Locale["st"]["translations-of"]    = "Liphetolelo tsa %s"
     Locale["st"]["definitions-of"]     = "Meelelo ea %s"


Translate: fix auto dictionary mode

Translate: fix auto dictionary mode

--- include/Translate.awk
+++ include/Translate.awk
@@ -248,7 +248,9 @@

         if (!anything(oPhonetics)) wShowOriginalPhonetics = 0
         if (!anything(phonetics)) wShowTranslationPhonetics = 0
-        if (il == tl && (isarray(oWordClasses) || isarray(oSynonymClasses))) {
+        if (getCode(il) == getCode(tl) &&                               \
+            (isarray(oWordClasses) || isarray(oSynonymClasses) ||       \
+             isarray(oExamples) || isarray(oSeeAlso))) {
             wShowOriginalDictionary = 1
             wShowTranslation = 0
         }


build.awk: no quotes for RHS of =~ regexp matching (as of bash 3.2, fix #179)

--- build.awk
+++ build.awk
@@ -171,7 +171,7 @@
             print "#" > Trans
         }

-        print "if ! [[ $LANG =~ '[UTF|utf]-?8$' ]]; then export LANG=en_US.UTF-8; fi" > Trans
+        print "if [[ ! $LANG =~ (UTF|utf)-?8$ ]]; then export LANG=en_US.UTF-8; fi" > Trans

         print "read -r -d '' TRANS_PROGRAM << 'EOF'" > Trans
         print readSqueezed(EntryPoint, TRUE) > Trans


testsuite: remove non-portable awk idiom; remove overlong source lines in awk script

--- testsuite/makefiles/summarize.awk
+++ testsuite/makefiles/summarize.awk
@@ -24,6 +24,7 @@

 function record_pass() {
     check();
+    if (!(key in RESULTS)) ++nresults;
     RESULTS[key] = "p";
     delete SKIPPED[curdir];
     clear();
@@ -31,6 +32,7 @@

 function record_skip() {
     check();
+    if (!(key in RESULTS)) ++nresults;
     RESULTS[key] = "s";
     if (curdir in SKIPPED) SKIPPED[curdir] = 1;
     clear();
@@ -41,6 +43,7 @@
 function record_fail() {
     check();
     if (!(key in RESULTS) || RESULTS[key] == "s"){
+        if (!(key in RESULTS)) ++nresults;
         RESULTS[key] = "f";
     }
     delete SKIPPED[curdir];
@@ -49,6 +52,7 @@

 function record_unexp() {
     if (!(key in RESULTS) || RESULTS[key] == "s"){
+        if (!(key in RESULTS)) ++nresults;
         RESULTS[key] = "e";
     }
     delete SKIPPED[curdir];
@@ -151,13 +155,18 @@
             }
             printf("\n");
             printf("Summary:\n");
-            printf("  %3d test%s passed\n", passed, (passed == 1 ? "" : "s"));
-            printf("  %3d test%s skipped\n", skipped, (skipped == 1 ? "" : "s"));
-            printf("  %3d test%s failed\n", failed, (failed == 1 ? "" : "s"));
-            printf("  %3d unexpected error%s\n", unexped, (unexped == 1 ? "" : "s"));
-            printf("  %3d tests considered%s\n", length(RESULTS), (length(RESULTS) != passed + skipped + failed + unexped ? " (totals don't add up??)": ""));
+            printf("  %3d tests passed\n", passed);
+            printf("  %3d tests skipped\n", skipped);
+            printf("  %3d tests failed\n", failed);
+            printf("  %3d unexpected errors\n", unexped);
+            printf("  %3d tests considered", nresults);
+            if (nresults == passed + skipped + failed + unexped){
+                printf ("\n");
+            }else{
+                printf (" (totals don't add up??)");
+            }
             if (reran != 0){
-                printf("  %3d test dir re-run%s\n", reran, (reran == 1 ? "" : "s"));
+                printf("  %3d test dir re-runs\n", reran);
             }
             if (failed != 0){
                 printf("\nList of failed tests:\n");


msg_parser.awk: just generate list of extra headers

Allocate extended parser dynamically.

darcs-hash:20070919223945-65a35-675870ddebc0c986e0d5098f7fbb9b15530e8768.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -604,7 +604,9 @@
       print_parser_table(s, "", m, without_experimental, basic);
    }

-    /* Hash extra headers */
+   if (0) {
+
+   /* Hash extra headers */
    for (i = basic; i < total; i++) {
       n = headers[i];
       h = hashed[n];
@@ -629,8 +631,23 @@
       s = "_e_" module "_s";
       print_parser_table(s, "static", m, without_experimental, total);
     }
-
-    printf("msg_mclass_t const * %s_extended_mclass = %s;\n", module, m) > PT;
+
+    printf("msg_mclass_t const * %s_extended_mclass = %s;\n\n", module, m) > PT;
+
+    }
+
+    if (basic < total) {
+      printf("msg_hclass_t const * const %s_extensions[] = {\n", module) > PT;
+      for (i = basic; i < total; i++) {
+	if (i == without_experimental) {
+	  print "#if SU_HAVE_EXPERIMENTAL" > PT;
+        }
+	printf("  %s_%s_class,\n", module, headers[i]) > PT;
+      }
+      if (total != without_experimental)
+	print "#endif" > PT;
+      print "  NULL\n};\n\n" > PT;
+    }
   }

   exit success;


REPL: add command :engine

REPL: add command :engine

--- include/REPL.awk
+++ include/REPL.awk
@@ -138,6 +138,10 @@
     } else if (command ~ /^:show$/) {
         name = words[2]
         print prettify("welcome-submessage", toString(Option[name], 1, 0, 1))
+    } else if (command ~ /^:engine$/) {
+        value = words[2]
+        Option["engine"] = value
+        initHttpService()
     } else {
         match(command, /^[{(\[]?([[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?(:|=)((@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?\+)*(@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?)[})\]]?$/, group)
         if (RSTART) {


Languages: add Bhojpuri

Languages: add Bhojpuri

--- include/Languages.awk
+++ include/Languages.awk
@@ -171,6 +171,19 @@
     Locale["bn"]["iso"]                = "ben"
     Locale["bn"]["glotto"]             = "beng1280"
     Locale["bn"]["script"]             = "Beng"
+
+    # Bhojpuri
+    Locale["bho"]["name"]              = "Bhojpuri"
+    Locale["bho"]["endonym"]           = "भोजपुरी"
+    #Locale["bho"]["translations-of"]
+    #Locale["bho"]["definitions-of"]
+    #Locale["bho"]["synonyms"]
+    #Locale["bho"]["examples"]
+    #Locale["bho"]["see-also"]
+    Locale["bho"]["family"]            = "Indo-European"
+    Locale["bho"]["iso"]               = "bho"
+    Locale["bho"]["glotto"]            = "bhoj1246"
+    Locale["bho"]["script"]            = "Deva"

     #10 Bosnian, Latin alphabet
     Locale["bs"]["name"]               = "Bosnian"


Languages: improve getDetails()

Languages: improve getDetails()

--- include/Languages.awk
+++ include/Languages.awk
@@ -2279,6 +2279,11 @@
 # Return the family of a language.
 function getFamily(code) {
     return Locale[getCode(code)]["family"]
+}
+
+# Return the branch of a language.
+function getBranch(code) {
+    return Locale[getCode(code)]["branch"]
 }

 # Return the ISO 639-3 code of a language.
@@ -2355,8 +2360,49 @@
     }
 }

+# Return the regions that a language is spoken in, as an English string.
+function getSpokenIn(code,    i, j, r, regions, str) {
+    r = NULLSTR
+    str = Locale[getCode(code)]["spoken-in"]
+    if (str) {
+        split(str, regions, /\s?;\s?/)
+        j = 0
+        for (i in regions) {
+            r = r regions[i]
+            j++
+            if (j < length(regions) - 1)
+                r = r ", "
+            else if (j == length(regions) - 1)
+                r = r " and "
+        }
+    }
+    return r
+}
+
+# Return 1 if a language is supported by Google; otherwise return 0.
+function isSupportedByGoogle(code,    engines, i, str) {
+    str = Locale[getCode(code)]["supported-by"]
+    if (str) {
+        split(str, engines, /\s?;\s?/)
+        for (i in engines)
+            if (engines[i] == "google") return 1
+    }
+    return 0
+}
+
+# Return 1 if a language is supported by Bing; otherwise return 0.
+function isSupportedByBing(code,    engines, i, str) {
+    str = Locale[getCode(code)]["supported-by"]
+    if (str) {
+        split(str, engines, /\s?;\s?/)
+        for (i in engines)
+            if (engines[i] == "bing") return 1
+    }
+    return 0
+}
+
 # Return detailed information of a language as a string.
-function getDetails(code,    group, iso, script) {
+function getDetails(code,    article, desc, group, iso, script) {
     if (code == "auto" || !getCode(code)) {
         e("[ERROR] Language not found: " code "\n"                      \
           "        Run '-reference / -R' to see a list of available languages.")
@@ -2367,6 +2413,15 @@
     if (isRTL(code)) script = script " (R-to-L)"
     split(getISO(code), group, "-")
     iso = group[1]
+
+    if (getBranch(code)) {
+        article = match(tolower(getBranch(code)), /^[aeiou]/) ? "an" : "a"
+        desc = sprintf("%s is %s %s language spoken mainly in %s.",
+                       getNames(code), article, getBranch(code), getSpokenIn(code))
+    } else
+        desc = sprintf("%s is a language of the %s family, spoken mainly in %s.",
+                       getNames(code), getFamily(code), getSpokenIn(code))
+
     return ansi("bold", sprintf("%s\n", getDisplay(code)))              \
         sprintf("%-22s%s\n", "Name", ansi("bold", getNames(code)))      \
         sprintf("%-22s%s\n", "Family", ansi("bold", getFamily(code)))   \
@@ -2376,7 +2431,12 @@
         sprintf("%-22s%s\n", "SIL", ansi("bold", "https://iso639-3.sil.org/code/" iso)) \
         sprintf("%-22s%s\n", "Glottolog", getGlotto(code) ?
                 ansi("bold", "https://glottolog.org/resource/languoid/id/" getGlotto(code)) : "") \
-        sprintf("%-22s%s", "Wikipedia", ansi("bold", "https://en.wikipedia.org/wiki/ISO_639:" iso))
+        sprintf("%-22s%s\n", "Wikipedia", ansi("bold", "https://en.wikipedia.org/wiki/ISO_639:" iso)) \
+        (Locale[getCode(code)]["supported-by"] ? # FIXME
+        sprintf("%-22s%s\n", "Translator support", sprintf("Google [%s]    Bing [%s]",
+                isSupportedByGoogle(code) ? "✔" : "✘", isSupportedByBing(code) ? "✔" : "✘")) : "") \
+        (Locale[getCode(code)]["spoken-in"] ? # FIXME
+        ansi("bold", sprintf("\n%s", desc)) : "")
 }

 # Add /slashes/ for IPA phonemic notations and (parentheses) for others.


Removed whoami from msg/msg_parser.awk.

Removed whoami from msg/msg_parser.awk.

whoami is not used.

darcs-hash:20051031155729-65a35-5229485651f8ef3710c3e11b0f865291ba02c5fb.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -37,7 +37,6 @@

 BEGIN {
   "date '+%a %b %e %H:%M:%S %Y'" | getline date;
-  "whoami" | getline whoami;

   ascii =			       \
      "                               " \


Main: update default user-agent

Main: update default user-agent

--- include/Main.awk
+++ include/Main.awk
@@ -59,10 +59,11 @@
     # Networking
     Option["proxy"] = ENVIRON["HTTP_PROXY"] ? ENVIRON["HTTP_PROXY"] : ENVIRON["http_proxy"]
     Option["user-agent"] = ENVIRON["USER_AGENT"] ? ENVIRON["USER_AGENT"] :
-        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) "   \
+        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "         \
         "AppleWebKit/537.36 (KHTML, like Gecko) "            \
-        "Chrome/81.0.4044.138 "                              \
-        "Safari/537.36"
+        "Chrome/104.0.0.0 "                                  \
+        "Safari/537.36 "                                     \
+        "Edg/104.0.1293.54"
     Option["ip-version"] = 0

     # Interactive shell


added total traffic column

added total traffic column

--- src/condor_ckpt_server/xfer_log.awk
+++ src/condor_ckpt_server/xfer_log.awk
@@ -67,14 +67,15 @@
     qsort(Users, 0, num_users-1);
     printf("\nCheckpoint Server Transfer Log Data from %s %s to %s %s\n\n",
 	   StartDate, StartTime, EndDate, EndTime);
-    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s\n",
-	   "", "Send", "Send", "Receive", "Receive", "Total", "Total");
-    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s\n",
+    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s %9.9s\n",
+	   "", "Send", "Send", "Receive", "Receive", "Total", "Total",
+	   "Total");
+    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s %9.9s\n",
 	   "", "Bandwidth", "Success", "Bandwidth", "Success", "Bandwidth",
-	   "Success");
-    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s\n\n",
+	   "Success", "Traffic");
+    printf("%-16.16s %9.9s %7.7s %9.9s %7.7s %9.9s %7.7s %9.9s\n\n",
 	   "User/Host/Subnet", "(Mb/s)", "Rate", "(Mb/s)", "Rate", "(Mb/s)",
-	   "Rate");
+	   "Rate", "(MB)");
     for (i=0; i < num_users; i++) {
 	User = Users[i];
 	Bytes = BytesSent[User] + BytesRecvd[User];
@@ -82,14 +83,15 @@
 	Attempted = AttemptedSends[User] + AttemptedRecvs[User];
 	Completed = CompletedSends[User] + CompletedRecvs[User];
 	if (TimeSending[User] > 0 && TimeReceiving[User] > 0) {
-	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%%\n",
+	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%% %9.0f\n",
 		   User,
 		   BytesSent[User]*8/TimeSending[User]/1024/1024,
 		   CompletedSends[User]/AttemptedSends[User]*100,
 		   BytesRecvd[User]*8/TimeReceiving[User]/1024/1024,
 		   CompletedRecvs[User]/AttemptedRecvs[User]*100,
 		   Bytes*8/Time/1024/1024,
-		   Completed/Attempted*100);
+		   Completed/Attempted*100,
+		   (BytesSent[User]+BytesRecvd[User])/1024/1024);
 	}
     }
     printf("\n");
@@ -100,14 +102,15 @@
 	Attempted = AttemptedSends[Host] + AttemptedRecvs[Host];
 	Completed = CompletedSends[Host] + CompletedRecvs[Host];
 	if (TimeSending[Host] > 0 && TimeReceiving[Host] > 0) {
-	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%%\n",
+	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%% %9.0f\n",
 		   Host,
 		   BytesSent[Host]*8/TimeSending[Host]/1024/1024,
 		   CompletedSends[Host]/AttemptedSends[Host]*100,
 		   BytesRecvd[Host]*8/TimeReceiving[Host]/1024/1024,
 		   CompletedRecvs[Host]/AttemptedRecvs[Host]*100,
 		   Bytes*8/Time/1024/1024,
-		   Completed/Attempted*100);
+		   Completed/Attempted*100,
+		   (BytesSent[Host]+BytesRecvd[Host])/1024/1024);
 	}
 	TotalBytesSent += BytesSent[Host];
 	TotalBytesRecvd += BytesRecvd[Host];
@@ -126,14 +129,15 @@
 	Attempted = AttemptedSends[Subnet] + AttemptedRecvs[Subnet];
 	Completed = CompletedSends[Subnet] + CompletedRecvs[Subnet];
 	if (TimeSending[Subnet] > 0 && TimeReceiving[Subnet] > 0) {
-	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%%\n",
+	    printf("%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%% %9.0f\n",
 		   Subnet,
 		   BytesSent[Subnet]*8/TimeSending[Subnet]/1024/1024,
 		   CompletedSends[Subnet]/AttemptedSends[Subnet]*100,
 		   BytesRecvd[Subnet]*8/TimeReceiving[Subnet]/1024/1024,
 		   CompletedRecvs[Subnet]/AttemptedRecvs[Subnet]*100,
 		   Bytes*8/Time/1024/1024,
-		   Completed/Attempted*100);
+		   Completed/Attempted*100,
+		   (BytesSent[Subnet]+BytesRecvd[Subnet])/1024/1024);
 	}
     }
     TotalBytes = TotalBytesSent + TotalBytesRecvd;
@@ -141,14 +145,15 @@
     TotalAttempted = TotalAttemptedSends + TotalAttemptedRecvs;
     TotalCompleted = TotalCompletedSends + TotalCompletedRecvs;
     if (TotalTimeSending > 0 && TotalTimeReceiving > 0) {
-	printf("\n%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%%\n\n",
+	printf("\n%-16.16s %9.2f %6.0f%% %9.2f %6.0f%% %9.2f %6.0f%% %9.0f\n\n",
 	       "Overall",
 	       TotalBytesSent*8/TotalTimeSending/1024/1024,
 	       TotalCompletedSends/TotalAttemptedSends*100,
 	       TotalBytesRecvd*8/TotalTimeReceiving/1024/1024,
 	       TotalCompletedRecvs/TotalAttemptedRecvs*100,
 	       TotalBytes*8/TotalTime/1024/1024,
-	       TotalCompleted/TotalAttempted*100);
+	       TotalCompleted/TotalAttempted*100,
+	       (TotalBytesSent+TotalBytesRecvd)/1024/1024);
     }
     printf("\n%-16.16s %25.25s %25.25s\n\n", "User", "MB Sent", "MB Received");
     for (i=0; i < num_users; i++) {


Languages: remove links to Ethnologue due to its absurd paywall

--- include/Languages.awk
+++ include/Languages.awk
@@ -1920,7 +1920,7 @@
         sprintf("%-22s%s\n", "Writing system", ansi("bold", script))    \
         sprintf("%-22s%s\n", "Code", ansi("bold", getCode(code)))       \
         sprintf("%-22s%s\n", "ISO 639-3", ansi("bold", iso))            \
-        sprintf("%-22s%s\n", "Ethnologue", ansi("bold", "http://www.ethnologue.com/language/" iso)) \
+        sprintf("%-22s%s\n", "SIL", ansi("bold", "http://www-01.sil.org/iso639-3/documentation.asp?id=" iso)) \
         sprintf("%-22s%s\n", "Glottolog", getGlotto(code) ?
                 ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code)) : "") \
         sprintf("%-22s%s", "Wikipedia", ansi("bold", "http://en.wikipedia.org/wiki/" language))


reduce redundant namespace, keep vars local

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -33,7 +33,7 @@

 # this may need to be called more than once since
 # some identifiers may have embedded delimiters other uri use differently
-function stripid(uri){
+function stripid(uri,  delim, char, max, c, l){
 	# <_:blanknode> are not allowed in ntriples (but may happen anyway)
 	if(0 < match(uri, /^_:|^https:\/\/monarchinitiative.org\/.well-known\/genid\//))
 		return "BNODE"
@@ -66,9 +66,10 @@
 }

 # if possible, find a shorter form for the input
-function contract(uri){
+function contract(uri,  u){
 	u = uri
 	# shorten till longest uri in curi map is found (or not)
+
 	while(!(u in prefix) &&  length(u))
 		u = stripid(substr(u,1,length(u)-1))
 	if(u in prefix)
@@ -80,13 +81,24 @@
 }

 # get the final (incl fragment identifier) portion of a slashed path
-function final(uri){
+function final(uri,  b, p, anchor){
 	split(uri, b, "/")
 	p = b[length(b)]
 	anchor = match(p, "#")
 	if(anchor > 0)
 		p = substr(p, anchor+1)
 	return p
+}
+
+# fix curie namespace when redundant due to OBO  i.e RO:RO_123
+
+function deoboify(curie,  a){
+	split(curie, a , ":")
+	if(match(a[2], a[1]) > 0){
+		sub("_", ":", a[2]);
+		curie=a[2]
+	}
+	return curie
 }

 BEGIN{
@@ -226,7 +238,7 @@
 		edge=sortlist[i]
 		split(edge ,spo, SUBSEP);
 		print simplify(spo[1]) " -> " simplify(spo[3]) \
-		" [label=\"" spo[2] " (" edgelist[edge] ")\"];"
+		" [label=\"" deoboify(spo[2]) " (" edgelist[edge] ")\"];"
 	}
 	print "LITERAL [shape=record];"
 	print "labelloc=\"t\";"


Canonicalize headers

Canonicalize headers

--- getBritBoxEpisodesFrom-webscraper.awk
+++ getBritBoxEpisodesFrom-webscraper.awk
@@ -8,7 +8,7 @@

 BEGIN {
     FS="\t"
-    print "Sortkey\tTitle\t\tDuration\tYear(s)\tRating\tDescription"
+    print "Sortkey\tTitle\tSeasons\tDuration\tYear(s)\tRating\tDescription"
 }

 {


x86: Fix kprobes build with non-gawk awk

The instruction attribute table generator fails when run by mawk
or original-awk:

 $ mawk -f arch/x86/tools/gen-insn-attr-x86.awk \
	arch/x86/lib/x86-opcode-map.txt > /dev/null
 Semantic error at 240: Second IMM error
 $ echo $?
 1

Line 240 contains "c8: ENTER Iw,Ib", which indicates that this
instruction has two immediate operands, the second of which is
one byte.  The script loops through the immediate operands using
a for loop.

Unfortunately, there is no guarantee in awk that a for (variable
in array) loop will return the indices in increasing order.
Internally, both original-awk and mawk iterate over a hash table
for this purpose, and both implementations happen to produce the
index 2 before 1.  The supposed second immediate operand is more
than one byte wide, producing the error.

So loop over the indices in increasing order instead.  As a
side-effect, with mawk this means the silly two-entry hash table
never has to be built.

Signed-off-by: Jonathan Nieder <b57189c5f2fd5b3daf3350a77fde90def1080fa5@gmail.com>
Acked-by Masami Hiramatsu <mhiramat@redhat.com>
Cc: Jim Keniston <40777a9d59bdf69ed7abf1ca5dad3b4d30e1b574@us.ibm.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
LKML-Reference: <26cf0542126de8d37615a34e557bc03782ddd8d2@progeny.tock>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- arch/x86/tools/gen-insn-attr-x86.awk
+++ arch/x86/tools/gen-insn-attr-x86.awk
@@ -226,12 +226,12 @@
 }

 # convert operands to flags.
-function convert_operands(opnd,       i,imm,mod)
+function convert_operands(count,opnd,       i,j,imm,mod)
 {
 	imm = null
 	mod = null
-	for (i in opnd) {
-		i  = opnd[i]
+	for (j = 1; j <= count; j++) {
+		i = opnd[j]
 		if (match(i, imm_expr) == 1) {
 			if (!imm_flag[i])
 				semantic_error("Unknown imm opnd: " i)
@@ -282,8 +282,8 @@
 		# parse one opcode
 		if (match($i, opnd_expr)) {
 			opnd = $i
-			split($(i++), opnds, ",")
-			flags = convert_operands(opnds)
+			count = split($(i++), opnds, ",")
+			flags = convert_operands(count, opnds)
 		}
 		if (match($i, ext_expr))
 			ext = $(i++)


fix copyright headers

fix copyright headers

--- awk/colortbl.awk
+++ awk/colortbl.awk
@@ -1,7 +1,16 @@
-# Copyright (c) AT&T Corp. 1994, 1995.
-# This code is licensed by AT&T Corp.  For the
-# terms and conditions of the license, see
-# http://www.research.att.com/orgs/ssr/book/reuse
+#
+# /**********************************************************
+# *      This software is part of the graphviz package      *
+# *                http://www.graphviz.org/                 *
+# *                                                         *
+# *            Copyright (c) 1994-2005 AT&T Corp.           *
+# *                and is licensed under the                *
+# *            Common Public License, Version 1.0           *
+# *                      by AT&T Corp.                      *
+# *                                                         *
+# *        Information and Software Systems Research        *
+# *              AT&T Research, Florham Park NJ             *
+# **********************************************************/

 function rgb_to_hsb(r,g,b) {
 	r = r / 255.0; g = g / 255.0; b = b / 255.0;


build.awk: update release(), remove pages(), rename temp() to test()

--- build.awk
+++ build.awk
@@ -39,6 +39,10 @@
     ManHtml              = Man ".html"

     PagesPath            = "gh-pages/"
+    BadgeDownload        = PagesPath "images/badge-download"
+    BadgeRelease         = PagesPath "images/badge-release"
+    HomebrewFormula      = PagesPath "translate-shell.rb"
+    Index                = PagesPath "index.md"

     ReadmePath           = "./"
     ReadmeTemplate       = ReadmePath "README.template.md"
@@ -58,10 +62,6 @@
     if (fileExists(ManTemplate))
         system("pandoc -s -t html --toc --toc-depth 1 --template " ManTemplate " " ManSource " -o " ManHtml)
     return system("pandoc -s -t man " ManSource " -o " Man)
-}
-
-function pages() {
-    # TODO
 }

 function readme(    code, col, cols, content, group, i, j, language, r, rows, text) {
@@ -131,7 +131,6 @@

 function doc() {
     man()
-    pages()
     readme()
     wiki()
     return 0
@@ -235,15 +234,51 @@
 }

 function release() {
-    # TODO
+    ("sha1sum " Trans) | getline temp
+    split(temp, group)
+    sha1 = group[1]
+
+    d("Updating registry ...")
+    # Update registry
     text = readFrom(MainRegistryTemplate)
     gsub(/\$Version\$/, Version, text)
     writeTo(text, MainRegistry)

-    return 0
-}
-
-function temp() {
+    d("Updating gh-pages/images ...")
+    # Update gh-pages/images/badge-release
+    text = readFrom(BadgeRelease ".temp")
+    gsub(/\$Version\$/, Version, text)
+    writeTo(text, BadgeRelease)
+    system("save-to-png " BadgeRelease)
+    # Update gh-pages/images/badge-download
+    ("wc -c " Trans) | getline temp
+    split(temp, group)
+    size = int(group[1] / 1000)
+    text = readFrom(BadgeDownload ".temp")
+    gsub(/\$Size\$/, size, text)
+    writeTo(text, BadgeDownload)
+    system("save-to-png " BadgeDownload)
+
+    d("Updating gh-pages/translate-shell.rb ...")
+    # Update gh-pages/translate-shell.rb
+    text = readFrom(HomebrewFormula ".temp")
+    gsub(/\$sha1\$/, sha1, text)
+    gsub(/\$Version\$/, Version, text)
+    writeTo(text, HomebrewFormula)
+
+    d("Updating gh-pages/index.md ...")
+    # Update gh-pages/index.md
+    content = readFrom(Readme)
+    text = readFrom(Index ".temp")
+    gsub(/\$sha1\$/, sha1, text)
+    gsub(/\$Version\$/, Version, text)
+    gsub(/\$readme\$/, content, text)
+    writeTo(text, Index)
+
+    return 0
+}
+
+function test() {
     return 0
 }

@@ -286,10 +321,6 @@
             status = man()
             break

-        case "pages":
-            status = pages()
-            break
-
         case "readme":
             status = readme()
             break
@@ -314,8 +345,8 @@
             status = release()
             break

-        case "temp":
-            status = temp()
+        case "test":
+            status = test()
             break

         default: # unknown task


MONDRIAN: Check ordering of 'import' statements.

[git-p4: depot-paths = "//open/mondrian/": change = 14715]

--- bin/checkFile.awk
+++ bin/checkFile.awk
@@ -79,6 +79,11 @@
     return i;
 }

+function startsWith(s, p) {
+    return length(s) > length(p) \
+        && substr(s, 1, length(p)) == p;
+}
+
 BEGIN {
     # pre-compute regexp for quotes, linefeed
     apos = sprintf("%c", 39);
@@ -96,6 +101,8 @@
     isCpp = _isCpp(fname);
     isJava = _isJava(fname);
     mondrian = _isMondrian(fname);
+    prevImport = "";
+    prevImportGroup = "";
 }
 {
     if (previousLineEndedInCloseBrace > 0) {
@@ -186,6 +193,55 @@
     }
 }

+/^package / && previousLineWasEmpty {
+    error(fname, FNR, "'package' declaration must not occur after empty line");
+}
+/^import / {
+    if (previousLineWasEmpty) {
+        prevImport = "";
+    } else {
+        if (!prevImport) {
+            error(fname, FNR, "Expected blank line before first import");
+        }
+    }
+    thisImport = $2;
+    gsub(/;/, "", thisImport);
+    gsub(/\*/, "", thisImport);
+    if (thisImport ~ /^mondrian/) {
+        importGroup = "a";
+    } else if (thisImport ~ /^static/) {
+        importGroup = "z";
+    } else if (thisImport ~ /^java/) {
+        importGroup = "y";
+    } else if (thisImport ~ /^junit/) {
+        importGroup = "b";
+    } else if (thisImport ~ /^org.apache/) {
+        importGroup = "c";
+    } else if (thisImport ~ /^org.eigenbase/) {
+        importGroup = "d";
+    } else if (thisImport ~ /^org.olap4j/) {
+        importGroup = "e";
+    } else {
+        importGroup = "f";
+    }
+    if (importGroup != prevImportGroup \
+        && prevImportGroup)
+    {
+        if (!previousLineWasEmpty) {
+            error(fname, FNR, "Expected blank line between import groups");
+        } else if (prevImportGroup > importGroup) {
+            error(fname, FNR, "Import group out of sequence");
+        }
+    } else if (prevImport \
+        && prevImport > thisImport \
+        && !startsWith(prevImport, thisImport) \
+        && !startsWith(thisImport, prevImport))
+    {
+        error(fname, FNR, "Import out of sorted order");
+    }
+    prevImport = thisImport;
+    prevImportGroup = importGroup;
+}
 /^$/ {
     if (matchFile && previousLineEndedInOpenBrace) {
         error(fname, FNR, "Empty line following open brace");
@@ -521,10 +577,10 @@
     else if (s ~ /(\]\)?|=) *{/) {} # ignore e.g. "(int[]) {1, 2}" or "int[] x = {1, 2}"
     else if (s ~ /\({/) {} # ignore e.g. @SuppressWarnings({"unchecked"})
     else if (s ~ /{ *(\/\/|\/\*)/) {} # ignore e.g. "do { // a comment"
-    else if (s ~ / {}$/) {} # ignore e.g. "Constructor() {}"
+    else if (s ~ / \{\}$/) {} # ignore e.g. "Constructor() {}"
     else if (s ~ / },$/) {} # ignore e.g. "{ yada },"
     else if (s ~ / };$/) {} # ignore e.g. "{ yada };"
-    else if (s ~ / {};$/) {} # ignore e.g. "template <> class Foo<int> {};"
+    else if (s ~ / \{\};$/) {} # ignore e.g. "template <> class Foo<int> {};"
     else if (s ~ / },? *\/\/.*$/) {} # ignore e.g. "{ yada }, // comment"
     else if (s ~ /\\$/) {} # ignore multiline macros
     else if (s ~ /{}/) { # e.g. "Constructor(){}"


We don't need the tool anymore.

We don't need the tool anymore.

--- mocks.awk
+++ mocks.awk
@@ -1,74 +0,0 @@
-BEGIN {
-	# A record ends on )); so the first record will include the boilerplate
-	# at the beginning of the file.
-	# No field separator, we split the entire record by hand.
-	RS = "));"
-	ORS = ""
-}
-/MOCK_[A-Z_]*METHOD/ {
-	# Start by closing the previous record.  We don't do that at the end of
-	# individual records to properly handle the end of file.
-	if (FNR > 1) {
-	  print "));"
-	}
-
-	# The prefix is the text before the macro in the current record.
-	prefix = $0
-	gsub(/MOCK_[A-Z_]*METHOD.*/, "", prefix)
-	if (prefix != "") {
-	  print prefix
-	}
-
-	# Extract the macro and its arguments.
-	mock = $0
-	gsub(/.* +MOCK_/, "MOCK_", mock)
-	macro = mock
-	gsub(/\(.*/, "", macro)
-
-	# See if the macro is const.
-	if (macro ~ /CONST/) {
-	  spec = "const, override"
-	} else {
-	  spec = "override"
-	}
-
-	name = mock
-	gsub(/.*METHOD[0-9]+(_T)?\(/, "", name)
-	gsub(/,.*/, "", name)
-	gsub(/[ \n]/, "", name)
-
-	ret = mock
-	gsub(".*\\(.*" name ",", "", ret)
-	gsub("\\(.*", "", ret)
-	gsub(/\n/, "", ret)
-	gsub(/^ */, "", ret)
-	gsub(/ *$/, "", ret)
-
-	# The params are everything after the return type.
-	params = $0
-	# Cannot use gsub here because ret may contain the character *
-	retpos = index(params, ret "(")
-	params = substr(params, retpos + length(ret) + 1)
-	split(params, p, ",\n")
-	pparams = ""
-	for (i in p) {
-	  if (i > 1) {
-	    pparams = pparams ",\n"
-	  }
-	  if (p[i] ~ /<.+,.+>/) {
-	    pparams = pparams "(" p[i] ")"
-	  } else {
-	    pparams = pparams p[i]
-	  }
-	}
-	if (ret ~ /,/) {
-	  ret = "(" ret ")"
-	}
-	print "MOCK_METHOD(" ret ", " name ", (" pparams "), (" spec
-}
-!/MOCK_[A-Z_]*METHOD/{
-	if (FNR > 1) {
-	  print "));"
-	}
-	print $0
-}


Languages: update

Languages: update

--- include/Languages.awk
+++ include/Languages.awk
@@ -1769,6 +1769,7 @@

 # Return the name of script (writing system).
 # See: <https://en.wikipedia.org/wiki/ISO_15924#List_of_codes>
+#      <http://unicode.org/iso15924/iso15924-codes.html>
 function scriptName(code) {
     switch (code) {
     case "Arab": return "Arabic"


Languages: add Samoan language

Languages: add Samoan language

--- include/Languages.awk
+++ include/Languages.awk
@@ -275,6 +275,19 @@
     Locale["sd"]["glotto"]             = "sind1272"
     Locale["sd"]["script"]             = "Arab"
     Locale["sd"]["rtl"]                = "true" # RTL language
+
+    #? Samoan
+    Locale["sm"]["name"]               = "Samoan"
+    Locale["sm"]["endonym"]            = "Gagana Sāmoa"
+    #Locale["sm"]["translations-of"]
+    #Locale["sm"]["definitions-of"]
+    #Locale["sm"]["synonyms"]
+    #Locale["sm"]["examples"]
+    #Locale["sm"]["see-also"]
+    Locale["sm"]["family"]             = "Austronesian"
+    Locale["sm"]["iso"]                = "smo"
+    Locale["sm"]["glotto"]             = "samo1305"
+    Locale["sm"]["script"]             = "Latn"

     #1 Afrikaans
     Locale["af"]["name"]               = "Afrikaans"


2014-02-18: parsegaspriceshtml.awk Added substitution for Certified pictures.

--- parsegaspriceshtml.awk
+++ parsegaspriceshtml.awk
@@ -40,6 +40,7 @@
    gsub("","Duchess")
    gsub("","Thorntons")
    gsub("","Thorntons")
+   gsub("","Certified")
    expectName=False
    sub("[ ]*$","")
    sub("^.*>","")


msg_parser.awk: cast offsets within header structure as unsigned short

darcs-hash:20070301130856-55b16-501ba18adf43c56ae7395f6c693cb4bb1821d88b.gz

--- libsofia-sip-ua/msg/msg_parser.awk
+++ libsofia-sip-ua/msg/msg_parser.awk
@@ -432,6 +432,10 @@
     gsub(/#DATE#/, "@date Generated: " date, header);
     print header > PT;

+    print "" > PT;
+    print "#define msg_offsetof(s, f) ((unsigned short)offsetof(s ,f))" > PT;
+    print "" > PT;
+
     if (MC_SHORT_SIZE) {
       printf("static msg_href_t const " \
 	     "%s_short_forms[MC_SHORT_SIZE] = \n{\n",
@@ -443,7 +447,7 @@
 	  n = shorts[i];
         flags = header_flags[n]; if (flags) flags = ",\n      " flags;

-	  printf("  { /* %s */ %s_%s_class, offsetof(%s_t, %s_%s)%s }%s\n",
+	  printf("  { /* %s */ %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
 		 substr(lower_case, i, 1),
 		 tprefix, n, module, prefix, n, flags, c)	\
 	    > PT;
@@ -494,11 +498,11 @@
     len = split("request status separator payload unknown error", unnamed, " ");

     for (i = 1; i <= len; i++) {
-      printf("  {{ %s_%s_class, offsetof(%s_t, %s_%s) }},\n",
+      printf("  {{ %s_%s_class, msg_offsetof(%s_t, %s_%s) }},\n",
 	     tprefix, unnamed[i], module, prefix, unnamed[i]) > PT;
     }
     if (multipart) {
-      printf("  {{ %s_class, offsetof(%s_t, %s_multipart) }},\n",
+      printf("  {{ %s_class, msg_offsetof(%s_t, %s_multipart) }},\n",
 	     multipart, module, prefix) > PT;
     } else {
       printf("  {{ NULL, 0 }},\n") > PT;
@@ -549,11 +553,11 @@

 	if (Since[n]) {
 	  printf("    { %s_%s_class,\n" \
-		 "      offsetof(struct %s, extra[%u])%s }%s\n",
+		 "      msg_offsetof(struct %s, extra[%u])%s }%s\n",
 		 tprefix, n, extra_struct, Extra[n], flags, c) > PT;
 	}
 	else {
-	  printf("    { %s_%s_class, offsetof(%s_t, %s_%s)%s }%s\n",
+	  printf("    { %s_%s_class, msg_offsetof(%s_t, %s_%s)%s }%s\n",
 		 tprefix, n, module, prefix, n, flags, c) > PT;
 	}


Fix the make_authors.awk script to handle quotes in names.

--- kernel/arch/dreamcast/kernel/make_authors.awk
+++ kernel/arch/dreamcast/kernel/make_authors.awk
@@ -1,7 +1,7 @@
 # KallistiOS ##version##
 #
 # arch/dreamcast/kernel/make_authors.awk
-# Copyright (C) 2013 Lawrence Sebald
+# Copyright (C) 2013, 2014 Lawrence Sebald

 # This script processes the AUTHORS file in the root directory of the source
 # distribution to create the authors.h file that is needed in banner.c. This
@@ -28,6 +28,7 @@
         exit;
     }
     else if(phase == 2 && $0 != "") {
+        gsub(/"/, "\\\"", $1)
         print "\"Copyright (C)" $2, $1 "\\n\"";
     }
 }


load theme file

load theme file

--- include/Theme.awk
+++ include/Theme.awk
@@ -10,17 +10,31 @@
     return temp
 }

-function setTheme() {
-    # Default theme
-    Option["sgr-original"][1] = "bold"
-    Option["sgr-original"][2] = "negative"
-    Option["sgr-translation"][1] = "bold"
-    Option["sgr-prompt-message-original"][1] = "underline"
-    Option["sgr-original-dictionary-detailed-explanation"][1] = "bold"
-    Option["sgr-original-dictionary-examples-original"][1] = "bold"
-    Option["sgr-original-dictionary-examples-original"][2] = "negative"
-    Option["sgr-original-dictionary-see-also-item"][1] = "underline"
-    Option["sgr-dictionary-word"][1] = "bold"
-    Option["sgr-alternatives-original"][1] = "underline"
-    Option["sgr-alternatives-translation"][1] = "bold"
+function setTheme(    file, line, script) {
+    if (Option["theme"] && Option["theme"] != "default") {
+        file = Option["theme"]
+        if (!fileExists(file))
+            file = ENVIRON["HOME"] "/.translate-shell/" Option["theme"]
+    }
+
+    if (file && fileExists(file)) {
+        # Read from theme file
+        script = NULLSTR
+        while (getline line < file)
+            script = script "\n" line
+        loadOptions(script)
+    } else {
+        # Default theme
+        Option["sgr-original"][1] = "bold"
+        Option["sgr-original"][2] = "negative"
+        Option["sgr-translation"][1] = "bold"
+        Option["sgr-prompt-message-original"][1] = "underline"
+        Option["sgr-original-dictionary-detailed-explanation"][1] = "bold"
+        Option["sgr-original-dictionary-examples-original"][1] = "bold"
+        Option["sgr-original-dictionary-examples-original"][2] = "negative"
+        Option["sgr-original-dictionary-see-also-item"][1] = "underline"
+        Option["sgr-dictionary-word"][1] = "bold"
+        Option["sgr-alternatives-original"][1] = "underline"
+        Option["sgr-alternatives-translation"][1] = "bold"
+    }
 }


Translators/BingTranslator: fix for Kurdish

--- include/Translators/BingTranslator.awk
+++ include/Translators/BingTranslator.awk
@@ -227,6 +227,8 @@
     if (_sl == "auto")  _sl = "auto-detect"
     if (_sl == "tl")    _sl = "fil" # Bing uses 'fil' for Filipino
     if (_sl == "hmn")   _sl = "mww" # Bing uses 'mww' for Hmong Daw
+    if (_sl == "ku")    _sl = "kmr" # Bing uses 'kmr' for Northern Kurdish
+    else if (_sl == "ckb") _sl = "ku" # and 'ku' for Central Kurdish
     if (_sl == "no")    _sl = "nb"  # Bing uses Norwegian Bokmål
     # Bing uses 'pt' or 'pt-br' for Brazilian Portuguese, 'pt-pt' for European Portuguese
     if (_sl == "pt-BR") _sl = "pt" # just pt-br
@@ -235,6 +237,8 @@
     if (_sl == "zh-TW") _sl = "zh-Hant"
     if (_tl == "tl")    _tl = "fil"
     if (_tl == "hmn")   _tl = "mww"
+    if (_tl == "ku")    _tl = "kmr"
+    else if (_tl == "ckb") _tl = "ku"
     if (_tl == "no")    _tl = "nb"
     if (_tl == "pt-BR") _tl = "pt"
     else if (_tl == "pt-PT") _tl = "pt-pt"


Translate: add translate()

Translate: add translate()

--- lib/Translate.awk
+++ lib/Translate.awk
@@ -20,7 +20,7 @@
     if (!getCode(tl)) {
         # Check if target language is supported
         w("[WARNING] Unknown target language code: " tl)
-    } else if (rtl = Locale[getCode(tl)]["rtl"]) {
+    } else if (getCode(tl) != "auto" && rtl = Locale[getCode(tl)]["rtl"]) {
         # Check if target language is RTL
         if (!FriBidi)
             w("[WARNING] " Locale[getCode(tl)]["name"] " is a right-to-left language, but GNU FriBidi is not found on your system.\nText might be displayed incorrectly.")
@@ -162,3 +162,49 @@

     return r
 }
+
+# Translate the source text (into all target languages).
+function translate(text,
+                   ####
+                   i, j, playlist) {
+
+    if (!getCode(Option["hl"])) {
+        # Check if home language is supported
+        w("[WARNING] Unknown language code: " Option["hl"] ", fallback to English: en")
+        Option["hl"] = "en" # fallback to English
+    } else if (getCode(Option["hl"]) != "auto" && Locale[getCode(Option["hl"])]["rtl"]) {
+        # Check if home language is RTL
+        if (!FriBidi)
+            w("[WARNING] " Locale[getCode(Option["hl"])]["name"] " is a right-to-left language, but GNU FriBidi is not found on your system.\nText might be displayed incorrectly.")
+    }
+
+    if (!getCode(Option["sl"])) {
+        # Check if source language is supported
+        w("[WARNING] Unknown source language code: " Option["sl"])
+    } else if (getCode(Option["sl"]) != "auto" && Locale[getCode(Option["sl"])]["rtl"]) {
+        # Check if source language is RTL
+        if (!FriBidi)
+            w("[WARNING] " Locale[getCode(Option["sl"])]["name"] " is a right-to-left language, but GNU FriBidi is not found on your system.\nText might be displayed incorrectly.")
+    }
+
+    for (i in Option["tl"]) {
+        # Non-interactive verbose mode: separator between translations
+        if (!Option["interactive"]) {
+            # Separator for multiple targets
+            if (i > 1) {
+                for (j = 0; j < Option["width"]; j++) printf "─"
+                printf "\n"
+            }
+        }
+
+        print getTranslation(text, Option["sl"], Option["tl"][i], Option["hl"], Option["verbose"], Option["play"], playlist) > Option["output"]
+
+        if (Option["play"])
+            if (Option["player"])
+                for (j in playlist)
+                    play(playlist[j]["text"], playlist[j]["tl"])
+            else if (SpeechSynthesizer)
+                for (j in playlist)
+                    print playlist[j]["text"] | SpeechSynthesizer
+    }
+}


No longer generates zero bytes in the script's output file.

--- util/opt/pop_push.awk
+++ util/opt/pop_push.awk
@@ -15,14 +15,14 @@
 END	{ print "};"
 	  print
 	  print "char flow_tab[]= {"
-	  print "'\000',"
+	  print "'\\000',"
 	  for(i=0; i < NR-switch; i++) {
 		inf = col_2[i]
 		f_out = "/* " comment[i] " */ "
 		if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|"
 		if (substr(inf,2,1)=="c") f_out = f_out "CONDBRA"
 		else if (substr(inf,2,1)=="t") f_out = f_out "JUMP"
-		else f_out = f_out "'\000'"
+		else f_out = f_out "'\\000'"
 		print f_out","
 	  }
 	  print "};"


Change linkparser, repair header grabbing feature

--- linkparser/linkparser.awk
+++ linkparser/linkparser.awk
@@ -1,5 +1,5 @@
 BEGIN {
-	version = "0.1.3"
+	version = "0.2.0"
 	printf("link-parser, v%s\n", version)

 	true = 1
@@ -85,33 +85,47 @@
 	# Headers
 	# ---------

-#	gsub(/\.(obj|o|lib)$/, "", link)
-#	dep_file = link ".D"
-#
-#	if ((getline < dep_file) < 0)
-#		next
-#
-#	# Get path prefix
-#	cur_path = $1
-#	gsub(/^#/, "", cur_path)
-#
-#	while ((getline < dep_file) > 0) {
-#		gsub(/:/, " ")
-#		for (i = 1; i <= NF; i++) {
-#			if ($i !~ /\.(h|hpp)$/)
-#				continue
-#			header = cur_path "/" $i
-#
-#			rel_install(header, g_sroot, inst_root)
-#		}
-#	}
-#	close(dep_file)
+	gsub(/\.(obj|o|lib)$/, "", link)
+	dep_file = link ".D"
+
+	if ((getline < dep_file) < 0)
+		next
+
+	# Get path prefix
+	cur_path = $1
+	gsub(/^#/, "", cur_path)
+
+	while ((getline < dep_file) > 0) {
+		gsub(/.+:/, " ")
+		for (i = 1; i <= NF; i++) {
+			#if ($i !~ /\.(h|hpp)$/)
+			#	continue
+			if ($i == "\\") continue
+
+			header = cur_path "/" $i
+			if (!buildroot_host_path) {
+				patt = "(.+\\/esam\\/.+\\/output\\/host)\\/.+$"
+				if (header ~ patt) {
+					buildroot_host_path = gensub(patt, "\\1", "g", header)
+
+					patt = ".+\\/"g_sroot"\\/sw\\/vobs"
+					gsub(patt, inst_root"/sw/vobs", buildroot_host_path)
+				}
+			}
+
+			rel_install(header, g_sroot, inst_root)
+		}
+	}
+	close(dep_file)
 }

 END {
 	if (SKIP_END)
 		exit 0
 	print "Total dumped files: " count
+
+	if (buildroot_host_path && arg !~ /pretend/)
+		system("mv " buildroot_host_path " " inst_root)

 	if (arg ~ /tar/)
 		make_tarball(arg)
@@ -135,7 +149,7 @@
 	}

 	system("mkdir -p " new_root "/" rel_path)
-	system("cp -L " source " " new_root "/" rel_path)
+	system("cp -fL " source " " new_root "/" rel_path)
 }

 function make_tarball(flag) {


Changed chimeric blacklist to handle quadruple reads and eliminate MT exception

--- CPU/common/chimeric_blacklist.awk
+++ CPU/common/chimeric_blacklist.awk
@@ -86,9 +86,9 @@
   else {
     # deal with read pair group
     tottot++;
-    if (count==3) {
+    if (count==3 || count==4) {
       # chimeric read
-      for (j=1; j <= 3; j++) {
+      for (j=1; j <= count; j++) {
 	split(c[j], tmp);
 	split(tmp[1],readname,"/");
 	read[j] = readname[2];
@@ -147,63 +147,108 @@
 	    cigloc = substr(tmp[6],where,RLENGTH-1) + 0;
 	    pos[j] = pos[j] + cigloc;
           }
-	  # Mitochrondria loops around
-	  if (chr[j] ~ /MT/ && pos[j] >= 16569) {
-	    pos[j] = pos[j] - 16569;
-	  }
 	}
         # blacklist - if 3rd bit set (=4) it means unmapped
         mapped[j] = and(tmp[2],4) == 0;
       }
-
-      dist[12] = abs(chr[1]-chr[2])*10000000 + abs(pos[1]-pos[2]);
-      dist[23] = abs(chr[2]-chr[3])*10000000 + abs(pos[2]-pos[3]);
-      dist[13] = abs(chr[1]-chr[3])*10000000 + abs(pos[1]-pos[3]);
-
-      if (min(dist[12],min(dist[23],dist[13])) < 1000) {
-	# The paired ends look like A/B...B.  Make sure we take A and B.
-	if (read[1] == read[2]) {
-	  # take the unique one "B" for sure
+      if (count == 4) {
+        # looking for A/B...A/B
+	dist[12] = abs(chr[1]-chr[2])*10000000 + abs(pos[1]-pos[2]);
+	dist[13] = abs(chr[1]-chr[3])*10000000 + abs(pos[1]-pos[3]);
+	dist[14] = abs(chr[1]-chr[4])*10000000 + abs(pos[1]-pos[4]);
+	dist[23] = abs(chr[2]-chr[3])*10000000 + abs(pos[2]-pos[3]);
+	dist[24] = abs(chr[2]-chr[4])*10000000 + abs(pos[2]-pos[4]);
+	dist[34] = abs(chr[3]-chr[4])*10000000 + abs(pos[3]-pos[4]);
+
+	# A/B, A/B
+	if ((dist[13] < 1000 && dist[24] < 1000) || (dist[14] < 1000 && dist[23] < 1000)) {
+	  read1 = 1;
+	  read2 = 2;
+	}
+	else if ((dist[12] < 1000 && dist[34] < 1000)) {
+	  read1 = 1;
 	  read2 = 3;
-	  # take the end of "A/B" that isn't close to "B"
-	  read1 = dist[13] > dist[23] ? 1:2;
-	}
-	else if (read[1] == read[3]) {
-	  read2 = 2;
-	  read1 = dist[12] > dist[23] ? 1:3;
-	}
-	else if (read[2] == read[3]) {
-	  read2 = 1;
-	  read1 = dist[12] > dist[13] ? 2:3;
 	}
 	else {
-	  printf("reads strange\n") > "/dev/stderr"
-	  exit 1
-	}
+	  read1 = 0;
+	}
+	if (read1 != 0) {
+	  if (mapped[read1] && mapped[read2]) {
+	    count_norm++;
+	    if (less_than(str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2])) {
+	      #  print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2],qual[read1],qual[read2] > fname1;
+	      print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2] > fname1;
+	    }
+	    else {
+	      #  print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1],qual[read2],qual[read1] > fname1;
+	      print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1] > fname1;
+	    }
+	  }
+	  else {
+	    for (i in c) {
+	      print c[i] > fname3;
+	    }
+	    count_unmapped++;
+	  }
+	}
+	else {
+	  # chimeric read with the 4 ends > 1KB apart
+	  count_abnorm++;
+	  for (i in c) {
+	    print c[i] > fname2;
+	  }
+	}
+      }
+      else {
+	dist[12] = abs(chr[1]-chr[2])*10000000 + abs(pos[1]-pos[2]);
+	dist[23] = abs(chr[2]-chr[3])*10000000 + abs(pos[2]-pos[3]);
+	dist[13] = abs(chr[1]-chr[3])*10000000 + abs(pos[1]-pos[3]);

-	if (mapped[read1] && mapped[read2]) {
-	  count_norm++;
-	  if (less_than(str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2])) {
-	  #  print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2],qual[read1],qual[read2] > fname1;
-	    print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2] > fname1;
+	if (min(dist[12],min(dist[23],dist[13])) < 1000) {
+	  # The paired ends look like A/B...B.  Make sure we take A and B.
+	  if (read[1] == read[2]) {
+	    # take the unique one "B" for sure
+	    read2 = 3;
+	    # take the end of "A/B" that isn't close to "B"
+	    read1 = dist[13] > dist[23] ? 1:2;
+	  }
+	  else if (read[1] == read[3]) {
+	    read2 = 2;
+	    read1 = dist[12] > dist[23] ? 1:3;
+	  }
+	  else if (read[2] == read[3]) {
+	    read2 = 1;
+	    read1 = dist[12] > dist[13] ? 2:3;
 	  }
 	  else {
-	  #  print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1],qual[read2],qual[read1] > fname1;
-	    print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1] > fname1;
+	    printf("reads strange\n") > "/dev/stderr"
+	    exit 1
+	  }
+
+	  if (mapped[read1] && mapped[read2]) {
+	    count_norm++;
+	    if (less_than(str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2])) {
+	      #  print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2],qual[read1],qual[read2] > fname1;
+	      print str[read1],chr[read1],pos[read1],str[read2],chr[read2],pos[read2],m[read1],cigarstr[read1],seq[read1],m[read2],cigarstr[read2],seq[read2],name[read1],name[read2] > fname1;
+	    }
+	    else {
+	      #  print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1],qual[read2],qual[read1] > fname1;
+	      print str[read2],chr[read2],pos[read2],str[read1],chr[read1],pos[read1],m[read2],cigarstr[read2],seq[read2],m[read1],cigarstr[read1],seq[read1],name[read2],name[read1] > fname1;
+	    }
+	  }
+	  else {
+	    for (i in c) {
+	      print c[i] > fname3;
+	    }
+	    count_unmapped++;
 	  }
 	}
 	else {
+	  # chimeric read with the 3 ends > 1KB apart
+	  count_abnorm++;
 	  for (i in c) {
-	    print c[i] > fname3;
-	  }
-	  count_unmapped++;
-	}
-      }
-      else {
-	# chimeric read with the 3 ends > 1KB apart
-	count_abnorm++;
-	for (i in c) {
-	  print c[i] > fname2;
+	    print c[i] > fname2;
+	  }
 	}
       }
     }


LanguageData: add 4 Inuit languages

LanguageData: add 4 Inuit languages

--- include/LanguageData.awk
+++ include/LanguageData.awk
@@ -793,6 +793,22 @@
     Locale["el"]["spoken-in"]          = "Greece; Cyprus; southern Albania"
     Locale["el"]["supported-by"]       = "google; bing; yandex"

+    # Greenlandic (West Greenlandic)
+    Locale["kl"]["name"]               = "Greenlandic"
+    Locale["kl"]["endonym"]            = "Kalaallisut"
+    #Locale["kl"]["translations-of"]
+    #Locale["kl"]["definitions-of"]
+    #Locale["kl"]["synonyms"]
+    #Locale["kl"]["examples"]
+    #Locale["kl"]["see-also"]
+    Locale["kl"]["family"]             = "Eskimo-Aleut"
+    Locale["kl"]["branch"]             = "Inuit"
+    Locale["kl"]["iso"]                = "kal"
+    Locale["kl"]["glotto"]             = "kala1399"
+    Locale["kl"]["script"]             = "Latn"
+    Locale["kl"]["spoken-in"]          = "Greenland"
+    Locale["kl"]["supported-by"]       = ""
+
     # Guarani
     Locale["gn"]["name"]               = "Guarani"
     Locale["gn"]["endonym"]            = "Avañe'ẽ"
@@ -1046,6 +1062,54 @@
     Locale["ie"]["spoken-in"]          = "worldwide"
     Locale["ie"]["description"]        = "an international auxiliary language"
     Locale["ie"]["supported-by"]       = ""
+
+    # Inuinnaqtun
+    Locale["ikt"]["name"]              = "Inuinnaqtun"
+    Locale["ikt"]["endonym"]           = "Inuinnaqtun"
+    #Locale["ikt"]["translations-of"]
+    #Locale["ikt"]["definitions-of"]
+    #Locale["ikt"]["synonyms"]
+    #Locale["ikt"]["examples"]
+    #Locale["ikt"]["see-also"]
+    Locale["ikt"]["family"]            = "Eskimo-Aleut"
+    Locale["ikt"]["branch"]            = "Inuit"
+    Locale["ikt"]["iso"]               = "ikt"
+    Locale["ikt"]["glotto"]            = "copp1244"
+    Locale["ikt"]["script"]            = "Latn"
+    Locale["ikt"]["spoken-in"]         = "the Canadian Arctic"
+    Locale["ikt"]["supported-by"]      = "bing"
+
+    # Inuktitut
+    Locale["iu"]["name"]               = "Inuktitut"
+    Locale["iu"]["endonym"]            = "ᐃᓄᒃᑎᑐᑦ"
+    #Locale["iu"]["translations-of"]
+    #Locale["iu"]["definitions-of"]
+    #Locale["iu"]["synonyms"]
+    #Locale["iu"]["examples"]
+    #Locale["iu"]["see-also"]
+    Locale["iu"]["family"]             = "Eskimo-Aleut"
+    Locale["iu"]["branch"]             = "Inuit"
+    Locale["iu"]["iso"]                = "iku"
+    Locale["iu"]["glotto"]             = "east2534"
+    Locale["iu"]["script"]             = "Cans"
+    Locale["iu"]["spoken-in"]          = "the Canadian Arctic"
+    Locale["iu"]["supported-by"]       = "bing"
+
+    # Inuktitut, Latin alphabet
+    Locale["iu-Latn"]["name"]          = "Inuktitut (Latin)"
+    Locale["iu-Latn"]["endonym"]       = "Inuktitut"
+    #Locale["iu-Latn"]["translations-of"]
+    #Locale["iu-Latn"]["definitions-of"]
+    #Locale["iu-Latn"]["synonyms"]
+    #Locale["iu-Latn"]["examples"]
+    #Locale["iu-Latn"]["see-also"]
+    Locale["iu-Latn"]["family"]        = "Eskimo-Aleut"
+    Locale["iu-Latn"]["branch"]        = "Inuit"
+    Locale["iu-Latn"]["iso"]           = "iku"
+    Locale["iu-Latn"]["glotto"]        = "east2534"
+    Locale["iu-Latn"]["script"]        = "Latn"
+    Locale["iu-Latn"]["spoken-in"]     = "the Canadian Arctic"
+    Locale["iu-Latn"]["supported-by"]  = "bing"

     # Irish
     Locale["ga"]["name"]               = "Irish"


added whitespace to print out; conv:symbol aligns with interpretation.

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -143,7 +143,7 @@
    }
    comment_out = length(interpretAsNull) && length(conversionID) ? "" : "#"; # We want to put in the template so it is easy to uncomment.
                                     printf("      %sconversion:interpret [          \n",             comment_out);
-                                    printf("      %s   conversion:symbol \"%s\";\n",                 comment_out,interpretAsNull);
+                                    printf("      %s   conversion:symbol        \"%s\";\n",                 comment_out,interpretAsNull);
                                     printf("      %s   conversion:interpretation conversion:null; \n",comment_out);
                                     printf("      %s];                            \n",               comment_out);
    if(length(dataEnd)) {


Fixed the /** */ on a single line, again. This time in xtract.awk.


log filename in error

log filename in error

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -187,7 +187,7 @@

 # print anything else so it makes itself known
 (FNR != NR) && (done[NR]<1) && (NF>1){
-	printf("ERROR? line %i  %s", FNR, $0) > "/dev/stderr"
+	printf("ERROR? in %s at line %i  %s",FILENAME,FNR,$0) > "/dev/stderr"
 }

 # output dot file, include edge counts


Removing hardcoding of data

Removing hardcoding of data

--- etc/scripts/htxconf.awk
+++ etc/scripts/htxconf.awk
@@ -522,7 +522,6 @@
     cmd = "";
 	DIR = snarf("echo $HTX_HOME_DIR");

-    #Hxediag stanza enabled only on HTX ubuntu Release
 	ip=snarf("hostname -i");
 	split(ip, ip_array, " ");
 	for (cnt in ip_array) {
@@ -548,7 +547,7 @@
 				driver_name = snarf(command);
 				command = sprintf("cat %s/htx_diag.config 2> /dev/null | awk -F':' 'NR==%d {print $2}'", DIR, (count+1));
 				driver_desc=snarf(command);
-				cmd1=sprintf("ethtool -i %s | awk -F : ' {print $2}' \n", "enP3p3s0f1");
+				cmd1=sprintf("ethtool -i %s | awk -F : ' {print $2}' \n", intface);
 				driver=snarf(cmd1);

 				if(driver ~ driver_name) {


range printing for compound lines sorted out... still some kinks.

--- deshellswebshellsbytheseashore.awk
+++ deshellswebshellsbytheseashore.awk
@@ -7,9 +7,9 @@
     {print "======\n""Removed line 1, as it was all shellcode:",FILENAME,". See diff for changes.\n======" >> "/root/audit/run.log"}
 # print "bliggablau" > FILENAME".tmp"}
   #If line matches shell pattern, and is on the first line, modify the file in place, and log what was changed.
-  else if($0 ~ /<\?php if\(!isset\(\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]\)\).*\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]=1\; \} \?><\?php.*?>/ && NR == 1 )
-#&& NF >= 3)
-    {print "======\n""Removed shellcode from line 1:",FILENAME,". See diff for changes.\n======" >> "/root/audit/run.log"; print "<"$bound > FILENAME".tmp" }
+  else if($0 ~ /<\?php if\(!isset\(\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]\)\).*\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]=1\; \} \?><\?php.*?>/ && NR == 1 && NF >= 3)
+    {print "======\n""Removed shellcode from line 1:",FILENAME,". See diff for changes.\n======" >> "/root/audit/run.log";
+      for(i=bound; i<=NF; i++) printf("%s%s%s","<", $(i), i<NF ? OFS : "\n") > FILENAME".tmp" }
   #If line matches shell pattern, but is not on the first line, just log it.
   else if($0 ~ /<\?php if\(!isset\(\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]\)\).*\$GLOBALS\[\"\\x61\\156\\x75\\156\\x61\"\]=1\; \} \?><\?php.*?>/)
     { print "======\n""Found additional shellcode, logging only:",FILENAME,", line",NR".\n\nShellcode is:", $0"\n======" >> "/root/audit/run.log"; print $0> FILENAME".tmp"}


code_cracker: fix usage doc

code_cracker: fix usage doc

--- KataCodeCracker/code_cracker.awk
+++ KataCodeCracker/code_cracker.awk
@@ -2,7 +2,7 @@

 # Usage:
 #
-#  $ awk -f code_cracker.awk -v key=<decryption key> [-v debug=1 ] [<your file>]
+#  $ ./code_cracker.awk -v key=<decryption key> [<your file>]
 #
 # See http://codingdojo.org/kata/CodeCracker/. The key must be 26-chars long.


[rnc2rng.awk] Fixing more awk --lint warnings

--- rng/mallard/rnc2rng.awk
+++ rng/mallard/rnc2rng.awk
@@ -154,7 +154,7 @@
     aft = substr(line, 8);
     sub(/^ */, "", aft);
     name = aft;
-    stack[++stack_i] = "<element"
+    stack[++stack_i] = "<element";
     mode = "name_class";
     name_class_i = stack_i;
     parse_name_class(name);
@@ -163,7 +163,7 @@
     aft = substr(line, 10);
     sub(/^ */, "", aft);
     name = aft;
-    stack[++stack_i] = "<attribute"
+    stack[++stack_i] = "<attribute";
     mode = "name_class";
     name_class_i = stack_i;
     parse_name_class(name);
@@ -225,6 +225,7 @@

 function parse_name_class (line) {
   sub(/^ */, "", line)
+  if (length(line) == 0) return;
   c = substr(line, 1, 1);
   if (c == "{") {
     if (stack_i != name_class_i) {
@@ -297,15 +298,21 @@
   else if (match(line, /^[A-Za-z_]/)) {
     name = substr(line, 1);
     sub(/[^A-Za-z_]+.*/, "", name);
-    aft = substr(line, length(name) + 1);
-    if (substr(aft, 1, 2) == ":*") {
+    if (length(line) >= length(name) + 1)
+      aft = substr(line, length(name) + 1);
+    else
+      aft = "";
+    if (length(aft) >= 2 && substr(aft, 1, 2) == ":*") {
       for (i = 1; i <= namespaces_i; i++) {
         if (nsnames[i] == name) {
           stack[++stack_i] = sprintf("<nsName ns='%s'/>", namespaces[i])
           break;
         }
       }
-      aft = substr(aft, 3);
+      if (length(aft) >= 3)
+        aft = substr(aft, 3);
+      else
+        aft = "";
     }
     else if (stack[stack_i] == "<element" || stack[stack_i] == "<attribute") {
       stack[stack_i] = stack[stack_i] sprintf(" name='%s'>", name);


typo & comment

typo & comment

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -1,4 +1,4 @@
-#! /usr/bin/gawk -f
+ #! /usr/bin/gawk -f

 #  Reduce the subject and object of RDF triples (ntriples format)
 #  down to their @prefix (or literal object class)
@@ -93,7 +93,7 @@
 	# exceptions
 	prefix["BNODE"]="BNODE"  # is a fixed point
 	prefix["https://monarchinitiative.org/.well-known/genid"]="BNODE"
-	prefid["https_archive_monarchinitiative_org_"]="MonarchArchive"
+	prefix["https_archive_monarchinitiative_org_"]="MonarchArchive"
 	############################################################
 	# Often re-visit whether these exceptions are still necessary
 	# they may have been moved into the curie prefix mapping file
@@ -114,7 +114,7 @@

 	# in GWAScatalog
 	prefix["http://www.ncbi.nlm.nih.gov/SNP/"]="dbSNP"
-	# note in curie_map WormBase is
+	# note in curie_map dbSNP is
 	# 'http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs='

 	# Ensembl  transient


correct kegg-img base-uri & reframe how the last token is found

--- scripts/ntriple2dot.awk
+++ scripts/ntriple2dot.awk
@@ -44,13 +44,19 @@
         # print str
         finish = length(str) - start + 1
     }
-
     return substr(str, start, finish)
 }

 # remove final token from token path delimited with SUBSEP
-function detail(key) {
-    return substr(key, 1, match(key, SUBSEP "[[:alnum:].]+$")-1)
+# this ends up matching chars included in local identifiers
+# ._-;():%#,?=@*\&+   (yea ... nope)
+
+function detail(key,   start) {
+    start = match(key, ".+" SUBSEP)
+    if(start == 1)
+        return substr(key, 1, RLENGTH -1)
+    else
+        return key
 }

 # for output, keep underscore, letters & numbers
@@ -105,7 +111,7 @@
     split(curie, a , ":")
     if(match(a[2], a[1]"_") > 0){
         sub("_", ":", a[2]);
-        curie=a[2]
+        curie = a[2]
     }
     return curie
 }
@@ -144,7 +150,7 @@
     prefix[tokenize("http://www.ncbi.nlm.nih.gov/genome/")]="NCBIGenome"
     prefix[tokenize("http://www.ncbi.nlm.nih.gov/assembly?term=")]="NCBIAssembly"
     # kegg
-    prefix[tokenize("http://www.genome.jp/kegg/pathway/map/map")]="KEGG-img"
+    prefix[tokenize("http://www.genome.jp/kegg/pathway/map/")]="KEGG-img"
     # in EOM
     prefix[tokenize("https://elementsofmorphology.nih.gov/images/terms/")]="EOM_IMG"
     prefix[tokenize("http://elementsofmorphology.nih.gov/index.cgi?tid=")]="EOM"  # w/o httpS


minor correction

minor correction

--- far/scripts/mkdep.awk
+++ far/scripts/mkdep.awk
@@ -41,7 +41,7 @@
   {
     if(substr(lnsrc,1,length("#include \"")) == "#include \"")
     {
-      lnsrc=gensub(/^#include[ \t]?\"([^\"]+)\"/, "\\1", "g", lnsrc);
+      lnsrc=gensub(/^#include[ \t]*\"([^\"]+)\".*$/, "\\1", "g", lnsrc);
       if(lnsrc != "" && lnsrc != $0)
         print " " lnsrc;
     }


show start and end

show start and end

--- transform_comments.awk
+++ transform_comments.awk
@@ -4,11 +4,13 @@

 /^;>>>/ {
     show = 0
+    print $0
     next
 }

 /^;<<</ {
     show = 1
+    print $0
     next
 }


bundle example in template maker

bundle example in template maker

--- bin/util/header2params2.awk
+++ bin/util/header2params2.awk
@@ -100,10 +100,12 @@
    }

    if( length(conversionID)) {
-                                    printf(":a_bundle\n");
-                                    printf("   conversion:property_name \"a_property\"; # Can also be a URI, e.g. dcterms:title.\n");
-                                    printf("   conversion:type_name     \"My Class\";   # Can also be a URI, e.g. foaf:Person.\n");
-                                    printf(".");
+                                    printf("\n");
+                                    printf("#:a_bundle\n");
+                                    printf("#   a conversion:ImplicitBundle;\n");
+                                    printf("#   conversion:property_name \"a_property\"; # Can also be a URI, e.g. dcterms:title.\n");
+                                    printf("#   conversion:type_name     \"My Class\";   # Can also be a URI, e.g. foaf:Person.\n");
+                                    printf("#.\n");
    }
    #
    # Describe the dataset.


some common declarations have extra spaces

--- verification/OpenAD/code_ad/cb2m1.awk
+++ verification/OpenAD/code_ad/cb2m1.awk
@@ -1,11 +1,7 @@
-BEGIN { incommon = 0; fstart = 0}
-{if ( fstart == 0 ) { fstart=1 }   }
-/^      .*/ {incommon = 0 }
-/^[^ ]/ {incommon = 0 }
-/^      COMMON/ || /^      common/ { incommon = 1 }
-/      &/ { if (incommon != 1) {print} }
-{if (incommon ==0 ) print}
-END {
-}
-
-
+BEGIN { commonDecl = 0}
+/^      .*/ {commonDecl = 0 }
+/^[^ ]/ {commonDecl = 0 }
+/^       *COMMON/ || /^       *common/ { commonDecl = 1 }
+/      &/ { if (commonDecl != 1) {print} }
+{if (commonDecl ==0 ) print }
+END {}


Languages: for newly supported languages, add an unstable field

--- include/Languages.awk
+++ include/Languages.awk
@@ -15,6 +15,7 @@
 function initLocale(    i) {

     #? Amharic
+    Locale["am"]["support"]            = "unstable"
     Locale["am"]["name"]               = "Amharic"
     Locale["am"]["endonym"]            = "አማርኛ"
     #Locale["am"]["translations-of"]
@@ -28,6 +29,7 @@
     Locale["am"]["script"]             = "Ethi"

     #? Assamese
+    Locale["as"]["support"]            = "unstable"
     Locale["as"]["name"]               = "Assamese"
     Locale["as"]["endonym"]            = "অসমীয়া"
     #Locale["as"]["translations-of"]
@@ -41,6 +43,7 @@
     Locale["as"]["script"]             = "Beng"

     #? Bashkir
+    Locale["ba"]["support"]            = "unstable"
     Locale["ba"]["name"]               = "Bashkir"
     Locale["ba"]["endonym"]            = "башҡорт теле"
     #Locale["ba"]["translations-of"]
@@ -54,6 +57,7 @@
     Locale["ba"]["script"]             = "Cyrl"

     #? Breton
+    Locale["br"]["support"]            = "unstable"
     Locale["br"]["name"]               = "Breton"
     Locale["br"]["endonym"]            = "Brezhoneg"
     #Locale["br"]["translations-of"]
@@ -67,6 +71,7 @@
     Locale["br"]["script"]             = "Latn"

     #? Corsican
+    Locale["co"]["support"]            = "unstable"
     Locale["co"]["name"]               = "Corsican"
     Locale["co"]["endonym"]            = "Corsu"
     #Locale["co"]["translations-of"]
@@ -80,6 +85,7 @@
     Locale["co"]["script"]             = "Latn"

     #? Dzongkha
+    Locale["dz"]["support"]            = "unstable"
     Locale["dz"]["name"]               = "Dzongkha"
     Locale["dz"]["endonym"]            = "རྫོང་ཁ"
     #Locale["dz"]["translations-of"]
@@ -93,6 +99,7 @@
     Locale["dz"]["script"]             = "Tibt"

     #? Faroese
+    Locale["fo"]["support"]            = "unstable"
     Locale["fo"]["name"]               = "Faroese"
     Locale["fo"]["endonym"]            = "Føroyskt"
     #Locale["fo"]["translations-of"]
@@ -106,6 +113,7 @@
     Locale["fo"]["script"]             = "Latn"

     #? Fijian
+    Locale["fj"]["support"]            = "unstable"
     Locale["fj"]["name"]               = "Fijian"
     Locale["fj"]["endonym"]            = "Vosa Vakaviti"
     #Locale["fj"]["translations-of"]
@@ -119,6 +127,7 @@
     Locale["fj"]["script"]             = "Latn"

     #? Guarani
+    Locale["gn"]["support"]            = "unstable"
     Locale["gn"]["name"]               = "Guarani"
     Locale["gn"]["endonym"]            = "Avañe'ẽ"
     #Locale["gn"]["translations-of"]
@@ -132,6 +141,7 @@
     Locale["gn"]["script"]             = "Latn"

     #? Interlingue
+    Locale["ie"]["support"]            = "unstable"
     Locale["ie"]["name"]               = "Interlingue"
     Locale["ie"]["endonym"]            = "Interlingue"
     #Locale["ie"]["translations-of"]
@@ -145,6 +155,7 @@
     Locale["ie"]["script"]             = "Latn"

     #? Kinyarwanda
+    Locale["rw"]["support"]            = "unstable"
     Locale["rw"]["name"]               = "Kinyarwanda"
     Locale["rw"]["endonym"]            = "Ikinyarwanda"
     #Locale["rw"]["translations-of"]
@@ -158,6 +169,7 @@
     Locale["rw"]["script"]             = "Latn"

     #? Kyrgyz
+    Locale["ky"]["support"]            = "unstable"
     Locale["ky"]["name"]               = "Kyrgyz"
     Locale["ky"]["endonym"]            = "Кыргызча"
     #Locale["ky"]["translations-of"]
@@ -171,6 +183,7 @@
     Locale["ky"]["script"]             = "Cyrl"

     #? Kurdish (Central Kurdish, Sorani), Latin alphabet
+    Locale["ku"]["support"]            = "unstable"
     Locale["ku"]["name"]               = "Kurdish"
     Locale["ku"]["endonym"]            = "Kurdî"
     #Locale["ku"]["translations-of"]
@@ -184,6 +197,7 @@
     Locale["ku"]["script"]             = "Latn"

     #? Luxembourgish
+    Locale["lb"]["support"]            = "unstable"
     Locale["lb"]["name"]               = "Luxembourgish"
     Locale["lb"]["endonym"]            = "Lëtzebuergesch"
     #Locale["lb"]["translations-of"]
@@ -197,6 +211,7 @@
     Locale["lb"]["script"]             = "Latn"

     #? Occitan
+    Locale["oc"]["support"]            = "unstable"
     Locale["oc"]["name"]               = "Occitan"
     Locale["oc"]["endonym"]            = "Occitan"
     #Locale["oc"]["translations-of"]
@@ -210,6 +225,7 @@
     Locale["oc"]["script"]             = "Latn"

     #? Oromo
+    Locale["om"]["support"]            = "unstable"
     Locale["om"]["name"]               = "Oromo"
     Locale["om"]["endonym"]            = "Afaan Oromoo"
     #Locale["om"]["translations-of"]
@@ -223,6 +239,7 @@
     Locale["om"]["script"]             = "Latn"

     #? Oriya
+    Locale["or"]["support"]            = "unstable"
     Locale["or"]["name"]               = "Oriya"
     Locale["or"]["endonym"]            = "ଓଡ଼ିଆ"
     #Locale["or"]["translations-of"]
@@ -236,6 +253,7 @@
     Locale["or"]["script"]             = "Orya"

     #? Pashto
+    Locale["ps"]["support"]            = "unstable"
     Locale["ps"]["name"]               = "Pashto"
     Locale["ps"]["endonym"]            = "پښتو"
     #Locale["ps"]["translations-of"]
@@ -250,6 +268,7 @@
     Locale["ps"]["rtl"]                = "true" # RTL language

     #? Romansh
+    Locale["rm"]["support"]            = "unstable"
     Locale["rm"]["name"]               = "Romansh"
     Locale["rm"]["endonym"]            = "Rumantsch"
     #Locale["rm"]["translations-of"]
@@ -263,6 +282,7 @@
     Locale["rm"]["script"]             = "Latn"

     #? Sindhi
+    Locale["sd"]["support"]            = "unstable"
     Locale["sd"]["name"]               = "Sindhi"
     Locale["sd"]["endonym"]            = "سنڌي"
     #Locale["sd"]["translations-of"]
@@ -277,6 +297,7 @@
     Locale["sd"]["rtl"]                = "true" # RTL language

     #? Samoan
+    Locale["sm"]["support"]            = "unstable"
     Locale["sm"]["name"]               = "Samoan"
     Locale["sm"]["endonym"]            = "Gagana Sāmoa"
     #Locale["sm"]["translations-of"]
@@ -290,6 +311,7 @@
     Locale["sm"]["script"]             = "Latn"

     #? Scottish Gaelic
+    Locale["gd"]["support"]            = "unstable"
     Locale["gd"]["name"]               = "Scottish Gaelic"
     Locale["gd"]["endonym"]            = "Gàidhlig"
     #Locale["gd"]["translations-of"]
@@ -303,6 +325,7 @@
     Locale["gd"]["script"]             = "Latn"

     #? Shona
+    Locale["sn"]["support"]            = "unstable"
     Locale["sn"]["name"]               = "Shona"
     Locale["sn"]["endonym"]            = "chiShona"
     #Locale["sn"]["translations-of"]
@@ -316,6 +339,7 @@
     Locale["sn"]["script"]             = "Latn"

     #? Tigrinya
+    Locale["ti"]["support"]            = "unstable"
     Locale["ti"]["name"]               = "Tigrinya"
     Locale["ti"]["endonym"]            = "ትግርኛ"
     #Locale["ti"]["translations-of"]
@@ -329,6 +353,7 @@
     Locale["ti"]["script"]             = "Ethi"

     #? Tibetan (Standard Tibetan)
+    Locale["bo"]["support"]            = "unstable"
     Locale["bo"]["name"]               = "Tibetan"
     Locale["bo"]["endonym"]            = "བོད་ཡིག"
     #Locale["bo"]["translations-of"]
@@ -342,6 +367,7 @@
     Locale["bo"]["script"]             = "Tibt"

     #? Turkmen
+    Locale["tk"]["support"]            = "unstable"
     Locale["tk"]["name"]               = "Turkmen"
     Locale["tk"]["endonym"]            = "Türkmen"
     #Locale["tk"]["translations-of"]
@@ -355,6 +381,7 @@
     Locale["tk"]["script"]             = "Latn"

     #? Tatar
+    Locale["tt"]["support"]            = "unstable"
     Locale["tt"]["name"]               = "Tatar"
     Locale["tt"]["endonym"]            = "татарча"
     #Locale["tt"]["translations-of"]
@@ -368,6 +395,7 @@
     Locale["tt"]["script"]             = "Cyrl"

     #? Uyghur
+    Locale["ug"]["support"]            = "unstable"
     Locale["ug"]["name"]               = "Uyghur"
     Locale["ug"]["endonym"]            = "ئۇيغۇر تىلى"
     #Locale["ug"]["translations-of"]
@@ -382,6 +410,7 @@
     Locale["ug"]["rtl"]                = "true" # RTL language

     #? Volapük
+    Locale["vo"]["support"]            = "unstable"
     Locale["vo"]["name"]               = "Volapük"
     Locale["vo"]["endonym"]            = "Volapük"
     #Locale["vo"]["translations-of"]
@@ -395,6 +424,7 @@
     Locale["vo"]["script"]             = "Latn"

     #? Wolof
+    Locale["wo"]["support"]            = "unstable"
     Locale["wo"]["name"]               = "Wolof"
     Locale["wo"]["endonym"]            = "Wollof"
     #Locale["wo"]["translations-of"]
@@ -408,6 +438,7 @@
     Locale["wo"]["script"]             = "Latn"

     #? Western Frisian
+    Locale["fy"]["support"]            = "unstable"
     Locale["fy"]["name"]               = "Western Frisian"
     Locale["fy"]["endonym"]            = "Frysk"
     #Locale["fy"]["translations-of"]
@@ -421,6 +452,7 @@
     Locale["fy"]["script"]             = "Latn"

     #? Xhosa
+    Locale["xh"]["support"]            = "unstable"
     Locale["xh"]["name"]               = "Xhosa"
     Locale["xh"]["endonym"]            = "isiXhosa"
     #Locale["xh"]["translations-of"]
@@ -434,6 +466,7 @@
     Locale["xh"]["script"]             = "Latn"

     #? Cherokee
+    Locale["chr"]["support"]            = "unstable"
     Locale["chr"]["name"]               = "Cherokee"
     Locale["chr"]["endonym"]            = "ᏣᎳᎩ"
     #Locale["chr"]["translations-of"]


Translate: warn if TTS voice isn't available

--- include/Translate.awk
+++ include/Translate.awk
@@ -193,11 +193,16 @@
 }

 # Play using a Text-to-Speech engine.
-function play(text, tl,    url) {
+function play(text, tl,    url, status) {
     url = _TTSUrl(text, tl)

     # Don't use getline from pipe here - the same pipe will be run only once for each AWK script!
-    system(Option["player"] " " parameterize(url) SUPOUT SUPERR)
+    status = system(Option["player"] " " parameterize(url) SUPOUT SUPERR)
+
+    if (status)
+        w("Voice output isn't available for " getName(tl))
+
+    return status
 }

 # Download audio from a Text-to-Speech engine.