lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE : [lwip-users] LWIP_DEBUGF


From: Frédéric BERNON
Subject: RE : [lwip-users] LWIP_DEBUGF
Date: Tue, 21 Jul 2009 10:01:10 +0200

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 : address@hidden 
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 : address@hidden [mailto:address@hidden 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
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]