/* Convert text in given files from the specified from-set to the to-set.
- Copyright (C) 1998-2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <argp.h>
#include <assert.h>
static const struct argp_option options[] =
{
{ NULL, 0, NULL, 0, N_("Input/Output format specification:") },
- { "from-code", 'f', "NAME", 0, N_("encoding of original text") },
- { "to-code", 't', "NAME", 0, N_("encoding for output") },
+ { "from-code", 'f', N_("NAME"), 0, N_("encoding of original text") },
+ { "to-code", 't', N_("NAME"), 0, N_("encoding for output") },
{ NULL, 0, NULL, 0, N_("Information:") },
{ "list", 'l', NULL, 0, N_("list all known coded character sets") },
{ NULL, 0, NULL, 0, N_("Output control:") },
{ NULL, 'c', NULL, 0, N_("omit invalid characters from output") },
- { "output", 'o', "FILE", 0, N_("output file") },
+ { "output", 'o', N_("FILE"), 0, N_("output file") },
{ "silent", 's', NULL, 0, N_("suppress warnings") },
{ "verbose", OPT_VERBOSE, NULL, 0, N_("print progress information") },
{ NULL, 0, NULL, 0, NULL }
/* File to write output to. If NULL write to stdout. */
static const char *output_file;
-/* Nonzero if verbose ouput is wanted. */
-int verbose;
-
/* Nonzero if list of all coded character sets is wanted. */
static int list;
const char *output_file);
static int process_file (iconv_t cd, FILE *input, FILE **output,
const char *output_file);
-static void print_known_names (void) internal_function;
+static void print_known_names (void);
int
if (*errhand == '/')
{
--nslash;
- errhand = strchrnul (errhand, '/');
+ errhand = strchrnul (errhand + 1, '/');
if (*errhand == '/')
{
do
{
#ifdef _POSIX_MAPPED_FILES
- struct stat st;
+ struct stat64 st;
char *addr;
#endif
int fd, ret;
#ifdef _POSIX_MAPPED_FILES
/* We have possibilities for reading the input file. First try
to mmap() it since this will provide the fastest solution. */
- if (fstat (fd, &st) == 0
+ if (fstat64 (fd, &st) == 0
&& ((addr = mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE,
fd, 0)) != MAP_FAILED))
{
static char *
more_help (int key, const char *text, void *input)
{
+ char *tp = NULL;
switch (key)
{
case ARGP_KEY_HELP_EXTRA:
/* We print some extra information. */
- return strdup (gettext ("\
+ if (asprintf (&tp, gettext ("\
For bug reporting instructions, please see:\n\
-<http://www.gnu.org/software/libc/bugs.html>.\n"));
+%s.\n"), REPORT_BUGS_TO) < 0)
+ return NULL;
+ return tp;
default:
break;
}
static void
print_version (FILE *stream, struct argp_state *state)
{
- fprintf (stream, "iconv (GNU %s) %s\n", PACKAGE, VERSION);
+ fprintf (stream, "iconv %s%s\n", PKGVERSION, VERSION);
fprintf (stream, gettext ("\
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2010");
+"), "2019");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
}
static void
-internal_function
add_known_names (struct gconv_module *node)
{
if (node->left != NULL)
add_known_names (node->right);
do
{
- if (strcmp (node->from_string, "INTERNAL"))
- tsearch (node->from_string, &printlist,
- (__compar_fn_t) strverscmp);
+ if (strcmp (node->from_string, "INTERNAL") != 0)
+ tsearch (node->from_string, &printlist, (__compar_fn_t) strverscmp);
if (strcmp (node->to_string, "INTERNAL") != 0)
tsearch (node->to_string, &printlist, (__compar_fn_t) strverscmp);
static void
-internal_function
print_known_names (void)
{
iconv_t h;
if (human_readable)
fputs (_("\
-The following list contain all the coded character sets known. This does\n\
+The following list contains all the coded character sets known. This does\n\
not necessarily mean that all combinations of these names can be used for\n\
the FROM and TO command line parameters. One coded character set can be\n\
listed with several different names (aliases).\n\n "), stdout);