diff -bBur tar-1.15.1/lib/exclude.c tar-1.15.1-xrg/lib/exclude.c
--- tar-1.15.1/lib/exclude.c	2004-12-17 18:11:20.000000000 +0200
+++ tar-1.15.1-xrg/lib/exclude.c	2005-12-14 18:12:56.000000000 +0200
@@ -105,6 +105,17 @@
   free (ex);
 }
 
+/** Copy the exclude structure to a new place */
+void copy_exclude(struct exclude * target, struct exclude const* source){
+	
+	if (target->exclude_alloc<source->exclude_count){
+		target->exclude_alloc=source->exclude_count;
+		target->exclude=xrealloc(target->exclude,sizeof(struct patopts) * target->exclude_alloc);
+		}
+	memcpy(target->exclude,source->exclude,sizeof(struct patopts)* source->exclude_count);
+	target->exclude_count=source->exclude_count;
+}
+
 /* Return zero if PATTERN matches F, obeying OPTIONS, except that
    (unlike fnmatch) wildcards are disabled in PATTERN.  */
 
diff -bBur tar-1.15.1/lib/exclude.h tar-1.15.1-xrg/lib/exclude.h
--- tar-1.15.1/lib/exclude.h	2003-04-05 09:53:09.000000000 +0300
+++ tar-1.15.1-xrg/lib/exclude.h	2005-12-14 17:15:35.000000000 +0200
@@ -41,3 +41,4 @@
 int add_exclude_file (void (*) (struct exclude *, char const *, int),
 		      struct exclude *, char const *, int, char);
 bool excluded_filename (struct exclude const *, char const *);
+void copy_exclude(struct exclude* target, struct exclude const* source);
diff -bBur tar-1.15.1/lib/localedir.h tar-1.15.1-xrg/lib/localedir.h
--- tar-1.15.1/lib/localedir.h	2004-12-21 16:01:12.000000000 +0200
+++ tar-1.15.1-xrg/lib/localedir.h	2005-12-14 15:34:48.000000000 +0200
@@ -1,4 +1,4 @@
-#define LOCALEDIR "/usr/share/locale"
+#define LOCALEDIR "/usr/local/share/locale"
 #ifndef DEFAULT_RMT_COMMAND
-# define DEFAULT_RMT_COMMAND "/etc/rmt"
+# define DEFAULT_RMT_COMMAND "/usr/local/libexec/rmt"
 #endif
diff -bBur tar-1.15.1/src/buffer.c tar-1.15.1-xrg/src/buffer.c
--- tar-1.15.1/src/buffer.c	2004-12-21 17:09:24.000000000 +0200
+++ tar-1.15.1-xrg/src/buffer.c	2005-12-14 16:52:42.000000000 +0200
@@ -167,9 +167,9 @@
 
 static struct zip_magic magic[] = {
   { ct_none, },
-  { ct_compress, "\037\235", 2, "compress", "-Z" },
-  { ct_gzip,     "\037\213", 2, "gzip", "-z"  },
-  { ct_bzip2,    "BZh",      3, "bzip2", "-j" },
+  { ct_compress, (unsigned char*) "\037\235", 2, "compress", "-Z" },
+  { ct_gzip,     (unsigned char*) "\037\213", 2, "gzip", "-z"  },
+  { ct_bzip2,    (unsigned char*) "BZh",      3, "bzip2", "-j" },
 };
 
 #define NMAGIC (sizeof(magic)/sizeof(magic[0]))
diff -bBur tar-1.15.1/src/common.h tar-1.15.1-xrg/src/common.h
--- tar-1.15.1/src/common.h	2004-12-21 16:31:58.000000000 +0200
+++ tar-1.15.1-xrg/src/common.h	2005-12-14 17:43:45.000000000 +0200
@@ -153,7 +153,7 @@
 GLOBAL int check_links_option;
 
 /* Patterns that match file names to be excluded.  */
-GLOBAL struct exclude *excluded;
+GLOBAL struct exclude *global_excluded;
 
 /* Exclude directories containing a cache directory tag. */
 GLOBAL bool exclude_caches_option;
@@ -304,6 +304,13 @@
 GLOBAL int allocated_archive_names;
 GLOBAL const char **archive_name_cursor;
 
+struct auto_exclude_struct {
+	char* name;
+	int options;
+};
+GLOBAL struct auto_exclude_struct* auto_exclude_array;
+GLOBAL int auto_exclude_size;
+
 /* Output index file name.  */
 GLOBAL char const *index_file_name;
 
@@ -386,7 +393,7 @@
 bool file_dumpable_p (struct tar_stat_info *);
 void create_archive (void);
 void pad_archive (off_t size_left);
