source: clfs-embedded/patches/iana-etc-2.30-update-2.patch@ adfc846

Last change on this file since adfc846 was 3e2104b, checked in by Andrew Bradford <andrew@…>, 11 years ago

Fix iana-etc patch and 'make get'

Use Arch Linux patch.

  • Property mode set to 100644
File size: 4.4 KB
  • Makefile

    Submitted By: Andrew Bradford <andrew@bradfordembedded.com>
    Date: 2013-10-22
    Initial Package Version: 2.30
    Origin:	Arch Linux
    Upstream Status: Not Applied
    Description: 	Patch provides the changes to Makefile required to enable 'make get'
    
    diff -Naur old/Makefile new/Makefile
    old new  
    4242            protocol-numbers.iana port-numbers.iana
    4343
    4444protocol-numbers.iana:
    45         $(AWK) -f get.gawk -v file=protocol-numbers >protocol-numbers.iana
     45        $(AWK) -f get.gawk -v file=protocol-numbers/protocol-numbers.xml >protocol-numbers.iana
    4646        rm -f protocol-numbers
    4747
    4848port-numbers.iana:
    49         $(AWK) -f get.gawk -v file=port-numbers >port-numbers.iana
     49        $(AWK) -f get.gawk -v file=service-names-port-numbers/service-names-port-numbers.xml >port-numbers.iana
    5050        rm -f port-numbers
    5151
    5252protocol-numbers:
  • get.gawk

    diff -Naur old/get.gawk new/get.gawk
    old new  
    2626        NR++
    2727
    2828        if (in_content) { print }
    29         if (/^$/)       { in_content=1 }
     29        if (/^\r?$/)    { in_content=1 }
    3030    }
    3131
    3232    printf "\n" >"/dev/stderr"
  • protocols.gawk

    diff -Naur old/protocols.gawk new/protocols.gawk
    old new  
    1 #!/usr/bin/gawk --re-interval -f
    2 # the above doesn't work (stupid kernel) but serves as documentation
    3 
    4 # Copyright (c) 2003-2004, 2006 Seth W. Klein <sk@sethwklein.net>
    5 # Licensed under the Open Software License version 3.0
    6 # See the file COPYING in the distribution tarball or
    7 # http://www.opensource.org/licenses/osl-3.0.txt
     1#!/usr/bin/awk -f
    82
    93BEGIN {
    10     if (strip == "yes") {
    11         strip = 1
    12         format = "%s\t%s\t%s\n"
    13         header_printed = 1
    14     } else {
    15         strip = 0
    16         print "# See also: protocols(5)" \
    17             ", http://www.sethwklein.net/projects/iana-etc/\n#"
    18         format = "%-12s %3s %-12s # %s\n"
    19         header_printed = 0
    20     }
     4        print "# See the full IANA XML file at: /usr/share/iana-etc/protocol-numbers.iana\n"
     5        FS="[<>]"
    216}
    22 { sub(/\r/, "") }
    23 match($0, /^[ \t]+([0-9]+)[ \t]{1,5}([^ \t]+)(.*)/, f) {
    24     if ( ! header_printed) {
    25         printf format, "# protocol", "num", "aliases", "comments"
    26         header_printed = 1;
    27     }
    28     sub(/^[ \t]*/, "", f[3])
    29     printf format, tolower(f[2]), f[1], f[2], f[3]
    30     next
     7
     8{
     9        if (/<record/) { v=n=0 }
     10        if (/<value/) v=$3
     11        if (/<name/ && !($3~/ /)) n=$3
     12        if (/<\/record/ && (v || n=="HOPOPT") && n) printf "%-12s %3i %s\n", tolower(n),v,n
    3113}
    32 !strip { print "# " $0 }
  • services.gawk

    diff -Naur old/services.gawk new/services.gawk
    old new  
    1 #!/usr/bin/gawk -f
    2 
    3 # Copyright (c) 2003-2004, 2006, 2008 Seth W. Klein <sk@sethwklein.net>
    4 # Licensed under the Open Software License version 3.0
    5 # See the file COPYING in the distribution tarball or
    6 # http://www.opensource.org/licenses/osl-3.0.txt
     1#!/usr/bin/awk -f
    72
    83BEGIN {
    9     if (strip == "yes") {
    10         strip = 1
    11     } else {
    12         strip = 0
    13         print "# See also: services(5)" \
    14             ", http://www.sethwklein.net/projects/iana-etc/\n#"
    15     }
    16     while (getline <"port-aliases") {
    17         sub(/#.*/, "")
    18         if (/^[ \t]*$/) { continue }
    19         #                  1:name         2:protocol     3:aliases
    20         match($0, /^[ \t]*([^ \t]+)[ \t]+([^ \t]+)[ \t]+(.*)$/, f)
    21         aliases[f[1] " " f[2]] = " " f[3]
    22     }
     4        print "# See the full IANA XML file at: /usr/share/iana-etc/port-numbers.iana\n"
     5        FS="[<>]"
    236}
    24 { sub(/\r/, "") }
    25 #           1:name               2:ws    3:port  4:range     5:proto  6:comment
    26 match($0, /(^[[:alnum:]][^ \t]+)([ \t]+)([0-9]+)(-[0-9]+)?\/([^ \t]+)(.*)/, f) \
    27 && f[3] != "0" {
    28 # port 0 means unallocated, per port-numbers
    29     name = f[1]
    30     whitespace = f[2]
    31     port = f[3]
    32     protocol = f[5]
    33     comment = f[6]
    34     if (strip) {
    35         whitespace = "\t"
    36         comment = ""
    37     } else if (length(comment) > 0)
    38         sub(/^[ \t]*/, "&# ", comment)
    39     print name whitespace port "/" protocol aliases[name " " protocol] comment
    40     next
     7
     8{
     9        if (/<record/) { n=u=p=c=0 }
     10        if (/<name/ && !/\(/) n=$3
     11        if (/<number/) u=$3
     12        if (/<protocol/) p=$3
     13        if (/Unassigned/ || /Reserved/ || /historic/) c=1
     14        if (/<\/record/ && n && u && p && !c) printf "%-15s %5i/%s\n", n,u,p # services
    4115}
    42 # comment out, prettily
    43 !/^#/ { sub(/^ /, "#") || sub(/^/, "# ") }
    44 !strip { print }
Note: See TracBrowser for help on using the repository browser.