| 1 | |
| 2 | /* |
| 3 | * Copyright © 2001 Novell, Inc. All Rights Reserved. |
| 4 | * |
| 5 | * You may distribute under the terms of either the GNU General Public |
| 6 | * License or the Artistic License, as specified in the README file. |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * FILENAME : nw5iop.h |
| 12 | * DESCRIPTION : Redefined functions for NetWare. |
| 13 | * Author : SGP, HYAK |
| 14 | * Date : January 2001. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | |
| 19 | |
| 20 | #ifndef NW5IOP_H |
| 21 | #define NW5IOP_H |
| 22 | |
| 23 | |
| 24 | #ifndef START_EXTERN_C |
| 25 | #ifdef __cplusplus |
| 26 | # define START_EXTERN_C extern "C" { |
| 27 | # define END_EXTERN_C } |
| 28 | # define EXTERN_C extern "C" |
| 29 | #else |
| 30 | # define START_EXTERN_C |
| 31 | # define END_EXTERN_C |
| 32 | # define EXTERN_C |
| 33 | #endif |
| 34 | #endif |
| 35 | |
| 36 | #if defined(_MSC_VER) || defined(__MINGW32__) |
| 37 | # include <sys/utime.h> |
| 38 | #else |
| 39 | # include <utime.h> |
| 40 | #endif |
| 41 | |
| 42 | /* |
| 43 | * defines for flock emulation |
| 44 | */ |
| 45 | #define LOCK_SH 1 |
| 46 | #define LOCK_EX 2 |
| 47 | #define LOCK_NB 4 |
| 48 | #define LOCK_UN 8 |
| 49 | |
| 50 | |
| 51 | /* |
| 52 | * Make this as close to original stdio as possible. |
| 53 | */ |
| 54 | |
| 55 | /* |
| 56 | * function prototypes for our own win32io layer |
| 57 | */ |
| 58 | /********CHKSGP ****/ |
| 59 | //making DLLExport as nothing |
| 60 | #define DllExport |
| 61 | /*******************/ |
| 62 | |
| 63 | START_EXTERN_C |
| 64 | |
| 65 | int * nw_errno(void); |
| 66 | char *** nw_environ(void); |
| 67 | |
| 68 | FILE* nw_stdin(void); |
| 69 | FILE* nw_stdout(void); |
| 70 | FILE* nw_stderr(void); |
| 71 | int nw_ferror(FILE *fp); |
| 72 | int nw_feof(FILE *fp); |
| 73 | |
| 74 | char* nw_strerror(int e); |
| 75 | |
| 76 | int nw_fprintf(FILE *pf, const char *format, ...); |
| 77 | int nw_printf(const char *format, ...); |
| 78 | int nw_vfprintf(FILE *pf, const char *format, va_list arg); |
| 79 | int nw_vprintf(const char *format, va_list arg); |
| 80 | |
| 81 | size_t nw_fread(void *buf, size_t size, size_t count, FILE *pf); |
| 82 | size_t nw_fwrite(const void *buf, size_t size, size_t count, FILE *pf); |
| 83 | FILE* nw_fopen(const char *path, const char *mode); |
| 84 | FILE* nw_fdopen(int fh, const char *mode); |
| 85 | FILE* nw_freopen(const char *path, const char *mode, FILE *pf); |
| 86 | int nw_fclose(FILE *pf); |
| 87 | |
| 88 | int nw_fputs(const char *s,FILE *pf); |
| 89 | int nw_fputc(int c,FILE *pf); |
| 90 | int nw_ungetc(int c,FILE *pf); |
| 91 | int nw_getc(FILE *pf); |
| 92 | int nw_fileno(FILE *pf); |
| 93 | void nw_clearerr(FILE *pf); |
| 94 | int nw_fflush(FILE *pf); |
| 95 | long nw_ftell(FILE *pf); |
| 96 | int nw_fseek(FILE *pf,long offset,int origin); |
| 97 | int nw_fgetpos(FILE *pf,fpos_t *p); |
| 98 | int nw_fsetpos(FILE *pf,const fpos_t *p); |
| 99 | void nw_rewind(FILE *pf); |
| 100 | FILE* nw_tmpfile(void); |
| 101 | |
| 102 | void nw_abort(void); |
| 103 | |
| 104 | int nw_stat(const char *name,struct stat *sbufptr); |
| 105 | |
| 106 | FILE* nw_Popen(char* command, char* mode, int* e); |
| 107 | int nw_Pclose(FILE* file, int* e); |
| 108 | int nw_Pipe(int* a, int* e); |
| 109 | |
| 110 | int nw_rename( const char *oname, const char *newname); |
| 111 | //int nw_setmode( int fd, int mode); |
| 112 | int nw_setmode( FILE *fp, int mode); |
| 113 | long nw_lseek( int fd, long offset, int origin); |
| 114 | int nw_dup( int fd); |
| 115 | int nw_dup2(int h1, int h2); |
| 116 | int nw_open(const char *path, int oflag,...); |
| 117 | int nw_close(int fd); |
| 118 | int nw_read(int fd, void *buf, unsigned int cnt); |
| 119 | int nw_write(int fd, const void *buf, unsigned int cnt); |
| 120 | |
| 121 | int nw_spawnvp(int mode, char *cmdname, char **argv); |
| 122 | |
| 123 | int nw_rmdir(const char *dir); |
| 124 | int nw_chdir(const char *dir); |
| 125 | int nw_flock(int fd, int oper); |
| 126 | |
| 127 | int nw_execv(char *cmdname, char **argv); |
| 128 | int nw_execvp(char *cmdname, char **argv); |
| 129 | |
| 130 | void nw_setbuf(FILE *pf, char *buf); |
| 131 | int nw_setvbuf(FILE *pf, char *buf, int type, size_t size); |
| 132 | char* nw_fgets(char *s, int n, FILE *pf); |
| 133 | |
| 134 | int nw_fgetc(FILE *pf); |
| 135 | |
| 136 | int nw_putc(int c, FILE *pf); |
| 137 | |
| 138 | int nw_open_osfhandle(long handle, int flags); |
| 139 | long nw_get_osfhandle(int fd); |
| 140 | |
| 141 | DIR* nw_opendir(char *filename); |
| 142 | struct direct* nw_readdir(DIR *dirp); |
| 143 | long nw_telldir(DIR *dirp); |
| 144 | void nw_seekdir(DIR *dirp, long loc); |
| 145 | void nw_rewinddir(DIR *dirp); |
| 146 | int nw_closedir(DIR *dirp); |
| 147 | |
| 148 | unsigned int nw_sleep(unsigned int); |
| 149 | int nw_times(struct tms *timebuf); |
| 150 | |
| 151 | int nw_stat(const char *path, struct stat *buf); |
| 152 | int nw_link(const char *oldname, const char *newname); |
| 153 | int nw_unlink(const char *f); |
| 154 | int nw_utime(const char *f, struct utimbuf *t); |
| 155 | DllExport int nw_uname(struct utsname *n); |
| 156 | |
| 157 | int nw_wait(int *status); |
| 158 | |
| 159 | int nw_waitpid(int pid, int *status, int flags); |
| 160 | int nw_kill(int pid, int sig); |
| 161 | |
| 162 | unsigned long nw_os_id(void); |
| 163 | void* nw_dynaload(const char*filename); |
| 164 | |
| 165 | int nw_access(const char *path, int mode); |
| 166 | int nw_chmod(const char *path, int mode); |
| 167 | int nw_getpid(void); |
| 168 | |
| 169 | char * nw_crypt(const char *txt, const char *salt); |
| 170 | |
| 171 | int nw_isatty(int fd); |
| 172 | char* nw_mktemp(char *Template); |
| 173 | int nw_chsize(int handle, long size); |
| 174 | END_EXTERN_C |
| 175 | |
| 176 | |
| 177 | /* |
| 178 | * the following six(6) is #define in stdio.h |
| 179 | */ |
| 180 | #ifndef WIN32IO_IS_STDIO |
| 181 | #undef environ |
| 182 | #undef feof |
| 183 | #undef pipe |
| 184 | #undef pause |
| 185 | #undef sleep |
| 186 | #undef times |
| 187 | #undef alarm |
| 188 | #undef ioctl |
| 189 | #undef unlink |
| 190 | #undef utime |
| 191 | #undef uname |
| 192 | #undef wait |
| 193 | |
| 194 | |
| 195 | #define environ (*nw_environ()) |
| 196 | |
| 197 | |
| 198 | #if !defined(MYMALLOC) || !defined(PERL_CORE) |
| 199 | |
| 200 | #endif |
| 201 | |
| 202 | |
| 203 | #endif /* WIN32IO_IS_STDIO */ |
| 204 | #endif /* NW5IOP_H */ |
| 205 | |