File: make_commands

package info (click to toggle)
kbtin 2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,856 kB
  • sloc: ansic: 18,627; perl: 179; sh: 88; makefile: 17
file content (24 lines) | stat: -rwxr-xr-x 822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

rm -f commands.h
rm -f load_commands.h
ARGS="_command(const char *arg, struct session *ses) __attribute__((nonnull))"
while read FUNC
    do
        if [ -z "$FUNC" ]
            then
                continue
        fi
        case $FUNC in
            \;*)    ;;
            \#*)    echo "$FUNC" >>commands.h;echo "$FUNC">>load_commands.h
                    ;;
            \**)    FUNC=`echo "$FUNC"|sed 's/^\*//'`
                    echo "extern struct session *$FUNC$ARGS;" >>commands.h
                    echo "add_c_command( \"$FUNC\", ${FUNC}_command);" >>load_commands.h
                    ;;
            *)      echo "extern void            $FUNC$ARGS;" >>commands.h
                    echo "add_command(\"$FUNC\", ${FUNC}_command);" >>load_commands.h
                    ;;
        esac
    done