xref: /titanic_52/usr/src/cmd/sendmail/libsm/t-fopen.c (revision 69a119caa6570c7077699161b7c28b6ee9f8b0f4)
1 /*
2  * Copyright (c) 2000-2002 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-fopen.c,v 1.9 2002/02/06 23:57:45 ca Exp $")
14 
15 #include <fcntl.h>
16 #include <sm/io.h>
17 #include <sm/test.h>
18 
19 /* ARGSUSED0 */
20 int
21 main(argc, argv)
22 	int argc;
23 	char *argv[];
24 {
25 	int m, r;
26 	SM_FILE_T *out;
27 
28 	sm_test_begin(argc, argv, "test sm_io_fopen");
29 	out = sm_io_fopen("foo", O_WRONLY|O_APPEND|O_CREAT, 0666);
30 	SM_TEST(out != NULL);
31 	if (out != NULL)
32 	{
33 		(void) sm_io_fprintf(out, SM_TIME_DEFAULT, "foo\n");
34 		r = sm_io_getinfo(out, SM_IO_WHAT_MODE, &m);
35 		SM_TEST(r == 0);
36 		SM_TEST(m == SM_IO_WRONLY);
37 		sm_io_close(out, SM_TIME_DEFAULT);
38 	}
39 	return sm_test_end();
40 }
41