#include <sys/cdefs.h>
#ifndef lint
-static const char copyright[] =
+__unused static const char copyright[] =
"@(#) Copyright (c) 1980, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#if 0
static char sccsid[] = "@(#)from: main.c 8.1 (Berkeley) 6/20/93";
#endif
-static const char rcsid[] =
+__unused static const char rcsid[] =
"$FreeBSD: src/libexec/getty/main.c,v 1.47 2005/04/06 17:42:24 stefanf Exp $";
#endif /* not lint */
#include <errno.h>
#include <fcntl.h>
#include <locale.h>
+#ifdef __APPLE__
+#include <util.h>
+#else
#include <libutil.h>
+#endif
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>
#define OBUFSIZ 128
#define TABBUFSIZ 512
-char defent[TABBUFSIZ];
-char tabent[TABBUFSIZ];
const char *tname;
char *env[128];
static void putpad(const char *);
static void puts(const char *);
static void timeoverrun(int);
-static char *getline(int);
+static char *getty_getline(int);
static void setttymode(int);
static int opentty(const char *, int);
limit.rlim_cur = GETTY_TIMEOUT;
(void)setrlimit(RLIMIT_CPU, &limit);
- gettable("default", defent);
+ gettable("default");
gendefaults();
tname = "default";
if (argc > 1)
int i, rfds;
struct timeval to;
- rfds = 1 << 0; /* FD_SET */
- to.tv_sec = RT;
- to.tv_usec = 0;
- i = select(32, (fd_set*)&rfds, (fd_set*)NULL,
- (fd_set*)NULL, RT ? &to : NULL);
- if (i < 0) {
+ rfds = 1 << 0; /* FD_SET */
+ to.tv_sec = RT;
+ to.tv_usec = 0;
+ i = select(32, (fd_set*)&rfds, (fd_set*)NULL,
+ (fd_set*)NULL, RT ? &to : NULL);
+ if (i < 0) {
syslog(LOG_ERR, "select %s: %m", ttyn);
} else if (i == 0) {
syslog(LOG_NOTICE, "recycle tty %s", ttyn);
for (;;) {
/*
- * if a delay was specified then sleep for that
+ * if a delay was specified then sleep for that
* number of seconds before writing the initial prompt
*/
if (first_sleep && DE) {
if ((fd = open(IF, O_RDONLY)) != -1) {
char * cp;
- while ((cp = getline(fd)) != NULL) {
+ while ((cp = getty_getline(fd)) != NULL) {
putf(cp);
}
close(fd);
}
sleep(60);
}
- if (login_tty(i) < 0) {
+ if (login_tty(i) < 0) {
#ifndef __APPLE__
if (daemon(0,0) < 0) {
syslog(LOG_ERR,"daemon: %m");
}
static void
-defttymode()
+defttymode(void)
{
/* Start with default tty settings. */
static char *
-getline(int fd)
+getty_getline(int fd)
{
int i = 0;
static char linebuf[512];
static void
dogettytab()
{
-
/* Read the database entry. */
- gettable(tname, tabent);
+ gettable(tname);
/*
* Avoid inheriting the parity values from the default entry