1318436Sngie/*
2346920Sngie * Copyright (c) 2017 Enji Cooper <ngie@FreeBSD.org>
3318436Sngie *
4318436Sngie * Redistribution and use in source and binary forms, with or without
5318436Sngie * modification, are permitted provided that the following conditions
6318436Sngie * are met:
7318436Sngie * 1. Redistributions of source code must retain the above copyright
8318436Sngie *    notice, this list of conditions and the following disclaimer.
9318436Sngie * 2. Redistributions in binary form must reproduce the above copyright
10318436Sngie *    notice, this list of conditions and the following disclaimer in the
11318436Sngie *    documentation and/or other materials provided with the distribution.
12318436Sngie *
13318436Sngie * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14318436Sngie * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15318436Sngie * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16318436Sngie * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17318436Sngie * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18318436Sngie * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19318436Sngie * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20318436Sngie * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21318436Sngie * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22318436Sngie * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23318436Sngie * POSSIBILITY OF SUCH DAMAGE.
24318436Sngie */
25318436Sngie
26318436Sngie#include <sys/cdefs.h>
27318436Sngie__RCSID("$FreeBSD: stable/11/usr.bin/getconf/tests/arch_type.c 346920 2019-04-29 19:36:46Z ngie $");
28318436Sngie
29318436Sngie#include <assert.h>
30318436Sngie#include <stdbool.h>
31318436Sngie#include <stdlib.h>
32318436Sngie#include <stdio.h>
33318436Sngie
34318436Sngieint
35318436Sngiemain(void)
36318436Sngie{
37318436Sngie	bool known_arch_type;
38318436Sngie
39318436Sngie	known_arch_type = false;
40318436Sngie#ifdef	__LP64__
41318436Sngie	printf("LP64\n");
42318436Sngie	known_arch_type = true;
43318436Sngie#endif
44318436Sngie#ifdef	__LP32__
45318436Sngie	printf("LP32\n");
46318436Sngie	known_arch_type = true;
47318436Sngie#endif
48318436Sngie#ifdef	__ILP32__
49318436Sngie	printf("ILP32\n");
50318436Sngie	known_arch_type = true;
51318436Sngie#endif
52318436Sngie
53318436Sngie	if (known_arch_type)
54318436Sngie		exit(0);
55318436Sngie
56318436Sngie	fprintf(stderr, "unknown architecture type detected\n");
57318436Sngie	assert(0);
58318436Sngie}
59