1 /* 2 * Copyright (c) 2000-2002 Proofpoint, 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 * $MirOS: src/gnu/usr.sbin/sendmail/include/sm/gen.h,v 1.8 2014/06/09 15:17:08 tg Exp $ 10 * $Id: gen.h,v 1.24 2013-11-22 20:51:31 ca Exp $ 11 */ 12 13 /* 14 ** libsm general definitions 15 ** See libsm/gen.html for documentation. 16 */ 17 18 #ifndef SM_GEN_H 19 # define SM_GEN_H 20 21 # include <sm/config.h> 22 # include <sm/cdefs.h> 23 # include <sm/types.h> 24 25 /* 26 ** Define SM_RCSID and SM_IDSTR, 27 ** macros used to embed RCS and SCCS identification strings in object files. 28 */ 29 30 #ifdef __MirBSD__ 31 # include <sys/cdefs.h> 32 # define SM_RCSID(str) __RCSID(str); 33 # define SM_IDSTR(id,str) __IDSTRING(id,str); 34 # define SM_COPYRIGHT(str) __COPYRIGHT(str); 35 #else 36 # ifdef lint 37 # define SM_RCSID(str) 38 # define SM_IDSTR(id,str) 39 # define SM_COPYRIGHT(str) 40 # else /* lint */ 41 # define SM_RCSID(str) SM_UNUSED(static const char RcsId[]) = str; 42 # define SM_IDSTR(id,str) SM_UNUSED(static const char id[]) = str; 43 # define SM_COPYRIGHT(str) SM_UNUSED(static char copyright[]) = str; 44 # endif /* lint */ 45 #endif 46 47 /* 48 ** Define NULL and offsetof (from the C89 standard) 49 */ 50 51 # if SM_CONF_STDDEF_H 52 # include <stddef.h> 53 # else /* SM_CONF_STDDEF_H */ 54 # ifndef NULL 55 # define NULL 0 56 # endif /* ! NULL */ 57 # define offsetof(type, member) ((size_t)(&((type *)0)->member)) 58 # endif /* SM_CONF_STDDEF_H */ 59 60 /* 61 ** Define bool, true, false (from the C99 standard) 62 */ 63 64 # if SM_CONF_STDBOOL_H 65 # include <stdbool.h> 66 # else /* SM_CONF_STDBOOL_H */ 67 # ifndef __cplusplus 68 typedef int bool; 69 # define false 0 70 # define true 1 71 # define __bool_true_false_are_defined 1 72 # endif /* ! __cplusplus */ 73 # endif /* SM_CONF_STDBOOL_H */ 74 75 /* 76 ** Define SM_MAX and SM_MIN 77 */ 78 79 # define SM_MAX(a, b) ((a) > (b) ? (a) : (b)) 80 # define SM_MIN(a, b) ((a) < (b) ? (a) : (b)) 81 82 /* Define SM_SUCCESS and SM_FAILURE */ 83 # define SM_SUCCESS 0 84 # define SM_FAILURE (-1) 85 86 /* XXX This needs to be fixed when we start to use threads: */ 87 typedef int SM_ATOMIC_INT_T; 88 typedef unsigned int SM_ATOMIC_UINT_T; 89 90 #endif /* SM_GEN_H */ 91