aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stty.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r--coreutils/stty.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index b78368e7b..073de847b 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -21,31 +21,7 @@
21 21
22 */ 22 */
23 23
24//#define TEST
25
26#include "busybox.h" 24#include "busybox.h"
27#include <stddef.h>
28#include <termios.h>
29#include <sys/ioctl.h>
30
31#include <sys/param.h>
32#include <unistd.h>
33
34#ifndef STDIN_FILENO
35# define STDIN_FILENO 0
36#endif
37
38#ifndef STDOUT_FILENO
39# define STDOUT_FILENO 1
40#endif
41
42#include <stdlib.h>
43#include <string.h>
44#include <assert.h>
45#include <ctype.h>
46#include <errno.h>
47#include <limits.h>
48#include <fcntl.h>
49 25
50#define STREQ(a, b) (strcmp ((a), (b)) == 0) 26#define STREQ(a, b) (strcmp ((a), (b)) == 0)
51 27
@@ -469,11 +445,7 @@ static const struct suffix_mult stty_suffixes[] = {
469 {NULL, 0 } 445 {NULL, 0 }
470}; 446};
471 447
472#ifndef TEST
473int stty_main(int argc, char **argv) 448int stty_main(int argc, char **argv)
474#else
475int main(int argc, char **argv)
476#endif
477{ 449{
478 struct termios mode; 450 struct termios mode;
479 void (*output_func)(struct termios *); 451 void (*output_func)(struct termios *);
@@ -541,7 +513,7 @@ int main(int argc, char **argv)
541 513
542 device_name = file_name; 514 device_name = file_name;
543 fclose(stdin); 515 fclose(stdin);
544 bb_xopen(device_name, O_RDONLY | O_NONBLOCK); 516 xopen(device_name, O_RDONLY | O_NONBLOCK);
545 if ((fdflags = fcntl(STDIN_FILENO, F_GETFL)) == -1 517 if ((fdflags = fcntl(STDIN_FILENO, F_GETFL)) == -1
546 || fcntl(STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0) 518 || fcntl(STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
547 perror_on_device("%s: couldn't reset non-blocking mode"); 519 perror_on_device("%s: couldn't reset non-blocking mode");
@@ -1299,9 +1271,3 @@ static const char *visible(unsigned int ch)
1299 *bpout = '\0'; 1271 *bpout = '\0';
1300 return (const char *) buf; 1272 return (const char *) buf;
1301} 1273}
1302
1303#ifdef TEST
1304
1305const char *bb_applet_name = "stty";
1306
1307#endif