1.x: update gettext, replace autosprintf with boost::format

git-svn-id: http://encfs.googlecode.com/svn/branches/1.x@129 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough 2013-11-13 06:45:46 +00:00
parent 07b35f2b49
commit 3373886fdf
14 changed files with 1292 additions and 1183 deletions

1970
ABOUT-NLS

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,15 @@
2013-11-12 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.18.3.
* m4/iconv.m4: Upgrade to gettext-0.18.3.
* m4/lib-ld.m4: Upgrade to gettext-0.18.3.
* m4/lib-link.m4: Upgrade to gettext-0.18.3.
* m4/lib-prefix.m4: Upgrade to gettext-0.18.3.
* m4/nls.m4: Upgrade to gettext-0.18.3.
* m4/po.m4: Upgrade to gettext-0.18.3.
* m4/progtest.m4: Upgrade to gettext-0.18.3.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.18.3.
Sun Nov 12 2013 Valient Gough <vgough@pobox.com>
* fix compiler warnings on OSX 10.9
* allow building with NLS disabled (configure --disable-nls)

View File

@ -27,9 +27,7 @@ dnl make /usr/local the default for the installation
AC_PREFIX_DEFAULT(/usr/local)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
dnl AC_LIB_LINKFLAGS([asprintf]) # use internal copy
LIBINTL=-lgettextlib
AM_GNU_GETTEXT_VERSION([0.18.3])
dnl create only shared libtool-libraries
dnl These can be overridden by command line arguments

View File

