Re: Re: Strftime's %C and %y formats versus wide-ranging tm_yea
hi paul IMHO this will fail in case of error. 1. snprint() old version return -1 on error therefor reducing result by one 2. snprint() new version return size that is *needed* any overflow will cause pt point to exacly were i should not be is a private version of snprintf/strftime an option ? regards, walter - - - - - - - - - - - - - - Original Message - - - - - - - - - - - - - - From: Paul Eggert <eggert@CS.UCLA.EDU> Subject: Re: Strftime's %C and %y formats versus wide-ranging tm_year va Date: 10/15/04 21:03 "Olson, Arthur David (NIH/NCI)" <olsona@dc37a.nci.nih.gov> writes: ** We avoid using snprintf since it's not available on all systems. */ ! pt = result + sprintf(result, ! ASCTIME_FMT, wn, mn, timeptr->tm_mday, timeptr->tm_hour, ! timeptr->tm_min, timeptr->tm_sec); ! if (-999 - TM_YEAR_BASE <= timeptr->tm_year ! && timeptr->tm_year <= 9999 - TM_YEAR_BASE) ! pt += sprintf(pt, ! SMALL_YEAR_FMT, timeptr->tm_year + TM_YEAR_BASE); ! else ! /*
participants (1)
-
WHarms@bfs.de