home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.sysv386:12486 biz.sco.general:2711
- Newsgroups: comp.unix.sysv386,biz.sco.general
- Path: sparky!uunet!kithrup!sef
- From: sef@kithrup.COM (Sean Eric Fagan)
- Subject: diffs to net/2 finger for SCO 3.2v2
- Organization: Kithrup Enterprises, Ltd.
- Date: Mon, 27 Jul 1992 11:13:31 GMT
- Message-ID: <1992Jul27.111331.1556@kithrup.COM>
- Sender: sef@kithrup.COM (Sean Eric Fagan)
- Lines: 482
-
- Here are the diffs necessary to make the Net/2 finger compile and,
- apparantly, run under SCO UNIX 3.2v2. As with the fingerd changes, they
- have not been tested extensively, just enough to make sure it works. If you
- run it on a 3.2v4 system, for example, I would worry about symlinks!
-
- Note that, while it doesn't give very useful information about last login
- times, neither does the native version, although I'm tryinig to figure out
- a way to change that.
-
- As with the previous set of diffs, use at your own discretion. If you find
- some bugs, please let me know, but I may not be able to fix them in time to
- make you happy. Also, any bugs with something other than what is changed
- with the set of patches should go to berkeley people, not me 8-).
-
- Share and enjoy!
-
- -- snip snip --
- *** finger/Makefile.~1~ Mon Jul 27 00:48:37 1992
- --- finger/Makefile Mon Jul 27 03:52:53 1992
- ***************
- *** 1,6 ****
- # @(#)Makefile 5.3 (Berkeley) 5/11/90
-
- PROG= finger
- ! SRCS= finger.c lprint.c net.c sprint.c util.c
-
- ! .include <bsd.prog.mk>
- --- 1,13 ----
- # @(#)Makefile 5.3 (Berkeley) 5/11/90
-
- PROG= finger
- ! SRCS= finger.c lprint.c net.c sprint.c util.c strsep.c
- ! CC= gcc
- ! CFLAGS= -g -O -I.
- ! LIBS= -lsocket
- ! OBJS= finger.o lprint.o net.o sprint.o util.o strsep.o
-
- ! all: $(PROG)
- !
- ! $(PROG): $(OBJS)
- ! $(CC) $(CFLAGS) $(OBJS) -o $(PROG) $(LIBS)
- *** finger/finger.c.~1~ Mon Jul 27 00:48:40 1992
- --- finger/finger.c Mon Jul 27 03:52:42 1992
- ***************
- *** 57,64 ****
- * mail info, and .plan/.project files.
- */
-
- #include <sys/param.h>
- ! #include <sys/file.h>
- #include <stdio.h>
- #include "finger.h"
-
- --- 57,65 ----
- * mail info, and .plan/.project files.
- */
-
- + #include <sys/types.h>
- #include <sys/param.h>
- ! #include <fcntl.h>
- #include <stdio.h>
- #include "finger.h"
-
- ***************
- *** 98,104 ****
- argv += optind;
-
- (void)time(&now);
- ! setpassent(1);
- if (!*argv) {
- /*
- * Assign explicit "small" format if no names given and -l
- --- 99,105 ----
- argv += optind;
-
- (void)time(&now);
- ! /* setpassent(1); */ /* what is setpassent?! */
- if (!*argv) {
- /*
- * Assign explicit "small" format if no names given and -l
- *** finger/finger.h.~1~ Mon Jul 27 00:48:42 1992
- --- finger/finger.h Mon Jul 27 03:49:38 1992
- ***************
- *** 39,44 ****
- --- 39,48 ----
- #include <pwd.h>
- #include <utmp.h>
-
- + #ifndef _PATH_UTMP
- + # define _PATH_UTMP "/etc/utmp"
- + #endif
- +
- /*
- * All unique persons are linked in a list headed by "head" and linkd
- * by the "next" field, as well as kept in a hash table.
- ***************
- *** 60,65 ****
- --- 64,77 ----
-
- enum status { LASTLOG, LOGGEDIN };
-
- + #ifndef UT_LINESIZE
- + # define UT_LINESIZE 12
- + #endif
- +
- + #ifndef UT_NAMESIZE
- + # define UT_NAMESIZE 8
- + #endif
- +
- typedef struct where {
- struct where *next; /* next place he is or has been */
- enum status info; /* type/status of request */
- ***************
- *** 67,73 ****
- --- 79,87 ----
- time_t loginat; /* time of (last) login */
- time_t idletime; /* how long idle (if logged in) */
- char tty[UT_LINESIZE+1]; /* null terminated tty line */
- + #ifdef UT_HOSTSIZE
- char host[UT_HOSTSIZE+1]; /* null terminated remote host name */
- + #endif
- } WHERE;
-
- #define HBITS 8 /* number of bits in hash code */
- ***************
- *** 83,85 ****
- --- 97,107 ----
- WHERE *walloc();
-
- extern char tbuf[1024]; /* temp buffer for anybody */
- +
- + #ifndef HAVE_LASTLOG
- + struct lastlog {
- + time_t ll_time;
- + char ll_line[8];
- + char ll_host[16];
- + };
- + #endif /* !HAVE_LASTLOG */
- *** finger/lprint.c.~1~ Mon Jul 27 00:48:44 1992
- --- finger/lprint.c Mon Jul 27 01:03:22 1992
- ***************
- *** 39,51 ****
- #endif /* not lint */
-
- #include <sys/types.h>
- ! #include <sys/file.h>
- #include <sys/stat.h>
- ! #include <sys/time.h>
- ! #include <tzfile.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <paths.h>
- #include "finger.h"
-
- #define LINE_LEN 80
- --- 39,51 ----
- #endif /* not lint */
-
- #include <sys/types.h>
- ! #include <fcntl.h>
- #include <sys/stat.h>
- ! #include <time.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <paths.h>
- + #include <tzfile.h>
- #include "finger.h"
-
- #define LINE_LEN 80
- ***************
- *** 146,152 ****
- case LOGGEDIN:
- tp = localtime(&w->loginat);
- t = asctime(tp);
- ! tzn = tp->tm_zone;
- cpr = printf("On since %.16s (%s) on %s",
- t, tzn, w->tty);
- /*
- --- 146,152 ----
- case LOGGEDIN:
- tp = localtime(&w->loginat);
- t = asctime(tp);
- ! tzn = tp->tm_name;
- cpr = printf("On since %.16s (%s) on %s",
- t, tzn, w->tty);
- /*
- ***************
- *** 165,174 ****
- --- 165,176 ----
- }
- cpr += printf("%d:%02d",
- delta->tm_hour, delta->tm_min);
- + #ifdef UT_HOSTSIZE
- if (*w->host) {
- putchar(',');
- ++cpr;
- }
- + #endif
- }
- if (!w->writable)
- cpr += printf(" (messages off)");
- ***************
- *** 180,186 ****
- }
- tp = localtime(&w->loginat);
- t = asctime(tp);
- ! tzn = tp->tm_zone;
- if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
- cpr =
- printf("Last login %.16s %.4s (%s) on %s",
- --- 182,188 ----
- }
- tp = localtime(&w->loginat);
- t = asctime(tp);
- ! tzn = tp->tm_name;
- if (now - w->loginat > SECSPERDAY * DAYSPERNYEAR / 2)
- cpr =
- printf("Last login %.16s %.4s (%s) on %s",
- ***************
- *** 190,200 ****
- --- 192,204 ----
- t, tzn, w->tty);
- break;
- }
- + #ifdef UT_HOSTSIZE
- if (*w->host) {
- if (LINE_LEN < (cpr + 6 + strlen(w->host)))
- (void)printf("\n ");
- (void)printf(" from %s", w->host);
- }
- + #endif
- putchar('\n');
- }
- }
- *** finger/paths.h.~1~ Mon Jul 27 04:04:41 1992
- --- finger/paths.h Mon Jul 27 03:44:24 1992
- ***************
- *** 0 ****
- --- 1,8 ----
- + #ifndef _PATHS_H
- + # define _PATHS_H
- +
- + # define _PATH_BSHELL "/bin/sh"
- + # define _PATH_DEV "/dev/"
- + # define _PATH_LASTLOG "/etc/lastlog"
- +
- + #endif
- *** finger/sprint.c.~1~ Mon Jul 27 00:48:47 1992
- --- finger/sprint.c Mon Jul 27 01:58:32 1992
- ***************
- *** 39,45 ****
- #endif /* not lint */
-
- #include <sys/types.h>
- ! #include <sys/time.h>
- #include <tzfile.h>
- #include <stdio.h>
- #include "finger.h"
- --- 39,45 ----
- #endif /* not lint */
-
- #include <sys/types.h>
- ! #include <time.h>
- #include <tzfile.h>
- #include <stdio.h>
- #include "finger.h"
- *** finger/strsep.c.~1~ Mon Jul 27 04:05:01 1992
- --- finger/strsep.c Mon Jul 27 03:53:30 1992
- ***************
- *** 0 ****
- --- 1,79 ----
- + /*-
- + * Copyright (c) 1990 The Regents of the University of California.
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. All advertising materials mentioning features or use of this software
- + * must display the following acknowledgement:
- + * This product includes software developed by the University of
- + * California, Berkeley and its contributors.
- + * 4. Neither the name of the University nor the names of its contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- + #include <string.h>
- + #include <stdio.h>
- +
- + #if defined(LIBC_SCCS) && !defined(lint)
- + static const char sccsid[] = "@(#)strsep.c 5.4 (Berkeley) 1/26/91";
- + #endif /* LIBC_SCCS and not lint */
- +
- + /*
- + * Get next token from string *stringp, where tokens are nonempty
- + * strings separated by characters from delim.
- + *
- + * Writes NULs into the string at *stringp to end tokens.
- + * delim need not remain constant from call to call.
- + * On return, *stringp points past the last NUL written (if there might
- + * be further tokens), or is NULL (if there are definitely no more tokens).
- + *
- + * If *stringp is NULL, strtoken returns NULL.
- + */
- + char *
- + strsep(stringp, delim)
- + register char **stringp;
- + register const char *delim;
- + {
- + register char *s;
- + register const char *spanp;
- + register int c, sc;
- + char *tok;
- +
- + if ((s = *stringp) == NULL)
- + return (NULL);
- + for (tok = s;;) {
- + c = *s++;
- + spanp = delim;
- + do {
- + if ((sc = *spanp++) == c) {
- + if (c == 0)
- + s = NULL;
- + else
- + s[-1] = 0;
- + *stringp = s;
- + return (tok);
- + }
- + } while (sc != 0);
- + }
- + /* NOTREACHED */
- + }
- *** finger/tzfile.h.~1~ Mon Jul 27 04:05:24 1992
- --- finger/tzfile.h Mon Jul 27 00:58:38 1992
- ***************
- *** 0 ****
- --- 1,54 ----
- + /*
- + * Copyright (c) 1988 Regents of the University of California.
- + * All rights reserved.
- + *
- + * This code is derived from software contributed to Berkeley by
- + * Arthur David Olson of the National Cancer Institute.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. All advertising materials mentioning features or use of this software
- + * must display the following acknowledgement:
- + * This product includes software developed by the University of
- + * California, Berkeley and its contributors.
- + * 4. Neither the name of the University nor the names of its contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + *
- + * @(#)tzfile.h 5.10 (Berkeley) 4/3/91
- + */
- +
- + #ifndef _TZFILE_H_
- + #define _TZFILE_H_
- +
- + #define SECSPERMIN 60
- + #define MINSPERHOUR 60
- + #define HOURSPERDAY 24
- + #define DAYSPERWEEK 7
- + #define DAYSPERNYEAR 365
- + #define DAYSPERLYEAR 366
- + #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
- + #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
- + #define MONSPERYEAR 12
- +
- + #define TM_SUNDAY 0
- +
- + #endif /* !_TZFILE_H_ */
- *** finger/util.c.~1~ Mon Jul 27 00:48:48 1992
- --- finger/util.c Mon Jul 27 03:49:42 1992
- ***************
- *** 38,46 ****
- static char sccsid[] = "@(#)util.c 5.14 (Berkeley) 1/17/91";
- #endif /* not lint */
-
- #include <sys/param.h>
- #include <sys/stat.h>
- ! #include <sys/file.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- --- 38,48 ----
- static char sccsid[] = "@(#)util.c 5.14 (Berkeley) 1/17/91";
- #endif /* not lint */
-
- + #include <unistd.h>
- + #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/stat.h>
- ! #include <fcntl.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- ***************
- *** 150,156 ****
- opened = 1;
- }
- if (fd == -1 ||
- ! lseek(fd, (long)pn->uid * sizeof(ll), L_SET) !=
- (long)pn->uid * sizeof(ll) ||
- read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
- /* as if never logged in */
- --- 152,158 ----
- opened = 1;
- }
- if (fd == -1 ||
- ! lseek(fd, (long)pn->uid * sizeof(ll), SEEK_SET) !=
- (long)pn->uid * sizeof(ll) ||
- read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
- /* as if never logged in */
- ***************
- *** 179,186 ****
- --- 181,190 ----
- w->info = LASTLOG;
- bcopy(ll.ll_line, w->tty, UT_LINESIZE);
- w->tty[UT_LINESIZE] = 0;
- + #ifdef UT_HOSTSIZE
- bcopy(ll.ll_host, w->host, UT_HOSTSIZE);
- w->host[UT_HOSTSIZE] = 0;
- + #endif
- w->loginat = ll.ll_time;
- }
- }
- ***************
- *** 194,201 ****
- --- 198,207 ----
- w->info = LOGGEDIN;
- bcopy(ut->ut_line, w->tty, UT_LINESIZE);
- w->tty[UT_LINESIZE] = 0;
- + #ifdef UT_HOSTSIZE
- bcopy(ut->ut_host, w->host, UT_HOSTSIZE);
- w->host[UT_HOSTSIZE] = 0;
- + #endif
- w->loginat = (time_t)ut->ut_time;
- find_idle_and_ttywrite(w);
- }
- --
- Sean Eric Fagan | "My psychiatrist says I have a messiah
- sef@kithrup.COM | complex. But I forgive him."
- -----------------+ -- Jim Carrey
- Any opinions expressed are my own, and generally unpopular with others.
-