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