//
// Written by Curtis Olson, started November 1999.
//
-// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
+#include <cstdlib>
+#include <cstring>
#include <simgear/compiler.h>
-#include STL_STRING
+#include <string>
#include <simgear/debug/logstream.hxx>
#include <simgear/serial/serial.hxx>
#include "sg_serial.hxx"
-SG_USING_STD(string);
+using std::string;
SGSerial::SGSerial( const string& device_name, const string& baud_rate ) :
// cout << "fd = " << port.fd << endl;
- if ( ! port.set_baud( atoi( baud.c_str() ) ) ) {
+ if ( ! port.set_baud( std::atoi( baud.c_str() ) ) ) {
SG_LOG( SG_IO, SG_ALERT, "Error setting baud: " << baud );
return false;
}
result = port.read_port( buf_ptr, length - save_len );
if ( result + save_len == length ) {
- strncpy( buf, save_buf, length );
+ std::strncpy( buf, save_buf, length );
save_len = 0;
return length;
// we found an end of line
// copy to external buffer
- strncpy( buf, save_buf, result );
+ std::strncpy( buf, save_buf, result );
buf[result] = '\0';
SG_LOG( SG_IO, SG_INFO, "fg_serial line = " << buf );
// write null terminated string to port
int SGSerial::writestring( const char *str ) {
- int length = strlen( str );
+ int length = std::strlen( str );
return write( str, length );
}