1 # Copyright (C) 2003-2021 Free Software Foundation, Inc.
2 # Contributed by Kelley Cook, June 2004.
3 # Original code from Neil Booth, May 2003.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
19 # This Awk script takes a list of *.opt files and combines them into
20 # a three-field sorted list suitable for input into opt[ch]-gen.awk.
22 # Usage: awk -f opt-gather.awk file1.opt [...] > outputfile
24 function sort
(ARRAY
, ELEMENTS
)
26 for (i =
2; i
<= ELEMENTS
; ++i
) {
27 for (j = i
; ARRAY
[j
-1] > ARRAY
[j
]; --j
) {
38 # Ignore comments and blank lines
39 /^
[ \t]*(;|$
)/ { flag =
0; next }
40 /^
[^
\t]/ { if (flag ==
0) {
44 record
[numrec
] = record
[numrec
] SUBSEP $
0
48 # Sort it and output it
52 for (i =
1; i
<= numrec
; i
++) {