-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopying.awk
58 lines (55 loc) · 1.12 KB
/
copying.awk
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
BEGIN {
FS="\"";
print "/* ==> Do not modify this file!! It is created automatically";
print " by copying.awk. Modify copying.awk instead. <== */";
print "";
print "#ifdef DEBUGGING";
print "";
print "#include \"nitfol.h\"";
print "";
print "void show_copying(void)";
print "{";
print " infix_print_fixed_string(";
}
NR == 1,/^[ ]*NO WARRANTY[ ]*$/ {
if ($0 ~ //)
{
print " \"\\n\\n\"";
}
else if ($0 !~ /^[ ]*NO WARRANTY[ ]*$/)
{
printf " \"";
for (i = 1; i <= NF; i++)
{
gsub("\011", " ", $i);
printf "%s", $i;
}
printf "\\n\"\n";
}
}
/^[ ]*NO WARRANTY[ ]*$/ {
print " );";
print "}";
print "";
print "void show_warranty(void)";
print "{";
print " infix_print_fixed_string(";
}
/^[ ]*NO WARRANTY[ ]*$/, /^[ ]*END OF TERMS AND CONDITIONS[ ]*$/{
if (! ($0 ~ /^[ ]*END OF TERMS AND CONDITIONS[ ]*$/))
{
printf " \"";
for (i = 1; i <= NF; i++)
{
gsub("\011", " ", $i);
printf "%s", $i;
}
printf "\\n\"\n", $NF;
}
}
END {
print " );";
print "}";
print "";
print "#endif";
}