s1 = index_query(mappedfile, xi1, t);
s2 = index_query(mappedfile, xi2, t);
+ if (s1 == s2)
+ return; /* no space taken up => no display */
+
/* Display in units of 2 512-byte blocks = 1Kb */
printf("%-11llu %s\n", (s2 - s1) / 2, querydir);
int i;
/*
- * Prevent divisions by zero.
+ * A line with literally zero space usage should not be
+ * printed at all if it's a link to a subdirectory (since it
+ * probably means the whole thing was excluded by some
+ * --exclude-path wildcard). If it's [files] or the top-level
+ * line, though, we must always print _something_, and in that
+ * case we must fiddle about to prevent divisions by zero in
+ * the code below.
*/
+ if (!vec->sizes[MAXCOLOUR] && vec->want_href)
+ return;
divisor = ctx->totalsize;
- if (!divisor)
+ if (!divisor) {
divisor = 1;
+ }
/*
* Find the total size of this subdirectory.