|
|
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} -S${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} -S${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} >${TMP}X
57: ${LINT1} -S${TMP}.j <${1} 2>/dev/null ${TMP}X \
58: | ${DIR}/lpfx ${IFLAG} >>${TMPG}
59: ;;
60: *.i)
61: name=`basename ${1} .c`
62: ${LINT1} -S${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.