1 /* $Source: /u/mark/src/pax/RCS/port.h,v $ 2 * 3 * $Revision: 1.2 $ 4 * 5 * port.h - defnitions for portability library 6 * 7 * DESCRIPTION 8 * 9 * Header for maintaing portablilty across operating system and 10 * version boundries. For the most part, this file contains 11 * definitions which map functions which have the same functionality 12 * but different names on different systems, to have the same name. 13 * 14 * AUTHORS 15 * 16 * Mark H. Colburn, NAPS International (mark@jhereg.mn.org) 17 * John Gilmore (gnu@hoptoad) 18 * 19 * Sponsored by The USENIX Association for public distribution. 20 * 21 * Copyright (c) 1989 Mark H. Colburn. 22 * All rights reserved. 23 * 24 * Redistribution and use in source and binary forms are permitted 25 * provided that the above copyright notice and this paragraph are 26 * duplicated in all such forms and that any documentation, 27 * advertising materials, and other materials related to such 28 * distribution and use acknowledge that the software was developed 29 * by Mark H. Colburn and sponsored by The USENIX Association. 30 * 31 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 32 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 33 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 34 */ 35 36 #ifndef _PAX_PORT_H 37 #define _PAX_PORT_H 38 39 /* 40 * Everybody does wait() differently. There seem to be no definitions for 41 * this in V7 (e.g. you are supposed to shift and mask things out using 42 * constant shifts and masks.) In order to provide the functionality, here 43 * are some non standard but portable macros. Don't change to a "union wait" 44 * based approach -- the ordering of the elements of the struct depends on the 45 * byte-sex of the machine. 46 */ 47 48 #define TERM_SIGNAL(status) ((status) & 0x7F) 49 #define TERM_COREDUMP(status) (((status) & 0x80) != 0) 50 #define TERM_VALUE(status) ((status) >> 8) 51 52 /* 53 * String library emulation definitions for the different variants of UNIX 54 */ 55 56 #if defined(USG) 57 58 # include <string.h> 59 #ifndef _POSIX_SOURCE 60 # include <memory.h> 61 #endif 62 63 #else /* USG */ 64 65 /* 66 * The following functions are defined here since func.h has no idea which 67 * of the functions will actually be used. 68 */ 69 # ifdef __STDC__ 70 extern char *rindex(char *, char); 71 extern char *index(char *, char); 72 extern char *bcopy(char *, char *, unsigned int); 73 extern char *bzero(char *, unsigned int); 74 extern char *strcat(char *, char *); 75 extern char *strcpy(char *, char *); 76 # else /* !__STDC__ */ 77 extern char *rindex(); 78 extern char *index(); 79 extern char *bcopy(); 80 extern char *bzero(); 81 extern char *strcat(); 82 extern char *strcpy(); 83 # endif /* __STDC__ */ 84 85 /* 86 * Map ANSI C compatible functions to V7 functions 87 */ 88 89 # define memcpy(a,b,n) bcopy((b),(a),(n)) 90 # define memset(a,b,n) bzero((a),(n)) 91 # define strrchr(s,c) rindex(s,c) 92 # define strchr(s,c) index(s,c) 93 94 #endif /* USG */ 95 #endif /* _PAX_PORT_H */ 96