-void dump_file (char *, int, dev_t);
+void dump_file (char *, int, dev_t, struct exclude* excl);
 union block *start_header (struct tar_stat_info *st);
 void finish_header (struct tar_stat_info *, union block *, off_t);
 void simple_finish_header (union block *header);
@@ -622,7 +629,7 @@
 size_t stripped_prefix_len (char const *file_name, size_t num);
 bool all_names_found (struct tar_stat_info *);
 
-bool excluded_name (char const *);
+bool excluded_name (char const *, struct exclude const *);
 
 void add_avoided_name (char const *);
 bool is_avoided_name (char const *);
diff -bBur tar-1.15.1/src/create.c tar-1.15.1-xrg/src/create.c
--- tar-1.15.1/src/create.c	2004-10-04 12:21:31.000000000 +0300
+++ tar-1.15.1-xrg/src/create.c	2005-12-14 17:54:27.000000000 +0200
@@ -965,8 +965,9 @@
 
 static void
 dump_dir0 (char *directory,
-	   struct tar_stat_info *st, int top_level, dev_t parent_device)
+	   struct tar_stat_info *st, int top_level, dev_t parent_device, struct exclude * parent_excluded)
 {
+	struct exclude *excluded=parent_excluded;
   dev_t our_device = st->stat.st_dev;
 
   if (!is_avoided_name (st->orig_file_name))
@@ -1042,6 +1043,46 @@
   if (!recursion_option)
     return;
 
+	{ /* Search for extra excludes */
+		char const * entry;
+		int ae_i;
+		size_t entry_len;
+		char *name_buf = strdup (st->orig_file_name);
+		size_t name_size = strlen (name_buf);
+		size_t name_len = name_size;
+		
+		/* Search the directory if it contains the file */
+	    for (entry = directory; (entry_len = strlen (entry)) != 0;
+		 entry += entry_len + 1)
+		for(ae_i=0;ae_i<auto_exclude_size;ae_i++)
+			if (!strcmp(entry,auto_exclude_array[ae_i].name)){
+				/* Found the file, construct a canonical name */
+				if (name_size < name_len + entry_len)
+				{
+					name_size = name_len + entry_len;
+					name_buf = xrealloc (name_buf, name_size + 1);
+				}
+				/* If we haven't already, we should now clone the excludes,
+				  because this directory will have its own.. */
+				if (excluded == parent_excluded){
+					excluded= new_exclude();
+					copy_exclude(excluded,parent_excluded);
+				}
+				strcpy (name_buf + name_len, entry);
+				
+				/*Debugging: WARN((0,0,_("%s file found, adding excludes\n"),name_buf)); */
+				
+				if (add_exclude_file (add_exclude, excluded, name_buf,
+							auto_exclude_array[ae_i].options , '\n') != 0)
+				{
+					int e = errno;
+					WARN ((0, e, "Cannot add exclude file"));
+				}
+      	}
+      	free (name_buf);
+    }
+
+
   if (one_file_system_option
       && !top_level
       && parent_device != st->stat.st_dev)
@@ -1050,7 +1091,7 @@
 	WARN ((0, 0,
 	       _("%s: file is on a different filesystem; not dumped"),
 	       quotearg_colon (st->orig_file_name)));
-      return;
+      goto out;
     }
 
   if (exclude_caches_option
@@ -1060,7 +1101,7 @@
 	WARN ((0, 0,
 	       _("%s: contains a cache directory tag; not dumped"),
 	       quotearg_colon (st->orig_file_name)));
-      return;
+      goto out;
     }
 
   {
@@ -1082,12 +1123,16 @@
 	    name_buf = xrealloc (name_buf, name_size + 1);
 	  }
 	strcpy (name_buf + name_len, entry);
-	if (!excluded_name (name_buf))
-	  dump_file (name_buf, 0, our_device);
+	if (!excluded_name (name_buf,excluded))
+	  dump_file (name_buf, 0, our_device,excluded);
       }
 
     free (name_buf);
   }
+  out:
+  	if (excluded !=parent_excluded)
+  	free_exclude(excluded);
+  	return;
 }
 
 /* Ensure exactly one trailing slash.  */
@@ -1104,7 +1149,7 @@
 }
 
 static bool
