/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2014,2015 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 "termsort.c" /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$Id: dump_entry.c,v 1.111 2013/12/15 01:05:20 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.118 2015/07/07 08:06:39 Werner.Fink Exp $")
#define INDENT 8
#define DISCARD(string) string = ABSENT_STRING
static int column; /* current column, limited by 'width' */
static int oldcol; /* last value of column before wrap */
static bool pretty; /* true if we format if-then-else strings */
+static bool checking; /* true if we are checking for tic */
static char *save_sgr;
#endif
#define NameTrans(check,result) \
- if (OkIndex(np->nte_index, check) \
+ if ((np->nte_index <= OK_ ## check) \
&& check[np->nte_index]) \
return (result[np->nte_index])
NCURSES_CONST char *
nametrans(const char *name)
-/* translate a capability name from termcap to terminfo */
+/* translate a capability name to termcap from terminfo */
{
const struct name_table_entry *np;
- if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0)
+ if ((np = _nc_find_entry(name, _nc_get_hash_table(0))) != 0) {
switch (np->nte_type) {
case BOOLEAN:
NameTrans(bool_from_termcap, boolcodes);
NameTrans(str_from_termcap, strcodes);
break;
}
+ }
return (0);
}
int twidth,
int theight,
unsigned traceval,
- bool formatted)
+ bool formatted,
+ bool check)
/* set up for entry display */
{
width = twidth;
height = theight;
pretty = formatted;
+ checking = check;
/* versions */
if (version == 0)
strncpy_DYN(buffer, "\t", (size_t) 1);
}
-static bool
+bool
has_params(const char *src)
{
bool result = FALSE;
indent_DYN(&tmpbuf, level + 1);
}
} else if (level == 1) {
- _nc_warning("%s: %%%c without %%? in %s",
- _nc_first_name(tterm->term_names),
- *src, capability);
+ if (checking)
+ _nc_warning("%s: %%%c without %%? in %s",
+ _nc_first_name(tterm->term_names),
+ *src, capability);
}
}
continue;
}
return src;
}
- _nc_warning("%s: %%; without %%? in %s",
- _nc_first_name(tterm->term_names),
- capability);
+ if (checking)
+ _nc_warning("%s: %%; without %%? in %s",
+ _nc_first_name(tterm->term_names),
+ capability);
}
break;
case 'p':
trimmed_sgr0 = _nc_trim_sgr0(tterm);
if (strcmp(capability, trimmed_sgr0))
capability = trimmed_sgr0;
+ else {
+ if (trimmed_sgr0 != exit_attribute_mode)
+ free(trimmed_sgr0);
+ }
set_attributes = my_sgr;
}
"%s@", name);
WRAP_CONCAT;
} else if (outform == F_TERMCAP || outform == F_TCONVERR) {
- int params = ((i < (int) SIZEOF(parametrized))
- ? parametrized[i]
- : 0);
char *srccap = _nc_tic_expand(capability, TRUE, numbers);
+ int params = (((i < (int) SIZEOF(parametrized)) &&
+ (i < STRCOUNT))
+ ? parametrized[i]
+ : ((*srccap == 'k')
+ ? 0
+ : has_params(srccap)));
char *cv = _nc_infotocap(name, srccap, params);
if (cv == 0) {