[BACK]Return to out.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/out.c between version 1.5 and 1.6

version 1.5, 2009/10/18 19:02:10 version 1.6, 2009/10/22 18:55:32
Line 16 
Line 16 
  */   */
 #include <sys/types.h>  #include <sys/types.h>
   
   #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <string.h>
   
 #include "out.h"  #include "out.h"
   
Line 117  a2roffsu(const char *src, struct roffsu *dst, enum rof
Line 119  a2roffsu(const char *src, struct roffsu *dst, enum rof
   
         return(1);          return(1);
 }  }
   
   
   /*
    * Correctly writes the time in nroff form, which differs from standard
    * form in that a space isn't printed in lieu of the extra %e field for
    * single-digit dates.
    */
   void
   time2a(time_t t, char *dst, size_t sz)
   {
           struct tm        tm;
           char             buf[5];
           char            *p;
           size_t           nsz;
   
           assert(sz > 1);
           localtime_r(&t, &tm);
   
           p = dst;
           nsz = 0;
   
           dst[0] = '\0';
   
           if (0 == (nsz = strftime(p, sz, "%B ", &tm)))
                   return;
   
           p += (int)nsz;
           sz -= nsz;
   
           if (0 == strftime(buf, sizeof(buf), "%e, ", &tm))
                   return;
   
           nsz = strlcat(p, buf + (' ' == buf[0] ? 1 : 0), sz);
   
           if (nsz >= sz)
                   return;
   
           p += (int)nsz;
           sz -= nsz;
   
           (void)strftime(p, sz, "%Y", &tm);
   }
   

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

CVSweb