summaryrefslogtreecommitdiff
path: root/gnu/dist/postfix/src/postconf/extract.awk
blob: cdf25b91b2f042932950b8df695ec021e3aa8678 (plain)
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
31
32
33
34
35
36
# Extract initialization tables from actual source code.

/^(static| )*CONFIG_INT_TABLE .*\{/,/\};/ { 
    if ($1 ~ /VAR/) {
	print "int " substr($3,2,length($3)-2) ";" > "int_vars.h"
	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >int_table.h" 
    }
}
/^(static| )*CONFIG_STR_TABLE .*\{/,/\};/ { 
    if ($1 ~ /VAR/) {
	print "char *" substr($3,2,length($3)-2) ";" > "str_vars.h"
	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >str_table.h" 
    }
}
/^(static| )*CONFIG_RAW_TABLE .*\{/,/\};/ { 
    if ($1 ~ /VAR/) {
	print "char *" substr($3,2,length($3)-2) ";" > "raw_vars.h"
	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >raw_table.h" 
    }
}
/^(static| )*CONFIG_BOOL_TABLE .*\{/,/\};/ { 
    if ($1 ~ /VAR/) {
	print "int " substr($3,2,length($3)-2) ";" > "bool_vars.h"
	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >bool_table.h" 
    }
}
/^(static| )*CONFIG_TIME_TABLE .*\{/,/\};/ { 
    if ($1 ~ /VAR/) {
	print "int " substr($3,2,length($3)-2) ";" > "time_vars.h"
	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >time_table.h" 
    }
}

# Workaround for broken gawk versions.

END { exit(0); }