1 /* 2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Chris Torek. 9 * 10 * By using this file, you agree to the terms and conditions set 11 * forth in the LICENSE file which can be found at the top level of 12 * the sendmail distribution. 13 */ 14 15 #include <sm/gen.h> 16 SM_RCSID("@(#)$Id: flags.c,v 1.1.1.1 2002/02/17 21:56:43 gshapiro Exp $") 17 #include <sys/types.h> 18 #include <sys/file.h> 19 #include <errno.h> 20 #include <sm/io.h> 21 22 /* 23 ** SM_FLAGS -- translate external (user) flags into internal flags 24 ** 25 ** Paramters: 26 ** flags -- user select flags 27 ** 28 ** Returns: 29 ** Internal flag value matching user selected flags 30 */ 31 32 int 33 sm_flags(flags) 34 register int flags; 35 { 36 register int ret; 37 38 switch(flags) 39 { 40 case SM_IO_RDONLY: /* open for reading */ 41 ret = SMRD; 42 break; 43 44 case SM_IO_WRONLY: /* open for writing */ 45 ret = SMWR; 46 break; 47 48 case SM_IO_APPEND: /* open for appending */ 49 ret = SMWR; 50 break; 51 52 case SM_IO_RDWR: /* open for read and write */ 53 ret = SMRW; 54 break; 55 56 default: 57 ret = 0; 58 break; 59 } 60 return ret; 61 } 62