File: make_protos

package info (click to toggle)
kbtin 1.0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,212 kB
  • ctags: 1,149
  • sloc: ansic: 18,124; sh: 7,640; perl: 142; makefile: 137
file content (21 lines) | stat: -rwxr-xr-x 381 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

DIR="$1"
shift
DIR="${*:+${DIR:-.}/}"

mkdir -p "protos"

for f in ${*:--}
  do
    h="${f%.c}.h"
    (cd "$DIR";
    egrep -h '^[a-zA-Z_]+.*[a-zA-Z_][a-zA-Z0-9_]*\(.*\)$' "$f"|
    grep -v '^static'|
    egrep -v '^void [a-z_]+_command\('|
    egrep -v '^struct session \*[a-z_]+_command\('|
    while read x
      do
        echo "$x;"
      done) >"protos/$h"
  done