globbing reacts to signals more quickly; new printf %Q format specifier; readline completion handles multiline quotes better

This commit is contained in:
Chet Ramey
2021-08-08 20:44:28 -04:00
parent 0edd0a9183
commit 4d4294caf7
8 changed files with 110 additions and 22 deletions
+2 -2
View File
@@ -956,7 +956,7 @@ glob_vector (pat, dir, flags)
/* compat: if GX_ADDCURDIR, add the passed directory also. Add an empty
directory name as a placeholder if GX_NULLDIR (in which case the passed
directory name is "."). */
if (add_current)
if (add_current && lose == 0)
{
sdlen = strlen (dir);
nextname = (char *)malloc (sdlen + 1);
@@ -986,7 +986,7 @@ glob_vector (pat, dir, flags)
lose |= name_vector == NULL;
}
/* Have we run out of memory? */
/* Have we run out of memory or been interrupted? */
if (lose)
{
tmplink = 0;
+5
View File
@@ -16,6 +16,8 @@
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
extern int interrupt_state, terminating_signal;
struct STRUCT
{
CHAR *pattern;
@@ -81,6 +83,9 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
sc = n < se ? *n : '\0';
if (interrupt_state || terminating_signal)
return FNM_NOMATCH;
#ifdef EXTENDED_GLOB
/* EXTMATCH () will handle recursively calling GMATCH, so we can
just return what EXTMATCH() returns. */