Commit b0e7d70e authored by Mike Hibler's avatar Mike Hibler

Version of tip (roughly from FreeBSD 4.1.1) hacked for Linux

parent 4295f5f3
CC = gcc -g
# for BSD
#CFLAGS = -O
#LIBS= -lutil
# for Linux
CFLAGS = -O -DLINUX
LIBS= -ldb
OBJS = acu.o acutab.o cmds.o cmdtab.o cu.o hunt.o log.o partab.o \
remote.o tip.o tipout.o value.o vars.o getcap.o
DESTDIR = /usr/site
all: tip
tip: $(OBJS)
$(CC) -o tip $(OBJS) $(LIBS)
tip.static: $(OBJS)
$(CC) -static -o tip.static $(OBJS) $(LIBS)
install:
install -s -c tip $(DESTDIR)/bin/tip
clean:
rm -f $(OBJS) tip tip.static
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: acu.c,v 1.1 2000-12-22 18:48:46 mike Exp $";
#endif /* not lint */
#include "tipconf.h"
#include "tip.h"
#if UNIDIALER
acu_t* unidialer_getmodem (const char *modem_name);
#endif
static acu_t *acu = NOACU;
static int conflag;
static void acuabort();
static acu_t *acutype();
static jmp_buf jmpbuf;
/*
* Establish connection for tip
*
* If DU is true, we should dial an ACU whose type is AT.
* The phone numbers are in PN, and the call unit is in CU.
*
* If the PN is an '@', then we consult the PHONES file for
* the phone numbers. This file is /etc/phones, unless overriden
* by an exported shell variable.
*
* The data base files must be in the format:
* host-name[ \t]*phone-number
* with the possibility of multiple phone numbers
* for a single host acting as a rotary (in the order
* found in the file).
*/
char *
connect()
{
register char *cp = PN;
char *phnum, string[256];
FILE *fd;
int tried = 0;
if (!DU) { /* regular connect message */
if (CM != NOSTR)
xpwrite(FD, CM, size(CM));
logent(value(HOST), "", DV, "call completed");
return (NOSTR);
}
/*
* @ =>'s use data base in PHONES environment variable
* otherwise, use /etc/phones
*/
signal(SIGINT, acuabort);
signal(SIGQUIT, acuabort);
if (setjmp(jmpbuf)) {
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
printf("\ncall aborted\n");
logent(value(HOST), "", "", "call aborted");
if (acu != NOACU) {
boolean(value(VERBOSE)) = FALSE;
if (conflag)
disconnect(NOSTR);
else
(*acu->acu_abort)();
}
return ("interrupt");
}
if ((acu = acutype(AT)) == NOACU)
return ("unknown ACU type");
if (*cp != '@') {
while (*cp) {
for (phnum = cp; *cp && *cp != ','; cp++)
;
if (*cp)
*cp++ = '\0';
if ((conflag = (*acu->acu_dialer)(phnum, CU))) {
if (CM != NOSTR)
xpwrite(FD, CM, size(CM));
logent(value(HOST), phnum, acu->acu_name,
"call completed");
return (NOSTR);
} else
logent(value(HOST), phnum, acu->acu_name,
"call failed");
tried++;
}
} else {
if ((fd = fopen(PH, "r")) == NOFILE) {
printf("%s: ", PH);
return ("can't open phone number file");
}
while (fgets(string, sizeof(string), fd) != NOSTR) {
for (cp = string; !any(*cp, " \t\n"); cp++)
;
if (*cp == '\n') {
fclose(fd);
return ("unrecognizable host name");
}
*cp++ = '\0';
if (strcmp(string, value(HOST)))
continue;
while (any(*cp, " \t"))
cp++;
if (*cp == '\n') {
fclose(fd);
return ("missing phone number");
}
for (phnum = cp; *cp && *cp != ',' && *cp != '\n'; cp++)
;
if (*cp)
*cp++ = '\0';
if ((conflag = (*acu->acu_dialer)(phnum, CU))) {
fclose(fd);
if (CM != NOSTR)
xpwrite(FD, CM, size(CM));
logent(value(HOST), phnum, acu->acu_name,
"call completed");
return (NOSTR);
} else
logent(value(HOST), phnum, acu->acu_name,
"call failed");
tried++;
}
fclose(fd);
}
if (!tried)
logent(value(HOST), "", acu->acu_name, "missing phone number");
else
(*acu->acu_abort)();
return (tried ? "call failed" : "missing phone number");
}
void
disconnect(reason)
char *reason;
{
if (!conflag) {
logent(value(HOST), "", DV, "call terminated");
return;
}
if (reason == NOSTR) {
logent(value(HOST), "", acu->acu_name, "call terminated");
if (boolean(value(VERBOSE)))
printf("\r\ndisconnecting...");
} else
logent(value(HOST), "", acu->acu_name, reason);
(*acu->acu_disconnect)();
}
static void
acuabort(s)
{
signal(s, SIG_IGN);
longjmp(jmpbuf, 1);
}
static acu_t *
acutype(s)
register char *s;
{
register acu_t *p;
extern acu_t acutable[];
for (p = acutable; p->acu_name != '\0'; p++)
if (!strcmp(s, p->acu_name))
return (p);
#if UNIDIALER
return unidialer_getmodem (s);
#else
return (NOACU);
#endif
}
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)acutab.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: acutab.c,v 1.1 2000-12-22 18:48:46 mike Exp $";
#endif /* not lint */
#include "tipconf.h"
#include "tip.h"
extern int df02_dialer(), df03_dialer(),
biz31f_dialer(),
biz31w_dialer(),
biz22f_dialer(),
biz22w_dialer(),
ven_dialer(),
hay_dialer(),
cour_dialer(),
multitech_dialer(),
t3000_dialer(),
v3451_dialer(),
v831_dialer(),
dn_dialer();
extern void df_disconnect(), df_abort(),
biz31_disconnect(), biz31_abort(),
biz22_disconnect(), biz22_abort(),
ven_disconnect(), ven_abort(),
hay_disconnect(), hay_abort(),
cour_disconnect(), cour_abort(),
multitech_disconnect(), multitech_abort(),
t3000_disconnect(), t3000_abort(),
v3451_disconnect(), v3451_abort(),
v831_disconnect(), v831_abort(),
dn_disconnect(), dn_abort();
acu_t acutable[] = {
#if BIZ1031
"biz31f", biz31f_dialer, biz31_disconnect, biz31_abort,
"biz31w", biz31w_dialer, biz31_disconnect, biz31_abort,
#endif
#if BIZ1022
"biz22f", biz22f_dialer, biz22_disconnect, biz22_abort,
"biz22w", biz22w_dialer, biz22_disconnect, biz22_abort,
#endif
#if DF02
"df02", df02_dialer, df_disconnect, df_abort,
#endif
#if DF03
"df03", df03_dialer, df_disconnect, df_abort,
#endif
#if DN11
"dn11", dn_dialer, dn_disconnect, dn_abort,
#endif
#if VENTEL
"ventel",ven_dialer, ven_disconnect, ven_abort,
#endif
#if HAYES
"hayes",hay_dialer, hay_disconnect, hay_abort,
#endif
#if COURIER
"courier",cour_dialer, cour_disconnect, cour_abort,
#endif
#if MULTITECH
"multitech",multitech_dialer, multitech_disconnect, multitech_abort,
#endif
#if T3000
"t3000",t3000_dialer, t3000_disconnect, t3000_abort,
#endif
#if V3451
#if !V831
"vadic",v3451_dialer, v3451_disconnect, v3451_abort,
#endif
"v3451",v3451_dialer, v3451_disconnect, v3451_abort,
#endif
#if V831
#if !V3451
"vadic",v831_dialer, v831_disconnect, v831_abort,
#endif
"v831",v831_dialer, v831_disconnect, v831_abort,
#endif
0, 0, 0, 0
};
This diff is collapsed.
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: cmdtab.c,v 1.1 2000-12-22 18:48:47 mike Exp $";
#endif /* not lint */
#include "tipconf.h"
#include "tip.h"
extern int shell(), getfl(), sendfile(), chdirectory();
extern int finish(), help(), pipefile(), pipeout(), variable();
extern int cu_take(), cu_put(), dollar(), genbrk(), suspend();
esctable_t etable[] = {
{ '!', NORM, "shell", shell },
{ '<', NORM, "receive file from remote host", getfl },
{ '>', NORM, "send file to remote host", sendfile },
{ 't', NORM, "take file from remote UNIX", cu_take },
{ 'p', NORM, "put file to remote UNIX", cu_put },
{ '|', NORM, "pipe remote file", pipefile },
{ '$', NORM, "pipe local command to remote host", pipeout },
#if CONNECT
{ 'C', NORM, "connect program to remote host",consh },
#endif
{ 'c', NORM, "change directory", chdirectory },
{ '.', NORM, "exit from tip", finish },
{CTRL('d'),NORM,"exit from tip", finish },
{CTRL('y'),NORM,"suspend tip (local+remote)", suspend },
{CTRL('z'),NORM,"suspend tip (local only)", suspend },
{ 's', NORM, "set variable", variable },
{ '?', NORM, "get this summary", help },
{ '#', NORM, "send break", genbrk },
{ 0, 0, 0 }
};
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: cu.c,v 1.1 2000-12-22 18:48:47 mike Exp $";
#endif /* not lint */
#include "tipconf.h"
#include "tip.h"
void cleanup();
#if INCLUDE_CU_INTERFACE
/*
* Botch the interface to look like cu's
*/
cumain(argc, argv)
char *argv[];
{
register int i;
static char sbuf[12];
if (argc < 2) {
printf("usage: cu telno [-t] [-s speed] [-a acu] [-l line] [-#]\n");
exit(8);
}
CU = DV = NOSTR;
BR = DEFBR;
for (; argc > 1; argv++, argc--) {
if (argv[1][0] != '-')
PN = argv[1];
else switch (argv[1][1]) {
case 't':
HW = 1, DU = -1;
--argc;
continue;
case 'a':
CU = argv[2]; ++argv; --argc;
break;
case 's':
if (argc < 3 || speed(atoi(argv[2])) == 0) {
fprintf(stderr, "cu: unsupported speed %s\n",
argv[2]);
exit(3);
}
BR = atoi(argv[2]); ++argv; --argc;
break;
case 'l':
DV = argv[2]; ++argv; --argc;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (CU)
CU[strlen(CU)-1] = argv[1][1];
if (DV)
DV[strlen(DV)-1] = argv[1][1];
break;
default:
printf("Bad flag %s", argv[1]);
break;
}
}
signal(SIGINT, cleanup);
signal(SIGQUIT, cleanup);
signal(SIGHUP, cleanup);
signal(SIGTERM, cleanup);
/*
* The "cu" host name is used to define the
* attributes of the generic dialer.
*/
(void)snprintf(sbuf, sizeof(sbuf), "cu%d", BR);
if ((i = hunt(sbuf)) == 0) {
printf("all ports busy\n");
exit(3);
}
if (i == -1) {
printf("link down\n");
(void)uu_unlock(uucplock);
exit(3);
}
setbuf(stdout, NULL);
loginit();
user_uid();
vinit();
setparity("none");
boolean(value(VERBOSE)) = 0;
if (HW)
ttysetup(speed(BR));
if (connect()) {
printf("Connect failed\n");
daemon_uid();
(void)uu_unlock(uucplock);
exit(1);
}
if (!HW)
ttysetup(speed(BR));
}
#endif /* INCLUDE_CU_INTERFACE */
This diff is collapsed.
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: hunt.c,v 1.1 2000-12-22 18:48:47 mike Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <err.h>
#ifndef LINUX
#include <libutil.h>
#endif
#include "tipconf.h"
#include "tip.h"
extern char *getremote();
extern char *rindex();
static jmp_buf deadline;
static int deadfl;
void
dead()
{
deadfl = 1;
longjmp(deadline, 1);
}
int
hunt(name)
char *name;
{
register char *cp;
sig_t f;
int res;
f = signal(SIGALRM, dead);
while ((cp = getremote(name))) {
deadfl = 0;
uucplock = rindex(cp, '/')+1;
if ((res = uu_lock(uucplock)) != UU_LOCK_OK) {
if (res != UU_LOCK_INUSE)
fprintf(stderr, "uu_lock: %s\n", uu_lockerr(res));
continue;
}
/*
* Straight through call units, such as the BIZCOMP,
* VADIC and the DF, must indicate they're hardwired in
* order to get an open file descriptor placed in FD.
* Otherwise, as for a DN-11, the open will have to
* be done in the "open" routine.
*/
if (!HW)
break;
if (setjmp(deadline) == 0) {
alarm(10);
FD = open(cp, O_RDWR);
}
alarm(0);
if (FD < 0) {
warn("%s", cp);
deadfl = 1;
}
if (!deadfl) {
ioctl(FD, TIOCEXCL, 0);
#if HAVE_TERMIOS
{
struct termios t;
if (tcgetattr(FD, &t) == 0) {
t.c_cflag |= HUPCL;
(void)tcsetattr(FD, TCSANOW, &t);
}
}
#else /* HAVE_TERMIOS */
#ifdef TIOCHPCL
ioctl(FD, TIOCHPCL, 0);
#endif
#endif /* HAVE_TERMIOS */
signal(SIGALRM, SIG_DFL);
return ((int)cp);
}
(void)uu_unlock(uucplock);
}
signal(SIGALRM, f);
return (deadfl ? -1 : (int)cp);
}
/*
* Copyright (c) 1983, 1993
* 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.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: log.c,v 1.1 2000-12-22 18:48:48 mike Exp $";
#endif /* not lint */
#include "tipconf.h"
#include "tip.h"
#include <err.h>
#if ACULOG
static FILE *flog = NULL;
/*
* Log file maintenance routines
*/
void
logent(group, num, acu, message)
char *group, *num, *acu, *message;
{
char *user, *timestamp;
struct passwd *pwd;
time_t t;
if (flog == NULL)
return;
if (flock(fileno(flog), LOCK_EX) < 0) {
warn("flock");