home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / jove-4.16-src.tgz / tar.out / bsd / jove / externs.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  6KB  |  181 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. /* UNIX Library/System Routine Emulations for Macintosh (mac.c) */
  9.  
  10. #ifdef MAC
  11.  
  12. extern int
  13.     creat proto((const char *, int)),
  14.     /* open may have an optional third argument, int mode */
  15.     open proto((const char */*path*/, int /*flags*/, ...)),
  16.     close proto((int)),
  17.     unlink proto((const char *)),
  18.     chdir proto((const char *));
  19.  
  20. extern SSIZE_T
  21.     read proto((int /*fd*/, UnivPtr /*buf*/, size_t /*nbytes*/)),
  22.     write proto((int /*fd*/, UnivConstPtr /*buf*/, size_t /*nbytes*/));
  23.  
  24. extern off_t    lseek proto((int /*fd*/, off_t /*offset*/, int /*whence*/));
  25. extern time_t    time proto((time_t *));
  26.  
  27. extern void
  28.     menus_off proto((void));    /* called by real_ask, findcom, waitchar */
  29.  
  30. #endif /* MAC */
  31.  
  32. /*==== Declarations of Library/System Routines ====*/
  33.  
  34. #ifndef REALSTDC
  35. extern int    errno;    /* Redundant if declared in <errno.h> -- DHR */
  36. #endif
  37. extern char *strerror proto((int));    /* errno.h or string.h? */
  38.  
  39. /* General Utilities: <stdlib.h> */
  40.  
  41. extern int    abs proto((int));
  42.  
  43. extern void    abort proto((void));
  44. extern void    exit proto((int));
  45.  
  46. extern int    atoi proto((const char */*nptr*/));
  47.  
  48. extern void    qsort proto((UnivPtr /*base*/, size_t /*nmemb*/,
  49.     size_t /*size*/, int (*/*compar*/)(UnivConstPtr, UnivConstPtr)));
  50.  
  51. extern char    *getenv proto((const char *));
  52. extern int    system proto((const char *));
  53.  
  54. extern void
  55.     free proto((UnivPtr));
  56.  
  57. extern UnivPtr
  58.     calloc proto((size_t, size_t)),
  59.     malloc proto((size_t)),
  60.     realloc proto((UnivPtr, size_t));
  61.  
  62. /* Date and Time <time.h> */
  63.  
  64. extern time_t    time proto((time_t */*tloc*/));
  65. extern char    *ctime proto((const time_t *));
  66.  
  67. /* UNIX */
  68.  
  69. #ifdef MSC51
  70. #define const    /* the const's in the following defs conflict with MSC 5.1 */
  71. #endif
  72.  
  73. #ifdef POSIX_UNISTD
  74. # include <unistd.h>
  75. # if _POSIX_VERSION < 199009L    /* defined in <unistd.h>: can't test earlier */
  76.    /* ssize_t is not defined in original POSIX.1
  77.     * Surprise: NetBSD defines it, even though it claims to be old POSIX.1!
  78.     * To dodge this problem, we define ssize_t as a macro, not a typedef.
  79.     */
  80. #  define ssize_t    int
  81. # endif
  82. # include <fcntl.h>
  83. #else /* !POSIX_UNISTD */
  84.  
  85. extern int    chdir proto((const char */*path*/));
  86.  
  87. /* POSIX, System Vr4, MSDOS, and our Mac code specify getcwd.
  88.  * System Vr4 (sometimes?) types the second argument "int"!!
  89.  */
  90. # ifdef USE_GETCWD
  91. extern char    *getcwd proto((char *, size_t));
  92. # endif /* USE_GETCWD */
  93.  
  94. extern int    access proto((const char */*path*/, int /*mode*/));
  95. # ifndef W_OK
  96. #  define R_OK    0x04
  97. #  define W_OK    0x02
  98. #  define X_OK    0x01
  99. #  define F_OK    0
  100. # endif
  101.  
  102. extern int    creat proto((const char */*path*/, mode_t /*mode*/));
  103.     /* open may have an optional third argument, int mode */
  104. extern int    open proto((const char */*path*/, int /*flags*/, ...));
  105.  
  106.  
  107. # ifdef MSC51
  108. extern SSIZE_T    read proto((int /*fd*/, char * /*buf*/, size_t /*nbytes*/));
  109. extern SSIZE_T    write proto((int /*fd*/, const char * /*buf*/, size_t /*nbytes*/));
  110. # else
  111. extern SSIZE_T    read proto((int /*fd*/, UnivPtr /*buf*/, size_t /*nbytes*/));
  112. extern SSIZE_T    write proto((int /*fd*/, UnivConstPtr /*buf*/, size_t /*nbytes*/));
  113. # endif
  114.  
  115. # if !defined(ZTCDOS) && !defined(__BORLANDC__)
  116. /* Zortech incorrectly defines argv as const char **.
  117.  * Borland incorrectly defines argv as char *[] and omits some consts
  118.  * on execl and execlp parameters.
  119.  * On the other hand, each supplies declarations for these functions.
  120.  */
  121. extern int    execl proto((const char */*path*/, const char */*arg*/, ...));
  122. extern int    execlp proto((const char */*file*/, const char */*arg*/, ...));
  123. extern int    execv proto((const char */*path*/, char *const /*argv*/[]));
  124. extern int    execvp proto((const char */*file*/, char *const /*argv*/[]));
  125. # endif
  126.  
  127. # ifdef MSC51
  128. #  undef const
  129. # endif
  130.  
  131. extern void    _exit proto((int));    /* exit(), without flush, etc. */
  132.  
  133. extern unsigned    alarm proto((unsigned /*seconds*/));
  134.  
  135. extern int    pipe proto((int *));
  136. extern int    close proto((int));
  137. extern int    dup proto((int));
  138. extern int    dup2 proto((int /*old_fd*/, int /*new_fd*/));
  139. extern off_t    lseek proto((int /*fd*/, off_t /*offset*/, int /*whence*/));
  140. extern int    fchmod proto((int /*fd*/, mode_t /*mode*/));
  141. extern int    chown proto((const char *, int, int));
  142.  
  143. extern int    unlink proto((const char */*path*/));
  144.  
  145. #endif /* !POSIX_UNISTD */
  146.  
  147.  
  148. #ifndef FULL_UNISTD
  149.  
  150. extern int    fsync proto((int));
  151.  
  152. /* BSD UNIX
  153.  *
  154.  * Note: in most systems, declaration of a non-existant function is
  155.  * OK if the function is never actually called.  The parentheses around
  156.  * the name prevent any macro expansion.  Of course, if the types in the
  157.  * prototype are not declared, the compiler gets upset.
  158.  */
  159.  
  160. # ifdef USE_BCOPY
  161. extern void    UNMACRO(bcopy) proto((UnivConstPtr, UnivPtr, size_t));
  162. extern void    UNMACRO(bzero) proto((UnivPtr, size_t));
  163. # endif
  164.  
  165. #endif /* !FULL_UNISTD */
  166.  
  167. extern char    *mktemp proto((char *));
  168.  
  169. /* termcap */
  170. #ifdef TERMCAP
  171. # ifdef TERMINFO
  172. extern char    *UNMACRO(tparm) proto((const char *, ...));
  173. #  define    targ1(s, i)    tparm(s, i)
  174. #  define    targ2(s, c, l)    tparm(s, c, l)
  175. # else
  176. extern char    *UNMACRO(tgoto) proto((const char *, int /*destcol*/, int /*destline*/));
  177. #  define    targ1(s, i)    tgoto(s, 0, i)
  178. #  define    targ2(s, c, l)    tgoto(s, c, l)
  179. # endif
  180. #endif
  181.