Write correct length to terminal for unflash sequences

Introduce a wrapper for fwrite() of a full string to the current_ftarget.
This commit is contained in:
Kevin Easton
2017-06-09 00:42:57 +10:00
parent 917a04ce66
commit 4ae2c5ebdd
2 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2.2]
* Write correct length to terminal for unflash sequences. (caf)
* Update source file dependencies in Makefile.in. (caf)
* Remove unused opendir.c. (caf)

View File

@@ -44,6 +44,12 @@ extern LastMsg last_servermsg[];
char three_stars[4] = "***";
/* Write a string to the current target */
static size_t writestr(const char *s)
{
return fwrite(s, strlen(s), 1, current_ftarget);
}
/* unflash: sends a ^[c to the screen */
/* Must be defined to be useful, cause some vt100s really *do* reset when
sent this command. >;-) */
@@ -53,17 +59,17 @@ char three_stars[4] = "***";
void charset_ibmpc(void)
{
fwrite("\033(U", 3, 1, current_ftarget); /* switch to IBM code page 437 */
writestr("\033(U"); /* switch to IBM code page 437 */
}
void charset_lat1(void)
{
fwrite("\033(B", 3, 1, current_ftarget); /* switch to Latin-1 (ISO 8859-1) */
writestr("\033(B"); /* switch to Latin-1 (ISO 8859-1) */
}
void charset_cst(void)
{
fwrite("\033(K", 3, 1, current_ftarget); /* switch too user-defined */
writestr("\033(K"); /* switch to user-defined */
}
/* currently not used. */
@@ -75,9 +81,9 @@ void unflash (void)
#if !defined(WINNT) && !defined(__EMX__)
#if defined(HARD_UNFLASH) && !defined(CHARSET_CUSTOM)
fwrite("\033c", 5, 1, current_ftarget); /* hard reset */
writestr("\033c"); /* hard reset */
#else
fwrite("\033)0", 6, 1, current_ftarget); /* soft reset */
writestr("\033)0"); /* soft reset */
#endif
#if defined(LATIN1)