#include <utmp.h>
#endif
-#define _PATH_LOGIN "/bin/login"
-
-#ifdef CONFIG_SYSLOGD
-#include <sys/param.h>
-#endif
-
-
/*
* Some heuristics to find out what environment we are in: if it is not
* System V, assume it is SunOS 4.
#endif
#endif /* LOGIN_PROCESS */
+#ifdef SYSV_STYLE
+#include <sys/utsname.h>
+#include <time.h>
+#endif
+
/*
* Things you may want to modify.
*
* and for line editing at the same time.
*/
-#ifdef SYSV_STYLE
-#include <sys/utsname.h>
-#include <time.h>
-#endif
+#define _PATH_LOGIN "/bin/login"
/* If ISSUE is not defined, agetty will never display the contents of the
* /etc/issue file. You will not want to spit out large "issue" files at the
#define DEBUGTERM "/dev/ttyp0"
FILE *dbf;
#else
-#define debug(s) /* nothing */
+#define debug(s) /* nothing */
#endif
parse_speeds(op, argv[1]); /* baud rate(s) */
}
- if (argc > 2 && argv[2])
+ if (argv[2])
setenv("TERM", argv[2], 1);
debug("exiting parseargs\n");
}
}
#else
- (void) chown(tty, 0, 0); /* root, sys */
- (void) chmod(tty, 0622); /* crw--w--w- */
+ chown(tty, 0, 0); /* root, sys */
+ chmod(tty, 0622); /* crw--w--w- */
#endif
if (chdir_to_root)
xchdir("/");
*/
#ifdef __linux__
/* flush input and output queues, important for modems! */
- (void) ioctl(0, TCFLSH, TCIOFLUSH);
+ ioctl(0, TCFLSH, TCIOFLUSH);
#endif
tp->c_cflag = CS8 | HUPCL | CREAD | speed;
tp->c_cflag |= CRTSCTS;
#endif
- (void) ioctl(0, TCSETA, tp);
+ ioctl(0, TCSETA, tp);
/* go to blocking input even in local mode */
fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NONBLOCK);
tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */
vmin = tp->c_cc[VMIN];
tp->c_cc[VMIN] = 0; /* don't block if queue empty */
- (void) ioctl(0, TCSETA, tp);
+ ioctl(0, TCSETA, tp);
/*
* Wait for a while, then read everything the modem has said so far and
* try to extract the speed of the dial-in call.
*/
- (void) sleep(1);
+ sleep(1);
nread = read(0, buf, sizeof(buf) - 1);
if (nread > 0) {
buf[nread] = '\0';
tp->c_iflag = iflag;
tp->c_cc[VMIN] = vmin;
- (void) ioctl(0, TCSETA, tp);
+ ioctl(0, TCSETA, tp);
}
/* next_speed - select next baud rate */
baud_index = (baud_index + 1) % op->numspeed;
tp->c_cflag &= ~CBAUD;
tp->c_cflag |= op->speeds[baud_index];
- (void) ioctl(0, TCSETA, tp);
+ ioctl(0, TCSETA, tp);
}
/* Flush pending input (esp. after parsing or switching the baud rate). */
- (void) sleep(1);
- (void) ioctl(0, TCFLSH, TCIFLUSH);
+ sleep(1);
+ ioctl(0, TCFLSH, TCIFLUSH);
/* Prompt for and read a login name. */
case '#':
cp->erase = ascval; /* set erase character */
if (bp > logname) {
- (void) write(1, erase[cp->parity], 3);
+ write(1, erase[cp->parity], 3);
bp--;
}
break;
case '@':
cp->kill = ascval; /* set kill character */
while (bp > logname) {
- (void) write(1, erase[cp->parity], 3);
+ write(1, erase[cp->parity], 3);
bp--;
}
break;
} else if (bp - logname >= sizeof(logname) - 1) {
bb_error_msg_and_die("%s: input overrun", op->tty);
} else {
- (void) write(1, &c, 1); /* echo the character */
+ write(1, &c, 1); /* echo the character */
*bp++ = ascval; /* and store it */
}
break;
{
int nullfd;
char *logname = NULL; /* login name, given to /bin/login */
+ // TODO: we can merge these into "struct local"
+ // (will reduce parameter passing)
struct chardata chardata; /* set by get_logname() */
struct termio termio; /* terminal mode bits */
- static struct options options = {
+ struct options options = {
0, /* show /etc/issue (SYSV_STYLE) */
0, /* no timeout */
_PATH_LOGIN, /* default login program */
/* Set the optional timer. */
if (options.timeout)
- (void) alarm(options.timeout);
+ alarm(options.timeout);
/* optionally wait for CR or LF before writing /etc/issue */
if (options.flags & F_WAITCRLF) {
/* Disable timer. */
if (options.timeout)
- (void) alarm(0);
+ alarm(0);
/* Finalize the termio settings. */
/* Now the newline character should be properly written. */
- (void) write(1, "\n", 1);
+ write(1, "\n", 1);
/* Let the login program take care of password validation. */
- (void) execl(options.login, options.login, "--", logname, (char *) 0);
+ execl(options.login, options.login, "--", logname, (char *) 0);
bb_error_msg_and_die("%s: can't exec %s", options.tty, options.login);
}