190792Sgshapiro/* 2261363Sgshapiro * Copyright (c) 2001 Proofpoint, Inc. and its suppliers. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * 590792Sgshapiro * By using this file, you agree to the terms and conditions set 690792Sgshapiro * forth in the LICENSE file which can be found at the top level of 790792Sgshapiro * the sendmail distribution. 890792Sgshapiro * 990792Sgshapiro */ 1090792Sgshapiro 1164562Sgshapiro#include <stdio.h> 1264562Sgshapiro#include <sysexits.h> 1364562Sgshapiro 1490792Sgshapiro#ifndef lint 15266692Sgshapirostatic char id[] = "@(#)$Id: t_snprintf.c,v 8.5 2013-11-22 20:52:01 ca Exp $"; 1690792Sgshapiro#endif /* ! lint */ 1790792Sgshapiro 1864562Sgshapiro#define TEST_STRING "1234567890" 1964562Sgshapiro 2064562Sgshapiroint 2164562Sgshapiromain(argc, argv) 2264562Sgshapiro int argc; 2364562Sgshapiro char **argv; 2464562Sgshapiro{ 2564562Sgshapiro int r; 2664562Sgshapiro char buf[5]; 2764562Sgshapiro 2864562Sgshapiro r = snprintf(buf, sizeof buf, "%s", TEST_STRING); 2964562Sgshapiro 3080785Sgshapiro if (buf[sizeof buf - 1] != '\0' || 3180785Sgshapiro r != strlen(TEST_STRING)) 3264562Sgshapiro { 3364562Sgshapiro fprintf(stderr, "Add the following to devtools/Site/site.config.m4:\n\n"); 3464562Sgshapiro fprintf(stderr, "APPENDDEF(`confENVDEF', `-DSNPRINTF_IS_BROKEN=1')\n\n"); 3564562Sgshapiro exit(EX_OSERR); 3664562Sgshapiro } 3764562Sgshapiro fprintf(stderr, "snprintf() appears to work properly\n"); 3864562Sgshapiro exit(EX_OK); 3964562Sgshapiro} 40