88 lines
2.6 KiB
C
88 lines
2.6 KiB
C
/*****************************************************************************
|
|
* Copyright (C) 2008
|
|
* ProbeStar Telematics, LLC
|
|
* All Rights Reserved. Proprietary and Confidential.
|
|
*============================================================================
|
|
* Serial String Output
|
|
*----------------------------------------------------------------------------
|
|
* Details
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* includes
|
|
*****************************************************************************/
|
|
|
|
#include "serial.h"
|
|
#include "types.h"
|
|
|
|
/*****************************************************************************
|
|
* defines
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* macros
|
|
*****************************************************************************/
|
|
|
|
#ifdef __linux__
|
|
#define putch(C) putchar(C)
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
* structs & typedefs
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static prototypes
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* C functions
|
|
*****************************************************************************/
|
|
|
|
#ifdef SERIAL_PUTS
|
|
int serial_puts( const BYTE *s, WORD n )
|
|
{
|
|
int r = n;
|
|
while ( n-- )
|
|
putch( *s++ );
|
|
return r;
|
|
}
|
|
#endif
|
|
|
|
int puts( const char *s )
|
|
{
|
|
char c;
|
|
int n = 0;
|
|
|
|
while ( c = *s++ )
|
|
{
|
|
if ( c == '\n' )
|
|
{
|
|
putch( '\r' );
|
|
n++;
|
|
}
|
|
putch( c );
|
|
n++;
|
|
}
|
|
putch( '\r' );
|
|
putch( '\n' );
|
|
|
|
return n+2;
|
|
}
|