File: tool_code.sh

package info (click to toggle)
arpalert 2.0.12-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,508 kB
  • sloc: ansic: 4,452; sh: 517; makefile: 116; perl: 35
file content (48 lines) | stat: -rwxr-xr-x 1,228 bytes parent folder | download | duplicates (5)
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
#!/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