Contiki 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
cpu
stm32w108
small-printf
sp-puts.c
1
/**
2
* \addtogroup stm32w-cpu
3
*
4
* @{
5
*/
6
7
#include <stdio.h>
8
#include <string.h>
9
10
void
__io_putchar (
char
);
11
12
/*--------------------------------------------------------------------------*/
13
void
14
_SMALL_PRINTF_puts(
const
char
*ptr,
int
len, FILE *fp)
15
{
16
/* No file => sprintf */
17
if
(fp && (fp->_file == -1) && (fp->_flags & (__SWR | __SSTR))) {
18
char
*str = fp->_p;
19
for
(; len ; len--) {
20
*str ++ = *ptr++;
21
}
22
fp->_p = str;
23
}
else
{
24
/* file => printf */
25
for
(; len ; len--) {
26
__io_putchar (*ptr++);
27
}
28
}
29
}
30
/*--------------------------------------------------------------------------*/
31
int
32
puts(
const
char
*str)
33
{
34
int
len = strlen (str);
35
_SMALL_PRINTF_puts(str, len, 0) ;
36
__io_putchar (
'\n'
);
37
return
len;
38
}
39
/** @} */
Generated on Sun Nov 30 2014 09:58:58 for Contiki 3.x by
1.8.5