]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: add debug message, use colors for -l
authorKarel Zak <kzak@redhat.com>
Tue, 17 Sep 2013 07:42:53 +0000 (09:42 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Sep 2013 07:42:53 +0000 (09:42 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.c
libfdisk/src/ask.c

index 368c89ed087ff60292d6cb2d5e1881510a1ee342..9b748761394b3263b261484dac5d002c9d79add2 100644 (file)
@@ -487,9 +487,12 @@ int main(int argc, char **argv)
                warnx(_("The device properties (sector size and geometry) should"
                        " be used with one specified device only."));
 
+       colors_init(colormode);
+
        switch (act) {
        case ACT_LIST:
                fdisk_context_enable_listonly(cxt, 1);
+
                if (argc > optind) {
                        int k;
                        for (k = optind; k < argc; k++)
@@ -515,8 +518,6 @@ int main(int argc, char **argv)
                if (argc-optind != 1)
                        usage(stderr);
 
-               colors_init(colormode);
-
                if (fdisk_context_assign_device(cxt, argv[optind], 0) != 0)
                        err(EXIT_FAILURE, _("cannot open %s"), argv[optind]);
 
index 09b081974cf2da0e7e88c53dae431039d8c1cd7f..190cf4a58bded4f714edd70325fe9fad138ac807 100644 (file)
@@ -69,7 +69,12 @@ int fdisk_do_ask(struct fdisk_context *cxt, struct fdisk_ask *ask)
        assert(ask);
        assert(cxt);
 
-       DBG(ASK, dbgprint("asking for '%s'", ask->query));
+       DBG(ASK, dbgprint("do_ask for '%s'",
+                               ask->query ? ask->query :
+                               ask->type == FDISK_ASKTYPE_INFO  ? "info" :
+                               ask->type == FDISK_ASKTYPE_WARNX ? "warnx" :
+                               ask->type == FDISK_ASKTYPE_WARN  ? "warn" :
+                               "?nothing?"));
 
        if (!cxt->ask_cb) {
                DBG(ASK, dbgprint("no ask callback specified!"));