xref: /titanic_41/usr/src/cmd/sendmail/libsm/t-strio.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3*7c478bd9Sstevel@tonic-gate  *	All rights reserved.
4*7c478bd9Sstevel@tonic-gate  *
5*7c478bd9Sstevel@tonic-gate  * By using this file, you agree to the terms and conditions set
6*7c478bd9Sstevel@tonic-gate  * forth in the LICENSE file which can be found at the top level of
7*7c478bd9Sstevel@tonic-gate  * the sendmail distribution.
8*7c478bd9Sstevel@tonic-gate  */
9*7c478bd9Sstevel@tonic-gate 
10*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
11*7c478bd9Sstevel@tonic-gate 
12*7c478bd9Sstevel@tonic-gate #include <sm/gen.h>
13*7c478bd9Sstevel@tonic-gate SM_IDSTR(id, "@(#)$Id: t-strio.c,v 1.9 2001/03/03 04:00:53 ca Exp $")
14*7c478bd9Sstevel@tonic-gate #include <sm/string.h>
15*7c478bd9Sstevel@tonic-gate #include <sm/io.h>
16*7c478bd9Sstevel@tonic-gate #include <sm/test.h>
17*7c478bd9Sstevel@tonic-gate 
18*7c478bd9Sstevel@tonic-gate int
19*7c478bd9Sstevel@tonic-gate main(argc, argv)
20*7c478bd9Sstevel@tonic-gate 	int argc;
21*7c478bd9Sstevel@tonic-gate 	char *argv[];
22*7c478bd9Sstevel@tonic-gate {
23*7c478bd9Sstevel@tonic-gate 	char buf[20];
24*7c478bd9Sstevel@tonic-gate 	char *r;
25*7c478bd9Sstevel@tonic-gate 	SM_FILE_T f;
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate 	sm_test_begin(argc, argv, "test strio");
28*7c478bd9Sstevel@tonic-gate 	(void) memset(buf, '.', 20);
29*7c478bd9Sstevel@tonic-gate 	sm_strio_init(&f, buf, 10);
30*7c478bd9Sstevel@tonic-gate 	(void) sm_io_fprintf(&f, SM_TIME_DEFAULT, "foobarbazoom");
31*7c478bd9Sstevel@tonic-gate 	sm_io_flush(&f, SM_TIME_DEFAULT);
32*7c478bd9Sstevel@tonic-gate 	r = "foobarbaz";
33*7c478bd9Sstevel@tonic-gate 	SM_TEST(strcmp(buf, r) == 0);
34*7c478bd9Sstevel@tonic-gate 	return sm_test_end();
35*7c478bd9Sstevel@tonic-gate }
36