diff options
Diffstat (limited to 'src/fmt.c')
-rw-r--r-- | src/fmt.c | 41 |
1 files changed, 22 insertions, 19 deletions
@@ -1,39 +1,41 @@ #include "fmt.h" /** - @file fmt.c - @author djb - @source qmail - @brief formating differnt inputs format for output printing + @file fmt.c + @author djb + @source qmail + @brief formating differnt inputs format for output printing */ -unsigned int fmt_str(register char *s, register char *t) +unsigned int fmt_str(char *s, char *t) { - register unsigned int len; + unsigned int len; char ch; len = 0; if (s) { while ((ch = t[len])) s[len++] = ch; - } else + } else { while (t[len]) len++; + } return len; } -unsigned int fmt_strn(register char *s, register char *t, register unsigned int n) +unsigned int fmt_strn(char *s, char *t, unsigned int n) { - register unsigned int len; + unsigned int len; char ch; len = 0; if (s) { while (n-- && (ch = t[len])) s[len++] = ch; - } else + } else { while (n-- && t[len]) len++; + } return len; } -unsigned int fmt_uint(register char *s, register unsigned int u) +unsigned int fmt_uint(char *s, unsigned int u) { - register unsigned long l; + unsigned long l; l = u; return fmt_ulong(s, l); } @@ -50,10 +52,10 @@ unsigned int fmt_uint0(char *s, unsigned int u, unsigned int n) return len; } -unsigned int fmt_ulong(register char *s, register unsigned long u) +unsigned int fmt_ulong(char *s, unsigned long u) { - register unsigned int len; - register unsigned long q; + unsigned int len; + unsigned long q; len = 1; q = u; while (q > 9) { @@ -70,10 +72,10 @@ unsigned int fmt_ulong(register char *s, register unsigned long u) return len; } -unsigned int fmt_xlong(register char *s, register unsigned long u) +unsigned int fmt_xlong(char *s, unsigned long u) { - register unsigned int len; - register unsigned long q; + unsigned int len; + unsigned long q; len = 1; q = u; while (q > 15) { @@ -108,5 +110,6 @@ int fromhex(unsigned char c) return c - 'A' + 10; else if (c >= 'a' && c <= 'f') return c - 'a' + 10; - return -1; + else + return -1; } |