+ if (!mounted) {
+ if (format_not_mounted == NULL)
+ format_not_mounted = "";
+ selected_format = format_not_mounted;
+ } else if (low_threshold > 0 && below_threshold(buf, prefix_type, threshold_type, low_threshold)) {
+ START_COLOR("color_bad");
+ colorful_output = true;
+ if (format_below_threshold != NULL)
+ selected_format = format_below_threshold;
+ }
+
+ for (walk = selected_format; *walk != '\0'; walk++) {
+ if (*walk != '%') {
+ *(outwalk++) = *walk;
+
+ } else if (BEGINS_WITH(walk + 1, "free")) {
+ outwalk += print_bytes_human(outwalk, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bfree, prefix_type);
+ walk += strlen("free");
+
+ } else if (BEGINS_WITH(walk + 1, "used")) {
+ outwalk += print_bytes_human(outwalk, (uint64_t)buf.f_bsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree), prefix_type);
+ walk += strlen("used");
+
+ } else if (BEGINS_WITH(walk + 1, "total")) {
+ outwalk += print_bytes_human(outwalk, (uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks, prefix_type);
+ walk += strlen("total");
+
+ } else if (BEGINS_WITH(walk + 1, "avail")) {
+ outwalk += print_bytes_human(outwalk, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bavail, prefix_type);
+ walk += strlen("avail");
+
+ } else if (BEGINS_WITH(walk + 1, "percentage_free")) {
+ outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)buf.f_bfree / (double)buf.f_blocks, pct_mark);
+ walk += strlen("percentage_free");
+
+ } else if (BEGINS_WITH(walk + 1, "percentage_used_of_avail")) {
+ outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bavail) / (double)buf.f_blocks, pct_mark);
+ walk += strlen("percentage_used_of_avail");
+
+ } else if (BEGINS_WITH(walk + 1, "percentage_used")) {
+ outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bfree) / (double)buf.f_blocks, pct_mark);
+ walk += strlen("percentage_used");
+
+ } else if (BEGINS_WITH(walk + 1, "percentage_avail")) {
+ outwalk += sprintf(outwalk, "%.01f%s", 100.0 * (double)buf.f_bavail / (double)buf.f_blocks, pct_mark);
+ walk += strlen("percentage_avail");