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);
}
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);