head 1.7; access; symbols netbsd-11-0-RC5:1.7 netbsd-11-0-RC4:1.7 netbsd-11-0-RC3:1.7 netbsd-11-0-RC2:1.7 netbsd-11-0-RC1:1.7 perseant-exfatfs-base-20250801:1.7 netbsd-11:1.7.0.12 netbsd-11-base:1.7 netbsd-10-1-RELEASE:1.7 perseant-exfatfs-base-20240630:1.7 perseant-exfatfs:1.7.0.10 perseant-exfatfs-base:1.7 netbsd-8-3-RELEASE:1.6 netbsd-9-4-RELEASE:1.6 netbsd-10-0-RELEASE:1.7 netbsd-10-0-RC6:1.7 netbsd-10-0-RC5:1.7 netbsd-10-0-RC4:1.7 netbsd-10-0-RC3:1.7 netbsd-10-0-RC2:1.7 netbsd-10-0-RC1:1.7 netbsd-10:1.7.0.8 netbsd-10-base:1.7 netbsd-9-3-RELEASE:1.6 cjep_sun2x-base1:1.7 cjep_sun2x:1.7.0.6 cjep_sun2x-base:1.7 cjep_staticlib_x-base1:1.7 netbsd-9-2-RELEASE:1.6 cjep_staticlib_x:1.7.0.4 cjep_staticlib_x-base:1.7 netbsd-9-1-RELEASE:1.6 phil-wifi-20200421:1.7 phil-wifi-20200411:1.7 is-mlppp:1.7.0.2 is-mlppp-base:1.7 phil-wifi-20200406:1.7 netbsd-8-2-RELEASE:1.6 netbsd-9-0-RELEASE:1.6 netbsd-9-0-RC2:1.6 netbsd-9-0-RC1:1.6 phil-wifi-20191119:1.7 netbsd-9:1.6.0.18 netbsd-9-base:1.6 phil-wifi-20190609:1.6 netbsd-8-1-RELEASE:1.6 netbsd-8-1-RC1:1.6 pgoyette-compat-merge-20190127:1.6 pgoyette-compat-20190127:1.6 pgoyette-compat-20190118:1.6 pgoyette-compat-1226:1.6 pgoyette-compat-1126:1.6 pgoyette-compat-1020:1.6 pgoyette-compat-0930:1.6 pgoyette-compat-0906:1.6 netbsd-7-2-RELEASE:1.3.42.3 pgoyette-compat-0728:1.6 netbsd-8-0-RELEASE:1.6 phil-wifi:1.6.0.16 phil-wifi-base:1.6 pgoyette-compat-0625:1.6 netbsd-8-0-RC2:1.6 pgoyette-compat-0521:1.6 pgoyette-compat-0502:1.6 pgoyette-compat-0422:1.6 netbsd-8-0-RC1:1.6 pgoyette-compat-0415:1.6 pgoyette-compat-0407:1.6 pgoyette-compat-0330:1.6 pgoyette-compat-0322:1.6 pgoyette-compat-0315:1.6 netbsd-7-1-2-RELEASE:1.3.42.3 pgoyette-compat:1.6.0.14 pgoyette-compat-base:1.6 netbsd-7-1-1-RELEASE:1.3.42.3 matt-nb8-mediatek:1.6.0.12 matt-nb8-mediatek-base:1.6 perseant-stdc-iso10646:1.6.0.10 perseant-stdc-iso10646-base:1.6 netbsd-8:1.6.0.8 netbsd-8-base:1.6 prg-localcount2-base3:1.6 prg-localcount2-base2:1.6 prg-localcount2-base1:1.6 prg-localcount2:1.6.0.6 prg-localcount2-base:1.6 pgoyette-localcount-20170426:1.6 bouyer-socketcan-base1:1.6 pgoyette-localcount-20170320:1.6 netbsd-7-1:1.3.42.3.0.6 netbsd-7-1-RELEASE:1.3.42.3 netbsd-7-1-RC2:1.3.42.3 netbsd-7-nhusb-base-20170116:1.3.42.3 bouyer-socketcan:1.6.0.4 bouyer-socketcan-base:1.6 pgoyette-localcount-20170107:1.6 netbsd-7-1-RC1:1.3.42.3 pgoyette-localcount-20161104:1.6 netbsd-7-0-2-RELEASE:1.3.42.3 localcount-20160914:1.6 netbsd-7-nhusb:1.3.42.3.0.4 netbsd-7-nhusb-base:1.3.42.3 pgoyette-localcount-20160806:1.6 pgoyette-localcount-20160726:1.6 pgoyette-localcount:1.6.0.2 pgoyette-localcount-base:1.6 netbsd-7-0-1-RELEASE:1.3.42.3 netbsd-7-0:1.3.42.3.0.2 netbsd-7-0-RELEASE:1.3.42.3 netbsd-7-0-RC3:1.3.42.3 netbsd-7-0-RC2:1.3.42.2 netbsd-7-0-RC1:1.3.42.2 netbsd-5-2-3-RELEASE:1.3 netbsd-5-1-5-RELEASE:1.3 netbsd-6-0-6-RELEASE:1.3 netbsd-6-1-5-RELEASE:1.3 netbsd-7:1.3.0.42 netbsd-7-base:1.3 yamt-pagecache-base9:1.3 yamt-pagecache-tag8:1.3 netbsd-6-1-4-RELEASE:1.3 netbsd-6-0-5-RELEASE:1.3 tls-earlyentropy:1.3.0.40 tls-earlyentropy-base:1.3 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.3 riastradh-drm2-base3:1.3 netbsd-6-1-3-RELEASE:1.3 netbsd-6-0-4-RELEASE:1.3 netbsd-5-2-2-RELEASE:1.3 netbsd-5-1-4-RELEASE:1.3 netbsd-6-1-2-RELEASE:1.3 netbsd-6-0-3-RELEASE:1.3 netbsd-5-2-1-RELEASE:1.3 netbsd-5-1-3-RELEASE:1.3 netbsd-6-1-1-RELEASE:1.3 riastradh-drm2-base2:1.3 riastradh-drm2-base1:1.3 riastradh-drm2:1.3.0.32 riastradh-drm2-base:1.3 netbsd-6-1:1.3.0.38 netbsd-6-0-2-RELEASE:1.3 netbsd-6-1-RELEASE:1.3 khorben-n900:1.3.0.36 netbsd-6-1-RC4:1.3 netbsd-6-1-RC3:1.3 agc-symver:1.3.0.34 agc-symver-base:1.3 netbsd-6-1-RC2:1.3 netbsd-6-1-RC1:1.3 yamt-pagecache-base8:1.3 netbsd-5-2:1.3.0.30 netbsd-6-0-1-RELEASE:1.3 yamt-pagecache-base7:1.3 netbsd-5-2-RELEASE:1.3 netbsd-5-2-RC1:1.3 matt-nb6-plus-nbase:1.3 yamt-pagecache-base6:1.3 netbsd-6-0:1.3.0.28 netbsd-6-0-RELEASE:1.3 netbsd-6-0-RC2:1.3 tls-maxphys:1.3.0.26 tls-maxphys-base:1.3 matt-nb6-plus:1.3.0.24 matt-nb6-plus-base:1.3 netbsd-6-0-RC1:1.3 yamt-pagecache-base5:1.3 yamt-pagecache-base4:1.3 netbsd-6:1.3.0.22 netbsd-6-base:1.3 netbsd-5-1-2-RELEASE:1.3 netbsd-5-1-1-RELEASE:1.3 yamt-pagecache-base3:1.3 yamt-pagecache-base2:1.3 yamt-pagecache:1.3.0.20 yamt-pagecache-base:1.3 cherry-xenmp:1.3.0.18 cherry-xenmp-base:1.3 bouyer-quota2-nbase:1.3 bouyer-quota2:1.3.0.16 bouyer-quota2-base:1.3 matt-mips64-premerge-20101231:1.3 matt-nb5-mips64-premerge-20101231:1.3 matt-nb5-pq3:1.3.0.14 matt-nb5-pq3-base:1.3 netbsd-5-1:1.3.0.12 netbsd-5-1-RELEASE:1.3 netbsd-5-1-RC4:1.3 matt-nb5-mips64-k15:1.3 netbsd-5-1-RC3:1.3 netbsd-5-1-RC2:1.3 netbsd-5-1-RC1:1.3 netbsd-5-0-2-RELEASE:1.3 matt-nb5-mips64-premerge-20091211:1.3 matt-premerge-20091211:1.3 matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.3 matt-nb4-mips64-k7-u2a-k9b:1.3 matt-nb5-mips64-u1-k1-k5:1.3 matt-nb5-mips64:1.3.0.10 netbsd-5-0-1-RELEASE:1.3 jym-xensuspend-nbase:1.3 netbsd-5-0:1.3.0.8 netbsd-5-0-RELEASE:1.3 netbsd-5-0-RC4:1.3 netbsd-5-0-RC3:1.3 netbsd-5-0-RC2:1.3 jym-xensuspend:1.3.0.6 jym-xensuspend-base:1.3 netbsd-5-0-RC1:1.3 netbsd-5:1.3.0.4 netbsd-5-base:1.3 matt-mips64-base2:1.3 matt-mips64:1.2.0.38 netbsd-4-0-1-RELEASE:1.2 wrstuden-revivesa-base-3:1.3 wrstuden-revivesa-base-2:1.3 wrstuden-fixsa-newbase:1.2 wrstuden-revivesa-base-1:1.3 yamt-pf42-base4:1.3 yamt-pf42-base3:1.3 hpcarm-cleanup-nbase:1.3 yamt-pf42-baseX:1.2 yamt-pf42-base2:1.3 wrstuden-revivesa:1.3.0.2 wrstuden-revivesa-base:1.3 yamt-pf42:1.2.0.36 yamt-pf42-base:1.2 mjf-devfs2:1.2.0.34 mjf-devfs2-base:1.3 keiichi-mipv6:1.2.0.32 keiichi-mipv6-base:1.2 mjf-devfs:1.2.0.30 mjf-devfs-base:1.2 matt-armv6-nbase:1.2 matt-armv6-prevmlocking:1.2 wrstuden-fixsa-base-1:1.2 netbsd-4-0:1.2.0.28 netbsd-4-0-RELEASE:1.2 cube-autoconf:1.2.0.26 cube-autoconf-base:1.2 netbsd-4-0-RC5:1.2 netbsd-4-0-RC4:1.2 netbsd-4-0-RC3:1.2 netbsd-4-0-RC2:1.2 netbsd-4-0-RC1:1.2 matt-armv6:1.2.0.24 matt-armv6-base:1.2 matt-mips64-base:1.2 hpcarm-cleanup:1.2.0.22 hpcarm-cleanup-base:1.2 netbsd-3-1-1-RELEASE:1.2 netbsd-3-0-3-RELEASE:1.2 wrstuden-fixsa:1.2.0.20 wrstuden-fixsa-base:1.2 abandoned-netbsd-4-base:1.2 abandoned-netbsd-4:1.2.0.14 netbsd-3-1:1.2.0.16 netbsd-3-1-RELEASE:1.2 netbsd-3-0-2-RELEASE:1.2 netbsd-3-1-RC4:1.2 netbsd-3-1-RC3:1.2 netbsd-3-1-RC2:1.2 netbsd-3-1-RC1:1.2 netbsd-4:1.2.0.18 netbsd-4-base:1.2 netbsd-3-0-1-RELEASE:1.2 netbsd-3-0:1.2.0.12 netbsd-3-0-RELEASE:1.2 netbsd-3-0-RC6:1.2 netbsd-3-0-RC5:1.2 netbsd-3-0-RC4:1.2 netbsd-3-0-RC3:1.2 netbsd-3-0-RC2:1.2 netbsd-3-0-RC1:1.2 netbsd-2-0-3-RELEASE:1.2 netbsd-2-1:1.2.0.10 netbsd-2-1-RELEASE:1.2 netbsd-2-1-RC6:1.2 netbsd-2-1-RC5:1.2 netbsd-2-1-RC4:1.2 netbsd-2-1-RC3:1.2 netbsd-2-1-RC2:1.2 netbsd-2-1-RC1:1.2 netbsd-2-0-2-RELEASE:1.2 netbsd-3:1.2.0.8 netbsd-3-base:1.2 netbsd-2-0-1-RELEASE:1.2 netbsd-2:1.2.0.6 netbsd-2-base:1.2 netbsd-2-0-RELEASE:1.2 netbsd-2-0-RC5:1.2 netbsd-2-0-RC4:1.2 netbsd-2-0-RC3:1.2 netbsd-2-0-RC2:1.2 netbsd-2-0-RC1:1.2 netbsd-2-0:1.2.0.4 netbsd-2-0-base:1.2 netbsd-1-6-PATCH002-RELEASE:1.2 netbsd-1-6-PATCH002:1.2 netbsd-1-6-PATCH002-RC4:1.2 netbsd-1-6-PATCH002-RC3:1.2 netbsd-1-6-PATCH002-RC2:1.2 netbsd-1-6-PATCH002-RC1:1.2 netbsd-1-6-PATCH001:1.2 netbsd-1-6-PATCH001-RELEASE:1.2 netbsd-1-6-PATCH001-RC3:1.2 netbsd-1-6-PATCH001-RC2:1.2 netbsd-1-6-PATCH001-RC1:1.2 fvdl_fs64_base:1.2 netbsd-1-6-RELEASE:1.2 netbsd-1-6-RC3:1.2 netbsd-1-6-RC2:1.2 netbsd-1-6-RC1:1.2 netbsd-1-6:1.2.0.2 netbsd-1-6-base:1.2; locks; strict; comment @# @; 1.7 date 2019.10.24.16.52.11; author rhialto; state Exp; branches; next 1.6; commitid Zyj5ujzMczMII8IB; 1.6 date 2014.10.24.22.19.44; author riz; state Exp; branches 1.6.16.1; next 1.5; commitid id8s8jVURWYjjvVx; 1.5 date 2014.10.23.14.19.33; author apb; state Exp; branches; next 1.4; commitid RjXKLOynGXPyGkVx; 1.4 date 2014.10.21.23.15.38; author apb; state Exp; branches; next 1.3; commitid STP4K6vbsE0Fw7Vx; 1.3 date 2008.04.30.13.10.49; author martin; state Exp; branches 1.3.42.1; next 1.2; 1.2 date 2002.05.19.13.32.44; author lukem; state Exp; branches 1.2.34.1 1.2.36.1; next 1.1; 1.1 date 2002.04.13.12.47.10; author lukem; state Exp; branches; next ; 1.6.16.1 date 2020.04.13.07.45.31; author martin; state Exp; branches; next ; commitid X01YhRUPVUDaec4C; 1.3.42.1 date 2014.10.24.07.30.14; author martin; state Exp; branches; next 1.3.42.2; commitid 3lKn0r3qYKDFoqVx; 1.3.42.2 date 2014.10.24.23.13.22; author riz; state Exp; branches; next 1.3.42.3; commitid J3AB6kJy7G54CvVx; 1.3.42.3 date 2015.08.04.17.16.33; author snj; state Exp; branches; next ; commitid rZZU7cvYrRxKvYvy; 1.2.34.1 date 2008.06.02.13.21.17; author mjf; state Exp; branches; next 1.2.34.2; 1.2.34.2 date 2008.10.05.20.10.32; author mjf; state dead; branches; next ; 1.2.36.1 date 2008.05.18.12.29.38; author yamt; state Exp; branches; next ; desc @@ 1.7 log @Solve [ vs. \133 in join.awk which replaces fix in r1.23 of regpkg. Ok uki@@. @ text @# $NetBSD: join.awk,v 1.6 2014/10/24 22:19:44 riz Exp $ # # Copyright (c) 2002 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation # by Luke Mewburn of Wasabi Systems. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # join.awk F1 F2 # Similar to join(1), this reads a list of words from F1 # and outputs lines in F2 with a first word that is in F1. # For purposes of matching the first word, both instances are # canonicalised via unvis(word); the version from F2 is printed. # Neither file needs to be sorted. function unvis(s) \ { # XXX: We don't handle the complete range of vis encodings unvis_result = "" while (length(s) > 0) { unvis_pos = match(s, "\\\\.") if (unvis_pos == 0) { unvis_result = unvis_result "" s s = "" break } # copy the part before the next backslash unvis_result = unvis_result "" substr(s, 1, unvis_pos - 1) s = substr(s, unvis_pos) # process the backslash and next few chars if (substr(s, 1, 2) == "\\\\") { # double backslash -> single backslash unvis_result = unvis_result "\\" s = substr(s, 3) } else if (match(s, "\\\\[0-7][0-7][0-7]") == 1) { # \ooo with three octal digits. # XXX: use strnum() is that is available unvis_result = unvis_result "" sprintf("%c", \ 0+substr(s, 2, 1) * 64 + \ 0+substr(s, 3, 1) * 8 + \ 0+substr(s, 4, 1)) s = substr(s, 5) } else { # unrecognised escape: keep the literal backslash printf "%s: %s:%s: unrecognised escape %s\n", \ ARGV[0], (FILENAME ? FILENAME : "stdin"), FNR, \ substr(s, 1, 2) \ >"/dev/stderr" unvis_result = unvis_result "" substr(s, 1, 1) s = substr(s, 2) } } return unvis_result } BEGIN \ { if (ARGC != 3) { printf("Usage: join file1 file2\n") >"/dev/stderr" exit 1 } while ( (getline < ARGV[1]) > 0) { f1 = unvis($1) words[f1] = $0 } delete ARGV[1] } { f1 = unvis($1) } f1 in words \ { $1="" print words[f1] $0 } @ 1.6 log @Back out previous until it can be fixed - it was causing all sets to contain all files, which made a full build of all arches over 150GB! My awk isn't good enough to fix this myself in the time available. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.4 2014/10/21 23:15:38 apb Exp $ d33 3 a35 1 # Neither file needs to be sorted d84 2 a85 2 $1 = unvis($1) words[$1] = $0 d90 1 a90 1 // { $1 = unvis($1) } d92 1 a92 1 $1 in words \ a93 1 f1=$1 @ 1.6.16.1 log @Mostly merge changes from HEAD upto 20200411 @ text @d1 1 a1 1 # $NetBSD$ d33 1 a33 3 # For purposes of matching the first word, both instances are # canonicalised via unvis(word); the version from F2 is printed. # Neither file needs to be sorted. d82 2 a83 2 f1 = unvis($1) words[f1] = $0 d88 1 a88 1 { f1 = unvis($1) } d90 1 a90 1 f1 in words \ d92 1 @ 1.5 log @Add vis() function, and canonicalise file names via vis(unvis($1)). XXX: The vis() function is very limited, due to the absence of ord() in NetBSD's awk. @ text @d33 1 a33 2 # The first word is canonicalised via vis(unvis(word))). # Neither file needs to be sorted. d56 1 a56 1 # XXX: use strtonum() when that is available a74 54 function vis(s) \ { # We need to encode backslash, space, and tab, because they # would interfere with scripts that attempt to manipulate # the set files. # # We make no attempt to encode shell special characters # such as " ' $ ( ) { } [ ] < > * ?, because nothing that # parses set files would need that. # # We would like to handle other white space or non-graph # characters, because they may be confusing for human readers, # but they are too difficult to handle in awk without the ord() # function, so we print an error message. # # As of October 2014, no files in the set lists contain # characters that would need any kind of encoding. # vis_result = "" while (length(s) > 0) { vis_pos = match(s, "(\\\\|[[:space:]]|[^[:graph:]])") if (vis_pos == 0) { vis_result = vis_result "" s s = "" break } # copy the part before the next special char vis_result = vis_result "" substr(s, 1, vis_pos - 1) vis_char = substr(s, vis_pos, 1) s = substr(s, vis_pos + 1) # process the special char if (vis_char == "\\") { # backslash -> double backslash vis_result = vis_result "\\\\" } else if (vis_char == " ") { # space -> \040 vis_result = vis_result "\\040" } else if (vis_char == "\t") { # tab -> \011 vis_result = vis_result "\\011" } else { # generalised \ooo with three octal digits. # XXX: I don't know how to do this in awk without ord() printf "%s: %s:%s: cannot perform vis encoding\n", \ ARGV[0], (FILENAME ? FILENAME : "stdin"), FNR \ >"/dev/stderr" vis_result = vis_result "" vis_char } } return vis_result } // { $1 = vis(unvis($1)); print } d82 1 a82 1 $1 = vis(unvis($1)) d88 1 a88 1 // { $1 = vis(unvis($1)) } @ 1.4 log @Add an unvis function and use it on file names in mtree specs. This should correct the problem that ./bin/[ was missing from the base.tgz set, despite being listed in src/distrib/sets/base/mi and being present in METALOG. The corresponding entry in METALOG.sanitised has ./bin/\133 instead of ./bin/[, and that made join.awk omit it. XXX: The unvis() implementation in join.awk handles only a subset of the syntax, but it's probably good enough for now. XXX: The file names should probably be canonicalised by vis(unvis(name)), but at present none of the file names in the set lists really need it. XXX: It may be a bug that entries in the set lists without corresponding entries in METALOG are silently ignored by join.awk. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.3 2008/04/30 13:10:49 martin Exp $ d33 2 a34 1 # Neither file needs to be sorted d57 1 a57 1 # XXX: use strnum() is that is available d76 54 d137 1 a137 1 $1 = unvis($1) d143 1 a143 1 // { $1 = unvis($1) } @ 1.3 log @Convert TNF licenses to new 2 clause variant @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.2 2002/05/19 13:32:44 lukem Exp $ d35 40 d81 2 a82 1 while ( (getline < ARGV[1]) > 0) d84 1 d88 2 @ 1.3.42.1 log @Pull up following revision(s) (requested by apbapb in ticket #155): distrib/sets/join.awk: revision 1.4 distrib/sets/join.awk: revision 1.5 Add an unvis function and use it on file names in mtree specs. This should correct the problem that ./bin/[ was missing from the base.tgz set, despite being listed in src/distrib/sets/base/mi and being present in METALOG. The corresponding entry in METALOG.sanitised has ./bin/\133 instead of ./bin/[, and that made join.awk omit it. XXX: The unvis() implementation in join.awk handles only a subset of the syntax, but it's probably good enough for now. XXX: The file names should probably be canonicalised by vis(unvis(name)), but at present none of the file names in the set lists really need it. XXX: It may be a bug that entries in the set lists without corresponding entries in METALOG are silently ignored by join.awk. Add vis() function, and canonicalise file names via vis(unvis($1)). XXX: The vis() function is very limited, due to the absence of ord() in NetBSD's awk. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.3 2008/04/30 13:10:49 martin Exp $ d33 1 a33 96 # The first word is canonicalised via vis(unvis(word))). # Neither file needs to be sorted. function unvis(s) \ { # XXX: We don't handle the complete range of vis encodings unvis_result = "" while (length(s) > 0) { unvis_pos = match(s, "\\\\.") if (unvis_pos == 0) { unvis_result = unvis_result "" s s = "" break } # copy the part before the next backslash unvis_result = unvis_result "" substr(s, 1, unvis_pos - 1) s = substr(s, unvis_pos) # process the backslash and next few chars if (substr(s, 1, 2) == "\\\\") { # double backslash -> single backslash unvis_result = unvis_result "\\" s = substr(s, 3) } else if (match(s, "\\\\[0-7][0-7][0-7]") == 1) { # \ooo with three octal digits. # XXX: use strtonum() when that is available unvis_result = unvis_result "" sprintf("%c", \ 0+substr(s, 2, 1) * 64 + \ 0+substr(s, 3, 1) * 8 + \ 0+substr(s, 4, 1)) s = substr(s, 5) } else { # unrecognised escape: keep the literal backslash printf "%s: %s:%s: unrecognised escape %s\n", \ ARGV[0], (FILENAME ? FILENAME : "stdin"), FNR, \ substr(s, 1, 2) \ >"/dev/stderr" unvis_result = unvis_result "" substr(s, 1, 1) s = substr(s, 2) } } return unvis_result } function vis(s) \ { # We need to encode backslash, space, and tab, because they # would interfere with scripts that attempt to manipulate # the set files. # # We make no attempt to encode shell special characters # such as " ' $ ( ) { } [ ] < > * ?, because nothing that # parses set files would need that. # # We would like to handle other white space or non-graph # characters, because they may be confusing for human readers, # but they are too difficult to handle in awk without the ord() # function, so we print an error message. # # As of October 2014, no files in the set lists contain # characters that would need any kind of encoding. # vis_result = "" while (length(s) > 0) { vis_pos = match(s, "(\\\\|[[:space:]]|[^[:graph:]])") if (vis_pos == 0) { vis_result = vis_result "" s s = "" break } # copy the part before the next special char vis_result = vis_result "" substr(s, 1, vis_pos - 1) vis_char = substr(s, vis_pos, 1) s = substr(s, vis_pos + 1) # process the special char if (vis_char == "\\") { # backslash -> double backslash vis_result = vis_result "\\\\" } else if (vis_char == " ") { # space -> \040 vis_result = vis_result "\\040" } else if (vis_char == "\t") { # tab -> \011 vis_result = vis_result "\\011" } else { # generalised \ooo with three octal digits. # XXX: I don't know how to do this in awk without ord() printf "%s: %s:%s: cannot perform vis encoding\n", \ ARGV[0], (FILENAME ? FILENAME : "stdin"), FNR \ >"/dev/stderr" vis_result = vis_result "" vis_char } } return vis_result } // { $1 = vis(unvis($1)); print } d41 1 a41 2 while ( (getline < ARGV[1]) > 0) { $1 = vis(unvis($1)) a42 1 } a45 2 // { $1 = vis(unvis($1)) } @ 1.3.42.2 log @Back out #155, it was problematic on HEAD. Reapply when it's reworked and better tested. @ text @d33 96 a128 1 # Neither file needs to be sorted d136 2 a137 1 while ( (getline < ARGV[1]) > 0) d139 1 d143 2 @ 1.3.42.3 log @Pull up following revision(s) (requested by martin in ticket #929): distrib/sets/join.awk: revision 1.4 Add an unvis function and use it on file names in mtree specs. This should correct the problem that ./bin/[ was missing from the base.tgz set, despite being listed in src/distrib/sets/base/mi and being present in METALOG. The corresponding entry in METALOG.sanitised has ./bin/\133 instead of ./bin/[, and that made join.awk omit it. XXX: The unvis() implementation in join.awk handles only a subset of the syntax, but it's probably good enough for now. XXX: The file names should probably be canonicalised by vis(unvis(name)), but at present none of the file names in the set lists really need it. XXX: It may be a bug that entries in the set lists without corresponding entries in METALOG are silently ignored by join.awk. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.3.42.2 2014/10/24 23:13:22 riz Exp $ a34 40 function unvis(s) \ { # XXX: We don't handle the complete range of vis encodings unvis_result = "" while (length(s) > 0) { unvis_pos = match(s, "\\\\.") if (unvis_pos == 0) { unvis_result = unvis_result "" s s = "" break } # copy the part before the next backslash unvis_result = unvis_result "" substr(s, 1, unvis_pos - 1) s = substr(s, unvis_pos) # process the backslash and next few chars if (substr(s, 1, 2) == "\\\\") { # double backslash -> single backslash unvis_result = unvis_result "\\" s = substr(s, 3) } else if (match(s, "\\\\[0-7][0-7][0-7]") == 1) { # \ooo with three octal digits. # XXX: use strnum() is that is available unvis_result = unvis_result "" sprintf("%c", \ 0+substr(s, 2, 1) * 64 + \ 0+substr(s, 3, 1) * 8 + \ 0+substr(s, 4, 1)) s = substr(s, 5) } else { # unrecognised escape: keep the literal backslash printf "%s: %s:%s: unrecognised escape %s\n", \ ARGV[0], (FILENAME ? FILENAME : "stdin"), FNR, \ substr(s, 1, 2) \ >"/dev/stderr" unvis_result = unvis_result "" substr(s, 1, 1) s = substr(s, 2) } } return unvis_result } d41 1 a41 2 while ( (getline < ARGV[1]) > 0) { $1 = unvis($1) a42 1 } a45 2 // { $1 = unvis($1) } @ 1.2 log @getdirs.awk: - improve parsing; explicitly skip lines we don't want and use the rest. - keep track of which items were explicitly listed, and only output directories at the END which weren't listed, each with a suffix of "optional". - convert to my awk KNF join.awk: - when joining, output all of the matching entry from the first file and the 2nd & subsequent lines of the entry from the second file. - convert to my awk KNF these changes mean that maketars use of pax will result in tar files with the traditional behaviour of only containing the necessary directories, rather than all the parent directories required to get to a particular item. this latter behaviour was necessary for METALOG (i.e UNPRIVED) pax .tgz set file generation, until the changes above fixed it. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.1 2002/04/13 12:47:10 lukem Exp $ a16 7 # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the NetBSD # Foundation, Inc. and its contributors. # 4. Neither the name of The NetBSD Foundation nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. @ 1.2.34.1 log @Sync with HEAD. @ text @d1 1 a1 1 # $NetBSD$ d17 7 @ 1.2.34.2 log @Sync with HEAD. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.2.34.1 2008/06/02 13:21:17 mjf Exp $ @ 1.2.36.1 log @sync with head. @ text @d1 1 a1 1 # $NetBSD: join.awk,v 1.2 2002/05/19 13:32:44 lukem Exp $ d17 7 @ 1.1 log @- clean up SDIR (temporary directory) creation - improve munging of NetBSD.dist and METALOG into metalog, using mtree to "cleanup" / "merge" entries, and don't sort the result. relies upon mtree to not change the order (see below) - use (newly added) join.awk to output lines in metalog that are listed in flist.${set}. join.awk doesn't require either file to be sorted (unlike join(1)), which is required because we want to retain the order of the metalog, because certain entries in the metalog (such as hard links) make assumptions about the permissions of earlier entries. this should fix [toolchain/16207] @ text @d1 1 a1 1 # $NetBSD$ d45 2 a46 2 printf("Usage: join file1 file2\n") >"/dev/stderr"; exit 1; d49 2 a50 2 words[$1]++; delete ARGV[1]; d53 6 a58 1 $1 in words { print; } @