public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Deprecate ,ccs= parameter for fopen
@ 2018-06-15  6:41 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2018-06-15  6:41 UTC (permalink / raw)
  To: GNU C Library; +Cc: Arjun Shankar

I suggest that we deprecate the ,ccs= parameter for fopen, and 
eventually disable it for new programs.

The benefit of doing that is that in the future, statically linked 
programs calling fopen will not have to link in the gconv machinery 
(which, currently, includes the dynamic loader).

Instead, I would like to see a function like this one:

   int fwide_charset (FILE *fp, const char *charset, unsigned int flags);

Mark the stream FP as wide-character orientation, and set the external 
file encoding to CHARSET.  CHARSET must be a character set name as used 
by the iconv_open function.  The FLAGS argument is for future extension 
and must currently be specified as zero.

Return value: 0 on success, -1 on error.  Error codes:

EINVAL   flags is not zero.
EBUSY    The stream is already wide-oriented or narrow-oriented.


I propose to add the FLAGS argument right away.  We eventually want to 
specify error handling both on input and output (error, ignore, 
replacement character) and transliteration, but this requires 
gconv/iconv cleanups which do not currently exist.

With a separate fwide_charset function, only that function and the 
wide-character stream functions will pull in the gconv implementation 
(which still we be a bit clunky even if we no longer need the dynamic 
loader as part of it).

Comments?

Thanks,
Florian

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-15  6:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15  6:41 Deprecate ,ccs= parameter for fopen Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).