mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-27 05:00:15 +00:00
30891f35fa
We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
78 lines
1.4 KiB
C
78 lines
1.4 KiB
C
#include <errno.h>
|
|
#include <iconv.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#define UCS_STR "\x4e\x8c" /* EUC-TW 0xa2a2, EUC-JP 0x */
|
|
|
|
static const char *to_code;
|
|
|
|
static bool
|
|
xiconv (iconv_t cd, int out_size)
|
|
{
|
|
unsigned char euc[4];
|
|
char *inp = (char *) UCS_STR;
|
|
char *outp = (char *) euc;
|
|
size_t inbytesleft = strlen (UCS_STR);
|
|
size_t outbytesleft = out_size;
|
|
size_t ret;
|
|
bool fail = false;
|
|
|
|
errno = 0;
|
|
ret = iconv (cd, &inp, &inbytesleft, &outp, &outbytesleft);
|
|
if (errno || ret == (size_t) -1)
|
|
{
|
|
fail = out_size == 4 || errno != E2BIG;
|
|
printf ("expected %d (E2BIG), got %d (%m)\n", E2BIG, errno);
|
|
}
|
|
else
|
|
{
|
|
printf ("%s: 0x%02x%02x\n", to_code, euc[0], euc[1]);
|
|
if (out_size == 1)
|
|
fail = true;
|
|
}
|
|
|
|
return fail;
|
|
}
|
|
|
|
|
|
static iconv_t
|
|
xiconv_open (const char *code)
|
|
{
|
|
iconv_t cd;
|
|
to_code = code;
|
|
errno = 0;
|
|
if (errno || (cd = iconv_open (to_code, "UCS-2BE")) == (iconv_t) -1)
|
|
{
|
|
puts ("Can't open converter");
|
|
exit (1);
|
|
}
|
|
return cd;
|
|
}
|
|
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
iconv_t cd;
|
|
int result = 0;
|
|
|
|
cd = xiconv_open ("EUC-TW");
|
|
result |= xiconv (cd, 4) == true;
|
|
puts ("---");
|
|
result |= xiconv (cd, 1) == true;
|
|
puts ("---");
|
|
iconv_close (cd);
|
|
|
|
cd = xiconv_open ("EUC-JP");
|
|
result |= xiconv (cd, 4) == true;
|
|
puts ("---");
|
|
result |= xiconv (cd, 1) == true;
|
|
puts ("---");
|
|
iconv_close (cd);
|
|
|
|
return result;
|
|
}
|