[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 10/11] dmidecode: Add helper function for separators
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 10/11] dmidecode: Add helper function for separators |
Date: |
Tue, 24 Mar 2020 17:41:39 +0100 |
A simple helper function to print a blank line between records.
Signed-off-by: Jean Delvare <address@hidden>
---
dmidecode.c | 9 +++++----
dmioutput.c | 5 +++++
dmioutput.h | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
--- dmidecode.orig/dmidecode.c 2020-03-24 15:01:18.304886924 +0100
+++ dmidecode/dmidecode.c 2020-03-24 15:01:42.564182354 +0100
@@ -5068,7 +5068,7 @@ static void dmi_decode(const struct dmi_
h->type >= 128 ? "OEM-specific" : "Unknown");
dmi_dump(h);
}
- printf("\n");
+ pr_sep();
}
static void to_dmi_header(struct dmi_header *h, u8 *data)
@@ -5195,7 +5195,8 @@ static void dmi_table_decode(u8 *buf, u3
if ((unsigned long)(next - buf) > len)
{
if (display && !(opt.flags & FLAG_QUIET))
- printf("\t<TRUNCATED>\n\n");
+ printf("\t<TRUNCATED>\n");
+ pr_sep();
data = next;
break;
}
@@ -5213,7 +5214,7 @@ static void dmi_table_decode(u8 *buf, u3
if (opt.flags & FLAG_DUMP)
{
dmi_dump(&h);
- printf("\n");
+ pr_sep();
}
else
dmi_decode(&h, ver);
@@ -5271,7 +5272,7 @@ static void dmi_table(off_t base, u32 le
pr_info("Table at 0x%08llX.",
(unsigned long long)base);
}
- printf("\n");
+ pr_sep();
}
if ((flags & FLAG_NO_FILE_OFFSET) || (opt.flags & FLAG_FROM_DUMP))
--- dmidecode.orig/dmioutput.c 2020-03-24 15:01:01.667684315 +0100
+++ dmidecode/dmioutput.c 2020-03-24 15:01:42.564182354 +0100
@@ -118,3 +118,8 @@ void pr_list_end(void)
{
/* a no-op for text output */
}
+
+void pr_sep(void)
+{
+ printf("\n");
+}
--- dmidecode.orig/dmioutput.h 2020-03-24 15:01:01.667684315 +0100
+++ dmidecode/dmioutput.h 2020-03-24 15:01:42.564182354 +0100
@@ -30,3 +30,4 @@ void pr_subattr(const char *name, const
void pr_list_start(const char *name, const char *format, ...);
void pr_list_item(const char *format, ...);
void pr_list_end(void);
+void pr_sep(void);
--
Jean Delvare
SUSE L3 Support
- [dmidecode] [PATCH 00/11] dmidecode: Output through helper functions, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 01/11] dmidecode: Add helper function pr_comment, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 03/11] dmidecode: Protect dmidecode.h against double inclusion, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 02/11] dmidecode: Add helper function pr_info, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 04/11] dmidecode: Add helper function pr_handle, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 05/11] dmidecode: Add helper function pr_handle_name, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 06/11] dmidecode: Add helper function pr_attr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 07/11] dmidecode: Add helper functions pr_list_start/item/end, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 08/11] dmidecode: Add helper function pr_subattr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 09/11] dmidecode: Use the print helpers in dump mode too, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 10/11] dmidecode: Add helper function for separators,
Jean Delvare <=
- [dmidecode] [PATCH 11/11] dmidecode: Add helper function for structure errors, Jean Delvare, 2020/03/24