/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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 <dump_entry.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.125 2005/09/25 00:39:43 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.132 2007/04/07 17:14:27 tom Exp $")
const char *_nc_progname = "tic";
return fp;
}
+#if NO_LEAKS
+static void
+free_namelist(char **src)
+{
+ if (src != 0) {
+ int n;
+ for (n = 0; src[n] != 0; ++n)
+ free(src[n]);
+ free(src);
+ }
+}
+#endif
+
/* Parse the "-e" option-value into a list of names */
-static const char **
+static char **
make_namelist(char *src)
{
- const char **dst = 0;
+ char **dst = 0;
char *s, *base;
unsigned pass, n, nn;
if ((s = stripped(buffer)) != 0) {
if (dst != 0)
dst[nn] = s;
+ else
+ free(s);
nn++;
}
}
if (pass == 1) {
- dst = typeCalloc(const char *, nn + 1);
+ dst = typeCalloc(char *, nn + 1);
rewind(fp);
}
}
break;
}
if (pass == 1)
- dst = typeCalloc(const char *, nn + 1);
+ dst = typeCalloc(char *, nn + 1);
}
}
- if (showsummary) {
+ if (showsummary && (dst != 0)) {
fprintf(log_fp, "Entries that will be compiled:\n");
for (n = 0; dst[n] != 0; n++)
fprintf(log_fp, "%u:%s\n", n + 1, dst[n]);
}
static bool
-matches(const char **needle, const char *haystack)
+matches(char **needle, const char *haystack)
/* does entry in needle list match |-separated field in haystack? */
{
bool code = FALSE;
bool limited = TRUE;
char *tversion = (char *) NULL;
const char *source_file = "terminfo";
- const char **namelst = 0;
+ char **namelst = 0;
char *outdir = (char *) NULL;
bool check_only = FALSE;
bool suppress_untranslatable = FALSE;
_nc_set_type(_nc_first_name(qp->tterm.term_names));
(void) fseek(tmp_fp, qp->cstart, SEEK_SET);
- while (j--) {
+ while (j-- > 0) {
if (infodump)
(void) putchar(fgetc(tmp_fp));
else
put_translate(fgetc(tmp_fp));
}
- len = dump_entry(&qp->tterm, suppress_untranslatable,
- limited, 0, numbers, NULL);
+ dump_entry(&qp->tterm, suppress_untranslatable,
+ limited, numbers, NULL);
for (j = 0; j < qp->nuses; j++)
- len += dump_uses(qp->uses[j].name, !capdump);
- (void) putchar('\n');
+ dump_uses(qp->uses[j].name, !capdump);
+ len = show_entry();
if (debug_level != 0 && !limited)
printf("# length=%d\n", len);
}
else
fprintf(log_fp, "No entries written\n");
}
+#if NO_LEAKS
+ free_namelist(namelst);
+#endif
cleanup();
ExitProgram(EXIT_SUCCESS);
}
* references to locations in the arrays Booleans, Numbers, and Strings ---
* precisely what's needed (see comp_parse.c).
*/
-
-TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */
-
#undef CUR
#define CUR tp->
char *test;
_nc_tparm_err = 0;
- test = tparm(set_attributes,
- num == 1,
- num == 2,
- num == 3,
- num == 4,
- num == 5,
- num == 6,
- num == 7,
- num == 8,
- num == 9);
+ test = TPARM_9(set_attributes,
+ num == 1,
+ num == 2,
+ num == 3,
+ num == 4,
+ num == 5,
+ num == 6,
+ num == 7,
+ num == 8,
+ num == 9);
if (test != 0) {
if (PRESENT(cap)) {
if (!similar_sgr(num, test, cap)) {
static void
show_where(unsigned level)
{
- if (_nc_tracing >= level) {
+ if (_nc_tracing >= DEBUG_LEVEL(level)) {
char my_name[256];
_nc_get_type(my_name);
fprintf(stderr, "\"%s\", line %d, '%s' ",
}
#else
-#define show_where(level) /* nothing */
+#define show_where(level) /* nothing */
#endif
/* other sanity-checks (things that we don't want in the normal
if (PRESENT(exit_attribute_mode)) {
zero = strdup(CHECK_SGR(0, exit_attribute_mode));
} else {
- zero = strdup(tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+ zero = strdup(TPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
if (_nc_tparm_err)
_nc_warning("stack error in sgr(0) string");