-dump_dir (struct tar_stat_info *st, int top_level, dev_t parent_device)
+dump_dir (struct tar_stat_info *st, int top_level, dev_t parent_device, struct exclude * excl)
 {
   char *directory;
 
@@ -1118,7 +1163,7 @@
   ensure_slash (&st->orig_file_name);
   ensure_slash (&st->file_name);
 
-  dump_dir0 (directory, st, top_level, parent_device);
+  dump_dir0 (directory, st, top_level, parent_device,excl);
 
   free (directory);
   return true;
@@ -1131,6 +1176,7 @@
 create_archive (void)
 {
   char *p;
+  struct exclude* excluded = global_excluded;
 
   open_archive (ACCESS_WRITE);
   xheader_write_global ();
@@ -1144,12 +1190,12 @@
       collect_and_sort_names ();
 
       while ((p = name_from_list ()) != NULL)
-	if (!excluded_name (p))
-	  dump_file (p, -1, (dev_t) 0);
+	if (!excluded_name (p,excluded))
+	  dump_file (p, -1, (dev_t) 0,excluded);
 
       blank_name_list ();
       while ((p = name_from_list ()) != NULL)
-	if (!excluded_name (p))
+	if (!excluded_name (p,excluded))
 	  {
 	    size_t plen = strlen (p);
 	    if (buffer_size <= plen)
@@ -1175,7 +1221,7 @@
 			  buffer = xrealloc (buffer, buffer_size);
  			}
 		      strcpy (buffer + plen, q + 1);
-		      dump_file (buffer, -1, (dev_t) 0);
+		      dump_file (buffer, -1, (dev_t) 0, excluded);
 		    }
 		  q += qlen + 1;
 		}
@@ -1185,8 +1231,8 @@
   else
     {
       while ((p = name_next (1)) != NULL)
-	if (!excluded_name (p))
-	  dump_file (p, 1, (dev_t) 0);
+	if (!excluded_name (p,excluded))
+	  dump_file (p, 1, (dev_t) 0, excluded);
     }
 
   write_eot ();
@@ -1334,7 +1380,7 @@
 
 static void
 dump_file0 (struct tar_stat_info *st, char *p,
-	    int top_level, dev_t parent_device)
+	    int top_level, dev_t parent_device, struct exclude* excluded)
 {
   union block *header;
   char type;
@@ -1399,7 +1445,7 @@
 
   if (S_ISDIR (st->stat.st_mode))
     {
-      dump_dir (st, top_level, parent_device);
+      dump_dir (st, top_level, parent_device,excluded);
       if (atime_preserve_option)
 	utime (p, &restore_times);
       return;
@@ -1565,10 +1611,12 @@
 }
 
 void
-dump_file (char *p, int top_level, dev_t parent_device)
+dump_file (char *p, int top_level, dev_t parent_device, struct exclude* excluded)
 {
   struct tar_stat_info st;
   tar_stat_init (&st);
-  dump_file0 (&st, p, top_level, parent_device);
+  dump_file0 (&st, p, top_level, parent_device,excluded);
   tar_stat_destroy (&st);
 }
+
+/*eof */
diff -bBur tar-1.15.1/src/incremen.c tar-1.15.1-xrg/src/incremen.c
--- tar-1.15.1/src/incremen.c	2004-09-06 14:30:42.000000000 +0300
+++ tar-1.15.1-xrg/src/incremen.c	2005-12-14 17:50:46.000000000 +0200
@@ -160,7 +160,8 @@
 	  }
 	strcpy (name_buffer + name_length, entry);
 
-	if (excluded_name (name_buffer))
+	/* FIXME: are global excludes enough here ? */
+	if (excluded_name (name_buffer,global_excluded))
 	  obstack_1grow (stk, 'N');
 	else
 	  {
diff -bBur tar-1.15.1/src/list.c tar-1.15.1-xrg/src/list.c
--- tar-1.15.1/src/list.c	2004-12-21 16:34:05.000000000 +0200
+++ tar-1.15.1-xrg/src/list.c	2005-12-14 17:51:28.000000000 +0200
@@ -103,7 +103,7 @@
 		      current_stat_info.stat.st_mtim.ST_MTIM_NSEC = 0,
 #endif
 		      OLDER_STAT_TIME (current_stat_info.stat, m)))
