/****************************************************************************
- * Copyright (c) 2000-2001,2002 Free Software Foundation, Inc. *
+ * Copyright (c) 2000-2008,2012 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 <ctype.h>
#include <termcap.h>
-MODULE_ID("$Id: lib_tgoto.c,v 1.10 2002/08/31 22:14:47 Philippe.Blain Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.16 2012/02/24 02:08:08 tom Exp $")
#if !PURE_TERMINFO
static bool
*value = 0200; /* tputs will treat this as \0 */
}
}
- result[used++] = *value++;
+ result[used++] = (char) *value++;
break;
case '%':
result[used++] = *string;
*value = 16 * (*value / 10) + (*value % 10);
break;
case 'D': /* Reverse coding (Delta Data) */
- *value -= 2 * (*value / 16);
+ *value -= 2 * (*value % 16);
break;
}
if (fmt != 0) {
- sprintf(result + used, fmt, *value++);
+ _nc_SPRINTF(result + used, _nc_SLIMIT(length - used)
+ fmt, *value++);
used += strlen(result + used);
fmt = 0;
}
}
if (result != 0) {
if (need_BC) {
- strcpy(result + used, BC);
+ _nc_STRCPY(result + used, BC, length - used);
used += strlen(BC);
}
result[used] = '\0';
result = tgoto_internal(string, x, y);
else
#endif
- result = tparm((NCURSES_CONST char *) string, y, x);
+ result = TPARM_2((NCURSES_CONST char *) string, y, x);
returnPtr(result);
}