builtins now return success if supplied --help; use groff to build HTML man pages; reset mbstate if $'...' strings read an invalid multibyte sequence; read -t 0 now looks at other options (-n/-N/-d) and sets the terminal state appropriately

This commit is contained in:
Chet Ramey
2025-10-01 10:44:10 -04:00
parent cf8a2518c8
commit fbd078be0a
35 changed files with 1666 additions and 1479 deletions
+10 -7
View File
@@ -83,6 +83,8 @@ ansicstr (const char *string, size_t len, int flags, int *sawc, size_t *rlen)
(locale_utf8locale == 0 && mb_cur_max > 0 && is_basic (c) == 0))
{
clen = mbrtowc (&wc, s - 1, mb_cur_max, 0);
if (MB_NULLWCH (clen))
break; /* it apparently can happen */
if (MB_INVALIDCH (clen))
clen = 1;
}
@@ -263,8 +265,8 @@ ansic_quote (const char *str, int flags, int *rlen)
if (is_basic (c) == 0)
{
clen = mbrtowc (&wc, s, MB_CUR_MAX, &state);
if (clen == 0)
break;
if (MB_NULLWCH (clen))
goto quote_end;
if (MB_INVALIDCH (clen))
INITIALIZE_MBSTATE;
else if (iswprint (wc))
@@ -283,17 +285,18 @@ ansic_quote (const char *str, int flags, int *rlen)
continue;
}
*r++ = '\\';
*r++ = TOCHAR ((c >> 6) & 07);
*r++ = TOCHAR ((c >> 3) & 07);
*r++ = TOCHAR (c & 07);
continue;
*r++ = '\\';
*r++ = TOCHAR ((c >> 6) & 07);
*r++ = TOCHAR ((c >> 3) & 07);
*r++ = TOCHAR (c & 07);
continue;
}
*r++ = '\\';
*r++ = c;
}
quote_end:
*r++ = '\'';
*r = '\0';
if (rlen)