glibc/locale/programs/locfile.c
Ulrich Drepper 601d294296 Update.
2001-06-04  Bruno Haible  <haible@clisp.cons.org>

	* iconv/loop.c (UNICODE_TAG_HANDLER): New macro.
	* iconv/gconv_simple.c (__gconv_transform_internal_ascii): Invoke
	UNICODE_TAG_HANDLER.
	(__gconv_transform_internal_ucs2): Likewise.
	(__gconv_transform_internal_ucs2reverse): Likewise.
	* iconvdata/8bit-gap.c (BODY for TO_LOOP): Invoke UNICODE_TAG_HANDLER.
	* iconvdata/8bit-generic.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ansi_x3.110.c (BODY for TO_LOOP): Likewise.
	* iconvdata/big5.c (BODY for TO_LOOP): Likewise.
	* iconvdata/big5hkscs.c (BODY for TO_LOOP): Likewise.
	* iconvdata/cp1255.c (BODY for TO_LOOP): Likewise.
	* iconvdata/cp1258.c (BODY for TO_LOOP): Likewise.
	* iconvdata/euc-cn.c (BODY for TO_LOOP): Likewise.
	* iconvdata/euc-jp.c (BODY for TO_LOOP): Likewise.
	* iconvdata/euc-kr.c (BODY for TO_LOOP): Likewise.
	* iconvdata/euc-tw.c (BODY for TO_LOOP): Likewise.
	* iconvdata/gbk.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm930.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm932.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm933.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm935.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm937.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm939.c (BODY for TO_LOOP): Likewise.
	* iconvdata/ibm943.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso646.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso8859-1.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso_6937.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso_6937-2.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso-2022-cn.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso-2022-cn-ext.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso-2022-kr.c (BODY for TO_LOOP): Likewise.
	* iconvdata/johab.c (BODY for TO_LOOP): Likewise.
	* iconvdata/sjis.c (BODY for TO_LOOP): Likewise.
	* iconvdata/t.61.c (BODY for TO_LOOP): Likewise.
	* iconvdata/uhc.c (BODY for TO_LOOP): Likewise.
	* iconvdata/unicode.c (BODY for TO_LOOP): Likewise.
	* iconvdata/iso-2022-jp.c (TAG_none, TAG_language, TAG_language_j,
	TAG_language_ja, TAG_language_k, TAG_language_ko, TAG_language_z,
	TAG_language_zh, CURRENT_TAG_MASK): New enum values.
	(EMIT_SHIFT_TO_INIT): Don't emit an escape sequence if ASCII_set
	is already selected but set2 or tag are set.
	(conversion): New enum type.
	(cvlist_t): New type.
	(CVLIST, CVLIST_FIRST, CVLIST_REST): New macros.
	(conversion_lists): New array.
	(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja",
	prefer conversion to Japanese character sets. If "zh", prefer
	conversion to GB2312. If "ko", prefer conversion to KSC5601. Small
	optimizations.
	(INIT_PARAMS): Add tag.
	(UPDATE_PARAMS): Add tag.

2001-06-04  Bruno Haible  <haible@clisp.cons.org>

	* locale/programs/locfile.c (write_locale_data): Before creat(),
	unlink the file, to avoid crashing the processes that mmap it.  Change
	a double slash to a single slash.  Free fname in case of error return.

2001-06-02  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/i386/fpu/s_frexpl.S (__frexpl): Mostly revert 2000-12-03
	changes, do the special handling for denormal numbers, not for
	normalized numbers (patch by <trevin@xmission.com>).

	* math/test-misc.c (main): Test frexpl with denormal arguments.

2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* math/libm-test.inc (llround_test): Add two new llround tests.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Don't allow
	overflow when rounding away from zero.

2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* math/Makefile (libm-calls): Add e_log2, w_log2, remove s_log2.
	* math/math_private.h (__ieee754_log2, __ieee754_log2f,
	__ieee754_log2l): New prototypes.
	* sysdeps/generic/w_log2.c: New file.
	* sysdeps/generic/w_log2f.c: New file.
	* sysdeps/generic/w_log2l.c: New file.
	* sysdeps/generic/s_log2l.c: Move...
	* sysdeps/generic/e_log2l.c: ...to here. Rename to __ieee754_log2l.
	* sysdeps/ieee754/k_standard.c (__kernel_standard): Handle log2(0)
	and log2(x < 0).
	* sysdeps/i386/fpu/s_log2.S: Move...
	* sysdeps/i386/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
	* sysdeps/i386/fpu/s_log2f.S: Move...
	* sysdeps/i386/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
	* sysdeps/i386/fpu/s_log2l.S: Move...
	* sysdeps/i386/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
	* sysdeps/m68k/fpu/s_log2.S: Move...
	* sysdeps/m68k/fpu/e_log2.S: ...to here. Rename to __ieee754_log2.
	* sysdeps/m68k/fpu/s_log2f.S: Move...
	* sysdeps/m68k/fpu/e_log2f.S: ...to here. Rename to __ieee754_log2f.
	* sysdeps/m68k/fpu/s_log2l.S: Move...
	* sysdeps/m68k/fpu/e_log2l.S: ...to here. Rename to __ieee754_log2l.
	* sysdeps/ieee754/dbl-64/s_log2.c: Move...
	* sysdeps/ieee754/dbl-64/e_log2.c: ...to here. Rename to
	__ieee754_log2.
	* sysdeps/ieee754/flt-32/s_log2f.c: Move...
	* sysdeps/ieee754/flt-32/e_log2f.c: ...to here. Rename to
	__ieee754_log2f.

2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/w_exp2.c (u_threshold): Lower threshold so that
	even arguments which result in denormalized exp2 are accepted.
	(__exp2): Arguments equal to u_threshold already result into
	underflow.
	* sysdeps/generic/w_exp2f.c (u_threshold, __exp2f): Likewise.
	* sysdeps/generic/w_exp2l.c (u_threshold, __exp2l): Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Lomark was too
	low, with corrected lowmark use greaterequal, not greater.
	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.

2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* math/libm-test.inc (ilogb_test): Test that ilogb(+-Inf) == INT_MAX.
	* sysdeps/i386/fpu/s_ilogb.S (__ilogb): Return INT_MAX for +-Inf.
	* sysdeps/i386/fpu/s_ilogbf.S (__ilogbf): Likewise.
	* sysdeps/i386/fpu/s_ilogbl.S (__ilogbl): Likewise.
	* sysdeps/ieee754/dbl-64/s_ilogb.c (__ilogb): Likewise.
	* sysdeps/ieee754/flt-32/s_ilogbf.c (__ilogbf): Likewise.
	* sysdeps/ieee754/ldbl-128/s_ilogbl.c (__ilogbl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Likewise.

2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/w_coshl.c (__coshl): Test if finite argument
	gave non-finite result instead of using constant in generic
	version.
	* sysdeps/generic/w_coshf.c (__coshf): Likewise.
	* sysdeps/generic/w_cosh.c (__cosh): Likewise.
	* sysdeps/generic/w_exp10.c (o_threshold, u_threshold): Remove.
	(__exp10): Test if finite argument gave non-finite result.
	* sysdeps/generic/w_exp10f.c (o_threshold, u_threshold, __exp10f):
	Likewise.
	* sysdeps/generic/w_exp10l.c (o_threshold, u_threshold, __exp10l):
	Likewise.
2001-06-04  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Fix
	overflow threshold constant (log(LDBL_MAX)+M_LN2l).

2001-05-29  Bruno Haible  <haible@clisp.cons.org>

	* locale/programs/ld-ctype.c (idx_table): New struct type.
	(idx_table_init, idx_table_get, idx_table_add): New functions.
	(MAX_CHARNAMES_IDX): Remove macro.
	(locale_ctype_t): Change type of charnames_idx field.
	(ctype_startup): Change initialization of charnames_idx field.
	(find_idx): Use idx_table_get and idx_table_add for speed.

	* locale/programs/charmap.c (charmap_new_char): Fix ucs4 value
	computation of characters in a range.

2001-05-29  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/gb18030.c (__fourbyte_to_ucs1): Add mappings for <U03F4>,
	<U03F5>.
	(__ucs_to_gb18030_tab1): Likewise.
	(BODY for FROM_LOOP): Add mapping for <U00010000>..<U0010FFFF>.
	(BODY for TO_LOOP): Likewise.
	* iconvdata/tst-table-charmap.sh: Update for charmaps containing
	<U00xxxxxx> syntax.
	* iconvdata/tst-table-from.c (bmp_only): New variable.
	(utf8_decode): If bmp_only, don't return characters outside Unicode
	plane 0.
	(main): When testing UTF-8 or GB18030, set bmp_only to 1. Don't print
	a conversion line if utf8_decode returns NULL.
	* iconvdata/tst-table-to.c (main): When testing encodings other than
	UTF-8 and GB18030, loop upto U+30000 instead of U+10000. Use UTF-8
	instead of UCS-2 as input.
	* iconvdata/tst-table.sh: For GB18030, use only the part < 0x10000
	of the charmap.

2001-05-29  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/cns11643l1.c: Update to Unicode 3.1.
	(__cns11643l1_to_ucs4_tab): Regenerated.
	(__cns11643l1_from_ucs4_tab12): Regenerated.
	* iconvdata/cns11643.c: Update to Unicode 3.1.
	(__cns11643l14_to_ucs4_tab): Remove array.
	(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
	__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
	__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New arrays.
	(__cns11643_from_ucs4p0_tab): Renamed from __cns11643_from_ucs4_tab.
	(__cns11643_from_ucs4p2_tab): New array.
	* iconvdata/cns11643.h (__cns11643l14_to_ucs4_tab): Remove declaration.
	(__cns11643l3_to_ucs4_tab, __cns11643l4_to_ucs4_tab,
	__cns11643l5_to_ucs4_tab, __cns11643l6_to_ucs4_tab,
	__cns11643l7_to_ucs4_tab, __cns11643l15_to_ucs4_tab): New declarations.
	(cns11643_to_ucs4): Treat planes 3, 4, 5, 6, 7, 15 instead of 14.
	(__cns11643_from_ucs4_tab): Remove declaration.
	(__cns11643_from_ucs4p0_tab, __cns11643_from_ucs4p2_tab): New
	declarations.
	(ucs4_to_cns11643): Update for new arrays. Treat U+3400..U+4DFF and
	U+20000..U+2A6D6.
	* iconvdata/cns11643l2.h (__cns11643_from_ucs4_tab): Remove
	declaration.
	(__cns11643_from_ucs4p0_tab): New declaration.
	(ucs4_to_cns11643l2): Update for new arrays.
	* iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Handle planes
	3 to 7.
	(BODY for TO_LOOP): Handle planes 3 to 7, instead of plane 14.
	* iconvdata/EUC-TW.irreversible: New file.
	* iconvdata/tst-table.sh: Use it.
	* iconvdata/Makefile (distribute): Add CP1255.irreversible,
	CP1258.irreversible, EUC-TW.irreversible.

2001-05-29  Bruno Haible  <haible@clisp.cons.org>

	* locale/C-translit.h.in: Add transliterations for new Unicode 3.1
	mathematical symbols.
2001-06-06 12:55:46 +00:00

419 lines
11 KiB
C

/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/stat.h>
#include "localedef.h"
#include "locfile.h"
#include "locfile-kw.h"
int
locfile_read (struct localedef_t *result, struct charmap_t *charmap)
{
const char *filename = result->name;
const char *repertoire_name = result->repertoire_name;
int locale_mask = result->needed ^ result->avail;
struct linereader *ldfile;
int not_here = ALL_LOCALES;
/* If no repertoire name was specified use the global one. */
if (repertoire_name == NULL)
repertoire_name = repertoire_global;
/* Open the locale definition file. */
ldfile = lr_open (filename, locfile_hash);
if (ldfile == NULL)
{
if (filename != NULL && filename[0] != '/')
{
char *i18npath = getenv ("I18NPATH");
if (i18npath != NULL && *i18npath != '\0')
{
char path[strlen (filename) + 1 + strlen (i18npath)
+ sizeof ("/locales/") - 1];
char *next;
i18npath = strdupa (i18npath);
while (ldfile == NULL
&& (next = strsep (&i18npath, ":")) != NULL)
{
stpcpy (stpcpy (stpcpy (path, next), "/locales/"), filename);
ldfile = lr_open (path, locfile_hash);
if (ldfile == NULL)
{
stpcpy (stpcpy (path, next), filename);
ldfile = lr_open (path, locfile_hash);
}
}
}
/* Test in the default directory. */
if (ldfile == NULL)
{
char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)];
stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename);
ldfile = lr_open (path, locfile_hash);
}
}
if (ldfile == NULL)
return 1;
}
/* Parse locale definition file and store result in RESULT. */
while (1)
{
struct token *now = lr_token (ldfile, charmap, NULL, verbose);
enum token_t nowtok = now->tok;
struct token *arg;
if (nowtok == tok_eof)
break;
if (nowtok == tok_eol)
/* Ignore empty lines. */
continue;
switch (nowtok)
{
case tok_escape_char:
case tok_comment_char:
/* We need an argument. */
arg = lr_token (ldfile, charmap, NULL, verbose);
if (arg->tok != tok_ident)
{
SYNTAX_ERROR (_("bad argument"));
continue;
}
if (arg->val.str.lenmb != 1)
{
lr_error (ldfile, _("\
argument to `%s' must be a single character"),
nowtok == tok_escape_char
? "escape_char" : "comment_char");
lr_ignore_rest (ldfile, 0);
continue;
}
if (nowtok == tok_escape_char)
ldfile->escape_char = *arg->val.str.startmb;
else
ldfile->comment_char = *arg->val.str.startmb;
break;
case tok_repertoiremap:
/* We need an argument. */
arg = lr_token (ldfile, charmap, NULL, verbose);
if (arg->tok != tok_ident)
{
SYNTAX_ERROR (_("bad argument"));
continue;
}
if (repertoire_name == NULL)
{
repertoire_name = memcpy (xmalloc (arg->val.str.lenmb + 1),
arg->val.str.startmb,
arg->val.str.lenmb);
((char *) repertoire_name)[arg->val.str.lenmb] = '\0';
}
break;
case tok_lc_ctype:
ctype_read (ldfile, result, charmap, repertoire_name,
(locale_mask & CTYPE_LOCALE) == 0);
result->avail |= locale_mask & CTYPE_LOCALE;
not_here ^= CTYPE_LOCALE;
continue;
case tok_lc_collate:
collate_read (ldfile, result, charmap, repertoire_name,
(locale_mask & COLLATE_LOCALE) == 0);
result->avail |= locale_mask & COLLATE_LOCALE;
not_here ^= COLLATE_LOCALE;
continue;
case tok_lc_monetary:
monetary_read (ldfile, result, charmap, repertoire_name,
(locale_mask & MONETARY_LOCALE) == 0);
result->avail |= locale_mask & MONETARY_LOCALE;
not_here ^= MONETARY_LOCALE;
continue;
case tok_lc_numeric:
numeric_read (ldfile, result, charmap, repertoire_name,
(locale_mask & NUMERIC_LOCALE) == 0);
result->avail |= locale_mask & NUMERIC_LOCALE;
not_here ^= NUMERIC_LOCALE;
continue;
case tok_lc_time:
time_read (ldfile, result, charmap, repertoire_name,
(locale_mask & TIME_LOCALE) == 0);
result->avail |= locale_mask & TIME_LOCALE;
not_here ^= TIME_LOCALE;
continue;
case tok_lc_messages:
messages_read (ldfile, result, charmap, repertoire_name,
(locale_mask & MESSAGES_LOCALE) == 0);
result->avail |= locale_mask & MESSAGES_LOCALE;
not_here ^= MESSAGES_LOCALE;
continue;
case tok_lc_paper:
paper_read (ldfile, result, charmap, repertoire_name,
(locale_mask & PAPER_LOCALE) == 0);
result->avail |= locale_mask & PAPER_LOCALE;
not_here ^= PAPER_LOCALE;
continue;
case tok_lc_name:
name_read (ldfile, result, charmap, repertoire_name,
(locale_mask & NAME_LOCALE) == 0);
result->avail |= locale_mask & NAME_LOCALE;
not_here ^= NAME_LOCALE;
continue;
case tok_lc_address:
address_read (ldfile, result, charmap, repertoire_name,
(locale_mask & ADDRESS_LOCALE) == 0);
result->avail |= locale_mask & ADDRESS_LOCALE;
not_here ^= ADDRESS_LOCALE;
continue;
case tok_lc_telephone:
telephone_read (ldfile, result, charmap, repertoire_name,
(locale_mask & TELEPHONE_LOCALE) == 0);
result->avail |= locale_mask & TELEPHONE_LOCALE;
not_here ^= TELEPHONE_LOCALE;
continue;
case tok_lc_measurement:
measurement_read (ldfile, result, charmap, repertoire_name,
(locale_mask & MEASUREMENT_LOCALE) == 0);
result->avail |= locale_mask & MEASUREMENT_LOCALE;
not_here ^= MEASUREMENT_LOCALE;
continue;
case tok_lc_identification:
identification_read (ldfile, result, charmap, repertoire_name,
(locale_mask & IDENTIFICATION_LOCALE) == 0);
result->avail |= locale_mask & IDENTIFICATION_LOCALE;
not_here ^= IDENTIFICATION_LOCALE;
continue;
default:
SYNTAX_ERROR (_("\
syntax error: not inside a locale definition section"));
continue;
}
/* The rest of the line must be empty. */
lr_ignore_rest (ldfile, 1);
}
/* We read all of the file. */
lr_close (ldfile);
/* Mark the categories which are not contained in the file. We assume
them to be available and the default data will be used. */
result->avail |= not_here;
return 0;
}
static void (*const check_funcs[]) (struct localedef_t *,
struct charmap_t *) =
{
[LC_CTYPE] = ctype_finish,
[LC_COLLATE] = collate_finish,
[LC_MESSAGES] = messages_finish,
[LC_MONETARY] = monetary_finish,
[LC_NUMERIC] = numeric_finish,
[LC_TIME] = time_finish,
[LC_PAPER] = paper_finish,
[LC_NAME] = name_finish,
[LC_ADDRESS] = address_finish,
[LC_TELEPHONE] = telephone_finish,
[LC_MEASUREMENT] = measurement_finish,
[LC_IDENTIFICATION] = identification_finish
};
void
check_all_categories (struct localedef_t *definitions,
struct charmap_t *charmap)
{
int cnt;
for (cnt = 0; cnt < sizeof (check_funcs) / sizeof (check_funcs[0]); ++cnt)
if (check_funcs[cnt] != NULL)
check_funcs[cnt] (definitions, charmap);
}
static void (*const write_funcs[]) (struct localedef_t *, struct charmap_t *,
const char *) =
{
[LC_CTYPE] = ctype_output,
[LC_COLLATE] = collate_output,
[LC_MESSAGES] = messages_output,
[LC_MONETARY] = monetary_output,
[LC_NUMERIC] = numeric_output,
[LC_TIME] = time_output,
[LC_PAPER] = paper_output,
[LC_NAME] = name_output,
[LC_ADDRESS] = address_output,
[LC_TELEPHONE] = telephone_output,
[LC_MEASUREMENT] = measurement_output,
[LC_IDENTIFICATION] = identification_output
};
void
write_all_categories (struct localedef_t *definitions,
struct charmap_t *charmap,
const char *output_path)
{
int cnt;
for (cnt = 0; cnt < sizeof (write_funcs) / sizeof (write_funcs[0]); ++cnt)
if (write_funcs[cnt] != NULL)
write_funcs[cnt] (definitions, charmap, output_path);
}
void
write_locale_data (const char *output_path, const char *category,
size_t n_elem, struct iovec *vec)
{
size_t cnt, step, maxiov;
int fd;
char *fname;
fname = malloc (strlen (output_path) + 2 * strlen (category) + 7);
if (fname == NULL)
error (5, errno, _("memory exhausted"));
/* Normally we write to the directory pointed to by the OUTPUT_PATH.
But for LC_MESSAGES we have to take care for the translation
data. This means we need to have a directory LC_MESSAGES in
which we place the file under the name SYS_LC_MESSAGES. */
sprintf (fname, "%s%s", output_path, category);
fd = -2;
if (strcmp (category, "LC_MESSAGES") == 0)
{
struct stat st;
if (stat (fname, &st) < 0)
{
if (mkdir (fname, 0777) >= 0)
{
fd = -1;
errno = EISDIR;
}
}
else if (!S_ISREG (st.st_mode))
{
fd = -1;
errno = EISDIR;
}
}
/* Create the locale file with nlinks == 1; this avoids crashing processes
which currently use the locale. */
if (fd == -2)
{
unlink (fname);
fd = creat (fname, 0666);
}
if (fd == -1)
{
int save_err = errno;
if (errno == EISDIR)
{
sprintf (fname, "%1$s%2$s/SYS_%2$s", output_path, category);
unlink (fname);
fd = creat (fname, 0666);
if (fd == -1)
save_err = errno;
}
if (fd == -1)
{
if (!be_quiet)
error (0, save_err, _("\
cannot open output file `%s' for category `%s'"),
fname, category);
free (fname);
return;
}
}
free (fname);
#ifdef UIO_MAXIOV
maxiov = UIO_MAXIOV;
#else
maxiov = sysconf (_SC_UIO_MAXIOV);
#endif
/* Write the data using writev. But we must take care for the
limitation of the implementation. */
for (cnt = 0; cnt < n_elem; cnt += step)
{
step = n_elem - cnt;
if (maxiov > 0)
step = MIN (maxiov, step);
if (writev (fd, &vec[cnt], step) < 0)
{
if (!be_quiet)
error (0, errno, _("failure while writing data for category `%s'"),
category);
break;
}
}
close (fd);
}