@ -28,7 +28,6 @@
#include "config.h"
#include "readpassphrase.h"
#include "autosprintf.h"
#include "FileUtils.h"
#include "ConfigReader.h"
@ -63,6 +62,7 @@
#include <boost/version.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/format.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/split_free.hpp>
@ -75,9 +75,9 @@
using namespace rel;
using namespace rlog;
using namespace std;
using namespace gnu;
namespace fs = boost::filesystem;
namespace serial = boost::serialization;
using boost::format;
static const int DefaultBlockSize = 1024;
// The maximum length of text passwords. If longer are needed,
@ -327,7 +327,7 @@ bool userAllowMkdir(int promptno, const char *path, mode_t mode )
// TODO: can we internationalize the y/n names? Seems strange to prompt in
// their own language but then have to respond 'y' or 'n'.
// xgroup(setup)
cerr << autosprintf( _("The directory \"%s\" does not exist. Should it be created? (y,n) "), path );
cerr << format(_("The directory \"%s\" does not exist. Should it be created? (y,n) ")) % path;
char answer[10];
char *res;
@ -676,31 +676,30 @@ Cipher::CipherAlgorithm selectCipherAlgorithm()
{
// shown after algorithm name and description.
// xgroup(setup)
cout << autosprintf(_(" -- key length %i bits")
, it->keyLength.min()) << "\n";
cout << format(_(" -- key length %i bits")) % it->keyLength.min() << "\n";
} else
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- Supports key lengths of %i to %i bits"),
it->keyLength.min(), it->keyLength.max()) << "\n";
_(" -- Supports key lengths of %i to %i bits")) %
it->keyLength.min() % it->keyLength.max() << "\n";
}
if(it->blockSize.min() == it->blockSize.max())
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- block size %i bytes"), it->blockSize.min())
_(" -- block size %i bytes")) % it->blockSize.min()
<< "\n";
} else
{
cout << autosprintf(
cout << format(
// shown after algorithm name and description.
// xgroup(setup)
_(" -- Supports block sizes of %i to %i bytes"),
it->blockSize.min(), it->blockSize.max()) << "\n";
_(" -- Supports block sizes of %i to %i bytes")) %
it->blockSize.min() % it->blockSize.max() << "\n";
}
}
@ -724,7 +723,7 @@ Cipher::CipherAlgorithm selectCipherAlgorithm()
Cipher::CipherAlgorithm alg = *it;
// xgroup(setup)
cout << autosprintf(_("Selected algorithm \"%s\""), alg.name.c_str())
cout << format(_("Selected algorithm \"%s\"")) % alg.name
<< "\n\n";
return alg;
@ -767,7 +766,7 @@ Interface selectNameCoding()
++it;
// xgroup(setup)
cout << autosprintf(_("Selected algorithm \"%s\""), it->name.c_str())
cout << format(_("Selected algorithm \"%s\"")) % it->name
<< "\"\n\n";
return it->iface;
@ -779,17 +778,17 @@ int selectKeySize( const Cipher::CipherAlgorithm &alg )
{
if(alg.keyLength.min() == alg.keyLength.max())
{
cout << autosprintf(_("Using key size of %i bits"),
alg.keyLength.min()) << "\n";
cout << format(_("Using key size of %i bits")) %
alg.keyLength.min() << "\n";
return alg.keyLength.min();
}
cout << autosprintf(
cout << format(
// xgroup(setup)
_("Please select a key size in bits. The cipher you have chosen\n"
"supports sizes from %i to %i bits in increments of %i bits.\n"
"For example: "), alg.keyLength.min(), alg.keyLength.max(),
alg.keyLength.inc()) << "\n";
"For example: ")) % alg.keyLength.min() % alg.keyLength.max() %
alg.keyLength.inc() << "\n";
int numAvail = (alg.keyLength.max() - alg.keyLength.min())
/ alg.keyLength.inc();
@ -826,7 +825,7 @@ int selectKeySize( const Cipher::CipherAlgorithm &alg )
keySize = alg.keyLength.closest( keySize );
// xgroup(setup)
cout << autosprintf(_("Using key size of %i bits"), keySize) << "\n\n";
cout << format(_("Using key size of %i bits")) % keySize << "\n\n";
return keySize;
}
@ -836,20 +835,20 @@ int selectBlockSize( const Cipher::CipherAlgorithm &alg )
{
if(alg.blockSize.min() == alg.blockSize.max())
{
cout << autosprintf(
cout << format(
// xgroup(setup)
_("Using filesystem block size of %i bytes"),
alg.blockSize.min()) << "\n";
_("Using filesystem block size of %i bytes")) %
alg.blockSize.min() << "\n";
return alg.blockSize.min();
}
cout << autosprintf(
cout << format(
// xgroup(setup)
_("Select a block size in bytes. The cipher you have chosen\n"
"supports sizes from %i to %i bytes in increments of %i.\n"
"Or just hit enter for the default (%i bytes)\n"),
alg.blockSize.min(), alg.blockSize.max(), alg.blockSize.inc(),
DefaultBlockSize);
"Or just hit enter for the default (%i bytes)\n")) %
alg.blockSize.min() % alg.blockSize.max() % alg.blockSize.inc() %
DefaultBlockSize;
// xgroup(setup)
cout << "\n" << _("filesystem block size: ");
@ -865,8 +864,8 @@ int selectBlockSize( const Cipher::CipherAlgorithm &alg )
blockSize = alg.blockSize.closest( blockSize );
// xgroup(setup)
cout << autosprintf(_("Using filesystem block size of %i bytes"),
blockSize) << "\n\n";
cout << format(_("Using filesystem block size of %i bytes")) %
blockSize << "\n\n";
return blockSize;
}
@ -1267,11 +1266,13 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
{
shared_ptr<Cipher> cipher = Cipher::New( config->cipherIface, -1 );
{
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Filesystem cipher: \"%s\", version %i:%i:%i"),
config->cipherIface.name().c_str(), config->cipherIface.current(),
config->cipherIface.revision(), config->cipherIface.age());
_("Filesystem cipher: \"%s\", version %i:%i:%i")) %
config->cipherIface.name().c_str() %
config->cipherIface.current() %
config->cipherIface.revision() %
config->cipherIface.age();
// check if we support this interface..
if(!cipher)
cout << _(" (NOT supported)\n");
@ -1282,17 +1283,19 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
{
Interface iface = cipher->interface();
// xgroup(diag)
cout << autosprintf(_(" (using %i:%i:%i)\n"),
iface.current(), iface.revision(), iface.age());
cout << format(_(" (using %i:%i:%i)\n")) %
iface.current() % iface.revision() % iface.age();
} else
cout << "\n";
}
}
{
// xgroup(diag)
cout << autosprintf(_("Filename encoding: \"%s\", version %i:%i:%i"),
config->nameIface.name().c_str(), config->nameIface.current(),
config->nameIface.revision(), config->nameIface.age());
cout << format(_("Filename encoding: \"%s\", version %i:%i:%i")) %
config->nameIface.name().c_str() %
config->nameIface.current() %
config->nameIface.revision() %
config->nameIface.age();
// check if we support the filename encoding interface..
shared_ptr<NameIO> nameCoder = NameIO::New( config->nameIface,
@ -1307,14 +1310,14 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
if( config->nameIface != nameCoder->interface() )
{
Interface iface = nameCoder->interface();
cout << autosprintf(_(" (using %i:%i:%i)\n"),
iface.current(), iface.revision(), iface.age());
cout << format(_(" (using %i:%i:%i)\n")) %
iface.current() % iface.revision() % iface.age();
} else
cout << "\n";
}
}
{
cout << autosprintf(_("Key Size: %i bits"), config->keySize);
cout << format(_("Key Size: %i bits")) % config->keySize;
cipher = config->getCipher();
if(!cipher)
{
@ -1325,33 +1328,33 @@ void showFSInfo( const boost::shared_ptr<EncFSConfig> &config )
}
if(config->kdfIterations > 0 && config->salt.size() > 0)
{
cout << autosprintf(_("Using PBKDF2, with %i iterations"),
config->kdfIterations) << "\n";
cout << autosprintf(_("Salt Size: %i bits"),
8*(int)config->salt.size()) << "\n";
cout << format(_("Using PBKDF2, with %i iterations")) %
config->kdfIterations << "\n";
cout << format(_("Salt Size: %i bits")) %
(8*config->salt.size()) << "\n";
}
if(config->blockMACBytes || config->blockMACRandBytes)
{
if(config->subVersion < 20040813)
{
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Block Size: %i bytes + %i byte MAC header"),
config->blockSize,
config->blockMACBytes + config->blockMACRandBytes) << endl;
_("Block Size: %i bytes + %i byte MAC header")) %
config->blockSize %
(config->blockMACBytes + config->blockMACRandBytes) << endl;
} else
{
// new version stores the header as part of that block size..
cout << autosprintf(
cout << format(
// xgroup(diag)
_("Block Size: %i bytes, including %i byte MAC header"),
config->blockSize,
config->blockMACBytes + config->blockMACRandBytes) << endl;
_("Block Size: %i bytes, including %i byte MAC header")) %
config->blockSize %
(config->blockMACBytes + config->blockMACRandBytes) << endl;
}
} else
{
// xgroup(diag)
cout << autosprintf(_("Block Size: %i bytes"), config->blockSize);
cout << format(_("Block Size: %i bytes")) % config->blockSize;
cout << "\n";
}

