home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / cpio-2.3-src.lha / src / amiga / cpio-2.3 / system.h < prev    next >
C/C++ Source or Header  |  1993-03-29  |  3KB  |  140 lines

  1. /* System dependent declarations.  Requires sys/types.h.
  2.    Copyright (C) 1992 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  19. #include <string.h>
  20. #ifndef index
  21. #define index    strchr
  22. #endif
  23. #ifndef rindex
  24. #define rindex    strrchr
  25. #endif
  26. #ifndef bcmp
  27. #define bcmp(s1, s2, n)    memcmp ((s1), (s2), (n))
  28. #endif
  29. #ifndef bzero
  30. #define bzero(s, n)    memset ((s), 0, (n))
  31. #endif
  32. #else
  33. #include <strings.h>
  34. #endif
  35.  
  36. #include <time.h>
  37.  
  38. #ifdef STDC_HEADERS
  39. #include <stdlib.h>
  40. #endif
  41.  
  42. #ifdef HAVE_UNISTD_H
  43. #include <unistd.h>
  44. #endif
  45.  
  46. #ifndef SEEK_SET
  47. #define SEEK_SET 0
  48. #define SEEK_CUR 1
  49. #define SEEK_END 2
  50. #endif
  51.  
  52. #ifndef _POSIX_VERSION
  53. off_t lseek ();
  54. #endif
  55.  
  56. /* Since major is a function on SVR4, we can't use `ifndef major'.  */
  57. #ifdef MAJOR_IN_MKDEV
  58. #include <sys/mkdev.h>
  59. #define HAVE_MAJOR
  60. #endif
  61.  
  62. #ifdef MAJOR_IN_SYSMACROS
  63. #include <sys/sysmacros.h>
  64. #define HAVE_MAJOR
  65. #endif
  66.  
  67. #ifdef major            /* Might be defined in sys/types.h.  */
  68. #define HAVE_MAJOR
  69. #endif
  70.  
  71. #ifndef HAVE_MAJOR
  72. #define major(dev) (((dev) >> 8) & 0xff)
  73. #define minor(dev) ((dev) & 0xff)
  74. #define    makedev(ma, mi) (((ma) << 8) | (mi))
  75. #endif
  76. #undef HAVE_MAJOR
  77.  
  78. #if defined(__MSDOS__) || defined(_POSIX_VERSION) || defined(HAVE_FCNTL_H)
  79. #include <fcntl.h>
  80. #else
  81. #include <sys/file.h>
  82. #endif
  83. #ifndef O_BINARY
  84. #define O_BINARY 0
  85. #endif
  86.  
  87. #include <errno.h>
  88. #ifndef errno
  89. extern int errno;
  90. #endif
  91. #ifdef __EMX__            /* gcc on OS/2.  */
  92. #define EPERM EACCES
  93. #define ENXIO EIO
  94. #endif
  95.  
  96. #ifdef HAVE_UTIME_H
  97. #include <utime.h>
  98. #else
  99. struct utimbuf
  100. {
  101.   time_t actime;
  102.   time_t modtime;
  103. };
  104. #endif
  105.  
  106. #ifdef TRUE
  107. #undef TRUE
  108. #endif
  109. #define TRUE 1
  110. #ifdef FALSE
  111. #undef FALSE
  112. #endif
  113. #define FALSE 0
  114.  
  115. #ifndef __MSDOS__
  116. #define CONSOLE "/dev/tty"
  117. #else
  118. #define CONSOLE "con"
  119. #endif
  120.  
  121. #ifdef __MSDOS__
  122. typedef int uid_t;
  123. typedef int gid_t;
  124. #endif
  125.  
  126. /* On most systems symlink() always creates links with rwxrwxrwx
  127.    protection modes, but on some (HP/UX 8.07; I think maybe DEC's OSF
  128.    on MIPS too) symlink() uses the value of umask, so links' protection modes
  129.    aren't always rwxrwxrwx.  There doesn't seem to be any way to change
  130.    the modes of a link (no system call like, say, lchmod() ), it seems
  131.    the only way to set the modes right is to set umask before calling
  132.    symlink(). */
  133.  
  134. #ifndef SYMLINK_USES_UMASK
  135. #define UMASKED_SYMLINK(name1,name2,mode)    symlink(name1,name2)
  136. #else
  137. #define UMASKED_SYMLINK(name1,name2,mode)    umasked_symlink(name1,name2,mode)
  138. #endif /* SYMLINK_USES_UMASK */
  139.  
  140.