more minor fixes

This commit is contained in:
fgerlits 2007-06-13 11:56:49 +00:00
parent c47dcd8e98
commit a30e597b3f
1 changed files with 39 additions and 7 deletions

View File

@ -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 <SerialStream.h>
#include <iostream>
/**
* testing the serial ports
*
@ -7,10 +39,6 @@
* or: LD_LIBRARY_PATH=$CC_DIR/usr/lib ./serialtest out /dev/ttyUSB0
* (etc)
*/
#include <SerialStream.h>
#include <iostream>
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');