mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 16:39:53 +02:00
commit bash-20140321 snapshot
This commit is contained in:
+34
-25
@@ -179,42 +179,50 @@ extglob_skipname (pat, dname, flags)
|
||||
char *pat, *dname;
|
||||
int flags;
|
||||
{
|
||||
char *pp, *pe, *t;
|
||||
int n, r;
|
||||
char *pp, *pe, *t, *se;
|
||||
int n, r, negate;
|
||||
|
||||
negate = *pat == '!';
|
||||
pp = pat + 2;
|
||||
pe = pp + strlen (pp) - 1; /*(*/
|
||||
if (*pe != ')')
|
||||
return 0;
|
||||
if ((t = strchr (pp, '|')) == 0) /* easy case first */
|
||||
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 != 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)
|
||||
{
|
||||
*pe = '\0';
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
r = mbskipname (pp, dname, flags);
|
||||
#else
|
||||
r = skipname (pp, dname, flags); /*(*/
|
||||
#endif
|
||||
*pe = ')';
|
||||
return r;
|
||||
}
|
||||
|
||||
/* check every subpattern */
|
||||
while (t = glob_patscan (pp, pe, '|'))
|
||||
{
|
||||
n = t[-1];
|
||||
t[-1] = '\0';
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
r = mbskipname (pp, dname, flags);
|
||||
#else
|
||||
r = skipname (pp, dname, flags);
|
||||
#endif
|
||||
t[-1] = n;
|
||||
if (r == 0) /* if any pattern says not skip, we don't skip */
|
||||
return r;
|
||||
pp = t;
|
||||
} /*(*/
|
||||
|
||||
if (pp == pe) /* glob_patscan might find end of pattern */
|
||||
/* glob_patscan might find end of pattern */
|
||||
if (pp == se)
|
||||
return r;
|
||||
|
||||
*pe = '\0';
|
||||
# if defined (HANDLE_MULTIBYTE)
|
||||
r = mbskipname (pp, dname, flags); /*(*/
|
||||
# else
|
||||
r = skipname (pp, dname, flags); /*(*/
|
||||
# endif
|
||||
*pe = ')';
|
||||
return r;
|
||||
/* but if it doesn't then we didn't match a leading dot */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -277,20 +285,23 @@ wextglob_skipname (pat, dname, flags)
|
||||
int flags;
|
||||
{
|
||||
#if EXTENDED_GLOB
|
||||
wchar_t *pp, *pe, *t, n;
|
||||
int r;
|
||||
wchar_t *pp, *pe, *t, n, *se;
|
||||
int r, negate;
|
||||
|
||||
negate = *pat == L'!';
|
||||
pp = pat + 2;
|
||||
pe = pp + wcslen (pp) - 1; /*(*/
|
||||
if (*pe != L')')
|
||||
return 0;
|
||||
if ((t = wcschr (pp, L'|')) == 0)
|
||||
se = pp + wcslen (pp) - 1; /*(*/
|
||||
pe = glob_patscan_wc (pp, se, 0);
|
||||
|
||||
if (pe == se && *pe == ')' && (t = wcschr (pp, L'|')) == 0)
|
||||
{
|
||||
*pe = L'\0';
|
||||
r = wchkname (pp, dname); /*(*/
|
||||
*pe = L')';
|
||||
return r;
|
||||
}
|
||||
|
||||
/* check every subpattern */
|
||||
while (t = glob_patscan_wc (pp, pe, '|'))
|
||||
{
|
||||
n = t[-1];
|
||||
@@ -305,10 +316,8 @@ wextglob_skipname (pat, dname, flags)
|
||||
if (pp == pe) /* glob_patscan_wc might find end of pattern */
|
||||
return r;
|
||||
|
||||
*pe = L'\0';
|
||||
r = wchkname (pp, dname); /*(*/
|
||||
*pe = L')';
|
||||
return r;
|
||||
/* but if it doesn't then we didn't match a leading dot */
|
||||
return 0;
|
||||
#else
|
||||
return (wchkname (pat, dname));
|
||||
#endif
|
||||
|
||||
@@ -210,6 +210,7 @@ extglob_pattern_p (pat)
|
||||
case '+':
|
||||
case '!':
|
||||
case '@':
|
||||
case '?':
|
||||
return (pat[1] == LPAREN);
|
||||
default:
|
||||
return 0;
|
||||
|
||||
@@ -52,8 +52,10 @@ SHELL = @MAKE_SHELL@
|
||||
ETAGS = etags -tw
|
||||
CTAGS = ctags -tw
|
||||
|
||||
DEBUG = @DEBUG@
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -478,6 +478,7 @@ _rl_savestring (s)
|
||||
return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
||||
|
||||
#if defined (DEBUG)
|
||||
#if defined (USE_VARARGS)
|
||||
static FILE *_rl_tracefp;
|
||||
|
||||
@@ -540,6 +541,7 @@ _rl_settracefp (fp)
|
||||
_rl_tracefp = fp;
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
#if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT)
|
||||
|
||||
Reference in New Issue
Block a user