diff options
Diffstat (limited to 'src/libstddjb/long_fmt.c')
-rw-r--r-- | src/libstddjb/long_fmt.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstddjb/long_fmt.c b/src/libstddjb/long_fmt.c new file mode 100644 index 0000000..552fe47 --- /dev/null +++ b/src/libstddjb/long_fmt.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include <skalibs/ulong.h> + +unsigned int long_fmt (char *fmt, long n) +{ + if (n >= 0) return ulong_fmt(fmt, n) ; + if (fmt) *fmt++ = '-' ; + return 1 + ulong_fmt(fmt, -n) ; +} |