/****************************************************************************
- * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2015,2016 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 *
#include <parametrized.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.220 2015/12/27 01:46:01 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.224 2016/10/01 12:46:54 tom Exp $")
#define STDIN_NAME "<stdin>"
#endif
DATA(" -U suppress post-processing of entries")
DATA(" -V print version")
+ DATA(" -W wrap long strings according to -w[n] option")
DATA(" -v[n] set verbosity level")
DATA(" -w[n] set format width for translation output")
#if NCURSES_XNAMES
bool suppress_untranslatable = FALSE;
int quickdump = 0;
bool quiet = FALSE;
+ bool wrap_strings = FALSE;
log_fp = stderr;
* be optional.
*/
while ((this_opt = getopt(argc, argv,
- "0123456789CDIKLNQR:TUVace:fGgo:qrstvwx")) != -1) {
+ "0123456789CDIKLNQR:TUVWace:fGgo:qrstvwx")) != -1) {
if (isdigit(this_opt)) {
switch (last_opt) {
case 'Q':
case 'V':
puts(curses_version());
ExitProgram(EXIT_SUCCESS);
+ case 'W':
+ wrap_strings = TRUE;
+ break;
case 'c':
check_only = TRUE;
break;
if (infodump || check_only) {
dump_init(tversion,
- smart_defaults
- ? outform
- : F_LITERAL,
- sortmode, width, height, debug_level, formatted ||
- check_only, check_only, quickdump);
+ (smart_defaults
+ ? outform
+ : F_LITERAL),
+ sortmode,
+ wrap_strings, width, height,
+ debug_level, formatted || check_only, check_only, quickdump);
} else if (capdump) {
dump_init(tversion,
outform,
- sortmode, width, height, debug_level, FALSE, FALSE, FALSE);
+ sortmode,
+ wrap_strings, width, height,
+ debug_level, FALSE, FALSE, FALSE);
}
/* parse entries out of the source file */
*next++ = '\0';
for (k = 1; k <= NUM_PARM; k++) {
numbers[k] = count;
- sprintf(next, "XYZ%d", count);
+ _nc_SPRINTF(next,
+ _nc_SLIMIT(sizeof(blob) - (next - blob))
+ "XYZ%d", count);
strings[k] = next;
next += strlen(next) + 1;
}
static void
check_exit_attribute(const char *name, char *test, char *trimmed, char *untrimmed)
{
- if (VALID_STRING(test)) {
+ if (VALID_STRING(test) && (trimmed != 0)) {
if (similar_sgr(-1, trimmed, test) ||
similar_sgr(-1, untrimmed, test)) {
_nc_warning("%s matches exit_attribute_mode", name);
if (is_sgr_string(test)) {
int param = 0;
int count = 0;
+ int skips = 0;
+ int color = (value == set_a_foreground ||
+ value == set_a_background ||
+ value == set_foreground ||
+ value == set_background);
while (*test != 0) {
if (isdigit(UChar(*test))) {
param = 10 * param + (*test - '0');
++count;
} else {
if (count) {
- if (param == code)
+ /*
+ * Avoid unnecessary warning for xterm 256color codes.
+ */
+ if (color && (param == 38 || param == 48))
+ skips = 3;
+ if ((skips-- <= 0) && (param == code))
break;
}
count = 0;