makeinfo (GNU texinfo) 4.5
automake (GNU automake) 1.7.3
Hi,
when building Info documentation in a build directory different from the
source directory (VPATH builds), makeinfo fails to lookup image files in
the source directory even if the source directory is added to the
include files search path. I think this is a bug. Here is a patch
together with a ChangeLog entry.
2003-03-06 Ralph Schleicher <[EMAIL PROTECTED]>
* makeinfo/files.h (get_file_info_in_path): Declare function.
* makeinfo/files.c (get_file_info_in_path): Remove static keyword.
* makeinfo/makeinfo.c (cm_image): Lookup image file name in the
search path for include files.
diff -u texinfo-4.5/makeinfo/makeinfo.c.orig texinfo-4.5/makeinfo/makeinfo.c
--- texinfo-4.5/makeinfo/makeinfo.c.orig Sun Jan 19 19:44:28 2003
+++ texinfo-4.5/makeinfo/makeinfo.c Thu Mar 6 13:22:46 2003
@@ -3441,6 +3441,8 @@
if (*name_arg)
{
+ struct stat file_info;
+ char *pathname = NULL;
char *fullname = xmalloc (strlen (name_arg)
+ (ext_arg && *ext_arg ? strlen (ext_arg) + 1 : 4) + 1);
@@ -3450,25 +3452,53 @@
{
sprintf (fullname, "%s.%s", name_arg, ext_arg);
if (access (fullname, R_OK) != 0)
- {
- line_error(_("@image file `%s' (for HTML) not readable: %s"),
- fullname, strerror (errno));
- return;
- }
+ {
+ pathname = get_file_info_in_path (fullname, include_files_path, &file_info);
+ if (pathname != NULL && access (pathname, R_OK) != 0)
+ {
+ line_error(_("@image file `%s' (for HTML) not readable: %s"),
+ fullname, strerror (errno));
+ return;
+ }
+ else if (pathname == NULL)
+ {
+ line_error (_("No such file `%s'"),
+ fullname);
+ return;
+ }
+ }
}
else
{
- sprintf (fullname, "%s.png", name_arg);
- if (access (fullname, R_OK) != 0)
- {
- sprintf (fullname, "%s.jpg", name_arg);
- if (access (fullname, R_OK) != 0)
- {
- line_error (_("No `%s.png' or `.jpg', and no extension supplied"),
- name_arg);
- return;
- }
- }
+ sprintf (fullname, "%s.png", name_arg);
+ if (access (fullname, R_OK) != 0)
+ {
+ pathname = get_file_info_in_path (fullname, include_files_path, &file_info);
+ if (pathname != NULL && access (pathname, R_OK) != 0)
+ {
+ line_error(_("@image file `%s' (for HTML) not readable: %s"),
+ fullname, strerror (errno));
+ return;
+ }
+
+ sprintf (fullname, "%s.jpg", name_arg);
+ if (access (fullname, R_OK) != 0)
+ {
+ pathname = get_file_info_in_path (fullname, include_files_path, &file_info);
+ if (pathname != NULL && access (pathname, R_OK) != 0)
+ {
+ line_error(_("@image file `%s' (for HTML) not readable: %s"),
+ fullname, strerror (errno));
+ return;
+ }
+ else if (pathname == NULL)
+ {
+ line_error (_("No `%s.png' or `.jpg', and no extension supplied"),
+ name_arg);
+ return;
+ }
+ }
+ }
}
add_html_elt ("<img src=");
@@ -3490,6 +3520,12 @@
strcpy (fullname, name_arg);
strcat (fullname, ".txt");
image_file = fopen (fullname, "r");
+ if (image_file == NULL)
+ {
+ pathname = get_file_info_in_path (fullname, include_files_path, &file_info);
+ if (pathname != NULL)
+ image_file = fopen (pathname, "r");
+ }
if (image_file)
{
int ch;
@@ -3519,6 +3555,8 @@
}
free (fullname);
+ if (pathname)
+ free (pathname);
}
else
line_error (_("@image missing filename argument"));
diff -u texinfo-4.5/makeinfo/files.h.orig texinfo-4.5/makeinfo/files.h
--- texinfo-4.5/makeinfo/files.h.orig Mon Aug 26 01:38:38 2002
+++ texinfo-4.5/makeinfo/files.h Thu Mar 6 13:26:10 2003
@@ -36,6 +36,7 @@
extern void pushfile (), popfile ();
extern void flush_file_stack ();
+extern char *get_file_info_in_path ();
extern char *find_and_load ();
extern char *output_name_from_input_name ();
extern char *expand_filename ();
diff -u texinfo-4.5/makeinfo/files.c.orig texinfo-4.5/makeinfo/files.c
--- texinfo-4.5/makeinfo/files.c.orig Mon Aug 26 01:38:38 2002
+++ texinfo-4.5/makeinfo/files.c Thu Mar 6 13:25:49 2003
@@ -82,7 +82,7 @@
When found, return the stat () info for FILENAME in FINFO.
If PATH is NULL, only the current directory is searched.
If the file could not be found, return a NULL pointer. */
-static char *
+char *
get_file_info_in_path (filename, path, finfo)
char *filename, *path;
struct stat *finfo;
--
Ralph
_______________________________________________
Bug-texinfo mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-texinfo