/* Merge parameters into a termcap entry string.
- Copyright (C) 1985, 1987, 1993, 1995, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2015 Free
+ Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Emacs config.h may rename various library functions such as malloc. */
#include <config.h>
register int tem;
int *old_argp = argp; /* can move */
int *fixed_argp = argp; /* never moves */
- int explicit_param_p = 0; /* set by %p */
+ bool explicit_param_p = false; /* set by %p */
ptrdiff_t doleft = 0;
ptrdiff_t doup = 0;
ptrdiff_t append_len = 0;
outend = outstring + len;
- while (1)
+ while (true)
{
/* If the buffer might be too short, make it bigger. */
while (outend - op - append_len <= 5)
{
c = *p++;
if (explicit_param_p)
- explicit_param_p = 0;
+ explicit_param_p = false;
else
tem = *argp;
switch (c)
break;
case 'p': /* %pN means use param N for next subst. */
tem = fixed_argp[(*p++) - '1'];
- explicit_param_p = 1;
+ explicit_param_p = true;
break;
case 'C':
/* For c-100: print quotient of value by 96, if nonzero,
}
*op = 0;
while (doup-- > 0)
- strcat (op, up);
+ op = stpcpy (op, up);
while (doleft-- > 0)
- strcat (op, left);
+ op = stpcpy (op, left);
return outstring;
}
\f