1
0
mirror of https://github.com/moparisthebest/socat synced 2024-12-22 06:58:47 -05:00

MacOSX port: detect TABDLY shift problem with autoconf

This commit is contained in:
Gerhard Rieger 2008-09-26 13:19:49 +02:00
parent 8287a65d1a
commit 097608e8a9
4 changed files with 23 additions and 5 deletions

View File

@ -1227,7 +1227,11 @@ AC_CACHE_CHECK(shift offset of $1, $2,
if (n==0) {fprintf(stderr,"$1 is 0 (impossible!)\n"); exit(1);} if (n==0) {fprintf(stderr,"$1 is 0 (impossible!)\n"); exit(1);}
i=0; while (!(n&1)) { i=0; while (!(n&1)) {
n>>=1; ++i; } n>>=1; ++i; }
fprintf(f, "%u", i); if (3<<i == $1) {
fprintf(f, "%u", i);
} else {
fprintf(f, "-1"); /* anticipate result of xioinitialize assert */
}
exit(0); exit(0);
} }
], ],

View File

@ -43,8 +43,10 @@ const struct optdesc opt_cr2 = { "cr2", NULL, OPT_CR2, GROUP_TERMIOS
# endif # endif
# ifdef CR3 # ifdef CR3
const struct optdesc opt_cr3 = { "cr3", NULL, OPT_CR3, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, CR3, CRDLY }; const struct optdesc opt_cr3 = { "cr3", NULL, OPT_CR3, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, CR3, CRDLY };
#endif # endif
# if CRDLY_SHIFT >= 0
const struct optdesc opt_crdly = { "crdly", NULL, OPT_CRDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, CRDLY, CRDLY_SHIFT }; const struct optdesc opt_crdly = { "crdly", NULL, OPT_CRDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, CRDLY, CRDLY_SHIFT };
# endif
#endif /* defined(CRDLY) */ #endif /* defined(CRDLY) */
#ifdef NLDLY #ifdef NLDLY
# ifdef NL0 # ifdef NL0
@ -91,8 +93,10 @@ const struct optdesc opt_tab3 = { "tab3", NULL, OPT_TAB3, GROUP_TERMIOS
# ifdef XTABS # ifdef XTABS
const struct optdesc opt_xtabs = { "xtabs", NULL, OPT_XTABS, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_FLAG, 1, XTABS, TABDLY }; const struct optdesc opt_xtabs = { "xtabs", NULL, OPT_XTABS, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_FLAG, 1, XTABS, TABDLY };
# endif # endif
# if TABDLY_SHIFT >= 0
const struct optdesc opt_tabdly = { "tabdly", NULL, OPT_TABDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, TABDLY, TABDLY_SHIFT }; const struct optdesc opt_tabdly = { "tabdly", NULL, OPT_TABDLY, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 1, TABDLY, TABDLY_SHIFT };
#endif # endif
#endif /* defined(TABDLY) */
#ifdef BSDLY #ifdef BSDLY
# ifdef BS0 # ifdef BS0
const struct optdesc opt_bs0 = { "bs0", NULL, OPT_BS0, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, BS0, BSDLY }; const struct optdesc opt_bs0 = { "bs0", NULL, OPT_BS0, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 1, BS0, BSDLY };
@ -197,7 +201,9 @@ const struct optdesc opt_cs5 = { "cs5", NULL, OPT_CS5, GROUP_TERMIOS
const struct optdesc opt_cs6 = { "cs6", NULL, OPT_CS6, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS6, CSIZE }; const struct optdesc opt_cs6 = { "cs6", NULL, OPT_CS6, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS6, CSIZE };
const struct optdesc opt_cs7 = { "cs7", NULL, OPT_CS7, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS7, CSIZE }; const struct optdesc opt_cs7 = { "cs7", NULL, OPT_CS7, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS7, CSIZE };
const struct optdesc opt_cs8 = { "cs8", NULL, OPT_CS8, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS8, CSIZE }; const struct optdesc opt_cs8 = { "cs8", NULL, OPT_CS8, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_PATTERN, 2, CS8, CSIZE };
#if CSIZE_SHIFT >= 0
const struct optdesc opt_csize = { "csize", NULL, OPT_CSIZE, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 2, CSIZE, CSIZE_SHIFT }; const struct optdesc opt_csize = { "csize", NULL, OPT_CSIZE, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_VALUE, 2, CSIZE, CSIZE_SHIFT };
#endif
const struct optdesc opt_cstopb = { "cstopb", NULL, OPT_CSTOPB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CSTOPB }; const struct optdesc opt_cstopb = { "cstopb", NULL, OPT_CSTOPB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CSTOPB };
const struct optdesc opt_cread = { "cread", NULL, OPT_CREAD, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CREAD }; const struct optdesc opt_cread = { "cread", NULL, OPT_CREAD, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, CREAD };
const struct optdesc opt_parenb = { "parenb", NULL, OPT_PARENB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, PARENB }; const struct optdesc opt_parenb = { "parenb", NULL, OPT_PARENB, GROUP_TERMIOS, PH_FD, TYPE_BOOL, OFUNC_TERMIOS_FLAG, 2, PARENB };

View File

@ -37,13 +37,15 @@ int xioinitialize(void) {
/* some assertions about termios */ /* some assertions about termios */
#if WITH_TERMIOS #if WITH_TERMIOS
#ifdef CRDLY #if defined(CRDLY) && CRDLY_SHIFT >= 0
assert(3 << opt_crdly.arg3 == CRDLY); assert(3 << opt_crdly.arg3 == CRDLY);
#endif #endif
#ifdef TABDLY #if defined(TABDLY) && TABDLY_SHIFT >= 0
assert(3 << opt_tabdly.arg3 == TABDLY); assert(3 << opt_tabdly.arg3 == TABDLY);
#endif #endif
#if CSIZE_SHIFT >= 0
assert(3 << opt_csize.arg3 == CSIZE); assert(3 << opt_csize.arg3 == CSIZE);
#endif
{ {
union { union {
struct termios termarg; struct termios termarg;

View File

@ -316,7 +316,9 @@ const struct optname optionnames[] = {
# ifdef CR3 # ifdef CR3
IF_TERMIOS("cr3", &opt_cr3) IF_TERMIOS("cr3", &opt_cr3)
# endif # endif
# if CRDLY_SHIFT >= 0
IF_TERMIOS("crdly", &opt_crdly) IF_TERMIOS("crdly", &opt_crdly)
# endif
#endif /* defined(CRDLY) */ #endif /* defined(CRDLY) */
IF_TERMIOS("cread", &opt_cread) IF_TERMIOS("cread", &opt_cread)
IF_OPEN ("creat", &opt_o_create) IF_OPEN ("creat", &opt_o_create)
@ -332,7 +334,9 @@ const struct optname optionnames[] = {
IF_TERMIOS("cs6", &opt_cs6) IF_TERMIOS("cs6", &opt_cs6)
IF_TERMIOS("cs7", &opt_cs7) IF_TERMIOS("cs7", &opt_cs7)
IF_TERMIOS("cs8", &opt_cs8) IF_TERMIOS("cs8", &opt_cs8)
#if CSIZE_SHIFT >= 0
IF_TERMIOS("csize", &opt_csize) IF_TERMIOS("csize", &opt_csize)
#endif
IF_TERMIOS("cstopb", &opt_cstopb) IF_TERMIOS("cstopb", &opt_cstopb)
IF_TERMIOS("ctlecho", &opt_echoctl) IF_TERMIOS("ctlecho", &opt_echoctl)
IF_TERMIOS("ctty", &opt_tiocsctty) IF_TERMIOS("ctty", &opt_tiocsctty)
@ -1456,7 +1460,9 @@ const struct optname optionnames[] = {
# ifdef TAB3 # ifdef TAB3
IF_TERMIOS("tab3", &opt_tab3) IF_TERMIOS("tab3", &opt_tab3)
# endif # endif
# if TABDLY_SHIFT >= 0
IF_TERMIOS("tabdly", &opt_tabdly) IF_TERMIOS("tabdly", &opt_tabdly)
# endif
#endif #endif
IF_TERMIOS("tandem", &opt_ixoff) IF_TERMIOS("tandem", &opt_ixoff)
#ifdef TCP_ABORT_THRESHOLD /* HP_UX */ #ifdef TCP_ABORT_THRESHOLD /* HP_UX */