/****************************************************************************
- * Copyright (c) 2000-2012,2018 Free Software Foundation, Inc. *
+ * Copyright 2018-2020,2023 Thomas E. Dickey *
+ * Copyright 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.17 2018/04/07 21:11:48 tom Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.22 2023/04/08 13:48:58 tom Exp $")
#if !PURE_TERMINFO
static bool
*value += 1;
need_BC = TRUE;
} else {
- *value = 0200; /* tputs will treat this as \0 */
+ /* tputs will pretend this is \0, which will almost
+ * always work since ANSI-compatible terminals ignore
+ * the character. ECMA-48 does not document a C1
+ * control for this value. A few (obsolete) terminals
+ * can use this value in special cases, such as cursor
+ * addressing using single-byte coordinates.
+ */
+ *value = 0200;
}
}
result[used++] = (char) *value++;
result = tgoto_internal(string, x, y);
else
#endif
- result = TPARM_2(string, y, x);
+ if ((result = TIPARM_2(string, y, x)) == NULL) {
+ /*
+ * Because termcap did not provide a more general solution such as
+ * tparm(), it was necessary to handle single-parameter capabilities
+ * using tgoto(). The internal _nc_tiparm() function returns a NULL
+ * for that case; retry for the single-parameter case.
+ */
+ result = TIPARM_1(string, y);
+ }
returnPtr(result);
}