MCPcopy Create free account
hub / github.com/coreutils/coreutils / inittables

Function inittables

src/sort.c:1399–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1397/* Initialize the character class tables. */
1398
1399static void
1400inittables (void)
1401{
1402 for (size_t i = 0; i < UCHAR_LIM; ++i)
1403 {
1404 blanks[i] = i == '\n' || isblank (i);
1405 nondictionary[i] = ! blanks[i] && ! isalnum (i);
1406 nonprinting[i] = ! isprint (i);
1407 fold_toupper[i] = toupper (i);
1408 }
1409
1410#if HAVE_NL_LANGINFO
1411 /* If we're not in the "C" locale, read different names for months. */
1412 if (hard_LC_TIME)
1413 {
1414 for (size_t i = 0; i < MONTHS_PER_YEAR; i++)
1415 {
1416 char const *s;
1417 size_t s_len;
1418 size_t j, k;
1419 char *name;
1420
1421 s = nl_langinfo (ABMON_1 + i);
1422 s_len = strlen (s);
1423 monthtab[i].name = name = xmalloc (s_len + 1);
1424 monthtab[i].val = i + 1;
1425
1426 for (j = k = 0; j < s_len; j++)
1427 if (! isblank (to_uchar (s[j])))
1428 name[k++] = fold_toupper[to_uchar (s[j])];
1429 name[k] = '\0';
1430 }
1431 qsort (monthtab, MONTHS_PER_YEAR, sizeof *monthtab, struct_month_cmp);
1432 }
1433#endif
1434}
1435
1436/* Specify how many inputs may be merged at once.
1437 This may be set on the command-line with the

Callers 1

mainFunction · 0.85

Calls 1

to_ucharFunction · 0.85

Tested by

no test coverage detected