diff options
author | 2000-07-24 04:06:09 +0000 | |
---|---|---|
committer | 2000-07-24 04:06:09 +0000 | |
commit | 2a9262cfa0c64e36a033f83af8d3756af1bb0e57 (patch) | |
tree | bd7eebec09718dc6a1455d5b35dd937c44bb3da1 /lib/libcurses/trace | |
parent | Rename move() to moveplayer() to avoid clashing with curses; (diff) | |
download | wireguard-openbsd-2a9262cfa0c64e36a033f83af8d3756af1bb0e57.tar.xz wireguard-openbsd-2a9262cfa0c64e36a033f83af8d3756af1bb0e57.zip |
Update to ncurses-5.1-20000722
Diffstat (limited to 'lib/libcurses/trace')
-rw-r--r-- | lib/libcurses/trace/lib_tracebits.c | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/lib/libcurses/trace/lib_tracebits.c b/lib/libcurses/trace/lib_tracebits.c index fe933b0ad71..2460c4d8b95 100644 --- a/lib/libcurses/trace/lib_tracebits.c +++ b/lib/libcurses/trace/lib_tracebits.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_tracebits.c,v 1.5 2000/03/10 01:35:05 millert Exp $ */ +/* $OpenBSD: lib_tracebits.c,v 1.6 2000/07/24 04:06:11 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -36,7 +36,7 @@ #include <curses.priv.h> #include <term.h> /* cur_term */ -MODULE_ID("$From: lib_tracebits.c,v 1.5 2000/02/13 01:01:55 tom Exp $") +MODULE_ID("$From: lib_tracebits.c,v 1.6 2000/07/23 00:22:32 tom Exp $") #if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -155,30 +155,41 @@ _nc_tracebits(void) lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.c_cflag); #if defined(CS5) && defined(CS8) - switch (cur_term->Nttyb.c_cflag & CSIZE) { -#if defined(CS5) && (CS5 != 0) - case CS5: - strcat(buf, "CS5 "); - break; -#endif -#if defined(CS6) && (CS6 != 0) - case CS6: - strcat(buf, "CS6 "); - break; -#endif -#if defined(CS7) && (CS7 != 0) - case CS7: - strcat(buf, "CS7 "); - break; -#endif -#if defined(CS8) && (CS8 != 0) - case CS8: - strcat(buf, "CS8 "); - break; -#endif - default: - strcat(buf, "CSIZE? "); - break; + { + static struct { + char *name; + int value; + } csizes[] = { + { + "CS5 ", CS5 + }, +#ifdef CS6 + { + "CS6 ", CS6 + }, +#endif +#ifdef CS7 + { + "CS7 ", CS7 + }, +#endif + { + "CS8 ", CS8 + }, + }; + char *result = "CSIZE? "; + int value = (cur_term->Nttyb.c_cflag & CSIZE); + unsigned n; + + if (value != 0) { + for (n = 0; n < SIZEOF(csizes); n++) { + if (csizes[n].value == value) { + result = csizes[n].name; + break; + } + } + } + strcat(buf, result); } #endif |