#include <sys/ioctl.h>
#include <errno.h>
#include <sys/stat.h>
-#include <sys/signal.h>
+#include <signal.h>
#include <fcntl.h>
#include <stdarg.h>
#include <ctype.h>
#define TCGETA TCGETS
#define TCSETA TCSETS
#define TCSETAW TCSETSW
-#endif
-
- /*
- * This program tries to not use the standard-i/o library. This keeps the
- * executable small on systems that do not have shared libraries (System V
- * Release <3).
- */
-#ifndef BUFSIZ
-#define BUFSIZ 1024
#endif
/*
struct chardata *cp);
static int caps_lock(const char *s);
static int bcode(const char *s);
-static void error(const char *fmt, ...) __attribute__ ((noreturn));
+static void error(const char *fmt, ...) ATTRIBUTE_NORETURN;
#ifdef SYSV_STYLE
#ifdef CONFIG_FEATURE_UTMP
/* Open the tty as standard input. */
+ close(0);
debug("open(2)\n");
fd = open(tty, O_RDWR | O_NONBLOCK, 0);
- if (dup2(fd, STDIN_FILENO) == -1)
+ if (fd != 0)
error("/dev/%s: cannot open as standard input: %m", tty);
- close(fd);
-
} else {
/*
/* return NULL on failure, logname on success */
static char *get_logname(struct options *op, struct chardata *cp, struct termio *tp)
{
- static char logname[BUFSIZ];
+#define logname bb_common_bufsiz1
char *bp;
- char c; /* input character, full eight bits */
- char ascval; /* low 7 bits of input character */
- int bits; /* # of "1" bits per character */
- int mask; /* mask with 1 bit up */
+ char c; /* input character, full eight bits */
+ char ascval; /* low 7 bits of input character */
+ int bits; /* # of "1" bits per character */
+ int mask; /* mask with 1 bit up */
static char *erase[] = { /* backspace-space-backspace */
"\010\040\010", /* space parity */
"\010\040\010", /* odd parity */