|
|
1.1 root 1: #! /bin/sh
2: # @(#)cflow.sh 1.6 83/10/05
3: # 3.0 SID # 1.2
4: INVFLG=
5: DFLAG=
6: IFLAG=
7: DIR=/usr/lib
8: CC=/bin/cc
9: # LINT1=/usr/lib/lint/lint1
10: LINT1=/src/cmd/lint/lint1
11: TMP=/usr/tmp/cf.${$}
12: TMPG=${TMP}.g
13: trap "rm -f ${TMP}*; kill ${$}" 1 2 3
14: echo "" >${TMP}.g
15: while [ -n "${1}" ]
16: do
17: case "${1}" in
18: -r)
19: INVFLG=1
20: ;;
21: -d*)
22: DFLAG=${1}
23: ;;
24: -i*)
25: IFLAG="${IFLAG} ${1}"
26: ;;
27: -f)
28: cat ${2} </dev/null >>${TMPG}
29: shift
30: ;;
31: -g)
32: TMPG=${2}
33: if [ -z "${TMPG}" ]
34: then
35: TMPG=${TMP}.g
36: fi
37: shift
38: ;;
39: -[IDU]*)
40: o="${o} ${1}"
41: ;;
42: *.y)
43: yacc ${1}
44: sed -e "/^# line/d" y.tab.c > ${1}.c
45: ${CC} -E ${o} ${1}.c | ${LINT1} -H${TMP}.j 2>/dev/null ${1}.c\
46: | ${DIR}/lpfx ${IFLAG} >>${TMPG}
47: rm y.tab.c ${1}.c
48: ;;
49: *.l)
50: lex ${1}
51: sed -e "/^# line/d" lex.yy.c > ${1}.c
52: ${CC} -E ${o} ${1}.c | ${LINT1} -H${TMP}.j 2>/dev/null ${1}.c\
53: | ${DIR}/lpfx ${IFLAG} >>${TMPG}
54: rm lex.yy.c ${1}.c
55: ;;
56: *.c)
57: ${CC} -E ${o} ${1} | ${LINT1} -H${TMP}.j 2>/dev/null ${1}\
58: | ${DIR}/lpfx ${IFLAG} >>${TMPG}
59: ;;
60: *.i)
61: name=`basename ${1} .c`
62: ${LINT1} -H${TMP}.j 2>/dev/null <${1} | ${DIR}/lpfx >>${TMPG} ${name}.c
63: ;;
64: *.s)
65: a=`basename ${1} .s`
66: as -o ${TMP}.o ${1}
67: nm -he ${TMP}.o | sort -t'|' -n +1 -2 | ${DIR}/nmf ${a} ${a}.s >>${TMPG}
68: ;;
69: *.o)
70: a=`basename ${1} .o`
71: nm -he ${1} | sort -t'|' -n +1 -2 | ${DIR}/nmf ${a} ${a}.o >>${TMPG}
72: ;;
73: *)
74: echo ${1} "-- cflow can't process - file skipped"
75: ;;
76: esac
77: shift
78: done
79: if [ -n "${INVFLG}" ]
80: then
81: grep "=" ${TMPG} >${TMP}.q
82: grep ":" ${TMPG} | ${DIR}/flip >>${TMP}.q
83: sort <${TMP}.q >${TMPG}
84: rm ${TMP}.q
85: fi
86: ${DIR}/dag ${DFLAG} <${TMPG}
87: rm -f ${TMP}*
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.