bash-5.1 distribution sources and documentation

This commit is contained in:
Chet Ramey
2020-12-06 15:51:17 -05:00
parent 36f2c406ff
commit 8868edaf22
828 changed files with 94641 additions and 56509 deletions

View File

@@ -122,7 +122,6 @@ strvec_remove (array, name)
return 0;
}
#ifdef INCLUDE_UNUSED
/* Find NAME in ARRAY. Return the index of NAME, or -1 if not present.
ARRAY should be NULL terminated. */
int
@@ -137,7 +136,6 @@ strvec_search (array, name)
return (-1);
}
#endif
/* Allocate and return a new copy of ARRAY and its contents. */
char **
@@ -158,6 +156,28 @@ strvec_copy (array)
return (ret);
}
/* Comparison routine for use by qsort that conforms to the new Posix
requirements (http://austingroupbugs.net/view.php?id=1070).
Perform a bytewise comparison if *S1 and *S2 collate equally. */
int
strvec_posixcmp (s1, s2)
register char **s1, **s2;
{
int result;
#if defined (HAVE_STRCOLL)
result = strcoll (*s1, *s2);
if (result != 0)
return result;
#endif
if ((result = **s1 - **s2) == 0)
result = strcmp (*s1, *s2);
return (result);
}
/* Comparison routine for use with qsort() on arrays of strings. Uses
strcoll(3) if available, otherwise it uses strcmp(3). */
int
@@ -178,10 +198,14 @@ strvec_strcmp (s1, s2)
/* Sort ARRAY, a null terminated array of pointers to strings. */
void
strvec_sort (array)
strvec_sort (array, posix)
char **array;
int posix;
{
qsort (array, strvec_len (array), sizeof (char *), (QSFUNC *)strvec_strcmp);
if (posix)
qsort (array, strvec_len (array), sizeof (char *), (QSFUNC *)strvec_posixcmp);
else
qsort (array, strvec_len (array), sizeof (char *), (QSFUNC *)strvec_strcmp);
}
/* Cons up a new array of words. The words are taken from LIST,