commit bash-20140502 snapshot

This commit is contained in:
Chet Ramey
2014-05-13 16:19:02 -04:00
parent e38100f49d
commit 098cbb5c3d
21 changed files with 3249 additions and 483 deletions
+18 -1
View File
@@ -123,6 +123,8 @@ static char **glob_dir_to_array __P((char *, char **, int));
extern char *glob_patscan __P((char *, char *, int));
extern wchar_t *glob_patscan_wc __P((wchar_t *, wchar_t *, int));
extern char *glob_dirscan __P((char *, int));
/* Compile `glob_loop.c' for single-byte characters. */
#define CHAR unsigned char
#define INT int
@@ -187,6 +189,9 @@ extglob_skipname (pat, dname, flags)
se = pp + strlen (pp) - 1; /* end of string */
pe = glob_patscan (pp, se, 0); /* end of extglob pattern (( */
/* we should check for invalid extglob pattern here */
if (pe == 0)
return 0;
/* if pe != se we have more of the pattern at the end of the extglob
pattern. Check the easy case first ( */
if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0)
@@ -1015,7 +1020,7 @@ glob_filename (pathname, flags)
{
char **result;
unsigned int result_size;
char *directory_name, *filename, *dname;
char *directory_name, *filename, *dname, *fn;
unsigned int directory_len;
int free_dirname; /* flag */
int dflags;
@@ -1031,6 +1036,18 @@ glob_filename (pathname, flags)
/* Find the filename. */
filename = strrchr (pathname, '/');
#if defined (EXTENDED_GLOB)
if (filename && extended_glob)
{
fn = glob_dirscan (pathname, '/');
#if DEBUG_MATCHING
if (fn != filename)
fprintf (stderr, "glob_filename: glob_dirscan: fn (%s) != filename (%s)\n", fn ? fn : "(null)", filename);
#endif
filename = fn;
}
#endif
if (filename == NULL)
{
filename = pathname;
+33
View File
@@ -42,6 +42,8 @@
#define WLPAREN L'('
#define WRPAREN L')'
extern char *glob_patscan __P((char *, char *, int));
/* Return 1 of the first character of WSTRING could match the first
character of pattern WPAT. Wide character version. */
int
@@ -375,3 +377,34 @@ bad_bracket:
return matlen;
}
/* Skip characters in PAT and return the final occurrence of DIRSEP. This
is only called when extended_glob is set, so we have to skip over extglob
patterns x(...) */
char *
glob_dirscan (pat, dirsep)
char *pat;
int dirsep;
{
char *p, *d, *pe, *se;
d = pe = 0;
for (p = pat; p && *p; p++)
{
if (extglob_pattern_p (p))
{
if (se == 0)
se = p + strlen (p) - 1;
pe = glob_patscan (p + 2, se, 0);
if (pe == 0)
continue;
else if (*pe == 0)
break;
p = pe - 1; /* will do increment above */
continue;
}
if (*p == dirsep)
d = p;
}
return d;
}
+2 -1
View File
@@ -533,7 +533,8 @@ matched:
embedded () and []. If DELIM is 0, we scan until a matching `)'
because we're scanning a `patlist'. Otherwise, we scan until we see
DELIM. In all cases, we never scan past END. The return value is the
first character after the matching DELIM. */
first character after the matching DELIM or NULL if the pattern is
empty or invalid. */
/*static*/ CHAR *
PATSCAN (string, end, delim)
CHAR *string, *end;
+76
View File
@@ -0,0 +1,76 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
RM = rm -f
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
TEXI2HTML = texi2html
QUIETPS = #set this to -q to shut up dvips
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
INSTALL_DATA = cp
infodir = /usr/local/info
RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
DVIOBJ = readline.dvi history.dvi
INFOOBJ = readline.info history.info
PSOBJ = readline.ps history.ps
HTMLOBJ = readline.html history.html
all: info dvi html ps
nodvi: info html
readline.dvi: $(RLSRC)
$(TEXI2DVI) rlman.texinfo
mv rlman.dvi readline.dvi
readline.info: $(RLSRC)
$(MAKEINFO) --no-split -o $@ rlman.texinfo
history.dvi: ${HISTSRC}
$(TEXI2DVI) hist.texinfo
mv hist.dvi history.dvi
history.info: ${HISTSRC}
$(MAKEINFO) --no-split -o $@ hist.texinfo
readline.ps: readline.dvi
$(RM) $@
$(DVIPS) readline.dvi
history.ps: history.dvi
$(RM) $@
$(DVIPS) history.dvi
readline.html: ${RLSRC}
$(TEXI2HTML) rlman.texinfo
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
$(RM) rlman.html rlman_toc.html
history.html: ${HISTSRC}
$(TEXI2HTML) hist.texinfo
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
$(RM) hist.html hist_toc.html
info: $(INFOOBJ)
dvi: $(DVIOBJ)
ps: $(PSOBJ)
html: $(HTMLOBJ)
clean:
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.fns *.kys *.tps *.vrs *.o core
distclean: clean
mostlyclean: clean
maintainer-clean: clean
$(RM) *.dvi *.info *.info-* *.ps *.html
install: info
${INSTALL_DATA} readline.info $(infodir)/readline.info
${INSTALL_DATA} history.info $(infodir)/history.info