Dimitris Papastamos <[email protected]> writes:
> sbase should only contain code that runs on POSIX systems (with some
> minor exceptions) and fallback implementations for non-standardized
> interfaces that can be implemented portably on top of POSIX interfaces.
So there's no place for fallback implementations _of_ POSIX interfaces
on top of either older POSIX interfaces or non-standard ones?
Anyway, here's a patch for some data type issues that came up - more to
do with compiling with all warnings, though the fact that clock_t is
unsigned on OSX helped catch one of them.
diff --git a/du.c b/du.c
index 41e4380..3dc3545 100644
--- a/du.c
+++ b/du.c
@@ -25,7 +25,7 @@ printpath(off_t n, const char *path)
if (hflag)
printf("%s\t%s\n", humansize(n * blksize), path);
else
- printf("%ju\t%s\n", n, path);
+ printf("%jd\t%s\n", (intmax_t)n, path);
}
static off_t
diff --git a/split.c b/split.c
index f15e925..ee24556 100644
--- a/split.c
+++ b/split.c
@@ -48,7 +48,7 @@ int
main(int argc, char *argv[])
{
FILE *in = stdin, *out = NULL;
- size_t size = 1000, n;
+ off_t size = 1000, n;
int ret = 0, ch, plen, slen = 2, always = 0;
char name[NAME_MAX + 1], *prefix = "x", *file = NULL;
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
break;
case 'l':
always = 0;
- size = estrtonum(EARGF(usage()), 1, MIN(LLONG_MAX, SIZE_MAX));
+ size = estrtonum(EARGF(usage()), 1, MIN(LLONG_MAX, OFF_MAX));
break;
default:
usage();
diff --git a/time.c b/time.c
index 4af0352..60a8c8d 100644
--- a/time.c
+++ b/time.c
@@ -36,7 +36,7 @@ main(int argc, char *argv[])
if ((ticks = sysconf(_SC_CLK_TCK)) <= 0)
eprintf("sysconf _SC_CLK_TCK:");
- if ((r0 = times(&tms)) < 0)
+ if ((r0 = times(&tms)) == (clock_t)-1)
eprintf("times:");
switch ((pid = fork())) {
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
}
waitpid(pid, &status, 0);
- if ((r1 = times(&tms)) < 0)
+ if ((r1 = times(&tms)) == (clock_t)-1)
eprintf("times:");
if (WIFSIGNALED(status)) {