sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-28 05:57:34 +00:00
commit 88965415ff
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
26235 changed files with 29195616 additions and 0 deletions

View file

@ -0,0 +1,25 @@
if BUILD_SXPM
bin_PROGRAMS = sxpm
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CFLAGS = $(CWARNFLAGS) $(SXPM_CFLAGS)
sxpm_SOURCES = sxpm.c
LDADD = $(SXPM_LIBS) $(top_builddir)/src/libXpm.la
if USE_GETTEXT
noinst_DATA = sxpm.po
sxpm.po: $(sxpm_SOURCES:%=$(srcdir)/%)
$(AM_V_GEN)xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES:%=$(srcdir)/%)
CLEANFILES = sxpm.po
endif
endif
EXTRA_DIST = \
plaid_ext.xpm \
plaid_mask.xpm \
plaid.xpm

632
lib/libXpm/sxpm/Makefile.in Normal file
View file

@ -0,0 +1,632 @@
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@BUILD_SXPM_TRUE@bin_PROGRAMS = sxpm$(EXEEXT)
subdir = sxpm
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am__sxpm_SOURCES_DIST = sxpm.c
@BUILD_SXPM_TRUE@am_sxpm_OBJECTS = sxpm.$(OBJEXT)
sxpm_OBJECTS = $(am_sxpm_OBJECTS)
sxpm_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
@BUILD_SXPM_TRUE@sxpm_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@BUILD_SXPM_TRUE@ $(top_builddir)/src/libXpm.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(sxpm_SOURCES)
DIST_SOURCES = $(am__sxpm_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(noinst_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LIPO = @LIPO@
LN_S = @LN_S@
LOCALEDIR = @LOCALEDIR@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
SXPM_CFLAGS = @SXPM_CFLAGS@
SXPM_LIBS = @SXPM_LIBS@
VERSION = @VERSION@
XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
XPM_CFLAGS = @XPM_CFLAGS@
XPM_LIBS = @XPM_LIBS@
XPM_PATH_COMPRESS = @XPM_PATH_COMPRESS@
XPM_PATH_GZIP = @XPM_PATH_GZIP@
XPM_PATH_UNCOMPRESS = @XPM_PATH_UNCOMPRESS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@BUILD_SXPM_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/include
@BUILD_SXPM_TRUE@AM_CFLAGS = $(CWARNFLAGS) $(SXPM_CFLAGS)
@BUILD_SXPM_TRUE@sxpm_SOURCES = sxpm.c
@BUILD_SXPM_TRUE@LDADD = $(SXPM_LIBS) $(top_builddir)/src/libXpm.la
@BUILD_SXPM_TRUE@@USE_GETTEXT_TRUE@noinst_DATA = sxpm.po
@BUILD_SXPM_TRUE@@USE_GETTEXT_TRUE@CLEANFILES = sxpm.po
EXTRA_DIST = \
plaid_ext.xpm \
plaid_mask.xpm \
plaid.xpm
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sxpm/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign sxpm/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
sxpm$(EXEEXT): $(sxpm_OBJECTS) $(sxpm_DEPENDENCIES) $(EXTRA_sxpm_DEPENDENCIES)
@rm -f sxpm$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sxpm_OBJECTS) $(sxpm_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sxpm.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool cscopelist ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
@BUILD_SXPM_TRUE@@USE_GETTEXT_TRUE@sxpm.po: $(sxpm_SOURCES:%=$(srcdir)/%)
@BUILD_SXPM_TRUE@@USE_GETTEXT_TRUE@ $(AM_V_GEN)xgettext -c"L10N_Comments" -d sxpm -n $(sxpm_SOURCES:%=$(srcdir)/%)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

34
lib/libXpm/sxpm/plaid.xpm Normal file
View file

@ -0,0 +1,34 @@
/* XPM */
static char * plaid[] = {
/* plaid pixmap
* width height ncolors chars_per_pixel */
"22 22 4 2 ",
/* colors */
" c red m white s light_color ",
"Y c green m black s lines_in_mix ",
"+ c yellow m white s lines_in_dark ",
"x m black s dark_color ",
/* pixels */
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
"x x x x x x x x x x x x x x x x x x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x "
} ;

View file

@ -0,0 +1,43 @@
/* XPM */
static char * plaid[] = {
/* plaid pixmap
* width height ncolors chars_per_pixel */
"22 22 4 2 XPMEXT",
/* colors */
" c red m white s light_color ",
"Y c green m black s lines_in_mix ",
"+ c yellow m white s lines_in_dark ",
"x m black s dark_color ",
/* pixels */
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
"x x x x x x x x x x x x x x x x x x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
"XPMEXT ext1 data1",
"XPMEXT ext2",
"data2_1",
"data2_2",
"XPMEXT ext3",
"data3",
"XPMEXT",
"data4",
"XPMENDEXT"
} ;

View file

@ -0,0 +1,35 @@
/* XPM */
static char * plaid[] = {
/* plaid pixmap
* width height ncolors chars_per_pixel */
"22 22 5 2",
/* colors */
". c red m white s light_color ",
"Y c green m black s lines_in_mix ",
"+ c yellow m white s lines_in_dark ",
"x m black s dark_color ",
" c none s mask ",
/* pixels */
" x x x x x + x x x x x ",
" . x x x x x x x x x x x ",
" . x x x x x x + x x x x x ",
" . x . x x x x x x x x x x x ",
" . x . x x x x x x + x x x x x ",
" Y Y Y Y Y + x + x + x + x + x + ",
" x x . x . x x x x x x + x x x x x ",
" . x . x . x . x x x x x x x x x x x ",
" . x x x . x . x x x x x x + x x x x x ",
" . x . x . x . x . x x x x x x x x x x x ",
" . x . x x x . x . x x x x x x + x x x x x ",
". . . . . x . . . . . x . x . x Y x . x . x ",
". . . . . x . . . . . . x . x . Y . x . x . ",
". . . . . x . . . . . x . x . x Y x . x . x ",
". . . . . x . . . . . . x . x . Y . x . x . ",
". . . . . x . . . . . x . x . x Y x . x . x ",
"x x x x x x x x x x x x x x x x x x x x x x ",
". . . . . x . . . . . x . x . x Y x . x . x ",
". . . . . x . . . . . . x . x . Y . x . x . ",
". . . . . x . . . . . x . x . x Y x . x . x ",
". . . . . x . . . . . . x . x . Y . x . x . ",
". . . . . x . . . . . x . x . x Y x . x . x "
} ;

747
lib/libXpm/sxpm/sxpm.c Normal file
View file

@ -0,0 +1,747 @@
/*
* Copyright (C) 1989-95 GROUPE BULL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of GROUPE BULL shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from GROUPE BULL.
*/
/*****************************************************************************\
* sxpm.c: *
* *
* Show XPM File program *
* *
* Developed by Arnaud Le Hors *
\*****************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#include <X11/Shell.h>
#ifdef VMS
#include <X11/shape.h>
#else
#include <X11/extensions/shape.h>
#endif
#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[] = {
/* width height ncolors chars_per_pixel */
"22 22 4 2 XPMEXT",
/* colors */
" c red m white s light_color",
"Y c green m black s lines_in_mix",
"+ c yellow m white s lines_in_dark",
"x m black s dark_color",
/* pixels */
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x x x x x x x x x x x x x ",
"x x x x x x x x x x x x + x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
"x x x x x x x x x x x x x x x x x x x x x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
" x x x Y x x ",
" x x x x Y x x x ",
"bullshit",
"XPMEXT ext1 data1",
"XPMEXT ext2",
"data2_1",
"data2_2",
"XPMEXT",
"foo",
"",
"XPMEXT ext3",
"data3",
"XPMENDEXT"
};
#define win XtWindow(topw)
#define dpy XtDisplay(topw)
#define root XRootWindowOfScreen(XtScreen(topw))
#define xrdb XtDatabase(dpy)
static Colormap colormap;
void Usage(void) _X_NORETURN;
void ErrorMessage(int ErrorStatus, const char *tag);
void Punt(int i) _X_NORETURN;
void VersionInfo(void);
void kinput(Widget widget, char *tag, XEvent *xe, Boolean *b);
void GetNumbers(int num, int *format_return,
int *libmajor_return,
char *libminor_return);
#define IWIDTH 50
#define IHEIGHT 50
typedef struct _XpmIcon {
Pixmap pixmap;
Pixmap mask;
XpmAttributes attributes;
} XpmIcon;
static char **command;
static Widget topw;
static XpmIcon view, icon;
static XrmOptionDescRec options[] = {
{"-hints", ".hints", XrmoptionNoArg, (XtPointer) "True"},
{"-icon", ".icon", XrmoptionSepArg, (XtPointer) NULL},
};
int
main(
int argc,
char **argv)
{
int ErrorStatus;
unsigned int verbose = 0; /* performs verbose output */
unsigned int stdinf = 1; /* read from stdin */
unsigned int stdoutf = 0; /* write to stdout */
unsigned int nod = 0; /* no display */
unsigned int nom = 0; /* no mask display */
unsigned int incResize = 0;
unsigned int resize = 0;
unsigned int w_rtn;
unsigned int h_rtn;
char *input = NULL;
char *output = NULL;
char *iconFile = NULL;
unsigned int numsymbols = 0;
XpmColorSymbol symbols[10];
char *stype;
XrmValue val;
unsigned long valuemask = 0;
int n;
Arg args[4];
#ifdef Debug
char **data;
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) {
/* 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));
/*
* geometry management
*/
if (XrmGetResource(xrdb, NULL, "sxpm.geometry", &stype, &val)
|| XrmGetResource(xrdb, NULL, "Sxpm.geometry", &stype, &val)) {
int flags;
int x_rtn;
int y_rtn;
char *geo = NULL;
geo = (char *) val.addr;
flags = XParseGeometry(geo, &x_rtn, &y_rtn,
(unsigned int *) &w_rtn,
(unsigned int *) &h_rtn);
if (!((WidthValue & flags) && (HeightValue & flags)))
resize = 1;
} else
resize = 1;
n = 0;
if (resize) {
w_rtn = 0;
h_rtn = 0;
XtSetArg(args[n], XtNwidth, 1);
n++;
XtSetArg(args[n], XtNheight, 1);
n++;
}
XtSetArg(args[n], XtNmappedWhenManaged, False);
n++;
XtSetArg(args[n], XtNinput, True);
n++;
XtSetValues(topw, args, n);
if ((XrmGetResource(xrdb, "sxpm.hints", "", &stype, &val)
|| XrmGetResource(xrdb, "Sxpm.hints", "", &stype, &val))
&& !strcmp((char *) val.addr, "True")) {
/* gotcha */
incResize = 1;
resize = 1;
}
/*
* icon management
*/
if (XrmGetResource(xrdb, "sxpm.icon", "", &stype, &val)
|| XrmGetResource(xrdb, "Sxpm.icon", "", &stype, &val)) {
iconFile = (char *) val.addr;
}
if (iconFile) {
XColor color, junk;
Pixel bpix;
Window iconW;
if (XAllocNamedColor(dpy, colormap, "black", &color, &junk))
bpix = color.pixel;
else
bpix = XBlackPixelOfScreen(XtScreen(topw));
iconW = XCreateSimpleWindow(dpy, root, 0, 0,
IWIDTH, IHEIGHT, 1, bpix, bpix);
icon.attributes.valuemask = XpmReturnAllocPixels;
ErrorStatus = XpmReadFileToPixmap(dpy, root, iconFile, &icon.pixmap,
&icon.mask, &icon.attributes);
ErrorMessage(ErrorStatus, "Icon");
XSetWindowBackgroundPixmap(dpy, iconW, icon.pixmap);
n = 0;
XtSetArg(args[n], XtNbackground, bpix);
n++;
XtSetArg(args[n], XtNiconWindow, iconW);
n++;
XtSetValues(topw, args, n);
}
/*
* arguments parsing
*/
command = argv;
for (n = 1; n < argc; n++) {
if (strcmp(argv[n], "-plaid") == 0) {
stdinf = 0;
continue;
}
if (argv[n][0] != '-') {
stdinf = 0;
input = argv[n];
continue;
}
if ((strlen(argv[n]) == 1) && (argv[n][0] == '-'))
/* stdin */
continue;
if (strcmp(argv[n], "-o") == 0) {
if (n < argc - 1) {
if ((strlen(argv[n + 1]) == 1) && (argv[n + 1][0] == '-'))
stdoutf = 1;
else
output = argv[n + 1];
n++;
continue;
} else
Usage();
}
if (strcmp(argv[n], "-nod") == 0) {
nod = 1;
continue;
}
if (strcmp(argv[n], "-nom") == 0) {
nom = 1;
continue;
}
if (strcmp(argv[n], "-sc") == 0) {
if (n < argc - 2) {
valuemask |= XpmColorSymbols;
symbols[numsymbols].name = argv[++n];
symbols[numsymbols++].value = argv[++n];
continue;
} else
Usage();
}
if (strcmp(argv[n], "-sp") == 0) {
if (n < argc - 2) {
valuemask |= XpmColorSymbols;
symbols[numsymbols].name = argv[++n];
symbols[numsymbols].value = NULL;
symbols[numsymbols++].pixel = atol(argv[++n]);
continue;
}
}
if (strcmp(argv[n], "-cp") == 0) {
if (n < argc - 2) {
valuemask |= XpmColorSymbols;
symbols[numsymbols].name = NULL;
symbols[numsymbols].value = argv[++n];
symbols[numsymbols++].pixel = atol(argv[++n]);
continue;
}
}
if (strcmp(argv[n], "-mono") == 0) {
valuemask |= XpmColorKey;
view.attributes.color_key = XPM_MONO;
continue;
}
if (strcmp(argv[n], "-gray4") == 0 || strcmp(argv[n], "-grey4") == 0) {
valuemask |= XpmColorKey;
view.attributes.color_key = XPM_GRAY4;
continue;
}
if (strcmp(argv[n], "-gray") == 0 || strcmp(argv[n], "-grey") == 0) {
valuemask |= XpmColorKey;
view.attributes.color_key = XPM_GRAY;
continue;
}
if (strcmp(argv[n], "-color") == 0) {
valuemask |= XpmColorKey;
view.attributes.color_key = XPM_COLOR;
continue;
}
if (strncmp(argv[n], "-closecolors", 6) == 0) {
valuemask |= XpmCloseness;
view.attributes.closeness = 40000;
continue;
}
if (strcmp(argv[n], "-rgb") == 0) {
if (n < argc - 1) {
valuemask |= XpmRgbFilename;
view.attributes.rgb_fname = argv[++n];
continue;
} else
Usage();
}
if (strncmp(argv[n], "-version", 4) == 0) {
VersionInfo();
exit(0);
}
if (strcmp(argv[n], "-v") == 0) {
verbose = 1;
continue;
}
if (strcmp(argv[n], "-pcmap") == 0) {
valuemask |= XpmColormap;
continue;
}
Usage();
}
XtRealizeWidget(topw);
if (valuemask & XpmColormap) {
colormap = XCreateColormap(dpy, win,
DefaultVisual(dpy, DefaultScreen(dpy)),
AllocNone);
view.attributes.colormap = colormap;
XSetWindowColormap(dpy, win, colormap);
}
view.attributes.colorsymbols = symbols;
view.attributes.numsymbols = numsymbols;
view.attributes.valuemask = valuemask;
#ifdef Debug
/* this is just to test the XpmCreateDataFromPixmap function */
view.attributes.valuemask |= XpmReturnAllocPixels;
view.attributes.valuemask |= XpmReturnExtensions;
ErrorStatus = XpmCreatePixmapFromData(dpy, win, plaid,
&view.pixmap, &view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "Plaid");
ErrorStatus = XpmCreateDataFromPixmap(dpy, &data, view.pixmap, view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "Data");
if (verbose && view.attributes.nextensions) {
unsigned int i, j;
for (i = 0; i < view.attributes.nextensions; i++) {
fprintf(stderr, "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",
view.attributes.extensions[i].lines[j]);
}
}
XFreePixmap(dpy, view.pixmap);
if (view.mask)
XFreePixmap(dpy, view.mask);
XFreeColors(dpy, colormap,
view.attributes.alloc_pixels,
view.attributes.nalloc_pixels, 0);
XpmFreeAttributes(&view.attributes);
view.attributes.valuemask = valuemask;
#endif
if (input || stdinf) {
view.attributes.valuemask |= XpmReturnInfos;
view.attributes.valuemask |= XpmReturnAllocPixels;
view.attributes.valuemask |= XpmReturnExtensions;
#ifdef Debug
XpmFree(data);
/*
* this is just to test the XpmCreatePixmapFromBuffer and
* XpmCreateBufferFromPixmap functions
*/
ErrorStatus = XpmReadFileToBuffer(input, &buffer);
ErrorMessage(ErrorStatus, "CreateBufferFromFile");
ErrorStatus = XpmCreatePixmapFromBuffer(dpy, win, buffer,
&view.pixmap, &view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "CreatePixmapFromBuffer");
XpmFree(buffer);
ErrorStatus = XpmCreateBufferFromPixmap(dpy, &buffer,
view.pixmap, view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "CreateBufferFromPixmap");
ErrorStatus = XpmWriteFileFromBuffer("buffer_output", buffer);
ErrorMessage(ErrorStatus, "WriteFileFromBuffer");
XpmFree(buffer);
if (view.pixmap) {
XFreePixmap(dpy, view.pixmap);
if (view.mask)
XFreePixmap(dpy, view.mask);
XFreeColors(dpy, colormap, view.attributes.alloc_pixels,
view.attributes.nalloc_pixels, 0);
XpmFreeAttributes(&view.attributes);
}
ErrorStatus = XpmReadFileToData(input, &data);
ErrorMessage(ErrorStatus, "ReadFileToData");
ErrorStatus = XpmCreatePixmapFromData(dpy, win, data,
&view.pixmap, &view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "CreatePixmapFromData");
ErrorStatus = XpmWriteFileFromData("sxpmout.xpm", data);
ErrorMessage(ErrorStatus, "WriteFileFromData");
XpmFree(data);
XpmFreeAttributes(&view.attributes);
#endif
ErrorStatus = XpmReadFileToPixmap(dpy, win, input,
&view.pixmap, &view.mask,
&view.attributes);
ErrorMessage(ErrorStatus, "Read");
if (verbose && view.attributes.nextensions) {
unsigned int i, j;
for (i = 0; i < view.attributes.nextensions; i++) {
/* 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",
view.attributes.extensions[i].lines[j]);
}
}
} else {
#ifdef Debug
ErrorStatus = XpmCreatePixmapFromData(dpy, win, data,
&view.pixmap, &view.mask,
&view.attributes);
XpmFree(data);
#else
ErrorStatus = XpmCreatePixmapFromData(dpy, win, plaid,
&view.pixmap, &view.mask,
&view.attributes);
#endif
ErrorMessage(ErrorStatus, "Plaid");
}
if (output || stdoutf) {
ErrorStatus = XpmWriteFileFromPixmap(dpy, output, view.pixmap,
view.mask, &view.attributes);
ErrorMessage(ErrorStatus, "Write");
}
if (!nod) {
/*
* manage display if requested
*/
XSizeHints size_hints;
char *xString = NULL;
if (w_rtn && h_rtn
&& ((w_rtn < view.attributes.width)
|| h_rtn < view.attributes.height)) {
resize = 1;
}
if (resize) {
XtResizeWidget(topw,
view.attributes.width, view.attributes.height, 1);
}
if (incResize) {
size_hints.flags = USSize | PMinSize | PResizeInc;
size_hints.height = view.attributes.height;
size_hints.width = view.attributes.width;
size_hints.height_inc = view.attributes.height;
size_hints.width_inc = view.attributes.width;
} else
size_hints.flags = PMinSize;
size_hints.min_height = view.attributes.height;
size_hints.min_width = view.attributes.width;
XSetWMNormalHints(dpy, win, &size_hints);
if (input) {
xString = (char *) XtMalloc((sizeof(char) * strlen(input)) + 20);
sprintf(xString, "Sxpm: %s", input);
XStoreName(dpy, win, xString);
XSetIconName(dpy, win, xString);
} else if (stdinf) {
XStoreName(dpy, win, "Sxpm: stdin");
XSetIconName(dpy, win, "Sxpm: stdin");
} else {
XStoreName(dpy, win, "Sxpm");
XSetIconName(dpy, win, "Sxpm");
}
XtAddEventHandler(topw, KeyPressMask, False,
(XtEventHandler) kinput, NULL);
XSetWindowBackgroundPixmap(dpy, win, view.pixmap);
if (view.mask && !nom)
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0,
view.mask, ShapeSet);
XClearWindow(dpy, win);
XtMapWidget(topw);
if (xString)
XtFree(xString);
XtMainLoop();
}
Punt(0);
}
void
Usage(void)
{
/* 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\
[-hints] Set ResizeInc for window.\n\
[-icon filename] Set pixmap for iconWindow.\n\
[-plaid] Read the included plaid pixmap.\n\
[filename] Read from file 'filename', and from standard\n\
input if 'filename' is '-'.\n\
[-o filename] Write to file 'filename', and to standard\n\
output if 'filename' is '-'.\n\
[-pcmap] Use a private colormap.\n\
[-closecolors] Try to use `close' colors.\n\
[-nod] Don't display in window.\n\
[-nom] Don't use clip mask if any.\n\
[-mono] Use the colors specified for a monochrome visual.\n\
[-grey4] Use the colors specified for a 4 greyscale visual.\n\
[-grey] Use the colors specified for a greyscale visual.\n\
[-color] Use the colors specified for a color visual.\n\
[-sc symbol color] Override color defaults.\n\
[-sp symbol pixel] Override color defaults.\n\
[-cp color pixel] Override color defaults.\n\
[-rgb filename] Search color names in the rgb text file 'filename'.\n\
[-v] Verbose - print out extensions.\n\
[-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"));
exit(0);
}
void
ErrorMessage(
int ErrorStatus,
const char *tag)
{
char *error = NULL;
char *warning = NULL;
switch (ErrorStatus) {
case XpmSuccess:
return;
case XpmColorError:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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)
/* 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) {
/* 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);
}
}
void
Punt(int i)
{
if (icon.pixmap) {
XFreePixmap(dpy, icon.pixmap);
if (icon.mask)
XFreePixmap(dpy, icon.mask);
XFreeColors(dpy, colormap,
icon.attributes.alloc_pixels,
icon.attributes.nalloc_pixels, 0);
XpmFreeAttributes(&icon.attributes);
}
if (view.pixmap) {
XFreePixmap(dpy, view.pixmap);
if (view.mask)
XFreePixmap(dpy, view.mask);
XFreeColors(dpy, colormap,
view.attributes.alloc_pixels,
view.attributes.nalloc_pixels, 0);
XpmFreeAttributes(&view.attributes);
}
exit(i);
}
void
kinput(
Widget widget,
char *tag,
XEvent *xe,
Boolean *b)
{
char c = '\0';
XLookupString(&(xe->xkey), &c, 1, NULL, NULL);
if (c == 'q' || c == 'Q')
Punt(0);
}
/*
* small function to extract various version numbers from the given global
* number (following the rule described in xpm.h).
*/
void
GetNumbers(
int num,
int *format_return,
int *libmajor_return,
char *libminor_return)
{
*format_return = num / 10000;
*libmajor_return = (num % 10000) / 100;
*libminor_return = 'a' + (num % 10000) % 100 - 1;
}
void
VersionInfo(void)
{
int format, libmajor;
char libminor;
GetNumbers(XpmIncludeVersion, &format, &libmajor, &libminor);
/* 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 when sxpm -version is called.
*/
if (XpmIncludeVersion != XpmLibraryVersion()) {
GetNumbers(XpmLibraryVersion(), &format, &libmajor, &libminor);
fprintf(stderr, gettext("using the XPM library version: %d.%d%c\n"),
format, libmajor, libminor);
}
}