xref: /titanic_41/usr/src/cmd/sendmail/libsm/t-strio.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  *
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  */
9 
10 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 
12 #include <sm/gen.h>
13 SM_IDSTR(id, "@(#)$Id: t-strio.c,v 1.9 2001/03/03 04:00:53 ca Exp $")
14 #include <sm/string.h>
15 #include <sm/io.h>
16 #include <sm/test.h>
17 
18 int
19 main(argc, argv)
20 	int argc;
21 	char *argv[];
22 {
23 	char buf[20];
24 	char *r;
25 	SM_FILE_T f;
26 
27 	sm_test_begin(argc, argv, "test strio");
28 	(void) memset(buf, '.', 20);
29 	sm_strio_init(&f, buf, 10);
30 	(void) sm_io_fprintf(&f, SM_TIME_DEFAULT, "foobarbazoom");
31 	sm_io_flush(&f, SM_TIME_DEFAULT);
32 	r = "foobarbaz";
33 	SM_TEST(strcmp(buf, r) == 0);
34 	return sm_test_end();
35 }
36