#ifndef UNISTD_H
#define UNISTD_H

/*
**          $VER: unistd.h 2.0 (18.02.01)
**             Includes Release 45.00
**                 StormC Version
**
**    Copyright © 1996/2001 by CyberdyneSystems
**
**            written by Matthias Henze
**               All Rights Reserved
*/

#ifndef STORMAMIGA_H
  #include <stormamiga.h>
#endif
#ifndef FCNTL_H
  #include <fcntl.h>
#endif
#ifndef SYS_TYPES_H
  #include <sys/types.h>
#endif
#ifndef SYS_UNISTD_H
  #include <sys/unistd.h>
#endif
#ifndef _INCLUDE_STDIO_H
  #include <stdio.h>
#endif

#ifdef __cplusplus
  extern "C" {
#endif

#define STDIN_FILENO  0       /* standard input file descriptor */
#define STDOUT_FILENO 1       /* standard output file descriptor */
#define STDERR_FILENO 2       /* standard error file descriptor */


/*----- ANSI C-functions -----*/

char    *getcwd (char *, size_t);

/*----- UNIX-functions -----*/

void    sleep   (uint);

#define rmdir   remove
#define unlink  remove

#ifndef _POSIX_SOURCE
  char    *getwd  (char *);
  char    *mktemp (char *);
  void    usleep  (uint);
#endif

/*----- POSIX-functions -----*/

int     access  (cchar *, int);
int     chdir   (cchar *);
int     close   (int);
int     isatty  (int);
off_t   lseek   (int, off_t, int);
ssize_t read    (int, void *, size_t);
ssize_t write   (int, cvoid *, size_t);

#define tell(x) lseek(x, 0L, 1)

#ifdef __cplusplus
  }
#endif

#ifdef STORMAMIGA_UNIXPATH
  extern "C" {char *UnixToAmigaPath (cchar *);}

  __inline int access_u (cchar *file, int mode)
  { return access       (UnixToAmigaPath(file), mode); }

  __inline int chdir_u  (cchar *path)
  { return chdir        (UnixToAmigaPath(path)); }

  #define access access_u
  #define chdir  chdir_u
#endif

#endif /* UNISTD_H */
