diff -bruw patch-2.5.8-8-orig/inp.c patch-2.5.8-8/inp.c
--- patch-2.5.8-8-orig/inp.c	2003-09-07 10:22:05.000000000 +0200
+++ patch-2.5.8-8/inp.c	2004-08-20 12:17:31.080267200 +0200
@@ -235,6 +235,10 @@
      When creating files, the files do not actually exist.  */
   if (size)
     {
+#ifdef PATHCOMPRESS
+      char compressed_filename[4096];
+      filename = pathcompress_compress_path(filename, compressed_filename);
+#endif
 #ifdef __CYGWIN__
       int ifd = open (filename, O_RDONLY|(binary_transput?:O_TEXT));
 #else
diff -bruw patch-2.5.8-8-orig/patch.c patch-2.5.8-8/patch.c
--- patch-2.5.8-8-orig/patch.c	2003-08-19 13:24:17.000000000 +0200
+++ patch-2.5.8-8/patch.c	2004-08-20 12:15:11.820020800 +0200
@@ -380,6 +380,11 @@
 	      if (! dry_run)
 		{
 		  time_t t;
+#ifdef PATHCOMPRESS
+  char compressed_outname[4096];
+  outname = pathcompress_compress_path(outname, compressed_outname);
+#endif
+
 
 		  move_file (TMPOUTNAME, &TMPOUTNAME_needs_removal,
 			     outname, instat.st_mode,
@@ -426,7 +431,13 @@
 		    strcpy (rej, outname);
 		    addext (rej, ".rej", '#');
 		}
+#ifdef PATHCOMPRESS
+		char uncompressed_rej[4096];
+		pathcompress_uncompress_path(rej, uncompressed_rej);
+		say (" -- saving rejects to file %s", quotearg (uncompressed_rej));
+#else
 		say (" -- saving rejects to file %s", quotearg (rej));
+#endif
 		if (! dry_run)
 		  {
 		    move_file (TMPREJNAME, &TMPREJNAME_needs_removal,
@@ -790,11 +801,23 @@
     /* Process any filename args.  */
     if (optind < Argc)
       {
+#ifdef PATHCOMPRESS
+	char compressed_inname[4096];
+	pathcompress_compress_path(Argv[optind++], compressed_inname);
+	inname = savestr(compressed_inname);
+#else
 	inname = savestr (Argv[optind++]);
+#endif
 	invc = -1;
 	if (optind < Argc)
 	  {
+#ifdef PATHCOMPRESS
+	    char compressed_inname[4096];
+	    pathcompress_compress_path(Argv[optind++], compressed_inname);
+	    patchname = savestr(compressed_inname);
+#else
 	    patchname = savestr (Argv[optind++]);
+#endif
 	    if (optind < Argc)
 	      {
 		fprintf (stderr, "%s: %s: extra operand\n",
diff -bruw patch-2.5.8-8-orig/pch.c patch-2.5.8-8/pch.c
--- patch-2.5.8-8-orig/pch.c	2003-08-19 13:24:17.000000000 +0200
+++ patch-2.5.8-8/pch.c	2004-08-20 12:19:13.197104000 +0200
@@ -149,6 +149,10 @@
       }
     else
       {
+#ifdef PATHCOMPRESS
+  char compressed_filename[4096];
+  filename = pathcompress_compress_path(filename, compressed_filename);
+#endif
 #if HAVE_SETMODE_DOS
 	pfp = fopen (filename, binary_transput ? "rb" : "rt");
 #else
@@ -264,7 +268,13 @@
 	inname = fetchname (buf, 0, (time_t *) 0);
 	if (inname)
 	  {
+#ifdef PATHCOMPRESS
+	    char compressed_inname[4096];
+	    pathcompress_compress_path(inname, compressed_inname);
+	    if (stat (compressed_inname, &instat) == 0)
+#else
 	    if (stat (inname, &instat) == 0)
+#endif
 	      {
 		inerrno = 0;
 		invc = -1;
@@ -537,6 +547,10 @@
 	for (i = OLD;  i <= INDEX;  i++)
 	  if (name[i])
 	    {
+#ifdef PATHCOMPRESS
+	      char compressed_filename[4096];
+	      pathcompress_compress_path(name[i], compressed_filename);
+#endif
 	      if (i0 != NONE && strcmp (name[i0], name[i]) == 0)
 		{
 		  /* It's the same name as before; reuse stat results.  */
@@ -544,7 +558,11 @@
 		  if (! stat_errno[i])
 		    st[i] = st[i0];
 		}
+#ifdef PATHCOMPRESS
+	      else if (stat (compressed_filename, &st[i]) != 0)
+#else
 	      else if (stat (name[i], &st[i]) != 0)
+#endif
 		stat_errno[i] = errno;
 	      else
 		{
diff -bruw patch-2.5.8-8-orig/util.c patch-2.5.8-8/util.c
--- patch-2.5.8-8-orig/util.c	2003-09-07 10:22:05.000000000 +0200
+++ patch-2.5.8-8/util.c	2004-08-20 12:15:12.010294400 +0200
@@ -61,6 +61,13 @@
 move_file (char const *from, int volatile *from_needs_removal,
 	   char *to, mode_t mode, int backup)
 {
+#ifdef PATHCOMPRESS
+  char compressed_from[4096];
+  from = pathcompress_compress_path(from, compressed_from);
+  char compressed_to[4096];
+  to = pathcompress_compress_path(to, compressed_to);
+#endif
+
   struct stat to_st;
   int to_errno = ! backup ? -1 : stat (to, &to_st) == 0 ? 0 : errno;
 
@@ -192,6 +199,10 @@
 int
 create_file (char const *file, int open_flags, mode_t mode)
 {
+#ifdef PATHCOMPRESS
+  char compressed_file[4096];
+  file = pathcompress_compress_path(file, compressed_file);
+#endif
   int fd;
   mode |= S_IRUSR | S_IWUSR;
   mode &= ~ (S_IXUSR | S_IXGRP | S_IXOTH);
@@ -211,6 +222,12 @@
   int tofd;
   int fromfd;
   size_t i;
+#ifdef PATHCOMPRESS
+  char compressed_from[4096];
+  from = pathcompress_compress_path(from, compressed_from);
+  char compressed_to[4096];
+  to = pathcompress_compress_path(to, compressed_to);
+#endif
 
 #ifdef __CYGWIN__
   if ((fromfd = open (from, O_RDONLY | (binary_transput ?: O_TEXT))) < 0)
