ntpd: default to FEATURE_NTP_AUTH=y
[oweals/busybox.git] / coreutils / stty.c
index 2292fa5eeb57404ec429a94227916935c323cca5..424d909cf3c40a4601f7481c1ab6e56e7ed11e9e 100644 (file)
@@ -1,24 +1,25 @@
 /* vi: set sw=4 ts=4: */
-/* stty -- change and print terminal line settings
-   Copyright (C) 1990-1999 Free Software Foundation, Inc.
-
-   Licensed under GPLv2 or later, see file LICENSE in this source tree.
-*/
+/*
+ * stty -- change and print terminal line settings
+ * Copyright (C) 1990-1999 Free Software Foundation, Inc.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
 /* Usage: stty [-ag] [-F device] [setting...]
-
  Options:
  -a Write all current settings to stdout in human-readable form.
  -g Write all current settings to stdout in stty-readable form.
  -F Open and use the specified device instead of stdin
-
  If no args are given, write to stdout the baud rate and settings that
  have been changed from their defaults.  Mode reading and changes
  are done on the specified device, or stdin if none was specified.
-
  David MacKenzie <djm@gnu.ai.mit.edu>
-
  Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
-*/
+ *
* Options:
* -a Write all current settings to stdout in human-readable form.
* -g Write all current settings to stdout in stty-readable form.
* -F Open and use the specified device instead of stdin
+ *
* If no args are given, write to stdout the baud rate and settings that
* have been changed from their defaults.  Mode reading and changes
* are done on the specified device, or stdin if none was specified.
+ *
* David MacKenzie <djm@gnu.ai.mit.edu>
+ *
* Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
+ */
 //config:config STTY
 //config:      bool "stty (8.6 kb)"
 //config:      default y
 #ifndef CRDLY
 # define CRDLY 0
 #endif
+#ifndef CMSPAR
+# define CMSPAR 0
+#endif
 #ifndef CRTSCTS
 # define CRTSCTS 0
 #endif
@@ -352,6 +356,9 @@ static const char mode_name[] ALIGN1 =
 #endif
        MI_ENTRY("parenb",   control,     REV,               PARENB,     0 )
        MI_ENTRY("parodd",   control,     REV,               PARODD,     0 )
+#if CMSPAR
+       MI_ENTRY("cmspar",   control,     REV,               CMSPAR,     0 )
+#endif
        MI_ENTRY("cs5",      control,     0,                 CS5,     CSIZE)
        MI_ENTRY("cs6",      control,     0,                 CS6,     CSIZE)
        MI_ENTRY("cs7",      control,     0,                 CS7,     CSIZE)
@@ -476,6 +483,10 @@ static const char mode_name[] ALIGN1 =
 #if ECHOKE
        MI_ENTRY("echoke",   local,       SANE_SET   | REV,  ECHOKE,     0 )
        MI_ENTRY("crtkill",  local,       OMIT       | REV,  ECHOKE,     0 )
+#endif
+       MI_ENTRY("flusho",   local,       SANE_UNSET | REV,  FLUSHO,     0 )
+#ifdef EXTPROC
+       MI_ENTRY("extproc",  local,       SANE_UNSET | REV,  EXTPROC,    0 )
 #endif
        ;
 
@@ -509,6 +520,9 @@ static const struct mode_info mode_info[] = {
 #endif
        MI_ENTRY("parenb",   control,     REV,               PARENB,     0 )
        MI_ENTRY("parodd",   control,     REV,               PARODD,     0 )
+#if CMSPAR
+       MI_ENTRY("cmspar",   control,     REV,               CMSPAR,     0 )
+#endif
        MI_ENTRY("cs5",      control,     0,                 CS5,     CSIZE)
        MI_ENTRY("cs6",      control,     0,                 CS6,     CSIZE)
        MI_ENTRY("cs7",      control,     0,                 CS7,     CSIZE)
@@ -633,6 +647,10 @@ static const struct mode_info mode_info[] = {
 #if ECHOKE
        MI_ENTRY("echoke",   local,       SANE_SET   | REV,  ECHOKE,     0 )
        MI_ENTRY("crtkill",  local,       OMIT       | REV,  ECHOKE,     0 )
+#endif
+       MI_ENTRY("flusho",   local,       SANE_UNSET | REV,  FLUSHO,     0 )
+#ifdef EXTPROC
+       MI_ENTRY("extproc",  local,       SANE_UNSET | REV,  EXTPROC,    0 )
 #endif
 };
 
@@ -785,6 +803,7 @@ struct globals {
 } FIX_ALIASING;
 #define G (*(struct globals*)bb_common_bufsiz1)
 #define INIT_G() do { \
+       setup_common_bufsiz(); \
        G.device_name = bb_msg_standard_input; \
        G.max_col = 80; \
        G.current_col = 0; /* we are noexec, must clear */ \
@@ -835,10 +854,11 @@ static void wrapf(const char *message, ...)
                G.current_col++;
                if (buf[0] != '\n') {
                        if (G.current_col + buflen >= G.max_col) {
-                               bb_putchar('\n');
                                G.current_col = 0;
-                       } else
+                               bb_putchar('\n');
+                       } else {
                                bb_putchar(' ');
+                       }
                }
        }
        fputs(buf, stdout);