home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / ARCH / PAX20-2 / PORT.H < prev    next >
C/C++ Source or Header  |  1993-12-24  |  3KB  |  117 lines

  1. /* $Source: /u/mark/src/pax/RCS/port.h,v $
  2.  *
  3.  * $Revision: 2.0.0.4 $
  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, Open Systems Architects, Inc. (mark@minnetech.mn.org)
  17.  *    John Gilmore (gnu@hoptoad)
  18.  *
  19.  * COPYRIGHT
  20.  *
  21.  *    Copyright (c) 1989 Mark H. Colburn.  All rights reserved.
  22.  *
  23.  *    Redistribution and use in source and binary forms are permitted
  24.  *    provided that the above copyright notice and this paragraph are
  25.  *    duplicated in all such forms and that any documentation,
  26.  *    advertising materials, and other materials related to such
  27.  *    distribution and use acknowledge that the software was developed
  28.  *    by Mark H. Colburn.
  29.  *
  30.  *    THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  31.  *    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  32.  *    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  33.  */
  34.  
  35. #ifndef _PAX_PORT_H
  36. #define _PAX_PORT_H
  37.  
  38. /*
  39.  * Everybody does wait() differently.  There seem to be no definitions for
  40.  * this in V7 (e.g. you are supposed to shift and mask things out using
  41.  * constant shifts and masks.)  In order to provide the functionality, here
  42.  * are some non standard but portable macros.  Don't change to a "union wait"
  43.  * based approach -- the ordering of the elements of the struct depends on the
  44.  * byte-sex of the machine.
  45.  */
  46.  
  47. #define    TERM_SIGNAL(status)    ((status) & 0x7F)
  48. #define TERM_VALUE(status)    ((status) >> 8)
  49.  
  50. #ifdef PC
  51.  
  52. #include <io.h>
  53. #define    major(x)    (0)
  54. #define    minor(x)    (0)
  55. #define    makedev(x,y)    (0)
  56.  
  57. struct passwd {
  58.     char           *pw_name;
  59.     char           *pw_passwd;
  60.     int            pw_uid;
  61.     int            pw_gid;
  62.     int            pw_quota;
  63.     char           *pw_comment;
  64.     char           *pw_gecos;
  65.     char           *pw_dir;
  66.     char           *pw_shell;
  67. };
  68.  
  69. struct group {
  70.     char           *gr_name;
  71.     char           *gr_passwd;
  72.     int            gr_gid;
  73.     char          **gr_mem;
  74. };
  75.  
  76. #endif /* PC */
  77.  
  78.  
  79. #ifdef PC
  80.  
  81. #if defined(DIO)
  82.  
  83. #define OPEN2(p,f) \
  84.     ( (dio_open_check(p) < 0) ? dio_open2(p,f) : open(p,f) )
  85. #define OPEN3(p,f,m) \
  86.     ( (dio_open_check(p) < 0) ? dio_open3(p,f,m) : open(p,f,m) )
  87. #define CLOSE(h) \
  88.     ( (h < 0) ? dio_close(h) : close(h) )
  89. #define READ(h,b,c) \
  90.     ( (h < 0) ? dio_read(h,b,c) : read(h,b,c) )
  91. #define WRITE(h,b,c) \
  92.     ( (h < 0) ? dio_write(h,b,c) : write(h,b,c) )
  93. #define LSEEK(h,o,r) \
  94.     ( (h < 0) ? dio_lseek(h,o,r) : lseek(h,o,r) )
  95.  
  96. #elif defined(DISKACC)
  97.  
  98. #if defined(PC) && defined(DISKACC)
  99. #include "disktape.h"
  100. #endif /* PC */
  101.  
  102. #else
  103.  
  104. #define OPEN2(p,f) open(p,f)
  105. #define OPEN3(p,f,m) open(p,f,m)
  106. #define CLOSE(h) close(h)
  107. #define READ(h,b,c) read(h,b,c)
  108. #define WRITE(h,b,c) write(h,b,c)
  109. #define LSEEK(h,o,r) lseek(h,o,r)
  110.  
  111. #endif
  112.  
  113. #endif /* PC */
  114. #endif /* _PAX_PORT_H */
  115.  
  116.  
  117.