]>
Dogcows Code - chaz/tar/blob - lib/print-copyr.c
1 /* copysym.c -- Return a copyright symbol suitable for the current locale.
2 Copyright (C) 2001 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Written by Paul Eggert. */
34 /* Store into BUF (of size BUFSIZE) a representation of the copyright
35 symbol (C-in-a-circle) that is a valid text string for the current
36 locale. Return BUF if successful, and a pointer to some other
40 copyright_symbol (char *buf
, size_t bufsize
)
43 char const *outcharset
= getenv ("OUTPUT_CHARSET");
45 if (! (outcharset
&& *outcharset
))
47 extern char const *locale_charset (void);
48 outcharset
= locale_charset ();
53 iconv_t conv
= iconv_open (outcharset
, "UTF-8");
55 if (conv
!= (iconv_t
) -1)
57 static char const copyright_utf_8
[] = "\302\251";
58 char ICONV_CONST
*inptr
= (char ICONV_CONST
*) ©right_utf_8
;
59 size_t inleft
= sizeof copyright_utf_8
;
61 size_t chars
= iconv (conv
, &inptr
, &inleft
, &outptr
, &bufsize
);
65 if (chars
!= (size_t) -1)
71 /* "(C)" is the best we can do in ASCII. */
This page took 0.038682 seconds and 4 git commands to generate.