Update zoneinfo database.
[dragonfly/netmp.git] / contrib / sendmail / libsm / t-string.c
blob0506e7aa407795919f59ddece8a173d8e4424fc9
1 /*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
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.
8 */
10 #include <sm/gen.h>
11 SM_IDSTR(id, "@(#)$Id: t-string.c,v 1.11 2001/09/11 04:04:49 gshapiro Exp $")
13 #include <sm/exc.h>
14 #include <sm/io.h>
15 #include <sm/string.h>
16 #include <sm/test.h>
18 int
19 main(argc, argv)
20 int argc;
21 char **argv;
23 char *s;
24 char buf[4096];
25 char foo[4];
26 char *r;
27 int n;
29 sm_test_begin(argc, argv, "test string utilities");
31 s = sm_stringf_x("%.3s%03d", "foobar", 42);
32 r = "foo042";
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);
39 foo[3] = 1;
40 n = sm_snprintf(foo, sizeof(foo), "foobar%dbaz", 42);
41 SM_TEST(n == 11);
42 r = "foo";
43 SM_TEST(strcmp(foo, r) == 0);
45 return sm_test_end();