* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
const char *_nc_progname = "tset";
static TTY mode, oldmode, original;
const char *_nc_progname = "tset";
static TTY mode, oldmode, original;
static int terasechar = -1; /* new erase character */
static int intrchar = -1; /* new interrupt character */
static int tkillchar = -1; /* new kill character */
static int terasechar = -1; /* new erase character */
static int intrchar = -1; /* new interrupt character */
static int tkillchar = -1; /* new kill character */
- strcpy(temp, _nc_progname);
- strcat(temp, ": ");
+ _nc_STRCPY(temp, _nc_progname, sizeof(temp));
+ _nc_STRCAT(temp, ": ", sizeof(temp));
mapp = typeMalloc(MAP, 1);
if (copy == 0 || mapp == 0)
failed("malloc");
mapp = typeMalloc(MAP, 1);
if (copy == 0 || mapp == 0)
failed("malloc");
* real entry from /etc/termcap. This prevents us from being fooled
* by out of date stuff in the environment.
*/
* real entry from /etc/termcap. This prevents us from being fooled
* by out of date stuff in the environment.
*/
/* 'unsetenv("TERMCAP")' is not portable.
* The 'environ' array is better.
*/
int n;
for (n = 0; environ[n] != 0; n++) {
/* 'unsetenv("TERMCAP")' is not portable.
* The 'environ' array is better.
*/
int n;
for (n = 0; environ[n] != 0; n++) {
- if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0)
- mode.c_cc[VERASE] = (terasechar >= 0) ? terasechar : default_erase();
+ if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0) {
+ mode.c_cc[VERASE] = UChar((terasechar >= 0)
+ ? terasechar
+ : default_erase());
+ }
- if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0)
- mode.c_cc[VINTR] = (intrchar >= 0) ? intrchar : CINTR;
+ if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0) {
+ mode.c_cc[VINTR] = UChar((intrchar >= 0)
+ ? intrchar
+ : CINTR);
+ }
- if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0)
- mode.c_cc[VKILL] = (tkillchar >= 0) ? tkillchar : CKILL;
+ if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0) {
+ mode.c_cc[VKILL] = UChar((tkillchar >= 0)
+ ? tkillchar
+ : CKILL);
+ }
if (newline != (char *) 0 && newline[0] == '\n' && !newline[1]) {
/* Newline, not linefeed. */
#ifdef ONLCR
if (newline != (char *) 0 && newline[0] == '\n' && !newline[1]) {
/* Newline, not linefeed. */
#ifdef ONLCR
(void) putc('\r', stderr); /* Force to left margin. */
tputs(clear_all_tabs, 0, outc);
(void) putc('\r', stderr); /* Force to left margin. */
tputs(clear_all_tabs, 0, outc);
/* Get to the right column. In BSD tset, this
* used to try a bunch of half-clever things
* with cup and hpa, for an average saving of
/* Get to the right column. In BSD tset, this
* used to try a bunch of half-clever things
* with cup and hpa, for an average saving of