File: exten_make.awk

package info (click to toggle)
afio 2.5.1.20160103+gitc8e4317-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bullseye, buster, sid, stretch
  • size: 864 kB
  • ctags: 647
  • sloc: ansic: 4,903; sh: 139; makefile: 83; awk: 19
file content (30 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Generates default list of -E extensions from manpage.
# Does this by looking for the special comments
# 'br START_EXT_LIST
# and
# 'br END_EXT_LIST
# in the manpage, and for all lines in between, recording every
# word on each line, except for the first word each line, as an extension,
# where a word is a whitespace-separated string of characters.
# See also the manpage comments surrounding the extension list.
$0 ~ "'br END_EXT_LIST" { p=0; }
p==1 {
 for(i=2; i<=NF; i++) { ex[nx++]=$i; }
}
$0 ~ "'br START_EXT_LIST" { p=1; }
END {
 print "/* This file was auto-generated by the Makefile, from the afio.1 manpage file */"
 for(i=0; i<nx; i++)
 {
  #a just-in-case consistency check.
  if((ex[i]==".I")||(ex[i]!~"^\\.")) {
     print "Questionable extention:"ex[i];
     print "Editing of afio.1 probably made it incompatible with"
     print "the parsing rules used by the exten_make.awk script.";
     exit 1;
  }
  print "struct extnode de"i+1"={ \""ex[i]"\", "(i?"&de"i:"NULL")" };";
 }
 print "struct extnode *compexts=&de"nx";";

}