View File

@ -52,7 +52,7 @@ libencfs_la_LIBADD = @RLOG_LIBS@ \
@OPENSSL_LIBS@ \
@BOOST_SERIALIZATION_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@
EXTRASRC = ../intl/autosprintf.cpp
EXTRASRC =
if BUILD_OPENSSL
if BUILD_SSLCIPHER
EXTRASRC += SSL_Cipher.cpp

View File

@ -18,7 +18,6 @@
#include "encfs.h"
#include "autosprintf.h"
#include "config.h"
#include "FileUtils.h"
@ -42,6 +41,7 @@
#include "i18n.h"
#include <boost/format.hpp>
#include <boost/scoped_array.hpp>
#ifdef HAVE_SSL
@ -51,9 +51,8 @@
using namespace rlog;
using namespace std;
using namespace gnu;
using namespace boost;
using boost::format;
static int showInfo( int argc, char **argv );
static int showVersion( int argc, char **argv );
@ -117,12 +116,12 @@ struct CommandOpts
static
void usage(const char *name)
{
cerr << autosprintf(_("encfsctl version %s"), VERSION) << "\n"
cerr << format(_("encfsctl version %s")) % VERSION << "\n"
<< _("Usage:\n")
// displays usage commands, eg "./encfs (root dir) ..."
// xgroup(usage)
<< autosprintf(_("%s (root dir)\n"
" -- displays information about the filesystem, or \n"), name);
<< format(_("%s (root dir)\n"
" -- displays information about the filesystem, or \n")) % name;
int offset = 0;
while(commands[offset].name != 0)
@ -138,7 +137,7 @@ void usage(const char *name)
cerr << "\n"
// xgroup(usage)
<< autosprintf(_("Example: \n%s info ~/.crypt\n"), name)
<< format(_("Example: \n%s info ~/.crypt\n")) % name
<< "\n";
}
@ -146,8 +145,8 @@ static bool checkDir( string &rootDir )
{
if( !isDirectory( rootDir.c_str() ))
{
cerr << autosprintf(_("directory %s does not exist.\n"),
rootDir.c_str());
cerr << format(_("directory %s does not exist.\n")) %
rootDir.c_str();
return false;
}
if(rootDir[ rootDir.length()-1 ] != '/')
@ -161,7 +160,7 @@ static int showVersion( int argc, char **argv )
(void)argc;
(void)argv;
// xgroup(usage)
cerr << autosprintf(_("encfsctl version %s"), VERSION) << "\n";
cerr << format(_("encfsctl version %s")) % VERSION << "\n";
return EXIT_SUCCESS;
}
@ -190,25 +189,25 @@ static int showInfo( int argc, char **argv )
return EXIT_FAILURE;
case Config_V3:
// xgroup(diag)
cout << "\n" << autosprintf(_("Version 3 configuration; "
"created by %s\n"), config->creator.c_str());
cout << "\n" << format(_("Version 3 configuration; "
"created by %s\n")) % config->creator.c_str();
break;
case Config_V4:
// xgroup(diag)
cout << "\n" << autosprintf(_("Version 4 configuration; "
"created by %s\n"), config->creator.c_str());
cout << "\n" << format(_("Version 4 configuration; "
"created by %s\n")) % config->creator.c_str();
break;
case Config_V5:
// xgroup(diag)
cout << "\n" << autosprintf(_("Version 5 configuration; "
"created by %s (revision %i)\n"), config->creator.c_str(),
config->subVersion);
cout << "\n" << format(_("Version 5 configuration; "
"created by %s (revision %i)\n")) % config->creator %
config->subVersion;
break;
case Config_V6:
// xgroup(diag)
cout << "\n" << autosprintf(_("Version 6 configuration; "
"created by %s (revision %i)\n"), config->creator.c_str(),
config->subVersion);
cout << "\n" << format(_("Version 6 configuration; "
"created by %s (revision %i)\n")) % config->creator %
config->subVersion;
break;
}
@ -638,7 +637,7 @@ int showcruft( const shared_ptr<EncFS_Root> &rootInfo, const char *dirName )
if(!showedDir)
{
// just before showing a list of files in a directory
cout << autosprintf(_("In directory %s: \n"), dirName);
cout << format(_("In directory %s: \n")) % dirName;
showedDir = true;
}
++found;
@ -685,9 +684,9 @@ static int cmd_showcruft( int argc, char **argv )
int filesFound = showcruft( rootInfo, "/" );
cerr << autosprintf(
cerr << format(
ngettext("Found %i invalid file.", "Found %i invalid files.",
filesFound), filesFound) << "\n";
filesFound)) % filesFound << "\n";
return EXIT_SUCCESS;
}
@ -713,8 +712,8 @@ static int do_chpasswd( bool useStdin, bool annotate, int argc, char **argv )
config->cipherIface, config->keySize );
if(!cipher)
{
cout << autosprintf(_("Unable to find specified cipher \"%s\"\n"),
config->cipherIface.name().c_str());
cout << format(_("Unable to find specified cipher \"%s\"\n")) %
config->cipherIface.name();
return EXIT_FAILURE;
}
@ -841,15 +840,15 @@ int main(int argc, char **argv)
if(commands[offset].name == 0)
{
cerr << autosprintf(_("invalid command: \"%s\""), argv[1]) << "\n";
cerr << format(_("invalid command: \"%s\"")) % argv[1] << "\n";
} else
{
if((argc-2 < commands[offset].minOptions) ||
(argc-2 > commands[offset].maxOptions))
{
cerr << autosprintf(
_("Incorrect number of arguments for command \"%s\""),
argv[1]) << "\n";
cerr << format(
_("Incorrect number of arguments for command \"%s\"")) %
argv[1] << "\n";
} else
return (*commands[offset].func)( argc-1, argv+1 );
}

