runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

fmt_uint0.c (241B)


      1 /* Public domain. */
      2 
      3 #include "fmt.h"
      4 
      5 unsigned int fmt_uint0(char *s,unsigned int u,unsigned int n)
      6 {
      7   unsigned int len;
      8   len = fmt_uint(FMT_LEN,u);
      9   while (len < n) { if (s) *s++ = '0'; ++len; }
     10   if (s) fmt_uint(s,u);
     11   return len;
     12 }