2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
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.
10 #pragma ident "%Z%%M% %I% %E% SMI"
13 SM_IDSTR(id
, "@(#)$Id: t-string.c,v 1.9 2001/01/26 03:28:43 ca Exp $")
17 #include <sm/string.h>
31 sm_test_begin(argc
, argv
, "test string utilities");
33 s
= sm_stringf_x("%.3s%03d", "foobar", 42);
35 SM_TEST(strcmp(s
, r
) == 0);
37 s
= sm_stringf_x("+%*x+", 2000, 0xCAFE);
38 sm_snprintf(buf
, 4096, "+%*x+", 2000, 0xCAFE);
39 SM_TEST(strcmp(s
, buf
) == 0);
42 n
= sm_snprintf(foo
, sizeof(foo
), "foobar%dbaz", 42);
45 SM_TEST(strcmp(foo
, r
) == 0);