-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremove_header.awk
More file actions
executable file
·48 lines (47 loc) · 1.07 KB
/
remove_header.awk
File metadata and controls
executable file
·48 lines (47 loc) · 1.07 KB
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
# This script removes ANSI C file header comments
BEGIN { start = 0; incomment = 0;}
{
if (start == 0)
{
if (incomment == 0)
{
# C++ single line comment
if (/^\/\//)
{
# print "single line"
}
# single line comment
else if (/^\/\*[^\/]*\*\/$/)
{
# print "single line"
}
# multi line comment
else if (/^\/\*/)
{
#print "start comment"
# start multi line comment
incomment = 1
}
else
{
# first line that is not a comment, start normal output
print $0;
start = 1;
}
}
else
{
# search for comment end
if (/\*\//)
{
#print "end comment"
incomment = 0;
}
}
}
else
{
# print the complete line for the rest of the file
print $0
}
}