diff options
| author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-07-30 06:01:37 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-01 03:31:35 +0200 |
| commit | 138ce54c9c1930348bc842be781accd7c50c2cef (patch) | |
| tree | 0992cad1a2167bba7dfda1a70e20cf3c90489513 /coreutils | |
| parent | 63c2e7ecc0c7a72b2ed35475a8d18d3052039ce4 (diff) | |
| download | busybox-w32-138ce54c9c1930348bc842be781accd7c50c2cef.tar.gz busybox-w32-138ce54c9c1930348bc842be781accd7c50c2cef.tar.bz2 busybox-w32-138ce54c9c1930348bc842be781accd7c50c2cef.zip | |
stty: sort out preprocessor conditionals
* Move the definitions of missing constants to the top of the file.
* Fix undefined IDX_xxx on missing termios constants.
* FreeBSD has TABDLY, TAB0 and TAB3, but no TAB1 or TAB2
* Omit the definition of set_window_size() if TIOCGWINSZ is not available.
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/Config.src | 1 | ||||
| -rw-r--r-- | coreutils/stty.c | 339 |
2 files changed, 214 insertions, 126 deletions
diff --git a/coreutils/Config.src b/coreutils/Config.src index 780b73fda..0eb70af55 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src | |||
| @@ -607,7 +607,6 @@ config FEATURE_STAT_FORMAT | |||
| 607 | config STTY | 607 | config STTY |
| 608 | bool "stty" | 608 | bool "stty" |
| 609 | default y | 609 | default y |
| 610 | depends on PLATFORM_LINUX | ||
| 611 | help | 610 | help |
| 612 | stty is used to change and print terminal line settings. | 611 | stty is used to change and print terminal line settings. |
| 613 | 612 | ||
diff --git a/coreutils/stty.c b/coreutils/stty.c index c40d718af..33f7b21dd 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
| @@ -115,6 +115,113 @@ | |||
| 115 | # define CSTATUS Control('t') | 115 | # define CSTATUS Control('t') |
| 116 | #endif | 116 | #endif |
| 117 | 117 | ||
| 118 | /* Save us from #ifdef forest plague */ | ||
| 119 | #ifndef BSDLY | ||
| 120 | # define BSDLY 0 | ||
| 121 | #endif | ||
| 122 | #ifndef CIBAUD | ||
| 123 | # define CIBAUD 0 | ||
| 124 | #endif | ||
| 125 | #ifndef CRDLY | ||
| 126 | # define CRDLY 0 | ||
| 127 | #endif | ||
| 128 | #ifndef CRTSCTS | ||
| 129 | # define CRTSCTS 0 | ||
| 130 | #endif | ||
| 131 | #ifndef ECHOCTL | ||
| 132 | # define ECHOCTL 0 | ||
| 133 | #endif | ||
| 134 | #ifndef ECHOKE | ||
| 135 | # define ECHOKE 0 | ||
| 136 | #endif | ||
| 137 | #ifndef ECHOPRT | ||
| 138 | # define ECHOPRT 0 | ||
| 139 | #endif | ||
| 140 | #ifndef FFDLY | ||
| 141 | # define FFDLY 0 | ||
| 142 | #endif | ||
| 143 | #ifndef IEXTEN | ||
| 144 | # define IEXTEN 0 | ||
| 145 | #endif | ||
| 146 | #ifndef IMAXBEL | ||
| 147 | # define IMAXBEL 0 | ||
| 148 | #endif | ||
| 149 | #ifndef IUCLC | ||
| 150 | # define IUCLC 0 | ||
| 151 | #endif | ||
| 152 | #ifndef IXANY | ||
| 153 | # define IXANY 0 | ||
| 154 | #endif | ||
| 155 | #ifndef NLDLY | ||
| 156 | # define NLDLY 0 | ||
| 157 | #endif | ||
| 158 | #ifndef OCRNL | ||
| 159 | # define OCRNL 0 | ||
| 160 | #endif | ||
| 161 | #ifndef OFDEL | ||
| 162 | # define OFDEL 0 | ||
| 163 | #endif | ||
| 164 | #ifndef OFILL | ||
| 165 | # define OFILL 0 | ||
| 166 | #endif | ||
| 167 | #ifndef OLCUC | ||
| 168 | # define OLCUC 0 | ||
| 169 | #endif | ||
| 170 | #ifndef ONLCR | ||
| 171 | # define ONLCR 0 | ||
| 172 | #endif | ||
| 173 | #ifndef ONLRET | ||
| 174 | # define ONLRET 0 | ||
| 175 | #endif | ||
| 176 | #ifndef ONOCR | ||
| 177 | # define ONOCR 0 | ||
| 178 | #endif | ||
| 179 | #ifndef OXTABS | ||
| 180 | # define OXTABS 0 | ||
| 181 | #endif | ||
| 182 | #ifndef TABDLY | ||
| 183 | # define TABDLY 0 | ||
| 184 | #endif | ||
| 185 | #ifndef TAB1 | ||
| 186 | # define TAB1 0 | ||
| 187 | #endif | ||
| 188 | #ifndef TAB2 | ||
| 189 | # define TAB2 0 | ||
| 190 | #endif | ||
| 191 | #ifndef TOSTOP | ||
| 192 | # define TOSTOP 0 | ||
| 193 | #endif | ||
| 194 | #ifndef VDSUSP | ||
| 195 | # define VDSUSP 0 | ||
| 196 | #endif | ||
| 197 | #ifndef VEOL2 | ||
| 198 | # define VEOL2 0 | ||
| 199 | #endif | ||
| 200 | #ifndef VFLUSHO | ||
| 201 | # define VFLUSHO 0 | ||
| 202 | #endif | ||
| 203 | #ifndef VLNEXT | ||
| 204 | # define VLNEXT 0 | ||
| 205 | #endif | ||
| 206 | #ifndef VREPRINT | ||
| 207 | # define VREPRINT 0 | ||
| 208 | #endif | ||
| 209 | #ifndef VSTATUS | ||
| 210 | # define VSTATUS 0 | ||
| 211 | #endif | ||
| 212 | #ifndef VSWTCH | ||
| 213 | # define VSWTCH 0 | ||
| 214 | #endif | ||
| 215 | #ifndef VTDLY | ||
| 216 | # define VTDLY 0 | ||
| 217 | #endif | ||
| 218 | #ifndef VWERASE | ||
| 219 | # define VWERASE 0 | ||
| 220 | #endif | ||
| 221 | #ifndef XCASE | ||
| 222 | # define XCASE 0 | ||
| 223 | #endif | ||
| 224 | |||
| 118 | /* Which speeds to set */ | 225 | /* Which speeds to set */ |
| 119 | enum speed_setting { | 226 | enum speed_setting { |
| 120 | input_speed, output_speed, both_speeds | 227 | input_speed, output_speed, both_speeds |
| @@ -167,13 +274,13 @@ enum { | |||
| 167 | IDX_cbreak, | 274 | IDX_cbreak, |
| 168 | IDX_crt, | 275 | IDX_crt, |
| 169 | IDX_dec, | 276 | IDX_dec, |
| 170 | #ifdef IXANY | 277 | #if IXANY |
| 171 | IDX_decctlq, | 278 | IDX_decctlq, |
| 172 | #endif | 279 | #endif |
| 173 | #if defined(TABDLY) || defined(OXTABS) | 280 | #if TABDLY || OXTABS |
| 174 | IDX_tabs, | 281 | IDX_tabs, |
| 175 | #endif | 282 | #endif |
| 176 | #if defined(XCASE) && defined(IUCLC) && defined(OLCUC) | 283 | #if XCASE && IUCLC && OLCUC |
| 177 | IDX_lcase, | 284 | IDX_lcase, |
| 178 | IDX_LCASE, | 285 | IDX_LCASE, |
| 179 | #endif | 286 | #endif |
| @@ -196,13 +303,13 @@ static const char mode_name[] = | |||
| 196 | MI_ENTRY("cbreak", combination, REV | OMIT, 0, 0 ) | 303 | MI_ENTRY("cbreak", combination, REV | OMIT, 0, 0 ) |
| 197 | MI_ENTRY("crt", combination, OMIT, 0, 0 ) | 304 | MI_ENTRY("crt", combination, OMIT, 0, 0 ) |
| 198 | MI_ENTRY("dec", combination, OMIT, 0, 0 ) | 305 | MI_ENTRY("dec", combination, OMIT, 0, 0 ) |
| 199 | #ifdef IXANY | 306 | #if IXANY |
| 200 | MI_ENTRY("decctlq", combination, REV | OMIT, 0, 0 ) | 307 | MI_ENTRY("decctlq", combination, REV | OMIT, 0, 0 ) |
| 201 | #endif | 308 | #endif |
| 202 | #if defined(TABDLY) || defined(OXTABS) | 309 | #if TABDLY || OXTABS |
| 203 | MI_ENTRY("tabs", combination, REV | OMIT, 0, 0 ) | 310 | MI_ENTRY("tabs", combination, REV | OMIT, 0, 0 ) |
| 204 | #endif | 311 | #endif |
| 205 | #if defined(XCASE) && defined(IUCLC) && defined(OLCUC) | 312 | #if XCASE && IUCLC && OLCUC |
| 206 | MI_ENTRY("lcase", combination, REV | OMIT, 0, 0 ) | 313 | MI_ENTRY("lcase", combination, REV | OMIT, 0, 0 ) |
| 207 | MI_ENTRY("LCASE", combination, REV | OMIT, 0, 0 ) | 314 | MI_ENTRY("LCASE", combination, REV | OMIT, 0, 0 ) |
| 208 | #endif | 315 | #endif |
| @@ -217,7 +324,7 @@ static const char mode_name[] = | |||
| 217 | MI_ENTRY("cstopb", control, REV, CSTOPB, 0 ) | 324 | MI_ENTRY("cstopb", control, REV, CSTOPB, 0 ) |
| 218 | MI_ENTRY("cread", control, SANE_SET | REV, CREAD, 0 ) | 325 | MI_ENTRY("cread", control, SANE_SET | REV, CREAD, 0 ) |
| 219 | MI_ENTRY("clocal", control, REV, CLOCAL, 0 ) | 326 | MI_ENTRY("clocal", control, REV, CLOCAL, 0 ) |
| 220 | #ifdef CRTSCTS | 327 | #if CRTSCTS |
| 221 | MI_ENTRY("crtscts", control, REV, CRTSCTS, 0 ) | 328 | MI_ENTRY("crtscts", control, REV, CRTSCTS, 0 ) |
| 222 | #endif | 329 | #endif |
| 223 | MI_ENTRY("ignbrk", input, SANE_UNSET | REV, IGNBRK, 0 ) | 330 | MI_ENTRY("ignbrk", input, SANE_UNSET | REV, IGNBRK, 0 ) |
| @@ -232,74 +339,78 @@ static const char mode_name[] = | |||
| 232 | MI_ENTRY("ixon", input, REV, IXON, 0 ) | 339 | MI_ENTRY("ixon", input, REV, IXON, 0 ) |
| 233 | MI_ENTRY("ixoff", input, SANE_UNSET | REV, IXOFF, 0 ) | 340 | MI_ENTRY("ixoff", input, SANE_UNSET | REV, IXOFF, 0 ) |
| 234 | MI_ENTRY("tandem", input, REV | OMIT, IXOFF, 0 ) | 341 | MI_ENTRY("tandem", input, REV | OMIT, IXOFF, 0 ) |
| 235 | #ifdef IUCLC | 342 | #if IUCLC |
| 236 | MI_ENTRY("iuclc", input, SANE_UNSET | REV, IUCLC, 0 ) | 343 | MI_ENTRY("iuclc", input, SANE_UNSET | REV, IUCLC, 0 ) |
| 237 | #endif | 344 | #endif |
| 238 | #ifdef IXANY | 345 | #if IXANY |
| 239 | MI_ENTRY("ixany", input, SANE_UNSET | REV, IXANY, 0 ) | 346 | MI_ENTRY("ixany", input, SANE_UNSET | REV, IXANY, 0 ) |
| 240 | #endif | 347 | #endif |
| 241 | #ifdef IMAXBEL | 348 | #if IMAXBEL |
| 242 | MI_ENTRY("imaxbel", input, SANE_SET | REV, IMAXBEL, 0 ) | 349 | MI_ENTRY("imaxbel", input, SANE_SET | REV, IMAXBEL, 0 ) |
| 243 | #endif | 350 | #endif |
| 244 | MI_ENTRY("opost", output, SANE_SET | REV, OPOST, 0 ) | 351 | MI_ENTRY("opost", output, SANE_SET | REV, OPOST, 0 ) |
| 245 | #ifdef OLCUC | 352 | #if OLCUC |
| 246 | MI_ENTRY("olcuc", output, SANE_UNSET | REV, OLCUC, 0 ) | 353 | MI_ENTRY("olcuc", output, SANE_UNSET | REV, OLCUC, 0 ) |
| 247 | #endif | 354 | #endif |
| 248 | #ifdef OCRNL | 355 | #if OCRNL |
| 249 | MI_ENTRY("ocrnl", output, SANE_UNSET | REV, OCRNL, 0 ) | 356 | MI_ENTRY("ocrnl", output, SANE_UNSET | REV, OCRNL, 0 ) |
| 250 | #endif | 357 | #endif |
| 251 | #ifdef ONLCR | 358 | #if ONLCR |
| 252 | MI_ENTRY("onlcr", output, SANE_SET | REV, ONLCR, 0 ) | 359 | MI_ENTRY("onlcr", output, SANE_SET | REV, ONLCR, 0 ) |
| 253 | #endif | 360 | #endif |
| 254 | #ifdef ONOCR | 361 | #if ONOCR |
| 255 | MI_ENTRY("onocr", output, SANE_UNSET | REV, ONOCR, 0 ) | 362 | MI_ENTRY("onocr", output, SANE_UNSET | REV, ONOCR, 0 ) |
| 256 | #endif | 363 | #endif |
| 257 | #ifdef ONLRET | 364 | #if ONLRET |
| 258 | MI_ENTRY("onlret", output, SANE_UNSET | REV, ONLRET, 0 ) | 365 | MI_ENTRY("onlret", output, SANE_UNSET | REV, ONLRET, 0 ) |
| 259 | #endif | 366 | #endif |
| 260 | #ifdef OFILL | 367 | #if OFILL |
| 261 | MI_ENTRY("ofill", output, SANE_UNSET | REV, OFILL, 0 ) | 368 | MI_ENTRY("ofill", output, SANE_UNSET | REV, OFILL, 0 ) |
| 262 | #endif | 369 | #endif |
| 263 | #ifdef OFDEL | 370 | #if OFDEL |
| 264 | MI_ENTRY("ofdel", output, SANE_UNSET | REV, OFDEL, 0 ) | 371 | MI_ENTRY("ofdel", output, SANE_UNSET | REV, OFDEL, 0 ) |
| 265 | #endif | 372 | #endif |
| 266 | #ifdef NLDLY | 373 | #if NLDLY |
| 267 | MI_ENTRY("nl1", output, SANE_UNSET, NL1, NLDLY) | 374 | MI_ENTRY("nl1", output, SANE_UNSET, NL1, NLDLY) |
| 268 | MI_ENTRY("nl0", output, SANE_SET, NL0, NLDLY) | 375 | MI_ENTRY("nl0", output, SANE_SET, NL0, NLDLY) |
| 269 | #endif | 376 | #endif |
| 270 | #ifdef CRDLY | 377 | #if CRDLY |
| 271 | MI_ENTRY("cr3", output, SANE_UNSET, CR3, CRDLY) | 378 | MI_ENTRY("cr3", output, SANE_UNSET, CR3, CRDLY) |
| 272 | MI_ENTRY("cr2", output, SANE_UNSET, CR2, CRDLY) | 379 | MI_ENTRY("cr2", output, SANE_UNSET, CR2, CRDLY) |
| 273 | MI_ENTRY("cr1", output, SANE_UNSET, CR1, CRDLY) | 380 | MI_ENTRY("cr1", output, SANE_UNSET, CR1, CRDLY) |
| 274 | MI_ENTRY("cr0", output, SANE_SET, CR0, CRDLY) | 381 | MI_ENTRY("cr0", output, SANE_SET, CR0, CRDLY) |
| 275 | #endif | 382 | #endif |
| 276 | 383 | ||
| 277 | #ifdef TABDLY | 384 | #if TABDLY |
| 278 | MI_ENTRY("tab3", output, SANE_UNSET, TAB3, TABDLY) | 385 | MI_ENTRY("tab3", output, SANE_UNSET, TAB3, TABDLY) |
| 386 | # if TAB2 | ||
| 279 | MI_ENTRY("tab2", output, SANE_UNSET, TAB2, TABDLY) | 387 | MI_ENTRY("tab2", output, SANE_UNSET, TAB2, TABDLY) |
| 388 | # endif | ||
| 389 | # if TAB1 | ||
| 280 | MI_ENTRY("tab1", output, SANE_UNSET, TAB1, TABDLY) | 390 | MI_ENTRY("tab1", output, SANE_UNSET, TAB1, TABDLY) |
| 391 | # endif | ||
| 281 | MI_ENTRY("tab0", output, SANE_SET, TAB0, TABDLY) | 392 | MI_ENTRY("tab0", output, SANE_SET, TAB0, TABDLY) |
| 282 | #else | 393 | #else |
| 283 | # ifdef OXTABS | 394 | # if OXTABS |
| 284 | MI_ENTRY("tab3", output, SANE_UNSET, OXTABS, 0 ) | 395 | MI_ENTRY("tab3", output, SANE_UNSET, OXTABS, 0 ) |
| 285 | # endif | 396 | # endif |
| 286 | #endif | 397 | #endif |
| 287 | 398 | ||
| 288 | #ifdef BSDLY | 399 | #if BSDLY |
| 289 | MI_ENTRY("bs1", output, SANE_UNSET, BS1, BSDLY) | 400 | MI_ENTRY("bs1", output, SANE_UNSET, BS1, BSDLY) |
| 290 | MI_ENTRY("bs0", output, SANE_SET, BS0, BSDLY) | 401 | MI_ENTRY("bs0", output, SANE_SET, BS0, BSDLY) |
| 291 | #endif | 402 | #endif |
| 292 | #ifdef VTDLY | 403 | #if VTDLY |
| 293 | MI_ENTRY("vt1", output, SANE_UNSET, VT1, VTDLY) | 404 | MI_ENTRY("vt1", output, SANE_UNSET, VT1, VTDLY) |
| 294 | MI_ENTRY("vt0", output, SANE_SET, VT0, VTDLY) | 405 | MI_ENTRY("vt0", output, SANE_SET, VT0, VTDLY) |
| 295 | #endif | 406 | #endif |
| 296 | #ifdef FFDLY | 407 | #if FFDLY |
| 297 | MI_ENTRY("ff1", output, SANE_UNSET, FF1, FFDLY) | 408 | MI_ENTRY("ff1", output, SANE_UNSET, FF1, FFDLY) |
| 298 | MI_ENTRY("ff0", output, SANE_SET, FF0, FFDLY) | 409 | MI_ENTRY("ff0", output, SANE_SET, FF0, FFDLY) |
| 299 | #endif | 410 | #endif |
| 300 | MI_ENTRY("isig", local, SANE_SET | REV, ISIG, 0 ) | 411 | MI_ENTRY("isig", local, SANE_SET | REV, ISIG, 0 ) |
| 301 | MI_ENTRY("icanon", local, SANE_SET | REV, ICANON, 0 ) | 412 | MI_ENTRY("icanon", local, SANE_SET | REV, ICANON, 0 ) |
| 302 | #ifdef IEXTEN | 413 | #if IEXTEN |
| 303 | MI_ENTRY("iexten", local, SANE_SET | REV, IEXTEN, 0 ) | 414 | MI_ENTRY("iexten", local, SANE_SET | REV, IEXTEN, 0 ) |
| 304 | #endif | 415 | #endif |
| 305 | MI_ENTRY("echo", local, SANE_SET | REV, ECHO, 0 ) | 416 | MI_ENTRY("echo", local, SANE_SET | REV, ECHO, 0 ) |
| @@ -308,21 +419,21 @@ static const char mode_name[] = | |||
| 308 | MI_ENTRY("echok", local, SANE_SET | REV, ECHOK, 0 ) | 419 | MI_ENTRY("echok", local, SANE_SET | REV, ECHOK, 0 ) |
| 309 | MI_ENTRY("echonl", local, SANE_UNSET | REV, ECHONL, 0 ) | 420 | MI_ENTRY("echonl", local, SANE_UNSET | REV, ECHONL, 0 ) |
| 310 | MI_ENTRY("noflsh", local, SANE_UNSET | REV, NOFLSH, 0 ) | 421 | MI_ENTRY("noflsh", local, SANE_UNSET | REV, NOFLSH, 0 ) |
| 311 | #ifdef XCASE | 422 | #if XCASE |
| 312 | MI_ENTRY("xcase", local, SANE_UNSET | REV, XCASE, 0 ) | 423 | MI_ENTRY("xcase", local, SANE_UNSET | REV, XCASE, 0 ) |
| 313 | #endif | 424 | #endif |
| 314 | #ifdef TOSTOP | 425 | #if TOSTOP |
| 315 | MI_ENTRY("tostop", local, SANE_UNSET | REV, TOSTOP, 0 ) | 426 | MI_ENTRY("tostop", local, SANE_UNSET | REV, TOSTOP, 0 ) |
| 316 | #endif | 427 | #endif |
| 317 | #ifdef ECHOPRT | 428 | #if ECHOPRT |
| 318 | MI_ENTRY("echoprt", local, SANE_UNSET | REV, ECHOPRT, 0 ) | 429 | MI_ENTRY("echoprt", local, SANE_UNSET | REV, ECHOPRT, 0 ) |
| 319 | MI_ENTRY("prterase", local, REV | OMIT, ECHOPRT, 0 ) | 430 | MI_ENTRY("prterase", local, REV | OMIT, ECHOPRT, 0 ) |
| 320 | #endif | 431 | #endif |
| 321 | #ifdef ECHOCTL | 432 | #if ECHOCTL |
| 322 | MI_ENTRY("echoctl", local, SANE_SET | REV, ECHOCTL, 0 ) | 433 | MI_ENTRY("echoctl", local, SANE_SET | REV, ECHOCTL, 0 ) |
| 323 | MI_ENTRY("ctlecho", local, REV | OMIT, ECHOCTL, 0 ) | 434 | MI_ENTRY("ctlecho", local, REV | OMIT, ECHOCTL, 0 ) |
| 324 | #endif | 435 | #endif |
| 325 | #ifdef ECHOKE | 436 | #if ECHOKE |
| 326 | MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) | 437 | MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) |
| 327 | MI_ENTRY("crtkill", local, REV | OMIT, ECHOKE, 0 ) | 438 | MI_ENTRY("crtkill", local, REV | OMIT, ECHOKE, 0 ) |
| 328 | #endif | 439 | #endif |
| @@ -346,13 +457,13 @@ static const struct mode_info mode_info[] = { | |||
| 346 | MI_ENTRY("cbreak", combination, REV | OMIT, 0, 0 ) | 457 | MI_ENTRY("cbreak", combination, REV | OMIT, 0, 0 ) |
| 347 | MI_ENTRY("crt", combination, OMIT, 0, 0 ) | 458 | MI_ENTRY("crt", combination, OMIT, 0, 0 ) |
| 348 | MI_ENTRY("dec", combination, OMIT, 0, 0 ) | 459 | MI_ENTRY("dec", combination, OMIT, 0, 0 ) |
| 349 | #ifdef IXANY | 460 | #if IXANY |
| 350 | MI_ENTRY("decctlq", combination, REV | OMIT, 0, 0 ) | 461 | MI_ENTRY("decctlq", combination, REV | OMIT, 0, 0 ) |
| 351 | #endif | 462 | #endif |
| 352 | #if defined(TABDLY) || defined(OXTABS) | 463 | #if TABDLY || OXTABS |
| 353 | MI_ENTRY("tabs", combination, REV | OMIT, 0, 0 ) | 464 | MI_ENTRY("tabs", combination, REV | OMIT, 0, 0 ) |
| 354 | #endif | 465 | #endif |
| 355 | #if defined(XCASE) && defined(IUCLC) && defined(OLCUC) | 466 | #if XCASE && IUCLC && OLCUC |
| 356 | MI_ENTRY("lcase", combination, REV | OMIT, 0, 0 ) | 467 | MI_ENTRY("lcase", combination, REV | OMIT, 0, 0 ) |
| 357 | MI_ENTRY("LCASE", combination, REV | OMIT, 0, 0 ) | 468 | MI_ENTRY("LCASE", combination, REV | OMIT, 0, 0 ) |
| 358 | #endif | 469 | #endif |
| @@ -367,7 +478,7 @@ static const struct mode_info mode_info[] = { | |||
| 367 | MI_ENTRY("cstopb", control, REV, CSTOPB, 0 ) | 478 | MI_ENTRY("cstopb", control, REV, CSTOPB, 0 ) |
| 368 | MI_ENTRY("cread", control, SANE_SET | REV, CREAD, 0 ) | 479 | MI_ENTRY("cread", control, SANE_SET | REV, CREAD, 0 ) |
| 369 | MI_ENTRY("clocal", control, REV, CLOCAL, 0 ) | 480 | MI_ENTRY("clocal", control, REV, CLOCAL, 0 ) |
| 370 | #ifdef CRTSCTS | 481 | #if CRTSCTS |
| 371 | MI_ENTRY("crtscts", control, REV, CRTSCTS, 0 ) | 482 | MI_ENTRY("crtscts", control, REV, CRTSCTS, 0 ) |
| 372 | #endif | 483 | #endif |
| 373 | MI_ENTRY("ignbrk", input, SANE_UNSET | REV, IGNBRK, 0 ) | 484 | MI_ENTRY("ignbrk", input, SANE_UNSET | REV, IGNBRK, 0 ) |
| @@ -382,74 +493,78 @@ static const struct mode_info mode_info[] = { | |||
| 382 | MI_ENTRY("ixon", input, REV, IXON, 0 ) | 493 | MI_ENTRY("ixon", input, REV, IXON, 0 ) |
| 383 | MI_ENTRY("ixoff", input, SANE_UNSET | REV, IXOFF, 0 ) | 494 | MI_ENTRY("ixoff", input, SANE_UNSET | REV, IXOFF, 0 ) |
| 384 | MI_ENTRY("tandem", input, REV | OMIT, IXOFF, 0 ) | 495 | MI_ENTRY("tandem", input, REV | OMIT, IXOFF, 0 ) |
| 385 | #ifdef IUCLC | 496 | #if IUCLC |
| 386 | MI_ENTRY("iuclc", input, SANE_UNSET | REV, IUCLC, 0 ) | 497 | MI_ENTRY("iuclc", input, SANE_UNSET | REV, IUCLC, 0 ) |
| 387 | #endif | 498 | #endif |
| 388 | #ifdef IXANY | 499 | #if IXANY |
| 389 | MI_ENTRY("ixany", input, SANE_UNSET | REV, IXANY, 0 ) | 500 | MI_ENTRY("ixany", input, SANE_UNSET | REV, IXANY, 0 ) |
| 390 | #endif | 501 | #endif |
| 391 | #ifdef IMAXBEL | 502 | #if IMAXBEL |
| 392 | MI_ENTRY("imaxbel", input, SANE_SET | REV, IMAXBEL, 0 ) | 503 | MI_ENTRY("imaxbel", input, SANE_SET | REV, IMAXBEL, 0 ) |
| 393 | #endif | 504 | #endif |
| 394 | MI_ENTRY("opost", output, SANE_SET | REV, OPOST, 0 ) | 505 | MI_ENTRY("opost", output, SANE_SET | REV, OPOST, 0 ) |
| 395 | #ifdef OLCUC | 506 | #if OLCUC |
| 396 | MI_ENTRY("olcuc", output, SANE_UNSET | REV, OLCUC, 0 ) | 507 | MI_ENTRY("olcuc", output, SANE_UNSET | REV, OLCUC, 0 ) |
| 397 | #endif | 508 | #endif |
| 398 | #ifdef OCRNL | 509 | #if OCRNL |
| 399 | MI_ENTRY("ocrnl", output, SANE_UNSET | REV, OCRNL, 0 ) | 510 | MI_ENTRY("ocrnl", output, SANE_UNSET | REV, OCRNL, 0 ) |
| 400 | #endif | 511 | #endif |
| 401 | #ifdef ONLCR | 512 | #if ONLCR |
| 402 | MI_ENTRY("onlcr", output, SANE_SET | REV, ONLCR, 0 ) | 513 | MI_ENTRY("onlcr", output, SANE_SET | REV, ONLCR, 0 ) |
| 403 | #endif | 514 | #endif |
| 404 | #ifdef ONOCR | 515 | #if ONOCR |
| 405 | MI_ENTRY("onocr", output, SANE_UNSET | REV, ONOCR, 0 ) | 516 | MI_ENTRY("onocr", output, SANE_UNSET | REV, ONOCR, 0 ) |
| 406 | #endif | 517 | #endif |
| 407 | #ifdef ONLRET | 518 | #if ONLRET |
| 408 | MI_ENTRY("onlret", output, SANE_UNSET | REV, ONLRET, 0 ) | 519 | MI_ENTRY("onlret", output, SANE_UNSET | REV, ONLRET, 0 ) |
| 409 | #endif | 520 | #endif |
| 410 | #ifdef OFILL | 521 | #if OFILL |
| 411 | MI_ENTRY("ofill", output, SANE_UNSET | REV, OFILL, 0 ) | 522 | MI_ENTRY("ofill", output, SANE_UNSET | REV, OFILL, 0 ) |
| 412 | #endif | 523 | #endif |
| 413 | #ifdef OFDEL | 524 | #if OFDEL |
| 414 | MI_ENTRY("ofdel", output, SANE_UNSET | REV, OFDEL, 0 ) | 525 | MI_ENTRY("ofdel", output, SANE_UNSET | REV, OFDEL, 0 ) |
| 415 | #endif | 526 | #endif |
| 416 | #ifdef NLDLY | 527 | #if NLDLY |
| 417 | MI_ENTRY("nl1", output, SANE_UNSET, NL1, NLDLY) | 528 | MI_ENTRY("nl1", output, SANE_UNSET, NL1, NLDLY) |
| 418 | MI_ENTRY("nl0", output, SANE_SET, NL0, NLDLY) | 529 | MI_ENTRY("nl0", output, SANE_SET, NL0, NLDLY) |
| 419 | #endif | 530 | #endif |
| 420 | #ifdef CRDLY | 531 | #if CRDLY |
| 421 | MI_ENTRY("cr3", output, SANE_UNSET, CR3, CRDLY) | 532 | MI_ENTRY("cr3", output, SANE_UNSET, CR3, CRDLY) |
| 422 | MI_ENTRY("cr2", output, SANE_UNSET, CR2, CRDLY) | 533 | MI_ENTRY("cr2", output, SANE_UNSET, CR2, CRDLY) |
| 423 | MI_ENTRY("cr1", output, SANE_UNSET, CR1, CRDLY) | 534 | MI_ENTRY("cr1", output, SANE_UNSET, CR1, CRDLY) |
| 424 | MI_ENTRY("cr0", output, SANE_SET, CR0, CRDLY) | 535 | MI_ENTRY("cr0", output, SANE_SET, CR0, CRDLY) |
| 425 | #endif | 536 | #endif |
| 426 | 537 | ||
| 427 | #ifdef TABDLY | 538 | #if TABDLY |
| 428 | MI_ENTRY("tab3", output, SANE_UNSET, TAB3, TABDLY) | 539 | MI_ENTRY("tab3", output, SANE_UNSET, TAB3, TABDLY) |
| 540 | # if TAB2 | ||
| 429 | MI_ENTRY("tab2", output, SANE_UNSET, TAB2, TABDLY) | 541 | MI_ENTRY("tab2", output, SANE_UNSET, TAB2, TABDLY) |
| 542 | # endif | ||
| 543 | # if TAB1 | ||
| 430 | MI_ENTRY("tab1", output, SANE_UNSET, TAB1, TABDLY) | 544 | MI_ENTRY("tab1", output, SANE_UNSET, TAB1, TABDLY) |
| 545 | # endif | ||
| 431 | MI_ENTRY("tab0", output, SANE_SET, TAB0, TABDLY) | 546 | MI_ENTRY("tab0", output, SANE_SET, TAB0, TABDLY) |
| 432 | #else | 547 | #else |
| 433 | # ifdef OXTABS | 548 | # if OXTABS |
| 434 | MI_ENTRY("tab3", output, SANE_UNSET, OXTABS, 0 ) | 549 | MI_ENTRY("tab3", output, SANE_UNSET, OXTABS, 0 ) |
| 435 | # endif | 550 | # endif |
| 436 | #endif | 551 | #endif |
| 437 | 552 | ||
| 438 | #ifdef BSDLY | 553 | #if BSDLY |
| 439 | MI_ENTRY("bs1", output, SANE_UNSET, BS1, BSDLY) | 554 | MI_ENTRY("bs1", output, SANE_UNSET, BS1, BSDLY) |
| 440 | MI_ENTRY("bs0", output, SANE_SET, BS0, BSDLY) | 555 | MI_ENTRY("bs0", output, SANE_SET, BS0, BSDLY) |
| 441 | #endif | 556 | #endif |
| 442 | #ifdef VTDLY | 557 | #if VTDLY |
| 443 | MI_ENTRY("vt1", output, SANE_UNSET, VT1, VTDLY) | 558 | MI_ENTRY("vt1", output, SANE_UNSET, VT1, VTDLY) |
| 444 | MI_ENTRY("vt0", output, SANE_SET, VT0, VTDLY) | 559 | MI_ENTRY("vt0", output, SANE_SET, VT0, VTDLY) |
| 445 | #endif | 560 | #endif |
| 446 | #ifdef FFDLY | 561 | #if FFDLY |
| 447 | MI_ENTRY("ff1", output, SANE_UNSET, FF1, FFDLY) | 562 | MI_ENTRY("ff1", output, SANE_UNSET, FF1, FFDLY) |
| 448 | MI_ENTRY("ff0", output, SANE_SET, FF0, FFDLY) | 563 | MI_ENTRY("ff0", output, SANE_SET, FF0, FFDLY) |
| 449 | #endif | 564 | #endif |
| 450 | MI_ENTRY("isig", local, SANE_SET | REV, ISIG, 0 ) | 565 | MI_ENTRY("isig", local, SANE_SET | REV, ISIG, 0 ) |
| 451 | MI_ENTRY("icanon", local, SANE_SET | REV, ICANON, 0 ) | 566 | MI_ENTRY("icanon", local, SANE_SET | REV, ICANON, 0 ) |
| 452 | #ifdef IEXTEN | 567 | #if IEXTEN |
| 453 | MI_ENTRY("iexten", local, SANE_SET | REV, IEXTEN, 0 ) | 568 | MI_ENTRY("iexten", local, SANE_SET | REV, IEXTEN, 0 ) |
| 454 | #endif | 569 | #endif |
| 455 | MI_ENTRY("echo", local, SANE_SET | REV, ECHO, 0 ) | 570 | MI_ENTRY("echo", local, SANE_SET | REV, ECHO, 0 ) |
| @@ -458,21 +573,21 @@ static const struct mode_info mode_info[] = { | |||
| 458 | MI_ENTRY("echok", local, SANE_SET | REV, ECHOK, 0 ) | 573 | MI_ENTRY("echok", local, SANE_SET | REV, ECHOK, 0 ) |
| 459 | MI_ENTRY("echonl", local, SANE_UNSET | REV, ECHONL, 0 ) | 574 | MI_ENTRY("echonl", local, SANE_UNSET | REV, ECHONL, 0 ) |
| 460 | MI_ENTRY("noflsh", local, SANE_UNSET | REV, NOFLSH, 0 ) | 575 | MI_ENTRY("noflsh", local, SANE_UNSET | REV, NOFLSH, 0 ) |
| 461 | #ifdef XCASE | 576 | #if XCASE |
| 462 | MI_ENTRY("xcase", local, SANE_UNSET | REV, XCASE, 0 ) | 577 | MI_ENTRY("xcase", local, SANE_UNSET | REV, XCASE, 0 ) |
| 463 | #endif | 578 | #endif |
| 464 | #ifdef TOSTOP | 579 | #if TOSTOP |
| 465 | MI_ENTRY("tostop", local, SANE_UNSET | REV, TOSTOP, 0 ) | 580 | MI_ENTRY("tostop", local, SANE_UNSET | REV, TOSTOP, 0 ) |
| 466 | #endif | 581 | #endif |
| 467 | #ifdef ECHOPRT | 582 | #if ECHOPRT |
| 468 | MI_ENTRY("echoprt", local, SANE_UNSET | REV, ECHOPRT, 0 ) | 583 | MI_ENTRY("echoprt", local, SANE_UNSET | REV, ECHOPRT, 0 ) |
| 469 | MI_ENTRY("prterase", local, REV | OMIT, ECHOPRT, 0 ) | 584 | MI_ENTRY("prterase", local, REV | OMIT, ECHOPRT, 0 ) |
| 470 | #endif | 585 | #endif |
| 471 | #ifdef ECHOCTL | 586 | #if ECHOCTL |
| 472 | MI_ENTRY("echoctl", local, SANE_SET | REV, ECHOCTL, 0 ) | 587 | MI_ENTRY("echoctl", local, SANE_SET | REV, ECHOCTL, 0 ) |
| 473 | MI_ENTRY("ctlecho", local, REV | OMIT, ECHOCTL, 0 ) | 588 | MI_ENTRY("ctlecho", local, REV | OMIT, ECHOCTL, 0 ) |
| 474 | #endif | 589 | #endif |
| 475 | #ifdef ECHOKE | 590 | #if ECHOKE |
| 476 | MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) | 591 | MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) |
| 477 | MI_ENTRY("crtkill", local, REV | OMIT, ECHOKE, 0 ) | 592 | MI_ENTRY("crtkill", local, REV | OMIT, ECHOKE, 0 ) |
| 478 | #endif | 593 | #endif |
| @@ -497,31 +612,31 @@ enum { | |||
| 497 | CIDX_kill, | 612 | CIDX_kill, |
| 498 | CIDX_eof, | 613 | CIDX_eof, |
| 499 | CIDX_eol, | 614 | CIDX_eol, |
| 500 | #ifdef VEOL2 | 615 | #if VEOL2 |
| 501 | CIDX_eol2, | 616 | CIDX_eol2, |
| 502 | #endif | 617 | #endif |
| 503 | #ifdef VSWTCH | 618 | #if VSWTCH |
| 504 | CIDX_swtch, | 619 | CIDX_swtch, |
| 505 | #endif | 620 | #endif |
| 506 | CIDX_start, | 621 | CIDX_start, |
| 507 | CIDX_stop, | 622 | CIDX_stop, |
| 508 | CIDX_susp, | 623 | CIDX_susp, |
| 509 | #ifdef VDSUSP | 624 | #if VDSUSP |
| 510 | CIDX_dsusp, | 625 | CIDX_dsusp, |
| 511 | #endif | 626 | #endif |
| 512 | #ifdef VREPRINT | 627 | #if VREPRINT |
| 513 | CIDX_rprnt, | 628 | CIDX_rprnt, |
| 514 | #endif | 629 | #endif |
| 515 | #ifdef VWERASE | 630 | #if VWERASE |
| 516 | CIDX_werase, | 631 | CIDX_werase, |
| 517 | #endif | 632 | #endif |
| 518 | #ifdef VLNEXT | 633 | #if VLNEXT |
| 519 | CIDX_lnext, | 634 | CIDX_lnext, |
| 520 | #endif | 635 | #endif |
| 521 | #ifdef VFLUSHO | 636 | #if VFLUSHO |
| 522 | CIDX_flush, | 637 | CIDX_flush, |
| 523 | #endif | 638 | #endif |
| 524 | #ifdef VSTATUS | 639 | #if VSTATUS |
| 525 | CIDX_status, | 640 | CIDX_status, |
| 526 | #endif | 641 | #endif |
| 527 | CIDX_min, | 642 | CIDX_min, |
| @@ -538,31 +653,31 @@ static const char control_name[] = | |||
| 538 | CI_ENTRY("kill", CKILL, VKILL ) | 653 | CI_ENTRY("kill", CKILL, VKILL ) |
| 539 | CI_ENTRY("eof", CEOF, VEOF ) | 654 | CI_ENTRY("eof", CEOF, VEOF ) |
| 540 | CI_ENTRY("eol", CEOL, VEOL ) | 655 | CI_ENTRY("eol", CEOL, VEOL ) |
| 541 | #ifdef VEOL2 | 656 | #if VEOL2 |
| 542 | CI_ENTRY("eol2", CEOL2, VEOL2 ) | 657 | CI_ENTRY("eol2", CEOL2, VEOL2 ) |
| 543 | #endif | 658 | #endif |
| 544 | #ifdef VSWTCH | 659 | #if VSWTCH |
| 545 | CI_ENTRY("swtch", CSWTCH, VSWTCH ) | 660 | CI_ENTRY("swtch", CSWTCH, VSWTCH ) |
| 546 | #endif | 661 | #endif |
| 547 | CI_ENTRY("start", CSTART, VSTART ) | 662 | CI_ENTRY("start", CSTART, VSTART ) |
| 548 | CI_ENTRY("stop", CSTOP, VSTOP ) | 663 | CI_ENTRY("stop", CSTOP, VSTOP ) |
| 549 | CI_ENTRY("susp", CSUSP, VSUSP ) | 664 | CI_ENTRY("susp", CSUSP, VSUSP ) |
| 550 | #ifdef VDSUSP | 665 | #if VDSUSP |
| 551 | CI_ENTRY("dsusp", CDSUSP, VDSUSP ) | 666 | CI_ENTRY("dsusp", CDSUSP, VDSUSP ) |
| 552 | #endif | 667 | #endif |
| 553 | #ifdef VREPRINT | 668 | #if VREPRINT |
| 554 | CI_ENTRY("rprnt", CRPRNT, VREPRINT) | 669 | CI_ENTRY("rprnt", CRPRNT, VREPRINT) |
| 555 | #endif | 670 | #endif |
| 556 | #ifdef VWERASE | 671 | #if VWERASE |
| 557 | CI_ENTRY("werase", CWERASE, VWERASE ) | 672 | CI_ENTRY("werase", CWERASE, VWERASE ) |
| 558 | #endif | 673 | #endif |
| 559 | #ifdef VLNEXT | 674 | #if VLNEXT |
| 560 | CI_ENTRY("lnext", CLNEXT, VLNEXT ) | 675 | CI_ENTRY("lnext", CLNEXT, VLNEXT ) |
| 561 | #endif | 676 | #endif |
| 562 | #ifdef VFLUSHO | 677 | #if VFLUSHO |
| 563 | CI_ENTRY("flush", CFLUSHO, VFLUSHO ) | 678 | CI_ENTRY("flush", CFLUSHO, VFLUSHO ) |
| 564 | #endif | 679 | #endif |
| 565 | #ifdef VSTATUS | 680 | #if VSTATUS |
| 566 | CI_ENTRY("status", CSTATUS, VSTATUS ) | 681 | CI_ENTRY("status", CSTATUS, VSTATUS ) |
| 567 | #endif | 682 | #endif |
| 568 | /* These must be last because of the display routines */ | 683 | /* These must be last because of the display routines */ |
| @@ -581,31 +696,31 @@ static const struct control_info control_info[] = { | |||
| 581 | CI_ENTRY("kill", CKILL, VKILL ) | 696 | CI_ENTRY("kill", CKILL, VKILL ) |
| 582 | CI_ENTRY("eof", CEOF, VEOF ) | 697 | CI_ENTRY("eof", CEOF, VEOF ) |
| 583 | CI_ENTRY("eol", CEOL, VEOL ) | 698 | CI_ENTRY("eol", CEOL, VEOL ) |
| 584 | #ifdef VEOL2 | 699 | #if VEOL2 |
| 585 | CI_ENTRY("eol2", CEOL2, VEOL2 ) | 700 | CI_ENTRY("eol2", CEOL2, VEOL2 ) |
| 586 | #endif | 701 | #endif |
| 587 | #ifdef VSWTCH | 702 | #if VSWTCH |
| 588 | CI_ENTRY("swtch", CSWTCH, VSWTCH ) | 703 | CI_ENTRY("swtch", CSWTCH, VSWTCH ) |
| 589 | #endif | 704 | #endif |
| 590 | CI_ENTRY("start", CSTART, VSTART ) | 705 | CI_ENTRY("start", CSTART, VSTART ) |
| 591 | CI_ENTRY("stop", CSTOP, VSTOP ) | 706 | CI_ENTRY("stop", CSTOP, VSTOP ) |
| 592 | CI_ENTRY("susp", CSUSP, VSUSP ) | 707 | CI_ENTRY("susp", CSUSP, VSUSP ) |
| 593 | #ifdef VDSUSP | 708 | #if VDSUSP |
| 594 | CI_ENTRY("dsusp", CDSUSP, VDSUSP ) | 709 | CI_ENTRY("dsusp", CDSUSP, VDSUSP ) |
| 595 | #endif | 710 | #endif |
| 596 | #ifdef VREPRINT | 711 | #if VREPRINT |
| 597 | CI_ENTRY("rprnt", CRPRNT, VREPRINT) | 712 | CI_ENTRY("rprnt", CRPRNT, VREPRINT) |
| 598 | #endif | 713 | #endif |
| 599 | #ifdef VWERASE | 714 | #if VWERASE |
| 600 | CI_ENTRY("werase", CWERASE, VWERASE ) | 715 | CI_ENTRY("werase", CWERASE, VWERASE ) |
| 601 | #endif | 716 | #endif |
| 602 | #ifdef VLNEXT | 717 | #if VLNEXT |
| 603 | CI_ENTRY("lnext", CLNEXT, VLNEXT ) | 718 | CI_ENTRY("lnext", CLNEXT, VLNEXT ) |
| 604 | #endif | 719 | #endif |
| 605 | #ifdef VFLUSHO | 720 | #if VFLUSHO |
| 606 | CI_ENTRY("flush", CFLUSHO, VFLUSHO ) | 721 | CI_ENTRY("flush", CFLUSHO, VFLUSHO ) |
| 607 | #endif | 722 | #endif |
| 608 | #ifdef VSTATUS | 723 | #if VSTATUS |
| 609 | CI_ENTRY("status", CSTATUS, VSTATUS ) | 724 | CI_ENTRY("status", CSTATUS, VSTATUS ) |
| 610 | #endif | 725 | #endif |
| 611 | /* These must be last because of the display routines */ | 726 | /* These must be last because of the display routines */ |
| @@ -740,6 +855,7 @@ static void newline(void) | |||
| 740 | wrapf("\n"); | 855 | wrapf("\n"); |
| 741 | } | 856 | } |
| 742 | 857 | ||
| 858 | #ifdef TIOCGWINSZ | ||
| 743 | static void set_window_size(int rows, int cols) | 859 | static void set_window_size(int rows, int cols) |
| 744 | { | 860 | { |
| 745 | struct winsize win = { 0, 0, 0, 0 }; | 861 | struct winsize win = { 0, 0, 0, 0 }; |
| @@ -760,6 +876,7 @@ static void set_window_size(int rows, int cols) | |||
| 760 | bail: | 876 | bail: |
| 761 | perror_on_device("%s"); | 877 | perror_on_device("%s"); |
| 762 | } | 878 | } |
| 879 | #endif | ||
| 763 | 880 | ||
| 764 | static void display_window_size(int fancy) | 881 | static void display_window_size(int fancy) |
| 765 | { | 882 | { |
| @@ -973,41 +1090,6 @@ static void sane_mode(struct termios *mode) | |||
| 973 | } | 1090 | } |
| 974 | } | 1091 | } |
| 975 | 1092 | ||
| 976 | /* Save set_mode from #ifdef forest plague */ | ||
| 977 | #ifndef ONLCR | ||
| 978 | #define ONLCR 0 | ||
| 979 | #endif | ||
| 980 | #ifndef OCRNL | ||
| 981 | #define OCRNL 0 | ||
| 982 | #endif | ||
| 983 | #ifndef ONLRET | ||
| 984 | #define ONLRET 0 | ||
| 985 | #endif | ||
| 986 | #ifndef XCASE | ||
| 987 | #define XCASE 0 | ||
| 988 | #endif | ||
| 989 | #ifndef IXANY | ||
| 990 | #define IXANY 0 | ||
| 991 | #endif | ||
| 992 | #ifndef TABDLY | ||
| 993 | #define TABDLY 0 | ||
| 994 | #endif | ||
| 995 | #ifndef OXTABS | ||
| 996 | #define OXTABS 0 | ||
| 997 | #endif | ||
| 998 | #ifndef IUCLC | ||
| 999 | #define IUCLC 0 | ||
| 1000 | #endif | ||
| 1001 | #ifndef OLCUC | ||
| 1002 | #define OLCUC 0 | ||
| 1003 | #endif | ||
| 1004 | #ifndef ECHOCTL | ||
| 1005 | #define ECHOCTL 0 | ||
| 1006 | #endif | ||
| 1007 | #ifndef ECHOKE | ||
| 1008 | #define ECHOKE 0 | ||
| 1009 | #endif | ||
| 1010 | |||
| 1011 | static void set_mode(const struct mode_info *info, int reversed, | 1093 | static void set_mode(const struct mode_info *info, int reversed, |
| 1012 | struct termios *mode) | 1094 | struct termios *mode) |
| 1013 | { | 1095 | { |
| @@ -1093,27 +1175,32 @@ static void set_mode(const struct mode_info *info, int reversed, | |||
| 1093 | mode->c_cc[VTIME] = 0; | 1175 | mode->c_cc[VTIME] = 0; |
| 1094 | } | 1176 | } |
| 1095 | } | 1177 | } |
| 1096 | else if (IXANY && info == &mode_info[IDX_decctlq]) { | 1178 | #if IXANY |
| 1179 | else if (info == &mode_info[IDX_decctlq]) { | ||
| 1097 | if (reversed) | 1180 | if (reversed) |
| 1098 | mode->c_iflag |= IXANY; | 1181 | mode->c_iflag |= IXANY; |
| 1099 | else | 1182 | else |
| 1100 | mode->c_iflag &= ~IXANY; | 1183 | mode->c_iflag &= ~IXANY; |
| 1101 | } | 1184 | } |
| 1102 | else if (TABDLY && info == &mode_info[IDX_tabs]) { | 1185 | #endif |
| 1186 | #if TABDLY | ||
| 1187 | else if (info == &mode_info[IDX_tabs]) { | ||
| 1103 | if (reversed) | 1188 | if (reversed) |
| 1104 | mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB3; | 1189 | mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB3; |
| 1105 | else | 1190 | else |
| 1106 | mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB0; | 1191 | mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB0; |
| 1107 | } | 1192 | } |
| 1108 | else if (OXTABS && info == &mode_info[IDX_tabs]) { | 1193 | #endif |
| 1194 | #if OXTABS | ||
| 1195 | else if (info == &mode_info[IDX_tabs]) { | ||
| 1109 | if (reversed) | 1196 | if (reversed) |
| 1110 | mode->c_oflag |= OXTABS; | 1197 | mode->c_oflag |= OXTABS; |
| 1111 | else | 1198 | else |
| 1112 | mode->c_oflag &= ~OXTABS; | 1199 | mode->c_oflag &= ~OXTABS; |
| 1113 | } else | 1200 | } |
| 1114 | if (XCASE && IUCLC && OLCUC | 1201 | #endif |
| 1115 | && (info == &mode_info[IDX_lcase] || info == &mode_info[IDX_LCASE]) | 1202 | #if XCASE && IUCLC && OLCUC |
| 1116 | ) { | 1203 | else if (info==&mode_info[IDX_lcase] || info==&mode_info[IDX_LCASE]) { |
| 1117 | if (reversed) { | 1204 | if (reversed) { |
| 1118 | mode->c_lflag &= ~XCASE; | 1205 | mode->c_lflag &= ~XCASE; |
| 1119 | mode->c_iflag &= ~IUCLC; | 1206 | mode->c_iflag &= ~IUCLC; |
| @@ -1123,7 +1210,9 @@ static void set_mode(const struct mode_info *info, int reversed, | |||
| 1123 | mode->c_iflag |= IUCLC; | 1210 | mode->c_iflag |= IUCLC; |
| 1124 | mode->c_oflag |= OLCUC; | 1211 | mode->c_oflag |= OLCUC; |
| 1125 | } | 1212 | } |
| 1126 | } else if (info == &mode_info[IDX_crt]) { | 1213 | } |
| 1214 | #endif | ||
| 1215 | else if (info == &mode_info[IDX_crt]) { | ||
| 1127 | mode->c_lflag |= ECHOE | ECHOCTL | ECHOKE; | 1216 | mode->c_lflag |= ECHOE | ECHOCTL | ECHOKE; |
| 1128 | } else if (info == &mode_info[IDX_dec]) { | 1217 | } else if (info == &mode_info[IDX_dec]) { |
| 1129 | mode->c_cc[VINTR] = 3; /* ^C */ | 1218 | mode->c_cc[VINTR] = 3; /* ^C */ |
| @@ -1419,7 +1508,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv) | |||
| 1419 | perror_on_device_and_die("%s"); | 1508 | perror_on_device_and_die("%s"); |
| 1420 | 1509 | ||
| 1421 | if (memcmp(&mode, &new_mode, sizeof(mode)) != 0) { | 1510 | if (memcmp(&mode, &new_mode, sizeof(mode)) != 0) { |
| 1422 | #ifdef CIBAUD | 1511 | #if CIBAUD |
| 1423 | /* SunOS 4.1.3 (at least) has the problem that after this sequence, | 1512 | /* SunOS 4.1.3 (at least) has the problem that after this sequence, |
| 1424 | tcgetattr (&m1); tcsetattr (&m1); tcgetattr (&m2); | 1513 | tcgetattr (&m1); tcsetattr (&m1); tcgetattr (&m2); |
| 1425 | sometimes (m1 != m2). The only difference is in the four bits | 1514 | sometimes (m1 != m2). The only difference is in the four bits |
