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.
11 SM_IDSTR(id
, "@(#)$Id: t-string.c,v 1.11 2001/09/11 04:04:49 gshapiro Exp $")
15 #include <sm/string.h>
29 sm_test_begin(argc
, argv
, "test string utilities");
31 s
= sm_stringf_x("%.3s%03d", "foobar", 42);
33 SM_TEST(strcmp(s
, r
) == 0);
35 s
= sm_stringf_x("+%*x+", 2000, 0xCAFE);
36 sm_snprintf(buf
, 4096, "+%*x+", 2000, 0xCAFE);
37 SM_TEST(strcmp(s
, buf
) == 0);
40 n
= sm_snprintf(foo
, sizeof(foo
), "foobar%dbaz", 42);
43 SM_TEST(strcmp(foo
, r
) == 0);