[BACK]Return to stat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / stat

Diff for /src/usr.bin/stat/stat.c between version 1.23 and 1.24

version 1.23, 2018/09/18 15:14:06 version 1.24, 2023/08/06 19:33:54
Line 635 
Line 635 
                 }                  }
                 small = (sizeof(secs) == 4);                  small = (sizeof(secs) == 4);
                 data = secs;                  data = secs;
                 small = 1;  
                 tm = localtime(&secs);                  tm = localtime(&secs);
                 (void)strftime(path, sizeof(path), timefmt, tm);                  (void)strftime(path, sizeof(path), timefmt, tm);
                 sdata = path;                  sdata = path;
Line 817 
Line 816 
                                 (void)snprintf(tmp, sizeof(tmp), "%d", size);                                  (void)snprintf(tmp, sizeof(tmp), "%d", size);
                                 (void)strlcat(lfmt, tmp, sizeof(lfmt));                                  (void)strlcat(lfmt, tmp, sizeof(lfmt));
                         }                          }
                         (void)strlcat(lfmt, "d", sizeof(lfmt));                          (void)strlcat(lfmt, "lld", sizeof(lfmt));
                         n = snprintf(buf, blen, lfmt, secs);                          n = snprintf(buf, blen, lfmt, (long long)secs);
                         return (n >= blen ? blen : n);                          return (n >= blen ? blen : n);
                 }                  }
   
Line 842 
Line 841 
                         (void)snprintf(tmp, sizeof(tmp), "%d", size);                          (void)snprintf(tmp, sizeof(tmp), "%d", size);
                         (void)strlcat(lfmt, tmp, sizeof(lfmt));                          (void)strlcat(lfmt, tmp, sizeof(lfmt));
                 }                  }
                 (void)strlcat(lfmt, "d", sizeof(lfmt));                  (void)strlcat(lfmt, "lld", sizeof(lfmt));
   
                 /*                  /*
                  * The stuff after the decimal point always needs zero                   * The stuff after the decimal point always needs zero
Line 854 
Line 853 
                  * We can "print" at most nine digits of precision.  The                   * We can "print" at most nine digits of precision.  The
                  * rest we will pad on at the end.                   * rest we will pad on at the end.
                  */                   */
                 (void)snprintf(tmp, sizeof(tmp), "%dd", prec > 9 ? 9 : prec);                  (void)snprintf(tmp, sizeof(tmp), "%dld", prec > 9 ? 9 : prec);
                 (void)strlcat(lfmt, tmp, sizeof(lfmt));                  (void)strlcat(lfmt, tmp, sizeof(lfmt));
   
                 /*                  /*
Line 868 
Line 867 
                  * Use the format, and then tack on any zeroes that                   * Use the format, and then tack on any zeroes that
                  * might be required to make up the requested precision.                   * might be required to make up the requested precision.
                  */                   */
                 l = snprintf(buf, blen, lfmt, secs, nsecs);                  l = snprintf(buf, blen, lfmt, (long long)secs, nsecs);
                 if (l >= blen)                  if (l >= blen)
                         return (l);                          return (l);
                 for (; prec > 9 && l < blen; prec--, l++)                  for (; prec > 9 && l < blen; prec--, l++)

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24