freebsd-dev/contrib/sendmail/test/t_snprintf.c
Gregory Neil Shapiro 06f25ae9f1 Import of sendmail version 8.11.0 into vendor branch SENDMAIL with
release tag v8_11_0.

Obtained from: ftp://ftp.sendmail.org/pub/sendmail/
2000-08-12 21:55:49 +00:00

25 lines
485 B
C

#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);
}