/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <utmpx.h>
#include <pwd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <locale.h>
#include <stdlib.h>
#include <limits.h>
#include <wctype.h>
#include <errno.h>
#include <syslog.h>
#define FALSE 0
/*
* DATE-TIME format
* %a abbreviated weekday name
* %b abbreviated month name
* %e day of month
* %H hour - 24 hour clock
* %M minute
* %S second
*
*/
extern char myhostname[];
extern char progname[];
static void openfail(int);
static void eof(void);
static void setsignals(void (*)());
int
{
register int bad = 0;
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
/* Set "rterm" to location where receipient's terminal will go. */
/*
* strip any realm or instance from principal so we can match against unix
* userid.
*/
/*
* Scan through the "utmpx" file for the
* entry for the person we want to send to.
*/
setutxent();
/* Try to open up the line to the receipient's terminal. */
alarm(5);
alarm(0);
/* Catch signals SIGHUP, SIGINT, SIGQUIT, and SIGTERM, and send */
/* <EOT> message to receipient. */
/* Get the time of day, convert it to a string and throw away the */
/* year information at the end of the string. */
"\r\n\007\007\007\tMessage from %s@%s [ %s ] ...\r\n"),
sleep(1);
/* Since "end of file" received, send <EOT> message to receipient. */
eof();
}
}
}
/* Did we find a place to talk to? If we were looking for a */
/* specific spot and didn't find it, complain and log it. */
if (*rterm == '\0')
if (bad > 0) {
return (1);
}
endutxent();
return (0);
}
static void
void (*catch)();
{
}
static void
openfail(int i)
{
extern char *rterm;
#if 0
gettext("Timeout trying to open line(%s).\n"),
rterm);
#endif
exit(1);
}
static void
eof(void)
{
}