X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftrace%2Flib_tracebits.c;h=7d8325a828f4e042635fb9d9374f781a4a21c77e;hp=d19d0e420acce2675896cbdf70f31783bdb52b9f;hb=a8845f1feadb0b4d906e9040e465b93fd3f72660;hpb=3a935d9991cdf43ebfa952073c9b555f73a3e011 diff --git a/ncurses/trace/lib_tracebits.c b/ncurses/trace/lib_tracebits.c index d19d0e42..7d8325a8 100644 --- a/ncurses/trace/lib_tracebits.c +++ b/ncurses/trace/lib_tracebits.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,11 +34,7 @@ #include -MODULE_ID("$Id: lib_tracebits.c,v 1.19 2011/01/09 00:23:03 tom Exp $") - -#if SVR4_TERMIO && !defined(_POSIX_SOURCE) -#define _POSIX_SOURCE -#endif +MODULE_ID("$Id: lib_tracebits.c,v 1.23 2012/06/09 19:55:46 tom Exp $") #if HAVE_SYS_TERMIO_H #include /* needed for ISC */ @@ -80,22 +76,24 @@ typedef struct { const char *name; } BITNAMES; +#define TRACE_BUF_SIZE(num) (_nc_globals.tracebuf_ptr[num].size) + static void lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int val) { const BITNAMES *sp; - (void) strcat(buf, label); - (void) strcat(buf, ": {"); + _nc_STRCAT(buf, label, TRACE_BUF_SIZE(0)); + _nc_STRCAT(buf, ": {", TRACE_BUF_SIZE(0)); for (sp = table; sp->name; sp++) if (sp->val != 0 && (val & sp->val) == sp->val) { - (void) strcat(buf, sp->name); - (void) strcat(buf, ", "); + _nc_STRCAT(buf, sp->name, TRACE_BUF_SIZE(0)); + _nc_STRCAT(buf, ", ", TRACE_BUF_SIZE(0)); } if (buf[strlen(buf) - 2] == ',') buf[strlen(buf) - 2] = '\0'; - (void) strcat(buf, "} "); + _nc_STRCAT(buf, "} ", TRACE_BUF_SIZE(0)); } NCURSES_EXPORT(char *) @@ -192,7 +190,7 @@ _nc_trace_ttymode(TTY * tty) CS_DATA(CS8), }; const char *result = "CSIZE? "; - int value = (tty->c_cflag & CSIZE); + int value = (int) (tty->c_cflag & CSIZE); unsigned n; if (value != 0) { @@ -203,7 +201,7 @@ _nc_trace_ttymode(TTY * tty) } } } - strcat(buf, result); + _nc_STRCAT(buf, result, TRACE_BUF_SIZE(0)); } #endif