aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/tinfo/comp_error.c
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-01-20 07:32:02 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-01-20 07:32:02 +0000
commit4a1a95108dd76c4259fe6c37c4471f7969b17983 (patch)
tree1c6c3b549401156e1dbd96b9a6b18521f63ffb58 /contrib/ncurses/ncurses/tinfo/comp_error.c
parent555c9cae3cf9146482732c28c06a73314b618149 (diff)
downloadsrc-4a1a95108dd76c4259fe6c37c4471f7969b17983.tar.gz
src-4a1a95108dd76c4259fe6c37c4471f7969b17983.zip
Import ncurses 5.6-20061217 onto the vender branch
Approved by: delphij
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=166124
Diffstat (limited to 'contrib/ncurses/ncurses/tinfo/comp_error.c')
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_error.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c
index e67cb795dd33..015f34886eb1 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_error.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_error.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2005 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 *
@@ -29,6 +29,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -40,7 +41,7 @@
#include <tic.h>
-MODULE_ID("$Id: comp_error.c,v 1.23 2001/09/23 00:58:30 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.30 2005/11/26 15:28:47 tom Exp $")
NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */
@@ -49,6 +50,12 @@ NCURSES_EXPORT_VAR(int) _nc_curr_col = 0; /* current column # in input */
static const char *sourcename;
static char *termtype;
+NCURSES_EXPORT(const char *)
+_nc_get_source(void)
+{
+ return sourcename;
+}
+
NCURSES_EXPORT(void)
_nc_set_source(const char *const name)
{
@@ -59,19 +66,28 @@ NCURSES_EXPORT(void)
_nc_set_type(const char *const name)
{
if (termtype == 0)
- termtype = _nc_doalloc(termtype, MAX_NAME_SIZE + 1);
- termtype[0] = '\0';
- if (name)
- strncat(termtype, name, MAX_NAME_SIZE);
+ termtype = typeMalloc(char, MAX_NAME_SIZE + 1);
+ if (termtype != 0) {
+ termtype[0] = '\0';
+ if (name)
+ strncat(termtype, name, MAX_NAME_SIZE);
+ }
}
NCURSES_EXPORT(void)
_nc_get_type(char *name)
{
- strcpy(name, termtype != 0 ? termtype : "");
+#if NO_LEAKS
+ if (name == 0 && termtype != 0) {
+ FreeAndNull(termtype);
+ return;
+ }
+#endif
+ if (name != 0)
+ strcpy(name, termtype != 0 ? termtype : "");
}
-static inline void
+static NCURSES_INLINE void
where_is_problem(void)
{
fprintf(stderr, "\"%s\"", sourcename);