mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
Compare commits
386
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcc0587080 | ||
|
|
8935d79733 | ||
|
|
06187df476 | ||
|
|
b3f6e5e9f1 | ||
|
|
214e0c9020 | ||
|
|
cacb7e6814 | ||
|
|
270fd87cbb | ||
|
|
188d6589ff | ||
|
|
0e8064dff4 | ||
|
|
442c3b7577 | ||
|
|
7877839a22 | ||
|
|
a53a472ff4 | ||
|
|
fae3d6e480 | ||
|
|
e8e1bc02c0 | ||
|
|
dab7f20af9 | ||
|
|
bd0ed0fef9 | ||
|
|
6a15d061c8 | ||
|
|
c8e5bc75de | ||
|
|
3a32adb8f5 | ||
|
|
17cea34886 | ||
|
|
f533df855d | ||
|
|
9b56baa39f | ||
|
|
80be3bf6bd | ||
|
|
ebd954b83d | ||
|
|
5bd7156a38 | ||
|
|
1fac13be5b | ||
|
|
8719ea484d | ||
|
|
5a537073db | ||
|
|
1a1dd3927c | ||
|
|
60e815c4f0 | ||
|
|
52bb8d914e | ||
|
|
4216d60d32 | ||
|
|
f69cb5c9a0 | ||
|
|
2969e2ae42 | ||
|
|
88624191ca | ||
|
|
073ac28a4e | ||
|
|
a96d1e75b7 | ||
|
|
e31f41339e | ||
|
|
19ae55f383 | ||
|
|
211afe2cd0 | ||
|
|
a604799d09 | ||
|
|
5337d7a2a5 | ||
|
|
7fa52a6ce5 | ||
|
|
af738435af | ||
|
|
a5fb94c9f9 | ||
|
|
2d0ae92a99 | ||
|
|
ec6ceacea2 | ||
|
|
0509eb8c40 | ||
|
|
5708147189 | ||
|
|
084f6a26f3 | ||
|
|
e2708d8dab | ||
|
|
4e66f8c158 | ||
|
|
439e13cd0d | ||
|
|
49f41c222b | ||
|
|
a2cd26dd26 | ||
|
|
111698cd41 | ||
|
|
31f3e70ec1 | ||
|
|
2d390ebe39 | ||
|
|
c6d822bd7e | ||
|
|
7227eaef88 | ||
|
|
1bc6dd3cb1 | ||
|
|
6151498945 | ||
|
|
e28f66ee9c | ||
|
|
ccd4f86e06 | ||
|
|
d092a4ec45 | ||
|
|
13b226b3a7 | ||
|
|
45d935933c | ||
|
|
91f457d5d9 | ||
|
|
f1b2470e25 | ||
|
|
a8029cb9a2 | ||
|
|
e194d8cb90 | ||
|
|
05a025dddb | ||
|
|
789eb1f255 | ||
|
|
221b4dcfb8 | ||
|
|
a6cdc48471 | ||
|
|
8e9239893a | ||
|
|
fdef63144f | ||
|
|
0e0be1b309 | ||
|
|
fadc189a5b | ||
|
|
0a51b1ff1f | ||
|
|
1ac6f2d09a | ||
|
|
aea12503a4 | ||
|
|
f6d39af95e | ||
|
|
114cd4e652 | ||
|
|
30343e0985 | ||
|
|
0921567ffe | ||
|
|
bc7110d7e3 | ||
|
|
4d8d2df850 | ||
|
|
c7d8b0e516 | ||
|
|
76275a6104 | ||
|
|
4dd24a5a6c | ||
|
|
ad2126e920 | ||
|
|
70b2c8e405 | ||
|
|
eda11af7c7 | ||
|
|
af8bf61211 | ||
|
|
f49fbf7d98 | ||
|
|
12ec7eeec5 | ||
|
|
9f05ed9b32 | ||
|
|
226ec65268 | ||
|
|
df2b319ff2 | ||
|
|
47c9256192 | ||
|
|
3555f7305a | ||
|
|
2649070a45 | ||
|
|
8508495309 | ||
|
|
f5d0795a1e | ||
|
|
3f9969c610 | ||
|
|
655820bbe0 | ||
|
|
18bf0ef63c | ||
|
|
af9d21a285 | ||
|
|
d3aa551242 | ||
|
|
7586373a05 | ||
|
|
14c6b9ff03 | ||
|
|
ebfce84390 | ||
|
|
49673092dc | ||
|
|
b52c5b8a0f | ||
|
|
7621d88604 | ||
|
|
066914d08c | ||
|
|
f6a94edde0 | ||
|
|
84862e63a7 | ||
|
|
ebb640e37b | ||
|
|
8b8e9060b1 | ||
|
|
274d5fa01e | ||
|
|
26c25ec91e | ||
|
|
bbed0325d9 | ||
|
|
b30249d957 | ||
|
|
83a04e4fb0 | ||
|
|
b67946a431 | ||
|
|
31b5435674 | ||
|
|
6d26efa8ef | ||
|
|
9537a8b04d | ||
|
|
e2b601e6c3 | ||
|
|
6b5bc93a28 | ||
|
|
46c6c6d2e1 | ||
|
|
151c42b44e | ||
|
|
0fa58b56ec | ||
|
|
435c642891 | ||
|
|
4414763f4d | ||
|
|
db5c241aba | ||
|
|
016d972ea2 | ||
|
|
9e0a20e6bd | ||
|
|
5d8ff3922a | ||
|
|
8ba175812b | ||
|
|
a13546d7e7 | ||
|
|
98bbf54ffa | ||
|
|
d55382bcbc | ||
|
|
eeee68fd82 | ||
|
|
16bc8f3c7b | ||
|
|
d11af0bfda | ||
|
|
0bd0bd9c82 | ||
|
|
2ce04713fe | ||
|
|
f05c7cc1e6 | ||
|
|
26daf24714 | ||
|
|
b4f05001f3 | ||
|
|
eea7c212a5 | ||
|
|
8f55fa3b8b | ||
|
|
e6874927ec | ||
|
|
c109bf1446 | ||
|
|
1cbbbc10fc | ||
|
|
f85c49b786 | ||
|
|
b9bdf5b8cb | ||
|
|
b749b3bb3e | ||
|
|
b57e894043 | ||
|
|
971d1e6fff | ||
|
|
3d337f13fc | ||
|
|
2412cdd3e9 | ||
|
|
61b481c7f4 | ||
|
|
9230146b39 | ||
|
|
82f4e70650 | ||
|
|
aba290e1d7 | ||
|
|
3d76eec03d | ||
|
|
4c3d4253f3 | ||
|
|
57133a9ade | ||
|
|
c9335a049c | ||
|
|
53b1134004 | ||
|
|
7bbdef777c | ||
|
|
c1364f7838 | ||
|
|
13e2fc0a0f | ||
|
|
a76e875480 | ||
|
|
96537300fa | ||
|
|
c80009a4e9 | ||
|
|
198bfce040 | ||
|
|
1031171ee4 | ||
|
|
03081c7928 | ||
|
|
d3d6a8fb1d | ||
|
|
b9bcff08c0 | ||
|
|
b1df7f9a19 | ||
|
|
08fe4eb387 | ||
|
|
2b7895902e | ||
|
|
024b62e1bb | ||
|
|
3e0dd5e7df | ||
|
|
13abd41167 | ||
|
|
cd252574b1 | ||
|
|
1b4569257b | ||
|
|
6440f26160 | ||
|
|
3192c775e6 | ||
|
|
6f63b1f2b2 | ||
|
|
ccba9c3f37 | ||
|
|
caf9e52f18 | ||
|
|
29bd2e6e45 | ||
|
|
c37590dda2 | ||
|
|
6d3e1e88a4 | ||
|
|
dc6d5fe517 | ||
|
|
a94b094efb | ||
|
|
3d8fed90ed | ||
|
|
9b542d5380 | ||
|
|
deeacf7682 | ||
|
|
f932f046b2 | ||
|
|
c2efd23f3a | ||
|
|
4e4245448f | ||
|
|
2e8ac4e109 | ||
|
|
e7668b2043 | ||
|
|
e39e17dfa0 | ||
|
|
c0e6bef5c9 | ||
|
|
055d577dc9 | ||
|
|
e07824536f | ||
|
|
c063e3aedc | ||
|
|
1f199dffd0 | ||
|
|
65892ed949 | ||
|
|
77f9139893 | ||
|
|
67a61d68a0 | ||
|
|
ad8f99bb3a | ||
|
|
9c89b851c9 | ||
|
|
65d9ba4eb1 | ||
|
|
a29bf0ab58 | ||
|
|
86f23c4237 | ||
|
|
7aca2d6d19 | ||
|
|
bf2db90612 | ||
|
|
fee7bfeffb | ||
|
|
ecd64598ee | ||
|
|
11adaa2b2e | ||
|
|
8a1209f238 | ||
|
|
67068fe3e8 | ||
|
|
ddb6133958 | ||
|
|
647edf6222 | ||
|
|
7fe4d17490 | ||
|
|
4ef5cab369 | ||
|
|
9c8744932e | ||
|
|
09bc20bed2 | ||
|
|
8771f74895 | ||
|
|
c99311c81d | ||
|
|
1b698c4f58 | ||
|
|
54e3ff158e | ||
|
|
98f6d1b8ba | ||
|
|
24ad92549c | ||
|
|
3a75219a88 | ||
|
|
6698fe083f | ||
|
|
8dfac1c97b | ||
|
|
9d7c73393b | ||
|
|
a007f2ea7a | ||
|
|
faa363b6ef | ||
|
|
2f4dff0ed1 | ||
|
|
0f2f502705 | ||
|
|
dd15aae6d7 | ||
|
|
20bba48b3d | ||
|
|
d8bd056aaa | ||
|
|
cabf9e56a5 | ||
|
|
8d75a27388 | ||
|
|
4706824e3f | ||
|
|
ced2724a6c | ||
|
|
d86aa8b7c9 | ||
|
|
463d56f4bc | ||
|
|
4bc69d1149 | ||
|
|
363b506043 | ||
|
|
d01342629b | ||
|
|
282fd6c84c | ||
|
|
614317b095 | ||
|
|
5397377bf1 | ||
|
|
00699bdaa9 | ||
|
|
ce106a445f | ||
|
|
1900e82b71 | ||
|
|
a86ad81a8d | ||
|
|
f82d4db913 | ||
|
|
09eee860d0 | ||
|
|
04c18344d2 | ||
|
|
3e08d472d4 | ||
|
|
2a7fbb663d | ||
|
|
c794cd4b81 | ||
|
|
a22a955450 | ||
|
|
7118179c50 | ||
|
|
c56029c1c2 | ||
|
|
dad1e4d981 | ||
|
|
b8490f0625 | ||
|
|
49d9611cc7 | ||
|
|
536e33d9f6 | ||
|
|
769b3c79bc | ||
|
|
fc43f514d9 | ||
|
|
612ca3f7dd | ||
|
|
822dd9e1e0 | ||
|
|
8f04263f3f | ||
|
|
b3d6b19930 | ||
|
|
555ce93ce3 | ||
|
|
6bd66a6bd6 | ||
|
|
d9ac39faed | ||
|
|
1ccb288333 | ||
|
|
2359546b66 | ||
|
|
78567912f2 | ||
|
|
c28702b61b | ||
|
|
97786e63d0 | ||
|
|
9ccd6e6efd | ||
|
|
668b5184c8 | ||
|
|
1e7f63411c | ||
|
|
835b56e5ba | ||
|
|
c8fc6b7a38 | ||
|
|
3bda9cc428 | ||
|
|
6f97fa6e1d | ||
|
|
ca77442146 | ||
|
|
3e40cfcf3b | ||
|
|
7416bd11b9 | ||
|
|
61b25a7e99 | ||
|
|
9ba3240efc | ||
|
|
7887637757 | ||
|
|
7351afe798 | ||
|
|
3736df61ba | ||
|
|
be48bcdb2d | ||
|
|
5aaa15bf31 | ||
|
|
48663a646e | ||
|
|
53e5d3057b | ||
|
|
8d1dd37cea | ||
|
|
7e88e4033e | ||
|
|
b745c9dd21 | ||
|
|
4545e9f856 | ||
|
|
49136cd513 | ||
|
|
16ace871f3 | ||
|
|
4dde74dae8 | ||
|
|
0d81c0a8c7 | ||
|
|
61a870c842 | ||
|
|
396eacd821 | ||
|
|
ca3216c9ae | ||
|
|
92c252206b | ||
|
|
accba27143 | ||
|
|
040cdff758 | ||
|
|
bcab5a28a5 | ||
|
|
cd765480f2 | ||
|
|
50192c3ed7 | ||
|
|
d35f3ae11f | ||
|
|
bd37be6edd | ||
|
|
fd7be8bc8f | ||
|
|
4e59b4292c | ||
|
|
57dec3a67d | ||
|
|
ed1e041772 | ||
|
|
58da3cfa14 | ||
|
|
fd8889c85b | ||
|
|
def236013c | ||
|
|
1dbef5b79f | ||
|
|
f63018e9b5 | ||
|
|
49d27bdc83 | ||
|
|
33a35e056b | ||
|
|
7c2b54b21e | ||
|
|
d7487e5e4a | ||
|
|
a140d348a3 | ||
|
|
e8acfe1aff | ||
|
|
60feda37c7 | ||
|
|
93a18dff8f | ||
|
|
08c07cd420 | ||
|
|
08fbd37c67 | ||
|
|
51c616f6a8 | ||
|
|
10891800ac | ||
|
|
e53c87bc5d | ||
|
|
1e241f19a9 | ||
|
|
fd08c444e6 | ||
|
|
f9eba749d7 | ||
|
|
8a90f6c3ad | ||
|
|
61e660abb9 | ||
|
|
c35e478053 | ||
|
|
9d9e22bbbf | ||
|
|
371bf72731 | ||
|
|
b8a0e88098 | ||
|
|
dc35556033 | ||
|
|
2d69cd14a9 | ||
|
|
1575ff5b59 | ||
|
|
c7bcb06440 | ||
|
|
0f1b35f61b | ||
|
|
467194d9b6 | ||
|
|
365738c9e2 | ||
|
|
7753eed96f | ||
|
|
4937b79d09 | ||
|
|
c0eea35fcb | ||
|
|
a7efd265c0 | ||
|
|
e506051a5b | ||
|
|
d85926e0cf | ||
|
|
1c7bd47f2d | ||
|
|
a460193410 | ||
|
|
f8b9627ac5 | ||
|
|
2bd74093d6 | ||
|
|
9a9f7322bf | ||
|
|
f94d869a9b |
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: Makefile,v 1.109.2.1 1996/11/28 21:43:35 phk Exp $
|
||||
# $Id: Makefile,v 1.109.2.3 1997/04/11 16:57:40 asami Exp $
|
||||
#
|
||||
# Make command line options:
|
||||
# -DCLOBBER will remove /usr/include
|
||||
@@ -18,6 +18,7 @@
|
||||
# -DNOSECURE do not go into secure subdir
|
||||
# -DNOGAMES do not go into games subdir
|
||||
# -DNOSHARE do not go into share subdir
|
||||
# -DNOINFO do not make or install info files
|
||||
|
||||
#
|
||||
# The intended user-driven targets are:
|
||||
@@ -119,7 +120,7 @@ SUPFLAGS?= -v
|
||||
# While building tools for bootstrapping, we dont need to waste time on
|
||||
# profiled libraries or man pages. This speeds things up somewhat.
|
||||
#
|
||||
MK_FLAGS= -DNOMAN -DNOPROFILE
|
||||
MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
|
||||
|
||||
#
|
||||
# world
|
||||
@@ -454,6 +455,10 @@ lib-tools:
|
||||
# libraries - build and install the libraries
|
||||
#
|
||||
libraries:
|
||||
.if exists(lib/csu/i386)
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libcompat)
|
||||
cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
@@ -466,10 +471,6 @@ libraries:
|
||||
cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib)
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(gnu)
|
||||
cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
@@ -501,6 +502,8 @@ libraries:
|
||||
#
|
||||
build-tools:
|
||||
.for d in \
|
||||
share/info \
|
||||
gnu/usr.bin/texinfo \
|
||||
usr.bin/symorder \
|
||||
usr.bin/sgmls \
|
||||
usr.bin/sgmlfmt \
|
||||
|
||||
+8
-4
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: buf.c,v 1.6 1994/09/24 02:55:22 davidg Exp $
|
||||
* $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";
|
||||
@@ -198,14 +198,18 @@ char sfn[15] = ""; /* scratch file name */
|
||||
int
|
||||
open_sbuf()
|
||||
{
|
||||
int fd = -1;
|
||||
int u;
|
||||
|
||||
isbinary = newline_added = 0;
|
||||
u = umask(077);
|
||||
strcpy(sfn, "/tmp/ed.XXXXXX");
|
||||
if (mktemp(sfn) == NULL || (sfp = fopen(sfn, "w+")) == NULL) {
|
||||
fprintf(stderr, "%s: %s\n", sfn, strerror(errno));
|
||||
sprintf(errmsg, "cannot open temp file");
|
||||
if ((fd = mkstemp(sfn)) == -1 ||
|
||||
(sfp = fdopen(fd, "w+")) == NULL) {
|
||||
if (fd != -1)
|
||||
close(fd);
|
||||
perror(sfn);
|
||||
strcpy(errmsg, "cannot open temp file");
|
||||
umask(u);
|
||||
return ERR;
|
||||
}
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)ls.1 8.6 (Berkeley) 4/18/94
|
||||
.\" $Id: ls.1,v 1.5.2.1 1997/02/25 00:38:13 mpp Exp $
|
||||
.\" $Id: ls.1,v 1.5.2.2 1997/03/07 02:00:30 mpp Exp $
|
||||
.\"
|
||||
.Dd April 18, 1994
|
||||
.Dt LS 1
|
||||
@@ -43,7 +43,7 @@
|
||||
.Nd list directory contents
|
||||
.Sh SYNOPSIS
|
||||
.Nm ls
|
||||
.Op Fl ACFLRTacdfgiloqrstu1
|
||||
.Op Fl ACFLRTacdfgikloqrstu1
|
||||
.Op Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
For each operand that names a
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: util.c,v 1.4 1994/10/09 15:25:23 ache Exp $
|
||||
* $Id: util.c,v 1.5 1996/03/31 16:14:11 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -68,6 +68,6 @@ prcopy(src, dest, len)
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfiklqrstu] [file ...]\n");
|
||||
(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfikloqrstu] [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
+5
-2
@@ -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.15 1996/06/29 10:25:31 peter Exp $
|
||||
* $Id: print.c,v 1.16 1996/10/21 07:30:24 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -103,7 +103,10 @@ command(k, ve)
|
||||
v = ve->var;
|
||||
|
||||
if (cflag) {
|
||||
(void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
|
||||
if (ve->next == NULL) /* last field, don't pad */
|
||||
(void)printf("%s", KI_PROC(k)->p_comm);
|
||||
else
|
||||
(void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -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.7 1996/02/11 09:01:32 markm Exp $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -131,7 +131,8 @@ main(argc, argv)
|
||||
#ifdef KERBEROS
|
||||
case 'k':
|
||||
dest_realm = dst_realm_buf;
|
||||
(void)strncpy(dst_realm_buf, optarg, REALM_SZ);
|
||||
(void)strncpy(dst_realm_buf, optarg, REALM_SZ - 1);
|
||||
dst_realm_buf[REALM_SZ - 1] = '\0';
|
||||
break;
|
||||
#ifdef CRYPT
|
||||
case 'x':
|
||||
|
||||
+19
-13
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)rm.1 8.2 (Berkeley) 4/18/94
|
||||
.\" $Id: rm.1,v 1.3 1996/03/07 23:26:58 wosch Exp $
|
||||
.\" $Id: rm.1,v 1.4.2.1 1997/04/08 20:43:37 mpp Exp $
|
||||
.\"
|
||||
.Dd April 18, 1994
|
||||
.Dt RM 1
|
||||
@@ -119,20 +119,26 @@ If an error occurs,
|
||||
.Nm rm
|
||||
exits with a value >0.
|
||||
.Sh NOTE
|
||||
.Nm rm
|
||||
use
|
||||
The
|
||||
.Nm
|
||||
command uses
|
||||
.Xr getopt 3
|
||||
parsing routine. Getopt accept a
|
||||
to parse its arguments, which allows it to accept
|
||||
the
|
||||
.Sq Li --
|
||||
argument, which stop reading options, anything after this
|
||||
is not an option.
|
||||
So
|
||||
.Nm rm
|
||||
handle files whose names begins with a
|
||||
.Sq Li - .
|
||||
Example:
|
||||
|
||||
``$ rm -- -filename''.
|
||||
option which will cause it to stop processing flag options at that
|
||||
point. This will allow the removal of file names that begin
|
||||
with a dash
|
||||
.Pq Sq - .
|
||||
For example:
|
||||
.Dl rm -- -filename
|
||||
The same behavior can be obtained by using an absolute or relative
|
||||
path reference. For example:
|
||||
.Dl rm /home/user/-filename
|
||||
.Dl rm ./-filename
|
||||
This is useful for commands that do not use
|
||||
.Xr getopt 3
|
||||
to parse the command line arguments.
|
||||
.Sh SEE ALSO
|
||||
.Xr rmdir 1 ,
|
||||
.Xr unlink 2 ,
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: eval.c,v 1.8 1996/11/12 18:35:06 peter Exp $
|
||||
* $Id: eval.c,v 1.7.2.1 1996/11/12 19:23:44 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -957,7 +957,7 @@ returncmd(argc, argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = exitstatus;
|
||||
ret = oexitstatus;
|
||||
if (argc > 1)
|
||||
ret = number(argv[1]);
|
||||
if (funcnest) {
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char rcsid[] = "$Id: ns_udp.c,v 8.3 1996/08/27 08:33:23 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
#include <nlist.h>
|
||||
#include <resolv.h>
|
||||
|
||||
#include "named.h"
|
||||
|
||||
void
|
||||
ns_udp() {
|
||||
#if defined(CHECK_UDP_SUM) || defined(FIX_UDP_SUM)
|
||||
struct nlist nl[2];
|
||||
int fd;
|
||||
int sum;
|
||||
u_long res, offset;
|
||||
|
||||
nl[0].n_name = UDPSUM;
|
||||
nl[1].n_name = 0;
|
||||
|
||||
if (nlist(KSYMS, nl)) {
|
||||
dprintf(1, (ddt, "ns_udp: nlist (%s,%s) failed\n",
|
||||
KSYMS, UDPSUM));
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %s %d %lu (%ld)\n",
|
||||
nl[0].n_name, nl[0].n_type, nl[0].n_value,
|
||||
nl[0].n_value));
|
||||
|
||||
if (!nl[0].n_type)
|
||||
return;
|
||||
|
||||
if ((fd = open(KMEM, O_RDWR, 0)) < 0) {
|
||||
dprintf(1, (ddt, "ns_udp: open %s failed\n", KMEM));
|
||||
return;
|
||||
}
|
||||
|
||||
offset = nl[0].n_value;
|
||||
#ifdef KMAP
|
||||
offset &= ((~0UL)>>1);
|
||||
#endif
|
||||
|
||||
res = lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (read(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: read failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %d\n", sum));
|
||||
if (sum == 0) {
|
||||
#ifdef FIX_UDP_SUM
|
||||
sum = 1;
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
if (write(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: write failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
dprintf(1, (ddt, "ns_udp: set to 1\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: check sums turned on");
|
||||
#else
|
||||
dprintf(1, (ddt, "ns_udp: Exiting\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: checksums NOT turned on: Exiting");
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
cleanup:
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# include "../conf/portability.h"
|
||||
#endif
|
||||
|
||||
#define Assert(Cond) if (!(Cond)) abort()
|
||||
|
||||
static const char Base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
|
||||
The following encoding technique is taken from RFC 1521 by Borenstein
|
||||
and Freed. It is reproduced here in a slightly edited form for
|
||||
convenience.
|
||||
|
||||
A 65-character subset of US-ASCII is used, enabling 6 bits to be
|
||||
represented per printable character. (The extra 65th character, "=",
|
||||
is used to signify a special processing function.)
|
||||
|
||||
The encoding process represents 24-bit groups of input bits as output
|
||||
strings of 4 encoded characters. Proceeding from left to right, a
|
||||
24-bit input group is formed by concatenating 3 8-bit input groups.
|
||||
These 24 bits are then treated as 4 concatenated 6-bit groups, each
|
||||
of which is translated into a single digit in the base64 alphabet.
|
||||
|
||||
Each 6-bit group is used as an index into an array of 64 printable
|
||||
characters. The character referenced by the index is placed in the
|
||||
output string.
|
||||
|
||||
Table 1: The Base64 Alphabet
|
||||
|
||||
Value Encoding Value Encoding Value Encoding Value Encoding
|
||||
0 A 17 R 34 i 51 z
|
||||
1 B 18 S 35 j 52 0
|
||||
2 C 19 T 36 k 53 1
|
||||
3 D 20 U 37 l 54 2
|
||||
4 E 21 V 38 m 55 3
|
||||
5 F 22 W 39 n 56 4
|
||||
6 G 23 X 40 o 57 5
|
||||
7 H 24 Y 41 p 58 6
|
||||
8 I 25 Z 42 q 59 7
|
||||
9 J 26 a 43 r 60 8
|
||||
10 K 27 b 44 s 61 9
|
||||
11 L 28 c 45 t 62 +
|
||||
12 M 29 d 46 u 63 /
|
||||
13 N 30 e 47 v
|
||||
14 O 31 f 48 w (pad) =
|
||||
15 P 32 g 49 x
|
||||
16 Q 33 h 50 y
|
||||
|
||||
Special processing is performed if fewer than 24 bits are available
|
||||
at the end of the data being encoded. A full encoding quantum is
|
||||
always completed at the end of a quantity. When fewer than 24 input
|
||||
bits are available in an input group, zero bits are added (on the
|
||||
right) to form an integral number of 6-bit groups. Padding at the
|
||||
end of the data is performed using the '=' character.
|
||||
|
||||
Since all base64 input is an integral number of octets, only the
|
||||
-------------------------------------------------
|
||||
following cases can arise:
|
||||
|
||||
(1) the final quantum of encoding input is an integral
|
||||
multiple of 24 bits; here, the final unit of encoded
|
||||
output will be an integral multiple of 4 characters
|
||||
with no "=" padding,
|
||||
(2) the final quantum of encoding input is exactly 8 bits;
|
||||
here, the final unit of encoded output will be two
|
||||
characters followed by two "=" padding characters, or
|
||||
(3) the final quantum of encoding input is exactly 16 bits;
|
||||
here, the final unit of encoded output will be three
|
||||
characters followed by one "=" padding character.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_ntop(src, srclength, target, targsize)
|
||||
u_char const *src;
|
||||
size_t srclength;
|
||||
char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
size_t datalength = 0;
|
||||
u_char input[3];
|
||||
u_char output[4];
|
||||
int i;
|
||||
|
||||
while (2 < srclength) {
|
||||
input[0] = *src++;
|
||||
input[1] = *src++;
|
||||
input[2] = *src++;
|
||||
srclength -= 3;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
output[3] = input[2] & 0x3f;
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
Assert(output[3] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Base64[output[3]];
|
||||
}
|
||||
|
||||
/* Now we worry about padding. */
|
||||
if (0 != srclength) {
|
||||
/* Get what's left. */
|
||||
input[0] = input[1] = input[2] = '\0';
|
||||
for (i = 0; i < srclength; i++)
|
||||
input[i] = *src++;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
if (srclength == 1)
|
||||
target[datalength++] = Pad64;
|
||||
else
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Pad64;
|
||||
}
|
||||
if (datalength >= targsize)
|
||||
return (-1);
|
||||
target[datalength] = '\0'; /* Returned value doesn't count \0. */
|
||||
return (datalength);
|
||||
}
|
||||
|
||||
/* skips all whitespace anywhere.
|
||||
converts characters, four at a time, starting at (or after)
|
||||
src from base - 64 numbers into three 8 bit bytes in the target area.
|
||||
it returns the number of data bytes stored at the target, or -1 on error.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_pton(src, target, targsize)
|
||||
char const *src;
|
||||
u_char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
int tarindex, state, ch;
|
||||
char *pos;
|
||||
|
||||
state = 0;
|
||||
tarindex = 0;
|
||||
|
||||
while ((ch = *src++) != '\0') {
|
||||
if (isspace(ch)) /* Skip whitespace anywhere. */
|
||||
continue;
|
||||
|
||||
if (ch == Pad64)
|
||||
break;
|
||||
|
||||
pos = strchr(Base64, ch);
|
||||
if (pos == 0) /* A non-base64 character. */
|
||||
return (-1);
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] = (pos - Base64) << 2;
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 4;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||
<< 4 ;
|
||||
}
|
||||
tarindex++;
|
||||
state = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 2;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||
<< 6;
|
||||
}
|
||||
tarindex++;
|
||||
state = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64);
|
||||
}
|
||||
tarindex++;
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are done decoding Base-64 chars. Let's see if we ended
|
||||
* on a byte boundary, and/or with erroneous trailing characters.
|
||||
*/
|
||||
|
||||
if (ch == Pad64) { /* We got a pad char. */
|
||||
ch = *src++; /* Skip it, get next. */
|
||||
switch (state) {
|
||||
case 0: /* Invalid = in first position */
|
||||
case 1: /* Invalid = in second position */
|
||||
return (-1);
|
||||
|
||||
case 2: /* Valid, means one byte of info */
|
||||
/* Skip any number of spaces. */
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
break;
|
||||
/* Make sure there is another trailing = sign. */
|
||||
if (ch != Pad64)
|
||||
return (-1);
|
||||
ch = *src++; /* Skip the = */
|
||||
/* Fall through to "single trailing =" case. */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3: /* Valid, means two bytes of info */
|
||||
/*
|
||||
* We know this char is an =. Is there anything but
|
||||
* whitespace after it?
|
||||
*/
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Now make sure for cases 2 and 3 that the "extra"
|
||||
* bits that slopped past the last full byte were
|
||||
* zeros. If we don't check them, they become a
|
||||
* subliminal channel.
|
||||
*/
|
||||
if (target && target[tarindex] != 0)
|
||||
return (-1);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We ended by seeing the end of the string. Make sure we
|
||||
* have no partial bytes lying around.
|
||||
*/
|
||||
if (state != 0)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (tarindex);
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
|
||||
char *dst, size_t size));
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_net_ntop(af, src, bits, dst, size)
|
||||
* convert network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_net_ntop(af, src, bits, dst, size)
|
||||
int af;
|
||||
const void *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_ntop_ipv4(src, bits, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static char *
|
||||
* inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
* convert IPv4 network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
static char *
|
||||
inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
const u_char *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *t;
|
||||
u_int m;
|
||||
int b;
|
||||
|
||||
if (bits < 0 || bits > 32) {
|
||||
errno = EINVAL;
|
||||
return (NULL);
|
||||
}
|
||||
if (bits == 0) {
|
||||
if (size < sizeof "0")
|
||||
goto emsgsize;
|
||||
*dst++ = '0';
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
/* Format whole octets. */
|
||||
for (b = bits / 8; b > 0; b--) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
dst += SPRINTF((dst, "%u", *src++));
|
||||
if (b > 1) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format partial octet. */
|
||||
b = bits % 8;
|
||||
if (b > 0) {
|
||||
if (size < sizeof ".255")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
if (dst != odst)
|
||||
*dst++ = '.';
|
||||
m = ((1 << b) - 1) << (8 - b);
|
||||
dst += SPRINTF((dst, "%u", *src & m));
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format CIDR /width. */
|
||||
if (size < sizeof "/32")
|
||||
goto emsgsize;
|
||||
dst += SPRINTF((dst, "/%u", bits));
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
|
||||
size_t size));
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton(af, src, dst, size)
|
||||
* convert network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not a valid network specification.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
int
|
||||
inet_net_pton(af, src, dst, size)
|
||||
int af;
|
||||
const char *src;
|
||||
void *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_pton_ipv4(src, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton_ipv4(src, dst, size)
|
||||
* convert IPv4 network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not an IPv4 network specification.
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
static int
|
||||
inet_net_pton_ipv4(src, dst, size)
|
||||
const char *src;
|
||||
u_char *dst;
|
||||
size_t size;
|
||||
{
|
||||
static const char
|
||||
xdigits[] = "0123456789abcdef",
|
||||
digits[] = "0123456789";
|
||||
int n, ch, tmp, dirty, bits;
|
||||
const u_char *odst = dst;
|
||||
|
||||
ch = *src++;
|
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
|
||||
&& isascii(src[1]) && isxdigit(src[1])) {
|
||||
/* Hexadecimal: Eat nybble string. */
|
||||
if (size <= 0)
|
||||
goto emsgsize;
|
||||
*dst = 0, dirty = 0;
|
||||
src++; /* skip x or X. */
|
||||
while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isxdigit(ch)) {
|
||||
if (isupper(ch))
|
||||
ch = tolower(ch);
|
||||
n = strchr(xdigits, ch) - xdigits;
|
||||
assert(n >= 0 && n <= 15);
|
||||
*dst |= n;
|
||||
if (!dirty++)
|
||||
*dst <<= 4;
|
||||
else if (size-- > 0)
|
||||
*++dst = 0, dirty = 0;
|
||||
else
|
||||
goto emsgsize;
|
||||
}
|
||||
if (dirty)
|
||||
size--;
|
||||
} else if (isascii(ch) && isdigit(ch)) {
|
||||
/* Decimal: eat dotted digit string. */
|
||||
for (;;) {
|
||||
tmp = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
tmp *= 10;
|
||||
tmp += n;
|
||||
if (tmp > 255)
|
||||
goto enoent;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = (u_char) tmp;
|
||||
if (ch == '\0' || ch == '/')
|
||||
break;
|
||||
if (ch != '.')
|
||||
goto enoent;
|
||||
ch = *src++;
|
||||
if (!isascii(ch) || !isdigit(ch))
|
||||
goto enoent;
|
||||
}
|
||||
} else
|
||||
goto enoent;
|
||||
|
||||
bits = -1;
|
||||
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
|
||||
/* CIDR width specifier. Nothing can follow it. */
|
||||
ch = *src++; /* Skip over the /. */
|
||||
bits = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
bits *= 10;
|
||||
bits += n;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
if (bits > 32)
|
||||
goto emsgsize;
|
||||
}
|
||||
|
||||
/* Firey death and destruction unless we prefetched EOS. */
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
|
||||
/* If nothing was written to the destination, we found no address. */
|
||||
if (dst == odst)
|
||||
goto enoent;
|
||||
/* If no CIDR spec was given, infer width from net class. */
|
||||
if (bits == -1) {
|
||||
if (*odst >= 240) /* Class E */
|
||||
bits = 32;
|
||||
else if (*odst >= 224) /* Class D */
|
||||
bits = 4;
|
||||
else if (*odst >= 192) /* Class C */
|
||||
bits = 24;
|
||||
else if (*odst >= 128) /* Class B */
|
||||
bits = 16;
|
||||
else /* Class A */
|
||||
bits = 8;
|
||||
/* If imputed mask is narrower than specified octets, widen. */
|
||||
if (bits >= 8 && bits < ((dst - odst) * 8))
|
||||
bits = (dst - odst) * 8;
|
||||
}
|
||||
/* Extend network to cover the actual mask. */
|
||||
while (bits > ((dst - odst) * 8)) {
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = '\0';
|
||||
}
|
||||
return (bits);
|
||||
|
||||
enoent:
|
||||
errno = ENOENT;
|
||||
return (-1);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_neta(src, dst, size)
|
||||
* format a u_long network number into presentation format.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* format of ``src'' is as for inet_network().
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_neta(src, dst, size)
|
||||
u_long src;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *tp;
|
||||
|
||||
while (src & 0xffffffff) {
|
||||
u_char b = (src & 0xff000000) >> 24;
|
||||
|
||||
src <<= 8;
|
||||
if (b) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
tp = dst;
|
||||
dst += SPRINTF((dst, "%u", b));
|
||||
if (src != 0L) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - tp);
|
||||
}
|
||||
}
|
||||
if (dst == odst) {
|
||||
if (size < sizeof "0.0.0.0")
|
||||
goto emsgsize;
|
||||
strcpy(dst, "0.0.0.0");
|
||||
}
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
||||
@@ -86,17 +86,21 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
|
||||
|
||||
/* Like the default, except no -lg. */
|
||||
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
||||
/* Like the default, except no -lg, and no -p. */
|
||||
#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
|
||||
|
||||
#define LINK_SPEC \
|
||||
"%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
|
||||
%{p:-Bstatic} %{pg:-Bstatic} %{Z} %{R*}"
|
||||
"%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
|
||||
%{shared:-Bshareable} \
|
||||
%{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
|
||||
%{pg:-Bstatic} %{Z}} \
|
||||
%{assert*} %{R*}"
|
||||
|
||||
#define LINK_LIBGCC_SPECIAL_1 1
|
||||
|
||||
#define STARTFILE_SPEC \
|
||||
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
|
||||
"%{shared:c++rt0.o%s} \
|
||||
%{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
|
||||
|
||||
/* This goes away when the math emulator is fixed. */
|
||||
#undef TARGET_DEFAULT
|
||||
|
||||
@@ -86,17 +86,21 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
|
||||
|
||||
/* Like the default, except no -lg. */
|
||||
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
||||
/* Like the default, except no -lg, and no -p. */
|
||||
#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
|
||||
|
||||
#define LINK_SPEC \
|
||||
"%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*} \
|
||||
%{p:-Bstatic} %{pg:-Bstatic} %{Z} %{R*}"
|
||||
"%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
|
||||
%{shared:-Bshareable} \
|
||||
%{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
|
||||
%{pg:-Bstatic} %{Z}} \
|
||||
%{assert*} %{R*}"
|
||||
|
||||
#define LINK_LIBGCC_SPECIAL_1 1
|
||||
|
||||
#define STARTFILE_SPEC \
|
||||
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
|
||||
"%{shared:c++rt0.o%s} \
|
||||
%{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
|
||||
|
||||
/* This goes away when the math emulator is fixed. */
|
||||
#undef TARGET_DEFAULT
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@ifinfo
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* Reno 1: (reno-1). The GNU C++ Renovation Project, Phase 1.
|
||||
* Reno 1: (reno). The GNU C++ Renovation Project, Phase 1.
|
||||
END-INFO-DIR-ENTRY
|
||||
@end format
|
||||
@end ifinfo
|
||||
|
||||
+9
-3
@@ -1189,13 +1189,17 @@ Like `\|\c
|
||||
.B \-M\c
|
||||
\&\|' but the output mentions only the user header files
|
||||
included with `\|\c
|
||||
.B #include "\c
|
||||
.B
|
||||
#include "\c
|
||||
.I file\c
|
||||
.B
|
||||
\&"\c
|
||||
\&\|'. System header files
|
||||
included with `\|\c
|
||||
.B #include <\c
|
||||
.B
|
||||
#include <\c
|
||||
.I file\c
|
||||
.B
|
||||
\&>\c
|
||||
\&\|' are omitted.
|
||||
.TP
|
||||
@@ -1472,8 +1476,10 @@ option are searched only for the case of `\|\c
|
||||
\&"\c
|
||||
\&\|';
|
||||
they are not searched for `\|\c
|
||||
.B #include <\c
|
||||
.B
|
||||
#include <\c
|
||||
.I file\c
|
||||
.B
|
||||
\&>\c
|
||||
\&\|'.
|
||||
.Sp
|
||||
|
||||
@@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sgtty.h>
|
||||
#include <sys/file.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -27,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include <netinet/tcp.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Sort of a hack... */
|
||||
#define EOL (EOF - 1)
|
||||
@@ -41,13 +42,10 @@ void
|
||||
perror_with_name (string)
|
||||
char *string;
|
||||
{
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
extern int errno;
|
||||
char *err;
|
||||
char *combined;
|
||||
|
||||
err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";
|
||||
err = strerror(errno);
|
||||
combined = (char *) alloca (strlen (err) + strlen (string) + 3);
|
||||
strcpy (combined, string);
|
||||
strcat (combined, ": ");
|
||||
@@ -84,7 +82,6 @@ void
|
||||
remote_open (name)
|
||||
char *name;
|
||||
{
|
||||
struct sgttyb sg;
|
||||
extern char *strchr ();
|
||||
|
||||
if (!strchr (name, ':'))
|
||||
|
||||
@@ -30,10 +30,7 @@ void
|
||||
perror_with_name (string)
|
||||
char *string;
|
||||
{
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
extern int errno;
|
||||
char *err;
|
||||
const char *err;
|
||||
char *combined;
|
||||
|
||||
if (errno < sys_nerr)
|
||||
|
||||
@@ -83,6 +83,12 @@ add_to_objfile_sections (abfd, asect, objfile_p_char)
|
||||
section.objfile = objfile;
|
||||
section.the_bfd_section = asect;
|
||||
section.addr = bfd_section_vma (abfd, asect);
|
||||
#ifdef __FreeBSD__
|
||||
/* 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);
|
||||
#endif
|
||||
section.endaddr = section.addr + bfd_section_size (abfd, asect);
|
||||
obstack_grow (&objfile->psymbol_obstack, (char *) §ion, sizeof(section));
|
||||
objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1);
|
||||
|
||||
@@ -151,6 +151,10 @@
|
||||
.nr cZ \\n(.s
|
||||
.ds aa \&\f\\n(cF\s\\n(cZ
|
||||
.if \\n(.$==2 \{\
|
||||
. if "\\$1"1.0" \&\\*(tNFreeBSD\\*(aa 1.0\\*(aa\\$2
|
||||
. if "\\$1"1.1" \&\\*(tNFreeBSD\\*(aa 1.1\\*(aa\\$2
|
||||
. if "\\$1"1.1.5" \&\\*(tNFreeBSD\\*(aa 1.1.5\\*(aa\\$2
|
||||
. if "\\$1"1.1.5.1" \&\\*(tNFreeBSD\\*(aa 1.1.5.1\\*(aa\\$2
|
||||
. if "\\$1"2.0" \&\\*(tNFreeBSD\\*(aa 2.0\\*(aa\\$2
|
||||
. if "\\$1"2.0.5" \&\\*(tNFreeBSD\\*(aa 2.0.5\\*(aa\\$2
|
||||
. if "\\$1"2.1" \&\\*(tNFreeBSD\\*(aa 2.1\\*(aa\\$2
|
||||
@@ -162,6 +166,10 @@
|
||||
. if "\\$1"3.0" \&\\*(tNFreeBSD\\*(aa 3.0\\*(aa\\$2
|
||||
.\}
|
||||
.if \\n(.$==1 \{\
|
||||
. if "\\$1"1.0" \&\\*(tNFreeBSD\\*(aa 1.0\\*(aa
|
||||
. if "\\$1"1.1" \&\\*(tNFreeBSD\\*(aa 1.1\\*(aa
|
||||
. if "\\$1"1.1.5" \&\\*(tNFreeBSD\\*(aa 1.1.5\\*(aa
|
||||
. if "\\$1"1.1.5.1" \&\\*(tNFreeBSD\\*(aa 1.1.5.1\\*(aa
|
||||
. if "\\$1"2.0" \&\\*(tNFreeBSD\\*(aa 2.0\\*(aa
|
||||
. if "\\$1"2.0.5" \&\\*(tNFreeBSD\\*(aa 2.0.5\\*(aa
|
||||
. if "\\$1"2.1" \&\\*(tNFreeBSD\\*(aa 2.1\\*(aa
|
||||
|
||||
@@ -1536,7 +1536,7 @@
|
||||
. if "\\$1"-literal" \&\\*(lI\c
|
||||
. if "\\$1"-symbolic" \&\\*(sY\c
|
||||
.\}
|
||||
.el .tm Usage .Bf [Em | emphasis | Li | literal | Sy | symbolic] (#\\n(.c)
|
||||
.el .tm Usage .Bf [Em | -emphasis | Li | -literal | Sy | -symbolic] (#\\n(.c)
|
||||
..
|
||||
.de Ef
|
||||
.ds mN Ef
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
@ifinfo
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* gmp: (gmp.info). GNU Multiple Precision Arithmetic Library.
|
||||
* gmp: (gmp). GNU Multiple Precision Arithmetic Library.
|
||||
END-INFO-DIR-ENTRY
|
||||
@end format
|
||||
@end ifinfo
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,7 @@
|
||||
srcdir= @srcdir@/..
|
||||
CC= @CC@
|
||||
OPTFLAG=@OPTFLAG@
|
||||
CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@
|
||||
CFLAGS= -c $(OPTFLAG) @CFLAGS@ -I. -I$(srcdir)/include @CPPFLAGS@ -DGTAGS
|
||||
LDFLAGS=@LDFLAGS@
|
||||
PERL= @vi_cv_path_perl@
|
||||
PERLLIB=@vi_cv_perllib@
|
||||
|
||||
@@ -64,6 +64,9 @@ editor(gp, argc, argv)
|
||||
size_t len;
|
||||
u_int flags;
|
||||
int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
|
||||
#ifdef GTAGS
|
||||
int gtags = 0;
|
||||
#endif
|
||||
char *tag_f, *wsizearg, path[256];
|
||||
|
||||
/* Initialize the busy routine, if not defined by the screen. */
|
||||
@@ -113,10 +116,18 @@ editor(gp, argc, argv)
|
||||
/* Set the file snapshot flag. */
|
||||
F_SET(gp, G_SNAPSHOT);
|
||||
|
||||
#ifdef GTAGS
|
||||
#ifdef DEBUG
|
||||
while ((ch = getopt(argc, argv, "c:D:eFGlRrSsT:t:vw:")) != EOF)
|
||||
#else
|
||||
while ((ch = getopt(argc, argv, "c:eFGlRrSst:vw:")) != EOF)
|
||||
#endif
|
||||
#else
|
||||
#ifdef DEBUG
|
||||
while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF)
|
||||
#else
|
||||
while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF)
|
||||
#endif
|
||||
#endif
|
||||
switch (ch) {
|
||||
case 'c': /* Run the command. */
|
||||
@@ -154,6 +165,11 @@ editor(gp, argc, argv)
|
||||
case 'F': /* No snapshot. */
|
||||
F_CLR(gp, G_SNAPSHOT);
|
||||
break;
|
||||
#ifdef GTAGS
|
||||
case 'G': /* gtags mode. */
|
||||
gtags = 1;
|
||||
break;
|
||||
#endif
|
||||
case 'l': /* Set lisp, showmatch options. */
|
||||
lflag = 1;
|
||||
break;
|
||||
@@ -252,6 +268,10 @@ editor(gp, argc, argv)
|
||||
}
|
||||
if (readonly)
|
||||
*oargp++ = O_READONLY;
|
||||
#ifdef GTAGS
|
||||
if (gtags)
|
||||
*oargp++ = O_GTAGSMODE;
|
||||
#endif
|
||||
if (secure)
|
||||
*oargp++ = O_SECURE;
|
||||
*oargp = -1; /* Options initialization. */
|
||||
|
||||
@@ -80,6 +80,10 @@ OPTLIST const optlist[] = {
|
||||
{"filec", NULL, OPT_STR, 0},
|
||||
/* O_FLASH HPUX */
|
||||
{"flash", NULL, OPT_1BOOL, 0},
|
||||
#ifdef GTAGS
|
||||
/* O_GTAGSMODE FreeBSD2.2 */
|
||||
{"gtagsmode", NULL, OPT_0BOOL, 0},
|
||||
#endif
|
||||
/* O_HARDTABS 4BSD */
|
||||
{"hardtabs", NULL, OPT_NUM, 0},
|
||||
/* O_ICLOWER 4.4BSD */
|
||||
@@ -244,6 +248,9 @@ static OABBREV const abbrev[] = {
|
||||
{"eb", O_ERRORBELLS}, /* 4BSD */
|
||||
{"ed", O_EDCOMPATIBLE}, /* 4BSD */
|
||||
{"ex", O_EXRC}, /* System V (undocumented) */
|
||||
#ifdef GTAGS
|
||||
{"gt", O_GTAGSMODE}, /* FreeBSD2.2 */
|
||||
#endif
|
||||
{"ht", O_HARDTABS}, /* 4BSD */
|
||||
{"ic", O_IGNORECASE}, /* 4BSD */
|
||||
{"li", O_LINES}, /* 4.4BSD */
|
||||
|
||||
@@ -17,7 +17,7 @@ ex, vi, view \- text editors
|
||||
.SH SYNOPSIS
|
||||
.B ex
|
||||
[\c
|
||||
.B -eFRrSsv\c
|
||||
.B -eFGRrSsv\c
|
||||
] [\c
|
||||
.BI -c " cmd"\c
|
||||
] [\c
|
||||
@@ -28,7 +28,7 @@ ex, vi, view \- text editors
|
||||
.br
|
||||
.B vi
|
||||
[\c
|
||||
.B -eFlRrSv\c
|
||||
.B -eFGlRrSv\c
|
||||
] [\c
|
||||
.BI -c " cmd"\c
|
||||
] [\c
|
||||
@@ -39,7 +39,7 @@ ex, vi, view \- text editors
|
||||
.br
|
||||
.B view
|
||||
[\c
|
||||
.B -eFRrSv\c
|
||||
.B -eFGRrSv\c
|
||||
] [\c
|
||||
.BI -c " cmd"\c
|
||||
] [\c
|
||||
@@ -121,6 +121,9 @@ the file during your edit session.)
|
||||
.B \-l
|
||||
Start editing with the lisp and showmatch options set.
|
||||
.TP
|
||||
.B \-G
|
||||
Start editing in gtags mode, as if the gtagsmode option was set.
|
||||
.TP
|
||||
.B \-R
|
||||
Start editing in read-only mode, as if the command name was
|
||||
.IR view ,
|
||||
@@ -429,6 +432,8 @@ commands or cancel partial commands.
|
||||
.TP
|
||||
.B "<control-]>"
|
||||
Push a tag reference onto the tag stack.
|
||||
In gtagsmode, if at the first column of line,
|
||||
locate function references otherwise function definitions.
|
||||
.TP
|
||||
.B "<control-^>"
|
||||
Switch to the most recently edited file.
|
||||
@@ -940,6 +945,9 @@ Grow or shrink the current screen.
|
||||
.B "rew[ind][!]"
|
||||
Rewind the argument list.
|
||||
.TP
|
||||
.B "rta[g][!] tagstring"
|
||||
Edit the file refering the specified tag. (Only in gtagsmode)
|
||||
.TP
|
||||
.B "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
|
||||
Display or set editor options.
|
||||
.TP
|
||||
@@ -1110,6 +1118,9 @@ command line.
|
||||
.B "flash [on]"
|
||||
Flash the screen instead of beeping the keyboard on error.
|
||||
.TP
|
||||
.B "gtagsmode, gt [off]"
|
||||
Use GTAGS and GRTAGS instead of tags.
|
||||
.TP
|
||||
.B "hardtabs, ht [8]"
|
||||
Set the spacing between hardware tab settings.
|
||||
.TP
|
||||
|
||||
@@ -152,6 +152,9 @@ struct _excmd {
|
||||
#define E_SEARCH_WMSG 0x01000000 /* Display search-wrapped message. */
|
||||
#define E_USELASTCMD 0x02000000 /* Use the last command. */
|
||||
#define E_VISEARCH 0x04000000 /* It's really a vi search command. */
|
||||
#ifdef GTAGS
|
||||
#define E_REFERENCE 0x08000000 /* locate function references */
|
||||
#endif
|
||||
u_int32_t flags; /* Current flags. */
|
||||
};
|
||||
|
||||
|
||||
@@ -302,6 +302,13 @@ EXCMDLIST const cmds[] = {
|
||||
"!",
|
||||
"rew[ind][!]",
|
||||
"re-edit all the files in the file argument list"},
|
||||
#ifdef GTAGS
|
||||
/* C_RTAG */
|
||||
{"rtag", ex_rtag_push, E_NEWSCREEN,
|
||||
"!w1o",
|
||||
"[Rr]ta[g][!] [string]",
|
||||
"edit the file containing the tag"},
|
||||
#endif
|
||||
/*
|
||||
* !!!
|
||||
* Adding new commands starting with 's' may break the substitute command code
|
||||
|
||||
@@ -46,6 +46,10 @@ static char *binary_search __P((char *, char *, char *));
|
||||
static int compare __P((char *, char *, char *));
|
||||
static void ctag_file __P((SCR *, TAGF *, char *, char **, size_t *));
|
||||
static int ctag_search __P((SCR *, char *, size_t, char *));
|
||||
#ifdef GTAGS
|
||||
static int getentry __P((char *, char *, char *, char *));
|
||||
static TAGQ *gtag_slist __P((SCR *, char *, int));
|
||||
#endif
|
||||
static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
|
||||
static TAGQ *ctag_slist __P((SCR *, char *));
|
||||
static char *linear_search __P((char *, char *, char *));
|
||||
@@ -89,6 +93,25 @@ ex_tag_first(sp, tagarg)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef GTAGS
|
||||
/*
|
||||
* ex_rtag_push -- ^]
|
||||
* :rtag[!] [string]
|
||||
*
|
||||
* Enter a new TAGQ context based on a ctag string.
|
||||
*
|
||||
* PUBLIC: int ex_rtag_push __P((SCR *, EXCMD *));
|
||||
*/
|
||||
int
|
||||
ex_rtag_push(sp, cmdp)
|
||||
SCR *sp;
|
||||
EXCMD *cmdp;
|
||||
{
|
||||
F_SET(cmdp, E_REFERENCE);
|
||||
return ex_tag_push(sp, cmdp);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ex_tag_push -- ^]
|
||||
* :tag[!] [string]
|
||||
@@ -138,6 +161,12 @@ ex_tag_push(sp, cmdp)
|
||||
}
|
||||
|
||||
/* Get the tag information. */
|
||||
#ifdef GTAGS
|
||||
if (O_ISSET(sp, O_GTAGSMODE)) {
|
||||
if ((tqp = gtag_slist(sp, exp->tag_last, F_ISSET(cmdp, E_REFERENCE))) == NULL)
|
||||
return (1);
|
||||
} else
|
||||
#endif
|
||||
if ((tqp = ctag_slist(sp, exp->tag_last)) == NULL)
|
||||
return (1);
|
||||
|
||||
@@ -969,6 +998,119 @@ notfound: tag_msg(sp, TAG_SEARCH, tag);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef GTAGS
|
||||
/*
|
||||
* getentry --
|
||||
* get tag information from current line.
|
||||
*
|
||||
* gtags temporary file format.
|
||||
* <tag> <lineno> <file> <image>
|
||||
*
|
||||
* sample.
|
||||
* +------------------------------------------------
|
||||
* |main 30 main.c main(argc, argv)
|
||||
* |func 21 subr.c func(arg)
|
||||
*/
|
||||
static int
|
||||
getentry(buf, tag, file, line)
|
||||
char *buf, *tag, *file, *line;
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = tag;
|
||||
while (*buf && !isspace(*buf)) /* tag name */
|
||||
*p++ = *buf++;
|
||||
*p = 0;
|
||||
while (*buf && isspace(*buf)) /* skip blanks */
|
||||
buf++;
|
||||
p = line;
|
||||
while (*buf && !isspace(*buf)) /* line no */
|
||||
*p++ = *buf++;
|
||||
*p = 0;
|
||||
while (*buf && isspace(*buf)) /* skip blanks */
|
||||
buf++;
|
||||
p = file;
|
||||
while (*buf && !isspace(*buf)) /* file name */
|
||||
*p++ = *buf++;
|
||||
*p = 0;
|
||||
|
||||
/* value check */
|
||||
if (strlen(tag) && strlen(line) && strlen(file) && atoi(line) > 0)
|
||||
return 1; /* OK */
|
||||
return 0; /* ERROR */
|
||||
}
|
||||
|
||||
/*
|
||||
* gtag_slist --
|
||||
* Search the list of tags files for a tag, and return tag queue.
|
||||
*/
|
||||
static TAGQ *
|
||||
gtag_slist(sp, tag, ref)
|
||||
SCR *sp;
|
||||
char *tag;
|
||||
int ref;
|
||||
{
|
||||
EX_PRIVATE *exp;
|
||||
TAGF *tfp;
|
||||
TAGQ *tqp;
|
||||
size_t len;
|
||||
int echk;
|
||||
TAG *tp;
|
||||
static char name[80], file[200], line[10];
|
||||
char command[200];
|
||||
char buf[BUFSIZ+1];
|
||||
FILE *fp;
|
||||
|
||||
/* Allocate and initialize the tag queue structure. */
|
||||
len = strlen(tag);
|
||||
CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
|
||||
CIRCLEQ_INIT(&tqp->tagq);
|
||||
tqp->tag = tqp->buf;
|
||||
memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
|
||||
|
||||
/*
|
||||
* Find the tag, only display missing file messages once, and
|
||||
* then only if we didn't find the tag.
|
||||
*/
|
||||
sprintf(command, "global -%s '%s'", ref ? "rx" : "x", tag);
|
||||
if (fp = popen(command, "r")) {
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
if (buf[strlen(buf)-1] == '\n') /* chop(buf) */
|
||||
buf[strlen(buf)-1] = 0;
|
||||
else
|
||||
while (fgetc(fp) != '\n')
|
||||
;
|
||||
if (getentry(buf, name, file, line) == 0) {
|
||||
echk = 1;
|
||||
F_SET(tfp, TAGF_ERR);
|
||||
break;
|
||||
}
|
||||
CALLOC_GOTO(sp, tp,
|
||||
TAG *, 1, sizeof(TAG) + strlen(file) + 1 + strlen(line) + 1);
|
||||
tp->fname = tp->buf;
|
||||
strcpy(tp->fname, file);
|
||||
tp->fnlen = strlen(file);
|
||||
tp->search = tp->fname + tp->fnlen + 1;
|
||||
strcpy(tp->search, line);
|
||||
CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
|
||||
}
|
||||
pclose(fp);
|
||||
}
|
||||
|
||||
/* Check to see if we found anything. */
|
||||
if (tqp->tagq.cqh_first == (void *)&tqp->tagq) {
|
||||
msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
|
||||
free(tqp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
tqp->current = tqp->tagq.cqh_first;
|
||||
return (tqp);
|
||||
|
||||
alloc_err:
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* ctag_slist --
|
||||
* Search the list of tags files for a tag, and return tag queue.
|
||||
|
||||
@@ -47,32 +47,33 @@
|
||||
#define C_RECOVER 46
|
||||
#define C_RESIZE 47
|
||||
#define C_REWIND 48
|
||||
#define C_SUBSTITUTE 49
|
||||
#define C_SCRIPT 50
|
||||
#define C_SET 51
|
||||
#define C_SHELL 52
|
||||
#define C_SOURCE 53
|
||||
#define C_STOP 54
|
||||
#define C_SUSPEND 55
|
||||
#define C_T 56
|
||||
#define C_TAG 57
|
||||
#define C_TAGNEXT 58
|
||||
#define C_TAGPOP 59
|
||||
#define C_TAGPREV 60
|
||||
#define C_TAGTOP 61
|
||||
#define C_TCLCMD 62
|
||||
#define C_UNDO 63
|
||||
#define C_UNABBREVIATE 64
|
||||
#define C_UNMAP 65
|
||||
#define C_V 66
|
||||
#define C_VERSION 67
|
||||
#define C_VISUAL_EX 68
|
||||
#define C_VISUAL_VI 69
|
||||
#define C_VIUSAGE 70
|
||||
#define C_WRITE 71
|
||||
#define C_WN 72
|
||||
#define C_WQ 73
|
||||
#define C_XIT 74
|
||||
#define C_YANK 75
|
||||
#define C_Z 76
|
||||
#define C_SUBTILDE 77
|
||||
#define C_RTAG 49
|
||||
#define C_SUBSTITUTE 50
|
||||
#define C_SCRIPT 51
|
||||
#define C_SET 52
|
||||
#define C_SHELL 53
|
||||
#define C_SOURCE 54
|
||||
#define C_STOP 55
|
||||
#define C_SUSPEND 56
|
||||
#define C_T 57
|
||||
#define C_TAG 58
|
||||
#define C_TAGNEXT 59
|
||||
#define C_TAGPOP 60
|
||||
#define C_TAGPREV 61
|
||||
#define C_TAGTOP 62
|
||||
#define C_TCLCMD 63
|
||||
#define C_UNDO 64
|
||||
#define C_UNABBREVIATE 65
|
||||
#define C_UNMAP 66
|
||||
#define C_V 67
|
||||
#define C_VERSION 68
|
||||
#define C_VISUAL_EX 69
|
||||
#define C_VISUAL_VI 70
|
||||
#define C_VIUSAGE 71
|
||||
#define C_WRITE 72
|
||||
#define C_WN 73
|
||||
#define C_WQ 74
|
||||
#define C_XIT 75
|
||||
#define C_YANK 76
|
||||
#define C_Z 77
|
||||
#define C_SUBTILDE 78
|
||||
@@ -89,6 +89,7 @@ int re_compile __P((SCR *,
|
||||
char *, size_t, char **, size_t *, regex_t *, u_int));
|
||||
void re_error __P((SCR *, int, regex_t *));
|
||||
int ex_tag_first __P((SCR *, char *));
|
||||
int ex_rtag_push __P((SCR *, EXCMD *));
|
||||
int ex_tag_push __P((SCR *, EXCMD *));
|
||||
int ex_tag_next __P((SCR *, EXCMD *));
|
||||
int ex_tag_prev __P((SCR *, EXCMD *));
|
||||
|
||||
@@ -16,64 +16,65 @@
|
||||
#define O_EXTENDED 15
|
||||
#define O_FILEC 16
|
||||
#define O_FLASH 17
|
||||
#define O_HARDTABS 18
|
||||
#define O_ICLOWER 19
|
||||
#define O_IGNORECASE 20
|
||||
#define O_KEYTIME 21
|
||||
#define O_LEFTRIGHT 22
|
||||
#define O_LINES 23
|
||||
#define O_LISP 24
|
||||
#define O_LIST 25
|
||||
#define O_LOCKFILES 26
|
||||
#define O_MAGIC 27
|
||||
#define O_MATCHTIME 28
|
||||
#define O_MESG 29
|
||||
#define O_MODELINE 30
|
||||
#define O_MSGCAT 31
|
||||
#define O_NOPRINT 32
|
||||
#define O_NUMBER 33
|
||||
#define O_OCTAL 34
|
||||
#define O_OPEN 35
|
||||
#define O_OPTIMIZE 36
|
||||
#define O_PARAGRAPHS 37
|
||||
#define O_PATH 38
|
||||
#define O_PRINT 39
|
||||
#define O_PROMPT 40
|
||||
#define O_READONLY 41
|
||||
#define O_RECDIR 42
|
||||
#define O_REDRAW 43
|
||||
#define O_REMAP 44
|
||||
#define O_REPORT 45
|
||||
#define O_RULER 46
|
||||
#define O_SCROLL 47
|
||||
#define O_SEARCHINCR 48
|
||||
#define O_SECTIONS 49
|
||||
#define O_SECURE 50
|
||||
#define O_SHELL 51
|
||||
#define O_SHELLMETA 52
|
||||
#define O_SHIFTWIDTH 53
|
||||
#define O_SHOWMATCH 54
|
||||
#define O_SHOWMODE 55
|
||||
#define O_SIDESCROLL 56
|
||||
#define O_SLOWOPEN 57
|
||||
#define O_SOURCEANY 58
|
||||
#define O_TABSTOP 59
|
||||
#define O_TAGLENGTH 60
|
||||
#define O_TAGS 61
|
||||
#define O_TERM 62
|
||||
#define O_TERSE 63
|
||||
#define O_TILDEOP 64
|
||||
#define O_TIMEOUT 65
|
||||
#define O_TTYWERASE 66
|
||||
#define O_VERBOSE 67
|
||||
#define O_W1200 68
|
||||
#define O_W300 69
|
||||
#define O_W9600 70
|
||||
#define O_WARN 71
|
||||
#define O_WINDOW 72
|
||||
#define O_WINDOWNAME 73
|
||||
#define O_WRAPLEN 74
|
||||
#define O_WRAPMARGIN 75
|
||||
#define O_WRAPSCAN 76
|
||||
#define O_WRITEANY 77
|
||||
#define O_OPTIONCOUNT 78
|
||||
#define O_GTAGSMODE 18
|
||||
#define O_HARDTABS 19
|
||||
#define O_ICLOWER 20
|
||||
#define O_IGNORECASE 21
|
||||
#define O_KEYTIME 22
|
||||
#define O_LEFTRIGHT 23
|
||||
#define O_LINES 24
|
||||
#define O_LISP 25
|
||||
#define O_LIST 26
|
||||
#define O_LOCKFILES 27
|
||||
#define O_MAGIC 28
|
||||
#define O_MATCHTIME 29
|
||||
#define O_MESG 30
|
||||
#define O_MODELINE 31
|
||||
#define O_MSGCAT 32
|
||||
#define O_NOPRINT 33
|
||||
#define O_NUMBER 34
|
||||
#define O_OCTAL 35
|
||||
#define O_OPEN 36
|
||||
#define O_OPTIMIZE 37
|
||||
#define O_PARAGRAPHS 38
|
||||
#define O_PATH 39
|
||||
#define O_PRINT 40
|
||||
#define O_PROMPT 41
|
||||
#define O_READONLY 42
|
||||
#define O_RECDIR 43
|
||||
#define O_REDRAW 44
|
||||
#define O_REMAP 45
|
||||
#define O_REPORT 46
|
||||
#define O_RULER 47
|
||||
#define O_SCROLL 48
|
||||
#define O_SEARCHINCR 49
|
||||
#define O_SECTIONS 50
|
||||
#define O_SECURE 51
|
||||
#define O_SHELL 52
|
||||
#define O_SHELLMETA 53
|
||||
#define O_SHIFTWIDTH 54
|
||||
#define O_SHOWMATCH 55
|
||||
#define O_SHOWMODE 56
|
||||
#define O_SIDESCROLL 57
|
||||
#define O_SLOWOPEN 58
|
||||
#define O_SOURCEANY 59
|
||||
#define O_TABSTOP 60
|
||||
#define O_TAGLENGTH 61
|
||||
#define O_TAGS 62
|
||||
#define O_TERM 63
|
||||
#define O_TERSE 64
|
||||
#define O_TILDEOP 65
|
||||
#define O_TIMEOUT 66
|
||||
#define O_TTYWERASE 67
|
||||
#define O_VERBOSE 68
|
||||
#define O_W1200 69
|
||||
#define O_W300 70
|
||||
#define O_W9600 71
|
||||
#define O_WARN 72
|
||||
#define O_WINDOW 73
|
||||
#define O_WINDOWNAME 74
|
||||
#define O_WRAPLEN 75
|
||||
#define O_WRAPMARGIN 76
|
||||
#define O_WRAPSCAN 77
|
||||
#define O_WRITEANY 78
|
||||
#define O_OPTIONCOUNT 79
|
||||
@@ -226,6 +226,11 @@ v_tagpush(sp, vp)
|
||||
ARGS *ap[2], a;
|
||||
EXCMD cmd;
|
||||
|
||||
#ifdef GTAGS
|
||||
if (O_ISSET(sp, O_GTAGSMODE) && vp->m_start.cno == 0)
|
||||
ex_cinit(&cmd, C_RTAG, 0, OOBLNO, 0, 0, ap);
|
||||
else
|
||||
#endif
|
||||
ex_cinit(&cmd, C_TAG, 0, OOBLNO, 0, 0, ap);
|
||||
ex_cadd(&cmd, &a, VIP(sp)->keyw, strlen(VIP(sp)->keyw));
|
||||
return (v_exec_ex(sp, vp, &cmd));
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
William LeFebvre
|
||||
Group sys Consulting
|
||||
[email protected]
|
||||
+1-770-813-3224
|
||||
|
||||
|
||||
William LeFebvre is available for consulting and teaching engagements
|
||||
through the company Group sys Consulting. William's specialties are:
|
||||
|
||||
Unix system administration issues
|
||||
Local area network design
|
||||
Design of safe connections to the Internet
|
||||
Domain Name Service
|
||||
Unix and Internet security
|
||||
INN news server configuration
|
||||
SunOS to Solaris migration
|
||||
Troubleshooting
|
||||
|
||||
|
||||
Although located in the Atlanta metropolitan area, William can easily
|
||||
travel to any location in the United States and Canada. Trips to
|
||||
other countries can be arranged as well.
|
||||
|
||||
If you are interested in having William work for your organization,
|
||||
contact him at +1-770-813-3224 or via the address "[email protected]".
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
Thu Aug 29 1996 - wnl (3.4)
|
||||
Replaced modules (from Tim Pugh): next 32, next40.
|
||||
Fixed bug in username.c: hashing negative uids.
|
||||
|
||||
Thu Aug 22 1996 - wnl (3.4beta3)
|
||||
Patched modules: ultrix4, sunos4, sunos5, utek, decosf1, irix5.
|
||||
Added modules: next40, next32.
|
||||
Fixed procstates update bug in display.c.
|
||||
Fixed divide by zero bug in utils.c.
|
||||
Fixed bad number in layout.h
|
||||
Minor fixes to Configure.
|
||||
Complete overhaul of FAQ.
|
||||
|
||||
Tue Feb 13 1996 - wnl (3.4beta3)
|
||||
Added convex module from Warren Vosper (originally written by
|
||||
William Jones).
|
||||
|
||||
Tue Feb 13 1996 - wnl (3.4beta2)
|
||||
Fixed format_k in utils.c to calculate K and M values correctly.
|
||||
Added check for gigabyte values ('G'). Changed sumamry_format
|
||||
in display.c to use format_k where appropriate.
|
||||
Changed creation of distribution tar file to place everything in
|
||||
a top level directory.
|
||||
|
||||
Tue Jan 30 1996 - wnl (3.4beta2)
|
||||
Added m_aix41 module. Added new tag type to module comments:
|
||||
TERMCAP, which defined the library to use for a termcap library.
|
||||
If no TERMCAP tag is found in the module's initial comment, then
|
||||
Configure will default to "-ltermcap". AIX needs this since it
|
||||
put all the termcap routines in libcurses(!)
|
||||
|
||||
Added m_bsdos2 (found lingering in my mailbox).
|
||||
Updated m_svr4 to include support for NCR multiprocessors.
|
||||
Fixed small bug in utils.c
|
||||
|
||||
Thu Jan 25 1996 - wnl (3.4beta1)
|
||||
Fixed m_sunos5 invocation of gettimeofday to include "NULL" as
|
||||
second argument. This provides compatability with the Posix-
|
||||
compliant template provided with SunOS 5.5, but doesn't hurt
|
||||
previous versions since they do bother with a template for that
|
||||
function.
|
||||
|
||||
Made changes (recommended by net users) to hpux10, ultrix4,
|
||||
netbsd10, aux3 (replaced aux31). Added module for linux.
|
||||
|
||||
Fri Oct 10 1995 - wnl (3.4beta1)
|
||||
Added user-contributed modules for SCO Unix, IRIX 5, HP/UX 10,
|
||||
Pyramid DC/OSX. Changed Configure so that it runs in environments
|
||||
whose c-shells have no 'eval'(!). Added support for multiple sort
|
||||
ordering methods via the -o switch. This option requires support
|
||||
from the machine dependent module: such support was added to
|
||||
sunos5 (thus sunos54) and sunos4.
|
||||
|
||||
display.c: Changed CPU states display line to shorten the leading
|
||||
tag if the data won't fit in the current width. Fixed a divide-by-
|
||||
zero bug that affected ultrasparc servers (and potentially other
|
||||
systems).
|
||||
|
||||
m_sunos5.c: Now asks the system for the correct pagesize rather than
|
||||
assuming it is 4K.
|
||||
|
||||
Thu Mar 2 1995 - wnl (3.3 RELEASE)
|
||||
Added module netbsd10 and renamed netbsd to netbsd08. Changed
|
||||
Configure so that it does not use an initial default module name.
|
||||
Made other compatability fixes to Configure. Added comments to
|
||||
decosf1 concerning optimizer bug. Other documentation changes.
|
||||
Added use of "prime.c" to Configure script.
|
||||
|
||||
Tue Feb 7 1995 - wnl (3.3beta6)
|
||||
Still one more beta....
|
||||
Fixes for sunos5 2.4 gcc core dump (it was an alignment problem).
|
||||
Fixed and improvements for decosf1 (including use of format_k
|
||||
for proper SIZE column formatting). Added modules freebsd20 and
|
||||
ncr3000.
|
||||
|
||||
Thu Feb 2 1995 - wnl (3.3beta5)
|
||||
One more beta....
|
||||
Fixed a few bugs in the sunos5 port pertaining to casting and
|
||||
very large memory counts. Added "ifndef HAVE_GETOPT" to getopt.c
|
||||
to provide for conditional compilation of the getopt function.
|
||||
Those systems that have getopt in libc can add -DHAVE_GETOPT to
|
||||
the CFLAGS line in the module to prevent the function from being
|
||||
compiled. Added sunos54 module to accomodate SunOS 5.4
|
||||
peculiarities. Added module for aux3.1.
|
||||
|
||||
Wed Jan 4 1995 - wnl (3.3beta4)
|
||||
This is really taking too long......sigh.
|
||||
Fixed SIGWINCH handling once and for all. It now remembers the
|
||||
number of processes you want displayed even thru window resizes.
|
||||
Fixed buffer conflict in utils.c (itoa and itoa7).
|
||||
Lots of small improvements to the various modules were made over
|
||||
the past month: too numberous to list here. SunOS 5 module made
|
||||
more secure thru use of seteuid calls (other SVR4 modules should
|
||||
be modified similarly). One final MP fix to sunos5, too. Module
|
||||
for decosf1 was modified to accomodate V3.0.
|
||||
|
||||
Mon Apr 18 1994 - wnl (3.3beta3)
|
||||
I think I finally got a sunos5 module that will work on MP
|
||||
machines. Fixed cpu states figure in osmp41a so that
|
||||
percentages never exceed 100%. Added shell script "install"
|
||||
since Unix vendors can't seem to make up their minds on what
|
||||
options they want to use for the one that comes with the OS.
|
||||
Added netbsd modules from Christos. Fixed lots of other little
|
||||
things over the past few months that I have long since forgotten.
|
||||
|
||||
Wed Dec 15 1993 - wnl (3.3beta2)
|
||||
Added module patches from various users: hpux9, sunos5.
|
||||
Fixed bug with batch mode (screen_width wasn't getting set).
|
||||
Changes to accomodate 64 bit machines.
|
||||
Fixed some bugs in command parsing ("renice 19 " did something
|
||||
unexpected).
|
||||
|
||||
Mon Aug 30 1993 - wnl (3.3beta)
|
||||
Added lots of little patches from various users.
|
||||
Added routines to utils.c for intelligent formatting of kilobytes
|
||||
and time. These are intended to be used in the modules when
|
||||
formatting a process line. Added code to "summary_format" in
|
||||
display.c to do intelligent formatting of memory quantities.
|
||||
Redid display.c to allow for varying line widths and dynamic
|
||||
reallocation of the screen buffer.
|
||||
Added a SIGWINCH handler to top.c!
|
||||
Added a constant, MAX_COLS, to top.h which defines the absolute
|
||||
widest line we will ever allow. Changed allocations of "char fmt"
|
||||
in all machine modules to use this constant rather than an abitrary
|
||||
number.
|
||||
|
||||
Fri Aug 13 1993 - wnl (3.3)
|
||||
Changed return value definition of time-related functions in top.c,
|
||||
display.c, and m_ultrix4.c to time_t ([email protected]).
|
||||
Fixed bug in display.c: line_update when start != 0.
|
||||
|
||||
Wed Aug 4 1993 - wnl (3.2 release)
|
||||
Changes to Configure from Paul Vixie. Added modules for hpux9 and
|
||||
bsd386.
|
||||
|
||||
Tue Jul 13 1993 - wnl (3.1 release)
|
||||
More small changes and minor bug fixes. Brought bsd44 up to date
|
||||
and added a module for svr4.2. Changed shar packaging to use Rich
|
||||
Salz's cshar stuff.
|
||||
|
||||
Wed Jul 7 1993 - wnl (3.1BETA)
|
||||
More changes and bug fixes to Configure. Applied some other
|
||||
minor bug fixes and suggestions from the beta testers. Added
|
||||
the "metatop" shell script and the "installmeta" rule to the
|
||||
Makefile to make handling multiple machine models and OS versions
|
||||
easier. Added INSTALL and FAQ files.
|
||||
|
||||
Tue May 18 1993 - wnl (3.1BETA)
|
||||
Changed Configure to be compatible with most SVR4 environments
|
||||
(differing output from "ls -lg"). Also changed Configure,
|
||||
Makefile.X, etc., to look for module files in the subdirectory
|
||||
"machine" (thanks to Christos Zoulas).
|
||||
|
||||
Tue Apr 20 1993 - wnl (3.1BETA)
|
||||
Changed both occurences of "ls -1" in Configure to "ls". This
|
||||
SHOULD produce the same result, and has the advantage that it
|
||||
doesn't produce an error on a system 5 machine. Integrated other
|
||||
changes recommended in the first round of beta testing.
|
||||
|
||||
Wed Mar 10 1993 - wnl (3.1BETA)
|
||||
MAJOR CHANGE: I have added a required function to all machine
|
||||
dependent modules, called proc_owner. It takes a pid as an argument
|
||||
and returns the uid of the process's owner. Such capability is
|
||||
necessary for top to run securely as a set-uid program, something
|
||||
that is needed for SVR4 implementations to read /proc. I have
|
||||
retrofitted all modules except dgux with this function, but was
|
||||
not able to test most of them. Top should now run securely as
|
||||
a setuid program. Added 386bsd and sunos5 modules. Added sunos4mp
|
||||
module for MP Suns.
|
||||
|
||||
Sat Feb 20 1993 - wnl (3.1ALPHA)
|
||||
Modified top.c and commands.c to compile correctly on System V
|
||||
derived Unixes (especially SVR4), but in a way that doesn't rely
|
||||
on an oracle-like declaration (that is, I don't use "ifdef SYSV").
|
||||
Fixed some bugs in "Configure" and "getans". Added inspection of
|
||||
env variable "TOP" for options, and made -I default to showing
|
||||
idle processes. Added "u" command to change username restriction
|
||||
on the fly. Created shell script "suntop" for poor multi-version
|
||||
SunOS folks (like myself).
|
||||
|
||||
Wed Jun 3 1992 - wnl (3.0)
|
||||
"max_topn" wasn't being used everywhere it was supposed to be
|
||||
in top.c. Many cosmetic changes, including copyright notices in
|
||||
all the .c files. Version number is now handled by version.c and
|
||||
reflects the current patchlevel (which is initially set to 0).
|
||||
Changed Configure and Makefile to allow configurable variables for
|
||||
certain commands: shell, cc, awk, install. Updated README and
|
||||
Porting. Ready to release to the world!
|
||||
|
||||
Mon May 18 1992 - wnl (2.9BETA)
|
||||
Added modules provided by Christos Zoulas. Replaced screen.c
|
||||
with one modified by Christos and that will appropriately select
|
||||
and handle the sgtty, termio, or termios system. Integrated many
|
||||
other changes recommended by Christos. Fixed (I hope) the "-b"
|
||||
batch mode display bug. Had to change loadavg to load_avg to avoid
|
||||
a conflict with 4.4BSD.
|
||||
|
||||
Mon Apr 27 1992 - wnl (2.8BETA)
|
||||
Added modules provided by Daniel Trinkle. Added patchlevel.h,
|
||||
but the patch level is not yet reflected in the version number.
|
||||
Cleaned up m_sunos4.c a little.
|
||||
|
||||
Wed Apr 22 1992 - wnl (2.8BETA)
|
||||
Major internal reorganization. All of the system dependent stuff
|
||||
is now really and truly separated from everything else. The
|
||||
system dependent functions are contained in a separate .c file
|
||||
called a "module". The Configure script knows how to find and
|
||||
set up these modules, but the human installer still needs to tell
|
||||
Configure which module to use (no automagic determination of
|
||||
machine type---sorry). Added -U option to specify one user's
|
||||
processes, but there is no corresponding command...yet. Other
|
||||
changes and improvements too numerous to mention here. Currently
|
||||
there are only two modules: sunos4 and umax. But after this beta
|
||||
release is sent around, I expect more to be written. I just hope
|
||||
that the machine-dependent abstractions don't need to change in
|
||||
the process.
|
||||
|
||||
Thu Mar 26 1992 - wnl (2.7BETA)
|
||||
Beta release with minimal architecture support. Updated README
|
||||
and added a first cut at a Porting guide. Added ioctl TIOCGWINSZ
|
||||
code from top2.5+ (courtesy of David MacKenzie). I didn't even
|
||||
try porting the Ultrix support since I don't have access to an
|
||||
Ultrix machine.
|
||||
|
||||
Fri Oct 11 1991 - wnl (2.6)
|
||||
This version was not widely released. It contained many changes.
|
||||
Here are the major ones:
|
||||
|
||||
Put in Vixie's idle process hack.
|
||||
|
||||
Enhanced type field in new_message to handle delayed messages.
|
||||
|
||||
Changed u_process to automatically adjust for varying lines of
|
||||
output. Management of screenbuf should now be completely contained
|
||||
in display.c. Removed now extraneous code from CMD_number[12]
|
||||
portion of command switch in top.c. This was the stuff that dealt
|
||||
with zeroing out lines in screenbuf.
|
||||
|
||||
Finally made it all work correctly on a 386i. Problems I had to
|
||||
overcome: kvm_nlist doesn't return 0 on success as advertised (it
|
||||
returns 1 instead); the results of a kvm_nlist are different
|
||||
(n_type can be zero even for a symbol that exists).
|
||||
|
||||
Serious rearrangement for processor dependent stuff. All nlists
|
||||
are now in separate files with the suffix ".nlist". Most machine
|
||||
specific code is in "machine.c" surrounded by appropriate ifdefs---
|
||||
the goal is to eventually have all machine specific code in this
|
||||
file. Managed to find a way to detect SunOS 4.x at compile-time:
|
||||
this is contained in the include file "sun.h". Completely changed
|
||||
the memory display line for SunOS 4.x---it now displays a far
|
||||
more appropriate report.
|
||||
|
||||
Created the shell script "Configure" to aid in the configuration
|
||||
step.
|
||||
|
||||
Fixed a bug in init_termcap: it will now tolerate an environment
|
||||
which does not have TERM defined (thanks to Sam Horrocks for
|
||||
pointing this out).
|
||||
|
||||
Tue Aug 9 1988 - wnl (2.5)
|
||||
Added changes to make top work under version 4.0 of the Sun
|
||||
operating system. Changes were provided by Scott Alexander of the
|
||||
University of Pennsylvania. Thanks! Compile with "-Dsunos4" to
|
||||
get them. Virtual memory statistics are not readily accessible
|
||||
under 4.0, so they don't show up in the output.
|
||||
|
||||
Thu Jul 31 1987 - wnl (2.4)
|
||||
Fixed a problem with the 4.0 Pyramid code. The label "cp_time"
|
||||
doesn't exist in the 4.0 kernel anymore. I think the code Carl
|
||||
sent me wants "percpu" instead. That is what I am using and it
|
||||
appears to work. 375 code is still untested (at least by me).
|
||||
Also picked a great deal of lint out of the source. Lint now only
|
||||
complains about a very few nitpicky things (there are far too many
|
||||
calls to "printf" to put a "(void)" in front of!), at least under
|
||||
SunOS.
|
||||
|
||||
Tue Jul 28 1987 - wnl (2.4a)
|
||||
Added changes for a Symmetrics Computer Systems s/375 machine.
|
||||
Changes were provided by Paul Vixie. Thanks! According to Mr.
|
||||
Vixie: "These changes were not made at, by, or for SCS proper.
|
||||
SCS would probably be interested in them, but so far only the
|
||||
users' group has them. They were made in February, 1987, to
|
||||
version 2.1 of the program, by Paul Vixie
|
||||
([email protected])." His changes were
|
||||
integrated into version 2.3 to make version 2.4.
|
||||
|
||||
The SCS peculiarities are summarized in Changes.scs.
|
||||
|
||||
Tue Jun 9 1987 - wnl (2.3 for real)
|
||||
Changed the includes for the extra code Carl sent me to only
|
||||
compile on Version 4.0 Pyramid machines. This makes top still
|
||||
compilable on pre-4.0 Pyramids. Specifically, this code is only
|
||||
compiled when both "pyr" and "CPUFOUND" are defined.
|
||||
|
||||
Wed Jun 3 1987 - wnl (2.3 with Pyramid additions)
|
||||
It's been a month and I still haven't done anything about
|
||||
distributing this version. However, Carl Gutekunst from Pyramid
|
||||
has sent me some extra patches for some of the Pyramid code. I
|
||||
just added those and will make them part of 2.3. This fixes the
|
||||
following Pyramid problems: adds the inclusion of <sys/systm.h>,
|
||||
uses the correct size for getting the kernel value _ccpu (this bug
|
||||
affected the Vax version as well), sums the elements of the percpu
|
||||
array to calculate a cp_time value (for OSx 4.0).
|
||||
|
||||
Fri May 1 1987 - wnl (2.3)
|
||||
I have finally finished all the changes for better support of
|
||||
oddbal terminals. Added the low-level routine "clear_eol" which
|
||||
makes handling terminals without "ce" easy: it uses spaces
|
||||
instead. All direct uses of "clear_line" outside of screen.c have
|
||||
been changed to use this primitive. A terminal with "os" is now
|
||||
handled in such that all situations that need overwriting are
|
||||
completely avoided (including several commands). This required
|
||||
some changes to the way commands are translated into action (in
|
||||
"top.c"). Made several important changes to display.c to prevent
|
||||
overflowing of any of the fields. Specifically, more than 99
|
||||
total processes and a cpu state that reaches 100%. Had to make a
|
||||
small change to two casts in top.c, because the Sun 3.2 compiler
|
||||
was giving warnings on them. Added the "-q" option which lets
|
||||
root run top at a nice of -20 (in case he thinks he really needs it).
|
||||
|
||||
Tue Dec 30 1986 - wnl (2.2)
|
||||
I think I fixed a bug reported by Julian Onions at Nottingham.
|
||||
Occasionally, top will core dump when the sprintf in either
|
||||
i_process or u_process overflows due to an exceptionally
|
||||
unrealistic time value. I think it highly unlikely that top can
|
||||
get a bad proc structure (although I suppose it is possible), but
|
||||
the process time is read from the user structure, and that can
|
||||
sometimes be part garbage. So, "get_ucpu" checks the value it
|
||||
returns to make sure its formatted form will not overflow the
|
||||
sprintf. If this doesn't fix the bug, then more drastic measures
|
||||
will be necessary. I plan to make this version the official
|
||||
"top 2.2". [[ This version was never distributed very widely. ]]
|
||||
|
||||
Tue Dec 2 1986 - wnl (2.2c)
|
||||
Added to top.c the notion of a "failed command". When a command
|
||||
produces a message (on the message line), an update does not
|
||||
follow it. Before, the message was written and a new display was
|
||||
shown---purposefully not overwriting the message. But the
|
||||
improvements to handle overstriking terminals and terminals
|
||||
without "ce" clear the screen before every display, which would
|
||||
erase the message. Now, the message is displayed and top waits
|
||||
another full time interval before updating the display. This
|
||||
works much better all around.
|
||||
|
||||
Mon Nov 24 1986 - wnl (2.2b)
|
||||
Created a new file, utils.c, and made appropriate changes to
|
||||
Makefile. This new file holds all utility functions that can and
|
||||
may be used by more than one "module". Improved i_memory and
|
||||
u_memory (display.c) so that screen updates for the values
|
||||
displayed are only changed when necessary. Also made the line
|
||||
look better: the last fixes made for a rather ugly display.
|
||||
Added the locally defined constant "LoadMax" and added code to
|
||||
top.c to send the cursor home after a space command is entered if
|
||||
the load average is higher than "LoadMax". This provides visual
|
||||
feedback on loaded systems.
|
||||
|
||||
Mon Nov 3 1986 - wnl (2.2a)
|
||||
Widened the format for memory usage so that it can display 5
|
||||
digits. This makes that line look a little ugly---maybe I'll fix
|
||||
that later. Screen handling now understands "os" and a missing
|
||||
"ce". It treats them identically: clear the screen between each
|
||||
display. Screen handling code now uses "cd" when appropriate
|
||||
(i.e.: when user has shortened the screen). Made i_loadave clear
|
||||
then screen and took out most of the explicit calls to "clear" in
|
||||
top.c. This method is cleaner, especially in conjunction with
|
||||
"os" handling. Added preprocessor variable "RANDOM_PW" for
|
||||
systems that access the passwd file randomly (Sun's yp and 4.3).
|
||||
With "RANDOM_PW" set, "getpwuid" is used instead of "getpwnam",
|
||||
but uid->username mappings are still hashed internally (because
|
||||
that is still faster than going to disk).
|
||||
|
||||
Mon Oct 6 1986 - wnl (2.1)
|
||||
A bug with the kill command was pointed out by "dciem!tim"---
|
||||
specifying a signal by name did not work correctly. This bug has
|
||||
been fixed with a simple change to commands.c. Another bug made
|
||||
the cpu state percentages incorrect the first time they were
|
||||
displayed. This bug has also been fixed (changed top.c).
|
||||
|
||||
Thu Sep 4 1986 - wnl (2.0, at last)
|
||||
This is the version that will (hopefully) get released to the
|
||||
world as top 2.0.
|
||||
Added the "r" and "k" commands for renice and kill, respectively.
|
||||
This required adding a way to handle system call errors, and the
|
||||
addition of the "e" command. Help screen and manual page were
|
||||
changed to reflect this change. Changed all "#ifdef SUN" directives
|
||||
to "#ifdef sun", and changed all "#ifdef PYRAMID" directives to
|
||||
"#ifdef pyr". As much as I hate those choices of preprocessor
|
||||
names (they too easily conflict with real variable names), it does
|
||||
make automatic compilation possible---people don't have to change
|
||||
the Makefile anymore for specific machines. The manual page was
|
||||
changed to automatically incorporate the defaults as set in the
|
||||
Makefile (including an infinite value for TOPN) and the way the
|
||||
manual page is generated by the Makefile was changed to make
|
||||
maintenance of this information automatic.
|
||||
|
||||
Mon Jul 28 1986 - wnl (still pre 2.0)
|
||||
Real close now. I put in a new definition for the macro "pagetok"
|
||||
that does an explicit shift of a constant expression involving
|
||||
PGSHIFT. Appropriate checks are made if PGSHIFT is to small.
|
||||
"pagetok" is now used exclusively everywhere to convert kernel
|
||||
clicks to kilobytes. I added a full blown interactive mode with
|
||||
the ability to change some of the runtime parameters (how many to
|
||||
display, time delay, etc.) while top is running. I also
|
||||
incorporated a few ideas from the net: control characters in the
|
||||
command name are replaced with '?'; the '-S' option makes the
|
||||
swapper and pager visible; options have been added to control the
|
||||
number of displays produced (this makes it easier to make
|
||||
performance snapshots with top). I have also added the notion of
|
||||
"infinite" values for number of processes and number of displays.
|
||||
I fixed a long-standing bug in the uid to username mapping code
|
||||
that was only aggravated on the pyramids: it was an ill-defined
|
||||
expression (akin to i = i++). I tweaked the proc_compar routine
|
||||
for qsort slightly so that stopped processes were more likely to
|
||||
show up. Manual page was updated to reflect all changes
|
||||
noticeable to the user.
|
||||
|
||||
Tue Jul 1 1986 - wnl (pre 2.0 -- 1.9999?)
|
||||
In the process of major revamping on the way to version 2.0.
|
||||
I have completely done away with curses by adding my own screen
|
||||
management routines in a separate file (screen.c). The rationale
|
||||
for this is that top knows a whole lot more about what is and is
|
||||
not redundant on the screen and can compare simple integer values
|
||||
where curses would have to compare strings. This has turned out
|
||||
to be a very big win speed-wise. The proc_compar routine for
|
||||
sorting has been rewritten to include several more keys. I
|
||||
decided this was necessary when I noticed that the "top" process
|
||||
itself kept disappearing off the top 10 list on a Sun-3. All the
|
||||
processes had the same percentage (0%) and the sort wasn't really
|
||||
doing anything worthwhile. I changed the expression that computes
|
||||
memory usage to use the ctob macro instead of just assuming that
|
||||
pages were 512 bytes. More work still needs to be done before
|
||||
this version is usable. I changed options-processing to use
|
||||
getopt and added appropriate incantations to the Makefile.
|
||||
|
||||
Wed Feb 20 1985 - wnl (still 1.8)
|
||||
Put in the ifdef FOUR_ONE statements to make top still compilable
|
||||
on a 4.1 system. Apparently, there are some users out there that
|
||||
need this functionality. Oh well. I don't guarantee any of it,
|
||||
since I can't test it. Made appropriate changes to README and
|
||||
final installation related changes to Makefile.
|
||||
|
||||
Sat Feb 2 1985 - wnl (1.8)
|
||||
Removed all the ifdef FOUR_TWO statements and made "top" into a
|
||||
4.2 only program. If someone really wants to still run it on 4.1,
|
||||
then they can do all the work. We don't have a 4.1 machine
|
||||
anymore, so I don't even know if the thing still works under 4.1.
|
||||
Cleaned up the Makefile and the README. Added installation rules
|
||||
to the Makefile, as requested by several sites. Fixed a very
|
||||
obscure divide-by-zero bug. Added a second "key" to the qsort
|
||||
comparison function (proc_compar) so that comparisons are based on
|
||||
cpu ticks if the percentages are equal (provided by Jonathon
|
||||
Feiber at Sun).
|
||||
|
||||
Tue Dec 11 1984 - wnl (1.7)
|
||||
Added the virtual and real memory status line to the header area
|
||||
(provided by Jonathon Feiber at Sun)
|
||||
|
||||
Tue Nov 20 1984 - wnl (1.6)
|
||||
Added an "exit" if sbrk's fail. Added changes from Jonathon
|
||||
Feiber at Sun: ifdef SUN to make top work on Suns (they don't use
|
||||
doubles in the proc structure), register declarations, check for
|
||||
getting a user structure that has disappeared since the proc array
|
||||
was read (it used to die, now it just shows the process as swapped).
|
||||
|
||||
Tue Nov 13 1984 - wnl (1.5)
|
||||
If the number of displayable processes ("active_procs") was less
|
||||
than the number of requested processes ("topn"), top would
|
||||
segmentation fault. This bug has been fixed. Thanks to Prentiss
|
||||
Riddle at ut-sally for pointing out the existence of this bug.
|
||||
|
||||
Tue Oct 23 1984 - wnl (1.4)
|
||||
Finally fixed the hash table bug that caused processes owned by
|
||||
root to sometimes appear with either no name or a different name
|
||||
that had UID 0 (such as "operator"). Removed all the ifdef DEBUG
|
||||
blocks to make top ready for distribution to the real world.
|
||||
|
||||
Sun Apr 8 1984 - wnl (still 1.3)
|
||||
Made some slight changes to the display format. It now looks more
|
||||
aesthetically pleasing. Added some preprocessor constants so that
|
||||
the two defaults (number of processes and seconds of delay) easier
|
||||
to change.
|
||||
|
||||
Thu Apr 5 1984 - wnl (1.3)
|
||||
Changed the order in which things are done at initialization time.
|
||||
This way, if an error occurs before starting the main loop, curses
|
||||
will never get started. Also changed other error handlers so that
|
||||
endwin() is called before any flavor of exit. Specifying a number
|
||||
of processes that is more than the screen can handle is no longer
|
||||
fatal. It displays a warning message and pretends the user
|
||||
specified the maximum for the screen. Finally cured all the TSTP
|
||||
blues (well, almost all). I removed my TSTP handler and convinced
|
||||
the system to always use the one that curses sets up. Turns out
|
||||
that "sleep" was stepping all over it during a pause. So, I don't
|
||||
use sleep anymore. The only problem that remains with it now is
|
||||
redrawing the old display before updating it after a pause.
|
||||
|
||||
Tue Apr 3 1984 - wnl (from 1.0 to 1.2)
|
||||
I changed the format of the TIME column from just "seconds" to
|
||||
"minutes:seconds". I also made pausing work correctly. Screen
|
||||
redraws with an up to date display. For compatibility with 4.2, I
|
||||
changed the name of the "zero" function to "bzero". The makefile
|
||||
has been altered to handle versions for 4.1 and 4.2, and README
|
||||
has been updated to reflect these recent changes.
|
||||
Executable
+503
@@ -0,0 +1,503 @@
|
||||
#!/bin/csh -f
|
||||
#
|
||||
# Configuration script for top.
|
||||
#
|
||||
# Use with version 3.0 and higher.
|
||||
#
|
||||
set PRIME = "/usr/games/primes"
|
||||
set vars = (module LoadMax topn NominalTopn delay owner group mode random \
|
||||
TableSize bindir mandir manext mansty \
|
||||
Cmdshell Cmdcc Cmdawk Cmdinstall cdefs)
|
||||
set fastrack = 0
|
||||
set yesno = (no yes)
|
||||
|
||||
onintr byebye
|
||||
|
||||
# make sure that getans is there and ready
|
||||
if (! -e getans) then
|
||||
echo 'This package is not complete. The shell file "getans" is missing.'
|
||||
exit 10
|
||||
endif
|
||||
chmod +x getans
|
||||
|
||||
if ($#argv > 0) then
|
||||
# fast track configuration
|
||||
set fastrack = 1
|
||||
else
|
||||
cat <<'EOF'
|
||||
Configuration for top, version 3.4
|
||||
|
||||
One moment....
|
||||
'EOF'
|
||||
endif
|
||||
|
||||
# collect file names and module names
|
||||
ls machine/m_*.c >$$.f
|
||||
ls machine/m_*.man >$$.m
|
||||
sed -e 's@^machine/m_@@' -e 's/.c$//' $$.f >$$.n
|
||||
|
||||
# build Make.desc
|
||||
set descs = `sed -e 's@\[email protected]@' $$.f`
|
||||
sed -e "s@%descs%@$descs@" Make.desc.X >Make.desc
|
||||
|
||||
# build desc files and SYNOPSIS as needed
|
||||
make -f Make.desc >/dev/null
|
||||
|
||||
if (-e .defaults) then
|
||||
echo ""
|
||||
echo "Reading configuration from last time..."
|
||||
source .defaults
|
||||
set nodefaults = 0
|
||||
if ($fastrack == 1) then
|
||||
set module = $1
|
||||
endif
|
||||
else
|
||||
if ($fastrack == 1) then
|
||||
echo "No previous configuration was found."
|
||||
set fastrack = 0
|
||||
set module = $1
|
||||
else
|
||||
set module = ""
|
||||
endif
|
||||
set LoadMax = 5.0
|
||||
set topn = 15
|
||||
set NominalTopn = 18
|
||||
set delay = 5
|
||||
set TableSize = 0
|
||||
set bindir = /usr/local/bin
|
||||
set mandir = /usr/man/manl
|
||||
set manext = l
|
||||
set mansty = man
|
||||
set nodefaults = 1
|
||||
set Cmdshell = /bin/sh
|
||||
set Cmdawk = awk
|
||||
set Cmdinstall = ./install
|
||||
set Cmdcc = cc
|
||||
set cdefs = -O
|
||||
endif
|
||||
echo ""
|
||||
|
||||
if ($fastrack == 1) then
|
||||
grep -s $module $$.n >/dev/null
|
||||
if ($status != 0) then
|
||||
echo "$module is not recognized. To see a list of available modules"
|
||||
echo 'run "Configure" with no arguments.'
|
||||
rm -f $$.[fmn]
|
||||
exit 1
|
||||
endif
|
||||
set random1 = `expr $random + 1`
|
||||
cat <<EOF
|
||||
Using these settings:
|
||||
Bourne Shell $Cmdshell
|
||||
C compiler $Cmdcc
|
||||
Compiler options $cdefs
|
||||
Awk command $Cmdawk
|
||||
Install command $Cmdinstall
|
||||
|
||||
Module $module
|
||||
LoadMax $LoadMax
|
||||
Default TOPN $topn
|
||||
Nominal TOPN $NominalTopn
|
||||
Default Delay $delay
|
||||
Random passwd access $yesno[$random1]
|
||||
Table Size $TableSize
|
||||
Owner $owner
|
||||
Group Owner $group
|
||||
Mode $mode
|
||||
bin directory $bindir
|
||||
man directory $mandir
|
||||
man extension $manext
|
||||
man style $mansty
|
||||
|
||||
EOF
|
||||
goto fast
|
||||
endif
|
||||
|
||||
cat <<'EOF'
|
||||
You will be asked a series of questions. Each question will have a
|
||||
default answer enclosed in brackets, such as "[5.0]". In most cases,
|
||||
the default answer will work well. To use that value, merely press
|
||||
return.
|
||||
|
||||
'EOF'
|
||||
|
||||
# display synopses
|
||||
|
||||
getmod:
|
||||
cat <<'EOF'
|
||||
|
||||
The following machine-dependent modules are available:
|
||||
'EOF'
|
||||
awk -F: ' { printf "%-8s %s\n", $1, $2 }' SYNOPSIS
|
||||
echo ''
|
||||
./getans "What module is appropriate for this machine? " string "$module" .$$
|
||||
set module = `cat .$$`
|
||||
|
||||
if ("$module" == "") then
|
||||
echo "Please specify a valid module name."
|
||||
goto getmod
|
||||
endif
|
||||
|
||||
# is it a valid one?
|
||||
grep -s "$module" $$.n >/dev/null
|
||||
if ($status != 0) then
|
||||
echo "That is not a recognized module name."
|
||||
goto getmod
|
||||
endif
|
||||
|
||||
# display a full description
|
||||
sed -e '1,/DESCRIPTION:/d' -e '/^$/,$d' machine/m_${module}.desc
|
||||
|
||||
# verify it
|
||||
echo ""
|
||||
./getans "Is this what you want to use?" yesno 1 .$$
|
||||
if (`cat .$$` == 0) then
|
||||
goto getmod
|
||||
endif
|
||||
endif
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
First we need to find out a little bit about the executables needed to
|
||||
compile top.
|
||||
|
||||
'EOF'
|
||||
./getans "What is the full path name for the Bourne shell" file "$Cmdshell" .$$
|
||||
set Cmdshell = `cat .$$`
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
Please supply the name of the appropriate command. It need not be a
|
||||
full path name, but the named command does need to exist somewhere on
|
||||
the current path.
|
||||
|
||||
'EOF'
|
||||
./getans "AWK Interpreter" path "$Cmdawk" .$$
|
||||
set Cmdawk = `cat .$$`
|
||||
./getans "C Compiler" path "$Cmdcc" .$$
|
||||
set Cmdcc = `cat .$$`
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
The installer command needs to understand Berkeley-esque arguments:
|
||||
"-o" for owner, "-g" for group, and "-m" for mode. A shell script
|
||||
called "install" is distributed with top and is suitable for use by
|
||||
top. You can specify a different program here if you like, or use
|
||||
the shell script (the default).
|
||||
|
||||
'EOF'
|
||||
./getans "Installer" path "$Cmdinstall" .$$
|
||||
set Cmdinstall = `cat .$$`
|
||||
|
||||
cat <<EOF
|
||||
|
||||
What other options should be used with the $Cmdcc command (use "none" to
|
||||
specify no options)?
|
||||
EOF
|
||||
./getans "Compiler options" string "$cdefs" .$$
|
||||
set cdefs = `cat .$$`
|
||||
if ("$cdefs" == "none") then
|
||||
set cdefs = ""
|
||||
endif
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
Now you need to answer some questions concerning the configuration of
|
||||
top itself.
|
||||
|
||||
The space command forces an immediate update. Sometimes, on loaded
|
||||
systems, this update will take a significant period of time (because all
|
||||
the output is buffered). So, if the short-term load average is above
|
||||
"LoadMax", then top will put the cursor home immediately after the space
|
||||
is pressed before the next update is attempted. This serves as a visual
|
||||
acknowledgement of the command. "LoadMax" should always be specified as a
|
||||
floating point number.
|
||||
|
||||
'EOF'
|
||||
./getans "LoadMax" number "$LoadMax" .$$
|
||||
set LoadMax = `cat .$$`
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
"Default TOPN" is the default number of processes to show. This is the
|
||||
number that will be used when the user does not specify the number of
|
||||
processes to show. If you want "all" (or infinity) as the default, use
|
||||
the value "-1".
|
||||
|
||||
'EOF'
|
||||
|
||||
./getans "Default TOPN" neginteger "$topn" .$$
|
||||
set topn = `cat .$$`
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
"Nominal_TOPN" is used as the default TOPN when Default_TOPN is Infinity
|
||||
and the output is a dumb terminal. If we didn't do this, then
|
||||
installations who use a default TOPN of Infinity will get every process in
|
||||
the system when running top on a dumb terminal (or redirected to a file).
|
||||
Note that Nominal_TOPN is a default: it can still be overridden on the
|
||||
command line, even with the value "infinity".
|
||||
|
||||
'EOF'
|
||||
|
||||
./getans "Nominal TOPN" integer "$NominalTopn" .$$
|
||||
set NominalTopn = `cat .$$`
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
Default Delay is the default number of seconds to wait between screen
|
||||
updates.
|
||||
|
||||
'EOF'
|
||||
|
||||
./getans "Default Delay" integer "$delay" .$$
|
||||
set delay = `cat .$$`
|
||||
|
||||
echo ""
|
||||
|
||||
set rand = 0
|
||||
ypwhich >&/dev/null
|
||||
if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
|
||||
set rand = 1
|
||||
endif
|
||||
|
||||
if ($rand == 1) then
|
||||
echo "It looks like you have a passwd file that can be accessed at random."
|
||||
set pr = 'Do you want top to take advantage of this'
|
||||
else
|
||||
echo "It looks like you have conventional passwd file access. Top can take"
|
||||
echo "advantage of a random access passwd mechanism if such exists. Do"
|
||||
echo "you want top to assume that accesses to the file /etc/passwd are done"
|
||||
set pr = 'with random access rather than sequential'
|
||||
endif
|
||||
|
||||
if ($nodefaults == 1) then
|
||||
set random = $rand
|
||||
endif
|
||||
|
||||
./getans "${pr}?" yesno $random .$$
|
||||
set random = `cat .$$`
|
||||
|
||||
echo ""
|
||||
echo "Compiling prime.c"
|
||||
$Cmdcc $cdefs -o prime prime.c -lm
|
||||
if ($status != 0) then
|
||||
echo "Oh well."
|
||||
rm -f prime
|
||||
endif
|
||||
|
||||
echo ""
|
||||
|
||||
ypcat passwd.byname >&/tmp/$$.a
|
||||
if ($status == 0) then
|
||||
set cnt = `wc -l </tmp/$$.a`
|
||||
set mapfile = "NIS map"
|
||||
else
|
||||
set cnt = `wc -l </etc/passwd`
|
||||
set mapfile = "file"
|
||||
endif
|
||||
rm /tmp/$$.a
|
||||
set double = `expr $cnt \* 2`
|
||||
echo "I found $cnt entries in your passwd $mapfile. Top hashes the username to"
|
||||
echo "uid mappings as it goes along and it needs a good guess on the size of"
|
||||
echo "that hash table. This number should be the next highest prime number"
|
||||
echo "after $double."
|
||||
echo ""
|
||||
if (-e prime) then
|
||||
set pr = `./prime $double`
|
||||
echo "I have calculated that to be $pr."
|
||||
else if (-e $PRIME) then
|
||||
set pr = `$PRIME $double | head -1`
|
||||
echo "I have calculated that to be $pr."
|
||||
else
|
||||
set pr = $double
|
||||
echo "I cannot calculate that prime number, so you will need to provide it for me."
|
||||
endif
|
||||
|
||||
if ($TableSize == 0) then
|
||||
set TableSize = $pr
|
||||
endif
|
||||
|
||||
./getans "Enter the hash table size" integer "$TableSize" .$$
|
||||
set TableSize = `cat .$$`
|
||||
|
||||
echo ""
|
||||
|
||||
# !!! I need to fix this: /dev/kmem might not exist on some machines !!!
|
||||
|
||||
# determine the right way to invoke ls to get full output
|
||||
set ls = "ls -l"
|
||||
if (`$ls getans | wc -w` < 9) then
|
||||
set ls = "ls -lg"
|
||||
endif
|
||||
|
||||
set t_owner = root
|
||||
set t_group = `$ls -d /usr/bin | awk ' { print $4 }'`
|
||||
if (-e /proc) then
|
||||
cat <<EOF
|
||||
Uh oh! I see /proc out there. Some new Unix variants provide the /proc
|
||||
file system as a mechanism to get to a process's address space. This
|
||||
directory is typically only accessible by root. However, there are a few
|
||||
systems (such as DG/UX) on which this directory exists, but isn't used.
|
||||
I'm going to assume that top needs to run setuid to root, but you should
|
||||
double check and use mode 2755 (set group id) if top doesn't really need
|
||||
root access. If you are running SunOS 5.x then you will need to install
|
||||
top setuid root (owner root and mode 4711).
|
||||
|
||||
EOF
|
||||
set t_mode = 4711
|
||||
set mode = 4711
|
||||
else if (-e /dev/kmem) then
|
||||
$ls /dev/kmem >/tmp/$$.b
|
||||
grep '^....r..r..' /tmp/$$.b >&/dev/null
|
||||
if ($status == 1) then
|
||||
grep '^....r..-..' /tmp/$$.b >&/dev/null
|
||||
if ($status == 0) then
|
||||
set t_group = `awk ' { print $4 }' /tmp/$$.b`
|
||||
set t_mode = 2755
|
||||
echo "It looks like only group $t_group can read the memory devices."
|
||||
else
|
||||
set t_mode = 4755
|
||||
echo "It looks like only root can read the memory devices."
|
||||
endif
|
||||
else
|
||||
set t_mode = 755
|
||||
echo "It looks like anybody can read the memory devices."
|
||||
endif
|
||||
else
|
||||
echo "It looks like there are no memory device special files."
|
||||
set t_mode = 755
|
||||
endif
|
||||
if ($nodefaults) then
|
||||
set owner = $t_owner
|
||||
set group = $t_group
|
||||
set mode = $t_mode
|
||||
endif
|
||||
echo "Tell me how to set the following when top is installed:"
|
||||
./getans "Owner" user "$owner" .$$
|
||||
set owner = `cat .$$`
|
||||
./getans "Group owner" group "$group" .$$
|
||||
set group = `cat .$$`
|
||||
./getans "Mode" integer "$mode" .$$
|
||||
set mode = `cat .$$`
|
||||
rm -f /tmp/$$.b
|
||||
|
||||
echo ""
|
||||
./getans "Install the executable in this directory" file "$bindir" .$$
|
||||
set bindir = `cat .$$`
|
||||
|
||||
echo ""
|
||||
./getans "Install the manual page in this directory" file "$mandir" .$$
|
||||
set mandir = `cat .$$`
|
||||
|
||||
echo ""
|
||||
./getans "Install the manual page with this extension" string "$manext" .$$
|
||||
set manext = `cat .$$`
|
||||
|
||||
echo ""
|
||||
./getans "Install the manual page as 'man' or 'catman'" string "$mansty" .$$
|
||||
set mansty = `cat .$$`
|
||||
|
||||
echo ""
|
||||
echo "We are done with the questions."
|
||||
|
||||
# Some Unix environments are so poor that their csh doesn't even support
|
||||
# the "eval" builtin. Check for this before relying on its use to save
|
||||
# the current configuration.
|
||||
/bin/csh -c "eval echo foo" >&/dev/null
|
||||
if ($status == 1) then
|
||||
echo "Can't save configuration (nonfatal)"
|
||||
else
|
||||
echo "Saving configuration..."
|
||||
# save settings to use as defaults the next time
|
||||
rm -f .defaults
|
||||
foreach v ($vars)
|
||||
set tmp = `eval echo \$$v`
|
||||
echo set $v = "'$tmp'" >>.defaults
|
||||
end
|
||||
endif
|
||||
|
||||
fast:
|
||||
|
||||
# set variables which contain module lists
|
||||
set modules = `cat $$.f`
|
||||
set manmodules = `cat $$.m`
|
||||
|
||||
# clean up
|
||||
rm -f $$.f $$.m $$.n
|
||||
|
||||
# set the link for machine.c
|
||||
rm -f machine.c machine.o
|
||||
ln -s machine/m_${module}.c machine.c
|
||||
|
||||
# get definitions out of the module file
|
||||
set libs = `grep LIBS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||
set cflgs = `grep CFLAGS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||
set tcap = `grep TERMCAP: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
|
||||
|
||||
# default for tcap (termcap)
|
||||
if ("$tcap" == "") then
|
||||
set tcap="-ltermcap"
|
||||
endif
|
||||
|
||||
if ( { grep -s SIGKILL /usr/include/signal.h } ) then
|
||||
set signal="/usr/include/signal.h"
|
||||
else
|
||||
set signal="/usr/include/sys/signal.h"
|
||||
endif
|
||||
|
||||
|
||||
echo "Building Makefile..."
|
||||
sed -e "s|%topn%|$topn|" \
|
||||
-e "s|%delay%|$delay|" \
|
||||
-e "s|%owner%|$owner|" \
|
||||
-e "s|%group%|$group|" \
|
||||
-e "s|%mode%|$mode|" \
|
||||
-e "s|%bindir%|$bindir|" \
|
||||
-e "s|%mandir%|$mandir|" \
|
||||
-e "s|%manext%|$manext|" \
|
||||
-e "s|%mansty%|$mansty|" \
|
||||
-e "s|%tablesize%|$TableSize|" \
|
||||
-e "s|%libs%|$libs|" \
|
||||
-e "s|%cflgs%|$cflgs|" \
|
||||
-e "s|%termcap%|$tcap|" \
|
||||
-e "s|%cdefs%|$cdefs|" \
|
||||
-e "s|%modules%|$modules|" \
|
||||
-e "s|%manmodules%|$manmodules|" \
|
||||
-e "s|%signal%|$signal|" \
|
||||
-e "s|%cc%|$Cmdcc|" \
|
||||
-e "s|%awk%|$Cmdawk|" \
|
||||
-e "s|%install%|$Cmdinstall|" \
|
||||
-e "s|%shell%|$Cmdshell|" \
|
||||
Makefile.X >Makefile
|
||||
|
||||
echo "Building top.local.h..."
|
||||
sed -e "s|%LoadMax%|$LoadMax|" \
|
||||
-e "s|%TableSize%|$TableSize|" \
|
||||
-e "s|%NominalTopn%|$NominalTopn|" \
|
||||
-e "s|%topn%|$topn|" \
|
||||
-e "s|%delay%|$delay|" \
|
||||
-e "s|%random%|$random|" \
|
||||
top.local.H >top.local.h
|
||||
|
||||
echo "Building top.1..."
|
||||
sed -e "s|%topn%|$topn|" \
|
||||
-e "s|%delay%|$delay|" \
|
||||
top.X >top.1
|
||||
if (-e machine/m_${module}.man ) then
|
||||
cat machine/m_${module}.man >>top.1
|
||||
endif
|
||||
|
||||
# clean up
|
||||
rm -f .$$
|
||||
|
||||
echo 'Doing a "make clean".'
|
||||
make clean
|
||||
|
||||
echo 'To create the executable, type "make".'
|
||||
echo 'To install the executable, type "make install".'
|
||||
exit 0
|
||||
|
||||
byebye:
|
||||
rm -f .$$ $$.[fmn] /tmp/$$.[ab]
|
||||
exit 1
|
||||
@@ -0,0 +1,30 @@
|
||||
DISCLAIMER
|
||||
|
||||
"top" is distributed free of charge. It should not be considered an
|
||||
official product of Argonne National Laboratory. William LeFebvre
|
||||
supports "top" in his spare time and as time permits.
|
||||
|
||||
NO WARRANTY:
|
||||
|
||||
BECAUSE "top" IS DISTRIBUTED FREE OF CHARGE, THERE IS ABSOLUTELY NO
|
||||
WARRANTY PROVIDED, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING, ARGONNE NATIONAL LABORATORY,
|
||||
NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE AND/OR OTHER PARTIES
|
||||
PROVIDE "top" "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
|
||||
AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
|
||||
THE "top" PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
|
||||
NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
IN NO EVENT WILL ARGONNE NATIONAL LABORATORY, NORTHWESTERN UNIVERSITY,
|
||||
WILLIAM N. LeFEBVRE, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
|
||||
REDISTRIBUTE "top", BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST
|
||||
PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL
|
||||
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT
|
||||
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES
|
||||
SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
|
||||
OTHER PROGRAMS) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
|
||||
|
||||
So there!
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
|
||||
William LeFebvre
|
||||
and a cast of dozens
|
||||
|
||||
|
||||
FREQUENTLY ASKED QUESTIONS AND THEIR ANSWERS
|
||||
|
||||
This FAQ is broken out in to several topics.
|
||||
|
||||
|
||||
GENERAL
|
||||
|
||||
1. "Where do I get the latest version of top?"
|
||||
|
||||
The latest version of top is now available at the site "ftp.groupsys.com" in
|
||||
the directory "/pub/top". It is also available at "eecs.nwu.edu" in the
|
||||
directory "/pub/top".
|
||||
|
||||
2. "Is there a web page for top?"
|
||||
|
||||
Not at this time, but I am planning one. When it is finally available, you
|
||||
will be able to find it at "www.groupsys.com."
|
||||
|
||||
3. "Is there a mailing list for top?"
|
||||
|
||||
Currently there is a top developers mailing list that is used by beta
|
||||
testers and other people who help me port the program to various machines.
|
||||
I am planning a general mailing list for announcements and such, but it is
|
||||
not yet available.
|
||||
|
||||
4. "How can I find out when all these things become available?"
|
||||
|
||||
Information about the web site and the mailing list will be made available
|
||||
in future distributions of top. New distributions will be announced on the
|
||||
appropriate Usenet newsgroups (including comp.sources.unix).
|
||||
|
||||
5. "Why does it take so long for a new version of top to go through the
|
||||
beta test process?"
|
||||
|
||||
This is completely my fault. I have just not had the time recently to give
|
||||
top the attention it deserves. I thank everyone for their patience, and I
|
||||
hope that with the recent changes in the direction of my career that I can
|
||||
spend more time on this.
|
||||
|
||||
6. "Top is not written in ANSI C. Do you ever plan to change that?"
|
||||
|
||||
Top predates ANSI C by about 5 years. Yeah, it'll get "fixed" eventually.
|
||||
Probably in 3.5.
|
||||
|
||||
|
||||
CONFIGURING
|
||||
|
||||
7. "Configure said that it saw /proc and is recommending that I install top
|
||||
setuid root. Is there any way around this? Is it safe?"
|
||||
|
||||
There is no way around it. Complain to POSIX. Every effort has been made
|
||||
to make top a secure setuid program. However, we cannot guarantee that
|
||||
there are no security problems associated with this configuration. The
|
||||
places where top is most vulnerable are the builtin kill and renice
|
||||
commands. There is no internal top command that causes top to start a shell
|
||||
as a subprocess. Some SVR4 systems may contain a bug that enables a user to
|
||||
renice his own processes downward (to lower nice values that are more
|
||||
favorable for the process). This problem has been fixed for the Solaris 2.x
|
||||
modules, but may still exist in others. We will hopefully fix this up in
|
||||
the next release.
|
||||
|
||||
8. "Why is Configure a c-shell script? I thought c-shell scripts were
|
||||
evil?"
|
||||
|
||||
They are. :-) I'll probably be rewriting the Configure script for the
|
||||
next release.
|
||||
|
||||
|
||||
COMPILING
|
||||
|
||||
9. "We just upgraded our operating system to a new version and top broke.
|
||||
What should we do?"
|
||||
|
||||
Recompile it. Top is very sensitive to changes in internal kernel data
|
||||
structures. It is not uncommon for a new version of the operating system to
|
||||
include changes to kernel data structures.
|
||||
|
||||
|
||||
RUNNING
|
||||
|
||||
10. "I just finished compiling top and it works fine for root, but when
|
||||
I try to run it as a regular user it either complains about files
|
||||
it can't open or it doesn't display all the information it should.
|
||||
Did I do something wrong?"
|
||||
|
||||
Well, you're just not done. On many operating systems today, access to
|
||||
many of the kernel memory devices and other system files is restricted to
|
||||
either root or a particular group. The Configure script figures this out
|
||||
(usually) and makes sure that the "intsall" rule in the Makefile will
|
||||
install top so that anyone can run it successfully. However, you have to
|
||||
*install* it first. Do this with the command "make install".
|
||||
|
||||
11. "Top is (not) displaying idle processes and I don't (do) want it to."
|
||||
|
||||
This default has only changed about a dozen times, and I finally got tired
|
||||
of people whining about it. Go read the manual page for the current version
|
||||
and pay special attention to the description of the "TOP" environment
|
||||
variable.
|
||||
|
||||
12. "We have so much memory in our machine that the memory status display
|
||||
(the fourth line) ends up being longer than 80 characters. This
|
||||
completely messes up top's output. Is there a patch?"
|
||||
|
||||
Most modules have been changed to use new memory formatting functions which
|
||||
will display large values in terms of megabytes instead of kilobytes. This
|
||||
should fix all occurences of this problem. If you encounter a system where
|
||||
this large memory display overflow is still occurring, please let me know
|
||||
(send mail to <[email protected]>). Also note that newer versions of top can
|
||||
use columns beyond 79, and understand window resizes. So you can always
|
||||
make your window bigger.
|
||||
|
||||
13. "I tried to compile top with gcc and it doesn't work. I get
|
||||
compilation errors in the include files, or I get an executable that
|
||||
dumps core, or top displays incorrect numbers in some of the displays.
|
||||
What's wrong?"
|
||||
|
||||
Gnu CC likes very much to use its own include files. Not being a gcc
|
||||
expert, I can't explain why it does this. But I can tell you that if you
|
||||
upgrade your operating system (say from Solaris 2.4 to Solaris 2.5) after
|
||||
installing gcc, then the include files that gcc uses will be incorrect,
|
||||
especially those found in the "sys" directory. Your choices are: (1)
|
||||
rebuild and reinstall the "standard" include files for gcc (look for a
|
||||
script in the distribution called "fixincludes"), (2) compile machine.c
|
||||
with "CFLAGS=-I/usr/include" then make the rest of the object files
|
||||
normally, or (3) use "cc".
|
||||
|
||||
14. "The cpu state percentages are all wrong, indicating that my machine is
|
||||
using 95% system time when it is clearly idle. What's wrong?"
|
||||
|
||||
This can happen if you compiled with gcc using the wrong include files.
|
||||
See the previous question.
|
||||
|
||||
|
||||
SUNOS PROBLEMS
|
||||
|
||||
15. "I tried compiling top under SunOS version 4.1.x and it got compile time
|
||||
errors. Is there a patch?"
|
||||
|
||||
If you try compiling top in a "System V environment" under SunOS (that is,
|
||||
/usr/5bin is before /usr/bin on your path) then the compilation may fail.
|
||||
This is mostly due to the fact that top thinks its being compiled on a
|
||||
System V machine when it really isn't. The only solution is to put /usr/bin
|
||||
and /usr/ucb before /usr/5bin on your path and try again.
|
||||
|
||||
|
||||
SVR4-derived PROBLEMS
|
||||
|
||||
16. "When I run top on my SVR4-derived operating system, it displays all
|
||||
the system information at the top but does not display any process
|
||||
information (or only displayes process information for my own
|
||||
processes). Yet when I run it as root, everything works fine."
|
||||
|
||||
Your system probably uses the pseudo file system "/proc", which is by
|
||||
default only accessible by root. Top needs to be installed setuid root on
|
||||
such systems if it is going to function correctly for normal users.
|
||||
|
||||
|
||||
SOLARIS PROBLEMS
|
||||
|
||||
17. "Under Solaris 2, when I run top as root it only shows root processes,
|
||||
or it only shows processes with a PID less than 1000. It refuses to
|
||||
show anything else. What do I do?"
|
||||
|
||||
You probably compiled it with /usr/ucb/cc instead of the real C compiler.
|
||||
/usr/ucb/cc is a cc front end that compiles programs in BSD source-level
|
||||
compatability mode. You do not want that. Make sure that /usr/ucb is not
|
||||
on your path and try compiling top again.
|
||||
|
||||
18. "Under Solaris 2, I compiled top using what I am sure is the correct
|
||||
compiler but when I try to run it it complains about missing dynamic
|
||||
libraries. What is wrong?"
|
||||
|
||||
Check to see if you have LD_LIBRARY_PATH defined in your shell. If you do,
|
||||
make sure that /usr/ucblib is not on the path anywhere. Then try compiling
|
||||
top again.
|
||||
|
||||
19. "Under Solaris 2, when I try to run top it complains that it can't open
|
||||
the library "libucb.so.1". So I changed the LIBS line in m_sunos5.c
|
||||
to include -R/usr/ucblib to make sure that the dynamic linker will look
|
||||
there when top runs. I figured this was just an oversight. Was I
|
||||
right?"
|
||||
|
||||
No, you were not right. As distributed, top requires NO alterations for
|
||||
successful compilation and operations under Solaris 2.0, 2.1, 2.2, 2.3, 2.4,
|
||||
and 2.5. You probably compiled top with /usr/ucb/cc instead of the real C
|
||||
compiler. See FAQ #10 for more details.
|
||||
|
||||
|
||||
SCO PROBLEMS
|
||||
|
||||
20. "When I try to run Configure, it complains about a syntax error."
|
||||
|
||||
Some versions of SCO's csh do not understand the syntax "$<". This breaks
|
||||
Configure. You'll just have to hack around it for now: the Configure script
|
||||
is going to be completely redone in the near future anyway.
|
||||
|
||||
|
||||
SVR42 PROBLEMS
|
||||
|
||||
21. "The load average and memory displays don't work right. Why?"
|
||||
|
||||
This is a known bug with the svr42 module. The problem has been traced down
|
||||
to a potential bug in the "mem" driver. The author of the svr42 module is
|
||||
working on a fix.
|
||||
|
||||
|
||||
STILL STUCK
|
||||
|
||||
22. I'm still stuck. To whom do I report problems with top?"
|
||||
|
||||
The most common problems are caused by top's sensitivity to internal kernel
|
||||
data structures. So make sure that you are using the right include files,
|
||||
and make sure that you test out top on the same machine where you compiled
|
||||
it. Sun's BSD Source Compatability Mode is also a common culprit. Make
|
||||
sure you aren't using either /usr/ucb/cc or any of the libraries in
|
||||
/usr/ucblib. Finally, make sure you are using the correct module. If there
|
||||
does not appear to be one appropriate for your computer, then top probably
|
||||
will not work on your system.
|
||||
|
||||
If after reading all of this file and checking everything you can you are
|
||||
still stuck, then send mail to "[email protected]". I will answer your mail
|
||||
when I have time. Please bear with me in that regard! If it looks like the
|
||||
problem is machine-specific, I will forward the report along to the module's
|
||||
author. If you would like to converse directly with the module author, the
|
||||
authors' names are listed at the beginning of the module .c file in the
|
||||
"machine" directory.
|
||||
@@ -0,0 +1,165 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
|
||||
William LeFebvre
|
||||
and a cast of dozens
|
||||
|
||||
INSTALLATION
|
||||
|
||||
Configuration and installation of top is very straightforward. After
|
||||
unpacking the sources, run the script "Configure". It will present you
|
||||
with a series of questions, all of which should be explained in the
|
||||
presentation. After you have answered all the questions, "Configure" will
|
||||
perform all the necessary configuration. Once this is finished, type
|
||||
"make install". Make will compile the sources then install the resulting
|
||||
executable and manual page in the appropriate places.
|
||||
|
||||
The most difficult step in the configuration is the choice of an
|
||||
appropriate machine-specific module. The Configure script gives you a
|
||||
list of choices complete with brief descriptions of when each choice is
|
||||
appropriate. Each module is contained in a separate c file in the
|
||||
directory "machine". The module contains all of the machine-specific code
|
||||
that makes top work correctly on the architecture in question. All of the
|
||||
code in the top-level directory is machine-independent (or at least
|
||||
strives to be). Hints for some module choices that are not obvious are
|
||||
given at the end of this file.
|
||||
|
||||
The first comment in each c file in that directory contains the synopsis
|
||||
AND a detailed description of the machines for which that module is
|
||||
appropriate. It also contains a list of authors for that module. If you
|
||||
are really stumped in this choice, use grep to find your machine
|
||||
manufacturer's name or operating system name in machine/*.c. If you still
|
||||
can't find one that is appropriate, then chances are very good that one
|
||||
hasn't been written yet. If that is the case, then you are out of luck.
|
||||
|
||||
HANDLING MULTIPLE ARCHITECTURES
|
||||
|
||||
If you need to recompile top for a different architecture (that is, using
|
||||
a different module) you need to reconfigure top. A short cut is available
|
||||
to make this a little easier. If all of your previous answers to the
|
||||
configuration questions (except for the module name of course) are
|
||||
adequate for the new architecture, then you can just use the command
|
||||
"Configure <modulename>". The configuration script will reconfigure top
|
||||
using the new module and all the answers you gave last time. It will
|
||||
finish with a "make clean". Once that completes, type "make install"
|
||||
and make will compile the sources and do the installation.
|
||||
|
||||
HANDLING MULTIPLE OS VERSIONS
|
||||
|
||||
By far the most frequently received bug report for top is something like
|
||||
this: "We just upgraded our operating system to version 99.9.9.9 and top
|
||||
broke. What should we do?" The simple answer is "recompile".
|
||||
|
||||
Top is very sensitive to changes in internal kernel data structures
|
||||
(especially the proc and user structures). Some operating systems
|
||||
(especially SunOS) are notorious for changing these structure in every
|
||||
minor release of the OS. This means that a top executable made under one
|
||||
version of the OS will not always work correctly (if even at all) under
|
||||
another version. This is just one of those tough facts of life. There is
|
||||
really no way around it.
|
||||
|
||||
To make life even worse, some operating systems (SunOS again) will use
|
||||
slightly different proc and user structures on different models. For
|
||||
example, "top" built on a SparcStation 2 will not run correctly on a
|
||||
SparcStation 10, even if they are both running SunOS 4.1.3. These
|
||||
unfortunate circumstances make maintaining top very difficult, especially
|
||||
in an environment that runs several different versions of the same
|
||||
operating system.
|
||||
|
||||
But there is hope. If your operating system has a properly functioning
|
||||
"uname" command then you can handle this problem rather gracefully.
|
||||
Included in the distribution is a shell file called "metatop". All this
|
||||
shell file does is:
|
||||
|
||||
exec top-`uname -m`-`uname -r` "$@"
|
||||
|
||||
So when you run this script, it execs a filename that is unique to your
|
||||
specific machine architecture and your OS revision number.
|
||||
|
||||
To use "metatop", do the following:
|
||||
|
||||
. on any machine, run Configure and choose the module that is
|
||||
appropriate for the machine
|
||||
. for all machines which use the same module:
|
||||
. group machines according to machine architecture AND OS
|
||||
revision number (i.e.: sun4-4.1.1, sun4c-4.1.1, sun4c-4.1.2,
|
||||
sun4-4.1.3, sun4c-4.1.3, sun4m-4.1.3, ...)
|
||||
. for each group, choose one machine from that group and on it
|
||||
run "make clean; make installmeta".
|
||||
|
||||
|
||||
The "installmeta" rule in the makefile will insure that top is compiled,
|
||||
install the shell file "metatop" as "top", then install the executable
|
||||
"top" with a name appropriate to the machine architecture and OS revision.
|
||||
|
||||
|
||||
HINTS FOR CHOOSING THE CORRECT MODULE:
|
||||
|
||||
SOLARIS 2.x
|
||||
|
||||
For Solaris versions 2.0 thru 2.3, use the module sunos5. For Solaris
|
||||
versions 2.4 and higher (including 2.5 and 2.5.1) use the module sunos54.
|
||||
|
||||
SUNOS 4.x AND MULTIPROCESSOR ARCHITECTURES
|
||||
|
||||
First, we need to be speaking the same language:
|
||||
|
||||
sun4 a regular sparc sun 4 architecture machine (sparc station 1,
|
||||
sparc station 2, IPC, SLC, etc.)
|
||||
|
||||
sun4m a multiprocessor sparc (Sparc 10, 4/670, 4/690)
|
||||
|
||||
I intended to write the sunos4 module so that an executable compiled on a
|
||||
sun4m machine would work correctly on a sun4 machine. Unfortunately my
|
||||
experiments indicate that this cannot be done. It turns out that the user
|
||||
structure is so different between these two architectures that nothing
|
||||
short of a serious hack will make the same executable work correctly on
|
||||
both machines. I recommend that you use the separate module "sunos4mp"
|
||||
when making an executable for a sun4m architecture, and use "sunos4" when
|
||||
making an executable for sun4 or sun4c architectures.
|
||||
|
||||
DIGITAL UNIX V4.0
|
||||
|
||||
This is the successor to DECOSF/1. Use the module decosf1.
|
||||
|
||||
SOLBOURNE OPERATING SYSTEM (OS/MP)
|
||||
|
||||
If you are running OS/MP version 4.1A, then use the module "osmp4.1a".
|
||||
|
||||
If you are running a version of OS/MP OLDER than 4.1A (that is, one
|
||||
of its predecessors), use the module "sunos4".
|
||||
|
||||
If you are running OS/MP 4.1B or LATER, use the module "sunos4mp".
|
||||
|
||||
HP/UX OPERATING SYSTEM
|
||||
|
||||
The module hpux8 works on all version 8 systems. Some say that it works
|
||||
with version 9 as well, but one user did send me a separate module for
|
||||
version 9. This module has only been tested on series 800 machines. I
|
||||
would recommend the following for those running version 9: try hpux9 and
|
||||
if it doesn't work then try hpux8. If neither work, then send mail to me
|
||||
and/or the modules' authors. Another note: we have a model 730 supposedly
|
||||
running version 9.01. The module hpux9 did not compile successfully, but
|
||||
the module hpux8 worked fine. The module hpux10 works on all revisions of
|
||||
HP/UX 10 except 10.10, where HP removed the definition of the proc structure
|
||||
from the system include files.
|
||||
|
||||
NET/2 386BSD SYSTEMS
|
||||
|
||||
If your version of the operating system has patchkit 2.4 installed,
|
||||
then you will need to modify machine/m_386bsd.c and uncomment the
|
||||
definition of PATCHED_KVM. This patchkit makes what more than a few
|
||||
people believe to be a wholly unnecessary patch to the way the kvm
|
||||
routines work.
|
||||
|
||||
A/UX SYSTEMS
|
||||
|
||||
There is a module for A/UX 3.0 and 3.1. Whether or not it works for
|
||||
any other version is not known. Proceed at your own risk.
|
||||
|
||||
Although AUX does not generally have a renice systemcall, it can be
|
||||
implemented by tweeking kernel memory. The flag IMPLEMENT_SETPRIORITY
|
||||
controls the inclusion of this code. It is off be default. While
|
||||
such a simple hack should not be difficult to get right, USE THIS
|
||||
FEATURE AT YOUR OWN RISK!
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Makefile for .desc files
|
||||
|
||||
# This makefile is the prototype for "Make.desc", which is used by
|
||||
# top's Configure script to build .desc files and the SYNOPSIS file.
|
||||
# Configure then uses these files to ask appropriate questions.
|
||||
|
||||
# Written by William LeFebvre, Argonne National Laboratory
|
||||
# (formerly of Northwestern University and Rice University)
|
||||
|
||||
# DO NOT EDIT "Make.desc"!!! Make changes to "Make.desc.X",
|
||||
# then "make veryclean", then run "Configure".
|
||||
|
||||
DESCS=%descs%
|
||||
|
||||
.SUFFIXES: .desc
|
||||
|
||||
.c.desc:
|
||||
sed -e '/^$$/,$$d' -e 's,^[/ *]*,,' $< > $@
|
||||
|
||||
all: SYNOPSIS
|
||||
|
||||
SYNOPSIS: $(DESCS)
|
||||
grep SYNOPSIS: $(DESCS) | sed -e 's@^machine/m_@@' -e '[email protected]:.[^:]*: *@:@' >SYNOPSIS
|
||||
@@ -0,0 +1,130 @@
|
||||
# Makefile for "top", a top 10 process display for Unix
|
||||
#
|
||||
# This makefile is for top, version 3
|
||||
#
|
||||
# Written by William LeFebvre, Argonne National Laboratory
|
||||
# (formerly of Northwestern University and Rice University)
|
||||
|
||||
# DO NOT EDIT "Makefile"!!!! Make changes to "Makefile.X" and rerun
|
||||
# Configure.
|
||||
|
||||
# Executables (these should be obvious):
|
||||
|
||||
SHELL = %shell%
|
||||
CC = %cc%
|
||||
AWK = %awk%
|
||||
INSTALL = %install%
|
||||
|
||||
# installation information:
|
||||
# OWNER - name (or uid) for the installed executable's owner
|
||||
# GROUP - group name (or gid) for the installed executable's group
|
||||
# MODE - mode for the installed executable (should start with a 0)
|
||||
# BINDIR - directory where the executable should live
|
||||
# MANDIR - directory where the manual page should live
|
||||
# MANEXT - installed man pages end in .$(MANEXT)
|
||||
# MANSTY - "man" or "catman" depending on what's to be installed
|
||||
# SIGNAL - <signal.h> or <sys/signal.h>; the one with signal definitions
|
||||
# TROFF - most appropriate troff command
|
||||
|
||||
OWNER = %owner%
|
||||
GROUP = %group%
|
||||
MODE = %mode%
|
||||
BINDIR = %bindir%
|
||||
MANDIR = %mandir%
|
||||
MANEXT = %manext%
|
||||
MANSTY = %mansty%
|
||||
SIGNAL = %signal%
|
||||
|
||||
# Values for the two defaults in "top":
|
||||
# TOPN - default number of processes to display
|
||||
# DELAY - default delay between updates
|
||||
#
|
||||
# set TOPN to -1 to indicate infinity (so that top will display as many
|
||||
# as the screen will hold).
|
||||
|
||||
TOPN = %topn%
|
||||
DELAY = %delay%
|
||||
|
||||
TARFILES = README INSTALL DISCLAIMER FAQ ADVERTISEMENT \
|
||||
Changes Configure Porting \
|
||||
Makefile.X Make.desc.X getans install \
|
||||
top.c commands.c display.c screen.c username.c \
|
||||
utils.c version.c getopt.c prime.c \
|
||||
boolean.h display.h layout.h loadavg.h screen.h \
|
||||
machine.h patchlevel.h top.h top.local.H os.h utils.h \
|
||||
sigconv.awk top.X m-template metatop \
|
||||
machine
|
||||
CFILES = top.c commands.c display.c screen.c username.c \
|
||||
utils.c version.c getopt.c machine.c
|
||||
OBJS = top.o commands.o display.o screen.o username.o \
|
||||
utils.o version.o getopt.o machine.o
|
||||
|
||||
CDEFS = %cdefs%
|
||||
LIBS = %libs%
|
||||
TERMCAP = %termcap%
|
||||
|
||||
CFLAGS = %cflgs% $(CDEFS)
|
||||
LINTFLAGS = -x $(CDEFS)
|
||||
|
||||
all: Makefile top.local.h top
|
||||
|
||||
Makefile: Makefile.X
|
||||
@echo 'You need to run the script "Configure" before running "make".'
|
||||
exit 10
|
||||
|
||||
top.local.h: top.local.H
|
||||
@echo 'You need to run the script "Configure" before running "make".'
|
||||
exit 10
|
||||
|
||||
top: $(OBJS)
|
||||
rm -f top
|
||||
$(CC) -o top $(OBJS) $(TERMCAP) -lm $(LIBS)
|
||||
|
||||
lint: sigdesc.h
|
||||
$(LINT) $(LINTFLAGS) $(CFILES)
|
||||
|
||||
# include file dependencies
|
||||
top.o: boolean.h display.h screen.h top.h top.local.h utils.h machine.h
|
||||
commands.o: boolean.h sigdesc.h utils.h
|
||||
display.o: boolean.h display.h layout.h screen.h top.h top.local.h utils.h
|
||||
machine.o: top.h machine.h utils.h
|
||||
screen.o: boolean.h screen.h
|
||||
utils.o: top.h
|
||||
version.o: top.h patchlevel.h
|
||||
username.o: top.local.h utils.h
|
||||
|
||||
# automatically built include file
|
||||
sigdesc.h: sigconv.awk $(SIGNAL)
|
||||
$(AWK) -f sigconv.awk $(SIGNAL) >sigdesc.h
|
||||
|
||||
tar:
|
||||
rm -f top.tar machine/*.desc machine/*~
|
||||
tar cvf top.tar $(TARFILES)
|
||||
|
||||
shar:
|
||||
rm -f top.shar* machine/*.desc
|
||||
makekit -ntop.shar. -t"Now read README and INSTALL, then run Configure" machine $(TARFILES)/*
|
||||
|
||||
clean:
|
||||
rm -f *.o top core core.* sigdesc.h
|
||||
|
||||
veryclean: clean
|
||||
rm -f Make.desc machine/*.desc .defaults top.tar SYNOPSIS Makefile top.local.h top.1 machine.c prime
|
||||
|
||||
install: top top.1 install-top install-$(MANSTY)
|
||||
|
||||
install-top:
|
||||
$(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) top $(BINDIR)
|
||||
|
||||
install-man:
|
||||
$(INSTALL) top.1 $(MANDIR)/top.$(MANEXT)
|
||||
|
||||
install-catman:
|
||||
tbl top.1 | nroff -man > $(MANDIR)/top.$(MANEXT)
|
||||
|
||||
installmeta: top top.1
|
||||
$(INSTALL) -o $(OWNER) -m 755 -g $(GROUP) metatop $(BINDIR)/top
|
||||
@echo $(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) top $(BINDIR)/top-`uname -m`-`uname -r`
|
||||
@$(INSTALL) -o $(OWNER) -m $(MODE) -g $(GROUP) \
|
||||
top $(BINDIR)/top-`uname -m`-`uname -r`
|
||||
$(INSTALL) top.1 $(MANDIR)/top.$(MANEXT)
|
||||
@@ -0,0 +1,165 @@
|
||||
Instructions for porting top to other architectures.
|
||||
|
||||
This is still a preliminary document. Suggestions for improvement are
|
||||
most welcome.
|
||||
|
||||
My address is now "[email protected]".
|
||||
|
||||
Before you embark on a port, please send me a mail message telling me
|
||||
what platform you are porting top to. There are three reasons for
|
||||
this: (1) I may already have a port, (2) module naming needs to be
|
||||
centralized, (3) I want to loosely track the various porting efforts.
|
||||
You do not need to wait for an "okay", but I do want to know that you
|
||||
are working on it. And of course, once it is finished, please send me
|
||||
the module files so that I can add them to the main distribution!
|
||||
|
||||
----------
|
||||
|
||||
There is one set of functions which extract all the information that
|
||||
top needs for display. These functions are collected in to one file.
|
||||
To make top work on a different architecture simply requires a
|
||||
different implementation of these functions. The functions for a
|
||||
given architecture "foo" are stored in a file called "m_foo.c". The
|
||||
Configure script looks for these files and lets the configurer choose
|
||||
one of them. This file is called a "module". The idea is that making
|
||||
top work on a different machine only requires one additional file and
|
||||
does not require changes to any existing files.
|
||||
|
||||
A module template is included in the distribution, called "m-template".
|
||||
To write your own module, it is a good idea to start with this template.
|
||||
If you architecture is similar to one for which a module already
|
||||
exists, then you can start with that module instead. If you do so,
|
||||
remember to change the "AUTHOR" section at the top!
|
||||
|
||||
The first comment in a module contains information which is extracted
|
||||
and used by Configure. This information is marked with words in all
|
||||
capitals (such as "SYNOPSIS:" and "LIBS:"). Go look at m-template: it
|
||||
is fairly self-explanatory. The text after "LIBS:" (on the same line)
|
||||
is extracted and included in the LIBS definition of the Makefile so
|
||||
that extra libraries which may be necessary on some machines (such as
|
||||
"-lkvm") can be specified in the module. The text after "CFLAGS:"
|
||||
(on the same line) is extracted and included as flags in the "CFLAGS"
|
||||
definition of the Makefile (thus in every compilation step). This is
|
||||
used for rare circumstances only: please don't abuse this hook.
|
||||
|
||||
Some operating systems have idiosyncrasies which will affect the form
|
||||
and/or content of the information top displays. You may wish to
|
||||
document such anomalies in the top man page. This can be done by adding
|
||||
a file called m_{modulename}.man (where {modulename} is replaced with
|
||||
the name of the module). Configure will automatically add this file to
|
||||
the end of the man page. See m_sunos4.man for an example.
|
||||
|
||||
A module is concerned with two structures:
|
||||
|
||||
The statics struct is filled in by machine_init. Each item is a
|
||||
pointer to a list of character pointers. The list is terminated
|
||||
with a null pointer.
|
||||
|
||||
struct statics
|
||||
{
|
||||
char **procstate_names; /* process state names */
|
||||
char **cpustate_names; /* cpu state names */
|
||||
char **memory_names; /* memory information names */
|
||||
};
|
||||
|
||||
The system_info struct is filled in by get_system_info and
|
||||
get_process_info.
|
||||
|
||||
struct system_info
|
||||
{
|
||||
int last_pid; /* last pid assigned (0 means non-sequential assignment) */
|
||||
double load_avg[NUM_AVERAGES]; /* see below */
|
||||
int p_total; /* total number of processes */
|
||||
int p_active; /* number of procs considered "active" */
|
||||
int *procstates; /* array of process state counters */
|
||||
int *cpustates; /* array of cpustate counters */
|
||||
int *memory; /* memory information */
|
||||
};
|
||||
|
||||
The last three pointers each point to an array of integers. The
|
||||
length of the array is determined by the length of the corresponding
|
||||
_names array in the statics structure. Furthermore, if an entry in a
|
||||
_names array is the empty string ("") then the corresponding value in
|
||||
the value array will be skipped over. The display routine displays,
|
||||
for example, the string procstate_names[0] then the number
|
||||
procstates[0], then procstate_names[1], procstates[1], etc. until
|
||||
procstate_names[N] == NULL. This allows for a tremendous amount of
|
||||
flexibility in labeling the displayed values.
|
||||
|
||||
"procstates" and "memory" are displayed as straight integer values.
|
||||
Values in "cpustates" are displayed as a percentage * 10. For
|
||||
example, the (integer) value 105 is displayed as 10.5%.
|
||||
|
||||
These routines must be defined by the machine dependent module.
|
||||
|
||||
int machine_init(struct statics *)
|
||||
|
||||
returns 0 on success and -1 on failure,
|
||||
prints error messages
|
||||
|
||||
char *format_header(char *)
|
||||
|
||||
Returns a string which should be used as the header for the
|
||||
process display area. The argument is a string used to label
|
||||
the username column (either "USERNAME" or "UID") and is always
|
||||
8 characters in length.
|
||||
|
||||
void get_system_info(struct system_info *)
|
||||
|
||||
caddr_t get_process_info(struct system_info *, int, int, int (*func)())
|
||||
|
||||
returns a handle to use with format_next_process
|
||||
|
||||
char *format_next_process(caddr_t, char *(*func)())
|
||||
|
||||
returns string which describes next process
|
||||
|
||||
int proc_compare(caddr_t, caddr_t)
|
||||
|
||||
qsort comparison function
|
||||
|
||||
uid_t proc_owner(pid_t)
|
||||
|
||||
Returns the uid owner of the process specified by the pid argument.
|
||||
This function is VERY IMPORTANT. If it fails to do its job, then
|
||||
top may pose a security risk.
|
||||
|
||||
|
||||
get_process_info is called immediately after get_system_info. In
|
||||
fact, the two functions could be rolled in to one. The reason they
|
||||
are not is mostly historical.
|
||||
|
||||
Top relies on the existence of a function called "setpriority" to
|
||||
change a process's priority. This exists as a kernel call on most 4.3
|
||||
BSD derived Unixes. If neither your operating system nor your C
|
||||
library supplies such a function, then you will need to add one to the
|
||||
module. It is defined as follows:
|
||||
|
||||
int setpriority (int dummy, int who, int niceval)
|
||||
|
||||
For the purposes of top, the first argument is meaningless.
|
||||
The second is the pid and the third is the new nice value.
|
||||
This function should behave just like a kernel call, setting
|
||||
errno and returning -1 in case of an error. This function MUST
|
||||
check to make sure that a non-root user does not specify a nice
|
||||
value less than the process's current value. If it detects such
|
||||
a condition, it should set errno to EACCES and return -1.
|
||||
Other possible ERRNO values: ESRCH when pid "who" does not exist,
|
||||
EPERM when the invoker is not root and not the same as the
|
||||
process owner.
|
||||
|
||||
Note that top checks process ownership and should never call setpriority
|
||||
when the invoker's uid is not root and not the same as the process's owner
|
||||
uid.
|
||||
|
||||
|
||||
The file "machine.h" contains definitions which are useful to modules
|
||||
and to top.c (such as the structure definitions). You SHOULD NOT need
|
||||
to change it when porting to a new platform.
|
||||
|
||||
Porting to a new platform should NOT require any changes to existing
|
||||
files. You should only need to add m_ files. If you feel you need a
|
||||
change in one of the existing files, please contact me so that we can
|
||||
discuss the details. I want to keep such changes as general as
|
||||
possible.
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
TOP
|
||||
Version 3.4
|
||||
|
||||
William LeFebvre
|
||||
and a cast of dozens
|
||||
|
||||
|
||||
If you do not want to read this entire file, then at least read
|
||||
the section at the end entitled "KNOWN PROBLEMS".
|
||||
|
||||
If you are having any problems getting top to work, please read the
|
||||
file "FAQ" *before* contacting me. Thank you.
|
||||
|
||||
"top" is a program that will give continual reports about the state of
|
||||
the system, including a list of the top cpu using processes. Version 3
|
||||
of "top" has three primary design goals: provide an accurate snapshot of
|
||||
the system and process state, not be one of the top processes itself, be
|
||||
as portable as possible.
|
||||
|
||||
Version 3 has many bug fixes from version 2.5, and it has also been
|
||||
reorganized in a major way to make it easy to port to other platforms.
|
||||
All system dependent code is now contained in one file.
|
||||
|
||||
Top now includes a configuration script called "Configure". It helps
|
||||
the installer choose the correct parameters for this particular
|
||||
installation. This script MUST be run before attempting to compile top.
|
||||
|
||||
Top requires read access to the memory files "/dev/kmem" and "/dev/mem"
|
||||
as well as the system image "/vmunix". Some installations have these
|
||||
files protected from general access. These sites would have to install
|
||||
this program in the same way that programs such as "ps" are installed.
|
||||
In addition, on those Unix variants that support the proc filesystem
|
||||
(such as SVR4 and Solaris 2), top requires read access to all the files
|
||||
in /proc: typically dictating that top be installed setuid to root.
|
||||
|
||||
CAVEAT: version 3 of top has internal commands that kill and renice
|
||||
processes. Although I have taken steps to insure that top makes
|
||||
appropriate checks with these commands, I cannot guarantee that these
|
||||
internal commands are totally secure. IF YOU INSTALL top as a SETUID
|
||||
program, you do so AT YOUR OWN RISK! I realize that some operating
|
||||
systems will require top to run setuid, and I will do everything I can
|
||||
to make sure that top is a secure setuid program.
|
||||
|
||||
Configure will ask you to input values for certain parameters. Before
|
||||
each parameter, Configure will display a description of what the
|
||||
parameter does. Read the description and choose an appropriate value.
|
||||
Sometimes a default will appear in brackets. Typing just return will
|
||||
choose the default.
|
||||
|
||||
System support now takes the form of "modules". Adding support for
|
||||
a different architecture requires only adding a module. Configure
|
||||
asks which module to use when it is configuring top. See the file
|
||||
"Porting" for a description of how to write your own module.
|
||||
|
||||
To compile and install "top", read the file "INSTALL" and follow the
|
||||
directions and advice contained therein.
|
||||
|
||||
Once you have created a binary for one particular type of machine, you
|
||||
can reconfigure for another type with "./Configure modulename" where
|
||||
"modulename" is replaced with the appropriate module name. All other
|
||||
parameter values are kept the same. Note that in some cases this may
|
||||
not be appropriate.
|
||||
|
||||
If you make any kind of change to "top" that you feel would be
|
||||
beneficial to others who use this program, or if you find and fix a bug,
|
||||
please send me the change.
|
||||
|
||||
Be sure to read the FAQ enclosed with the distrubution. It contains
|
||||
answers to the most commonly asked questions about the configuration,
|
||||
installation, and operation of top.
|
||||
|
||||
AVAILABILITY
|
||||
|
||||
The latest version of "top" is now being made available via anonymous
|
||||
FTP from the host "ftp.groupsys.com" in the directory "/pub/top".
|
||||
Additional modules will be made available in the directory
|
||||
"/pub/top/m". The site "eecs.nwu.edu" will continue to house copies
|
||||
of the distribution as well.
|
||||
|
||||
Here are HTML links for the two best "top" archive sites:
|
||||
|
||||
<A HREF="ftp://ftp.groupsys.com/pub/top>Top archive (groupsys.com)</A>
|
||||
<A HREF="ftp://eecs.nwu.edu/pub/top>Top archive (eecs.nwu.edu)</A>
|
||||
|
||||
New releases will be posted to comp.sources.unix as they become
|
||||
available. Sites which arhive that newsgroup will also contain copies
|
||||
of the distribution.
|
||||
|
||||
KNOWN PROBLEMS:
|
||||
|
||||
Gnu CC
|
||||
|
||||
Compiling via Gnu CC continued to be the source of most of the
|
||||
questions I receive. By far the most common mistake made by those
|
||||
attempting to compile top with Gnu CC is out of date include files.
|
||||
When the operating system is upgraded, the include files that are part
|
||||
of the gcc package MUST also be updated. Gcc maintains its own
|
||||
include files. Even a minor OS upgrade can involve changes to some of
|
||||
the kernel's internal data structures, which are defined in include
|
||||
files in "sys". Top is very sensitive to these changes. If you are
|
||||
compiling with gcc and experience any sort of strange problems, please
|
||||
make sure the include files you are using are up to date BEFORE
|
||||
sending me a bug report. Look in the gcc source distribution for the
|
||||
shell script "fixincludes".
|
||||
|
||||
HP/UX 10.10
|
||||
|
||||
In their infinite wisdom, the folks at HP have decided that mere mortals
|
||||
such as you and I don't need to know what the kernel's proc structure looks
|
||||
like. To that end, they have removed all useful content from the include
|
||||
file <sys/proc.h> in version 10.10. As a result, top will not compile
|
||||
under 10.10. What HP is trying to accomplish with this move is to force
|
||||
iconoclasts such as myself to use "pstat" for collecting all process
|
||||
information. I have no immediate solution for this problem, but hope to
|
||||
obtain a sufficiently complete definition of "struct proc" at some point in
|
||||
the near future. Stay tuned.
|
||||
|
||||
DIGITAL UNIX 4.0 (DECOSF/1 V4.0)
|
||||
|
||||
A user has reported that idle processes are not displayed regardless
|
||||
of the flags used when invoking top. We have not had time to track
|
||||
this problem down.
|
||||
|
||||
DECOSF/1 V3.0
|
||||
|
||||
There is a bug either in the module, in utils.c, or in DEC's optimizer that
|
||||
is tickled by the decosf1 module when compiled under V3.0 (and perhaps
|
||||
earlier versions). Top compiled using DEC's compiler with optimization
|
||||
will consistently produce a segmentation fault (in format_next_process
|
||||
while calling sprintf). To work around this problem, either compile top
|
||||
with gcc or turn off optimization (compile without -O). We think that
|
||||
one of the bugs fixed in utils.c fixed this problem as well, but we are
|
||||
not certain.
|
||||
|
||||
|
||||
System V R 4.2
|
||||
|
||||
Load average and memory displays do not work. The problem has been
|
||||
traced down to a potential bug in the "mem" driver. The author
|
||||
of the svr42 module is working on a fix.
|
||||
|
||||
|
||||
|
||||
GRATITUDE
|
||||
|
||||
My perpetual thanks to all the people who have helped me support top
|
||||
on so many platforms. Without these people, top would not be what it
|
||||
is. Here is a partial list of contributors and other individuals.
|
||||
|
||||
Robert Boucher <[email protected]>
|
||||
Marc Cohen <[email protected]>
|
||||
David Cutter <[email protected]>
|
||||
Casper Dik <[email protected]>
|
||||
Charles Hedrick <[email protected]>
|
||||
Andrew Herbert <[email protected]>
|
||||
Jeff Janvrin <[email protected]>
|
||||
Torsten Kasch <[email protected]>
|
||||
Petri Kutvonen <[email protected]>
|
||||
William L. Jones <jones@chpc>
|
||||
Tim Pugh <[email protected]>
|
||||
Steve Scherf <[email protected]>
|
||||
Phillip Wu <[email protected]>
|
||||
|
||||
(My apologies if I missed anyone.)
|
||||
|
||||
|
||||
AUTHOR
|
||||
|
||||
William LeFebvre
|
||||
Group sys Consulting
|
||||
[email protected]
|
||||
|
||||
|
||||
U.S. Mail address:
|
||||
William LeFebvre
|
||||
170 Colton Crest Drive
|
||||
Alpharetta, GA 30202
|
||||
(770) 813-3224
|
||||
@@ -0,0 +1,5 @@
|
||||
/* My favorite names for boolean values */
|
||||
#define No 0
|
||||
#define Yes 1
|
||||
#define Maybe 2 /* tri-state boolean, actually */
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains the routines that implement some of the interactive
|
||||
* mode commands. Note that some of the commands are implemented in-line
|
||||
* in "main". This is necessary because they change the global state of
|
||||
* "top" (i.e.: changing the number of processes to display).
|
||||
*/
|
||||
|
||||
#include "os.h"
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "sigdesc.h" /* generated automatically */
|
||||
#include "boolean.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern int errno;
|
||||
|
||||
extern char *copyright;
|
||||
|
||||
/* imported from screen.c */
|
||||
extern int overstrike;
|
||||
|
||||
int err_compar();
|
||||
char *err_string();
|
||||
|
||||
/*
|
||||
* show_help() - display the help screen; invoked in response to
|
||||
* either 'h' or '?'.
|
||||
*/
|
||||
|
||||
show_help()
|
||||
|
||||
{
|
||||
printf("Top version %s, %s\n", version_string(), copyright);
|
||||
fputs("\n\n\
|
||||
A top users display for Unix\n\
|
||||
\n\
|
||||
These single-character commands are available:\n\
|
||||
\n\
|
||||
^L - redraw screen\n\
|
||||
q - quit\n\
|
||||
h or ? - help; show this text\n", stdout);
|
||||
|
||||
/* not all commands are availalbe with overstrike terminals */
|
||||
if (overstrike)
|
||||
{
|
||||
fputs("\n\
|
||||
Other commands are also available, but this terminal is not\n\
|
||||
sophisticated enough to handle those commands gracefully.\n\n", stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs("\
|
||||
d - change number of displays to show\n\
|
||||
e - list errors generated by last \"kill\" or \"renice\" command\n\
|
||||
i - toggle the displaying of idle processes\n\
|
||||
I - same as 'i'\n\
|
||||
k - kill processes; send a signal to a list of processes\n\
|
||||
n or # - change number of processes to display\n", stdout);
|
||||
#ifdef ORDER
|
||||
fputs("\
|
||||
o - specify sort order (size, res, cpu, time)\n", stdout);
|
||||
#endif
|
||||
fputs("\
|
||||
r - renice a process\n\
|
||||
s - change number of seconds to delay between updates\n\
|
||||
u - display processes for only one user (+ selects all users)\n\
|
||||
\n\
|
||||
\n", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility routines that help with some of the commands.
|
||||
*/
|
||||
|
||||
char *next_field(str)
|
||||
|
||||
register char *str;
|
||||
|
||||
{
|
||||
if ((str = strchr(str, ' ')) == NULL)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
*str = '\0';
|
||||
while (*++str == ' ') /* loop */;
|
||||
|
||||
/* if there is nothing left of the string, return NULL */
|
||||
/* This fix is dedicated to Greg Earle */
|
||||
return(*str == '\0' ? NULL : str);
|
||||
}
|
||||
|
||||
scanint(str, intp)
|
||||
|
||||
char *str;
|
||||
int *intp;
|
||||
|
||||
{
|
||||
register int val = 0;
|
||||
register char ch;
|
||||
|
||||
/* if there is nothing left of the string, flag it as an error */
|
||||
/* This fix is dedicated to Greg Earle */
|
||||
if (*str == '\0')
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while ((ch = *str++) != '\0')
|
||||
{
|
||||
if (isdigit(ch))
|
||||
{
|
||||
val = val * 10 + (ch - '0');
|
||||
}
|
||||
else if (isspace(ch))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
*intp = val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Some of the commands make system calls that could generate errors.
|
||||
* These errors are collected up in an array of structures for later
|
||||
* contemplation and display. Such routines return a string containing an
|
||||
* error message, or NULL if no errors occurred. The next few routines are
|
||||
* for manipulating and displaying these errors. We need an upper limit on
|
||||
* the number of errors, so we arbitrarily choose 20.
|
||||
*/
|
||||
|
||||
#define ERRMAX 20
|
||||
|
||||
struct errs /* structure for a system-call error */
|
||||
{
|
||||
int errno; /* value of errno (that is, the actual error) */
|
||||
char *arg; /* argument that caused the error */
|
||||
};
|
||||
|
||||
static struct errs errs[ERRMAX];
|
||||
static int errcnt;
|
||||
static char *err_toomany = " too many errors occurred";
|
||||
static char *err_listem =
|
||||
" Many errors occurred. Press `e' to display the list of errors.";
|
||||
|
||||
/* These macros get used to reset and log the errors */
|
||||
#define ERR_RESET errcnt = 0
|
||||
#define ERROR(p, e) if (errcnt >= ERRMAX) \
|
||||
{ \
|
||||
return(err_toomany); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
errs[errcnt].arg = (p); \
|
||||
errs[errcnt++].errno = (e); \
|
||||
}
|
||||
|
||||
/*
|
||||
* err_string() - return an appropriate error string. This is what the
|
||||
* command will return for displaying. If no errors were logged, then
|
||||
* return NULL. The maximum length of the error string is defined by
|
||||
* "STRMAX".
|
||||
*/
|
||||
|
||||
#define STRMAX 80
|
||||
|
||||
char *err_string()
|
||||
|
||||
{
|
||||
register struct errs *errp;
|
||||
register int cnt = 0;
|
||||
register int first = Yes;
|
||||
register int currerr = -1;
|
||||
int stringlen; /* characters still available in "string" */
|
||||
static char string[STRMAX];
|
||||
|
||||
/* if there are no errors, return NULL */
|
||||
if (errcnt == 0)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* sort the errors */
|
||||
qsort((char *)errs, errcnt, sizeof(struct errs), err_compar);
|
||||
|
||||
/* need a space at the front of the error string */
|
||||
string[0] = ' ';
|
||||
string[1] = '\0';
|
||||
stringlen = STRMAX - 2;
|
||||
|
||||
/* loop thru the sorted list, building an error string */
|
||||
while (cnt < errcnt)
|
||||
{
|
||||
errp = &(errs[cnt++]);
|
||||
if (errp->errno != currerr)
|
||||
{
|
||||
if (currerr != -1)
|
||||
{
|
||||
if ((stringlen = str_adderr(string, stringlen, currerr)) < 2)
|
||||
{
|
||||
return(err_listem);
|
||||
}
|
||||
(void) strcat(string, "; "); /* we know there's more */
|
||||
}
|
||||
currerr = errp->errno;
|
||||
first = Yes;
|
||||
}
|
||||
if ((stringlen = str_addarg(string, stringlen, errp->arg, first)) ==0)
|
||||
{
|
||||
return(err_listem);
|
||||
}
|
||||
first = No;
|
||||
}
|
||||
|
||||
/* add final message */
|
||||
stringlen = str_adderr(string, stringlen, currerr);
|
||||
|
||||
/* return the error string */
|
||||
return(stringlen == 0 ? err_listem : string);
|
||||
}
|
||||
|
||||
/*
|
||||
* str_adderr(str, len, err) - add an explanation of error "err" to
|
||||
* the string "str".
|
||||
*/
|
||||
|
||||
str_adderr(str, len, err)
|
||||
|
||||
char *str;
|
||||
int len;
|
||||
int err;
|
||||
|
||||
{
|
||||
register char *msg;
|
||||
register int msglen;
|
||||
|
||||
msg = err == 0 ? "Not a number" : errmsg(err);
|
||||
msglen = strlen(msg) + 2;
|
||||
if (len <= msglen)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
(void) strcat(str, ": ");
|
||||
(void) strcat(str, msg);
|
||||
return(len - msglen);
|
||||
}
|
||||
|
||||
/*
|
||||
* str_addarg(str, len, arg, first) - add the string argument "arg" to
|
||||
* the string "str". This is the first in the group when "first"
|
||||
* is set (indicating that a comma should NOT be added to the front).
|
||||
*/
|
||||
|
||||
str_addarg(str, len, arg, first)
|
||||
|
||||
char *str;
|
||||
int len;
|
||||
char *arg;
|
||||
int first;
|
||||
|
||||
{
|
||||
register int arglen;
|
||||
|
||||
arglen = strlen(arg);
|
||||
if (!first)
|
||||
{
|
||||
arglen += 2;
|
||||
}
|
||||
if (len <= arglen)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
if (!first)
|
||||
{
|
||||
(void) strcat(str, ", ");
|
||||
}
|
||||
(void) strcat(str, arg);
|
||||
return(len - arglen);
|
||||
}
|
||||
|
||||
/*
|
||||
* err_compar(p1, p2) - comparison routine used by "qsort"
|
||||
* for sorting errors.
|
||||
*/
|
||||
|
||||
err_compar(p1, p2)
|
||||
|
||||
register struct errs *p1, *p2;
|
||||
|
||||
{
|
||||
register int result;
|
||||
|
||||
if ((result = p1->errno - p2->errno) == 0)
|
||||
{
|
||||
return(strcmp(p1->arg, p2->arg));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* error_count() - return the number of errors currently logged.
|
||||
*/
|
||||
|
||||
error_count()
|
||||
|
||||
{
|
||||
return(errcnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* show_errors() - display on stdout the current log of errors.
|
||||
*/
|
||||
|
||||
show_errors()
|
||||
|
||||
{
|
||||
register int cnt = 0;
|
||||
register struct errs *errp = errs;
|
||||
|
||||
printf("%d error%s:\n\n", errcnt, errcnt == 1 ? "" : "s");
|
||||
while (cnt++ < errcnt)
|
||||
{
|
||||
printf("%5s: %s\n", errp->arg,
|
||||
errp->errno == 0 ? "Not a number" : errmsg(errp->errno));
|
||||
errp++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* kill_procs(str) - send signals to processes, much like the "kill"
|
||||
* command does; invoked in response to 'k'.
|
||||
*/
|
||||
|
||||
char *kill_procs(str)
|
||||
|
||||
char *str;
|
||||
|
||||
{
|
||||
register char *nptr;
|
||||
int signum = SIGTERM; /* default */
|
||||
int procnum;
|
||||
struct sigdesc *sigp;
|
||||
int uid;
|
||||
|
||||
/* reset error array */
|
||||
ERR_RESET;
|
||||
|
||||
/* remember our uid */
|
||||
uid = getuid();
|
||||
|
||||
/* skip over leading white space */
|
||||
while (isspace(*str)) str++;
|
||||
|
||||
if (str[0] == '-')
|
||||
{
|
||||
/* explicit signal specified */
|
||||
if ((nptr = next_field(str)) == NULL)
|
||||
{
|
||||
return(" kill: no processes specified");
|
||||
}
|
||||
|
||||
if (isdigit(str[1]))
|
||||
{
|
||||
(void) scanint(str + 1, &signum);
|
||||
if (signum <= 0 || signum >= NSIG)
|
||||
{
|
||||
return(" invalid signal number");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* translate the name into a number */
|
||||
for (sigp = sigdesc; sigp->name != NULL; sigp++)
|
||||
{
|
||||
if (strcmp(sigp->name, str + 1) == 0)
|
||||
{
|
||||
signum = sigp->number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* was it ever found */
|
||||
if (sigp->name == NULL)
|
||||
{
|
||||
return(" bad signal name");
|
||||
}
|
||||
}
|
||||
/* put the new pointer in place */
|
||||
str = nptr;
|
||||
}
|
||||
|
||||
/* loop thru the string, killing processes */
|
||||
do
|
||||
{
|
||||
if (scanint(str, &procnum) == -1)
|
||||
{
|
||||
ERROR(str, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* check process owner if we're not root */
|
||||
if (uid && (uid != proc_owner(procnum)))
|
||||
{
|
||||
ERROR(str, EACCES);
|
||||
}
|
||||
/* go in for the kill */
|
||||
else if (kill(procnum, signum) == -1)
|
||||
{
|
||||
/* chalk up an error */
|
||||
ERROR(str, errno);
|
||||
}
|
||||
}
|
||||
} while ((str = next_field(str)) != NULL);
|
||||
|
||||
/* return appropriate error string */
|
||||
return(err_string());
|
||||
}
|
||||
|
||||
/*
|
||||
* renice_procs(str) - change the "nice" of processes, much like the
|
||||
* "renice" command does; invoked in response to 'r'.
|
||||
*/
|
||||
|
||||
char *renice_procs(str)
|
||||
|
||||
char *str;
|
||||
|
||||
{
|
||||
register char negate;
|
||||
int prio;
|
||||
int procnum;
|
||||
int uid;
|
||||
|
||||
ERR_RESET;
|
||||
uid = getuid();
|
||||
|
||||
/* allow for negative priority values */
|
||||
if ((negate = (*str == '-')) != 0)
|
||||
{
|
||||
/* move past the minus sign */
|
||||
str++;
|
||||
}
|
||||
|
||||
/* use procnum as a temporary holding place and get the number */
|
||||
procnum = scanint(str, &prio);
|
||||
|
||||
/* negate if necessary */
|
||||
if (negate)
|
||||
{
|
||||
prio = -prio;
|
||||
}
|
||||
|
||||
#if defined(PRIO_MIN) && defined(PRIO_MAX)
|
||||
/* check for validity */
|
||||
if (procnum == -1 || prio < PRIO_MIN || prio > PRIO_MAX)
|
||||
{
|
||||
return(" bad priority value");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* move to the first process number */
|
||||
if ((str = next_field(str)) == NULL)
|
||||
{
|
||||
return(" no processes specified");
|
||||
}
|
||||
|
||||
/* loop thru the process numbers, renicing each one */
|
||||
do
|
||||
{
|
||||
if (scanint(str, &procnum) == -1)
|
||||
{
|
||||
ERROR(str, 0);
|
||||
}
|
||||
|
||||
/* check process owner if we're not root */
|
||||
else if (uid && (uid != proc_owner(procnum)))
|
||||
{
|
||||
ERROR(str, EACCES);
|
||||
}
|
||||
else if (setpriority(PRIO_PROCESS, procnum, prio) == -1)
|
||||
{
|
||||
ERROR(str, errno);
|
||||
}
|
||||
} while ((str = next_field(str)) != NULL);
|
||||
|
||||
/* return appropriate error string */
|
||||
return(err_string());
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
/* constants needed for display.c */
|
||||
|
||||
/* "type" argument for new_message function */
|
||||
|
||||
#define MT_standout 1
|
||||
#define MT_delayed 2
|
||||
|
||||
Executable
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/csh -f
|
||||
set ny = (no yes)
|
||||
if ($2 == "yesno") then
|
||||
@ i = $3 + 1
|
||||
set pmpt = "$1 [$ny[$i]]: "
|
||||
else
|
||||
if ("$3" == "") then
|
||||
set pmpt = "${1}"
|
||||
else
|
||||
set pmpt = "$1 [$3]: "
|
||||
endif
|
||||
endif
|
||||
rpt:
|
||||
echo -n "$pmpt"
|
||||
set input = $<
|
||||
switch ($2)
|
||||
case number:
|
||||
set tmp = `echo $input | tr -d 0123456789.`
|
||||
if ("x$tmp" != x) then
|
||||
echo "Invalid number. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case integer:
|
||||
set tmp = `echo $input | tr -d 0123456789`
|
||||
if ("x$tmp" != x) then
|
||||
echo "Invalid integer. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case neginteger:
|
||||
if ("x$input" != x-1) then
|
||||
set tmp = `echo $input | tr -d 0123456789`
|
||||
if ("x$tmp" != x) then
|
||||
echo "Invalid integer. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case file:
|
||||
if ("x$input" == "x") then
|
||||
set input = $3
|
||||
endif
|
||||
if (! -e "$input") then
|
||||
echo The file $input "does not exist. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case path:
|
||||
if ("x$input" == "x") then
|
||||
set input = "$3"
|
||||
endif
|
||||
if (! -e "$input") then
|
||||
foreach elt ($path)
|
||||
if (-e "$elt/$input") breaksw
|
||||
end
|
||||
echo The command $input "was not found. Please try again."
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case yesno:
|
||||
if ("x$input" == xy || "x$input" == xyes) then
|
||||
set input = 1
|
||||
else if ("x$input" == xn || "x$input" == xno) then
|
||||
set input = 0
|
||||
else if ("x$input" != x) then
|
||||
echo 'Please answer "yes" or "no".'
|
||||
goto rpt
|
||||
endif
|
||||
breaksw
|
||||
|
||||
default:
|
||||
breaksw
|
||||
|
||||
endsw
|
||||
|
||||
if ("x$input" == x) then
|
||||
set input = "$3"
|
||||
endif
|
||||
|
||||
echo $input > $4
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* "getopt" routine customized for top.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Many modern-day Unix implementations already have this function
|
||||
* in libc. The standard "getopt" is perfectly sufficient for top's
|
||||
* needs. If such a function exists in libc then you certainly don't
|
||||
* need to compile this one in. To prevent this function from being
|
||||
* compiled, define "HAVE_GETOPT". This is usually done in the "CFLAGS"
|
||||
* line of the corresponding machine module.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This empty declaration exists solely to placate overexhuberant C
|
||||
* compilers that like to warn you about content-free files.
|
||||
*/
|
||||
static void __empty();
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
|
||||
/*LINTLIBRARY*/
|
||||
|
||||
#include "os.h"
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
#define ERR(s, c) if(opterr){\
|
||||
extern int write();\
|
||||
char errbuf[2];\
|
||||
errbuf[0] = c; errbuf[1] = '\n';\
|
||||
(void) write(2, argv[0], strlen(argv[0]));\
|
||||
(void) write(2, s, strlen(s));\
|
||||
(void) write(2, errbuf, 2);}
|
||||
|
||||
|
||||
int opterr = 1;
|
||||
int optind = 1;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
int
|
||||
getopt(argc, argv, opts)
|
||||
int argc;
|
||||
char **argv, *opts;
|
||||
{
|
||||
static int sp = 1;
|
||||
register int c;
|
||||
register char *cp;
|
||||
|
||||
if(sp == 1)
|
||||
if(optind >= argc ||
|
||||
argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
return(EOF);
|
||||
else if(strcmp(argv[optind], "--") == 0) {
|
||||
optind++;
|
||||
return(EOF);
|
||||
}
|
||||
optopt = c = argv[optind][sp];
|
||||
if(c == ':' || (cp=strchr(opts, c)) == NULL) {
|
||||
ERR(": unknown option, -", c);
|
||||
if(argv[optind][++sp] == '\0') {
|
||||
optind++;
|
||||
sp = 1;
|
||||
}
|
||||
return('?');
|
||||
}
|
||||
if(*++cp == ':') {
|
||||
if(argv[optind][sp+1] != '\0')
|
||||
optarg = &argv[optind++][sp+1];
|
||||
else if(++optind >= argc) {
|
||||
ERR(": argument missing for -", c);
|
||||
sp = 1;
|
||||
return('?');
|
||||
} else
|
||||
optarg = argv[optind++];
|
||||
sp = 1;
|
||||
} else {
|
||||
if(argv[optind][++sp] == '\0') {
|
||||
sp = 1;
|
||||
optind++;
|
||||
}
|
||||
optarg = NULL;
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
#endif /* HAVE_GETOPT */
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# this shell script is amazingly similar to the old and lamented
|
||||
# BSD "install" command. It recognized the following options:
|
||||
#
|
||||
# -o target file owner
|
||||
# -m target file mode
|
||||
# -g target file group owner
|
||||
#
|
||||
#
|
||||
# scan the options
|
||||
#
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-o)
|
||||
owner=$2
|
||||
shift ; shift
|
||||
;;
|
||||
|
||||
-m)
|
||||
mode=$2
|
||||
shift; shift
|
||||
;;
|
||||
|
||||
-g)
|
||||
group=$2
|
||||
shift ; shift
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo "install: unknown option $1"
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
#
|
||||
# we need two more: filename and destination
|
||||
#
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: install [ -o owner ] [ -m mode ] [ -g group ] file destination"
|
||||
exit
|
||||
fi
|
||||
#
|
||||
# first, copy
|
||||
#
|
||||
cp $1 $2
|
||||
#
|
||||
# normalize the name
|
||||
#
|
||||
dest=$2
|
||||
if [ -d $2 ]; then
|
||||
dest=$2/`basename $1`
|
||||
fi
|
||||
#
|
||||
# do optional things
|
||||
#
|
||||
if [ "$owner" ]; then
|
||||
chown $owner $dest
|
||||
fi
|
||||
if [ "$group" ]; then
|
||||
chgrp $group $dest
|
||||
fi
|
||||
if [ "$mode" ]; then
|
||||
chmod $mode $dest
|
||||
fi
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Top - a top users display for Berkeley Unix
|
||||
*
|
||||
* This file defines the locations on tne screen for various parts of the
|
||||
* display. These definitions are used by the routines in "display.c" for
|
||||
* cursor addressing.
|
||||
*/
|
||||
|
||||
#define x_lastpid 10
|
||||
#define y_lastpid 0
|
||||
#define x_loadave 33
|
||||
#define x_loadave_nompid 15
|
||||
#define y_loadave 0
|
||||
#define x_procstate 0
|
||||
#define y_procstate 1
|
||||
#define x_brkdn 15
|
||||
#define y_brkdn 1
|
||||
#define x_mem 5
|
||||
#define y_mem 3
|
||||
#define x_swap 6
|
||||
#define y_swap 4
|
||||
#define y_message 5
|
||||
#define x_header 0
|
||||
#define y_header 6
|
||||
#define x_idlecursor 0
|
||||
#define y_idlecursor 5
|
||||
#define y_procs 7
|
||||
|
||||
#define y_cpustates 2
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Top - a top users display for Berkeley Unix
|
||||
*
|
||||
* Defines required to access load average figures.
|
||||
*
|
||||
* This include file sets up everything we need to access the load average
|
||||
* values in the kernel in a machine independent way. First, it sets the
|
||||
* typedef "load_avg" to be either double or long (depending on what is
|
||||
* needed), then it defines these macros appropriately:
|
||||
*
|
||||
* loaddouble(la) - convert load_avg to double.
|
||||
* intload(i) - convert integer to load_avg.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We assume that if FSCALE is defined, then avenrun and ccpu are type long.
|
||||
* If your machine is an exception (mips, perhaps?) then make adjustments
|
||||
* here.
|
||||
*
|
||||
* Defined types: load_avg for load averages, pctcpu for cpu percentages.
|
||||
*/
|
||||
#if defined(mips) && !defined(NetBSD)
|
||||
# include <sys/fixpoint.h>
|
||||
# if defined(FBITS) && !defined(FSCALE)
|
||||
# define FSCALE (1 << FBITS) /* mips */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef FSCALE
|
||||
# define FIXED_LOADAVG FSCALE
|
||||
# define FIXED_PCTCPU FSCALE
|
||||
#endif
|
||||
|
||||
#ifdef ibm032
|
||||
# undef FIXED_LOADAVG
|
||||
# undef FIXED_PCTCPU
|
||||
# define FIXED_PCTCPU PCT_SCALE
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FIXED_PCTCPU
|
||||
typedef long pctcpu;
|
||||
# define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
|
||||
#else
|
||||
typedef double pctcpu;
|
||||
# define pctdouble(p) (p)
|
||||
#endif
|
||||
|
||||
#ifdef FIXED_LOADAVG
|
||||
typedef long load_avg;
|
||||
# define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
|
||||
# define intload(i) ((int)((i) * FIXED_LOADAVG))
|
||||
#else
|
||||
typedef double load_avg;
|
||||
# define loaddouble(la) (la)
|
||||
# define intload(i) ((double)(i))
|
||||
#endif
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* top - a top users display for Unix
|
||||
*
|
||||
* THIS IS A TEMPLATE FILE FOR A MACHINE DEPENDENT (m_...c) FILE
|
||||
*
|
||||
* SYNOPSIS: one line description of machine this module works with
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Detailed description of this machine dependent module.
|
||||
* It can be multiple lines, but a blank comment line (one with only an
|
||||
* asterisk) is considered to end it. Place here a complete list of
|
||||
* the machines and OS versions that this module works on.
|
||||
*
|
||||
* LIBS: list of special libraries to include at link step (REMOVE THIS LINE IF NOT NEEDED)
|
||||
*
|
||||
* AUTHOR: your name and <[email protected]>
|
||||
*/
|
||||
|
||||
#include "top.h"
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
/*
|
||||
* These definitions control the format of the per-process area
|
||||
*/
|
||||
|
||||
static char header[] =
|
||||
" PID X PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND";
|
||||
/* 0123456 -- field to fill in starts at header+6 */
|
||||
#define UNAME_START 6
|
||||
|
||||
#define Proc_format \
|
||||
"%5d %-8.8s %3d %4d%6dK %4dK %-5s%4d:%02d %5.2f%% %5.2f%% %.14s"
|
||||
|
||||
/* these are for detailing the process states */
|
||||
|
||||
int process_states[?];
|
||||
char *procstatenames[] = {
|
||||
"", " sleeping, ", " ABANDONED, ", " running, ", " starting, ",
|
||||
" zombie, ", " stopped, ",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* these are for detailing the cpu states */
|
||||
|
||||
int cpu_states[?];
|
||||
char *cpustatenames[] = {
|
||||
"user", "nice", "system", "idle",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* these are for detailing the memory statistics */
|
||||
|
||||
int memory_stats[?];
|
||||
char *memorynames[] = {
|
||||
"K available, ", "K in use, ", "K free, ", "K locked", NULL
|
||||
};
|
||||
|
||||
/* useful externals */
|
||||
extern int errno;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
long lseek();
|
||||
long time();
|
||||
long percentages();
|
||||
|
||||
machine_init(statics)
|
||||
|
||||
struct statics *statics;
|
||||
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
char *format_header(uname_field)
|
||||
|
||||
register char *uname_field;
|
||||
|
||||
{
|
||||
register char *ptr;
|
||||
|
||||
ptr = header + UNAME_START;
|
||||
while (*uname_field != '\0')
|
||||
{
|
||||
*ptr++ = *uname_field++;
|
||||
}
|
||||
|
||||
return(header);
|
||||
}
|
||||
|
||||
get_system_info(si)
|
||||
|
||||
struct system_info *si;
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
static struct handle handle;
|
||||
|
||||
caddr_t get_process_info(si, sel, compare)
|
||||
|
||||
struct system_info *si;
|
||||
struct process_select *sel;
|
||||
int (*compare)();
|
||||
|
||||
{
|
||||
return((caddr_t)&handle);
|
||||
}
|
||||
|
||||
char fmt[128]; /* static area where result is built */
|
||||
|
||||
/* define what weighted cpu is. */
|
||||
#define weighted_cpu(pct, pp) ((pp)->p_time == 0 ? 0.0 : \
|
||||
((pct) / (1.0 - exp((pp)->p_time * logcpu))))
|
||||
|
||||
char *format_next_process(handle, get_userid)
|
||||
|
||||
caddr_t handle;
|
||||
char *(*get_userid)();
|
||||
|
||||
{
|
||||
return(fmt);
|
||||
}
|
||||
|
||||
/*
|
||||
* getkval(offset, ptr, size, refstr) - get a value out of the kernel.
|
||||
* "offset" is the byte offset into the kernel for the desired value,
|
||||
* "ptr" points to a buffer into which the value is retrieved,
|
||||
* "size" is the size of the buffer (and the object to retrieve),
|
||||
* "refstr" is a reference string used when printing error meessages,
|
||||
* if "refstr" starts with a '!', then a failure on read will not
|
||||
* be fatal (this may seem like a silly way to do things, but I
|
||||
* really didn't want the overhead of another argument).
|
||||
*
|
||||
*/
|
||||
|
||||
getkval(offset, ptr, size, refstr)
|
||||
|
||||
unsigned long offset;
|
||||
int *ptr;
|
||||
int size;
|
||||
char *refstr;
|
||||
|
||||
{
|
||||
if (kvm_read(kd, offset, ptr, size) != size)
|
||||
{
|
||||
if (*refstr == '!')
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "top: kvm_read for %s: %s\n",
|
||||
refstr, sys_errlist[errno]);
|
||||
quit(23);
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* comparison routine for qsort */
|
||||
/* NOTE: this is specific to the BSD proc structure, but it should
|
||||
give you a good place to start. */
|
||||
|
||||
/*
|
||||
* proc_compare - comparison function for "qsort"
|
||||
* Compares the resource consumption of two processes using five
|
||||
* distinct keys. The keys (in descending order of importance) are:
|
||||
* percent cpu, cpu ticks, state, resident set size, total virtual
|
||||
* memory usage. The process states are ordered as follows (from least
|
||||
* to most important): WAIT, zombie, sleep, stop, start, run. The
|
||||
* array declaration below maps a process state index into a number
|
||||
* that reflects this ordering.
|
||||
*/
|
||||
|
||||
static unsigned char sorted_state[] =
|
||||
{
|
||||
0, /* not used */
|
||||
3, /* sleep */
|
||||
1, /* ABANDONED (WAIT) */
|
||||
6, /* run */
|
||||
5, /* start */
|
||||
2, /* zombie */
|
||||
4 /* stop */
|
||||
};
|
||||
|
||||
proc_compare(pp1, pp2)
|
||||
|
||||
struct proc **pp1;
|
||||
struct proc **pp2;
|
||||
|
||||
{
|
||||
register struct proc *p1;
|
||||
register struct proc *p2;
|
||||
register int result;
|
||||
register pctcpu lresult;
|
||||
|
||||
/* remove one level of indirection */
|
||||
p1 = *pp1;
|
||||
p2 = *pp2;
|
||||
|
||||
/* compare percent cpu (pctcpu) */
|
||||
if ((lresult = p2->p_pctcpu - p1->p_pctcpu) == 0)
|
||||
{
|
||||
/* use cpticks to break the tie */
|
||||
if ((result = p2->p_cpticks - p1->p_cpticks) == 0)
|
||||
{
|
||||
/* use process state to break the tie */
|
||||
if ((result = sorted_state[p2->p_stat] -
|
||||
sorted_state[p1->p_stat]) == 0)
|
||||
{
|
||||
/* use priority to break the tie */
|
||||
if ((result = p2->p_pri - p1->p_pri) == 0)
|
||||
{
|
||||
/* use resident set size (rssize) to break the tie */
|
||||
if ((result = p2->p_rssize - p1->p_rssize) == 0)
|
||||
{
|
||||
/* use total memory to break the tie */
|
||||
result = PROCSIZE(p2) - PROCSIZE(p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = lresult < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
proc_owner(pid)
|
||||
|
||||
int pid;
|
||||
|
||||
{
|
||||
/* returns uid of owner of process pid */
|
||||
return(uid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file defines the interface between top and the machine-dependent
|
||||
* module. It is NOT machine dependent and should not need to be changed
|
||||
* for any specific machine.
|
||||
*/
|
||||
|
||||
/*
|
||||
* the statics struct is filled in by machine_init
|
||||
*/
|
||||
struct statics
|
||||
{
|
||||
char **procstate_names;
|
||||
char **cpustate_names;
|
||||
char **memory_names;
|
||||
char **swap_names;
|
||||
#ifdef ORDER
|
||||
char **order_names;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* the system_info struct is filled in by a machine dependent routine.
|
||||
*/
|
||||
|
||||
struct system_info
|
||||
{
|
||||
int last_pid;
|
||||
double load_avg[NUM_AVERAGES];
|
||||
int p_total;
|
||||
int p_active; /* number of procs considered "active" */
|
||||
int *procstates;
|
||||
int *cpustates;
|
||||
int *memory;
|
||||
int *swap;
|
||||
};
|
||||
|
||||
/* cpu_states is an array of percentages * 10. For example,
|
||||
the (integer) value 105 is 10.5% (or .105).
|
||||
*/
|
||||
|
||||
/*
|
||||
* the process_select struct tells get_process_info what processes we
|
||||
* are interested in seeing
|
||||
*/
|
||||
|
||||
struct process_select
|
||||
{
|
||||
int idle; /* show idle processes */
|
||||
int system; /* show system processes */
|
||||
int uid; /* only this uid (unless uid == -1) */
|
||||
char *command; /* only this command (unless == NULL) */
|
||||
};
|
||||
|
||||
/* routines defined by the machine dependent module */
|
||||
|
||||
char *format_header();
|
||||
char *format_next_process();
|
||||
|
||||
/* non-int routines typically used by the machine dependent module */
|
||||
char *printable();
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Top is very sensitive to differences in the kernel, so much so that an
|
||||
# executable created on one sub-architecture may not work on others. It
|
||||
# is also quite common for a minor OS revision to require recompilation of
|
||||
# top. Both of these problems are especially prevalent on Suns. For
|
||||
# example, a top executable made under SunOS 4.1.1 will not run correctly
|
||||
# under SunOS 4.1.2, and vice versa. "metatop" attempts to solve this
|
||||
# problem by choosing one of several possible top executables to run then
|
||||
# executing it.
|
||||
#
|
||||
# To use metatop your operating system needs to have the command "uname"
|
||||
# as part of the standard OS release. MAKE SURE IT DOES before proceeding.
|
||||
# It will try to execute the command "top-`uname -m`-`uname -r`" For
|
||||
# example, on a sparcstation 1 running SunOS 4.1.1, it will try to run
|
||||
# "top-sun4c-4.1.1".
|
||||
#
|
||||
# INSTALLATION is easy. Just compile top as normal. Then use the command
|
||||
# "make metainstall" (on the same machine!) instead of the usual. "make"
|
||||
# will insure that this shell script is installed correctly then will install
|
||||
# the most recently made top executable with the correct name. Remember:
|
||||
# you will need to "make clean" and "make metainstall" on every different
|
||||
# combination of sub-architecture and OS version that you have.
|
||||
#
|
||||
exec $0-`uname -m`-`uname -r` "$@"
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h> /* This defines BSD */
|
||||
#if defined(BSD) && !defined(BSD4_4) && !defined(__osf__)
|
||||
# include <stdio.h>
|
||||
# include <strings.h>
|
||||
# define strchr(a, b) index((a), (b))
|
||||
# define strrchr(a, b) rindex((a), (b))
|
||||
# define memcpy(a, b, c) bcopy((b), (a), (c))
|
||||
# define memzero(a, b) bzero((a), (b))
|
||||
# define memcmp(a, b, c) bcmp((a), (b), (c))
|
||||
#if defined(NeXT)
|
||||
typedef void sigret_t;
|
||||
#else
|
||||
typedef int sigret_t;
|
||||
#endif
|
||||
|
||||
/* system routines that don't return int */
|
||||
char *getenv();
|
||||
caddr_t malloc();
|
||||
|
||||
#else
|
||||
# include <stdio.h>
|
||||
# define setbuffer(f, b, s) setvbuf((f), (b), (b) ? _IOFBF : _IONBF, (s))
|
||||
# include <string.h>
|
||||
# include <memory.h>
|
||||
# include <stdlib.h>
|
||||
# define memzero(a, b) memset((a), 0, (b))
|
||||
typedef void sigret_t;
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
#define PATCHLEVEL 4
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Prime number generator. It prints on stdout the next prime number
|
||||
* higher than the number specified as argv[1].
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
main(argc, argv)
|
||||
|
||||
int argc;
|
||||
char *argv[];
|
||||
|
||||
{
|
||||
double i, j;
|
||||
int f;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
i = atoi(argv[1]);
|
||||
while (i++)
|
||||
{
|
||||
f=1;
|
||||
for (j=2; j<i; j++)
|
||||
{
|
||||
if ((i/j)==floor(i/j))
|
||||
{
|
||||
f=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (f)
|
||||
{
|
||||
printf("%.0f\n", i);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
/* This file contains the routines that interface to termcap and stty/gtty.
|
||||
*
|
||||
* Paul Vixie, February 1987: converted to use ioctl() instead of stty/gtty.
|
||||
*
|
||||
* I put in code to turn on the TOSTOP bit while top was running, but I
|
||||
* didn't really like the results. If you desire it, turn on the
|
||||
* preprocessor variable "TOStop". --wnl
|
||||
*/
|
||||
|
||||
#include "os.h"
|
||||
#include "top.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef CBREAK
|
||||
# include <sgtty.h>
|
||||
# define SGTTY
|
||||
#else
|
||||
# ifdef TCGETA
|
||||
# define TERMIO
|
||||
# include <termio.h>
|
||||
# else
|
||||
# define TERMIOS
|
||||
# include <termios.h>
|
||||
# endif
|
||||
#endif
|
||||
#if defined(TERMIO) || defined(TERMIOS)
|
||||
# ifndef TAB3
|
||||
# ifdef OXTABS
|
||||
# define TAB3 OXTABS
|
||||
# else
|
||||
# define TAB3 0
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#include "screen.h"
|
||||
#include "boolean.h"
|
||||
|
||||
extern char *myname;
|
||||
|
||||
int putstdout();
|
||||
|
||||
int overstrike;
|
||||
int screen_length;
|
||||
int screen_width;
|
||||
char ch_erase;
|
||||
char ch_kill;
|
||||
char smart_terminal;
|
||||
char PC;
|
||||
char *tgetstr();
|
||||
char *tgoto();
|
||||
char termcap_buf[1024];
|
||||
char string_buffer[1024];
|
||||
char home[15];
|
||||
char lower_left[15];
|
||||
char *clear_line;
|
||||
char *clear_screen;
|
||||
char *clear_to_end;
|
||||
char *cursor_motion;
|
||||
char *start_standout;
|
||||
char *end_standout;
|
||||
char *terminal_init;
|
||||
char *terminal_end;
|
||||
short ospeed;
|
||||
|
||||
#ifdef SGTTY
|
||||
static struct sgttyb old_settings;
|
||||
static struct sgttyb new_settings;
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
static struct termio old_settings;
|
||||
static struct termio new_settings;
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
static struct termios old_settings;
|
||||
static struct termios new_settings;
|
||||
#endif
|
||||
static char is_a_terminal = No;
|
||||
#ifdef TOStop
|
||||
static int old_lword;
|
||||
static int new_lword;
|
||||
#endif
|
||||
|
||||
#define STDIN 0
|
||||
#define STDOUT 1
|
||||
#define STDERR 2
|
||||
|
||||
init_termcap(interactive)
|
||||
|
||||
int interactive;
|
||||
|
||||
{
|
||||
char *bufptr;
|
||||
char *PCptr;
|
||||
char *term_name;
|
||||
char *getenv();
|
||||
int status;
|
||||
|
||||
/* set defaults in case we aren't smart */
|
||||
screen_width = MAX_COLS;
|
||||
screen_length = 0;
|
||||
|
||||
if (!interactive)
|
||||
{
|
||||
/* pretend we have a dumb terminal */
|
||||
smart_terminal = No;
|
||||
return;
|
||||
}
|
||||
|
||||
/* assume we have a smart terminal until proven otherwise */
|
||||
smart_terminal = Yes;
|
||||
|
||||
/* get the terminal name */
|
||||
term_name = getenv("TERM");
|
||||
|
||||
/* if there is no TERM, assume it's a dumb terminal */
|
||||
/* patch courtesy of Sam Horrocks at telegraph.ics.uci.edu */
|
||||
if (term_name == NULL)
|
||||
{
|
||||
smart_terminal = No;
|
||||
return;
|
||||
}
|
||||
|
||||
/* now get the termcap entry */
|
||||
if ((status = tgetent(termcap_buf, term_name)) != 1)
|
||||
{
|
||||
if (status == -1)
|
||||
{
|
||||
fprintf(stderr, "%s: can't open termcap file\n", myname);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s: no termcap entry for a `%s' terminal\n",
|
||||
myname, term_name);
|
||||
}
|
||||
|
||||
/* pretend it's dumb and proceed */
|
||||
smart_terminal = No;
|
||||
return;
|
||||
}
|
||||
|
||||
/* "hardcopy" immediately indicates a very stupid terminal */
|
||||
if (tgetflag("hc"))
|
||||
{
|
||||
smart_terminal = No;
|
||||
return;
|
||||
}
|
||||
|
||||
/* set up common terminal capabilities */
|
||||
if ((screen_length = tgetnum("li")) <= 0)
|
||||
{
|
||||
screen_length = smart_terminal = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* screen_width is a little different */
|
||||
if ((screen_width = tgetnum("co")) == -1)
|
||||
{
|
||||
screen_width = 79;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen_width -= 1;
|
||||
}
|
||||
|
||||
/* terminals that overstrike need special attention */
|
||||
overstrike = tgetflag("os");
|
||||
|
||||
/* initialize the pointer into the termcap string buffer */
|
||||
bufptr = string_buffer;
|
||||
|
||||
/* get "ce", clear to end */
|
||||
if (!overstrike)
|
||||
{
|
||||
clear_line = tgetstr("ce", &bufptr);
|
||||
}
|
||||
|
||||
/* get necessary capabilities */
|
||||
if ((clear_screen = tgetstr("cl", &bufptr)) == NULL ||
|
||||
(cursor_motion = tgetstr("cm", &bufptr)) == NULL)
|
||||
{
|
||||
smart_terminal = No;
|
||||
return;
|
||||
}
|
||||
|
||||
/* get some more sophisticated stuff -- these are optional */
|
||||
clear_to_end = tgetstr("cd", &bufptr);
|
||||
terminal_init = tgetstr("ti", &bufptr);
|
||||
terminal_end = tgetstr("te", &bufptr);
|
||||
start_standout = tgetstr("so", &bufptr);
|
||||
end_standout = tgetstr("se", &bufptr);
|
||||
|
||||
/* pad character */
|
||||
PC = (PCptr = tgetstr("pc", &bufptr)) ? *PCptr : 0;
|
||||
|
||||
/* set convenience strings */
|
||||
(void) strcpy(home, tgoto(cursor_motion, 0, 0));
|
||||
/* (lower_left is set in get_screensize) */
|
||||
|
||||
/* get the actual screen size with an ioctl, if needed */
|
||||
/* This may change screen_width and screen_length, and it always
|
||||
sets lower_left. */
|
||||
get_screensize();
|
||||
|
||||
/* if stdout is not a terminal, pretend we are a dumb terminal */
|
||||
#ifdef SGTTY
|
||||
if (ioctl(STDOUT, TIOCGETP, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
if (ioctl(STDOUT, TCGETA, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
if (tcgetattr(STDOUT, &old_settings) == -1)
|
||||
{
|
||||
smart_terminal = No;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
init_screen()
|
||||
|
||||
{
|
||||
/* get the old settings for safe keeping */
|
||||
#ifdef SGTTY
|
||||
if (ioctl(STDOUT, TIOCGETP, &old_settings) != -1)
|
||||
{
|
||||
/* copy the settings so we can modify them */
|
||||
new_settings = old_settings;
|
||||
|
||||
/* turn on CBREAK and turn off character echo and tab expansion */
|
||||
new_settings.sg_flags |= CBREAK;
|
||||
new_settings.sg_flags &= ~(ECHO|XTABS);
|
||||
(void) ioctl(STDOUT, TIOCSETP, &new_settings);
|
||||
|
||||
/* remember the erase and kill characters */
|
||||
ch_erase = old_settings.sg_erase;
|
||||
ch_kill = old_settings.sg_kill;
|
||||
|
||||
#ifdef TOStop
|
||||
/* get the local mode word */
|
||||
(void) ioctl(STDOUT, TIOCLGET, &old_lword);
|
||||
|
||||
/* modify it */
|
||||
new_lword = old_lword | LTOSTOP;
|
||||
(void) ioctl(STDOUT, TIOCLSET, &new_lword);
|
||||
#endif
|
||||
/* remember that it really is a terminal */
|
||||
is_a_terminal = Yes;
|
||||
|
||||
/* send the termcap initialization string */
|
||||
putcap(terminal_init);
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
if (ioctl(STDOUT, TCGETA, &old_settings) != -1)
|
||||
{
|
||||
/* copy the settings so we can modify them */
|
||||
new_settings = old_settings;
|
||||
|
||||
/* turn off ICANON, character echo and tab expansion */
|
||||
new_settings.c_lflag &= ~(ICANON|ECHO);
|
||||
new_settings.c_oflag &= ~(TAB3);
|
||||
new_settings.c_cc[VMIN] = 1;
|
||||
new_settings.c_cc[VTIME] = 0;
|
||||
(void) ioctl(STDOUT, TCSETA, &new_settings);
|
||||
|
||||
/* remember the erase and kill characters */
|
||||
ch_erase = old_settings.c_cc[VERASE];
|
||||
ch_kill = old_settings.c_cc[VKILL];
|
||||
|
||||
/* remember that it really is a terminal */
|
||||
is_a_terminal = Yes;
|
||||
|
||||
/* send the termcap initialization string */
|
||||
putcap(terminal_init);
|
||||
}
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
if (tcgetattr(STDOUT, &old_settings) != -1)
|
||||
{
|
||||
/* copy the settings so we can modify them */
|
||||
new_settings = old_settings;
|
||||
|
||||
/* turn off ICANON, character echo and tab expansion */
|
||||
new_settings.c_lflag &= ~(ICANON|ECHO);
|
||||
new_settings.c_oflag &= ~(TAB3);
|
||||
new_settings.c_cc[VMIN] = 1;
|
||||
new_settings.c_cc[VTIME] = 0;
|
||||
(void) tcsetattr(STDOUT, TCSADRAIN, &new_settings);
|
||||
|
||||
/* remember the erase and kill characters */
|
||||
ch_erase = old_settings.c_cc[VERASE];
|
||||
ch_kill = old_settings.c_cc[VKILL];
|
||||
|
||||
/* remember that it really is a terminal */
|
||||
is_a_terminal = Yes;
|
||||
|
||||
/* send the termcap initialization string */
|
||||
putcap(terminal_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!is_a_terminal)
|
||||
{
|
||||
/* not a terminal at all---consider it dumb */
|
||||
smart_terminal = No;
|
||||
}
|
||||
}
|
||||
|
||||
end_screen()
|
||||
|
||||
{
|
||||
/* move to the lower left, clear the line and send "te" */
|
||||
if (smart_terminal)
|
||||
{
|
||||
putcap(lower_left);
|
||||
putcap(clear_line);
|
||||
fflush(stdout);
|
||||
putcap(terminal_end);
|
||||
}
|
||||
|
||||
/* if we have settings to reset, then do so */
|
||||
if (is_a_terminal)
|
||||
{
|
||||
#ifdef SGTTY
|
||||
(void) ioctl(STDOUT, TIOCSETP, &old_settings);
|
||||
#ifdef TOStop
|
||||
(void) ioctl(STDOUT, TIOCLSET, &old_lword);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
(void) ioctl(STDOUT, TCSETA, &old_settings);
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
(void) tcsetattr(STDOUT, TCSADRAIN, &old_settings);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
reinit_screen()
|
||||
|
||||
{
|
||||
/* install our settings if it is a terminal */
|
||||
if (is_a_terminal)
|
||||
{
|
||||
#ifdef SGTTY
|
||||
(void) ioctl(STDOUT, TIOCSETP, &new_settings);
|
||||
#ifdef TOStop
|
||||
(void) ioctl(STDOUT, TIOCLSET, &new_lword);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TERMIO
|
||||
(void) ioctl(STDOUT, TCSETA, &new_settings);
|
||||
#endif
|
||||
#ifdef TERMIOS
|
||||
(void) tcsetattr(STDOUT, TCSADRAIN, &new_settings);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* send init string */
|
||||
if (smart_terminal)
|
||||
{
|
||||
putcap(terminal_init);
|
||||
}
|
||||
}
|
||||
|
||||
get_screensize()
|
||||
|
||||
{
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
|
||||
struct winsize ws;
|
||||
|
||||
if (ioctl (1, TIOCGWINSZ, &ws) != -1)
|
||||
{
|
||||
if (ws.ws_row != 0)
|
||||
{
|
||||
screen_length = ws.ws_row;
|
||||
}
|
||||
if (ws.ws_col != 0)
|
||||
{
|
||||
screen_width = ws.ws_col - 1;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef TIOCGSIZE
|
||||
|
||||
struct ttysize ts;
|
||||
|
||||
if (ioctl (1, TIOCGSIZE, &ts) != -1)
|
||||
{
|
||||
if (ts.ts_lines != 0)
|
||||
{
|
||||
screen_length = ts.ts_lines;
|
||||
}
|
||||
if (ts.ts_cols != 0)
|
||||
{
|
||||
screen_width = ts.ts_cols - 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* TIOCGSIZE */
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
(void) strcpy(lower_left, tgoto(cursor_motion, 0, screen_length - 1));
|
||||
}
|
||||
|
||||
standout(msg)
|
||||
|
||||
char *msg;
|
||||
|
||||
{
|
||||
if (smart_terminal)
|
||||
{
|
||||
putcap(start_standout);
|
||||
fputs(msg, stdout);
|
||||
putcap(end_standout);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs(msg, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
clear()
|
||||
|
||||
{
|
||||
if (smart_terminal)
|
||||
{
|
||||
putcap(clear_screen);
|
||||
}
|
||||
}
|
||||
|
||||
clear_eol(len)
|
||||
|
||||
int len;
|
||||
|
||||
{
|
||||
if (smart_terminal && !overstrike && len > 0)
|
||||
{
|
||||
if (clear_line)
|
||||
{
|
||||
putcap(clear_line);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (len-- > 0)
|
||||
{
|
||||
putchar(' ');
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
go_home()
|
||||
|
||||
{
|
||||
if (smart_terminal)
|
||||
{
|
||||
putcap(home);
|
||||
}
|
||||
}
|
||||
|
||||
/* This has to be defined as a subroutine for tputs (instead of a macro) */
|
||||
|
||||
putstdout(ch)
|
||||
|
||||
char ch;
|
||||
|
||||
{
|
||||
putchar(ch);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* top - a top users display for Unix 4.2
|
||||
*
|
||||
* This file contains all the definitions necessary to use the hand-written
|
||||
* screen package in "screen.c"
|
||||
*/
|
||||
|
||||
#define TCputs(str) tputs(str, 1, putstdout)
|
||||
#define putcap(str) (void)((str) != NULL ? TCputs(str) : 0)
|
||||
#define Move_to(x, y) TCputs(tgoto(cursor_motion, x, y))
|
||||
|
||||
/* declare return values for termcap functions */
|
||||
char *tgetstr();
|
||||
char *tgoto();
|
||||
|
||||
extern char ch_erase; /* set to the user's erase character */
|
||||
extern char ch_kill; /* set to the user's kill character */
|
||||
extern char smart_terminal; /* set if the terminal has sufficient termcap
|
||||
capabilities for normal operation */
|
||||
|
||||
/* These are some termcap strings for use outside of "screen.c" */
|
||||
extern char *cursor_motion;
|
||||
extern char *clear_line;
|
||||
extern char *clear_to_end;
|
||||
|
||||
/* rows and columns on the screen according to termcap */
|
||||
extern int screen_length;
|
||||
extern int screen_width;
|
||||
|
||||
/* a function that puts a single character on stdout */
|
||||
int putstdout();
|
||||
@@ -0,0 +1,53 @@
|
||||
BEGIN {
|
||||
nsig = 0;
|
||||
j = 0;
|
||||
print "/* This file was automatically generated */"
|
||||
print "/* by the awk script \"sigconv.awk\". */\n"
|
||||
print "struct sigdesc {"
|
||||
print " char *name;"
|
||||
print " int number;"
|
||||
print "};\n"
|
||||
print "struct sigdesc sigdesc[] = {"
|
||||
}
|
||||
|
||||
/^#define[ \t][ \t]*SIG[A-Z]/ {
|
||||
|
||||
j = sprintf("%d", $3);
|
||||
str = $2;
|
||||
|
||||
if (nsig < j)
|
||||
nsig = j;
|
||||
|
||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
||||
substr(str, 4), j);
|
||||
}
|
||||
/^#[ \t]*define[ \t][ \t]*SIG[A-Z]/ {
|
||||
|
||||
j = sprintf("%d", $4);
|
||||
str = $3;
|
||||
|
||||
if (nsig < j)
|
||||
nsig = j;
|
||||
|
||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
||||
substr(str, 4), j);
|
||||
}
|
||||
/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]/ {
|
||||
|
||||
j = sprintf("%d", $4);
|
||||
str = $3;
|
||||
|
||||
if (nsig < j)
|
||||
nsig = j;
|
||||
|
||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
||||
substr(str, 5), j);
|
||||
}
|
||||
|
||||
END {
|
||||
for (n = 1; n <= nsig; n++)
|
||||
if (siglist[n] != "")
|
||||
printf(" %s\n", siglist[n]);
|
||||
|
||||
printf(" NULL,\t 0\n};\n");
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
.\" NOTE: changes to the manual page for "top" should be made in the
|
||||
.\" file "top.X" and NOT in the file "top.1".
|
||||
.nr N %topn%
|
||||
.nr D %delay%
|
||||
.TH TOP 1 Local
|
||||
.UC 4
|
||||
.SH NAME
|
||||
top \- display and update information about the top cpu processes
|
||||
.SH SYNOPSIS
|
||||
.B top
|
||||
[
|
||||
.B \-SbiInqu
|
||||
] [
|
||||
.BI \-d count
|
||||
] [
|
||||
.BI \-s time
|
||||
] [
|
||||
.BI \-o field
|
||||
] [
|
||||
.BI \-U username
|
||||
] [
|
||||
.I number
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.\" This defines appropriate quote strings for nroff and troff
|
||||
.ds lq \&"
|
||||
.ds rq \&"
|
||||
.if t .ds lq ``
|
||||
.if t .ds rq ''
|
||||
.\" Just in case these number registers aren't set yet...
|
||||
.if \nN==0 .nr N 10
|
||||
.if \nD==0 .nr D 5
|
||||
.I Top
|
||||
displays the top
|
||||
.if !\nN==-1 \nN
|
||||
processes on the system and periodically updates this information.
|
||||
.if \nN==-1 \
|
||||
\{\
|
||||
If standard output is an intelligent terminal (see below) then
|
||||
as many processes as will fit on the terminal screen are displayed
|
||||
by default. Otherwise, a good number of them are shown (around 20).
|
||||
.\}
|
||||
Raw cpu percentage is used to rank the processes. If
|
||||
.I number
|
||||
is given, then the top
|
||||
.I number
|
||||
processes will be displayed instead of the default.
|
||||
.PP
|
||||
.I Top
|
||||
makes a distinction between terminals that support advanced capabilities
|
||||
and those that do not. This
|
||||
distinction affects the choice of defaults for certain options. In the
|
||||
remainder of this document, an \*(lqintelligent\*(rq terminal is one that
|
||||
supports cursor addressing, clear screen, and clear to end of line.
|
||||
Conversely, a \*(lqdumb\*(rq terminal is one that does not support such
|
||||
features. If the output of
|
||||
.I top
|
||||
is redirected to a file, it acts as if it were being run on a dumb
|
||||
terminal.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-S
|
||||
Show system processes in the display. Normally, system processes such as
|
||||
the pager and the swapper are not shown. This option makes them visible.
|
||||
.TP
|
||||
.B \-b
|
||||
Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is
|
||||
ignored. Interrupt characters (such as ^C and ^\e) still have an effect.
|
||||
This is the default on a dumb terminal, or when the output is not a terminal.
|
||||
.TP
|
||||
.B \-i
|
||||
Use \*(lqinteractive\*(rq mode. In this mode, any input is immediately
|
||||
read for processing. See the section on \*(lqInteractive Mode\*(rq
|
||||
for an explanation of
|
||||
which keys perform what functions. After the command is processed, the
|
||||
screen will immediately be updated, even if the command was not
|
||||
understood. This mode is the default when standard output is an
|
||||
intelligent terminal.
|
||||
.TP
|
||||
.B \-I
|
||||
Do not display idle processes.
|
||||
By default, top displays both active and idle processes.
|
||||
.TP
|
||||
.B \-n
|
||||
Use \*(lqnon-interactive\*(rq mode. This is indentical to \*(lqbatch\*(rq
|
||||
mode.
|
||||
.TP
|
||||
.B \-q
|
||||
Renice
|
||||
.I top
|
||||
to -20 so that it will run faster. This can be used when the system is
|
||||
being very sluggish to improve the possibility of discovering the problem.
|
||||
This option can only be used by root.
|
||||
.TP
|
||||
.B \-u
|
||||
Do not take the time to map uid numbers to usernames. Normally,
|
||||
.I top
|
||||
will read as much of the file \*(lq/etc/passwd\*(rq as is necessary to map
|
||||
all the user id numbers it encounters into login names. This option
|
||||
disables all that, while possibly decreasing execution time. The uid
|
||||
numbers are displayed instead of the names.
|
||||
.TP
|
||||
.BI \-d count
|
||||
Show only
|
||||
.I count
|
||||
displays, then exit. A display is considered to be one update of the
|
||||
screen. This option allows the user to select the number of displays he
|
||||
wants to see before
|
||||
.I top
|
||||
automatically exits. For intelligent terminals, no upper limit
|
||||
is set. The default is 1 for dumb terminals.
|
||||
.TP
|
||||
.BI \-s time
|
||||
Set the delay between screen updates to
|
||||
.I time
|
||||
seconds. The default delay between updates is \nD seconds.
|
||||
.TP
|
||||
.BI \-o field
|
||||
Sort the process display area on the specified field. The field name is
|
||||
the name of the column as seen in the output, but in lower case. Likely
|
||||
values are \*(lqcpu\*(rq, \*(lqsize\*(rq, \*(lqres\*(rq, and \*(lqtime\*(rq,
|
||||
but may vary on different operating systems. Note that
|
||||
not all operating systems support this option.
|
||||
.TP
|
||||
.BI \-U username
|
||||
Show only those processes owned by
|
||||
.IR username .
|
||||
This option currently only accepts usernames and will not understand
|
||||
uid numbers.
|
||||
.PP
|
||||
Both
|
||||
.I count
|
||||
and
|
||||
.I number
|
||||
fields can be specified as \*(lqinfinite\*(rq, indicating that they can
|
||||
stretch as far as possible. This is accomplished by using any proper
|
||||
prefix of the keywords
|
||||
\*(lqinfinity\*(rq,
|
||||
\*(lqmaximum\*(rq,
|
||||
or
|
||||
\*(lqall\*(rq.
|
||||
The default for
|
||||
.I count
|
||||
on an intelligent terminal is, in fact,
|
||||
.BI infinity .
|
||||
.PP
|
||||
The environment variable
|
||||
.B TOP
|
||||
is examined for options before the command line is scanned. This enables
|
||||
a user to set his or her own defaults. The number of processes to display
|
||||
can also be specified in the environment variable
|
||||
.BR TOP .
|
||||
The options
|
||||
.BR \-I ,
|
||||
.BR \-S ,
|
||||
and
|
||||
.B \-u
|
||||
are actually toggles. A second specification of any of these options
|
||||
will negate the first. Thus a user who has the environment variable
|
||||
.B TOP
|
||||
set to \*(lq\-I\*(rq may use the command \*(lqtop \-I\*(rq to see idle processes.
|
||||
.SH "INTERACTIVE MODE"
|
||||
When
|
||||
.I top
|
||||
is running in \*(lqinteractive mode\*(rq, it reads commands from the
|
||||
terminal and acts upon them accordingly. In this mode, the terminal is
|
||||
put in \*(lqCBREAK\*(rq, so that a character will be
|
||||
processed as soon as it is typed. Almost always, a key will be
|
||||
pressed when
|
||||
.I top
|
||||
is between displays; that is, while it is waiting for
|
||||
.I time
|
||||
seconds to elapse. If this is the case, the command will be
|
||||
processed and the display will be updated immediately thereafter
|
||||
(reflecting any changes that the command may have specified). This
|
||||
happens even if the command was incorrect. If a key is pressed while
|
||||
.I top
|
||||
is in the middle of updating the display, it will finish the update and
|
||||
then process the command. Some commands require additional information,
|
||||
and the user will be prompted accordingly. While typing this information
|
||||
in, the user's erase and kill keys (as set up by the command
|
||||
.IR stty )
|
||||
are recognized, and a newline terminates the input.
|
||||
.PP
|
||||
These commands are currently recognized (^L refers to control-L):
|
||||
.TP
|
||||
.B ^L
|
||||
Redraw the screen.
|
||||
.IP "\fBh\fP\ or\ \fB?\fP"
|
||||
Display a summary of the commands (help screen).
|
||||
.TP
|
||||
.B q
|
||||
Quit
|
||||
.IR top.
|
||||
.TP
|
||||
.B d
|
||||
Change the number of displays to show (prompt for new number).
|
||||
Remember that the next display counts as one, so typing
|
||||
.B d1
|
||||
will make
|
||||
.I top
|
||||
show one final display and then immediately exit.
|
||||
.TP
|
||||
.B n or #
|
||||
Change the number of processes to display (prompt for new number).
|
||||
.TP
|
||||
.B s
|
||||
Change the number of seconds to delay between displays
|
||||
(prompt for new number).
|
||||
.TP
|
||||
.B k
|
||||
Send a signal (\*(lqkill\*(rq by default) to a list of processes. This
|
||||
acts similarly to the command
|
||||
.IR kill (1)).
|
||||
.TP
|
||||
.B r
|
||||
Change the priority (the \*(lqnice\*(rq) of a list of processes.
|
||||
This acts similarly to the command
|
||||
.IR renice (8)).
|
||||
.TP
|
||||
.B u
|
||||
Display only processes owned by a specific username (prompt for username).
|
||||
If the username specified is simply \*(lq+\*(rq, then processes belonging
|
||||
to all users will be displayed.
|
||||
.TP
|
||||
.B e
|
||||
Display a list of system errors (if any) generated by the last
|
||||
.BR k ill
|
||||
or
|
||||
.BR r enice
|
||||
command.
|
||||
.TP
|
||||
.B i
|
||||
(or
|
||||
.BR I)
|
||||
Toggle the display of idle processes.
|
||||
.SH "THE DISPLAY"
|
||||
The actual display varies depending on the specific variant of Unix
|
||||
that the machine is running. This description may not exactly match
|
||||
what is seen by top running on this particular machine. Differences
|
||||
are listed at the end of this manual entry.
|
||||
.PP
|
||||
The top few lines of the display show general information
|
||||
about the state of the system, including
|
||||
the last process id assigned to a process (on most systems),
|
||||
the three load averages,
|
||||
the current time,
|
||||
the number of existing processes,
|
||||
the number of processes in each state
|
||||
(sleeping, running, starting, zombies, and stopped),
|
||||
and a percentage of time spent in each of the processor states
|
||||
(user, nice, system, and idle).
|
||||
It also includes information about physial and virtual memory allocation.
|
||||
.PP
|
||||
The remainder of the screen displays information about individual
|
||||
processes. This display is similar in spirit to
|
||||
.IR ps (1)
|
||||
but it is not exactly the same. PID is the process id, USERNAME is the name
|
||||
of the process's owner (if
|
||||
.B \-u
|
||||
is specified, a UID column will be substituted for USERNAME),
|
||||
PRI is the current priority of the process,
|
||||
NICE is the nice amount (in the range \-20 to 20),
|
||||
SIZE is the total size of the process (text, data, and stack),
|
||||
RES is the current amount of resident memory (both SIZE and RES are
|
||||
given in kilobytes),
|
||||
STATE is the current state (one of \*(lqsleep\*(rq, \*(lqWAIT\*(rq,
|
||||
\*(lqrun\*(rq, \*(lqidl\*(rq, \*(lqzomb\*(rq, or \*(lqstop\*(rq),
|
||||
TIME is the number of system and user cpu seconds that the process has used,
|
||||
WCPU, when displayed, is the weighted cpu percentage (this is the same
|
||||
value that
|
||||
.IR ps (1)
|
||||
displays as CPU),
|
||||
CPU is the raw percentage and is the field that is sorted to determine
|
||||
the order of the processes, and
|
||||
COMMAND is the name of the command that the process is currently running
|
||||
(if the process is swapped out, this column is marked \*(lq<swapped>\*(rq).
|
||||
.SH NOTES
|
||||
The \*(lqABANDONED\*(rq state (known in the kernel as \*(lqSWAIT\*(rq) was
|
||||
abandoned, thus the name. A process should never end up in this state.
|
||||
.SH AUTHOR
|
||||
William LeFebvre, EECS Department, Northwestern University
|
||||
.SH ENVIRONMENT
|
||||
.DT
|
||||
TOP user-configurable defaults for options.
|
||||
.SH FILES
|
||||
.DT
|
||||
/dev/kmem kernel memory
|
||||
.br
|
||||
/dev/mem physical memory
|
||||
.br
|
||||
/etc/passwd used to map uid numbers to user names
|
||||
.br
|
||||
/vmunix system image
|
||||
.SH BUGS
|
||||
Don't shoot me, but the default for
|
||||
.B \-I
|
||||
has changed once again. So many people were confused by the fact that
|
||||
.I top
|
||||
wasn't showing them all the processes that I have decided to make the
|
||||
default behavior show idle processes, just like it did in version 2.
|
||||
But to appease folks who can't stand that behavior, I have added the
|
||||
ability to set \*(lqdefault\*(rq options in the environment variable
|
||||
.B TOP
|
||||
(see the OPTIONS section). Those who want the behavior that version
|
||||
3.0 had need only set the environment variable
|
||||
.B TOP
|
||||
to \*(lq\-I\*(rq.
|
||||
.PP
|
||||
The command name for swapped processes should be tracked down, but this
|
||||
would make the program run slower.
|
||||
.PP
|
||||
As with
|
||||
.IR ps (1),
|
||||
things can change while
|
||||
.I top
|
||||
is collecting information for an update. The picture it gives is only a
|
||||
close approximation to reality.
|
||||
.SH "SEE ALSO"
|
||||
kill(1),
|
||||
ps(1),
|
||||
stty(1),
|
||||
mem(4),
|
||||
renice(8)
|
||||
+1007
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Top - a top users display for Berkeley Unix
|
||||
*
|
||||
* General (global) definitions
|
||||
*/
|
||||
|
||||
/* Current major version number */
|
||||
#define VERSION 3
|
||||
|
||||
/* Number of lines of header information on the standard screen */
|
||||
#define Header_lines 7
|
||||
|
||||
/* Maximum number of columns allowed for display */
|
||||
#define MAX_COLS 128
|
||||
|
||||
/* Log base 2 of 1024 is 10 (2^10 == 1024) */
|
||||
#define LOG1024 10
|
||||
|
||||
char *itoa();
|
||||
char *itoa7();
|
||||
|
||||
char *version_string();
|
||||
|
||||
/* Special atoi routine returns either a non-negative number or one of: */
|
||||
#define Infinity -1
|
||||
#define Invalid -2
|
||||
|
||||
/* maximum number we can have */
|
||||
#define Largest 0x7fffffff
|
||||
|
||||
/*
|
||||
* The entire display is based on these next numbers being defined as is.
|
||||
*/
|
||||
|
||||
#define NUM_AVERAGES 3
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Top - a top users display for Berkeley Unix
|
||||
*
|
||||
* Definitions for things that might vary between installations.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The space command forces an immediate update. Sometimes, on loaded
|
||||
* systems, this update will take a significant period of time (because all
|
||||
* the output is buffered). So, if the short-term load average is above
|
||||
* "LoadMax", then top will put the cursor home immediately after the space
|
||||
* is pressed before the next update is attempted. This serves as a visual
|
||||
* acknowledgement of the command. On Suns, "LoadMax" will get multiplied by
|
||||
* "FSCALE" before being compared to avenrun[0]. Therefore, "LoadMax"
|
||||
* should always be specified as a floating point number.
|
||||
*/
|
||||
#ifndef LoadMax
|
||||
#define LoadMax %LoadMax%
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "Table_size" defines the size of the hash tables used to map uid to
|
||||
* username. The number of users in /etc/passwd CANNOT be greater than
|
||||
* this number. If the error message "table overflow: too many users"
|
||||
* is printed by top, then "Table_size" needs to be increased. Things will
|
||||
* work best if the number is a prime number that is about twice the number
|
||||
* of lines in /etc/passwd.
|
||||
*/
|
||||
#ifndef Table_size
|
||||
#define Table_size %TableSize%
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "Nominal_TOPN" is used as the default TOPN when Default_TOPN is Infinity
|
||||
* and the output is a dumb terminal. If we didn't do this, then
|
||||
* installations who use a default TOPN of Infinity will get every
|
||||
* process in the system when running top on a dumb terminal (or redirected
|
||||
* to a file). Note that Nominal_TOPN is a default: it can still be
|
||||
* overridden on the command line, even with the value "infinity".
|
||||
*/
|
||||
#ifndef Nominal_TOPN
|
||||
#define Nominal_TOPN %NominalTopn%
|
||||
#endif
|
||||
|
||||
#ifndef Default_TOPN
|
||||
#define Default_TOPN %topn%
|
||||
#endif
|
||||
|
||||
#ifndef Default_DELAY
|
||||
#define Default_DELAY %delay%
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the local system's getpwnam interface uses random access to retrieve
|
||||
* a record (i.e.: 4.3 systems, Sun "yellow pages"), then defining
|
||||
* RANDOM_PW will take advantage of that fact. If RANDOM_PW is defined,
|
||||
* then getpwnam is used and the result is cached. If not, then getpwent
|
||||
* is used to read and cache the password entries sequentially until the
|
||||
* desired one is found.
|
||||
*
|
||||
* We initially set RANDOM_PW to something which is controllable by the
|
||||
* Configure script. Then if its value is 0, we undef it.
|
||||
*/
|
||||
|
||||
#define RANDOM_PW %random%
|
||||
#if RANDOM_PW == 0
|
||||
#undef RANDOM_PW
|
||||
#endif
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
/*
|
||||
* Username translation code for top.
|
||||
*
|
||||
* These routines handle uid to username mapping.
|
||||
* They use a hashing table scheme to reduce reading overhead.
|
||||
* For the time being, these are very straightforward hashing routines.
|
||||
* Maybe someday I'll put in something better. But with the advent of
|
||||
* "random access" password files, it might not be worth the effort.
|
||||
*
|
||||
* Changes to these have been provided by John Gilmore (gnu@toad.com).
|
||||
*
|
||||
* The hash has been simplified in this release, to avoid the
|
||||
* table overflow problems of previous releases. If the value
|
||||
* at the initial hash location is not right, it is replaced
|
||||
* by the right value. Collisions will cause us to call getpw*
|
||||
* but hey, this is a cache, not the Library of Congress.
|
||||
* This makes the table size independent of the passwd file size.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <utmp.h>
|
||||
|
||||
#include "top.local.h"
|
||||
#include "utils.h"
|
||||
|
||||
struct hash_el {
|
||||
int uid;
|
||||
char name[UT_NAMESIZE + 1];
|
||||
};
|
||||
|
||||
#define is_empty_hash(x) (hash_table[x].name[0] == 0)
|
||||
|
||||
/* simple minded hashing function */
|
||||
/* Uid "nobody" is -2 results in hashit(-2) = -2 which is out of bounds for
|
||||
the hash_table. Applied abs() function to fix. 2/16/96 tpugh
|
||||
*/
|
||||
#define hashit(i) (abs(i) % Table_size)
|
||||
|
||||
/* K&R requires that statically declared tables be initialized to zero. */
|
||||
/* We depend on that for hash_table and YOUR compiler had BETTER do it! */
|
||||
struct hash_el hash_table[Table_size];
|
||||
|
||||
init_hash()
|
||||
|
||||
{
|
||||
/*
|
||||
* There used to be some steps we had to take to initialize things.
|
||||
* We don't need to do that anymore, but we will leave this stub in
|
||||
* just in case future changes require initialization steps.
|
||||
*/
|
||||
}
|
||||
|
||||
char *username(uid)
|
||||
|
||||
register int uid;
|
||||
|
||||
{
|
||||
register int hashindex;
|
||||
|
||||
hashindex = hashit(uid);
|
||||
if (is_empty_hash(hashindex) || (hash_table[hashindex].uid != uid))
|
||||
{
|
||||
/* not here or not right -- get it out of passwd */
|
||||
hashindex = get_user(uid);
|
||||
}
|
||||
return(hash_table[hashindex].name);
|
||||
}
|
||||
|
||||
int userid(username)
|
||||
|
||||
char *username;
|
||||
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
/* Eventually we want this to enter everything in the hash table,
|
||||
but for now we just do it simply and remember just the result.
|
||||
*/
|
||||
|
||||
if ((pwd = getpwnam(username)) == NULL)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* enter the result in the hash table */
|
||||
enter_user(pwd->pw_uid, username, 1);
|
||||
|
||||
/* return our result */
|
||||
return(pwd->pw_uid);
|
||||
}
|
||||
|
||||
int enter_user(uid, name, wecare)
|
||||
|
||||
register int uid;
|
||||
register char *name;
|
||||
int wecare; /* 1 = enter it always, 0 = nice to have */
|
||||
|
||||
{
|
||||
register int hashindex;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "enter_hash(%d, %s, %d)\n", uid, name, wecare);
|
||||
#endif
|
||||
|
||||
hashindex = hashit(uid);
|
||||
|
||||
if (!is_empty_hash(hashindex))
|
||||
{
|
||||
if (!wecare)
|
||||
return 0; /* Don't clobber a slot for trash */
|
||||
if (hash_table[hashindex].uid == uid)
|
||||
return(hashindex); /* Fortuitous find */
|
||||
}
|
||||
|
||||
/* empty or wrong slot -- fill it with new value */
|
||||
hash_table[hashindex].uid = uid;
|
||||
(void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE);
|
||||
return(hashindex);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a userid->name mapping from the system.
|
||||
* If the passwd database is hashed (#define RANDOM_PW), we
|
||||
* just handle this uid. Otherwise we scan the passwd file
|
||||
* and cache any entries we pass over while looking.
|
||||
*/
|
||||
|
||||
int get_user(uid)
|
||||
|
||||
register int uid;
|
||||
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
#ifdef RANDOM_PW
|
||||
/* no performance penalty for using getpwuid makes it easy */
|
||||
if ((pwd = getpwuid(uid)) != NULL)
|
||||
{
|
||||
return(enter_user(pwd->pw_uid, pwd->pw_name, 1));
|
||||
}
|
||||
#else
|
||||
|
||||
int from_start = 0;
|
||||
|
||||
/*
|
||||
* If we just called getpwuid each time, things would be very slow
|
||||
* since that just iterates through the passwd file each time. So,
|
||||
* we walk through the file instead (using getpwent) and cache each
|
||||
* entry as we go. Once the right record is found, we cache it and
|
||||
* return immediately. The next time we come in, getpwent will get
|
||||
* the next record. In theory, we never have to read the passwd file
|
||||
* a second time (because we cache everything we read). But in
|
||||
* practice, the cache may not be large enough, so if we don't find
|
||||
* it the first time we have to scan the file a second time. This
|
||||
* is not very efficient, but it will do for now.
|
||||
*/
|
||||
|
||||
while (from_start++ < 2)
|
||||
{
|
||||
while ((pwd = getpwent()) != NULL)
|
||||
{
|
||||
if (pwd->pw_uid == uid)
|
||||
{
|
||||
return(enter_user(pwd->pw_uid, pwd->pw_name, 1));
|
||||
}
|
||||
(void) enter_user(pwd->pw_uid, pwd->pw_name, 0);
|
||||
}
|
||||
/* try again */
|
||||
setpwent();
|
||||
}
|
||||
#endif
|
||||
/* if we can't find the name at all, then use the uid as the name */
|
||||
return(enter_user(uid, itoa7(uid), 1));
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains various handy utilities used by top.
|
||||
*/
|
||||
|
||||
#include "top.h"
|
||||
#include "os.h"
|
||||
|
||||
int atoiwi(str)
|
||||
|
||||
char *str;
|
||||
|
||||
{
|
||||
register int len;
|
||||
|
||||
len = strlen(str);
|
||||
if (len != 0)
|
||||
{
|
||||
if (strncmp(str, "infinity", len) == 0 ||
|
||||
strncmp(str, "all", len) == 0 ||
|
||||
strncmp(str, "maximum", len) == 0)
|
||||
{
|
||||
return(Infinity);
|
||||
}
|
||||
else if (str[0] == '-')
|
||||
{
|
||||
return(Invalid);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(atoi(str));
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* itoa - convert integer (decimal) to ascii string for positive numbers
|
||||
* only (we don't bother with negative numbers since we know we
|
||||
* don't use them).
|
||||
*/
|
||||
|
||||
/*
|
||||
* How do we know that 16 will suffice?
|
||||
* Because the biggest number that we will
|
||||
* ever convert will be 2^32-1, which is 10
|
||||
* digits.
|
||||
*/
|
||||
|
||||
char *itoa(val)
|
||||
|
||||
register int val;
|
||||
|
||||
{
|
||||
register char *ptr;
|
||||
static char buffer[16]; /* result is built here */
|
||||
/* 16 is sufficient since the largest number
|
||||
we will ever convert will be 2^32-1,
|
||||
which is 10 digits. */
|
||||
|
||||
ptr = buffer + sizeof(buffer);
|
||||
*--ptr = '\0';
|
||||
if (val == 0)
|
||||
{
|
||||
*--ptr = '0';
|
||||
}
|
||||
else while (val != 0)
|
||||
{
|
||||
*--ptr = (val % 10) + '0';
|
||||
val /= 10;
|
||||
}
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* itoa7(val) - like itoa, except the number is right justified in a 7
|
||||
* character field. This code is a duplication of itoa instead of
|
||||
* a front end to a more general routine for efficiency.
|
||||
*/
|
||||
|
||||
char *itoa7(val)
|
||||
|
||||
register int val;
|
||||
|
||||
{
|
||||
register char *ptr;
|
||||
static char buffer[16]; /* result is built here */
|
||||
/* 16 is sufficient since the largest number
|
||||
we will ever convert will be 2^32-1,
|
||||
which is 10 digits. */
|
||||
|
||||
ptr = buffer + sizeof(buffer);
|
||||
*--ptr = '\0';
|
||||
if (val == 0)
|
||||
{
|
||||
*--ptr = '0';
|
||||
}
|
||||
else while (val != 0)
|
||||
{
|
||||
*--ptr = (val % 10) + '0';
|
||||
val /= 10;
|
||||
}
|
||||
while (ptr > buffer + sizeof(buffer) - 7)
|
||||
{
|
||||
*--ptr = ' ';
|
||||
}
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* digits(val) - return number of decimal digits in val. Only works for
|
||||
* positive numbers. If val <= 0 then digits(val) == 0.
|
||||
*/
|
||||
|
||||
int digits(val)
|
||||
|
||||
int val;
|
||||
|
||||
{
|
||||
register int cnt = 0;
|
||||
|
||||
while (val > 0)
|
||||
{
|
||||
cnt++;
|
||||
val /= 10;
|
||||
}
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* strecpy(to, from) - copy string "from" into "to" and return a pointer
|
||||
* to the END of the string "to".
|
||||
*/
|
||||
|
||||
char *strecpy(to, from)
|
||||
|
||||
register char *to;
|
||||
register char *from;
|
||||
|
||||
{
|
||||
while ((*to++ = *from++) != '\0');
|
||||
return(--to);
|
||||
}
|
||||
|
||||
/*
|
||||
* string_index(string, array) - find string in array and return index
|
||||
*/
|
||||
|
||||
int string_index(string, array)
|
||||
|
||||
char *string;
|
||||
char **array;
|
||||
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
while (*array != NULL)
|
||||
{
|
||||
if (strcmp(string, *array) == 0)
|
||||
{
|
||||
return(i);
|
||||
}
|
||||
array++;
|
||||
i++;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* argparse(line, cntp) - parse arguments in string "line", separating them
|
||||
* out into an argv-like array, and setting *cntp to the number of
|
||||
* arguments encountered. This is a simple parser that doesn't understand
|
||||
* squat about quotes.
|
||||
*/
|
||||
|
||||
char **argparse(line, cntp)
|
||||
|
||||
char *line;
|
||||
int *cntp;
|
||||
|
||||
{
|
||||
register char *from;
|
||||
register char *to;
|
||||
register int cnt;
|
||||
register int ch;
|
||||
int length;
|
||||
int lastch;
|
||||
register char **argv;
|
||||
char **argarray;
|
||||
char *args;
|
||||
|
||||
/* unfortunately, the only real way to do this is to go thru the
|
||||
input string twice. */
|
||||
|
||||
/* step thru the string counting the white space sections */
|
||||
from = line;
|
||||
lastch = cnt = length = 0;
|
||||
while ((ch = *from++) != '\0')
|
||||
{
|
||||
length++;
|
||||
if (ch == ' ' && lastch != ' ')
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
lastch = ch;
|
||||
}
|
||||
|
||||
/* add three to the count: one for the initial "dummy" argument,
|
||||
one for the last argument and one for NULL */
|
||||
cnt += 3;
|
||||
|
||||
/* allocate a char * array to hold the pointers */
|
||||
argarray = (char **)malloc(cnt * sizeof(char *));
|
||||
|
||||
/* allocate another array to hold the strings themselves */
|
||||
args = (char *)malloc(length+2);
|
||||
|
||||
/* initialization for main loop */
|
||||
from = line;
|
||||
to = args;
|
||||
argv = argarray;
|
||||
lastch = '\0';
|
||||
|
||||
/* create a dummy argument to keep getopt happy */
|
||||
*argv++ = to;
|
||||
*to++ = '\0';
|
||||
cnt = 2;
|
||||
|
||||
/* now build argv while copying characters */
|
||||
*argv++ = to;
|
||||
while ((ch = *from++) != '\0')
|
||||
{
|
||||
if (ch != ' ')
|
||||
{
|
||||
if (lastch == ' ')
|
||||
{
|
||||
*to++ = '\0';
|
||||
*argv++ = to;
|
||||
cnt++;
|
||||
}
|
||||
*to++ = ch;
|
||||
}
|
||||
lastch = ch;
|
||||
}
|
||||
*to++ = '\0';
|
||||
|
||||
/* set cntp and return the allocated array */
|
||||
*cntp = cnt;
|
||||
return(argarray);
|
||||
}
|
||||
|
||||
/*
|
||||
* percentages(cnt, out, new, old, diffs) - calculate percentage change
|
||||
* between array "old" and "new", putting the percentages i "out".
|
||||
* "cnt" is size of each array and "diffs" is used for scratch space.
|
||||
* The array "old" is updated on each call.
|
||||
* The routine assumes modulo arithmetic. This function is especially
|
||||
* useful on BSD mchines for calculating cpu state percentages.
|
||||
*/
|
||||
|
||||
long percentages(cnt, out, new, old, diffs)
|
||||
|
||||
int cnt;
|
||||
int *out;
|
||||
register long *new;
|
||||
register long *old;
|
||||
long *diffs;
|
||||
|
||||
{
|
||||
register int i;
|
||||
register long change;
|
||||
register long total_change;
|
||||
register long *dp;
|
||||
long half_total;
|
||||
|
||||
/* initialization */
|
||||
total_change = 0;
|
||||
dp = diffs;
|
||||
|
||||
/* calculate changes for each state and the overall change */
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
if ((change = *new - *old) < 0)
|
||||
{
|
||||
/* this only happens when the counter wraps */
|
||||
change = (int)
|
||||
((unsigned long)*new-(unsigned long)*old);
|
||||
}
|
||||
total_change += (*dp++ = change);
|
||||
*old++ = *new++;
|
||||
}
|
||||
|
||||
/* avoid divide by zero potential */
|
||||
if (total_change == 0)
|
||||
{
|
||||
total_change = 1;
|
||||
}
|
||||
|
||||
/* calculate percentages based on overall change, rounding up */
|
||||
half_total = total_change / 2l;
|
||||
|
||||
/* Do not divide by 0. Causes Floating point exception */
|
||||
if(total_change) {
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
*out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
|
||||
}
|
||||
}
|
||||
|
||||
/* return the total in case the caller wants to use it */
|
||||
return(total_change);
|
||||
}
|
||||
|
||||
/*
|
||||
* errmsg(errnum) - return an error message string appropriate to the
|
||||
* error number "errnum". This is a substitute for the System V
|
||||
* function "strerror" with one important difference: the string
|
||||
* returned by this function does NOT end in a newline!
|
||||
* N.B.: there appears to be no reliable way to determine if
|
||||
* "strerror" exists at compile time, so I make do by providing
|
||||
* something of similar functionality.
|
||||
*/
|
||||
|
||||
/* externs referenced by errmsg */
|
||||
|
||||
char *errmsg(errnum)
|
||||
|
||||
int errnum;
|
||||
|
||||
{
|
||||
if (errnum > 0 && errnum < sys_nerr)
|
||||
{
|
||||
return((char *)sys_errlist[errnum]);
|
||||
}
|
||||
return("No error");
|
||||
}
|
||||
|
||||
/* format_time(seconds) - format number of seconds into a suitable
|
||||
* display that will fit within 6 characters. Note that this
|
||||
* routine builds its string in a static area. If it needs
|
||||
* to be called more than once without overwriting previous data,
|
||||
* then we will need to adopt a technique similar to the
|
||||
* one used for format_k.
|
||||
*/
|
||||
|
||||
/* Explanation:
|
||||
We want to keep the output within 6 characters. For low values we use
|
||||
the format mm:ss. For values that exceed 999:59, we switch to a format
|
||||
that displays hours and fractions: hhh.tH. For values that exceed
|
||||
999.9, we use hhhh.t and drop the "H" designator. For values that
|
||||
exceed 9999.9, we use "???".
|
||||
*/
|
||||
|
||||
char *format_time(seconds)
|
||||
|
||||
long seconds;
|
||||
|
||||
{
|
||||
register int value;
|
||||
register int digit;
|
||||
register char *ptr;
|
||||
static char result[10];
|
||||
|
||||
/* sanity protection */
|
||||
if (seconds < 0 || seconds > (99999l * 360l))
|
||||
{
|
||||
strcpy(result, " ???");
|
||||
}
|
||||
else if (seconds >= (1000l * 60l))
|
||||
{
|
||||
/* alternate (slow) method displaying hours and tenths */
|
||||
sprintf(result, "%5.1fH", (double)seconds / (double)(60l * 60l));
|
||||
|
||||
/* It is possible that the sprintf took more than 6 characters.
|
||||
If so, then the "H" appears as result[6]. If not, then there
|
||||
is a \0 in result[6]. Either way, it is safe to step on.
|
||||
*/
|
||||
result[6] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* standard method produces MMM:SS */
|
||||
/* we avoid printf as must as possible to make this quick */
|
||||
sprintf(result, "%3d:%02d", seconds / 60l, seconds % 60l);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_k(amt) - format a kilobyte memory value, returning a string
|
||||
* suitable for display. Returns a pointer to a static
|
||||
* area that changes each call. "amt" is converted to a
|
||||
* string with a trailing "K". If "amt" is 10000 or greater,
|
||||
* then it is formatted as megabytes (rounded) with a
|
||||
* trailing "M".
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compromise time. We need to return a string, but we don't want the
|
||||
* caller to have to worry about freeing a dynamically allocated string.
|
||||
* Unfortunately, we can't just return a pointer to a static area as one
|
||||
* of the common uses of this function is in a large call to sprintf where
|
||||
* it might get invoked several times. Our compromise is to maintain an
|
||||
* array of strings and cycle thru them with each invocation. We make the
|
||||
* array large enough to handle the above mentioned case. The constant
|
||||
* NUM_STRINGS defines the number of strings in this array: we can tolerate
|
||||
* up to NUM_STRINGS calls before we start overwriting old information.
|
||||
* Keeping NUM_STRINGS a power of two will allow an intelligent optimizer
|
||||
* to convert the modulo operation into something quicker. What a hack!
|
||||
*/
|
||||
|
||||
#define NUM_STRINGS 8
|
||||
|
||||
char *format_k(amt)
|
||||
|
||||
int amt;
|
||||
|
||||
{
|
||||
static char retarray[NUM_STRINGS][16];
|
||||
static int index = 0;
|
||||
register char *p;
|
||||
register char *ret;
|
||||
register char tag = 'K';
|
||||
|
||||
p = ret = retarray[index];
|
||||
index = (index + 1) % NUM_STRINGS;
|
||||
|
||||
if (amt >= 10000)
|
||||
{
|
||||
amt = (amt + 512) / 1024;
|
||||
tag = 'M';
|
||||
if (amt >= 10000)
|
||||
{
|
||||
amt = (amt + 512) / 1024;
|
||||
tag = 'G';
|
||||
}
|
||||
}
|
||||
|
||||
p = strecpy(p, itoa(amt));
|
||||
*p++ = tag;
|
||||
*p = '\0';
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
char *format_k2(amt)
|
||||
|
||||
int amt;
|
||||
|
||||
{
|
||||
static char retarray[NUM_STRINGS][16];
|
||||
static int index = 0;
|
||||
register char *p;
|
||||
register char *ret;
|
||||
register char tag = 'K';
|
||||
|
||||
p = ret = retarray[index];
|
||||
index = (index + 1) % NUM_STRINGS;
|
||||
|
||||
if (amt >= 100000)
|
||||
{
|
||||
amt = (amt + 512) / 1024;
|
||||
tag = 'M';
|
||||
if (amt >= 100000)
|
||||
{
|
||||
amt = (amt + 512) / 1024;
|
||||
tag = 'G';
|
||||
}
|
||||
}
|
||||
|
||||
p = strecpy(p, itoa(amt));
|
||||
*p++ = tag;
|
||||
*p = '\0';
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
/* prototypes for functions found in utils.c */
|
||||
|
||||
int atoiwi();
|
||||
char *itoa();
|
||||
char *itoa7();
|
||||
int digits();
|
||||
char *strecpy();
|
||||
char **argparse();
|
||||
long percentages();
|
||||
char *errmsg();
|
||||
char *format_time();
|
||||
char *format_k();
|
||||
char *format_k2();
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Top users/processes display for Unix
|
||||
* Version 3
|
||||
*
|
||||
* This program may be freely redistributed,
|
||||
* but this entire comment MUST remain intact.
|
||||
*
|
||||
* Copyright (c) 1984, 1989, William LeFebvre, Rice University
|
||||
* Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
|
||||
*/
|
||||
|
||||
#include "top.h"
|
||||
#include "patchlevel.h"
|
||||
|
||||
static char version[16];
|
||||
|
||||
char *version_string()
|
||||
|
||||
{
|
||||
sprintf(version, "%d.%d", VERSION, PATCHLEVEL);
|
||||
#ifdef BETA
|
||||
strcat(version, BETA);
|
||||
#endif
|
||||
return(version);
|
||||
}
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
# from: @(#)Makefile 5.11 (Berkeley) 5/21/91
|
||||
# $Id: Makefile,v 1.143.2.1 1996/12/13 10:25:29 jkh Exp $
|
||||
# $Id: Makefile,v 1.143.2.2 1996/12/14 11:35:56 joerg Exp $
|
||||
|
||||
# -rw-r--r--
|
||||
BINOWN= root
|
||||
BINGRP= wheel
|
||||
BIN1= aliases amd.map csh.cshrc csh.login csh.logout dm.conf \
|
||||
ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \
|
||||
inetd.conf login.access motd modems netstart networks \
|
||||
inetd.conf login.access motd modems networks \
|
||||
newsyslog.conf phones pccard.conf.sample printcap profile protocols \
|
||||
rc rc.firewall rc.local rc.pccard rc.serial \
|
||||
rc rc.conf rc.firewall rc.local rc.network rc.pccard rc.serial \
|
||||
etc.${MACHINE}/rc.${MACHINE} \
|
||||
remote security services sysconfig shells \
|
||||
remote security services shells \
|
||||
syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \
|
||||
${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \
|
||||
${.CURDIR}/../usr.bin/mail/misc/mail.rc \
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
# perfmon CPU performance-monitoring counters
|
||||
# pci PCI configuration-space access from user mode
|
||||
#
|
||||
# $Id: MAKEDEV,v 1.127.2.8 1997/03/05 14:05:38 joerg Exp $
|
||||
# $Id: MAKEDEV,v 1.127.2.9 1997/03/11 11:15:39 joerg Exp $
|
||||
#
|
||||
|
||||
PATH=/sbin:/bin/:/usr/bin:/usr/sbin:$PATH
|
||||
@@ -185,6 +185,7 @@ all)
|
||||
sh MAKEDEV perfmon speaker pcaudio psm0 mse0 sysmouse # cdev
|
||||
sh MAKEDEV vty4 # cdev
|
||||
sh MAKEDEV tun0 # cdev
|
||||
sh MAKEDEV vn0 # cdev
|
||||
sh MAKEDEV apm card0 card1 # cdev, laptop
|
||||
;;
|
||||
std)
|
||||
|
||||
+22
-17
@@ -1,27 +1,28 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# $Id: rc.i386,v 1.17 1996/09/07 19:04:48 ache Exp $
|
||||
# $Id: rc.i386,v 1.18.2.2 1997/04/28 05:50:13 jkh Exp $
|
||||
# Do i386 specific processing
|
||||
#
|
||||
|
||||
echo -n 'enabling FreeBSD/i386 options:'
|
||||
echo -n 'Initial rc.i386 initialization:'
|
||||
if [ "X$apm_enable" = X"YES" ] ; then
|
||||
echo -n ' apm'
|
||||
apmconf -e > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Start the SCO binary emulation if requested.
|
||||
if [ "X${ibcs2}" = X"YES" ]; then
|
||||
echo -n ' '; ibcs2
|
||||
# XXX BOGUS - ibcs2 script shouldn't make any output on success
|
||||
if [ "X${ibcs2_enable}" = X"YES" ]; then
|
||||
echo -n ' ibcs2'; ibcs2 > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Start the Linux binary emulation if requested.
|
||||
if [ "X${linux}" = X"YES" ]; then
|
||||
echo -n ' '; linux
|
||||
# XXX BOGUS - Linux script shouldn't make any output on success
|
||||
if [ "X${linux_enable}" = X"YES" ]; then
|
||||
echo -n ' linux'; linux > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then
|
||||
if [ "X${xtend_enable}" = X"YES" ]; then
|
||||
echo -n ' xtend'; /usr/libexec/xtend
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
|
||||
##########################################################################
|
||||
@@ -32,7 +33,7 @@ echo '.'
|
||||
kbddev=/dev/ttyv0
|
||||
viddev=/dev/ttyv0
|
||||
|
||||
echo -n "configuring syscons:"
|
||||
echo -n "rc.i386 configuring syscons:"
|
||||
|
||||
# keymap
|
||||
if [ "X${keymap}" != X"NO" ]; then
|
||||
@@ -44,6 +45,11 @@ if [ "X${keyrate}" != X"NO" ]; then
|
||||
echo -n ' keyrate'; kbdcontrol <${kbddev} -r ${keyrate}
|
||||
fi
|
||||
|
||||
# keybell
|
||||
if [ "X${keybell}" != X"NO" ]; then
|
||||
echo -n ' keybell'; kbdcontrol <${kbddev} -b ${keybell}
|
||||
fi
|
||||
|
||||
# change function keys
|
||||
if [ "X${keychange}" != X"NO" ]; then
|
||||
echo -n " keychange"
|
||||
@@ -97,14 +103,13 @@ if [ "X${mousedtype}" != XNO ] ; then
|
||||
echo -n ' moused'
|
||||
moused ${mousedflags} -p ${mousedport} -t ${mousedtype}
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
|
||||
# interrupts for /dev/random device
|
||||
if [ "X${rand_irqs}" != X"NO" ] ; then
|
||||
echo -n 'entropy source: '
|
||||
rndcontrol ${rand_irqs}
|
||||
echo -n 'entropy IRQs:'
|
||||
for irq in ${rand_irqs}; do
|
||||
echo -n " ${irq}" && rndcontrol -q -s ${irq}
|
||||
done
|
||||
echo '.'
|
||||
fi
|
||||
|
||||
echo '.' # probably bogus
|
||||
|
||||
@@ -4,6 +4,7 @@ kmem:*:2:root
|
||||
sys:*:3:root
|
||||
tty:*:4:root
|
||||
operator:*:5:root
|
||||
mail:*:6:
|
||||
bin:*:7:
|
||||
news:*:8:
|
||||
man:*:9:
|
||||
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
# Sample login.conf - login class capabilities database.
|
||||
# To speed up access to this data, you can use /bin/cap_mkdb
|
||||
# to create a database form of this file:
|
||||
#
|
||||
# cap_mkdb /etc/login.conf
|
||||
#
|
||||
# Don't forget to do this after each edit as well!
|
||||
#
|
||||
# This file controls resource limits, accounting limits and
|
||||
# default user environment settings.
|
||||
#
|
||||
# $Id: login.conf,v 1.8 1997/03/20 13:41:16 ache Exp $
|
||||
#
|
||||
|
||||
|
||||
# Authentication methods
|
||||
|
||||
auth-defaults:\
|
||||
:auth=krb_skey_or_passwd,passwd,kerberos,skey:
|
||||
|
||||
auth-root-defaults:\
|
||||
:auth-login=krb_skey_or_passwd,passwd,kerberos,skey:\
|
||||
:auth-rlogin=krb_or_skey,kerberos,skey:\
|
||||
|
||||
auth-ftp-defaults:\
|
||||
:auth=skey_or_pwd,passwd,skey:
|
||||
|
||||
|
||||
# Example defaults
|
||||
# These settings are used by login(1) by default for classless users
|
||||
# Note that entries like "cputime" set both "cputime-cur" and "cputime-max"
|
||||
|
||||
default:\
|
||||
:cputime=infinity:\
|
||||
:datasize-cur=16M:\
|
||||
:stacksize-cur=8M:\
|
||||
:memorylocked-cur=10M:\
|
||||
:memoryuse-cur=30M:\
|
||||
:filesize=infinity:\
|
||||
:coredumpsize=infinity:\
|
||||
:maxproc-cur=64:\
|
||||
:openfiles-cur=64:\
|
||||
:priority=0:\
|
||||
:requirehome:\
|
||||
:umask=022:\
|
||||
:tc=auth-defaults:
|
||||
|
||||
|
||||
#
|
||||
# standard - standard user defaults
|
||||
#
|
||||
standard:\
|
||||
:copyright=/etc/COPYRIGHT:\
|
||||
:welcome=/etc/motd:\
|
||||
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,EDITOR=/usr/bin/ee:\
|
||||
:path=~/bin /bin /usr/bin /usr/local/bin:\
|
||||
:manpath=/usr/share/man /usr/local/man:\
|
||||
:nologin=/etc/nologin:\
|
||||
:cputime=1h30m:\
|
||||
:datasize=8M:\
|
||||
:stacksize=2M:\
|
||||
:memorylocked=4M:\
|
||||
:memoryuse=8M:\
|
||||
:filesize=8M:\
|
||||
:coredumpsize=8M:\
|
||||
:openfiles=24:\
|
||||
:maxproc=32:\
|
||||
:priority=0:\
|
||||
:requirehome:\
|
||||
:passwordperiod=90d:\
|
||||
:umask=002:\
|
||||
:ignoretime@:\
|
||||
:tc=default:
|
||||
|
||||
|
||||
#
|
||||
# users of X (needs more resources!)
|
||||
#
|
||||
xuser:\
|
||||
:manpath=/usr/share/man /usr/X11R6/man /usr/local/man:\
|
||||
:cputime=4h:\
|
||||
:datasize=12M:\
|
||||
:stacksize=4M:\
|
||||
:filesize=8M:\
|
||||
:memoryuse=16M:\
|
||||
:openfiles=32:\
|
||||
:maxproc=48:\
|
||||
:tc=standard:
|
||||
|
||||
|
||||
#
|
||||
# Staff users - few restrictions and allow login anytime
|
||||
#
|
||||
staff:\
|
||||
:ignorenologin:\
|
||||
:ignoretime:\
|
||||
:requirehome@:\
|
||||
:accounted@:\
|
||||
:path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin:\
|
||||
:umask=022:\
|
||||
:tc=standard:
|
||||
|
||||
|
||||
#
|
||||
# root - fallback for root logins
|
||||
#
|
||||
root:\
|
||||
:path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin:\
|
||||
:cputime=infinity:\
|
||||
:datasize=infinity:\
|
||||
:stacksize=infinity:\
|
||||
:memorylocked=infinity:\
|
||||
:memoryuse=infinity:\
|
||||
:filesize=infinity:\
|
||||
:coredumpsize=infinity:\
|
||||
:openfiles=infinity:\
|
||||
:maxproc=infinity:\
|
||||
:memoryuse-cur=32M:\
|
||||
:maxproc-cur=64:\
|
||||
:openfiles-cur=1024:\
|
||||
:priority=0:\
|
||||
:requirehome@:\
|
||||
:umask=022:\
|
||||
:tc=auth-root-defaults:\
|
||||
|
||||
|
||||
#
|
||||
# Settings used by /etc/rc
|
||||
#
|
||||
daemon:\
|
||||
:cputime=infinity:\
|
||||
:filesize=64M:\
|
||||
:datasize=32M:\
|
||||
:stacksize=16M:\
|
||||
:coredumpsize=0:\
|
||||
:memoryuse-cur=64M:\
|
||||
:memorylocked-cur=64M:\
|
||||
:maxproc=32:\
|
||||
:openfiles=1024:\
|
||||
:tc=default:
|
||||
|
||||
|
||||
#
|
||||
# Settings used by news subsystem
|
||||
#
|
||||
news:\
|
||||
:path=/usr/local/news/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin:\
|
||||
:cputime=infinity:\
|
||||
:filesize=128M:\
|
||||
:datasize-curr=64M:\
|
||||
:stacksize-cur=32M:\
|
||||
:coredumpsize-cur=0:\
|
||||
:maxmemorysize-cur=128M:\
|
||||
:memorylocked=32M:\
|
||||
:maxproc=128:\
|
||||
:openfiles=256:\
|
||||
:tc=default:
|
||||
|
||||
|
||||
#
|
||||
# The dialer class should be used for a dialup PPP/SLIP accounts
|
||||
# Welcome messages/news suppressed
|
||||
#
|
||||
dialer:\
|
||||
:hushlogin:\
|
||||
:requirehome@:\
|
||||
:cputime=unlimited:\
|
||||
:filesize=2M:\
|
||||
:datasize=2M:\
|
||||
:stacksize=4M:\
|
||||
:coredumpsize=0:\
|
||||
:memoryuse=4M:\
|
||||
:memorylocked=1M:\
|
||||
:maxproc=16:\
|
||||
:openfiles=32:\
|
||||
:tc=standard:
|
||||
|
||||
|
||||
#
|
||||
# Site full-time 24/7 PPP/SLIP connections
|
||||
# - no time accounting, restricted to access via dialin lines
|
||||
#
|
||||
site:\
|
||||
:ignoretime:\
|
||||
:passwordperiod@:\
|
||||
:refreshtime@:\
|
||||
:refreshperiod@:\
|
||||
:sessionlimit@:\
|
||||
:autodelete@:\
|
||||
:expireperiod@:\
|
||||
:graceexpire@:\
|
||||
;gracetime@:\
|
||||
:warnexpire@:\
|
||||
:warnpassword@:\
|
||||
:idletime@:\
|
||||
:sessiontime@:\
|
||||
:daytime@:\
|
||||
:weektime@:\
|
||||
:monthtime@:\
|
||||
:warntime@:\
|
||||
:accounted@:\
|
||||
:tc=dialer:\
|
||||
:tc=staff:
|
||||
|
||||
|
||||
#
|
||||
# Example standard accounting entries for subscriber levels
|
||||
#
|
||||
|
||||
subscriber|Subscribers:\
|
||||
:accounted:\
|
||||
:refreshtime=180d:\
|
||||
:refreshperiod@:\
|
||||
:sessionlimit@:\
|
||||
:autodelete=30d:\
|
||||
:expireperiod=180d:\
|
||||
:graceexpire=7d:\
|
||||
:gracetime=10m:\
|
||||
:warnexpire=7d:\
|
||||
:warnpassword=7d:\
|
||||
:idletime=30m:\
|
||||
:sessiontime=4h:\
|
||||
:daytime=6h:\
|
||||
:weektime=40h:\
|
||||
:monthtime=120h:\
|
||||
:warntime=4h:\
|
||||
:tc=standard:
|
||||
|
||||
|
||||
#
|
||||
# Subscriber accounts. These accounts have their login times
|
||||
# accounted and have access limits applied.
|
||||
#
|
||||
subppp|PPP Subscriber Accounts:\
|
||||
:tc=dialer:\
|
||||
:tc=subscriber:
|
||||
|
||||
|
||||
subslip|SLIP Subscriber Accounts:\
|
||||
:tc=dialer:\
|
||||
:tc=subscriber:
|
||||
|
||||
|
||||
subshell:Shell Subscriber Accounts:\
|
||||
:tc=subscriber:
|
||||
|
||||
|
||||
#
|
||||
# Russian Users Accounts. Setup proper environment variables.
|
||||
#
|
||||
russian:Russian Users Accounts:\
|
||||
:charset=KOI8-R:\
|
||||
:lang=ru_RU.KOI8-R:\
|
||||
:tc=default:
|
||||
+34
-1
@@ -1,4 +1,4 @@
|
||||
# $Id: make.conf,v 1.37.2.2 1996/12/23 06:21:53 peter Exp $
|
||||
# $Id: make.conf,v 1.37.2.3 1997/02/23 11:02:40 joerg Exp $
|
||||
#
|
||||
# This file, if present, will be read by make (see /usr/share/mk/sys.mk).
|
||||
# It allows you to override macro definitions to make without changing
|
||||
@@ -107,6 +107,39 @@
|
||||
#MOTIFLIB= -L${X11BASE}/lib -lXm
|
||||
#
|
||||
#
|
||||
# Port master sites.
|
||||
#
|
||||
# If you want your port fetches to go somewhere else than the default
|
||||
# (specified below) in case the distfile/patchfile was not found,
|
||||
# uncomment this and change it to a location nearest you. (Don't
|
||||
# remove the "/${DIST_SUBDIR}/" part.)
|
||||
#
|
||||
#MASTER_SITE_BACKUP?= \
|
||||
# ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
|
||||
#
|
||||
# If you want your port fetches to check the above site first (before
|
||||
# the MASTER_SITES specified in the port Makefiles), uncomment the
|
||||
# line below. You can also change the right side to point to wherever
|
||||
# you want.
|
||||
#
|
||||
#MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
|
||||
#
|
||||
# Some ports use a special variable to point to a collection of
|
||||
# mirrors of well-known software archives. If you have a mirror close
|
||||
# to you, uncomment any of the following lines and change it to that
|
||||
# address. (Don't remove the "/${MASTER_SITE_SUBDIR}/" part.)
|
||||
#
|
||||
# Note: the right hand sides of the following lines are only for your
|
||||
# information. For a full list of default sites, take a look at
|
||||
# bsd.port.mk.
|
||||
#
|
||||
#MASTER_SITE_XCONTRIB= ftp://ftp.x.org/contrib/${MASTER_SITE_SUBDIR}/
|
||||
#MASTER_SITE_GNU= ftp://prep.ai.mit.edu/pub/gnu/${MASTER_SITE_SUBDIR}/
|
||||
#MASTER_SITE_PERL_CPAN= ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/
|
||||
#MASTER_SITE_TEX_CTAN= ftp://ftp.tex.ac.uk/public/ctan/tex-archive/${MASTER_SITE_SUBDIR}/
|
||||
#MASTER_SITE_SUNSITE= ftp://sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/
|
||||
#
|
||||
#
|
||||
# Kerberos IV
|
||||
# If you want the eBones-based Kerberos, define this:
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: BSD.var.dist,v 1.26 1996/10/13 16:52:40 joerg Exp $
|
||||
# $Id: BSD.var.dist,v 1.26.2.1 1997/02/26 01:18:15 mpp Exp $
|
||||
#
|
||||
|
||||
/set type=dir uname=bin gname=bin mode=0755
|
||||
@@ -34,7 +34,7 @@
|
||||
..
|
||||
log uname=bin
|
||||
..
|
||||
mail uname=bin
|
||||
mail uname=bin gname=mail mode=0775
|
||||
..
|
||||
msgs uname=daemon
|
||||
..
|
||||
|
||||
+50
-11
@@ -1,11 +1,21 @@
|
||||
; $Id: named.boot,v 1.2 1993/11/07 00:58:34 wollman Exp $
|
||||
; $Id: named.boot,v 1.3 1995/03/23 08:43:02 rgrimes Exp $
|
||||
; From: @(#)named.boot 5.1 (Berkeley) 6/30/90
|
||||
|
||||
; boot file for secondary name server
|
||||
; Note that there should be one primary entry for each SOA record.
|
||||
; Refer to the named(8) man page for details. If you are ever going
|
||||
; to setup a primary server, make sure you've understood the hairy
|
||||
; details of how DNS is working. Even with simple mistakes, you can
|
||||
; break connectivity for affected parties, or cause huge amount of
|
||||
; useless Internet traffic.
|
||||
;
|
||||
; Setting up secondaries is way easier and the rough picture for this
|
||||
; is explained below.
|
||||
;
|
||||
; If you enable a local name server, don't forget to enter 127.0.0.1
|
||||
; into your /etc/resolv.conf so this server will be queried first.
|
||||
; Also, make sure to enable it in /etc/sysconfig.
|
||||
|
||||
; example sortlist config:
|
||||
; sortlist 128.3.0.0
|
||||
; sortlist 127.0.0.0
|
||||
|
||||
directory /etc/namedb
|
||||
|
||||
@@ -14,10 +24,39 @@ directory /etc/namedb
|
||||
cache . named.root
|
||||
primary 0.0.127.IN-ADDR.ARPA localhost.rev
|
||||
|
||||
; example secondary server config:
|
||||
; secondary Berkeley.EDU 128.32.130.11 128.32.133.1 ucbhosts.bak
|
||||
; secondary 32.128.IN-ADDR.ARPA 128.32.130.11 128.32.133.1 ucbhosts.rev.bak
|
||||
|
||||
; example primary server config:
|
||||
; primary Berkeley.EDU ucbhosts
|
||||
; primary 32.128.IN-ADDR.ARPA ucbhosts.rev
|
||||
; NB: Do not use the IP addresses below, they are faked, and only
|
||||
; serve demonstration/documentation purposes!
|
||||
;
|
||||
; Example secondary config entries. It can be convenient to become
|
||||
; a secondary at least for the zone where your own domain is in. Ask
|
||||
; your network administrator for the IP address of the responsible
|
||||
; primary.
|
||||
;
|
||||
; Never forget to include the reverse lookup (IN-ADDR.ARPA) zone!
|
||||
; (This is the first bytes of the respective IP address, in reverse
|
||||
; order, with ".IN-ADDR.ARPA" appended.)
|
||||
;
|
||||
; Before starting to setup a primary zone, better make sure you fully
|
||||
; understand how DNS and BIND works, however. There are sometimes
|
||||
; unobvious pitfalls. Setting up a secondary is comparably simpler.
|
||||
;
|
||||
; NB: Don't blindly enable the examples below. :-) Use actual names
|
||||
; and addresses instead.
|
||||
;
|
||||
;type zone name IP of primary backup file name
|
||||
;==================================================================
|
||||
;secondary domain.com 192.168.1.1 domain.com.bak
|
||||
;secondary 0.168.192.in-addr.arpa 192.168.1.1 0.168.192.in-addr.arpa.bak
|
||||
;
|
||||
;
|
||||
; If you've got a DNS server around at your upstream provider, enter
|
||||
; its IP address here, and enable the line below. This will make you
|
||||
; benefit from its cache, thus reduce overall DNS traffic in the Internet.
|
||||
;
|
||||
;forwarders 127.0.0.1
|
||||
;
|
||||
; In addition to the "forwarders" clause, you can force your name
|
||||
; server to never initiate queries of its own, but always ask its
|
||||
; forwarders only, by enabling the following line:
|
||||
;
|
||||
;options forward-only
|
||||
+31
-4
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Written by Toshiharu OHNO
|
||||
#
|
||||
# $Id: ppp.conf.sample,v 1.5.2.1 1996/11/16 21:03:20 phk Exp $
|
||||
# $Id: ppp.conf.sample,v 1.13 1997/05/08 01:45:48 brian Exp $
|
||||
#
|
||||
#################################################################
|
||||
|
||||
@@ -91,6 +91,8 @@ ondemand:
|
||||
# IP will be either, take a wild guess at an some IPs that you can't
|
||||
# currently route to. Ensure that the "delete" and "add" lines are also
|
||||
# present in ppp.linkup so that when we connect, things will be put straight.
|
||||
# Note that it is illegal to use HISADDR here - HISADDR is only available
|
||||
# in ppp.linkup (after the value has been established).
|
||||
#
|
||||
# The /0 bit says that we insist on 0 bits of the specified IP actually
|
||||
# being correct, therefore, the other side can assign any IP numbers.
|
||||
@@ -98,15 +100,40 @@ ondemand:
|
||||
# We also set openmode active - this makes us initiate ppp negotiation.
|
||||
# The default is to wait for the server to start talking.
|
||||
#
|
||||
pmdemend:
|
||||
pmdemand:
|
||||
set phone 1234567
|
||||
set login "TIMEOUT 5 login:-\\r-login: ppp word: ppp"
|
||||
set timeout 120
|
||||
set ifaddr 10.10.10.10/0 10.10.11.11/0 255.255.255.0
|
||||
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0
|
||||
delete ALL
|
||||
add 0 0 HISADDR
|
||||
add 0 0 10.0.0.2
|
||||
set openmode active
|
||||
|
||||
# Examples to connect using a null-modem cable from one machine to another.
|
||||
# The important thing here is to allow the lqr packets on both sides.
|
||||
# Without them enabled, we can't tell if the line's dropped - there
|
||||
# should always be carrier on a direct connection.
|
||||
# Here, the server sends lqr's every 10 seconds and quits if three in a
|
||||
# row fail.
|
||||
#
|
||||
# Make sure you don't have "deny lqr" in your default: on the client !
|
||||
#
|
||||
direct-client:
|
||||
set dial ""
|
||||
set line /dev/cuaa0
|
||||
set sp 115200
|
||||
set timeout 900
|
||||
set debug Phase Chat LQM
|
||||
set login "TIMEOUT 5 -\\r-login:-\\r-login: ppp word: ppp HELLO"
|
||||
set ifaddr 10.0.4.2 10.0.4.1
|
||||
add 10.0.4.2 255.255.255.255 127.0.0.1
|
||||
|
||||
direct-server:
|
||||
set timeout 900 10 3
|
||||
set debug Phase LQM
|
||||
set ifaddr 10.0.4.1 10.0.4.2
|
||||
add 10.0.4.1 255.255.255.255 127.0.0.1
|
||||
|
||||
# Example to validate incoming user with CHAP
|
||||
# Invoke as ``ppp -direct users'' from login script. User's system name
|
||||
# and secret-key must be registered into /etc/ppp.secret.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# list of users disallowed any pppd access via 'system
|
||||
# password login'.
|
||||
# read by pppd(8).
|
||||
root
|
||||
toor
|
||||
daemon
|
||||
operator
|
||||
bin
|
||||
games
|
||||
news
|
||||
man
|
||||
ftp
|
||||
uucp
|
||||
xten
|
||||
ingres
|
||||
@@ -0,0 +1,11 @@
|
||||
# List of acceptable shells for pppd(8).
|
||||
# Pppd will not accept a system password login
|
||||
# by a user whose shell is not listed below.
|
||||
|
||||
/bin/sh
|
||||
/bin/csh
|
||||
/usr/local/bin/ksh
|
||||
/usr/local/bin/zsh
|
||||
/usr/local/bin/bash
|
||||
/usr/local/bin/tcsh
|
||||
/usr/local/bin/ppplogin.sh
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $Id: rc,v 1.104.2.4 1996/12/23 00:36:58 joerg Exp $
|
||||
# $Id: rc,v 1.104.2.13 1997/05/04 22:35:26 andreas Exp $
|
||||
# From: @(#)rc 5.27 (Berkeley) 6/5/91
|
||||
|
||||
# System startup script run by init on autoboot
|
||||
@@ -8,7 +8,7 @@
|
||||
# and the console is the controlling terminal.
|
||||
|
||||
# Note that almost all the user-configurable behavior is no longer in
|
||||
# this file, but rather in /etc/sysconfig. Please check this file
|
||||
# this file, but rather in /etc/rc.conf. Please check this file
|
||||
# first before contemplating any changes here.
|
||||
|
||||
stty status '^T'
|
||||
@@ -23,15 +23,13 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
|
||||
export PATH
|
||||
|
||||
# Configure ccd devices.
|
||||
if [ -f /etc/ccd.conf ]
|
||||
then
|
||||
if [ -f /etc/ccd.conf ]; then
|
||||
ccdconfig -C
|
||||
fi
|
||||
|
||||
swapon -a
|
||||
|
||||
if [ $1x = autobootx ]
|
||||
then
|
||||
if [ $1x = autobootx ]; then
|
||||
echo Automatic reboot in progress...
|
||||
fsck -p
|
||||
case $? in
|
||||
@@ -84,20 +82,27 @@ if [ $? != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there is a global system configuration file, suck it in.
|
||||
if [ -f /etc/rc.conf ]; then
|
||||
. /etc/rc.conf
|
||||
fi
|
||||
|
||||
# If old file exists, whine until they fix it.
|
||||
if [ -f /etc/sysconfig ]; then
|
||||
echo "Warning: /etc/sysconfig has been replaced by /etc/rc.conf."
|
||||
echo "You should switch to /etc/rc.conf ASAP to eliminate this warning."
|
||||
fi
|
||||
|
||||
adjkerntz -i
|
||||
|
||||
# Keep a copy of the boot messages around
|
||||
/sbin/dmesg > /var/run/dmesg.boot
|
||||
dmesg > /var/run/dmesg.boot
|
||||
|
||||
# If there is a global system configuration file, suck it in.
|
||||
if [ -f /etc/sysconfig ]; then
|
||||
. /etc/sysconfig
|
||||
fi
|
||||
|
||||
# Add additional swapfile, if configured.
|
||||
if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then
|
||||
echo "Adding $swapfile as additional swap."
|
||||
/usr/sbin/vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b
|
||||
vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b
|
||||
fi
|
||||
|
||||
# configure serial devices
|
||||
@@ -110,9 +115,10 @@ if [ -f /etc/rc.pccard ]; then
|
||||
. /etc/rc.pccard
|
||||
fi
|
||||
|
||||
# start up the network
|
||||
if [ -f /etc/netstart ]; then
|
||||
sh /etc/netstart
|
||||
# start up the initial network configuration.
|
||||
if [ -f /etc/rc.network ]; then
|
||||
. /etc/rc.network # We only need to do this once.
|
||||
network_pass1
|
||||
fi
|
||||
|
||||
mount -a -t nfs >/dev/null 2>&1
|
||||
@@ -126,119 +132,47 @@ rm -f /var/spool/lock/*
|
||||
rm -rf /var/spool/uucp/.Temp/*
|
||||
(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })
|
||||
|
||||
#
|
||||
# Clearing /tmp at boot-time is essentially stupid, but seems to have
|
||||
# a long tradition. It doesn't help in any way for long-living systems,
|
||||
# and it might accidentally clobber files you would rather like to have
|
||||
# preserved after a crash (if not using mfs /tmp anyway).
|
||||
#
|
||||
# See also the commented out example of another cleanup policy in
|
||||
# /etc/daily.
|
||||
#
|
||||
echo clearing /tmp
|
||||
|
||||
# prune quickly with one rm, then use find to clean up /tmp/[lq]*
|
||||
# (not needed with mfs /tmp, but doesn't hurt there...)
|
||||
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
|
||||
find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
|
||||
|
||||
# The above is even more stupid since it prevents you from restarting
|
||||
# X11 after a system crash. If you disable the above, make sure to
|
||||
# uncomment the line below.
|
||||
#
|
||||
# clean up leftover X lock files and local connection sockets
|
||||
#rm -f /tmp/.X*-lock /tmp/.X11-unix/*
|
||||
|
||||
|
||||
# enable dumpdev so that savecore can see it
|
||||
if [ "X${dumpdev}" != X"NO" ]; then
|
||||
if [ "X${dumpdev}" != X"NO" -a -e ${dumpdev} ]; then
|
||||
dumpon ${dumpdev}
|
||||
fi
|
||||
|
||||
# /var/crash should be a directory or a symbolic link
|
||||
# to the crash directory if core dumps are to be saved.
|
||||
if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then
|
||||
if [ "X${savecore_enable}" = X"YES" -a -d /var/crash ]; then
|
||||
echo -n checking for core dump...
|
||||
savecore /var/crash
|
||||
fi
|
||||
|
||||
# snapshot any kernel -c changes back to disk
|
||||
echo 'recording kernel -c changes'
|
||||
/sbin/dset -q
|
||||
dset -q
|
||||
|
||||
echo -n 'additional daemons:'
|
||||
# start system logging and name service (named needs to start before syslogd
|
||||
# if you don't have a /etc/resolv.conf)
|
||||
#
|
||||
echo -n starting system daemons:
|
||||
|
||||
# Transitional symlink (for the next couple of years :) until all
|
||||
# binaries had a chance to move towards /var/run/log.
|
||||
if [ ! -h /dev/log ] ; then
|
||||
# might complain for r/o root f/s
|
||||
ln -sf /var/run/log /dev/log
|
||||
fi
|
||||
rm -f /var/run/log
|
||||
echo ' syslogd.'; syslogd
|
||||
|
||||
echo -n starting early network daemons:
|
||||
|
||||
# $namedflags is imported from /etc/sysconfig
|
||||
if [ "X${namedflags}" != X"NO" ]; then
|
||||
echo -n ' named'; named $namedflags
|
||||
fi
|
||||
|
||||
# $ntpdate and $xntpdflags are imported from /etc/sysconfig.
|
||||
# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
|
||||
# If $xntpdflags != NO, start xntpd.
|
||||
if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then
|
||||
if [ "X${tickadjflags}" != X"NO" ]; then
|
||||
echo -n ' tickadj'; tickadj ${tickadjflags--Aq}
|
||||
if [ "X${syslogd_enable}" = X"YES" ]; then
|
||||
# Transitional symlink (for the next couple of years :) until all
|
||||
# binaries had a chance to move towards /var/run/log.
|
||||
if [ ! -h /dev/log ] ; then
|
||||
# might complain for r/o root f/s
|
||||
ln -sf /var/run/log /dev/log
|
||||
fi
|
||||
|
||||
if [ "X${ntpdate}" != X"NO" ]; then
|
||||
echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X${xntpdflags}" != X"NO" ]; then
|
||||
echo -n ' xntpd'; xntpd ${xntpdflags}
|
||||
fi
|
||||
rm -f /var/run/log
|
||||
echo -n ' syslogd'; syslogd ${syslogd_flags}
|
||||
fi
|
||||
|
||||
# $timedflags is imported from /etc/sysconfig;
|
||||
# if $timedflags == NO, timed isn't run.
|
||||
if [ "X${timedflags}" != X"NO" ]; then
|
||||
echo -n ' timed'; timed $timedflags
|
||||
if [ "X${tickadj_enable}" = X"YES" ]; then
|
||||
echo -n ' tickadj'; tickadj ${tickadj_flags--Aq}
|
||||
fi
|
||||
|
||||
# Portmapper should always be run, to provide RPC services for inetd.
|
||||
if [ -x /usr/sbin/portmap ]; then
|
||||
echo -n ' portmap'; portmap
|
||||
fi
|
||||
|
||||
# Start ypserv if we're an NIS server.
|
||||
# Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
|
||||
if [ "X${nis_serverflags}" != X"NO" ]; then
|
||||
echo -n ' ypserv'; ypserv ${nis_serverflags}
|
||||
|
||||
if [ "X${ypxfrdflags}" != X"NO" ]; then
|
||||
echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${ypxfrdflags}
|
||||
fi
|
||||
|
||||
if [ "X${yppasswddflags}" != X"NO" ]; then
|
||||
echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${yppasswddflags}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start ypbind if we're an NIS client
|
||||
if [ "X${nis_clientflags}" != X"NO" ]; then
|
||||
echo -n ' ypbind'; ypbind ${nis_clientflags}
|
||||
if [ "X${nis_ypsetflags}" != X"NO" ]; then
|
||||
echo -n ' ypset'; ypset ${nis_ypsetflags}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
|
||||
if [ -n "$network_pass1_done" ]; then
|
||||
network_pass2
|
||||
fi
|
||||
|
||||
# Check the quotas (must be after ypbind if using NIS)
|
||||
if [ "X${check_quotas}" = X"YES" ]; then
|
||||
echo -n 'checking quotas:'
|
||||
@@ -247,50 +181,10 @@ if [ "X${check_quotas}" = X"YES" ]; then
|
||||
quotaon -a
|
||||
fi
|
||||
|
||||
echo -n starting other network daemons:
|
||||
|
||||
if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then
|
||||
echo -n ' mountd'
|
||||
if [ "X${weak_mountd_authentication}" = X"YES" ]; then
|
||||
mountd -n
|
||||
else
|
||||
mountd
|
||||
fi
|
||||
echo -n ' nfsd'; nfsd -u -t 4
|
||||
# Warning: rpc.lockd is broken.
|
||||
# Only uncomment this line if the consequences are fully understood.
|
||||
# echo -n ' rpc.lockd'; rpc.lockd
|
||||
echo -n ' rpc.statd'; rpc.statd
|
||||
if [ -n "$network_pass2_done" ]; then
|
||||
network_pass3
|
||||
fi
|
||||
|
||||
if [ "X${nfs_client}" = X"YES" ]; then
|
||||
echo -n ' nfsiod'; nfsiod -n 4
|
||||
fi
|
||||
|
||||
if [ "X${amdflags}" != X"NO" ]; then
|
||||
echo -n ' amd'
|
||||
amd -p ${amdflags} > /var/run/amd.pid
|
||||
fi
|
||||
|
||||
# $rwhod is imported from /etc/sysconfig;
|
||||
# if $rwhod is set to YES, rwhod is run.
|
||||
if [ "X${rwhod}" = X"YES" ]; then
|
||||
echo -n ' rwhod'; rwhod
|
||||
fi
|
||||
|
||||
# Kerberos runs ONLY on the Kerberos server machine
|
||||
if [ "X${kerberos_server}" = X"YES" ]; then
|
||||
echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
|
||||
echo -n ' kadmind'; \
|
||||
(sleep 20; kadmind -n >/dev/null 2>&1 &) &
|
||||
fi
|
||||
|
||||
# IP multicast routing daemon
|
||||
if [ "X${mrouted}" != X"NO" -a -x /usr/sbin/mrouted ]; then
|
||||
echo -n ' mrouted'; mrouted ${mrouted}
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
|
||||
# build ps databases
|
||||
kvm_mkdb
|
||||
@@ -303,7 +197,7 @@ then
|
||||
"password file may be incorrect -- /etc/ptmp exists"
|
||||
fi
|
||||
|
||||
if [ "X${accounting}" = X"YES" -a -d /var/account ]; then
|
||||
if [ "X${accounting_enable}" = X"YES" -a -d /var/account ]; then
|
||||
echo 'turning on accounting'
|
||||
if [ ! -e /var/account/acct ]; then
|
||||
touch /var/account/acct
|
||||
@@ -313,39 +207,34 @@ fi
|
||||
|
||||
# Make shared lib searching a little faster. Leave /usr/lib first if you
|
||||
# add your own entries or you may come to grief.
|
||||
if [ -x /sbin/ldconfig ]; then
|
||||
_LDC=/usr/lib
|
||||
if [ -d /usr/lib/compat ]; then _LDC="${_LDC} /usr/lib/compat" ; fi
|
||||
if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
|
||||
if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi
|
||||
if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
|
||||
echo 'setting ldconfig path:' ${_LDC}
|
||||
ldconfig ${_LDC}
|
||||
fi
|
||||
_LDC=/usr/lib
|
||||
if [ -d /usr/lib/compat ]; then _LDC="${_LDC} /usr/lib/compat" ; fi
|
||||
if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
|
||||
if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
|
||||
echo 'setting ldconfig path:' ${_LDC}
|
||||
ldconfig ${_LDC}
|
||||
|
||||
# Now start up miscellaneous daemons that don't belong anywhere else
|
||||
#
|
||||
echo -n standard daemons:
|
||||
echo -n ' inetd'; inetd
|
||||
echo -n starting standard daemons:
|
||||
echo -n ' inetd'; inetd ${inetd_flags}
|
||||
echo -n ' cron'; cron
|
||||
|
||||
if [ "X${lpd}" != X"NO" -a -x /usr/sbin/lpd ]; then
|
||||
if [ "X${lpd_enable}" = X"YES" ]; then
|
||||
echo -n ' printer'; lpd
|
||||
fi
|
||||
|
||||
# $sendmail_flags is imported from /etc/sysconfig;
|
||||
# if $sendmail_flags is something other than NO, sendmail is run.
|
||||
if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
|
||||
echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags}
|
||||
if [ "X${sendmail_enable}" = X"YES" -a -r /etc/sendmail.cf ]; then
|
||||
echo -n ' sendmail'; sendmail ${sendmail_flags}
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
|
||||
# configure implementation specific stuff
|
||||
arch=`uname -m`
|
||||
if [ -f /etc/rc.${arch} ]; then
|
||||
if [ -f /etc/rc.${arch} ]; then
|
||||
. /etc/rc.${arch}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Recover vi editor files.
|
||||
vibackup=`echo /var/tmp/vi.recover/vi.*`
|
||||
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# This is rc.conf - a file full of useful variables that you can set
|
||||
# to change the default startup behavior of your system.
|
||||
#
|
||||
# All arguments must be in double or single quotes.
|
||||
#
|
||||
# $Id: rc.conf,v 1.1.2.8 1997/05/05 09:33:13 jkh Exp $
|
||||
|
||||
##############################################################
|
||||
### Important initial Boot-time options #####################
|
||||
##############################################################
|
||||
|
||||
swapfile="NO" # Set to name of swapfile if aux swapfile desired.
|
||||
apm_enable="NO" # Set to YES if you want APM enabled.
|
||||
pccard_enable="NO" # Set to YES if you want to configure PCCARD devices.
|
||||
pccard_mem="DEFAULT" # If pccard_enable=YES, this is card memory address.
|
||||
pccard_ifconfig="NO" # Specialized pccard ethernet configuration (or NO).
|
||||
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
|
||||
|
||||
|
||||
##############################################################
|
||||
### Network configuration sub-section ######################
|
||||
##############################################################
|
||||
|
||||
### Basic network options: ###
|
||||
hostname="myname.my.domain" # Set this!
|
||||
nisdomainname="NO" # Set to NIS domain if using NIS (or NO).
|
||||
firewall="NO" # Set to firewall type or NO for none.
|
||||
tcp_extensions="YES" # Allow RFC1323 & RFC1544 extensions (or NO).
|
||||
network_interfaces="lo0" # List of network interfaces (lo0 is loopback).
|
||||
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
|
||||
|
||||
### Network daemon (miscellaneous) & NFS options: ###
|
||||
syslogd_enable="YES" # Run syslog daemon (or NO).
|
||||
syslogd_flags="" # Flags to syslogd (if enabled).
|
||||
inetd_flags="" # Optional flags to inetd (always enabled).
|
||||
named_enable="NO" # Run named, the DNS server (or NO).
|
||||
named_flags="" # Flags to named (if enabled).
|
||||
kerberos_server_enable="NO" # Run a kerberos master server (or NO).
|
||||
rwhod_enable="NO" # Run the rwho daemon (or NO).
|
||||
amd_enable="NO" # Run amd service with $amd_flags (or NO).
|
||||
amd_flags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"
|
||||
nfs_client_enable="NO" # This host is an NFS client (or NO).
|
||||
nfs_server_enable="NO" # This host is an NFS server (or NO).
|
||||
weak_mountd_authentication="NO" # Running PCNFSD / other non-root nfsd (or NO).
|
||||
nfs_reserved_port_only="NO" # Provide NFS only on secure port (or NO).
|
||||
rpc_lockd_enable="NO" # Run NFS rpc.lockd (*broken!*) if nfs_server.
|
||||
rpc_statd_enable="YES" # Run NFS rpc.statd if nfs_server (or NO).
|
||||
portmap_enable="YES" # Run the portmapper service (or NO).
|
||||
portmap_flags="" # Flags to portmap (if enabled).
|
||||
xtend_enable="NO" # Run the X-10 power controller daemon.
|
||||
xtend_flags="" # Flags to xtend (if enabled).
|
||||
|
||||
### Network Time Services options: ###
|
||||
timed_enabled="NO" # Run the time daemon (or NO).
|
||||
timed_flags="" # Flags to timed (if enabled).
|
||||
ntpdate_enable="NO" # Run the ntpdate to sync time (or NO).
|
||||
ntpdate_flags="" # Flags to ntpdate (if enabled).
|
||||
xntpd_enable="NO" # Run xntpd Network Time Protocol (or NO).
|
||||
xntpd_flags="" # Flags to xntpd (if enabled).
|
||||
tickadj_enable="NO" # Run tickadj (or NO).
|
||||
tickadj_flags="-Aq" # Flags to tickadj (if enabled).
|
||||
|
||||
# Network Information Services (NIS) options: ###
|
||||
nis_client_enable="NO" # We're an NIS client (or NO)
|
||||
nis_client_flags="" # Flags to ypbind (if enabled).
|
||||
nis_ypset_enable="NO" # Run ypset at boot time (or NO).
|
||||
nis_ypset_flags="" # Flags to ypset (if enabled).
|
||||
nis_server_enable="NO" # We're an NIS server (or NO)
|
||||
nis_server_flags="" # Flags to ypserv (if enabled).
|
||||
nis_ypxfrd_enable="NO" # Run rpc.ypxfrd at boot time (or NO).
|
||||
nis_ypxfrd_flags="" # Flags to rpc.ypxfrd (if enabled).
|
||||
nis_yppasswdd_enable="NO" # Run rpc.yppasswdd at boot time (or NO).
|
||||
nis_yppasswdd_flags="" # Flags to rpc.yppasswdd (if enabled).
|
||||
|
||||
### Network routing options: ###
|
||||
defaultrouter="NO" # Set to default gateway (or NO).
|
||||
static_routes="" # Set to static route list (or leave empty).
|
||||
gateway_enable="NO" # Set to YES if this host will be a gateway.
|
||||
router_enable="YES" # Set to YES to enable a routing daemon.
|
||||
router="routed" # Name of routing daemon to use if enabled.
|
||||
router_flags="-q" # Flags for routing daemon.
|
||||
mrouted_enable="NO" # Do multicast routing (see /etc/mrouted.conf)
|
||||
ipxgateway_enable="NO" # Set to YES to enable IPX routing.
|
||||
ipxrouted_enable="NO" # Set to YES to run the IPX routing daemon.
|
||||
ipxrouted_flags="" # Flags for IPX routing daemon.
|
||||
arpproxy_all="" # obsolete kernel option ARP_PROXY_ALL equiv.
|
||||
|
||||
|
||||
##############################################################
|
||||
### System console options #################################
|
||||
##############################################################
|
||||
|
||||
keymap="NO" # keymap in /usr/share/syscons/keymaps/* (or NO).
|
||||
keyrate="NO" # keyboard rate to: slow, normal, fast (or NO).
|
||||
keybell="NO" # bell to duration.pitch or normal or visual (or NO).
|
||||
keychange="NO" # function keys default values (or NO).
|
||||
cursor="NO" # cursor type {normal|blink|destructive} (or NO).
|
||||
scrnmap="NO" # screen map in /usr/share/syscons/scrnmaps/* (or NO).
|
||||
font8x16="NO" # font 8x16 from /usr/share/syscons/fonts/* (or NO).
|
||||
font8x14="NO" # font 8x14 from /usr/share/syscons/fonts/* (or NO).
|
||||
font8x8="NO" # font 8x8 from /usr/share/syscons/fonts/* (or NO).
|
||||
blanktime="NO" # blank time (in seconds) or "NO" to turn it off.
|
||||
saver="NO" # screen saver desired: blank/green/snake/star/NO.
|
||||
mousedtype="NO" # See man page for rc.conf(8) for available settings.
|
||||
mousedport="/dev/cuaa0" # Set to your mouse port (required if mousetype set)
|
||||
mousedflags="" # Any additional flags to moused.
|
||||
|
||||
|
||||
##############################################################
|
||||
### Miscellaneous administrative options ###################
|
||||
##############################################################
|
||||
|
||||
lpd_enable="YES" # Run the line printer daemon
|
||||
sendmail_enable="YES" # Run the sendmail daemon (or NO).
|
||||
sendmail_flags="-bd -q30m" # -bd is pretty mandatory
|
||||
savecore_enable="NO" # Save kernel crashdumps for debugging (or NO).
|
||||
dumpdev="NO" # Device name to crashdump to (if enabled).
|
||||
check_quotas="NO" # Check quotas (or NO).
|
||||
accounting="NO" # Turn on process accounting (or NO).
|
||||
ibcs2_enable="NO" # Ibcs2 (SCO) emulation loaded at startup (or NO).
|
||||
linux_enable="NO" # Linux emulation loaded at startup (or NO).
|
||||
rand_irqs="NO" # Stir the entropy pool (or NO).
|
||||
+12
-10
@@ -1,6 +1,6 @@
|
||||
############
|
||||
# Setup system for firewall service.
|
||||
# $Id: rc.firewall,v 1.5 1996/08/19 15:34:29 wosch Exp $
|
||||
# $Id: rc.firewall,v 1.6.2.1 1997/04/26 22:39:34 jkh Exp $
|
||||
|
||||
############
|
||||
#
|
||||
@@ -13,9 +13,6 @@
|
||||
# machine and ``simple'' will try to protect a whole network (entries should
|
||||
# be customized appropriately below). To let no one in, use NONE.
|
||||
|
||||
firewall_type=NONE
|
||||
|
||||
|
||||
############
|
||||
#
|
||||
# If you don't know enough about packet filtering, we suggest that you
|
||||
@@ -26,6 +23,7 @@ firewall_type=NONE
|
||||
#
|
||||
# O'Reilly & Associates, Inc
|
||||
# ISBN 1-56592-124-0
|
||||
# http://www.ora.com/
|
||||
#
|
||||
# For a more advanced treatment of Internet Security read:
|
||||
#
|
||||
@@ -35,6 +33,7 @@ firewall_type=NONE
|
||||
#
|
||||
# Addison-Wesley
|
||||
# ISBN 0-201-6337-4
|
||||
# http://www.awl.com/
|
||||
#
|
||||
|
||||
############
|
||||
@@ -55,11 +54,11 @@ firewall_type=NONE
|
||||
|
||||
|
||||
# Prototype setups.
|
||||
if [ "${firewall_type}" = "open" ]; then
|
||||
if [ "${firewall}" = "open" ]; then
|
||||
|
||||
/sbin/ipfw add 65000 pass all from any to any
|
||||
|
||||
elif [ "${firewall_type}" = "client" ]; then
|
||||
elif [ "${firewall}" = "client" ]; then
|
||||
|
||||
############
|
||||
# This is a prototype setup that will protect your system somewhat against
|
||||
@@ -95,9 +94,9 @@ elif [ "${firewall_type}" = "client" ]; then
|
||||
/sbin/ipfw add pass udp from any 123 to ${ip}
|
||||
/sbin/ipfw add pass udp from ${ip} to any 123
|
||||
|
||||
# Everyting else is denied as default.
|
||||
# Everything else is denied as default.
|
||||
|
||||
elif [ "${firewall_type}" = "simple" ]; then
|
||||
elif [ "${firewall}" = "simple" ]; then
|
||||
|
||||
############
|
||||
# This is a prototype setup for a simple firewall. Configure this machine
|
||||
@@ -152,6 +151,9 @@ elif [ "${firewall_type}" = "simple" ]; then
|
||||
/sbin/ipfw add pass udp from any 123 to ${oip}
|
||||
/sbin/ipfw add pass udp from ${oip} to any 123
|
||||
|
||||
# Everyting else is denied as default.
|
||||
fi
|
||||
# Everything else is denied as default.
|
||||
|
||||
elif [ "${firewall}" != "NONE" -a -r "${firewall}" ]; then
|
||||
|
||||
/sbin/ipfw ${firewall}
|
||||
fi
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# $Id: rc.network,v 1.1.2.6 1997/05/01 23:42:19 jkh Exp $
|
||||
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
|
||||
|
||||
# Note that almost all the user-configurable behavior is no longer in
|
||||
# this file, but rather in /etc/rc.conf. Please check that file
|
||||
# first before contemplating any changes here. If you do need to change
|
||||
# this file for some reason, we would like to know about it.
|
||||
|
||||
# First pass startup stuff.
|
||||
|
||||
network_pass1() {
|
||||
echo -n 'Doing initial network setup:'
|
||||
# Set the host name if it is not already set
|
||||
if [ -z "`hostname -s`" ] ; then
|
||||
hostname $hostname
|
||||
echo -n ' hostname'
|
||||
fi
|
||||
|
||||
# Set the domainname if we're using NIS
|
||||
if [ -n "$nisdomainname" -a "x$nisdomainname" != "xNO" ] ; then
|
||||
domainname $nisdomainname
|
||||
echo -n ' domain'
|
||||
fi
|
||||
echo '.'
|
||||
|
||||
# Set up all the network interfaces, calling startup scripts if needed
|
||||
for ifn in ${network_interfaces}; do
|
||||
if [ -e /etc/start_if.${ifn} ]; then
|
||||
. /etc/start_if.${ifn} ${ifn}
|
||||
fi
|
||||
# Do the primary ifconfig if specified
|
||||
eval ifconfig_args=\$ifconfig_${ifn}
|
||||
if [ -n "${ifconfig_args}" ] ; then
|
||||
ifconfig ${ifn} ${ifconfig_args}
|
||||
fi
|
||||
# Check to see if aliases need to be added
|
||||
alias=0
|
||||
while :
|
||||
do
|
||||
eval ifconfig_args=\$ifconfig_${ifn}_alias${alias}
|
||||
if [ -n "${ifconfig_args}" ]; then
|
||||
ifconfig ${ifn} ${ifconfig_args} alias
|
||||
alias=`expr ${alias} + 1`
|
||||
else
|
||||
break;
|
||||
fi
|
||||
done
|
||||
# Do ipx address if specified
|
||||
eval ifconfig_args=\$ifconfig_${ifn}_ipx
|
||||
if [ -n "${ifconfig_args}" ]; then
|
||||
ifconfig ${ifn} ${ifconfig_args}
|
||||
fi
|
||||
ifconfig ${ifn}
|
||||
done
|
||||
|
||||
# If IP filtering
|
||||
if [ -n "$firewall" -a "x$firewall" != "xNO" -a -f /etc/rc.firewall ] ; then
|
||||
echo -n ' firewall'
|
||||
. /etc/rc.firewall
|
||||
fi
|
||||
|
||||
if [ "x$defaultrouter" != "xNO" ] ; then
|
||||
static_routes="default ${static_routes}"
|
||||
route_default="default ${defaultrouter}"
|
||||
fi
|
||||
|
||||
# Set up any static routes. This should be done before router discovery.
|
||||
if [ "x${static_routes}" != "x" ]; then
|
||||
for i in ${static_routes}; do
|
||||
eval route_args=\$route_${i}
|
||||
route add ${route_args}
|
||||
done
|
||||
fi
|
||||
|
||||
echo -n 'Additional routing options:'
|
||||
if [ "X$gateway_enable" = X"YES" ]; then
|
||||
echo -n ' IP gateway=YES'
|
||||
sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X$router_enable" = X"YES" ]; then
|
||||
echo -n " ${router}"; ${router} ${router_flags}
|
||||
fi
|
||||
|
||||
if [ "X$ipxgateway_enable" = X"YES" ]; then
|
||||
echo -n ' IPX gateway=YES'
|
||||
sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X$ipxrouted_enable" = X"YES" ]; then
|
||||
echo -n ' IPXrouted: '
|
||||
IPXrouted ${ipxrouted_flags} > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X$arpproxy_all" = X"YES" ]; then
|
||||
echo -n ' enabling ARP_PROXY_ALL: '
|
||||
sysctl -w net.link.ether.inet.proxyall=1 2>&1
|
||||
fi
|
||||
echo '.'
|
||||
network_pass1_done=YES # Let future generations know we made it.
|
||||
}
|
||||
|
||||
network_pass2() {
|
||||
echo -n 'Doing additional network setup:'
|
||||
if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then
|
||||
echo -n ' tcp extensions=NO'
|
||||
sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1
|
||||
sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1
|
||||
fi
|
||||
if [ "X${named_enable}" = X"YES" ]; then
|
||||
echo -n ' named'; named ${named_flags}
|
||||
fi
|
||||
|
||||
if [ "X${ntpdate_enable}" = X"YES" -o "X${xntpd_enable}" = X"YES" ]; then
|
||||
if [ "X${ntpdate_enable}" = X"YES" ]; then
|
||||
echo -n ' ntpdate'; ntpdate ${ntpdate_flags} >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "X${xntpd_enable}" = X"YES" ]; then
|
||||
echo -n ' xntpd'; xntpd ${xntpd_flags}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "X${timed_enable}" = X"YES" ]; then
|
||||
echo -n ' timed'; timed ${timed_flags}
|
||||
fi
|
||||
|
||||
if [ "X${portmap_enable}" = X"YES" ]; then
|
||||
echo -n ' portmap'; portmap ${portmap_flags}
|
||||
fi
|
||||
|
||||
# Start ypserv if we're an NIS server.
|
||||
# Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
|
||||
if [ "X${nis_server_enable}" = X"YES" ]; then
|
||||
echo -n ' ypserv'; ypserv ${nis_server_flags}
|
||||
|
||||
if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then
|
||||
echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags}
|
||||
fi
|
||||
|
||||
if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then
|
||||
echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start ypbind if we're an NIS client
|
||||
if [ "X${nis_client_enable}" = X"YES" ]; then
|
||||
echo -n ' ypbind'; ypbind ${nis_client_flags}
|
||||
if [ "X${nis_ypset_enable}" = X"YES" ]; then
|
||||
echo -n ' ypset'; ypset ${nis_ypset_flags}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '.'
|
||||
network_pass2_done=YES
|
||||
}
|
||||
|
||||
network_pass3() {
|
||||
echo -n 'Starting final network daemons:'
|
||||
|
||||
if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then
|
||||
echo -n ' mountd'
|
||||
if [ "X${weak_mountd_authentication}" = X"YES" ]; then
|
||||
mountd_flags="-n"
|
||||
fi
|
||||
mountd ${mountd_flags}
|
||||
if [ "X${nfs_reserved_port_only}" = X"YES" ]; then
|
||||
echo -n ' nfsprivport=YES'
|
||||
sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1
|
||||
fi
|
||||
echo -n ' nfsd'; nfsd -u -t 4
|
||||
if [ "X$rpc_lockd_enable" = X"YES" ]; then
|
||||
echo -n ' rpc.lockd'; rpc.lockd
|
||||
fi
|
||||
if [ "X$rpc_statd_enable" = X"YES" ]; then
|
||||
echo -n ' rpc.statd'; rpc.statd
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "X${nfs_client_enable}" = X"YES" ]; then
|
||||
echo -n ' nfsiod'; nfsiod -n 4
|
||||
fi
|
||||
|
||||
if [ "X${amd_enable}" = X"YES" ]; then
|
||||
echo -n ' amd'
|
||||
amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ "X${rwhod_enable}" = X"YES" ]; then
|
||||
echo -n ' rwhod'; rwhod
|
||||
fi
|
||||
|
||||
# Kerberos runs ONLY on the Kerberos server machine
|
||||
if [ "X${kerberos_server_enable}" = X"YES" ]; then
|
||||
echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
|
||||
echo -n ' kadmind'; \
|
||||
(sleep 20; kadmind -n >/dev/null 2>&1 &) &
|
||||
fi
|
||||
|
||||
# IP multicast routing daemon
|
||||
if [ "X${mrouted_enable}" = X"YES" ]; then
|
||||
echo -n ' mrouted'; mrouted ${mrouted_flags}
|
||||
fi
|
||||
echo '.'
|
||||
network_pass3_done=YES
|
||||
}
|
||||
+4
-9
@@ -4,17 +4,12 @@
|
||||
# HOSOKAWA, Tatsumi <[email protected]>
|
||||
#
|
||||
|
||||
if [ "x$apm_enable" = "xYES" ] ; then
|
||||
echo "Enable APM BIOS."
|
||||
/usr/sbin/apmconf -e
|
||||
fi
|
||||
|
||||
if [ "x$pccard_enable" != "xNO" ] ; then
|
||||
if [ "X$pccard_enable" = X"YES" ] ; then
|
||||
if [ "x$pccard_mem" != "xDEFAULT" ] ; then
|
||||
/usr/sbin/pccardc pccardmem $pccard_mem
|
||||
pccardc pccardmem $pccard_mem
|
||||
else
|
||||
/usr/sbin/pccardc pccardmem 0xd0000
|
||||
pccardc pccardmem 0xd0000
|
||||
fi
|
||||
echo -n "Enable PC-card."
|
||||
/usr/sbin/pccardd 2>&1 > /var/log/pccardd.debug &
|
||||
pccardd 2>&1 > /var/log/pccardd.debug &
|
||||
fi
|
||||
@@ -25,7 +25,7 @@ nlockmgr 100021
|
||||
x25.inr 100022
|
||||
statmon 100023
|
||||
status 100024
|
||||
bootparam 100026
|
||||
bootparamd 100026 bootparam
|
||||
ypupdated 100028 ypupdate
|
||||
keyserv 100029 keyserver
|
||||
tfsd 100037
|
||||
|
||||
+4
-2
@@ -9,7 +9,7 @@
|
||||
# Kerberos services are for Kerberos v4, and are unofficial. Sites running
|
||||
# v5 should uncomment v5 entries and comment v4 entries.
|
||||
#
|
||||
# $Id: services,v 1.31 1997/02/23 09:20:53 peter Exp $
|
||||
# $Id: services,v 1.27.2.2 1997/03/10 22:28:46 pst Exp $
|
||||
# From: @(#)services 5.8 (Berkeley) 5/9/91
|
||||
#
|
||||
# WELL KNOWN PORT NUMBERS
|
||||
@@ -204,7 +204,7 @@ acr-nema 104/tcp #ACR-NEMA Digital Imag. & Comm. 300
|
||||
acr-nema 104/udp #ACR-NEMA Digital Imag. & Comm. 300
|
||||
csnet-ns 105/tcp cso-ns #Mailbox Name Nameserver
|
||||
csnet-ns 105/udp cso-ns #Mailbox Name Nameserver
|
||||
3com-tsmux 106/tcp
|
||||
pop3pw 106/tcp 3com-tsmux #Eudroa compatible PW changer
|
||||
3com-tsmux 106/udp
|
||||
rtelnet 107/tcp #Remote Telnet Service
|
||||
rtelnet 107/udp #Remote Telnet Service
|
||||
@@ -1675,6 +1675,8 @@ man 9535/udp
|
||||
sd 9876/tcp #Session Director
|
||||
sd 9876/udp #Session Director
|
||||
amanda 10080/udp #Dump server control
|
||||
amandaidx 10082/tcp #Amanda indexing
|
||||
amidxtape 10083/tcp #Amanda tape indexing
|
||||
isode-dua 17007/tcp
|
||||
isode-dua 17007/udp
|
||||
biimenu 18000/tcp #Beckman Instruments, Inc.
|
||||
|
||||
-322
@@ -1,322 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# This is sysconfig - a file full of useful variables that you can set
|
||||
# to change the default startup behavior of your system.
|
||||
#
|
||||
# $Id: sysconfig,v 1.52.2.2 1996/12/10 16:53:55 joerg Exp $
|
||||
|
||||
######################### Start Of Local Configuration Section ###########
|
||||
|
||||
# Location of local startup directories.
|
||||
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d"
|
||||
|
||||
######################### End Of Local Configuration Section #############
|
||||
|
||||
######################### Start Of Syscons Section #######################
|
||||
|
||||
# Choose keyboard map from /usr/share/syscons/keymaps/* or NO if default.
|
||||
keymap=NO
|
||||
|
||||
# Set keyboard rate to: slow, normal, fast or NO if default.
|
||||
keyrate=NO
|
||||
|
||||
# Change function keys default values (or no change if NO)
|
||||
# Syntax: "<funkey_number> <new_value> [<funkey_number> <new_value>]..."
|
||||
keychange=NO
|
||||
|
||||
# Desired cursor type {normal|blink|destructive}, NO if no change
|
||||
cursor=NO
|
||||
|
||||
# Choose screen map from /usr/share/syscons/scrnmaps/* (or NO for none)
|
||||
scrnmap=NO
|
||||
|
||||
# Choose font 8x16 from /usr/share/syscons/fonts/* (or NO for default)
|
||||
font8x16=NO
|
||||
|
||||
# Choose font 8x14 from /usr/share/syscons/fonts/* (or NO for default)
|
||||
font8x14=NO
|
||||
|
||||
# Choose font 8x8 from /usr/share/syscons/fonts/* (or NO for default)
|
||||
font8x8=NO
|
||||
|
||||
# Set blank time (in seconds) or "off" to turn it off (or NO for default)
|
||||
blanktime=NO
|
||||
|
||||
# Set to screen saver desired: blank, green, snake, star (or NO for none)
|
||||
saver=NO
|
||||
|
||||
# Set to
|
||||
# {microsoft|mousesystems|mmseries|logitech|busmouse|mouseman|ps/2|mmhittab}
|
||||
# to activate system mouse cursor support (or NO for none)
|
||||
# Use 'vidcontrol -m on' command to activate it on particular screen
|
||||
mousedtype=NO
|
||||
|
||||
############## Next block activated only if mousedtype != NO ################
|
||||
|
||||
# Set to your mouse port (required)
|
||||
# Use real device here, because /dev/mouse usually linked with /dev/sysmouse
|
||||
mousedport=/dev/cuaa0
|
||||
|
||||
# Moused options:
|
||||
# -s: 9600 baud mouse
|
||||
# -c: enable ChordMiddle
|
||||
# see moused usage info for complete options list
|
||||
mousedflags=""
|
||||
|
||||
######################### End of moused block ##############################
|
||||
|
||||
# General Russian setup for example:
|
||||
# (koi8-r keyboard with cp866 screen font mapped to koi8-r)
|
||||
#
|
||||
# keymap=ru.koi8-r
|
||||
# keyrate=fast
|
||||
# keychange="61 [K"
|
||||
# cursor=destructive
|
||||
# scrnmap=koi8-r2cp866
|
||||
# font8x16=cp866b-8x16
|
||||
# font8x14=cp866-8x14
|
||||
# font8x8=cp866-8x8
|
||||
# blanktime=600
|
||||
# saver=snake
|
||||
# mousedtype=mousesystems
|
||||
# mousedport=/dev/cuaa0
|
||||
# mousedflags=""
|
||||
|
||||
######################### End Of Syscons Section #######################
|
||||
|
||||
######################### Start Of Netconfig Section #######################
|
||||
|
||||
# Set to the name of your host - this is pretty important!
|
||||
hostname=myname.my.domain
|
||||
|
||||
# Set to the NIS domainname of your host, or NO if none
|
||||
defaultdomainname=NO
|
||||
|
||||
#
|
||||
# Some broken implementations can't handle the RFC 1323 and RFC 1644
|
||||
# TCP options. If TCP connections randomly hang, try disabling this,
|
||||
# and bug the vendor of the losing equipment.
|
||||
#
|
||||
tcp_extensions=YES
|
||||
|
||||
# If you're running PCNFSD or anything else which requires mountd to allow
|
||||
# non-root requests for NFS mounts, set this to YES.
|
||||
weak_mountd_authentication=NO
|
||||
|
||||
#
|
||||
# Set to the list of network devices on this host. You must have an
|
||||
# ifconfig_${network_interface} line for each interface listed here.
|
||||
# Extra addresses may be specified with sequentual _alias<N> lines. IPX
|
||||
# addresses may be specified with an ifconfig_${network_interface}_ipx
|
||||
# line.
|
||||
#
|
||||
# for example:
|
||||
#
|
||||
# network_interfaces="ed0 sl0 lo0"
|
||||
#
|
||||
# ifconfig_ed0="inet 10.0.0.1 netmask 0xffffff00"
|
||||
# ifconfig_sl0="inet 10.0.1.0 netmask 0xffffff00"
|
||||
# ifconfig_lo0="inet 127.0.0.1"
|
||||
# ifconfig_ed0_alias0="inet 10.0.2.1 netmask 0xffffff00"
|
||||
# ifconfig_ed0_alias1="inet 10.0.2.2 netmask 0xffffffff"
|
||||
# ifconfig_ed0_ipx="ipx 0x1234"
|
||||
#
|
||||
# Alternatively, /etc/start_if.${network_interface} is run if it exists.
|
||||
# This script can be used as an alternative to the ifconfig_<xxx> lines.
|
||||
#
|
||||
network_interfaces="lo0"
|
||||
|
||||
ifconfig_lo0="inet 127.0.0.1"
|
||||
|
||||
#
|
||||
# Set to the list of route add lines for this host. You must have a
|
||||
# route_${static_routes} line for each static route listed here (unless
|
||||
# static_routes is set to "" - do NOT use ``NO'' to denote a lack of static
|
||||
# routes!).
|
||||
#
|
||||
#static_routes="foo multicast"
|
||||
#route_foo="woofo woofo-gw"
|
||||
#route_multicast="224.0.0.0 -netmask 0xf0000000 -interface 10.0.0.1"
|
||||
static_routes=""
|
||||
|
||||
# Set to the host you'd like set as your default router, or NO for none.
|
||||
# This is the same as adding a ``default'' entry to static_routes.
|
||||
defaultrouter=NO
|
||||
|
||||
# This is the routing daemon you want to use. Possible options are
|
||||
# currently NO (for none), `routed' and `gated'. Also see `routerflags'
|
||||
# for startup flags.
|
||||
router=routed
|
||||
|
||||
# These are the flags you'd like to start the routing daemon with
|
||||
routerflags=-q
|
||||
|
||||
# mrouted flags, or NO if you don't want to start mrouted. Needs kernel
|
||||
# options enabled before it will work.
|
||||
mrouted=NO
|
||||
|
||||
# YES will switch routing on in the kernel. You need to switch this on
|
||||
# if this machine has to act as a IPX router. You need to build a
|
||||
# kernel with IPX support for this to work.
|
||||
ipxgateway=NO
|
||||
|
||||
# IPXrouted flags. NO if you don't want to start it. Do "man IPXrouted"
|
||||
# to get more information on the flags.
|
||||
ipxrouted=NO
|
||||
|
||||
# timed flags, or NO if you don't want to start the time daemon
|
||||
timedflags=NO
|
||||
|
||||
# xntpd flags, or NO if you don't want to start the xntpd daemon
|
||||
xntpdflags="NO"
|
||||
|
||||
# this is inoperative unless xntpd is enabled; NO to disable
|
||||
tickadjflags="-Aq"
|
||||
|
||||
# Set to the site you'd like to synchronize your clock from (gatekeeper.dec.com,
|
||||
# for example) or NO for no such site.
|
||||
ntpdate="NO"
|
||||
|
||||
# Set to YES if you want to run rwhod
|
||||
rwhod=NO
|
||||
|
||||
# Set to NO if don't want to run lpd
|
||||
lpd=YES
|
||||
|
||||
# Default sendmail flags. -bd is pretty mandatory, -q<n>m sets the queue scan
|
||||
# time in minutes. If set to NO, don't start sendmail at all.
|
||||
sendmail_flags="-bd -q30m"
|
||||
|
||||
# Set to appropriate flags if you want to use AMD. The commented-out entry
|
||||
# provides a reasonable default, using the sample amd.map config file from the
|
||||
# /usr/src/etc directory.
|
||||
amdflags="NO"
|
||||
#amdflags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"
|
||||
|
||||
# Set to YES if this machine will be an NFS client
|
||||
nfs_client=NO
|
||||
|
||||
# Set to YES if this machine will be an NFS server
|
||||
nfs_server=NO
|
||||
|
||||
# Set to appropriate flags if you want to start NIS for a client
|
||||
nis_clientflags="NO"
|
||||
|
||||
# Name of host to ypset to, if no YP server on this wire
|
||||
nis_ypsetflags="NO"
|
||||
|
||||
# Set to appropriate flags if you want to start NIS for a server
|
||||
nis_serverflags="NO"
|
||||
|
||||
# Set to appropriate flags for rpc.ypxfrd. This should only be
|
||||
# run on NIS master servers.
|
||||
ypxfrdflags="NO"
|
||||
|
||||
# Set to appropriate flags for rpc.yppasswdd. This should only be
|
||||
# run on NIS master servers.
|
||||
# Typical flags might be "-t /var/yp/master.passwd -s -f"
|
||||
yppasswddflags="NO"
|
||||
|
||||
# Set to appropriate flags for named, if you have a full-time
|
||||
# connection to the Internet.
|
||||
# For most hosts, flags should be "-b /etc/namedb/named.boot"
|
||||
namedflags="NO"
|
||||
|
||||
# Set to YES if you want to run the X-10 power controller daemon
|
||||
xtend=NO
|
||||
|
||||
# Set to the name of the device for kernel crashdumps, or `off' to
|
||||
# disable any statically configured dumpdev, or NO for no change.
|
||||
# The device should normally be one of the swap devices specified
|
||||
# in /etc/fstab.
|
||||
dumpdev=NO
|
||||
|
||||
# Set to YES if you want kernel crashdumps to be saved for debugging
|
||||
savecore=NO
|
||||
|
||||
# Set to an additional swapfile you'd like to have added to preallocated swap
|
||||
# space during system boot (or NO for none).
|
||||
swapfile=NO
|
||||
|
||||
# Set to YES if you want to run Kerberos authentication
|
||||
kerberos_server=NO
|
||||
|
||||
# If you want this host to be a gateway, set to YES.
|
||||
gateway=NO
|
||||
|
||||
# If you want this host to be a firewall or otherwise filter IP, set to YES.
|
||||
firewall=NO
|
||||
|
||||
# Set to YES if you wish to check quotas.
|
||||
check_quotas=NO
|
||||
|
||||
# Set to YES to turn on accounting.
|
||||
accounting=NO
|
||||
|
||||
######################### End Of Netconfig Section #######################
|
||||
|
||||
######################### Start Of PC-card Section #######################
|
||||
|
||||
# If you want to enable APM BIOS driver, set to YES
|
||||
# (The APM BIOS driver is not configured into GENERIC kernel b/c of bugs)
|
||||
apm_enable=NO
|
||||
|
||||
# If you want to use PC-card package, set to YES
|
||||
# (PC-card support is not configured in the GENERIC kernel)
|
||||
pccard_enable=NO
|
||||
|
||||
# If you want to specify the address of memory used by PCIC,
|
||||
# set this address (DEFAULT=0xd0000)
|
||||
pccard_mem=DEFAULT
|
||||
|
||||
# If you want to use Etnerent PCMCIA cards, specify the ifconfig portion
|
||||
# here. (card-specific flags like connector selection should be written in
|
||||
# the card-specific entry in /etc/pccard.conf). Set to DHCP if you want to
|
||||
# use a DHCP server to determine your IP address (not implemented).
|
||||
#
|
||||
# Set to NO if you don't want to configure your PC-CARD ethernet controller.
|
||||
#
|
||||
# for example:
|
||||
#
|
||||
# pccard_ifconfig="131.113.32.126 netmask 0xffffff00"
|
||||
# or
|
||||
# pccard_ifconfig="DHCP"
|
||||
#
|
||||
pccard_ifconfig=NO
|
||||
|
||||
######################### End Of PC-card Section #######################
|
||||
|
||||
######################### Start Of Misc Section #######################
|
||||
|
||||
# Set to YES if you want ibcs2 (SCO) emulation loaded at startup
|
||||
ibcs2=NO
|
||||
|
||||
# Set to YES if you want Linux a.out emulation loaded at startup
|
||||
linux=NO
|
||||
|
||||
# Set to a string representing the interrupts you are going to use
|
||||
# for generating entropy in the kernel (or NO to ignore).
|
||||
# If the machine is networked, the Ethernet card IRQ is good.
|
||||
# The IRQ on an intelligent hard disk controller is good.
|
||||
# The IRQ's on most sound devices are good.
|
||||
#
|
||||
# The following choices are BAD:
|
||||
# The IRQ's on COM-ports (SIO devices), the IRQ used by a "classic"
|
||||
# IDE disk or cdrom (Intelligent controllers seem to be OK), and
|
||||
# the IRQ on the system clock.
|
||||
#
|
||||
# Experiment with the rest. The best interrupts are the ones that
|
||||
# happen fairly irregularly, and never occur in very high-speed bursts.
|
||||
#
|
||||
# You'll have it right when you have a good supply of numbers from
|
||||
# /dev/random, and no problems on your system, like slowdowns,
|
||||
# Sluggish net/disk activity, perhaps even errors.
|
||||
|
||||
# For example - if you have a sound blaster on IRQ5, an ethernet card
|
||||
# on IRQ10 and a SCSI controller on IRQ11 (eg ADAPTEC 1542) you might
|
||||
# try this:
|
||||
#
|
||||
# rand_irqs="-s 5 -s 10 -s 11"
|
||||
|
||||
rand_irqs="NO"
|
||||
@@ -10,7 +10,4 @@ CLEANFILES+=setup data.c
|
||||
data.c: glorkz setup
|
||||
./setup ${.CURDIR}/glorkz > data.c
|
||||
|
||||
setup: setup.c hdr.h
|
||||
${CC} -o setup ${.CURDIR}/setup.c
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -156,7 +156,6 @@ int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters */
|
||||
|
||||
int demo,newloc,limit;
|
||||
|
||||
char *malloc();
|
||||
char *decr();
|
||||
unsigned long crc();
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int widt
|
||||
max_lines = getnlines(prompt);
|
||||
print_page(dialog, theight, width, prompt, startline, hscroll);
|
||||
print_perc(dialog, height-3, width-9, (float) (startline+theight)/max_lines);
|
||||
wmove(dialog, height-2, width/2-6);
|
||||
wmove(dialog, height-2, width/2-3);
|
||||
wrefresh(dialog);
|
||||
while ((key != ESC) && (key != '\n') && (key != '\r')) {
|
||||
key = wgetch(dialog);
|
||||
@@ -230,7 +230,7 @@ dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int widt
|
||||
}
|
||||
print_page(dialog, theight, width, prompt, startline, hscroll);
|
||||
print_perc(dialog, height-3, width-9, (float) (startline+theight)/max_lines);
|
||||
wmove(dialog, height-2, width/2-2);
|
||||
wmove(dialog, height-2, width/2-3);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.1 1996/10/04 08:43:37 peter Exp $
|
||||
|
||||
INFO = g++FAQ libg++ iostream
|
||||
INFOSECTION= "Gcc Documentation"
|
||||
INFOENTRY_g++FAQ= "* G++FAQ: (g++FAQ). The GNU G++ FAQ."
|
||||
|
||||
.PATH: ${.CURDIR}/../../../../contrib/libg++/libg++
|
||||
.PATH: ${.CURDIR}/../../../../contrib/libg++/libio
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.3 1996/10/20 09:28:03 markm Exp $
|
||||
#
|
||||
INFO = gmp
|
||||
INFOSECTION= "Programming & development tools."
|
||||
|
||||
GMPDIR= ${.CURDIR}/../../../../contrib/libgmp
|
||||
.PATH: ${GMPDIR}
|
||||
SRCDIR= ${.CURDIR}/../../../../contrib/libgmp
|
||||
|
||||
.include "../Makefile.inc"
|
||||
.include <bsd.info.mk>
|
||||
@@ -1,257 +0,0 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 1, February 1989
|
||||
|
||||
Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
The Free Software Foundation has exempted Bash from the requirement of
|
||||
Paragraph 2c of the General Public License. This is to say, there is
|
||||
no requirement for Bash to print a notice when it is started
|
||||
interactively in the usual way. We made this exception because users
|
||||
and standards expect shells not to print such messages. This
|
||||
exception applies to any program that serves as a shell and that is
|
||||
based primarily on Bash as opposed to other GNU software.
|
||||
|
||||
Preamble
|
||||
|
||||
The license agreements of most software companies try to keep users
|
||||
at the mercy of those companies. By contrast, our General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. The
|
||||
General Public License applies to the Free Software Foundation's
|
||||
software and to any other program whose authors commit to using it.
|
||||
You can use it for your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Specifically, the General Public License is designed to make
|
||||
sure that you have the freedom to give away or sell copies of free
|
||||
software, that you receive source code or can get it if you want it,
|
||||
that you can change the software or use pieces of it in new free
|
||||
programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of a such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must tell them their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any program or other work which
|
||||
contains a notice placed by the copyright holder saying it may be
|
||||
distributed under the terms of this General Public License. The
|
||||
"Program", below, refers to any such program or work, and a "work based
|
||||
on the Program" means either the Program or any work containing the
|
||||
Program or a portion of it, either verbatim or with modifications. Each
|
||||
licensee is addressed as "you".
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and
|
||||
disclaimer of warranty; keep intact all the notices that refer to this
|
||||
General Public License and to the absence of any warranty; and give any
|
||||
other recipients of the Program a copy of this General Public License
|
||||
along with the Program. You may charge a fee for the physical act of
|
||||
transferring a copy.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of
|
||||
it, and copy and distribute such modifications under the terms of Paragraph
|
||||
1 above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish, that
|
||||
in whole or in part contains the Program or any part thereof, either
|
||||
with or without modifications, to be licensed at no charge to all
|
||||
third parties under the terms of this General Public License (except
|
||||
that you may choose to grant warranty protection to some or all
|
||||
third parties, at your option).
|
||||
|
||||
c) If the modified program normally reads commands interactively when
|
||||
run, you must cause it, when started running for such interactive use
|
||||
in the simplest and most usual way, to print or display an
|
||||
announcement including an appropriate copyright notice and a notice
|
||||
that there is no warranty (or else, saying that you provide a
|
||||
warranty) and that users may redistribute the program under these
|
||||
conditions, and telling the user how to view a copy of this General
|
||||
Public License.
|
||||
|
||||
d) You may charge a fee for the physical act of transferring a
|
||||
copy, and you may at your option offer warranty protection in
|
||||
exchange for a fee.
|
||||
|
||||
Mere aggregation of another independent work with the Program (or its
|
||||
derivative) on a volume of a storage or distribution medium does not bring
|
||||
the other work under the scope of these terms.
|
||||
|
||||
3. You may copy and distribute the Program (or a portion or derivative of
|
||||
it, under Paragraph 2) in object code or executable form under the terms of
|
||||
Paragraphs 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three
|
||||
years, to give any third party free (except for a nominal charge
|
||||
for the cost of distribution) a complete machine-readable copy of the
|
||||
corresponding source code, to be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the
|
||||
corresponding source code may be obtained. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form alone.)
|
||||
|
||||
Source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable file, complete source code means
|
||||
all the source code for all modules it contains; but, as a special
|
||||
exception, it need not include source code for modules which are standard
|
||||
libraries that accompany the operating system on which the executable
|
||||
file runs, or for standard header files or definitions files that
|
||||
accompany that operating system.
|
||||
|
||||
4. You may not copy, modify, sublicense, distribute or transfer the
|
||||
Program except as expressly provided under this General Public License.
|
||||
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
|
||||
the Program is void, and will automatically terminate your rights to use
|
||||
the Program under this License. However, parties who have received
|
||||
copies, or rights to use copies, from you under this General Public
|
||||
License will not have their licenses terminated so long as such parties
|
||||
remain in full compliance.
|
||||
|
||||
5. By copying, distributing or modifying the Program (or any work based
|
||||
on the Program) you indicate your acceptance of this license to do so,
|
||||
and all its terms and conditions.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the original
|
||||
licensor to copy, distribute or modify the Program subject to these
|
||||
terms and conditions. You may not impose any further restrictions on the
|
||||
recipients' exercise of the rights granted herein.
|
||||
|
||||
7. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of the license which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
the license, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
8. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to humanity, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19xx name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the
|
||||
appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than `show w' and `show
|
||||
c'; they could even be mouse-clicks or menu items--whatever suits your
|
||||
program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
program `Gnomovision' (a program to direct compilers to make passes
|
||||
at assemblers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,403 +0,0 @@
|
||||
Tue Mar 23 14:36:51 1993 Brian Fox ([email protected])
|
||||
|
||||
* readline.c (rl_copy): Changed name to rl_copy_text.
|
||||
|
||||
Mon Mar 22 19:16:05 1993 Brian Fox ([email protected])
|
||||
|
||||
* dispose_cmd.c, several other files. Declare dispose_xxx () as
|
||||
"void".
|
||||
|
||||
* builtins/hashcom.h: Make declarations of hashed_filenames be
|
||||
"extern" to keep the SGI compiler happy.
|
||||
|
||||
* readline.c (rl_initialize_everything): Assign values to
|
||||
out_stream and in_stream immediately, since
|
||||
output_character_function () can be called before
|
||||
readline_internal () is called.
|
||||
|
||||
Tue Dec 8 09:30:56 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_init_terminal) Set PC from BC, not from *buffer.
|
||||
|
||||
Mon Nov 30 09:35:47 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (invoking_keyseqs_in_map, rl_parse_and_bind) Allow
|
||||
backslash to quote characters, such as backslash, double quote,
|
||||
and space. Backslash quotes all character indiscriminately.
|
||||
|
||||
* funmap.c (vi_keymap) Fix type in "vi-replace" declaration.
|
||||
|
||||
Fri Nov 20 10:55:05 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (init_terminal_io, rl_prep_terminal): FINALLY!
|
||||
Declare and use termcap variable `ospeed' when setting up terminal
|
||||
parameters.
|
||||
|
||||
Thu Oct 8 08:53:07 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* Makefile, this directory: Include (as links to the canonical
|
||||
sources), tilde.c, tilde.h, posixstat.h and xmalloc.c.
|
||||
|
||||
Tue Sep 29 13:07:21 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* readline.c (init_terminal_io) Don't set arrow keys if the key
|
||||
sequences that represent them are already set.
|
||||
|
||||
* readline.c (rl_function_of_keyseq) New function returns the first
|
||||
function (or macro) found while searching a key sequence.
|
||||
|
||||
Mon Sep 28 00:34:04 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* readline.c (LibraryVersion) New static char * contains current
|
||||
version number. Version is at 2.0.
|
||||
|
||||
* readline.c (rl_complete_internal): Incorporated clean changes
|
||||
from gilmore ([email protected]) to support quoted substrings within
|
||||
completion functions.
|
||||
|
||||
* readline.c (many locations) Added support for the _GO32_,
|
||||
whatever that is. Patches supplied by Cygnus, typed in by hand,
|
||||
with cleanups.
|
||||
|
||||
Sun Aug 16 12:46:24 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (init_terminal_io): Find out the values of the keypad
|
||||
arrows and bind them to appropriate RL functions if present.
|
||||
|
||||
Mon Aug 10 18:13:24 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c (stifle_history): A negative argument to stifle
|
||||
becomes zero.
|
||||
|
||||
Tue Jul 28 09:28:41 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_variable_bind): New local structure describes
|
||||
booleans by name and address; code in rl_variable_bind () looks at
|
||||
structure to set simple variables.
|
||||
|
||||
* parens.c (rl_insert_close): New variable rl_blink_matching_paren
|
||||
is non-zero if we want to blink the matching open when a close is
|
||||
inserted. If FD_SET is defined, rl_blink_matching_paren defaults
|
||||
to 1, else 0. If FD_SET is not defined, and
|
||||
rl_blink_matching_paren is non-zero, the close character(s) are/is
|
||||
simply inserted.
|
||||
|
||||
Wed Jul 22 20:03:59 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c, readline.c, vi_mode.c: Cause the functions strchr ()
|
||||
and strrchr () to be used instead of index () and rindex ()
|
||||
throughout the source.
|
||||
|
||||
Mon Jul 13 11:34:07 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (rl_variable_bind) New variable "meta-flag" if "on"
|
||||
means force the use of the 8th bit as Meta bit. Internal variable
|
||||
is called meta_flag.
|
||||
|
||||
Thu Jul 9 10:37:56 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c (get_history_event) Change INDEX to LOCAL_INDEX. If
|
||||
compiling for the shell, allow shell metacharacters to separate
|
||||
history tokens as they would for shell tokens.
|
||||
|
||||
Sat Jul 4 19:29:12 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* vi_keymap.c: According to Posix, TAB self-inserts instead of
|
||||
doing completion.
|
||||
|
||||
* vi_mode.c: (rl_vi_yank_arg) Enter VI insert mode after yanking
|
||||
an arg from the previous line.
|
||||
|
||||
* search.c: New file takes over vi style searching and implements
|
||||
non-incremental searching the history.
|
||||
|
||||
Makefile: Add search.c and search.o.
|
||||
|
||||
funmap.c: Add names for non-incremental-forward-search-history and
|
||||
non-incremental-reverse-search-history.
|
||||
|
||||
readline.h: Add extern definitions for non-incremental searching.
|
||||
|
||||
vi_mode.c: Remove old search code; add calls to code in search.c.
|
||||
|
||||
Fri Jul 3 10:36:33 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_delete_horizontal_space); New function deletes
|
||||
all whitespace surrounding point.
|
||||
|
||||
funmap.c: Add "delete-horizontal-space".
|
||||
emacs_keymap.c: Put rl_delete_horizontal_space () on M-\.
|
||||
|
||||
* readline.c (rl_set_signals, rl_clear_signals); New function
|
||||
rl_set_sighandler () is either defined in a Posix way (if
|
||||
HAVE_POSIX_SIGNALS is defined) or in a BSD way. Function is
|
||||
called from rl_set_signals () and rl_clear_signals ().
|
||||
|
||||
Fri May 8 12:50:15 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (readline_default_bindings) Do comparisons with
|
||||
_POSIX_VDISABLE casted to `unsigned char'. Change tty characters
|
||||
to be unsigned char.
|
||||
|
||||
Thu Apr 30 12:36:35 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (rl_getc) Handle "read would block" error on
|
||||
non-blocking IO streams.
|
||||
|
||||
* readline.c: (rl_signal_handler): Unblock only the signal that we
|
||||
have caught, not all signals.
|
||||
|
||||
Sun Feb 23 03:33:09 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: Many functions. Use only the macros META_CHAR and
|
||||
UNMETA to deal with meta characters. Prior to this, we used
|
||||
numeric values and tests.
|
||||
|
||||
* readline.c (rl_complete_internal) Report exactly the number of
|
||||
possible completions, not the number + 1.
|
||||
|
||||
* vi_mode.c (rl_do_move) Do not change the cursor position when
|
||||
using `cw' or `cW'.
|
||||
|
||||
* vi_mode.c (rl_vi_complete) Enter insert mode after completing
|
||||
with `*' or `\'.
|
||||
|
||||
Fri Feb 21 05:58:18 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_dispatch) Increment rl_key_sequence_length for
|
||||
meta characters that map onto ESC map.
|
||||
|
||||
Mon Feb 10 01:41:35 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* history.c (history_do_write) Build a buffer of all of the lines
|
||||
to write and write them in one fell swoop (lower overhead than
|
||||
calling write () for each line). Suggested by Peter Ho.
|
||||
|
||||
* readline.c: Include hbullx20 as well as hpux for determining
|
||||
USGr3ness.
|
||||
|
||||
* readline.c (rl_unix_word_rubout) As per the "Now REMEMBER"
|
||||
comment, pass arguments to rl_kill_text () in the correct order to
|
||||
preserve prepending and appending of killed text.
|
||||
|
||||
* readline.c (rl_search_history) malloc (), realloc (), and free
|
||||
() SEARCH_STRING so that there are no static limits on searching.
|
||||
|
||||
* vi_mode.c (rl_vi_subst) Don't forget to end the undo group.
|
||||
|
||||
Fri Jan 31 14:51:02 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_signal_handler): Zero the current history entry's
|
||||
pointer after freeing the undo_list when SIGINT received.
|
||||
Reformat a couple of functions.
|
||||
|
||||
Sat Jan 25 13:47:35 1992 Brian Fox (bfox at bears)
|
||||
|
||||
* readline.c (parser_if): free () TNAME after use.
|
||||
|
||||
Tue Jan 21 01:01:35 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_redisplay) and (rl_character_len): Display
|
||||
Control characters as "^c" and Meta characters as "\234", instead
|
||||
of "C-C" and "M-C".
|
||||
|
||||
Sun Dec 29 10:59:00 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (init_terminal_io) Default to environment variables
|
||||
LINES and COLUMNS before termcap entry values. If all else fails,
|
||||
then assume 80x24 terminal.
|
||||
|
||||
Sat Dec 28 16:33:11 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: If this machine is USG and it is hpux, then define
|
||||
USGr3.
|
||||
|
||||
* history.c: Cosmetic fixes.
|
||||
|
||||
Thu Nov 21 00:10:12 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* vi_mode.c: (rl_do_move) Place cursor at end of line, never at
|
||||
next to last character.
|
||||
|
||||
Thu Nov 14 05:08:01 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* history.c (get_history_event) Non-anchored searches can have a
|
||||
return index of greater than zero from get_history_event ().
|
||||
|
||||
Fri Nov 1 07:02:13 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_translate_keyseq) Make C-? translate to RUBOUT
|
||||
unconditionally.
|
||||
|
||||
Mon Oct 28 11:34:52 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c; Use Posix directory routines and macros.
|
||||
|
||||
* funmap.c; Add entry for call-last-kbd-macro.
|
||||
|
||||
* readline.c (rl_prep_term); Use system EOF character on POSIX
|
||||
systems also.
|
||||
|
||||
Thu Oct 3 16:19:53 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c; Make a distinction between having a TERMIOS tty
|
||||
driver, and having POSIX signal handling. You might one without
|
||||
the other. New defines used HAVE_POSIX_SIGNALS, and
|
||||
TERMIOS_TTY_DRIVER.
|
||||
|
||||
Tue Jul 30 22:37:26 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_getc () If a call to read () returns without an
|
||||
error, but with zero characters, the file is empty, so return EOF.
|
||||
|
||||
Thu Jul 11 20:58:38 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: (rl_get_next_history, rl_get_previous_history)
|
||||
Reallocate the buffer space if the line being moved to is longer
|
||||
the the current space allocated. Amazing that no one has found
|
||||
this bug until now.
|
||||
|
||||
Sun Jul 7 02:37:05 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c:(rl_parse_and_bind) Allow leading whitespace.
|
||||
Make sure TERMIO and TERMIOS systems treat CR and NL
|
||||
disctinctly.
|
||||
|
||||
Tue Jun 25 04:09:27 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: Rework parsing conditionals to pay attention to the
|
||||
prior states of the conditional stack. This makes $if statements
|
||||
work correctly.
|
||||
|
||||
Mon Jun 24 20:45:59 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: support for displaying key binding information
|
||||
includes the functions rl_list_funmap_names (),
|
||||
invoking_keyseqs_in_map (), rl_invoking_keyseqs (),
|
||||
rl_dump_functions (), and rl_function_dumper ().
|
||||
|
||||
funmap.c: support for same includes rl_funmap_names ().
|
||||
|
||||
readline.c, funmap.c: no longer define STATIC_MALLOC. However,
|
||||
update both version of xrealloc () to handle a null pointer.
|
||||
|
||||
Thu Apr 25 12:03:49 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* vi_mode.c (rl_vi_fword, fWord, etc. All functions use
|
||||
the macro `isident()'. Fixed movement bug which prevents
|
||||
continious movement through the text.
|
||||
|
||||
Fri Jul 27 16:47:01 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (parser_if) Allow "$if term=foo" construct.
|
||||
|
||||
Wed May 23 16:10:33 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_dispatch) Correctly remember the last command
|
||||
executed. Fixed typo in username_completion_function ().
|
||||
|
||||
Mon Apr 9 19:55:48 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: username_completion_function (); For text passed in
|
||||
with a leading `~', remember that this could be a filename (after
|
||||
it is completed).
|
||||
|
||||
Thu Apr 5 13:44:24 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_search_history (): Correctly handle case of an
|
||||
unfound search string, but a graceful exit (as with ESC).
|
||||
|
||||
* readline.c: rl_restart_output (); The Apollo passes the address
|
||||
of the file descriptor to TIOCSTART, not the descriptor itself.
|
||||
|
||||
Tue Mar 20 05:38:55 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_complete (); second call in a row causes possible
|
||||
completions to be listed.
|
||||
|
||||
* readline.c: rl_redisplay (), added prompt_this_line variable
|
||||
which is the first character character following \n in prompt.
|
||||
|
||||
Sun Mar 11 04:32:03 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* Signals are now supposedly handled inside of SYSV compilation.
|
||||
|
||||
Wed Jan 17 19:24:09 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* history.c: history_expand (); fixed overwriting memory error,
|
||||
added needed argument to call to get_history_event ().
|
||||
|
||||
Thu Jan 11 10:54:04 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* readline.c: added mark_modified_lines to control the
|
||||
display of an asterisk on modified history lines. Also
|
||||
added a user variable called mark-modified-lines to the
|
||||
`set' command.
|
||||
|
||||
Thu Jan 4 10:38:05 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* readline.c: start_insert (). Only use IC if we don't have an im
|
||||
capability.
|
||||
|
||||
Fri Sep 8 09:00:45 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: rl_prep_terminal (). Only turn on 8th bit
|
||||
as meta-bit iff the terminal is not using parity.
|
||||
|
||||
Sun Sep 3 08:57:40 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: start_insert (). Uses multiple
|
||||
insertion call in cases where that makes sense.
|
||||
|
||||
rl_insert (). Read type-ahead buffer for additional
|
||||
keys that are bound to rl_insert, and insert them
|
||||
all at once. Make insertion of single keys given
|
||||
with an argument much more efficient.
|
||||
|
||||
Tue Aug 8 18:13:57 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: Changed handling of EOF. readline () returns
|
||||
(char *)EOF or consed string. The EOF character is read from the
|
||||
tty, or if the tty doesn't have one, defaults to C-d.
|
||||
|
||||
* readline.c: Added support for event driven programs.
|
||||
rl_event_hook is the address of a function you want called
|
||||
while Readline is waiting for input.
|
||||
|
||||
* readline.c: Cleanup time. Functions without type declarations
|
||||
do not use return with a value.
|
||||
|
||||
* history.c: history_expand () has new variable which is the
|
||||
characters to ignore immediately following history_expansion_char.
|
||||
|
||||
Sun Jul 16 08:14:00 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* rl_prep_terminal ()
|
||||
BSD version turns off C-s, C-q, C-y, C-v.
|
||||
|
||||
* readline.c -- rl_prep_terminal ()
|
||||
SYSV version hacks readline_echoing_p.
|
||||
BSD version turns on passing of the 8th bit for the duration
|
||||
of reading the line.
|
||||
|
||||
Tue Jul 11 06:25:01 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: new variable rl_tilde_expander.
|
||||
If non-null, this contains the address of a function to call if
|
||||
the standard meaning for expanding a tilde fails. The function is
|
||||
called with the text sans tilde (as in "foo"), and returns a
|
||||
malloc()'ed string which is the expansion, or a NULL pointer if
|
||||
there is no expansion.
|
||||
|
||||
* readline.h - new file chardefs.h
|
||||
Separates things that only readline.c needs from the standard
|
||||
header file publishing interesting things about readline.
|
||||
|
||||
* readline.c:
|
||||
readline_default_bindings () now looks at terminal chararacters
|
||||
and binds those as well.
|
||||
|
||||
Wed Jun 28 20:20:51 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* Made readline and history into independent libraries.
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
# $Id: Makefile,v 1.22 1996/08/30 02:13:06 peter Exp $
|
||||
# $Id: Makefile,v 1.23 1996/08/30 18:33:31 ache Exp $
|
||||
|
||||
SRCDIR= ${.CURDIR}/../../../contrib/libreadline
|
||||
.PATH: ${SRCDIR}
|
||||
|
||||
CFLAGS+= -I${.CURDIR} -DVOID_SIGHANDLER -DHAVE_CONFIG_H \
|
||||
-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1
|
||||
SUBDIR= doc
|
||||
|
||||
LIB= readline
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 0
|
||||
SRCS+= readline.c funmap.c keymaps.c vi_mode.c parens.c \
|
||||
rltty.c complete.c bind.c isearch.c display.c signals.c \
|
||||
history.c search.c tilde.c xmalloc.c
|
||||
HEADERS= history.h readline.h keymaps.h chardefs.h tilde.h
|
||||
MAN3= readline.3
|
||||
|
||||
CFLAGS+= -I${.CURDIR} -I${SRCDIR} -DHAVE_CONFIG_H
|
||||
|
||||
HISTSRC= history.c histexpand.c histfile.c histsearch.c
|
||||
TILDESRC= tilde.c
|
||||
SRCS= readline.c vi_mode.c funmap.c keymaps.c parens.c search.c \
|
||||
rltty.c complete.c bind.c isearch.c display.c signals.c \
|
||||
util.c kill.c undo.c macro.c input.c callback.c terminal.c \
|
||||
nls.c xmalloc.c \
|
||||
$(HISTSRC) $(TILDESRC)
|
||||
|
||||
INSTALLED_HEADERS= readline.h chardefs.h keymaps.h history.h tilde.h
|
||||
|
||||
DPADD+= $(LIBTERMCAP)
|
||||
LDADD+= -ltermcap
|
||||
|
||||
SUBDIR+= doc
|
||||
|
||||
beforeinstall:
|
||||
.for i in ${HEADERS}
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/$i \
|
||||
.for i in ${INSTALLED_HEADERS}
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${SRCDIR}/$i \
|
||||
${DESTDIR}/usr/include/readline
|
||||
.endfor
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
This is the distribution of the Gnu Readline library. See the file
|
||||
STANDALONE for a description of the #defines that can be passed via
|
||||
the makefile to build readline on different systems.
|
||||
|
||||
The file rlconf.h contains defines that enable and disable certain
|
||||
readline features.
|
||||
Loaded 100 of 753 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user