+ else
+ {
+ CHECK_STRING (Vdoc_directory);
+ name = (char *) alloca (SCHARS (filename)
+ + SCHARS (Vdoc_directory) + 1);
+ strcpy (name, SDATA (Vdoc_directory));
+ }
+ strcat (name, SDATA (filename)); /*** Add this line ***/
+ munge_doc_file_name (name);
+
+ /* Vbuild_files is nil when temacs is run, and non-nil after that. */
+ if (NILP (Vbuild_files))
+ {
+ size_t cp_size = 0;
+ size_t to_read;
+ int nr_read;
+ char *cp = NULL;
+ char *beg, *end;
+
+ fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
+ if (fd < 0)
+ report_file_error ("Opening file buildobj.lst", Qnil);
+
+ filled = 0;
+ for (;;)
+ {
+ cp_size += 1024;
+ to_read = cp_size - 1 - filled;
+ cp = xrealloc (cp, cp_size);
+ nr_read = emacs_read (fd, &cp[filled], to_read);
+ filled += nr_read;
+ if (nr_read < to_read)
+ break;
+ }
+
+ emacs_close (fd);
+ cp[filled] = 0;
+
+ for (beg = cp; *beg; beg = end)
+ {
+ int len;
+
+ while (*beg && isspace (*beg)) ++beg;
+
+ for (end = beg; *end && ! isspace (*end); ++end)
+ if (*end == '/') beg = end+1; /* skip directory part */
+
+ len = end - beg;
+ if (len > 4 && end[-4] == '.' && end[-3] == 'o')
+ len -= 2; /* Just take .o if it ends in .obj */
+
+ if (len > 0)
+ Vbuild_files = Fcons (make_string (beg, len), Vbuild_files);
+ }
+
+ xfree (cp);
+ }
+
+ fd = emacs_open (name, O_RDONLY, 0);