Blame dmioutput.c

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