[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: INFOPATH starting with `:'
From: |
Karl Berry |
Subject: |
Re: INFOPATH starting with `:' |
Date: |
Fri, 24 Jan 2003 15:43:34 -0500 |
If INFOPATH starts with `:', `info' aborts with
info: dir: No such file or directory
Thanks again for the report, Werner. Here's a patch if you want to try
it. (I hope to make another pretest today, by the way.)
karl
diff -c -r1.1 -r1.2
*** filesys.c 25 Aug 2002 23:38:38 -0000 1.1
--- filesys.c 24 Jan 2003 18:51:49 -0000 1.2
***************
*** 266,308 ****
return info_file_in_path (filename_non_directory (fname), containing_dir);
}
! /* Given a string containing units of information separated by
! the PATH_SEP character, return the next one pointed to by
! IDX, or NULL if there are no more.
! Advance IDX to the character after the colon. */
char *
extract_colon_unit (string, idx)
char *string;
int *idx;
{
! register int i, start;
! i = start = *idx;
! if ((i >= strlen (string)) || !string)
! return ((char *) NULL);
while (string[i] && string[i] != PATH_SEP[0])
i++;
- if (i == start)
- {
- return ((char *) NULL);
- }
- else
- {
- char *value;
! value = (char *) xmalloc (1 + (i - start));
! strncpy (value, &string[start], (i - start));
! value[i - start] = '\0';
! if (string[i])
! ++i;
! *idx = i;
! return (value);
! }
}
/* A structure which associates a filename with its expansion. */
! typedef struct {
char *filename;
char *expansion;
} FILENAME_LIST;
--- 267,309 ----
return info_file_in_path (filename_non_directory (fname), containing_dir);
}
!
! /* Given a string containing units of information separated by the
! PATH_SEP character, return the next one after IDX, or NULL if there
! are no more. Advance IDX to the character after the colon. */
!
char *
extract_colon_unit (string, idx)
char *string;
int *idx;
{
! int i = *idx;
! int start = *idx;
! if (!string || i >= strlen (string))
! return NULL;
+ /* Advance to next PATH_SEP. */
while (string[i] && string[i] != PATH_SEP[0])
i++;
! if (!string[i]) /* end of string */
! return NULL;
!
! {
! char *value = xmalloc ((i - start) + 1);
! strncpy (value, &string[start], (i - start));
! value[i - start] = 0;
!
! i++; /* move past PATH_SEP */
! *idx = i;
! return value;
! }
}
/* A structure which associates a filename with its expansion. */
! typedef struct
! {
char *filename;
char *expansion;
} FILENAME_LIST;