[The latest version should compile out of the box on SunOS5.3 and Alpha OSF1.3. The AIX patches haven't been integrated (yet) since I don't have access to a suitable system. Sorry. -- stolcke] Replied: Fri, 24 Sep 1993 09:27:50 PDT Replied: "To: ro@TechFak.Uni-Bielefeld.DE (Rainer Orth) Fcc: soft/finger" Return-Path: ro@TechFak.Uni-Bielefeld.DE Delivery-Date: Tue, 21 Sep 1993 07:39:15 PDT Return-Path: ro@TechFak.Uni-Bielefeld.DE Return-Path: Received: from techfac.TechFak.Uni-Bielefeld.DE by icsia.ICSI.Berkeley.EDU (4.1/HUB$Revision: 1.17 $) id AA12600; Tue, 21 Sep 93 07:38:42 PDT Received: from anemone.TechFak.Uni-Bielefeld.DE by techfac.TechFak.Uni-Bielefeld.DE id AA16155; Tue, 21 Sep 1993 16:38:33 +0200 Received: by anemone.techfak.uni-bielefeld.de (5.0/tp.29.0890) id AA28286; Tue, 21 Sep 93 16:38:32 +0200 Date: Tue, 21 Sep 93 16:38:32 +0200 From: ro@TechFak.Uni-Bielefeld.DE (Rainer Orth) Message-Id: <9309211438.AA28286@anemone.techfak.uni-bielefeld.de> To: Andreas Stolcke Subject: Ports of ICSI-finger 1.0.19 to AIX 3.2, Solaris 2.2, and OSF/1 V1.2 Content-Length: 37852 I've recently ported your ICSI finger 1.0.19 to some new machine/OS combinations: * IBM RS/6000 running AIX 3.2.4 * Sun Sparc running Solaris 2.2 * DEC Alpha running OSF/1 V1.2 To get it running, I had to make a couple of changes included below. All the ports were done using gcc 2.4.5 -O. * several files need to include to get defintions of O_RDONLY etc and for R_OK etc. * OSF/1 on the alpha has sizeof(time_t) == sizeof(int) != sizeof(long) and the same is true for inet addresses. Therefore I've introduced a new type inaddr_t and used that one, time_t and off_t instead of long where appropriate. * MAXHOSTNAMELEN is used in several places to hold a fully qualified domain name (fqdn). This may be ok on some unixes, but is certainly false on AIX where gethostname() never returns an fqdn. I've redefined MAXHOSTNAMELEN to 64 in several places, but it were probably more correct to use a differnt name and the DNS max. fqdn length of 256. * one should use the POSIX.1 values for lseek()'s third argument (SEEK_CUR etc) instead of the BSD L_INCR or hard-coded numerical values * config.h-dist: some new configuration variables to support the additional ports * include/tcp.h: include if present to get a definition of fd_set * lib/Makefile: BM_{READERS, WRITERS}_{SRC, OBJ}: include {read, save}_face.[co] * lib/{read, save}_rastfile.c: there's no rasterfile support in Solaris 2 * lib/tty.c: pseudo-tty's in SVR4 and AIX have names starting with /dev/pts/ * lib/site/defface.c: use POSIX.1 struct dirent instead of BSD struct direct and map between the two as necessary * lib/site/icsi_info.c (display_finger_info): getc() returns an int, not char! * src/fingerd.c (poll_client): now that times are time_t, machine_idle_time must be initialized to TIME_T_MAX (I've used LONG_MAX here since time_t's tend (must ?) to be signed, but that's wrong on the alpha where time_t == int). * src/packet2ascii.c: renamed parse_long to parse_time_t since time_t's aren't long on the alpha * support/cpp-Makefile: finger and in.fingerd need libm since they refer to sqrt() somehow I hope you find some of these changes useful. With best regards. Rainer Orth ----------------------------------------------------------------------------- Rainer Orth, Technical Computer Science, University of Bielefeld Internet: ro@TechFak.Uni-Bielefeld.DE =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/config.h-dist,v retrieving revision 1.1.1.5 retrieving revision 1.3 diff -u -r1.1.1.5 -r1.3 --- config.h-dist 1993/09/14 18:22:31 1.1.1.5 +++ config.h-dist 1993/09/21 08:37:58 1.3 @@ -57,10 +57,16 @@ #define CcOptions -O #ifdef sgi #define CcLibs -lsun /* for NIS support */ -lc_s +#elif defined(sun) && defined(__svr4__) +#define CcLibs -lsocket -lnsl +#elif defined(_AIX) +#define CcLibs -lbsd -lcfg -lodm #else #define CcLibs /* -lresolv */ #endif +#define MathLibs -lm + /* Install commands and flags. The ones below assume a BSD-style install. A script that has the required functionality can be found in support/install.sh */ @@ -249,21 +255,25 @@ location of the mail spool and various system calls. SYSV is just an attempt to get things right most of the time, but you may have to replace more specific #ifdef's where this fails. */ -#if defined(hpux) || defined(sgi) /* for example */ +#if defined(hpux) || defined(sgi) || defined(__osf__) /* for example */ #define SYSV #endif +#if defined(__svr4__) +#define SVR4 +#endif + /* Define USE_LASTLOG if your system has a lastlog(5) database. This will cause finger to accurately initialize its user database from the information found in that file. */ -#if !defined(SYSV) || defined(sgi) +#if (!defined(SYSV) && !defined(_AIX)) || defined(SVR4) || defined(sgi) #define USE_LASTLOG #endif /* Define USE_TTYENT if your system has a getttyent(3) function and you want to use the comment fields in the system's tty database file as a fallback resource for tty locations. */ -#ifndef SYSV +#if !defined(SYSV) && !defined(SVR4) #define USE_TTYENT #endif @@ -271,10 +281,26 @@ recording the origin of remote logins (or the display names of X11 terminal emulators). This is a major win in determining the `Where' filed of finger packets. Check /usr/include/utmp.h to verify. */ -#if !defined(SYSV) || defined(hpux) +#if (!defined(SYSV) && !defined(SVR4)) || defined(hpux) #define HAVE_UTHOST #endif +#ifdef SVR4 +#define HAVE_DIRENT +#endif + +#ifdef SVR4 +#define STDC_HEADERS +#endif + +#ifdef SVR4 +#define POSIX_SIGNALS +#endif + +#ifdef _AIX +#define HAVE_SYS_SELECT_H +#endif + /* Define USE_SYSLOG to the facility categeory under which you want error and warning message to be logged. Check /usr/include/syslog.h for appropriate categories, like LOG_DAEMON or LOG_LOCAL1. @@ -303,13 +329,13 @@ available you are either out of luck or you can try #define flock(x,y) (0) */ -#if defined(SYSV) && !defined(sgi) +#if (defined(SYSV) || defined(SVR4) || defined(_AIX)) && !defined(sgi) #define NEED_FLOCK #endif /* Define NEED_GETUSERSHELL if your C library doesn't have the getusershell() function. */ -#if (defined(SYSV) && !defined(hpux))|| defined(ultrix) +#if (defined(SYSV) && !defined(hpux))|| defined(ultrix) || defined(_AIX) #define NEED_GETUSERSHELL #endif @@ -344,10 +370,14 @@ /* Define HAVE_VFORK if your system has the vfork() system call and it should be used for efficiency in exec-ing target scripts. */ -#if !defined(SYSV) || defined(hpux) +#if (!defined(SYSV) && !defined(SVR4)) || defined(hpux) #define HAVE_VFORK #endif +#ifndef NeXT +#define HAVE_UNISTD_H +#endif + /* Define HAVE_STRCASECMP if your libc contains the strcasecmp/strncasecmp functions. */ #if defined(sun) || defined(NeXT) || defined(ultrix) || defined(sgi) @@ -358,5 +388,10 @@ debug heap management. It assumes Conor P. Cahill's dbmalloc package is accessible with #include and -ldbmalloc. */ /* #define USE_DBMALLOC */ + +#ifdef STDC_HEADERS +#define bcopy(src, dst, len) memmove((dst), (src), (len)) +#define bzero(buf, len) memset((buf), 0, (len)) +#endif #endif /* _CONFIG_H_ */ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/client.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- client.h 1993/01/29 11:54:50 1.1.1.1 +++ client.h 1993/09/15 09:45:48 1.2 @@ -48,12 +48,12 @@ /* What a client looks like. */ typedef struct { char hostname[64]; - unsigned long address; + inaddr_t address; int status; /* Status flags */ int users; /* Number of active users. */ - long idle_time; /* If up, length of time idle. + time_t idle_time; /* If up, length of time idle. If down, time first found down. */ - long times_polled; /* Number of times successfully polled. */ + time_t times_polled; /* Number of times successfully polled. */ } CLIENT; /* flags in status field */ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/general.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- general.h 1993/01/29 11:54:50 1.1.1.1 +++ general.h 1993/09/15 09:46:50 1.2 @@ -53,6 +53,13 @@ #define byte unsigned char #endif +/* An Internet address. */ +#ifndef __alpha__ +#define inaddr_t unsigned long +#else +#define inaddr_t unsigned int +#endif + /* So I can say (Function *)foo; */ typedef int Function (); =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/os.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- os.h 1993/02/08 16:21:05 1.1.1.2 +++ os.h 1993/09/15 09:48:41 1.2 @@ -71,7 +71,7 @@ /* Return the time that TTY was last accessed. TTY is the name of the terminal device, as in "ttyp0", or "console". */ -long get_last_access (); +time_t get_last_access (); /* Return a string which is the location of the terminal in utmp ENTRY. */ char *tty_location (); =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/packet.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- packet.h 1993/02/04 19:53:10 1.1.1.2 +++ packet.h 1993/09/15 09:48:53 1.2 @@ -42,8 +42,8 @@ char name[USERNAME_LEN]; char real_name[REALNAME_LEN]; char host[HOSTNAME_LEN]; - long login_time; - long idle_time; + time_t login_time; + time_t idle_time; char ttyname[TTYNAME_LEN]; char ttyloc[TTYLOC_LEN]; char what[WHAT_LEN]; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/tcp.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- tcp.h 1993/01/29 11:54:50 1.1.1.1 +++ tcp.h 1993/09/21 08:38:18 1.2 @@ -32,6 +32,10 @@ /* #include */ #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif + /* TCP service for fingering a client machine. */ #define CFINGER_SERVICE "cfinger" =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/include/util.h,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -u -r1.1.1.3 -r1.2 --- util.h 1993/09/14 18:22:58 1.1.1.3 +++ util.h 1993/09/15 09:49:06 1.2 @@ -109,7 +109,7 @@ char *path_concat (); /* Return a string which is the English representation of the - amount of idle time present in ITIME. Note that ITIME is a long. */ + amount of idle time present in ITIME. Note that ITIME is a time_t. */ char *idle_time_string (); /* Return the real person name of ENTRY. */ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/Makefile,v retrieving revision 1.1.1.4 retrieving revision 1.3 diff -u -r1.1.1.4 -r1.3 --- Makefile 1993/09/14 18:23:03 1.1.1.4 +++ Makefile 1993/09/15 09:49:41 1.3 @@ -44,12 +44,14 @@ CORELIB_OBJECTS = error.o os.o packet.o tcp.o tty.o util.o getservhost.o \ text-finger.o face-finger.o dither.o call.o mail.o -BM_READERS_SRC = read_bitmap.c read_rastfile.c read_x_bitmap.c read_lispmug.c +BM_READERS_SRC = read_bitmap.c read_rastfile.c read_x_bitmap.c read_lispmug.c \ + read_face.c BM_WRITERS_SRC = save_bitmap.c save_rastfile.c save_x_bitmap.c save_lispmug.c BM_SHOWERS_SRC = x_show_face.c sun_show_face.c showface.c BITMAP_SOURCES = $(BM_READERS_SRC) $(BM_WRITERS_SRC) $(BM_SHOWERS_SRC) bitmap.c -BM_READERS_OBJ = read_bitmap.o read_rastfile.o read_x_bitmap.o read_lispmug.o +BM_READERS_OBJ = read_bitmap.o read_rastfile.o read_x_bitmap.o read_lispmug.o \ + read_face.o BM_WRITERS_OBJ = save_bitmap.o save_rastfile.o save_x_bitmap.o save_lispmug.o BM_SHOWERS_OBJ = x_show_face.o sun_show_face.o showface.o BITMAP_OBJECTS = $(BM_READERS_OBJ) $(BM_WRITERS_OBJ) $(BM_SHOWERS_OBJ) bitmap.o @@ -145,6 +147,8 @@ $(INCLUDES)../config.h-dist $(INCLUDES)bitmap.h read_lispmug.o : read_lispmug.c $(INCLUDES)general.h $(INCLUDES)util.h $(INCLUDES)../config.h \ $(INCLUDES)../config.h-dist $(INCLUDES)bitmap.h +read_face.o : read_face.c $(INCLUDES)general.h $(INCLUDES)util.h $(INCLUDES)../config.h \ + $(INCLUDES)../config.h-dist $(INCLUDES)bitmap.h save_bitmap.o : save_bitmap.c $(INCLUDES)general.h $(INCLUDES)util.h $(INCLUDES)../config.h \ $(INCLUDES)../config.h-dist $(INCLUDES)bitmap.h $(INCLUDES)error.h save_rastfile.o : save_rastfile.c $(INCLUDES)general.h $(INCLUDES)util.h $(INCLUDES)../config.h \ @@ -156,9 +160,7 @@ x_show_face.o : x_show_face.c ../config.h ../config.h-dist $(INCLUDES)general.h \ $(INCLUDES)util.h $(INCLUDES)../config.h $(INCLUDES)../config.h-dist $(INCLUDES)call.h \ $(INCLUDES)bitmap.h $(INCLUDES)error.h -sun_show_face.o : sun_show_face.c ../config.h ../config.h-dist $(INCLUDES)general.h \ - $(INCLUDES)util.h $(INCLUDES)../config.h $(INCLUDES)../config.h-dist $(INCLUDES)call.h \ - $(INCLUDES)bitmap.h $(INCLUDES)error.h +sun_show_face.o : sun_show_face.c ../config.h ../config.h-dist showface.o : showface.c ../config.h ../config.h-dist $(INCLUDES)bitmap.h $(INCLUDES)error.h \ $(INCLUDES)util.h $(INCLUDES)../config.h $(INCLUDES)../config.h-dist bitmap.o : bitmap.c ../config.h ../config.h-dist $(INCLUDES)general.h $(INCLUDES)util.h \ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/authuser.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- authuser.c 1993/01/29 11:54:55 1.1.1.1 +++ authuser.c 1993/09/21 08:38:43 1.3 @@ -8,6 +8,8 @@ 5/6/91 DJB baseline authuser 3.1. Public domain. */ +#include "../config.h" + #include #include #include @@ -15,6 +17,9 @@ #include #include /*XXX*/ #include +#ifdef HAVE_SYS_SELECT_H +#include +#endif #include #include #include @@ -62,7 +67,7 @@ char *auth_xline(user,fd,in) register char *user; /* the supposed name of the user, NULL if unknown */ register int fd; /* the file descriptor of the connection */ -register unsigned long *in; +register inaddr_t *in; { unsigned short local; unsigned short remote; @@ -83,18 +88,18 @@ int auth_fd(fd,in,local,remote) register int fd; -register unsigned long *in; +register inaddr_t *in; register unsigned short *local; register unsigned short *remote; { - unsigned long inlocal; + inaddr_t inlocal; return auth_fd2(fd,&inlocal,in,local,remote); } int auth_fd2(fd,inlocal,inremote,local,remote) register int fd; -register unsigned long *inlocal; -register unsigned long *inremote; +register inaddr_t *inlocal; +register inaddr_t *inremote; register unsigned short *local; register unsigned short *remote; { @@ -124,7 +129,7 @@ static char *buf; char *auth_tcpuser(in,local,remote) -register unsigned long in; +register inaddr_t in; register unsigned short local; register unsigned short remote; { @@ -134,8 +139,8 @@ #define CLORETS(e) { saveerrno = errno; close(s); errno = saveerrno; return e; } int auth_tcpsock(inlocal,inremote) -register unsigned long inlocal; -register unsigned long inremote; +register inaddr_t inlocal; +register inaddr_t inremote; { struct sockaddr_in sa; register int s; @@ -168,8 +173,8 @@ } char *auth_tcpuser2(inlocal,inremote,local,remote) -register unsigned long inlocal; -register unsigned long inremote; +register inaddr_t inlocal; +register inaddr_t inremote; register unsigned short local; register unsigned short remote; { @@ -182,8 +187,8 @@ } char *auth_tcpuser3(inlocal,inremote,local,remote,timeout) -register unsigned long inlocal; -register unsigned long inremote; +register inaddr_t inlocal; +register inaddr_t inremote; register unsigned short local; register unsigned short remote; register int timeout; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/authuser.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- authuser.h 1993/01/29 11:54:55 1.1.1.1 +++ authuser.h 1993/09/15 09:50:27 1.2 @@ -1,6 +1,14 @@ #ifndef AUTHUSER_H #define AUTHUSER_H +#ifndef inaddr_t +#ifndef __alpha__ +#define inaddr_t unsigned long +#else +#define inaddr_t unsigned int +#endif +#endif + extern unsigned short auth_tcpport; extern char *auth_xline(); extern int auth_fd(); =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/call.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- call.c 1993/02/04 19:53:41 1.1.1.2 +++ call.c 1993/09/15 09:50:48 1.2 @@ -52,7 +52,7 @@ int verbose = 0; struct hostent *host; int connection, facing, info, width; - unsigned long addr; + inaddr_t addr; username = savestring (arg); facing = options & FACE; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/mail.c,v retrieving revision 1.1.1.4 retrieving revision 1.3 diff -u -r1.1.1.4 -r1.3 --- mail.c 1993/09/14 18:23:18 1.1.1.4 +++ mail.c 1993/09/21 08:39:51 1.3 @@ -46,9 +46,8 @@ #include "os.h" #include "error.h" -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif #define FORWMSG "Mail forwarded to " #define DISPWIDTH 50 @@ -118,7 +117,7 @@ char *peer_name; { int sockfd; - long addr; + inaddr_t addr; char *smtphost; struct hostent *host; char rbuf[1024]; @@ -130,7 +129,7 @@ /* Connect to SMTP */ if (isdigit (*smtphost)) { - addr = (long)inet_addr (smtphost); + addr = (inaddr_t)inet_addr (smtphost); host = gethostbyaddr (&addr, 4, AF_INET); } else =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/os.c,v retrieving revision 1.1.1.5 retrieving revision 1.3 diff -u -r1.1.1.5 -r1.3 --- os.c 1993/09/14 18:23:32 1.1.1.5 +++ os.c 1993/09/21 08:40:59 1.3 @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef WANT_ACCT #include #endif @@ -54,9 +55,8 @@ #include "util.h" #include "error.h" -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif /* Location of the accounting file. This is for filling in the WHAT field. */ #ifndef ACCT_FILE @@ -189,7 +189,7 @@ int lastlog; /* don't worry about idle time */ { int i; - long idle, current_time; + time_t idle, current_time; char *ttyloc; FINGER_PACKET **result; @@ -276,7 +276,7 @@ if (finfo.st_mode & S_IFCHR) { dev_t tty = finfo.st_rdev; - long offset; + off_t offset; int file; if ((stat (ACCT_FILE, &finfo) == 0) && @@ -418,7 +418,7 @@ } else { - if (lseek (file, (long) pw->pw_uid * sizeof(entry), 0) == -1 || + if (lseek (file, (off_t) pw->pw_uid * sizeof(entry), 0) == -1 || read (file, (char *)&entry, sizeof(entry)) != sizeof(entry) || entry.ll_time == 0) return (struct utmp *)NULL; @@ -499,7 +499,7 @@ /* Hopefully the nonuser macro will eliminate the lossage we had with all of the non-existant users laying around in the utmp file. */ if (entry.ut_name[0] != '\0' && -#ifdef sun +#if defined(sun) && !defined(__svr4__) !nonuser(entry) && #endif #ifdef USER_PROCESS /* SYSV */ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/packet.c,v retrieving revision 1.1.1.4 retrieving revision 1.2 diff -u -r1.1.1.4 -r1.2 --- packet.c 1993/09/14 18:23:25 1.1.1.4 +++ packet.c 1993/09/15 09:51:51 1.2 @@ -300,7 +300,7 @@ same as ".all". */ FINGER_PACKET ** finger_at_address (address, user) - unsigned long address; + inaddr_t address; char *user; { FINGER_PACKET **packets, **read_packets (); @@ -405,7 +405,7 @@ } /* through away any old data */ - if (ftruncate(filedes, (long)(i * sizeof (FINGER_PACKET))) < 0) + if (ftruncate(filedes, (off_t)(i * sizeof (FINGER_PACKET))) < 0) return -1; return 0; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/read_bitmap.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- read_bitmap.c 1993/09/14 18:23:13 1.1.1.2 +++ read_bitmap.c 1993/09/21 09:47:35 1.2 @@ -27,6 +27,7 @@ #include #include +#include #include "general.h" #include "bitmap.h" =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/read_lispmug.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- read_lispmug.c 1993/09/14 18:23:15 1.1.1.2 +++ read_lispmug.c 1993/09/21 08:42:22 1.2 @@ -27,6 +27,7 @@ #include #include +#include #include "general.h" #include "bitmap.h" =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/read_rastfile.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- read_rastfile.c 1993/09/14 18:23:17 1.1.1.2 +++ read_rastfile.c 1993/09/21 08:43:14 1.2 @@ -29,11 +29,13 @@ #include #include +#include +#include #include "general.h" #include "bitmap.h" -#ifdef sun +#if defined(sun) && !defined(__svr4__) #include #else struct rasterfile { @@ -43,7 +45,7 @@ }; /* Today. I don't know what it is tommorrow. */ #define RAS_MAGIC 0X59A66A95 -#endif /* sun */ +#endif /* sun && !__svr4__ */ BITMAP * read_rasterfile (user) @@ -68,7 +70,7 @@ } if (header.ras_maplength) - lseek (file, header.ras_maplength, L_INCR); + lseek (file, header.ras_maplength, SEEK_CUR); face = (BITMAP *)xmalloc (sizeof (BITMAP)); face->width = header.ras_width; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/save_bitmap.c,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -u -r1.1.1.3 -r1.2 --- save_bitmap.c 1993/09/14 18:23:12 1.1.1.3 +++ save_bitmap.c 1993/09/21 08:42:24 1.2 @@ -27,6 +27,7 @@ #include #include +#include #include #include "general.h" =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/save_lispmug.c,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -u -r1.1.1.3 -r1.2 --- save_lispmug.c 1993/09/14 18:23:21 1.1.1.3 +++ save_lispmug.c 1993/09/21 08:42:26 1.2 @@ -27,6 +27,7 @@ #include #include +#include #include #include "general.h" =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/save_rastfile.c,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -u -r1.1.1.3 -r1.2 --- save_rastfile.c 1993/09/14 18:23:07 1.1.1.3 +++ save_rastfile.c 1993/09/21 09:42:37 1.2 @@ -27,13 +27,14 @@ #include #include +#include #include #include "general.h" #include "bitmap.h" #include "error.h" -#ifdef sun +#if defined(sun) && !defined(__svr4__) #include #else struct rasterfile { @@ -43,7 +44,7 @@ }; /* Today. I don't know what it is tommorrow. */ #define RAS_MAGIC 0X59A66A95 -#endif /* sun */ +#endif /* sun && !__svr4__ */ int save_rasterfile (user, face) =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/tty.c,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- tty.c 1993/02/23 17:31:48 1.1.1.3 +++ tty.c 1993/09/21 09:43:10 1.3 @@ -44,9 +44,8 @@ #include "error.h" #include "fingerpaths.h" -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif /* The directory containing the tty devices. */ #ifndef TTYPATH @@ -95,7 +94,7 @@ /* Return the time that TTY was last accessed. TTY is the name of the terminal device, as in "ttyp0", or "console". */ -long +time_t get_last_access (hostname, tty) char *hostname; char *tty; @@ -314,6 +313,12 @@ /* HP/UX (and maybe others) have pseudo-terminals in /dev/pty/ */ else if (strncmp (ttyname, "pty/tty", 7) == 0) offset = 7; + /* SVR4 and AIX have pseudo-terminals in /dev/pts/ */ + else if (strncmp (ttyname, "pts/", 4) == 0) + { + ttyname[3] = 'p'; + offset = 3; + } else offset = 0; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/util.c,v retrieving revision 1.1.1.4 retrieving revision 1.2 diff -u -r1.1.1.4 -r1.2 --- util.c 1993/09/14 18:23:08 1.1.1.4 +++ util.c 1993/09/15 09:52:19 1.2 @@ -140,7 +140,7 @@ /* **************************************************************** */ /* Number of seconds that, below which, the terminal is not idle. */ -long idle_time_threshold = 60; +time_t idle_time_threshold = 60; /* Macros for formatting possibly pluralized strings to time_buffer. */ #define ADD_SHORT(var, str) \ @@ -150,10 +150,10 @@ var, str, (var) > 1 ? "s" : "") /* Return a static string which is the English representation of the - amount of idle time present in ITIME. Note that ITIME is a long. */ + amount of idle time present in ITIME. Note that ITIME is a time_t. */ char * idle_time_string (itime, short_format) - long itime; + time_t itime; int short_format; { int seconds, minutes, hours, days, weeks, months, years; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/site/caltech_info.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- caltech_info.c 1993/01/29 11:54:55 1.1.1.1 +++ caltech_info.c 1993/09/15 09:52:40 1.2 @@ -82,7 +82,7 @@ if ((file = open (LASTLOG_FILE, O_RDONLY)) >= 0) { - if ((lseek (file, (long) (entry->pw_uid * sizeof (logent)), L_SET) != -1) && + if ((lseek (file, (off_t) (entry->pw_uid * sizeof (logent)), L_SET) != -1) && (read (file, &logent, sizeof (logent)) == sizeof (logent))) { fprintf (stream, "Last login on %s ", =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/site/defface.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- defface.c 1993/01/29 11:54:56 1.1.1.1 +++ defface.c 1993/09/21 09:43:30 1.3 @@ -25,12 +25,21 @@ static char *rcsid = "$Id$ ICSI (Berkeley)"; #endif +#include "../config.h" + #include #include #include + +#ifdef HAVE_DIRENT +#include +#define NLENGTH(dirent) (strlen ((dirent)->d_name)) +#else #include +#define NLENGTH(dirent) ((dirent)->d_namlen) +#define dirent direct +#endif -#include "../config.h" #include "general.h" #include "bitmap.h" @@ -87,7 +96,7 @@ DIR *directory; char name[256], **result = (char **)NULL; int result_index, result_size; - struct direct *entry = (struct direct *)NULL; + struct dirent *entry = (struct dirent *)NULL; int dir_is_dot; result_index = result_size = 0; @@ -99,9 +108,9 @@ dir_is_dot = (strcmp (dir, ".") == 0); - while ((entry = readdir (directory)) != (struct direct *)NULL) + while ((entry = readdir (directory)) != (struct dirent *)NULL) { - int len = entry->d_namlen; + int len = NLENGTH(entry); if (entry->d_name[0] == '.') continue; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/site/definfo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- definfo.c 1993/01/29 11:54:56 1.1.1.1 +++ definfo.c 1993/09/15 09:53:27 1.2 @@ -86,7 +86,7 @@ if ((file = open (LASTLOG_FILE, O_RDONLY)) >= 0) { - if ((lseek (file, (long) (entry->pw_uid * sizeof (logent)), L_SET) != -1) && + if ((lseek (file, (off_t) (entry->pw_uid * sizeof (logent)), L_SET) != -1) && (read (file, &logent, sizeof (logent)) == sizeof (logent))) { fprintf (stream, "Last login on %s ", =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/site/icsi_info.c,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -u -r1.1.1.2 -r1.3 --- icsi_info.c 1993/09/14 18:23:40 1.1.1.2 +++ icsi_info.c 1993/09/21 09:44:22 1.3 @@ -43,6 +43,7 @@ #include #include #include +#include #include "general.h" #include "packet.h" @@ -50,9 +51,8 @@ #include "util.h" #include "error.h" -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif #ifndef S_ISREG #define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) #endif @@ -350,7 +350,7 @@ if ((file = open (LASTLOG_FILE, O_RDONLY)) >= 0) { - if ((lseek (file, (long) (entry->pw_uid * sizeof (logent)), L_SET) + if ((lseek (file, (off_t) (entry->pw_uid * sizeof (logent)), L_SET) != -1) && (read (file, &logent, sizeof (logent)) == sizeof (logent)) && logent.ll_time != 0 ) @@ -408,7 +408,7 @@ /* Maybe do the .project file. */ { FILE *istream; - char c; + int c; if (is_plain(proj_file) && (istream = fopen(proj_file, "r"))) @@ -456,7 +456,7 @@ else { extern int local_connect; - long now = time((long *)NULL); + time_t now = time((time_t *)NULL); struct tm *tm = localtime(&now); fclose (istream); =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/lib/site/ucsb_info.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ucsb_info.c 1993/01/29 11:54:56 1.1.1.1 +++ ucsb_info.c 1993/09/15 09:54:02 1.2 @@ -180,7 +180,7 @@ { char *idle_time_string (); - char *otime = idle_time_string (time ((long *)0) - loggedin); + char *otime = idle_time_string (time ((time_t *)0) - loggedin); char *t = otime; if (*t) @@ -477,7 +477,7 @@ /* Number of seconds that below which, the terminal is not idle. */ -long idle_time_threshold = 60; +time_t idle_time_threshold = 60; /* Macro for appending possibly pluralized strings to time_buffer. */ #define ADD_TIME(str,var)\ =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/src/fingerd.c,v retrieving revision 1.1.1.5 retrieving revision 1.3 diff -u -r1.1.1.5 -r1.3 --- fingerd.c 1993/09/14 18:23:44 1.1.1.5 +++ fingerd.c 1993/09/21 09:45:06 1.3 @@ -38,6 +38,7 @@ #include #include #include +#include #include "../config.h" @@ -434,7 +435,7 @@ int status = 0; char *start, *end; struct hostent *hostinfo; - unsigned long address; + inaddr_t address; /* If special directive, do what it says. */ if (*line == ':') @@ -515,7 +516,7 @@ add_client (name, address, status) char *name; /* name as we want it recorded */ - unsigned long address; + inaddr_t address; int status; { CLIENT *new; @@ -675,7 +676,7 @@ FINGER_PACKET **packets; int i; int gateway = (client->status & CLIENT_GATEWAY); - long timestamp = time((long *)NULL); + time_t timestamp = time((time_t *)NULL); debug (debugging || poll_debugging, "polling %s%s%s", gateway ? "gateway " : "host ", @@ -796,7 +797,7 @@ if (packets) { int users = 0; - unsigned long machine_idle_time = (unsigned long)-1; + time_t machine_idle_time = (time_t)LONG_MAX; for (i = 0; packets[i]; i++) { @@ -841,7 +842,7 @@ such packets. */ record_user_info (packet, timestamp, lastlog, gateway) FINGER_PACKET *packet; - long timestamp; /* when packet is recorded */ + time_t timestamp; /* when packet is recorded */ int lastlog; /* packet is a lastlog record */ int gateway; /* packet comes from a gateway */ { @@ -866,7 +867,7 @@ if (packet->name[0] != '\0') { register int i; - long offset; + off_t offset; /* use idle_time in user packets as time stamps */ if (lastlog) @@ -890,7 +891,7 @@ #endif { bcopy (packet, user_packets[i], sizeof (FINGER_PACKET)); - offset = i * (long)sizeof(FINGER_PACKET); + offset = i * (off_t)sizeof(FINGER_PACKET); if (flock (user_file, LOCK_EX) < 0 || lseek (user_file, offset, L_SET) != offset) file_error(FATAL, userdata); @@ -913,7 +914,7 @@ bcopy (packet, user_packets[i], sizeof (FINGER_PACKET)); user_packets[i + 1] = (FINGER_PACKET *)NULL; - offset = i * (long)sizeof(FINGER_PACKET); + offset = i * (off_t)sizeof(FINGER_PACKET); if (flock (user_file, LOCK_EX) < 0 || lseek (user_file, offset, L_SET) != offset) file_error(FATAL, userdata); @@ -1011,7 +1012,7 @@ } /* through away any old data */ - if (ftruncate(filedes, (long)(i * sizeof (CLIENT))) < 0) + if (ftruncate(filedes, (off_t)(i * sizeof (CLIENT))) < 0) return -1; return 0; =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/src/in.cfingerd.c,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -u -r1.1.1.2 -r1.3 --- in.cfingerd.c 1993/02/08 16:21:53 1.1.1.2 +++ in.cfingerd.c 1993/09/21 08:40:06 1.3 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -49,9 +50,8 @@ #include #endif -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif /* How old the hostdata and clientstatus files can get before we suspect something is wrong. */ @@ -257,7 +257,7 @@ if (stat (filename, &finfo) != -1) { - long last_change = time ((long *)0) - finfo.st_mtime; + time_t last_change = time ((time_t *)0) - finfo.st_mtime; if (last_change > MIN_UPDATE_INTERVAL) { =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/src/in.fingerd.c,v retrieving revision 1.1.1.6 retrieving revision 1.3 diff -u -r1.1.1.6 -r1.3 --- in.fingerd.c 1993/09/14 18:23:42 1.1.1.6 +++ in.fingerd.c 1993/09/21 09:46:09 1.3 @@ -25,6 +25,8 @@ static char *rcsid = "$Id$ ICSI (Berkeley)"; #endif +#include "../config.h" + #include #include #include @@ -32,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -39,12 +42,13 @@ #include #include #include -#ifdef sun +#ifdef HAVE_UNISTD_H +#include +#endif +#if defined(sun) && !defined(__svr4__) #include #endif -#include "../config.h" - #include "fingerpaths.h" #include "general.h" #include "client.h" @@ -63,9 +67,8 @@ #define DEFAULT_TARGET "default" #define TEMPFILE "/tmp/fingerXXXXXX" -#ifndef MAXHOSTNAMELEN +#undef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 -#endif /* **************************************************************** */ /* */ @@ -716,7 +719,7 @@ CLIENT **clients; int clients_count; int plural; - long now = time((long *)0); + time_t now = time((time_t *)0); /* client listings are handled by local servers only */ if (!im_a_lserver) @@ -1200,7 +1203,7 @@ if (stat (filename, &finfo) != -1) { - long last_change = time ((long *)0) - finfo.st_mtime; + time_t last_change = time ((time_t *)0) - finfo.st_mtime; if (last_change > MIN_UPDATE_INTERVAL) { @@ -1240,7 +1243,7 @@ } else { - long last_change = time ((long *)0) - finfo.st_mtime; + time_t last_change = time ((time_t *)0) - finfo.st_mtime; char *itime = idle_time_string (last_change, 0); fprintf (stream, "%s last updated %d seconds ago.\r\n", what, last_change); @@ -1269,7 +1272,7 @@ char *arg; { int pid; -#ifdef SYSV +#if defined(SYSV) || defined(POSIX_SIGNALS) int status; #else #ifndef WEXITSTATUS =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/src/packet2ascii.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- packet2ascii.c 1993/01/29 11:54:57 1.1.1.1 +++ packet2ascii.c 1993/09/21 09:46:21 1.3 @@ -26,6 +26,7 @@ #include #include +#include #include "packet.h" @@ -97,10 +98,10 @@ } char * -parse_long(line, sep, buffer, lineno, name) +parse_time_t(line, sep, buffer, lineno, name) char *line; char sep; - long *buffer; + time_t *buffer; int lineno; char *name; { @@ -144,10 +145,10 @@ p = parse_string(p, SEPARATOR, packet.host, sizeof(packet.host), lineno, "host"); - p = parse_long(p, SEPARATOR, + p = parse_time_t(p, SEPARATOR, &packet.login_time, lineno, "login_time"); - p = parse_long(p, SEPARATOR, + p = parse_time_t(p, SEPARATOR, &packet.idle_time, lineno, "idle_time"); p = parse_string(p, SEPARATOR, =================================================================== RCS file: /vol/src/master/gnu/finger/icsi/support/cpp-Makefile,v retrieving revision 1.1.1.5 retrieving revision 1.4 diff -u -r1.1.1.5 -r1.4 --- cpp-Makefile 1993/09/14 18:23:57 1.1.1.5 +++ cpp-Makefile 1993/09/21 09:47:10 1.4 @@ -155,6 +158,7 @@ MALLOCLIB = #endif SYSLIBS = $(MALLOCLIB) CcLibs +LIBM = MathLibs SRCS = finger.c fingerd.c in.cfingerd.c in.fingerd.c packet2ascii.c EXECUTABLES = finger fingerd in.cfingerd in.fingerd packet2ascii vifinger @@ -166,7 +170,7 @@ finger: finger.o $(MYLIBS) $(LINKCMD) $(CFLAGS) -o finger finger.o $(MYLIBS) \ - $(WINLIBS) $(SYSLIBS) + $(WINLIBS) $(SYSLIBS) $(LIBM) fingerd: fingerd.o $(MYLIBS) $(LINKCMD) $(CFLAGS) -o fingerd fingerd.o $(MYLIBS) \ @@ -178,7 +182,7 @@ in.fingerd: in.fingerd.o $(MYLIBS) $(LINKCMD) $(CFLAGS) -o in.fingerd in.fingerd.o $(MYLIBS) \ - $(SYSLIBS) + $(SYSLIBS) $(LIBM) packet2ascii: packet2ascii.o $(MYLIBS) $(LINKCMD) $(CFLAGS) -o packet2ascii packet2ascii.o $(MYLIBS) \