Index: lisp/info.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/lisp/info.el,v
retrieving revision 1.11
diff -u -r1.11 info.el
--- info.el	1998/04/24 21:34:04	1.11
+++ info.el	1998/04/25 17:09:30
@@ -998,7 +998,7 @@
 
 (defun Info-dir-outdated-p (file)
   "Return non-nil if dir or localdir is outdated.
-dir or localdir are outdated when a *.info file in the same
+dir or localdir are outdated when an info file in the same
 directory has been modified more recently."
   (let ((dir-mod-time (nth 5 (file-attributes file)))
 	f-mod-time
@@ -1047,20 +1047,23 @@
       (save-restriction
 	(narrow-to-region beg end)
 	(goto-char beg)
-	(while (re-search-forward "^\\* \\([^:]+\\):\\([ \t]*(\\(.*\\))\\w*\\.\\|:\\)" nil t)
+	(while (re-search-forward "^\\* \\([^:]+\\):\\([ \t]*(\\([^)]*\\))\\w*\\.\\|:\\)" nil t)
 	  (setq entry (list (match-string 2)
 			    (match-string 1)
 			    (downcase (or (match-string 3)
 					  (match-string 1)))))
-	  (setq entry (cons (nreverse 
-			     (cdr 
-			      (nreverse 
-			       (split-string (buffer-substring (re-search-forward "[ \t]*" nil t)
-							       (or (and (re-search-forward "^[^ \t]" nil t)
-									(goto-char (match-beginning 0)))
-								   (point-max)))
-					     "[ \t]*\n[ \t]*"))))
-			    entry))
+	  (setq entry 
+		(cons (nreverse 
+		       (cdr 
+			(nreverse 
+			 (split-string 
+			  (buffer-substring 
+			   (re-search-forward "[ \t]*" nil t)
+			   (or (and (re-search-forward "^[^ \t]" nil t)
+				    (goto-char (match-beginning 0)))
+			       (point-max)))
+			  "[ \t]*\n[ \t]*"))))
+		      entry))
 	  (setq entries (cons (nreverse entry) entries)))))
     (nreverse entries)))
 
@@ -1114,7 +1117,10 @@
 	'(lambda (f)
 	   (or (Info-extract-dir-entry-from f)
 	       (list 'dummy
-		     (file-name-sans-extension (file-name-nondirectory f))
+		     (progn 
+		       (string-match "\\(.*\\)\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$" 
+				     (file-name-nondirectory f))
+		       (capitalize (match-string 1 (file-name-nondirectory f))))
 		     ":"
 		     (list Info-no-description-string))))
 	info-files))
@@ -1204,7 +1210,35 @@
 	(if to-temp
 	    (message "Rebuilding temporary dir...done")
 	  (message "Rebuilding %s...done" file))))))
-      
+
+;;;###autoload      
+(defun Info-batch-rebuild-dir ()
+  "(Re)build info `dir' files in the directories remaining on the command line.
+Use this from the command line, with `-batch';
+it won't work in an interactive Emacs.
+Each file is processed even if an error occurred previously.
+For example, invoke \"xemacs -batch -f Info-batch-rebuild-dir /usr/local/info\""
+  ;; command-line-args-left is what is left of the command line (from
+  ;; startup.el)
+  (defvar command-line-args-left)	; Avoid 'free variable' warning
+  (if (not noninteractive)
+      (error "`Info-batch-rebuild-dir' is to be used only with -batch"))
+  (while command-line-args-left
+    (if  (not (file-directory-p (car command-line-args-left)))
+	(message "Warning: Skipped %s. Not a directory."
+		 (car command-line-args-left))
+      (setq dir (expand-file-name "dir" (car command-line-args-left)))
+      (setq localdir (expand-file-name "localdir" (car command-line-args-left)))
+      (cond 
+       ((file-exists-p dir)
+	(Info-rebuild-dir dir nil))
+       ((file-exists-p localdir)
+	(Info-rebuild-dir localdir nil))
+       (t
+	(Info-build-dir-anew (car command-line-args-left) nil))))
+    (setq command-line-args-left (cdr command-line-args-left)))
+  (message "Done")
+  (kill-emacs 0))
 
 (defun Info-history-add (file node point)
   (if Info-keeping-history
@@ -1277,16 +1311,16 @@
       (setq file (concat name (caar suff))
 	    file2 (and name2 (concat name2 (caar suff))))
       (cond
-       ((file-exists-p file)
+       ((file-regular-p file)
 	(setq found file))
-       ((and file2 (file-exists-p file2))
+       ((and file2 (file-regular-p file2))
 	(setq found file2))
        (t
 	(setq suff (cdr suff)))))
     (or found
-	(and name (when (file-exists-p name)
+	(and name (when (file-regular-p name)
 		    name))
-	(and name2 (when (file-exists-p name2)
+	(and name2 (when (file-regular-p name2)
 		     name2)))))
 
 (defun Info-insert-file-contents (file &optional visit)
