home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / W2KPRK.iso / apps / posix / source / PAX / PORT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-17  |  2.9 KB  |  94 lines

  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. #   include <memory.h>
  60.  
  61. #else /* USG */
  62.  
  63. /*
  64.  * The following functions are defined here since func.h has no idea which
  65.  * of the functions will actually be used.
  66.  */
  67. #  ifdef __STDC__
  68. extern char *rindex(char *, char);
  69. extern char *index(char *, char);
  70. extern char *bcopy(char *, char *, unsigned int);
  71. extern char *bzero(char *, unsigned int);
  72. extern char *strcat(char *, char *);
  73. extern char *strcpy(char *, char *);
  74. #  else /* !__STDC__ */
  75. extern char *rindex();
  76. extern char *index();
  77. extern char *bcopy();
  78. extern char *bzero();
  79. extern char *strcat();
  80. extern char *strcpy();
  81. #  endif /* __STDC__ */
  82.  
  83. /*
  84.  * Map ANSI C compatible functions to V7 functions
  85.  */
  86.  
  87. #   define memcpy(a,b,n)    bcopy((b),(a),(n))
  88. #   define memset(a,b,n)    bzero((a),(n))
  89. #   define strrchr(s,c)        rindex(s,c)
  90. #   define strchr(s,c)        index(s,c)
  91.  
  92. #endif /* USG */
  93. #endif /* _PAX_PORT_H */
  94.