File: check_consistency

package info (click to toggle)
allegro5 2%3A5.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,856 kB
  • ctags: 15,948
  • sloc: ansic: 87,540; cpp: 9,693; objc: 3,491; python: 2,057; sh: 829; makefile: 93; perl: 37; pascal: 24
file content (58 lines) | stat: -rwxr-xr-x 1,052 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh -e
#
# SYNOPSIS
#
# check_consistency [OPTION...] DOC-FILE...
#
# OPTION
#
# --protos FILE
#
# DESCRIPTION
#
# Check that functions and types marked in source code have corresponding
# entries in the documentation, and vice versa.  The protos file must be
# present.
#
# ENVIRONMENT VARIABLES
#
# - PROTOS
#

export LC_ALL=C

PROTOS=${PROTOS:-protos}

case $1 in
    --protos)
        PROTOS=$2
        shift 2
        ;;
esac

if test ! -f "$PROTOS"
then
    echo "check_consistency: missing protos file: $PROTOS" 1>&2
    exit 1
fi

TEMP_SRC=check_consistency.tmp1.$$
TEMP_DOC=check_consistency.tmp2.$$
trap 'rm -f $TEMP_SRC $TEMP_DOC' 0 1 2 3 13 15

cut -d':' -f1 "$PROTOS" | sort | uniq > $TEMP_SRC
grep -h '# API: ' "$@" | cut -d' ' -f 3- | sort | uniq > $TEMP_DOC

diff $TEMP_SRC $TEMP_DOC | while read -r marker name
do
    case $marker in
        '>')
            echo "$name not in source (or missing Function: marker)"
            ;;
        '<')
            echo "$name not documented"
            ;;
    esac
done

# vim: set et: