Make the format of LC_COLLATE files architecture independent.
This commit is contained in:
parent
cd147cba52
commit
edc431123e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142686
@ -775,6 +775,10 @@ _groff= gnu/usr.bin/groff/tmac
|
|||||||
_cap_mkdb= usr.bin/cap_mkdb
|
_cap_mkdb= usr.bin/cap_mkdb
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if ${BOOTSTRAPPING} < 600018
|
||||||
|
_colldef= usr.bin/colldef
|
||||||
|
.endif
|
||||||
|
|
||||||
.if ${BOOTSTRAPPING} < 600017
|
.if ${BOOTSTRAPPING} < 600017
|
||||||
_gencat= usr.bin/gencat
|
_gencat= usr.bin/gencat
|
||||||
.endif
|
.endif
|
||||||
@ -795,7 +799,7 @@ bootstrap-tools:
|
|||||||
${_groff} \
|
${_groff} \
|
||||||
gnu/usr.bin/texinfo \
|
gnu/usr.bin/texinfo \
|
||||||
${_cap_mkdb} \
|
${_cap_mkdb} \
|
||||||
usr.bin/colldef \
|
${_colldef} \
|
||||||
${_gencat} \
|
${_gencat} \
|
||||||
usr.bin/lorder \
|
usr.bin/lorder \
|
||||||
usr.bin/makewhatis \
|
usr.bin/makewhatis \
|
||||||
|
@ -99,7 +99,7 @@ __collate_load_tables(const char *encoding)
|
|||||||
chains = -1;
|
chains = -1;
|
||||||
if (strcmp(strbuf, COLLATE_VERSION) == 0)
|
if (strcmp(strbuf, COLLATE_VERSION) == 0)
|
||||||
chains = 0;
|
chains = 0;
|
||||||
else if (strcmp(strbuf, COLLATE_VERSION1_1) == 0)
|
else if (strcmp(strbuf, COLLATE_VERSION1_2) == 0)
|
||||||
chains = 1;
|
chains = 1;
|
||||||
if (chains < 0) {
|
if (chains < 0) {
|
||||||
(void)fclose(fp);
|
(void)fclose(fp);
|
||||||
@ -172,10 +172,21 @@ __collate_load_tables(const char *encoding)
|
|||||||
if (__collate_char_pri_table_ptr != NULL)
|
if (__collate_char_pri_table_ptr != NULL)
|
||||||
free(__collate_char_pri_table_ptr);
|
free(__collate_char_pri_table_ptr);
|
||||||
__collate_char_pri_table_ptr = TMP_char_pri_table;
|
__collate_char_pri_table_ptr = TMP_char_pri_table;
|
||||||
|
for (i = 0; i < UCHAR_MAX + 1; i++) {
|
||||||
|
__collate_char_pri_table[i].prim =
|
||||||
|
ntohl(__collate_char_pri_table[i].prim);
|
||||||
|
__collate_char_pri_table[i].sec =
|
||||||
|
ntohl(__collate_char_pri_table[i].sec);
|
||||||
|
}
|
||||||
if (__collate_chain_pri_table != NULL)
|
if (__collate_chain_pri_table != NULL)
|
||||||
free(__collate_chain_pri_table);
|
free(__collate_chain_pri_table);
|
||||||
__collate_chain_pri_table = TMP_chain_pri_table;
|
__collate_chain_pri_table = TMP_chain_pri_table;
|
||||||
|
for (i = 0; i < chains; i++) {
|
||||||
|
__collate_chain_pri_table[i].prim =
|
||||||
|
ntohl(__collate_chain_pri_table[i].prim);
|
||||||
|
__collate_chain_pri_table[i].sec =
|
||||||
|
ntohl(__collate_chain_pri_table[i].sec);
|
||||||
|
}
|
||||||
__collate_substitute_nontrivial = 0;
|
__collate_substitute_nontrivial = 0;
|
||||||
for (i = 0; i < UCHAR_MAX + 1; i++) {
|
for (i = 0; i < UCHAR_MAX + 1; i++) {
|
||||||
if (__collate_substitute_table[i][0] != i ||
|
if (__collate_substitute_table[i][0] != i ||
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#define STR_LEN 10
|
#define STR_LEN 10
|
||||||
#define TABLE_SIZE 100
|
#define TABLE_SIZE 100
|
||||||
#define COLLATE_VERSION "1.0\n"
|
#define COLLATE_VERSION "1.0\n"
|
||||||
#define COLLATE_VERSION1_1 "1.1\n"
|
#define COLLATE_VERSION1_2 "1.2\n"
|
||||||
|
|
||||||
struct __collate_st_char_pri {
|
struct __collate_st_char_pri {
|
||||||
int prim, sec;
|
int prim, sec;
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
* is created, otherwise 1.
|
* is created, otherwise 1.
|
||||||
*/
|
*/
|
||||||
#undef __FreeBSD_version
|
#undef __FreeBSD_version
|
||||||
#define __FreeBSD_version 600017 /* Master, propagated to newvers */
|
#define __FreeBSD_version 600018 /* Master, propagated to newvers */
|
||||||
|
|
||||||
#ifndef LOCORE
|
#ifndef LOCORE
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -58,7 +58,7 @@ u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
|
|||||||
struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
|
struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
|
||||||
struct __collate_st_chain_pri *__collate_chain_pri_table;
|
struct __collate_st_chain_pri *__collate_chain_pri_table;
|
||||||
|
|
||||||
int chain_index;
|
int chain_index = 0;
|
||||||
int prim_pri = 1, sec_pri = 1;
|
int prim_pri = 1, sec_pri = 1;
|
||||||
#ifdef COLLATE_DEBUG
|
#ifdef COLLATE_DEBUG
|
||||||
int debug;
|
int debug;
|
||||||
@ -122,11 +122,15 @@ order : ORDER order_list {
|
|||||||
sizeof(__collate_chain_pri_table[0]));
|
sizeof(__collate_chain_pri_table[0]));
|
||||||
chain_index++;
|
chain_index++;
|
||||||
|
|
||||||
|
#ifdef COLLATE_DEBUG
|
||||||
|
if (debug)
|
||||||
|
collate_print_tables();
|
||||||
|
#endif
|
||||||
if ((fp = fopen(out_file, "w")) == NULL)
|
if ((fp = fopen(out_file, "w")) == NULL)
|
||||||
err(EX_UNAVAILABLE, "can't open destination file %s",
|
err(EX_UNAVAILABLE, "can't open destination file %s",
|
||||||
out_file);
|
out_file);
|
||||||
|
|
||||||
strcpy(__collate_version, COLLATE_VERSION1_1);
|
strcpy(__collate_version, COLLATE_VERSION1_2);
|
||||||
if (fwrite(__collate_version, sizeof(__collate_version), 1, fp) != 1)
|
if (fwrite(__collate_version, sizeof(__collate_version), 1, fp) != 1)
|
||||||
err(EX_IOERR,
|
err(EX_IOERR,
|
||||||
"IO error writting collate version to destination file %s",
|
"IO error writting collate version to destination file %s",
|
||||||
@ -141,11 +145,23 @@ order : ORDER order_list {
|
|||||||
err(EX_IOERR,
|
err(EX_IOERR,
|
||||||
"IO error writting substitute table to destination file %s",
|
"IO error writting substitute table to destination file %s",
|
||||||
out_file);
|
out_file);
|
||||||
|
for (ch = 0; ch < UCHAR_MAX + 1; ch++) {
|
||||||
|
__collate_char_pri_table[ch].prim =
|
||||||
|
htonl(__collate_char_pri_table[ch].prim);
|
||||||
|
__collate_char_pri_table[ch].sec =
|
||||||
|
htonl(__collate_char_pri_table[ch].sec);
|
||||||
|
}
|
||||||
if (fwrite(__collate_char_pri_table,
|
if (fwrite(__collate_char_pri_table,
|
||||||
sizeof(__collate_char_pri_table), 1, fp) != 1)
|
sizeof(__collate_char_pri_table), 1, fp) != 1)
|
||||||
err(EX_IOERR,
|
err(EX_IOERR,
|
||||||
"IO error writting char table to destination file %s",
|
"IO error writting char table to destination file %s",
|
||||||
out_file);
|
out_file);
|
||||||
|
for (ch = 0; ch < chain_index; ch++) {
|
||||||
|
__collate_chain_pri_table[ch].prim =
|
||||||
|
htonl(__collate_chain_pri_table[ch].prim);
|
||||||
|
__collate_chain_pri_table[ch].sec =
|
||||||
|
htonl(__collate_chain_pri_table[ch].sec);
|
||||||
|
}
|
||||||
if (fwrite(__collate_chain_pri_table,
|
if (fwrite(__collate_chain_pri_table,
|
||||||
sizeof(*__collate_chain_pri_table), chain_index, fp) !=
|
sizeof(*__collate_chain_pri_table), chain_index, fp) !=
|
||||||
(size_t)chain_index)
|
(size_t)chain_index)
|
||||||
@ -155,10 +171,6 @@ order : ORDER order_list {
|
|||||||
if (fclose(fp) != 0)
|
if (fclose(fp) != 0)
|
||||||
err(EX_IOERR, "IO error closing destination file %s",
|
err(EX_IOERR, "IO error closing destination file %s",
|
||||||
out_file);
|
out_file);
|
||||||
#ifdef COLLATE_DEBUG
|
|
||||||
if (debug)
|
|
||||||
collate_print_tables();
|
|
||||||
#endif
|
|
||||||
exit(EX_OK);
|
exit(EX_OK);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -351,7 +363,6 @@ static void
|
|||||||
collate_print_tables(void)
|
collate_print_tables(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct __collate_st_chain_pri *p2;
|
|
||||||
|
|
||||||
printf("Substitute table:\n");
|
printf("Substitute table:\n");
|
||||||
for (i = 0; i < UCHAR_MAX + 1; i++)
|
for (i = 0; i < UCHAR_MAX + 1; i++)
|
||||||
@ -359,8 +370,11 @@ collate_print_tables(void)
|
|||||||
printf("\t'%c' --> \"%s\"\n", i,
|
printf("\t'%c' --> \"%s\"\n", i,
|
||||||
__collate_substitute_table[i]);
|
__collate_substitute_table[i]);
|
||||||
printf("Chain priority table:\n");
|
printf("Chain priority table:\n");
|
||||||
for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++)
|
for (i = 0; i < chain_index - 1; i++)
|
||||||
printf("\t\"%s\" : %d %d\n", p2->str, p2->prim, p2->sec);
|
printf("\t\"%s\" : %d %d\n",
|
||||||
|
__collate_chain_pri_table[i].str,
|
||||||
|
__collate_chain_pri_table[i].prim,
|
||||||
|
__collate_chain_pri_table[i].sec);
|
||||||
printf("Char priority table:\n");
|
printf("Char priority table:\n");
|
||||||
for (i = 0; i < UCHAR_MAX + 1; i++)
|
for (i = 0; i < UCHAR_MAX + 1; i++)
|
||||||
printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
|
printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
|
||||||
|
Loading…
Reference in New Issue
Block a user