|
Packit Service |
b671d8 |
/*
|
|
Packit Service |
b671d8 |
* Generic output functions
|
|
Packit Service |
b671d8 |
* This file is part of the dmidecode project.
|
|
Packit Service |
b671d8 |
*
|
|
Packit Service |
b671d8 |
* Copyright (C) 2020 Jean Delvare <jdelvare@suse.de>
|
|
Packit Service |
b671d8 |
*
|
|
Packit Service |
b671d8 |
* This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
b671d8 |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
b671d8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
Packit Service |
b671d8 |
* (at your option) any later version.
|
|
Packit Service |
b671d8 |
*
|
|
Packit Service |
b671d8 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
b671d8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
b671d8 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
b671d8 |
* GNU General Public License for more details.
|
|
Packit Service |
b671d8 |
*
|
|
Packit Service |
b671d8 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
b671d8 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
b671d8 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
Packit Service |
b671d8 |
*/
|
|
Packit Service |
b671d8 |
|
|
Packit Service |
b671d8 |
#include <stdarg.h>
|
|
Packit Service |
b671d8 |
#include <stdio.h>
|
|
Packit Service |
b671d8 |
#include "dmioutput.h"
|
|
Packit Service |
b671d8 |
|
|
Packit Service |
b671d8 |
void pr_comment(const char *format, ...)
|
|
Packit Service |
b671d8 |
{
|
|
Packit Service |
b671d8 |
va_list args;
|
|
Packit Service |
b671d8 |
|
|
Packit Service |
b671d8 |
printf("# ");
|
|
Packit Service |
b671d8 |
va_start(args, format);
|
|
Packit Service |
b671d8 |
vprintf(format, args);
|
|
Packit Service |
b671d8 |
va_end(args);
|
|
Packit Service |
b671d8 |
printf("\n");
|
|
Packit Service |
b671d8 |
}
|
|
Packit Service |
8ba4c5 |
|
|
Packit Service |
8ba4c5 |
void pr_info(const char *format, ...)
|
|
Packit Service |
8ba4c5 |
{
|
|
Packit Service |
8ba4c5 |
va_list args;
|
|
Packit Service |
8ba4c5 |
|
|
Packit Service |
8ba4c5 |
va_start(args, format);
|
|
Packit Service |
8ba4c5 |
vprintf(format, args);
|
|
Packit Service |
8ba4c5 |
va_end(args);
|
|
Packit Service |
8ba4c5 |
printf("\n");
|
|
Packit Service |
8ba4c5 |
}
|
|
Packit Service |
1d15be |
|
|
Packit Service |
1d15be |
void pr_handle(const struct dmi_header *h)
|
|
Packit Service |
1d15be |
{
|
|
Packit Service |
1d15be |
printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
|
Packit Service |
1d15be |
h->handle, h->type, h->length);
|
|
Packit Service |
1d15be |
}
|
|
Packit Service |
a1ff7a |
|
|
Packit Service |
a1ff7a |
void pr_handle_name(const char *format, ...)
|
|
Packit Service |
a1ff7a |
{
|
|
Packit Service |
a1ff7a |
va_list args;
|
|
Packit Service |
a1ff7a |
|
|
Packit Service |
a1ff7a |
va_start(args, format);
|
|
Packit Service |
a1ff7a |
vprintf(format, args);
|
|
Packit Service |
a1ff7a |
va_end(args);
|
|
Packit Service |
a1ff7a |
printf("\n");
|
|
Packit Service |
a1ff7a |
}
|
|
Packit Service |
46ab7f |
|
|
Packit Service |
46ab7f |
void pr_attr(const char *name, const char *format, ...)
|
|
Packit Service |
46ab7f |
{
|
|
Packit Service |
46ab7f |
va_list args;
|
|
Packit Service |
46ab7f |
|
|
Packit Service |
46ab7f |
printf("\t%s: ", name);
|
|
Packit Service |
46ab7f |
|
|
Packit Service |
46ab7f |
va_start(args, format);
|
|
Packit Service |
46ab7f |
vprintf(format, args);
|
|
Packit Service |
46ab7f |
va_end(args);
|
|
Packit Service |
46ab7f |
printf("\n");
|
|
Packit Service |
46ab7f |
}
|
|
Packit Service |
67160e |
|
|
Packit Service |
a7a251 |
void pr_subattr(const char *name, const char *format, ...)
|
|
Packit Service |
a7a251 |
{
|
|
Packit Service |
a7a251 |
va_list args;
|
|
Packit Service |
a7a251 |
|
|
Packit Service |
a7a251 |
printf("\t\t%s: ", name);
|
|
Packit Service |
a7a251 |
|
|
Packit Service |
a7a251 |
va_start(args, format);
|
|
Packit Service |
a7a251 |
vprintf(format, args);
|
|
Packit Service |
a7a251 |
va_end(args);
|
|
Packit Service |
a7a251 |
printf("\n");
|
|
Packit Service |
a7a251 |
}
|
|
Packit Service |
a7a251 |
|
|
Packit Service |
67160e |
void pr_list_start(const char *name, const char *format, ...)
|
|
Packit Service |
67160e |
{
|
|
Packit Service |
67160e |
va_list args;
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
printf("\t%s:", name);
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
/* format is optional, skip value if not provided */
|
|
Packit Service |
67160e |
if (format)
|
|
Packit Service |
67160e |
{
|
|
Packit Service |
67160e |
printf(" ");
|
|
Packit Service |
67160e |
va_start(args, format);
|
|
Packit Service |
67160e |
vprintf(format, args);
|
|
Packit Service |
67160e |
va_end(args);
|
|
Packit Service |
67160e |
}
|
|
Packit Service |
67160e |
printf("\n");
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
}
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
void pr_list_item(const char *format, ...)
|
|
Packit Service |
67160e |
{
|
|
Packit Service |
67160e |
va_list args;
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
printf("\t\t");
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
va_start(args, format);
|
|
Packit Service |
67160e |
vprintf(format, args);
|
|
Packit Service |
67160e |
va_end(args);
|
|
Packit Service |
67160e |
printf("\n");
|
|
Packit Service |
67160e |
}
|
|
Packit Service |
67160e |
|
|
Packit Service |
67160e |
void pr_list_end(void)
|
|
Packit Service |
67160e |
{
|
|
Packit Service |
67160e |
/* a no-op for text output */
|
|
Packit Service |
67160e |
}
|