#define SANE_UNSET 2 /* Unset in 'sane' mode. */
#define REV 4 /* Can be turned off by prepending '-'. */
#define OMIT 8 /* Don't display value. */
+#define NO_SETATTR 16 /* tcsetattr not used to set mode bits. */
/* Each mode. */
struct mode_info
{"echoke", local, SANE_SET | REV, ECHOKE, 0},
{"crtkill", local, REV | OMIT, ECHOKE, 0},
#endif
-#ifdef EXTPROC
+#if defined TIOCEXT
+ {"extproc", local, SANE_UNSET | REV | NO_SETATTR, EXTPROC, 0},
+#elif defined EXTPROC
{"extproc", local, SANE_UNSET | REV, EXTPROC, 0},
#endif
{
char const *arg = argv[k];
bool match_found = false;
+ bool not_set_attr = false;
bool reversed = false;
int i;
{
if (STREQ (arg, mode_info[i].name))
{
- match_found = set_mode (&mode_info[i], reversed, &mode);
- require_set_attr = true;
+ if ((mode_info[i].flags & NO_SETATTR) == 0)
+ {
+ match_found = set_mode (&mode_info[i], reversed, &mode);
+ require_set_attr = true;
+ }
+ else
+ match_found = not_set_attr = true;
break;
}
}
}
}
}
- if (!match_found)
+ if (!match_found || not_set_attr)
{
if (STREQ (arg, "ispeed"))
{
require_set_attr = true;
}
#ifdef TIOCEXT
- else if (STREQ (arg, "extproc") || STREQ (arg, "-extproc"))
+ /* This is the BSD interface to "extproc".
+ Even though it's an lflag, an ioctl is used to set it. */
+ else if (STREQ (arg, "extproc"))
{
- /* This is the BSD interface to "extproc". */
- int val = *arg != '-';
+ int val = ! reversed;
if (ioctl (STDIN_FILENO, TIOCEXT, &val) != 0)
{
for (i = 0; mode_info[i].name != NULL; ++i)
{
+ if (mode_info[i].flags & NO_SETATTR)
+ continue;
+
if (mode_info[i].flags & SANE_SET)
{
bitsp = mode_type_flag (mode_info[i].type, mode);