diff options
author | izabera <izaberina@gmail.com> | 2016-02-06 15:25:35 +0100 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-02-10 16:31:42 -0600 |
commit | e8427bfd008be233aadea49e89075451c8a9ceee (patch) | |
tree | 9ef361ee146548866cd65eabcdf19a65fe58327d /toys/other/factor.c | |
parent | 93e27d0d4723d57082463c4d70e6443060a8732b (diff) | |
download | toybox-e8427bfd008be233aadea49e89075451c8a9ceee.tar.gz |
use unsigned long with factor
Diffstat (limited to 'toys/other/factor.c')
-rw-r--r-- | toys/other/factor.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/toys/other/factor.c b/toys/other/factor.c index 570270ed..8aa1d935 100644 --- a/toys/other/factor.c +++ b/toys/other/factor.c @@ -19,7 +19,7 @@ config FACTOR static void factor(char *s) { - long l, ll; + unsigned long l, ll; for (;;) { char *err = s; @@ -27,14 +27,14 @@ static void factor(char *s) while(isspace(*s)) s++; if (!*s) return; - l = strtol(s, &s, 0); + l = strtoul(s, &s, 0); if (*s && !isspace(*s)) { error_msg("%s: not integer", err); return; } - printf("%ld:", l); + printf("%lu:", l); // Negative numbers have -1 as a factor if (l < 0) { @@ -44,7 +44,7 @@ static void factor(char *s) // Nothing below 4 has factors if (l < 4) { - printf(" %ld\n", l); + printf(" %lu\n", l); continue; } @@ -59,11 +59,11 @@ static void factor(char *s) long lll = ll*ll; if (lll>l || lll<ll) { - if (l>1) printf(" %ld", l); + if (l>1) printf(" %lu", l); break; } while (!(l%ll)) { - printf(" %ld", ll); + printf(" %lu", ll); l /= ll; } } |