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

Re: c program : pb with Sparc ?

Just for the record, I follow up on myself, because I have found my
mistake. This can be of some use for others. So :

On Fri, Jan 21, 2000 at 12:02:35AM +0100, Thierry Laronde wrote:
> Within them, there is `ldate', a c program which displays date informations
> in a versatile format, according to the LC_TIME passed as an argument. This
> uses strftime() which is POSIX defined.
> The program compiles well on i386/Debian Slink and works as expected, but I have
> tried to compile it on sparc, and, because I rent some place on a server,
> try on it, which is a sparc/SunOS with the GNU utils.
> Compilation is good ( no warning with flags -g -W -Wall), but there is a 
> segmentation fault. 
> 	/* if nb of char written == 0, then format is too small */
> 	while ( (max = 
> 		strftime(NULL, size_format, strftime_format, local_time))== 0) {
the problem is here : this is a "GNUism", this is not POSIX defined. So the
problem is not on Sparc, or SunOS, but on the POSIX compliance. 
This is corrected and this works absolutely fine :)


website : http://www.polynum.com

Reply to: