another @command{stty} command to restore the current settings. This option
may not be used in combination with any line settings.
+@item -I
+@itemx --immediate
+@opindex -I
+@opindex --immediate
+@cindex nonblocking @command{stty} setting
+Apply settings without first waiting for pending output to be transmitted.
+In some cases the system may be in a state where serial transmission
+is not possible.
+For example, if the system has received the @samp{DC3} character
+with @code{ixon} (software flow control) enabled, then @command{stty} would
+block without this option.
+
@end table
Many settings can be turned off by preceding them with a @samp{-}.
{"all", no_argument, NULL, 'a'},
{"save", no_argument, NULL, 'g'},
{"file", required_argument, NULL, 'F'},
+ {"immediate", no_argument, NULL, 'I'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
else
{
printf (_("\
-Usage: %s [-F DEVICE | --file=DEVICE] [SETTING]...\n\
+Usage: %s [-F DEVICE | --file=DEVICE] [-I] [SETTING]...\n\
or: %s [-F DEVICE | --file=DEVICE] [-a|--all]\n\
or: %s [-F DEVICE | --file=DEVICE] [-g|--save]\n\
"),
-a, --all print all current settings in human-readable form\n\
-g, --save print all current settings in a stty-readable form\n\
-F, --file=DEVICE open and use the specified DEVICE instead of stdin\n\
+"), stdout);
+ fputs (_("\
+ -I, --immediate apply setting without waiting for pending transmission\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
bool noargs = true;
char *file_name = NULL;
const char *device_name;
+ int tcsetattr_options = TCSADRAIN;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
stty parses options, be sure it still works with combinations of
short and long options, --, POSIXLY_CORRECT, etc. */
- while ((optc = getopt_long (argc - argi, argv + argi, "-agF:",
+ while ((optc = getopt_long (argc - argi, argv + argi, "-agF:I",
longopts, NULL))
!= -1)
{
file_name = optarg;
break;
+ case 'I':
+ tcsetattr_options = TCSANOW;
+ break;
+
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
spurious difference in an uninitialized portion of the structure. */
static struct termios new_mode;
- if (tcsetattr (STDIN_FILENO, TCSADRAIN, &mode))
+ if (tcsetattr (STDIN_FILENO, tcsetattr_options, &mode))
error (EXIT_FAILURE, errno, "%s", quotef (device_name));
/* POSIX (according to Zlotnick's book) tcsetattr returns zero if