Index: patch/addext.c diff -c patch/addext.c:1.1.1.1 patch/addext.c:1.2 *** patch/addext.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/addext.c Wed Nov 15 12:10:04 2006 *************** *** 38,44 **** --- 38,46 ---- # define _POSIX_NAME_MAX 14 #endif + #if HAVE_SYS_TYPES_H #include + #endif #if HAVE_STRING_H # include #else Index: patch/argmatch.h diff -c patch/argmatch.h:1.1.1.1 patch/argmatch.h:1.2 *** patch/argmatch.h:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/argmatch.h Wed Nov 15 12:10:04 2006 *************** *** 25,31 **** --- 25,33 ---- # include # endif + # if HAVE_SYS_TYPES_H # include + # endif # ifndef PARAMS # if PROTOTYPES || (defined (__STDC__) && __STDC__) Index: patch/backupfile.c diff -c patch/backupfile.c:1.1.1.1 patch/backupfile.c:1.2 *** patch/backupfile.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/backupfile.c Wed Nov 15 12:10:04 2006 *************** *** 27,33 **** --- 27,35 ---- #include #include + #if HAVE_SYS_TYPES_H #include + #endif #if HAVE_STRING_H # include #else Index: patch/common.h diff -c patch/common.h:1.1.1.1 patch/common.h:1.2 *** patch/common.h:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/common.h Wed Nov 15 12:10:06 2006 *************** *** 36,45 **** --- 36,49 ---- #include #include + #if HAVE_SYS_TYPES_H #include + #endif #include + #if HAVE_SYS_STAT_H #include + #endif #if ! defined S_ISDIR && defined S_IFDIR # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif Index: patch/config.h diff -c /dev/null patch/config.h:1.5 *** /dev/null Fri Nov 17 13:40:52 2006 --- patch/config.h Thu Nov 16 12:16:00 2006 *************** *** 0 **** --- 1,217 ---- + /* config.hin. Generated automatically from configure.in by autoheader. */ + + /* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ + #ifndef _ALL_SOURCE + #undef _ALL_SOURCE + #endif + + /* Define if the closedir function returns void instead of int. */ + #undef CLOSEDIR_VOID + + /* Define to empty if the keyword does not work. */ + #undef const + + /* Define if you don't have vprintf but do have _doprnt. */ + #undef HAVE_DOPRNT + + /* Define if you support file names longer than 14 characters. */ + #undef HAVE_LONG_FILE_NAMES + + /* Define if you have the vprintf function. */ + #define HAVE_VPRINTF 1 + + /* Define if on MINIX. */ + #undef _MINIX + + /* Define to `int' if doesn't define. */ + #define mode_t int + + /* Define to `long' if doesn't define. */ + /*#define off_t long*/ + + /* Define to `int' if doesn't define. */ + #define pid_t int + + /* Define if the system does not provide POSIX.1 features except + with this defined. */ + #undef _POSIX_1_SOURCE + + /* Define if you need to in order for stat and other things to work. */ + #undef _POSIX_SOURCE + + /* Define as the return type of signal handlers (int or void). */ + #define RETSIGTYPE void + + /* Define to `unsigned' if doesn't define. */ + #undef size_t + + /* Define if you have the ANSI C header files. */ + #define STDC_HEADERS 1 + + /* Define if you can safely include both and . */ + #undef TIME_WITH_SYS_TIME + + /* Define if you have the _doprintf function. */ + #undef HAVE__DOPRINTF + + /* Define if you have the fseeko function. */ + #undef HAVE_FSEEKO + + /* Define if you have the isascii function. */ + #undef HAVE_ISASCII + + /* Define if you have the memchr function. */ + #define HAVE_MEMCHR 1 + + /* Define if you have the memcmp function. */ + #define HAVE_MEMCMP 1 + + /* Define if you have the mkdir function. */ + #undef HAVE_MKDIR + + /* Define if you have the mktemp function. */ + #undef HAVE_MKTEMP + + /* Define if you have the pathconf function. */ + #undef HAVE_PATHCONF + + /* Define if you have the raise function. */ + #define HAVE_RAISE 1 + + /* Define if you have the rename function. */ + #define HAVE_RENAME 1 + + /* Define if you have the rmdir function. */ + #undef HAVE_RMDIR + + /* Define if you have the setmode function. */ + #undef HAVE_SETMODE + + /* Define if you have the sigaction function. */ + #undef HAVE_SIGACTION + + /* Define if you have the sigprocmask function. */ + #undef HAVE_SIGPROCMASK + + /* Define if you have the sigsetmask function. */ + #undef HAVE_SIGSETMASK + + /* Define if you have the strerror function. */ + #define HAVE_STRERROR 1 + + /* Define if you have the header file. */ + #undef HAVE_DIRENT_H + + /* Define if you have the header file. */ + #undef HAVE_FCNTL_H + + /* Define if you have the header file. */ + #define HAVE_LIMITS_H 1 + + /* Define if you have the header file. */ + #undef HAVE_NDIR_H + + /* Define if you have the header file. */ + #define HAVE_STRING_H 1 + + /* Define if you have the header file. */ + #undef HAVE_SYS_DIR_H + + /* Define if you have the header file. */ + #undef HAVE_SYS_NDIR_H + + /* Define if you have the header file. */ + #undef HAVE_UNISTD_H + + /* Define if you have the header file. */ + #undef HAVE_UTIME_H + + /* Define if you have the header file. */ + #undef HAVE_VARARGS_H + + /* Number of bits in a file offset, on hosts where this is settable. */ + #undef _FILE_OFFSET_BITS + + /* Define to make fseeko etc. visible, on some hosts. */ + #undef _LARGEFILE_SOURCE + + /* Define for large files, on AIX-style hosts. */ + #undef _LARGE_FILES + + /* Define if compiler has function prototypes */ + #define PROTOTYPES 1 + + /* Define if exists, doesn't clash with , + and declares uintmax_t. */ + #undef HAVE_INTTYPES_H + + /* Define if struct utimbuf is declared -- usually in . + Some systems have utime.h but don't declare the struct anywhere. */ + #define HAVE_STRUCT_UTIMBUF 1 + + /* Define if the malloc check has been performed. */ + #define HAVE_DONE_WORKING_MALLOC_CHECK 1 + + /* Define to rpl_malloc if the replacement function should be used. */ + #undef malloc + + /* Define if the realloc check has been performed. */ + #define HAVE_DONE_WORKING_REALLOC_CHECK 1 + + /* Define to rpl_realloc if the replacement function should be used. */ + #undef realloc + + /* Define if there is a member named d_ino in the struct describing + directory headers. */ + #undef D_INO_IN_DIRENT + + #define ed_PROGRAM "ed" + + #include + + #include "unixio.h" + + #include + + #ifndef EXDEV + #define EXDEV 900 + #endif + + #define PUREISO 1 + + #define __argmatch_die _amdie + #define __argmatch_internal _aminternal + #define argmatch_invalid aminvalid + #define argmatch_valid amvalid + #define argmatch_to_argument amtoarg + #define argmatch_die amdie + #define TMPINNAME_needs_removal TIneedrem + #define TMPOUTNAME_needs_removal TOneedrem + #define TMPPATNAME_needs_removal TPneedrem + #define TMPREJNAME_needs_removal TRneedrem + #define version_controller vctler + #define version_get vget + #define version_control vcontrol + #define version_control_context vcontcont + #define version_number vnumber + #define quoting_style_args qsargs + #define quoting_style_vals qsvals + #define quotearg_buffer qabuffer + #define quotearg_n_options qanopts + #define quotearg_n qan + #define quotearg_n_style qanstyle + #define quotearg_style qastyle + #define quotearg_char qachar + #define quotearg_colon qacolon + #define CHECKOUT_LOCKED COLOCKED + #define SCCSDIFF1 SCD1 + #define SCCSDIFF2 SCD2 + #define initial_signal_mask insigmask + #define initial_time intime + #define xalloc_fail_func xaffunc + #define _getopt_initialize goinit + #define _getopt_internal gointernal + #define getopt_long_only golonly + #define Fseek fseek2 Index: patch/maketime.c diff -c patch/maketime.c:1.1.1.1 patch/maketime.c:1.2 *** patch/maketime.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/maketime.c Wed Nov 15 12:10:06 2006 *************** *** 42,48 **** --- 42,50 ---- # endif # endif /* MIPS RISCOS4.52 defines time_t in not . */ + #if HAVE_SYS_TYPES_H # include + #endif # if HAVE_LIMITS_H # include # endif Index: patch/patch.c diff -c patch/patch.c:1.1.1.1 patch/patch.c:1.3 *** patch/patch.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/patch.c Fri Nov 17 13:30:36 2006 *************** *** 427,447 **** rej = xmalloc (strlen (outname) + 5); strcpy (rej, outname); addext (rej, ".rej", '#'); ! } ! say (" -- saving rejects to file %s", quotearg (rej)); ! if (! dry_run) ! { ! move_file (TMPREJNAME, &TMPREJNAME_needs_removal, ! rej, instat.st_mode, FALSE); ! if (! inerrno ! && (chmod (rej, (instat.st_mode & ~(S_IXUSR|S_IXGRP|S_IXOTH))) != 0)) ! pfatal ("can't set permissions on file %s", quotearg (rej)); ! } ! if (!rejname) free (rej); } say ("\n"); } --- 427,446 ---- rej = xmalloc (strlen (outname) + 5); strcpy (rej, outname); addext (rej, ".rej", '#'); ! say (" -- saving rejects to file %s", quotearg (rej)); ! if (! dry_run) ! { ! move_file (TMPREJNAME, &TMPREJNAME_needs_removal, ! rej, instat.st_mode, FALSE); ! if (! inerrno ! && (chmod (rej, (instat.st_mode & ~(S_IXUSR|S_IXGRP|S_IXOTH))) != 0)) ! pfatal ("can't set permissions on file %s", quotearg (rej)); ! } free (rej); + } } say ("\n"); } *************** *** 1154,1162 **** --- 1153,1166 ---- static FILE * create_output_file (char const *name, int open_flags) { + #if PUREISO + FILE *f = fopen(name, binary_transput ? "wb" : "w"); + #else int fd = create_file (name, O_WRONLY | binary_transput | open_flags, instat.st_mode); FILE *f = fdopen (fd, binary_transput ? "wb" : "w"); + #endif + if (! f) pfatal ("Can't create file %s", quotearg (name)); return f; *************** *** 1178,1185 **** init_reject (void) { int exclusive = TMPREJNAME_needs_removal ? 0 : O_EXCL; ! TMPREJNAME_needs_removal = 1; ! rejfp = create_output_file (TMPREJNAME, exclusive); } /* Copy input file to output, up to wherever hunk is to be applied. */ --- 1182,1196 ---- init_reject (void) { int exclusive = TMPREJNAME_needs_removal ? 0 : O_EXCL; ! if (rejname) ! { ! rejfp = create_output_file (rejname, O_EXCL); ! } ! else ! { ! TMPREJNAME_needs_removal = 1; ! rejfp = create_output_file (TMPREJNAME, exclusive); ! } } /* Copy input file to output, up to wherever hunk is to be applied. */ Index: patch/quotearg.c diff -c patch/quotearg.c:1.1.1.1 patch/quotearg.c:1.2 *** patch/quotearg.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/quotearg.c Wed Nov 15 12:10:06 2006 *************** *** 23,29 **** --- 23,31 ---- # include #endif + #if HAVE_SYS_TYPES_H #include + #endif #include #include Index: patch/quotesys.c diff -c patch/quotesys.c:1.1.1.1 patch/quotesys.c:1.2 *** patch/quotesys.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/quotesys.c Wed Nov 15 12:10:06 2006 *************** *** 22,28 **** --- 22,30 ---- # include #endif + #if HAVE_SYS_TYPES_H #include + #endif #include /* Place into QUOTED a quoted version of ARG suitable for `system'. Index: patch/strncasecmp.c diff -c /dev/null patch/strncasecmp.c:1.1 *** /dev/null Fri Nov 17 13:40:52 2006 --- patch/strncasecmp.c Wed Nov 15 12:12:38 2006 *************** *** 0 **** --- 1,70 ---- + /* strcasecmp.c -- case insensitive string comparator + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + #define LENGTH_LIMIT 1 + + #if HAVE_CONFIG_H + # include + #endif + + #ifdef LENGTH_LIMIT + # define STRXCASECMP_FUNCTION strncasecmp + # define STRXCASECMP_DECLARE_N , size_t n + # define LENGTH_LIMIT_EXPR(Expr) Expr + #else + # define STRXCASECMP_FUNCTION strcasecmp + # define STRXCASECMP_DECLARE_N /* empty */ + # define LENGTH_LIMIT_EXPR(Expr) 0 + #endif + + #if HAVE_SYS_TYPES_H + #include + #endif + #include + + #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) + + /* Compare {{no more than N characters of }}strings S1 and S2, + ignoring case, returning less than, equal to or + greater than zero if S1 is lexicographically less + than, equal to or greater than S2. */ + + int + STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N) + { + register const unsigned char *p1 = (const unsigned char *) s1; + register const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0)) + return 0; + + do + { + c1 = TOLOWER (*p1); + c2 = TOLOWER (*p2); + + if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0') + break; + + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; + } Index: patch/unixio.c diff -c /dev/null patch/unixio.c:1.2 *** /dev/null Fri Nov 17 13:40:52 2006 --- patch/unixio.c Thu Nov 16 12:12:38 2006 *************** *** 0 **** --- 1,230 ---- + /*********************************************************************/ + /* */ + /* This Program Written By Paul Edwards. */ + /* Released to the public domain. */ + /* */ + /*********************************************************************/ + /*********************************************************************/ + /* */ + /* unixio - Unix I/O functions written in terms of standard C */ + /* functions. */ + /* */ + /*********************************************************************/ + + #include + #include + #include + + #ifdef fileno + #undef fileno + #endif + + #include "unixio.h" + + static FILE *files[FOPEN_MAX]; + /*char *environ[] = { NULL };*/ + + int open(const char *fnm, int mode, ...) + { + int x; + char *modestr = ""; + + for (x = 3; x < FOPEN_MAX; x++) + { + if (files[x] == NULL) + { + break; + } + } + if (x == FOPEN_MAX) + { + return (-1); + } + if ((mode & 0x07) == O_RDONLY) + { + modestr = "r"; + } + else if ((mode & 0x07) == O_WRONLY) + { + modestr = "w"; + } + else if ((mode & 0x07) == O_RDWR) + { + modestr = "r+"; + } + files[x] = fopen(fnm, modestr); + if (files[x] == NULL) + { + return (-1); + } + return (x); + } + + int read(int fno, void *buf, size_t bytes) + { + size_t rb; + + if (fno < 3) + { + rb = fread(buf, 1, bytes, stdin); + } + else + { + rb = fread(buf, 1, bytes, files[fno]); + } + return ((int)rb); + } + + int write(int fno, const void *buf, size_t bytes) + { + size_t wb; + + if (fno == 1) + { + fwrite(buf, 1, bytes, stdout); + } + else if (fno == 2) + { + fwrite(buf, 1, bytes, stderr); + } + else if (fno > 2) + { + wb = fwrite(buf, 1, bytes, files[fno]); + } + return ((int)wb); + } + + int close(int fno) + { + if (fno >= 3) + { + fclose(files[fno]); + files[fno] = NULL; + } + return (0); + } + + long lseek(int fno, long int offset, int whence) + { + return (fseek(files[fno], offset, whence)); + } + + FILE *fdopen(int fno, const char *mode) + { + return (files[fno]); + } + + char *getcwd(char *buf, int len) + { + if (len != 0) + { + *buf = '\0'; + } + return (buf); + } + + void unlink(char *f) + { + remove(f); + return; + } + + int stat(char *f, struct stat *buf) + { + memset(buf, '\0', sizeof *buf); + buf->st_mode = S_IFREG; + buf->st_size = 999999; + return (0); + } + + int fileno(FILE *fp) + { + return (0); + } + + int access(char *f, int n) + { + return (1); + } + + int fstat(int fh, struct stat *buf) + { + memset(buf, '\0', sizeof *buf); + return (0); + } + + int pwait(int a, int *b, int c) + { + return (0); + } + + int putenv(const char *x) + { + return (0); + } + + char *mktemp(char *s) + { + return (tmpnam(s)); + } + + int chdir(char *path) + { + return (0); + } + + int rmdir(char *path) + { + return (0); + } + + int mkdir(char *path, int permissions) + { + return (0); + } + + FILE *popen(const char *s, const char *t) + { + return (NULL); + } + + int pclose(FILE *f) + { + return (0); + } + + int kill(int a, int b) + { + return (0); + } + + int mkstemp(char *buf) + { + return (open(tmpnam(buf), O_WRONLY)); + } + + DIR *opendir(char *dirname) + { + return (NULL); + } + + struct dirent *readdir(DIR *dir) + { + return (NULL); + } + + int closedir(DIR *dir) + { + return (0); + } + + int execvp(char *path, char **argv) + { + return (0); + } + + int utime(char *file, struct utimbuf *utbuf) + { + memset(utbuf, 0, sizeof *utbuf); + return (0); + } Index: patch/unixio.h diff -c /dev/null patch/unixio.h:1.2 *** /dev/null Fri Nov 17 13:40:52 2006 --- patch/unixio.h Thu Nov 16 12:12:38 2006 *************** *** 0 **** --- 1,85 ---- + /* written by Paul Edwards */ + /* released to the public domain */ + + #ifndef UNIXIO_INCLUDED + #define UNIXIO_INCLUDED + + #include + #include + #include + #include + #include + + #define S_IFBLK 0x3000 + #define S_IFDIR 0x4000 + #define S_IFREG 0x8000 + #define S_IFMT 0xf000 + + #ifndef ENOENT + #define ENOENT 2002 + #endif + #ifndef ENOTDIR + #define ENOTDIR 2045 + #endif + + #define O_RDONLY 1 + #define O_WRONLY 2 + #define O_RDWR 4 + #define O_CREAT 0x100 + #define O_TRUNC 0x200 + + struct stat { + long st_size; + long st_mode; + long st_ino; + long st_dev; + long st_mtime; + int st_nlink; + int st_uid; + int st_gid; + int st_ctime; + }; + + typedef struct { + int whatever; + } DIR; + + struct dirent { + int whatever; + }; + + struct direct { + char *d_name; + int d_namlen; + }; + + typedef struct utimbuf { + time_t actime; + time_t modtime; + }; + + typedef long off_t; + + #define waitpid(a,b,c) (*(b) = 0) + #define getpid() (0) + #define geteuid() (0) + #define _exit(a) (exit((a))) + #define chmod(a, b) (0) + #define creat(a, b) (open((a), (b))) + #define isatty(a) (0) + + int open(const char *fnm, int mode, ...); + int read(int fno, void *buf, size_t bytes); + int write(int fno, const void *buf, size_t bytes); + int close(int fno); + long lseek(int fno, long int offset, int whence); + char *mktemp(char *s); + FILE *popen(const char *s, const char *t); + int kill(int a, int b); + DIR *opendir(char *dirname); + struct dirent *readdir(DIR *dir); + int closedir(DIR *dir); + int execvp(char *path, char **argv); + int utime(char *file, struct utimbuf *utbuf); + + #endif Index: patch/xmalloc.c diff -c patch/xmalloc.c:1.1.1.1 patch/xmalloc.c:1.2 *** patch/xmalloc.c:1.1.1.1 Wed Nov 15 11:57:32 2006 --- patch/xmalloc.c Wed Nov 15 12:10:06 2006 *************** *** 19,25 **** --- 19,27 ---- # include #endif + #if HAVE_SYS_TYPES_H #include + #endif #if STDC_HEADERS # include