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