summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/test/t_snprintf.c
blob: 4789f4974f0b843cc04a2a7523af3165c1c7e588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <sysexits.h>

#define TEST_STRING	"1234567890"

int
main(argc, argv)
	int argc;
	char **argv;
{
	int r;
	char buf[5];

	r = snprintf(buf, sizeof buf, "%s", TEST_STRING);

	if (buf[sizeof buf - 1] != '\0')
	{
		fprintf(stderr, "Add the following to devtools/Site/site.config.m4:\n\n");
		fprintf(stderr, "APPENDDEF(`confENVDEF', `-DSNPRINTF_IS_BROKEN=1')\n\n");
		exit(EX_OSERR);
	}
	fprintf(stderr, "snprintf() appears to work properly\n");
	exit(EX_OK);
}
OpenPOWER on IntegriCloud