]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: don't colorize "foo:" prefixes
authorKarel Zak <kzak@redhat.com>
Tue, 1 Apr 2014 12:39:13 +0000 (14:39 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Apr 2014 09:55:08 +0000 (11:55 +0200)
Based on master branch commit 412791a995890d3576906d86a39bbee6246eb01e.

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk-ask.c

index 7de40b435c525091cc6113de899fb86c46d3039a..491d85e16ab4a89807861410c864091a4203db1e 100644 (file)
@@ -192,48 +192,19 @@ static int ask_offset(struct fdisk_context *cxt,
        return -1;
 }
 
-static void fputs_info(struct fdisk_ask *ask, FILE *out, char *buf, size_t bufsz)
+static void fputs_info(struct fdisk_ask *ask, FILE *out)
 {
        const char *msg;
-       unsigned int flags;
 
        assert(ask);
 
        msg = fdisk_ask_print_get_mesg(ask);
-       flags = fdisk_ask_get_flags(ask);
 
        if (!msg)
                return;
        if (info_count == 1)
                fputc('\n', out);
-       if (flags == 0 || !colors_wanted())
-               goto simple;
-
-       if (flags & FDISK_INFO_COLON) {
-               size_t sz;
-               char *sep = _(": ");
-               char *p = strstr(msg, sep);
-
-               if (!p)
-                       goto simple;
-
-               sz = strlen(sep);
-               strncpy(buf, msg, bufsz);
-               buf[p - msg + sz] = '\0';
-
-               color_enable(UL_COLOR_BROWN);
-               fputs(buf, out);
-               color_disable();
-               fputs(p + sz, out);
-
-       } else if (flags & FDISK_INFO_SUCCESS) {
-               color_enable(UL_COLOR_BOLD);
-               fputs(msg, out);
-               color_disable();
-       } else {
-simple:
-               fputs(msg, out);
-       }
+       fputs(msg, out);
        fputc('\n', out);
 }
 
@@ -256,7 +227,7 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
                return ask_offset(cxt, ask, buf, sizeof(buf));
        case FDISK_ASKTYPE_INFO:
                info_count++;
-               fputs_info(ask, stdout, buf, sizeof(buf));
+               fputs_info(ask, stdout);
                break;
        case FDISK_ASKTYPE_WARNX:
                color_fenable(UL_COLOR_RED, stderr);