Cleanup: consolidate swrite

This commit is contained in:
Keith Winstein
2011-01-26 14:04:13 -05:00
parent 65f7f3515c
commit 4486f1c119
7 changed files with 42 additions and 71 deletions
+1 -17
View File
@@ -5,11 +5,10 @@
#include <typeinfo>
#include "terminal.hpp"
#include "swrite.hpp"
using namespace Terminal;
static void swrite( int fd, const char *str );
Cell::Cell()
: overlapping_cell( NULL ),
contents(),
@@ -192,21 +191,6 @@ void Emulator::print( Parser::Print *act )
}
}
static void swrite( int fd, const char *str )
{
ssize_t total_bytes_written = 0;
ssize_t bytes_to_write = strlen( str );
while ( total_bytes_written < bytes_to_write ) {
ssize_t bytes_written = write( fd, str + total_bytes_written,
bytes_to_write - total_bytes_written );
if ( bytes_written <= 0 ) {
perror( "write" );
} else {
total_bytes_written += bytes_written;
}
}
}
void Emulator::debug_printout( int fd )
{
std::string screen;