#ifndef UNISTD_H
#define UNISTD_H

/*
**          $VER: unistd.h 1.6 (18.09.98)
**             Includes Release 45.00
**
**     Copyright © 1996/99 by CyberdyneSystems
**
**            written by Matthias Henze
**               All Rights Reserved
*/

#ifndef STORMAMIGA_H
  #include <stormamiga.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 -----*/

char    *getwd  (char *);
char    *mktemp (char *);
int     rmdir   (cchar *);
void    sleep   (uint);
int     unlink  (cchar *);
void    usleep  (uint);


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

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

#ifdef __cplusplus
  }
#endif

#ifdef STORMAMIGA_UNIXPATH
  __inline int access_u (cchar *file, int mode)
  { return access       (file, mode); }

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

  __inline int rmdir_u  (cchar *path)
  { return rmdir        (path); }

  #define access(file, mode)  access_u(UnixToAmigaPath(file), mode)
  #define chdir(path)         chdir_u(UnixToAmigaPath(path))
  #define rmdir(path)         rmdir_u(UnixToAmigaPath(path))
  #define unlink(path)        rmdir_u(UnixToAmigaPath(path))
#endif

#endif /* UNISTD_H */
