summaryrefslogblamecommitdiffstats
path: root/testutil/get-error.c
blob: d390a60525203e91bc97baf1155d82081b8f4fd8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11






                                                         



                                                                                         

   
                           


              




                                                 













                                               
/* See LICENSE file for copyright and license details. */
#include "../libsyscalls.h"

#include <stddef.h>
#include <stdio.h>
#include <string.h>

#if defined(__clang__)
# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* clang is just being silly */
#endif


int
main(int argc, char **argv)
{
	int i;

	if (argc < 2) {
		fprintf(stderr, "usage error\n");
		return 3;
	}

	for (i = 1; i < argc; i++) {
#define X(N, S)\
		if (!strcmp(argv[i], #N))\
			printf("%s\n", S)
		LIBSYSCALLS_LIST_ERRORS(X, ;);
#undef X
	}

	if (fflush(stdout) || fclose(stdout)) {
		perror(NULL);
		return 1;
	}
	return 0;
}