File: make_commands

package info (click to toggle)
kbtin 1.0.15-1.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,852 kB
  • ctags: 1,074
  • sloc: ansic: 17,345; sh: 7,584; makefile: 135; perl: 118
file content (24 lines) | stat: -rwxr-xr-x 821 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
22
23
24
#!/bin/sh

rm -f commands.h
rm -f load_commands.h
ARGS="_command(char *arg, struct session *ses)"
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_command(c_commands, \"$FUNC\", (t_command)${FUNC}_command);" >>load_commands.h
                    ;;
            *)      echo "extern void            $FUNC$ARGS;" >>commands.h
                    echo "add_command(commands, \"$FUNC\", ${FUNC}_command);" >>load_commands.h
                    ;;
        esac
    done