View File

@ -22,30 +22,11 @@
#define _i18n_incl_
#include "config.h"
#include "intl/gettext.h"
#if defined(ENABLE_NLS) && defined(LOCALEDIR)
#ifdef __FreeBSD__
#include <libintl.h>
#endif
# include "gettext.h"
// make shortcut for gettext
# define _(STR) gettext (STR)
# include "autosprintf.h"
using gnu::autosprintf;
#else
# define gettext(STR) (STR)
# define gettext_noop(STR) (STR)
# define _(STR) (STR)
# define N_(STR) (STR)
# define ngettext(STR1, STR2, N) ((N) == 1 ? (STR1) : (STR2))
#endif
#endif

View File

@ -18,7 +18,6 @@
#include "encfs.h"
#include "config.h"
#include "autosprintf.h"
#include <iostream>
#include <string>
@ -33,6 +32,7 @@
#include <getopt.h>
#include <boost/format.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
@ -70,7 +70,7 @@ inline static int MAX(int a, int b)
using namespace std;
using namespace rlog;
using namespace rel;
using namespace gnu;
using boost::format;
using boost::shared_ptr;
using boost::scoped_ptr;
@ -126,10 +126,10 @@ static
void usage(const char *name)
{
// xgroup(usage)
cerr << autosprintf( _("Build: encfs version %s"), VERSION )
cerr << format( _("Build: encfs version %s")) % VERSION
<< "\n\n"
// xgroup(usage)
<< autosprintf(_("Usage: %s [options] rootDir mountPoint [-- [FUSE Mount Options]]"), name) << "\n\n"
<< format(_("Usage: %s [options] rootDir mountPoint [-- [FUSE Mount Options]]")) % name << "\n\n"
// xgroup(usage)
<< _("Common Options:\n"
" -H\t\t\t" "show optional FUSE Mount Options\n"
@ -325,7 +325,7 @@ bool processArgs(int argc, char *argv[], const shared_ptr<EncFS_Args> &out)
break;
case 'V':
// xgroup(usage)
cerr << autosprintf(_("encfs version %s"), VERSION) << endl;
cerr << format(_("encfs version %s")) % VERSION << endl;
exit(EXIT_SUCCESS);
break;
case 'H':

View File

@ -1,78 +0,0 @@
/* Class autosprintf - formatted output to an ostream.
Copyright (C) 2002 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library 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. */
/* Tell glibc's <stdio.h> to provide a prototype for vasprintf().
This must come before <config.h> because <config.h> may include
<features.h>, and once <features.h> has been included, it's too late. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Specification. */
#include "autosprintf.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
//#include "lib-asprintf.h"
#include <stdio.h>
namespace gnu
{
/* Constructor: takes a format string and the printf arguments. */
autosprintf::autosprintf (const char *format, ...)
{
va_list args;
va_start (args, format);
if (vasprintf (&str, format, args) < 0)
str = NULL;
va_end (args);
}
/* Copy constructor. Necessary because the destructor is nontrivial. */
autosprintf::autosprintf (const autosprintf& src)
{
str = (src.str != NULL ? strdup (src.str) : NULL);
}
/* Destructor: frees the temporarily allocated string. */
autosprintf::~autosprintf ()
{
free (str);
}
/* Conversion to string. */
autosprintf::operator char * () const
{
if (str != NULL)
{
size_t length = strlen (str) + 1;
char *copy = new char[length];
memcpy (copy, str, length);
return copy;
}
else
return NULL;
}
autosprintf::operator std::string () const
{
return std::string (str ? str : "(error in autosprintf)");
}
}

View File

@ -1,66 +0,0 @@
/* Class autosprintf - formatted output to an ostream.
Copyright (C) 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library 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. */
#ifndef _AUTOSPRINTF_H
#define _AUTOSPRINTF_H
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
#include <string>
#include <iostream>
namespace gnu
{
/* A temporary object, usually allocated on the stack, representing
the result of an asprintf() call. */
class autosprintf
{
public:
/* Constructor: takes a format string and the printf arguments. */
autosprintf (const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
/* Copy constructor. */
autosprintf (const autosprintf& src);
/* Destructor: frees the temporarily allocated string. */
~autosprintf ();
/* Conversion to string. */
operator char * () const;
operator std::string () const;
/* Output to an ostream. */
friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp)
{
stream << (tmp.str ? tmp.str : "(error in autosprintf)");
return stream;
}
private:
char *str;
};
}
#endif /* _AUTOSPRINTF_H */

View File

@ -1,20 +1,18 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
@ -54,7 +52,7 @@
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
#endif
@ -64,26 +62,41 @@
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# undef gettext
# define gettext(Msgid) ((const char *) (Msgid))
# undef dgettext
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
# undef dcgettext
# define dcgettext(Domainname, Msgid, Category) \
((void) (Category), dgettext (Domainname, Msgid))
# undef ngettext
# define ngettext(Msgid1, Msgid2, N) \
((N) == 1 \
? ((void) (Msgid2), (const char *) (Msgid1)) \
: ((void) (Msgid1), (const char *) (Msgid2)))
# undef dngettext
# define dngettext(Domainname, Msgid1, Msgid2, N) \
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
# undef dcngettext
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
# undef textdomain
# define textdomain(Domainname) ((const char *) (Domainname))
# undef bindtextdomain
# define bindtextdomain(Domainname, Dirname) \
((void) (Domainname), (const char *) (Dirname))
# undef bind_textdomain_codeset
# define bind_textdomain_codeset(Domainname, Codeset) \
((void) (Domainname), (const char *) (Codeset))
#endif
/* Prefer gnulib's setlocale override over libintl's setlocale override. */
#ifdef GNULIB_defined_setlocale
# undef setlocale
# define setlocale rpl_setlocale
#endif
/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
@ -132,8 +145,8 @@ inline
#endif
static const char *
pgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid,
int category)
const char *msg_ctxt_id, const char *msgid,
int category)
{
const char *translation = dcgettext (domain, msg_ctxt_id, category);
if (translation == msg_ctxt_id)
@ -151,9 +164,9 @@ inline
#endif
static const char *
npgettext_aux (const char *domain,
const char *msg_ctxt_id, const char *msgid,
const char *msgid_plural, unsigned long int n,
int category)
const char *msg_ctxt_id, const char *msgid,
const char *msgid_plural, unsigned long int n,
int category)
{
const char *translation =
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
@ -169,9 +182,12 @@ npgettext_aux (const char *domain,
#include <string.h>
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
(((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
/* || __STDC_VERSION__ >= 199901L */ )
#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
/* || __STDC_VERSION__ >= 199901L */ )
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
#endif
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>
@ -191,8 +207,8 @@ inline
#endif
static const char *
dcpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid,
int category)
const char *msgctxt, const char *msgid,
int category)
{
size_t msgctxt_len = strlen (msgctxt) + 1;
size_t msgid_len = strlen (msgid) + 1;
@ -214,10 +230,10 @@ dcpgettext_expr (const char *domain,
translation = dcgettext (domain, msg_ctxt_id, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
free (msg_ctxt_id);
#endif
if (translation != msg_ctxt_id)
return translation;
return translation;
}
return msgid;
}
@ -236,9 +252,9 @@ inline
#endif
static const char *
dcnpgettext_expr (const char *domain,
const char *msgctxt, const char *msgid,
const char *msgid_plural, unsigned long int n,
int category)
const char *msgctxt, const char *msgid,
const char *msgid_plural, unsigned long int n,
int category)
{
size_t msgctxt_len = strlen (msgctxt) + 1;
size_t msgid_len = strlen (msgid) + 1;
@ -260,10 +276,10 @@ dcnpgettext_expr (const char *domain,
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if (msg_ctxt_id != buf)
free (msg_ctxt_id);
free (msg_ctxt_id);
#endif
if (!(translation == msg_ctxt_id || translation == msgid_plural))
return translation;
return translation;
}
return (n == 1 ? msgid : msgid_plural);
}

View File

@ -1,3 +1,8 @@
2013-11-12 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.18.3.
* Rules-quot: Upgrade to gettext-0.18.3.
2008-05-22 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.17.

View File

@ -1,5 +1,5 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2007 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
@ -8,13 +8,14 @@
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.17
GETTEXT_MACRO_VERSION = 0.17
# Origin: gettext-0.18.3
GETTEXT_MACRO_VERSION = 0.18
PACKAGE = @PACKAGE@
VERSION = @VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
SED = @SED@
SHELL = /bin/sh
@SET_MAKE@
@ -88,22 +89,22 @@ CATALOGS = @CATALOGS@
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all: check-macro-version all-@USE_NLS@
all: all-@USE_NLS@
all-yes: stamp-po
all-no:
# Ensure that the gettext macros and this Makefile.in.in are in sync.
check-macro-version:
@test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
CHECK_MACRO_VERSION = \
test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
|| { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
exit 1; \
}
@ -123,6 +124,7 @@ check-macro-version:
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
@$(CHECK_MACRO_VERSION)
test ! -f $(srcdir)/$(DOMAIN).pot || \
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
@ -137,8 +139,16 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
# The determination of whether the package xyz is a GNU one is based on the
# heuristic whether some file in the top level directory mentions "GNU xyz".
# If GNU 'find' is available, we avoid grepping through monster files.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
else \
LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
fi; \
} | grep -v 'libtool:' >/dev/null; then \
package_gnu='GNU '; \
else \
package_gnu=''; \
@ -193,8 +203,15 @@ $(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
esac; \
}; \
else \
$(MAKE) $${lang}.po-create; \
fi
@ -217,7 +234,6 @@ install-data: install-data-@USE_NLS@
fi
install-data-no: all
install-data-yes: all
$(mkdir_p) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
@ -269,7 +285,6 @@ installdirs-data: installdirs-data-@USE_NLS@
fi
installdirs-data-no:
installdirs-data-yes:
$(mkdir_p) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
@ -395,9 +410,15 @@ update-po: Makefile
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
esac; \
}; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
@ -418,9 +439,13 @@ $(DUMMYPOFILES):
update-gmo: Makefile $(GMOFILES)
@:
# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
# because execution permission bits may not work on the current file system.
# Use @SHELL@, which is the shell determined by autoconf for the use by its
# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& $(SHELL) ./config.status $(subdir)/$@.in po-directories
&& @SHELL@ ./config.status $(subdir)/$@.in po-directories
force:

View File

@ -14,13 +14,13 @@ en@boldquot.po-update: en@boldquot.po-update-en
.insert-header.po-update-en:
@lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
ll=`echo $$lang | sed -e 's/@.*//'`; \
LC_ALL=C; export LC_ALL; \
cd $(srcdir); \
if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \