Hello Edouard,

 I oversaw this email, so some of my comments in my last mail don't apply anymore. I 
see you 
already applied the verbosity patch to pppoa2.c as well. For the verbosity patch for 
modem_run.c 
see my previous mail.

> Waiting for your patch, i'll then judge if it's worth it (for the
> beauty of code)

 I had a closer look and noticed that since vsnprintf(msg, 256, format, ap) nor 
vfprintf(log, 
format, ap) use va_arg the reordering of the report() parameters is not as trivial as 
I expected. 
Let's forget about that (for now).

 However, I still feel the log level should be separated independent of whether 
REPORT_DUMP is set. 
This results in the following patch:

diff -pruN speedtouch/src/modem_run.c speedtouch.report_cleanup/src/modem_run.c
--- speedtouch/src/modem_run.c  2003-09-30 23:51:55.000000000 +0200
+++ speedtouch.report_cleanup/src/modem_run.c   2003-10-05 23:34:02.000000000 +0200
@@ -1214,38 +1214,24 @@ void report( int minlevel, unsigned int 
 #endif
 
                /* Prints log message */
-               if(!(flags&REPORT_DUMP)) {
-#ifndef USE_SYSLOG
-                       vfprintf(flog, format, ap);
-#else
-                       char msg[256];
-
-                       vsnprintf(msg, 256, format, ap);
-                       syslog(LOG_INFO, msg);
-#endif
-               }
-               else {
-
-#ifdef USE_SYSLOG
-                       unsigned char msg[256];
-#endif
-
+               if(flags & REPORT_DUMP) {
                        buffer = va_arg(ap, char*);
                        length = va_arg(ap, int);
+               }
 
 #ifndef USE_SYSLOG
-                       vfprintf(flog, format, ap);
+               vfprintf(flog, format, ap);
 #else
-                       vsnprintf(msg, 256, format, ap);
-                       if(flags&REPORT_ERROR)
-                               syslog(LOG_ERR, msg);
-                       else if (flags&REPORT_INFO)
-                               syslog(LOG_INFO, msg);
-                       else if (flags&REPORT_DEBUG)
-                               syslog(LOG_DEBUG, msg);
-#endif
+               char msg[256];
 
-               }
+               vsnprintf(msg, 256, format, ap);
+               if(flags&REPORT_ERROR)
+                       syslog(LOG_ERR, msg);
+               else if (flags&REPORT_INFO)
+                       syslog(LOG_INFO, msg);
+               else if (flags&REPORT_DEBUG)
+                       syslog(LOG_DEBUG, msg);
+#endif
 
 #ifndef USE_SYSLOG
                /* If needed we include the strerror from libc */
diff -pruN speedtouch/src/pppoa2.c speedtouch.report_cleanup/src/pppoa2.c
--- speedtouch/src/pppoa2.c     2003-09-30 23:51:55.000000000 +0200
+++ speedtouch.report_cleanup/src/pppoa2.c      2003-10-05 23:28:27.000000000 +0200
@@ -720,35 +720,24 @@ void report( int minlevel, unsigned int 
 
 #endif
                /* Prints log message */
-               if(!(flags&REPORT_DUMP)) {
-#ifndef USE_SYSLOG
-                       vprintf(format, ap);
-#else
-                       char msg[256];
-
-                       vsnprintf(msg, 256, format, ap);
-                       syslog(LOG_INFO, msg);
-#endif
-               }
-               else {
-#ifdef USE_SYSLOG
-                       unsigned char msg[256];
-#endif
+               if(flags & REPORT_DUMP) {
                        buffer = va_arg(ap, char*);
                        length = va_arg(ap, int);
+               }
 
 #ifndef USE_SYSLOG
-                       vprintf(format, ap);
+               vprintf(format, ap);
 #else
-                       vsnprintf(msg, 256, format, ap);
-                       if(flags&REPORT_ERROR)
-                               syslog(LOG_ERR, msg);
-                       else if (flags&REPORT_INFO)
-                               syslog(LOG_INFO, msg);
-                       else if (flags&REPORT_DEBUG)
-                               syslog(LOG_DEBUG, msg);
+               char msg[256];
+
+               vsnprintf(msg, 256, format, ap);
+               if(flags&REPORT_ERROR)
+                       syslog(LOG_ERR, msg);
+               else if (flags&REPORT_INFO)
+                       syslog(LOG_INFO, msg);
+               else if (flags&REPORT_DEBUG)
+                       syslog(LOG_DEBUG, msg);
 #endif
-               }
 
 #ifndef USE_SYSLOG
                /* If needed we include the strerror from libc */
diff -pruN speedtouch/src/pppoa3.c speedtouch.report_cleanup/src/pppoa3.c
--- speedtouch/src/pppoa3.c     2003-09-30 23:51:55.000000000 +0200
+++ speedtouch.report_cleanup/src/pppoa3.c      2003-10-05 23:34:55.000000000 +0200
@@ -1798,38 +1798,24 @@ void report( int minlevel, unsigned int 
 #endif
 
                /* Prints log message */
-               if(!(flags&REPORT_DUMP)) {
-#ifndef USE_SYSLOG
-                       vfprintf(log, format, ap);
-#else
-                       char msg[256];
-
-                       vsnprintf(msg, 256, format, ap);
-                       syslog(LOG_INFO, msg);
-#endif
-               }
-               else {
-
-#ifdef USE_SYSLOG
-                       unsigned char msg[256];
-#endif
-
+               if(flags&REPORT_DUMP) {
                        buffer = va_arg(ap, char*);
                        length = va_arg(ap, int);
+               }
 
 #ifndef USE_SYSLOG
-                       vfprintf(log, format, ap);
+               vfprintf(log, format, ap);
 #else
-                       vsnprintf(msg, 256, format, ap);
-                       if(flags&REPORT_ERROR)
-                               syslog(LOG_ERR, msg);
-                       else if (flags&REPORT_INFO)
-                               syslog(LOG_INFO, msg);
-                       else if (flags&REPORT_DEBUG)
-                               syslog(LOG_DEBUG, msg);
-#endif
+               char msg[256];
 
-               }
+               vsnprintf(msg, 256, format, ap);
+               if(flags&REPORT_ERROR)
+                       syslog(LOG_ERR, msg);
+               else if (flags&REPORT_INFO)
+                       syslog(LOG_INFO, msg);
+               else if (flags&REPORT_DEBUG)
+                       syslog(LOG_DEBUG, msg);
+#endif
 
 #ifndef USE_SYSLOG
                /* If needed we include the strerror from libc */

Bye,
Leonard.

--
How clean is a war when you shoot around nukelar waste?
Stop the use of depleted uranium ammo!
End all weapons of mass destruction.


Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se d�sinscrire : mailto:[EMAIL PROTECTED]

        

Reply via email to