home *** CD-ROM | disk | FTP | other *** search
- // I pulled this stuff from the NT port of Tar. That author had pulled
- // it from the NT port of Perl. This stuff is getting around.
-
- /* $Id: nt.h,v 1.4 1993/09/17 02:21:00 ESullivan Exp ESullivan $
- */
-
- /*
- * Copyright (c) 1993, Intergraph Corporation
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the perl README file.
- *
- * I pulled this out of the PERL NT port (the memory functions came
- * from PERL itself (v 4.036). Clark Williams of Intergraph wrote
- * the original of this, and I apologize to him in advance for hacking
- * it all up. :-)
- *
- */
-
- /* $Log: nt.h,v $
- * Revision 1.4 1993/09/17 02:21:00 ESullivan
- * Consolidated this file among several projects, so that all the
- * projects use the same nt.h file.
- *
- * Revision 1.3 1993/09/07 02:09:30 ESullivan
- * added a $Log area.
- *
- * Revision 1.2 1993/09/06 04:11:58 ESullivan
- * Took out references to my fake pipe and vfork. They
- * are no longer used.
- *
- * Revision 1.1 1993/09/05 04:59:21 ESullivan
- * Initial revision
- * */
-
- //
- // Definitions for NT port of Perl
- //
-
- //
- // GRRRR!!!! Windows Nonsense.
- // Define the following so we don't get tons of extra stuff
- // when we include windows.h
- //
-
- #ifndef NT_INC
- #define NT_INC
-
- #define NOGDICAPMASKS
- #define NOVIRTUALKEYCODES
- #define NOWINMESSAGES
- #define NOWINSTYLES
- #define NOSYSMETRICS
- #define NOMENUS
- #define NOICONS
- #define NOKEYSTATES
- #define NOSYSCOMMANDS
- #define NORASTEROPS
- #define NOSHOWWINDOW
- #define OEMRESOURCE
- #define NOATOM
- #define NOCLIPBOARD
- #define NOCOLOR
- #define NOCTLMGR
- #define NODRAWTEXT
- #define NOGDI
- #define NONLS
- #define NOMB
- #define NOMEMMGR
- #define NOMETAFILE
- #define NOMINMAX
- #define NOMSG
- #define NOOPENFILE
- #define NOSCROLL
- #define NOSERVICE
- #define NOSOUND
- #define NOTEXTMETRIC
- #define NOWH
- #define NOWINOFFSETS
- #define NOCOMM
- #define NOKANJI
- #define NOHELP
- #define NOPROFILER
- #define NODEFERWINDOWPOS
-
-
- //
- // Ok now we can include the normal include files.
- //
- #include <stdio.h>
- #ifndef GAWK
- #include <stdarg.h>
- #endif /* !GAWK */
-
- #ifndef DIFF3
- #ifndef GAWK
- #include <windows.h>
- #endif /* GAWK */
- #endif /* not DIFF3 */
-
- #define bool int
- #define MEM_SIZE size_t
- typedef MEM_SIZE STRLEN;
-
- //
- // We\'re not using Microsoft\'s "extensions" to C for
- // Structured Exception Handling (SEH) so we can nuke these
- //
- #undef try
- #undef except
- #undef finally
- #undef leave
-
- #ifndef DIFF3
- #include <winsock.h>
- #endif /* not DIFF3 */
-
- #include <sys/types.h>
- #include <direct.h>
- #include <process.h>
- #include <io.h>
- #include <time.h>
- #include <sys/utime.h>
-
- //
- // Grrr...
- //
-
- #define access _access
- #define chmod _chmod
- #define chsize _chsize
- #define close _close
- #define creat _creat
- #define dup _dup
- // #define dup2 _dup2
- #define eof _eof
- #define filelength _filelength
- #define isatty _isatty
- #define locking _locking
- #define lseek _lseek
- #define mktemp _mktemp
- #define open _open
- #define read _read
- #define setmode _setmode
- #define sopen _sopen
- #define tell _tell
- #define umask _umask
- #define unlink _unlink
- #define write _write
- #define execl _execl
- #define execle _execle
- #define execlp _execlp
- #define execlpe _execlpe
- #define execv _execv
- #define execve _execve
- #define execvp _execvp
- #define execvpe _execvpe
- #define getpid _getpid
- #define spawnl _spawnl
- #define spawnle _spawnle
- #define spawnlp _spawnlp
- #define spawnlpe _spawnlpe
- #define spawnv _spawnv
- #define spawnve _spawnve
- #define spawnvp _spawnvp
- #define spawnvpe _spawnvpe
- #define cwait _cwait
- #define fileno _fileno
- #define utime _utime
-
- //
- // This is for the memory functions swiped from PERL...
- //
- #define FLUSH ;fflush( stderr )
- #define MEM_SIZE size_t
- #define Nullch (char*)0
- #define New(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t))))
- #define Newc(x,v,n,t,c) (v = (c*)safemalloc(((unsigned long)(n) * sizeof(t))))
- #define Newz(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t)))), \
- memzero((char*)(v), (n) * sizeof(t))
- #define Renew(v,n,t) (v = (t*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t))))
- #define Renewc(v,n,t,c) (v = (c*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t))))
-
- #define Safefree(d) safefree((char*)d)
- #define Str_new(x,len) str_new(len)
-
- char *safemalloc();
- char *saferealloc();
- void safefree();
- void *memzero();
-
-
- //
- // Got the idea and some of the code from the MSDOS implementation
- //
-
- /*
- * (C) Copyright 1987, 1990 Diomidis Spinellis.
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * Included in the nt header file for use by nt port
- *
- */
- /*
- * defines the type returned by the directory(3) functions
- */
-
- /*Directory entry size */
- #ifdef DIRSIZ
- #undef DIRSIZ
- #endif
- #define DIRSIZ(rp) (sizeof(struct direct))
-
- /* need this so that directory stuff will compile! */
- //#define DIRENT direct
-
- /*
- * Structure of a directory entry
- */
- #ifndef DIRECT_DEFINED
- struct direct {
- ino_t d_ino; /* inode number (not used by MS-DOS) */
- int d_namlen; /* Name length */
- char d_name[257]; /* file name */
- };
-
- #define DIRECT_DEFINED
- #endif
-
- #ifndef DIRSTRUCT_DEFINED
- struct _dir_struc { /* Structure used by dir operations */
- char *start; /* Starting position */
- char *curr; /* Current position */
- long size; /* Size of string table */
- long nfiles; /* number if filenames in table */
- struct direct dirstr; /* Directory structure to return */
- };
-
- #define DIRSTRUCT_DEFINED
- #endif
-
- typedef struct _dir_struc DIR; /* Type returned by dir operations */
-
-
- extern int sys_nerr;
- extern char *sys_errlist[];
-
- // #define strerror(e) mystrerror(e)
-
- /*
- * Here\'s some voodoo to prevent winsock initialization until it\'s
- * actually required.
- *
- */
- #define accept myaccept
- #define bind mybind
- #define connect myconnect
- #define getpeername mygetpeername
- #define getsockname mygetsockname
- #define getsockopt mygetsockopt
- #define ioctlsocket myioctlsocket
- #define listen mylisten
- #define recv myrecv
- #define recvfrom myrecvfrom
- #define select myselect
- #define send mysend
- #define sendto mysendto
- #define setsockopt mysetsockopt
- #define shutdown myshutdown
- #define socket mysocket
- #define gethostbyaddr mygethostbyaddr
- #define gethostbyname mygethostbyname
- #define gethostname mygethostname
- #define getprotobyname mygetprotobyname
- #define getprotobynumber mygetprotobynumber
- #define getservbyname mygetservbyname
- #define getservbyport mygetservbyport
-
- // function prototypes
- DIR *cdecl opendir(char *filename);
- struct direct *readdir(DIR *dirp);
- long telldir(DIR *dirp);
- void seekdir(DIR *dirp,long loc);
- void rewinddir(DIR *dirp);
- void closedir(DIR *dirp);
-
- // functions in ntpipe.c
- bool NtHasRedirection (char *cmd);
- int NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd);
- FILE *ntpopen (char *cmd, char *mode);
- FILE *ntpopenEx (char *cmd, char *mode, int *cpipes);
- int ntpclose(FILE *fp);
- int ntGetPid( FILE *fp);
- int ntwait_for( int pid);
-
- #endif //NT_INC
-
-