scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#!/bin/sh
 2
 3set -e
 4
 5trap 'rm -f file.a' EXIT
 6trap 'exit $?' HUP INT TERM
 7
 8############################################################################
 9#delete one member
10
11cp master.a file.a
12
13$EXEC scc ar -dv file.a file2
14
15if $EXEC scc ar -tv file.a file2
16then
17	echo file-2 was not deleted >&2
18	exit 1
19fi
20
21
22############################################################################
23#delete two members, 1st and 2nd
24
25cp master.a file.a
26
27$EXEC scc ar -dv file.a file1 file2
28
29if $EXEC scc ar -tv file.a file1 file2
30then
31	echo file-1 or file-2 were not deleted >&2
32	exit 1
33fi
34
35
36############################################################################
37#delete two members, 2nd and 3rd
38
39cp master.a file.a
40$EXEC scc ar -dv  file.a file2 file3
41
42if $EXEC scc ar -tv file.a file2 file3
43then
44	echo file-2 file-3 were not deleted >&2
45	exit 1
46fi
47
48############################################################################
49#remove all the members
50
51cp master.a file.a
52$EXEC scc ar -dv file.a file1 file2 file3
53
54if $EXEC scc ar -tv file.a file2 file3
55then
56	echo file-1 file2 file were not deleted >&2
57	exit 1
58fi
59
60if test `$EXEC scc ar -t file.a | wc -l` -ne 0
61then
62	echo file.a is not empty after deleting all the members >&2
63	exit 1
64fi
65
66############################################################################
67#special cases
68
69#no members
70cp master.a file.a
71
72last=`ls -l file.a | awk '{print $6,$7,$8}'`
73
74if ! $EXEC scc ar -dv file.a
75then
76	echo ar returned with error when no members
77	exit 1
78fi
79
80now=`ls -l file.a | awk '{print $6,$7,$8}'`
81if test "$now" != "$last"
82then
83	echo empty ar -d modified the archive >&2
84	exit 1
85fi
86
87#delete not existing member
88cp master.a file.a
89
90if $EXEC scc ar -dv file.a badfile
91then
92	echo ar returned ok deleting a not existing member >&2
93	exit 1
94fi