Precision (printf("%.Ns", text1)) not supported by all compilers, for example some versions of avrgcc and mspgcc.
This commit is contained in:
parent
f2f6a7bd53
commit
ec1d598148
|
@ -32,8 +32,6 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
|
||||||
* $Id: serial-shell.c,v 1.5 2009/03/17 15:56:32 adamdunkels Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,6 +57,7 @@ PROCESS(serial_shell_process, "Contiki serial shell");
|
||||||
void
|
void
|
||||||
shell_default_output(const char *text1, int len1, const char *text2, int len2)
|
shell_default_output(const char *text1, int len1, const char *text2, int len2)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
if(text1 == NULL) {
|
if(text1 == NULL) {
|
||||||
text1 = "";
|
text1 = "";
|
||||||
len1 = 0;
|
len1 = 0;
|
||||||
|
@ -68,13 +67,15 @@ shell_default_output(const char *text1, int len1, const char *text2, int len2)
|
||||||
len2 = 0;
|
len2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workaround for absence of "%.*s" format in avr-libc */
|
/* Precision (printf("%.Ns", text1)) not supported on all platforms.
|
||||||
#if defined (__AVR__)
|
putchar(c) not be supported on all platforms. */
|
||||||
printf("%s %s\r\n", text1, text2);
|
for(i = 0; i < len1; i++) {
|
||||||
#else
|
printf("%c", text1[i]);
|
||||||
printf("%.*s%.*s\r\n", len1, text1, len2, text2);
|
}
|
||||||
#endif
|
for(i = 0; i < len2; i++) {
|
||||||
|
printf("%c", text2[i]);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue