diff --git a/src/common/printing.h b/src/common/printing.h index ad02b8047..7ccc645f2 100644 --- a/src/common/printing.h +++ b/src/common/printing.h @@ -5,7 +5,7 @@ typedef enum FFPrintType { FF_PRINT_TYPE_DEFAULT = 0, - FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, + FF_PRINT_TYPE_NO_CUSTOM_KEY = 1 << 0, // key has been formatted outside FF_PRINT_TYPE_NO_CUSTOM_KEY_COLOR = 1 << 1, FF_PRINT_TYPE_NO_CUSTOM_KEY_WIDTH = 1 << 2, FF_PRINT_TYPE_NO_CUSTOM_OUTPUT_FORMAT = 1 << 3, // reserved diff --git a/src/modules/bios/bios.c b/src/modules/bios/bios.c index 5e9d1742c..b9a4fc902 100644 --- a/src/modules/bios/bios.c +++ b/src/modules/bios/bios.c @@ -50,7 +50,7 @@ void ffPrintBios(FFBiosOptions* options) if(options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY); ffStrbufWriteTo(&bios.version, stdout); if (bios.release.length) printf(" (%s)\n", bios.release.chars); @@ -59,7 +59,7 @@ void ffPrintBios(FFBiosOptions* options) } else { - FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BIOS_NUM_FORMAT_ARGS, ((FFformatarg[]) { + FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BIOS_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &bios.date, "date"}, {FF_FORMAT_ARG_TYPE_STRBUF, &bios.release, "release"}, {FF_FORMAT_ARG_TYPE_STRBUF, &bios.vendor, "vendor"}, diff --git a/src/modules/cpucache/cpucache.c b/src/modules/cpucache/cpucache.c index 31b931e6a..d728929bf 100644 --- a/src/modules/cpucache/cpucache.c +++ b/src/modules/cpucache/cpucache.c @@ -12,15 +12,19 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate(); + char levelStr[4] = "L"; for (uint32_t i = 0; i < sizeof (result->caches) / sizeof (result->caches[0]) && result->caches[i].length > 0; i++) { ffStrbufClear(&key); + levelStr[1] = (char) ('1' + i); if (options->moduleArgs.key.length == 0) - ffStrbufAppendF(&key, "%s (L%u)", FF_CPUCACHE_DISPLAY_NAME, i + 1); + ffStrbufAppendF(&key, "%s (%s)", FF_CPUCACHE_DISPLAY_NAME, levelStr); else { - FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 1, ((FFformatarg[]){ - {FF_FORMAT_ARG_TYPE_UINT, &i, "index"}, + uint32_t index = i + 1; + FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){ + {FF_FORMAT_ARG_TYPE_UINT, &index, "index"}, + {FF_FORMAT_ARG_TYPE_STRING, levelStr, "level"}, })); } @@ -49,14 +53,14 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption if(options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY); ffStrbufPutTo(&buffer, stdout); } else { FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate(); ffParseSize(sum, &buffer2); - FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) { + FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "result"}, {FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "sum"}, })); diff --git a/src/modules/diskio/diskio.c b/src/modules/diskio/diskio.c index 424226b60..dbe52f061 100644 --- a/src/modules/diskio/diskio.c +++ b/src/modules/diskio/diskio.c @@ -37,7 +37,7 @@ void ffPrintDiskIO(FFDiskIOOptions* options) if(error) { - ffPrintError(FF_DISKIO_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error); + ffPrintError(FF_DISKIO_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error); return; } @@ -55,7 +55,7 @@ void ffPrintDiskIO(FFDiskIOOptions* options) if(options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY); ffParseSize(dev->bytesRead, &buffer); if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s"); diff --git a/src/modules/netio/netio.c b/src/modules/netio/netio.c index 10d7a3ca1..cc4a70238 100644 --- a/src/modules/netio/netio.c +++ b/src/modules/netio/netio.c @@ -57,7 +57,7 @@ void ffPrintNetIO(FFNetIOOptions* options) if(options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY); ffParseSize(inf->rxBytes, &buffer); if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s"); diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 8827eb317..ef042382d 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -70,7 +70,7 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) if(options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY); if (physicalType[0] || removableType[0] || readOnlyType[0]) { diff --git a/src/modules/physicalmemory/physicalmemory.c b/src/modules/physicalmemory/physicalmemory.c index fd748d4c8..c629a3831 100644 --- a/src/modules/physicalmemory/physicalmemory.c +++ b/src/modules/physicalmemory/physicalmemory.c @@ -32,11 +32,7 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) if (options->moduleArgs.outputFormat.length == 0) { - ffPrintLogoAndKey( - FF_PHYSICALMEMORY_DISPLAY_NAME, - result.length == 1 ? 0 : (uint8_t) i, - &options->moduleArgs, - FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(FF_PHYSICALMEMORY_DISPLAY_NAME, result.length == 1 ? 0 : (uint8_t) i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); fputs(prettySize.chars, stdout); fputs(" - ", stdout); @@ -53,7 +49,7 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options) } else { - FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]) { + FF_PRINT_FORMAT_CHECKED(FF_PHYSICALMEMORY_DISPLAY_NAME, (uint8_t) i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_UINT64, &device->size, "bytes"}, {FF_FORMAT_ARG_TYPE_STRBUF, &prettySize, "size"}, {FF_FORMAT_ARG_TYPE_UINT, &device->maxSpeed, "max-speed"},