Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon4.gif   -W -Wall options (using gcc), posted by Heiko Scheit on Fri Feb 13 12:25:15 2004 
    icon2.gif   Re: -W -Wall options (using gcc), posted by Stefan Ritt on Fri Feb 13 21:52:48 2004 
       icon5.gif   Re: -W -Wall options (using gcc), posted by Stefan Ritt on Mon Feb 16 16:07:34 2004 
          icon5.gif   Re: -W -Wall options (using gcc), posted by Heiko Scheit on Mon Feb 16 16:40:50 2004 
             icon5.gif   Re: -W -Wall options (using gcc), posted by Stefan Ritt on Mon Feb 16 16:47:55 2004 
                icon5.gif   Re: -W -Wall options (using gcc), posted by Heiko Scheit on Mon Feb 16 17:18:39 2004 
Message ID: 478     Entry time: Mon Feb 16 17:18:39 2004     In reply to: 477
Icon: Question  Author: Heiko Scheit  Author Email: h.scheit@mpi-hd.mpg.de 
Category:   OS: Linux  ELOG Version: 2.5.0 
Subject: Re: -W -Wall options (using gcc) 
> > Have a look at the gcc info pages:
> > 
> > $ info gcc "invoking gcc" "warning options"
> 
> Sure, I'm not stupid! 

  Sorry, didn't mean to offend you.

> I looked for ~10 minutes how to turn off the remaining 
> warnings, but I could not find it. The code is now correct, like I do want the 
> "%y" format specifier in the strftime() function, but the warning is wrong.

  One way to remove the warnings would be to use "%Y" in a separate strftime() call
  and then taking only the last two digits (characters) of that string.

  Something like:
old:
   strftime(str, sizeof(str), "%A, %d-%b-%y %H:%M:%S GMT", gmt);

new:
   strftime(str, sizeof(str), "%A, %d-%b-XX %H:%M:%S GMT", gmt);
   strftime(year, sizeof(year), "%Y", gmt);
   i=strstr(str,"XX"); /* find position of XX */
   if ( i+1 < sizeof(str) ) {
     str[i]  =year[3];
     str[i+1]=year[4];
   } else ...

  Somewhat cumbersome, but should work.  Maybe consider using the four 
  digit year directly, where possible.

  Gruss, Heiko
ELOG V3.1.5-fe60aaf