[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6435] allow subdirectories in manual specifications
From: |
Gavin D. Smith |
Subject: |
[6435] allow subdirectories in manual specifications |
Date: |
Thu, 16 Jul 2015 17:53:34 +0000 |
Revision: 6435
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6435
Author: gavin
Date: 2015-07-16 17:53:33 +0000 (Thu, 16 Jul 2015)
Log Message:
-----------
allow subdirectories in manual specifications
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/filesys.c
trunk/info/info.c
trunk/info/nodes.c
trunk/info/t/infodir/dir
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-07-15 12:53:52 UTC (rev 6434)
+++ trunk/ChangeLog 2015-07-16 17:53:33 UTC (rev 6435)
@@ -1,3 +1,19 @@
+2015-07-16 Gavin Smith <address@hidden>
+
+ * info/nodes.c (info_find_file): If filename has slash, look for
+ it in search path if it does not begin "./".
+ * info/filesys.c (info_find_fullpath): Don't look for a filename
+ beginning "./" in the search path, but otherwise look for the
+ filename in the search path even if it contains a slash.
+ (info_file_find_next_in_path): Prefix returned path with "./" if
+ it is relative to the current directory.
+ (info_add_extension): Allow second argument to be null.
+
+ * info/info.c (main) <--file or slash in argument>: If argument
+ not an absolute path, prefix it with "./". Call
+ info_add_extension instead of info_find_fullpath for arguments
+ other than simple filenames.
+
2015-07-15 Gavin Smith <address@hidden>
* info/t/dir-entry-to-subdir.sh: New test.
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2015-07-15 12:53:52 UTC (rev 6434)
+++ trunk/info/Makefile.am 2015-07-16 17:53:33 UTC (rev 6435)
@@ -164,8 +164,7 @@
t/quoted-target.sh \
t/quoted-label-and-target.sh \
t/goto-quoted.sh \
- t/next-quoted.sh \
- t/dir-entry-to-subdir.sh
+ t/next-quoted.sh
EXTRA_DIST += $(TESTS) $(XFAIL_TESTS) \
t/README t/infodir \
Modified: trunk/info/filesys.c
===================================================================
--- trunk/info/filesys.c 2015-07-15 12:53:52 UTC (rev 6434)
+++ trunk/info/filesys.c 2015-07-16 17:53:33 UTC (rev 6435)
@@ -77,8 +77,7 @@
{ NULL, NULL }
};
-/* Expand the filename in PARTIAL to make a real name for this operating
- system. This looks in INFOPATH in order to find the correct file.
+/* Look for the filename PARTIAL in INFOPATH in order to find the correct file.
Return file name and set *FINFO with information about file. If it
can't find the file, it returns NULL, and sets filesys_error_number.
Return value should be freed by caller. */
@@ -101,7 +100,8 @@
/* IS_SLASH and IS_ABSOLUTE defined in ../system.h. */
/* If path is absolute already, see if it needs an extension. */
- if (IS_ABSOLUTE (partial))
+ if (IS_ABSOLUTE (partial)
+ || partial[0] == '.' && IS_SLASH(partial[1]))
{
fullpath = info_add_extension (0, partial, finfo);
}
@@ -113,12 +113,6 @@
fullpath = info_add_extension (0, partial, finfo);
}
- /* If filename has a slash in it (for example, begins with "./" or "../", or
- if there are intermediate directories) interpret it as relative to current
- directory. This may be from the command line, or in the subfiles table of
- a split file. */
- else if (HAS_SLASH (partial))
- fullpath = info_add_extension (0, partial, finfo);
/* If just a simple name element, look for it in the path. */
else
fullpath = info_file_in_path (partial, finfo);
@@ -168,11 +162,24 @@
with_extension = info_add_extension (dirname, filename, finfo);
if (with_extension)
- return with_extension;
+ {
+ if (!IS_ABSOLUTE (with_extension))
+ {
+ /* Prefix "./" to it. */
+ char *s;
+ asprintf (&s, "%s%s", "./", with_extension);
+ free (with_extension);
+ return s;
+ }
+ else
+ return with_extension;
+ }
}
return NULL;
}
+/* Return full path of first Info file known as FILENAME in
+ search path. If relative to current directory, precede it with './'. */
static char *
info_file_in_path (char *filename, struct stat *finfo)
{
@@ -189,7 +196,11 @@
{
char *try_filename;
register int i, pre_suffix_length = 0;
+ struct stat dummy;
+ if (!finfo)
+ finfo = &dummy;
+
if (dirname)
pre_suffix_length += strlen (dirname);
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2015-07-15 12:53:52 UTC (rev 6434)
+++ trunk/info/info.c 2015-07-16 17:53:33 UTC (rev 6435)
@@ -825,7 +825,7 @@
for a matching entry. */
if (!user_filename && argv[0] && HAS_SLASH (argv[0]))
{
- user_filename = argv[0];
+ user_filename = xstrdup (argv[0]);
argv++; /* Advance past first remaining argument. */
argc--;
}
@@ -873,7 +873,7 @@
/* --all */
if (!user_filename && argv[0])
{
- user_filename = argv[0];
+ user_filename = xstrdup (argv[0]);
argv++; argc--;
}
else if (!user_filename)
@@ -904,10 +904,29 @@
/* User used "--file". */
if (user_filename)
{
- initial_file = info_find_fullpath (user_filename, 0);
- if (!initial_file && filesys_error_number)
- error = filesys_error_string (user_filename, filesys_error_number);
+ if (!IS_ABSOLUTE(user_filename) && HAS_SLASH(user_filename)
+ && !(user_filename[0] == '.' && IS_SLASH(user_filename[1])))
+ {
+ /* Prefix "./" to the filename to prevent a lookup
+ in INFOPATH. */
+ char *s;
+ asprintf (&s, "%s%s", "./", user_filename);
+ free (user_filename);
+ user_filename = s;
+ }
+ if (IS_ABSOLUTE(user_filename) || HAS_SLASH(user_filename))
+ initial_file = info_add_extension (0, user_filename, 0);
else
+ initial_file = info_find_fullpath (user_filename, 0);
+
+ if (!initial_file)
+ {
+ if (!filesys_error_number)
+ filesys_error_number = ENOENT;
+ error = filesys_error_string (user_filename,
+ filesys_error_number);
+ }
+ else
add_pointer_to_array (info_new_reference (initial_file, "Top"),
ref_index, ref_list, ref_slots, 2);
goto skip_get_initial_file;
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2015-07-15 12:53:52 UTC (rev 6434)
+++ trunk/info/nodes.c 2015-07-16 17:53:33 UTC (rev 6435)
@@ -558,7 +558,8 @@
int is_fullpath;
/* If full path to the file has been given, we must find it exactly. */
- is_fullpath = IS_ABSOLUTE (filename) || HAS_SLASH (filename);
+ is_fullpath = IS_ABSOLUTE (filename)
+ || filename[0] == '.' && IS_SLASH(filename[1]);
/* First try to find the file in our list of already loaded files. */
if (info_loaded_files)
Modified: trunk/info/t/infodir/dir
===================================================================
(Binary files differ)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6435] allow subdirectories in manual specifications,
Gavin D. Smith <=