8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sendmail / libsm / t-string.c
blob30cef8d236e84a11658bf0b2b9b8427be4690359
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 #pragma ident "%Z%%M% %I% %E% SMI"
12 #include <sm/gen.h>
13 SM_IDSTR(id, "@(#)$Id: t-string.c,v 1.9 2001/01/26 03:28:43 ca Exp $")
15 #include <sm/exc.h>
16 #include <sm/io.h>
17 #include <sm/string.h>
18 #include <sm/test.h>
20 int
21 main(argc, argv)
22 int argc;
23 char **argv;
25 char *s;
26 char buf[4096];
27 char foo[4];
28 char *r;
29 int n;
31 sm_test_begin(argc, argv, "test string utilities");
33 s = sm_stringf_x("%.3s%03d", "foobar", 42);
34 r = "foo042";
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);
41 foo[3] = 1;
42 n = sm_snprintf(foo, sizeof(foo), "foobar%dbaz", 42);
43 SM_TEST(n == 11);
44 r = "foo";
45 SM_TEST(strcmp(foo, r) == 0);
47 return sm_test_end();