summaryrefslogtreecommitdiffstats
path: root/tests/one_man.sh
blob: 879f3e7dcdfd4fd693be386a6ad051cc8d083db9 (plain)
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
49
50
51
52
53
54
#!/bin/sh
RM='rm -f'
SCI=..
FILE='one_man.tst'
LOGFILE='get_examples.log'

$RM prov $LOGFILE

echo '//' `date` > prov
echo '' >> prov

do_example()
{
echo '//====================================================' >> prov
echo '//' "$1" >> prov
echo '//====================================================' >> prov

res=`grep 'SH EXAMPLE' $1 2> /dev/null`
if test -n "$res"
then
	echo "clear;lines(0);" >> prov

	sed -e '1,/^.SH EXAMPLE/d' $1 > prov1
	sed -e '1d' prov1 > prov2
	sed -e '/^.fi/,$d' prov2 >> prov
	$RM prov1 prov2
	
	echo "$1" PROCESSED >> $LOGFILE
else
	echo "$1" NO EXAMPLE >> $LOGFILE
fi

echo '' >> prov
}

for j in graphics
do
	echo -n "Processing man/$j "
	for f in $SCI/man/$j/*.man
	do
		echo -n '.'
		do_example $f
	done
	echo ""
done

echo ''
echo `grep PROCESSED $LOGFILE|wc -l` examples extracted from `cat  $LOGFILE|wc -l` manual files.

$RM $FILE

sed -e 's/\\\\/\\/' prov > $FILE

$RM prov