mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-30 20:35:03 +01:00
Compare commits
1228
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49bb443250 | ||
|
|
c07eac88c8 | ||
|
|
72c7c6df77 | ||
|
|
6cf06919a0 | ||
|
|
0d4be6ca72 | ||
|
|
733cfb9bb8 | ||
|
|
cb460d650f | ||
|
|
6367fe8072 | ||
|
|
c3424cd871 | ||
|
|
5a24da17a7 | ||
|
|
1c2b24e948 | ||
|
|
1324ef9143 | ||
|
|
70d839b759 | ||
|
|
291ce9d9a3 | ||
|
|
36f99fcc36 | ||
|
|
6d6434e793 | ||
|
|
dc76fc7f98 | ||
|
|
5b0cfa351d | ||
|
|
a0bc9f84c4 | ||
|
|
e0289248f1 | ||
|
|
9f674266a7 | ||
|
|
66c6293482 | ||
|
|
d2e84f2808 | ||
|
|
43b4ceb226 | ||
|
|
51cddf2d26 | ||
|
|
993fbaf726 | ||
|
|
5b17c66859 | ||
|
|
73ac47a262 | ||
|
|
fd0aafd577 | ||
|
|
afcd9d9b16 | ||
|
|
62f9114960 | ||
|
|
e298b4a9c2 | ||
|
|
16253f541d | ||
|
|
3653eb467c | ||
|
|
6c3e83d3ae | ||
|
|
dec2349be0 | ||
|
|
12f2852b67 | ||
|
|
a2483209ea | ||
|
|
46de6f9b51 | ||
|
|
1a0a467b2b | ||
|
|
cef7a77d87 | ||
|
|
632da78512 | ||
|
|
fbd2533d62 | ||
|
|
b9f1e07817 | ||
|
|
b908a7017e | ||
|
|
e6989a19cf | ||
|
|
f2e45911e4 | ||
|
|
bc7aba4d8b | ||
|
|
a0af358cab | ||
|
|
6fb3275346 | ||
|
|
9f918aee67 | ||
|
|
f21b767cf0 | ||
|
|
534868f7e8 | ||
|
|
dace61020a | ||
|
|
01af8b9c01 | ||
|
|
0c55543a21 | ||
|
|
76d702ac87 | ||
|
|
f015efc65b | ||
|
|
fd94d842e3 | ||
|
|
59ce00d12b | ||
|
|
8bac3c358e | ||
|
|
029dcaf2e5 | ||
|
|
550be9779a | ||
|
|
792c207aa2 | ||
|
|
1e8398d0df | ||
|
|
ed4c88b1d5 | ||
|
|
243fd3e79a | ||
|
|
71d0614efb | ||
|
|
d869e46220 | ||
|
|
0575a75788 | ||
|
|
6929275e82 | ||
|
|
1cea839607 | ||
|
|
190a915090 | ||
|
|
90638faa1f | ||
|
|
03bcc3402c | ||
|
|
6af7e6d637 | ||
|
|
6de777acf5 | ||
|
|
feb65cb027 | ||
|
|
407b54fd05 | ||
|
|
2fa4719ed4 | ||
|
|
1e359daeb4 | ||
|
|
c235c061fb | ||
|
|
9feb160f29 | ||
|
|
cb20acb3b8 | ||
|
|
7521aec722 | ||
|
|
9408676622 | ||
|
|
a1fde92e0c | ||
|
|
3a39895236 | ||
|
|
4e97723090 | ||
|
|
1ed5167061 | ||
|
|
7143f5f3f2 | ||
|
|
cd6b1bf7af | ||
|
|
74efa25380 | ||
|
|
9a41f0e081 | ||
|
|
085c0b8eca | ||
|
|
5770110f26 | ||
|
|
db7e1c2a6c | ||
|
|
d3263cd569 | ||
|
|
a3a781424a | ||
|
|
74c1d25376 | ||
|
|
161d9c3e34 | ||
|
|
f19047ea50 | ||
|
|
233785b9b9 | ||
|
|
aafeb4047a | ||
|
|
9f00e664c0 | ||
|
|
2f340cec8e | ||
|
|
cc36f4f11f | ||
|
|
f27bc428c5 | ||
|
|
e62e0a9cd5 | ||
|
|
cdac4fc88d | ||
|
|
46f18e0a84 | ||
|
|
506507f08d | ||
|
|
dd4fe77199 | ||
|
|
885366f8ef | ||
|
|
d8acbb659c | ||
|
|
3ba684834e | ||
|
|
910d07b46f | ||
|
|
7ce4840b98 | ||
|
|
21a88d2aca | ||
|
|
3d0513eb64 | ||
|
|
c4d84e573b | ||
|
|
a86a6e2ee9 | ||
|
|
02a575f96d | ||
|
|
33b8b7d63a | ||
|
|
ad351aa0fa | ||
|
|
b936d091ae | ||
|
|
454941b570 | ||
|
|
cb577245cb | ||
|
|
e4591b2fa9 | ||
|
|
ad8f2c5634 | ||
|
|
ec72e8eac1 | ||
|
|
15aa8bbf6e | ||
|
|
e349036c87 | ||
|
|
412c4bd52a | ||
|
|
740f4fdd92 | ||
|
|
b432275ccc | ||
|
|
1e136bb59b | ||
|
|
7d33adacfc | ||
|
|
49b674e404 | ||
|
|
2f846027d7 | ||
|
|
55dfa970e9 | ||
|
|
eb147da479 | ||
|
|
055eefe377 | ||
|
|
9961cc24c4 | ||
|
|
da926b324c | ||
|
|
b6c0616c29 | ||
|
|
fc2381faa1 | ||
|
|
3744cb12b8 | ||
|
|
7c7601318f | ||
|
|
c58546b6e8 | ||
|
|
bca25aca16 | ||
|
|
d654db57fd | ||
|
|
8c789ce6f1 | ||
|
|
dead352686 | ||
|
|
487f5e8626 | ||
|
|
4af5a7d002 | ||
|
|
0f73cb6fbc | ||
|
|
7a86eaebc6 | ||
|
|
5ff2fc8acc | ||
|
|
87fef19de6 | ||
|
|
b3f0d6573d | ||
|
|
d5c1447353 | ||
|
|
d5778a710e | ||
|
|
7d82445973 | ||
|
|
f710e88f14 | ||
|
|
80f51f71d5 | ||
|
|
d8b0e6145c | ||
|
|
2f74839692 | ||
|
|
8c16e00393 | ||
|
|
ef602f288b | ||
|
|
739cc4994b | ||
|
|
45c6141c08 | ||
|
|
a1fd592756 | ||
|
|
58d8819dad | ||
|
|
a6248a578b | ||
|
|
c7d1714833 | ||
|
|
f4c3a13a6e | ||
|
|
fa130747f5 | ||
|
|
d7a2ce56b3 | ||
|
|
9f508664ec | ||
|
|
79642eb1d5 | ||
|
|
fb70d80533 | ||
|
|
9527403b34 | ||
|
|
c1224d2453 | ||
|
|
4cb6b0566a | ||
|
|
88efa09f14 | ||
|
|
8fb558fe22 | ||
|
|
9dbcc22226 | ||
|
|
991e337734 | ||
|
|
d7e6040dd6 | ||
|
|
0439300080 | ||
|
|
2e5860ca13 | ||
|
|
23e43883f9 | ||
|
|
d3ba7f2755 | ||
|
|
80a7328e64 | ||
|
|
2de062a5d6 | ||
|
|
c4564a0846 | ||
|
|
b555909025 | ||
|
|
12a0106037 | ||
|
|
cc0baf1126 | ||
|
|
2086e2380b | ||
|
|
eac5ae87c9 | ||
|
|
2caa3c7ec7 | ||
|
|
6a93dd96e2 | ||
|
|
43c2f5b8b9 | ||
|
|
612784615f | ||
|
|
07a6122da8 | ||
|
|
c2556ef3bb | ||
|
|
66a7bbebff | ||
|
|
cab3b1cc45 | ||
|
|
0731ee16d2 | ||
|
|
93282a50b8 | ||
|
|
4e0902ecb1 | ||
|
|
f59ac23959 | ||
|
|
6bfb7c23f6 | ||
|
|
14294751ca | ||
|
|
41bc14717a | ||
|
|
dbfbe0991b | ||
|
|
987d42d1d9 | ||
|
|
de503836d7 | ||
|
|
c16dffe008 | ||
|
|
190d09596b | ||
|
|
975ecd4e44 | ||
|
|
75215af3a4 | ||
|
|
63a0d06723 | ||
|
|
6ba9a03def | ||
|
|
42099f1985 | ||
|
|
1a7da473da | ||
|
|
ce4f6eab05 | ||
|
|
0dcd847817 | ||
|
|
2d53fa24bc | ||
|
|
8185204e06 | ||
|
|
c84686f2fe | ||
|
|
e4589052b7 | ||
|
|
e77642a7d4 | ||
|
|
7215b3e587 | ||
|
|
b49a589fbd | ||
|
|
25e5aa7122 | ||
|
|
ba8f5a28fc | ||
|
|
2686524e26 | ||
|
|
16124dd4d8 | ||
|
|
fae58f29bf | ||
|
|
73fa0bd618 | ||
|
|
2cdd42ccc0 | ||
|
|
b513302589 | ||
|
|
a49c296607 | ||
|
|
36f098b747 | ||
|
|
3ff1999702 | ||
|
|
e5a7e22bf0 | ||
|
|
c7efd09df3 | ||
|
|
b5a190847f | ||
|
|
05e0e2a035 | ||
|
|
9b63e77d39 | ||
|
|
d91b51a381 | ||
|
|
9b43fd1d20 | ||
|
|
ca431b5b3f | ||
|
|
849c9a9907 | ||
|
|
2e7e860033 | ||
|
|
c493950755 | ||
|
|
46aa4c86cb | ||
|
|
37456e2c56 | ||
|
|
5629e5d986 | ||
|
|
1a7c7795ae | ||
|
|
2763415aa7 | ||
|
|
240ac5a208 | ||
|
|
3d90a70e17 | ||
|
|
b0c3f4c6ae | ||
|
|
a2e9dbda21 | ||
|
|
717c94ce15 | ||
|
|
1a58ada4d0 | ||
|
|
d265b9ab3e | ||
|
|
be526c8cd4 | ||
|
|
1e3cb17908 | ||
|
|
722f695479 | ||
|
|
3ef85769b6 | ||
|
|
b4e1904a54 | ||
|
|
a686be61fc | ||
|
|
34f27258c4 | ||
|
|
a22e146e91 | ||
|
|
9f9121a48a | ||
|
|
6664127189 | ||
|
|
e50f132dab | ||
|
|
9c14b9d60f | ||
|
|
1c0ab20825 | ||
|
|
dee399a6f9 | ||
|
|
fcce2c9c3b | ||
|
|
5bd0d24864 | ||
|
|
ab5b89e884 | ||
|
|
4d10866172 | ||
|
|
b3d60a9e86 | ||
|
|
d29fd12d7d | ||
|
|
09b1aa831d | ||
|
|
f1e6abb452 | ||
|
|
b781c00d72 | ||
|
|
a8b6c5dc10 | ||
|
|
a004a3217f | ||
|
|
04042f8a99 | ||
|
|
67035a68d5 | ||
|
|
551c64f766 | ||
|
|
ef33836f21 | ||
|
|
a8ca7e86be | ||
|
|
c8d3b74023 | ||
|
|
85ed071988 | ||
|
|
6c4df54e91 | ||
|
|
8ee67de88d | ||
|
|
fb82164a44 | ||
|
|
2ec296b2f4 | ||
|
|
e70043e74a | ||
|
|
e326ccd99e | ||
|
|
985c94d740 | ||
|
|
e97ee948df | ||
|
|
4806c3b763 | ||
|
|
d93a6ba8b3 | ||
|
|
04cdd79934 | ||
|
|
985f4cbc11 | ||
|
|
e145ffa4ba | ||
|
|
fe874e21b6 | ||
|
|
d06b1bfae6 | ||
|
|
cc1922f9c8 | ||
|
|
e682184fae | ||
|
|
0330ff20d9 | ||
|
|
85fe572bcd | ||
|
|
c1273ab0d2 | ||
|
|
e1d0e58079 | ||
|
|
53624e94f1 | ||
|
|
56f0dfd16e | ||
|
|
4a04b7e53c | ||
|
|
fb5974780c | ||
|
|
9c51dc33c2 | ||
|
|
1c0b99dade | ||
|
|
af5ad159ff | ||
|
|
e14ae26bdb | ||
|
|
f6f16d1894 | ||
|
|
bcbbf719a8 | ||
|
|
e3e6bbd6c1 | ||
|
|
129ec01ab6 | ||
|
|
cf65d7238e | ||
|
|
8e5b4b7228 | ||
|
|
10a0a6c691 | ||
|
|
2158e8d2ac | ||
|
|
67dacb093c | ||
|
|
b2fb2490bf | ||
|
|
7374211ae1 | ||
|
|
24c252656d | ||
|
|
b1b992e40d | ||
|
|
70d3135c69 | ||
|
|
b4d39651f8 | ||
|
|
07e798e8a3 | ||
|
|
2261fa0be1 | ||
|
|
a4cc7f4b09 | ||
|
|
91a42e4408 | ||
|
|
b4ae091bf1 | ||
|
|
00445d9a5b | ||
|
|
310895245a | ||
|
|
e970871785 | ||
|
|
61c67a1217 | ||
|
|
7744cb4ebd | ||
|
|
fb43d43394 | ||
|
|
d1763d119d | ||
|
|
4cfa33f038 | ||
|
|
8d9622c3c9 | ||
|
|
66e34790dc | ||
|
|
1d9738f844 | ||
|
|
92f4c0ce84 | ||
|
|
1e5009096a | ||
|
|
935b3a313c | ||
|
|
04be3b2317 | ||
|
|
377ebd813c | ||
|
|
1805b0603c | ||
|
|
1321af36c3 | ||
|
|
b0c14abb8e | ||
|
|
0d86498d34 | ||
|
|
9cdc1be394 | ||
|
|
71c1288a19 | ||
|
|
ca4d247b09 | ||
|
|
5af0a1725f | ||
|
|
21a9ec614a | ||
|
|
74f2655fd9 | ||
|
|
57ba83dfce | ||
|
|
2dead96ff3 | ||
|
|
f64f13befd | ||
|
|
1c77f6284f | ||
|
|
44425c8879 | ||
|
|
65be1f35bf | ||
|
|
7b63e34bea | ||
|
|
2631f8007f | ||
|
|
fec1ddfe5d | ||
|
|
854e5b87a4 | ||
|
|
8b140cc754 | ||
|
|
e24dccc870 | ||
|
|
a2d1368129 | ||
|
|
9cc691db5c | ||
|
|
fb3dfe55f8 | ||
|
|
0c3900b51c | ||
|
|
5c65c476da | ||
|
|
dd1b601f5a | ||
|
|
0e9b5b4dee | ||
|
|
d009bf39da | ||
|
|
173160ff04 | ||
|
|
cd8a873ba8 | ||
|
|
c86f973ea7 | ||
|
|
6f51dd62b2 | ||
|
|
0bd789315d | ||
|
|
c5e964b9c5 | ||
|
|
62a0144f81 | ||
|
|
1dd5073864 | ||
|
|
364287184c | ||
|
|
8fa950ecaf | ||
|
|
e80901d631 | ||
|
|
f89ede28f4 | ||
|
|
ad423c383c | ||
|
|
88e3d55425 | ||
|
|
881ad77662 | ||
|
|
3c0f3c1ee9 | ||
|
|
eb6bde4037 | ||
|
|
4ac0bf5406 | ||
|
|
16639c2c16 | ||
|
|
167855d31d | ||
|
|
46691eb9d8 | ||
|
|
8592baea6d | ||
|
|
baa0a2e1ce | ||
|
|
aaf4de8255 | ||
|
|
03a4ce00c3 | ||
|
|
e77f4eacc9 | ||
|
|
ae94e14fdd | ||
|
|
5e7d2837f9 | ||
|
|
50b12e912f | ||
|
|
0af28e9283 | ||
|
|
e588909218 | ||
|
|
f7705ac1e9 | ||
|
|
482892fcb4 | ||
|
|
a098ebeaf9 | ||
|
|
f03e8f3e57 | ||
|
|
0e1d9fe707 | ||
|
|
38d94ef317 | ||
|
|
cb81b9e53f | ||
|
|
660422417d | ||
|
|
8b6cbc8e12 | ||
|
|
d9db2132d0 | ||
|
|
8d1b11d33c | ||
|
|
ab44076735 | ||
|
|
f30c2d09c4 | ||
|
|
2c555e4f1a | ||
|
|
84cb66dcae | ||
|
|
6b81d495cc | ||
|
|
65c146f937 | ||
|
|
2740d93865 | ||
|
|
63db378a26 | ||
|
|
4cf5702563 | ||
|
|
6dcf27befc | ||
|
|
6204e88d2a | ||
|
|
ff2d4a6612 | ||
|
|
547a90c0d5 | ||
|
|
62b482e8da | ||
|
|
79beccb985 | ||
|
|
5693556bca | ||
|
|
8de10f6d18 | ||
|
|
45984731dd | ||
|
|
7b9a62ea21 | ||
|
|
02acb6c49c | ||
|
|
ae38c4b199 | ||
|
|
d428a4b284 | ||
|
|
f287ca6aaa | ||
|
|
fc7807d266 | ||
|
|
395a4bcf59 | ||
|
|
f2bdedc432 | ||
|
|
fdca560121 | ||
|
|
02a1f33dd3 | ||
|
|
f29096316f | ||
|
|
9bc63d5d71 | ||
|
|
e2e273a558 | ||
|
|
1f4a4cf7e4 | ||
|
|
ad79c5fdaa | ||
|
|
52bc0f17f0 | ||
|
|
3c50b19b46 | ||
|
|
c83ec7c18c | ||
|
|
93294191b5 | ||
|
|
b8cb053796 | ||
|
|
d9391d60a9 | ||
|
|
73a0bfddbb | ||
|
|
767c375f9c | ||
|
|
27c55448ae | ||
|
|
6819f91559 | ||
|
|
38ca348910 | ||
|
|
b3dce7919c | ||
|
|
3b1e46d52d | ||
|
|
0445a11d70 | ||
|
|
5444c305a6 | ||
|
|
5d236b351a | ||
|
|
73a7bd0fad | ||
|
|
0517605bd8 | ||
|
|
1b7a8ba9fb | ||
|
|
4d2b8b0cb7 | ||
|
|
c9907737be | ||
|
|
52d420ba99 | ||
|
|
44f1f16583 | ||
|
|
2c32415aa5 | ||
|
|
b910f9f584 | ||
|
|
e0f44d8ea6 | ||
|
|
efcc214848 | ||
|
|
e954be3560 | ||
|
|
124be570c8 | ||
|
|
4acbacbf19 | ||
|
|
cb15545a43 | ||
|
|
302c9157a9 | ||
|
|
20021e11c7 | ||
|
|
f243c7fc5d | ||
|
|
66eeac3dea | ||
|
|
6e3e4e0955 | ||
|
|
efd9ff49c0 | ||
|
|
361c3b4198 | ||
|
|
57cc2adeb7 | ||
|
|
683bc49e47 | ||
|
|
fd3374a739 | ||
|
|
ff755ca072 | ||
|
|
4e82845941 | ||
|
|
84f7f79739 | ||
|
|
6eb78d60c2 | ||
|
|
e3fb95be71 | ||
|
|
556ee612e5 | ||
|
|
95ae1807d9 | ||
|
|
1db99c554d | ||
|
|
525c53b3ec | ||
|
|
9c97b85b3c | ||
|
|
23a8527027 | ||
|
|
30b2cc2b1b | ||
|
|
c66f09b6a3 | ||
|
|
b267deb4c5 | ||
|
|
8471da2f8f | ||
|
|
adfc96dfd5 | ||
|
|
23ceeef060 | ||
|
|
b3582060b0 | ||
|
|
814cb5b910 | ||
|
|
88a5eacca9 | ||
|
|
99504fb4e4 | ||
|
|
27763d6d8a | ||
|
|
76ea369c73 | ||
|
|
404ec9caa3 | ||
|
|
447695c26b | ||
|
|
1d62962b11 | ||
|
|
7e2b49dd8d | ||
|
|
1af88191c0 | ||
|
|
b88c111087 | ||
|
|
da3e600964 | ||
|
|
9515cf0b15 | ||
|
|
f1e7747dd5 | ||
|
|
65869d0828 | ||
|
|
e35b6d2d67 | ||
|
|
c1c5295bb2 | ||
|
|
12d7c718f2 | ||
|
|
2e866bdb54 | ||
|
|
57a15a2aa7 | ||
|
|
fd9c6ac960 | ||
|
|
8af71c651f | ||
|
|
5336463792 | ||
|
|
1e09e5bdbf | ||
|
|
0b56e0673e | ||
|
|
d35bc7e328 | ||
|
|
d81830504d | ||
|
|
334a8b8c19 | ||
|
|
2548e94bf7 | ||
|
|
d7ae2737b6 | ||
|
|
085c2f151e | ||
|
|
2767e2eeea | ||
|
|
934cf4eeb4 | ||
|
|
cf4724914d | ||
|
|
e336171dc1 | ||
|
|
1140eaf333 | ||
|
|
46923adada | ||
|
|
71a3f8f1bd | ||
|
|
8a7b85eafe | ||
|
|
418f30eb6d | ||
|
|
5c0822d911 | ||
|
|
2e5559a9ee | ||
|
|
221b016f86 | ||
|
|
f51d972eda | ||
|
|
5315cd21e3 | ||
|
|
a078966dee | ||
|
|
ce7a7394ee | ||
|
|
ab20a5df0b | ||
|
|
46f43ee8a4 | ||
|
|
1c005bf789 | ||
|
|
f7f588cbec | ||
|
|
71383a1a73 | ||
|
|
2232ea795e | ||
|
|
b9572e1d0c | ||
|
|
76c92e50b7 | ||
|
|
b07152c2b0 | ||
|
|
1442749f62 | ||
|
|
bbab5af811 | ||
|
|
a021374b82 | ||
|
|
480d43780d | ||
|
|
4f0d5513ca | ||
|
|
fe0e3377f5 | ||
|
|
47bd995ad7 | ||
|
|
9c875d9f49 | ||
|
|
0bbc124081 | ||
|
|
b508227023 | ||
|
|
a74632b4e0 | ||
|
|
57750d9b19 | ||
|
|
5e7e17f1ee | ||
|
|
0e2e931499 | ||
|
|
7dc2f8b338 | ||
|
|
93e116a75d | ||
|
|
48ffbb042b | ||
|
|
a7ace46a44 | ||
|
|
af0ef8eea2 | ||
|
|
a7e03f4755 | ||
|
|
74e75f855c | ||
|
|
0ed832a5a5 | ||
|
|
ef5d0da3b9 | ||
|
|
6e7e1e81eb | ||
|
|
c821eb485c | ||
|
|
2ba3a677f9 | ||
|
|
3b78646819 | ||
|
|
c080068bf4 | ||
|
|
c6b074e9c0 | ||
|
|
6af9aa044c | ||
|
|
9b0287d02f | ||
|
|
645d8a83e6 | ||
|
|
f07ebb62ea | ||
|
|
b34ff0f84d | ||
|
|
cfa6e9077d | ||
|
|
3ad0fccd05 | ||
|
|
ec225d7313 | ||
|
|
c19360290d | ||
|
|
b108a0bd5d | ||
|
|
fa8055d766 | ||
|
|
5c0b3a8493 | ||
|
|
a1f7e01e87 | ||
|
|
f87930345e | ||
|
|
9b3cc4d8a9 | ||
|
|
08ca3972f3 | ||
|
|
05c94159a6 | ||
|
|
8841389ba9 | ||
|
|
029cb871c6 | ||
|
|
159c47d6bb | ||
|
|
9b14c24177 | ||
|
|
be225210cf | ||
|
|
353d376929 | ||
|
|
a060cf8674 | ||
|
|
af20c42255 | ||
|
|
285aec4be4 | ||
|
|
f8c1ca120d | ||
|
|
98e3c339d5 | ||
|
|
1822af0b19 | ||
|
|
c66dddb0b1 | ||
|
|
c499c3953a | ||
|
|
3d8719929d | ||
|
|
a76093b068 | ||
|
|
ecd4e6393a | ||
|
|
fbdfe6cfbf | ||
|
|
afaba402ee | ||
|
|
d25af4c96e | ||
|
|
027e33e1f7 | ||
|
|
6edbf2a534 | ||
|
|
045ade9166 | ||
|
|
db905d03f0 | ||
|
|
e7acc121a2 | ||
|
|
b56b6f1294 | ||
|
|
4474bc8244 | ||
|
|
cda3c22ce5 | ||
|
|
2fc56184a7 | ||
|
|
5a3e30a66b | ||
|
|
3d22e6a7cf | ||
|
|
c62a6476fb | ||
|
|
26b656890c | ||
|
|
815cd824bf | ||
|
|
33d0449485 | ||
|
|
94df5a8d5b | ||
|
|
7ce8a424e8 | ||
|
|
b76ad9ff28 | ||
|
|
f741481677 | ||
|
|
e78cbdfa07 | ||
|
|
9a2bf9599e | ||
|
|
7925c9901c | ||
|
|
085f0c8a53 | ||
|
|
e658b9c185 | ||
|
|
ca4b414c7b | ||
|
|
24b298fe9a | ||
|
|
06b816a9d8 | ||
|
|
8683d822f8 | ||
|
|
df05d108e3 | ||
|
|
93ba63597f | ||
|
|
352827a8ea | ||
|
|
ca13ea54b3 | ||
|
|
443b7ee41b | ||
|
|
f913a59011 | ||
|
|
cc64368d73 | ||
|
|
27516d4c8b | ||
|
|
84cb365772 | ||
|
|
9d9e357c5e | ||
|
|
eaf1b7be8f | ||
|
|
bb20c765b8 | ||
|
|
5b5cd0d201 | ||
|
|
129b306d00 | ||
|
|
6595512435 | ||
|
|
23ce36f885 | ||
|
|
453eff22bc | ||
|
|
7bdfdec9c0 | ||
|
|
4b30cf18ce | ||
|
|
a09226bba3 | ||
|
|
b2e059338f | ||
|
|
cf3e1daa3d | ||
|
|
d17d950b3b | ||
|
|
01c7d0f68b | ||
|
|
cb4d28ad2a | ||
|
|
d3d40d6aae | ||
|
|
c414bef8bb | ||
|
|
7f7d250b5f | ||
|
|
a1e60e042a | ||
|
|
d7134afc47 | ||
|
|
141f4393fe | ||
|
|
7800e53de7 | ||
|
|
3c353147a1 | ||
|
|
1b909317e8 | ||
|
|
502d1984bf | ||
|
|
bc0ea602a4 | ||
|
|
1609559230 | ||
|
|
870010a55d | ||
|
|
324c6add0e | ||
|
|
f173e370fa | ||
|
|
e9e5d16b88 | ||
|
|
9234d22cc3 | ||
|
|
88aa7456e2 | ||
|
|
1d935d7bc3 | ||
|
|
bbe3b23726 | ||
|
|
33a5a01f1b | ||
|
|
26ccfeff7a | ||
|
|
8c9d8ce4b8 | ||
|
|
d8c231517a | ||
|
|
0568ea0d2a | ||
|
|
33a5f2e68e | ||
|
|
8bd133c816 | ||
|
|
09afa73f83 | ||
|
|
bfebe9e467 | ||
|
|
268cf3d588 | ||
|
|
dd38ad52d1 | ||
|
|
a892a02aed | ||
|
|
dc84c70cb8 | ||
|
|
befa68afd3 | ||
|
|
de1d9be7d0 | ||
|
|
a5e8bedc5a | ||
|
|
4707ded303 | ||
|
|
b13951d29e | ||
|
|
5c6c3376c6 | ||
|
|
6c830cc7f9 | ||
|
|
05276d135a | ||
|
|
140a9c19a0 | ||
|
|
843724d3d0 | ||
|
|
dec4b7aef6 | ||
|
|
c8f119883f | ||
|
|
dd29bd4fb0 | ||
|
|
2fa6f14da1 | ||
|
|
0064e6b3b6 | ||
|
|
cb916c1f38 | ||
|
|
65d6800f17 | ||
|
|
33a5d9d948 | ||
|
|
896f45b4ed | ||
|
|
b7b37d2099 | ||
|
|
7da863dc25 | ||
|
|
32e09a111e | ||
|
|
578a086c41 | ||
|
|
55e4da0b7d | ||
|
|
4cc7a0f0c3 | ||
|
|
9bf57627ee | ||
|
|
8f13751bcc | ||
|
|
7026d8da48 | ||
|
|
5f5939e751 | ||
|
|
79dd6b9dc0 | ||
|
|
ce41fbb4b9 | ||
|
|
1830995bf9 | ||
|
|
1248da34d4 | ||
|
|
420fee292a | ||
|
|
bdef1d1965 | ||
|
|
da9be79356 | ||
|
|
493d6a0dec | ||
|
|
df09afe043 | ||
|
|
15e3a583fd | ||
|
|
462fac9c68 | ||
|
|
6486e9db80 | ||
|
|
143a8a7fe1 | ||
|
|
c8a978d1f3 | ||
|
|
5bdb3c8b56 | ||
|
|
c5ed7cd9fa | ||
|
|
712d120ca9 | ||
|
|
8512dd1f60 | ||
|
|
000de18dad | ||
|
|
03db2997c3 | ||
|
|
0a88588e3e | ||
|
|
b09d5dbb8f | ||
|
|
63308da72a | ||
|
|
5e8f9ce585 | ||
|
|
796bd8bf6e | ||
|
|
e4a091227f | ||
|
|
6168b728f5 | ||
|
|
45bf2f08fa | ||
|
|
8358267a40 | ||
|
|
d3c17c74e2 | ||
|
|
12d367dd29 | ||
|
|
174689d853 | ||
|
|
a6c0065435 | ||
|
|
d738bdb73a | ||
|
|
963c4e4a4f | ||
|
|
5b259a5e08 | ||
|
|
3c56d9fa6d | ||
|
|
b49116e407 | ||
|
|
bbf0f0c73f | ||
|
|
d693f65c2f | ||
|
|
67a5262989 | ||
|
|
d024026477 | ||
|
|
3694001918 | ||
|
|
05108e5cb6 | ||
|
|
561a7318e2 | ||
|
|
75609b5b87 | ||
|
|
215c2c6dda | ||
|
|
1f96f1b269 | ||
|
|
cbd9fd89ef | ||
|
|
829e66ff5f | ||
|
|
45517834bd | ||
|
|
c3cf4947ba | ||
|
|
9873a7e9bc | ||
|
|
17e9468629 | ||
|
|
82b04f8442 | ||
|
|
a89b5cb8ab | ||
|
|
5ca8318b57 | ||
|
|
639b6fc0a5 | ||
|
|
536ad3ea79 | ||
|
|
88c370dffa | ||
|
|
897ba78098 | ||
|
|
7ec8fc48b0 | ||
|
|
c749bd6e74 | ||
|
|
894ec265c9 | ||
|
|
cb6efea151 | ||
|
|
c46c60d264 | ||
|
|
42688aef00 | ||
|
|
063a5bd12c | ||
|
|
9cd69ea883 | ||
|
|
911bc45f47 | ||
|
|
1778c9bd2c | ||
|
|
358eeff570 | ||
|
|
9981b91cc4 | ||
|
|
53616a70c3 | ||
|
|
1557704800 | ||
|
|
b161c7ad27 | ||
|
|
338b26306d | ||
|
|
3f4ca2de5c | ||
|
|
296c601b45 | ||
|
|
99429694a4 | ||
|
|
70ebb9cb36 | ||
|
|
ae1acdba2e | ||
|
|
95644767c5 | ||
|
|
cbcb11e08e | ||
|
|
57143f3c8d | ||
|
|
c2e8cf81ac | ||
|
|
ff9e61eb57 | ||
|
|
91bc3a3e31 | ||
|
|
afb082a415 | ||
|
|
a2ab4bb2bf | ||
|
|
b6d90f2b77 | ||
|
|
b1bb0c441f | ||
|
|
da29049ba5 | ||
|
|
2e33d44c0f | ||
|
|
5bdcd310f6 | ||
|
|
11f3f3cd20 | ||
|
|
b9f60d10a1 | ||
|
|
f4b4eb47c5 | ||
|
|
889a50a45f | ||
|
|
4b6a53f316 | ||
|
|
414209db7c | ||
|
|
e7bcf2a04f | ||
|
|
b20df097d3 | ||
|
|
0ff36d7151 | ||
|
|
a79ee00664 | ||
|
|
c84580aaa0 | ||
|
|
2fb24b4b1d | ||
|
|
b07160254c | ||
|
|
2340fc3916 | ||
|
|
3c28dfbe95 | ||
|
|
a4b302f726 | ||
|
|
cf2a1052b7 | ||
|
|
d5cbe77c9e | ||
|
|
4b8a4c48f5 | ||
|
|
ba41a82208 | ||
|
|
5ed04b4e84 | ||
|
|
fbdaac74be | ||
|
|
342a6fb1bf | ||
|
|
e497d697fa | ||
|
|
5a667a4b35 | ||
|
|
0cc0babb77 | ||
|
|
1255258cfc | ||
|
|
1da671d87c | ||
|
|
8ea94cce42 | ||
|
|
cf15fe8d40 | ||
|
|
23949b6ee8 | ||
|
|
bb530930d9 | ||
|
|
ae953937e1 | ||
|
|
3e83eef908 | ||
|
|
8c0eb26b8f | ||
|
|
1121b712c5 | ||
|
|
01aa757517 | ||
|
|
28801d8a51 | ||
|
|
e3ef61e87f | ||
|
|
eb34b52a3a | ||
|
|
9df87923d9 | ||
|
|
3c85ff2d98 | ||
|
|
5df5c35e86 | ||
|
|
98b9422ae3 | ||
|
|
4fa918711d | ||
|
|
54a6feacd2 | ||
|
|
41c637f831 | ||
|
|
6b6bd4ea62 | ||
|
|
0050bff193 | ||
|
|
b0025d0931 | ||
|
|
9c0558a269 | ||
|
|
a9cd70d9f7 | ||
|
|
0e480efce6 | ||
|
|
1bdb0c08ee | ||
|
|
22349a8ca5 | ||
|
|
5b7c438d0f | ||
|
|
2934376fd7 | ||
|
|
387e3f62d1 | ||
|
|
8ce877ea7d | ||
|
|
9cf455aaa5 | ||
|
|
3623a71d8b | ||
|
|
8c801b6376 | ||
|
|
aa4bb97695 | ||
|
|
35d97a9e61 | ||
|
|
27493a5edc | ||
|
|
0a2165b40c | ||
|
|
2cf5dd837d | ||
|
|
abbb1c1afe | ||
|
|
46b4f2e7b0 | ||
|
|
d3e34dbb59 | ||
|
|
56741a081d | ||
|
|
879fd82504 | ||
|
|
0c2177ea58 | ||
|
|
6440ac243f | ||
|
|
a2090eb847 | ||
|
|
ed1f57f9a0 | ||
|
|
7f8ac6aa1a | ||
|
|
493e5a5a8f | ||
|
|
84cc83712b | ||
|
|
963ea596a7 | ||
|
|
f574fdf66c | ||
|
|
02e2d6b705 | ||
|
|
69f6c35e6a | ||
|
|
7fdca09f79 | ||
|
|
a8ab6074bb | ||
|
|
3e6d9e9e9c | ||
|
|
be40226a6b | ||
|
|
44da6e4afd | ||
|
|
b8280542c5 | ||
|
|
cc2377eb0e | ||
|
|
1ee6e2823d | ||
|
|
7f8b578479 | ||
|
|
0292124f79 | ||
|
|
17536ff55d | ||
|
|
bb602b4be5 | ||
|
|
47332048c3 | ||
|
|
b26150537d | ||
|
|
84588e0912 | ||
|
|
261835d9a8 | ||
|
|
34519663c2 | ||
|
|
54fd837c68 | ||
|
|
1b19c67bf4 | ||
|
|
389d195aaa | ||
|
|
5dfadf47d3 | ||
|
|
16460baaf0 | ||
|
|
a216f0308a | ||
|
|
a5229afc6c | ||
|
|
cc2ab1e13c | ||
|
|
1d909eeabd | ||
|
|
1c0a002bf3 | ||
|
|
c976e350fb | ||
|
|
db6b0d3582 | ||
|
|
1494cae800 | ||
|
|
0e1cf8e36c | ||
|
|
1daf575af6 | ||
|
|
b6b4607cdd | ||
|
|
3c9c967631 | ||
|
|
2de0667d03 | ||
|
|
2a8d6e5d91 | ||
|
|
55ed0029f6 | ||
|
|
1a92ca98f2 | ||
|
|
c9e5fc7b7a | ||
|
|
9520c6e4b8 | ||
|
|
97adcdaa3f | ||
|
|
0ab2e4b338 | ||
|
|
1280baf755 | ||
|
|
95778a3035 | ||
|
|
3a397712e4 | ||
|
|
85e35a4756 | ||
|
|
d55e3d33f5 | ||
|
|
f0195efdc4 | ||
|
|
411b24a0d0 | ||
|
|
94fc0783ff | ||
|
|
ad1f72b440 | ||
|
|
8a9d9e56be | ||
|
|
21653cb97c | ||
|
|
04538516ac | ||
|
|
29d321b5ab | ||
|
|
97aa7e5221 | ||
|
|
d103000886 | ||
|
|
8cb72df8aa | ||
|
|
2e7f80b849 | ||
|
|
664f264f9b | ||
|
|
19a29d88c2 | ||
|
|
da9c90fd01 | ||
|
|
65c974e762 | ||
|
|
e64853e80b | ||
|
|
d7d1e6403f | ||
|
|
eb6ffe6ef7 | ||
|
|
a564378015 | ||
|
|
49ce1aca5f | ||
|
|
0810d179fa | ||
|
|
524909f177 | ||
|
|
46ab13df54 | ||
|
|
e37b880bd5 | ||
|
|
340c11ee28 | ||
|
|
83a9cfa09d | ||
|
|
01f8b8aa1c | ||
|
|
f2246e8db9 | ||
|
|
a0d6c372fa | ||
|
|
6654ca29e9 | ||
|
|
e8ebe2308b | ||
|
|
a08697a4c3 | ||
|
|
6284b48915 | ||
|
|
52083bfec0 | ||
|
|
dd18481e46 | ||
|
|
2ba8043a8d | ||
|
|
99fb2d6dd1 | ||
|
|
f88d4eeedf | ||
|
|
9fc5b9bdde | ||
|
|
14dff51593 | ||
|
|
ef5adff921 | ||
|
|
235d4dee7f | ||
|
|
ab50cfd70b | ||
|
|
7a5f51eadc | ||
|
|
3ef84d17f9 | ||
|
|
4ef9c5b002 | ||
|
|
ceb8154d1c | ||
|
|
0482db90be | ||
|
|
5e007daf51 | ||
|
|
8073928b42 | ||
|
|
1ec95b81f2 | ||
|
|
a1e83538f6 | ||
|
|
49ea47d685 | ||
|
|
ee4c1e56ab | ||
|
|
3795ddeff6 | ||
|
|
ab90fea96b | ||
|
|
157288d366 | ||
|
|
c3c3ba4f59 | ||
|
|
c296277c1d | ||
|
|
d31157003b | ||
|
|
426ca56de1 | ||
|
|
ba7fcc2c02 | ||
|
|
966549ce5b | ||
|
|
c72da07aed | ||
|
|
fdd0c57b01 | ||
|
|
b15315a699 | ||
|
|
2c3044640e | ||
|
|
726b036e26 | ||
|
|
c13180b6a0 | ||
|
|
4e759a51ed | ||
|
|
6b95f492b8 | ||
|
|
59d1cd6d18 | ||
|
|
7d97390e24 | ||
|
|
5cb64c3dd5 | ||
|
|
f416d31767 | ||
|
|
ae8e46245f | ||
|
|
14791dcf9e | ||
|
|
ae9a28ea86 | ||
|
|
8139c33495 | ||
|
|
e645221cca | ||
|
|
11b16e0b5f | ||
|
|
4d0f48d313 | ||
|
|
553426e83b | ||
|
|
5cbcf1d710 | ||
|
|
2fb1472555 | ||
|
|
959c1c300c | ||
|
|
e713d840dd | ||
|
|
f8686cf6df | ||
|
|
d0cc99345f | ||
|
|
83942493e1 | ||
|
|
6189f6970b | ||
|
|
b47837c71e | ||
|
|
ce9acbfe9b | ||
|
|
83086f21f4 | ||
|
|
48ab02f708 | ||
|
|
5361be8c3c | ||
|
|
2a386443d8 | ||
|
|
ddc56328a7 | ||
|
|
e1144dc72b | ||
|
|
08bd7550de | ||
|
|
a424fb1209 | ||
|
|
16735098be | ||
|
|
91e63a068d | ||
|
|
3f842b3f9b | ||
|
|
8a48fd791b | ||
|
|
7e53192819 | ||
|
|
871ec2968f | ||
|
|
4c932cdd1b | ||
|
|
785c330256 | ||
|
|
c0753ad684 | ||
|
|
9de9ccb3a2 | ||
|
|
ab3fd57237 | ||
|
|
f38d0b5e37 | ||
|
|
11057593c1 | ||
|
|
7dfb554e73 | ||
|
|
63d6c71e6e | ||
|
|
2f86ba6203 | ||
|
|
7f5c2799af | ||
|
|
b8a421cb03 | ||
|
|
627294a8b8 | ||
|
|
b5b6335a64 | ||
|
|
9826c7254f | ||
|
|
74174270e3 | ||
|
|
5364ddbaed | ||
|
|
a7063cd377 | ||
|
|
e132426e55 | ||
|
|
9281f80d33 | ||
|
|
fcbe885f3e | ||
|
|
e8406d0911 | ||
|
|
d2df983a39 | ||
|
|
ab95abbe5d | ||
|
|
00b220c466 | ||
|
|
b8bea516b7 | ||
|
|
b9f3209a2c | ||
|
|
cf1f33d440 | ||
|
|
68f26b5fd7 | ||
|
|
a3e515e062 | ||
|
|
2e183215bc | ||
|
|
f1f1b4b6e5 | ||
|
|
9ce4c57499 | ||
|
|
c32200b239 | ||
|
|
43fda83167 | ||
|
|
90b7a4a0b8 | ||
|
|
12e75133a0 | ||
|
|
e650bc6ac9 | ||
|
|
1e91a7d75b | ||
|
|
ef2728b6b7 | ||
|
|
12c55b4d4d | ||
|
|
be82e9fdb6 | ||
|
|
08eec301cf | ||
|
|
c0e25c8d7d | ||
|
|
6368c19417 | ||
|
|
ce9c6cd70c | ||
|
|
7694772ed2 | ||
|
|
1ed48d4191 | ||
|
|
17a8496b49 | ||
|
|
29cba9e58c | ||
|
|
d27b7b62e2 | ||
|
|
a841376b32 | ||
|
|
19b916b10e | ||
|
|
c81065f199 | ||
|
|
881b87a07c | ||
|
|
182da0df25 | ||
|
|
b4f8389ab2 | ||
|
|
732c6d9d94 | ||
|
|
41042d9ff7 | ||
|
|
e360fedee0 | ||
|
|
949cb28bdb | ||
|
|
f56efde542 | ||
|
|
7bb8a2294d | ||
|
|
a53ad5a283 | ||
|
|
6dc3ca6ec6 | ||
|
|
156ce8a520 | ||
|
|
a715202c54 | ||
|
|
b2b97bae44 | ||
|
|
ddc81f7629 | ||
|
|
e8af1c59f1 | ||
|
|
20e8a26e5f | ||
|
|
c4c52a2b9d | ||
|
|
a75c15bd23 | ||
|
|
ffb1eb5804 | ||
|
|
2673d214ce | ||
|
|
ec7e867937 | ||
|
|
e076d80eea | ||
|
|
4e0ab57fdd | ||
|
|
4a0eba1e56 | ||
|
|
c000725d18 | ||
|
|
3c854924e7 | ||
|
|
983fcaead5 | ||
|
|
d4223c3ff8 | ||
|
|
82f24f8d62 | ||
|
|
ef03c4d436 | ||
|
|
18a3196ff8 | ||
|
|
fe79593cd4 | ||
|
|
5b9137d76a | ||
|
|
011900324c | ||
|
|
31f6ea3211 | ||
|
|
10dac66425 | ||
|
|
cafbafde03 | ||
|
|
2c0e775278 | ||
|
|
b6a5549243 | ||
|
|
9aa8e0fee6 | ||
|
|
d3be7d37ea | ||
|
|
2589f597e2 | ||
|
|
10e8e7dc86 | ||
|
|
779a78f185 | ||
|
|
89ab5bc7f7 | ||
|
|
72cda6fbff | ||
|
|
36af3b3b36 | ||
|
|
618e3470d2 | ||
|
|
cdd618b97c | ||
|
|
65a105cd4c | ||
|
|
dc2b07f121 | ||
|
|
58bb0f6dba | ||
|
|
80e8079d74 | ||
|
|
5906ff8223 | ||
|
|
7dbc3e67ad | ||
|
|
f4b17d6dbf | ||
|
|
efa3ef68f0 | ||
|
|
257c74eeba | ||
|
|
f32b9c1276 | ||
|
|
1f3ce7cfab | ||
|
|
48deac08f8 | ||
|
|
5049a17c0c | ||
|
|
861f6791e9 | ||
|
|
f3f2cf899c | ||
|
|
1690d5f3ca | ||
|
|
12dc924ede | ||
|
|
3f8559f2c1 | ||
|
|
4f1d0db9b8 | ||
|
|
cd50789984 | ||
|
|
b56db3ce74 | ||
|
|
d8916dfa94 |
No files matched your search
@@ -1,14 +1,15 @@
|
||||
#
|
||||
# $Id: Makefile,v 1.109.2.18 1997/09/17 23:50:26 rgrimes Exp $
|
||||
# $Id: Makefile,v 1.109.2.24 1998/03/09 14:18:02 jkh Exp $
|
||||
#
|
||||
# Make command line options:
|
||||
# -DCLOBBER will remove /usr/include
|
||||
# -DMAKE_EBONES to build eBones (KerberosIV)
|
||||
# -DMAKE_KERBEROS4 to build KerberosIV
|
||||
# -DALLLANG to build documentation for all languages
|
||||
# (where available -- see share/doc/Makefile)
|
||||
#
|
||||
# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
|
||||
# -DNOCLEAN do not clean at all
|
||||
# -DNOTOOLS do not rebuild any tools first
|
||||
# -DNOCRYPT will prevent building of crypt versions
|
||||
# -DNOLKM do not build loadable kernel modules
|
||||
# -DNOOBJDIR do not run ``${MAKE} obj''
|
||||
@@ -17,6 +18,7 @@
|
||||
# -DNOGAMES do not go into games subdir
|
||||
# -DNOSHARE do not go into share subdir
|
||||
# -DNOINFO do not make or install info files
|
||||
# -DNOPERL do not make or install perl
|
||||
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
|
||||
|
||||
#
|
||||
@@ -39,6 +41,13 @@
|
||||
# Put initial settings here.
|
||||
SUBDIR=
|
||||
|
||||
# We must do share/info early so that installation of info `dir'
|
||||
# entries works correctly. Do it first since it is less likely to
|
||||
# grow dependencies on include and lib than vice versa.
|
||||
.if exists(share/info)
|
||||
SUBDIR+= share/info
|
||||
.endif
|
||||
|
||||
# We must do include and lib first so that the perl *.ph generation
|
||||
# works correctly as it uses the header files installed by this.
|
||||
.if exists(include)
|
||||
@@ -57,8 +66,8 @@ SUBDIR+= games
|
||||
.if exists(gnu)
|
||||
SUBDIR+= gnu
|
||||
.endif
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
SUBDIR+= eBones
|
||||
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
SUBDIR+= kerberosIV
|
||||
.endif
|
||||
.if exists(libexec)
|
||||
SUBDIR+= libexec
|
||||
@@ -146,7 +155,7 @@ world:
|
||||
cd ${.CURDIR} && ${MAKE} pre-world
|
||||
.endif
|
||||
cd ${.CURDIR} && ${MAKE} buildworld
|
||||
cd ${.CURDIR} && ${MAKE} installworld
|
||||
cd ${.CURDIR} && ${MAKE} -B installworld
|
||||
.if target(post-world)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@@ -209,14 +218,22 @@ buildworld:
|
||||
chflags -R noschg ${WORLDTMP}/
|
||||
rm -rf ${WORLDTMP}
|
||||
.endif
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making make"
|
||||
@echo "--------------------------------------------------------------"
|
||||
mkdir -p ${WORLDTMP}/usr/bin
|
||||
.if !defined(NOCLEAN) || !defined(NOOBJDIR)
|
||||
cd ${.CURDIR}/usr.bin/make && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all install clean cleandepend
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
cd ${.CURDIR}/usr.bin/make && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk depend && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean cleandepend
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making hierarchy"
|
||||
@@ -227,15 +244,16 @@ buildworld:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Cleaning up the obj tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} ${CLEANDIR}
|
||||
cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
|
||||
.endif
|
||||
.if !defined(NOOBJDIR)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding the obj tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} obj
|
||||
cd ${.CURDIR} && ${BMAKE} par-obj
|
||||
.endif
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding bootstrap tools"
|
||||
@@ -246,31 +264,36 @@ buildworld:
|
||||
@echo " Rebuilding tools necessary to build the include files"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} include-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/include"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding tools needed to build the libraries"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} lib-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/lib"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} libraries
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding all other tools needed to build the world"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} build-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding dependencies"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${XMAKE} depend
|
||||
cd ${.CURDIR} && ${XMAKE} ${.MAKEFLAGS} par-depend
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Building everything.."
|
||||
@@ -304,6 +327,11 @@ reinstall:
|
||||
cd ${.CURDIR} && ${MAKE} install
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Re-scanning the shared libraries.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ldconfig -R
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding man page indexes"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}/share/man && ${MAKE} makedb
|
||||
@@ -351,8 +379,8 @@ most:
|
||||
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all
|
||||
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all
|
||||
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
|
||||
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most
|
||||
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/kerberosIV && ${MAKE} ${.MAKEFLAGS} most
|
||||
#.endif
|
||||
#.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most
|
||||
@@ -376,8 +404,8 @@ installmost:
|
||||
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install
|
||||
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install
|
||||
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
|
||||
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/kerberos4 && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
#.endif
|
||||
#.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
@@ -413,11 +441,14 @@ bootstrap:
|
||||
cd ${.CURDIR}/include && make symlinks
|
||||
.endif
|
||||
cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR}
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB all && \
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
|
||||
.if !defined(NOOBJDIR)
|
||||
cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
|
||||
.endif
|
||||
@@ -431,8 +462,9 @@ bootstrap:
|
||||
# on cleaned away headers in ${WORLDTMP}.
|
||||
#
|
||||
include-tools:
|
||||
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
|
||||
#
|
||||
# includes - possibly generate and install the include files.
|
||||
@@ -443,17 +475,22 @@ includes:
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${DESTDIR}/usr/include
|
||||
.endif
|
||||
cd ${.CURDIR}/include && ${MAKE} all install
|
||||
cd ${.CURDIR}/include && ${MAKE} -B all install
|
||||
cd ${.CURDIR}/gnu/include && ${MAKE} install
|
||||
cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall
|
||||
.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
cd ${.CURDIR}/kerberosIV/lib/libacl && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkadm && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkafs && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkdb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkrb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
|
||||
.else
|
||||
cd ${.CURDIR}/lib/libtelnet && ${MAKE} beforeinstall
|
||||
.endif
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libalias && ${MAKE} beforeinstall
|
||||
@@ -498,7 +535,8 @@ lib-tools:
|
||||
usr.bin/ranlib \
|
||||
usr.bin/uudecode
|
||||
cd ${.CURDIR}/$d && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endfor
|
||||
|
||||
#
|
||||
@@ -507,43 +545,53 @@ lib-tools:
|
||||
libraries:
|
||||
.if exists(lib/csu/i386)
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libcompat)
|
||||
cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libncurses)
|
||||
cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libtermcap)
|
||||
cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(gnu)
|
||||
cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
|
||||
cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib)
|
||||
cd ${.CURDIR}/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(usr.bin/lex/lib)
|
||||
cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(usr.sbin/pcvt/keycap)
|
||||
cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
|
||||
#
|
||||
@@ -614,7 +662,25 @@ build-tools:
|
||||
usr.sbin/mtree \
|
||||
usr.sbin/zic
|
||||
cd ${.CURDIR}/$d && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endfor
|
||||
|
||||
.for __target in clean cleandir obj depend
|
||||
.for entry in ${SUBDIR}
|
||||
${entry}.${__target}__D: .PHONY
|
||||
if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
|
||||
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
|
||||
edir=${entry}.${MACHINE}; \
|
||||
cd ${.CURDIR}/$${edir}; \
|
||||
else \
|
||||
${ECHODIR} "===> ${DIRPRFX}${entry}"; \
|
||||
edir=${entry}; \
|
||||
cd ${.CURDIR}/$${edir}; \
|
||||
fi; \
|
||||
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
|
||||
.endfor
|
||||
par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
|
||||
.endfor
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -1,5 +1,5 @@
|
||||
This is the top level of the FreeBSD source directory. This file
|
||||
was last revised on: $Id: README,v 1.7 1997/01/01 14:06:29 jkh Exp $
|
||||
was last revised on: $Id: README,v 1.7.2.1 1997/08/13 19:49:35 jkh Exp $
|
||||
|
||||
For copyright information, please see the file COPYRIGHT in this
|
||||
directory (additional copyright information also exists for some
|
||||
@@ -14,10 +14,10 @@ kernel and the contents of /etc. Please see the top of the Makefile
|
||||
in this directory for more information on the standard build targets
|
||||
and compile-time flags.
|
||||
|
||||
Building a kernel with config(1) is a somewhat more involved process,
|
||||
Building a kernel with config(8) is a somewhat more involved process,
|
||||
documentation for which can be found at:
|
||||
http://www.freebsd.org/handbook/kernelconfig.html
|
||||
And in the config(1) man page.
|
||||
And in the config(8) man page.
|
||||
|
||||
The sample kernel configuration files reside in the sys/i386/conf
|
||||
sub-directory (assuming that you've installed the kernel sources), the
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* $Id: chio.c,v 1.1.1.1.2.1 1997/06/06 16:02:01 charnier Exp $ */
|
||||
/* $Id: chio.c,v 1.1.1.1.2.2 1997/08/24 10:29:16 jkh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Jason R. Thorpe <[email protected]>
|
||||
@@ -374,7 +374,7 @@ do_params(cname, argc, argv)
|
||||
|
||||
/* No arguments to this command. */
|
||||
if (argc) {
|
||||
warnx("%s: no arguements expected", cname);
|
||||
warnx("%s: no arguments expected", cname);
|
||||
goto usage;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)chmod.1 8.4 (Berkeley) 3/31/94
|
||||
.\" $Id: chmod.1,v 1.7 1997/02/22 14:01:29 peter Exp $
|
||||
.\" $Id: chmod.1,v 1.4.2.1 1997/02/28 07:54:25 mpp Exp $
|
||||
.\"
|
||||
.Dd March 31, 1994
|
||||
.Dt CHMOD 1
|
||||
@@ -110,10 +110,14 @@ the following values:
|
||||
.Bl -tag -width 6n -compact -offset indent
|
||||
.It Li 4000
|
||||
set-user-ID-on-execution
|
||||
( see
|
||||
.Xr chmod 2
|
||||
for directories )
|
||||
.It Li 2000
|
||||
set-group-ID-on-execution
|
||||
.It Li 1000
|
||||
sticky bit, see chmod(2)
|
||||
sticky bit, see
|
||||
.Xr chmod 2
|
||||
.It Li 0400
|
||||
read by owner
|
||||
.It Li 0200
|
||||
|
||||
+21
-6
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: utils.c,v 1.9 1996/03/08 06:58:08 wosch Exp $
|
||||
* $Id: utils.c,v 1.9.2.1 1997/08/24 10:34:49 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -60,7 +60,8 @@ copy_file(entp, dne)
|
||||
{
|
||||
static char buf[MAXBSIZE];
|
||||
struct stat to_stat, *fs;
|
||||
int ch, checkch, from_fd, rcount, rval, to_fd, wcount;
|
||||
int ch, checkch, from_fd, rcount, rval, to_fd, wcount, wresid;
|
||||
char *bufp;
|
||||
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
|
||||
char *p;
|
||||
#endif
|
||||
@@ -81,13 +82,16 @@ copy_file(entp, dne)
|
||||
* modified by the umask.)
|
||||
*/
|
||||
if (!dne) {
|
||||
#define YESNO "(y/n [n]) "
|
||||
if (iflag) {
|
||||
(void)fprintf(stderr, "overwrite %s? ", to.p_path);
|
||||
(void)fprintf(stderr, "overwrite %s? %s",
|
||||
to.p_path, YESNO);
|
||||
checkch = ch = getchar();
|
||||
while (ch != '\n' && ch != EOF)
|
||||
ch = getchar();
|
||||
if (checkch != 'y' && checkch != 'Y') {
|
||||
(void)close(from_fd);
|
||||
(void)fprintf(stderr, "not overwritten\n");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@@ -125,7 +129,13 @@ copy_file(entp, dne)
|
||||
warn("%s", entp->fts_path);
|
||||
rval = 1;
|
||||
} else {
|
||||
if (write(to_fd, p, fs->st_size) != fs->st_size) {
|
||||
for (bufp = p, wresid = fs->st_size; ;
|
||||
bufp += wcount, wresid -= wcount) {
|
||||
wcount = write(to_fd, bufp, wresid);
|
||||
if (wcount >= wresid || wcount <= 0)
|
||||
break;
|
||||
}
|
||||
if (wcount != wresid) {
|
||||
warn("%s", to.p_path);
|
||||
rval = 1;
|
||||
}
|
||||
@@ -139,8 +149,13 @@ copy_file(entp, dne)
|
||||
#endif
|
||||
{
|
||||
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
|
||||
wcount = write(to_fd, buf, rcount);
|
||||
if (rcount != wcount || wcount == -1) {
|
||||
for (bufp = buf, wresid = rcount; ;
|
||||
bufp += wcount, wresid -= wcount) {
|
||||
wcount = write(to_fd, bufp, wresid);
|
||||
if (wcount >= wresid || wcount <= 0)
|
||||
break;
|
||||
}
|
||||
if (wcount != wresid) {
|
||||
warn("%s", to.p_path);
|
||||
rval = 1;
|
||||
break;
|
||||
|
||||
+3
-2
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: csh.c,v 1.6 1995/10/23 23:08:25 ache Exp $
|
||||
* $Id: csh.c,v 1.6.2.1 1997/08/24 21:41:29 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -46,6 +46,7 @@ static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
@@ -229,7 +230,7 @@ main(argc, argv)
|
||||
*/
|
||||
set(STRstatus, Strsave(STR0));
|
||||
|
||||
if ((tcp = getenv("HOME")) != NULL)
|
||||
if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < MAXPATHLEN)
|
||||
cp = SAVE(tcp);
|
||||
else
|
||||
cp = NULL;
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: err.c,v 1.2 1994/09/24 02:53:57 davidg Exp $
|
||||
* $Id: err.c,v 1.2.8.1 1997/08/24 21:41:31 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -307,7 +307,7 @@ seterror(id, va_alist)
|
||||
#endif
|
||||
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
||||
id = ERR_INVALID;
|
||||
vsprintf(berr, errorlist[id], va);
|
||||
vsnprintf(berr, sizeof(berr), errorlist[id], va);
|
||||
va_end(va);
|
||||
|
||||
seterr = strsave(berr);
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: file.c,v 1.4 1995/06/18 14:08:44 ache Exp $
|
||||
* $Id: file.c,v 1.4.2.1 1997/08/24 21:41:33 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -450,7 +450,7 @@ tsearch(word, command, max_word_length)
|
||||
|
||||
looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
|
||||
if (looking_for_lognames) {
|
||||
(void) setpwent();
|
||||
setpwent();
|
||||
copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
|
||||
dir_fd = NULL;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ again: /* search for matches */
|
||||
ignoring = FALSE;
|
||||
nignored = 0;
|
||||
if (looking_for_lognames)
|
||||
(void) setpwent();
|
||||
setpwent();
|
||||
else
|
||||
rewinddir(dir_fd);
|
||||
goto again;
|
||||
|
||||
+3
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: proc.c,v 1.2 1994/09/24 02:54:13 davidg Exp $
|
||||
* $Id: proc.c,v 1.2.8.1 1997/08/24 21:41:37 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -86,6 +86,7 @@ pchild(notused)
|
||||
struct process *fp;
|
||||
int pid;
|
||||
extern int insource;
|
||||
int save_errno = errno;
|
||||
union wait w;
|
||||
int jobflags;
|
||||
struct rusage ru;
|
||||
@@ -101,6 +102,7 @@ loop:
|
||||
goto loop;
|
||||
}
|
||||
pnoprocesses = pid == -1;
|
||||
errno = save_errno;
|
||||
return;
|
||||
}
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||
|
||||
+6
-6
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
|
||||
.\" $Id: date.1,v 1.8.2.4 1997/09/14 13:07:03 jkh Exp $
|
||||
.\" $Id: date.1,v 1.8.2.6 1997/10/03 12:54:28 danny Exp $
|
||||
.\"
|
||||
.Dd November 17, 1993
|
||||
.Dt DATE 1
|
||||
@@ -43,14 +43,14 @@
|
||||
.Nd display or set date and time
|
||||
.Sh SYNOPSIS
|
||||
.Nm date
|
||||
.Op Fl nu
|
||||
.Op Fl d Ar dst
|
||||
.Op Fl r Ar seconds
|
||||
.Op Fl t Ar minutes_west
|
||||
.Op Fl nu
|
||||
.Op Cm + Ns Ar format
|
||||
.Op Fl v Ar [+|-]val[ymwdHM]
|
||||
.Op Fl v Ns Ar [+|-]val Ns Op ymwdHM
|
||||
.Ar ...
|
||||
.Op Fl f Ar fmt Ar date | [[[[yy]mm]dd]HH]MM[\&.ss]
|
||||
.Op Cm + Ns Ar format
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
displays the current date and time when invoked without arguments.
|
||||
@@ -183,12 +183,12 @@ and years are handled automatically.
|
||||
.Sh EXAMPLES
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date ``+DATE: %m/%d/%y%nTIME: %H:%M:%S''
|
||||
date "+DATE: 19%y-%m-%d%nTIME: %H:%M:%S"
|
||||
.Ed
|
||||
.Pp
|
||||
will display:
|
||||
.Bd -literal -offset indent
|
||||
DATE: 11/21/87
|
||||
DATE: 1987-11-21
|
||||
TIME: 13:36:16
|
||||
.Ed
|
||||
.Pp
|
||||
|
||||
+6
-5
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: date.c,v 1.7.2.5 1997/10/01 06:12:58 danny Exp $
|
||||
* $Id: date.c,v 1.7.2.6 1997/10/03 12:54:30 danny Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -187,9 +187,9 @@ setthetime(fmt, p)
|
||||
lt = localtime(&tval);
|
||||
return;
|
||||
} else if (*t != '\0')
|
||||
fprintf(stderr, "Warning: Ignoring %d extraneous"
|
||||
fprintf(stderr, "Warning: Ignoring %ld extraneous"
|
||||
" characters in date string (%s)\n",
|
||||
strlen(t), t);
|
||||
(long) strlen(t), t);
|
||||
} else {
|
||||
for (t = p, dot = NULL; *t; ++t) {
|
||||
if (isdigit(*t))
|
||||
@@ -276,7 +276,8 @@ static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format]",
|
||||
" [-v [+|-]val[ymwdHM]] ... [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]]");
|
||||
"usage: date [-nu] [-d dst] [-r seconds] [-t west] "
|
||||
"[-v[+|-]val[ymwdHM]] ... ",
|
||||
" [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]] [+format]");
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,3 +1,31 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Brian Somers <[email protected]>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Brian Somers <[email protected]>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
struct vary {
|
||||
char *arg;
|
||||
struct vary *next;
|
||||
|
||||
+4
-1
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: args.c,v 1.3.8.1 1996/11/21 16:30:28 phk Exp $
|
||||
* $Id: args.c,v 1.3.8.2 1997/08/24 21:45:26 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -101,6 +101,8 @@ jcl(argv)
|
||||
in.dbsz = out.dbsz = 512;
|
||||
|
||||
while ((oper = *++argv) != NULL) {
|
||||
if ((oper = strdup(oper)) == NULL)
|
||||
errx(1, "unable to allocate space for the argument \"%s\"", *argv);
|
||||
if ((arg = strchr(oper, '=')) == NULL)
|
||||
errx(1, "unknown operand %s", oper);
|
||||
*arg++ = '\0';
|
||||
@@ -282,6 +284,7 @@ static struct conv {
|
||||
{ "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V },
|
||||
{ "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V },
|
||||
{ "osync", C_OSYNC, C_BS, NULL },
|
||||
{ "sparse", C_SPARSE, 0, NULL },
|
||||
{ "swab", C_SWAB, 0, NULL },
|
||||
{ "sync", C_SYNC, 0, NULL },
|
||||
{ "ucase", C_UCASE, C_LCASE, NULL },
|
||||
|
||||
+8
-1
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
|
||||
.\" $Id: dd.1,v 1.2.8.1 1997/02/28 07:54:33 mpp Exp $
|
||||
.\" $Id: dd.1,v 1.2.8.2 1997/08/24 21:45:30 jkh Exp $
|
||||
.\"
|
||||
.Dd January 13, 1994
|
||||
.Dt DD 1
|
||||
@@ -250,6 +250,13 @@ regularly sized blocks to be written.
|
||||
This option is incompatible with use of the
|
||||
.Cm bs= Ns Ar n
|
||||
block size specification.
|
||||
.It Cm sparse
|
||||
If one or more output blocks would consist solely of
|
||||
.Tn NUL
|
||||
bytes, try to seek the output file by the required space instead of
|
||||
filling them with
|
||||
.Tn NULs ,
|
||||
resulting in a sparse file.
|
||||
.It Cm swab
|
||||
Swap every pair of input bytes.
|
||||
If an input buffer has an odd number of bytes, the last byte will be
|
||||
|
||||
+34
-5
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: dd.c,v 1.5.2.2 1997/08/21 02:52:39 jlemon Exp $
|
||||
* $Id: dd.c,v 1.5.2.4 1998/01/09 09:13:06 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -75,6 +75,7 @@ IO in, out; /* input/output state */
|
||||
STAT st; /* statistics */
|
||||
void (*cfunc) __P((void)); /* conversion function */
|
||||
u_long cpy_cnt; /* # of blocks to copy */
|
||||
u_long pending = 0; /* pending seek if sparse */
|
||||
u_int ddflags; /* conversion options */
|
||||
u_int cbsz; /* conversion block size */
|
||||
u_int files_cnt = 1; /* # of files to copy */
|
||||
@@ -315,7 +316,7 @@ dd_in()
|
||||
}
|
||||
|
||||
if (ddflags & C_SWAB) {
|
||||
if ((n = in.dbcnt) & 1) {
|
||||
if ((n = in.dbrcnt) & 1) {
|
||||
++st.swab;
|
||||
--n;
|
||||
}
|
||||
@@ -347,7 +348,7 @@ dd_close()
|
||||
memset(out.dbp, 0, out.dbsz - out.dbcnt);
|
||||
out.dbcnt = out.dbsz;
|
||||
}
|
||||
if (out.dbcnt)
|
||||
if (out.dbcnt || pending)
|
||||
dd_out(1);
|
||||
}
|
||||
|
||||
@@ -356,7 +357,7 @@ dd_out(force)
|
||||
int force;
|
||||
{
|
||||
static int warned;
|
||||
int cnt, n, nw;
|
||||
int cnt, n, nw, i, sparse;
|
||||
u_char *outp;
|
||||
|
||||
/*
|
||||
@@ -378,7 +379,35 @@ dd_out(force)
|
||||
outp = out.db;
|
||||
for (n = force ? out.dbcnt : out.dbsz;; n = out.dbsz) {
|
||||
for (cnt = n;; cnt -= nw) {
|
||||
nw = write(out.fd, outp, cnt);
|
||||
sparse = 0;
|
||||
if (ddflags & C_SPARSE) {
|
||||
sparse = 1; /* Is buffer sparse? */
|
||||
for (i = 0; i < cnt; i++)
|
||||
if (outp[i] != 0) {
|
||||
sparse = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sparse && !force) {
|
||||
pending += cnt;
|
||||
nw = cnt;
|
||||
} else {
|
||||
if (pending != 0) {
|
||||
if (force)
|
||||
pending--;
|
||||
if (lseek (out.fd, pending, SEEK_CUR) == -1)
|
||||
err(2, "%s: seek error creating sparse file",
|
||||
out.name);
|
||||
if (force)
|
||||
write(out.fd, outp, 1);
|
||||
pending = 0;
|
||||
}
|
||||
if (cnt)
|
||||
nw = write(out.fd, outp, cnt);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (nw <= 0) {
|
||||
if (nw == 0)
|
||||
errx(1, "%s: end of device", out.name);
|
||||
|
||||
+3
-2
@@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)dd.h 8.3 (Berkeley) 4/2/94
|
||||
* $Id: dd.h,v 1.2 1994/09/24 02:54:54 davidg Exp $
|
||||
* $Id: dd.h,v 1.2.8.2 1998/02/11 02:24:40 asami Exp $
|
||||
*/
|
||||
|
||||
/* Input/output stream state. */
|
||||
@@ -69,7 +69,7 @@ typedef struct {
|
||||
u_long out_part; /* # of partial output blocks */
|
||||
u_long trunc; /* # of truncated records */
|
||||
u_long swab; /* # of odd-length swab blocks */
|
||||
u_long bytes; /* # of bytes written */
|
||||
u_int64_t bytes; /* # of bytes written */
|
||||
double start; /* start time of dd */
|
||||
} STAT;
|
||||
|
||||
@@ -95,3 +95,4 @@ typedef struct {
|
||||
#define C_UCASE 0x40000
|
||||
#define C_UNBLOCK 0x80000
|
||||
#define C_OSYNC 0x100000
|
||||
#define C_SPARSE 0x200000
|
||||
+5
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: misc.c,v 1.2.8.1 1996/11/21 16:30:35 phk Exp $
|
||||
* $Id: misc.c,v 1.2.8.3 1998/02/11 02:24:41 asami Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -45,6 +45,7 @@ static char const sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -81,7 +82,7 @@ summary()
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
(void)snprintf(buf, sizeof(buf),
|
||||
"%u bytes transferred in %.6f secs (%.0f bytes/sec)\n",
|
||||
"%qu bytes transferred in %.6f secs (%.0f bytes/sec)\n",
|
||||
st.bytes, secs, st.bytes / secs);
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
@@ -91,8 +92,10 @@ void
|
||||
summaryx(notused)
|
||||
int notused;
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
summary();
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)df.1 8.2 (Berkeley) 1/13/94
|
||||
.\" $Id: df.1,v 1.4.2.1 1996/12/13 17:15:10 joerg Exp $
|
||||
.\" $Id: df.1,v 1.4.2.2 1997/09/19 06:18:10 charnier Exp $
|
||||
.\"
|
||||
.Dd January 13, 1994
|
||||
.Dt DF 1
|
||||
@@ -96,7 +96,7 @@ or
|
||||
``df -t local -t nomfs''
|
||||
will display statistics for UFS and LFS filesystems.
|
||||
.El
|
||||
.Sh ENVIRONMENTAL VARIABLES
|
||||
.Sh ENVIRONMENT VARIABLES
|
||||
.Bl -tag -width BLOCKSIZE
|
||||
.It Ev BLOCKSIZE
|
||||
If the environment variable
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: df.c,v 1.8 1996/01/14 18:55:09 bde Exp $
|
||||
* $Id: df.c,v 1.8.2.1 1996/12/13 17:15:11 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -129,7 +129,7 @@ main(argc, argv)
|
||||
iflag = nflag = tflag = 0;
|
||||
fsmask = MT_NONE;
|
||||
|
||||
while ((ch = getopt(argc, argv, "iknt:")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "iknt:")) != -1)
|
||||
switch (ch) {
|
||||
case 'i':
|
||||
iflag = 1;
|
||||
|
||||
+11
-3
@@ -24,11 +24,15 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: buf.c,v 1.7 1995/05/30 00:06:43 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
|
||||
#if 0
|
||||
static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
|
||||
#else
|
||||
static char * const rcsid =
|
||||
"$Id: buf.c,v 1.15 1997/12/31 12:25:33 helbig Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/file.h>
|
||||
@@ -264,6 +268,10 @@ init_buffers()
|
||||
hello, world
|
||||
EOF */
|
||||
setbuffer(stdin, stdinbuf, 1);
|
||||
|
||||
/* Ensure stdout is line buffered. This avoids bogus delays
|
||||
of output if stdout is piped through utilities to a terminal. */
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
if (open_sbuf() < 0)
|
||||
quit(2);
|
||||
REQUE(&buffer_head, &buffer_head);
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
.\" $Id: ed.1,v 1.8 1996/10/05 22:26:02 wosch Exp $
|
||||
.\" $Id: ed.1,v 1.12 1997/12/31 12:25:35 helbig Exp $
|
||||
.TH ED 1 "21 May 1993"
|
||||
.SH NAME
|
||||
.\" ed, red \- text editor
|
||||
@@ -820,7 +820,7 @@ are treated as a single command by undo.
|
||||
is its own inverse.
|
||||
|
||||
.TP 8
|
||||
.RI (1,$)v /pat/command-list
|
||||
.RI (1,$)v /re/command-list
|
||||
Applies
|
||||
.I command-list
|
||||
to each of the addressed lines not matching a regular expression
|
||||
|
||||
+1
-2
@@ -25,10 +25,9 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp
|
||||
* $Id: ed.h,v 1.7 1994/09/24 02:55:25 davidg Exp $
|
||||
* $Id: ed.h,v 1.8 1994/11/03 21:46:55 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#include <errno.h>
|
||||
#if defined(sun) || defined(__NetBSD__)
|
||||
|
||||
+8
-3
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.6 1996/08/11 16:48:11 ache Exp $
|
||||
* $Id: main.c,v 1.6.2.1 1997/08/24 21:50:21 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -1355,7 +1355,8 @@ signal_hup(signo)
|
||||
{
|
||||
if (mutex)
|
||||
sigflags |= (1 << (signo - 1));
|
||||
else handle_hup(signo);
|
||||
else
|
||||
handle_hup(signo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1365,7 +1366,8 @@ signal_int(signo)
|
||||
{
|
||||
if (mutex)
|
||||
sigflags |= (1 << (signo - 1));
|
||||
else handle_int(signo);
|
||||
else
|
||||
handle_int(signo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1415,6 +1417,8 @@ void
|
||||
handle_winch(signo)
|
||||
int signo;
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
struct winsize ws; /* window size structure */
|
||||
|
||||
sigflags &= ~(1 << (signo - 1));
|
||||
@@ -1422,6 +1426,7 @@ handle_winch(signo)
|
||||
if (ws.ws_row > 2) rows = ws.ws_row - 2;
|
||||
if (ws.ws_col > 8) cols = ws.ws_col - 8;
|
||||
}
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)ls.1 8.6 (Berkeley) 4/18/94
|
||||
.\" $Id: ls.1,v 1.5.2.3 1997/03/26 17:55:17 obrien Exp $
|
||||
.\" $Id: ls.1,v 1.5.2.4 1997/09/19 06:18:11 charnier Exp $
|
||||
.\"
|
||||
.Dd April 18, 1994
|
||||
.Dt LS 1
|
||||
@@ -265,7 +265,7 @@ and setgroup-ID mode is set.
|
||||
The file is executable or the directory is
|
||||
searchable.
|
||||
.It Sy \-
|
||||
The file is neither readable, writeable, executable,
|
||||
The file is neither readable, writable, executable,
|
||||
nor set-user-ID nor set-group-ID mode, nor sticky. (See below.)
|
||||
.El
|
||||
.Pp
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ls.c,v 1.9 1995/10/26 10:56:38 ache Exp $
|
||||
* $Id: ls.c,v 1.10 1996/08/27 21:51:48 adam Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -131,7 +131,7 @@ main(argc, argv)
|
||||
f_listdot = 1;
|
||||
|
||||
fts_options = FTS_PHYSICAL;
|
||||
while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != EOF) {
|
||||
while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != -1) {
|
||||
switch (ch) {
|
||||
/*
|
||||
* The -1, -C and -l options all override each other so shell
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $Id: mv.1,v 1.6 1996/02/20 23:27:54 wosch Exp $
|
||||
.\" $Id: mv.1,v 1.7 1996/08/29 18:06:04 wosch Exp $
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt MV 1
|
||||
@@ -47,7 +47,7 @@
|
||||
.Ar source target
|
||||
.Nm mv
|
||||
.Op Fl f | Fl i
|
||||
.Ar source ... source directory
|
||||
.Ar source ... directory
|
||||
.Sh DESCRIPTION
|
||||
.Pp
|
||||
In its first form, the
|
||||
|
||||
+30
-12
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mv.c,v 1.8 1996/03/01 06:14:13 wosch Exp $
|
||||
* $Id: mv.c,v 1.8.2.1 1997/08/25 08:33:11 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -50,6 +50,7 @@ static char const sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
@@ -142,7 +143,7 @@ do_move(from, to)
|
||||
char *from, *to;
|
||||
{
|
||||
struct stat sb;
|
||||
int ask, ch;
|
||||
int ask, ch, first;
|
||||
char modep[15];
|
||||
|
||||
/*
|
||||
@@ -157,30 +158,47 @@ do_move(from, to)
|
||||
warn("%s", from);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
#define YESNO "(y/n [n]) "
|
||||
ask = 0;
|
||||
if (iflg) {
|
||||
(void)fprintf(stderr, "overwrite %s? ", to);
|
||||
(void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
|
||||
ask = 1;
|
||||
} else if (access(to, W_OK) && !stat(to, &sb)) {
|
||||
strmode(sb.st_mode, modep);
|
||||
(void)fprintf(stderr, "override %s%s%s/%s for %s? ",
|
||||
(void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
|
||||
modep + 1, modep[9] == ' ' ? "" : " ",
|
||||
user_from_uid(sb.st_uid, 0),
|
||||
group_from_gid(sb.st_gid, 0), to);
|
||||
group_from_gid(sb.st_gid, 0), to, YESNO);
|
||||
ask = 1;
|
||||
}
|
||||
if (ask) {
|
||||
if ((ch = getchar()) != EOF && ch != '\n')
|
||||
while (getchar() != '\n');
|
||||
if (ch != 'y' && ch != 'Y')
|
||||
first = ch = getchar();
|
||||
while (ch != '\n' && ch != EOF)
|
||||
ch = getchar();
|
||||
if (first != 'y' && first != 'Y') {
|
||||
(void)fprintf(stderr, "not overwritten\n");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!rename(from, to))
|
||||
return (0);
|
||||
|
||||
if (errno != EXDEV) {
|
||||
if (errno == EXDEV) {
|
||||
struct statfs sfs;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
/* Can't mv(1) a mount point. */
|
||||
if (realpath(from, path) == NULL) {
|
||||
warnx("cannot resolve %s: %s", from, path);
|
||||
return (1);
|
||||
}
|
||||
if (!statfs(path, &sfs) && !strcmp(path, sfs.f_mntonname)) {
|
||||
warnx("cannot rename a mount point");
|
||||
return (1);
|
||||
}
|
||||
} else {
|
||||
warn("rename %s to %s", from, to);
|
||||
return (1);
|
||||
}
|
||||
@@ -327,7 +345,7 @@ void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: mv [-f | -i] src target",
|
||||
" mv [-f | -i] src1 ... srcN directory");
|
||||
"usage: mv [-f | -i] source target",
|
||||
" mv [-f | -i] source ... directory");
|
||||
exit(1);
|
||||
}
|
||||
+1
-3
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ar_io.c,v 1.4.2.1 1997/08/25 08:36:50 jkh Exp $
|
||||
* $Id: ar_io.c,v 1.4.2.2 1997/09/14 13:07:09 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,11 +42,9 @@ static char const sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mtio.h>
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
+2
-3
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ar_subs.c,v 1.4.2.1 1997/08/25 08:36:51 jkh Exp $
|
||||
* $Id: ar_subs.c,v 1.4.2.2 1997/09/14 13:07:11 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -743,7 +742,7 @@ copy()
|
||||
* set up the destination dir path and make sure it is a directory. We
|
||||
* make sure we have a trailing / on the destination
|
||||
*/
|
||||
dlen = l_strncpy(dirbuf, dirptr, PAXPATHLEN);
|
||||
dlen = l_strncpy(dirbuf, dirptr, sizeof(dirbuf) - 1);
|
||||
dest_pt = dirbuf + dlen;
|
||||
if (*(dest_pt-1) != '/') {
|
||||
*dest_pt++ = '/';
|
||||
|
||||
+1
-4
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: buf_subs.c,v 1.4.2.1 1997/08/25 08:36:52 jkh Exp $
|
||||
* $Id: buf_subs.c,v 1.4.2.2 1997/09/14 13:07:13 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,10 +42,7 @@ static char const sccsid[] = "@(#)buf_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+1
-3
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cache.c,v 1.3.2.2 1997/08/25 08:36:54 jkh Exp $
|
||||
* $Id: cache.c,v 1.3.2.3 1997/09/14 13:07:15 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,9 +42,7 @@ static char const sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cpio.c,v 1.4.2.1 1997/08/25 08:36:55 jkh Exp $
|
||||
* $Id: cpio.c,v 1.4.2.2 1997/09/14 13:07:17 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)cpio.c 8.1 (Berkeley) 5/31/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: file_subs.c,v 1.4.2.1 1997/08/25 08:36:56 jkh Exp $
|
||||
* $Id: file_subs.c,v 1.4.2.2 1997/09/14 13:07:21 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -45,7 +45,6 @@ static char const sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ftree.c,v 1.4.2.1 1997/08/25 08:36:57 jkh Exp $
|
||||
* $Id: ftree.c,v 1.4.2.2 1997/09/14 13:07:23 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: gen_subs.c,v 1.6 1995/10/23 21:23:14 ache Exp $
|
||||
* $Id: gen_subs.c,v 1.6.2.1 1997/08/25 08:37:00 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)gen_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <utmp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+1
-3
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: options.c,v 1.4.2.1 1997/08/25 08:37:01 jkh Exp $
|
||||
* $Id: options.c,v 1.4.2.2 1997/09/14 13:07:25 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,10 +42,8 @@ static char const sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mtio.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+1
-3
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pat_rep.c,v 1.5.2.2 1997/08/25 08:37:02 jkh Exp $
|
||||
* $Id: pat_rep.c,v 1.5.2.3 1997/09/14 13:07:27 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,9 +42,7 @@ static char const sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+5
-6
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pax.c,v 1.5.2.1 1997/08/25 08:37:03 jkh Exp $
|
||||
* $Id: pax.c,v 1.5.2.2 1997/09/14 13:07:29 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -47,17 +47,16 @@ static char const copyright[] =
|
||||
static char const sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "pax.h"
|
||||
#include "extern.h"
|
||||
static int gen_init __P((void));
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sel_subs.c,v 1.3.2.1 1997/08/25 08:37:04 jkh Exp $
|
||||
* $Id: sel_subs.c,v 1.3.2.2 1997/09/14 13:07:33 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)sel_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+3
-4
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tables.c,v 1.4.2.2 1997/08/25 08:37:05 jkh Exp $
|
||||
* $Id: tables.c,v 1.4.2.3 1997/09/14 13:07:34 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,13 +44,12 @@ static char const sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "pax.h"
|
||||
#include "tables.h"
|
||||
#include "extern.h"
|
||||
|
||||
+1
-2
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tar.c,v 1.4.2.1 1997/08/25 08:37:05 jkh Exp $
|
||||
* $Id: tar.c,v 1.4.2.2 1997/09/14 13:07:35 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -44,7 +44,6 @@ static char const sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+1
-4
@@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: tty_subs.c,v 1.3.2.1 1997/08/25 08:37:06 jkh Exp $
|
||||
* $Id: tty_subs.c,v 1.3.2.2 1997/09/14 13:07:37 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -42,12 +42,9 @@ static char const sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
+8
-2
@@ -1,9 +1,15 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/2/93
|
||||
# $Id: Makefile,v 1.6 1995/10/25 15:07:38 torstenb Exp $
|
||||
# $Id: Makefile,v 1.6.2.1 1997/10/16 12:44:17 mckay Exp $
|
||||
|
||||
PROG= ps
|
||||
SRCS= fmt.c keyword.c nlist.c print.c ps.c
|
||||
CFLAGS+=-I${.CURDIR}/../../sys
|
||||
#
|
||||
# To support "lazy" ps for non root/wheel users
|
||||
# add -DLAZY_PS to the cflags. This helps
|
||||
# keep ps from being an unnecessary load
|
||||
# on large systems.
|
||||
#
|
||||
CFLAGS+=-I${.CURDIR}/../../sys -DLAZY_PS
|
||||
DPADD= ${LIBM} ${LIBKVM}
|
||||
LDADD= -lm -lkvm
|
||||
BINGRP= kmem
|
||||
|
||||
+4
-2
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $Id: ps.1,v 1.11 1996/10/21 07:30:25 peter Exp $
|
||||
.\" $Id: ps.1,v 1.11.2.1 1997/08/21 02:54:28 jlemon Exp $
|
||||
.\"
|
||||
.Dd April 18, 1994
|
||||
.Dt PS 1
|
||||
@@ -40,7 +40,7 @@
|
||||
.Nd process status
|
||||
.Sh SYNOPSIS
|
||||
.Nm \&ps
|
||||
.Op Fl aCcehjlmrSTuvwx
|
||||
.Op Fl aCcefhjlmrSTuvwx
|
||||
.Op Fl M Ar core
|
||||
.Op Fl N Ar system
|
||||
.Op Fl O Ar fmt
|
||||
@@ -88,6 +88,8 @@ cpu calculation that ignores ``resident'' time (this normally has
|
||||
no effect).
|
||||
.It Fl e
|
||||
Display the environment as well.
|
||||
.It Fl f
|
||||
Work harder to get detailed process information.
|
||||
.It Fl h
|
||||
Repeat the information header as often as necessary to guarantee one
|
||||
header per page of information.
|
||||
|
||||
+32
-6
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ps.c,v 1.13.2.1 1996/11/11 21:23:15 phk Exp $
|
||||
* $Id: ps.c,v 1.13.2.2 1997/06/06 16:09:12 charnier Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -84,6 +84,12 @@ int totwidth; /* calculated width of requested variables */
|
||||
|
||||
static int needuser, needcomm, needenv;
|
||||
|
||||
#if defined(LAZY_PS)
|
||||
static int forceuread=0;
|
||||
#else
|
||||
static int forceuread=1;
|
||||
#endif
|
||||
|
||||
enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
|
||||
|
||||
static char *fmt __P((char **(*)(kvm_t *, const struct kinfo_proc *, int),
|
||||
@@ -139,7 +145,11 @@ main(argc, argv)
|
||||
ttydev = NODEV;
|
||||
memf = nlistf = swapf = NULL;
|
||||
while ((ch = getopt(argc, argv,
|
||||
#if defined(LAZY_PS)
|
||||
"aCcefghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != EOF)
|
||||
#else
|
||||
"aCceghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != EOF)
|
||||
#endif
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
all = 1;
|
||||
@@ -153,6 +163,12 @@ main(argc, argv)
|
||||
case 'e': /* XXX set ufmt */
|
||||
needenv = 1;
|
||||
break;
|
||||
#if defined(LAZY_PS)
|
||||
case 'f':
|
||||
if (getuid() == 0 || getgid() == 0)
|
||||
forceuread = 1;
|
||||
break;
|
||||
#endif
|
||||
case 'g':
|
||||
break; /* no-op */
|
||||
case 'h':
|
||||
@@ -393,6 +409,8 @@ fmt(fn, ki, comm, maxlen)
|
||||
return (s);
|
||||
}
|
||||
|
||||
#define UREADOK(ki) (forceuread || (KI_PROC(ki)->p_flag & P_INMEM))
|
||||
|
||||
static void
|
||||
saveuser(ki)
|
||||
KINFO *ki;
|
||||
@@ -402,7 +420,7 @@ saveuser(ki)
|
||||
struct user *u_addr = (struct user *)USRSTACK;
|
||||
|
||||
usp = &ki->ki_u;
|
||||
if (kvm_uread(kd, KI_PROC(ki), (unsigned long)&u_addr->u_stats,
|
||||
if (UREADOK(ki) && kvm_uread(kd, KI_PROC(ki), (unsigned long)&u_addr->u_stats,
|
||||
(char *)&pstats, sizeof(pstats)) == sizeof(pstats)) {
|
||||
/*
|
||||
* The u-area might be swapped out, and we can't get
|
||||
@@ -419,15 +437,23 @@ saveuser(ki)
|
||||
/*
|
||||
* save arguments if needed
|
||||
*/
|
||||
if (needcomm)
|
||||
if (needcomm && UREADOK(ki)) {
|
||||
ki->ki_args = fmt(kvm_getargv, ki, KI_PROC(ki)->p_comm,
|
||||
MAXCOMLEN);
|
||||
else
|
||||
} else if (needcomm) {
|
||||
ki->ki_args = malloc(strlen(KI_PROC(ki)->p_comm) + 3);
|
||||
sprintf(ki->ki_args, "(%s)", KI_PROC(ki)->p_comm);
|
||||
} else {
|
||||
ki->ki_args = NULL;
|
||||
if (needenv)
|
||||
}
|
||||
if (needenv && UREADOK(ki)) {
|
||||
ki->ki_env = fmt(kvm_getenvv, ki, (char *)NULL, 0);
|
||||
else
|
||||
} else if (needenv) {
|
||||
ki->ki_env = malloc(3);
|
||||
strcpy(ki->ki_env, "()");
|
||||
} else {
|
||||
ki->ki_env = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
+10
-8
@@ -1,23 +1,25 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 7/19/93
|
||||
# $Id: Makefile,v 1.4 1994/09/29 13:06:00 csgr Exp $
|
||||
# $Id$
|
||||
|
||||
PROG= rcp
|
||||
SRCS= rcp.c util.c
|
||||
CFLAGS+=-Wall
|
||||
|
||||
|
||||
.if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \
|
||||
|| defined(MAKE_EBONES))
|
||||
SRCS+= kcmd.c krcmd.c
|
||||
CFLAGS+=-DKERBEROS -DCRYPT
|
||||
.if exists(${DESTDIR}/usr/lib/libkrb.a) && defined(MAKE_KERBEROS4)
|
||||
SRCS+= krcmd.c kcmd.c rcmd_util.c encrypt.c
|
||||
DPADD= ${LIBKRB} ${LIBDES}
|
||||
CFLAGS+=-DKERBEROS -DCRYPT -DHAVE_CONFIG_H \
|
||||
-I${.CURDIR}/../../kerberosIV/include \
|
||||
-I${.CURDIR}/../../crypto/kerberosIV/include \
|
||||
-I${.CURDIR}/../../crypto/kerberosIV/lib/roken \
|
||||
-I${.CURDIR}/../../crypto/kerberosIV/appl/bsd
|
||||
LDADD= -lkrb -ldes
|
||||
DISTRIBUTION= krb
|
||||
.PATH: ${.CURDIR}/../../crypto/kerberosIV/appl/bsd
|
||||
.endif
|
||||
|
||||
BINOWN= root
|
||||
BINMODE=4555
|
||||
INSTALLFLAGS=-fschg
|
||||
|
||||
.PATH: ${.CURDIR}/../../usr.bin/rlogin
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
+4
-4
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rcp.c,v 1.8.2.2 1997/06/06 16:11:15 charnier Exp $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -70,9 +70,9 @@ static char const sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94";
|
||||
|
||||
#ifdef KERBEROS
|
||||
#include <des.h>
|
||||
#include <kerberosIV/krb.h>
|
||||
#include <krb.h>
|
||||
|
||||
#include "../../usr.bin/rlogin/krb.h"
|
||||
/* #include "../../usr.bin/rlogin/krb.h" */
|
||||
|
||||
char dst_realm_buf[REALM_SZ];
|
||||
char *dest_realm = NULL;
|
||||
@@ -344,7 +344,7 @@ tolocal(argc, argv)
|
||||
if (!(bp = malloc(len)))
|
||||
err(1, NULL);
|
||||
(void)snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP,
|
||||
iamrecursive ? " -r" : "", pflag ? " -p" : "",
|
||||
iamrecursive ? " -PR" : "", pflag ? " -p" : "",
|
||||
argv[i], argv[argc - 1]);
|
||||
if (susystem(bp, userid))
|
||||
++errs;
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rm.c,v 1.10 1996/02/19 05:57:22 pst Exp $
|
||||
* $Id: rm.c,v 1.11 1996/03/07 23:26:59 wosch Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -82,7 +82,7 @@ main(argc, argv)
|
||||
int ch, rflag;
|
||||
|
||||
rflag = 0;
|
||||
while ((ch = getopt(argc, argv, "dfiPRr")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "dfiPRr")) != -1)
|
||||
switch(ch) {
|
||||
case 'd':
|
||||
dflag = 1;
|
||||
|
||||
+9
-6
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.4 (Berkeley) 5/5/95
|
||||
# $Id: Makefile,v 1.15.2.1 1997/08/25 09:09:28 jkh Exp $
|
||||
# $Id: Makefile,v 1.15.2.2 1997/08/25 21:16:13 jkh Exp $
|
||||
|
||||
PROG= sh
|
||||
SHSRCS= alias.c cd.c echo.c error.c eval.c exec.c expand.c \
|
||||
@@ -7,7 +7,8 @@ SHSRCS= alias.c cd.c echo.c error.c eval.c exec.c expand.c \
|
||||
mystring.c options.c output.c parser.c printf.c redir.c show.c \
|
||||
trap.c var.c
|
||||
GENSRCS= arith.c arith_lex.c builtins.c init.c nodes.c syntax.c
|
||||
SRCS= ${SHSRCS} ${GENSRCS}
|
||||
GENHDRS= builtins.h nodes.h syntax.h token.h
|
||||
SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
|
||||
|
||||
DPADD+= ${LIBL} ${LIBEDIT} ${LIBTERMCAP}
|
||||
LDADD+= -ll -ledit -ltermcap
|
||||
@@ -19,13 +20,13 @@ CFLAGS+=-DSHELL -I. -I${.CURDIR}
|
||||
|
||||
.PATH: ${.CURDIR}/bltin ${.CURDIR}/../../usr.bin/printf
|
||||
|
||||
CLEANFILES+= builtins.h mkinit mkinit.o mknodes mknodes.o \
|
||||
CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
|
||||
mksyntax mksyntax.o \
|
||||
nodes.h syntax.h token.h y.tab.h
|
||||
CLEANFILES+= ${GENSRCS}
|
||||
y.tab.h
|
||||
CLEANFILES+= ${GENSRCS} ${GENHDRS}
|
||||
|
||||
beforedepend: builtins.h nodes.h syntax.h token.h
|
||||
|
||||
.ORDER: builtins.c builtins.h
|
||||
builtins.c builtins.h: mkbuiltins builtins.def
|
||||
cd ${.CURDIR}; sh mkbuiltins ${.OBJDIR}
|
||||
|
||||
@@ -45,9 +46,11 @@ mknodes.o: mknodes.c # XXX and many headers
|
||||
mksyntax: mksyntax.o
|
||||
mksyntax.o: mksyntax.c # XXX and many headers
|
||||
|
||||
.ORDER: nodes.c nodes.h
|
||||
nodes.c nodes.h: mknodes nodetypes nodes.c.pat
|
||||
./mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
|
||||
|
||||
.ORDER: syntax.c syntax.h
|
||||
syntax.c syntax.h: mksyntax
|
||||
./mksyntax
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
char *getpwd __P((void));
|
||||
+1
-2
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: jobs.c,v 1.8.2.2 1997/08/17 14:47:33 joerg Exp $
|
||||
* $Id: jobs.c,v 1.8.2.3 1997/08/25 09:10:00 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -45,7 +45,6 @@ static char const sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#ifdef BSD
|
||||
#include <sys/wait.h>
|
||||
|
||||
+63
-4
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: miscbltin.c,v 1.8 1996/09/03 14:24:44 peter Exp $
|
||||
* $Id: miscbltin.c,v 1.8.2.1 1997/08/25 09:10:10 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -52,6 +52,7 @@ static char const sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95";
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "options.h"
|
||||
@@ -88,14 +89,43 @@ readcmd(argc, argv)
|
||||
int startword;
|
||||
int status;
|
||||
int i;
|
||||
struct timeval tv;
|
||||
char *tvptr;
|
||||
fd_set ifds;
|
||||
struct termios told, tnew;
|
||||
int tsaved;
|
||||
|
||||
eflag = 0;
|
||||
prompt = NULL;
|
||||
while ((i = nextopt("ep:")) != '\0') {
|
||||
if (i == 'p')
|
||||
tv.tv_sec = -1;
|
||||
tv.tv_usec = 0;
|
||||
while ((i = nextopt("ep:t:")) != '\0') {
|
||||
switch(i) {
|
||||
case 'p':
|
||||
prompt = optarg;
|
||||
else
|
||||
break;
|
||||
case 'e':
|
||||
eflag = 1;
|
||||
break;
|
||||
case 't':
|
||||
tv.tv_sec = strtol(optarg, &tvptr, 0);
|
||||
if (tvptr == optarg)
|
||||
error("timeout value");
|
||||
switch(*tvptr) {
|
||||
case 0:
|
||||
case 's':
|
||||
break;
|
||||
case 'h':
|
||||
tv.tv_sec *= 60;
|
||||
/* FALLTHROUGH */
|
||||
case 'm':
|
||||
tv.tv_sec *= 60;
|
||||
break;
|
||||
default:
|
||||
error("timeout unit");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prompt && isatty(0)) {
|
||||
out2str(prompt);
|
||||
@@ -105,6 +135,35 @@ readcmd(argc, argv)
|
||||
error("arg count");
|
||||
if ((ifs = bltinlookup("IFS", 1)) == NULL)
|
||||
ifs = nullstr;
|
||||
|
||||
if (tv.tv_sec >= 0) {
|
||||
/*
|
||||
* See if we can disable input processing; this will
|
||||
* not give the desired result if we are in a pipeline
|
||||
* and someone upstream is still in line-by-line mode.
|
||||
*/
|
||||
tsaved = 0;
|
||||
if (tcgetattr(0, &told) == 0) {
|
||||
memcpy(&tnew, &told, sizeof(told));
|
||||
cfmakeraw(&tnew);
|
||||
tcsetattr(0, TCSANOW, &tnew);
|
||||
tsaved = 1;
|
||||
}
|
||||
/*
|
||||
* Wait for something to become available.
|
||||
*/
|
||||
FD_ZERO(&ifds);
|
||||
FD_SET(0, &ifds);
|
||||
status = select(1, &ifds, NULL, NULL, &tv);
|
||||
if (tsaved)
|
||||
tcsetattr(0, TCSANOW, &told);
|
||||
/*
|
||||
* If there's nothing ready, return an error.
|
||||
*/
|
||||
if (status <= 0)
|
||||
return(1);
|
||||
}
|
||||
|
||||
status = 0;
|
||||
startword = 1;
|
||||
backslash = 0;
|
||||
|
||||
+23
-3
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $Id: sh.1,v 1.9.2.3 1997/08/25 21:22:27 jkh Exp $
|
||||
.\" $Id: sh.1,v 1.9.2.7 1998/02/12 01:25:29 jdp Exp $
|
||||
.\"
|
||||
.Dd May 5, 1995
|
||||
.Dt SH 1
|
||||
@@ -453,6 +453,10 @@ error, or a false indication. The man page for each command
|
||||
should indicate the various exit codes and what they mean.
|
||||
Additionally, the builtin commands return exit codes, as does
|
||||
an executed shell function.
|
||||
.Pp
|
||||
If a command is terminated by a signal, its exit status is 128 plus
|
||||
the signal number. Signal numbers are defined in the header file
|
||||
.Aq Pa sys/signal.h .
|
||||
.Ss Complex Commands
|
||||
Complex commands are combinations of simple commands
|
||||
with control operators or reserved words, together creating a larger complex
|
||||
@@ -623,7 +627,7 @@ slightly more efficient.
|
||||
Grouping commands together this way allows you to
|
||||
redirect their output as though they were one program:
|
||||
.Bd -literal -offset indent
|
||||
{ echo -n "hello"; echo " world" } > greeting
|
||||
{ echo -n "hello"; echo " world"; } > greeting
|
||||
.Ed
|
||||
.Ss Functions
|
||||
The syntax of a function definition is
|
||||
@@ -970,6 +974,15 @@ etc).
|
||||
A null command that returns a 0 (true) exit value.
|
||||
.It \&. file
|
||||
The commands in the specified file are read and executed by the shell.
|
||||
If
|
||||
.Ar file
|
||||
contains any
|
||||
.Ql /
|
||||
characters, it is used as is. Otherwise, the shell searches the
|
||||
.Ev PATH
|
||||
for the file. If it is not found in the
|
||||
.Ev PATH ,
|
||||
it is sought in the current working directory.
|
||||
.It alias [ name[=string] ... ]
|
||||
If name=string is specified, the shell defines the
|
||||
alias ``name'' with value ``string''. If just ``name''
|
||||
@@ -1123,7 +1136,7 @@ is rather than recomputing it each time. This makes
|
||||
it faster. However, if the current directory is
|
||||
renamed, the builtin version of pwd will continue to
|
||||
print the old name for the directory.
|
||||
.It read [ -p prompt ] [ -e ] variable ...
|
||||
.It Li "read [ -p prompt ] [ -t timeout ] [ -e ] variable ...
|
||||
The prompt is printed if the -p option is specified
|
||||
and the standard input is a terminal. Then a line is
|
||||
read from the standard input. The trailing newline
|
||||
@@ -1136,6 +1149,13 @@ separated them) are assigned to the last variable.
|
||||
If there are more variables than pieces, the remaining
|
||||
variables are assigned the null string.
|
||||
.Pp
|
||||
If the -t option is specified the timeout elapses
|
||||
before any input is supplied, the read command will
|
||||
return without assigning any values. The timeout value
|
||||
may optionally be followed by one of 's', 'm' or 'h' to
|
||||
explicitly specify seconds, minutes or or hours. If none
|
||||
is supplied, 's' is assumed.
|
||||
.Pp
|
||||
The -e option causes any backslashes in the input to
|
||||
be treated specially. If a backslash is followed by
|
||||
a newline, the backslash and the newline will be
|
||||
|
||||
+12
-6
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: trap.c,v 1.4 1996/09/01 10:21:47 peter Exp $
|
||||
* $Id: trap.c,v 1.4.2.1 1997/08/25 09:10:46 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -205,12 +205,12 @@ clear_traps()
|
||||
* Set the signal handler for the specified signal. The routine figures
|
||||
* out what it should be set to.
|
||||
*/
|
||||
long
|
||||
void
|
||||
setsignal(signo)
|
||||
int signo;
|
||||
{
|
||||
int action;
|
||||
sig_t sigact = SIG_DFL;
|
||||
sig_t sig, sigact = SIG_DFL;
|
||||
char *t;
|
||||
|
||||
if ((t = trap[signo]) == NULL)
|
||||
@@ -260,7 +260,7 @@ setsignal(signo)
|
||||
* here, but other shells don't. We don't alter
|
||||
* sigmode, so that we retry every time.
|
||||
*/
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (sigact == SIG_IGN) {
|
||||
if (mflag && (signo == SIGTSTP ||
|
||||
@@ -273,14 +273,18 @@ setsignal(signo)
|
||||
}
|
||||
}
|
||||
if (*t == S_HARD_IGN || *t == action)
|
||||
return 0;
|
||||
return;
|
||||
switch (action) {
|
||||
case S_DFL: sigact = SIG_DFL; break;
|
||||
case S_CATCH: sigact = onsig; break;
|
||||
case S_IGN: sigact = SIG_IGN; break;
|
||||
}
|
||||
*t = action;
|
||||
return (long)signal(signo, sigact);
|
||||
sig = signal(signo, sigact);
|
||||
#ifdef BSD
|
||||
if (sig != SIG_ERR && action == S_CATCH)
|
||||
siginterrupt(signo, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -340,7 +344,9 @@ onsig(signo)
|
||||
int signo;
|
||||
{
|
||||
|
||||
#ifndef BSD
|
||||
signal(signo, onsig);
|
||||
#endif
|
||||
if (signo == SIGINT && trap[SIGINT] == NULL) {
|
||||
onint();
|
||||
return;
|
||||
|
||||
+2
-2
@@ -34,14 +34,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)trap.h 8.3 (Berkeley) 6/5/95
|
||||
* $Id: trap.h,v 1.3 1996/09/01 10:21:50 peter Exp $
|
||||
* $Id: trap.h,v 1.3.2.1 1997/08/25 09:10:48 jkh Exp $
|
||||
*/
|
||||
|
||||
extern int pendingsigs;
|
||||
|
||||
int trapcmd __P((int, char **));
|
||||
void clear_traps __P((void));
|
||||
long setsignal __P((int));
|
||||
void setsignal __P((int));
|
||||
void ignoresig __P((int));
|
||||
void onsig __P((int));
|
||||
void dotrap __P((void));
|
||||
|
||||
+5
-3
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: print.c,v 1.5 1995/05/30 00:07:27 rgrimes Exp $
|
||||
* $Id: print.c,v 1.5.6.1 1997/08/25 09:24:08 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -205,8 +205,10 @@ print(tp, wp, ldisc, fmt)
|
||||
if (fmt != BSD && cc[p->sub] == p->def)
|
||||
continue;
|
||||
#define WD "%-8s"
|
||||
(void)sprintf(buf1 + cnt * 8, WD, p->name);
|
||||
(void)sprintf(buf2 + cnt * 8, WD, ccval(p, cc[p->sub]));
|
||||
(void)snprintf(buf1 + cnt * 8, sizeof(buf1) - cnt * 8,
|
||||
WD, p->name);
|
||||
(void)snprintf(buf2 + cnt * 8, sizeof(buf2) - cnt * 8,
|
||||
WD, ccval(p, cc[p->sub]));
|
||||
if (++cnt == LINELENGTH / 8) {
|
||||
cnt = 0;
|
||||
(void)printf("%s\n", buf1);
|
||||
|
||||
+2
-3
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: test.c,v 1.13.2.1 1996/12/26 18:54:46 joerg Exp $
|
||||
* $Id: test.c,v 1.13.2.2 1997/08/25 09:26:35 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -46,9 +46,8 @@ static char const copyright[] =
|
||||
static char const sccsid[] = "@(#)test.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
|
||||
@@ -325,9 +325,9 @@ The long-named options can be introduced with `+' as well as `\-\-',
|
||||
for compatibility with previous releases. Eventually support for `+'
|
||||
will be removed, because it is incompatible with the POSIX.2 standard.
|
||||
.SH FILES
|
||||
/usr/local/lib/bison.simple simple parser
|
||||
/usr/share/misc/bison.simple simple parser
|
||||
.br
|
||||
/usr/local/lib/bison.hairy complicated parser
|
||||
/usr/share/misc/bison.hairy complicated parser
|
||||
.SH SEE ALSO
|
||||
.IR yacc (1)
|
||||
.br
|
||||
|
||||
@@ -3,7 +3,7 @@ GNU cpio 2.4.2
|
||||
|
||||
removed files:
|
||||
INSTALL cpio.info mkdir.c
|
||||
Makefile.in cpio.texi mkinstalldirs
|
||||
Makefile.in mkinstalldirs
|
||||
argmatch.c fnmatch.c mt.1
|
||||
bcopy.c fnmatch.h mt.c
|
||||
configure install-sh rmt.c
|
||||
|
||||
+4
-4
@@ -1977,7 +1977,7 @@ cases where multiple declaration is valid and changes nothing.
|
||||
.B \-Wnested-externs
|
||||
Warn if an \c
|
||||
.B extern\c
|
||||
\& declaration is encountered within an function.
|
||||
\& declaration is encountered within a function.
|
||||
.TP
|
||||
.B \-Wenum\-clash
|
||||
Warn about conversion between different enumeration types (C++ only).
|
||||
@@ -2925,17 +2925,17 @@ exist in SPARClite but not in SPARC v7.
|
||||
.B \-mcypress
|
||||
.TP
|
||||
.B \-msupersparc
|
||||
These two options select the processor for which the code is optimised.
|
||||
These two options select the processor for which the code is optimized.
|
||||
.Sp
|
||||
With
|
||||
.B \-mcypress
|
||||
(the default), the compiler optimises code for the Cypress CY7C602 chip, as
|
||||
(the default), the compiler optimizes code for the Cypress CY7C602 chip, as
|
||||
used in the SparcStation/SparcServer 3xx series. This is also appropriate for
|
||||
the older SparcStation 1, 2, IPX etc.
|
||||
.Sp
|
||||
With
|
||||
.B \-msupersparc
|
||||
the compiler optimises code for the SuperSparc cpu, as used in the SparcStation
|
||||
the compiler optimizes code for the SuperSparc cpu, as used in the SparcStation
|
||||
10, 1000 and 2000 series. This flag also enables use of the full SPARC v8
|
||||
instruction set.
|
||||
.PP
|
||||
|
||||
+2
-1
@@ -2098,7 +2098,7 @@ pexecute (search_flag, program, argv, not_last)
|
||||
/* Exec the program. */
|
||||
(*func) (program, argv);
|
||||
perror_exec (program);
|
||||
exit (-1);
|
||||
_exit (1);
|
||||
/* NOTREACHED */
|
||||
return 0;
|
||||
|
||||
@@ -2709,6 +2709,7 @@ process_command (argc, argv)
|
||||
#ifdef FREEBSD_NATIVE
|
||||
add_prefix (&exec_prefixes, "/usr/libexec/", 0, 0, NULL_PTR);
|
||||
add_prefix (&exec_prefixes, "/usr/bin/", 0, 0, NULL_PTR);
|
||||
add_prefix (&startfile_prefixes, "/usr/libdata/gcc/", 0, 0, NULL_PTR);
|
||||
#else /* not FREEBSD_NATIVE */
|
||||
#ifndef OS2
|
||||
add_prefix (&exec_prefixes, standard_exec_prefix, 0, 2, NULL_PTR);
|
||||
|
||||
@@ -87,7 +87,8 @@ add_to_objfile_sections (abfd, asect, objfile_p_char)
|
||||
/* XXX perhaps this should be in bfd_section_vma (), but it wouldn't
|
||||
even compile there, since a bfd pointer isn't actually passed in
|
||||
all invocations of bfd_section_vma (). */
|
||||
section.addr += bfd_get_start_address (abfd);
|
||||
if (kernel_debugging)
|
||||
section.addr += bfd_get_start_address (abfd);
|
||||
#endif
|
||||
section.endaddr = section.addr + bfd_section_size (abfd, asect);
|
||||
obstack_grow (&objfile->psymbol_obstack, (char *) §ion, sizeof(section));
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
@@@@@@@=
|
||||
@= @=
|
||||
@= @=
|
||||
@= @= @@@@@= @@@@@@= @@= @=
|
||||
@= F o r a l l h a c k e r s. @=@= @=
|
||||
@= @@@@@@=@= @= @= @@@@@= @= @= @=
|
||||
@= @= @= @= @= @= @= @@@@@= @=
|
||||
@= @= @= @= @= @= @=@= @= @=
|
||||
@@@@@@@@= @@@@= @@@@@= @@@@@@=@@@= @@@@= @@@@@@=
|
||||
|
||||
This software is covered by the following:
|
||||
|
||||
Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
This product includes software developed by Shigio Yamaguchi.
|
||||
4. Neither the name of the author nor the names of any co-contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of gozilla(1) are covered by the following:
|
||||
|
||||
Copyright 1996 Netscape Communications Corporation, all rights reserved.
|
||||
Created: Jamie Zawinski <[email protected]>, 24-Dec-94.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting documen-
|
||||
tation. No representations are made about the suitability of this soft-
|
||||
ware for any purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
Copyright 1991 by Andreas Stolcke
|
||||
Copyright 1990 by Solbourne Computer Inc.
|
||||
Longmont, Colorado
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Solbourne not be used
|
||||
in advertising in publicity pertaining to distribution of the software
|
||||
without specific, written prior permission.
|
||||
|
||||
ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
CHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE OR SOL-
|
||||
BOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,357 @@
|
||||
GLOBAL history
|
||||
--------------
|
||||
|
||||
version 1.0 Initial version [21-Apr-96]
|
||||
|
||||
global, gtags, btreeop, extended ctags.
|
||||
|
||||
version 1.1 Only bugfix [2-May-96]
|
||||
|
||||
[fixed bug]
|
||||
global - makes corrupted path name by conversion error.
|
||||
- description of exit code in online manual is mistaken.
|
||||
btreeop - cannot treat a long line over BUFSIZ. With the result
|
||||
that gtags fails.
|
||||
extended ctags - when using -r option, considers a reserved word
|
||||
to be a function name. With the result that GRTAGS becomes
|
||||
too large.
|
||||
|
||||
version 1.2 Support of 1.34 nvi [7-Jun-96]
|
||||
|
||||
[changed]
|
||||
extended ctags
|
||||
- change to use bsearch(3) for searching reserved words.
|
||||
- change to consider '__P' as a reserved word.
|
||||
- unify the original patch (included in version1.0) and
|
||||
the bugfix patch (included in version1.1).
|
||||
[added]
|
||||
extended vi
|
||||
- VI tag support.
|
||||
|
||||
version 1.3 Support of GTAGSLIBPATH [28-Jul-96]
|
||||
|
||||
[changed]
|
||||
global - search not only in a source tree but also in library paths
|
||||
specified by environment variable GTAGSLIBPATH.
|
||||
extended ctags
|
||||
- change print format a little when -x option
|
||||
|
||||
version 1.4 Support of yacc source file [26-Oct-96]
|
||||
|
||||
[changed]
|
||||
extended ctags
|
||||
- support of yacc source file.
|
||||
- this version of ctags is NOT COMPATIBLE with original one.
|
||||
* search all part of a yacc file for C functions.
|
||||
(original only 3rd part)
|
||||
* no longer considers a yacc rule to be an object.
|
||||
|
||||
version 1.5 Hypertext generator [12-Dec-96]
|
||||
|
||||
[fixed bug]
|
||||
gtags - treat 'y.tab.c' as a C source.(we should treat only *.y)
|
||||
extended vi
|
||||
- free stack memory. free(3) in FreeBSD 2.1.5R seems to
|
||||
show a warning message when receive stack address.
|
||||
So it spoils the screen.
|
||||
[added]
|
||||
htags - new command (hypertext generator of C source file)
|
||||
gtags - error check code added.
|
||||
|
||||
version 1.6 Support of 1.76 nvi and reconstruction for other OS [21-Jan-97]
|
||||
|
||||
[changed]
|
||||
htags - cease using <BLOCKQUOTE> because lynx doesn't understand it.
|
||||
global,htags
|
||||
- replace 'sort -u' with 'sort | uniq' for compatibility reason.
|
||||
[fixed bug]
|
||||
global - makes illegal path name when using GTAGSLIBPATH.
|
||||
gtags - error message mistaken.
|
||||
[added]
|
||||
nvi-1.76.diff
|
||||
- patch for nvi 1.76 to make extended vi.
|
||||
gctags - this is the same with extended ctags in older version.
|
||||
now GLOBAL includes BSD ctags in it. so no longer has
|
||||
patch file (ctags.diff).
|
||||
(I brought original ctags from FreeBSD 2.1.5R)
|
||||
|
||||
Thanks to
|
||||
Gary Kline
|
||||
Hideki Mori
|
||||
for their advice.
|
||||
|
||||
global - -a option added.
|
||||
|
||||
version 1.7 Make suitable for large project (mainly FreeBSD kernel) [17-Feb-97]
|
||||
|
||||
[changed]
|
||||
htags - htags no longer makes frame.html. Index.html offers frame
|
||||
function too.
|
||||
- works MUCH faster than previous version.
|
||||
[fixed bug]
|
||||
htags - generate path name including '¶m'. (It means special
|
||||
charactor in hypertertext.)
|
||||
So, changed internal separator from '&' to '|'.
|
||||
[added]
|
||||
gtags - -s option added. If specified, gtags extract ENTRY() and
|
||||
ALTENTRY() from *.[sS] files.
|
||||
htags - support one level nested index. It's always valid for file
|
||||
index when directories found, and valid for function index
|
||||
only when -a option specified.
|
||||
- -v and -t option added.
|
||||
systags.sh
|
||||
- script to make all tags (GTAGS,GRTAGS,HTML) for kernel source.
|
||||
(it is only for FreeBSD and Linux)
|
||||
|
||||
version 1.8 Fix some bugs, add options and make more portable [5-Apr-97]
|
||||
|
||||
[changed]
|
||||
gctags, btreeop, Makefile
|
||||
- modify for generic UNIX (Linux, Solaris)
|
||||
- modify to quiet compiler.
|
||||
|
||||
Many thanks to
|
||||
A.E. Brouwer
|
||||
Oleg Checkulaev
|
||||
Emile Heyns
|
||||
|
||||
gctags - modify to treat '\r' at the end of line.
|
||||
htags - changed internal separator from '|' to ' '.
|
||||
because some OS cannot treat '|' in a path.
|
||||
[fixed bug]
|
||||
htags - regard a part of path in #include as a reserved word.
|
||||
- generate illegal links when same tags exist in a line.
|
||||
- insufficient comment detection.
|
||||
|
||||
Thanks to Jeffrey Friedl. I took his code for complete
|
||||
comment detection.
|
||||
|
||||
gctags - regard function name as a definition in extern statement.
|
||||
- skip macro(no argment) body when -r specified.
|
||||
gctags, htags
|
||||
- regard 'entry' as a reserved word.
|
||||
[added]
|
||||
global - -c (complete) option added.
|
||||
htags - -d tagdir option added.
|
||||
- -w option added.
|
||||
|
||||
version 1.81 Make global to understand 'obj' directory [14-Apr-97]
|
||||
|
||||
[fixed bug]
|
||||
extended vi
|
||||
- doesn't hand '\' in a pattern to global.
|
||||
[changed]
|
||||
global
|
||||
- can find tag file in obj directory.
|
||||
|
||||
version 1.9 Support of 1.79 nvi and some additional options [21-Apr-97]
|
||||
|
||||
[fixed bug]
|
||||
htags - doesn't keep the code formatted correctly.
|
||||
So, changed to convert tabs in source files into spaces.
|
||||
(expand(1) needed)
|
||||
|
||||
Thanks to Andy Newman for his bug report and fix method.
|
||||
|
||||
- cannot print error message correctly.
|
||||
[changed]
|
||||
gctags, btreeop
|
||||
- modify for SunOS 4.1.3.
|
||||
|
||||
Thanks to Yoshiharu Ito for his information.
|
||||
|
||||
[added]
|
||||
btreeop - META record is available.
|
||||
(It will be used in the furture.)
|
||||
- -A and -D option added.
|
||||
(It will be used in the future.)
|
||||
global - 'format version record' is available.
|
||||
(It will be used in the furture.)
|
||||
htags - use temporary directory specified by TMPDIR environment
|
||||
variable.
|
||||
- -l option added.
|
||||
|
||||
Thanks to Jeff Trawick. This option is his idea.
|
||||
|
||||
nvi-1.79.diff
|
||||
- patch for nvi 1.79 to make extended vi.
|
||||
|
||||
version 2.0 Support of Emacs and CGI Form [7-Jul-97]
|
||||
|
||||
[fixed bug]
|
||||
gtags, htags
|
||||
- treat files under 'RCS/' or 'SCCS/' directory.
|
||||
global - allow relative path of GTAGSDBPATH and GTAGSROOT.
|
||||
htags - illegal tag generated when no definition found.
|
||||
[changed]
|
||||
htags - changed not to print line number by default.
|
||||
If you need it, -n option should be specified.
|
||||
- added the command name to error message.
|
||||
- avoid sort(1)'s bug.
|
||||
- changed for performance.
|
||||
systags - use -n, -f option for htags by default.
|
||||
doesn't use -w option for htags by default.
|
||||
gtags - rewritten with perl.
|
||||
gtags, gctags
|
||||
- move some code for assembler source from gtags to gctags.
|
||||
gtags, htags, global
|
||||
- restrict PATH to '/bin:/usr/bin'.
|
||||
btreeop - expand tabs into spaces of output.
|
||||
[deleted]
|
||||
nvi-1.76.diff
|
||||
[added]
|
||||
gtags.el- emacs support (emulation of 1.34 nvi) added.
|
||||
htags - hyperlink for include files added.
|
||||
- check if GTAGS is the latest one.
|
||||
- -f option added.
|
||||
With this option, you can use input form and dynamic
|
||||
index. (You need to setup httpd server for it.)
|
||||
- -n option added.
|
||||
global - -f option added.
|
||||
btreeop - -L option added.
|
||||
|
||||
version 2.1 Symbol search, incremental update and gozilla [20-Sep-97]
|
||||
|
||||
[changed]
|
||||
gtags - -e option and -s option were deleted.
|
||||
These options become default, so you need not to specify
|
||||
them. Gtags accepts these options for compatibility but
|
||||
no effect.
|
||||
global - understand not only 'obj'(MAKEOBJDIR) directory but also
|
||||
'/usr/obj'(MAKEOBJDIRPREFIX) directory of BSD build system.
|
||||
|
||||
Thanks to Jordan K. Hubbard. This is his idea.
|
||||
|
||||
gctags, btreeop
|
||||
- remove <err.h> for portability. (Sorry, Philippe...)
|
||||
btreeop - output procedure rewritten.
|
||||
detab() + fprintf -> detab_print()
|
||||
gtags, htags, global
|
||||
- don't restrict PATH to '/bin:/usr/bin' like version 1.9
|
||||
and the former.
|
||||
[fixed bug]
|
||||
gctags - cannot treat files which include '\r'.
|
||||
|
||||
Thanks to Christoph Conrad for his bug report.
|
||||
|
||||
- is disturbed by '_asm' statement.
|
||||
- write buffer beyoned the end when source file doesn't
|
||||
end with '\n'. It brings segmentation fault.
|
||||
gtags.el- ESC-r command doesn't work.
|
||||
htags - has a security hole in global.cgi.
|
||||
btreeop - corrupt database when interrupted.
|
||||
all command
|
||||
- description of exit code in online manual is fixed.
|
||||
[added]
|
||||
gozilla
|
||||
- new command.
|
||||
gtags, gctags, global
|
||||
- can locate specified symbol other than function name
|
||||
using GSYMS tag file.
|
||||
btreeop - support secondary key.
|
||||
Optional key number added to -K option and -D option.
|
||||
- -k option added.(prefix read)
|
||||
global
|
||||
- -g option added.(grep pattern)
|
||||
|
||||
Thanks to Hideaki Okada for his advice.
|
||||
|
||||
- -s option added.(symbol search)
|
||||
- -i option added.(incremental update)
|
||||
- -l option added.(search only under current directory)
|
||||
- -v option added.(verbose mode)
|
||||
gtags - -i option added.(incremental update)
|
||||
- -v option added.(verbose mode)
|
||||
- -o option added.(stop making GSYMS tag file)
|
||||
gtags.el- gtags-find-symbol command (ESC-s) added.
|
||||
It is equal to global's -s option.
|
||||
- gtags-find-pattern command (ESC-g) added.
|
||||
It is equal to global's -g option.
|
||||
|
||||
version 2.11 Only bugfix [7-Nov-97]
|
||||
|
||||
[fixed bug]
|
||||
htags, gtags
|
||||
- cannot treat symbolic link.
|
||||
|
||||
Thanks to Yoshiharu Ito for his bug report.
|
||||
|
||||
Makefile.generic
|
||||
- doens't work on Debian GNU/Linux.
|
||||
|
||||
Thanks to Y.Yoshinaga for his patch.
|
||||
|
||||
version 2.2 Rewritten with C for performance [7-Dec-97]
|
||||
|
||||
[changed]
|
||||
gtags, global, gozilla
|
||||
- rewritten with C.
|
||||
global - adopted POSIX regular expression (extension) instead of
|
||||
perl's one.
|
||||
htags - shape up anchor database.
|
||||
btreeop - some options (-b, -c, -l, -p) were deleted.
|
||||
|
||||
version 2.21 Bugfix and slightly modified [11-Dec-97]
|
||||
|
||||
[fixed bug]
|
||||
gtags, global
|
||||
- doesn't skip RCS, SCCS, y.tab.c, y.tab.h.
|
||||
global - generates illegal path name when using GTAGSLIBPATH
|
||||
with -a option.
|
||||
[changed]
|
||||
lib/Makefile.generic
|
||||
- MANDIR = /usr/share/man -> MANDIR = /usr/man
|
||||
- replace `lorder $(OBJS) | tsort -q` to already sorted list.
|
||||
for S.u.S.E Linux 5.1.
|
||||
|
||||
Thanks to Christoph Conrad for his information.
|
||||
|
||||
gtags, lib/test.c
|
||||
- some change for Solaris environment.
|
||||
|
||||
Thanks to Yamashita TAKAO for his information.
|
||||
|
||||
htags/Makefile, systags/Makefile
|
||||
- ${DESTDIR}/usr/bin -> ${DESTDIR}${BINDIR}
|
||||
|
||||
version 2.22 GRTAGS support for assembler source [26-Dec-97]
|
||||
|
||||
[changed]
|
||||
gtags, gctags, htags
|
||||
- recognize following patterns as a function reference
|
||||
to C function xxx().
|
||||
call EXT(xxx)
|
||||
call _xxx
|
||||
|
||||
Thanks to Yamashita TAKAO for his idea.
|
||||
|
||||
version 2.23 Bugfix and slightly modified [13-Jan-98]
|
||||
|
||||
[fixed bug]
|
||||
gctags - GRTAGS support in version 2.22 doesn't work.
|
||||
|
||||
Thanks to Yamashita TAKAO for his bug report.
|
||||
|
||||
[changed]
|
||||
gctags/Makefile, gctags/Makefile.generic
|
||||
- -DGLOBAL -DYACC was removed.
|
||||
gctags/ctags.h
|
||||
- #define GLOBAL 1 and #define YACC 1 were added.
|
||||
|
||||
[added]
|
||||
COPYING - Copyright notice was added.
|
||||
|
||||
version 2.24 Only bugfix [20-Jan-98]
|
||||
|
||||
[fixed bug]
|
||||
global - generates wrong path name when GTAGSROOT includes symbolic
|
||||
links.
|
||||
|
||||
Thanks to Wolfgang Helbig for his bug report.
|
||||
|
||||
htags - cannot treat path name which includes digit as the second
|
||||
character like 'i386'. (In fact it was expand(1)'s bug.)
|
||||
|
||||
Thanks to Andrew Gallatin for his bug report.
|
||||
|
||||
global - doesn't search 'obj' directory correctly.
|
||||
@@ -0,0 +1,178 @@
|
||||
|
||||
Installation of GLOBAL
|
||||
|
||||
20-Jan-1998 Shigio Yamaguchi
|
||||
---------------------------------------------------------------------------
|
||||
Guide line (C style)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
if (Your system == FreeBSD) {
|
||||
You are lucky!
|
||||
You need not to do procedure "1. Preparation for generic UNIX".
|
||||
|
||||
switch (version) {
|
||||
case 2.0.5R:
|
||||
case 2.1.0R:
|
||||
case 2.1.5R:
|
||||
There is no problem.
|
||||
break;
|
||||
case 2.1.6R:
|
||||
case 2.1.7R:
|
||||
I don't know. But it seems same with 2.1.5R.
|
||||
break;
|
||||
case 2.2.1R:
|
||||
It is OK. But your native nvi is version 1.71.
|
||||
Use 1.79 nvi available on the Internet.
|
||||
break;
|
||||
case 2.2.2R:
|
||||
case 2.2.5R:
|
||||
Your system inlucdes GLOBAL 1.9. You can overwrite it
|
||||
with this 2.2 package.
|
||||
But skip procedure "3. Extended vi (OPTIONAL)", because
|
||||
your /usr/bin/nvi is already extended nvi for GLOBAL.
|
||||
break;
|
||||
default:
|
||||
I don't know. But it seems to be little problem.
|
||||
}
|
||||
} else {
|
||||
You may some error messages to make GLOBAL.
|
||||
But it seems not so difficult to clear it. If you make a patch for it,
|
||||
please let me know. I would like to include your patch into new
|
||||
version of GLOBAL.
|
||||
|
||||
Thank you in advance.
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Install procedure
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
0. Extracting
|
||||
|
||||
% tar xzvf global-XXX.tar.gz
|
||||
% cd global-XXX
|
||||
|
||||
(XXX is version number.)
|
||||
|
||||
1. Preparation for generic UNIX
|
||||
|
||||
If you are a FreeBSD (all version) user, nothing to do here.
|
||||
Please go to "2. GLOBAL basic".
|
||||
|
||||
Otherwise, you must install following items before you install GLOBAL.
|
||||
|
||||
a) Generic makefile
|
||||
|
||||
This package includes generic makefile. Please do the followings.
|
||||
|
||||
% make -f Makefile.generic gen
|
||||
% vi Makefile <- check install directories (BINDIR, MANDIR)
|
||||
|
||||
b) BSD db library version 1.85
|
||||
|
||||
If you don't have it, you can fetch it from this site.
|
||||
|
||||
http://mongoose.bostic.com/db/packages/db.1.85.tar.gz
|
||||
|
||||
c) PERL version 4 or later
|
||||
|
||||
If you don't have it, you can fetch it from this site.
|
||||
|
||||
ftp://ftp.cis.ufl.edu/pub/perl/CPAN/src/5.0/latest.tar.gz
|
||||
|
||||
d) Rewrite some files
|
||||
|
||||
If you install GLOBAL into other than /usr/bin, you need rewrite
|
||||
hard coded path in a program. You can find the place by this command.
|
||||
|
||||
% grep '/usr/bin/global' */*.pl
|
||||
|
||||
If you install perl to other than /usr/bin, please rewrite hard coded
|
||||
path in some programs. You can find the places by this command.
|
||||
|
||||
% grep '/usr/bin/perl' */*.pl
|
||||
|
||||
e) POSIX regular expression (extension) library
|
||||
|
||||
If you don't have it, you can use GNU's regex library.
|
||||
|
||||
f) Some UNIX tools
|
||||
|
||||
Find(1), sed(1), sort(1) are needed.
|
||||
If your environment is UNIX, you have them.
|
||||
|
||||
2. GLOBAL basic (NEEDED)
|
||||
|
||||
% make
|
||||
# make install
|
||||
|
||||
3. Extended vi (OPTIONAL)
|
||||
|
||||
GLOBAL supports two version of nvi.
|
||||
There is a little defference in behavior between them when a number of
|
||||
functions located. (please see 'README'.)
|
||||
Version 1.34 nvi is included by FreeBSD 2.0.5R, 2.1.0R and 2.1.5R.
|
||||
Version 1.79 nvi is available on
|
||||
|
||||
ftp://ftp.cs.berkeley.edu/ucb/4bsd/nvi-1.79.tar.gz.
|
||||
|
||||
If you don't have nvi-1.34, use nvi-1.79.
|
||||
|
||||
If you use version 1.34 nvi which is a native command in FreeBSD 2.0.5R,
|
||||
2.1.0R or 2.1.5R then
|
||||
|
||||
% cp -r /usr/src/usr.bin/vi vi <- version 1.34 of nex/nvi
|
||||
% cd vi
|
||||
% patch -p < ../nvi-1.34.diff
|
||||
% make
|
||||
# make install
|
||||
|
||||
else if you use version 1.79 nvi which is the latest version then
|
||||
fetch from ftp://ftp.cs.berkeley.edu/ucb/4bsd/nvi-1.79.tar.gz and
|
||||
|
||||
% tar xzvf nvi-1.79.tar.gz
|
||||
% cd nvi-1.79
|
||||
% patch -p < ../nvi-1.79.diff
|
||||
% cd build
|
||||
% ./configure
|
||||
% make
|
||||
# make install
|
||||
|
||||
Caution: If you use FreeBSD 2.2.2R or later, your nvi is already
|
||||
extended vi. Don't patch with nvi-1.79.diff.
|
||||
|
||||
else we have no patch for it.
|
||||
|
||||
4. Extended emacs (OPTIONAL)
|
||||
|
||||
The version of Emacs supported by GLOBAL is GNU Emacs 19.28, 19.34 or
|
||||
Mule 2.3 (= Emacs 19.28). Other emacs version seems to work well,
|
||||
but I don't confirm it.
|
||||
|
||||
You can get it from
|
||||
|
||||
Emacs 19.34b:
|
||||
ftp://prep.ai.mit.edu/pub/gnu/emacs-19.34b.tar.gz
|
||||
Mule 2.3:
|
||||
ftp://ftp.cs.buffalo.edu/pub/mule/mule-2.3.tar.gz
|
||||
|
||||
If you are a FreeBSD user, install it from 'package' (see pkg_add(1)).
|
||||
|
||||
If you have installed it then copy gtags.el in this package to the emacs
|
||||
lisp library directory or place the file in a directory
|
||||
(for example "~/lisp") and write $HOME/.emacs like this.
|
||||
|
||||
+-----------------------------------------------
|
||||
|(setq load-path (cons "~/lisp" load-path))
|
||||
|
||||
5. Gozilla (OPTIONAL)
|
||||
|
||||
You need X(1) to install gozilla.
|
||||
|
||||
% cd gozilla
|
||||
% xmkmf
|
||||
% make
|
||||
# make install
|
||||
# make install.man
|
||||
|
||||
Good luck!
|
||||
@@ -1,17 +1,21 @@
|
||||
COPYING Copyright notice.
|
||||
HISTORY Histroy of GLOBAL.
|
||||
INSTALL Installation method
|
||||
MANIFEST This file.
|
||||
Makefile Makefile for BSD.
|
||||
Makefile.inc A part of Makefile for BSD.
|
||||
Makefile.generic Makefile for generic UNIX(including BSD).
|
||||
PROBLEMS Problem report.
|
||||
README Readme (introduction and usage).
|
||||
VERSION Version number.
|
||||
btreeop/ Btreeop command directory.
|
||||
gctags/ Gctags command directory (extended ctags).
|
||||
global/ Global command directory.
|
||||
gozilla/ Gozilla command directory.
|
||||
gctags/ Extended ctags command directory.
|
||||
gtags/ Gtags command directory.
|
||||
htags/ Htags command directory.
|
||||
systags/ Script for kernel.
|
||||
lib/ library.
|
||||
gtags.el Gtags mode for Emacs.
|
||||
nvi-1.34.diff Patch for nvi 1.34.
|
||||
nvi-1.76.diff Patch for nvi 1.76.
|
||||
nvi-1.79.diff Patch for nvi 1.79.
|
||||
@@ -0,0 +1,3 @@
|
||||
SUBDIR= lib global gtags gctags btreeop htags systags
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -0,0 +1,7 @@
|
||||
BINDIR?= /usr/bin
|
||||
MANDIR?= /usr/share/man/man
|
||||
.if exists(${.OBJDIR}/../lib)
|
||||
LIBUTIL=${.OBJDIR}/../lib/libutil.a
|
||||
.else
|
||||
LIBUTIL=${.CURDIR}/../lib/libutil.a
|
||||
.endif
|
||||
@@ -0,0 +1,38 @@
|
||||
GLOBAL cannot recognize following macros and functions.
|
||||
|
||||
1. Macro which doesn't end with ';'.
|
||||
|
||||
GLOBAL cannot recognize func() after M(a), because M(a) seems to be
|
||||
function definition.
|
||||
|
||||
#define M(a) static char *string = a;
|
||||
|
||||
M(a)
|
||||
|
||||
func() {
|
||||
...
|
||||
}
|
||||
|
||||
It should be follows.
|
||||
|
||||
#define M(a) static char *string = a
|
||||
|
||||
M(a);
|
||||
|
||||
func() {
|
||||
...
|
||||
}
|
||||
|
||||
2. Macro which is a renamed function.
|
||||
|
||||
#define func _func
|
||||
|
||||
_func() {
|
||||
...
|
||||
}
|
||||
main() {
|
||||
func();
|
||||
}
|
||||
|
||||
In fact, main() calls _func() instead of func() but GLOBAL cannot
|
||||
recognize it.
|
||||
@@ -1,21 +1,33 @@
|
||||
|
||||
@@@@@@@-
|
||||
@- @-
|
||||
@- @-
|
||||
@- @- @@@@@- @@@@@@- @@- @-
|
||||
@- F o r a l l h a c h e r s. version 1.9
|
||||
@- @@@@@@-@- @- @- @@@@@- @- @- @-
|
||||
@- @- @- @- @- @- @- @@@@@- @-
|
||||
@- @- @- @- @- @- @-@- @- @-
|
||||
@@@@@@@@- @@@@- @@@@@- @@@@@@-@@@- @@@@- @@@@@@-
|
||||
@@@@@@@=
|
||||
@= @=
|
||||
@= @=
|
||||
@= @= @@@@@= @@@@@@= @@= @=
|
||||
@= F o r a l l h a c k e r s.
|
||||
@= @@@@@@=@= @= @= @@@@@= @= @= @=
|
||||
@= @= @= @= @= @= @= @@@@@= @=
|
||||
@= @= @= @= @= @= @=@= @= @=
|
||||
@@@@@@@@= @@@@= @@@@@= @@@@@@=@@@= @@@@= @@@@@@=
|
||||
|
||||
Shigio Yamaguchi 21-Apr-97
|
||||
Shigio Yamaguchi 20-Jan-98
|
||||
|
||||
Copyright 1996, 1997 Shigio Yamaguchi All right resereved.
|
||||
Copyright 1996, 1997, 1998
|
||||
Shigio Yamaguchi All right resereved.
|
||||
|
||||
----------------------------------------------------------
|
||||
Note:
|
||||
This version of GLOBAL makes 'GSYMS' tag file for
|
||||
searching symbols other than functions.
|
||||
(Try global(1) with -s option.)
|
||||
But the tag file is very large. If you hope not to
|
||||
make the file, please use gtags with -o (old) option.
|
||||
Htags(1) doesn't use 'GSYMS'.
|
||||
----------------------------------------------------------
|
||||
|
||||
GLOBAL is a browsing system for C and Yacc source code.
|
||||
It brings benefits to all hackers. Enjoy!
|
||||
|
||||
|
||||
Contents
|
||||
--------------------------------
|
||||
0. Introduction
|
||||
@@ -40,6 +52,14 @@ It brings benefits to all hackers. Enjoy!
|
||||
3.2. Preparation
|
||||
3.3. Usage
|
||||
3.4. To make hypertext of kernel
|
||||
3.5. Gozilla
|
||||
|
||||
4. Extended emacs using global
|
||||
|
||||
4.1. Features
|
||||
4.2. Preparation
|
||||
4.3. Basic usage
|
||||
4.4. Applied usage
|
||||
--------------------------------
|
||||
|
||||
0. Introduction
|
||||
@@ -54,9 +74,10 @@ It supports following environments.
|
||||
o shell command line(see '1. Global')
|
||||
o vi editor(see '2. Extended vi using global')
|
||||
o web browser(see '3. Hypertext generator')
|
||||
o emacs editor(see '4. Emacs using global')
|
||||
|
||||
GLOBAL is consist of global(1), gtags(1), btreeop(1), gctags(1), htags(1)
|
||||
and extended vi(1).
|
||||
GLOBAL is consist of global(1), gtags(1), btreeop(1), gctags(1), htags(1),
|
||||
extended vi(1), gtags.el and gozilla(1).
|
||||
|
||||
* 'extended' means being entended for GLOBAL.
|
||||
|
||||
@@ -77,7 +98,7 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
o Global allows duplicate entries.
|
||||
o Global can treat a source tree containing subdirectories and you can
|
||||
get relative path of objects from anywhere within the tree.
|
||||
o Global can understand perl's regular expression.
|
||||
o Global can understand POSIX 1003.2 regular expression (extension).
|
||||
o Global can search in not only a source tree but also library paths.
|
||||
o Global can treat yacc source file.
|
||||
|
||||
@@ -101,9 +122,6 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
GTAGS - database for function definition
|
||||
GRTAGS - database for function reference
|
||||
|
||||
If you cannot find functions that should exist, please try -e option.
|
||||
|
||||
% gtags -e
|
||||
|
||||
1.3. Basic usage
|
||||
|
||||
@@ -154,7 +172,7 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
% global -r func2
|
||||
../DIR1/fileA.c <- func2() is referred from fileA.c
|
||||
|
||||
You can use perl's regular expression.
|
||||
You can use POSIX regular expression (extension).
|
||||
|
||||
% cd ROOT
|
||||
% global 'func[1-3]'
|
||||
@@ -174,6 +192,11 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
% global -a func1
|
||||
/home/user/ROOT/DIR1/fileB.c
|
||||
|
||||
-s option locates any symbols other than function.
|
||||
|
||||
% global -xs X
|
||||
X 1 DIR2/fileC.c #ifdef X
|
||||
|
||||
You can edit files including specified function directly like this.
|
||||
|
||||
% vi `global func1` <- edit fileB.c
|
||||
@@ -311,14 +334,14 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
o Tag function of extended vi can locate not only function definitions
|
||||
but also function references.
|
||||
o Extended vi allows duplicate tag entries.
|
||||
o Extended vi can understand perl's regular expression as a tag name
|
||||
for search.
|
||||
o Extended vi can understand POSIX regular expression (extension)
|
||||
as a tag name for search.
|
||||
o Extended vi is completely upper compatible with original one.
|
||||
Above functions are available only in 'gtags mode'.
|
||||
|
||||
2.2. Preparation
|
||||
|
||||
First do the preparation of global. (Please see "1.2. Preparation").
|
||||
First, do the preparation of global. (Please see "1.2. Preparation").
|
||||
|
||||
Second, to use global from vi, you need to get into 'gtagsmode'.
|
||||
There are some ways to do it.
|
||||
@@ -409,10 +432,10 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
|
||||
o Other tag commands are available too.
|
||||
|
||||
<control-T>
|
||||
":tagpop"
|
||||
":tagtop"
|
||||
":display tags"
|
||||
<control-T> - Return to the most recent tag context.
|
||||
":tagpop" - Pop to the specified tag in the tags stack.
|
||||
":tagtop" - Pop to the top tag in the tags stack.
|
||||
":display tags" - Display tags stack.
|
||||
|
||||
Please read online manual.
|
||||
|
||||
@@ -470,6 +493,7 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
|
||||
o Htags makes hypertext from C source files.
|
||||
o Once the hypertext generated, you need nothing other than WWW browser.
|
||||
o You can move hypertext to anywhere. It is independent of the source code.
|
||||
o You can use all of your browser's functions, for example, search,
|
||||
history, bookmark, save, frame, windows and so on.
|
||||
|
||||
@@ -479,15 +503,20 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
disk space. For example, the source code of FreeBSD kernel needs the
|
||||
following disk space.
|
||||
|
||||
source code(/usr/src/sys) 14MB
|
||||
tag database(GTAGS,GRTAGS) 9MB(!)
|
||||
hypertext(HTML/*) 45MB(!!!)
|
||||
source code(/usr/src/sys) 14.0MB
|
||||
|
||||
GTAGS 1.5MB
|
||||
GRTAGS 8.0MB
|
||||
GSYMS 12.0MB
|
||||
HTML/ 55MB(!!!)
|
||||
-------------------------------------------------
|
||||
total 77MB
|
||||
|
||||
Please do the followings.
|
||||
|
||||
(at your source directory)
|
||||
% gtags <- make tag database
|
||||
% htags <- make hypertext
|
||||
% gtags <- make tag database(GTAGS,GRTAGS,GSYMS)
|
||||
% htags <- make hypertext(HTML/)
|
||||
|
||||
Then you will find 'HTML' directory in the current directory.
|
||||
|
||||
@@ -498,8 +527,8 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
% lynx HTML/index.html
|
||||
|
||||
You can use any browsers, for example, Lynx, Chimera, Mosaic,
|
||||
Netscape Navigator, Internet Explorer and so on.
|
||||
(But IE3.0 doesn't work well about index.)
|
||||
Netscape Navigator, Internet Explorer and so on. But some browsers
|
||||
cannot treat framed index. Then select '[no frame version is here]'.
|
||||
|
||||
You will understand the usage for the looking.
|
||||
You can move HTML directory to anywhere. It is independent of
|
||||
@@ -507,7 +536,7 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
|
||||
3.4. To make hypertext of kernel
|
||||
|
||||
If you would like to make hypertext of FreeBSD or Linux kernel source,
|
||||
If you would like to make hypertext of FreeBSD kernel source,
|
||||
it is convenient to use systags script in this package.
|
||||
|
||||
% cd /usr/src/sys
|
||||
@@ -516,10 +545,213 @@ All the functions for GLOBAL are enabled only in 'gtagsmode'.
|
||||
|
||||
% netscape HTML/index.html
|
||||
|
||||
You can use one level nested index and browse assembler source file too.
|
||||
You can use following functions with systags.
|
||||
|
||||
o input form for dynamic index.
|
||||
(This reqires you to setup httpd server for CGI program.)
|
||||
o one level nested index.
|
||||
o browse assembler source file.
|
||||
|
||||
Of course, you can use above functions without systags.
|
||||
Please see gtags(1), htags(1).
|
||||
|
||||
3.5. Gozilla
|
||||
|
||||
If you use Netscape Navigator, you can control the browser from command
|
||||
line by gozilla(1).
|
||||
|
||||
% gtags
|
||||
% htags
|
||||
% global -x fork
|
||||
fork 60 kern/kern_fork.c fork(p, uap, retval)
|
||||
% gozilla +60 kern/kern_fork.c
|
||||
%
|
||||
|
||||
Then you can see the hypertext about fork function directly on Netscape
|
||||
Navigator. If the browser has not been loaded, gozilla loads it.
|
||||
|
||||
If you use another browser like lynx, try this.
|
||||
|
||||
% gozilla -b lynx +60 kern/kern_fork.c
|
||||
|
||||
or
|
||||
|
||||
% setenv BROWSER lynx
|
||||
% gozilla +60 kern/kern_fork.c
|
||||
|
||||
You can send remote command to Netscape Navigator too. Try this.
|
||||
|
||||
% gozilla -C pagedown
|
||||
% gozilla -C pageup
|
||||
|
||||
The remote commands are undocumented, but you can see the hint in the
|
||||
resource file. (Netscape.ad file)
|
||||
|
||||
NOTES:
|
||||
Netscape Navigator is a registered trademark of Netscape Communications
|
||||
Corporation in the United States and other countries.
|
||||
|
||||
4. Extended emacs using global
|
||||
|
||||
4.1. Features
|
||||
|
||||
Addition to the extended vi,
|
||||
|
||||
o More intelligent to recongnize current token and its type.
|
||||
o Tag completion is available for input tag name.
|
||||
o Mouse event is supported.
|
||||
|
||||
4.2. Preparation
|
||||
|
||||
First, do the preparation of global. (Please see "1.2. Preparation").
|
||||
|
||||
Second, to use global from emacs, you need to load gtags.el file and
|
||||
execute gtags-mode function in it. There are some ways to do it.
|
||||
|
||||
(a) Start emacs, load gtags.el and execute gtags-mode function.
|
||||
|
||||
% emacs
|
||||
|
||||
|
|
||||
|J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
|
||||
|M-x load-library[RET]
|
||||
+------------------------------------------------------
|
||||
|
||||
|
|
||||
|J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
|
||||
|Load library: gtags[RET]
|
||||
+------------------------------------------------------
|
||||
|
||||
|
|
||||
|J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
|
||||
|M-x gtags-mode[RET]
|
||||
+------------------------------------------------------
|
||||
|
||||
(b) Previously write autoload function to $HOME/.emacs file,
|
||||
start emacs and execute gtags-mode function.
|
||||
|
||||
$HOME/.emacs
|
||||
+------------------------------------------------------
|
||||
|(autoload 'gtags-mode "gtags" "" t)
|
||||
|
||||
% emacs
|
||||
|
||||
|
|
||||
|J_:-----Mule: *scratch* (Lisp Interaction)--L16--All----
|
||||
|M-x gtags-mode[RET]
|
||||
+------------------------------------------------------
|
||||
|
||||
(c) Previously write autoload function to $HOME/.emacs file and
|
||||
start emacs with -f option
|
||||
|
||||
$HOME/.emacs
|
||||
+------------------------------------------------------
|
||||
|(autoload 'gtags-mode "gtags" "" t)
|
||||
|
||||
% emacs -f gtags-mode
|
||||
|
||||
|
||||
You must start emacs under the source tree described in "1.2. Preparation".
|
||||
|
||||
4.3. Basic usage
|
||||
|
||||
It is resemble to the extended vi based nvi-1.34.
|
||||
|
||||
o To go to func1, press 'ESC-t' and you can see a prompt in mini-buffer.
|
||||
Then input tag name.
|
||||
|
||||
:tag func1 # ':tag ' is a prompt.
|
||||
~~~~~
|
||||
o To go to referenced point of func1, press 'ESC-r'.
|
||||
|
||||
:rtag func1 # 'rtag ' is a prompt
|
||||
~~~~~
|
||||
|
||||
o Tag name completion is available.
|
||||
|
||||
:tag fu<TAB>
|
||||
|
||||
:tag func1 # 'nc1' is appended by emacs
|
||||
|
||||
o If a number of functions located, emacs goes into 'GTAGS SELECT MODE'
|
||||
like this.
|
||||
|
||||
+-------------------------------------------------------------
|
||||
|main 347 i386/isa/ultra14f.c main()
|
||||
|main 128 kern/init_main.c main(framep)
|
||||
|main 104 netiso/clnp_debug.c main()
|
||||
|main 164 netiso/xebec/main.c main(argc, argv)
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|J_:--%*-Mule: *scratch* (Gtags Select)--L1--All----
|
||||
|[GTAGS SELECT MODE] 4 lines
|
||||
+-------------------------------------------------------------
|
||||
|
||||
You can select a tag line by any emacs command and press [RETURN],
|
||||
and you can go to the tag's point. When you want to go to next or
|
||||
previous tag, you can return to 'GTAGS SELECT MODE' with <control-T>
|
||||
and reselect.
|
||||
|
||||
o <control-]> command is available.
|
||||
|
||||
If current token is a definition, it is identical to
|
||||
":rtag <current token>[RETURN]", otherwise ":tag <current token>[RETURN]".
|
||||
(GLOBAL decides this intelligentlly, but may sometimes misunderstand.)
|
||||
|
||||
o To go to any symbols other than function, try 'ESC-s'.
|
||||
|
||||
Find symbol: lbolt
|
||||
~~~~~
|
||||
o To go to any strings other than symbol, try 'ESC-g'.
|
||||
|
||||
Find pattern: Copyright
|
||||
~~~~~~~~~
|
||||
|
||||
4.4. Applied usage
|
||||
|
||||
o You can use POSIX regular expression (extension).
|
||||
|
||||
:tag ^put_ # locate tags start with 'put_'.
|
||||
|
||||
o If your source files are on a read only device like CDROM, please do
|
||||
the followings.
|
||||
|
||||
% mkdir /var/dbpath <- directory for tag file
|
||||
% cd /cdrom/src <- the root of source tree
|
||||
% gtags /var/dbpath <- make tag files in /var/dbpath
|
||||
% setenv GTAGSROOT `pwd`
|
||||
% setenv GTAGSDBPATH /var/dbpath
|
||||
% mule -f gtags-mode
|
||||
|
||||
o If you want to treat the references to the function that is not defined
|
||||
in the source tree like library functions or system calls,
|
||||
do the followings.
|
||||
|
||||
% cd /usr/src/lib
|
||||
% gtags <- probably as a root
|
||||
% cd /usr/src/sys
|
||||
% gtags
|
||||
% setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys
|
||||
% mule -f gtags-mode
|
||||
|
||||
o mouse command is avalable.
|
||||
|
||||
If you use X version emacs, try this.
|
||||
(But xemacs doesn't work well. I don't know why.)
|
||||
|
||||
Move mouse cursor to a function name and click center button. And you
|
||||
will go to function's definition or references depending on the context.
|
||||
In 'GTAGS SELECT MODE', move mouse cursor to a line and click center
|
||||
button.
|
||||
|
||||
To return to the previous position, click right button.
|
||||
|
||||
Thank you for your reading of my poor english.
|
||||
And of course, I'm grateful to Keith Bostic for his excellent nvi(1) and db(3).
|
||||
And of course, I'm grateful to all excellent tools (vi, emacs, perl, C, db,
|
||||
mozilla ...) and its authors.
|
||||
----------------------------------------------------------------------------
|
||||
E-Mail: <[email protected]>
|
||||
WWW: <http://wafu.netgate.net/tama/unix/indexe.html>
|
||||
@@ -0,0 +1 @@
|
||||
2.24
|
||||
@@ -0,0 +1,6 @@
|
||||
PROG= btreeop
|
||||
CFLAGS+=-I${.CURDIR}/../lib
|
||||
LDADD= $(LIBUTIL)
|
||||
DPADD= $(LIBUTIL)
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -28,7 +28,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 21, 1997
|
||||
.Dd Nov 26, 1997
|
||||
.Dt BTREEOP 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
@@ -38,12 +38,10 @@
|
||||
.Nm btreeop
|
||||
.Op Fl A
|
||||
.Op Fl C
|
||||
.Op Fl D Ar key
|
||||
.Op Fl K Ar key
|
||||
.Op Fl b
|
||||
.Op Fl c Ar cashesize
|
||||
.Op Fl l
|
||||
.Op Fl p Ar psize
|
||||
.Op Fl D[keyno] Ar key
|
||||
.Op Fl K[keyno] Ar key
|
||||
.Op Fl L
|
||||
.Op Fl k Ar prefix
|
||||
.Op Ar dbname
|
||||
.Sh DESCRIPTION
|
||||
.Nm Btreeop
|
||||
@@ -51,9 +49,11 @@ execute simple operations for
|
||||
.Xr btree 3
|
||||
database.
|
||||
.Nm Btreeop
|
||||
can create database, write record, read record (sequential or index) and
|
||||
can create database, write record, read record (sequential or indexed) and
|
||||
delete record from it.
|
||||
Duplicate entries are allowed.
|
||||
Multi-key is available but only primary key can use index of
|
||||
.Xr btree 3 .
|
||||
.Sh OPTIONS
|
||||
A capital letter means a command. If no command specified
|
||||
then it assume sequential read operation.
|
||||
@@ -62,22 +62,25 @@ then it assume sequential read operation.
|
||||
append records. If database doesn't exist, btreeop creates it.
|
||||
.It Fl C
|
||||
create database and write records to it.
|
||||
.It Fl D Ar key
|
||||
delete records by the key.
|
||||
.It Fl K Ar key
|
||||
search records by the key.
|
||||
.It Fl b
|
||||
assume BIG_ENDIAN byte order. default is LITTLE_ENDIAN.
|
||||
.It Fl c Ar cashesize
|
||||
specify cashesize. It's identical to
|
||||
.Nm info.cachesize
|
||||
of BTREEINFO. (see btree(3))
|
||||
.It Fl l
|
||||
assume LITTLE_ENDIAN byte order. (the default)
|
||||
.It Fl p Ar psize
|
||||
specify page size. It's identical to
|
||||
.Nm info.psize
|
||||
of BTREEINFO. (see btree(3))
|
||||
.It Fl D[keyno] Ar key
|
||||
delete records by the key. By default, keyno is 0 (primary key).
|
||||
.It Fl K[keyno] Ar key
|
||||
search records by the key. By default, keyno is 0 (primary key).
|
||||
.It Fl L
|
||||
list all primary keys.
|
||||
Following two command lines are identical except that the latter is much faster.
|
||||
|
||||
btreeop | awk '{print $1}' | uniq
|
||||
|
||||
btreeop -L
|
||||
.It Fl k Ar prefix
|
||||
scan records which have the prefix as a primary key.
|
||||
This option is valid only with sequential read operation (-L command or non command).
|
||||
Following two command lines are identical except that the latter is much faster.
|
||||
|
||||
btreeop | awk '$1 ~ /^fo/ {print }'
|
||||
|
||||
btreeop -k fo
|
||||
.It Ar dbname
|
||||
database name. default is 'btree'.
|
||||
.Sh DATA FORMAT
|
||||
@@ -86,8 +89,11 @@ To creat (or append) database,
|
||||
read data from stdin.
|
||||
The format of the data is the following.
|
||||
|
||||
Key Data\\n
|
||||
Key Data\\n
|
||||
Primary-key Secondary-key-1 Secondary-key-2 Data
|
||||
(keyno = 0) (keyno = 1) (keyno = 2)
|
||||
--------------------------------------------------------------
|
||||
main 246 main.c main (){\\n
|
||||
func 120 library.c func(a1, a2)\\n
|
||||
.
|
||||
.
|
||||
.
|
||||
@@ -96,17 +102,17 @@ The format of the data is the following.
|
||||
|
||||
.Bl -enum -offset indent
|
||||
.It
|
||||
Key and Data are separated by blank('\\t' or ' ').
|
||||
All key and data are separated by blank('\\t' or ' ').
|
||||
.It
|
||||
Key cannot include blank.
|
||||
.It
|
||||
Data can include blank.
|
||||
.It
|
||||
Null Data not allowed.
|
||||
Null data not allowed.
|
||||
.It
|
||||
Additionally, META record is available. META record has a key that start with
|
||||
a blank. You can read this record only by indexed search (with -K option).
|
||||
Usage is unlimited by Btreeop.
|
||||
a blank. You can read this record only by indexed read operation (-K option).
|
||||
Usage is unlimited by btreeop.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Create database.
|
||||
@@ -129,10 +135,10 @@ Append records.
|
||||
Sequential read.
|
||||
|
||||
% btreeop
|
||||
key1 data1
|
||||
key2 data2-2
|
||||
key2 data2
|
||||
key3 data3
|
||||
key2 data2-2
|
||||
key1 data1
|
||||
%
|
||||
|
||||
Indexed read.
|
||||
@@ -144,6 +150,14 @@ Indexed read.
|
||||
__.VERSION 2
|
||||
%
|
||||
|
||||
List primary keys.
|
||||
|
||||
% btreeop -L
|
||||
key1
|
||||
key2
|
||||
key3
|
||||
%
|
||||
|
||||
Delete record.
|
||||
|
||||
% btreeop -D ' __.VERSION'
|
||||
@@ -157,7 +171,7 @@ default database name.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Nm Btreeop
|
||||
exits with a value of 1 if an error occurred, 0 otherwise.
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr btree 3
|
||||
.Sh AUTHOR
|
||||
@@ -165,4 +179,4 @@ Shigio Yamaguchi ([email protected])
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in FreeBSD 2.2.
|
||||
command appeared in FreeBSD 2.2.2.
|
||||
@@ -0,0 +1,344 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Shigio Yamaguchi.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* btreeop.c 6-Nov-97
|
||||
*
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dbio.h"
|
||||
#include "global.h"
|
||||
|
||||
char *dbdefault = "btree"; /* default database name */
|
||||
char *progname = "btreeop"; /* command name */
|
||||
|
||||
static void usage __P((void));
|
||||
void signal_setup __P((void));
|
||||
void onintr __P((int));
|
||||
void main __P((int, char **));
|
||||
void dbwrite __P((DBIO *));
|
||||
void dbkey __P((DBIO *, char *, int));
|
||||
void dbscan __P((DBIO *, char *, int));
|
||||
void dbdel __P((DBIO *, char *, int));
|
||||
void dbbysecondkey __P((DBIO *, int, char *, int));
|
||||
|
||||
#define F_KEY 0
|
||||
#define F_DEL 1
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n",
|
||||
"usage: btreeop [-A][-C][-D[n] key][-K[n] key][-L][-k prefix][dbname]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Btreeop catch signal even if the parent ignore it.
|
||||
*/
|
||||
int exitflag = 0;
|
||||
|
||||
void
|
||||
onintr(signo)
|
||||
int signo;
|
||||
{
|
||||
exitflag = 1;
|
||||
}
|
||||
|
||||
void
|
||||
signal_setup()
|
||||
{
|
||||
signal(SIGHUP, onintr);
|
||||
signal(SIGINT, onintr);
|
||||
signal(SIGQUIT, onintr);
|
||||
signal(SIGTERM, onintr);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char command = 'R';
|
||||
char *key = NULL;
|
||||
int mode = 0;
|
||||
char *dbname;
|
||||
DBIO *dbio;
|
||||
int i, c;
|
||||
int secondkey = 0;
|
||||
char *prefix = (char *)0;
|
||||
|
||||
for (i = 1; i < argc && argv[i][0] == '-'; ++i) {
|
||||
switch (c = argv[i][1]) {
|
||||
case 'D':
|
||||
case 'K':
|
||||
if (argv[i][2] && isdigit(argv[i][2]))
|
||||
secondkey = atoi(&argv[i][2]);
|
||||
key = argv[++i];
|
||||
case 'A':
|
||||
case 'C':
|
||||
case 'L':
|
||||
if (command != 'R')
|
||||
usage();
|
||||
command = c;
|
||||
break;
|
||||
case 'k':
|
||||
prefix = argv[++i];
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
dbname = (i < argc) ? argv[i] : dbdefault;
|
||||
switch (command) {
|
||||
case 'A':
|
||||
case 'D':
|
||||
mode = 2;
|
||||
break;
|
||||
case 'C':
|
||||
mode = 1;
|
||||
break;
|
||||
case 'K':
|
||||
case 'L':
|
||||
case 'R':
|
||||
mode = 0;
|
||||
break;
|
||||
}
|
||||
dbio = db_open(dbname, mode, 0644, DBIO_DUP);
|
||||
if (dbio == NULL)
|
||||
die1("db_open failed (dbname = %s).", dbname);
|
||||
|
||||
switch (command) {
|
||||
case 'A': /* Append records */
|
||||
case 'C': /* Create database */
|
||||
dbwrite(dbio);
|
||||
break;
|
||||
case 'D': /* Delete records */
|
||||
dbdel(dbio, key, secondkey);
|
||||
break;
|
||||
case 'K': /* Keyed (indexed) read */
|
||||
dbkey(dbio, key, secondkey);
|
||||
break;
|
||||
case 'R': /* sequencial Read */
|
||||
case 'L': /* primary key List */
|
||||
dbscan(dbio, prefix, (command == 'L') ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
db_close(dbio);
|
||||
if (exitflag)
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* dbwrite: write to database
|
||||
*
|
||||
* i) dbio database
|
||||
*/
|
||||
void
|
||||
dbwrite(dbio)
|
||||
DBIO *dbio;
|
||||
{
|
||||
char *p;
|
||||
char keybuf[MAXKEYLEN+1];
|
||||
char *c;
|
||||
|
||||
signal_setup();
|
||||
/*
|
||||
* Input file format:
|
||||
* +--------------------------------------------------
|
||||
* |Primary-key secondary-key-1 secondary-key-2 Data\n
|
||||
* |Primary-key secondary-key-1 secondary-key-2 Data\n
|
||||
* .
|
||||
* .
|
||||
* - Keys and Data are separated by blank('\t' or ' ').
|
||||
* - Keys cannot include blank.
|
||||
* - Data can include blank.
|
||||
* - Null record not allowed.
|
||||
* - Secondary-key is assumed as a part of data by db(3).
|
||||
*
|
||||
* META record:
|
||||
* You can write meta record by making key start with a ' '.
|
||||
* You can read this record only by indexed read ('-K' option).
|
||||
* +------------------
|
||||
* | __.VERSION 2
|
||||
*/
|
||||
while ((p = mgets(stdin, 0, NULL)) != NULL) {
|
||||
if (exitflag)
|
||||
break;
|
||||
c = p;
|
||||
if (*c == ' ') { /* META record */
|
||||
if (*++c == ' ')
|
||||
die("key cannot include blanks.");
|
||||
}
|
||||
for (; *c && !isspace(*c); c++) /* skip key part */
|
||||
;
|
||||
if (*c == 0)
|
||||
die("data part not found.");
|
||||
if (c - p > MAXKEYLEN)
|
||||
die("primary key too long.");
|
||||
strncpy(keybuf, p, c - p); /* make key string */
|
||||
keybuf[c - p] = 0;
|
||||
for (; *c && isspace(*c); c++) /* skip blanks */
|
||||
;
|
||||
if (*c == 0)
|
||||
die("data part is null.");
|
||||
entab(p);
|
||||
db_put(dbio, keybuf, p);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* dbkey: Keyed search
|
||||
*
|
||||
* i) dbio database
|
||||
* i) skey key for search
|
||||
* i) secondkey 0: primary key, >0: secondary key
|
||||
*/
|
||||
void
|
||||
dbkey(dbio, skey, secondkey)
|
||||
DBIO *dbio;
|
||||
char *skey;
|
||||
int secondkey;
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!secondkey) {
|
||||
for (p = db_first(dbio, skey, 0); p; p = db_next(dbio))
|
||||
detab(stdout, p);
|
||||
return;
|
||||
}
|
||||
dbbysecondkey(dbio, F_KEY, skey, secondkey);
|
||||
}
|
||||
|
||||
/*
|
||||
* dbscan: Scan records
|
||||
*
|
||||
* i) dbio database
|
||||
* i) prefix prefix of primary key
|
||||
* i) keylist 0: key and data, 1: primary key only
|
||||
*/
|
||||
void
|
||||
dbscan(dbio, prefix, keylist)
|
||||
DBIO *dbio;
|
||||
char *prefix;
|
||||
int keylist;
|
||||
{
|
||||
char *p;
|
||||
int flags = DBIO_SKIPMETA;
|
||||
|
||||
if (prefix)
|
||||
flags |= DBIO_PREFIX;
|
||||
if (keylist)
|
||||
flags |= DBIO_KEY;
|
||||
|
||||
for (p = db_first(dbio, prefix, flags); p; p = db_next(dbio))
|
||||
detab(stdout, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* dbdel: Delete records
|
||||
*
|
||||
* i) dbio database
|
||||
* i) skey key for search
|
||||
* i) secondkey 0: primary key, >0: secondary key
|
||||
*/
|
||||
void
|
||||
dbdel(dbio, skey, secondkey)
|
||||
DBIO *dbio;
|
||||
char *skey;
|
||||
int secondkey;
|
||||
{
|
||||
signal_setup();
|
||||
if (!secondkey) {
|
||||
db_del(dbio, skey);
|
||||
return;
|
||||
}
|
||||
dbbysecondkey(dbio, F_DEL, skey, secondkey);
|
||||
}
|
||||
/*
|
||||
* dbbysecondkey: proc by second key
|
||||
*
|
||||
* i) dbio database
|
||||
* i) func F_KEY, F_DEL
|
||||
* i) skey
|
||||
* i) secondkey
|
||||
*/
|
||||
void
|
||||
dbbysecondkey(dbio, func, skey, secondkey)
|
||||
DBIO *dbio;
|
||||
int func;
|
||||
char *skey;
|
||||
int secondkey;
|
||||
{
|
||||
char *c, *p;
|
||||
int i;
|
||||
|
||||
/* trim skey */
|
||||
for (c = skey; *c && isspace(*c); c++)
|
||||
;
|
||||
skey = c;
|
||||
for (c = skey+strlen(skey)-1; *c && isspace(*c); c--)
|
||||
*c = 0;
|
||||
|
||||
for (p = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio)) {
|
||||
if (exitflag)
|
||||
break;
|
||||
c = p;
|
||||
/* reach to specified key */
|
||||
for (i = secondkey; i; i--) {
|
||||
for (; *c && !isspace(*c); c++)
|
||||
;
|
||||
if (*c == 0)
|
||||
die("specified key not found.");
|
||||
for (; *c && isspace(*c); c++)
|
||||
;
|
||||
if (*c == 0)
|
||||
die("specified key not found.");
|
||||
}
|
||||
i = strlen(skey);
|
||||
if (!strncmp(c, skey, i) && (*(c+i) == 0 || isspace(*(c+i)))) {
|
||||
switch (func) {
|
||||
case F_KEY:
|
||||
detab(stdout, p);
|
||||
break;
|
||||
case F_DEL:
|
||||
db_del(dbio, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (exitflag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -35,18 +35,20 @@
|
||||
static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ctags.h"
|
||||
#include "lookup.h"
|
||||
|
||||
static int func_entry __P((void));
|
||||
static void hash_entry __P((void));
|
||||
static void skip_string __P((int));
|
||||
static int str_entry __P((int));
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
static int cmp __P((const void *, const void *));
|
||||
static int isstatement __P((char *));
|
||||
static void define_line __P((void));
|
||||
@@ -116,7 +118,7 @@ c_entries()
|
||||
*/
|
||||
if (--level < 0)
|
||||
level = 0;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
/*
|
||||
* -e flag force a function to end when a '}' appear
|
||||
* at column 0. If -e flag not specified, all functions
|
||||
@@ -192,7 +194,7 @@ c_entries()
|
||||
/*
|
||||
* if we have a current token, parenthesis on
|
||||
* level zero indicates a function.
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
* in the case of rflag == 1, if we have a current token,
|
||||
* parenthesis on level > zero indicates a function reference.
|
||||
#endif
|
||||
@@ -201,10 +203,14 @@ c_entries()
|
||||
#endif
|
||||
*/
|
||||
case '(':
|
||||
#ifdef GLOBAL
|
||||
if (sflag)
|
||||
break;
|
||||
#endif
|
||||
#ifdef YACC
|
||||
if (inyacc == NO)
|
||||
#endif
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (!rflag && !level && token)
|
||||
#else
|
||||
if (!level && token)
|
||||
@@ -222,7 +228,7 @@ c_entries()
|
||||
*/
|
||||
getline();
|
||||
curline = lineno;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
/* to make sure. */
|
||||
if (!isstatement(tok))
|
||||
#endif
|
||||
@@ -232,13 +238,14 @@ c_entries()
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
else if (rflag && level && token) {
|
||||
if (sp != tok)
|
||||
*sp = EOS;
|
||||
getline();
|
||||
if (!isstatement(tok) && isdefined(tok))
|
||||
if (!isstatement(tok) && lookup(tok)) {
|
||||
getline();
|
||||
pfnote(tok, lineno);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -305,13 +312,7 @@ c_entries()
|
||||
* reserved words.
|
||||
*/
|
||||
default:
|
||||
#ifdef BUGFIX
|
||||
/*
|
||||
* to treat following function.
|
||||
* func (arg) {
|
||||
* ....
|
||||
* }
|
||||
*/
|
||||
/* ignore whitespace */
|
||||
if (c == ' ' || c == '\t') {
|
||||
int save = c;
|
||||
while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
|
||||
@@ -321,12 +322,39 @@ c_entries()
|
||||
(void)ungetc(c, inf);
|
||||
c = save;
|
||||
}
|
||||
#endif
|
||||
storec: if (!intoken(c)) {
|
||||
if (sp == tok)
|
||||
break;
|
||||
*sp = EOS;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
/* ignore assembler in C source */
|
||||
if (!memcmp(tok, "_asm",4)) {
|
||||
while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
|
||||
;
|
||||
if (c == EOF)
|
||||
return;
|
||||
if (c == '{') {
|
||||
while (GETC(!=, EOF) && c != '}') {
|
||||
if (c == '\n')
|
||||
SETLINE;
|
||||
}
|
||||
} else {
|
||||
while (GETC(!=, EOF) && c != '\n')
|
||||
;
|
||||
if (c == '\n')
|
||||
SETLINE;
|
||||
}
|
||||
if (c == EOF)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (sflag) {
|
||||
if (!isstatement(tok)) {
|
||||
getline();
|
||||
pfnote(tok, lineno);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!memcmp(tok, "extern",7)) {
|
||||
while (GETC(!=, EOF) && c != ';') {
|
||||
if (c == '\n')
|
||||
@@ -367,6 +395,18 @@ c_entries()
|
||||
*sp++ = c;
|
||||
token = YES;
|
||||
}
|
||||
#ifdef GLOBAL
|
||||
/* skip hex number */
|
||||
else if (sp == tok && c == '0') {
|
||||
if (GETC(==, 'x') || c == 'X') {
|
||||
while (GETC(!=, EOF) && isxdigit(c))
|
||||
;
|
||||
if (c == EOF)
|
||||
return;
|
||||
}
|
||||
(void)ungetc(c, inf);
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
/* end of default */
|
||||
} /* end of switch */
|
||||
@@ -454,15 +494,10 @@ hash_entry()
|
||||
char *sp; /* buffer pointer */
|
||||
char tok[MAXTOKEN]; /* storage buffer */
|
||||
|
||||
#ifdef BUGFIX
|
||||
/*
|
||||
* to treat following macro.
|
||||
* # macro(arg) ....
|
||||
*/
|
||||
/* ignore leading whitespace */
|
||||
while (GETC(!=, EOF) && (c == ' ' || c == '\t'))
|
||||
;
|
||||
(void)ungetc(c, inf);
|
||||
#endif
|
||||
curline = lineno;
|
||||
for (sp = tok;;) { /* get next token */
|
||||
if (GETC(==, EOF))
|
||||
@@ -472,8 +507,16 @@ hash_entry()
|
||||
*sp++ = c;
|
||||
}
|
||||
*sp = EOS;
|
||||
#ifdef GLOBAL
|
||||
if (sflag && memcmp(tok, "include", 7)) {
|
||||
(void)ungetc(c, inf);
|
||||
define_line();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (memcmp(tok, "define", 6)) /* only interested in #define's */
|
||||
goto skip;
|
||||
|
||||
for (;;) { /* this doesn't handle "#define \n" */
|
||||
if (GETC(==, EOF))
|
||||
return;
|
||||
@@ -492,12 +535,12 @@ hash_entry()
|
||||
break;
|
||||
}
|
||||
*sp = EOS;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (rflag) {
|
||||
/*
|
||||
* #define XXX\n
|
||||
*/
|
||||
if (c == '\n' || (c == '\r' && GETC(==, '\n'))) {
|
||||
if (c == '\n') {
|
||||
SETLINE;
|
||||
return;
|
||||
}
|
||||
@@ -531,19 +574,13 @@ hash_entry()
|
||||
}
|
||||
skip: if (c == '\n') { /* get rid of rest of define */
|
||||
SETLINE
|
||||
#ifdef MODIFY
|
||||
if (*(sp - 1) == '\r') {
|
||||
if (*(sp - 2) != '\\')
|
||||
return;
|
||||
} else
|
||||
#endif
|
||||
if (*(sp - 1) != '\\')
|
||||
return;
|
||||
}
|
||||
(void)skip_key('\n');
|
||||
}
|
||||
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
/* sorted by alphabet */
|
||||
static struct words {
|
||||
char *name;
|
||||
@@ -619,12 +656,20 @@ define_line()
|
||||
goto endtok;
|
||||
|
||||
case '\\':
|
||||
if (GETC(==, '\n') || (c == '\r' && GETC(==, '\n'))) {
|
||||
if (GETC(==, '\n')) {
|
||||
SETLINE;
|
||||
}
|
||||
continue;
|
||||
|
||||
case '\n':
|
||||
if (sflag && token) {
|
||||
if (sp != tok)
|
||||
*sp = EOS;
|
||||
if (!isstatement(tok)) {
|
||||
getline();
|
||||
pfnote(tok, lineno);
|
||||
}
|
||||
}
|
||||
SETLINE;
|
||||
return;
|
||||
endtok: if (sp > tok) {
|
||||
@@ -651,11 +696,13 @@ define_line()
|
||||
goto storec;
|
||||
|
||||
case '(':
|
||||
if (sflag)
|
||||
break;
|
||||
if (token) {
|
||||
if (sp != tok)
|
||||
*sp = EOS;
|
||||
getline();
|
||||
if (!isstatement(tok) && isdefined(tok))
|
||||
if (!isstatement(tok) && lookup(tok))
|
||||
pfnote(tok, lineno);
|
||||
break;
|
||||
}
|
||||
@@ -670,6 +717,13 @@ storec: if (!intoken(c)) {
|
||||
break;
|
||||
*sp = EOS;
|
||||
sp = tok;
|
||||
if (sflag) {
|
||||
if (!isstatement(tok)) {
|
||||
getline();
|
||||
pfnote(tok, lineno);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (sp != tok || begtoken(c)) {
|
||||
*sp++ = c;
|
||||
@@ -774,10 +828,6 @@ skip_string(key)
|
||||
case '\\': /* a backslash escapes anything */
|
||||
skip = !skip; /* we toggle in case it's "\\" */
|
||||
break;
|
||||
#ifdef MODIFY
|
||||
case '\r':
|
||||
break;
|
||||
#endif
|
||||
case '\n':
|
||||
SETLINE;
|
||||
/*FALLTHROUGH*/
|
||||
@@ -823,10 +873,6 @@ skip_key(key)
|
||||
(void)ungetc(c, inf);
|
||||
c = '/';
|
||||
goto norm;
|
||||
#ifdef MODIFY
|
||||
case '\r':
|
||||
break;
|
||||
#endif
|
||||
case '\n':
|
||||
SETLINE;
|
||||
/*FALLTHROUGH*/
|
||||
@@ -0,0 +1,7 @@
|
||||
PROG= gctags
|
||||
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lib
|
||||
LDADD= $(LIBUTIL)
|
||||
DPADD= $(LIBUTIL)
|
||||
SRCS= C.c ctags.c fortran.c lisp.c print.c tree.c yacc.c assembler.c
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -32,74 +32,77 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)assembler.c 8.3 (Berkeley) 6/6/97";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ctags.h"
|
||||
#include "lookup.h"
|
||||
|
||||
/*
|
||||
* lisp tag functions
|
||||
* just look for (def or (DEF
|
||||
*/
|
||||
#ifdef GLOBAL
|
||||
void
|
||||
l_entries()
|
||||
asm_entries()
|
||||
{
|
||||
int special;
|
||||
char *cp;
|
||||
char savedc;
|
||||
char tok[MAXTOKEN];
|
||||
char *lbp;
|
||||
char tok[MAXTOKEN];
|
||||
char *sp;
|
||||
|
||||
for (;;) {
|
||||
lineftell = ftell(inf);
|
||||
if (!fgets(lbuf, sizeof(lbuf), inf))
|
||||
return;
|
||||
++lineno;
|
||||
lbp = lbuf;
|
||||
if (!cicmp("(def"))
|
||||
continue;
|
||||
special = NO;
|
||||
switch(*lbp | ' ') {
|
||||
case 'm':
|
||||
if (cicmp("method"))
|
||||
special = YES;
|
||||
break;
|
||||
case 'w':
|
||||
if (cicmp("wrapper") || cicmp("whopper"))
|
||||
special = YES;
|
||||
if (rflag) {
|
||||
/* extract only call EXT(xxx) or call _xxx */
|
||||
lbp = lbuf;
|
||||
while (*lbp && isspace(*lbp))
|
||||
lbp++;
|
||||
if (*lbp != 'c' || strncmp(lbp, "call", 4))
|
||||
continue;
|
||||
lbp += 4;
|
||||
while (*lbp && isspace(*lbp))
|
||||
lbp++;
|
||||
sp = tok;
|
||||
if (!strncmp(lbp, "EXT(" /* ) */, 4)) {
|
||||
lbp += 4;
|
||||
while (*lbp && intoken(*lbp))
|
||||
*sp++ = *lbp++;
|
||||
if (*lbp != /* ( */ ')')
|
||||
continue;
|
||||
*sp = EOS;
|
||||
} else if (*lbp == '_') {
|
||||
lbp++;
|
||||
while (*lbp && intoken(*lbp))
|
||||
*sp++ = *lbp++;
|
||||
*sp = EOS;
|
||||
} else
|
||||
continue;
|
||||
if (!lookup(tok))
|
||||
continue;
|
||||
} else {
|
||||
/* extract only ENTRY() and ALTENTRY(). */
|
||||
if (lbuf[0] != 'E' && lbuf[0] != 'A')
|
||||
continue;
|
||||
lbp = lbuf;
|
||||
if (!strncmp(lbp, "ENTRY(", 6)) {
|
||||
lbp += 6;
|
||||
} else if (!strncmp(lbp, "ALTENTRY(", 9)) {
|
||||
lbp += 9;
|
||||
} else
|
||||
continue;
|
||||
sp = tok;
|
||||
while (*lbp && intoken(*lbp))
|
||||
*sp++ = *lbp++;
|
||||
if (*lbp != /* ( */ ')')
|
||||
continue;
|
||||
*sp = EOS;
|
||||
}
|
||||
for (; !isspace(*lbp); ++lbp)
|
||||
continue;
|
||||
for (; isspace(*lbp); ++lbp)
|
||||
continue;
|
||||
for (cp = lbp; *cp && *cp != '\n'; ++cp)
|
||||
continue;
|
||||
*cp = EOS;
|
||||
if (special) {
|
||||
if (!(cp = strchr(lbp, ')')))
|
||||
continue;
|
||||
for (; cp >= lbp && *cp != ':'; --cp)
|
||||
continue;
|
||||
if (cp < lbp)
|
||||
continue;
|
||||
lbp = cp;
|
||||
for (; *cp && *cp != ')' && *cp != ' '; ++cp)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
for (cp = lbp + 1;
|
||||
*cp && *cp != '(' && *cp != ' '; ++cp)
|
||||
continue;
|
||||
savedc = *cp;
|
||||
*cp = EOS;
|
||||
(void)strcpy(tok, lbp);
|
||||
*cp = savedc;
|
||||
getline();
|
||||
pfnote(tok, lineno);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
#endif
|
||||
@@ -38,14 +38,10 @@ static const char copyright[] =
|
||||
#endif /* not lint */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ctags.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
"$Id: ctags.c,v 1.1.1.3 1998/02/02 05:38:07 cwt Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -53,6 +49,10 @@ static const char rcsid[] =
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ctags.h"
|
||||
#ifdef GLOBAL
|
||||
#include "lookup.h"
|
||||
#include "die.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ctags: create a tags file
|
||||
@@ -69,17 +69,21 @@ FILE *outf; /* ioptr for tags file */
|
||||
long lineftell; /* ftell after getc( inf ) == '\n' */
|
||||
|
||||
int lineno; /* line number of current line */
|
||||
#ifdef GLOBAL
|
||||
int cflag; /* -c: compact index */
|
||||
#endif
|
||||
int dflag; /* -d: non-macro defines */
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
int eflag; /* -e: '{' at 0 column force function end */
|
||||
#endif
|
||||
int tflag; /* -t: create tags for typedefs */
|
||||
int vflag; /* -v: vgrind style index output */
|
||||
int wflag; /* -w: suppress warnings */
|
||||
int xflag; /* -x: cxref style output */
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
int Dflag; /* -D: allow duplicate entrys */
|
||||
int rflag; /* -r: function reference */
|
||||
int sflag; /* -s: collect symbols */
|
||||
#endif
|
||||
#ifdef YACC
|
||||
int yaccfile; /* yacc file */
|
||||
@@ -88,12 +92,14 @@ int yaccfile; /* yacc file */
|
||||
char *curfile; /* current input file name */
|
||||
char searchar = '/'; /* use /.../ searches by default */
|
||||
char lbuf[LINE_MAX];
|
||||
char *progname = "gctags"; /* program name */
|
||||
|
||||
void init __P((void));
|
||||
void find_entries __P((char *));
|
||||
void main __P((int, char **));
|
||||
static void usage __P((void));
|
||||
|
||||
int
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@@ -109,8 +115,8 @@ main(argc, argv)
|
||||
extern int optind;
|
||||
|
||||
aflag = uflag = NO;
|
||||
#ifdef GTAGS
|
||||
while ((ch = getopt(argc, argv, "BDFadef:rtuwvxy")) != -1)
|
||||
#ifdef GLOBAL
|
||||
while ((ch = getopt(argc, argv, "BDFacdef:rstuwvx")) != -1)
|
||||
#else
|
||||
while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1)
|
||||
#endif
|
||||
@@ -118,7 +124,7 @@ main(argc, argv)
|
||||
case 'B':
|
||||
searchar = '?';
|
||||
break;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
case 'D':
|
||||
Dflag++;
|
||||
break;
|
||||
@@ -126,13 +132,23 @@ main(argc, argv)
|
||||
case 'F':
|
||||
searchar = '/';
|
||||
break;
|
||||
#ifdef GLOBAL
|
||||
case 's':
|
||||
sflag++;
|
||||
break;
|
||||
#endif
|
||||
case 'a':
|
||||
aflag++;
|
||||
break;
|
||||
#ifdef GLOBAL
|
||||
case 'c':
|
||||
cflag++;
|
||||
break;
|
||||
#endif
|
||||
case 'd':
|
||||
dflag++;
|
||||
break;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
case 'e':
|
||||
eflag++;
|
||||
break;
|
||||
@@ -140,7 +156,7 @@ main(argc, argv)
|
||||
case 'f':
|
||||
outfile = optarg;
|
||||
break;
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
case 'r':
|
||||
rflag++;
|
||||
break;
|
||||
@@ -165,17 +181,24 @@ main(argc, argv)
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
if (!argc)
|
||||
if (!argc)
|
||||
usage();
|
||||
#ifdef GTAGS
|
||||
if (rflag)
|
||||
gtagopen();
|
||||
#ifdef GLOBAL
|
||||
if (sflag && rflag)
|
||||
die("-s and -r conflict.");
|
||||
if (rflag) {
|
||||
char *dbpath;
|
||||
|
||||
if (!(dbpath = getenv("GTAGSDBPATH")))
|
||||
dbpath = ".";
|
||||
lookupopen(dbpath);
|
||||
}
|
||||
#endif
|
||||
init();
|
||||
|
||||
for (exit_val = step = 0; step < argc; ++step)
|
||||
if (!(inf = fopen(argv[step], "r"))) {
|
||||
warnx("%s cannot open", argv[step]);
|
||||
fprintf(stderr, "%s: %s cannot open\n", progname, argv[step]);
|
||||
exit_val = 1;
|
||||
}
|
||||
else {
|
||||
@@ -185,9 +208,13 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
if (head)
|
||||
if (xflag)
|
||||
if (xflag) {
|
||||
put_entries(head);
|
||||
else {
|
||||
#ifdef GLOBAL
|
||||
if (cflag)
|
||||
compact_print("", 0, "");/* flush last record */
|
||||
#endif
|
||||
} else {
|
||||
if (uflag) {
|
||||
for (step = 0; step < argc; step++) {
|
||||
(void)sprintf(cmd,
|
||||
@@ -199,7 +226,7 @@ main(argc, argv)
|
||||
++aflag;
|
||||
}
|
||||
if (!(outf = fopen(outfile, aflag ? "a" : "w"))) {
|
||||
warnx("%s cannot open", outfile);
|
||||
fprintf(stderr, "%s: %s cannot open\n", progname, outfile);
|
||||
exit(exit_val);
|
||||
}
|
||||
put_entries(head);
|
||||
@@ -210,21 +237,21 @@ main(argc, argv)
|
||||
system(cmd);
|
||||
}
|
||||
}
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (rflag)
|
||||
gtagclose();
|
||||
lookupclose();
|
||||
#endif
|
||||
exit(exit_val);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
#ifdef GTAGS
|
||||
"usage: gctags [-BDFadrtuwvx] [-f tagsfile] file ...\n");
|
||||
#ifdef GLOBAL
|
||||
"usage: gctags [-BDFacderstuvwx] [-f tagsfile] file ...\n");
|
||||
#else
|
||||
"usage: gctags [-BFadtuwvx] [-f tagsfile] file ...\n");
|
||||
"usage: ctags [-BFadtuwvx] [-f tagsfile] file ...\n");
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
@@ -282,7 +309,7 @@ find_entries(file)
|
||||
if (cp[1] == 'l' && !cp[2]) {
|
||||
int c;
|
||||
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (rflag)
|
||||
fprintf(stderr, "-r option is ignored in lisp file (Warning only)\n");
|
||||
#endif
|
||||
@@ -329,8 +356,14 @@ find_entries(file)
|
||||
pfnote("yyparse", lineno);
|
||||
y_entries();
|
||||
}
|
||||
#ifdef GLOBAL
|
||||
/* assembler */ else if ((cp[1] == 's' || cp[1] == 'S') && !cp[2]) {
|
||||
asm_entries();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* fortran */ else if ((cp[1] != 'c' && cp[1] != 'h') && !cp[2]) {
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (rflag)
|
||||
fprintf(stderr, "-r option is ignored in fortran file (Warning only)\n");
|
||||
#endif
|
||||
@@ -344,63 +377,3 @@ find_entries(file)
|
||||
#endif
|
||||
/* C */ c_entries();
|
||||
}
|
||||
|
||||
#ifdef GTAGS
|
||||
#include <db.h>
|
||||
DB *db;
|
||||
|
||||
void
|
||||
gtagopen()
|
||||
{
|
||||
BTREEINFO info;
|
||||
char *env;
|
||||
char dbname[200];
|
||||
|
||||
strcpy(dbname, ".");
|
||||
if ((env = getenv("GTAGDBPATH"))) {
|
||||
strcpy(dbname, env);
|
||||
}
|
||||
strcat(dbname, "/GTAGS");
|
||||
|
||||
info.flags = 0;
|
||||
info.cachesize = 500000;
|
||||
info.maxkeypage = 0;
|
||||
info.minkeypage = 0;
|
||||
info.psize = 0;
|
||||
info.compare = 0;
|
||||
info.prefix = 0;
|
||||
info.lorder = 0;
|
||||
|
||||
#define O_RDONLY 0x0000 /* open for reading only */
|
||||
db = dbopen(dbname, O_RDONLY, 0, DB_BTREE, &info);
|
||||
if (db == 0)
|
||||
errx(1, "GTAGS file needed");
|
||||
}
|
||||
int
|
||||
isdefined(skey)
|
||||
char *skey;
|
||||
{
|
||||
DBT dat, key;
|
||||
int status;
|
||||
|
||||
key.data = skey;
|
||||
key.size = strlen(skey)+1;
|
||||
|
||||
status = (*db->get)(db, &key, &dat, 0);
|
||||
switch (status) {
|
||||
case RET_SUCCESS:
|
||||
return(1); /* exist */
|
||||
case RET_ERROR:
|
||||
errx(1, "db->get failed");
|
||||
case RET_SPECIAL: /* not exist */
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void
|
||||
gtagclose()
|
||||
{
|
||||
if (db->close(db))
|
||||
errx(1, "GTAGS cannot close.(dbclose)");
|
||||
}
|
||||
#endif
|
||||
@@ -33,6 +33,10 @@
|
||||
* @(#)ctags.h 8.3 (Berkeley) 4/2/94
|
||||
*/
|
||||
|
||||
/* Definition for gctags */
|
||||
#define GLOBAL 1
|
||||
#define YACC 1
|
||||
|
||||
#define bool char
|
||||
|
||||
#define YES 1
|
||||
@@ -47,7 +51,11 @@
|
||||
#endif
|
||||
|
||||
#define SETLINE {++lineno;lineftell = ftell(inf);}
|
||||
#ifdef GLOBAL
|
||||
#define GETC(op,exp) ((((c = getc(inf)) == '\r') ? (c = getc(inf)) : c) op (int)exp)
|
||||
#else
|
||||
#define GETC(op,exp) ((c = getc(inf)) op (int)exp)
|
||||
#endif
|
||||
|
||||
#define iswhite(arg) (_wht[(unsigned)arg]) /* T if char is white */
|
||||
#define begtoken(arg) (_btk[(unsigned)arg]) /* T if char can start token */
|
||||
@@ -71,11 +79,13 @@ extern FILE *inf; /* ioptr for current input file */
|
||||
extern FILE *outf; /* ioptr for current output file */
|
||||
extern long lineftell; /* ftell after getc( inf ) == '\n' */
|
||||
extern int lineno; /* line number of current line */
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
extern int cflag; /* -c: compact index */
|
||||
extern int eflag; /* -e: '{' at 0 column force function end */
|
||||
extern int Dflag; /* -D: allow duplicate entrys */
|
||||
extern int rflag; /* -r: function reference */
|
||||
#endif /* GTAGS */
|
||||
extern int sflag; /* -s: collect symbols */
|
||||
#endif
|
||||
extern int dflag; /* -d: non-macro defines */
|
||||
extern int tflag; /* -t: create tags for typedefs */
|
||||
extern int vflag; /* -v: vgrind style index output */
|
||||
@@ -85,6 +95,7 @@ extern bool _wht[], _etk[], _itk[], _btk[], _gd[];
|
||||
extern char lbuf[LINE_MAX];
|
||||
extern char *lbp;
|
||||
extern char searchar; /* ex search character */
|
||||
extern char *progname; /* program name */
|
||||
|
||||
#ifndef __P
|
||||
#ifdef __STDC__
|
||||
@@ -105,6 +116,8 @@ void y_entries __P((void));
|
||||
int PF_funcs __P((void));
|
||||
void c_entries __P((void));
|
||||
void skip_comment __P((void));
|
||||
void gtagopen __P((void));
|
||||
int isdefined __P((char *));
|
||||
void gtagclose __P((void));
|
||||
#ifdef GLOBAL
|
||||
void asm_entries __P((void));
|
||||
void compact_print __P((char *, int, char *));
|
||||
int portable_getc __P((FILE *));
|
||||
#endif
|
||||
@@ -31,7 +31,7 @@
|
||||
.\"
|
||||
.\" @(#)gctags.1 8.1 (Berkeley) 6/6/93
|
||||
.\"
|
||||
.Dd Apr 21, 1997
|
||||
.Dd April 21, 1997
|
||||
.Dt GCTAGS 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
@@ -39,7 +39,7 @@
|
||||
.Nd create a tags file (special command for GLOBAL)
|
||||
.Sh SYNOPSIS
|
||||
.Nm gctags
|
||||
.Op Fl BDFadertuwvx
|
||||
.Op Fl BDFacderstuvwx
|
||||
.Op Fl f Ar tagsfile
|
||||
.Ar name ...
|
||||
.Sh DESCRIPTION
|
||||
@@ -49,7 +49,7 @@ makes a tags file for
|
||||
from the specified C,
|
||||
Pascal, Fortran,
|
||||
.Tn YACC ,
|
||||
lex, and lisp sources.
|
||||
lex, lisp and assembler sources.
|
||||
A tags file gives the locations of specified objects in a group of files.
|
||||
Each line of the tags file contains the object name, the file in which it
|
||||
is defined, and a search pattern for the object definition, separated by
|
||||
@@ -77,6 +77,8 @@ use forward searching patterns
|
||||
append to
|
||||
.Ar tags
|
||||
file.
|
||||
.It Fl c
|
||||
print with compact format. It is valid only with -x option.
|
||||
.It Fl d
|
||||
create tags for
|
||||
.Li #defines
|
||||
@@ -88,11 +90,13 @@ force a function to end when reach a '}' at the first column. (C source only)
|
||||
.It Fl f
|
||||
place the tag descriptions in a file called
|
||||
.Ar tagsfile .
|
||||
The default behavior is to place them in a file called
|
||||
The default behaviour is to place them in a file called
|
||||
.Ar tags .
|
||||
.It Fl r
|
||||
locate function references instead of function definitions. GTAGS file is
|
||||
needed at the current directory. (C source only)
|
||||
.It Fl s
|
||||
collect symbols except for functions.
|
||||
.It Fl t
|
||||
create tags for typedefs, structs, unions, and enums.
|
||||
.It Fl u
|
||||
@@ -144,7 +148,13 @@ Files whose names end in
|
||||
are assumed to be lisp files if their
|
||||
first non-blank character is `;', `(', or `[',
|
||||
otherwise, they are
|
||||
treated as lex files. Other files are first examined to see if they
|
||||
treated as lex files.
|
||||
Files whose names end in
|
||||
.Nm \&.s
|
||||
or
|
||||
.Nm \&.S
|
||||
are assumed to be Assembler
|
||||
source files. Other files are first examined to see if they
|
||||
contain any Pascal or Fortran routine definitions, and, if not, are
|
||||
searched for C style definitions.
|
||||
.Pp
|
||||
@@ -178,7 +188,7 @@ tags file for GLOBAL
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Nm Gctags
|
||||
exits with a value of 1 if an error occurred, 0 otherwise.
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
Duplicate objects are not considered errors.
|
||||
.Sh SEE ALSO
|
||||
.Xr btreeop 1 ,
|
||||
@@ -221,7 +231,11 @@ cause it to enter the last line of the object, rather than the first, as
|
||||
the searching pattern. The last line of multiple line
|
||||
.Li typedef Ns 's
|
||||
will similarly be noted.
|
||||
.Pp
|
||||
Assembler support is far from completeness. It extracts only ENTRY()
|
||||
and ALTENTRY() from source file. Probably valid only for FreeBSD and Linux
|
||||
kernel source.
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in FreeBSD 2.2.
|
||||
command appeared in FreeBSD 2.2.2.
|
||||
@@ -41,6 +41,7 @@ static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94";
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "die.h"
|
||||
#include "ctags.h"
|
||||
|
||||
/*
|
||||
@@ -59,7 +60,7 @@ getline()
|
||||
saveftell = ftell(inf);
|
||||
(void)fseek(inf, lineftell, SEEK_SET);
|
||||
if (xflag)
|
||||
for (cp = lbuf; GETC(!=, '\n'); *cp++ = c)
|
||||
for (cp = lbuf; GETC(!=, EOF) && c != '\n'; *cp++ = c)
|
||||
continue;
|
||||
/*
|
||||
* do all processing here, so we don't step through the
|
||||
@@ -89,7 +90,58 @@ getline()
|
||||
*cp = EOS;
|
||||
(void)fseek(inf, saveftell, SEEK_SET);
|
||||
}
|
||||
#ifdef GLOBAL
|
||||
void
|
||||
compact_print(entry, lno, file)
|
||||
char *entry;
|
||||
int lno;
|
||||
char *file;
|
||||
{
|
||||
static int first = 1;
|
||||
static char p_entry[128];
|
||||
static char p_file[1024];
|
||||
static int p_lno;
|
||||
static char *buf;
|
||||
static int bufsize = 512;
|
||||
static char *p;
|
||||
|
||||
if (first) {
|
||||
if (!(buf = (char *)malloc(bufsize)))
|
||||
die("short of memory.");
|
||||
buf[0] = 0;
|
||||
p = buf;
|
||||
first = 0;
|
||||
}
|
||||
if (strcmp(p_entry, entry) || strcmp(p_file, file)) {
|
||||
if (buf[0])
|
||||
printf("%s\n", buf);
|
||||
if (!entry[0]) /* flush */
|
||||
return;
|
||||
strcpy(p_entry, entry);
|
||||
strcpy(p_file, file);
|
||||
p_lno = lno;
|
||||
buf[0] = 0;
|
||||
sprintf(buf, "%s %s %d", entry, file, lno);
|
||||
p = buf;
|
||||
p += strlen(p);
|
||||
} else {
|
||||
if (p_lno > lno)
|
||||
die("impossible!");
|
||||
if (p_lno < lno) {
|
||||
if (buf + bufsize < p + 10) {
|
||||
int offset = p - buf;
|
||||
bufsize *= 2;
|
||||
if (!(buf = (char *)realloc(buf, bufsize)))
|
||||
die("short of memory.");
|
||||
p = buf + offset;
|
||||
}
|
||||
sprintf(p, ",%d", lno);
|
||||
p += strlen(p);
|
||||
p_lno = lno;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* put_entries --
|
||||
* write out the tags
|
||||
@@ -104,8 +156,12 @@ put_entries(node)
|
||||
if (vflag)
|
||||
printf("%s %s %d\n",
|
||||
node->entry, node->file, (node->lno + 63) / 64);
|
||||
#ifdef GLOBAL
|
||||
else if (xflag && cflag)
|
||||
compact_print(node->entry, node->lno, node->file);
|
||||
#endif
|
||||
else if (xflag)
|
||||
#ifdef MODIFY
|
||||
#ifdef GLOBAL
|
||||
/* separate 'entry' and 'lno' */
|
||||
if (strlen(node->entry) >= 16 && node->lno >= 1000)
|
||||
printf("%-16s %4d %-16s %s\n",
|
||||
@@ -35,12 +35,12 @@
|
||||
static char sccsid[] = "@(#)tree.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <err.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "die.h"
|
||||
#include "ctags.h"
|
||||
|
||||
static void add_node __P((NODE *, NODE *));
|
||||
@@ -61,12 +61,12 @@ pfnote(name, ln)
|
||||
|
||||
/*NOSTRICT*/
|
||||
if (!(np = (NODE *)malloc(sizeof(NODE)))) {
|
||||
warnx("too many entries to sort");
|
||||
fprintf(stderr, "too many entries to sort\n");
|
||||
put_entries(head);
|
||||
free_tree(head);
|
||||
/*NOSTRICT*/
|
||||
if (!(head = np = (NODE *)malloc(sizeof(NODE))))
|
||||
errx(1, "out of space");
|
||||
die("out of space");
|
||||
}
|
||||
if (!xflag && !strcmp(name, "main")) {
|
||||
if (!(fp = strrchr(curfile, '/')))
|
||||
@@ -80,12 +80,12 @@ pfnote(name, ln)
|
||||
name = nbuf;
|
||||
}
|
||||
if (!(np->entry = strdup(name)))
|
||||
errx(1, "out of space");
|
||||
die("out of space");
|
||||
np->file = curfile;
|
||||
np->lno = ln;
|
||||
np->left = np->right = 0;
|
||||
if (!(np->pat = strdup(lbuf)))
|
||||
errx(1, "out of space");
|
||||
die("out of space");
|
||||
if (!head)
|
||||
head = np;
|
||||
else
|
||||
@@ -100,7 +100,7 @@ add_node(node, cur_node)
|
||||
int dif;
|
||||
|
||||
dif = strcmp(node->entry, cur_node->entry);
|
||||
#ifdef GTAGS
|
||||
#ifdef GLOBAL
|
||||
if (!Dflag && !dif) /* -D option allows duplicate entries. */
|
||||
#else
|
||||
if (!dif)
|
||||
@@ -0,0 +1,6 @@
|
||||
PROG= global
|
||||
CFLAGS+=-I${.CURDIR}/../lib
|
||||
LDADD= $(LIBUTIL)
|
||||
DPADD= $(LIBUTIL)
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -28,53 +28,92 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Apr 21, 1997
|
||||
.Dd Nov 26, 1997
|
||||
.Dt GLOBAL 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm global
|
||||
.Nd print the locations of specified function.
|
||||
.Nd print the locations of specified object.
|
||||
.Sh SYNOPSIS
|
||||
.Nm global
|
||||
.Op Fl acrx
|
||||
.Ar name
|
||||
.Op Fl alrvx
|
||||
.Ar pattern
|
||||
.Nm global -c
|
||||
.Op Ar prefix
|
||||
.Nm global
|
||||
.Fl f[arx]
|
||||
.Ar file
|
||||
.Nm global
|
||||
.Fl g[alvx]
|
||||
.Ar pattern
|
||||
.Nm global
|
||||
.Fl i[v]
|
||||
.Nm global
|
||||
.Fl p
|
||||
.Nm global
|
||||
.Fl s[alvx]
|
||||
.Ar pattern
|
||||
.Sh DESCRIPTION
|
||||
.Nm Global
|
||||
find the locations of specified function in C and Yacc source files.
|
||||
find the locations of specified object in C and Yacc source files.
|
||||
.Nm Global
|
||||
can treat a source tree, that is, a directory that has subdirectories and
|
||||
source files.
|
||||
You can get the relative path of objects from anywhere within the tree.
|
||||
|
||||
.Nm Global
|
||||
can locate not only function definitions but also function references and
|
||||
allow duplicate entries too.
|
||||
other symbols.
|
||||
Duplicate entries are allowed.
|
||||
.Pp
|
||||
In advance of using this command, you must execute
|
||||
.Xr gtags 1
|
||||
at the root directory of the source tree.
|
||||
at the root directory of the source tree to make tag files.
|
||||
Then you can execute
|
||||
.Nm
|
||||
at anywhere in the source tree.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width Ds
|
||||
.It Ar pattern
|
||||
object pattern. It can include POSIX 1003.2 regular expression.
|
||||
.It Fl a
|
||||
print absolute path name. By default, print relative path name.
|
||||
.It Fl c
|
||||
print candidate function names which start with specified string.
|
||||
If string is not specified, print all function names.
|
||||
.It Fl c Op Ar prefix
|
||||
print candidate function names which start with specified
|
||||
.Ar prefix .
|
||||
If
|
||||
.Ar prefix
|
||||
is not specified, print all function names.
|
||||
.It Fl f Ar file
|
||||
print all function definitions in the
|
||||
.Ar file .
|
||||
This option implies -x option.
|
||||
.It Fl g
|
||||
print all lines which match to the pattern.
|
||||
.It Fl i
|
||||
reconstruct tags files incrementally.
|
||||
.It Fl l
|
||||
print objects which exist under the current directory.
|
||||
.It Fl r
|
||||
print the locations of function references. By default, print function
|
||||
definitions.
|
||||
.It Fl p
|
||||
print the location of GTAGS.
|
||||
.It Fl s
|
||||
print the locations of specified symbol other than function names.
|
||||
You need GSYMS tags file. See
|
||||
.Xr gtags 1 .
|
||||
.It Fl x
|
||||
In addition to the default output, produce the line number and
|
||||
the line contents.
|
||||
.It Ar name
|
||||
function name. It can include perl's regular expression.
|
||||
.Sh FILES
|
||||
.Bl -tag -width tags -compact
|
||||
.It Pa GTAGS
|
||||
tags file for function definitions.
|
||||
.It Pa GRTAGS
|
||||
tags file for function references.
|
||||
.It Pa GSYMS
|
||||
tags file for symbols other then functions.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
The following environment variables affect the execution of global.
|
||||
@@ -125,12 +164,12 @@ global search in these path too.
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr btreeop 1 ,
|
||||
.Xr gctags 1 ,
|
||||
.Xr gtags 1 ,
|
||||
.Xr htags 1 .
|
||||
.Xr htags 1 ,
|
||||
.Xr vi 1 .
|
||||
.Sh AUTHORS
|
||||
Shigio Yamaguchi ([email protected])
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in FreeBSD 2.2.
|
||||
command appeared in FreeBSD 2.2.2.
|
||||
@@ -0,0 +1,751 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Shigio Yamaguchi.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* global.c 7-Nov-97
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
char *progname = "global"; /* command name */
|
||||
|
||||
static void usage __P((void));
|
||||
void main __P((int, char **));
|
||||
char *outfilter __P((void));
|
||||
void completelist __P((char *, char *));
|
||||
void relative_filter __P((char *, char *, char *));
|
||||
void grep __P((char *));
|
||||
int printtag __P((FILE *, char *, char *, int));
|
||||
int regexp __P((char *));
|
||||
int search __P((char *, char *, char *, char *, int));
|
||||
char *extractpath __P((char *));
|
||||
int includepath __P((char *, char *));
|
||||
|
||||
char sortfilter[MAXCOMLINE+1]; /* sort filter */
|
||||
char pathfilter[MAXCOMLINE+1]; /* path convert filter */
|
||||
char local[MAXPATHLEN+1]; /* local prefix */
|
||||
char *localprefix; /* local prefix */
|
||||
int aflag; /* [option] */
|
||||
int cflag; /* command */
|
||||
int fflag; /* command */
|
||||
int lflag; /* [option] */
|
||||
int gflag; /* command */
|
||||
int iflag; /* command */
|
||||
int pflag; /* command */
|
||||
int rflag; /* [option] */
|
||||
int sflag; /* command */
|
||||
int vflag; /* [option] */
|
||||
int xflag; /* [option] */
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "usage:\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n",
|
||||
"global [-alrvx] pattern",
|
||||
"global -c [prefix]",
|
||||
"global -f[arx] file",
|
||||
"global -g[alvx] pattern",
|
||||
"global -i[v]",
|
||||
"global -p",
|
||||
"global -s[alvx] pattern");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char *p, *av;
|
||||
int count;
|
||||
int db;
|
||||
char cwd[MAXPATHLEN+1]; /* current directory */
|
||||
char root[MAXPATHLEN+1]; /* root of source tree */
|
||||
char dbpath[MAXPATHLEN+1]; /* dbpath directory */
|
||||
char comline[MAXCOMLINE+1];
|
||||
|
||||
while (--argc > 0 && (++argv)[0][0] == '-') {
|
||||
for (p = argv[0] + 1; *p; p++) {
|
||||
switch (*p) {
|
||||
case 'a':
|
||||
aflag++;
|
||||
break;
|
||||
case 'c':
|
||||
cflag++;
|
||||
break;
|
||||
case 'f':
|
||||
fflag++;
|
||||
break;
|
||||
case 'l':
|
||||
lflag++;
|
||||
break;
|
||||
case 'g':
|
||||
gflag++;
|
||||
break;
|
||||
case 'i':
|
||||
iflag++;
|
||||
break;
|
||||
case 'p':
|
||||
pflag++;
|
||||
break;
|
||||
case 'r':
|
||||
rflag++;
|
||||
break;
|
||||
case 's':
|
||||
sflag++;
|
||||
break;
|
||||
case 'v':
|
||||
vflag++;
|
||||
break;
|
||||
case 'x':
|
||||
xflag++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
av = (argc > 0) ? *argv : (char *)0;
|
||||
/*
|
||||
* usage check.
|
||||
*/
|
||||
{
|
||||
int commands, options;
|
||||
|
||||
commands = cflag + fflag + gflag + iflag + pflag + sflag;
|
||||
options = aflag + lflag + rflag + xflag;
|
||||
/*
|
||||
* only -c, -i and -p allows no argment.
|
||||
*/
|
||||
if (!av && !cflag && !iflag && !pflag)
|
||||
usage();
|
||||
/*
|
||||
* command cannot be duplicated.
|
||||
*/
|
||||
if (commands > 1)
|
||||
usage();
|
||||
/*
|
||||
* -c and -i command allows only -v option.
|
||||
*/
|
||||
if (cflag + iflag && options)
|
||||
usage();
|
||||
/*
|
||||
* -r is not valid for -g, -i and -s.
|
||||
*/
|
||||
if (rflag && (gflag + iflag + sflag))
|
||||
usage();
|
||||
}
|
||||
/*
|
||||
* remove leading blanks.
|
||||
*/
|
||||
if (av && !gflag)
|
||||
for (; *av == ' ' || *av == '\t'; av++)
|
||||
;
|
||||
if (cflag && av && regexp(av))
|
||||
die("regular expression not allowed with -c option.");
|
||||
/*
|
||||
* get path of following directories.
|
||||
* o current directory
|
||||
* o root of source tree
|
||||
* o dbpath directory
|
||||
*
|
||||
* if GTAGS not found, getdbpath doesn't return.
|
||||
*/
|
||||
getdbpath(cwd, root, dbpath);
|
||||
|
||||
if (pflag) {
|
||||
fprintf(stdout, "%s\n", dbpath);
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* incremental update of tag files.
|
||||
*/
|
||||
if (iflag) {
|
||||
if (chdir(root) < 0)
|
||||
die1("cannot change directory to '%s'.", root);
|
||||
sprintf(comline, "gtags -i%s %s", (vflag) ? "v" : "", dbpath);
|
||||
if (system(comline))
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* complete function name
|
||||
*/
|
||||
if (cflag) {
|
||||
completelist(dbpath, av);
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* make sort filter.
|
||||
*/
|
||||
if (sflag && xflag)
|
||||
*sortfilter = 0;
|
||||
else if (fflag)
|
||||
sprintf(sortfilter, "sort +1n -2");
|
||||
else if (xflag) /* print details */
|
||||
sprintf(sortfilter, "sort +0 -1 +2 -3 +1n -2");
|
||||
else /* print just file name */
|
||||
sprintf(sortfilter, "sort | uniq");
|
||||
/*
|
||||
* make path filter.
|
||||
*/
|
||||
if (aflag) /* absolute path name */
|
||||
sprintf(pathfilter, "sed -e 's!\\.!%s!'", root);
|
||||
else /* relative path name */
|
||||
relative_filter(root, cwd, pathfilter);
|
||||
/*
|
||||
* make local prefix.
|
||||
*/
|
||||
if (lflag) {
|
||||
/*
|
||||
* getdbpath() assure follows.
|
||||
* cwd != "/" and cwd includes root.
|
||||
*/
|
||||
strcpy(local, cwd);
|
||||
strcat(local, "/");
|
||||
localprefix = local + strlen(root) - 1;
|
||||
*localprefix = '.';
|
||||
}
|
||||
/*
|
||||
* grep the pattern in a source tree.
|
||||
*/
|
||||
if (gflag) {
|
||||
if (!lflag)
|
||||
chdir(root);
|
||||
else if (!aflag)
|
||||
sprintf(pathfilter, "sed -e 's!\\./!!'");
|
||||
grep(av);
|
||||
exit(0);
|
||||
}
|
||||
db = (rflag) ? GRTAGS : ((sflag) ? GSYMS : GTAGS);
|
||||
/*
|
||||
* print function definitions.
|
||||
*/
|
||||
if (fflag) {
|
||||
struct stat sb;
|
||||
char pathbuf[MAXPATHLEN+1], *path;
|
||||
char *p;
|
||||
FILE *op;
|
||||
DBIO *dbio;
|
||||
|
||||
/* av !~ /\.[chysS]$/) */
|
||||
p = av + strlen(av) - 1; /* last character */
|
||||
if (stat(av, &sb) || !S_ISREG(sb.st_mode))
|
||||
die1("file '%s' not found.", av);
|
||||
if (*(p - 1) != '.' || !locatestring("chysS", p, 0))
|
||||
die("accept only file name end with '.c .h .y .s .S'.");
|
||||
/*
|
||||
* convert path into relative from root directory of source tree.
|
||||
*/
|
||||
path = realpath(av, pathbuf);
|
||||
if (*path != '/')
|
||||
die("realpath(3) is not compatible with BSD version.");
|
||||
if (strncmp(path, root, strlen(root)))
|
||||
die1("file '%s' is out of source tree.", path);
|
||||
path += strlen(root) - 1;
|
||||
*path = '.';
|
||||
if (!(op = popen(outfilter(), "w")))
|
||||
die("cannot open output pipe.");
|
||||
dbio = gtagsopen(dbpath, db, 0);
|
||||
for (p = db_first(dbio, NULL, DBIO_SKIPMETA); p; p = db_next(dbio))
|
||||
if (includepath(p, path))
|
||||
fprintf(op, "%s\n", p);
|
||||
db_close(dbio);
|
||||
pclose(op);
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* search in current source tree.
|
||||
*/
|
||||
count = search(av, cwd, root, dbpath, db);
|
||||
/*
|
||||
* search in library path.
|
||||
*/
|
||||
if (count == 0 && !rflag && !sflag && !regexp(av) && getenv("GTAGSLIBPATH")) {
|
||||
char envbuf[MAXENVLEN+1];
|
||||
char libdbpath[MAXPATHLEN+1];
|
||||
char *p, *lib;
|
||||
|
||||
strcpy(envbuf, getenv("GTAGSLIBPATH"));
|
||||
p = envbuf;
|
||||
while (p) {
|
||||
lib = p;
|
||||
if ((p = locatestring(p, ":", 0)) != NULL)
|
||||
*p++ = 0;
|
||||
if (!strncmp(lib, cwd, strlen(cwd)) || !strncmp(cwd, lib, strlen(lib)))
|
||||
continue;
|
||||
if (!gtagsexist(lib, libdbpath))
|
||||
continue;
|
||||
if (!strcmp(dbpath, libdbpath))
|
||||
continue;
|
||||
if (aflag) /* absolute path name */
|
||||
sprintf(pathfilter, "sed -e 's!\\.!%s!'", lib);
|
||||
else
|
||||
relative_filter(lib, cwd, pathfilter);
|
||||
count = search(av, cwd, lib, libdbpath, GTAGS);
|
||||
if (count > 0) {
|
||||
strcpy(dbpath, libdbpath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vflag) {
|
||||
if (count) {
|
||||
if (count == 1)
|
||||
fprintf(stderr, "%d object located", count);
|
||||
if (count > 1)
|
||||
fprintf(stderr, "%d objects located", count);
|
||||
fprintf(stderr, " (using '%s').\n", makepath(dbpath, dbname(db)));
|
||||
} else {
|
||||
fprintf(stderr, "'%s' not found.\n", av);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* outfilter: return output filter.
|
||||
*
|
||||
* gi) pathfilter
|
||||
* gi) sortfilter
|
||||
* r) output filter
|
||||
*/
|
||||
char *
|
||||
outfilter(void)
|
||||
{
|
||||
static char filter[MAXCOMLINE+1];
|
||||
|
||||
/*
|
||||
* make output filter
|
||||
*/
|
||||
if (*sortfilter)
|
||||
sprintf(filter, "%s | %s", sortfilter, pathfilter);
|
||||
else
|
||||
strcpy(filter, pathfilter);
|
||||
return filter;
|
||||
}
|
||||
/*
|
||||
* completelist: print complete list of function
|
||||
*
|
||||
* i) dbpath dbpath directory
|
||||
* i) prefix prefix of primary key
|
||||
*/
|
||||
void
|
||||
completelist(dbpath, prefix)
|
||||
char *dbpath;
|
||||
char *prefix;
|
||||
{
|
||||
char *p;
|
||||
DBIO *dbio;
|
||||
|
||||
dbio = gtagsopen(dbpath, GTAGS, 0);
|
||||
for (p = db_first(dbio, prefix, DBIO_KEY|DBIO_PREFIX|DBIO_SKIPMETA); p; p = db_next(dbio))
|
||||
(void)fprintf(stdout, "%s\n", p);
|
||||
db_close(dbio);
|
||||
}
|
||||
/*
|
||||
* relative_filter: make relative path filter
|
||||
*
|
||||
* i) root the root directory of source tree
|
||||
* i) argcwd current directory
|
||||
* o) bp result
|
||||
* relative path filter
|
||||
*/
|
||||
void
|
||||
relative_filter(root, cwd, bp)
|
||||
char *root;
|
||||
char *cwd;
|
||||
char *bp;
|
||||
{
|
||||
char *p, *c, *branch;
|
||||
|
||||
/*
|
||||
* get branch point.
|
||||
*/
|
||||
branch = cwd;
|
||||
for (p = root, c = cwd; *p && *c && *p == *c; p++, c++)
|
||||
if (*c == '/')
|
||||
branch = c;
|
||||
if (*p == 0 && (*c == 0 || *c == '/'))
|
||||
branch = c;
|
||||
if (*c == 0 && *p)
|
||||
die("illegal root.");
|
||||
/*
|
||||
* forward to root.
|
||||
*/
|
||||
strcpy(bp, "sed -e 's!\\./!");
|
||||
for (c = branch; *c; c++)
|
||||
if (*c == '/')
|
||||
strcat(bp, "../");
|
||||
p = root + (branch - cwd);
|
||||
/*
|
||||
* backward to leaf.
|
||||
*/
|
||||
if (*p) {
|
||||
p++;
|
||||
strcat(bp, p);
|
||||
strcat(bp, "/");
|
||||
}
|
||||
strcat(bp, "!'");
|
||||
/*
|
||||
* remove redundancy.
|
||||
*/
|
||||
if (*branch) {
|
||||
char unit[256];
|
||||
|
||||
bp += strlen(bp);
|
||||
p = unit;
|
||||
for (c = branch + 1; ; c++) {
|
||||
if (*c == 0 || *c == '/') {
|
||||
*p = 0;
|
||||
sprintf(bp, " -e 's!\\.\\./%s/!!'", unit);
|
||||
bp += strlen(bp);
|
||||
if (*c == 0)
|
||||
break;
|
||||
p = unit;
|
||||
} else
|
||||
*p++ = *c;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* printtag: print a tag's line
|
||||
*
|
||||
* i) op output stream
|
||||
* i) root root of source tree
|
||||
* i) bp tag's line
|
||||
* i) compact 0: standard format, 1: compact format
|
||||
* r) output line count
|
||||
*/
|
||||
int
|
||||
printtag(op, root, bp, compact)
|
||||
FILE *op;
|
||||
char *root;
|
||||
char *bp;
|
||||
int compact;
|
||||
{
|
||||
int count = 0;
|
||||
char *tag, *file, *lno;
|
||||
int opened = 0;
|
||||
char path[MAXPATHLEN+1];
|
||||
char *buffer;
|
||||
int line = 0, tagline = 0;
|
||||
FILE *ip;
|
||||
|
||||
if (!xflag) {
|
||||
fprintf(op, "%s\n", extractpath(bp));
|
||||
return 1;
|
||||
}
|
||||
if (compact) { /* compact format */
|
||||
char *p = bp;
|
||||
|
||||
tag = p; /* tag = $1 */
|
||||
for (; !isspace(*p) ; p++)
|
||||
;
|
||||
*p++ = 0;
|
||||
for (; isspace(*p) ; p++)
|
||||
;
|
||||
file = p; /* file = $2 */
|
||||
for (; !isspace(*p) ; p++)
|
||||
;
|
||||
*p++ = 0;
|
||||
for (; isspace(*p) ; p++)
|
||||
;
|
||||
lno = p; /* lno = $3 */
|
||||
sprintf(path, "%s/%s", root, file + 2);
|
||||
if ((ip = fopen(path, "r")) != NULL) {
|
||||
opened = 1;
|
||||
buffer = mgets(ip, 0, NULL);
|
||||
line = 1;
|
||||
} else {
|
||||
buffer = "";
|
||||
}
|
||||
while (*lno) {
|
||||
/* get line number */
|
||||
for (tagline = 0; *lno >= '0' && *lno <= '9'; lno++)
|
||||
tagline = tagline * 10 + *lno - '0';
|
||||
if (*lno == ',')
|
||||
lno++;
|
||||
if (opened) {
|
||||
while (line < tagline) {
|
||||
if (!(buffer = mgets(ip, 0, NULL)))
|
||||
die1("unexpected end of file. '%s'", path);
|
||||
line++;
|
||||
}
|
||||
}
|
||||
if (strlen(tag) >= 16 && tagline >= 1000)
|
||||
fprintf(op, "%-16s %4d %-16s %s\n",
|
||||
tag, tagline, file, buffer);
|
||||
else
|
||||
fprintf(op, "%-16s%4d %-16s %s\n",
|
||||
tag, tagline, file, buffer);
|
||||
count++;
|
||||
}
|
||||
if (opened)
|
||||
fclose(ip);
|
||||
} else { /* standard format */
|
||||
/*
|
||||
* separater in key part must be ' ' to avoid sort(1)'s bug.
|
||||
*/
|
||||
detab(op, bp);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* regexp: test whether regular expression included.
|
||||
*
|
||||
* i) s string
|
||||
* r) 0: not included, 1: included
|
||||
*
|
||||
* This function cannot be used for generic purpose.
|
||||
* Any character except '[a-zA-Z_0-9]' is assumed RE char..
|
||||
*/
|
||||
int
|
||||
regexp(s)
|
||||
char *s;
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = *s++) != NULL)
|
||||
if ( (c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
(c == '_') )
|
||||
;
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* grep: grep pattern
|
||||
*
|
||||
* i) pattern POSIX regular expression
|
||||
*/
|
||||
void
|
||||
grep(pattern)
|
||||
char *pattern;
|
||||
{
|
||||
FILE *op, *fp;
|
||||
char *path;
|
||||
char edit[IDENTLEN+1];
|
||||
char *buffer, *p, *e;
|
||||
int linenum, count, editlen;
|
||||
regex_t preg;
|
||||
|
||||
/*
|
||||
* convert spaces into %FF format.
|
||||
*/
|
||||
e = edit;
|
||||
for (p = pattern; *p; p++) {
|
||||
if (*p == '%' || *p == ' ' || *p == '\t') {
|
||||
sprintf(e, "%%%02x", *p);
|
||||
e += 3;
|
||||
} else
|
||||
*e++ = *p;
|
||||
}
|
||||
*e = 0;
|
||||
editlen = strlen(edit);
|
||||
|
||||
if (regcomp(&preg, pattern, REG_EXTENDED) != 0)
|
||||
die("illegal regular expression.");
|
||||
if (!(op = popen(outfilter(), "w")))
|
||||
die("cannot open output pipe.");
|
||||
count = 0;
|
||||
for (findopen(); (path = findread(NULL)) != NULL; ) {
|
||||
if (!(fp = fopen(path, "r")))
|
||||
die1("cannot open file '%s'.", path);
|
||||
linenum = 0;
|
||||
while ((buffer = mgets(fp, 0, NULL)) != NULL) {
|
||||
linenum++;
|
||||
if (regexec(&preg, buffer, 0, 0, 0) == 0) {
|
||||
count++;
|
||||
if (xflag == 0) {
|
||||
fprintf(op, "%s\n", path);
|
||||
break;
|
||||
}
|
||||
if (editlen >= 16 && linenum >= 1000)
|
||||
fprintf(op, "%-16s %4d %-16s %s\n",
|
||||
edit, linenum, path, buffer);
|
||||
else
|
||||
fprintf(op, "%-16s%4d %-16s %s\n",
|
||||
edit, linenum, path, buffer);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
findclose();
|
||||
pclose(op);
|
||||
if (vflag) {
|
||||
if (count == 0)
|
||||
fprintf(stderr, "object not found.\n");
|
||||
if (count == 1)
|
||||
fprintf(stderr, "%d object located.\n", count);
|
||||
if (count > 1)
|
||||
fprintf(stderr, "%d objects located.\n", count);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* search: search specified function
|
||||
*
|
||||
* i) pattern search pattern
|
||||
* i) cwd current directory
|
||||
* i) root root of source tree
|
||||
* i) dbpath database directory
|
||||
* i) db GTAGS,GRTAGS,GSYMS
|
||||
* r) count of output lines
|
||||
*/
|
||||
int
|
||||
search(pattern, cwd, root, dbpath, db)
|
||||
char *pattern;
|
||||
char *cwd;
|
||||
char *root;
|
||||
char *dbpath;
|
||||
int db;
|
||||
{
|
||||
char *p;
|
||||
int count = 0;
|
||||
FILE *op;
|
||||
DBIO *dbio;
|
||||
int compact;
|
||||
regex_t preg;
|
||||
|
||||
/*
|
||||
* open tag file.
|
||||
* currently only GSYMS is compact format.
|
||||
*/
|
||||
dbio = gtagsopen(dbpath, db, 0);
|
||||
compact = (db == GSYMS) ? 1 : 0;
|
||||
if (!(op = popen(outfilter(), "w")))
|
||||
die1("filter '%s' failed.", outfilter());
|
||||
/*
|
||||
* regular expression.
|
||||
*/
|
||||
if (regexp(pattern) && regcomp(&preg, pattern, REG_EXTENDED) == 0) {
|
||||
char prefix_buf[IDENTLEN+1];
|
||||
char *prefix = (char *)0;
|
||||
|
||||
if (*pattern == '^' && *(p = pattern + 1) && (isalpha(*p) || *p == '_')) {
|
||||
prefix = prefix_buf;
|
||||
*prefix++ = *p++;
|
||||
while (*p && (isalpha(*p) || isdigit(*p) || *p == '_'))
|
||||
*prefix++ = *p++;
|
||||
*prefix = 0;
|
||||
prefix = prefix_buf;
|
||||
p = db_first(dbio, prefix, DBIO_SKIPMETA|DBIO_PREFIX);
|
||||
} else {
|
||||
p = db_first(dbio, NULL, DBIO_SKIPMETA);
|
||||
}
|
||||
for (; p; p = db_next(dbio)) {
|
||||
if (*p == ' ')
|
||||
continue;
|
||||
if (regexec(&preg, dbio->lastkey, 0, 0, 0) == 0)
|
||||
count += printtag(op, root, p, compact);
|
||||
}
|
||||
} else {
|
||||
for (p = db_first(dbio, pattern, 0); p; p = db_next(dbio)) {
|
||||
if (lflag) {
|
||||
char *q;
|
||||
/* locate start point of a path */
|
||||
q = locatestring(p, "./", 0);
|
||||
if (!locatestring(q, localprefix, 1))
|
||||
continue;
|
||||
}
|
||||
count += printtag(op, root, p, compact);
|
||||
}
|
||||
}
|
||||
pclose(op);
|
||||
db_close(dbio);
|
||||
return count;
|
||||
}
|
||||
/*
|
||||
* extractpath: extract path string of a tag line
|
||||
*
|
||||
* i) line tag line
|
||||
* r) path
|
||||
*
|
||||
* standard format: main 12 ./xxx/xxx/xxx.c main(argc, argv) {
|
||||
* compact format: main ./xxx/xxx/xxx.c 12,15,55,101
|
||||
*/
|
||||
char *
|
||||
extractpath(line)
|
||||
char *line;
|
||||
{
|
||||
static char buf[MAXPATHLEN+1];
|
||||
char *p, *b;
|
||||
int c;
|
||||
|
||||
if (!(p = locatestring(line, "./", 0)))
|
||||
die("illegal tag format (path not found).");
|
||||
b = buf;
|
||||
while ((c = *b++ = *p++) != NULL) {
|
||||
if (c == ' ' || c == '\t') {
|
||||
*(b - 1) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
/*
|
||||
* includepath: check if the path included in tag line or not.
|
||||
*
|
||||
* i) line tag line
|
||||
* i) path path
|
||||
* r) 0: doesn't included, 1: included
|
||||
*/
|
||||
int
|
||||
includepath(line, path)
|
||||
char *line;
|
||||
char *path;
|
||||
{
|
||||
char *p;
|
||||
int length;
|
||||
|
||||
if (!(p = locatestring(line, "./", 0)))
|
||||
die("illegal tag format (path not found).");
|
||||
length = strlen(path);
|
||||
if (strncmp(p, path, length))
|
||||
return 0;
|
||||
p += length;
|
||||
if (*p == ' ' || *p == '\t')
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
XCOMM
|
||||
XCOMM Imakefile for gozilla
|
||||
XCOMM
|
||||
|
||||
LOCAL_LIBRARIES = XawClientLibs -L../lib -lutil
|
||||
DEPLIBS = XawClientDepLibs ../lib/libutil.a
|
||||
DEFINES = -DSTANDALONE -DGLOBAL -I../lib
|
||||
|
||||
SRCS = gozilla.c remote.c
|
||||
OBJS = gozilla.o remote.o
|
||||
|
||||
ComplexProgramTarget(gozilla)
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Shigio Yamaguchi.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* gozilla.c 27-Oct-97
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "global.h"
|
||||
|
||||
char *progname = "gozilla"; /* command name */
|
||||
|
||||
static void usage __P((void));
|
||||
void main __P((int, char **));
|
||||
int sendcommand __P((char *));
|
||||
|
||||
int bflag;
|
||||
int pflag;
|
||||
int Cflag;
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "usage:\t%s\n\t%s\n",
|
||||
"gozilla [+no] [-b browser] [-p] file",
|
||||
"gozilla -C command");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char c, *p, *q;
|
||||
char *browser = (char *)0;
|
||||
char *command = (char *)0;
|
||||
char *arg = (char *)0;
|
||||
char URL[MAXPATHLEN+1];
|
||||
char com[MAXCOMLINE+1];
|
||||
int linenumber = 0;
|
||||
int status;
|
||||
|
||||
while (--argc > 0 && (c = (++argv)[0][0]) == '-' || c == '+') {
|
||||
if (c == '+') {
|
||||
linenumber = atoi(argv[0] + 1);
|
||||
continue;
|
||||
}
|
||||
p = argv[0] + 1;
|
||||
switch (*p) {
|
||||
case 'b':
|
||||
browser = argv[1];
|
||||
--argc; ++argv;
|
||||
break;
|
||||
case 'p':
|
||||
pflag++;
|
||||
break;
|
||||
case 'C':
|
||||
command = argv[1];
|
||||
--argc; ++argv;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
if (!browser && getenv("BROWSER"))
|
||||
browser = getenv("BROWSER");
|
||||
if (command) {
|
||||
if (browser)
|
||||
die("-C option is valid only for mozilla.");
|
||||
if (sendcommand(command) == -1)
|
||||
die("mozilla not found.");
|
||||
exit(0);
|
||||
}
|
||||
if (argc == 0)
|
||||
usage();
|
||||
if (locatestring(argv[0], "http:", 1) || locatestring(argv[0], "file:", 1))
|
||||
strcpy(URL, argv[0]);
|
||||
else {
|
||||
char *abspath;
|
||||
char pathbuf[MAXPATHLEN+1];
|
||||
char htmlpath[MAXPATHLEN+1];
|
||||
|
||||
if (!test("f", argv[0]) && !test("d", argv[0]))
|
||||
die1("path '%s' not found.", argv[0]);
|
||||
if (!(abspath = realpath(argv[0], pathbuf)))
|
||||
die1("cannot make absolute path name. realpath(%s) failed.", argv[0]);
|
||||
if (*abspath != '/')
|
||||
die("realpath(3) is not compatible with BSD version.");
|
||||
if (issource(abspath)) {
|
||||
char cwd[MAXPATHLEN+1];
|
||||
char root[MAXPATHLEN+1];
|
||||
char dbpath[MAXPATHLEN+1];
|
||||
char htmldir[MAXPATHLEN+1];
|
||||
/*
|
||||
* get current, root and dbpath directory.
|
||||
* if GTAGS not found, getdbpath doesn't return.
|
||||
*/
|
||||
getdbpath(cwd, root, dbpath);
|
||||
if (test("d", makepath(dbpath, "HTML")))
|
||||
strcpy(htmldir, makepath(dbpath, "HTML"));
|
||||
else if (test("d", makepath(root, "HTML")))
|
||||
strcpy(htmldir, makepath(root, "HTML"));
|
||||
else
|
||||
die("hypertext not found. See htags(1).");
|
||||
/*
|
||||
* convert path into hypertext.
|
||||
*/
|
||||
p = abspath + strlen(root);
|
||||
for (q = ++p; *q; q++)
|
||||
if (*q == '/')
|
||||
*q = ' ';
|
||||
if (linenumber)
|
||||
sprintf(URL, "file:%s/S/%s.html#%d", htmldir, p, linenumber);
|
||||
else
|
||||
sprintf(URL, "file:%s/S/%s.html", htmldir, p);
|
||||
} else {
|
||||
sprintf(URL, "file:%s", abspath);
|
||||
}
|
||||
}
|
||||
if (pflag) {
|
||||
fprintf(stdout, "%s\n", URL);
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* execute generic browser.
|
||||
*/
|
||||
if (browser && !locatestring(browser, "netscape", 3)) {
|
||||
sprintf(com, "%s '%s'", browser, URL);
|
||||
system(com);
|
||||
exit (0);
|
||||
}
|
||||
/*
|
||||
* send a command to mozilla.
|
||||
*/
|
||||
sprintf(com, "openURL(%s)", URL);
|
||||
status = sendcommand(com);
|
||||
/*
|
||||
* load mozilla if not found.
|
||||
*/
|
||||
if (status != 0) {
|
||||
int pid;
|
||||
|
||||
if ((pid = fork()) < 0) {
|
||||
die("cannot execute netscape (fork).");
|
||||
} else if (pid == 0) {
|
||||
execlp("netscape", "netscape", URL, (char *)0);
|
||||
die("loading mozilla failed.");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
exit(status);
|
||||
}
|
||||
int
|
||||
sendcommand(com)
|
||||
char *com;
|
||||
{
|
||||
int argc = 3;
|
||||
char *argv[4];
|
||||
|
||||
argv[0] = "netscape-remote";
|
||||
argv[1] = "-remote";
|
||||
argv[2] = com;
|
||||
argv[3] = (char *)0;
|
||||
|
||||
return netscape_remote(argc, argv);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Shigio Yamaguchi.
|
||||
.\" 4. Neither the name of the author nor the names of any co-contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Sep 17, 1997
|
||||
.Dt GOZILLA 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm gozilla
|
||||
.Nd force mozilla to display specified source file
|
||||
.Sh SYNOPSIS
|
||||
\fBgozilla\fP [\fB+\fP\fIno\fP]
|
||||
.Op Fl b Ar browser
|
||||
.Op Fl p
|
||||
.Ar file
|
||||
.Nm gozilla
|
||||
.Fl C Ar command
|
||||
.Sh DESCRIPTION
|
||||
First form:
|
||||
.br
|
||||
.Nm Gozilla
|
||||
force mozilla (Netscape Navigator) to display specified source file
|
||||
as a hypertext.
|
||||
If mozilla has not loaded then
|
||||
.Nm
|
||||
loads it.
|
||||
.Pp
|
||||
In advance of using this command, you must execute
|
||||
.Xr gtags 1
|
||||
and
|
||||
.Xr htags 1
|
||||
at the root directory of the source tree to make tag files.
|
||||
Then you can execute
|
||||
.Nm
|
||||
at anywhere in the source tree.
|
||||
.br
|
||||
You can specify source file and the line number optionally.
|
||||
.Pp
|
||||
Second form:
|
||||
.br
|
||||
.Nm Gozilla
|
||||
send
|
||||
.Ar command
|
||||
to mozilla directly.
|
||||
.Ar Command
|
||||
is undocumented. But the hint is in the resource file of mozilla.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width Ds
|
||||
.It Ar \fB+\fP\fIno\fP
|
||||
line number. It must be a line on which function definition or function
|
||||
reference is exist.
|
||||
If you execute
|
||||
.Xr htags 1
|
||||
with -l option, you can specify any line.
|
||||
.It Fl b Ar browser
|
||||
browser to use. By default, assumes mozilla.
|
||||
If you specify another browser,
|
||||
.Nm
|
||||
waits for exiting of the browser.
|
||||
.It Fl p
|
||||
just print generated target URL.
|
||||
.It Ar file
|
||||
path of source file.
|
||||
.It Fl C Ar command
|
||||
send
|
||||
.Ar command
|
||||
to mozilla directly.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width tags -compact
|
||||
.It Pa HTML/
|
||||
hypertext of source tree.
|
||||
.It Pa GTAGS
|
||||
tags file for function definitions.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
The following environment variables affect the execution of gozilla.
|
||||
.Pp
|
||||
.Bl -tag -width indent
|
||||
.It Ev GTAGSROOT
|
||||
The directory which is the root of source tree.
|
||||
.It Ev GTAGSDBPATH
|
||||
The directory on which HTML directory exist. This value is ignored
|
||||
when GTAGSROOT is not defined.
|
||||
.It Ev BROWSER
|
||||
browser to use. By default, assumes mozilla.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
|
||||
% global -x main
|
||||
main 82 ctags.c main(argc, argv)
|
||||
% gozilla +82 ctags.c
|
||||
% gozilla -C pageDown
|
||||
% gozilla -C back
|
||||
|
||||
.Sh DIAGNOSTICS
|
||||
.Nm Gozilla
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr global 1 ,
|
||||
.Xr gtags 1 ,
|
||||
.Xr htags 1 .
|
||||
.Sh NOTES
|
||||
Netscape Navigator is a registered trademark of Netscape Communications Corporation
|
||||
in the United States and other countries.
|
||||
.Pp
|
||||
.Nm Gozilla
|
||||
means 'Global for mozilla'.
|
||||
.Sh BUGS
|
||||
.Nm Gozilla
|
||||
can treat not only source file but also normal file, directory, HTML file
|
||||
and even URL, because it is omnivorous.
|
||||
.Sh AUTHORS
|
||||
Shigio Yamaguchi ([email protected])
|
||||
@@ -0,0 +1,717 @@
|
||||
/* -*- Mode:C; tab-width: 8 -*-
|
||||
* remote.c --- remote control of Netscape Navigator for Unix.
|
||||
* version 1.1.3, for Netscape Navigator 1.1 and newer.
|
||||
*
|
||||
* Copyright © 1996 Netscape Communications Corporation, all rights reserved.
|
||||
* Created: Jamie Zawinski <jwz@netscape.com>, 24-Dec-94.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation. No representations are made about the suitability of this
|
||||
* software for any purpose. It is provided "as is" without express or
|
||||
* implied warranty.
|
||||
*
|
||||
* To compile:
|
||||
*
|
||||
* cc -o netscape-remote remote.c -DSTANDALONE -lXmu -lX11
|
||||
*
|
||||
* To use:
|
||||
*
|
||||
* netscape-remote -help
|
||||
*
|
||||
* Documentation for the protocol which this code implements may be found at:
|
||||
*
|
||||
* http://home.netscape.com/newsref/std/x-remote.html
|
||||
*
|
||||
* Bugs and commentary to x_cbug@netscape.com.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xmu/WinUtil.h> /* for XmuClientWindow() */
|
||||
|
||||
|
||||
/* vroot.h is a header file which lets a client get along with `virtual root'
|
||||
window managers like swm, tvtwm, olvwm, etc. If you don't have this header
|
||||
file, you can find it at "http://home.netscape.com/newsref/std/vroot.h".
|
||||
If you don't care about supporting virtual root window managers, you can
|
||||
comment this line out.
|
||||
*/
|
||||
#include "vroot.h"
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
#ifdef GLOBAL
|
||||
extern char *progname;
|
||||
#else
|
||||
static const char *progname = 0;
|
||||
#endif
|
||||
static const char *expected_mozilla_version = "1.1";
|
||||
#else /* !STANDALONE */
|
||||
extern const char *progname;
|
||||
extern const char *expected_mozilla_version;
|
||||
#endif /* !STANDALONE */
|
||||
|
||||
#define MOZILLA_VERSION_PROP "_MOZILLA_VERSION"
|
||||
#define MOZILLA_LOCK_PROP "_MOZILLA_LOCK"
|
||||
#define MOZILLA_COMMAND_PROP "_MOZILLA_COMMAND"
|
||||
#define MOZILLA_RESPONSE_PROP "_MOZILLA_RESPONSE"
|
||||
static Atom XA_MOZILLA_VERSION = 0;
|
||||
static Atom XA_MOZILLA_LOCK = 0;
|
||||
static Atom XA_MOZILLA_COMMAND = 0;
|
||||
static Atom XA_MOZILLA_RESPONSE = 0;
|
||||
|
||||
static void
|
||||
mozilla_remote_init_atoms (Display *dpy)
|
||||
{
|
||||
if (! XA_MOZILLA_VERSION)
|
||||
XA_MOZILLA_VERSION = XInternAtom (dpy, MOZILLA_VERSION_PROP, False);
|
||||
if (! XA_MOZILLA_LOCK)
|
||||
XA_MOZILLA_LOCK = XInternAtom (dpy, MOZILLA_LOCK_PROP, False);
|
||||
if (! XA_MOZILLA_COMMAND)
|
||||
XA_MOZILLA_COMMAND = XInternAtom (dpy, MOZILLA_COMMAND_PROP, False);
|
||||
if (! XA_MOZILLA_RESPONSE)
|
||||
XA_MOZILLA_RESPONSE = XInternAtom (dpy, MOZILLA_RESPONSE_PROP, False);
|
||||
}
|
||||
|
||||
static Window
|
||||
mozilla_remote_find_window (Display *dpy)
|
||||
{
|
||||
int i;
|
||||
Window root = RootWindowOfScreen (DefaultScreenOfDisplay (dpy));
|
||||
Window root2, parent, *kids;
|
||||
unsigned int nkids;
|
||||
Window result = 0;
|
||||
Window tenative = 0;
|
||||
unsigned char *tenative_version = 0;
|
||||
|
||||
if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids))
|
||||
{
|
||||
fprintf (stderr, "%s: XQueryTree failed on display %s\n", progname,
|
||||
DisplayString (dpy));
|
||||
exit (2);
|
||||
}
|
||||
|
||||
/* root != root2 is possible with virtual root WMs. */
|
||||
|
||||
if (! (kids && nkids))
|
||||
{
|
||||
fprintf (stderr, "%s: root window has no children on display %s\n",
|
||||
progname, DisplayString (dpy));
|
||||
exit (2);
|
||||
}
|
||||
|
||||
for (i = nkids-1; i >= 0; i--)
|
||||
{
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nitems, bytesafter;
|
||||
unsigned char *version = 0;
|
||||
Window w = XmuClientWindow (dpy, kids[i]);
|
||||
int status = XGetWindowProperty (dpy, w, XA_MOZILLA_VERSION,
|
||||
0, (65536 / sizeof (long)),
|
||||
False, XA_STRING,
|
||||
&type, &format, &nitems, &bytesafter,
|
||||
&version);
|
||||
if (! version)
|
||||
continue;
|
||||
if (strcmp ((char *) version, expected_mozilla_version) &&
|
||||
!tenative)
|
||||
{
|
||||
tenative = w;
|
||||
tenative_version = version;
|
||||
continue;
|
||||
}
|
||||
XFree (version);
|
||||
if (status == Success && type != None)
|
||||
{
|
||||
result = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result && tenative)
|
||||
{
|
||||
#ifndef GLOBAL
|
||||
fprintf (stderr,
|
||||
"%s: warning: both version %s (0x%x) and version\n"
|
||||
"\t%s (0x%x) are running. Using version %s.\n",
|
||||
progname, tenative_version, (unsigned int) tenative,
|
||||
expected_mozilla_version, (unsigned int) result,
|
||||
expected_mozilla_version);
|
||||
#endif
|
||||
XFree (tenative_version);
|
||||
return result;
|
||||
}
|
||||
else if (tenative)
|
||||
{
|
||||
#ifndef GLOBAL
|
||||
fprintf (stderr,
|
||||
"%s: warning: expected version %s but found version\n"
|
||||
"\t%s (0x%x) instead.\n",
|
||||
progname, expected_mozilla_version,
|
||||
tenative_version, (unsigned int) tenative);
|
||||
#endif
|
||||
XFree (tenative_version);
|
||||
return tenative;
|
||||
}
|
||||
else if (result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GLOBAL
|
||||
return 0;
|
||||
#else
|
||||
fprintf (stderr, "%s: not running on display %s\n", progname,
|
||||
DisplayString (dpy));
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mozilla_remote_check_window (Display *dpy, Window window)
|
||||
{
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nitems, bytesafter;
|
||||
unsigned char *version = 0;
|
||||
int status = XGetWindowProperty (dpy, window, XA_MOZILLA_VERSION,
|
||||
0, (65536 / sizeof (long)),
|
||||
False, XA_STRING,
|
||||
&type, &format, &nitems, &bytesafter,
|
||||
&version);
|
||||
if (status != Success || !version)
|
||||
{
|
||||
fprintf (stderr, "%s: window 0x%x is not a Netscape window.\n",
|
||||
progname, (unsigned int) window);
|
||||
exit (6);
|
||||
}
|
||||
else if (strcmp ((char *) version, expected_mozilla_version))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: warning: window 0x%x is Netscape version %s;\n"
|
||||
"\texpected version %s.\n",
|
||||
progname, (unsigned int) window,
|
||||
version, expected_mozilla_version);
|
||||
}
|
||||
XFree (version);
|
||||
}
|
||||
|
||||
|
||||
static char *lock_data = 0;
|
||||
|
||||
static void
|
||||
mozilla_remote_obtain_lock (Display *dpy, Window window)
|
||||
{
|
||||
Bool locked = False;
|
||||
Bool waited = False;
|
||||
|
||||
if (! lock_data)
|
||||
{
|
||||
lock_data = (char *) malloc (255);
|
||||
sprintf (lock_data, "pid%d@", getpid ());
|
||||
if (gethostname (lock_data + strlen (lock_data), 100))
|
||||
{
|
||||
perror ("gethostname");
|
||||
exit (-1);
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
int result;
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems, bytes_after;
|
||||
unsigned char *data = 0;
|
||||
|
||||
XGrabServer (dpy); /* ################################# DANGER! */
|
||||
|
||||
result = XGetWindowProperty (dpy, window, XA_MOZILLA_LOCK,
|
||||
0, (65536 / sizeof (long)),
|
||||
False, /* don't delete */
|
||||
XA_STRING,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after,
|
||||
&data);
|
||||
if (result != Success || actual_type == None)
|
||||
{
|
||||
/* It's not now locked - lock it. */
|
||||
#ifdef DEBUG_PROPS
|
||||
fprintf (stderr, "%s: (writing " MOZILLA_LOCK_PROP
|
||||
" \"%s\" to 0x%x)\n",
|
||||
progname, lock_data, (unsigned int) window);
|
||||
#endif
|
||||
XChangeProperty (dpy, window, XA_MOZILLA_LOCK, XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *) lock_data,
|
||||
strlen (lock_data));
|
||||
locked = True;
|
||||
}
|
||||
|
||||
XUngrabServer (dpy); /* ################################# danger over */
|
||||
XSync (dpy, False);
|
||||
|
||||
if (! locked)
|
||||
{
|
||||
/* We tried to grab the lock this time, and failed because someone
|
||||
else is holding it already. So, wait for a PropertyDelete event
|
||||
to come in, and try again. */
|
||||
|
||||
fprintf (stderr, "%s: window 0x%x is locked by %s; waiting...\n",
|
||||
progname, (unsigned int) window, data);
|
||||
waited = True;
|
||||
|
||||
while (1)
|
||||
{
|
||||
XEvent event;
|
||||
XNextEvent (dpy, &event);
|
||||
if (event.xany.type == DestroyNotify &&
|
||||
event.xdestroywindow.window == window)
|
||||
{
|
||||
fprintf (stderr, "%s: window 0x%x unexpectedly destroyed.\n",
|
||||
progname, (unsigned int) window);
|
||||
exit (6);
|
||||
}
|
||||
else if (event.xany.type == PropertyNotify &&
|
||||
event.xproperty.state == PropertyDelete &&
|
||||
event.xproperty.window == window &&
|
||||
event.xproperty.atom == XA_MOZILLA_LOCK)
|
||||
{
|
||||
/* Ok! Someone deleted their lock, so now we can try
|
||||
again. */
|
||||
#ifdef DEBUG_PROPS
|
||||
fprintf (stderr, "%s: (0x%x unlocked, trying again...)\n",
|
||||
progname, (unsigned int) window);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data)
|
||||
XFree (data);
|
||||
}
|
||||
while (! locked);
|
||||
|
||||
if (waited)
|
||||
fprintf (stderr, "%s: obtained lock.\n", progname);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mozilla_remote_free_lock (Display *dpy, Window window)
|
||||
{
|
||||
int result;
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems, bytes_after;
|
||||
unsigned char *data = 0;
|
||||
|
||||
#ifdef DEBUG_PROPS
|
||||
fprintf (stderr, "%s: (deleting " MOZILLA_LOCK_PROP
|
||||
" \"%s\" from 0x%x)\n",
|
||||
progname, lock_data, (unsigned int) window);
|
||||
#endif
|
||||
|
||||
result = XGetWindowProperty (dpy, window, XA_MOZILLA_LOCK,
|
||||
0, (65536 / sizeof (long)),
|
||||
True, /* atomic delete after */
|
||||
XA_STRING,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after,
|
||||
&data);
|
||||
if (result != Success)
|
||||
{
|
||||
fprintf (stderr, "%s: unable to read and delete " MOZILLA_LOCK_PROP
|
||||
" property\n",
|
||||
progname);
|
||||
return;
|
||||
}
|
||||
else if (!data || !*data)
|
||||
{
|
||||
fprintf (stderr, "%s: invalid data on " MOZILLA_LOCK_PROP
|
||||
" of window 0x%x.\n",
|
||||
progname, (unsigned int) window);
|
||||
return;
|
||||
}
|
||||
else if (strcmp ((char *) data, lock_data))
|
||||
{
|
||||
fprintf (stderr, "%s: " MOZILLA_LOCK_PROP
|
||||
" was stolen! Expected \"%s\", saw \"%s\"!\n",
|
||||
progname, lock_data, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data)
|
||||
XFree (data);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mozilla_remote_command (Display *dpy, Window window, const char *command,
|
||||
Bool raise_p)
|
||||
{
|
||||
int result;
|
||||
Bool done = False;
|
||||
char *new_command = 0;
|
||||
|
||||
/* The -noraise option is implemented by passing a "noraise" argument
|
||||
to each command to which it should apply.
|
||||
*/
|
||||
if (! raise_p)
|
||||
{
|
||||
char *close;
|
||||
new_command = (char *) malloc (strlen (command) + 20);
|
||||
strcpy (new_command, command);
|
||||
close = strrchr (new_command, ')');
|
||||
if (close)
|
||||
strcpy (close, ", noraise)");
|
||||
else
|
||||
strcat (new_command, "(noraise)");
|
||||
command = new_command;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PROPS
|
||||
fprintf (stderr, "%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n",
|
||||
progname, command, (unsigned int) window);
|
||||
#endif
|
||||
|
||||
XChangeProperty (dpy, window, XA_MOZILLA_COMMAND, XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *) command,
|
||||
strlen (command));
|
||||
|
||||
while (!done)
|
||||
{
|
||||
XEvent event;
|
||||
XNextEvent (dpy, &event);
|
||||
if (event.xany.type == DestroyNotify &&
|
||||
event.xdestroywindow.window == window)
|
||||
{
|
||||
/* Print to warn user...*/
|
||||
fprintf (stderr, "%s: window 0x%x was destroyed.\n",
|
||||
progname, (unsigned int) window);
|
||||
result = 6;
|
||||
goto DONE;
|
||||
}
|
||||
else if (event.xany.type == PropertyNotify &&
|
||||
event.xproperty.state == PropertyNewValue &&
|
||||
event.xproperty.window == window &&
|
||||
event.xproperty.atom == XA_MOZILLA_RESPONSE)
|
||||
{
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems, bytes_after;
|
||||
unsigned char *data = 0;
|
||||
|
||||
result = XGetWindowProperty (dpy, window, XA_MOZILLA_RESPONSE,
|
||||
0, (65536 / sizeof (long)),
|
||||
True, /* atomic delete after */
|
||||
XA_STRING,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after,
|
||||
&data);
|
||||
#ifdef DEBUG_PROPS
|
||||
if (result == Success && data && *data)
|
||||
{
|
||||
fprintf (stderr, "%s: (server sent " MOZILLA_RESPONSE_PROP
|
||||
" \"%s\" to 0x%x.)\n",
|
||||
progname, data, (unsigned int) window);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (result != Success)
|
||||
{
|
||||
fprintf (stderr, "%s: failed reading " MOZILLA_RESPONSE_PROP
|
||||
" from window 0x%0x.\n",
|
||||
progname, (unsigned int) window);
|
||||
result = 6;
|
||||
done = True;
|
||||
}
|
||||
else if (!data || strlen((char *) data) < 5)
|
||||
{
|
||||
fprintf (stderr, "%s: invalid data on " MOZILLA_RESPONSE_PROP
|
||||
" property of window 0x%0x.\n",
|
||||
progname, (unsigned int) window);
|
||||
result = 6;
|
||||
done = True;
|
||||
}
|
||||
else if (*data == '1') /* positive preliminary reply */
|
||||
{
|
||||
fprintf (stderr, "%s: %s\n", progname, data + 4);
|
||||
/* keep going */
|
||||
done = False;
|
||||
}
|
||||
#if 1
|
||||
else if (!strncmp ((char *)data, "200", 3)) /* positive completion */
|
||||
{
|
||||
result = 0;
|
||||
done = True;
|
||||
}
|
||||
#endif
|
||||
else if (*data == '2') /* positive completion */
|
||||
{
|
||||
fprintf (stderr, "%s: %s\n", progname, data + 4);
|
||||
result = 0;
|
||||
done = True;
|
||||
}
|
||||
else if (*data == '3') /* positive intermediate reply */
|
||||
{
|
||||
fprintf (stderr, "%s: internal error: "
|
||||
"server wants more information? (%s)\n",
|
||||
progname, data);
|
||||
result = 3;
|
||||
done = True;
|
||||
}
|
||||
else if (*data == '4' || /* transient negative completion */
|
||||
*data == '5') /* permanent negative completion */
|
||||
{
|
||||
fprintf (stderr, "%s: %s\n", progname, data + 4);
|
||||
result = (*data - '0');
|
||||
done = True;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: unrecognised " MOZILLA_RESPONSE_PROP
|
||||
" from window 0x%x: %s\n",
|
||||
progname, (unsigned int) window, data);
|
||||
result = 6;
|
||||
done = True;
|
||||
}
|
||||
|
||||
if (data)
|
||||
XFree (data);
|
||||
}
|
||||
#ifdef DEBUG_PROPS
|
||||
else if (event.xany.type == PropertyNotify &&
|
||||
event.xproperty.window == window &&
|
||||
event.xproperty.state == PropertyDelete &&
|
||||
event.xproperty.atom == XA_MOZILLA_COMMAND)
|
||||
{
|
||||
fprintf (stderr, "%s: (server 0x%x has accepted "
|
||||
MOZILLA_COMMAND_PROP ".)\n",
|
||||
progname, (unsigned int) window);
|
||||
}
|
||||
#endif /* DEBUG_PROPS */
|
||||
}
|
||||
|
||||
DONE:
|
||||
|
||||
if (new_command)
|
||||
free (new_command);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
mozilla_remote_commands (Display *dpy, Window window, char **commands)
|
||||
{
|
||||
Bool raise_p = True;
|
||||
int status = 0;
|
||||
mozilla_remote_init_atoms (dpy);
|
||||
|
||||
if (window == 0)
|
||||
window = mozilla_remote_find_window (dpy);
|
||||
else
|
||||
mozilla_remote_check_window (dpy, window);
|
||||
#ifdef GLOBAL
|
||||
if (window == 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
XSelectInput (dpy, window, (PropertyChangeMask|StructureNotifyMask));
|
||||
|
||||
mozilla_remote_obtain_lock (dpy, window);
|
||||
|
||||
while (*commands)
|
||||
{
|
||||
if (!strcmp (*commands, "-raise"))
|
||||
raise_p = True;
|
||||
else if (!strcmp (*commands, "-noraise"))
|
||||
raise_p = False;
|
||||
else
|
||||
status = mozilla_remote_command (dpy, window, *commands, raise_p);
|
||||
|
||||
if (status != 0)
|
||||
break;
|
||||
commands++;
|
||||
}
|
||||
|
||||
/* When status = 6, it means the window has been destroyed */
|
||||
/* It is invalid to free the lock when window is destroyed. */
|
||||
|
||||
if ( status != 6 )
|
||||
mozilla_remote_free_lock (dpy, window);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
static void
|
||||
usage (void)
|
||||
{
|
||||
fprintf (stderr, "usage: %s [ options ... ]\n\
|
||||
where options include:\n\
|
||||
\n\
|
||||
-help to show this message.\n\
|
||||
-display <dpy> to specify the X server to use.\n\
|
||||
-remote <remote-command> to execute a command in an already-running\n\
|
||||
Netscape process. See the manual for a\n\
|
||||
list of valid commands.\n\
|
||||
-id <window-id> the id of an X window to which the -remote\n\
|
||||
commands should be sent; if unspecified,\n\
|
||||
the first window found will be used.\n\
|
||||
-raise whether following -remote commands should\n\
|
||||
cause the window to raise itself to the top\n\
|
||||
(this is the default.)\n\
|
||||
-noraise the opposite of -raise: following -remote\n\
|
||||
commands will not auto-raise the window.\n\
|
||||
",
|
||||
progname);
|
||||
}
|
||||
|
||||
|
||||
#ifdef GLOBAL
|
||||
int
|
||||
netscape_remote(int argc, char **argv)
|
||||
#else
|
||||
void
|
||||
main (int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
Display *dpy;
|
||||
char *dpy_string = 0;
|
||||
char **remote_commands = 0;
|
||||
int remote_command_count = 0;
|
||||
int remote_command_size = 0;
|
||||
unsigned long remote_window = 0;
|
||||
Bool sync_p = False;
|
||||
int i;
|
||||
|
||||
progname = strrchr (argv[0], '/');
|
||||
if (progname)
|
||||
progname++;
|
||||
else
|
||||
progname = argv[0];
|
||||
|
||||
/* Hack the -help and -version arguments before opening the display. */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!strcasecmp (argv [i], "-h") ||
|
||||
!strcasecmp (argv [i], "-help"))
|
||||
{
|
||||
usage ();
|
||||
exit (0);
|
||||
}
|
||||
else if (!strcmp (argv [i], "-d") ||
|
||||
!strcmp (argv [i], "-dpy") ||
|
||||
!strcmp (argv [i], "-disp") ||
|
||||
!strcmp (argv [i], "-display"))
|
||||
{
|
||||
i++;
|
||||
dpy_string = argv [i];
|
||||
}
|
||||
else if (!strcmp (argv [i], "-sync") ||
|
||||
!strcmp (argv [i], "-synchronize"))
|
||||
{
|
||||
sync_p = True;
|
||||
}
|
||||
else if (!strcmp (argv [i], "-remote"))
|
||||
{
|
||||
if (remote_command_count == remote_command_size)
|
||||
{
|
||||
remote_command_size += 20;
|
||||
remote_commands =
|
||||
(remote_commands
|
||||
? realloc (remote_commands,
|
||||
remote_command_size * sizeof (char *))
|
||||
: calloc (remote_command_size, sizeof (char *)));
|
||||
}
|
||||
i++;
|
||||
if (!argv[i] || *argv[i] == '-' || *argv[i] == 0)
|
||||
{
|
||||
fprintf (stderr, "%s: invalid `-remote' option \"%s\"\n",
|
||||
progname, argv[i] ? argv[i] : "");
|
||||
usage ();
|
||||
exit (-1);
|
||||
}
|
||||
remote_commands [remote_command_count++] = argv[i];
|
||||
}
|
||||
else if (!strcmp (argv [i], "-raise") ||
|
||||
!strcmp (argv [i], "-noraise"))
|
||||
{
|
||||
char *r = argv [i];
|
||||
if (remote_command_count == remote_command_size)
|
||||
{
|
||||
remote_command_size += 20;
|
||||
remote_commands =
|
||||
(remote_commands
|
||||
? realloc (remote_commands,
|
||||
remote_command_size * sizeof (char *))
|
||||
: calloc (remote_command_size, sizeof (char *)));
|
||||
}
|
||||
remote_commands [remote_command_count++] = r;
|
||||
}
|
||||
else if (!strcmp (argv [i], "-id"))
|
||||
{
|
||||
char c;
|
||||
if (remote_command_count > 0)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: the `-id' option must preceed all `-remote' options.\n",
|
||||
progname);
|
||||
usage ();
|
||||
exit (-1);
|
||||
}
|
||||
else if (remote_window != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: only one `-id' option may be used.\n",
|
||||
progname);
|
||||
usage ();
|
||||
exit (-1);
|
||||
}
|
||||
i++;
|
||||
if (argv[i] &&
|
||||
1 == sscanf (argv[i], " %ld %c", &remote_window, &c))
|
||||
;
|
||||
else if (argv[i] &&
|
||||
1 == sscanf (argv[i], " 0x%lx %c", &remote_window, &c))
|
||||
;
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "%s: invalid `-id' option \"%s\"\n",
|
||||
progname, argv[i] ? argv[i] : "");
|
||||
usage ();
|
||||
exit (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dpy = XOpenDisplay (dpy_string);
|
||||
if (! dpy)
|
||||
exit (-1);
|
||||
|
||||
if (sync_p)
|
||||
XSynchronize (dpy, True);
|
||||
|
||||
#ifdef GLOBAL
|
||||
return mozilla_remote_commands (dpy, (Window) remote_window,
|
||||
remote_commands);
|
||||
#else
|
||||
exit (mozilla_remote_commands (dpy, (Window) remote_window,
|
||||
remote_commands));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* STANDALONE */
|
||||
@@ -0,0 +1,119 @@
|
||||
/*****************************************************************************/
|
||||
/** Copyright 1991 by Andreas Stolcke **/
|
||||
/** Copyright 1990 by Solbourne Computer Inc. **/
|
||||
/** Longmont, Colorado **/
|
||||
/** **/
|
||||
/** All Rights Reserved **/
|
||||
/** **/
|
||||
/** Permission to use, copy, modify, and distribute this software and **/
|
||||
/** its documentation for any purpose and without fee is hereby **/
|
||||
/** granted, provided that the above copyright notice appear in all **/
|
||||
/** copies and that both that copyright notice and this permis- **/
|
||||
/** sion notice appear in supporting documentation, and that the **/
|
||||
/** name of Solbourne not be used in advertising **/
|
||||
/** in publicity pertaining to distribution of the software without **/
|
||||
/** specific, written prior permission. **/
|
||||
/** **/
|
||||
/** ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
|
||||
/** WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF **/
|
||||
/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/
|
||||
/** OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL **/
|
||||
/** DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
|
||||
/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
|
||||
/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
|
||||
/** OR PERFORMANCE OF THIS SOFTWARE. **/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* vroot.h -- Virtual Root Window handling header file
|
||||
*
|
||||
* This header file redefines the X11 macros RootWindow and DefaultRootWindow,
|
||||
* making them look for a virtual root window as provided by certain `virtual'
|
||||
* window managers like swm and tvtwm. If none is found, the ordinary root
|
||||
* window is returned, thus retaining backward compatibility with standard
|
||||
* window managers.
|
||||
* The function implementing the virtual root lookup remembers the result of
|
||||
* its last invocation to avoid overhead in the case of repeated calls
|
||||
* on the same display and screen arguments.
|
||||
* The lookup code itself is taken from Tom LaStrange's ssetroot program.
|
||||
*
|
||||
* Most simple root window changing X programs can be converted to using
|
||||
* virtual roots by just including
|
||||
*
|
||||
* #include <X11/vroot.h>
|
||||
*
|
||||
* after all the X11 header files. It has been tested on such popular
|
||||
* X clients as xphoon, xfroot, xloadimage, and xaqua.
|
||||
* It also works with the core clients xprop, xwininfo, xwd, and editres
|
||||
* (and is necessary to get those clients working under tvtwm).
|
||||
* It does NOT work with xsetroot; get the xsetroot replacement included in
|
||||
* the tvtwm distribution instead.
|
||||
*
|
||||
* Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
|
||||
* - replaced all NULL's with properly cast 0's, 5/6/91
|
||||
* - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
|
||||
* - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
|
||||
*/
|
||||
|
||||
#ifndef _VROOT_H_
|
||||
#define _VROOT_H_
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
static Window
|
||||
VirtualRootWindowOfScreen(screen)
|
||||
Screen *screen;
|
||||
{
|
||||
static Screen *save_screen = (Screen *)0;
|
||||
static Window root = (Window)0;
|
||||
|
||||
if (screen != save_screen) {
|
||||
Display *dpy = DisplayOfScreen(screen);
|
||||
Atom __SWM_VROOT = None;
|
||||
int i;
|
||||
Window rootReturn, parentReturn, *children;
|
||||
unsigned int numChildren;
|
||||
|
||||
root = RootWindowOfScreen(screen);
|
||||
|
||||
/* go look for a virtual root */
|
||||
__SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
|
||||
if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
|
||||
&children, &numChildren)) {
|
||||
for (i = 0; i < numChildren; i++) {
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems, bytesafter;
|
||||
Window *newRoot = (Window *)0;
|
||||
|
||||
if (XGetWindowProperty(dpy, children[i],
|
||||
__SWM_VROOT, 0, 1, False, XA_WINDOW,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytesafter,
|
||||
(unsigned char **) &newRoot) == Success
|
||||
&& newRoot) {
|
||||
root = *newRoot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (children)
|
||||
XFree((char *)children);
|
||||
}
|
||||
|
||||
save_screen = screen;
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
#undef RootWindowOfScreen
|
||||
#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
|
||||
|
||||
#undef RootWindow
|
||||
#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
|
||||
|
||||
#undef DefaultRootWindow
|
||||
#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
|
||||
|
||||
#endif /* _VROOT_H_ */
|
||||
@@ -0,0 +1,350 @@
|
||||
;;; gtags.el --- gtags facility for Emacs
|
||||
|
||||
;;
|
||||
;; Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
|
||||
;;
|
||||
;; Redistribution and use in source and binary forms, with or without
|
||||
;; modification, are permitted provided that the following conditions
|
||||
;; are met:
|
||||
;; 1. Redistributions of source code must retain the above copyright
|
||||
;; notice, this list of conditions and the following disclaimer.
|
||||
;; 2. Redistributions in binary form must reproduce the above copyright
|
||||
;; notice, this list of conditions and the following disclaimer in the
|
||||
;; documentation and/or other materials provided with the distribution.
|
||||
;; 3. All advertising materials mentioning features or use of this software
|
||||
;; must display the following acknowledgement:
|
||||
;; This product includes software developed by Shigio Yamaguchi.
|
||||
;; 4. Neither the name of the author nor the names of any co-contributors
|
||||
;; may be used to endorse or promote products derived from this software
|
||||
;; without specific prior written permission.
|
||||
;;
|
||||
;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
;; SUCH DAMAGE.
|
||||
;;
|
||||
;; gtags.el 31-Aug-97
|
||||
;;
|
||||
|
||||
;; This file is part of GLOBAL.
|
||||
;; Author: Shigio Yamaguchi <[email protected]>
|
||||
;; Version: 1.1
|
||||
;; Keywords: tools
|
||||
|
||||
;;; Code
|
||||
|
||||
(defvar gtags-buffer-stack nil
|
||||
"Stack for tag browsing.")
|
||||
(defvar gtags-point-stack nil
|
||||
"Stack for tag browsing.")
|
||||
(defvar gtags-complete-list nil
|
||||
"Gtags complete list.")
|
||||
(defconst symbol-regexp "[A-Za-z_][A-Za-z_0-9]*"
|
||||
"Regexp matching tag name.")
|
||||
(defconst definition-regexp "#[ \t]*define[ \t]+\\|ENTRY(\\|ALTENTRY("
|
||||
"Regexp matching tag definition name.")
|
||||
(defvar gtags-read-only nil
|
||||
"Gtags read only mode")
|
||||
(defvar gtags-mode-map (make-sparse-keymap)
|
||||
"Keymap used in gtags mode.")
|
||||
(define-key gtags-mode-map "\et" 'gtags-find-tag)
|
||||
(define-key gtags-mode-map "\er" 'gtags-find-rtag)
|
||||
(define-key gtags-mode-map "\es" 'gtags-find-symbol)
|
||||
(define-key gtags-mode-map "\eg" 'gtags-find-pattern)
|
||||
(define-key gtags-mode-map "\C-]" 'gtags-find-tag-from-here)
|
||||
(define-key gtags-mode-map "\C-t" 'gtags-pop-stack)
|
||||
(define-key gtags-mode-map "\e." 'etags-style-find-tag)
|
||||
(define-key gtags-mode-map [mouse-2] 'gtags-find-tag-by-event)
|
||||
(define-key gtags-mode-map [mouse-3] 'gtags-pop-stack)
|
||||
|
||||
(defvar gtags-select-mode-map (make-sparse-keymap)
|
||||
"Keymap used in gtags select mode.")
|
||||
(define-key gtags-select-mode-map "q" 'gtags-pop-stack)
|
||||
(define-key gtags-select-mode-map "\C-t" 'gtags-pop-stack)
|
||||
(define-key gtags-select-mode-map "\C-m" 'gtags-select-tag)
|
||||
(define-key gtags-select-mode-map " " 'scroll-up)
|
||||
(define-key gtags-select-mode-map "\^?" 'scroll-down)
|
||||
(define-key gtags-select-mode-map "\C-f" 'scroll-up)
|
||||
(define-key gtags-select-mode-map "\C-b" 'scroll-down)
|
||||
(define-key gtags-select-mode-map "n" 'next-line)
|
||||
(define-key gtags-select-mode-map "p" 'previous-line)
|
||||
(define-key gtags-select-mode-map "j" 'next-line)
|
||||
(define-key gtags-select-mode-map "k" 'previous-line)
|
||||
(define-key gtags-select-mode-map [mouse-2] 'gtags-select-tag-by-event)
|
||||
(define-key gtags-select-mode-map [mouse-3] 'gtags-pop-stack)
|
||||
|
||||
;;
|
||||
;; utility
|
||||
;;
|
||||
(defun match-string (n)
|
||||
(buffer-substring (match-beginning n) (match-end n)))
|
||||
|
||||
;; Return a default tag to search for, based on the text at point.
|
||||
(defun gtags-current-token ()
|
||||
(cond
|
||||
((looking-at "[0-9A-Za-z_]")
|
||||
(while (looking-at "[0-9A-Za-z_]")
|
||||
(forward-char -1))
|
||||
(forward-char 1))
|
||||
(t
|
||||
(while (looking-at "[ \t]")
|
||||
(forward-char 1))))
|
||||
(if (and (bolp) (looking-at definition-regexp))
|
||||
(goto-char (match-end 0)))
|
||||
(if (looking-at symbol-regexp)
|
||||
(match-string 0) nil))
|
||||
|
||||
;; push current context to stack
|
||||
(defun push-context ()
|
||||
(setq gtags-buffer-stack (cons (current-buffer) gtags-buffer-stack))
|
||||
(setq gtags-point-stack (cons (point) gtags-point-stack)))
|
||||
|
||||
;; pop context from stack
|
||||
(defun pop-context ()
|
||||
(if (not gtags-buffer-stack) nil
|
||||
(let (buffer point)
|
||||
(setq buffer (car gtags-buffer-stack))
|
||||
(setq gtags-buffer-stack (cdr gtags-buffer-stack))
|
||||
(setq point (car gtags-point-stack))
|
||||
(setq gtags-point-stack (cdr gtags-point-stack))
|
||||
(list buffer point))))
|
||||
|
||||
;; if the buffer exist in the stack
|
||||
(defun exist-in-stack (buffer)
|
||||
(memq buffer gtags-buffer-stack))
|
||||
|
||||
;; is it a function?
|
||||
(defun is-function ()
|
||||
(save-excursion
|
||||
(while (and (not (eolp)) (looking-at "[0-9A-Za-z_]"))
|
||||
(forward-char 1))
|
||||
(while (and (not (eolp)) (looking-at "[ \t]"))
|
||||
(forward-char 1))
|
||||
(if (looking-at "(") t nil)))
|
||||
|
||||
;; is it a definition?
|
||||
(defun is-definition ()
|
||||
(save-excursion
|
||||
(if (bolp)
|
||||
t
|
||||
(forward-word -1)
|
||||
(cond
|
||||
((looking-at "define")
|
||||
(forward-char -1)
|
||||
(while (and (not (bolp)) (looking-at "[ \t]"))
|
||||
(forward-char -1))
|
||||
(if (and (bolp) (looking-at "#"))
|
||||
t nil))
|
||||
((looking-at "ENTRY\\|ALTENTRY")
|
||||
(if (bolp) t nil))))))
|
||||
|
||||
;;
|
||||
;; interactive command
|
||||
;;
|
||||
(defun gtags-find-tag ()
|
||||
"Input tag name and move to the definition."
|
||||
(interactive)
|
||||
(let (tagname)
|
||||
(setq tagname (completing-read ":tag " gtags-complete-list))
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname "")))
|
||||
|
||||
(defun etags-style-find-tag ()
|
||||
"Input tag name and move to the definition.(etags style)"
|
||||
(interactive)
|
||||
(let (tagname prompt input)
|
||||
(setq tagname (gtags-current-token))
|
||||
(if tagname
|
||||
(setq prompt (concat "Find tag: (default " tagname ") "))
|
||||
(setq prompt "Find tag: "))
|
||||
(setq input (completing-read prompt gtags-complete-list))
|
||||
(if (not (equal "" input)) (setq tagname input))
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname "")))
|
||||
|
||||
(defun gtags-find-symbol ()
|
||||
"Input symbol and move to the locations."
|
||||
(interactive)
|
||||
(let (tagname prompt input)
|
||||
(setq tagname (gtags-current-token))
|
||||
(if tagname
|
||||
(setq prompt (concat "Find symbol: (default " tagname ") "))
|
||||
(setq prompt "Find symbol: "))
|
||||
(setq input (read-string prompt))
|
||||
(if (not (equal "" input)) (setq tagname input))
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname "s")))
|
||||
|
||||
(defun gtags-find-pattern ()
|
||||
"Input pattern and move to the locations."
|
||||
(interactive)
|
||||
(let (tagname prompt input)
|
||||
(setq tagname (gtags-current-token))
|
||||
(if tagname
|
||||
(setq prompt (concat "Find pattern: (default " tagname ") "))
|
||||
(setq prompt "Find pattern: "))
|
||||
(setq input (read-string prompt))
|
||||
(if (not (equal "" input)) (setq tagname input))
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname "g")))
|
||||
|
||||
(defun gtags-find-rtag ()
|
||||
"Input tag name and move to the referenced point."
|
||||
(interactive)
|
||||
(let (tagname)
|
||||
(setq tagname (completing-read ":rtag " gtags-complete-list))
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname "r")))
|
||||
|
||||
(defun gtags-find-tag-from-here ()
|
||||
"Get the expression as a tagname around here and move there."
|
||||
(interactive)
|
||||
(let (tagname flag)
|
||||
(setq tagname (gtags-current-token))
|
||||
(if (is-function)
|
||||
(if (is-definition) (setq flag "r") (setq flag ""))
|
||||
(setq flag "s"))
|
||||
(if (not tagname)
|
||||
nil
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname flag))))
|
||||
|
||||
(defun gtags-find-tag-by-event (event)
|
||||
"Get the expression as a tagname around here and move there."
|
||||
(interactive "e")
|
||||
(select-window (posn-window (event-end event)))
|
||||
(set-buffer (window-buffer (posn-window (event-end event))))
|
||||
(goto-char (posn-point (event-end event)))
|
||||
(let (tagname flag)
|
||||
(if (= 0 (count-lines (point-min) (point-max)))
|
||||
(progn (setq tagname "main") (setq flag ""))
|
||||
(setq tagname (gtags-current-token))
|
||||
(if (is-function)
|
||||
(if (is-definition) (setq flag "r") (setq flag ""))
|
||||
(setq flag "s")))
|
||||
(if (not tagname)
|
||||
nil
|
||||
(push-context)
|
||||
(gtags-goto-tag tagname flag))))
|
||||
|
||||
(defun gtags-select-tag ()
|
||||
"Select a tagname in [GTAGS SELECT MODE] and move there."
|
||||
(interactive)
|
||||
(push-context)
|
||||
(gtags-select-it nil))
|
||||
|
||||
(defun gtags-select-tag-by-event (event)
|
||||
"Select a tagname in [GTAGS SELECT MODE] and move there."
|
||||
(interactive "e")
|
||||
(select-window (posn-window (event-end event)))
|
||||
(set-buffer (window-buffer (posn-window (event-end event))))
|
||||
(goto-char (posn-point (event-end event)))
|
||||
(push-context)
|
||||
(gtags-select-it nil))
|
||||
|
||||
(defun gtags-pop-stack ()
|
||||
"Move to previous point on the stack."
|
||||
(interactive)
|
||||
(let (delete context buffer)
|
||||
(if (not (exist-in-stack (current-buffer)))
|
||||
(setq delete t))
|
||||
(setq context (pop-context))
|
||||
(if (not context)
|
||||
(message "The tags stack is empty.")
|
||||
(if delete
|
||||
(kill-buffer (current-buffer)))
|
||||
(switch-to-buffer (nth 0 context))
|
||||
(goto-char (nth 1 context)))))
|
||||
|
||||
;;
|
||||
;; common function
|
||||
;;
|
||||
|
||||
;; goto tag's point
|
||||
(defun gtags-goto-tag (tagname flag)
|
||||
(let (save prefix buffer lines)
|
||||
(setq save (current-buffer))
|
||||
(cond
|
||||
((equal flag "g")
|
||||
(setq prefix "(G)"))
|
||||
((equal flag "s")
|
||||
(setq prefix "(S)"))
|
||||
((equal flag "r")
|
||||
(setq prefix "(R)"))
|
||||
(t (setq prefix "(D)")))
|
||||
;; load tag
|
||||
(setq buffer (generate-new-buffer (generate-new-buffer-name (concat prefix tagname))))
|
||||
(set-buffer buffer)
|
||||
(if (not (= 0 (call-process "global" nil t nil (concat "-ax" flag) tagname)))
|
||||
(progn (message (buffer-substring (point-min)(1- (point-max))))
|
||||
(pop-context))
|
||||
(goto-char (point-min))
|
||||
(setq lines (count-lines (point-min) (point-max)))
|
||||
(cond
|
||||
((= 0 lines)
|
||||
(message "%s: tag not found" tagname)
|
||||
(pop-context)
|
||||
(kill-buffer buffer)
|
||||
(set-buffer save))
|
||||
((= 1 lines)
|
||||
(gtags-select-it t))
|
||||
(t
|
||||
(switch-to-buffer buffer)
|
||||
(gtags-select-mode))))))
|
||||
|
||||
;; select a tag line from lines
|
||||
(defun gtags-select-it (delete)
|
||||
(let (line file)
|
||||
;; get context from current tag line
|
||||
(beginning-of-line)
|
||||
;; (if (not (looking-at "[A-Za-z_][A-Za-z_0-9]*[ \t]+\\([0-9]+\\)[ \t]\\([^ \t]+\\)[ \t]"))
|
||||
(if (not (looking-at "[^ \t]+[ \t]+\\([0-9]+\\)[ \t]\\([^ \t]+\\)[ \t]"))
|
||||
(pop-context)
|
||||
(setq line (string-to-number (match-string 1)))
|
||||
(setq file (match-string 2))
|
||||
(if delete (kill-buffer (current-buffer)))
|
||||
;; move to the context
|
||||
(if gtags-read-only (find-file-read-only file) (find-file file))
|
||||
(goto-line line)
|
||||
(use-local-map gtags-mode-map))))
|
||||
|
||||
;; make complete list
|
||||
(defun make-gtags-complete-list ()
|
||||
(save-excursion
|
||||
(setq gtags-complete-list (make-vector 63 0))
|
||||
(set-buffer (generate-new-buffer "*Completions*"))
|
||||
(call-process "global" nil t nil "-c")
|
||||
(goto-char (point-min))
|
||||
(while (looking-at symbol-regexp)
|
||||
(intern (match-string 0) gtags-complete-list)
|
||||
(forward-line))
|
||||
(kill-buffer (current-buffer))))
|
||||
|
||||
;;;###autoload
|
||||
(defun gtags-mode ()
|
||||
"Minor mode for browsing C source using GLOBAL."
|
||||
(interactive)
|
||||
(make-gtags-complete-list)
|
||||
(use-local-map gtags-mode-map)
|
||||
(run-hooks 'gtags-mode-hook))
|
||||
|
||||
;; make gtags select mode
|
||||
(defun gtags-select-mode ()
|
||||
"Major mode for choosing a tag from tags list."
|
||||
(setq buffer-read-only t
|
||||
major-mode 'gtags-select-mode
|
||||
mode-name "Gtags Select")
|
||||
(use-local-map gtags-select-mode-map)
|
||||
(setq truncate-lines t)
|
||||
(goto-char (point-min))
|
||||
(message "[GTAGS SELECT MODE] %d lines" (count-lines (point-min) (point-max)))
|
||||
(run-hooks 'gtags-select-mode-hook))
|
||||
|
||||
;;; gtags.el ends here
|
||||
@@ -0,0 +1,6 @@
|
||||
PROG= gtags
|
||||
CFLAGS+=-I${.CURDIR}/../lib
|
||||
LDADD= $(LIBUTIL)
|
||||
DPADD= $(LIBUTIL)
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -28,59 +28,71 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Apr 21, 1997
|
||||
.Dd Sep 12, 1997
|
||||
.Dt GTAGS 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
.Nm gtags
|
||||
.Nd create GTAGS, GRTAGS file
|
||||
.Nd create GTAGS, GRTAGS and GSYMS file
|
||||
.Sh SYNOPSIS
|
||||
.Nm gtags
|
||||
.Op Fl e
|
||||
.Op Fl s
|
||||
.Op Fl i
|
||||
.Op Fl o
|
||||
.Op Fl v
|
||||
.Op Ar dbpath
|
||||
.Sh DESCRIPTION
|
||||
.Nm Gtags
|
||||
makes GTAGS, GRTAGS files for global(1).
|
||||
makes GTAGS, GRTAGS and GSYMS file for
|
||||
.Xr global 1 .
|
||||
.Nm Gtags
|
||||
trace subdirectories, read source files,
|
||||
locate the functions and save the information into tag files.
|
||||
locate symbols and save the information into tag files.
|
||||
C, yacc and assembler source files are supported.
|
||||
You should execute this command at the root of the source tree.
|
||||
.Pp
|
||||
If your source directory is on a read only device like CDROM, specify
|
||||
.Ar dbpath
|
||||
of the directory on which make tags files.
|
||||
of the directory on which make tag files.
|
||||
.Pp
|
||||
.Bl -tag -width Ds
|
||||
.It Fl e
|
||||
force a function to end when reach a '}' at the first column in C source file.
|
||||
.It Fl s
|
||||
treat assembler source file (*.s, *.S).
|
||||
.It Fl i
|
||||
update tag files incrementally by files which modified after the tag files were
|
||||
last updated.
|
||||
.It Fl o
|
||||
suppress making GSYMS file.
|
||||
Use this option if you don't use -s option of
|
||||
.Xr global 1 .
|
||||
.It Fl v
|
||||
verbose mode.
|
||||
.Sh FILES
|
||||
.Bl -tag -width tags -compact
|
||||
.It Pa GTAGS
|
||||
tags file for function definitions.
|
||||
tag file for function definitions.
|
||||
.It Pa GRTAGS
|
||||
tags file for function references.
|
||||
tag file for function references.
|
||||
.It Pa GSYMS
|
||||
tag file for other symbols.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Nm Gtags
|
||||
exits with a value of 1 if an error occurred, 0 otherwise.
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr btreeop 1 ,
|
||||
.Xr gctags 1 ,
|
||||
.Xr global 1 ,
|
||||
.Xr htags 1 .
|
||||
.Xr htags 1 ,
|
||||
.Xr vi 1 .
|
||||
.Sh BUG
|
||||
GTAGS, GRTAGS are very large. In advance, check the space of your disk.
|
||||
|
||||
GTAGS, GRTAGS and GSYMS are very large.
|
||||
In advance of using this command, check the space of your disk.
|
||||
.br
|
||||
Assembler support is far from completeness. It extracts only ENTRY()
|
||||
and ALTENTRY() from source file. Probably valid only for FreeBSD and Linux
|
||||
kernel source.
|
||||
.br
|
||||
There is no concurrency control about tag files.
|
||||
.Sh AUTHORS
|
||||
Shigio Yamaguchi ([email protected])
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in FreeBSD 2.2.
|
||||
command appeared in FreeBSD 2.2.2.
|
||||
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Shigio Yamaguchi.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* gtags.c 12-Dec-97
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
char *progname = "gtags"; /* command name */
|
||||
|
||||
static void usage __P((void));
|
||||
void main __P((int, char **));
|
||||
int incremental __P((char *));
|
||||
void tagadd __P((int, char *));
|
||||
void createtags __P((char *, int));
|
||||
char *current __P((void));
|
||||
|
||||
static int iflag;
|
||||
static int oflag;
|
||||
static int vflag;
|
||||
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "usage:\t%s [-i][-o][-v][dbpath]\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char dbpath[MAXPATHLEN+1];
|
||||
char env[MAXENVLEN+1];
|
||||
char *p;
|
||||
int db;
|
||||
|
||||
while (--argc > 0 && (++argv)[0][0] == '-') {
|
||||
for (p = argv[0] + 1; *p; p++) {
|
||||
switch (*p) {
|
||||
case 'i':
|
||||
iflag++;
|
||||
break;
|
||||
case 'o':
|
||||
oflag++;
|
||||
break;
|
||||
case 'v':
|
||||
vflag++;
|
||||
break;
|
||||
/* for compatibility */
|
||||
case 's':
|
||||
case 'e':
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc > 0) {
|
||||
strcpy(dbpath, *argv);
|
||||
} else {
|
||||
if (!getcwd(dbpath, MAXPATHLEN))
|
||||
die("cannot get current directory.");
|
||||
}
|
||||
if (!strcmp(dbpath, "/"))
|
||||
die("It's root directory! What are you doing?");
|
||||
if (!test("d", dbpath))
|
||||
die1("directory '%s' not found.", dbpath);
|
||||
if (vflag)
|
||||
fprintf(stderr, "[%s] Gtags started\n", current());
|
||||
/*
|
||||
* teach gctags(1) where is dbpath.
|
||||
*/
|
||||
sprintf(env, "GTAGSDBPATH=%s", dbpath);
|
||||
putenv(env);
|
||||
/*
|
||||
* incremental update.
|
||||
*/
|
||||
if (iflag && test("f", makepath(dbpath, dbname(GTAGS))) &&
|
||||
test("f", makepath(dbpath, dbname(GRTAGS))))
|
||||
{
|
||||
(void)incremental(dbpath);
|
||||
exit(0);
|
||||
}
|
||||
if (iflag && vflag)
|
||||
fprintf(stderr, " GTAGS and GRTAGS not found. -i option ignored.\n");
|
||||
/*
|
||||
* create GTAGS, GRTAGS and GSYMS
|
||||
*/
|
||||
for (db = GTAGS; db < GTAGLIM; db++) {
|
||||
if (oflag && db == GSYMS)
|
||||
continue;
|
||||
if (vflag)
|
||||
fprintf(stderr, "[%s] Creating '%s'.\n", current(), dbname(db));
|
||||
createtags(dbpath, db);
|
||||
}
|
||||
|
||||
if (vflag)
|
||||
fprintf(stderr, "[%s] Done.\n", current());
|
||||
exit(0);
|
||||
}
|
||||
/*
|
||||
* incremental: incremental update
|
||||
*
|
||||
* i) dbpath dbpath directory
|
||||
* r) 0: not updated, 1: updated
|
||||
*/
|
||||
int
|
||||
incremental(dbpath)
|
||||
char *dbpath;
|
||||
{
|
||||
struct stat sb;
|
||||
time_t gtags_mtime;
|
||||
int updated = 0;
|
||||
char *path;
|
||||
int db;
|
||||
|
||||
if (vflag) {
|
||||
fprintf(stderr, " Tag found in '%s'.\n", dbpath);
|
||||
fprintf(stderr, " Incremental update.\n");
|
||||
}
|
||||
/*
|
||||
* get modified time of GTAGS.
|
||||
*/
|
||||
path = makepath(dbpath, dbname(GTAGS));
|
||||
if (stat(path, &sb) < 0)
|
||||
die1("stat failed '%s'.", path);
|
||||
gtags_mtime = sb.st_mtime;
|
||||
|
||||
for (findopen(); (path = findread(NULL)) != NULL; ) {
|
||||
if (stat(path, &sb) < 0)
|
||||
die1("stat failed '%s'.", path);
|
||||
/*
|
||||
* only the path modified after GTAGS was modified.
|
||||
*/
|
||||
if (gtags_mtime < sb.st_mtime) {
|
||||
updated = 1;
|
||||
if (vflag)
|
||||
fprintf(stderr, " Updating tags of '%s' ...", path + 2);
|
||||
for (db = GTAGS; db < GTAGLIM; db++) {
|
||||
if (db == GSYMS && !test("f", makepath(dbpath, dbname(db))))
|
||||
continue;
|
||||
if (vflag)
|
||||
fprintf(stderr, "%s", dbname(db));
|
||||
tagopen(dbpath, db, 2);
|
||||
/*
|
||||
* GTAGS needed to make GRTAGS.
|
||||
*/
|
||||
if (db == GRTAGS)
|
||||
lookupopen(dbpath);
|
||||
tagdelete(path);
|
||||
if (vflag)
|
||||
fprintf(stderr, "..");
|
||||
tagadd(db, path);
|
||||
if (db == GRTAGS)
|
||||
lookupclose();
|
||||
tagclose();
|
||||
}
|
||||
if (vflag)
|
||||
fprintf(stderr, " Done.\n");
|
||||
}
|
||||
}
|
||||
findclose();
|
||||
if (vflag) {
|
||||
if (updated)
|
||||
fprintf(stderr, " Global databases have been modified.\n");
|
||||
else
|
||||
fprintf(stderr, " Global databases are up to date.\n");
|
||||
fprintf(stderr, "[%s] Done.\n", current());
|
||||
|
||||
fprintf(stderr, " Done.\n");
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
/*
|
||||
* tagadd: add records which has specified path.
|
||||
*
|
||||
* i) db 0: GTAGS, 1: GRTAGS, 2: GSYMS
|
||||
* i) path source file
|
||||
*/
|
||||
void
|
||||
tagadd(db, path)
|
||||
int db;
|
||||
char *path;
|
||||
{
|
||||
char *tagline, *p, *q;
|
||||
char key[IDENTLEN+1];
|
||||
FILE *ip;
|
||||
|
||||
stropen();
|
||||
/*
|
||||
* make command line.
|
||||
*/
|
||||
strputs("gctags -Dex");
|
||||
if (db == GRTAGS)
|
||||
strputs("r");
|
||||
if (db == GSYMS)
|
||||
strputs("sc");
|
||||
strputc(' ');
|
||||
strputs(path);
|
||||
p = strclose();
|
||||
if (!(ip = popen(p, "r")))
|
||||
die1("cannot execute '%s'.", p);
|
||||
while ((tagline = mgets(ip, 0, NULL)) != NULL) {
|
||||
p = tagline;
|
||||
q = key;
|
||||
while (*p && !isspace(*p))
|
||||
*q++ = *p++;
|
||||
*q = 0;
|
||||
tagput(key, tagline);
|
||||
}
|
||||
pclose(ip);
|
||||
}
|
||||
/*
|
||||
* createtags: create tags file
|
||||
*
|
||||
* i) dbpath dbpath directory
|
||||
* i) db GTAGS, GRTAGS, GSYMS
|
||||
*/
|
||||
void
|
||||
createtags(dbpath, db)
|
||||
char *dbpath;
|
||||
int db;
|
||||
{
|
||||
char *path;
|
||||
|
||||
/*
|
||||
* GTAGS needed to make GRTAGS.
|
||||
*/
|
||||
if (db == GRTAGS)
|
||||
lookupopen(dbpath);
|
||||
tagopen(dbpath, db, 1);
|
||||
for (findopen(); (path = findread(NULL)) != NULL; ) {
|
||||
/*
|
||||
* GSYMS doesn't treat asembler.
|
||||
*/
|
||||
if (db == GSYMS) {
|
||||
char *p = path + strlen(path) - 1;
|
||||
if ((*p == 's' || *p == 'S') && *(p - 1) == '.')
|
||||
continue;
|
||||
}
|
||||
if (vflag)
|
||||
fprintf(stderr, " extracting tags of %s.\n", path);
|
||||
tagadd(db, path);
|
||||
}
|
||||
findclose();
|
||||
tagclose();
|
||||
if (db == GRTAGS)
|
||||
lookupclose();
|
||||
}
|
||||
/*
|
||||
* current: current date and time
|
||||
*
|
||||
* r) date and time
|
||||
*/
|
||||
char *
|
||||
current(void)
|
||||
{
|
||||
static char buf[80];
|
||||
time_t tval;
|
||||
|
||||
if (time(&tval) == -1)
|
||||
die("cannot get current time.");
|
||||
(void)strftime(buf, sizeof(buf), "%+", localtime(&tval));
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
MAN1= htags.1
|
||||
|
||||
beforeinstall:
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
|
||||
${.CURDIR}/htags.pl ${DESTDIR}${BINDIR}/htags
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -28,7 +28,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Apr 21, 1997
|
||||
.Dd June 28, 1997
|
||||
.Dt HTAGS 1
|
||||
.Os BSD 4
|
||||
.Sh NAME
|
||||
@@ -37,7 +37,9 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm htags
|
||||
.Op Fl a
|
||||
.Op Fl f
|
||||
.Op Fl l
|
||||
.Op Fl n
|
||||
.Op Fl v
|
||||
.Op Fl w
|
||||
.Op Fl d Ar tagdir
|
||||
@@ -64,10 +66,15 @@ by any browsers.
|
||||
.Bl -tag -width Ds
|
||||
.It Fl a
|
||||
make an alphabetical function index. It's suitable for large project.
|
||||
.It Fl f
|
||||
support input form and dynamic index by CGI program.
|
||||
You need to setup HTTP server for it.
|
||||
.It Fl l
|
||||
make name tag(<A NAME=lno>) for each line so that outer hypertext
|
||||
make name tag(<A NAME=line number>) for each line so that outer hypertext
|
||||
can point any line of this hypertext.
|
||||
By default, make it only for lines which have referred object.
|
||||
.It Fl n
|
||||
print line number. By default, doesn't print it.
|
||||
.It Fl v
|
||||
verbose mode.
|
||||
.It Fl w
|
||||
@@ -75,13 +82,13 @@ print warning message.
|
||||
.It Fl d Ar tagdir
|
||||
the directory in which GTAGS and GRTAGS exist. Default is current directory.
|
||||
.It Fl t Ar title
|
||||
Tile of this hypertext. Default is the last conponent of current path.
|
||||
Tile of this hypertext. Default is the last component of current path.
|
||||
.It Ar dir
|
||||
the directory in which hypertext generated. Default is current directory.
|
||||
.Sh EXAMPLES
|
||||
% cd /usr/src/sys
|
||||
# gtags -se
|
||||
# htags -vat 'Welcom to FreeBSD kernel source tour!'
|
||||
# htags -fnvat 'Welcom to FreeBSD kernel source tour!'
|
||||
% lynx HTML/index.html
|
||||
.Sh FILES
|
||||
.Bl -tag -width tags -compact
|
||||
@@ -101,10 +108,9 @@ If this variable is set, its value is used as the directory to make temporary fi
|
||||
Default is /tmp.
|
||||
.Sh DIAGNOSTICS
|
||||
.Nm Htags
|
||||
exits with a value of 1 if an error occurred, 0 otherwise.
|
||||
exits with a non 0 value if an error occurred, 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr btreeop 1 ,
|
||||
.Xr gctags 1 ,
|
||||
.Xr global 1 ,
|
||||
.Xr gtags 1 .
|
||||
.Sh BUG
|
||||
@@ -114,4 +120,4 @@ Shigio Yamaguchi ([email protected])
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in FreeBSD 2.2.
|
||||
command appeared in FreeBSD 2.2.2.
|
||||
Executable → Regular
+374
-194
@@ -29,11 +29,11 @@
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# htags.pl 21-Apr-97
|
||||
# htags.pl 20-Jan-98
|
||||
#
|
||||
$com = $0;
|
||||
$com =~ s/.*\///;
|
||||
$usage = "usage: $com [-a][-l][-v][-w][-t title][-d tagdir][dir]";
|
||||
$usage = "usage: $com [-a][-f][-l][-n][-v][-w][-t title][-d tagdir][dir]\n";
|
||||
#-------------------------------------------------------------------------
|
||||
# CONFIGURATION
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -64,8 +64,7 @@ $ESCSEP = &escape($SEP);
|
||||
$SRCS = 'S';
|
||||
$DEFS = 'D';
|
||||
$REFS = 'R';
|
||||
$FILES = 'files';
|
||||
$FUNCS = 'funcs';
|
||||
$INCS = 'I';
|
||||
#-------------------------------------------------------------------------
|
||||
# JAVASCRIPT PARTS
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -83,13 +82,11 @@ $defaultview=
|
||||
"if (parent.frames.length)\n" .
|
||||
" document.write($langle+'BASE TARGET=$f_mains'+$rangle)\n";
|
||||
$rewrite_href_funcs =
|
||||
"// IE3.0 seems to be not able to treat following code.\n" .
|
||||
"if (parent.frames.length && parent.$f_funcs == self) {\n" .
|
||||
" document.links[0].href = '../funcs.html';\n" .
|
||||
" document.links[document.links.length - 1].href = '../funcs.html';\n" .
|
||||
"}\n";
|
||||
$rewrite_href_files =
|
||||
"// IE3.0 seems to be not able to treat following code.\n" .
|
||||
"if (parent.frames.length && parent.$f_files == self) {\n" .
|
||||
" document.links[0].href = '../files.html';\n" .
|
||||
" document.links[document.links.length - 1].href = '../files.html';\n" .
|
||||
@@ -97,6 +94,7 @@ $rewrite_href_files =
|
||||
#-------------------------------------------------------------------------
|
||||
# UTIRITIES
|
||||
#-------------------------------------------------------------------------
|
||||
$findcom = "find . \\( -type f -o -type l \\) -name '*.[chysS]' -print";
|
||||
sub getcwd {
|
||||
local($dir) = `/bin/pwd`;
|
||||
chop($dir);
|
||||
@@ -108,9 +106,9 @@ sub date {
|
||||
$date;
|
||||
}
|
||||
sub error {
|
||||
local($msg) = @_;
|
||||
&clean();
|
||||
die($msg);
|
||||
printf STDERR "$com: $_[0]\n";
|
||||
exit 1;
|
||||
}
|
||||
sub clean {
|
||||
&anchor'finish();
|
||||
@@ -122,31 +120,37 @@ sub escape {
|
||||
}
|
||||
sub usable {
|
||||
local($com) = @_;
|
||||
|
||||
foreach $path (split(/:/, $ENV{'PATH'})) {
|
||||
if (-x "$path/$com") {
|
||||
return 1;
|
||||
}
|
||||
foreach (split(/:/, $ENV{'PATH'})) {
|
||||
return 1 if (-x "$_/$com");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
sub copy {
|
||||
local($from, $to) = @_;
|
||||
local($ret) = system("cp $from $to");
|
||||
$ret = $ret / 256;
|
||||
$ret = ($ret == 0) ? 1 : 0;
|
||||
$ret;
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
# PROCESS START
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# options check
|
||||
# options check.
|
||||
#
|
||||
$aflag = $lflag = $vflag = $wflag = $sflag = '';# $sflag is set internally
|
||||
$aflag = $fflag = $lflag = $nflag = $vflag = $wflag = '';
|
||||
while ($ARGV[0] =~ /^-/) {
|
||||
$opt = shift;
|
||||
if ($opt =~ /[^-alvwtd]/) {
|
||||
print STDERR "$usage\n";
|
||||
if ($opt =~ /[^-aflnvwtd]/) {
|
||||
print STDERR $usage;
|
||||
exit 1;
|
||||
}
|
||||
if ($opt =~ /a/) { $aflag = 1; }
|
||||
if ($opt =~ /l/) { $lflag = 1; }
|
||||
if ($opt =~ /v/) { $vflag = 1; }
|
||||
if ($opt =~ /w/) { $wflag = 1; }
|
||||
if ($opt =~ /a/) { $aflag = 'a'; }
|
||||
if ($opt =~ /f/) { $fflag = 'f'; }
|
||||
if ($opt =~ /l/) { $lflag = 'l'; }
|
||||
if ($opt =~ /n/) { $nflag = 'n'; }
|
||||
if ($opt =~ /v/) { $vflag = 'v'; }
|
||||
if ($opt =~ /w/) { $wflag = 'w'; }
|
||||
if ($opt =~ /t/) {
|
||||
$opt = shift;
|
||||
last if ($opt eq '');
|
||||
@@ -161,19 +165,17 @@ if (!$title) {
|
||||
@cwd = split('/', &getcwd);
|
||||
$title = $cwd[$#cwd];
|
||||
}
|
||||
if (!$dbpath) {
|
||||
$dbpath = '.';
|
||||
}
|
||||
$dbpath = &getcwd() if (!$dbpath);
|
||||
unless (-r "$dbpath/GTAGS" && -r "$dbpath/GRTAGS") {
|
||||
&error("GTAGS and GRTAGS not found. please type 'gtags[RET]'\n");
|
||||
&error("GTAGS and GRTAGS not found. please type 'gtags[RET]'");
|
||||
}
|
||||
#
|
||||
# recognize format version
|
||||
# if version record is not found, it's assumed version 1.
|
||||
#
|
||||
$support_version = 1; # understand this format version
|
||||
$support_version = 1; # I can understand this format version
|
||||
#
|
||||
open(GTAGS, "btreeop -K ' __.VERSION' $dbpath/GTAGS |") || die("$com: GTAGS not found.\n");
|
||||
open(GTAGS, "btreeop -K ' __.VERSION' $dbpath/GTAGS |") || &error("GTAGS not found.");
|
||||
$rec = <GTAGS>;
|
||||
close(GTAGS);
|
||||
if ($rec =~ /^ __\.VERSION[ \t]+([0-9]+)$/) {
|
||||
@@ -182,7 +184,7 @@ if ($rec =~ /^ __\.VERSION[ \t]+([0-9]+)$/) {
|
||||
$format_version = 1;
|
||||
}
|
||||
if ($format_version != $support_version) {
|
||||
die("$com: GTAGS format version unmatched. Please remake it.\n");
|
||||
&error("GTAGS format version unmatched. Please remake it.");
|
||||
}
|
||||
#
|
||||
# check directories
|
||||
@@ -191,46 +193,64 @@ $html = &getcwd() . '/HTML';
|
||||
if ($ARGV[0]) {
|
||||
$cwd = &getcwd();
|
||||
unless (-w $ARGV[0]) {
|
||||
&error("$ARGV[0] is not writable directory.\n");
|
||||
&error("'$ARGV[0]' is not writable directory.");
|
||||
}
|
||||
chdir($ARGV[0]) || &error("directory $ARGV[0] not found.\n");
|
||||
chdir($ARGV[0]) || &error("directory '$ARGV[0]' not found.");
|
||||
$html = &getcwd() . '/HTML';
|
||||
chdir($cwd) || &error("cannot return directory.\n");
|
||||
chdir($cwd) || &error("cannot return to original directory.");
|
||||
}
|
||||
#
|
||||
# set sflag if *.[sS] are included.
|
||||
# check if GTAGS, GRTAGS is the latest.
|
||||
#
|
||||
open(CHECK, "btreeop $dbpath/GTAGS |") || &error("btreeop $dbpath/GTAGS failed.\n");
|
||||
while (<CHECK>) {
|
||||
local($tag, $lno, $filename) = split;
|
||||
if ($filename =~ /\.[sS]$/) {
|
||||
$'sflag = 1;
|
||||
last;
|
||||
$gtags_ctime = (stat("$dbpath/GTAGS"))[10];
|
||||
open(FIND, "$findcom |") || &error("cannot exec find.");
|
||||
while (<FIND>) {
|
||||
chop;
|
||||
next if /(y\.tab\.c|y\.tab\.h)$/;
|
||||
next if /(\/SCCS\/|\/RCS\/)/;
|
||||
if ($gtags_ctime < (stat($_))[10]) {
|
||||
&error("GTAGS is not the latest one. Please remake it.");
|
||||
}
|
||||
}
|
||||
close(CHECK);
|
||||
close(FIND);
|
||||
#-------------------------------------------------------------------------
|
||||
# MAKE FILES
|
||||
#-------------------------------------------------------------------------
|
||||
# HTML/cgi-bin/global.cgi ... CGI program (1)
|
||||
# HTML/help.html ... help file (2)
|
||||
# HTML/funcs.html ... function index (3)
|
||||
# HTML/$FUNCS/* ... function index (3)
|
||||
# HTML/$REFS/* ... referencies (4)
|
||||
# HTML/$DEFS/* ... definitions (4)
|
||||
# HTML/$REFS/* ... referencies (3)
|
||||
# HTML/$DEFS/* ... definitions (3)
|
||||
# HTML/funcs.html ... function index (4)
|
||||
# HTML/funcs/* ... function index (4)
|
||||
# HTML/files.html ... file index (5)
|
||||
# HTML/$FILES/* ... file index (5)
|
||||
# HTML/files/* ... file index (5)
|
||||
# HTML/index.html ... index file (6)
|
||||
# HTML/mains.html ... main index (7)
|
||||
# HTML/$SRCS/ ... source files (8)
|
||||
# HTML/$INCS/ ... include file index (9)
|
||||
#-------------------------------------------------------------------------
|
||||
print STDERR "[", &date, "] ", "Htags started\n" if ($vflag);
|
||||
#
|
||||
# (1) make directories
|
||||
# (0) make directories
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(1) making directories ...\n" if ($vflag);
|
||||
mkdir($html, 0777) || &error("cannot make directory <$html>.\n") if (! -d $html);
|
||||
foreach $d ($SRCS, $REFS, $DEFS, $FILES, $FUNCS) {
|
||||
mkdir("$html/$d", 0775) || &error("cannot make HTML directory\n") if (! -d "$html/$d");
|
||||
print STDERR "[", &date, "] ", "(0) making directories ...\n" if ($vflag);
|
||||
mkdir($html, 0777) || &error("cannot make directory '$html'.") if (! -d $html);
|
||||
foreach $d ($SRCS, $INCS, $DEFS, $REFS, files, funcs) {
|
||||
mkdir("$html/$d", 0775) || &error("cannot make HTML directory") if (! -d "$html/$d");
|
||||
}
|
||||
if ($fflag) {
|
||||
mkdir("$html/cgi-bin", 0775) || &error("cannot make cgi-bin directory") if (! -d "$html/cgi-bin");
|
||||
}
|
||||
#
|
||||
# (1) make CGI program
|
||||
#
|
||||
if ($fflag) {
|
||||
print STDERR "[", &date, "] ", "(1) making CGI program ...\n" if ($vflag);
|
||||
&makeprogram("$html/cgi-bin/global.cgi") || &error("cannot make CGI program.");
|
||||
chmod(0755, "$html/cgi-bin/global.cgi") || &error("cannot chmod CGI program.");
|
||||
unlink("$html/cgi-bin/GTAGS", "$html/cgi-bin/GRTAGS");
|
||||
link("$dbpath/GTAGS", "$html/cgi-bin/GTAGS") || ©("$dbpath/GTAGS", "$html/cgi-bin/GTAGS") || &error("cannot copy GTAGS.");
|
||||
link("$dbpath/GRTAGS", "$html/cgi-bin/GRTAGS") || ©("$dbpath/GRTAGS", "$html/cgi-bin/GRTAGS") || &error("cannot copy GRTAGS.");
|
||||
}
|
||||
#
|
||||
# (2) make help file
|
||||
@@ -238,30 +258,30 @@ foreach $d ($SRCS, $REFS, $DEFS, $FILES, $FUNCS) {
|
||||
print STDERR "[", &date, "] ", "(2) making help.html ...\n" if ($vflag);
|
||||
&makehelp("$html/help.html");
|
||||
#
|
||||
# (3) make function index (funcs.html and $FUNCS/*)
|
||||
# PRODUCE @funcs
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(3) making function index ...\n" if ($vflag);
|
||||
$func_total = &makefuncindex("$html/funcs.html");
|
||||
print STDERR "Total $func_total functions.\n" if ($vflag);
|
||||
#
|
||||
# (4) make function entries ($DEFS/* and $REFS/*)
|
||||
# (3) make function entries ($DEFS/* and $REFS/*)
|
||||
# MAKING TAG CACHE
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(4) making duplicate entries ...\n" if ($vflag);
|
||||
print STDERR "[", &date, "] ", "(3) making duplicate entries ...\n" if ($vflag);
|
||||
sub suddenly { &clean(); exit 1}
|
||||
$SIG{'INT'} = 'suddenly';
|
||||
$SIG{'QUIT'} = 'suddenly';
|
||||
$SIG{'TERM'} = 'suddenly';
|
||||
&cache'open(100000);
|
||||
$func_total = &makedupindex($func_total);
|
||||
$func_total = &makedupindex();
|
||||
print STDERR "Total $func_total functions.\n" if ($vflag);
|
||||
#
|
||||
# (5) make file index (files.html and $FILES/*)
|
||||
# PRODUCE @files
|
||||
# (4) make function index (funcs.html and funcs/*)
|
||||
# PRODUCE @funcs
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(4) making function index ...\n" if ($vflag);
|
||||
$func_total = &makefuncindex("$html/funcs.html", $func_total);
|
||||
print STDERR "Total $func_total functions.\n" if ($vflag);
|
||||
#
|
||||
# (5) make file index (files.html and files/*)
|
||||
# PRODUCE @files %includes
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(5) making file index ...\n" if ($vflag);
|
||||
$file_total = &makefileindex("$html/files.html");
|
||||
$file_total = &makefileindex("$html/files.html", "$html/$INCS");
|
||||
print STDERR "Total $file_total files.\n" if ($vflag);
|
||||
#
|
||||
# [#] make a common part for mains.html and index.html
|
||||
@@ -286,7 +306,7 @@ print STDERR "[", &date, "] ", "(#) making temporary database ...\n" if ($vflag)
|
||||
&anchor'create();
|
||||
#
|
||||
# (8) make HTML files ($SRCS/*)
|
||||
# USING TAG CACHE
|
||||
# USING TAG CACHE, %includes and anchor database.
|
||||
#
|
||||
print STDERR "[", &date, "] ", "(8) making hypertext from source code ...\n" if ($vflag);
|
||||
&makehtml($file_total);
|
||||
@@ -297,12 +317,86 @@ exit 0;
|
||||
# SUBROUTINES
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# makeprogram: make CGI program
|
||||
#
|
||||
sub makeprogram {
|
||||
local($file) = @_;
|
||||
|
||||
open(PROGRAM, ">$file") || &error("cannot make CGI program.");
|
||||
$program = <<'END_OF_SCRIPT';
|
||||
#!/usr/bin/perl
|
||||
#------------------------------------------------------------------
|
||||
# SORRY TO HAVE SURPRISED YOU!
|
||||
# IF YOU SEE THIS UNREASONABLE FILE WHILE BROUSING, FORGET PLEASE.
|
||||
# IF YOU ARE A ADMINISTRATOR OF THIS SITE, PLEASE SETUP HTTP SERVER
|
||||
# SO THAT THIS SCRIPT CAN BE EXECUTED AS A CGI COMMAND. THANK YOU.
|
||||
#------------------------------------------------------------------
|
||||
$SRCS = 'S';
|
||||
$SEP = ' '; # source file path must not include $SEP charactor
|
||||
$ESCSEP = &escape($SEP);
|
||||
sub escape {
|
||||
local($c) = @_;
|
||||
'%' . sprintf("%x", ord($c));
|
||||
}
|
||||
print "Content-type: text/html\n\n";
|
||||
print "<HTML>\n";
|
||||
@pairs = split (/&/, $ENV{'QUERY_STRING'});
|
||||
foreach $p (@pairs) {
|
||||
($name, $value) = split(/=/, $p);
|
||||
$value =~ tr/+/ /;
|
||||
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C", hex($1))/eg;
|
||||
$form{$name} = $value;
|
||||
}
|
||||
if ($form{'pattern'} eq '') {
|
||||
print "<H3>Pattern not specified. <A HREF=../mains.html>[return]</A></H3>\n";
|
||||
print "</HTML>\n";
|
||||
exit 0;
|
||||
}
|
||||
$pattern = $form{'pattern'};
|
||||
$flag = ($form{'type'} eq 'definition') ? '' : 'r';
|
||||
$words = ($form{'type'} eq 'definition') ? 'definitions' : 'referencies';
|
||||
print "<H1><FONT COLOR=#cc0000>\"$pattern\"</FONT></H1>\n";
|
||||
print "Following $words are matched to above pattern.<HR>\n";
|
||||
$pattern =~ s/'//g; # to shut security hole
|
||||
unless (open(PIPE, "/usr/bin/global -x$flag '$pattern' |")) {
|
||||
print "<H3>Cannot execute global. <A HREF=../mains.html>[return]</A></H3>\n";
|
||||
print "</HTML>\n";
|
||||
exit 0;
|
||||
}
|
||||
$cnt = 0;
|
||||
print "<PRE>\n";
|
||||
while (<PIPE>) {
|
||||
$cnt++;
|
||||
local($tag, $lno, $filename) = split;
|
||||
$filename =~ s/^\.\///;
|
||||
$filename =~ s/\//$ESCSEP/g;
|
||||
s/($tag)/<A HREF=..\/$SRCS\/$filename.html#$lno>$1<\/A>/;
|
||||
print;
|
||||
}
|
||||
print "</PRE>\n";
|
||||
if ($cnt == 0) {
|
||||
print "<H3>Pattern not found. <A HREF=../mains.html>[return]</A></H3>\n";
|
||||
}
|
||||
print "</HTML>\n";
|
||||
exit 0;
|
||||
#------------------------------------------------------------------
|
||||
# SORRY TO HAVE SURPRISED YOU!
|
||||
# IF YOU SEE THIS UNREASONABLE FILE WHILE BROUSING, FORGET PLEASE.
|
||||
# IF YOU ARE A ADMINISTRATOR OF THIS SITE, PLEASE SETUP HTTP SERVER
|
||||
# SO THAT THIS SCRIPT CAN BE EXECUTED AS A CGI COMMAND. THANK YOU.
|
||||
#------------------------------------------------------------------
|
||||
END_OF_SCRIPT
|
||||
|
||||
print PROGRAM $program;
|
||||
close(PROGRAM);
|
||||
}
|
||||
#
|
||||
# makehelp: make help file
|
||||
#
|
||||
sub makehelp {
|
||||
local($file) = @_;
|
||||
|
||||
open(HELP, ">$file") || &error("cannot make help file.\n");
|
||||
open(HELP, ">$file") || &error("cannot make help file.");
|
||||
print HELP "<HTML>\n<HEAD><TITLE>HELP</TITLE></HEAD>\n<BODY>\n";
|
||||
print HELP "<H2>Usage of Links</H2>\n";
|
||||
print HELP "<PRE>/* [<][>][^][v] [top][bottom][index][help] */</PRE>\n";
|
||||
@@ -320,29 +414,102 @@ sub makehelp {
|
||||
close(HELP);
|
||||
}
|
||||
#
|
||||
# makedupindex: make duplicate entries index ($DEFS/* and $REFS/*)
|
||||
#
|
||||
# go) tag cache
|
||||
# r) $count
|
||||
#
|
||||
sub makeline {
|
||||
$_[0] =~ s/\.\///;
|
||||
$_[0] =~ s/&/&/g;
|
||||
$_[0] =~ s/</</g;
|
||||
$_[0] =~ s/>/>/g;
|
||||
local($tag, $lno, $filename) = split(/[ \t\n]+/, $_[0]);;
|
||||
$filename =~ s/\//$ESCSEP/g;
|
||||
$_[0] =~ s/^$tag/<A HREF=..\/$SRCS\/$filename.html#$lno>$tag<\/A>/;
|
||||
}
|
||||
sub makedupindex {
|
||||
local($count) = 0;
|
||||
|
||||
foreach $db ('GRTAGS', 'GTAGS') {
|
||||
local($kind) = $db eq 'GTAGS' ? "definitions" : "references";
|
||||
local($prev) = '';
|
||||
local($first_line);
|
||||
local($writing) = 0;
|
||||
|
||||
$count = 0;
|
||||
open(LIST, "btreeop $dbpath/$db | sort +0 -1 +2 -3 +1n -2|") || &error("btreeop $dbpath/$db | sort +0 -1 +2 -3 +1n -2 failed.");
|
||||
while (<LIST>) {
|
||||
chop;
|
||||
local($tag, $lno, $filename) = split;
|
||||
if ($prev ne $tag) {
|
||||
$count++;
|
||||
print STDERR " [$count] adding $tag $kind.\n" if ($vflag);
|
||||
if ($writing) {
|
||||
print FILE "</PRE>\n</BODY>\n</HTML>\n";
|
||||
close(FILE);
|
||||
$writing = 0;
|
||||
}
|
||||
# single entry
|
||||
if ($first_line) {
|
||||
&cache'put($db, $prev, $first_line);
|
||||
}
|
||||
$first_line = $_;
|
||||
$prev = $tag;
|
||||
} else {
|
||||
# duplicate entry
|
||||
if ($first_line) {
|
||||
&cache'put($db, $tag, '');
|
||||
local($type) = ($db eq 'GTAGS') ? $DEFS : $REFS;
|
||||
open(FILE, ">$html/$type/$tag.html") || &error("cannot make file '$html/$type/$tag.html'.");
|
||||
$writing = 1;
|
||||
print FILE "<HTML>\n<HEAD><TITLE>$tag</TITLE></HEAD>\n<BODY>\n";
|
||||
print FILE "<PRE>\n";
|
||||
&makeline($first_line);
|
||||
print FILE $first_line, "\n";
|
||||
$first_line = '';
|
||||
}
|
||||
&makeline($_);
|
||||
print FILE $_, "\n";
|
||||
}
|
||||
}
|
||||
close(LIST);
|
||||
if ($writing) {
|
||||
print FILE "</PRE>\n</BODY>\n</HTML>\n";
|
||||
close(FILE);
|
||||
}
|
||||
if ($first_line) {
|
||||
&cache'put($db, $prev, $first_line);
|
||||
}
|
||||
}
|
||||
$count;
|
||||
}
|
||||
#
|
||||
# makefuncindex: make function index (including alphabetic index)
|
||||
#
|
||||
# i) file function index file
|
||||
# i) total functions total
|
||||
# gi) tag cache
|
||||
# go) @funcs
|
||||
#
|
||||
sub makefuncindex {
|
||||
local($file) = @_;
|
||||
local($file, $total) = @_;
|
||||
local($count) = 0;
|
||||
|
||||
open(FUNCTIONS, ">$file") || &error("cannot make function index <$file>.\n");
|
||||
open(FUNCTIONS, ">$file") || &error("cannot make function index '$file'.");
|
||||
print FUNCTIONS "<HTML>\n<HEAD><TITLE>FUNCTION INDEX</TITLE>\n";
|
||||
print FUNCTIONS "$begin_script$defaultview$end_script</HEAD>\n<BODY>\n";
|
||||
print FUNCTIONS "<H2>FUNCTION INDEX</H2>\n";
|
||||
print FUNCTIONS "<OL>\n" if (!$aflag);
|
||||
local($old) = select(FUNCTIONS);
|
||||
open(TAGS, "btreeop $dbpath/GTAGS | awk '{print \$1}' | sort | uniq |") || &error("btreeop $dbpath/GTAGS failed.\n");
|
||||
open(TAGS, "btreeop -L $dbpath/GTAGS |") || &error("btreeop -L $dbpath/GTAGS failed.");
|
||||
local($alpha) = '';
|
||||
@funcs = (); # [A][B][C]...
|
||||
while (<TAGS>) {
|
||||
$count++;
|
||||
chop;
|
||||
local($tag) = $_;
|
||||
print STDERR " [$count] adding $tag\n" if ($vflag);
|
||||
print STDERR " [$count/$total] adding $tag\n" if ($vflag);
|
||||
if ($aflag && $alpha ne substr($tag, 0, 1)) {
|
||||
if ($alpha) {
|
||||
print ALPHA "</OL>\n";
|
||||
@@ -352,8 +519,8 @@ sub makefuncindex {
|
||||
close(ALPHA);
|
||||
}
|
||||
$alpha = substr($tag, 0, 1);
|
||||
push(@funcs, "<A HREF=$FUNCS/$alpha.html TARGET=_self>[$alpha]</A>\n");
|
||||
open(ALPHA, ">$html/$FUNCS/$alpha.html") || &error("cannot make alphabetical function index.\n");
|
||||
push(@funcs, "<A HREF=funcs/$alpha.html TARGET=_self>[$alpha]</A>\n");
|
||||
open(ALPHA, ">$html/funcs/$alpha.html") || &error("cannot make alphabetical function index.");
|
||||
print ALPHA "<HTML>\n<HEAD><TITLE>$alpha</TITLE>\n";
|
||||
print ALPHA "$begin_script$defaultview$end_script";
|
||||
print ALPHA "</HEAD>\n<BODY>\n<H2>[$alpha]</H2>\n";
|
||||
@@ -361,22 +528,15 @@ sub makefuncindex {
|
||||
print ALPHA "<OL>\n";
|
||||
select(ALPHA);
|
||||
}
|
||||
open(LIST, "btreeop -K $tag $dbpath/GTAGS |") || &error("btreeop -K $tag $dbpath/GTAGS failed.\n");;
|
||||
local($line1, $line2);
|
||||
if ($line1 = <LIST>) {
|
||||
$line2 = <LIST>;
|
||||
}
|
||||
close(LIST);
|
||||
if ($line2) {
|
||||
print "<LI><A HREF=", ($aflag) ? "../" : "", "D/$tag.html>$tag</A>\n";
|
||||
local($line) = &cache'get('GTAGS', $tag);
|
||||
if (!$line) {
|
||||
print "<LI><A HREF=", ($aflag) ? "../" : "", "$DEFS/$tag.html>$tag</A>\n";
|
||||
} else {
|
||||
local($nouse, $lno, $filename) = split(/[ \t]+/, $line1);
|
||||
$nouse = ''; # to make perl quiet
|
||||
local($tag, $lno, $filename) = split(/[ \t]+/, $line);
|
||||
$filename =~ s/^\.\///;
|
||||
$filename =~ s/\//$ESCSEP/g;
|
||||
print "<LI><A HREF=", ($aflag) ? "../" : "", "$SRCS/$filename.html#$lno>$tag</A>\n";
|
||||
}
|
||||
close(LIST);
|
||||
}
|
||||
close(TAGS);
|
||||
select($old);
|
||||
@@ -395,87 +555,33 @@ sub makefuncindex {
|
||||
$count;
|
||||
}
|
||||
#
|
||||
# makedupindex: make duplicate entries index ($DEFS/* and $REFS/*)
|
||||
#
|
||||
# i) $total functions total
|
||||
# r) $count
|
||||
#
|
||||
sub makedupindex {
|
||||
local($total) = @_;
|
||||
local($count) = 0;
|
||||
|
||||
open(TAGS, "btreeop $dbpath/GTAGS | awk '{print \$1}' | sort | uniq |") || &error("btreeop $dbpath/GTAGS failed.\n");
|
||||
while (<TAGS>) {
|
||||
$count++;
|
||||
chop;
|
||||
local($tag) = $_;
|
||||
print STDERR " [$count/$total] adding $tag\n" if ($vflag);
|
||||
foreach $db ('GTAGS', 'GRTAGS') {
|
||||
open(LIST, "btreeop -K $tag $dbpath/$db | sort +0b -1 +2b -3 +1n -2|") || &error("btreeop -K $tag $dbpath/$db failed.\n");;
|
||||
local($line1, $line2);
|
||||
if ($line1 = <LIST>) {
|
||||
$line2 = <LIST>;
|
||||
}
|
||||
&cache'put($db, $tag, ($line2) ? '' : $line1) if ($line1);
|
||||
if ($line2) { # two or more entries exist
|
||||
local($type) = ($db eq 'GTAGS') ? $'DEFS : $'REFS;
|
||||
open(FILE, ">$html/$type/$tag.html") || &error("cannot make file <$html/$type/$tag.html>.\n");
|
||||
print FILE "<HTML>\n<HEAD><TITLE>$tag</TITLE></HEAD>\n<BODY>\n";
|
||||
print FILE "<PRE>\n";
|
||||
for (;;) {
|
||||
if ($line1) {
|
||||
$_ = $line1;
|
||||
$line1 = '';
|
||||
} elsif ($line2) {
|
||||
$_ = $line2;
|
||||
$line2 = '';
|
||||
} elsif (!($_ = <LIST>)) {
|
||||
last;
|
||||
}
|
||||
s/\.\///;
|
||||
s/&/&/g;
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
local($nouse, $lno, $filename) = split;
|
||||
$nouse = ''; # to make perl quiet
|
||||
$filename =~ s/\//$ESCSEP/g;
|
||||
s/^$tag/<A HREF=..\/$SRCS\/$filename.html#$lno>$tag<\/A>/;
|
||||
print FILE;
|
||||
}
|
||||
print FILE "</PRE>\n</BODY>\n</HTML>\n";
|
||||
close(FILE);
|
||||
}
|
||||
close(LIST);
|
||||
}
|
||||
}
|
||||
close(TAGS);
|
||||
$count;
|
||||
}
|
||||
#
|
||||
# makefileindex: make file index
|
||||
#
|
||||
# i) file name
|
||||
# i) $INC directory
|
||||
# go) @files
|
||||
# go) %includes
|
||||
#
|
||||
sub makefileindex {
|
||||
local($file) = @_;
|
||||
local($file, $incdir) = @_;
|
||||
local($count) = 0;
|
||||
|
||||
open(FILES, ">$file") || &error("cannot make file <$file>.\n");
|
||||
open(FILES, ">$file") || &error("cannot make file '$file'.");
|
||||
print FILES "<HTML>\n<HEAD><TITLE>FILES</TITLE>\n";
|
||||
print FILES "$begin_script$defaultview$end_script";
|
||||
print FILES "</HEAD>\n<BODY>\n<H2>FILE INDEX</H2>\n";
|
||||
print FILES "<OL>\n";
|
||||
local($old) = select(FILES);
|
||||
open(FIND, "find . -name '*.[chysS]' -print | sort |") || &error("cannot exec find.\n");
|
||||
open(FIND, "$findcom | sort |") || &error("cannot exec find.");
|
||||
local($lastdir) = '';
|
||||
@files = ();
|
||||
while (<FIND>) {
|
||||
next if /(y\.tab\.c|y\.tab\.h)$/;
|
||||
next if /(\/SCCS\/|\/RCS\/)/;
|
||||
|
||||
$count++;
|
||||
chop;
|
||||
s/^\.\///;
|
||||
next if /(y\.tab\.c|y\.tab\.h)$/;
|
||||
next if (!$'sflag && /\.[sS]$/);
|
||||
local($filename) = $_;
|
||||
print STDERR " [$count] adding $filename\n" if ($vflag);
|
||||
local($dir);
|
||||
@@ -495,8 +601,8 @@ sub makefileindex {
|
||||
close(DIR);
|
||||
}
|
||||
if ($dir) {
|
||||
push(@files, "<LI><A HREF=$FILES/$dir.html TARGET=_self>$dir/</A>\n");
|
||||
open(DIR, ">$html/$FILES/$dir.html") || &error("cannot make directory index.\n");
|
||||
push(@files, "<LI><A HREF=files/$dir.html TARGET=_self>$dir/</A>\n");
|
||||
open(DIR, ">$html/files/$dir.html") || &error("cannot make directory index.");
|
||||
print DIR "<HTML>\n<HEAD><TITLE>$dir/</TITLE>\n";
|
||||
print DIR "$begin_script$defaultview$end_script";
|
||||
print DIR "</HEAD>\n<BODY>\n<H2>$dir/</H2>\n";
|
||||
@@ -505,10 +611,21 @@ sub makefileindex {
|
||||
}
|
||||
$lastdir = $dir;
|
||||
}
|
||||
# collect include files.
|
||||
if ($filename =~ /.*\.h$/) {
|
||||
local($last) = $filename;
|
||||
$last =~ s!.*/!!;
|
||||
if (! defined $includes{$last}) {
|
||||
$includes{$last} = $filename;
|
||||
} else {
|
||||
# duplicate entries
|
||||
$includes{$last} = "$includes{$last}\n$filename";
|
||||
}
|
||||
}
|
||||
local($path) = $filename;
|
||||
$path =~ s/\//$ESCSEP/g;
|
||||
if ($dir eq '') {
|
||||
push(@files, "<LI><A HREF=", ($dir) ? "../" : "", "$SRCS/$path.html>$filename</A>\n");
|
||||
push(@files, "<LI><A HREF=$SRCS/$path.html>$filename</A>\n");
|
||||
} else {
|
||||
print DIR "<LI><A HREF=../$SRCS/$path.html>$filename</A>\n";
|
||||
}
|
||||
@@ -527,6 +644,22 @@ sub makefileindex {
|
||||
print FILES "</BODY>\n</HTML>\n";
|
||||
close(FILES);
|
||||
|
||||
foreach $last (keys %includes) {
|
||||
local(@incs) = split(/\n/, $includes{$last});
|
||||
if (@incs > 1) {
|
||||
open(INCLUDE, ">$incdir/$last.html") || &error("cannot open file '$incdir/$last.html'.");
|
||||
print INCLUDE "<HTML>\n<HEAD><TITLE>$last</TITLE></HEAD>\n<BODY>\n<PRE>\n";
|
||||
foreach $filename (@incs) {
|
||||
local($path) = $filename;
|
||||
$path =~ s/\//$ESCSEP/g;
|
||||
print INCLUDE "<A HREF=../$SRCS/$path.html>$filename</A>\n";
|
||||
}
|
||||
print INCLUDE "</PRE>\n</BODY>\n</HTML>\n";
|
||||
close(INCLUDE);
|
||||
# '' means that information already written to file.
|
||||
$includes{$last} = '';
|
||||
}
|
||||
}
|
||||
$count;
|
||||
}
|
||||
#
|
||||
@@ -548,9 +681,20 @@ sub makecommonpart {
|
||||
$index .= " document.write($langle+'A HREF=mains.html TARGET=_top'+$rangle+'[No frame version is here.]'+$langle+'/A'+$rangle)\n";
|
||||
$index .= "$end_script";
|
||||
$index .= "</P>\n<HR>\n";
|
||||
if ($fflag) {
|
||||
$index .= "<H2>FUNCTION SEARCH</H2>\n";
|
||||
$index .= "Please input function name and select [Search]. Perl's regular expression is allowed.<P>\n";
|
||||
$index .= "<FORM METHOD=GET ACTION=cgi-bin/global.cgi>\n";
|
||||
$index .= "<INPUT NAME=pattern>\n";
|
||||
$index .= "<INPUT TYPE=submit VALUE=Search>\n";
|
||||
$index .= "<INPUT TYPE=reset VALUE=Reset><BR>\n";
|
||||
$index .= "<INPUT TYPE=radio NAME=type VALUE=definition CHECKED>Definition\n";
|
||||
$index .= "<INPUT TYPE=radio NAME=type VALUE=reference>Reference\n";
|
||||
$index .= "</FORM>\n<HR>\n";
|
||||
}
|
||||
$index .= "<H2>MAINS</H2>\n";
|
||||
$index .= "<PRE>\n";
|
||||
open(PIPE, "btreeop -K main $dbpath/GTAGS | sort +0b -1 +2b -3 +1n -2 |") || &error("btreeop -K main $dbpath/GTAGS failed.\n");
|
||||
open(PIPE, "btreeop -K main $dbpath/GTAGS | sort +0 -1 +2 -3 +1n -2|") || &error("btreeop -K main $dbpath/GTAGS failed.");
|
||||
while (<PIPE>) {
|
||||
local($nouse, $lno, $filename) = split;
|
||||
$nouse = ''; # to make perl quiet
|
||||
@@ -586,7 +730,7 @@ sub makecommonpart {
|
||||
sub makeindex {
|
||||
local($file, $title, $index) = @_;
|
||||
|
||||
open(FRAME, ">$file") || &error("cannot open file <$file>.\n");
|
||||
open(FRAME, ">$file") || &error("cannot open file '$file'.");
|
||||
print FRAME "<HTML>\n<HEAD><TITLE>$title</TITLE></HEAD>\n";
|
||||
print FRAME "<FRAMESET COLS='200,*'>\n";
|
||||
print FRAME "<NOFRAME>\n$index</NOFRAME>\n";
|
||||
@@ -608,7 +752,7 @@ sub makeindex {
|
||||
sub makemainindex {
|
||||
local($file, $index) = @_;
|
||||
|
||||
open(INDEX, ">$file") || &error("cannot create file <$file>.\n");
|
||||
open(INDEX, ">$file") || &error("cannot create file '$file'.");
|
||||
print INDEX "<HTML>\n<HEAD><TITLE>MAINS</TITLE></HEAD>\n";
|
||||
print INDEX "<BODY>\n$index</BODY>\n</HTML>\n";
|
||||
close(INDEX);
|
||||
@@ -616,20 +760,23 @@ sub makemainindex {
|
||||
#
|
||||
# makehtml: make html files
|
||||
#
|
||||
# i) total number of files.
|
||||
#
|
||||
sub makehtml {
|
||||
local($total) = @_;
|
||||
local($count) = 0;
|
||||
|
||||
open(FIND, "find . -name '*.[chysS]' -print|") || &error("cannot exec find.\n");
|
||||
open(FIND, "$findcom |") || &error("cannot exec find.");
|
||||
while (<FIND>) {
|
||||
next if /y\.tab\.c|y\.tab\.h/;
|
||||
next if /(\/SCCS\/|\/RCS\/)/;
|
||||
|
||||
$count++;
|
||||
chop;
|
||||
s/^\.\///;
|
||||
next if /y\.tab\.c|y\.tab\.h/;
|
||||
next if (!$'sflag && /\.[sS]$/);
|
||||
local($path) = $_;
|
||||
$path =~ s/^\.\///;
|
||||
print STDERR " [$count/$total] converting $path\n" if ($vflag);
|
||||
$path =~ s/\//$SEP/g;
|
||||
print STDERR " [$count/$total] converting $_\n" if ($vflag);
|
||||
&convert'src2html($_, "$html/$SRCS/$path.html");
|
||||
}
|
||||
close(FIND);
|
||||
@@ -643,23 +790,26 @@ package convert;
|
||||
#
|
||||
# i) $file source file - Read from
|
||||
# i) $html HTML file - Write to
|
||||
# gi) %includes
|
||||
# pairs of include file and the path
|
||||
#
|
||||
sub src2html {
|
||||
local($file, $html) = @_;
|
||||
local($ncol) = $'ncol;
|
||||
local($expand) = &'usable('expand') ? 'expand' : 'cat';
|
||||
local(%ctab) = ('&', '&', '<', '<', '>', '>');
|
||||
|
||||
open(HTML, ">$html") || &'error("cannot create file <$html>.\n");
|
||||
open(HTML, ">$html") || &'error("cannot create file '$html'.");
|
||||
local($old) = select(HTML);
|
||||
#
|
||||
# load tags belonging to this file.
|
||||
#
|
||||
$file =~ s/^\.\///;
|
||||
&anchor'load($file);
|
||||
open(C, "$expand '$file' |") || &'error("cannot open file <$file>.\n");
|
||||
open(C, "$expand '$file' |") || &'error("cannot open file '$file'.");
|
||||
#
|
||||
# print the header
|
||||
#
|
||||
$file =~ s/^\.\///;
|
||||
print "<HTML>\n<HEAD><TITLE>$file</TITLE></HEAD>\n";
|
||||
print "<BODY><A NAME=TOP><H2>$file</H2>\n";
|
||||
print &link_format(&anchor'getlinks(0));
|
||||
@@ -680,14 +830,33 @@ sub src2html {
|
||||
$INCOMMENT = 0; # initial status is out of comment
|
||||
local($LNO, $TAG, $TYPE) = &anchor'first();
|
||||
while (<C>) {
|
||||
local($converted);
|
||||
s/\r$//;
|
||||
s/&/&/g; # '<', '>' and '&' are used for HTML tag
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
# make link for include file
|
||||
if (!$INCOMMENT && /^#include/) {
|
||||
local($last, $sep) = m([">])!;
|
||||
local($link);
|
||||
if (defined $'includes{$last}) {
|
||||
if ($'includes{$last}) {
|
||||
$link = $'includes{$last};
|
||||
$link =~ s/\//$'ESCSEP/g;
|
||||
} else {
|
||||
$link = "../$'INCS/$last";
|
||||
}
|
||||
if ($sep eq '"') {
|
||||
s!"(.*$last)"!"<A HREF=$link.html>$1</A>"!;
|
||||
} else {
|
||||
s!<(.*$last)>!<<A HREF=$link.html>$1</A>>!;
|
||||
}
|
||||
$converted = 1;
|
||||
}
|
||||
}
|
||||
# translate '<', '>' and '&' into entity name
|
||||
if (!$converted) { s/([&<>])/$ctab{$1}/ge; }
|
||||
&protect_line(); # protect quoted char, strings and comments
|
||||
# painting source code
|
||||
s/({|})/$'brace_begin$1$'brace_end/g;
|
||||
$sharp = s/^(#\w+)// ? $1 : ''; # protect macro
|
||||
local($sharp) = s/^(#\w+)// ? $1 : '';
|
||||
s/\b($'reserved_words)\b/$'reserved_begin$1$'reserved_end/go if ($sharp ne '#include');
|
||||
s/^/$'sharp_begin$sharp$'sharp_end/ if ($sharp); # recover macro
|
||||
|
||||
@@ -709,7 +878,7 @@ sub src2html {
|
||||
$db = ($TYPE eq 'D') ? 'GRTAGS' : 'GTAGS';
|
||||
local($line) = &cache'get($db, $TAG);
|
||||
if (defined($line)) {
|
||||
local($href, $dir);
|
||||
local($href);
|
||||
if ($line) {
|
||||
local($nouse, $lno, $filename) = split(/[ \t]+/, $line);
|
||||
$nouse = ''; # to make perl quiet
|
||||
@@ -717,11 +886,11 @@ sub src2html {
|
||||
$filename =~ s/\//$'ESCSEP/g;
|
||||
$href = "<A HREF=../$'SRCS/$filename.html#$lno>$TAG</A>";
|
||||
} else {
|
||||
$dir = ($TYPE eq 'D') ? $'REFS : $'DEFS;
|
||||
local($dir) = ($TYPE eq 'D') ? $'REFS : $'DEFS;
|
||||
$href = "<A HREF=../$dir/$TAG.html>$TAG</A>";
|
||||
}
|
||||
# set tag marks and push hyperlink into @links
|
||||
if (s/\b$TAG\b/\005$count\005/) {
|
||||
# set tag marks and save hyperlink into @links
|
||||
if (s/\b$TAG\b/\005$count\005/ || s/\b_$TAG\b/_\005$count\005/) {
|
||||
$count++;
|
||||
push(@links, $href);
|
||||
} else {
|
||||
@@ -741,11 +910,11 @@ sub src2html {
|
||||
}
|
||||
&unprotect_line();
|
||||
# print a line
|
||||
printf "%${ncol}d ", $.;
|
||||
printf "%${ncol}d ", $. if ($'nflag);
|
||||
print;
|
||||
# print hyperlinks
|
||||
if ($define_line && $file !~ /\.h$/) {
|
||||
print ' ' x ($ncol + 1);
|
||||
print ' ' x ($ncol + 1) if ($'nflag);
|
||||
print &link_format(&anchor'getlinks($define_line));
|
||||
print "\n";
|
||||
}
|
||||
@@ -774,37 +943,31 @@ sub src2html {
|
||||
#
|
||||
sub protect_line {
|
||||
@quoted_char1 = ();
|
||||
while (/(\\.)/) {
|
||||
while (s/(\\.)/\001/) {
|
||||
push(@quoted_char1, $1);
|
||||
s/\\./\001/;
|
||||
}
|
||||
@quoted_char2 = ();
|
||||
while (/('[^']')/) {
|
||||
while (s/('[^']')/\002/) {
|
||||
push(@quoted_char2, $1);
|
||||
s/'[^']'/\002/;
|
||||
}
|
||||
@quoted_strings = ();
|
||||
while (/("[^"]*")/) {
|
||||
while (s/("[^"]*")/\003/) {
|
||||
push(@quoted_strings, $1);
|
||||
s/"[^"]*"/\003/;
|
||||
}
|
||||
@comments = ();
|
||||
s/^/\032/ if ($INCOMMENT);
|
||||
while (1) {
|
||||
if ($INCOMMENT == 0) {
|
||||
if (/\/\*/) { # start comment
|
||||
s/\/\*/\032\/\*/;
|
||||
if (s/\/\*/\032\/\*/) { # start comment
|
||||
$INCOMMENT = 1;
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
} else {
|
||||
# Thanks to Jeffrey Friedl for his code.
|
||||
if (m!\032(/\*)?[^*]*\*+([^/*][^*]*\*+)*/!) {
|
||||
$INCOMMENT = 0;
|
||||
# minimum matching
|
||||
s!\032((/\*)?[^*]*\*+([^/*][^*]*\*+)*/)!\004!;
|
||||
if (s!\032((/\*)?[^*]*\*+([^/*][^*]*\*+)*/)!\004!) {
|
||||
push(@comments, $1);
|
||||
$INCOMMENT = 0;
|
||||
} else {
|
||||
s/\032(.*)$/\004/; # mark comment
|
||||
push(@comments, $1);
|
||||
@@ -868,15 +1031,26 @@ package anchor;
|
||||
#
|
||||
# create: create anchors temporary database
|
||||
#
|
||||
# go) %PATHLIST
|
||||
#
|
||||
sub create {
|
||||
$ANCH = "$'tmp/ANCH$$";
|
||||
open(ANCH, "| btreeop -C $ANCH") || &'error("btreeop -C $ANCH failed.\n");
|
||||
open(ANCH, ">$ANCH") || &'error("cannot create file '$ANCH'.");
|
||||
close(ANCH);
|
||||
chmod ($ANCH, 0600);
|
||||
open(ANCH, "| btreeop -C $ANCH") || &'error("btreeop -C $ANCH failed.");
|
||||
local($fcount) = 1;
|
||||
local($fnumber);
|
||||
foreach $db ('GTAGS', 'GRTAGS') {
|
||||
local($type) = ($db eq 'GTAGS') ? 'D' : 'R';
|
||||
open(PIPE, "btreeop $'dbpath/$db |") || &'error("btreeop $'dbpath/$db failed.\n");
|
||||
open(PIPE, "btreeop $'dbpath/$db |") || &'error("btreeop $'dbpath/$db failed.");
|
||||
while (<PIPE>) {
|
||||
local($tag, $lno, $filename) = split;
|
||||
print ANCH "$filename $lno $tag $type\n";
|
||||
$fnumber = $PATHLIST{$filename};
|
||||
if (!$fnumber) {
|
||||
$PATHLIST{$filename} = $fnumber = $fcount++;
|
||||
}
|
||||
print ANCH "$fnumber $lno $tag $type\n";
|
||||
}
|
||||
close(PIPE);
|
||||
}
|
||||
@@ -892,28 +1066,34 @@ sub finish {
|
||||
# load: load anchors in a file from database
|
||||
#
|
||||
# i) $file source file
|
||||
# gi) %PATHLIST
|
||||
# go) FIRST first definition
|
||||
# go) LAST last definition
|
||||
#
|
||||
sub load {
|
||||
local($file) = @_;
|
||||
|
||||
$file = './' . $file if ($file !~ /^\.\//);
|
||||
local($fnumber);
|
||||
|
||||
@ANCHORS = ();
|
||||
open(ANCH, "btreeop -K $file $ANCH|") || &'error("btreeop -K $file $ANCH failed.\n");
|
||||
$FIRST = $LAST = 0;
|
||||
|
||||
$file = './' . $file if ($file !~ /^\.\//);
|
||||
if (!($fnumber = $PATHLIST{$file})) {
|
||||
return;
|
||||
}
|
||||
open(ANCH, "btreeop -K $fnumber $ANCH |") || &'error("btreeop -K $file $ANCH failed.");
|
||||
$n = 0;
|
||||
while (<ANCH>) {
|
||||
local($filename, $lno, $tag, $type) = split;
|
||||
local($fnumber, $lno, $tag, $type) = split;
|
||||
local($line);
|
||||
# START for DTFLAG
|
||||
# don't refer to macros which is defined in other C source.
|
||||
if ($type eq 'R' && ($line = &cache'get('GTAGS', $tag))) {
|
||||
local($nouse1, $nouse2, $f, $def) = split(/[ \t]+/, $line);
|
||||
if ($f !~ /\.h$/ && $f !~ $filename && $def =~ /^#/) {
|
||||
print STDERR "Information: $filename $lno $tag($type) skipped, because this is a macro which is defined in other C source.\n" if ($'wflag);
|
||||
if ($f !~ /\.h$/ && $f !~ $file && $def =~ /^#/) {
|
||||
print STDERR "Information: $file $lno $tag($type) skipped, because this is a macro which is defined in other C source.\n" if ($'wflag);
|
||||
next;
|
||||
}
|
||||
}
|
||||
# END for DTFLAG
|
||||
push(@ANCHORS, "$lno,$tag,$type");
|
||||
}
|
||||
close(ANCH);
|
||||
@@ -1008,11 +1188,11 @@ sub getlinks {
|
||||
}
|
||||
}
|
||||
}
|
||||
$first = $FIRST if ($linenumber != $FIRST);
|
||||
$last = $LAST if ($linenumber != $LAST);
|
||||
$first = $FIRST if ($FIRST > 0 && $linenumber != $FIRST);
|
||||
$last = $LAST if ($LAST > 0 && $linenumber != $LAST);
|
||||
$top = 'TOP' if ($linenumber != 0);
|
||||
$bottom = 'BOTTOM' if ($linenumber != -1);
|
||||
if ($FIRST == $LAST) {
|
||||
if ($FIRST > 0 && $FIRST == $LAST) {
|
||||
$last = '' if ($linenumber == 0);
|
||||
$first = '' if ($linenumber == -1);
|
||||
}
|
||||
@@ -1055,7 +1235,7 @@ sub put {
|
||||
$cachecount++;
|
||||
if ($cachesize >= 0 && $cachecount > $cachesize) {
|
||||
$CACH = "$'tmp/CACH$$";
|
||||
dbmopen(%CACH, $CACH, 0600) || &'error("make cache database.\n");
|
||||
dbmopen(%CACH, $CACH, 0600) || &'error("make cache database.");
|
||||
$cachesize = -1;
|
||||
}
|
||||
$CACH{$label.$tag} = $line;
|
||||
@@ -0,0 +1,8 @@
|
||||
LIB= util
|
||||
SRCS= tag.o tab.o strop.o mgets.o lookup.o gtagsopen.o getdbpath.o \
|
||||
find.o dbname.o dbio.o test.o makepath.o locatestring.o
|
||||
NOPROFILE= yes
|
||||
install:
|
||||
@echo -n
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved.
|
||||
*
|
||||
* Redilogibution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redilogibutions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redilogibutions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the dilogibution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Shigio Yamaguchi.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* dbio.c 14-Dec-97
|
||||
*
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dbio.h"
|
||||
#include "die.h"
|
||||
#include "test.h"
|
||||
|
||||
DBT key; /* key of record */
|
||||
DBT dat; /* data of record */
|
||||
/*
|
||||
* db_open: open db database.
|
||||
*
|
||||
* i) dbname database name
|
||||
* i) mode 0: read only, 1: write only, 2: read & write
|
||||
* i) perm file permission
|
||||
* i) flags
|
||||
* DBIO_DUP: allow duplicate records.
|
||||
* DBIO_REMOVE: remove on closed.
|
||||
* r) descripter for db_xxx()
|
||||
*
|
||||
* db_open leaves database permission 0600. please chmod(2) to make public.
|
||||
*/
|
||||
DBIO *
|
||||
db_open(dbname, mode, perm, flags)
|
||||
char *dbname;
|
||||
int mode;
|
||||
int perm;
|
||||
int flags;
|
||||
{
|
||||
DB *db;
|
||||
int rw;
|
||||
BTREEINFO info;
|
||||
DBIO *dbio;
|
||||
|
||||
/*
|
||||
* setup argments.
|
||||
*/
|
||||
if (mode == 0)
|
||||
rw = O_RDONLY;
|
||||
else if (mode == 1)
|
||||
rw = O_RDWR|O_CREAT|O_TRUNC;
|
||||
else if (mode == 2)
|
||||
rw = O_RDWR;
|
||||
else
|
||||
die("db_open illegal mode.");
|
||||
info.flags = (flags & DBIO_DUP) ? R_DUP : 0;
|
||||
info.cachesize = 500000;
|
||||
info.maxkeypage = 0;
|
||||
info.minkeypage = 0;
|
||||
info.psize = 0;
|
||||
info.compare = NULL;
|
||||
info.prefix = NULL;
|
||||
info.lorder = LITTLE_ENDIAN;
|
||||
|
||||
/*
|
||||
* if unlink do job normally, those who already open tag file can use
|
||||
* it until closing.
|
||||
*/
|
||||
if (mode == 1 && test("f", dbname))
|
||||
(void)unlink(dbname);
|
||||
db = dbopen(dbname, rw, 0600, DB_BTREE, &info);
|
||||
if (!db)
|
||||
die1("db_open failed (dbname = %s).", dbname);
|
||||
if (!(dbio = (DBIO *)malloc(sizeof(DBIO))))
|
||||
die("short of memory.");
|
||||
strcpy(dbio->dbname, dbname);
|
||||
dbio->db = db;
|
||||
dbio->openflags = flags;
|
||||
dbio->perm = (mode == 1) ? perm : 0;
|
||||
dbio->lastkey = (char *)0;
|
||||
dbio->lastdat = (char *)0;
|
||||
|
||||
return dbio;
|
||||
}
|
||||
/*
|
||||
* db_get: get data by a key.
|
||||
*
|
||||
* i) dbio descripter
|
||||
* i) k key
|
||||
* r) pointer to data
|
||||
*/
|
||||
char *
|
||||
db_get(dbio, k)
|
||||
DBIO *dbio;
|
||||
char *k;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
int status;
|
||||
|
||||
key.data = k;
|
||||
key.size = strlen(k)+1;
|
||||
|
||||
status = (*db->get)(db, &key, &dat, 0);
|
||||
dbio->lastkey = (char *)key.data;
|
||||
dbio->lastdat = (char *)dat.data;
|
||||
switch (status) {
|
||||
case RET_SUCCESS:
|
||||
break;
|
||||
case RET_ERROR:
|
||||
die("db_get failed.");
|
||||
case RET_SPECIAL:
|
||||
return((char *)0);
|
||||
}
|
||||
return((char *)dat.data);
|
||||
}
|
||||
/*
|
||||
* db_put: put data by a key.
|
||||
*
|
||||
* i) dbio descripter
|
||||
* i) k key
|
||||
* i) d data
|
||||
*/
|
||||
void
|
||||
db_put(dbio, k, d)
|
||||
DBIO *dbio;
|
||||
char *k;
|
||||
char *d;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
int status;
|
||||
|
||||
if (strlen(k) > MAXKEYLEN)
|
||||
die("primary key too long.");
|
||||
key.data = k;
|
||||
key.size = strlen(k)+1;
|
||||
dat.data = d;
|
||||
dat.size = strlen(d)+1;
|
||||
|
||||
status = (*db->put)(db, &key, &dat, 0);
|
||||
switch (status) {
|
||||
case RET_SUCCESS:
|
||||
break;
|
||||
case RET_ERROR:
|
||||
case RET_SPECIAL:
|
||||
die("db_put failed.");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* db_del: delete record by a key.
|
||||
*
|
||||
* i) dbio descripter
|
||||
* i) k key
|
||||
*/
|
||||
void
|
||||
db_del(dbio, k)
|
||||
DBIO *dbio;
|
||||
char *k;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
int status;
|
||||
|
||||
if (k) {
|
||||
key.data = k;
|
||||
key.size = strlen(k)+1;
|
||||
status = (*db->del)(db, &key, 0);
|
||||
} else
|
||||
status = (*db->del)(db, &key, R_CURSOR);
|
||||
if (status == RET_ERROR)
|
||||
die("db_del failed.");
|
||||
}
|
||||
/*
|
||||
* db_first: get first record.
|
||||
*
|
||||
* i) dbio dbio descripter
|
||||
* i) k key
|
||||
* !=NULL: indexed read by key
|
||||
* ==NULL: sequential read
|
||||
* i) flags following db_next call take over this.
|
||||
* DBIO_KEY read key part
|
||||
* DBIO_PREFIX prefix read
|
||||
* DBIO_SKIPMETA skip META record
|
||||
* only valied when sequential read
|
||||
* r) data
|
||||
*/
|
||||
char *
|
||||
db_first(dbio, k, flags)
|
||||
DBIO *dbio;
|
||||
char *k;
|
||||
int flags;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
int status;
|
||||
|
||||
if (flags & DBIO_PREFIX && !k)
|
||||
flags &= ~DBIO_PREFIX;
|
||||
if (flags & DBIO_SKIPMETA && k)
|
||||
flags &= ~DBIO_SKIPMETA;
|
||||
if (k) {
|
||||
if (strlen(k) > MAXKEYLEN)
|
||||
die("primary key too long.");
|
||||
strcpy(dbio->key, k);
|
||||
key.data = k;
|
||||
key.size = strlen(k);
|
||||
/*
|
||||
* includes NULL character unless prefix read.
|
||||
*/
|
||||
if (!(flags & DBIO_PREFIX))
|
||||
key.size++;
|
||||
dbio->keylen = key.size;
|
||||
status = (*db->seq)(db, &key, &dat, R_CURSOR);
|
||||
} else {
|
||||
dbio->keylen = dbio->key[0] = 0;
|
||||
for (status = (*db->seq)(db, &key, &dat, R_FIRST);
|
||||
status == RET_SUCCESS &&
|
||||
flags & DBIO_SKIPMETA &&
|
||||
*((char *)dat.data) == ' ';
|
||||
status = (*db->seq)(db, &key, &dat, R_NEXT))
|
||||
;
|
||||
}
|
||||
dbio->lastkey = (char *)key.data;
|
||||
dbio->lastdat = (char *)dat.data;
|
||||
switch (status) {
|
||||
case RET_SUCCESS:
|
||||
break;
|
||||
case RET_ERROR:
|
||||
die("db_first failed.");
|
||||
case RET_SPECIAL:
|
||||
return ((char *)0);
|
||||
}
|
||||
dbio->ioflags = flags;
|
||||
if (flags & DBIO_PREFIX) {
|
||||
if (strncmp((char *)key.data, dbio->key, dbio->keylen))
|
||||
return (char *)0;
|
||||
} else if (dbio->keylen) {
|
||||
if (strcmp((char *)key.data, dbio->key))
|
||||
return (char *)0;
|
||||
}
|
||||
if (flags & DBIO_KEY) {
|
||||
strcpy(dbio->prev, (char *)key.data);
|
||||
return (char *)key.data;
|
||||
}
|
||||
return ((char *)dat.data);
|
||||
}
|
||||
/*
|
||||
* db_next: get next record.
|
||||
*
|
||||
* i) dbio dbio descripter
|
||||
* r) data
|
||||
*/
|
||||
char *
|
||||
db_next(dbio)
|
||||
DBIO *dbio;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
int flags = dbio->ioflags;
|
||||
int status;
|
||||
|
||||
while ((status = (*db->seq)(db, &key, &dat, R_NEXT)) == RET_SUCCESS) {
|
||||
if (flags & DBIO_SKIPMETA) {
|
||||
if (*((char *)dat.data) == ' ')
|
||||
continue;
|
||||
}
|
||||
if (flags & DBIO_KEY) {
|
||||
if (!strcmp(dbio->prev, (char *)key.data))
|
||||
continue;
|
||||
if (strlen((char *)key.data) > MAXKEYLEN)
|
||||
die("primary key too long.");
|
||||
strcpy(dbio->prev, (char *)key.data);
|
||||
}
|
||||
dbio->lastkey = (char *)key.data;
|
||||
dbio->lastdat = (char *)dat.data;
|
||||
if (flags & DBIO_PREFIX) {
|
||||
if (strncmp((char *)key.data, dbio->key, dbio->keylen))
|
||||
return (char *)0;
|
||||
} else if (dbio->keylen) {
|
||||
if (strcmp((char *)key.data, dbio->key))
|
||||
return (char *)0;
|
||||
}
|
||||
return (flags & DBIO_KEY) ? (char *)key.data : (char *)dat.data;
|
||||
}
|
||||
if (status == RET_ERROR)
|
||||
die("db_next failed.");
|
||||
return (char *)0;
|
||||
}
|
||||
/*
|
||||
* db_close: close db
|
||||
*
|
||||
* i) dbio dbio descripter
|
||||
*/
|
||||
void
|
||||
db_close(dbio)
|
||||
DBIO *dbio;
|
||||
{
|
||||
DB *db = dbio->db;
|
||||
(void)db->close(db);
|
||||
if (dbio->openflags & DBIO_REMOVE)
|
||||
(void)unlink(dbio->dbname);
|
||||
else if (dbio->perm && chmod(dbio->dbname, dbio->perm) < 0)
|
||||
die("cannot change file mode.");
|
||||
(void)free(dbio);
|
||||
}
|
||||
Loaded 100 of 2312 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user