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