don't typedef run_t if _ANSI_SOURCE defined
[unix-history] / usr / src / include / struct.h
index 2486388..f649dff 100644 (file)
@@ -1,9 +1,25 @@
-/*     struct.h        4.1     83/05/03        */
-
-/*
- * access to information relating to the fields of a structure
+/*-
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)struct.h    5.2 (Berkeley) %G%
  */
 
  */
 
-#define        fldoff(str, fld)        ((int)&(((struct str *)0)->fld))
-#define        fldsiz(str, fld)        (sizeof(((struct str *)0)->fld))
-#define        strbase(str, ptr, fld)  ((struct str *)((char *)(ptr)-fldoff(str, fld)))
+#ifndef _STRUCT_H_
+#define        _STRUCT_H_
+
+/* Offset of the field in the structure. */
+#define        fldoff(name, field) \
+       ((int)&(((struct name *)0)->field))
+
+/* Size of the field in the structure. */
+#define        fldsiz(name, field) \
+       (sizeof(((struct name *)0)->field))
+
+/* Address of the structure from a field. */
+#define        strbase(name, addr, field) \
+       ((struct name *)((char *)(addr) - fldoff(name, field)))
+
+#endif /* !_STRUCT_H_ */