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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
# cnews dbz makefile hacked by Blars for use with suck:
# remove dbzdbm
# don't use ../conf or ../include
# =()<@<INCLUDE>@>()=
# .include "../include/config.make"
# make header file
# pathname variables
# =()<NEWSARTS=@<NEWSARTS>@>()=
NEWSARTS=/var/spool/news
# =()<NEWSOV=@<NEWSOV>@>()=
NEWSOV=/var/spool/news
# =()<NEWSBIN=@<NEWSBIN>@>()=
NEWSBIN=/usr/lib/news
# =()<NEWSCTL=@<NEWSCTL>@>()=
NEWSCTL=/var/lib/news
# =()<NEWSCONFIG=@<NEWSCONFIG>@>()=
NEWSCONFIG=/usr/lib/news/config
# workaround for System V make bug
SHELL=/bin/sh
# directories where things go
UIBIN=/usr/lib/news
RBIN=/usr/lib/news/input
# compilation stuff
# LIB is for makefile dependencies, LIBS for cc invocations
LIB=../libcnews.a
LIBS=../libcnews.a
MCFLAGS=$(MORECFLAGS) -O2 -DFASTSTRCHR -I.
LDFLAGS=$(CFLAGS) -s
LINTFLAGS=$(MORELINTFLAGS) -I.
# directories etc.
MAKE=make
TO=$(CONF)/cpto
IN=$(CONF)/cmpto $(CMPOPT)
CF=$(CONF)/checkfile $(CMPOPT)
MKDIR=$(CONF)/mkdirs
MX=chmod +x
# ++roman: no need for ranlib on Linux, ar s does it; and use $(AR) for
# cross compiling
AR=ar
#UPDATE=$(CONF)/update.ran ../libcnews.a
UPDATE=$(AR) rusv ../libcnews.a
LIBCMP=$(CONF)/libcmp ../libcnews.a
# misc configuration bits
SPACEFOR=statfs
DOSPACEFOR=dospacefor
QUEUELEN=tay
UID=news
GID=news
SIZE=big
DBZ=libdbz
STDIO=sysstdio
SERVER=
REPORTTO=newsmaster
URGENTTO=newscrisis
# fake files needed
HFAKE= sys/timeb.h
OFAKE= fgetline.o fsync.o
RFC=-DHAVERFCIZE
DEBUG=-DDBZDEBUG
# database sizes for performance tests, regression, and regression prime-find
TSIZE=12007
RSIZE=4019
RPSIZE=2679
# history files for regression and performance tests
RHIST=hist3.3
R2HIST=hist10
THIST=hist13
OBJS=dbz.o
ALL=$(OBJS)
u: $(ALL)
$(UPDATE) $(OBJS)
o: $(OBJS)
# the following is made explicit to simplify modifications on systems (mostly
# x86 System Vs) where -O fouls up dbz.o somehow
dbz.o: dbz.c ../cndbz.h
$(CC) $(CFLAGS) $(MCFLAGS) -include "../cndbz.h" -c dbz.c
t: tdbz fake
lint:
lint $(LINTFLAGS) dbzmain.c dbz.c
rdbz tdbz fake byteflip: $(LIB)
rdbz.o: dbz.c
cp dbz.c rdbz.c
$(CC) $(CFLAGS) $(DEBUG) -DDEFSIZE=$(RSIZE) -c rdbz.c
rm -f rdbz.c
rdbzmain.o: dbzmain.c
cp dbzmain.c rdbzmain.c
$(CC) $(CFLAGS) $(RFC) -c rdbzmain.c
rm -f rdbzmain.c
tdbz.o: dbz.c
cp dbz.c tdbz.c
$(CC) $(CFLAGS) -DDEFSIZE=$(TSIZE) -c tdbz.c
rm -f tdbz.c
tdbz: dbzmain.o tdbz.o dbzdbm.o
$(CC) $(LDFLAGS) dbzmain.o tdbz.o dbzdbm.o $(LIBS) -o $@
rdbz: rdbzmain.o rdbz.o dbzdbm.o
$(CC) $(LDFLAGS) rdbzmain.o rdbz.o dbzdbm.o $(LIBS) -o $@
fake: fake.o random.o
$(CC) $(LDFLAGS) fake.o random.o $(LIBS) -o $@
byteflip: byteflip.o
$(CC) $(LDFLAGS) byteflip.o $(LIBS) -o $@
hist10: fake
./fake -t -e 75 10000 >$@
hist3.3: fake
./fake -t -e 75 3300 >$@
hist13: fake
./fake -t -e 75 13000 >$@
r: rclean rdbz $(RHIST) $(R2HIST) byteflip getmap revbytes altbytes
: 'WARNING: creates about 2MB of debris...'
: crude check of synthetic history file
( sed 25q $(RHIST) ; tail -25 $(RHIST) ) >histjunk
cmp histjunk firstlast25
rm -f histjunk
: basic tests, exercising as many options as possible
cp $(RHIST) dbase
mkdir xx
chmod -w xx
./rdbz -E 1000 -0 -M -i -S -u -U -C xx dbase
rmdir xx
sed '/> 0/d' $(RHIST) >dbase.used
test "`cat dbase.used | wc -l`" -eq "`sed -n '2s/ .*//p' dbase.dir`" ;
./rdbz -v dbase
cp $(RHIST) dbase2
./rdbz -E 1000 -0 -p $(RPSIZE) -t ' ' dbase2
cmp $(RHIST) dbase
cmp dbase dbase2
cmp dbase.dir dbase2.dir
cmp dbase.pag dbase2.pag
./rdbz -E 1000 -0 -c dbase
./rdbz -E 1000 -0 -c -i -q -M -U dbase
: build a database and then add to it
sed 1000q $(RHIST) >dbase2
sed 1,1000d $(RHIST) >dbase2.add
./rdbz -E 1000 -0 -w dbase2
./rdbz -E 1000 -0 -a dbase2 dbase2.add
cmp dbase dbase2
cmp dbase.dir dbase2.dir
cmp dbase.pag dbase2.pag
: build based on existing one, test extraction and readonly files
./rdbz -E 1000 -0 -f dbase dbase2
test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$1}' dbase2.dir`" ;
test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$2}' dbase2.dir`" ;
chmod -w dbase2.dir dbase2.pag
./rdbz -E 1000 -x dbase2 dbase >dbase.temp
cmp dbase.used dbase.temp
: try some small case perversions
sed 's/\(@[^ ]*\)A/\1a/' dbase >dbase.ick
./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
cmp dbase.used dbase.temp
sed -n 's/A\([^ ]*@\)/a\1/p' dbase >dbase.ick
./rdbz -x dbase2 dbase.ick >dbase.temp
test ! -s dbase.temp ;
rm -f dbase2.dir dbase2.pag
: try it without tags, case-insensitive, with case perversions
./rdbz -E 1000 -0 -p '0 b 1' dbase2
tr '[A-M][n-z]' '[a-m][N-Z]' <dbase2 >dbase.ick
./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
cmp dbase.used dbase.temp
rm -f dbase.temp dbase.ick
: test various perversions of byte ordering
awk -f revbytes dbase.dir >dbase2.dir
chmod +x getmap
./byteflip `./getmap dbase.dir` `./getmap dbase2.dir` <dbase.pag >dbase2.pag
cp dbase dbase2
./rdbz -E 1000 -0 -c dbase2
awk -f altbytes dbase.dir >dbase2.dir
dd conv=swab <dbase.pag >dbase2.pag
./rdbz -E 1000 -0 -c dbase2
cp dbase2 dbase3
./rdbz -E 1000 -0 -f dbase2 dbase3
./rdbz -E 1000 -0 -c dbase3
test " `./getmap dbase2.dir`" = " `./getmap dbase3.dir`" ;
: test massive overflow, throw in case sensitivity and tag mask
cp $(R2HIST) dbase
./rdbz -E 1000 -0 -p '0 0 7ffc0000' dbase
./rdbz -E 1000 -0 -cq dbase
sed 100q dbase | egrep '[aA].* ' | tr aA Aa >dbase.ick
./rdbz -x dbase dbase.ick >dbase.temp
test ! -s dbase.temp ;
: check tag autoshrinking, tag size computing
test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 8191" ;
./rdbz -E 1000 -0 -f dbase dbase
test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 8190" ;
cp $(RHIST) dbase
./rdbz -E 1000 -0 -p '0 0 0' -T 1000000 dbase
test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 127" ;
./rdbz -E 1000 -0 -p '0 0 0' -T 500000000 dbase
test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 3" ;
: success!
rclean:
rm -f dbase dbase[23] dbase.* dbase[23].* fake fake.o random.o
rm -f rdbz rdbz.o rdbzmain.? $(RHIST) $(R2HIST) byteflip byteflip.o
rm -f histjunk core
test ! -d xx || rmdir xx
clean: rclean
rm -f *.o dbz [a-z]dbz [a-z][a-z]dbz junk* PostScript.out
rm -f hist* dbase* *.bak mon.out gmon.out core dbm.h
|