summaryrefslogtreecommitdiff
path: root/pc
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:14:29 +0100
committerAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:14:29 +0100
commit1adb4535a31d825f10a5bd1ef10b52a7425073bd (patch)
tree1a9a12d04c92d4d93a4b7d8a09af635a8f93fa63 /pc
parentbcce1233902dc7a94623b3a90cd7920c44f22474 (diff)
downloadpatch-1adb4535a31d825f10a5bd1ef10b52a7425073bd.tar.gz
Import of patch-2.3.tar.gzv2.3
Diffstat (limited to 'pc')
-rw-r--r--pc/chdirsaf.c34
-rw-r--r--pc/djgpp/README19
-rw-r--r--pc/djgpp/config.h139
-rw-r--r--pc/djgpp/config.sed35
-rw-r--r--pc/djgpp/configure.bat27
5 files changed, 254 insertions, 0 deletions
diff --git a/pc/chdirsaf.c b/pc/chdirsaf.c
new file mode 100644
index 0000000..0598f78
--- /dev/null
+++ b/pc/chdirsaf.c
@@ -0,0 +1,34 @@
+/* A safer version of chdir, which returns back to the
+ initial working directory when the program exits. */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static char *initial_wd;
+
+static void
+restore_wd (void)
+{
+ chdir (initial_wd);
+}
+
+int
+chdir_safer (char const *dir)
+{
+ if (! initial_wd)
+ {
+ size_t s;
+ for (s = 256; ! (initial_wd = getcwd (0, s)); s *= 2)
+ if (errno != ERANGE)
+ return -1;
+ if (atexit (restore_wd) != 0)
+ {
+ free (initial_wd);
+ initial_wd = 0;
+ return -1;
+ }
+ }
+
+ return chdir (dir);
+}
diff --git a/pc/djgpp/README b/pc/djgpp/README
new file mode 100644
index 0000000..ef1cba7
--- /dev/null
+++ b/pc/djgpp/README
@@ -0,0 +1,19 @@
+To configure `patch' for DJGPP, issue these commands from the
+`patch' source directory:
+
+ pc\djgpp\configure
+ make
+
+To build `patch' in a directory other than where the sources are,
+add a parameter that specifies the source directory, e.g.:
+
+ e:\gnu\patch-2.3\pc\djgpp\configure e:/gnu/patch-2.3
+
+You MUST use forward slashes to specify the source directory.
+
+Running configure.bat requires a port of `sed'.
+You can find one on the usual DJGPP archive sites.
+
+
+Thanks to Eli Zaretskii <eliz@is.elta.co.il> for
+suggestions and ideas for this DJGPP port.
diff --git a/pc/djgpp/config.h b/pc/djgpp/config.h
new file mode 100644
index 0000000..d2f6cb5
--- /dev/null
+++ b/pc/djgpp/config.h
@@ -0,0 +1,139 @@
+/* config.h for compiling `patch' with DJGPP for MS-DOS and MS-Windows.
+ Please keep this file as similar as possible to ../../config.h
+ to simplify maintenance later. */
+
+/* This does most of the work; the rest of this file defines only those
+ symbols that <sys/config.h> doesn't define correctly. */
+#include <sys/config.h>
+
+/* 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. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* 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). */
+/* #undef RETSIGTYPE */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+/* Define if there is a member named d_ino in the struct describing
+ directory headers. */
+/* #undef D_INO_IN_DIRENT */
+
+/* Define if memchr works. */
+/* #undef HAVE_MEMCHR */
+
+/* Define if you have the _doprintf function. */
+/* #undef HAVE__DOPRINTF */
+
+/* Define if you have the isascii function. */
+/* #undef HAVE_ISASCII */
+
+/* Define if you have the memchr function. */
+/* #undef 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. */
+#define HAVE_MKTEMP 1
+
+/* Define if you have the pathconf function. */
+#define HAVE_PATHCONF 1
+
+/* Define if you have the rename function. */
+/* #undef HAVE_RENAME */
+
+/* Define if you have the sigaction function. */
+/* #undef HAVE_SIGACTION */
+
+/* Define if you have the sigprocmask function. */
+#define HAVE_SIGPROCMASK 1
+
+/* Define if you have the sigsetmask function. */
+/* #undef HAVE_SIGSETMASK */
+
+/* Define if you have the <dirent.h> header file. */
+/* #undef HAVE_DIRENT_H */
+
+/* Define if you have the <fcntl.h> header file. */
+/* #undef HAVE_FCNTL_H */
+
+/* Define if you have the <limits.h> header file. */
+/* #undef HAVE_LIMITS_H */
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <string.h> header file. */
+/* #undef HAVE_STRING_H */
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define if you have the <varargs.h> header file. */
+/* #undef HAVE_VARARGS_H */
+
+
+/* PC-specific definitions */
+
+#define chdir chdir_safer
+int chdir_safer (char const *);
+
+#define FILESYSTEM_PREFIX_LEN(f) ((f)[0] && (f)[1] == ':' ? 2 : 0)
+#define ISSLASH(c) ((c) == '/' || (c) == '\\')
+
+#define HAVE_DOS_FILE_NAMES 1
+
+#define HAVE_SETMODE 1
+#ifdef WIN32
+# define setmode _setmode
+#endif
+
+#define TMPDIR "c:"
diff --git a/pc/djgpp/config.sed b/pc/djgpp/config.sed
new file mode 100644
index 0000000..cc449fd
--- /dev/null
+++ b/pc/djgpp/config.sed
@@ -0,0 +1,35 @@
+# Edit Makefile.in to produce Makefile for DJGPP v2
+# $Id: config.sed,v 1.4 1997/05/26 17:52:29 eggert Exp $
+
+1i\
+# Makefile generated by "configure.bat" for DJGPP v2\
+
+/@SET_MAKE@/d
+
+s|@CC@|gcc|g
+s|@ed_PROGRAM@|ed|g
+s|@INSTALL@|${DJDIR}/bin/ginstall -c|g
+s|@INSTALL_PROGRAM@|${INSTALL}|g
+s|@INSTALL_DATA@|${INSTALL} -m 644|g
+
+s|@CFLAGS@|-g -O2|g
+s|@CPPFLAGS@|-I$(srcdir)/pc/djgpp|g
+s|@DEFS@|-DHAVE_CONFIG_H|g
+s|@LDFLAGS@||g
+s|@LIBOBJS@|getopt1.o getopt.o chdirsaf.o|g
+s|@LIBS@||g
+s|@PACKAGE@|patch|g
+/@VERSION@/d
+
+s|@prefix@|${DJDIR}|g
+s|@exec_prefix@|${prefix}|g
+
+/^CONFIG_HDRS *=/s|=.*|= pc/djgpp/config.h|
+/^CONFIG_STATUS *=/s|=.*|= $(srcdir)/pc/djgpp/configure.bat|
+/^ \$(SHELL) \$(CONFIG_STATUS) *$/s// $(CONFIG_STATUS) $(srcdir)/
+
+$a\
+chdirsaf.o: chdirsaf.c\
+# Use sed instead of cp, since cp might not be installed.\
+chdirsaf.c: pc/chdirsaf.c; sed -e '' $? > $@\
+distclean::; rm -f chdirsaf.c
diff --git a/pc/djgpp/configure.bat b/pc/djgpp/configure.bat
new file mode 100644
index 0000000..c5313ea
--- /dev/null
+++ b/pc/djgpp/configure.bat
@@ -0,0 +1,27 @@
+@echo off
+Rem Configure patch for DJGPP v2.
+Rem $Id: configure.bat,v 1.3 1997/05/26 17:52:29 eggert Exp $
+
+Rem The DOS shell has fixed-size environment storage.
+Rem When the environment is full, the shell prints
+Rem "Out of environment space" and truncates the string at will.
+Rem Since people often ignore these messages,
+Rem test whether the environment variable got the correct value.
+
+Rem Where is our source directory?
+set srcdir=.
+if not "%srcdir%" == "." goto SmallEnv
+if not "%1" == "" set srcdir=%1
+if not "%1" == "" if not "%srcdir%" == "%1" goto SmallEnv
+
+Rem Create Makefile
+sed -f %srcdir%/pc/djgpp/config.sed -e "s,@srcdir@,%srcdir%,g" %srcdir%/Makefile.in >Makefile
+sed -n -e "/^VERSION/p" %srcdir%/configure.in >>Makefile
+
+goto Exit
+
+:SmallEnv
+echo Your environment size is too small. Please enlarge it and run me again.
+
+:Exit
+set srcdir=