summaryrefslogtreecommitdiff
path: root/emx
diff options
context:
space:
mode:
Diffstat (limited to 'emx')
-rw-r--r--emx/.cvsignore3
-rw-r--r--emx/ChangeLog237
-rw-r--r--emx/Makefile409
-rw-r--r--emx/Makefile.in409
-rw-r--r--emx/README70
-rw-r--r--emx/config.h446
-rw-r--r--emx/filesubr.c804
-rw-r--r--emx/rcmd.h46
-rw-r--r--emx/savecwd.c141
-rw-r--r--emx/startserver.c82
-rw-r--r--emx/system.c91
11 files changed, 2738 insertions, 0 deletions
diff --git a/emx/.cvsignore b/emx/.cvsignore
new file mode 100644
index 0000000..0bc6703
--- /dev/null
+++ b/emx/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+cvs.exe
+cvs.out
diff --git a/emx/ChangeLog b/emx/ChangeLog
new file mode 100644
index 0000000..a6e7c7a
--- /dev/null
+++ b/emx/ChangeLog
@@ -0,0 +1,237 @@
+2005-09-01 Derek Price <derek@ximbiot.com>
+
+ * README: Update bug-cvs email.
+
+2005-03-16 Derek Price <derek@ximbiot.com>
+
+ * filesubr.c (open_file): Remove this function.
+
+2005-03-01 Derek Price <derek@ximbiot.com>
+
+ * config.h: Remove obsolete timeb cruft.
+
+2004-10-07 Derek Price <derek@ximbiot.com>
+
+ * Makefile.in (LIB_SOURCES): Remove stripslash.c.
+ (OS2_OBJECTS): Remove stripslash.o.
+
+2004-09-17 Derek Price <derek@ximbiot.com>
+
+ * stripslash.c: Remove file.
+
+2004-04-04 Derek Price <derek@ximbiot.com>
+
+ * filesubr.c (isabsolute): Remove this function.
+ * config.h (ISABSOLUTE): Define.
+
+2003-11-10 Mark D. Baushke <mdb@cvshome.org>
+
+ * filesubr.c (xresolvepath): New function.
+
+2003-08-07 Derek Price <derek@ximbiot.com>
+
+ * Makefile.in (pdf ps): New recursive targets to be ignored for
+ Automake's benefit.
+
+2003-07-16 Derek Price <derek@ximbiot.com>
+
+ * filesubr.c: s/PROTO/.
+ * savecwd.c: Ditto.
+
+2002-03-21 Derek Price <derek@ximbiot.com>
+
+ * Makefile.in: Remove unecessary dependence on $(srcdir) to
+ fix the dist target.
+ (distdir): Use new automake generated target (copied from src).
+
+2003-03-19 Mark D. Baushke <mdb@cvshome.org>
+
+ * config.h (RSH_DFLT): Default to "rsh".
+
+2002-12-19 Derek Price <derek@ximbiot.com>
+
+ * Makefile.in: Remove reference to options.h.
+ * startserver.c: Ditto.
+ * options.h: Remove file and move relevant content...
+ * config.h: ...here.
+
+2002-09-24 Derek Price <derek@ximbiot.com>
+
+ * options.h: Remove prototype of STDC exit().
+
+2002-08-24 Larry Jones <lawrence.jones@eds.com>
+
+ * options.h: Remove PATCH_PROGRAM.
+
+2002-08-16 Derek Price <derek@ximbiot.com>
+
+ * options.h: Remove RELATIVE_REPOS & move CVS_BADROOT...
+ * config.h: ...here.
+
+2001-09-04 Derek Price <dprice@collab.net>
+
+ * Makefile.in: Regenerated with automake 1.5.
+
+2001-03-14 Derek Price <derek.price@openavenue.com>
+
+ * Makefile.in (installcheck): New target.
+
+2001-02-14 Larry Jones <larry.jones@sdrc.com>
+
+ * Makefile.in: Remove references to rtag.c & rtag.o.
+
+2000-12-21 Derek Price <derek.price@openavenue.com>
+
+ * Makefile.in: Targets added to please Automake
+
+1999-03-27 Jim Kingdon <http://www.cyclic.com>
+
+ * Makefile.in (LIB_OBJECTS, LIB_SOURCES): Remove vasprintf.
+
+1999-02-26 Jim Kingdon <http://www.cyclic.com>
+
+ * options.h: Make RELATIVE_REPOS the default, as in
+ ../src/options.h.in.
+
+1998-08-24 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in (rcscmds.o): New rule, so we can supply -I for
+ diffrun.h.
+
+1998-04-09 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * filesubr.c (link_file): Remove; no longer used.
+
+Tue Feb 17 02:28:20 1998 Noel Cragg <noel@swish.red-bean.com>
+
+ * filesubr.c (last_component): return the top-level directory when
+ asked about the top-level directory.
+
+Tue Jan 13 13:17:33 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * options.h (DIFF, RCSBIN_DFLT): Remove; no longer used.
+
+Wed Dec 31 10:56:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * config.h, filesubr.c (convert_file): Remove; no longer used
+ (except for BROKEN_READWRITE_CONVERSION which doesn't apply).
+
+Sat Dec 27 16:57:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * options.h (HAVE_RCS5): Remove; no longer used.
+
+ * config.h (LINES_CRLF_TERMINATED): Remove; no longer used.
+
+Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * README: Change bug-cvs address from prep.ai.mit.edu to gnu.org
+ per email from Martin Hamilton.
+
+Sat Nov 29 22:20:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * options.h: Remove declaration of getwd; see lib/ChangeLog for
+ rationale.
+
+Fri Nov 14 13:37:33 1997 Abe Feldman and Jim Kingdon
+
+ * savecwd.c: New file, copied from lib/savecwd.c except it calls
+ _chdir2 not chdir.
+ * Makefile.in: Put savecwd in emx directory not lib directory.
+
+Tue Nov 4 18:20:08 1997 Abe Feldman <feldman@cyclic.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in: Adjust to add diff directory.
+
+Sun Sep 7 19:49:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * system.c (os2_stat): Adjust comment to reflect removal of
+ same_directories from src/root.c.
+
+Sat Sep 06 14:45:13 1997 Jim Kingdon
+
+ * Makefile.in: Add a cvs-static.exe rule for generating
+ executables which don't need emx.dll (doesn't work yet).
+
+Fri Sep 05 12:21:56 1997 Jim Kingdon
+
+ * filesubr.c (xchmod): Replace with "attrib"-based code from
+ os2/filesubr.c.
+ * config.h (CHMOD_BROKEN): Define.
+
+Wed Jul 30 15:35:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in: In comment about Makefile rule, remove note about
+ this not being a problem for os2/Makefile.in. It is a problem
+ there too.
+
+ * README: Add note about srcdir and top_srcdir.
+
+Mon Jul 21 15:36:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in (DISTFILES): Makefile is not in srcdir.
+
+Wed Jun 18 12:07:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in (OS2_SOURCES): Fix comment so this is not commented
+ out. Remove windows-NT/rcmd.c; the make dist for the windows-NT
+ directory can take care of that one.
+
+ * Makefile.in, README: Add comments about Makefile rule.
+
+Tue Jun 17 14:44:02 1997 Jim Kingdon (unknown@beezley)
+
+ * rcmd.c: Removed; no longer used.
+ * rcmd.h: Updated to have similar contents as
+ windows-NT/rcmd.h.
+ * Makefile.in (OS2_HEADERS): Change back to ${srcdir}/rcmd.h.
+ That is the one that the -I options specify anyway.
+ * startserver.c (os2_start_server): Pass a const char ** not
+ a char ** to rcmd.
+
+ * README: Replace text concerning warnings with a more
+ specific list of exactly what the warnings are. For the
+ most part there should be no warnings.
+ Update note about -lufc.
+ * Makefile.in (LIB): Remove -lufc.
+ * config.h (RSH_NOT_TRANSPARENT): Define.
+ * Makefile.in: Use ${top_srcdir}/windows-NT/rcmd.* not our
+ own rcmd.* (for better error messages).
+ * .cvsignore: Add cvs.out.
+
+Tue Jun 17 13:19:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * README: Revise paragraph on -Zsys to discuss problem with
+ sockets being missing.
+
+Mon Jun 16 10:58:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * README: Change bug submission address to include bug-cvs.
+ Add paragraph (from the mail message of the submission) concerning
+ HPFS and such. Cosmetic changes (two spaces after periods for
+ example). Say that ufc-crypt shouldn't be needed currently.
+ Add comment about emx.dll.
+ * config.h, startserver.c, rcmd.h, rcmd.c, system.c: Add
+ "copyright" notice.
+ * system.c (os2_initialize): Add comment about whether we should
+ be expanding wildcards here. Cosmetic changes throughout
+ (for example, reindenting just about everything).
+ * system.c (xgetwd): Rewritten and renamed from os2_getwd.
+ * config.h (CVS_GETWD, os2_getwd): Removed.
+ * rcmd.c: Add comment about portable versus OS-specific
+ implementations of this functionality.
+ * config.h: Remove SIZEOF_INT, SIZEOF_LONG, HAVE_MKFIFO,
+ HAVE_SETVBUF, and USE_DIRECT_TCP; no longer used.
+ * config.h: Add USE_SETMODE_BINARY.
+ * config.h: Define NO_EXT_METHOD.
+ * Makefile.in (LIB_SOURCES): Remove lib/xgetwd.c; replaced by
+ xgetwd in system.c.
+ (LIB_OBJECTS): Likewise, remove lib/xgetwd.o.
+ * Makefile.in (DISTFILES): Add missing "/".
+ * .cvsignore: Added.
+
+ * New directory. This consists of the port that Thomas Epting
+ sent to bug-cvs on 18 Mar 97. He also sent some diffs which go
+ with this; I'll subsequently be checking in some of those diffs
+ and my various tweaks to the code.
+
diff --git a/emx/Makefile b/emx/Makefile
new file mode 100644
index 0000000..4b906ba
--- /dev/null
+++ b/emx/Makefile
@@ -0,0 +1,409 @@
+# Makefile for OS/2. Generated from Makefile.in when CVS is
+# configured for a dist-build. Configure never gets run on OS/2, so
+# we must include the generated Makefile in the distribution. See the
+# `dist-dir' rule.
+
+project: cvs.exe
+# .SUFFIXES .c .o .exe
+
+# Directory in which to install executables.
+install_dir = s:/gnu/util
+
+# srcdir is usually "."
+srcdir = .
+
+# top_srcdir is usually ".."
+top_srcdir = ..
+
+
+subdir = emx
+
+lib_dir = ${top_srcdir}/lib
+cvs_srcdir = ${top_srcdir}/src
+diff_srcdir = ${top_srcdir}/diff
+zlib_dir = ${top_srcdir}/zlib
+
+# Do we need these?
+# prefix = /usr/local
+# exec_prefix = ${prefix}
+
+# Used to say -lufc, but that would only be needed for crypt().
+LIB = -lsocket
+
+CINC =
+# This says we are building an object file, not a full executable.
+OBJ_CFLAGS = -c
+CFLAGS = -pedantic -Wall -fno-builtin ${CINC} \
+ -I${srcdir} -I${lib_dir} -I${cvs_srcdir} -I${zlib_dir} \
+ -DUNIX -DHAVE_CONFIG_H
+
+
+# headers specific to OS/2
+
+# We list OS2_HEADERS so we know what to include when we make dist-dir
+# here.
+OS2_HEADERS = \
+ config.h \
+ rcmd.h
+
+# headers we use from the common src dir, ../src
+COMMON_HEADERS = \
+ ${cvs_srcdir}/client.h \
+ ${cvs_srcdir}/cvs.h \
+ ${cvs_srcdir}/rcs.h \
+ ${cvs_srcdir}/hash.h \
+ ${cvs_srcdir}/myndbm.h \
+ ${cvs_srcdir}/patchlevel.h \
+ ${cvs_srcdir}/update.h \
+ ${cvs_srcdir}/server.h \
+ ${cvs_srcdir}/error.h
+
+# headers in ../diff
+DIFF_HEADERS = \
+ ${diff_srcdir}/cmpbuf.h \
+ ${diff_srcdir}/diff.h \
+ ${diff_srcdir}/system.h
+
+# sources specific to OS/2
+OS2_SOURCES = \
+ filesubr.c \
+ startserver.c \
+ savecwd.c \
+ system.c
+
+# sources we use from the common src dir, ../src
+# FIXME: Is this used anywhere? I don't think it is.
+COMMON_SOURCES = \
+ ${cvs_srcdir}/add.c \
+ ${cvs_srcdir}/admin.c \
+ ${cvs_srcdir}/buffer.c \
+ ${cvs_srcdir}/checkin.c \
+ ${cvs_srcdir}/checkout.c \
+ ${cvs_srcdir}/classify.c \
+ ${cvs_srcdir}/client.c \
+ ${cvs_srcdir}/commit.c \
+ ${cvs_srcdir}/create_adm.c \
+ ${cvs_srcdir}/cvsrc.c \
+ ${cvs_srcdir}/diff.c \
+ ${cvs_srcdir}/edit.c \
+ ${cvs_srcdir}/entries.c \
+ ${cvs_srcdir}/error.c \
+ ${cvs_srcdir}/expand_path.c \
+ ${cvs_srcdir}/fileattr.c \
+ ${cvs_srcdir}/find_names.c \
+ ${cvs_srcdir}/hash.c \
+ ${cvs_srcdir}/history.c \
+ ${cvs_srcdir}/ignore.c \
+ ${cvs_srcdir}/import.c \
+ ${cvs_srcdir}/lock.c \
+ ${cvs_srcdir}/log.c \
+ ${cvs_srcdir}/login.c \
+ ${cvs_srcdir}/logmsg.c \
+ ${cvs_srcdir}/main.c \
+ ${cvs_srcdir}/mkmodules.c \
+ ${cvs_srcdir}/modules.c \
+ ${cvs_srcdir}/myndbm.c \
+ ${cvs_srcdir}/no_diff.c \
+ ${cvs_srcdir}/parseinfo.c \
+ ${cvs_srcdir}/patch.c \
+ ${cvs_srcdir}/rcs.c \
+ ${cvs_srcdir}/rcscmds.c \
+ ${cvs_srcdir}/recurse.c \
+ ${cvs_srcdir}/release.c \
+ ${cvs_srcdir}/remove.c \
+ ${cvs_srcdir}/repos.c \
+ ${cvs_srcdir}/root.c \
+ ${cvs_srcdir}/scramble.c \
+ ${cvs_srcdir}/server.c \
+ ${cvs_srcdir}/status.c \
+ ${cvs_srcdir}/subr.c \
+ ${cvs_srcdir}/run.c \
+ ${cvs_srcdir}/tag.c \
+ ${cvs_srcdir}/update.c \
+ ${cvs_srcdir}/watch.c \
+ ${cvs_srcdir}/wrapper.c \
+ ${cvs_srcdir}/vers_ts.c \
+ ${cvs_srcdir}/version.c \
+ ${cvs_srcdir}/zlib.c
+# end of $COMMON_SOURCES
+
+# sources in ../diff
+DIFF_SOURCES = \
+ ${diff_srcdir}/analyze.c \
+ ${diff_srcdir}/cmpbuf.c \
+ ${diff_srcdir}/context.c \
+ ${diff_srcdir}/diff.c \
+ ${diff_srcdir}/diff3.c \
+ ${diff_srcdir}/dir.c \
+ ${diff_srcdir}/ed.c \
+ ${diff_srcdir}/ifdef.c \
+ ${diff_srcdir}/io.c \
+ ${diff_srcdir}/normal.c \
+ ${diff_srcdir}/side.c \
+ ${diff_srcdir}/util.c \
+ ${diff_srcdir}/version.c
+
+# sources from ../lib
+# FIXME: Is this used anywhere? I don't think it is.
+LIB_SOURCES = \
+ ${lib_dir}/argmatch.c \
+ ${lib_dir}/getline.c \
+ ${lib_dir}/getopt.c \
+ ${lib_dir}/getopt1.c \
+ ${lib_dir}/md5.c \
+ ${lib_dir}/regex.c \
+ ${lib_dir}/sighandle.c \
+ ${lib_dir}/valloc.c \
+ ${lib_dir}/yesno.c \
+ ${lib_dir}/getdate.c
+
+# object files from OS/2 sources
+# was ${srcdir}/rcmd.o
+OS2_OBJECTS = \
+ ${srcdir}/filesubr.o \
+ ${srcdir}/startserver.o \
+ ${top_srcdir}/windows-NT/rcmd.o \
+ ${srcdir}/savecwd.o \
+ ${srcdir}/system.o
+
+# object files from ../src
+COMMON_OBJECTS = \
+ ${cvs_srcdir}/add.o \
+ ${cvs_srcdir}/admin.o \
+ ${cvs_srcdir}/buffer.o \
+ ${cvs_srcdir}/checkin.o \
+ ${cvs_srcdir}/checkout.o \
+ ${cvs_srcdir}/classify.o \
+ ${cvs_srcdir}/client.o \
+ ${cvs_srcdir}/commit.o \
+ ${cvs_srcdir}/create_adm.o \
+ ${cvs_srcdir}/cvsrc.o \
+ ${cvs_srcdir}/diff.o \
+ ${cvs_srcdir}/edit.o \
+ ${cvs_srcdir}/entries.o \
+ ${cvs_srcdir}/expand_path.o \
+ ${cvs_srcdir}/fileattr.o \
+ ${cvs_srcdir}/find_names.o \
+ ${cvs_srcdir}/hash.o \
+ ${cvs_srcdir}/history.o \
+ ${cvs_srcdir}/ignore.o \
+ ${cvs_srcdir}/import.o \
+ ${cvs_srcdir}/lock.o \
+ ${cvs_srcdir}/log.o \
+ ${cvs_srcdir}/login.o \
+ ${cvs_srcdir}/logmsg.o \
+ ${cvs_srcdir}/main.o \
+ ${cvs_srcdir}/mkmodules.o \
+ ${cvs_srcdir}/modules.o \
+ ${cvs_srcdir}/myndbm.o \
+ ${cvs_srcdir}/no_diff.o \
+ ${cvs_srcdir}/parseinfo.o \
+ ${cvs_srcdir}/patch.o \
+ ${cvs_srcdir}/rcs.o \
+ ${cvs_srcdir}/rcscmds.o \
+ ${cvs_srcdir}/recurse.o \
+ ${cvs_srcdir}/release.o \
+ ${cvs_srcdir}/remove.o \
+ ${cvs_srcdir}/repos.o \
+ ${cvs_srcdir}/root.o \
+ ${cvs_srcdir}/scramble.o \
+ ${cvs_srcdir}/server.o \
+ ${cvs_srcdir}/status.o \
+ ${cvs_srcdir}/tag.o \
+ ${cvs_srcdir}/update.o \
+ ${cvs_srcdir}/watch.o \
+ ${cvs_srcdir}/wrapper.o \
+ ${cvs_srcdir}/vers_ts.o \
+ ${cvs_srcdir}/subr.o \
+ ${cvs_srcdir}/run.o \
+ ${cvs_srcdir}/version.o \
+ ${cvs_srcdir}/error.o \
+ ${cvs_srcdir}/zlib.o
+# end of $COMMON_OBJECTS
+
+# object files in ../diff
+DIFF_OBJECTS = \
+ ${diff_srcdir}/analyze.o \
+ ${diff_srcdir}/cmpbuf.o \
+ ${diff_srcdir}/context.o \
+ ${diff_srcdir}/diff.o \
+ ${diff_srcdir}/diff3.o \
+ ${diff_srcdir}/dir.o \
+ ${diff_srcdir}/ed.o \
+ ${diff_srcdir}/ifdef.o \
+ ${diff_srcdir}/io.o \
+ ${diff_srcdir}/normal.o \
+ ${diff_srcdir}/side.o \
+ ${diff_srcdir}/util.o \
+ ${diff_srcdir}/version.o
+
+# objects from ../lib
+LIB_OBJECTS = \
+ ${lib_dir}/argmatch.o \
+ ${lib_dir}/getline.o \
+ ${lib_dir}/getopt.o \
+ ${lib_dir}/getopt1.o \
+ ${lib_dir}/md5.o \
+ ${lib_dir}/regex.o \
+ ${lib_dir}/sighandle.o \
+ ${lib_dir}/valloc.o \
+ ${lib_dir}/yesno.o \
+ ${lib_dir}/getdate.o
+
+ZLIB_OBJECTS = ${zlib_dir}/adler32.o \
+ ${zlib_dir}/compress.o \
+ ${zlib_dir}/crc32.o \
+ ${zlib_dir}/gzio.o \
+ ${zlib_dir}/uncompr.o \
+ ${zlib_dir}/deflate.o \
+ ${zlib_dir}/trees.o \
+ ${zlib_dir}/zutil.o \
+ ${zlib_dir}/inflate.o \
+ ${zlib_dir}/infblock.o \
+ ${zlib_dir}/inftrees.o \
+ ${zlib_dir}/infcodes.o \
+ ${zlib_dir}/infutil.o \
+ ${zlib_dir}/inffast.o
+
+SOURCES = ${COMMON_SOURCES} ${LIB_SOURCES} ${OS2_SOURCES} ${DIFF_SOURCES}
+HEADERS = ${COMMON_HEADERS} ${OS2_HEADERS} ${DIFF_HEADERS}
+OBJECTS = ${COMMON_OBJECTS} ${LIB_OBJECTS} ${OS2_OBJECTS} ${DIFF_OBJECTS} \
+ ${ZLIB_OBJECTS}
+
+DISTFILES = ${OS2_HEADERS} ${OS2_SOURCES} \
+ README ChangeLog \
+ Makefile.in .cvsignore \
+ Makefile
+
+all:
+
+# Automake
+.PHONY: all install installcheck uninstall check info dvi
+all install installcheck uninstall check:
+
+.PHONY: dvi info pdf ps
+dvi info pdf ps:
+
+installdirs:
+.PHONY: installdirs
+
+.PHONY: tags TAGS
+tags TAGS:
+
+.PHONY: clean distclean realclean mostlyclean
+clean distclean realclean maintainer-clean mostlyclean:
+
+.PHONY: lint
+lint:
+
+# distdir added for compatibility with CVS automake.
+top_distdir = ..
+PACKAGE = cvs
+VERSION = 1.12.13
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+distdir: $(DISTFILES)
+ @list='$(DISTFILES)'; for file in $$list; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+.PHONY: distdir
+
+# We don't have a real distclean or anything like that, but at least
+# we can get rid of the obj files and cvs.exe.
+.PHONY: clean distclean realclean mostlyclean maintainer-clean
+clean distclean realclean maintainer-clean mostlyclean:
+ rm -f cvs.exe cvs.out
+ rm -f ${srcdir}/*.o
+ rm -f ${diff_srcdir}/*.o
+ rm -f ${lib_dir}/*.o ${lib_dir}/*.a
+ rm -f ${zlib_dir}/*.o ${zlib_dir}/*.a
+ rm -f ${cvs_srcdir}/*.o
+
+clean-cvs:
+ del cvs.exe cvs.out
+ del $(subst /,\,${srcdir}/*.o)
+ del $(subst /,\,${diff_srcdir}/*.o)
+ del $(subst /,\,${lib_dir}/*.o ${lib_dir}/*.a)
+ del $(subst /,\,${zlib_dir}/*.o ${zlib_dir}/*.a)
+ del $(subst /,\,${cvs_srcdir}/*.o)
+
+install-cvs: cvs.exe
+ copy $(subst /,\,${srcdir}/cvs.exe ${install_dir}/cvs.exe)
+
+%.o: %.c
+ gcc ${OBJ_CFLAGS} ${CFLAGS} -o $@ -c $*.c
+
+${cvs_srcdir}/rcscmds.o: ${cvs_srcdir}/rcscmds.c ${top_srcdir}/diff/diffrun.h
+ gcc ${OBJ_CFLAGS} ${CFLAGS} -I${top_srcdir}/diff -o $@ -c $*.c
+
+${lib_dir}/libcvs.a: $(LIB_OBJECTS)
+ $(AR) cr $@ $(LIB_OBJECTS)
+
+${zlib_dir}/libz.a: $(ZLIB_OBJECTS)
+ $(AR) cr $@ $(ZLIB_OBJECTS)
+
+# Eventually probably static linking (cvs-static.exe) will be the
+# default, but even so we'll want to preserve this rule so we can
+# create a dynamically linked executable when we want coredumps.
+cvs.exe: ${OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a
+ gcc $(COMMON_OBJECTS) $(OS2_OBJECTS) ${DIFF_OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a $(LIB) -o cvs.out
+ emxbind -w -o $@.exe cvs.out
+
+${lib_dir}/libcvs.lib: ${lib_dir}/libcvs.a
+ emxomf ${lib_dir}/libcvs.a
+
+${zlib_dir}/libz.lib: ${zlib_dir}/libz.a
+ emxomf ${zlib_dir}/libz.a
+
+# Where do -Zomf -Zsys go? When we compile the .o's?
+# When I tried this rule, I had problems with (1) could not find
+# socket.lib. Hmm. I thought I converted it from socket.a
+# in the EMX distribution. Probably my EMX installation at fault.
+# (2) could not find miscellaneous system routines like strerror.
+# This might be a matter of learning to live without them (EMX
+# doc is supposed to describe which are present and which are not).
+# (3) some linker errors like no stack and the like. Maybe I am
+# missing some options?
+cvs-static.exe: ${OBJECTS} ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib
+ emxomf ${OBJECTS}
+ emxomfld -o $@ $(subst .o,.obj,${OBJECTS}) \
+ ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib ${LIB}
+
+# cvs.o: ${OBJECTS} ${SOURCES} ${HEADERS}
+
+# Hmm. This rule wants to exist on unix, so that "make dist" works.
+# And it doesn't want to exist on OS/2, because configure doesn't
+# run on OS/2 and so ../config.status won't exist. For now we just
+# say, in emx/README, that people will need to comment it out.
+Makefile: ../config.status $(srcdir)/Makefile.in
+ cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+
diff --git a/emx/Makefile.in b/emx/Makefile.in
new file mode 100644
index 0000000..8954713
--- /dev/null
+++ b/emx/Makefile.in
@@ -0,0 +1,409 @@
+# Makefile for OS/2. Generated from Makefile.in when CVS is
+# configured for a dist-build. Configure never gets run on OS/2, so
+# we must include the generated Makefile in the distribution. See the
+# `dist-dir' rule.
+
+project: cvs.exe
+# .SUFFIXES .c .o .exe
+
+# Directory in which to install executables.
+install_dir = s:/gnu/util
+
+# srcdir is usually "."
+srcdir = @srcdir@
+
+# top_srcdir is usually ".."
+top_srcdir = @top_srcdir@
+
+VPATH = @srcdir@
+subdir = emx
+
+lib_dir = ${top_srcdir}/lib
+cvs_srcdir = ${top_srcdir}/src
+diff_srcdir = ${top_srcdir}/diff
+zlib_dir = ${top_srcdir}/zlib
+
+# Do we need these?
+# prefix = /usr/local
+# exec_prefix = ${prefix}
+
+# Used to say -lufc, but that would only be needed for crypt().
+LIB = -lsocket
+
+CINC =
+# This says we are building an object file, not a full executable.
+OBJ_CFLAGS = -c
+CFLAGS = -pedantic -Wall -fno-builtin ${CINC} \
+ -I${srcdir} -I${lib_dir} -I${cvs_srcdir} -I${zlib_dir} \
+ -DUNIX -DHAVE_CONFIG_H
+
+
+# headers specific to OS/2
+
+# We list OS2_HEADERS so we know what to include when we make dist-dir
+# here.
+OS2_HEADERS = \
+ config.h \
+ rcmd.h
+
+# headers we use from the common src dir, ../src
+COMMON_HEADERS = \
+ ${cvs_srcdir}/client.h \
+ ${cvs_srcdir}/cvs.h \
+ ${cvs_srcdir}/rcs.h \
+ ${cvs_srcdir}/hash.h \
+ ${cvs_srcdir}/myndbm.h \
+ ${cvs_srcdir}/patchlevel.h \
+ ${cvs_srcdir}/update.h \
+ ${cvs_srcdir}/server.h \
+ ${cvs_srcdir}/error.h
+
+# headers in ../diff
+DIFF_HEADERS = \
+ ${diff_srcdir}/cmpbuf.h \
+ ${diff_srcdir}/diff.h \
+ ${diff_srcdir}/system.h
+
+# sources specific to OS/2
+OS2_SOURCES = \
+ filesubr.c \
+ startserver.c \
+ savecwd.c \
+ system.c
+
+# sources we use from the common src dir, ../src
+# FIXME: Is this used anywhere? I don't think it is.
+COMMON_SOURCES = \
+ ${cvs_srcdir}/add.c \
+ ${cvs_srcdir}/admin.c \
+ ${cvs_srcdir}/buffer.c \
+ ${cvs_srcdir}/checkin.c \
+ ${cvs_srcdir}/checkout.c \
+ ${cvs_srcdir}/classify.c \
+ ${cvs_srcdir}/client.c \
+ ${cvs_srcdir}/commit.c \
+ ${cvs_srcdir}/create_adm.c \
+ ${cvs_srcdir}/cvsrc.c \
+ ${cvs_srcdir}/diff.c \
+ ${cvs_srcdir}/edit.c \
+ ${cvs_srcdir}/entries.c \
+ ${cvs_srcdir}/error.c \
+ ${cvs_srcdir}/expand_path.c \
+ ${cvs_srcdir}/fileattr.c \
+ ${cvs_srcdir}/find_names.c \
+ ${cvs_srcdir}/hash.c \
+ ${cvs_srcdir}/history.c \
+ ${cvs_srcdir}/ignore.c \
+ ${cvs_srcdir}/import.c \
+ ${cvs_srcdir}/lock.c \
+ ${cvs_srcdir}/log.c \
+ ${cvs_srcdir}/login.c \
+ ${cvs_srcdir}/logmsg.c \
+ ${cvs_srcdir}/main.c \
+ ${cvs_srcdir}/mkmodules.c \
+ ${cvs_srcdir}/modules.c \
+ ${cvs_srcdir}/myndbm.c \
+ ${cvs_srcdir}/no_diff.c \
+ ${cvs_srcdir}/parseinfo.c \
+ ${cvs_srcdir}/patch.c \
+ ${cvs_srcdir}/rcs.c \
+ ${cvs_srcdir}/rcscmds.c \
+ ${cvs_srcdir}/recurse.c \
+ ${cvs_srcdir}/release.c \
+ ${cvs_srcdir}/remove.c \
+ ${cvs_srcdir}/repos.c \
+ ${cvs_srcdir}/root.c \
+ ${cvs_srcdir}/scramble.c \
+ ${cvs_srcdir}/server.c \
+ ${cvs_srcdir}/status.c \
+ ${cvs_srcdir}/subr.c \
+ ${cvs_srcdir}/run.c \
+ ${cvs_srcdir}/tag.c \
+ ${cvs_srcdir}/update.c \
+ ${cvs_srcdir}/watch.c \
+ ${cvs_srcdir}/wrapper.c \
+ ${cvs_srcdir}/vers_ts.c \
+ ${cvs_srcdir}/version.c \
+ ${cvs_srcdir}/zlib.c
+# end of $COMMON_SOURCES
+
+# sources in ../diff
+DIFF_SOURCES = \
+ ${diff_srcdir}/analyze.c \
+ ${diff_srcdir}/cmpbuf.c \
+ ${diff_srcdir}/context.c \
+ ${diff_srcdir}/diff.c \
+ ${diff_srcdir}/diff3.c \
+ ${diff_srcdir}/dir.c \
+ ${diff_srcdir}/ed.c \
+ ${diff_srcdir}/ifdef.c \
+ ${diff_srcdir}/io.c \
+ ${diff_srcdir}/normal.c \
+ ${diff_srcdir}/side.c \
+ ${diff_srcdir}/util.c \
+ ${diff_srcdir}/version.c
+
+# sources from ../lib
+# FIXME: Is this used anywhere? I don't think it is.
+LIB_SOURCES = \
+ ${lib_dir}/argmatch.c \
+ ${lib_dir}/getline.c \
+ ${lib_dir}/getopt.c \
+ ${lib_dir}/getopt1.c \
+ ${lib_dir}/md5.c \
+ ${lib_dir}/regex.c \
+ ${lib_dir}/sighandle.c \
+ ${lib_dir}/valloc.c \
+ ${lib_dir}/yesno.c \
+ ${lib_dir}/getdate.c
+
+# object files from OS/2 sources
+# was ${srcdir}/rcmd.o
+OS2_OBJECTS = \
+ ${srcdir}/filesubr.o \
+ ${srcdir}/startserver.o \
+ ${top_srcdir}/windows-NT/rcmd.o \
+ ${srcdir}/savecwd.o \
+ ${srcdir}/system.o
+
+# object files from ../src
+COMMON_OBJECTS = \
+ ${cvs_srcdir}/add.o \
+ ${cvs_srcdir}/admin.o \
+ ${cvs_srcdir}/buffer.o \
+ ${cvs_srcdir}/checkin.o \
+ ${cvs_srcdir}/checkout.o \
+ ${cvs_srcdir}/classify.o \
+ ${cvs_srcdir}/client.o \
+ ${cvs_srcdir}/commit.o \
+ ${cvs_srcdir}/create_adm.o \
+ ${cvs_srcdir}/cvsrc.o \
+ ${cvs_srcdir}/diff.o \
+ ${cvs_srcdir}/edit.o \
+ ${cvs_srcdir}/entries.o \
+ ${cvs_srcdir}/expand_path.o \
+ ${cvs_srcdir}/fileattr.o \
+ ${cvs_srcdir}/find_names.o \
+ ${cvs_srcdir}/hash.o \
+ ${cvs_srcdir}/history.o \
+ ${cvs_srcdir}/ignore.o \
+ ${cvs_srcdir}/import.o \
+ ${cvs_srcdir}/lock.o \
+ ${cvs_srcdir}/log.o \
+ ${cvs_srcdir}/login.o \
+ ${cvs_srcdir}/logmsg.o \
+ ${cvs_srcdir}/main.o \
+ ${cvs_srcdir}/mkmodules.o \
+ ${cvs_srcdir}/modules.o \
+ ${cvs_srcdir}/myndbm.o \
+ ${cvs_srcdir}/no_diff.o \
+ ${cvs_srcdir}/parseinfo.o \
+ ${cvs_srcdir}/patch.o \
+ ${cvs_srcdir}/rcs.o \
+ ${cvs_srcdir}/rcscmds.o \
+ ${cvs_srcdir}/recurse.o \
+ ${cvs_srcdir}/release.o \
+ ${cvs_srcdir}/remove.o \
+ ${cvs_srcdir}/repos.o \
+ ${cvs_srcdir}/root.o \
+ ${cvs_srcdir}/scramble.o \
+ ${cvs_srcdir}/server.o \
+ ${cvs_srcdir}/status.o \
+ ${cvs_srcdir}/tag.o \
+ ${cvs_srcdir}/update.o \
+ ${cvs_srcdir}/watch.o \
+ ${cvs_srcdir}/wrapper.o \
+ ${cvs_srcdir}/vers_ts.o \
+ ${cvs_srcdir}/subr.o \
+ ${cvs_srcdir}/run.o \
+ ${cvs_srcdir}/version.o \
+ ${cvs_srcdir}/error.o \
+ ${cvs_srcdir}/zlib.o
+# end of $COMMON_OBJECTS
+
+# object files in ../diff
+DIFF_OBJECTS = \
+ ${diff_srcdir}/analyze.o \
+ ${diff_srcdir}/cmpbuf.o \
+ ${diff_srcdir}/context.o \
+ ${diff_srcdir}/diff.o \
+ ${diff_srcdir}/diff3.o \
+ ${diff_srcdir}/dir.o \
+ ${diff_srcdir}/ed.o \
+ ${diff_srcdir}/ifdef.o \
+ ${diff_srcdir}/io.o \
+ ${diff_srcdir}/normal.o \
+ ${diff_srcdir}/side.o \
+ ${diff_srcdir}/util.o \
+ ${diff_srcdir}/version.o
+
+# objects from ../lib
+LIB_OBJECTS = \
+ ${lib_dir}/argmatch.o \
+ ${lib_dir}/getline.o \
+ ${lib_dir}/getopt.o \
+ ${lib_dir}/getopt1.o \
+ ${lib_dir}/md5.o \
+ ${lib_dir}/regex.o \
+ ${lib_dir}/sighandle.o \
+ ${lib_dir}/valloc.o \
+ ${lib_dir}/yesno.o \
+ ${lib_dir}/getdate.o
+
+ZLIB_OBJECTS = ${zlib_dir}/adler32.o \
+ ${zlib_dir}/compress.o \
+ ${zlib_dir}/crc32.o \
+ ${zlib_dir}/gzio.o \
+ ${zlib_dir}/uncompr.o \
+ ${zlib_dir}/deflate.o \
+ ${zlib_dir}/trees.o \
+ ${zlib_dir}/zutil.o \
+ ${zlib_dir}/inflate.o \
+ ${zlib_dir}/infblock.o \
+ ${zlib_dir}/inftrees.o \
+ ${zlib_dir}/infcodes.o \
+ ${zlib_dir}/infutil.o \
+ ${zlib_dir}/inffast.o
+
+SOURCES = ${COMMON_SOURCES} ${LIB_SOURCES} ${OS2_SOURCES} ${DIFF_SOURCES}
+HEADERS = ${COMMON_HEADERS} ${OS2_HEADERS} ${DIFF_HEADERS}
+OBJECTS = ${COMMON_OBJECTS} ${LIB_OBJECTS} ${OS2_OBJECTS} ${DIFF_OBJECTS} \
+ ${ZLIB_OBJECTS}
+
+DISTFILES = ${OS2_HEADERS} ${OS2_SOURCES} \
+ README ChangeLog \
+ Makefile.in .cvsignore \
+ Makefile
+
+all:
+
+# Automake
+.PHONY: all install installcheck uninstall check info dvi
+all install installcheck uninstall check:
+
+.PHONY: dvi info pdf ps
+dvi info pdf ps:
+
+installdirs:
+.PHONY: installdirs
+
+.PHONY: tags TAGS
+tags TAGS:
+
+.PHONY: clean distclean realclean mostlyclean
+clean distclean realclean maintainer-clean mostlyclean:
+
+.PHONY: lint
+lint:
+
+# distdir added for compatibility with CVS automake.
+top_distdir = ..
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+distdir: $(DISTFILES)
+ @list='$(DISTFILES)'; for file in $$list; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+.PHONY: distdir
+
+# We don't have a real distclean or anything like that, but at least
+# we can get rid of the obj files and cvs.exe.
+.PHONY: clean distclean realclean mostlyclean maintainer-clean
+clean distclean realclean maintainer-clean mostlyclean:
+ rm -f cvs.exe cvs.out
+ rm -f ${srcdir}/*.o
+ rm -f ${diff_srcdir}/*.o
+ rm -f ${lib_dir}/*.o ${lib_dir}/*.a
+ rm -f ${zlib_dir}/*.o ${zlib_dir}/*.a
+ rm -f ${cvs_srcdir}/*.o
+
+clean-cvs:
+ del cvs.exe cvs.out
+ del $(subst /,\,${srcdir}/*.o)
+ del $(subst /,\,${diff_srcdir}/*.o)
+ del $(subst /,\,${lib_dir}/*.o ${lib_dir}/*.a)
+ del $(subst /,\,${zlib_dir}/*.o ${zlib_dir}/*.a)
+ del $(subst /,\,${cvs_srcdir}/*.o)
+
+install-cvs: cvs.exe
+ copy $(subst /,\,${srcdir}/cvs.exe ${install_dir}/cvs.exe)
+
+%.o: %.c
+ gcc ${OBJ_CFLAGS} ${CFLAGS} -o $@ -c $*.c
+
+${cvs_srcdir}/rcscmds.o: ${cvs_srcdir}/rcscmds.c ${top_srcdir}/diff/diffrun.h
+ gcc ${OBJ_CFLAGS} ${CFLAGS} -I${top_srcdir}/diff -o $@ -c $*.c
+
+${lib_dir}/libcvs.a: $(LIB_OBJECTS)
+ $(AR) cr $@ $(LIB_OBJECTS)
+
+${zlib_dir}/libz.a: $(ZLIB_OBJECTS)
+ $(AR) cr $@ $(ZLIB_OBJECTS)
+
+# Eventually probably static linking (cvs-static.exe) will be the
+# default, but even so we'll want to preserve this rule so we can
+# create a dynamically linked executable when we want coredumps.
+cvs.exe: ${OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a
+ gcc $(COMMON_OBJECTS) $(OS2_OBJECTS) ${DIFF_OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a $(LIB) -o cvs.out
+ emxbind -w -o $@.exe cvs.out
+
+${lib_dir}/libcvs.lib: ${lib_dir}/libcvs.a
+ emxomf ${lib_dir}/libcvs.a
+
+${zlib_dir}/libz.lib: ${zlib_dir}/libz.a
+ emxomf ${zlib_dir}/libz.a
+
+# Where do -Zomf -Zsys go? When we compile the .o's?
+# When I tried this rule, I had problems with (1) could not find
+# socket.lib. Hmm. I thought I converted it from socket.a
+# in the EMX distribution. Probably my EMX installation at fault.
+# (2) could not find miscellaneous system routines like strerror.
+# This might be a matter of learning to live without them (EMX
+# doc is supposed to describe which are present and which are not).
+# (3) some linker errors like no stack and the like. Maybe I am
+# missing some options?
+cvs-static.exe: ${OBJECTS} ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib
+ emxomf ${OBJECTS}
+ emxomfld -o $@ $(subst .o,.obj,${OBJECTS}) \
+ ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib ${LIB}
+
+# cvs.o: ${OBJECTS} ${SOURCES} ${HEADERS}
+
+# Hmm. This rule wants to exist on unix, so that "make dist" works.
+# And it doesn't want to exist on OS/2, because configure doesn't
+# run on OS/2 and so ../config.status won't exist. For now we just
+# say, in emx/README, that people will need to comment it out.
+Makefile: ../config.status $(srcdir)/Makefile.in
+ cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+
diff --git a/emx/README b/emx/README
new file mode 100644
index 0000000..e0b3211
--- /dev/null
+++ b/emx/README
@@ -0,0 +1,70 @@
+
+CVS for OS/2
+based on EMX 0.9c (patch 02)
+
+
+This port works well in local mode. It fully respects the OS/2
+filename conventions, but only works on HPFS or other filesystem types
+which support long filenames (like ext2fs or Netware FS with OS/2
+namespace). It does _not_ work on FAT partitions or any other fs which
+does not support long filenames. The port also works in client mode.
+
+This port requires EMX 0.9c (patch 02) and the BSD libraries. It should
+work in local mode, in client mode and also in server mode. nServer mode
+will only work if the client uses the :server: method, because the CRLF
+handling of IBM's RSHD.EXE is not "compatible" with CVS. (If you find a
+better rshd for OS/2, please let us know!)
+
+To compile CVS for OS/2, you must install the following packages:
+
+ - EMX 0.9c (patch 02) and the GNU-C-Compiler
+
+ EMXDEV1.ZIP
+ EMXDEV2.ZIP
+ EMXRT.ZIP
+ GNUDEV1.ZIP
+ GNUDEV2.ZIP
+ BSDDEV.ZIP
+ EMXFIX02.ZIP
+
+ - GNU make for OS/2
+
+ GNUMAKE.ZIP
+
+ - ufc.a (ufc-crypt) as a replacement for crypt (this may be something
+ different if you live inside the USA). You don't need this one currently,
+ because the port of the server to OS/2 isn't done yet, but I'm mentioning
+ in case it is useful for future reference (we're probably better off
+ using a different password hash instead, as noted in item #184 of ../TODO).
+
+ GNUUFC.ZIP
+
+All packages can be found on ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu
+(You may also try http://www.leo.org/pub/comp/os/os2/leo/gnu).
+
+Change to the `emx' directory, do "make" and get emx\cvs.exe. I had
+to comment out the "Makefile" rule in emx/Makefile to avoid a
+complaint about ../config.status not existing. You also might need to
+edit srcdir to be "." and top_srcdir to be "..".
+
+Assuming you have edited the `install_dir' variable in the Makefile,
+you may type "make install-cvs" to put cvs.exe in the right place.
+You may also "make clean-cvs" to clean up object and library files.
+
+The cvs.exe generated will require emx.dll to run. You can try
+compiling with -Zomf -Zsys to generate a cvs.exe without this
+requirement, but that almost surely will require significant changes
+to make it work. For the client, the big known problem would be that
+EMX 0.9c doesn't have sockets with -Zsys (according to the
+documentation). That seems like it would be hard to get around. For
+local, the big known problem is that -Zsys doesn't have fork(). This
+one isn't as bad--using os2/run.c or something similar instead of
+src/run.c should solve this problem.
+
+You will get warnings in lib/getdate.c. These are yacc's fault; ignore
+them.
+
+You will get about 5 warnings in lib/regex.c concerning "unused variable
+destination". Ignore them.
+
+Report bugs to tepting@swol.de and bug-cvs@nongnu.org.
diff --git a/emx/config.h b/emx/config.h
new file mode 100644
index 0000000..1cc6474
--- /dev/null
+++ b/emx/config.h
@@ -0,0 +1,446 @@
+/* config.h --- configuration file for OS/2 EMX
+ Thomas Epting <tepting@swol.de> --- Feb 1997 */
+
+/* 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. */
+
+/* This file lives in the emx/ subdirectory, which is only included
+ * in your header search path if you use emx/Makefile (with GNU make
+ * for OS/2). Thus, this is the right place to put configuration
+ * information for OS/2.
+ */
+
+#include <io.h>
+#include <sys/types.h>
+#include <sys/stat.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 to empty if the keyword does not work. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define if you support file names longer than 14 characters. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if utime(file, NULL) sets file's timestamp to the present. */
+#define HAVE_UTIME_NULL 1
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef pid_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). */
+#define RETSIGTYPE void
+
+/* The default remote shell to use, if one does not specify the CVS_RSH
+ environment variable. */
+#define RSH_DFLT "rsh"
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define if you have MIT Kerberos version 4 available. */
+#undef HAVE_KERBEROS
+
+/* Define if you want CVS to be able to be a remote repository client. */
+#define CLIENT_SUPPORT 1
+
+#if 0
+/* This doesn't work yet, and I'm sure I don't want the hassles of seeing
+ whether it will compile. */
+/* Define if you want CVS to be able to serve repositories to remote
+ clients. */
+#define SERVER_SUPPORT 1
+
+/* Define if you want to use the password authenticated server. */
+#define AUTH_SERVER_SUPPORT
+#endif /* 0 */
+
+/* Define if you want encryption support. */
+/* #undef ENCRYPTION */
+
+/* Define if you have the connect function. */
+#define HAVE_CONNECT 1
+
+/* Define if you have the crypt function. */
+#define HAVE_CRYPT 1
+
+/* Define if you have the fchdir function. */
+/* #define HAVE_FCHDIR */
+
+/* Define if you have the fchmod function. */
+/* #define HAVE_FCHMOD */
+
+/* Define if you have the fsync function. */
+#define HAVE_FSYNC 1
+
+/* Define if you have the ftime function. */
+#define HAVE_FTIME 1
+
+/* Define if you have the ftruncate function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define if you have the getpagesize function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the getspnam function. */
+/* #define HAVE_GETSPNAM */
+
+/* Define if you have the initgroups function. */
+/* #define HAVE_INITGROUPS */
+
+/* Define if you have the krb_get_err_text function. */
+/* #undef HAVE_KRB_GET_ERR_TEXT */
+
+/* Define if you have the putenv function. */
+#define HAVE_PUTENV 1
+
+/* Define if you have the readlink function. */
+/* #define HAVE_READLINK */
+
+/* Define if you have the sigaction function. */
+#define HAVE_SIGACTION 1
+
+/* Define if you have the sigblock function. */
+/* #undef HAVE_SIGBLOCK */
+
+/* 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 sigvec function. */
+/* #undef HAVE_SIGVEC */
+
+/* Define if you have the timezone function. */
+#define HAVE_TIMEZONE 1
+
+/* Define if you have the tzset function. */
+#define HAVE_TZSET 1
+
+/* Define if you have the vfork function. */
+/* #undef HAVE_VFORK */
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define if you have the <direct.h> header file. */
+/* #undef HAVE_DIRECT_H */
+
+/* Define if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have the <ndbm.h> header file. */
+/* #undef HAVE_NDBM_H 1 */
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/bsdtypes.h> header file. */
+/* #undef HAVE_SYS_BSDTYPES_H */
+
+/* Define if you have the <sys/dir.h> header file. */
+#define HAVE_SYS_DIR_H 1
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define if you have the crypt library (-lcrypt). */
+#define HAVE_LIBCRYPT 1
+
+/* Define if you have the inet library (-linet). */
+/* #undef HAVE_LIBINET */
+
+/* Define if you have the nsl library (-lnsl). */
+#define HAVE_LIBNSL 1
+
+/* Define if you have the nsl_s library (-lnsl_s). */
+/* #undef HAVE_LIBNSL_S */
+
+/* Define if you have the sec library (-lsec). */
+/* #undef HAVE_LIBSEC 1 */
+
+/* Define if you have the socket library (-lsocket). */
+#define HAVE_LIBSOCKET 1
+
+/* Under OS/2, filenames are case-insensitive, and both / and \
+ are path component separators. */
+#define FOLD_FN_CHAR(c) (OS2_filename_classes[(unsigned char) (c)])
+extern unsigned char OS2_filename_classes[];
+
+/* Is the character C a path name separator? Under OS/2, you can use
+ either / or \. */
+#define ISDIRSEP(c) (FOLD_FN_CHAR(c) == '/')
+
+/* Like strcmp, but with the appropriate tweaks for file names.
+ Under OS/2, filenames are case-insensitive but case-preserving,
+ and both \ and / are path element separators. */
+extern int fncmp (const char *n1, const char *n2);
+
+/* Fold characters in FILENAME to their canonical forms.
+ If FOLD_FN_CHAR is not #defined, the system provides a default
+ definition for this. */
+extern void fnfold (char *FILENAME);
+
+/* This is where old bits go to die under OS/2 as well as WinNT. */
+#define DEVNULL "nul"
+
+/* We actually do have a transparent rsh, whew. */
+#undef RSH_NOT_TRANSPARENT
+/* But it won't be transparent unless we ask it nicely! */
+#define RSH_NEEDS_BINARY_FLAG 1
+
+#define START_SERVER os2_start_server
+#define SHUTDOWN_SERVER os2_shutdown_server
+
+extern void START_SERVER (int *tofd, int *fromfd,
+ char *client_user,
+ char *server_user,
+ char *server_host,
+ char *server_cvsroot);
+extern void SHUTDOWN_SERVER (int fd);
+
+/* Call our own os2_initialize function */
+#define SYSTEM_INITIALIZE(pargc,pargv) os2_initialize (pargc, pargv)
+extern void os2_initialize (int *pargc, char ***pargv);
+
+/* Under EMX, we already have popen() and pclose()... */
+/* #undef USE_OWN_POPEN */
+/* ... and we too have no need for popenRW to start the rsh server. */
+/* #define START_RSH_WITH_POPEN_RW */
+
+/* Socket handles and file handles share a command handle space under EMX. */
+/* #undef NO_SOCKET_TO_FD */
+
+
+
+#define CVS_STAT os2_stat
+#define CVS_CHDIR os2_chdir
+#define CVS_FNMATCH os2_fnmatch
+
+extern int os2_stat(const char *name, struct stat *buffer);
+extern int os2_chdir(const char *name);
+extern int os2_fnmatch(const char *pattern, const char *name, int flags);
+
+/* Pipes need to be put into binary mode using setmode (). */
+#define USE_SETMODE_BINARY 1
+
+/* The reason for this is that we don't know whether to pass -b to
+ rsh. The system-supplied rsh on OS/2 wants it. Some other rsh
+ replacement might not accept it. Historically, the NT port of CVS
+ has not passed -b, and the OS/2 port has. What a mess. If we can
+ get away with just not accepting :ext: until we can figure out how
+ we should deal with this, then it will avoid having people rely on
+ behaviors which will need to change. */
+#define NO_EXT_METHOD 1
+
+/* See above; we can't use rsh without -b. */
+#define RSH_NOT_TRANSPARENT 1
+
+/* See discussion at xchmod in filesubr.c. */
+#define CHMOD_BROKEN 1
+
+/*
+ * The following configuration options used to be defined in options.h.
+ */
+
+/*
+ * When committing a permanent change, CVS and RCS make a log entry of
+ * who committed the change. If you are committing the change logged in
+ * as "root" (not under "su" or other root-priv giving program), CVS/RCS
+ * cannot determine who is actually making the change.
+ *
+ * As such, by default, CVS disallows changes to be committed by users
+ * logged in as "root". You can disable this option by commenting
+ * out the lines below.
+ *
+ * Under Windows NT, privileges are associated with groups, not users,
+ * so the case in which someone has logged in as root does not occur.
+ * Thus, there is no need for this hack.
+ *
+ * todo: I don't know why emx had CVS_BADROOT commented out too, but
+ * historically it has been in the obsolete options.h file. -DRP
+ */
+#undef CVS_BADROOT
+
+/*
+ * For portability and heterogeneity reasons, CVS is shipped by
+ * default using my own text-file version of the ndbm database library
+ * in the src/myndbm.c file. If you want better performance and are
+ * not concerned about heterogeneous hosts accessing your modules
+ * file, turn this option off.
+ */
+#ifndef MY_NDBM
+#define MY_NDBM
+#endif
+
+/* Directory used for storing temporary files, if not overridden by
+ environment variables or the -T global option. There should be little
+ need to change this (-T is a better mechanism if you need to use a
+ different directory for temporary files). */
+#ifndef TMPDIR_DFLT
+#define TMPDIR_DFLT "/tmp"
+#endif
+
+/*
+ * The default editor to use, if one does not specify the "-e" option
+ * to cvs, or does not have an EDITOR environment variable. I set
+ * this to just "vi", and use the shell to find where "vi" actually
+ * is. This allows sites with /usr/bin/vi or /usr/ucb/vi to work
+ * equally well (assuming that your PATH is reasonable).
+ */
+#ifndef EDITOR_DFLT
+#define EDITOR_DFLT "e"
+#endif
+
+/*
+ * The default umask to use when creating or otherwise setting file or
+ * directory permissions in the repository. Must be a value in the
+ * range of 0 through 0777. For example, a value of 002 allows group
+ * rwx access and world rx access; a value of 007 allows group rwx
+ * access but no world access. This value is overridden by the value
+ * of the CVSUMASK environment variable, which is interpreted as an
+ * octal number.
+ */
+#ifndef UMASK_DFLT
+#define UMASK_DFLT 002
+#endif
+
+/*
+ * The cvs admin command is restricted to the members of the group
+ * CVS_ADMIN_GROUP. If this group does not exist, all users are
+ * allowed to run cvs admin. To disable the cvs admin for all users,
+ * create an empty group CVS_ADMIN_GROUP. To disable access control
+ * for cvs admin, comment out the define below.
+ */
+#ifndef CVS_ADMIN_GROUP
+#define CVS_ADMIN_GROUP "cvsadmin"
+#endif
+
+/*
+ * When committing or importing files, you must enter a log message.
+ * Normally, you can do this either via the -m flag on the command
+ * line or an editor will be started for you. If you like to use
+ * logging templates (the rcsinfo file within the $CVSROOT/CVSROOT
+ * directory), you might want to force people to use the editor even
+ * if they specify a message with -m. Enabling FORCE_USE_EDITOR will
+ * cause the -m message to be appended to the temp file when the
+ * editor is started.
+ */
+#ifndef FORCE_USE_EDITOR
+/* #define FORCE_USE_EDITOR */
+#endif
+
+#ifndef CVS_FUDGELOCKS
+/* #define CVS_FUDGELOCKS */
+#endif
+
+/*
+ * Should we build the password-authenticating client? Whether to
+ * include the password-authenticating _server_, on the other hand, is
+ * set in config.h.
+ */
+#ifdef CLIENT_SUPPORT
+#define AUTH_CLIENT_SUPPORT 1
+#endif
+
+/*
+ * If you are working with a large remote repository and a 'cvs
+ * checkout' is swamping your network and memory, define these to
+ * enable flow control. You will end up with even less probability of
+ * a consistent checkout (see Concurrency in cvs.texinfo), but CVS
+ * doesn't try to guarantee that anyway. The master server process
+ * will monitor how far it is getting behind, if it reaches the high
+ * water mark, it will signal the child process to stop generating
+ * data when convenient (ie: no locks are held, currently at the
+ * beginning of a new directory). Once the buffer has drained
+ * sufficiently to reach the low water mark, it will be signalled to
+ * start again. You may override the default hi/low watermarks here
+ * too.
+ */
+#define SERVER_FLOWCONTROL
+#define SERVER_HI_WATER (2 * 1024 * 1024)
+#define SERVER_LO_WATER (1 * 1024 * 1024)
+
+/* End of CVS options.h section */
+
+/* Return non-zero iff FILENAME is absolute.
+ Trivial under Unix, but more complicated under other systems.
+ Under EMX let _fnisabs do all this work. */
+#define ISABSOLUTE(filename) _fnisabs(filename);
diff --git a/emx/filesubr.c b/emx/filesubr.c
new file mode 100644
index 0000000..145d5a3
--- /dev/null
+++ b/emx/filesubr.c
@@ -0,0 +1,804 @@
+/* filesubr.c --- subroutines for dealing with files
+ Jim Blandy <jimb@cyclic.com>
+
+ This file is part of GNU CVS.
+
+ GNU CVS 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. */
+
+/* These functions were moved out of subr.c because they need different
+ definitions under operating systems (like, say, Windows NT) with different
+ file system semantics. */
+
+#include "cvs.h"
+#include <sys/param.h>
+
+/*
+ * I don't know of a convenient way to test this at configure time, or else
+ * I'd certainly do it there.
+ */
+#if defined(NeXT)
+#define LOSING_TMPNAM_FUNCTION
+#endif
+
+static int deep_remove_dir( const char *path );
+
+/*
+ * Copies "from" to "to".
+ */
+void
+copy_file (from, to)
+ const char *from;
+ const char *to;
+{
+ struct stat sb;
+ struct utimbuf t;
+ int fdin, fdout;
+
+ if (trace)
+#ifdef SERVER_SUPPORT
+ (void) fprintf (stderr, "%c-> copy(%s,%s)\n",
+ (server_active) ? 'S' : ' ', from, to);
+#else
+ (void) fprintf (stderr, "-> copy(%s,%s)\n", from, to);
+#endif
+ if (noexec)
+ return;
+
+ if ((fdin = open (from, O_RDONLY | O_BINARY)) < 0)
+ error (1, errno, "cannot open %s for copying", from);
+ if (fstat (fdin, &sb) < 0)
+ error (1, errno, "cannot fstat %s", from);
+ if ((fdout = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY,
+ (int) sb.st_mode & 07777)) < 0)
+ error (1, errno, "cannot create %s for copying", to);
+ if (sb.st_size > 0)
+ {
+ char buf[BUFSIZ];
+ int n;
+
+ for (;;)
+ {
+ n = read (fdin, buf, sizeof(buf));
+ if (n == -1)
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ error (1, errno, "cannot read file %s for copying", from);
+ }
+ else if (n == 0)
+ break;
+
+ if (write(fdout, buf, n) != n) {
+ error (1, errno, "cannot write file %s for copying", to);
+ }
+ }
+
+#ifdef HAVE_FSYNC
+ if (fsync (fdout))
+ error (1, errno, "cannot fsync file %s after copying", to);
+#endif
+ }
+
+ if (close (fdin) < 0)
+ error (0, errno, "cannot close %s", from);
+ if (close (fdout) < 0)
+ error (1, errno, "cannot close %s", to);
+
+ /* now, set the times for the copied file to match those of the original */
+ memset ((char *) &t, 0, sizeof (t));
+ t.actime = sb.st_atime;
+ t.modtime = sb.st_mtime;
+ (void) utime (to, &t);
+}
+
+/* FIXME-krp: these functions would benefit from caching the char * &
+ stat buf. */
+
+/*
+ * Returns non-zero if the argument file is a directory, or is a symbolic
+ * link which points to a directory.
+ */
+int
+isdir (file)
+ const char *file;
+{
+ struct stat sb;
+
+ if (stat (file, &sb) < 0)
+ return (0);
+ return (S_ISDIR (sb.st_mode));
+}
+
+/*
+ * Returns non-zero if the argument file is a symbolic link.
+ */
+int
+islink (file)
+ const char *file;
+{
+#ifdef S_ISLNK
+ struct stat sb;
+
+ if (lstat (file, &sb) < 0)
+ return (0);
+ return (S_ISLNK (sb.st_mode));
+#else
+ return (0);
+#endif
+}
+
+/*
+ * Returns non-zero if the argument file exists.
+ */
+int
+isfile (file)
+ const char *file;
+{
+ return isaccessible(file, F_OK);
+}
+
+/*
+ * Returns non-zero if the argument file is readable.
+ */
+int
+isreadable (file)
+ const char *file;
+{
+ return isaccessible(file, R_OK);
+}
+
+/*
+ * Returns non-zero if the argument file is writable.
+ */
+int
+iswritable (file)
+ const char *file;
+{
+ return isaccessible(file, W_OK);
+}
+
+/*
+ * Returns non-zero if the argument file is accessable according to
+ * mode. If compiled with SETXID_SUPPORT also works if cvs has setxid
+ * bits set.
+ */
+int
+isaccessible (file, mode)
+ const char *file;
+ const int mode;
+{
+#ifdef SETXID_SUPPORT
+ struct stat sb;
+ int umask = 0;
+ int gmask = 0;
+ int omask = 0;
+ int uid;
+
+ if (stat(file, &sb) == -1)
+ return 0;
+ if (mode == F_OK)
+ return 1;
+
+ uid = geteuid();
+ if (uid == 0) /* superuser */
+ {
+ if (mode & X_OK)
+ return sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH);
+ else
+ return 1;
+ }
+
+ if (mode & R_OK)
+ {
+ umask |= S_IRUSR;
+ gmask |= S_IRGRP;
+ omask |= S_IROTH;
+ }
+ if (mode & W_OK)
+ {
+ umask |= S_IWUSR;
+ gmask |= S_IWGRP;
+ omask |= S_IWOTH;
+ }
+ if (mode & X_OK)
+ {
+ umask |= S_IXUSR;
+ gmask |= S_IXGRP;
+ omask |= S_IXOTH;
+ }
+
+ if (sb.st_uid == uid)
+ return (sb.st_mode & umask) == umask;
+ else if (sb.st_gid == getegid())
+ return (sb.st_mode & gmask) == gmask;
+ else
+ return (sb.st_mode & omask) == omask;
+#else
+ return access(file, mode) == 0;
+#endif
+}
+
+
+
+/*
+ * Make a directory and die if it fails
+ */
+void
+make_directory (name)
+ const char *name;
+{
+ struct stat sb;
+
+ if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
+ error (0, 0, "%s already exists but is not a directory", name);
+ if (!noexec && mkdir (name, 0777) < 0)
+ error (1, errno, "cannot make directory %s", name);
+}
+
+/*
+ * Make a path to the argument directory, printing a message if something
+ * goes wrong.
+ */
+void
+make_directories (name)
+ const char *name;
+{
+ char *cp;
+
+ if (noexec)
+ return;
+
+ if (mkdir (name, 0777) == 0 || errno == EEXIST)
+ return;
+ if (! existence_error (errno))
+ {
+ error (0, errno, "cannot make path to %s", name);
+ return;
+ }
+ if ((cp = strrchr (name, '/')) == NULL)
+ return;
+ *cp = '\0';
+ make_directories (name);
+ *cp++ = '/';
+ if (*cp == '\0')
+ return;
+ (void) mkdir (name, 0777);
+}
+
+/* Create directory NAME if it does not already exist; fatal error for
+ other errors. Returns 0 if directory was created; 1 if it already
+ existed. */
+int
+mkdir_if_needed (name)
+ char *name;
+{
+ if (mkdir (name, 0777) < 0)
+ {
+ if (errno != EEXIST)
+ error (1, errno, "cannot make directory %s", name);
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Change the mode of a file, either adding write permissions, or removing
+ * all write permissions. Either change honors the current umask setting.
+ * The EMX doc (0.9c, emxlib.doc) says that chmod sets/clears the readonly
+ * bit. But it always seemed to be a noop when I tried it. Therefore,
+ * I've copied over the "attrib" code from os2/filesubr.c.
+ */
+void
+xchmod (fname, writable)
+ char *fname;
+ int writable;
+{
+ char *attrib_cmd;
+ char *attrib_option;
+ char *whole_cmd;
+ char *p;
+ char *q;
+
+ if (!isfile (fname))
+ {
+ error (0, 0, "cannot change mode of file %s; it does not exist",
+ fname);
+ return;
+ }
+
+ attrib_cmd = "attrib "; /* No, really? */
+
+ if (writable)
+ attrib_option = "-r "; /* make writeable */
+ else
+ attrib_option = "+r "; /* make read-only */
+
+ whole_cmd = xmalloc (strlen (attrib_cmd)
+ + strlen (attrib_option)
+ + strlen (fname)
+ + 1);
+
+ strcpy (whole_cmd, attrib_cmd);
+ strcat (whole_cmd, attrib_option);
+
+ /* Copy fname to the end of whole_cmd, translating / to \.
+ Attrib doesn't take / but many parts of CVS rely
+ on being able to use it. */
+ p = whole_cmd + strlen (whole_cmd);
+ q = fname;
+ while (*q)
+ {
+ if (*q == '/')
+ *p++ = '\\';
+ else
+ *p++ = *q;
+ ++q;
+ }
+ *p = '\0';
+
+ system (whole_cmd);
+ free (whole_cmd);
+}
+
+/*
+ * Rename a file and die if it fails
+ */
+void
+rename_file (from, to)
+ const char *from;
+ const char *to;
+{
+ if (trace)
+#ifdef SERVER_SUPPORT
+ (void) fprintf (stderr, "%c-> rename(%s,%s)\n",
+ (server_active) ? 'S' : ' ', from, to);
+#else
+ (void) fprintf (stderr, "-> rename(%s,%s)\n", from, to);
+#endif
+ if (noexec)
+ return;
+
+ unlink_file (to);
+ if (rename (from, to) != 0)
+ error (1, errno, "cannot rename file %s to %s", from, to);
+}
+
+/*
+ * unlink a file, if possible.
+ */
+int
+unlink_file (f)
+ const char *f;
+{
+ if (trace)
+#ifdef SERVER_SUPPORT
+ (void) fprintf (stderr, "%c-> unlink(%s)\n",
+ (server_active) ? 'S' : ' ', f);
+#else
+ (void) fprintf (stderr, "-> unlink(%s)\n", f);
+#endif
+ if (noexec)
+ return (0);
+
+ if (isfile (f))
+ xchmod ((char *)f, 1);
+ return (unlink (f));
+}
+
+/*
+ * Unlink a file or dir, if possible. If it is a directory do a deep
+ * removal of all of the files in the directory. Return -1 on error
+ * (in which case errno is set).
+ */
+int
+unlink_file_dir (f)
+ const char *f;
+{
+ if (trace)
+#ifdef SERVER_SUPPORT
+ (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
+ (server_active) ? 'S' : ' ', f);
+#else
+ (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
+#endif
+ if (noexec)
+ return (0);
+
+ /* For at least some unices, if root tries to unlink() a directory,
+ instead of doing something rational like returning EISDIR,
+ the system will gleefully go ahead and corrupt the filesystem.
+ So we first call isdir() to see if it is OK to call unlink(). This
+ doesn't quite work--if someone creates a directory between the
+ call to isdir() and the call to unlink(), we'll still corrupt
+ the filesystem. Where is the Unix Haters Handbook when you need
+ it? */
+ if (isdir(f))
+ return deep_remove_dir(f);
+ else
+ {
+ if (unlink (f) != 0)
+ return -1;
+ }
+ /* We were able to remove the file from the disk */
+ return 0;
+}
+
+/* Remove a directory and everything it contains. Returns 0 for
+ * success, -1 for failure (in which case errno is set).
+ */
+
+static int
+deep_remove_dir (path)
+ const char *path;
+{
+ DIR *dirp;
+ struct dirent *dp;
+ char buf[PATH_MAX];
+
+ if (rmdir (path) != 0)
+ {
+ if (errno == ENOTEMPTY
+ || errno == EEXIST
+ /* Ugly workaround for ugly AIX 4.1 (and 3.2) header bug
+ (it defines ENOTEMPTY and EEXIST to 17 but actually
+ returns 87). */
+ || (ENOTEMPTY == 17 && EEXIST == 17 && errno == 87))
+ {
+ if ((dirp = opendir (path)) == NULL)
+ /* If unable to open the directory return
+ * an error
+ */
+ return -1;
+
+ while ((dp = readdir (dirp)) != NULL)
+ {
+ if (strcmp (dp->d_name, ".") == 0 ||
+ strcmp (dp->d_name, "..") == 0)
+ continue;
+
+ sprintf (buf, "%s/%s", path, dp->d_name);
+
+ /* See comment in unlink_file_dir explanation of why we use
+ isdir instead of just calling unlink and checking the
+ status. */
+ if (isdir(buf))
+ {
+ if (deep_remove_dir(buf))
+ {
+ closedir(dirp);
+ return -1;
+ }
+ }
+ else
+ {
+ if (unlink (buf) != 0)
+ {
+ closedir(dirp);
+ return -1;
+ }
+ }
+ }
+ closedir (dirp);
+ return rmdir (path);
+ }
+ else
+ return -1;
+ }
+
+ /* Was able to remove the directory return 0 */
+ return 0;
+}
+
+/* Read NCHARS bytes from descriptor FD into BUF.
+ Return the number of characters successfully read.
+ The number returned is always NCHARS unless end-of-file or error. */
+static size_t
+block_read (fd, buf, nchars)
+ int fd;
+ char *buf;
+ size_t nchars;
+{
+ char *bp = buf;
+ size_t nread;
+
+ do
+ {
+ nread = read (fd, bp, nchars);
+ if (nread == (size_t)-1)
+ {
+#ifdef EINTR
+ if (errno == EINTR)
+ continue;
+#endif
+ return (size_t)-1;
+ }
+
+ if (nread == 0)
+ break;
+
+ bp += nread;
+ nchars -= nread;
+ } while (nchars != 0);
+
+ return bp - buf;
+}
+
+
+/*
+ * Compare "file1" to "file2". Return non-zero if they don't compare exactly.
+ */
+int
+xcmp (file1, file2)
+ const char *file1;
+ const char *file2;
+{
+ char *buf1, *buf2;
+ struct stat sb1, sb2;
+ int fd1, fd2;
+ int ret;
+
+ if ((fd1 = open (file1, O_RDONLY | O_BINARY)) < 0)
+ error (1, errno, "cannot open file %s for comparing", file1);
+ if ((fd2 = open (file2, O_RDONLY | O_BINARY)) < 0)
+ error (1, errno, "cannot open file %s for comparing", file2);
+ if (fstat (fd1, &sb1) < 0)
+ error (1, errno, "cannot fstat %s", file1);
+ if (fstat (fd2, &sb2) < 0)
+ error (1, errno, "cannot fstat %s", file2);
+
+ /* A generic file compare routine might compare st_dev & st_ino here
+ to see if the two files being compared are actually the same file.
+ But that won't happen in CVS, so we won't bother. */
+
+ if (sb1.st_size != sb2.st_size)
+ ret = 1;
+ else if (sb1.st_size == 0)
+ ret = 0;
+ else
+ {
+ /* FIXME: compute the optimal buffer size by computing the least
+ common multiple of the files st_blocks field */
+ size_t buf_size = 8 * 1024;
+ size_t read1;
+ size_t read2;
+
+ buf1 = xmalloc (buf_size);
+ buf2 = xmalloc (buf_size);
+
+ do
+ {
+ read1 = block_read (fd1, buf1, buf_size);
+ if (read1 == (size_t)-1)
+ error (1, errno, "cannot read file %s for comparing", file1);
+
+ read2 = block_read (fd2, buf2, buf_size);
+ if (read2 == (size_t)-1)
+ error (1, errno, "cannot read file %s for comparing", file2);
+
+ /* assert (read1 == read2); */
+
+ ret = memcmp(buf1, buf2, read1);
+ } while (ret == 0 && read1 == buf_size);
+
+ free (buf1);
+ free (buf2);
+ }
+
+ (void) close (fd1);
+ (void) close (fd2);
+ return (ret);
+}
+
+
+/* Just in case this implementation does not define this. */
+#ifndef L_tmpnam
+#define L_tmpnam 50
+#endif
+
+
+#ifdef LOSING_TMPNAM_FUNCTION
+char *
+cvs_temp_name ()
+{
+ char value[L_tmpnam + 1];
+
+ /* FIXME: Should be using TMPDIR. */
+ strcpy (value, "/tmp/cvsXXXXXX");
+ mktemp (value);
+ return xstrdup (value);
+}
+#else
+/* Generate a unique temporary filename. Returns a pointer to a newly
+ malloc'd string containing the name. Returns successfully or not at
+ all. */
+char *
+cvs_temp_name ()
+{
+ char value[L_tmpnam + 1];
+ char *retval;
+
+ /* FIXME: should be using TMPDIR, perhaps by using tempnam on systems
+ which have it. */
+ retval = tmpnam (value);
+ if (retval == NULL)
+ error (1, errno, "cannot generate temporary filename");
+ return xstrdup (retval);
+}
+#endif
+
+
+
+/* char *
+ * xresolvepath ( const char *path )
+ *
+ * Like xreadlink(), but resolve all links in a path.
+ *
+ * INPUTS
+ * path The original path.
+ *
+ * RETURNS
+ * The path with any symbolic links expanded.
+ *
+ * ERRORS
+ * This function exits with a fatal error if it fails to read the link for
+ * any reason.
+ */
+char *
+xresolvepath ( path )
+ const char *path;
+{
+ char *hardpath;
+ char *owd;
+
+ /* assert ( isdir ( path ) ); */
+
+ /* FIXME - If HAVE_READLINK is defined, we should probably walk the path
+ * bit by bit calling xreadlink().
+ */
+
+ owd = xgetwd();
+ if ( CVS_CHDIR ( path ) < 0)
+ error ( 1, errno, "cannot chdir to %s", path );
+ if ( ( hardpath = xgetwd() ) == NULL )
+ error (1, errno, "cannot readlink %s", hardpath);
+ if ( CVS_CHDIR ( owd ) < 0)
+ error ( 1, errno, "cannot chdir to %s", owd );
+ free (owd);
+ return hardpath;
+}
+
+/* Return a pointer into PATH's last component. */
+char *
+last_component (path)
+ char *path;
+{
+ char *last;
+
+ /* We can't be sure here if 'path' is already slashified. */
+ _fnslashify (path);
+
+ last = strrchr (path, '/');
+
+ if (last && (last != path))
+ return last + 1;
+ else
+ return path;
+}
+
+/* Return the home directory. Returns a pointer to storage
+ managed by this function or its callees (currently getenv).
+ This function will return the same thing every time it is
+ called. */
+char *
+get_homedir ()
+{
+ static char *home = NULL;
+ char *env = getenv ("HOME");
+ struct passwd *pw;
+
+ if (home != NULL)
+ return home;
+
+ if (env)
+ home = env;
+ else if ((pw = (struct passwd *) getpwuid (getuid ()))
+ && pw->pw_dir)
+ home = xstrdup (pw->pw_dir);
+ else
+ return 0;
+
+ return home;
+}
+
+/* See cvs.h for description. On unix this does nothing, because the
+ shell expands the wildcards. Under EMX, use _fnexplode to get the
+ expanded filenames */
+void
+expand_wild (argc, argv, pargc, pargv)
+ int argc;
+ char **argv;
+ int *pargc;
+ char ***pargv;
+{
+ int i;
+ *pargc = argc;
+ *pargv = (char **) xmalloc (argc * sizeof (char *));
+ for (i = 0; i < argc; ++i)
+ (*pargv)[i] = xstrdup (argv[i]);
+}
+
+unsigned char
+OS2_filename_classes[] =
+{
+ 0x00,0x01,0x02,0x03, 0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b, 0x0c,0x0d,0x0e,0x0f,
+ 0x10,0x11,0x12,0x13, 0x14,0x15,0x16,0x17,
+ 0x18,0x19,0x1a,0x1b, 0x1c,0x1d,0x1e,0x1f,
+ 0x20,0x21,0x22,0x23, 0x24,0x25,0x26,0x27,
+ 0x28,0x29,0x2a,0x2b, 0x2c,0x2d,0x2e,0x2f,
+ 0x30,0x31,0x32,0x33, 0x34,0x35,0x36,0x37,
+ 0x38,0x39,0x3a,0x3b, 0x3c,0x3d,0x3e,0x3f,
+ 0x40,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
+ 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
+ 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
+ 0x78,0x79,0x7a,0x5b, 0x2f,0x5d,0x5e,0x5f,
+ 0x60,0x61,0x62,0x63, 0x64,0x65,0x66,0x67,
+ 0x68,0x69,0x6a,0x6b, 0x6c,0x6d,0x6e,0x6f,
+ 0x70,0x71,0x72,0x73, 0x74,0x75,0x76,0x77,
+ 0x78,0x79,0x7a,0x7b, 0x7c,0x7d,0x7e,0x7f,
+ 0x80,0x81,0x82,0x83, 0x84,0x85,0x86,0x87,
+ 0x88,0x89,0x8a,0x8b, 0x8c,0x8d,0x8e,0x8f,
+ 0x90,0x91,0x92,0x93, 0x94,0x95,0x96,0x97,
+ 0x98,0x99,0x9a,0x9b, 0x9c,0x9d,0x9e,0x9f,
+ 0xa0,0xa1,0xa2,0xa3, 0xa4,0xa5,0xa6,0xa7,
+ 0xa8,0xa9,0xaa,0xab, 0xac,0xad,0xae,0xaf,
+ 0xb0,0xb1,0xb2,0xb3, 0xb4,0xb5,0xb6,0xb7,
+ 0xb8,0xb9,0xba,0xbb, 0xbc,0xbd,0xbe,0xbf,
+ 0xc0,0xc1,0xc2,0xc3, 0xc4,0xc5,0xc6,0xc7,
+ 0xc8,0xc9,0xca,0xcb, 0xcc,0xcd,0xce,0xcf,
+ 0xd0,0xd1,0xd2,0xd3, 0xd4,0xd5,0xd6,0xd7,
+ 0xd8,0xd9,0xda,0xdb, 0xdc,0xdd,0xde,0xdf,
+ 0xe0,0xe1,0xe2,0xe3, 0xe4,0xe5,0xe6,0xe7,
+ 0xe8,0xe9,0xea,0xeb, 0xec,0xed,0xee,0xef,
+ 0xf0,0xf1,0xf2,0xf3, 0xf4,0xf5,0xf6,0xf7,
+ 0xf8,0xf9,0xfa,0xfb, 0xfc,0xfd,0xfe,0xff,
+};
+
+
+/* Like strcmp, but with the appropriate tweaks for file names.
+ Under OS/2, filenames are case-insensitive but case-preserving, and
+ both \ and / are path element separators. */
+int
+fncmp (const char *n1, const char *n2)
+{
+ char fn1[MAXNAMLEN], fn2[MAXNAMLEN];
+
+ strcpy (fn1, n1); _fnslashify(fn1);
+ strcpy (fn2, n2); _fnslashify(fn2);
+
+ return _fncmp ((unsigned char *) fn1, (unsigned char *) fn2);
+}
+
+
+/* Fold characters in FILENAME to their canonical forms.
+ If FOLD_FN_CHAR is not #defined, the system provides a default
+ definition for this. */
+void
+fnfold (char *filename)
+{
+ while (*filename)
+ {
+ *filename = FOLD_FN_CHAR (*filename);
+ filename++;
+ }
+}
diff --git a/emx/rcmd.h b/emx/rcmd.h
new file mode 100644
index 0000000..a1fbf02
--- /dev/null
+++ b/emx/rcmd.h
@@ -0,0 +1,46 @@
+/* rcmd.h --- interface to executing commands on remote hosts
+ Karl Fogel <kfogel@cyclic.com> --- November 1995 */
+
+/* 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. */
+
+/* Run the command CMD on the host *AHOST, and return a file descriptor for
+ a bidirectional stream socket connected to the command's standard input
+ and output.
+
+ rcmd looks up *AHOST using gethostbyname, and sets *AHOST to the host's
+ canonical name. If *AHOST is not found, rcmd returns -1.
+
+ rcmd connects to the remote host at TCP port INPORT. This should
+ probably be the "shell" service, port 514.
+
+ LOCUSER is the name of the user on the local machine, and REMUSER is
+ the name of the user on the remote machine; the remote machine uses this,
+ along with the source address of the TCP connection, to authenticate
+ the connection.
+
+ CMD is the command to execute. The remote host will tokenize it any way
+ it damn well pleases. Welcome to Unix.
+
+ FD2P is a feature we don't support, but there's no point in making mindless
+ deviations from the interface. Callers should always pass this argument
+ as zero. */
+
+/* Note that because we are using windows-NT/rcmd.c, this declaration
+ must match windows-NT/rcmd.h (and rcmd.c). It would be much
+ more sensible to use a common header file. But I haven't bothered to
+ adjust the makefile accordingly, yet. Probably the best long-term
+ home for this would be in lib/rcmd.*, or perhaps src. */
+extern int rcmd (const char **AHOST,
+ unsigned short INPORT,
+ char *LOCUSER,
+ char *REMUSER,
+ char *CMD,
+ int *fd2p);
diff --git a/emx/savecwd.c b/emx/savecwd.c
new file mode 100644
index 0000000..c1fe9a7
--- /dev/null
+++ b/emx/savecwd.c
@@ -0,0 +1,141 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#else
+# include <sys/file.h>
+#endif
+
+#ifdef HAVE_DIRECT_H
+# include <direct.h>
+#endif
+
+#ifdef HAVE_IO_H
+# include <io.h>
+#endif
+
+#include <errno.h>
+# ifndef errno
+extern int errno;
+#endif
+
+#include "savecwd.h"
+#include "error.h"
+
+char *xgetwd( void );
+
+/* Record the location of the current working directory in CWD so that
+ the program may change to other directories and later use restore_cwd
+ to return to the recorded location. This function may allocate
+ space using malloc (via xgetwd) or leave a file descriptor open;
+ use free_cwd to perform the necessary free or close. Upon failure,
+ no memory is allocated, any locally opened file descriptors are
+ closed; return non-zero -- in that case, free_cwd need not be
+ called, but doing so is ok. Otherwise, return zero. */
+
+int
+save_cwd (cwd)
+ struct saved_cwd *cwd;
+{
+ static int have_working_fchdir = 1;
+
+ cwd->desc = -1;
+ cwd->name = NULL;
+
+ if (have_working_fchdir)
+ {
+#ifdef HAVE_FCHDIR
+ cwd->desc = open (".", O_RDONLY);
+ if (cwd->desc < 0)
+ {
+ error (0, errno, "cannot open current directory");
+ return 1;
+ }
+
+# if __sun__ || sun
+ /* On SunOS 4, fchdir returns EINVAL if accounting is enabled,
+ so we have to fall back to chdir. */
+ if (fchdir (cwd->desc))
+ {
+ if (errno == EINVAL)
+ {
+ close (cwd->desc);
+ cwd->desc = -1;
+ have_working_fchdir = 0;
+ }
+ else
+ {
+ error (0, errno, "current directory");
+ close (cwd->desc);
+ cwd->desc = -1;
+ return 1;
+ }
+ }
+# endif /* __sun__ || sun */
+#else
+#define fchdir(x) (abort (), 0)
+ have_working_fchdir = 0;
+#endif
+ }
+
+ if (!have_working_fchdir)
+ {
+ cwd->name = xgetwd ();
+ if (cwd->name == NULL)
+ {
+ error (0, errno, "cannot get current directory");
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Change to recorded location, CWD, in directory hierarchy.
+ If "saved working directory", NULL))
+ */
+
+int
+restore_cwd (cwd, dest)
+ const struct saved_cwd *cwd;
+ const char *dest;
+{
+ int fail = 0;
+ if (cwd->desc >= 0)
+ {
+ if (fchdir (cwd->desc))
+ {
+ error (0, errno, "cannot return to %s",
+ (dest ? dest : "saved working directory"));
+ fail = 1;
+ }
+ }
+ else if (_chdir2 (cwd->name) < 0)
+ {
+ error (0, errno, "%s", cwd->name);
+ fail = 1;
+ }
+ return fail;
+}
+
+void
+free_cwd (cwd)
+ struct saved_cwd *cwd;
+{
+ if (cwd->desc >= 0)
+ close (cwd->desc);
+ if (cwd->name)
+ free (cwd->name);
+}
+
diff --git a/emx/startserver.c b/emx/startserver.c
new file mode 100644
index 0000000..d7e4189
--- /dev/null
+++ b/emx/startserver.c
@@ -0,0 +1,82 @@
+/* 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. */
+
+#include <assert.h>
+#include "cvs.h"
+#include "rcmd.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+static char *cvs_server;
+static char *command;
+
+extern int trace;
+
+void
+os2_start_server (int *tofd, int *fromfd,
+ char *client_user,
+ char *server_user,
+ char *server_host,
+ char *server_cvsroot)
+{
+ int fd, port;
+ char *portenv;
+ struct servent *sptr;
+ const char *rcmd_host = (const char *) server_host;
+
+ if (! (cvs_server = getenv ("CVS_SERVER")))
+ cvs_server = "cvs";
+ command = xmalloc (strlen (cvs_server)
+ + strlen (server_cvsroot)
+ + 50);
+ sprintf (command, "%s server", cvs_server);
+
+ portenv = getenv ("CVS_RCMD_PORT");
+ if (portenv)
+ port = atoi (portenv);
+ else if ((sptr = getservbyname ("shell", "tcp")) != NULL)
+ port = sptr->s_port;
+ else
+ port = 514; /* shell/tcp */
+
+ if (trace)
+ {
+ fprintf (stderr, "os2_start_server(): connecting to %s:%d\n",
+ server_host, port);
+ fprintf (stderr, "local_user = %s, remote_user = %s, CVSROOT = %s\n",
+ client_user, (server_user ? server_user : client_user),
+ server_cvsroot);
+ }
+
+ fd = rcmd (&rcmd_host, port,
+ client_user,
+ (server_user ? server_user : client_user),
+ command, 0);
+
+ if (fd < 0)
+ error (1, errno, "cannot start server via rcmd()");
+
+ *tofd = fd;
+ *fromfd = fd;
+ free (command);
+}
+
+void
+os2_shutdown_server (int fd)
+{
+ /* FIXME: shutdown on files seems to have no bad effects */
+ if (shutdown (fd, 2) < 0 && errno != ENOTSOCK)
+ error (1, 0, "couldn't shutdown server connection");
+ if (close (fd) < 0)
+ error (1, 0, "couldn't close server connection");
+}
+
diff --git a/emx/system.c b/emx/system.c
new file mode 100644
index 0000000..f4481b3
--- /dev/null
+++ b/emx/system.c
@@ -0,0 +1,91 @@
+/* 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. */
+
+#include <io.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <fnmatch.h>
+
+
+/* Expand wildcards in argv. We probably should be expanding wildcards
+ via expand_wild instead; that way we could expand only filenames and
+ not tag names and the like. */
+
+void
+os2_initialize (pargc, pargv)
+ int *pargc;
+ char **pargv[];
+{
+ _wildcard (pargc, pargv);
+}
+
+
+/* Modifies 'stat' so that always the same inode is returned. EMX never
+ returns the same value for st_ino. Without this modification,
+ release_delete in module src/release.c refuses to work. Care must
+ be taken if someone is using the value of st_ino (but as far as I know,
+ no callers are). */
+
+int
+os2_stat (name, buffer)
+ const char *name;
+ struct stat *buffer;
+{
+ int rc = stat (name, buffer);
+
+ /* There are no inodes on OS/2. */
+ buffer->st_ino = 42;
+
+ return rc;
+}
+
+
+/* We must not only change the directory, but also the current drive.
+ Otherwise it is be impossible to have the working directory and the
+ repository on different drives. */
+
+int
+os2_chdir (name)
+ const char *name;
+{
+ return _chdir2 (name);
+}
+
+
+/* getwd must return a drive specification. */
+
+char *
+xgetwd ()
+{
+ return _getcwd2 (NULL, 1);
+}
+
+
+/* fnmatch must recognize OS/2 filename conventions: Filename case
+ must be preserved, but ignored in searches. It would perhaps be better
+ to just have CVS pick how to match based on FILENAMES_CASE_INSENSITIVE
+ or something rather than having an OS/2-specific version of CVS_FNMATCH.
+ Note that lib/fnmatch.c uses FOLD_FN_CHAR; that is how we get
+ case-insensitivity on NT (and VMS, I think). */
+
+#define _FNM_OS2 1
+#define _FNM_IGNORECASE 128
+
+int
+os2_fnmatch (pattern, name, flags)
+ const char *pattern;
+ const char *name;
+ int flags;
+{
+ return fnmatch (pattern, name, _FNM_IGNORECASE | _FNM_OS2 | flags);
+}