You could implement your own "printf" like this (I don't have test it, but it
should work) and use it in the LWIP_PLATFORM_DIAG define... About the "buffer"
variable, you could reduce its size, or set it as "static" if you don't use
multithreading.
int myprintf( const char* format, ... )
{ char buffer[1024];
int result;
va_list arglist;
va_start( arglist, format);
result = vsprintf( buffer, format, arglist);
va_end( arglist);
return result;
}
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : [email protected]
Web Site : http://www.hymatom.fr
Plan d'accès au siège social
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : [email protected]
[mailto:[email protected]] De la part de
Bernhard 'Gustl' Bauer
Envoyé : mardi 21 juillet 2009 09:18
À : Mailing list for lwIP users
Objet : [lwip-users] LWIP_DEBUGF
Hi,
I cannot use a printf for the output. The only possibility for me is to
use sprintf and write it to a part in the memory.
LWIP_DEBUGF is often used to get some variables along. So there a
brackets () around the printf part:
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif,
netif->name[0], netif->name[1], (u16_t)netif->num));
To use this with sprintf I have to get a string pointer inside the
brackets. I added a '#define LWIP_DEBUG_F str_ptr,' and changed all
LWIP_DEBUGF similar to this:
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, (LWIP_DEBUG_F
"dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif,
netif->name[0], netif->name[1], (u16_t)netif->num));
Is there any better way to do this? I like to avoid all the changes I
have to do every time I change LWIP version.
TIA
Gustl
_______________________________________________
lwip-users mailing list
[email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
BEGIN:VCARD
VERSION:2.1
N:BERNON;Frédéric;;M.
FN:Frédéric BERNON
ORG:HYMATOM SA;Recherche et Développement
TITLE:Chef de projet informatique
TEL;WORK;VOICE:04-67-87-61-10
TEL;WORK;FAX:04-67-70-85-44
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;23;Zone Industrielle=0D=0A175 rue de Massacan;VENDARGUES;;34740;FRANCE;
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:23=0D=0AZone Industrielle=0D=0A175 rue de Massacan=0D=0AVENDARGUES 34740=0D=
=0AFrance
URL;WORK:http://www.hymatom.fr
ROLE:Chef de projet informatique
EMAIL;PREF;INTERNET:[email protected]
REV:20020404T083210Z
END:VCARD
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users