aboutsummaryrefslogtreecommitdiff
path: root/ncurses/tinfo/lib_tparm.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2014-02-28 19:12:44 +0000
committerXin LI <delphij@FreeBSD.org>2014-02-28 19:12:44 +0000
commit4b819fa20a8d007a10f2d3e8d6a5dedf7f18fc9a (patch)
treeb8f6e12b479a78216f3bffb8e1258d54087268de /ncurses/tinfo/lib_tparm.c
parente07762606a5bf651a501cb095c98cba90e4a8fe2 (diff)
downloadsrc-4b819fa20a8d007a10f2d3e8d6a5dedf7f18fc9a.tar.gz
src-4b819fa20a8d007a10f2d3e8d6a5dedf7f18fc9a.zip
Undo two previous imports which was never done in preparation of doing a
new import.
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=262616
Diffstat (limited to 'ncurses/tinfo/lib_tparm.c')
-rw-r--r--ncurses/tinfo/lib_tparm.c49
1 files changed, 12 insertions, 37 deletions
diff --git a/ncurses/tinfo/lib_tparm.c b/ncurses/tinfo/lib_tparm.c
index 7cd12f7f6845..ba2a8404030e 100644
--- a/ncurses/tinfo/lib_tparm.c
+++ b/ncurses/tinfo/lib_tparm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -40,9 +40,10 @@
#include <curses.priv.h>
#include <ctype.h>
+#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.82 2011/01/15 22:19:12 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.76 2008/08/16 19:22:55 tom Exp $")
/*
* char *
@@ -139,7 +140,7 @@ save_text(const char *fmt, const char *s, int len)
{
size_t s_len = strlen(s);
if (len > (int) s_len)
- s_len = (size_t) len;
+ s_len = len;
get_space(s_len + 1);
@@ -450,13 +451,12 @@ _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount)
}
static NCURSES_INLINE char *
-tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
+tparam_internal(const char *string, va_list ap)
{
char *p_is_s[NUM_PARM];
TPARM_ARG param[NUM_PARM];
- int popcount = 0;
+ int popcount;
int number;
- int num_args;
int len;
int level;
int x, y;
@@ -479,13 +479,7 @@ tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
if (TPS(fmt_buff) == 0)
return NULL;
- if (number > NUM_PARM)
- number = NUM_PARM;
- if (popcount > NUM_PARM)
- popcount = NUM_PARM;
- num_args = max(popcount, number);
-
- for (i = 0; i < num_args; i++) {
+ for (i = 0; i < max(popcount, number); i++) {
/*
* A few caps (such as plab_norm) have string-valued parms.
* We'll have to assume that the caller knows the difference, since
@@ -495,11 +489,8 @@ tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
*/
if (p_is_s[i] != 0) {
p_is_s[i] = va_arg(ap, char *);
- param[i] = 0;
- } else if (use_TPARM_ARG) {
- param[i] = va_arg(ap, TPARM_ARG);
} else {
- param[i] = (TPARM_ARG) va_arg(ap, int);
+ param[i] = va_arg(ap, TPARM_ARG);
}
}
@@ -517,7 +508,7 @@ tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
if (p_is_s[i])
spush(p_is_s[i]);
else
- npush((int) param[i]);
+ npush(param[i]);
}
}
#ifdef TRACE
@@ -526,7 +517,7 @@ tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
if (p_is_s[i] != 0)
save_text(", %s", _nc_visbuf(p_is_s[i]), 0);
else
- save_number(", %d", (int) param[i], 0);
+ save_number(", %d", param[i], 0);
}
_tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(cp), TPS(out_buff));
TPS(out_used) = 0;
@@ -573,7 +564,7 @@ tparam_internal(bool use_TPARM_ARG, const char *string, va_list ap)
if (p_is_s[i])
spush(p_is_s[i]);
else
- npush((int) param[i]);
+ npush(param[i]);
}
break;
@@ -781,7 +772,7 @@ tparm_varargs(NCURSES_CONST char *string,...)
#ifdef TRACE
TPS(tname) = "tparm";
#endif /* TRACE */
- result = tparam_internal(TRUE, string, ap);
+ result = tparam_internal(string, ap);
va_end(ap);
return result;
}
@@ -802,19 +793,3 @@ tparm_proto(NCURSES_CONST char *string,
return tparm_varargs(string, a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
#endif /* NCURSES_TPARM_VARARGS */
-
-NCURSES_EXPORT(char *)
-tiparm(const char *string,...)
-{
- va_list ap;
- char *result;
-
- _nc_tparm_err = 0;
- va_start(ap, string);
-#ifdef TRACE
- TPS(tname) = "tiparm";
-#endif /* TRACE */
- result = tparam_internal(FALSE, string, ap);
- va_end(ap);
- return result;
-}