sbin/hammer - Properly indent config text on 'show' output
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Mon, 2 Mar 2015 14:52:57 +0000 (15:52 +0100)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Mon, 2 Mar 2015 15:12:29 +0000 (16:12 +0100)
sbin/hammer/cmd_show.c

index fc860a8..04f2186 100644 (file)
@@ -470,6 +470,19 @@ check_data_crc(hammer_btree_elm_t elm)
        return("BX");                   /* bad crc */
 }
 
+static
+void
+print_config(char *cfgtxt)
+{
+       char *token;
+
+       printf("\n%17stext=\"\n", "");
+       while((token = strsep(&cfgtxt, "\r\n")) != NULL) {
+               printf("%17s  %s\n", "", token);
+       }
+       printf("%17s\"", "");
+}
+
 static
 void
 print_record(hammer_btree_elm_t elm)
@@ -561,8 +574,7 @@ print_record(hammer_btree_elm_t elm)
                break;
        case HAMMER_RECTYPE_CONFIG:
                if (VerboseOpt > 2) {
-                       printf("\n%17s", "");
-                       printf("text=\"%s\"", data->config.text);
+                       print_config(data->config.text);
                }
                break;
        default: