Index: wp-includes/rewrite-functions.php
===================================================================
--- wp-includes/rewrite-functions.php	(revision 0)
+++ wp-includes/rewrite-functions.php	(revision 0)
@@ -0,0 +1,35 @@
+<?php
+
+//Add a straight rewrite rule
+function add_rewrite_rule($regex, $redirect) {
+	global $wp_rewrite;
+	$wp_rewrite->add_extra_rule($regex, $redirect);
+}
+
+//Add a new tag (like %postname%)
+//warning: you must call this on init or earlier, otherwise the query var addition stuff won't work
+function add_rewrite_tag($tagname, $regex) {
+	//validation
+	if ($tagname < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
+		return;
+	}
+	
+	$qv = trim($tagname, '%');
+	
+	global $wp_rewrite, $wp;
+	$wp->add_extra_qv($qv);
+	$wp_rewrite->add_rewrite_tag($tagname, $regex, trim($tagname, '%') . '=');
+}
+
+//Add a new feed type like /atom1/ 
+function add_feed($feedname, $filename) {
+	global $wp_rewrite;
+	if (in_array($feedname, $wp_rewrite->feeds)) { //override
+		$wp_rewrite->feed_files[$filename] = $feedname;
+		//the feed name is already in $wp_rewrite->feeds
+	} else { //add it
+		$wp_rewrite->feeds[] = $feedname;
+	}
+}
+
+?>
\ No newline at end of file
Index: wp-includes/classes.php
===================================================================
--- wp-includes/classes.php	(revision 3521)
+++ wp-includes/classes.php	(working copy)
@@ -864,6 +864,7 @@
 	var $index = 'index.php';
 	var $matches = '';
 	var $rules;
+	var $extra_rules; //those not generated by the class, see add_rewrite_rule()
 	var $use_verbose_rules = false;
 	var $rewritecode = 
 		array(
@@ -913,8 +914,16 @@
 					's='
 					);
 
-	var $feeds = array ('feed', 'rdf', 'rss', 'rss2', 'atom');
-
+	var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' ); 
+	
+	//the filenames aren't actually used in WP_Rewrite but seems a convenient place as any to store them
+	var $feed_files = array (
+		'rdf'  => 'wp-rdf.php'
+	 	'rss'  => 'wp-rss.php' 
+	 	'rss2' => 'wp-rss2.php'
+	 	'atom' =>'wp-atom.php'
+	);  
+     
 	function using_permalinks() {
 		if (empty($this->permalink_structure))
 			return false;
@@ -1400,6 +1409,14 @@
 
 		return $rules;
 	}
+	
+	//Add a straight rewrite rule
+	function add_extra_rule($regex, $redirect) {
+		if (!is_array($this->extra_rules)) {
+			$this->extra_rules = array ();
+		}
+		$this->extra_rules[$regex] = $redirect;
+	}
 
 	function flush_rules() {
 		generate_page_uri_index();
@@ -1456,6 +1473,10 @@
 	var $matched_rule;
 	var $matched_query;
 	var $did_permalink = false;
+	
+	function add_extra_qv($qv) {
+		$this->public_query_vars[] = $qv;
+	}
 
 	function parse_request($extra_query_vars = '') {
 		global $wp_rewrite;
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 3521)
+++ wp-settings.php	(working copy)
@@ -138,6 +138,7 @@
 require (ABSPATH . WPINC . '/template-functions-post.php');
 require (ABSPATH . WPINC . '/template-functions-category.php');
 require (ABSPATH . WPINC . '/comment-functions.php');
+require (ABSPATH . WPINC . '/rewrite-functions.php');
 require (ABSPATH . WPINC . '/feed-functions.php');
 require (ABSPATH . WPINC . '/links.php');
 require (ABSPATH . WPINC . '/kses.php');
Index: wp-feed.php
===================================================================
--- wp-feed.php	(revision 3521)
+++ wp-feed.php	(working copy)
@@ -12,26 +12,14 @@
     $feed = 'rss2';
 }
 
+$file = $wp_rewrite->feed_files[$feed];
+
 if ( is_single() || ($withcomments == 1) ) {
     require(ABSPATH . 'wp-commentsrss2.php');
 } else {
-    switch ($feed) {
-    case 'atom':
-        require(ABSPATH . 'wp-atom.php');
-        break;
-    case 'rdf':
-        require(ABSPATH . 'wp-rdf.php');
-        break;
-    case 'rss':
-        require(ABSPATH . 'wp-rss.php');
-        break;
-    case 'rss2':
-        require(ABSPATH . 'wp-rss2.php');
-        break;
-    case 'comments-rss2':
-        require(ABSPATH . 'wp-commentsrss2.php');
-        break;
-    }
+	if (in_array($feed, $wp_rewrite->feeds) && !empty($file) && file_exists(ABSPATH . $file)) {
+		require ABSPATH . $file;
+	}
 }
 
 ?>
