]>
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. */
29 # if ! USE_INCLUDED_LIBINTL && HAVE_LANGINFO_CODESET
30 # include <langinfo.h>
40 /* Store into BUF (of size BUFSIZE) a representation of the copyright
41 symbol (C-in-a-circle) that is a valid text string for the current
42 locale. Return BUF if successful, and a pointer to some other
46 copyright_symbol (char *buf
, size_t bufsize
)
49 char const *outcharset
= getenv ("OUTPUT_CHARSET");
51 if (! (outcharset
&& *outcharset
))
53 #if USE_INCLUDED_LIBINTL
54 extern char const *locale_charset (void);
55 outcharset
= locale_charset ();
57 # if HAVE_LANGINFO_CODESET
58 outcharset
= nl_langinfo (CODESET
);
65 iconv_t conv
= iconv_open (outcharset
, "UTF-8");
67 if (conv
!= (iconv_t
) -1)
69 static char const copyright_utf_8
[] = "\302\251";
70 char ICONV_CONST
*inptr
= (char ICONV_CONST
*) ©right_utf_8
;
71 size_t inleft
= sizeof copyright_utf_8
;
73 size_t chars
= iconv (conv
, &inptr
, &inleft
, &outptr
, &bufsize
);
77 if (chars
!= (size_t) -1)
83 /* "(C)" is the best we can do in ASCII. */
This page took 0.044011 seconds and 5 git commands to generate.