Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

Location:
branches/GNU/src/binutils/intl
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/intl/ChangeLog

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     12002-08-05  Daniel Jacobowitz  <drow@mvista.com>
     2
     3        * Makefile.in (distclean): Remove config.cache, stamp-h,
     4        config.status, and config.h.
     5
     62002-01-21  Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
     7
     8        * linux-msg.sed: Comment typo fix.
     9        * xopen-msg.sed: Likewise.
     10
     111998-04-29  Ulrich Drepper  <drepper@cygnus.com>
     12
     13        * intl/localealias.c (read_alias_file): Use unsigned char for
     14        local variables.  Remove unused variable tp.
     15        * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
     16        for type of codeset.  For loosing Solaris systems.
     17        * intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset.
     18        * intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable
     19        len if not needed.
     20        Patches by Jim Meyering.
     21
     221998-04-28  Ulrich Drepper  <drepper@cygnus.com>
     23
     24        * loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if
     25        mmap is not supported.
     26
     27        * hash-string.h: Don't include <values.h>.
     28
     291998-04-27  Ulrich Drepper  <drepper@cygnus.com>
     30
     31        * textdomain.c: Use strdup is available.
     32
     33        * localealias.c: Define HAVE_MEMPCPY so that we can use this
     34        function.  Define and use semapahores to protect modfication of
     35        global objects when compiling for glibc.  Add code to allow
     36        freeing alias table.
     37
     38        * l10nflist.c: Don't assume stpcpy not being a macro.
     39
     40        * gettextP.h: Define internal_function macri if not already done.
     41        Use glibc byte-swap macros instead of defining SWAP when compiled
     42        for glibc.
     43        (struct loaded_domain): Add elements to allow unloading.
     44
     45        * Makefile.in (distclean): Don't remove libintl.h here.
     46
     47        * bindtextdomain.c: Carry over changes from glibc.  Use strdup if
     48        available.
     49
     50        * dcgettext.c: Don't assume stpcpy not being a macro.  Mark internal
     51        functions.  Add memory freeing code for glibc.
     52
     53        * dgettext.c: Update copyright.
     54
     55        * explodename.c: Include stdlib.h and string.h only if they exist.
     56        Use strings.h eventually.
     57
     58        * finddomain.c: Mark internal functions.  Use strdup if available.
     59        Add memory freeing code for glibc.
     60
     611997-10-10 20:00  Ulrich Drepper  <drepper@cygnus.com>
     62
     63        * libgettext.h: Fix dummy textdomain and bindtextdomain macros.
     64        They should return reasonable values.
     65        Reported by Tom Tromey <tromey@cygnus.com>.
     66
     671997-09-16 03:33  Ulrich Drepper  <drepper@cygnus.com>
     68
     69        * libgettext.h: Define PARAMS also to `args' if __cplusplus is defined.
     70        * intlh.inst.in: Likewise.
     71        Reported by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>.
     72
     73        * libintl.glibc: Update from current glibc version.
     74
    1751997-09-06 02:10  Ulrich Drepper  <drepper@cygnus.com>
    276
  • branches/GNU/src/binutils/intl/Makefile.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    174174distclean: clean
    175175        rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h config.log
     176        rm -f config.cache stamp-h config.status config.h
    176177
    177178maintainer-clean: distclean
  • branches/GNU/src/binutils/intl/bindtextdom.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Implementation of the bindtextdomain(3) function
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33
    44   This program is free software; you can redistribute it and/or modify
     
    6262#ifdef _LIBC
    6363# define BINDTEXTDOMAIN __bindtextdomain
    64 # define strdup(str) __strdup (str)
     64# ifndef strdup
     65#  define strdup(str) __strdup (str)
     66# endif
    6567#else
    6668# define BINDTEXTDOMAIN bindtextdomain__
     
    134136    {
    135137      /* We have to create a new binding.  */
     138#if !defined _LIBC && !defined HAVE_STRDUP
    136139      size_t len;
     140#endif
    137141      struct binding *new_binding =
    138142        (struct binding *) malloc (sizeof (*new_binding));
  • branches/GNU/src/binutils/intl/dcgettext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Implementation of the dcgettext(3) function
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Implementation of the dcgettext(3) function.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33
    44   This program is free software; you can redistribute it and/or modify
     
    9292   file and the name space must not be polluted.  */
    9393# define getcwd __getcwd
    94 # define stpcpy __stpcpy
     94# ifndef stpcpy
     95#  define stpcpy __stpcpy
     96# endif
    9597#else
    9698# if !defined HAVE_GETCWD
     
    163165/* Prototypes for local functions.  */
    164166static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
    165                                const char *msgid));
    166 static const char *category_to_name PARAMS ((int category));
     167                               const char *msgid)) internal_function;
     168static const char *category_to_name PARAMS ((int category)) internal_function;
    167169static const char *guess_category_value PARAMS ((int category,
    168                                                  const char *categoryname));
     170                                                 const char *categoryname))
     171     internal_function;
    169172
    170173
     
    389392
    390393static char *
     394internal_function
    391395find_msg (domain_file, msgid)
    392396     struct loaded_l10nfile *domain_file;
     
    477481/* Return string representation of locale CATEGORY.  */
    478482static const char *
     483internal_function
    479484category_to_name (category)
    480485     int category;
     
    536541/* Guess value of current locale from value of the environment variables.  */
    537542static const char *
     543internal_function
    538544guess_category_value (category, categoryname)
    539545     int category;
     
    592598}
    593599#endif
     600
     601
     602#ifdef _LIBC
     603/* If we want to free all resources we have to do some work at
     604   program's end.  */
     605static void __attribute__ ((unused))
     606free_mem (void)
     607{
     608  struct binding *runp;
     609
     610  for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
     611    {
     612      free (runp->domainname);
     613      if (runp->dirname != _nl_default_dirname)
     614        /* Yes, this is a pointer comparison.  */
     615        free (runp->dirname);
     616    }
     617
     618  if (_nl_current_default_domain != _nl_default_default_domain)
     619    /* Yes, again a pointer comparison.  */
     620    free ((char *) _nl_current_default_domain);
     621}
     622
     623text_set_element (__libc_subfreeres, free_mem);
     624#endif
  • branches/GNU/src/binutils/intl/dgettext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* dgettext.c -- implementation of the dgettext(3) function
    2    Copyright (C) 1995 Software Foundation, Inc.
     1/* Implementation of the dgettext(3) function
     2   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    33
    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)
    7 any later version.
     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)
     7   any later version.
    88
    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.
     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.
    1313
    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
    16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     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.  */
    1717
    1818#ifdef HAVE_CONFIG_H
  • branches/GNU/src/binutils/intl/explodename.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    22   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    33
     
    2020#endif
    2121
    22 #include <stdlib.h>
    23 #include <string.h>
     22#if defined STDC_HEADERS || defined _LIBC
     23# include <stdlib.h>
     24#endif
     25
     26#if defined HAVE_STRING_H || defined _LIBC
     27# include <string.h>
     28#else
     29# include <strings.h>
     30#endif
    2431#include <sys/types.h>
    2532
  • branches/GNU/src/binutils/intl/finddomain.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Handle list of needed message catalogs
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44
     
    7171   established bindings.  */
    7272struct loaded_l10nfile *
     73internal_function
    7374_nl_find_domain (dirname, locale, domainname)
    7475     const char *dirname;
     
    9697        language[_territory][+audience][+special][,[sponsor][_revision]]
    9798
    98      Beside the first all of them are allowed to be missing.  If the
    99      full specified locale is not found, the less specific one are
    100      looked for.  The various part will be stripped of according to
     99     Beside the first part all of them are allowed to be missing.  If
     100     the full specified locale is not found, the less specific one are
     101     looked for.  The various parts will be stripped off according to
    101102     the following order:
    102103                (1) revision
     
    143144  if (alias_value != NULL)
    144145    {
     146#if defined _LIBC || defined HAVE_STRDUP
     147      locale = strdup (alias_value);
     148      if (locale == NULL)
     149        return NULL;
     150#else
    145151      size_t len = strlen (alias_value) + 1;
    146152      locale = (char *) malloc (len);
     
    149155
    150156      memcpy (locale, alias_value, len);
     157#endif
    151158    }
    152159
     
    188195  return retval;
    189196}
     197
     198
     199#ifdef _LIBC
     200static void __attribute__ ((unused))
     201free_mem (void)
     202{
     203  struct loaded_l10nfile *runp = _nl_loaded_domains;
     204
     205  while (runp != NULL)
     206    {
     207      struct loaded_l10nfile *here = runp;
     208      if (runp->data != NULL)
     209        _nl_unload_domain ((struct loaded_domain *) runp->data);
     210      runp = runp->next;
     211      free (here);
     212    }
     213}
     214
     215text_set_element (__libc_subfreeres, free_mem);
     216#endif
  • branches/GNU/src/binutils/intl/gettext.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Implementation of gettext(3) function
     1/* Implementation of gettext(3) function.
    22   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
    33
  • branches/GNU/src/binutils/intl/gettext.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Internal header for GNU gettext internationalization functions
     1/* Internal header for GNU gettext internationalization functions.
    22   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
    33
  • branches/GNU/src/binutils/intl/gettextP.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Header describing internals of gettext library
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
     3   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    34
    45   This program is free software; you can redistribute it and/or modify
     
    3132#endif
    3233
     34#ifndef internal_function
     35# define internal_function
     36#endif
     37
    3338#ifndef W
    3439# define W(flag, data) ((flag) ? SWAP (data) : (data))
     
    3641
    3742
     43#ifdef _LIBC
     44# include <byteswap.h>
     45# define SWAP(i) bswap_32 (i)
     46#else
    3847static nls_uint32 SWAP PARAMS ((nls_uint32 i));
    3948
     
    4453  return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
    4554}
     55#endif
    4656
    4757
     
    4959{
    5060  const char *data;
     61  int use_mmap;
     62  size_t mmap_size;
    5163  int must_swap;
    5264  nls_uint32 nstrings;
     
    6678struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
    6779                                                 char *__locale,
    68                                                  const char *__domainname));
    69 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
     80                                                 const char *__domainname))
     81     internal_function;
     82void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
     83     internal_function;
     84void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
     85     internal_function;
    7086
    7187/* @@ begin of epilog @@ */
  • branches/GNU/src/binutils/intl/hash-string.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1616   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1717   Boston, MA 02111-1307, USA.  */
    18 
    19 #ifdef HAVE_VALUES_H
    20 # include <values.h>
    21 #endif
    2218
    2319/* @@ end of prolog @@ */
  • branches/GNU/src/binutils/intl/intlh.inst.in

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    2727
    2828#ifndef PARAMS
    29 # if __STDC__
     29# if __STDC__ || defined __cplusplus
    3030#  define PARAMS(args) args
    3131# else
  • branches/GNU/src/binutils/intl/l10nflist.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Handle list of needed message catalogs
    22   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    3    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
     3   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44
    55   This program is free software; you can redistribute it and/or modify
     
    6666   because some ANSI C functions will require linking with this object
    6767   file and the name space must not be polluted.  */
    68 # define stpcpy(dest, src) __stpcpy(dest, src)
     68# ifndef stpcpy
     69#  define stpcpy(dest, src) __stpcpy(dest, src)
     70# endif
    6971#else
    7072# ifndef HAVE_STPCPY
     
    353355const char *
    354356_nl_normalize_codeset (codeset, name_len)
    355      const char *codeset;
     357     const unsigned char *codeset;
    356358     size_t name_len;
    357359{
  • branches/GNU/src/binutils/intl/libgettext.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Message catalogs for internationalization.
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33
    44   This program is free software; you can redistribute it and/or modify
     
    2121   define _LIBINTL_H and therefore we have to protect the definition here.  */
    2222
    23 #if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
    24 #if !defined (_LIBINTL_H)
     23#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
     24#ifndef _LIBINTL_H
    2525# define _LIBINTL_H     1
    2626#endif
     
    4545
    4646#ifndef PARAMS
    47 # if __STDC__
     47# if __STDC__ || defined __cplusplus
    4848#  define PARAMS(args) args
    4949# else
     
    169169# define dgettext(Domainname, Msgid) (Msgid)
    170170# define dcgettext(Domainname, Msgid, Category) (Msgid)
    171 # define textdomain(Domainname) while (0) /* nothing */
    172 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
     171# define textdomain(Domainname) ((char *) Domainname)
     172# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
    173173
    174174#endif
  • branches/GNU/src/binutils/intl/libintl.glibc

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* libgettext.h -- Message catalogs for internationalization.
    2 Copyright (C) 1995 Free Software Foundation, Inc.
    3 This file is part of the GNU C Library.
    4 Contributed by Ulrich Drepper.
    5 This file is derived from the file libgettext.h in the GNU gettext package.
     1/* Message catalogs for internationalization.
     2   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     3   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
     4   This file is derived from the file libgettext.h in the GNU gettext package.
    65
    7 The GNU C Library is free software; you can redistribute it and/or
    8 modify it under the terms of the GNU Library General Public License as
    9 published by the Free Software Foundation; either version 2 of the
    10 License, or (at your option) any later version.
     6   This file is part of the GNU C Library.  Its master source is NOT part of
     7   the C library, however.
    118
    12 The GNU C Library is distributed in the hope that it will be useful,
    13 but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15 Library General Public License for more details.
     9   The GNU C Library is free software; you can redistribute it and/or
     10   modify it under the terms of the GNU Library General Public License as
     11   published by the Free Software Foundation; either version 2 of the
     12   License, or (at your option) any later version.
    1613
    17 You should have received a copy of the GNU Library General Public
    18 License along with the GNU C Library; see the file COPYING.LIB.  If
    19 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    20 Boston, MA 02111-1307, USA.  */
     14   The GNU C Library is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17   Library General Public License for more details.
     18
     19   You should have received a copy of the GNU Library General Public
     20   License along with the GNU C Library; see the file COPYING.LIB.  If not,
     21   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     22   Boston, MA 02111-1307, USA.  */
    2123
    2224#ifndef _LIBINTL_H
    2325#define _LIBINTL_H      1
     26
    2427#include <features.h>
    25 
    26 #include <locale.h>
    27 
    28 #define __need_NULL
    29 #include <stddef.h>
    3028
    3129/* We define an additional symbol to signal that we use the GNU
     
    7169
    7270/* Optimized version of the function above.  */
    73 #if defined __OPTIMIZED
    74 /* These must be a macro.  Inlined functions are useless because the
     71#if defined __OPTIMIZE__
     72
     73/* We need NULL for `gettext'.  */
     74# define __need_NULL
     75# include <stddef.h>
     76
     77/* We need LC_MESSAGES for `dgettext'.  */
     78# include <locale.h>
     79
     80/* These must be macros.  Inlined functions are useless because the
    7581   `__builtin_constant_p' predicate in dcgettext would always return
    7682   false.  */
     
    8288
    8389# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
     90/* Variable defined in loadmsgcat.c which gets incremented every time a
     91   new catalog is loaded.  */
     92extern int _nl_msg_cat_cntr;
     93
    8494#  define dcgettext(domainname, msgid, category)                              \
    8595  (__extension__                                                              \
    8696   ({                                                                         \
    87      char *result;                                                            \
     97     char *__result;                                                          \
    8898     if (__builtin_constant_p (msgid))                                        \
    8999       {                                                                      \
    90          extern int _nl_msg_cat_cntr;                                         \
    91100         static char *__translation__;                                        \
    92101         static int __catalog_counter__;                                      \
     
    97106             __catalog_counter__ = _nl_msg_cat_cntr;                          \
    98107           }                                                                  \
    99          result = __translation__;                                            \
     108         __result = __translation__;                                          \
    100109       }                                                                      \
    101110     else                                                                     \
    102        result = __dcgettext ((domainname), (msgid), (category));              \
    103      result;                                                                  \
     111       __result = __dcgettext ((domainname), (msgid), (category));            \
     112     __result;                                                                \
    104113    }))
    105114# endif
  • branches/GNU/src/binutils/intl/linux-msg.sed

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
    2 # Copyright (C) 1995 Free Software Foundation, Inc.
     2# Copyright 1995, 2002 Free Software Foundation, Inc.
    33# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44#
     
    6969}
    7070#
    71 # The .msg file contains, other then the .po file, only the translations
     71# The .msg file contains, other than the .po file, only the translations
    7272# but each given a unique ID.  Starting from 1 and incrementing by 1 for
    7373# each message we assign them to the messages.
  • branches/GNU/src/binutils/intl/loadinfo.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
     1/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
     2   This file is part of the GNU C Library.
     3   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
     4
     5   This program is free software; you can redistribute it and/or modify
     6   it under the terms of the GNU General Public License as published by
     7   the Free Software Foundation; either version 2, or (at your option)
     8   any later version.
     9
     10   This program is distributed in the hope that it will be useful,
     11   but WITHOUT ANY WARRANTY; without even the implied warranty of
     12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13   GNU General Public License for more details.
     14
     15   You should have received a copy of the GNU General Public License
     16   along with this program; if not, write to the Free Software Foundation,
     17   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     18
    119#ifndef PARAMS
    220# if __STDC__
     
    3351
    3452
    35 extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
     53extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset,
    3654                                                  size_t name_len));
    3755
  • branches/GNU/src/binutils/intl/loadmsgcat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Load needed message catalogs
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Load needed message catalogs.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33
    44   This program is free software; you can redistribute it and/or modify
     
    4545   because some ISO C functions will require linking with this object
    4646   file and the name space must not be polluted.  */
    47 # define fstat  __fstat
    4847# define open   __open
    4948# define close  __close
     
    6261   message catalog do nothing.  */
    6362void
     63internal_function
    6464_nl_load_domain (domain_file)
    6565     struct loaded_l10nfile *domain_file;
    6666{
    6767  int fd;
     68  size_t size;
    6869  struct stat st;
    6970  struct mo_file_header *data = (struct mo_file_header *) -1;
     
    9192  /* We must know about the size of the file.  */
    9293  if (fstat (fd, &st) != 0
    93       && st.st_size < (off_t) sizeof (struct mo_file_header))
     94      || (size = (size_t) st.st_size) != st.st_size
     95      || size < sizeof (struct mo_file_header))
    9496    {
    9597      /* Something went wrong.  */
     
    102104  /* Now we are ready to load the file.  If mmap() is available we try
    103105     this first.  If not available or it failed we try to load it.  */
    104   data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
     106  data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
    105107                                         MAP_PRIVATE, fd, 0);
    106108
     
    117119  if (data == (struct mo_file_header *) -1)
    118120    {
    119       off_t to_read;
     121      size_t to_read;
    120122      char *read_ptr;
    121123
    122       data = (struct mo_file_header *) malloc (st.st_size);
     124      data = (struct mo_file_header *) malloc (size);
    123125      if (data == NULL)
    124126        return;
    125127
    126       to_read = st.st_size;
     128      to_read = size;
    127129      read_ptr = (char *) data;
    128130      do
     
    151153    || defined _LIBC
    152154      if (use_mmap)
    153         munmap ((caddr_t) data, st.st_size);
     155        munmap ((caddr_t) data, size);
    154156      else
    155157#endif
     
    165167  domain = (struct loaded_domain *) domain_file->data;
    166168  domain->data = (char *) data;
     169#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
     170    || defined _LIBC
     171  domain->use_mmap = use_mmap;
     172#endif
     173  domain->mmap_size = size;
    167174  domain->must_swap = data->magic != _MAGIC;
    168175
     
    185192    || defined _LIBC
    186193      if (use_mmap)
    187         munmap ((caddr_t) data, st.st_size);
     194        munmap ((caddr_t) data, size);
    188195      else
    189196#endif
     
    198205  ++_nl_msg_cat_cntr;
    199206}
     207
     208
     209#ifdef _LIBC
     210void
     211internal_function
     212_nl_unload_domain (domain)
     213     struct loaded_domain *domain;
     214{
     215  if (domain->use_mmap)
     216    munmap ((caddr_t) domain->data, domain->mmap_size);
     217  else
     218    free ((void *) domain->data);
     219
     220  free (domain);
     221}
     222#endif
  • branches/GNU/src/binutils/intl/localealias.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Handle aliases for locale names
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Handle aliases for locale names.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44
     
    8080   file and the name space must not be polluted.  */
    8181# define strcasecmp __strcasecmp
     82
     83# define mempcpy __mempcpy
     84# define HAVE_MEMPCPY   1
     85
     86/* We need locking here since we can be called from different places.  */
     87# include <bits/libc-lock.h>
     88
     89__libc_lock_define_initialized (static, lock);
    8290#endif
    8391
     
    126134
    127135
     136static char *string_space = NULL;
     137static size_t string_space_act = 0;
     138static size_t string_space_max = 0;
    128139static struct alias_map *map;
    129140static size_t nmap = 0;
     
    132143
    133144/* Prototypes for local functions.  */
    134 static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
     145static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
     146     internal_function;
    135147static void extend_alias_table PARAMS ((void));
    136148static int alias_compare PARAMS ((const struct alias_map *map1,
     
    144156  static const char *locale_alias_path = LOCALE_ALIAS_PATH;
    145157  struct alias_map *retval;
     158  const char *result = NULL;
    146159  size_t added;
     160
     161#ifdef _LIBC
     162  __libc_lock_lock (lock);
     163#endif
    147164
    148165  do
     
    163180      /* We really found an alias.  Return the value.  */
    164181      if (retval != NULL)
    165         return retval->value;
     182        {
     183          result = retval->value;
     184          break;
     185        }
    166186
    167187      /* Perhaps we can find another alias file.  */
     
    184204  while (added != 0);
    185205
    186   return NULL;
     206#ifdef _LIBC
     207  __libc_lock_unlock (lock);
     208#endif
     209
     210  return result;
    187211}
    188212
    189213
    190214static size_t
     215internal_function
    191216read_alias_file (fname, fname_len)
    192217     const char *fname;
     
    203228  full_fname = (char *) alloca (fname_len + sizeof aliasfile);
    204229  ADD_BLOCK (block_list, full_fname);
     230#ifdef HAVE_MEMPCPY
     231  mempcpy (mempcpy (full_fname, fname, fname_len),
     232           aliasfile, sizeof aliasfile);
     233#else
    205234  memcpy (full_fname, fname, fname_len);
    206235  memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
     236#endif
    207237
    208238  fp = fopen (full_fname, "r");
     
    221251            be that long
    222252       */
    223       char buf[BUFSIZ];
    224       char *alias;
    225       char *value;
    226       char *cp;
    227 
    228       if (fgets (buf, BUFSIZ, fp) == NULL)
     253      unsigned char buf[BUFSIZ];
     254      unsigned char *alias;
     255      unsigned char *value;
     256      unsigned char *cp;
     257
     258      if (fgets (buf, sizeof buf, fp) == NULL)
    229259        /* EOF reached.  */
    230260        break;
     261
     262      /* Possibly not the whole line fits into the buffer.  Ignore
     263         the rest of the line.  */
     264      if (strchr (buf, '\n') == NULL)
     265        {
     266          char altbuf[BUFSIZ];
     267          do
     268            if (fgets (altbuf, sizeof altbuf, fp) == NULL)
     269              /* Make sure the inner loop will be left.  The outer loop
     270                 will exit at the `feof' test.  */
     271              break;
     272          while (strchr (altbuf, '\n') == NULL);
     273        }
    231274
    232275      cp = buf;
     
    251294          if (cp[0] != '\0')
    252295            {
    253               char *tp;
    254               size_t len;
     296              size_t alias_len;
     297              size_t value_len;
    255298
    256299              value = cp++;
     
    272315                extend_alias_table ();
    273316
    274               /* We cannot depend on strdup available in the libc.  Sigh!  */
    275               len = strlen (alias) + 1;
    276               tp = (char *) malloc (len);
    277               if (tp == NULL)
     317              alias_len = strlen (alias) + 1;
     318              value_len = strlen (value) + 1;
     319
     320              if (string_space_act + alias_len + value_len > string_space_max)
    278321                {
    279                   FREE_BLOCKS (block_list);
    280                   return added;
     322                  /* Increase size of memory pool.  */
     323                  size_t new_size = (string_space_max
     324                                     + (alias_len + value_len > 1024
     325                                        ? alias_len + value_len : 1024));
     326                  char *new_pool = (char *) realloc (string_space, new_size);
     327                  if (new_pool == NULL)
     328                    {
     329                      FREE_BLOCKS (block_list);
     330                      return added;
     331                    }
     332                  string_space = new_pool;
     333                  string_space_max = new_size;
    281334                }
    282               memcpy (tp, alias, len);
    283               map[nmap].alias = tp;
    284 
    285               len = strlen (value) + 1;
    286               tp = (char *) malloc (len);
    287               if (tp == NULL)
    288                 {
    289                   FREE_BLOCKS (block_list);
    290                   return added;
    291                 }
    292               memcpy (tp, value, len);
    293               map[nmap].value = tp;
     335
     336              map[nmap].alias = memcpy (&string_space[string_space_act],
     337                                        alias, alias_len);
     338              string_space_act += alias_len;
     339
     340              map[nmap].value = memcpy (&string_space[string_space_act],
     341                                        value, value_len);
     342              string_space_act += value_len;
    294343
    295344              ++nmap;
     
    297346            }
    298347        }
    299 
    300       /* Possibly not the whole line fits into the buffer.  Ignore
    301          the rest of the line.  */
    302       while (strchr (cp, '\n') == NULL)
    303         {
    304           cp = buf;
    305           if (fgets (buf, BUFSIZ, fp) == NULL)
    306             /* Make sure the inner loop will be left.  The outer loop
    307                will exit at the `feof' test.  */
    308             *cp = '\n';
    309         }
    310348    }
    311349
     
    330368
    331369  new_size = maxmap == 0 ? 100 : 2 * maxmap;
    332   new_map = (struct alias_map *) malloc (new_size
    333                                          * sizeof (struct alias_map));
     370  new_map = (struct alias_map *) realloc (map, (new_size
     371                                                * sizeof (struct alias_map)));
    334372  if (new_map == NULL)
    335373    /* Simply don't extend: we don't have any more core.  */
    336374    return;
    337375
    338   memcpy (new_map, map, nmap * sizeof (struct alias_map));
    339 
    340   if (maxmap != 0)
    341     free (map);
    342 
    343376  map = new_map;
    344377  maxmap = new_size;
    345378}
     379
     380
     381#ifdef _LIBC
     382static void __attribute__ ((unused))
     383free_mem (void)
     384{
     385  if (string_space != NULL)
     386    free (string_space);
     387  if (map != NULL)
     388    free (map);
     389}
     390text_set_element (__libc_subfreeres, free_mem);
     391#endif
    346392
    347393
  • branches/GNU/src/binutils/intl/textdomain.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    1 /* Implementation of the textdomain(3) function
    2    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     1/* Implementation of the textdomain(3) function.
     2   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    33   Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44
     
    5555#ifdef _LIBC
    5656# define TEXTDOMAIN __textdomain
    57 # define strdup(str) __strdup (str)
     57# ifndef strdup
     58#  define strdup(str) __strdup (str)
     59# endif
    5860#else
    5961# define TEXTDOMAIN textdomain__
  • branches/GNU/src/binutils/intl/xopen-msg.sed

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
    2 # Copyright (C) 1995 Free Software Foundation, Inc.
     2# Copyright 1995, 2002 Free Software Foundation, Inc.
    33# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
    44#
     
    4545}
    4646#
    47 # The .msg file contains, other then the .po file, only the translations
     47# The .msg file contains, other than the .po file, only the translations
    4848# but each given a unique ID.  Starting from 1 and incrementing by 1 for
    4949# each message we assign them to the messages.
Note: See TracChangeset for help on using the changeset viewer.