libxpm: Changes to 'upstream-unstable'
acinclude.m4 | 47 +++++++++++++++++++++++++++++++++
configure.ac | 22 +++++++++++++++
cxpm/Makefile.am | 11 +++++++
cxpm/cxpm.c | 50 ++++++++++++++++++++++++++++-------
src/Makefile.am | 5 +--
src/RdFToI.c | 4 ++
src/WrFFrI.c | 15 +++++-----
src/XpmI.h | 4 ++
src/data.c | 2 -
src/parse.c | 2 -
src/simx.h | 17 +++++++++++-
sxpm/Makefile.am | 12 +++++++-
sxpm/sxpm.c | 77 +++++++++++++++++++++++++++++++++++++++++++------------
13 files changed, 225 insertions(+), 43 deletions(-)
New commits:
commit 3e37dd39b6169af9928d5b959c40ba79a07450ee
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Wed Aug 22 13:23:30 2007 -0700
Version bump: 3.5.7
diff --git a/configure.ac b/configure.ac
index ff7e245..2f56e4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# $Id$
AC_PREREQ(2.57)
-AC_INIT([libXpm], 3.5.6, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXpm)
+AC_INIT([libXpm], 3.5.7, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXpm)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
commit d82244497b54889f91c78585374d1ad6a0cef2cf
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Wed Aug 22 13:08:42 2007 -0700
Replace strcpy with strncpy to match previous code block
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index 6477188..15043e8 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -139,7 +139,8 @@ XpmWriteFileFromXpmImage(filename, image, info)
}
if (strchr(name, '-')) {
if (name != new_name) {
- strcpy(new_name, name);
+ strncpy(new_name, name, sizeof(new_name));
+ new_name[sizeof(new_name)-1] = '\0';
name = new_name;
}
/* change '-' to '_' */
commit 47c974872b51b8c1d6965eff4599f8ce739bcedc
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Mon Aug 6 14:22:48 2007 -0700
Use srcdir in paths passed to xgettext when making .po files
diff --git a/cxpm/Makefile.am b/cxpm/Makefile.am
index 158facb..097a640 100644
--- a/cxpm/Makefile.am
+++ b/cxpm/Makefile.am
@@ -41,8 +41,8 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
if USE_GETTEXT
noinst_DATA = cxpm.po
-cxpm.po: $(cxpm_SOURCES)
- xgettext -c"L10N_Comments" -d cxpm -n $(cxpm_SOURCES)
+cxpm.po: $(cxpm_SOURCES:%=$(srcdir)/%)
+ xgettext -c"L10N_Comments" -d cxpm -n $(cxpm_SOURCES:%=$(srcdir)/%)
CLEANFILES += cxpm.po
endif
diff --git a/sxpm/Makefile.am b/sxpm/Makefile.am
index 0b9771a..7780bd8 100644
--- a/sxpm/Makefile.am
+++ b/sxpm/Makefile.am
@@ -45,8 +45,8 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
if USE_GETTEXT
noinst_DATA = sxpm.po
-sxpm.po: $(sxpm_SOURCES)
- xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES)
+sxpm.po: $(sxpm_SOURCES:%=$(srcdir)/%)
+ xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES:%=$(srcdir)/%)
CLEANFILES += sxpm.po
endif
commit 6e003fd5f174a8e312d799d7f8812c2a5b87e433
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Mon Aug 6 12:59:04 2007 -0700
Replace index/rindex with C89 standard strchr/strrchr
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index 363f6c4..6477188 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -117,9 +117,9 @@ XpmWriteFileFromXpmImage(filename, image, info)
#ifdef VMS
name = filename;
#else
- if (!(name = rindex(filename, '/'))
+ if (!(name = strrchr(filename, '/'))
#ifdef AMIGA
- && !(name = rindex(filename, ':'))
+ && !(name = strrchr(filename, ':'))
#endif
)
name = filename;
@@ -127,24 +127,24 @@ XpmWriteFileFromXpmImage(filename, image, info)
name++;
#endif
/* let's try to make a valid C syntax name */
- if (index(name, '.')) {
+ if (strchr(name, '.')) {
strncpy(new_name, name, sizeof(new_name));
new_name[sizeof(new_name)-1] = '\0';
/* change '.' to '_' */
name = s = new_name;
- while ((dot = index(s, '.'))) {
+ while ((dot = strchr(s, '.'))) {
*dot = '_';
s = dot;
}
}
- if (index(name, '-')) {
+ if (strchr(name, '-')) {
if (name != new_name) {
strcpy(new_name, name);
name = new_name;
}
/* change '-' to '_' */
s = name;
- while ((dot = index(s, '-'))) {
+ while ((dot = strchr(s, '-'))) {
*dot = '_';
s = dot;
}
diff --git a/src/data.c b/src/data.c
index d0b86ee..87f4b3f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -422,7 +422,7 @@ xpmParseHeader(data)
if (!l)
return (XpmFileInvalid);
buf[l] = '\0';
- ptr = rindex(buf, '_');
+ ptr = strrchr(buf, '_');
if (!ptr || strncmp("_format", ptr, l - (ptr - buf)))
return XpmFileInvalid;
/* this is definitely an XPM 1 file */
diff --git a/src/parse.c b/src/parse.c
index c5ec1a1..bd5b52c 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -138,7 +138,7 @@ xpmParseValues(data, width, height, ncolors, cpp,
ptr = buf;
got_one = False;
while (!got_one) {
- ptr = index(ptr, '_');
+ ptr = strchr(ptr, '_');
if (!ptr)
return (XpmFileInvalid);
switch (l - (ptr - buf)) {
commit 43dfc6be8128139888426d8c709aa78efc207953
Author: Jason Rumney <jasonr@gnu.org>
Date: Mon Aug 6 12:52:52 2007 -0700
X.Org Bug #11863: Build libXpm on MS Windows (with MinGW)
* src/XpmI.h [FOR_MSW]: Include simx.h instead of real X headers.
* src/simx.h (_XFUNCPROTOBEGIN, _XFUNCPROTOEND, NO_ZPIPE): Define.
(XAllocColor): Fix arg list in prototype.
(bzero, close, fdopen, index, rindex, open, strdup, O_RDONLY):
Map to W32 equivalents.
* src/RdFToI.c [FOR_MSW]: Include fcntl.h.
diff --git a/src/RdFToI.c b/src/RdFToI.c
index 35fe78e..60db54a 100644
--- a/src/RdFToI.c
+++ b/src/RdFToI.c
@@ -44,6 +44,10 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
+#else
+#ifdef FOR_MSW
+#include <fcntl.h>
+#endif
#endif
LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
diff --git a/src/XpmI.h b/src/XpmI.h
index 70844ac..e9f28cc 100644
--- a/src/XpmI.h
+++ b/src/XpmI.h
@@ -58,9 +58,13 @@
extern FILE *popen();
#endif
+#ifdef FOR_MSW
+#include "simx.h"
+#else
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
#include <X11/Xmd.h>
+#endif
#ifdef VMS
#include <unixio.h>
diff --git a/src/simx.h b/src/simx.h
index 001cfdb..7c4c4b9 100644
--- a/src/simx.h
+++ b/src/simx.h
@@ -40,6 +40,9 @@
#ifdef FOR_MSW
#include "windows.h" /* MS windows GDI types */
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#define NO_ZPIPE
/*
* minimal portability layer between ansi and KR C
@@ -101,7 +104,7 @@ extern "C" {
/* color related */
FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *));
- FUNC(XAllocColor, int, (Display *, Colormap *, XColor *));
+ FUNC(XAllocColor, int, (Display *, Colormap, XColor *));
FUNC(XQueryColors, void, (Display *display, Colormap *colormap,
XColor *xcolors, int ncolors));
FUNC(XFreeColors, int, (Display *d, Colormap cmap,
@@ -134,6 +137,18 @@ typedef BOOL Bool; /* take MSW bool */
#undef LFUNC
#undef FUNC
+/* Some functions and constants that have non-standard names in the
+ MS library. */
+#define bzero(addr,sz) memset(addr, 0, sz)
+#define close _close
+#define fdopen _fdopen
+#define index strchr
+#define open _open
+#define O_RDONLY _O_RDONLY
+#define rindex strrchr
+#define strdup _strdup
+
+
#endif /* def FOR_MSW */
#endif /* _SIMX_H */
commit 290f0b9115428dab0cbf2880d154468c557b3e7e
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Wed Jul 25 17:45:15 2007 -0700
Include comment/copyright/license for AC_DEFINE_DIR in acinclude.m4
diff --git a/acinclude.m4 b/acinclude.m4
index 4c60e33..f3d8734 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,4 +1,36 @@
-# AC_DEFINE_DIR macro from autoconf-archive.cryp.to
+##### http://autoconf-archive.cryp.to/ac_define_dir.html
+#
+# SYNOPSIS
+#
+# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+# This macro sets VARNAME to the expansion of the DIR variable,
+# taking care of fixing up ${prefix} and such.
+#
+# VARNAME is then offered as both an output variable and a C
+# preprocessor symbol.
+#
+# Example:
+#
+# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LAST MODIFICATION
+#
+# 2006-10-13
+#
+# COPYLEFT
+#
+# Copyright (c) 2006 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2006 Andreas Schwab <schwab@suse.de>
+# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2006 Alexandre Oliva
+#
+# Copying and distribution of this file, with or without
+# modification, are permitted in any medium without royalty provided
+# the copyright notice and this notice are preserved.
+
AC_DEFUN([AC_DEFINE_DIR], [
prefix_NONE=
exec_prefix_NONE=
commit d4bc7dc0dea218cea380aba972f10f60dc1e86ac
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Wed Jun 27 13:54:07 2007 -0700
Use AM_CFLAGS & AM_CPPFLAGS to replace per-program and obsolete macros
Clears some warnings from automake-1.10
diff --git a/cxpm/Makefile.am b/cxpm/Makefile.am
index eea6dae..158facb 100644
--- a/cxpm/Makefile.am
+++ b/cxpm/Makefile.am
@@ -1,6 +1,7 @@
bin_PROGRAMS = cxpm
-cxpm_CFLAGS = $(XPM_CFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/include/X11
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include/X11
+AM_CFLAGS = $(XPM_CFLAGS)
cxpm_SOURCES = cxpm.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2329daf..5dcdf03 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,9 +2,8 @@
lib_LTLIBRARIES=libXpm.la
-AM_CFLAGS = -I. \
- -I$(top_srcdir)/include/X11/ \
- $(XPM_CFLAGS)
+AM_CPPFLAGS = -I. -I$(top_srcdir)/include/X11/
+AM_CFLAGS = $(XPM_CFLAGS)
libXpm_la_LDFLAGS = -version-number 4:11:0 -no-undefined
libXpm_la_LIBADD = $(XPM_LIBS)
diff --git a/sxpm/Makefile.am b/sxpm/Makefile.am
index 04571de..0b9771a 100644
--- a/sxpm/Makefile.am
+++ b/sxpm/Makefile.am
@@ -2,9 +2,9 @@ if BUILD_SXPM
bin_PROGRAMS = sxpm
-sxpm_CFLAGS = $(SXPM_CFLAGS)
+AM_CFLAGS = $(SXPM_CFLAGS)
-INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
sxpm_SOURCES = sxpm.c
commit 85a87de3c03ca8be526dedc0a2973f9426518c39
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Tue Nov 21 17:12:18 2006 -0800
Sun bug 4486226: Xpm is not internationalized
<http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4486226>
Use gettext() to allow translated messages in sxpm & cxpm
(cherry picked from bcda4f17ab3fa9f0572f876dbeb09b45fbc23f3d commit)
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..4c60e33
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,15 @@
+# AC_DEFINE_DIR macro from autoconf-archive.cryp.to
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ac_define_dir="\"[$]$2\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
diff --git a/configure.ac b/configure.ac
index 5dad93d..ff7e245 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,26 @@ if test "x$GCC" = "xyes"; then
CFLAGS="$GCC_WARNINGS $CFLAGS"
fi
+# Internationalization & localization support
+AC_SEARCH_LIBS([gettext], [intl], [USE_GETTEXT="yes"], [USE_GETTEXT="no"])
+AC_MSG_CHECKING([where to install localized messages])
+AC_ARG_WITH([localedir], AC_HELP_STRING([--with-localedir=<path>],
+ [Path to install message files in (default: datadir/locale)]),
+ [LOCALEDIR=${withval}], [LOCALEDIR=${datadir}/locale])
+AC_DEFINE_DIR([LOCALEDIR], [LOCALEDIR], [Location of translated messages])
+if test "x$LOCALEDIR" = "xno" -o "x$USE_GETTEXT" = "xno" ; then
+ AC_MSG_RESULT([nowhere])
+ USE_GETTEXT="no"
+else
+ AC_MSG_RESULT([$LOCALEDIR])
+fi
+
+if test "x$USE_GETTEXT" = "xyes" ; then
+ AC_DEFINE([USE_GETTEXT], 1,
+ [Define to 1 if you want to use the gettext() function.])
+fi
+AM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes")
+
# Optional feature: When ___.xpm is requested, also look for ___.xpm.Z & .gz
# Replaces ZFILEDEF = -DSTAT_ZFILE in old Imakefile
AC_ARG_ENABLE(stat-zfile,
diff --git a/cxpm/Makefile.am b/cxpm/Makefile.am
index 4a1faa9..eea6dae 100644
--- a/cxpm/Makefile.am
+++ b/cxpm/Makefile.am
@@ -37,3 +37,11 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
.man.$(APP_MAN_SUFFIX):
sed $(MAN_SUBSTS) < $< > $@
+if USE_GETTEXT
+noinst_DATA = cxpm.po
+
+cxpm.po: $(cxpm_SOURCES)
+ xgettext -c"L10N_Comments" -d cxpm -n $(cxpm_SOURCES)
+
+CLEANFILES += cxpm.po
+endif
diff --git a/cxpm/cxpm.c b/cxpm/cxpm.c
index 6a7cd9d..3b5e603 100644
--- a/cxpm/cxpm.c
+++ b/cxpm/cxpm.c
@@ -34,7 +34,16 @@
#define CXPMPROG
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "XpmI.h"
+#ifdef USE_GETTEXT
+#include <locale.h>
+#include <libintl.h>
+#else
+#define gettext(a) (a)
+#endif
#undef xpmGetC
#define xpmGetC(data) sGetc(data, data->stream.file)
@@ -86,9 +95,9 @@ sUngetc(data, c, file)
#include "Image.c"
void
-ErrorMessage(ErrorStatus, data)
- int ErrorStatus;
- xpmData *data;
+ErrorMessage(
+ int ErrorStatus,
+ xpmData *data)
{
char *error = NULL;
@@ -97,23 +106,36 @@ ErrorMessage(ErrorStatus, data)
case XpmSuccess:
return;
case XpmOpenFailed:
- error = "Cannot open file";
+ /* L10N_Comments : Error produced when filename does not exist
+ or insufficient permissions to open (i.e. cxpm /no/such/file ) */
+ error = gettext("Cannot open file");
break;
case XpmFileInvalid:
- error = "Invalid XPM file";
+ /* L10N_Comments : Error produced when filename can be read, but
+ is not an XPM file (i.e. cxpm /dev/null ) */
+ error = gettext("Invalid XPM file");
break;
case XpmNoMemory:
- error = "Not enough memory";
+ /* L10N_Comments : Error produced when filename can be read, but
+ is too big for memory
+ (i.e. limit datasize 32 ; cxpm /usr/dt/backdrops/Crochet.pm ) */
+ error = gettext("Not enough memory");
break;
case XpmColorFailed:
- error = "Failed to parse color";
+ /* L10N_Comments : Error produced when filename can be read, but
+ contains an invalid color specification (need to create test case)*/
+ error = gettext("Failed to parse color");
break;
}
if (error) {
- fprintf(stderr, "Xpm Error: %s.\n", error);
+ /* L10N_Comments : Wrapper around above Xpm errors - %s is
+ replaced with the contents of the error message retrieved above */
+ fprintf(stderr, gettext("Xpm Error: %s.\n"), error);
if (ErrorStatus == XpmFileInvalid && data)
- fprintf(stderr, "Error found line %d near character %d\n",
+ /* L10N_Comments : Error produced when filename can be read, but
+ is not an XPM file (i.e. cxpm /dev/null ) */
+ fprintf(stderr, gettext("Error found line %d near character %d\n"),
data->lineNum + 1,
data->charNum + 1);
exit(1);
@@ -130,9 +152,17 @@ main(argc, argv)
int ErrorStatus;
xpmData data;
+#ifdef USE_GETTEXT
+ setlocale(LC_ALL,"");
+ bindtextdomain("cxpm",LOCALEDIR);
+ textdomain("cxpm");
+#endif
+
if (argc > 1) {
if (!strcmp(argv[1], "-?") || !strncmp(argv[1], "-h", 2)) {
- fprintf(stderr, "Usage: %s [filename]\n", argv[0]);
+ /* L10N_Comments : Usage message produced by running cxpm -h
+ %s will be replaced by argv[0] (program name) */
+ fprintf(stderr, gettext("Usage: %s [filename]\n"), argv[0]);
exit(1);
}
filename = argv[1];
diff --git a/sxpm/Makefile.am b/sxpm/Makefile.am
index 1b63cb3..04571de 100644
--- a/sxpm/Makefile.am
+++ b/sxpm/Makefile.am
@@ -42,6 +42,14 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
.man.$(APP_MAN_SUFFIX):
sed $(MAN_SUBSTS) < $< > $@
+if USE_GETTEXT
+noinst_DATA = sxpm.po
+
+sxpm.po: $(sxpm_SOURCES)
+ xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES)
+
+CLEANFILES += sxpm.po
+endif
endif
EXTRA_DIST = \
diff --git a/sxpm/sxpm.c b/sxpm/sxpm.c
index 9d0b42e..a43d441 100644
--- a/sxpm/sxpm.c
+++ b/sxpm/sxpm.c
@@ -32,6 +32,10 @@
* Developed by Arnaud Le Hors *
\*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <X11/StringDefs.h>
@@ -47,6 +51,13 @@
#include <X11/xpm.h>
+#ifdef USE_GETTEXT
+#include <locale.h>
+#include <libintl.h>
+#else
+#define gettext(a) (a)
+#endif
+
/* XPM */
/* plaid pixmap */
static char *plaid[] = {
@@ -158,11 +169,19 @@ main(argc, argv)
char *buffer;
#endif
+#ifdef USE_GETTEXT
+ XtSetLanguageProc(NULL,NULL,NULL);
+ bindtextdomain("sxpm",LOCALEDIR);
+ textdomain("sxpm");
+#endif
+
topw = XtInitialize(argv[0], "Sxpm",
options, XtNumber(options), &argc, argv);
if (!topw) {
- fprintf(stderr, "Sxpm Error... [ Undefined DISPLAY ]\n");
+ /* L10N_Comments : Error if no $DISPLAY or $DISPLAY can't be opened.
+ Not normally reached as Xt exits before we get here. */
+ fprintf(stderr, gettext("Sxpm Error... [ Undefined DISPLAY ]\n"));
exit(1);
}
colormap = XDefaultColormapOfScreen(XtScreen(topw));
@@ -467,7 +486,9 @@ main(argc, argv)
unsigned int i, j;
for (i = 0; i < view.attributes.nextensions; i++) {
- fprintf(stderr, "Xpm extension : %s\n",
+ /* L10N_Comments : Output when -v & file has extensions
+ %s is replaced by extension name */
+ fprintf(stderr, gettext("Xpm extension : %s\n"),
view.attributes.extensions[i].name);
for (j = 0; j < view.attributes.extensions[i].nlines; j++)
fprintf(stderr, "\t\t%s\n",
@@ -559,8 +580,10 @@ main(argc, argv)
void
Usage()
{
- fprintf(stderr, "\nUsage: %s [options...]\n", command[0]);
- fprintf(stderr, "Where options are:\n\
+ /* L10N_Comments : Usage message (sxpm -h) in two parts.
+ In the first part %s is replaced by the command name. */
+ fprintf(stderr, gettext("\nUsage: %s [options...]\n"), command[0]);
+ fprintf(stderr, gettext("Where options are:\n\
\n\
[-d host:display] Display to connect to.\n\
[-g geom] Geometry of window.\n\
@@ -587,7 +610,7 @@ Usage()
[-version] Print out program's version number\n\
and library's version number if different.\n\
if no input is specified sxpm reads from standard input.\n\
-\n");
+\n"));
exit(0);
}
@@ -604,27 +627,48 @@ ErrorMessage(ErrorStatus, tag)
case XpmSuccess:
return;
case XpmColorError:
- warning = "Could not parse or alloc requested color";
+/* L10N_Comments : The following set of messages are classified as
+ either errors or warnings. Based on the class of message, different
+ wrappers are selected at the end to state the message source & class.
+
+ L10N_Comments : WARNING produced when filename can be read, but
+ contains an invalid color specification (need to create test case)*/
+ warning = gettext("Could not parse or alloc requested color");
break;
case XpmOpenFailed:
- error = "Cannot open file";
+ /* L10N_Comments : ERROR produced when filename does not exist
+ or insufficient permissions to open (i.e. sxpm /no/such/file ) */
+ error = gettext("Cannot open file");
break;
case XpmFileInvalid:
- error = "Invalid XPM file";
+ /* L10N_Comments : ERROR produced when filename can be read, but
+ is not an XPM file (i.e. sxpm /dev/null ) */
+ error = gettext("Invalid XPM file");
break;
case XpmNoMemory:
- error = "Not enough memory";
+ /* L10N_Comments : ERROR produced when filename can be read, but
+ is too big for memory
+ (i.e. limit datasize 32 ; sxpm /usr/dt/backdrops/Crochet.pm ) */
+ error = gettext("Not enough memory");
break;
case XpmColorFailed:
- error = "Failed to parse or alloc some color";
+ /* L10N_Comments : ERROR produced when filename can be read, but
+ contains an invalid color specification (need to create test case)*/
+ error = gettext("Failed to parse or alloc some color");
break;
}
if (warning)
- fprintf(stderr, "%s Xpm Warning: %s.\n", tag, warning);
+ /* L10N_Comments : Wrapper around above WARNING messages.
+ First %s is the tag for the operation that produced the warning.
+ Second %s is the message selected from the above set. */
+ fprintf(stderr, gettext("%s Xpm Warning: %s.\n"), tag, warning);
if (error) {
- fprintf(stderr, "%s Xpm Error: %s.\n", tag, error);
+ /* L10N_Comments : Wrapper around above ERROR messages.
+ First %s is the tag for the operation that produced the error.
+ Second %s is the message selected from the above set */
+ fprintf(stderr, gettext("%s Xpm Error: %s.\n"), tag, error);
Punt(1);
}
}
@@ -695,15 +739,16 @@ VersionInfo()
char libminor;
GetNumbers(XpmIncludeVersion, &format, &libmajor, &libminor);
- fprintf(stderr, "sxpm version: %d.%d%c\n",
+ /* L10N_Comments : sxpm -version output */
+ fprintf(stderr, gettext("sxpm version: %d.%d%c\n"),
format, libmajor, libminor);
- /*
+ /* L10N_Comments :
* if we are linked to an XPM library different from the one we've been
- * compiled with, print its own number too.
+ * compiled with, print its own number too when sxpm -version is called.
*/
if (XpmIncludeVersion != XpmLibraryVersion()) {
GetNumbers(XpmLibraryVersion(), &format, &libmajor, &libminor);
- fprintf(stderr, "using the XPM library version: %d.%d%c\n",
+ fprintf(stderr, gettext("using the XPM library version: %d.%d%c\n"),
format, libmajor, libminor);
}
}
Reply to: