Blame src/output/pe_output_image_category.c

007c7f
/***************************************************************/
007c7f
/*  perk: PE Resource Kit                                      */
ced38a
/*  Copyright (C) 2015--2017  Z. Gilboa                        */
007c7f
/*  Released under GPLv2 and GPLv3; see COPYING.PERK.          */
007c7f
/***************************************************************/
007c7f
007c7f
#include <stdio.h>
007c7f
007c7f
#include <perk/perk.h>
007c7f
#include <perk/perk_output.h>
007c7f
#include "perk_errinfo_impl.h"
007c7f
cd4ace
int pe_output_image_category(
007c7f
	const struct pe_driver_ctx *	dctx,
204e71
	const struct pe_image_meta *	meta,
007c7f
	FILE *				fout)
007c7f
{
50a830
	struct pe_info_string		abi;
919d9d
	struct pe_info_string		subtype;
a97030
	struct pe_info_string		subsystem;
58df62
	struct pe_info_string		framework;
58df62
f11c1f
	if (!fout)
f11c1f
		fout = stdout;
007c7f
50a830
	pe_get_image_abi      (meta,&abi;;
919d9d
	pe_get_image_subtype  (meta,&subtype);
a97030
	pe_get_image_subsystem(meta,&subsystem);
58df62
	pe_get_image_framework(meta,&framework);
58df62
007c7f
	if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) {
44fcac
		if (fprintf(fout,"category:\n- %s:\n- %s:\n- %s:\n- %s:\n",
50a830
				abi.buffer,
919d9d
				subtype.buffer,
a97030
				subsystem.buffer,
58df62
				framework.buffer) < 0)
f11c1f
			return PERK_FILE_ERROR(dctx);
007c7f
	} else {
007c7f
		if (fprintf(fout,"%s-%s-%s-%s\n",
50a830
				abi.buffer,
919d9d
				subtype.buffer,
a97030
				subsystem.buffer,
58df62
				framework.buffer) < 0)
f11c1f
			return PERK_FILE_ERROR(dctx);
007c7f
	}
007c7f
f11c1f
	return 0;
007c7f
}