-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtool_code.sh
executable file
·48 lines (40 loc) · 1.2 KB
/
tool_code.sh
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
#!/bin/bash
#
# Copyright (c) 2005-2010 Thierry FOURNIER
# $Id: tool_code.sh 690 2008-03-31 18:36:43Z $
#
case $1 in
pdf)
enscript -c -j -f Courier7 -E --header "\$n||Page $% of $=" --color -T 4 -p - *.h *.c | ps2pdf - arpalert-sources.pdf
;;
stats)
for files in *.c *.h; do
printf "%15s:% 5d lines\n" $files "$( cat $files | wc -l )"
done | sort -n -k 1
echo
printf "%15s:% 5d lines\n" "Total" "$( ( cat *.c ; cat *.h ) | wc -l )"
;;
dep)
for files in $(ls *.c); do
printf "%15s: %s\n" $files "$(cat $files | grep "#include \"" | sed -e "s/#include \"//; s/\"//" | xargs echo )";
done
;;
check)
grep "#.*include <" *.c *.h | \
sed -e "s/^.* <//; s/>//" | \
sort -u | \
sed -e "s/^\(.*\)/AC_CHECK_HEADERS(\1, , echo \"didn't find \1\"; exit 1)/"
;;
# funcs)
# cat *.c | \
# grep ".*(" | \
# sed -e "s/\([a-zA-Z0-9_]\+\)(/---\1---\n/g" | \
# grep -- "---.*---" | \
# sed -e "s/^.*---\([a-zA-Z0-9_]\+\)---$/\1/" | \
# sort -u | \
# grep -v "\(^data_\|^sens_\|[A-Z]\+\|^maclist_\|^maclist_\|^time_\|^mod_\|^module_\|^index_\|^cap_\|^alerte_\|^if\|^for\|^unindex_ip\|^to_lower\|^unindex_ip\|^\)"
# ;;
*)
echo "Syntax: $0 {pdf|stats|dep|check|funcs}"
exit 1
esac