[BACK]Return to strpct.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libutil

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libutil/strpct.c between version 1.2 and 1.3

version 1.2, 2011/09/02 10:13:44 version 1.3, 2012/01/07 18:40:56
Line 50  __RCSID("$NetBSD$");
Line 50  __RCSID("$NetBSD$");
 #include <util.h>  #include <util.h>
   
 char *  char *
   strspct(char *buf, size_t bufsiz, intmax_t numerator, intmax_t denominator,
       size_t digits)
   {
           int sign;
   
           switch (bufsiz) {
           case 1:
                   *buf = '\0';
                   /*FALLTHROUGH*/
           case 0:
                   return buf;
           default:
                   break;
           }
   
           if (denominator < 0) {
                   denominator = -denominator;
                   sign = 1;
           } else
                   sign = 0;
   
           if (numerator < 0) {
                   numerator = -numerator;
                   sign++;
           }
   
           sign &= 1;
           (void)strpct(buf + sign, bufsiz - sign, (uintmax_t)numerator,
               (uintmax_t)denominator, digits);
           if (sign)
                   *buf = '-';
           return buf;
   }
   
   char *
 strpct(char *buf, size_t bufsiz, uintmax_t numerator, uintmax_t denominator,  strpct(char *buf, size_t bufsiz, uintmax_t numerator, uintmax_t denominator,
     size_t digits)      size_t digits)
 {  {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

CVSweb <webmaster@jp.NetBSD.org>