libXpm 3.5.7

This commit is contained in:
matthieu 2007-09-30 08:38:09 +00:00
parent 3a51421d4a
commit 3fa7de0f34
19 changed files with 602 additions and 159 deletions

View File

@ -1,3 +1,18 @@
2006-06-02 Alan Coopersmith <alan.coopersmith@sun.com>
* src/hashtab.c (xpmHashTableInit):
Always initialize atomTable to NULL, so xpmHashTableFree() doesn't
try to free a random value from the stack if xpmHashTableInit returns
an error.
* src/create.c (xpmParseDataAndCreate):
Coverity #1432: Returned without freeing storage "hints_cmt"
(in error case when xpmHashTableInit failed)
* src/parse.c (xpmParseData):
Coverity #1415: Returned without freeing storage "hints_cmt"
(in error case when xpmHashTableInit failed)
2006-04-26 Adam Jackson <ajax@freedesktop.org>
* configure.ac:

47
lib/libXpm/acinclude.m4 Normal file
View File

@ -0,0 +1,47 @@
##### 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=
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
])

View File

@ -1,7 +1,7 @@
# $Id: configure.ac,v 1.1.1.1 2006/11/25 17:32:09 matthieu Exp $
# $Id: configure.ac,v 1.1.1.2 2007/09/30 08:38:09 matthieu Exp $
AC_PREREQ(2.57)
AC_INIT([libXpm], 3.5.5, [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])
@ -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,

View File

@ -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
@ -37,3 +38,11 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
.man.$(APP_MAN_SUFFIX):
sed $(MAN_SUBSTS) < $< > $@
if USE_GETTEXT
noinst_DATA = cxpm.po
cxpm.po: $(cxpm_SOURCES:%=$(srcdir)/%)
xgettext -c"L10N_Comments" -d cxpm -n $(cxpm_SOURCES:%=$(srcdir)/%)
CLEANFILES += cxpm.po
endif

View File

@ -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];

View File

@ -1,9 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
scriptversion=2006-10-15.18
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 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
@ -91,7 +92,20 @@ gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
@ -276,6 +290,46 @@ icc)
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@ -288,13 +342,13 @@ tru64)
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is

View File

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
scriptversion=2006-10-14.15
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -39,15 +39,24 @@ scriptversion=2005-05-14.22
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# put in absolute paths if you don't have them in your path; or use env. vars.
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
@ -58,7 +67,13 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
@ -95,7 +110,7 @@ Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
@ -111,9 +126,15 @@ while test -n "$1"; do
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
-o) chowncmd="$chownprog $2"
@ -136,25 +157,33 @@ while test -n "$1"; do
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
done
if test -z "$1"; then
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
@ -164,6 +193,33 @@ if test -z "$1"; then
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
@ -173,15 +229,11 @@ do
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
@ -208,53 +260,188 @@ do
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
obsolete_mkdir_used=false
# Make sure that the destination directory exists.
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
pathcomp=
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
oIFS=$IFS
IFS=/
$posix_glob && set -f
set fnord $dstdir
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
$posix_glob && set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
pathcomp=$pathcomp/
done
fi
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
@ -262,10 +449,9 @@ do
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@ -276,10 +462,10 @@ do
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
@ -291,11 +477,12 @@ do
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
@ -304,16 +491,13 @@ do
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
$doit $mvcmd "$dsttmp" "$dst"
}
}
fi || { (exit 1); exit 1; }
done
} || exit 1
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

View File

@ -1,9 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-06-08.21
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
@ -33,6 +33,8 @@ if test $# -eq 0; then
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
@ -44,7 +46,7 @@ fi
msg="missing on your system"
case "$1" in
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
@ -77,6 +79,7 @@ Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
@ -106,7 +109,7 @@ esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
@ -135,7 +138,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@ -164,7 +167,7 @@ WARNING: \`$1' is $msg. You should only need it if
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
@ -192,8 +195,8 @@ WARNING: \`$1' is needed, but is $msg.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
@ -214,25 +217,25 @@ WARNING: \`$1' $msg. You should only need it if
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
if test $# -ne 1; then
eval LASTARG="\${$#}"
case "$LASTARG" in
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
@ -244,18 +247,18 @@ WARNING: \`$1' is $msg. You should only need it if
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
if test $# -ne 1; then
eval LASTARG="\${$#}"
case "$LASTARG" in
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
@ -267,11 +270,9 @@ WARNING: \`$1' is $msg. You should only need it if
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
@ -289,11 +290,17 @@ WARNING: \`$1' is $msg. You should only need it if
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
@ -317,13 +324,13 @@ WARNING: \`$1' is $msg. You should only need it if
fi
firstarg="$1"
if shift; then
case "$firstarg" in
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0

View File

@ -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)

View File

@ -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));

View File

@ -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,25 @@ 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);
strncpy(new_name, name, sizeof(new_name));
new_name[sizeof(new_name)-1] = '\0';
name = new_name;
}
/* change '-' to '_' */
s = name;
while ((dot = index(s, '-'))) {
while ((dot = strchr(s, '-'))) {
*dot = '_';
s = dot;
}

View File

@ -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>

View File

@ -2080,12 +2080,12 @@ xpmParseDataAndCreate(display, data, image_return, shapeimage_return,
xpmGetCmt(data, &hints_cmt);
/*
* init the hastable
* init the hashtable
*/
if (USE_HASHTABLE) {
ErrorStatus = xpmHashTableInit(&hashtable);
if (ErrorStatus != XpmSuccess)
return (ErrorStatus);
RETURN(ErrorStatus);
}
/*

View File

@ -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 */

View File

@ -209,6 +209,7 @@ xpmHashTableInit(table)
table->size = INITIAL_HASH_SIZE;
table->limit = table->size / 3;
table->used = 0;
table->atomTable = NULL;
if (table->size >= UINT_MAX / sizeof(*atomTable))
return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable));

View File

@ -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)) {
@ -702,12 +702,12 @@ xpmParseData(data, image, info)
xpmGetCmt(data, &hints_cmt);
/*
* init the hastable
* init the hashtable
*/
if (USE_HASHTABLE) {
ErrorStatus = xpmHashTableInit(&hashtable);
if (ErrorStatus != XpmSuccess)
return (ErrorStatus);
RETURN(ErrorStatus);
}
/*

View File

@ -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 */

View File

@ -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
@ -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:%=$(srcdir)/%)
xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES:%=$(srcdir)/%)
CLEANFILES += sxpm.po
endif
endif
EXTRA_DIST = \

View File

@ -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);
}
}