-	      || excluded_name (current_stat_info.file_name))
+	      || excluded_name (current_stat_info.file_name,global_excluded))
 	    {
 	      switch (current_header->header.typeflag)
 		{
diff -bBur tar-1.15.1/src/names.c tar-1.15.1-xrg/src/names.c
--- tar-1.15.1/src/names.c	2004-09-06 14:30:54.000000000 +0300
+++ tar-1.15.1-xrg/src/names.c	2005-12-14 17:43:47.000000000 +0200
@@ -937,7 +937,7 @@
 
 /* Return nonzero if file NAME is excluded.  */
 bool
-excluded_name (char const *name)
+excluded_name (char const *name, struct exclude const * excluded)
 {
   return excluded_filename (excluded, name + FILE_SYSTEM_PREFIX_LEN (name));
 }
diff -bBur tar-1.15.1/src/tar.c tar-1.15.1-xrg/src/tar.c
--- tar-1.15.1/src/tar.c	2004-12-21 16:11:26.000000000 +0200
+++ tar-1.15.1-xrg/src/tar.c	2005-12-14 18:04:06.000000000 +0200
@@ -188,6 +188,7 @@
   DELETE_OPTION,
   EXCLUDE_OPTION,
   EXCLUDE_CACHES_OPTION,
+  EXCLUDE_AUTO_OPTION,
   FORCE_LOCAL_OPTION,
   GROUP_OPTION,
   IGNORE_CASE_OPTION,
@@ -456,6 +457,8 @@
    N_("exclude patterns listed in FILE"), 71 },
   {"exclude-caches", EXCLUDE_CACHES_OPTION, 0, 0,
    N_("exclude directories containing a cache tag"), 71 },
+  {"exclude-auto", EXCLUDE_AUTO_OPTION, N_("FILE"),0,
+   N_("in each directory scanned, use this file for more exclude patterns. Use .cvsignore for example."), 71 },
   {"ignore-case", IGNORE_CASE_OPTION, 0, 0,
    N_("exclusion ignores case"), 71 },
   {"anchored", ANCHORED_OPTION, 0, 0,
@@ -891,7 +894,7 @@
       break;
       
     case 'X':
-      if (add_exclude_file (add_exclude, excluded, arg,
+      if (add_exclude_file (add_exclude, global_excluded, arg,
 			    args->exclude_options | recursion_option, '\n')
 	  != 0)
 	{
@@ -937,13 +940,20 @@
       break;
       
     case EXCLUDE_OPTION:
-      add_exclude (excluded, arg, args->exclude_options | recursion_option);
+      add_exclude (global_excluded, arg, args->exclude_options | recursion_option);
       break;
       
     case EXCLUDE_CACHES_OPTION:
       exclude_caches_option = true;
       break;
 
+    case EXCLUDE_AUTO_OPTION:
+	  auto_exclude_array = xrealloc (auto_exclude_array,
+		      sizeof (struct auto_exclude_struct) * (auto_exclude_size+1));
+      auto_exclude_array[auto_exclude_size].name = arg;
+      auto_exclude_array[auto_exclude_size++].options =args->exclude_options | recursion_option ;
+      break;
+
     case FORCE_LOCAL_OPTION:
       force_local_option = true;
       break;
@@ -1324,7 +1334,7 @@
   archive_format = DEFAULT_FORMAT;
   blocking_factor = DEFAULT_BLOCKING;
   record_size = DEFAULT_BLOCKING * BLOCKSIZE;
-  excluded = new_exclude ();
+  global_excluded = new_exclude ();
   newer_mtime_option.tv_sec = TYPE_MINIMUM (time_t);
   newer_mtime_option.tv_nsec = -1;
   recursion_option = FNM_LEADING_DIR;
@@ -1638,6 +1648,8 @@
   archive_name_array =
     xmalloc (sizeof (const char *) * allocated_archive_names);
   archive_names = 0;
+  auto_exclude_array=NULL;
+  auto_exclude_size=0;
 
 #ifdef SIGCHLD
   /* System V fork+wait does not work if SIGCHLD is ignored.  */
@@ -1709,6 +1721,7 @@
   /* Dispose of allocated memory, and return.  */
 
   free (archive_name_array);
+  free (auto_exclude_array);
   name_term ();
 
   if (stdlis != stderr && (ferror (stdlis) || fclose (stdlis) != 0))
diff -bBur tar-1.15.1/src/update.c tar-1.15.1-xrg/src/update.c
--- tar-1.15.1/src/update.c	2004-09-06 14:31:06.000000000 +0300
+++ tar-1.15.1-xrg/src/update.c	2005-12-14 17:52:48.000000000 +0200
@@ -192,14 +192,14 @@
 
     while ((file_name = name_from_list ()) != NULL)
       {
-	if (excluded_name (file_name))
+	if (excluded_name (file_name,global_excluded))
 	  continue;
 	if (interactive_option && !confirm ("add", file_name))
 	  continue;
 	if (subcommand_option == CAT_SUBCOMMAND)
 	  append_file (file_name);
 	else
-	  dump_file (file_name, 1, (dev_t) 0);
+	  dump_file (file_name, 1, (dev_t) 0,global_excluded);
       }
   }
 
