1 #include <stdio.h> 2 #include <sysexits.h> 3 4 #define TEST_STRING "1234567890" 5 6 int 7 main(argc, argv) 8 int argc; 9 char **argv; 10 { 11 int r; 12 char buf[5]; 13 14 r = snprintf(buf, sizeof buf, "%s", TEST_STRING); 15 16 if (buf[sizeof buf - 1] != '\0') 17 { 18 fprintf(stderr, "Add the following to devtools/Site/site.config.m4:\n\n"); 19 fprintf(stderr, "APPENDDEF(`confENVDEF', `-DSNPRINTF_IS_BROKEN=1')\n\n"); 20 exit(EX_OSERR); 21 } 22 fprintf(stderr, "snprintf() appears to work properly\n"); 23 exit(EX_OK); 24 } 25