summaryrefslogtreecommitdiffstats
path: root/testutil/is-datatype-struct.c
blob: f1c76758ccb9b72ea2c5ed37551518775bd6f1e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* See LICENSE file for copyright and license details. */
#include "../libsyscalls.h"

#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>


int
main(int argc, char *argv[])
{
	enum libsyscalls_os os = (enum libsyscalls_os)atoi(argv[1]);
	enum libsyscalls_arch arch = (enum libsyscalls_arch)atoi(argv[2]);
	enum libsyscalls_datatype type = (enum libsyscalls_datatype)atoi(argv[3]);
	struct libsyscalls_datatype_description desc;
	enum libsyscalls_error err;
	size_t i;

	err = libsyscalls_get_datatype_description(os, arch, type, &desc);
	if (err == LIBSYSCALLS_E_ISSTRUCT) {
		return 0;
	} else if (err) {
		fprintf(stderr, "libsyscalls_get_datatype_description %s %s %s: ", argv[4], argv[5], argv[6]);
		libsyscalls_perror(NULL, err);
		return 2;
	}
	return 1;
}