Import sendmail 8.13.7
[dragonfly.git] / contrib / sendmail-8.13.7 / test / t_snprintf.c
blob8a0378fa2dce9a38c79c19f132f6644e085d9ed2
1 /*
2 * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 */
11 #include <stdio.h>
12 #include <sysexits.h>
14 #ifndef lint
15 static char id[] = "@(#)$Id: t_snprintf.c,v 8.4 2001/09/23 03:35:41 ca Exp $";
16 #endif /* ! lint */
18 #define TEST_STRING "1234567890"
20 int
21 main(argc, argv)
22 int argc;
23 char **argv;
25 int r;
26 char buf[5];
28 r = snprintf(buf, sizeof buf, "%s", TEST_STRING);
30 if (buf[sizeof buf - 1] != '\0' ||
31 r != strlen(TEST_STRING))
33 fprintf(stderr, "Add the following to devtools/Site/site.config.m4:\n\n");
34 fprintf(stderr, "APPENDDEF(`confENVDEF', `-DSNPRINTF_IS_BROKEN=1')\n\n");
35 exit(EX_OSERR);
37 fprintf(stderr, "snprintf() appears to work properly\n");
38 exit(EX_OK);