2 # COMMENT_MARKER - marks beginning of the comment on the line
3 # COMMENT_MARKER_RE - the same as previous, but in form usable
4 # as a part of a regular expression
5 # COPYRIGHT_MARKER - text inside comment
6 # COPYRIGHT_NOTICE - copyright notice text to insert
10 # 0 - before finding copyright notice
11 # 1 - in copyright notice or its continuation
12 # 2 - right after the end of copyright notice
13 # 3 - copyright notice added
17 comment_re = "^" COMMENT_MARKER_RE
18 copyright_re = comment_re "([[:space:]]*)" COPYRIGHT_MARKER
19 copyright_cont_re = copyright_re
22 state <= 1 && match($0, copyright_re, a) {
25 # set copyright notice continuation
26 copyright_cont_re = comment_re a[1] "[[:space:]]"
29 # this is neither copyright notice nor its continuation
30 state == 1 && ($0 !~ copyright_re) && ($0 !~ copyright_cont_re) {
35 print COMMENT_MARKER prefix COPYRIGHT_NOTICE