t-fopen.c revision 261194
1263646Sbapt/*
2263646Sbapt * Copyright (c) 2000-2002 Proofpoint, Inc. and its suppliers.
3263646Sbapt *	All rights reserved.
4263646Sbapt *
5263646Sbapt * By using this file, you agree to the terms and conditions set
6263646Sbapt * forth in the LICENSE file which can be found at the top level of
7263646Sbapt * the sendmail distribution.
8263646Sbapt */
9263646Sbapt
10263646Sbapt#include <sm/gen.h>
11263646SbaptSM_IDSTR(id, "@(#)$Id: t-fopen.c,v 1.10 2013/11/22 20:51:43 ca Exp $")
12263646Sbapt
13263646Sbapt#include <fcntl.h>
14263646Sbapt#include <sm/io.h>
15263646Sbapt#include <sm/test.h>
16263646Sbapt
17263646Sbapt/* ARGSUSED0 */
18263646Sbaptint
19263646Sbaptmain(argc, argv)
20263646Sbapt	int argc;
21263646Sbapt	char *argv[];
22263646Sbapt{
23263646Sbapt	int m, r;
24263646Sbapt	SM_FILE_T *out;
25263646Sbapt
26263646Sbapt	sm_test_begin(argc, argv, "test sm_io_fopen");
27263646Sbapt	out = sm_io_fopen("foo", O_WRONLY|O_APPEND|O_CREAT, 0666);
28263646Sbapt	SM_TEST(out != NULL);
29263646Sbapt	if (out != NULL)
30263646Sbapt	{
31263646Sbapt		(void) sm_io_fprintf(out, SM_TIME_DEFAULT, "foo\n");
32263646Sbapt		r = sm_io_getinfo(out, SM_IO_WHAT_MODE, &m);
33263646Sbapt		SM_TEST(r == 0);
34263646Sbapt		SM_TEST(m == SM_IO_WRONLY);
35263646Sbapt		sm_io_close(out, SM_TIME_DEFAULT);
36263646Sbapt	}
37263646Sbapt	return sm_test_end();
38263646Sbapt}
39263646Sbapt