* human readable manner.
*
*/
-void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const char *format, const char *prefix_type, const char *threshold_type, const double low_threshold) {
+void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const char *format, const char *format_not_mounted, const char *prefix_type, const char *threshold_type, const double low_threshold) {
const char *walk;
char *outwalk = buffer;
bool colorful_output = false;
if (statvfs(path, &buf) == -1)
return;
-#endif
- FILE *mntentfile = setmntent("/etc/mtab", "r");
- struct mntent *m;
- bool found = false;
+ if (format_not_mounted != NULL) {
+ FILE *mntentfile = setmntent("/etc/mtab", "r");
+ struct mntent *m;
+ bool found = false;
- while (NULL != (m = getmntent(mntentfile))) {
- if (strcmp(m->mnt_dir, path) == 0) {
- found = true;
- break;
+ while (NULL != (m = getmntent(mntentfile))) {
+ if (strcmp(m->mnt_dir, path) == 0) {
+ found = true;
+ break;
+ }
}
- }
- endmntent(mntentfile);
+ endmntent(mntentfile);
- if (!found) {
- *buffer = '\0';
- OUTPUT_FULL_TEXT(buffer);
- return;
+ if (!found) {
+ format = format_not_mounted;
+ }
}
+#endif
if (low_threshold > 0 && below_threshold(buf, prefix_type, threshold_type, low_threshold)) {
START_COLOR("color_bad");