home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-24 | 31.2 KB | 1,156 lines |
- Newsgroups: alt.bbs.unixbbs
- Path: sparky!uunet!decwrl!access.usask.ca!ccu.umanitoba.ca!umcarls9
- From: umcarls9@ccu.umanitoba.ca (Charles Carlson)
- Subject: Finger program to support BBS id
- Message-ID: <1992Jul24.171715.24665@ccu.umanitoba.ca>
- Organization: University of Manitoba, Winnipeg, Canada
- Date: Fri, 24 Jul 1992 17:17:15 GMT
- Lines: 1146
-
-
-
-
- Hi...
-
- I've modified Phil's Finger program to support UnixBBS login "bbs" ids.
- Now when the finger program comes across the login id "bbs", it attempts
- to open the UnixBBS files from /tmp and extract the callers name and city,
- and places it in the Full name and Console Location fields of Phil's
- Finger output. For those who don't know what Phil's Finger is, it is
- a finger replace with a few more features for those of us lacking a good
- finger program. He's some sample output:
-
- -User- --Full name-- -What- Idle TTY -Console Location-
- bbs Beaker Breaker bbs vt0 Wpg, Mb
- Charles Carlson bbs vt0 Winnipeg, Manitoba
- Shan Durand bbs d02 Wpg, Mb
- charles Charles tcsh 9 vt0 Unknown
- telnet vt0 Unknown
- root Root tcsh 8:35 con Console Terminal
- xf vt0 Unknown
- tcsh 8 vt0 Unknown
-
-
- One nice thing about this, is that it works over TCP/IP. So if you have
- your UnixBBS running on a machine in a networked environment, you can
- finger the machine and find out who's on the BBS w/o having to log into
- that machine!
-
- For those paranoid about such things, I'll tell you now that you now need
- to run the finger program as setuid root and setgid sys. You need setuid
- root otherwise you cannot open the UnixBBS files in /tmp. You probably
- could get by with running it setuid bbs, but I didn't bother trying.
-
- Phil's Finger was posted to comp.sources.unix(misc?) a while back, so you
- should be able to find it in the appropriate archives, if not, I've made
- it temporarily available via anonymous FTP from ccu.umanitoba.ca, as
- /pub/umcarls9/pfinger.tar.Z with my changes already included. If you're
- running ISC 2.2.1 and TCP/IP you should be able to just type make. If
- you're not using TCP/IP, you'll probably need to undefine the inet stuff.
-
- For those who already have Phil's Finger, the only files that need
- modifying are finger.c and ymakefile, and the addition of ubbswho.c. I've
- included these at the end of the article. Just search for UnixBBS if you
- want to see what has changed.
-
- I would like to hear about problems, so let me know if I did anything wrong.
-
- Charles
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create:
- # finger.c
- # ubbswho.c
- # ymakefile
- # This archive created: Fri Jul 24 11:46:21 CDT 1992
- # By: umcarls9 ()
- export PATH; PATH=/bin:/usr/bin:$PATH
- echo shar: "extracting 'finger.c'" '( 14601 characters)'
- if test -f 'finger.c'
- then
- echo shar: "will not over-write existing file 'finger.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'finger.c'
- X/*
- X * finger.c -- output formatting for finger (main is in args.c)
- X *
- X * Copyright (C) 1986, 1990 Philip L. Budne
- X *
- X * This file is part of "Phil's Finger Program".
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 1, or (at your option)
- X * any later version.
- X *
- X * UnixBBS support added by Charles Carlson, please let me know if you find
- X * and problems. mail to: umcarls9@ccu.umanitoba.ca or
- X * charles@gremlin.muug.mb.ca
- X *
- X * You must define UnixBBS, and you must now run finger as setuid root,
- X * otherwise it will not be able to open the bbs files in /tmp.
- X *
- X */
- X
- X# ifndef lint
- Xstatic char *rcsid = "$Id: finger.c,v 3.0 90/07/06 13:10:35 budd Rel $";
- X# endif /* lint not defined */
- X
- X# include <sys/types.h>
- X# include <stdio.h>
- X# include "person.h"
- X# include "output.h"
- X# include "args.h" /* before luser.h */
- X# include "luser.h"
- X# include "finger.h"
- X# include "pr.h"
- X# include "inquire.h" /* for INQUIRE */
- X# include "ttylocfile.h"
- X
- X# define PID_COL /* display /pid in seperate column */
- X
- X/*# define RELATION /* display REL if this is defined */
- X/*# define REL_SUP "" /* (define as quoted string of relations */
- X /* to supress display of) */
- X
- XFORWARD LOCAL void
- X# ifdef RELATION
- X prelation(),
- X# endif /* RELATION defined */
- X pusername(), pgroup(), pspace(), ppname(),
- X pcmd(), pidle(), pbiff(), ptty(), pmesg(), plocation(), ppid(),
- X pstr(), pchar(), togoal();
- X
- XLOCAL int outcol, goalcol;
- X
- X# define USER_WID 8
- X# define PROG_WID 7 /* 6 prog + 1 flag */
- X
- X# ifndef TTY_WID
- X# ifdef AIX3
- X# define TTY_WID 6
- X# else /* AIX3 not defined */
- X# if defined(UmaxV) || defined(PTS_PTY_NAMES)
- X# define TTY_WID 5 /* rtAAPPS or ptsNN */
- X# else /* not defined(UmaxV) || defined(PTS_PTY_NAMES) */
- X# define TTY_WID 3
- X# endif /* not defined(UmaxV) || defined(PTS_PTY_NAMES) */
- X# endif /* AIX3 not defined */
- X# endif /* TTY_WID not defined */
- X
- X# define BASE_PER_WID (22+3+3) /* base person width */
- X
- Xtypedef void (*FPTR)();
- X
- XFPTR fields[] = {
- X pusername,
- X pspace,
- X pgroup,
- X# ifdef RELATION
- X# define GRPREL_WID 3 /* 2 + space */
- X prelation,
- X# else /* RELATION not defined */
- X# define GRPREL_WID 2 /* 1 + space */
- X# endif /* RELATION not defined */
- X pspace,
- X ppname,
- X NULL
- X}; /* fields */
- X
- X# define PER_WID (BASE_PER_WID-TTY_WID-GRPREL_WID)
- X
- X
- XFPTR fields2[] = {
- X# ifdef PID_COL
- X ppid,
- X# endif /* PID_COL defined */
- X# ifndef SUPPRESS_WHAT
- X pcmd,
- X# endif /* SUPPRESS_WHAT not defined */
- X pidle,
- X pbiff,
- X ptty,
- X pmesg,
- X plocation,
- X NULL
- X}; /* fields2 */
- X
- X/* display when program running from another uid */
- X# ifndef SUID_ROOT
- X# define SUID_ROOT '+'
- X# endif /* SUID_ROOT not defined */
- X
- X# ifndef SUID_OTHER
- X# define SUID_OTHER '!'
- X# endif /* SUID_OTHER not defined */
- X
- X/* when no command found */
- X# ifndef EMPTY_CMD
- X# define EMPTY_CMD "??"
- X# endif /* EMPTY_CMD not defined */
- X
- X# define NO_GROUP ' '
- X
- X# ifdef RELATION
- X# define REL_HEADER 'R'
- X# define GRP_HEADER 'G'
- X# else /* RELATION not defined */
- X# define GRP_HEADER ' ' /* or 'G' */
- X# endif /* RELATION not defined */
- X
- X/****** what to show when there is no person structure ******/
- X# define NO_RELATION ' '
- X
- X# ifdef INQUIRE
- X# define NO_NAME "--No inquire entry--"
- X# else /* INQUIRE not defined */
- X# define NO_NAME "--No password entry--" /* acucntrl locks?!*/
- X# endif /* INQUIRE not defined */
- X
- Xextern LTREE *maketree(); /* from getent.c */
- Xextern struct pr *getcommand(); /* from getcommand.c */
- Xextern char *getttyloc(); /* from gettyloc.c */
- Xextern int pwtree(); /* from getperson.c */
- Xextern whois(), plan(); /* from whois.c */
- Xextern char *gtname(), *intstr(); /* from output.c */
- X
- XLOCAL time_t now; /* current time */
- XLOCAL int personwidth; /* calculated at runtime! */
- X
- X#define UnixBBS
- X
- X#ifdef UnixBBS
- Xchar bbsname[PLEN+1];
- Xchar bbscity[32];
- X#endif
- X
- XLOCAL void /* forwards.. */
- X finguser(),
- X fingheader(),
- X dogecos();
- X
- XGLOBAL void dofinger( t )
- XLTREE *t;
- X{
- X int n;
- X
- X personwidth = PER_WID;
- X# ifdef PID_COL
- X# define PID_WID 6
- X if( sw_pid )
- X personwidth -= PID_WID/2;
- X# endif /* PID_COL defined */
- X
- X# ifdef LASTLOG
- X llopen(); /* open lastlog file */
- X# endif /* LASTLOG defined */
- X
- X time( &now ); /* get current time */
- X if( t == NULL ) /* nothing? */
- X pwtree( (t = maketree()) ); /* get tree of all logged in users */
- X
- X n = treesize( t ); /* count users */
- X if( n == 0 )
- X puts("No one logged in.");
- X else {
- X# ifndef ALWAYS_PRINT_HEADER
- X if( n > 1 ) /* be like oz finger */
- X# endif /* ALWAYS_PRINT_HEADER not defined */
- X fingheader(); /* print header */
- X
- X ptree( t, finguser ); /* print tree */
- X } /* n != 0 */
- X
- X# ifdef LASTLOG
- X llclose(); /* close lastlog file */
- X# endif /* LASTLOG defined */
- X} /* finger */
- X
- XLOCAL BOOL same;
- X
- XLOCAL void finguser(u)
- Xregister LUSER *u;
- X{
- X static PERSON *person;
- X static int incarnations;
- X register FPTR *fp;
- X
- X if( u->u_person != NULL ) {
- X if( (u->u_person->p_flags & P_RC) != 0 ) { /* pw_gecos == "RC" ?*/
- X dogecos( u );
- X return;
- X } /* RC hack */
- X } /* run command */
- X
- X if( u->u_flags & U_NLI ) { /* not logged in */
- X char location[ 50 ];
- X time_t ltime; /* last login time */
- X int host;
- X PERSON *p;
- X
- X p = u->u_person;
- X same = FALSE; /* crock, pass as arg? *TODO* */
- X for( fp = fields; *fp != NULL; fp++ )
- X (*fp)( FALSE, u, p );
- X goalcol++; /* space */
- X
- X /* get last login time from lastlog */
- X if( p == NULL || (p->p_flags & P_NOPWENT) )
- X pstr( "NO PASSWORD ENTRY (EXPIRED ACCOUNT?)" ); /* no pw ent? */
- X# ifdef LASTLOG
- X else if( !lltime( p->p_uid, location, <ime, &host ) || ltime == 0 )
- X pstr( "Login Unknown" ); /* no login time */
- X else { /* have login time. format it */
- X int printed;
- X TTYLOC *tp;
- X
- X pstr( "Login " );
- X pstr( nicetime( ltime ) );
- X
- X /* TODO: if sw_its no "from...." */
- X pstr( " from " );
- X printed = FALSE;
- X inittylocs();
- X if( !host && (tp = findttyloc( location )) != NULL ) {
- X char *s;
- X if( tp->t_short != NULL )
- X s = tp->t_short;
- X else if( tp->t_locn != NULL )
- X s = tp->t_locn;
- X else
- X s = NULL;
- X if( s != NULL ) {
- X printed = TRUE;
- X pstr( s );
- X pchar('{');
- X pstr( location );
- X pchar('}');
- X }
- X } /* foundttyloc */
- X if( !printed )
- X pstr( location );
- X } /* have login time */
- X# endif /* LASTLOG defined */
- X /* if sw_its check plan */
- X pchar('\n');
- X incarnations = 1;
- X } /* not logged in */
- X else { /* is logged in */
- X termstat( u ); /* get tty status (before getcommand) */
- X# ifndef SUPPRESS_WHAT
- X getcommand( u ); /* get command/daemon procs */
- X# endif /* SUPPRESS_WHAT not defined */
- X
- X
- X# ifndef NEVER_SAME
- X if( u->u_person != NULL && u->u_person == person ) /* same person */
- X same = TRUE; /* as before? */
- X else
- X# endif /* NEVER_SAME not defined */
- X same = FALSE;
- X
- X person = u->u_person;
- X if( !same )
- X if( person != NULL )
- X incarnations = person->p_count;
- X else
- X incarnations = 1;
- X
- X for( fp = fields; *fp != NULL; fp++ )
- X (*fp)( FALSE, u, person );
- X goalcol++; /* blank space */
- X for( fp = fields2; *fp != NULL; fp++ )
- X (*fp)( FALSE, u, person );
- X pchar( '\n' );
- X } /* logged in */
- X
- X if( incarnations-- == 1 ) { /* final incarnation? */
- X if( sw_whois ) { /* do whois stuff */
- X whois( u );
- X blankline();
- X }
- X
- X if( u->u_sw.sw_mail || sw_whois || (u->u_flags & U_NLI) ) {
- X mcheck( u );
- X blankline();
- X }
- X
- X if( sw_whois ) {
- X remarks( u );
- X blankline();
- X }
- X
- X /*
- X * show plan if asked for. if user not logged in
- X * show unless prohibited.
- X */
- X if( u->u_sw.sw_plan || (u->u_flags & U_NLI) && !u->u_sw.sw_noplan ) {
- X plan( u );
- X blankline();
- X }
- X } /* last incarnation */
- X} /* finguser */
- X
- XLOCAL void fingheader() {
- X FPTR *fp;
- X
- X for( fp = fields; *fp != NULL; fp++ )
- X (*fp)( TRUE, NULL, NULL );
- X goalcol++; /* blank space */
- X for( fp = fields2; *fp != NULL; fp++ )
- X (*fp)( TRUE, NULL, NULL );
- X pchar( '\n' );
- X fflush(OUTPUT);
- X} /* fingheader */
- X
- XLOCAL void dogecos( u ) /* here if PNAME == "RC" */
- XLUSER *u;
- X{
- X int pid, wpid;
- X
- X pid = fork(); /* no vfork uses stdio */
- X if( pid == 0 ) { /* be childish */
- X PERSON *p;
- X p = u->u_person;
- X
- X chdir(p->p_home);
- X setuid(p->p_uid);
- X setgid(p->p_gid);
- X printf("%s/%s:\n", p->p_home, u->u_user);
- X fflush( stdout );
- X execl(u->u_user, u->u_user, 0);
- X perror("Sorry");
- X exit(1);
- X }
- X else if( pid < 0 )
- X perror("fork");
- X
- X while( (wpid = wait(0)) > 0 && wpid != pid ) /* lassie come home!! */
- X ;
- X} /* dogecos */
- X
- XLOCAL void
- X_pchar( c )
- X char c;
- X{
- X static char linebuf[ 512 ], *lp = linebuf;
- X if( c == '\n' ) {
- X *lp = EOS;
- X outline( linebuf );
- X outcol = goalcol = 0;
- X lp = linebuf;
- X } /* newline */
- X else { /* not newline */
- X if( c == '\t' )
- X outcol = (outcol + 8) & ~7;
- X else
- X outcol++;
- X *lp++ = c;
- X } /* not newline */
- X} /* _pchar */
- X
- XLOCAL void
- Xtogoal() {
- X while( outcol < goalcol ) {
- X int temp;
- X temp = (outcol + 8) & ~7;
- X if( temp <= goalcol )
- X _pchar( '\t' );
- X else
- X _pchar( ' ' );
- X }
- X goalcol = outcol;
- X} /* togoal */
- X
- XLOCAL void
- Xpchar( c )
- X char c;
- X{
- X if( outcol < goalcol ) /* save extra calls */
- X togoal();
- X _pchar( c );
- X} /* pchar */
- X
- XLOCAL void
- Xpstr( s )
- X register char *s;
- X{
- X if( s == NULL )
- X return;
- X togoal();
- X while( *s )
- X _pchar( *s++ );
- X} /* pstr */
- X
- XLOCAL void
- Xpcount( c, s )
- X register c;
- X register char *s;
- X{
- X if( s == NULL )
- X return;
- X togoal();
- X while( c-- && *s )
- X _pchar( *s++ );
- X} /* pcount */
- X
- XLOCAL void
- Xpusername( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( title )
- X pstr( "-User-" );
- X else if( !same )
- X pcount( USER_WID, u->u_user );
- X goalcol += USER_WID;
- X} /* pusername */
- X
- X# ifdef INQUIRE
- X# ifdef RELATION
- XLOCAL void
- Xprelation( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X char rel;
- X if( title )
- X pchar( REL_HEADER ); /* title */
- X else if( !same ) /* not same as last */
- X if( p != NULL ) { /* have person info */
- X rel = p->p_relation;
- X# ifdef REL_SUP
- X if( sw_whois || index(REL_SUP, rel) == NULL ) /* whois or */
- X# endif /* REL_SUP defined */
- X pchar( rel ); /* not suppressed */
- X } /* have person */
- X else
- X pchar( NO_REL );
- X goalcol++;
- X} /* prelation */
- X# endif /* RELATION defined */
- X# endif /* INQUIRE defined */
- X
- XLOCAL void
- Xpgroup( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X
- X if( title )
- X pchar( GRP_HEADER ); /* title */
- X else if( !same && p != NULL ) /* not same and have person */
- X pchar( p->p_group );
- X
- X goalcol++;
- X} /* pgroup */
- X
- XLOCAL void
- Xpspace( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X goalcol++;
- X} /* pspace */
- X
- XLOCAL void
- Xppname( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( title )
- X pstr( "--Full name--" );
- X else
- X#ifdef UnixBBS
- X {
- X if(strcmp(u->u_user,"bbs")==0) {
- X same=FALSE;
- X get_bbsuser(u->u_line,bbsname,bbscity);
- X strcpy(p->p_personal,bbsname);
- X }
- X#endif /* UnixBBS */
- X if( !same )
- X if( p != NULL )
- X pcount( personwidth, p->p_personal );
- X else
- X pstr( NO_NAME );
- X#ifdef UnixBBS
- X }
- X#endif /* UnixBBS */
- X goalcol += personwidth;
- X} /* ppname */
- X
- XLOCAL void
- Xpcmd( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X struct pr *pr;
- X
- X if( title ) {
- X pstr( (sw_its ? "Jobnam" : "-What-") );
- X goalcol += PROG_WID;
- X return;
- X }
- X
- X pr = u->u_command;
- X if( pr != NULL ) {
- X char suid;
- X
- X if( p == NULL || pr->pr_uid == p->p_uid ) /* same uid? */
- X suid = ' '; /* no flag */
- X else if( pr->pr_uid == 0 ) /* super user? */
- X suid = SUID_ROOT; /* flag it */
- X else /* someone else */
- X suid = SUID_OTHER;
- X
- X pcount( PROG_WID-1, pr->pr_cmd ); /* leave one for suid */
- X pchar( suid );
- X } /* pr not null */
- X else
- X pstr( EMPTY_CMD );
- X
- X goalcol += PROG_WID;
- X} /* pcmd */
- X
- X# ifdef PID_COL
- XLOCAL void
- Xppid( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( !sw_pid )
- X return; /* takes no space!! */
- X
- X if( title )
- X pstr(" Pid"); /* two leading spaces */
- X else if( u->u_command != NULL ) {
- X char tbuf[10];
- X sprintf(tbuf, "%5d", u->u_command->pr_pid );
- X pstr( tbuf );
- X }
- X goalcol += PID_WID; /* leave space after */
- X} /* ppid */
- X# endif /* PID_COL defined */
- X
- XLOCAL void
- Xpidle( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( title ) {
- X if( sw_age )
- X pstr( "-On-" );
- X else if( sw_state )
- X pstr( "Stat" );
- X# ifndef PID_COL
- X else if( sw_pid )
- X pstr( " Pid" ); /* two spaces!! */
- X# endif /* PID_COL not defined */
- X else
- X pstr( "Idle" );
- X } /* title */
- X else { /* real thing */
- X char idbuf[ 100 ];
- X strcpy( idbuf, "??" );
- X
- X if( sw_age )
- X intstr(idbuf, now - u->u_time ); /* get time on */
- X else if( sw_state ) {
- X if( u->u_command != NULL )
- X getstate( idbuf, u->u_command ); /* get state */
- X }
- X# ifndef PID_COL
- X else if( sw_pid ) {
- X if( u->u_command != NULL )
- X sprintf(idbuf, "%5d", u->u_command->pr_pid );
- X }
- X# endif /* PID_COL not defined */
- X else if( u->u_flags & U_BADTTY )
- X strcpy( idbuf, "*:**" );
- X else
- X intstr(idbuf, u->u_idle ); /* get idle time */
- X pstr( idbuf );
- X }
- X
- X# ifndef PID_COL
- X if( sw_pid ) /* variable width!! */
- X goalcol += 5;
- X else
- X# endif /* PID_COL not defined */
- X goalcol += 4;
- X} /* pidle */
- X
- XLOCAL void
- Xpbiff( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X /* alright, I lost control. C at its ugliest
- X * nothing - space
- X * biff - dot
- X * hungry - comma
- X * both - semi
- X */
- X if( !title )
- X pchar( " .,;"[ ((u->u_flags & U_BIFF) ? 01 : 0) |
- X ((u->u_flags & U_HUNGRY) ? 02 : 0) ] );
- X goalcol++;
- X} /* pbiff */
- X
- XLOCAL void
- Xptty( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( title )
- X pstr("TTY");
- X else
- X pcount( TTY_WID, gtname( u->u_line ) ); /* get trimmed tty name */
- X goalcol += TTY_WID;
- X} /* ptty */
- X
- XLOCAL void
- Xpmesg( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( !title && (u->u_flags & U_NOWRITE) )
- X pchar( '*' );
- X goalcol++;
- X} /* pmesg */
- X
- XLOCAL void
- Xplocation( title, u, p )
- X BOOL title;
- X LUSER *u;
- X PERSON *p;
- X{
- X if( title )
- X pstr( "-Console Location-" );
- X else
- X#ifdef UnixBBS
- X {
- X if(strcmp(u->u_user,"bbs")==0) {
- X/* get_bbsuser(u->u_line,bbsname,bbscity); */
- X pstr(bbscity);
- X } else
- X#endif /* UnixBBS */
- X pstr( getttyloc( u ) ); /* tty location */
- X#ifdef UnixBBS
- X }
- X#endif /* UnixBBS */
- X /* no new goal!! */
- X} /* plocation */
- X
- X/*
- X * Local variables:
- X * comment-column: 40
- X * End:
- X */
- SHAR_EOF
- if test 14601 -ne "`wc -c < 'finger.c'`"
- then
- echo shar: "error transmitting 'finger.c'" '(should have been 14601 characters)'
- fi
- fi
- echo shar: "extracting 'ubbswho.c'" '( 756 characters)'
- if test -f 'ubbswho.c'
- then
- echo shar: "will not over-write existing file 'ubbswho.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'ubbswho.c'
- X/* Original uwho.c source by Ricardo Pizzi <pizzi@nervous.com>
- X *
- X * Modified for Phil's Finger by Charles Carlson
- X * charles@gremlin.muug.mb.ca or umcarls9@ccu.umanitoba.ca
- X *
- X*/
- X
- X#include <stdio.h>
- X#include <errno.h>
- X#include "bbsuser.h"
- X
- Xvoid get_bbsuser(tty, name,city)
- Xchar *tty;
- Xchar name[33];
- Xchar city[32];
- X{
- X char bbs_rec[48];
- X char names[65];
- X struct User user;
- X FILE *f;
- X
- X sprintf(bbs_rec, "/tmp/bbs.%s", tty);
- X if ((f = fopen(bbs_rec, "r")) != NULL) {
- X fread(&user, sizeof(struct User), 1, f);
- X fclose(f);
- X strcpy(names,user.fname);
- X strcat(names," "); strcat(names,user.lname);
- X strncpy(name,names,32);
- X strcpy(city,user.city);
- X } else {
- X strcpy(name, "[ login ]");
- X strcpy(city, "Unknown");
- X }
- X
- X} /* end get_bbsuser */
- X
- SHAR_EOF
- if test 756 -ne "`wc -c < 'ubbswho.c'`"
- then
- echo shar: "error transmitting 'ubbswho.c'" '(should have been 756 characters)'
- fi
- fi
- echo shar: "extracting 'ymakefile'" '( 7944 characters)'
- if test -f 'ymakefile'
- then
- echo shar: "will not over-write existing file 'ymakefile'"
- else
- sed 's/^X//' << \SHAR_EOF > 'ymakefile'
- X/*
- X * ymakefile -- cpp input file for real work makefile (xmakefile)
- X *
- X * Copyright (C) 1986, 1990 Philip L. Budne
- X *
- X * This file is part of "Phil's Finger Program".
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 1, or (at your option)
- X * any later version.
- X *
- X */
- X
- X/*
- X * $Id: ymakefile,v 3.1 90/07/06 13:21:28 budd Exp $
- X */
- X
- X/* Needed under AIX_RT */
- XSHELL=/bin/sh
- X
- X# include "local.h"
- X
- X/* Used for make depend */
- X/* CCM=cc -M */
- XCCM=./cc-M
- X
- XETAGS=etags
- XDIST=/usr/public/users/budd/finger
- X
- X# ifdef C_COMPILER
- XCC=C_COMPILER
- X# else /* C_COMPILER not defined */
- X# ifdef ibm032
- XCC=pcc
- X# endif /* ibm032 defined */
- X# endif /* C_COMPILER not defined */
- X
- X# ifdef C_FLAGS
- XCC_FLAGS=-O
- X# else /* C_FLAGS not defined */
- XCC_FLAGS=-O
- X# endif /* C_FLAGS not defined */
- X
- X# ifdef LD_FLAGS
- X/* useful for -Bstatic on SunOS4 */
- XLDFLAGS=LD_FLAGS
- X# endif /* LD_FLAGS defined */
- X
- X# ifdef INQUIRE
- XLINQUIRE=./hakinq/libinq.a
- X# endif /* INQUIRE defined */
- X
- X# ifdef USG
- XTERM=-lcurses
- X# else /* USG not defined */
- XTERM=-ltermcap
- X# endif /* USG not defined */
- X
- X# if SunOS >= 40
- X# ifdef i386
- XOSLIBS=-lkvm -lld
- X# else /* i386 not defined */
- XOSLIBS=-lkvm
- X# endif /* i386 not defined */
- X# endif /* SunOS >= 40 */
- X
- X# ifdef sgi
- X/* -lsun for yp -- per spike@world.std.com */
- X# ifdef YELLOW_PAGES
- XOSLIBS=-lbsd -lmld -lsun
- X# else /* YELLOW_PAGES not defined */
- XOSLIBS=-lbsd -lmld
- X# endif /* YELLOW_PAGES not defined */
- XINCLUDES=-I/usr/include/bsd
- X# endif /* sgi defined */
- X
- X# ifdef AIX3
- XOSLIBS=-lcfg -lodm
- X# endif /* AIX3 defined */
- X
- X# ifdef UmaxV
- X/* recent versions have /bsd/usr/include... /bsd/bin/cc... etc */
- XOSLIBS=-laux
- XINCLUDES=-I./include
- X# endif /* UmaxV defined */
- X
- X# ifdef SYSI86 /* Interactive 386/ix */
- XOSLIBS=-linet
- X# endif /* SYSI86 defined */
- X
- X# if Umax == 43
- XOSLIBS=-lld
- X# endif /* Umax == 43 */
- X
- X# ifdef LIB_RESOLVE
- XRESOLVE=LIB_RESOLVE
- X# endif /* LIB_RESOLVE defined */
- X
- X# ifdef INCLUDE_PATH
- XINCLUDES=INCLUDE_PATH
- X# endif /* INCLUDE_PATH defined */
- X
- X# ifdef USG
- XOTHERS=uptime
- X# endif /* USG defined */
- X
- X# ifdef NO_STRINGS_H
- XOSINCLUDES=-I.
- X# endif /* NO_STRINGS_H defined */
- X
- XCFLAGS=$(CC_FLAGS) $(OSINCLUDES) $(INCLUDES)
- X
- X/****************************************************************
- X */
- XALL= xf fingerd ttyloc ttyask $(OTHERS)
- X
- X/* for cleanup */
- XALLBIN= $(ALL) symdate pversion newmanifest mywhoami
- X
- Xall: $(ALL)
- X
- X.PRECIOUS: $(ALL)
- X
- X/****************************************************************
- X * (internet) finger daemon
- X */
- X
- X/* Add new files to MANIFEST!! */
- XFINGERD_O=fingerd.o string.o upper.o
- Xfingerd: $(FINGERD_O)
- X $(CC) $(CFLAGS) -o fingerd $(FINGERD_O) $(RESOLVE) $(OSLIBS) $(LDFLAGS)
- X# ifdef IN_DOT_DAEMON
- X -rm -f in.fingerd
- X ln fingerd in.fingerd
- X# endif /* IN_DOT_DAEMON defined */
- X
- X/****************************************************************
- X * new finger!
- X */
- X/* Add new files to MANIFEST!! */
- XNF_O= args.o daemon.o doremote.o conf.o ubbswho.o finger.o getcommand.o\
- X getent.o getperson.o getttyloc.o getut.o global.o inquire.o\
- X kmem.o lastlog.o locname.o mcheck.o names.o output.o readpr.o\
- X ttylocfile.o read_vmunix.o select.o skip.o string.o switch.o\
- X undomain.o upper.o ustruct.o whois.o whoj.o
- X
- XNF_C= args.c daemon.c doremote.c conf.c ubbswho.c finger.c getcommand.c\
- X getent.c getperson.c getttyloc.c getut.c global.c inquire.c\
- X kmem.c lastlog.c locname.c mcheck.c names.c output.c readpr.c\
- X ttylocfile.c read_vmunix.c select.c skip.c string.c switch.c\
- X undomain.c upper.c ustruct.c whois.c whoj.c
- X
- XNFLIBS= $(TERM) $(RESOLVE) $(LINQUIRE) $(OSLIBS)
- X
- Xxf: $(NF_O) pversion mywhoami
- X ./make-version > version.c
- X $(CC) -c version.c
- X $(CC) $(CFLAGS) -o xf $(NF_O) version.o $(NFLIBS) $(LDFLAGS)
- X
- Xpversion: pversion.c History.h
- X $(CC) $(CFLAGS) -o pversion pversion.c
- X
- X/* whoami is a BSDism. USG systems don't have it */
- Xmywhoami: mywhoami.c
- X $(CC) $(CFLAGS) -o mywhoami mywhoami.c
- X
- X/* uptime replacement for USG systems */
- X# ifdef USG
- Xuptime: uptime.c
- X $(CC) $(CFLAGS) -o uptime uptime.c
- X# endif /* USG defined */
- X
- X# ifdef UmaxV
- X/* newer releases have /bsd/usr/include */
- X$(NF_O): ./include
- X
- X./include:
- X mkdir include include/sys
- X (cd include; \
- X ln -s /usr/include/sys/arpa /usr/include/sys/netinet .; \
- X ln -s /usr/include/sys/aux/syslog.h /usr/include/sys/aux/netdb.h .; \
- X cd sys; ln -s /usr/include/sys/h/socket.h . )
- X# endif /* UmaxV defined */
- X
- Xsymdate.h: symdate syms.h
- X ./symdate syms.h > symdate.h
- X
- Xsymdate: symdate.c
- X $(CC) -o symdate symdate.c
- X
- X/****************
- X * create call graph. (-c and -W are BU local switches)
- X */
- Xxf.calls: $(NF_C)
- X calls -W 4 -c -e -f main $(NF_C) > xf.calls
- X
- XTAGS: $(NF_C)
- X $(ETAGS) $(NF_C)
- X
- X/****************************************************************
- X * Interactive ttyloc asker (front end for ttyloc)
- X */
- X
- XTTYASK= ttyask.o skip.o getttytype.o ttylocfile.o string.o upper.o
- Xttyask: $(TTYASK)
- X $(CC) $(CFLAGS) -o ttyask $(TTYASK) $(OSLIBS) $(LDFLAGS)
- X
- X/****************************************************************
- X * ttyloc setting program
- X */
- X
- XTTYLOC= ttyloc.o locname.o
- Xttyloc: $(TTYLOC)
- X $(CC) $(CFLAGS) -o ttyloc $(TTYLOC) $(OSLIBS) $(LDFLAGS)
- X
- X/****************************************************************
- X * lint picking
- X */
- X
- X/* removed -p -- not in SunOS anymore!! */
- Xlint: llib-lf.ln
- X lint -h llib-lf.ln *.c > LINT 2>&1
- X
- Xllib-lf.ln:
- X lint -Cf $(DEFS) *.c > /dev/null 2>&1
- X
- X/****************************************************************
- X * household chores
- X */
- XKIT=Finger-part
- X/*
- X * be tidy (keeps .o files)
- X *
- X * kill myecho, pversion, and symdate as they are compiled
- X * and don't port across achitectures!
- X */
- X
- Xclean:
- X -rm -f core *~ \#* *.out finger.tar *.bak LOG *.s $(KIT)* \
- X MANIFEST.* myecho pversion symdate mywhoami getgroup checkmode
- X
- Xrealclean: clean
- X -rm -f $(ALLBIN) *.o version.c local.h \
- X xmakefile Install in.fingerd
- X
- X/*
- X * pack up using tar or makekit
- X */
- X
- X/* If you add here, you MUST add to MANIFEST too!! */
- XSAMPLE=SAMPLE-local.h
- XSAMPLE2=SAMPLE-flags
- XSAMPLE3=SAMPLE-conf
- XSAMPLES=$(SAMPLE) $(SAMPLE2) SAMPLE-nttyloc $(SAMPLE3)
- XTAR= VERSION* COPYRIGHT COPYING Cover README\
- X finger.1 ttyloc.1 nttyloc.5 finger.conf.5 fingerd.8c\
- X Makefile ymakefile Install.cpp autoconfig make-version\
- X TODO WISHES COUNT ORIG FINDDEFS DIFFALL COMDEFALL defs.awk cc-M\
- X MODES $(SAMPLES) Distfile\
- X `ls *.[ch] | egrep -v '^(local\.h|version\.c|symdate\.h)'`
- X
- X$(SAMPLE): local.h
- X rm -f $(SAMPLE)
- X cp local.h $(SAMPLE)
- X
- X$(SAMPLE2):
- X -cp local-flags $(SAMPLE2) || touch $(SAMPLE2)
- X
- X$(SAMPLE3):
- X -cp finger.conf $(SAMPLE3) || touch $(SAMPLE3)
- X
- Xfinger.tar tar: $(SAMPLES) pversion mywhoami
- X -rm -f VERSION*
- X# ifndef USG
- X echo "`date` by `./mywhoami` on `hostname`" > VERSION-`pversion`
- X# endif /* USG not defined */
- X tar cf finger.tar $(TAR) hungry
- X
- Xfinger.tar.Z: finger.tar
- X compress -v < finger.tar > finger.tar.Z
- X
- Xsplit: finger.tar.Z
- X uuencode finger.tar.Z < finger.tar.Z | split - finger.tar.Z.uu.
- X
- X/* utter crock to merge file list and MANIFEST! */
- Xnewmanifest: newmanifest.c
- X $(CC) $(CFLAGS) -o newmanifest newmanifest.c
- X
- X/* note; hungry/?* to defeat cpp comment removal!! */
- Xkit: $(SAMPLES) pversion newmanifest
- X -rm -f VERSION* $(KIT)*
- X echo "version `pversion` packed `date` by `whoami` on `hostname`" > \
- X VERSION
- X cp MANIFEST MANIFEST.saved
- X ./newmanifest $(TAR) hungry hungry/?* MANIFEST > nMANIFEST
- X mv nMANIFEST MANIFEST
- X makekit -n $(KIT) -s 64k -m
- X rm -f MANIFEST.BAK
- X
- Xdist: kit split
- X rm -rf $(DIST)
- X mkdir $(DIST) $(DIST)/shar $(DIST)/split
- X cp README COPYING $(DIST)
- X mv finger.tar finger.tar.Z VERSION* $(DIST)
- X mv $(KIT)* $(DIST)/shar
- X mv finger.tar.Z.uu.?? $(DIST)/split
- X
- Xdepend:
- X sed '/^# DO NOT DELETE THIS LINE/q' xmakefile > xmakefile.tmp
- X $(CCM) $(CFLAGS) *.c |\
- X egrep -v '(local\.h|finger\.h|/usr/include|.c:$$|.c$$)' |\
- X sed 's@[ ]*\./@ @' >> xmakefile.tmp
- X mv xmakefile.tmp xmakefile
- X
- X/* ugh. cannot trust make depend the first time around */
- Xnames.o: symdate.h
- SHAR_EOF
- if test 7944 -ne "`wc -c < 'ymakefile'`"
- then
- echo shar: "error transmitting 'ymakefile'" '(should have been 7944 characters)'
- fi
- fi
- exit 0
- # End of shell archive
-
- --
- / Charles Carlson umcarls9@ccu.Umanitoba.CA
- \ This .sig now available on a limited edition 2 record set, for 4 easy
- / installments of $19.95 each. To order, please have your Visa or Mastercard
- \ ready and phone: 1-800-555-1212, or send check or MO to 200-155 Carlton St.
-