File: makeintprotos-awk

package info (click to toggle)
rxvt 1%3A2.7.10-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,068 kB
  • ctags: 4,415
  • sloc: ansic: 23,997; sh: 6,606; makefile: 649; perl: 33
file content (20 lines) | stat: -rw-r--r-- 546 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/^\/\* INTPROTO \*\/$/ {
    getline     # function return
    printf "%-16s ", $0
    cline=""
    while (index(cline, "{") == 0 && index(cline, "#") == 0) {
	getline # function name and args
        cline=cline $0
    }
    gsub(/[\t\n]/, " ", cline)
    gsub(/[ ]+/, " ", cline)
    l = index(cline, "(")
    m = index(cline, "{")
    n = index(cline, "#")
    if (n > 0) { m = n }
    outstring = sprintf("%%-32.%ds __PROTO(", l - 1)
    printf outstring, cline
    reststring = substr(cline, l, m - l)
    printf reststring
    print ");"
}