2002-02-17 21:56:45 +00:00
|
|
|
/*
|
2002-04-10 03:05:00 +00:00
|
|
|
* Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
|
2002-02-17 21:56:45 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* By using this file, you agree to the terms and conditions set
|
|
|
|
* forth in the LICENSE file which can be found at the top level of
|
|
|
|
* the sendmail distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sm/gen.h>
|
2002-06-11 21:12:04 +00:00
|
|
|
SM_IDSTR(id, "@(#)$Id: t-fopen.c,v 1.9 2002/02/06 23:57:45 ca Exp $")
|
2002-02-17 21:56:45 +00:00
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sm/io.h>
|
|
|
|
#include <sm/test.h>
|
|
|
|
|
|
|
|
/* ARGSUSED0 */
|
|
|
|
int
|
|
|
|
main(argc, argv)
|
|
|
|
int argc;
|
|
|
|
char *argv[];
|
|
|
|
{
|
2002-04-10 03:05:00 +00:00
|
|
|
int m, r;
|
2002-02-17 21:56:45 +00:00
|
|
|
SM_FILE_T *out;
|
|
|
|
|
|
|
|
sm_test_begin(argc, argv, "test sm_io_fopen");
|
|
|
|
out = sm_io_fopen("foo", O_WRONLY|O_APPEND|O_CREAT, 0666);
|
|
|
|
SM_TEST(out != NULL);
|
|
|
|
if (out != NULL)
|
|
|
|
{
|
|
|
|
(void) sm_io_fprintf(out, SM_TIME_DEFAULT, "foo\n");
|
2002-04-10 03:05:00 +00:00
|
|
|
r = sm_io_getinfo(out, SM_IO_WHAT_MODE, &m);
|
|
|
|
SM_TEST(r == 0);
|
|
|
|
SM_TEST(m == SM_IO_WRONLY);
|
2002-02-17 21:56:45 +00:00
|
|
|
sm_io_close(out, SM_TIME_DEFAULT);
|
|
|
|
}
|
|
|
|
return sm_test_end();
|
|
|
|
}
|