From a30e597b3f4333a658309b26b2346645da2400c3 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 13 Jun 2007 11:56:49 +0000 Subject: [PATCH] more minor fixes --- campcaster/var/serialtest/serialtest.cpp | 46 ++++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/campcaster/var/serialtest/serialtest.cpp b/campcaster/var/serialtest/serialtest.cpp index 0da8c4341..419be28e7 100644 --- a/campcaster/var/serialtest/serialtest.cpp +++ b/campcaster/var/serialtest/serialtest.cpp @@ -1,3 +1,35 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the Campcaster project. + http://campcaster.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + Campcaster is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Campcaster is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Campcaster; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author$ + Version : $Revision$ + Location : $URL$ + +------------------------------------------------------------------------------*/ + +#include +#include + /** * testing the serial ports * @@ -7,10 +39,6 @@ * or: LD_LIBRARY_PATH=$CC_DIR/usr/lib ./serialtest out /dev/ttyUSB0 * (etc) */ - -#include -#include - int main (int argc, char * argv[]) { @@ -18,7 +46,7 @@ int main (int argc, std::string sn; if (argc > 2) { - if (argv[1] == "in") { + if (std::string(argv[1]) == "in") { in = true; } else { in = false; @@ -32,7 +60,11 @@ int main (int argc, LibSerial::SerialStream s(sn); - std::printf("Serial port %s is %s\n", sn.c_str(), s.bad() ? "bad" : "good"); + std::cout << "Serial port " + << sn + << " is " + << (s.bad() ? "bad" : "good") << std::endl + << (in ? "Receiving." : "Sending.") << std::endl; std::string str; @@ -40,7 +72,7 @@ int main (int argc, if (in) { std::getline(s, str, '\n'); if (str.length() > 0) { - std::cerr << str << std::endl; + std::cout << str << std::endl; } } else { std::getline(std::cin, str, '\n');