Update xwd to version 1.0.9

This commit is contained in:
matthieu
2023-07-03 07:17:28 +00:00
parent 341d6380db
commit b19e0af9de
15 changed files with 3951 additions and 3407 deletions

View File

@@ -1,3 +1,133 @@
commit a6663cdafe97e3e7a1c60d03fc576dfe62b20d88
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jun 3 10:23:24 2023 -0700
xwd 1.0.9
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 55e90e61eb0ec32b6998ba3c562df3897aebbb43
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Feb 11 18:26:12 2023 -0800
Make -help & -version work without requiring an open display
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit e9e78bf8f2de870fbf90cc247721df16805ba3da
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 15:07:14 2022 -0800
list.c: Stop building functions that are never called
This general-purpose list implementation includes functions xwd
doesn't use, so we don't need to build those here.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7d59a57f67f1c0be40b7e2ff0323026824b1f403
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 15:05:15 2022 -0800
Delete commented-out local copy of list function prototypes
Duplicated list.h header contents
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 0501a64d58ae6c1e9287188de120efbdd6aadd2d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 15:02:11 2022 -0800
Variable scope reduction as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 9bf3f50c2a287a1d455df3e36e751604d7d50381
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 14:33:08 2022 -0800
Remove unnecessary casts from malloc() and free() calls
Not needed in C89 & later
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit fd5e1e9ee9ed359e0ad0dddfbaa4d9c84dcb1810
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 14:27:25 2022 -0800
Handle -Wcomma warnings from clang
xwd.c:332:22: warning: possible misuse of comma operator here [-Wcomma]
width += absx, absx = 0;
^
xwd.c:334:23: warning: possible misuse of comma operator here [-Wcomma]
height += absy, absy = 0;
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c0601f552aa34af005270f3a65ec0e92421497cb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 13 14:23:28 2022 -0800
Remove unused macros
Found by clang:
multiVis.c:977:9: warning: macro is not used [-Wunused-macros]
#define DIRECT_COLOR 0x11
^
multiVis.c:976:9: warning: macro is not used [-Wunused-macros]
#define TRUE_COLOR 0x10
^
multiVis.c:975:9: warning: macro is not used [-Wunused-macros]
#define PSEUDO_COLOR 0x04
^
multiVis.c:974:9: warning: macro is not used [-Wunused-macros]
#define GRAY_SCALE 0x02
^
multiVis.c:973:9: warning: macro is not used [-Wunused-macros]
#define STATIC_GRAY 0x01
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit da73a432704776e7e78097fb0c93d81e90bc7859
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Jul 28 17:30:21 2022 -0700
gitlab CI: stop requiring Signed-off-by in commits
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d232d25f338fca51d583d5888cb9171fd958536e
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Dec 7 14:35:24 2021 -0800
Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 3eeb0d0e145b1ae47d2ec8d638f46960a321cdf7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Dec 7 14:35:21 2021 -0800
gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit e0341cc8ddd76e6af2b11bbcdda25f470aa4160d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Nov 28 14:14:14 2021 -0800
Fix spelling/wording issues
Found by using:
codespell --builtin clear,rare,usage,informal,code,names
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 57586247e0c6bce744c04f072185762e76879baf
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Aug 1 17:14:35 2021 -0700

View File

@@ -181,9 +181,9 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz
GZIP_ENV = --best
DIST_TARGETS = dist-bzip2 dist-gzip
DIST_TARGETS = dist-xz dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -204,7 +204,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -215,11 +214,9 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
@@ -657,6 +654,7 @@ distdir: $(DISTFILES)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
@@ -664,7 +662,6 @@ dist-bzip2: distdir
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)

View File

@@ -6,7 +6,7 @@ Xorg mailing list:
https://lists.x.org/mailman/listinfo/xorg
The master development code repository can be found at:
The primary development code repository can be found at:
https://gitlab.freedesktop.org/xorg/app/xwd

72
app/xwd/aclocal.m4 vendored
View File

@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
@@ -1318,7 +1318,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2005, 2023, Oracle and/or its affiliates.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@@ -1355,7 +1355,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.19.2])
m4_define([vers_have], [1.20.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -1376,7 +1376,7 @@ AM_MAINTAINER_MODE
# such as man pages and config files
AC_DEFUN([XORG_PROG_RAWCPP],[
AC_REQUIRE([AC_PROG_CPP])
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
# Check for flag to avoid builtin definitions - assumes unix is predefined,
@@ -1686,7 +1686,7 @@ AC_SUBST(MAKE_HTML)
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-xmlto option, it allows maximum flexibilty in making decisions
# the --with-xmlto option, it allows maximum flexibility in making decisions
# as whether or not to use the xmlto package. When DEFAULT is not specified,
# --with-xmlto assumes 'auto'.
#
@@ -1900,7 +1900,7 @@ AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-asciidoc option, it allows maximum flexibilty in making decisions
# the --with-asciidoc option, it allows maximum flexibility in making decisions
# as whether or not to use the asciidoc package. When DEFAULT is not specified,
# --with-asciidoc assumes 'auto'.
#
@@ -1970,7 +1970,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-doxygen option, it allows maximum flexibilty in making decisions
# the --with-doxygen option, it allows maximum flexibility in making decisions
# as whether or not to use the doxygen package. When DEFAULT is not specified,
# --with-doxygen assumes 'auto'.
#
@@ -2054,7 +2054,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-groff option, it allows maximum flexibilty in making decisions
# the --with-groff option, it allows maximum flexibility in making decisions
# as whether or not to use the groff package. When DEFAULT is not specified,
# --with-groff assumes 'auto'.
#
@@ -2162,7 +2162,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-fop option, it allows maximum flexibilty in making decisions
# the --with-fop option, it allows maximum flexibility in making decisions
# as whether or not to use the fop package. When DEFAULT is not specified,
# --with-fop assumes 'auto'.
#
@@ -2256,7 +2256,7 @@ AC_SUBST([M4], [$ac_cv_path_M4])
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
# presence of the tool and obtain it's path in separate variables. Coupled with
# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
# the --with-ps2pdf option, it allows maximum flexibility in making decisions
# as whether or not to use the ps2pdf package. When DEFAULT is not specified,
# --with-ps2pdf assumes 'auto'.
#
@@ -2311,7 +2311,7 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
# not at the appropriate level. This macro enables a builder to skip all
# documentation targets except traditional man pages.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -2344,7 +2344,7 @@ AC_MSG_RESULT([$build_docs])
#
# This macro enables a builder to skip all developer documentation.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -2377,7 +2377,7 @@ AC_MSG_RESULT([$build_devel_docs])
#
# This macro enables a builder to skip all functional specification targets.
# Combined with the specific tool checking macros XORG_WITH_*, it provides
# maximum flexibilty in controlling documentation building.
# maximum flexibility in controlling documentation building.
# Refer to:
# XORG_WITH_XMLTO --with-xmlto
# XORG_WITH_ASCIIDOC --with-asciidoc
@@ -2852,7 +2852,11 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
AC_DEFUN([XORG_COMPILER_BRAND], [
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
dnl and complains that AC_PROG_CC_C99 is obsolete
m4_version_prereq([2.70],
[AC_REQUIRE([AC_PROG_CC])],
[AC_REQUIRE([AC_PROG_CC_C99])])
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
@@ -2868,7 +2872,7 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
# Minimum version: 1.16.0
#
# Test if the compiler works when passed the given flag as a command line argument.
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
# If it succeeds, the flag is appended to the given variable. If not, it tries the
# next flag in the list until there are no more options.
#
# Note that this does not guarantee that the compiler supports the flag as some
@@ -2884,7 +2888,11 @@ AC_LANG_COMPILER_REQUIRE
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC
dnl and complains that AC_PROG_CC_C99 is obsolete
m4_version_prereq([2.70],
[AC_REQUIRE([AC_PROG_CC])],
[AC_REQUIRE([AC_PROG_CC_C99])])
define([PREFIX], [C])
define([CACHE_PREFIX], [cc])
define([COMPILER], [$CC])
@@ -3025,7 +3033,7 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds
# Turn some warnings into errors, so we don't accidentally get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
@@ -3134,23 +3142,35 @@ AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS
# --------------------
# Minimum version: 1.3.0
# XORG_DEFAULT_NOCODE_OPTIONS
# ---------------------------
# Minimum version: 1.20.0
#
# Defines default options for X.Org modules.
# Defines default options for X.Org modules which don't compile code,
# such as fonts, bitmaps, cursors, and docs.
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION
XORG_CHANGELOG
XORG_INSTALL
XORG_MANPAGE_SECTIONS
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
]) # XORG_DEFAULT_NOCODE_OPTIONS
# XORG_DEFAULT_OPTIONS
# --------------------
# Minimum version: 1.3.0
#
# Defines default options for X.Org modules which compile code.
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_DEFAULT_NOCODE_OPTIONS
]) # XORG_DEFAULT_OPTIONS
# XORG_INSTALL()

View File

@@ -3,12 +3,12 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -57,7 +57,9 @@
/* Patch version of this package */
#undef PACKAGE_VERSION_PATCHLEVEL
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Version number of package */

6454
app/xwd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -23,14 +23,13 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xwd], [1.0.8],
AC_INIT([xwd], [1.0.9],
[https://gitlab.freedesktop.org/xorg/app/xwd/issues], [xwd])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE([foreign dist-xz])
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],

View File

@@ -44,7 +44,7 @@ from The Open Group.
#include "dsimple.h"
/*
* Just_display: A group of routines designed to make the writting of simple
* Just_display: A group of routines designed to make the writing of simple
* X11 applications which open a display but do not open
* any windows much faster and easier. Unless a routine says
* otherwise, it may be assumed to require program_name, dpy,
@@ -61,7 +61,7 @@ int screen = 0;
/*
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete)
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obsolete)
* If found, remove it from command line. Don't go past a lone -.
*/
char *
@@ -71,14 +71,13 @@ Get_Display_Name(int *pargc, /* MODIFIED */
int argc = *pargc;
char **pargv = argv + 1;
char *displayname = NULL;
int i;
for (i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) {
char *arg = argv[i];
if (!strcmp(arg, "-display") || !strcmp(arg, "-d")) {
if (++i >= argc)
usage("-display requires an argument");
usage("-display requires an argument", EXIT_FAILURE);
displayname = argv[i];
*pargc -= 2;
@@ -150,7 +149,7 @@ Close_Display(void)
/*
* Select_Window_Args: a rountine to provide a common interface for
* Select_Window_Args: a routine to provide a common interface for
* applications that need to allow the user to select one
* window on the screen for special consideration.
* This routine implements the following command line
@@ -185,7 +184,8 @@ Select_Window_Args(int *rargc, char **argv)
#define OPTION argv[0]
#define NXTOPTP ++argv, --argc>0
#define NXTOPT(arg) if (++argv, --argc==0) usage(arg " requires an argument")
#define NXTOPT(arg) if (++argv, --argc==0) \
usage(arg " requires an argument", EXIT_FAILURE)
#define COPYOPT nargv++[0]=OPTION, nargc++
while (NXTOPTP) {

View File

@@ -61,7 +61,7 @@ Display *Open_Display(const char *);
void Setup_Display_And_Screen(int *, char **);
void Close_Display(void);
Window Select_Window_Args(int *, char **);
void usage(const char *errmsg) _X_NORETURN _X_COLD;
void usage(const char *errmsg, int exitval) _X_NORETURN _X_COLD;
#define X_USAGE "[host:display]" /* X arguments handled by
Get_Display_Name */

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" "" $nl"
IFS=" $tab$nl"
# set DOITPROG to echo to test this script
# 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
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -68,22 +64,16 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@@ -97,7 +87,7 @@ dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -114,18 +104,28 @@ Options:
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
@@ -137,46 +137,62 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-S) backupsuffix="$2"
shift;;
-T) no_target_directory=true;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@@ -207,6 +223,15 @@ if test $# -eq 0; then
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
@@ -223,16 +248,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
u_plus_rw=
else
u_plus_rw='% 200'
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
u_plus_rw=
else
u_plus_rw=,u+rw
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -250,6 +275,10 @@ do
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -266,178 +295,148 @@ do
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
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'
`
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
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;;
# 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
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
# 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
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
mkdir_mode=
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
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
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-writable 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;;
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# 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='';;
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set -f
set fnord $dstdir
shift
$posix_glob set +f
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
test X"$d" = X && 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/
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
# 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
fi
fi
@@ -450,14 +449,25 @@ do
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -472,20 +482,24 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
@@ -493,24 +507,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$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 $dst" >&2
(exit 1); exit 1
}
} &&
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
@@ -519,9 +533,9 @@ do
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -63,7 +63,7 @@ add_to_list(list_ptr lp, void *item)
while (lp->next) {
lp = lp->next;
}
if ((lp->next = (list_ptr) malloc(sizeof(list_item))) == NULL) {
if ((lp->next = malloc(sizeof(list_item))) == NULL) {
return 0;
}
@@ -83,7 +83,7 @@ new_list(void)
{
list_ptr lp;
if ((lp = (list_ptr) malloc(sizeof(list_item)))) {
if ((lp = malloc(sizeof(list_item)))) {
lp->next = NULL;
lp->ptr.item = NULL;
}
@@ -106,7 +106,7 @@ dup_list_head(list_ptr lp, int start_at_curr)
{
list_ptr new_listp;
if ((new_listp = (list_ptr) malloc(sizeof(list_item))) == NULL) {
if ((new_listp = malloc(sizeof(list_item))) == NULL) {
return (list_ptr) NULL;
}
@@ -117,6 +117,7 @@ dup_list_head(list_ptr lp, int start_at_curr)
}
#ifdef BUILD_UNUSED
/** ------------------------------------------------------------------------
Returns the number of items in the list.
-------------------------------------------------------------------- **/
@@ -135,7 +136,7 @@ list_length(list_ptr lp)
/** ------------------------------------------------------------------------
Scans thru list, looking for a node whose ptr.item is equal to
Scans through list, looking for a node whose ptr.item is equal to
the "item" passed in. "Equal" here means the same address - no
attempt is made to match equivalent values stored in different
locations. If a match is found, that node is deleted from the
@@ -161,6 +162,7 @@ delete_from_list(list_ptr lp, void *item)
return NULL;
}
#endif /* BUILD_UNUSED */
/** ------------------------------------------------------------------------
@@ -172,12 +174,9 @@ delete_from_list(list_ptr lp, void *item)
void
delete_list(list_ptr lp, int free_items)
{
list_ptr del_node;
void *item;
while (lp->next) {
del_node = lp->next;
item = del_node->ptr.item;
list_ptr del_node = lp->next;
void *item = del_node->ptr.item;
lp->next = del_node->next;
free(del_node);
if (free_items) {
@@ -189,13 +188,9 @@ delete_list(list_ptr lp, int free_items)
void
delete_list_destroying(list_ptr lp, void destructor(void *item))
{
list_ptr del_node;
void *item;
while (lp->next) {
del_node = lp->next;
item = del_node->ptr.item;
list_ptr del_node = lp->next;
void *item = del_node->ptr.item;
lp->next = del_node->next;
free(del_node);
if (destructor) {
@@ -242,8 +237,10 @@ next_in_list(list_ptr lp)
return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL;
}
#ifdef BUILD_UNUSED
int
list_is_empty(list_ptr lp)
{
return (lp == NULL || lp->next == NULL);
}
#endif /* BUILD_UNUSED */

View File

@@ -126,7 +126,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -137,11 +136,9 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@

View File

@@ -104,18 +104,6 @@ typedef struct {
#define GREEN_SHIFT 8
#define BLUE_SHIFT 0
/*
extern list_ptr new_list();
extern list_ptr dup_list_head();
extern void * first_in_list();
extern void * next_in_list();
extern int add_to_list();
extern void zero_list();
extern void delete_list();
extern void delete_list_destroying();
extern unsigned int list_length();
*/
/* Prototype Declarations for Static Functions */
static void QueryColorMap(Display *, Colormap, Visual *,
XColor **, int *, int *, int *);
@@ -160,22 +148,22 @@ static void
QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis,
XColor **src_colors, int *rShift, int *gShift, int *bShift)
{
unsigned int ncolors, i;
unsigned long redMask, greenMask, blueMask;
int redShift, greenShift, blueShift;
unsigned int ncolors;
XColor *colors;
ncolors = (unsigned) src_vis->map_entries;
*src_colors = colors = calloc(ncolors, sizeof(XColor));
if (src_vis->class != TrueColor && src_vis->class != DirectColor) {
for (i = 0; i < ncolors; i++) {
for (unsigned int i = 0; i < ncolors; i++) {
colors[i].pixel = i;
colors[i].pad = 0;
colors[i].flags = DoRed | DoGreen | DoBlue;
}
}
else { /** src is decomposed rgb ***/
unsigned long redMask, greenMask, blueMask;
int redShift, greenShift, blueShift;
/* Get the X colormap */
redMask = src_vis->red_mask;
@@ -199,7 +187,7 @@ QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis,
*rShift = redShift;
*gShift = greenShift;
*bShift = blueShift;
for (i = 0; i < ncolors; i++) {
for (unsigned int i = 0; i < ncolors; i++) {
if (i <= redMask)
colors[i].pixel = (i << redShift);
if (i <= greenMask)
@@ -277,7 +265,6 @@ TransferImage(Display *disp, XImage *reg_image,
image_region_type *reg, XImage *target_image,
int dst_x, int dst_y)
{
int i, j, old_pixel, new_pixel, red_ind, green_ind, blue_ind;
XColor *colors;
int rShift = 0, gShift = 0, bShift = 0;
@@ -286,15 +273,15 @@ TransferImage(Display *disp, XImage *reg_image,
switch (reg->vis->class) {
case TrueColor:
for (i = 0; i < srch; i++) {
for (j = 0; j < srcw; j++) {
old_pixel = XGetPixel(reg_image, j, i);
for (int i = 0; i < srch; i++) {
for (int j = 0; j < srcw; j++) {
int old_pixel = XGetPixel(reg_image, j, i);
int new_pixel;
if (reg->vis->map_entries == 16) {
red_ind = (old_pixel & reg->vis->red_mask) >> rShift;
green_ind = (old_pixel & reg->vis->green_mask) >> gShift;
blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift;
int red_ind = (old_pixel & reg->vis->red_mask) >> rShift;
int green_ind = (old_pixel & reg->vis->green_mask) >> gShift;
int blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift;
new_pixel = (
((colors[red_ind].red >> 8) << RED_SHIFT) |
@@ -311,15 +298,15 @@ TransferImage(Display *disp, XImage *reg_image,
}
break;
case DirectColor:
for (i = 0; i < srch; i++) {
for (int i = 0; i < srch; i++) {
for (j = 0; j < srcw; j++) {
old_pixel = XGetPixel(reg_image, j, i);
red_ind = (old_pixel & reg->vis->red_mask) >> rShift;
green_ind = (old_pixel & reg->vis->green_mask) >> gShift;
blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift;
for (int j = 0; j < srcw; j++) {
int old_pixel = XGetPixel(reg_image, j, i);
int red_ind = (old_pixel & reg->vis->red_mask) >> rShift;
int green_ind = (old_pixel & reg->vis->green_mask) >> gShift;
int blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift;
new_pixel = (
int new_pixel = (
((colors[red_ind].red >> 8) << RED_SHIFT) |
((colors[green_ind].green >> 8) << GREEN_SHIFT) |
((colors[blue_ind].blue >> 8) << BLUE_SHIFT)
@@ -330,11 +317,11 @@ TransferImage(Display *disp, XImage *reg_image,
}
break;
default:
for (i = 0; i < srch; i++) {
for (j = 0; j < srcw; j++) {
old_pixel = XGetPixel(reg_image, j, i);
for (int i = 0; i < srch; i++) {
for (int j = 0; j < srcw; j++) {
int old_pixel = XGetPixel(reg_image, j, i);
new_pixel = (
int new_pixel = (
((colors[old_pixel].red >> 8) << RED_SHIFT) |
((colors[old_pixel].green >> 8) << GREEN_SHIFT) |
((colors[old_pixel].blue >> 8) << BLUE_SHIFT)
@@ -353,12 +340,9 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
XRectangle bbox, /* bounding box of grabbed area */
list_ptr regions) /* list of regions to read from */
{
image_region_type *reg;
int dst_x, dst_y; /* where in pixmap to write (UL) */
int datalen, diff;
int datalen;
XImage *reg_image, *ximage;
int srcRect_x, srcRect_y, srcRect_width, srcRect_height;
int bytes_per_line;
ximage = XCreateImage(disp, fakeVis, depth, format, 0, NULL, width, height,
@@ -373,27 +357,28 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/
for (reg = (image_region_type *) first_in_list(regions); reg;
reg = (image_region_type *) next_in_list(regions)) {
int rect;
struct my_XRegion *vis_reg;
for (image_region_type *reg = (image_region_type *) first_in_list(regions);
reg; reg = (image_region_type *) next_in_list(regions)) {
vis_reg = (struct my_XRegion *) (reg->visible_region);
for (rect = 0; rect < vis_reg->numRects; rect++) {
struct my_XRegion *vis_reg = (struct my_XRegion *) (reg->visible_region);
for (int rect = 0; rect < vis_reg->numRects; rect++) {
/** ------------------------------------------------------------------------
Intersect bbox with visible part of region giving src rect & output
location. Width is the min right side minus the max left side.
Similar for height. Offset src rect so x,y are relative to
origin of win, not the root-relative visible rect of win.
------------------------------------------------------------------------ **/
srcRect_width =
int srcRect_width =
MIN(vis_reg->rects[rect].x2, bbox.width + bbox.x) -
MAX(vis_reg->rects[rect].x1, bbox.x);
srcRect_height =
int srcRect_height =
MIN(vis_reg->rects[rect].y2, bbox.height + bbox.y) -
MAX(vis_reg->rects[rect].y1, bbox.y);
int srcRect_x, srcRect_y;
int dst_x, dst_y; /* where in pixmap to write (UL) */
diff = bbox.x - vis_reg->rects[rect].x1;
int diff = bbox.x - vis_reg->rects[rect].x1;
srcRect_x = MAX(0,diff) +
(vis_reg->rects[rect].x1 - reg->x_rootrel - reg->border);
dst_x = MAX(0, -diff);
@@ -439,17 +424,12 @@ ReadAreaToImage(Display *disp,
int depth;
XImage *ximage, *ximage_ipm = NULL;
Visual fakeVis;
int x1, y1;
XImage *image;
#if 0
unsigned char *pmData, *ipmData;
#endif
int transparentColor, transparentType;
int srcRect_x, srcRect_y, srcRect_width, srcRect_height;
int diff;
int dst_x, dst_y; /* where in pixmap to write (UL) */
int pixel;
bbox.x = x; /* init X rect for bounding box */
bbox.y = y;
@@ -475,13 +455,16 @@ ReadAreaToImage(Display *disp,
#endif
}
/* Now tranverse the overlay visual windows and test for transparency index. */
/* If you find one, subsitute the value from the matching image plane pixmap. */
/* If you find one, substitute the value from the matching image plane pixmap. */
for (reg = (image_region_type *) first_in_list(vis_regions); reg;
reg = (image_region_type *) next_in_list(vis_regions)) {
if (src_in_overlay(reg, numOverlayVisuals, pOverlayVisuals,
&transparentColor, &transparentType)) {
int srcRect_x, srcRect_y, srcRect_width, srcRect_height;
int diff;
int dst_x, dst_y; /* where in pixmap to write (UL) */
int test = 0;
srcRect_width =
@@ -508,10 +491,11 @@ ReadAreaToImage(Display *disp,
unsigned char *pixel_ptr;
unsigned char *start_of_line = (unsigned char *) image->data;
for (y1 = 0; y1 < srcRect_height; y1++) {
for (int y1 = 0; y1 < srcRect_height; y1++) {
pixel_ptr = start_of_line;
for (x1 = 0; x1 < srcRect_width; x1++) {
for (int x1 = 0; x1 < srcRect_width; x1++) {
if (*pixel_ptr++ == transparentColor) {
int pixel;
#if 0
*pmData++ = *ipmData++;
*pmData++ = *ipmData++;
@@ -537,11 +521,12 @@ ReadAreaToImage(Display *disp,
}
else {
if (transparentType == TransparentPixel) {
for (y1 = 0; y1 < srcRect_height; y1++) {
for (x1 = 0; x1 < srcRect_width; x1++) {
for (int y1 = 0; y1 < srcRect_height; y1++) {
for (int x1 = 0; x1 < srcRect_width; x1++) {
int pixel_value = XGetPixel(image, x1, y1);
if (pixel_value == transparentColor) {
int pixel;
#if 0
*pmData++ = *ipmData++;
*pmData++ = *ipmData++;
@@ -566,11 +551,12 @@ ReadAreaToImage(Display *disp,
}
}
else {
for (y1 = 0; y1 < srcRect_height; y1++) {
for (x1 = 0; x1 < srcRect_width; x1++) {
for (int y1 = 0; y1 < srcRect_height; y1++) {
for (int x1 = 0; x1 < srcRect_width; x1++) {
int pixel_value = XGetPixel(image, x1, y1);
if (pixel_value & transparentColor) {
int pixel;
#if 0
*pmData++ = *ipmData++;
*pmData++ = *ipmData++;
@@ -628,10 +614,8 @@ make_src_list(Display *disp, list_ptr image_wins,
{
XWindowAttributes child_attrs;
Window root, parent, *child; /* variables for XQueryTree() */
Window *save_child_list; /* variables for XQueryTree() */
unsigned int nchild; /* variables for XQueryTree() */
XRectangle child_clip; /* vis part of child */
int curr_clipX, curr_clipY, curr_clipRt, curr_clipBt;
/* check that win is mapped & not outside bounding box */
if (curr_attrs->map_state == IsViewable &&
@@ -641,6 +625,9 @@ make_src_list(Display *disp, list_ptr image_wins,
(int) (pclip->x + pclip->width) <= bbox->x ||
(int) (pclip->y + pclip->height) <= bbox->y)) {
Window *save_child_list;
int curr_clipX, curr_clipY, curr_clipRt, curr_clipBt;
XQueryTree(disp, curr, &root, &parent, &child, &nchild);
save_child_list = child; /* so we can free list when we're done */
add_window_to_list(image_wins, curr, x_rootrel, y_rootrel,
@@ -747,8 +734,7 @@ make_region_list(Display *disp, Window win, XRectangle *bbox,
src_in_image(base_src, numImageVisuals, pImageVisuals)) {
/* find a window whose visual hasn't been put in list yet */
if (!src_in_region_list(base_src, image_regions)) {
if (!(new_reg = (image_region_type *)
malloc(sizeof(image_region_type)))) {
if (!(new_reg = malloc(sizeof(image_region_type)))) {
return (list_ptr) NULL;
}
count++;
@@ -796,7 +782,7 @@ make_region_list(Display *disp, Window win, XRectangle *bbox,
}
else {
XDestroyRegion(new_reg->visible_region);
free((void *) new_reg);
free(new_reg);
}
}
}
@@ -815,7 +801,7 @@ static void
destroy_image_region(image_region_type *image_region)
{
XDestroyRegion(image_region->visible_region);
free((void *) image_region);
free(image_region);
}
/** ------------------------------------------------------------------------
@@ -899,7 +885,7 @@ add_window_to_list(list_ptr image_wins, Window w,
{
image_win_type *new_src;
if ((new_src = (image_win_type *) malloc(sizeof(image_win_type))) == NULL)
if ((new_src = malloc(sizeof(image_win_type))) == NULL)
return;
new_src->win = w;
@@ -970,12 +956,6 @@ src_in_overlay(image_region_type *src, int numOverlayVisuals,
******************************************************************************/
#define STATIC_GRAY 0x01
#define GRAY_SCALE 0x02
#define PSEUDO_COLOR 0x04
#define TRUE_COLOR 0x10
#define DIRECT_COLOR 0x11
static int weCreateServerOverlayVisualsProperty = False;
@@ -996,7 +976,7 @@ static int weCreateServerOverlayVisualsProperty = False;
* the array of the screen's visuals, determining whether the visual is an
* overlay or image visual.
*
* If the routine sucessfully obtained the visual information, it returns zero.
* If the routine successfully obtained the visual information, it returns zero.
* If the routine didn't obtain the visual information, it returns non-zero.
*
******************************************************************************/
@@ -1027,15 +1007,13 @@ GetXVisualInfo( /* Which X server (aka "display"). */
XVisualInfo getVisInfo; /* Parameters of XGetVisualInfo */
int mask;
XVisualInfo *pVis, **pIVis; /* Faster, local copies */
OverlayInfo *pOVis;
OverlayVisualPropertyRec *pOOldVis;
int nVisuals, nOVisuals;
int nVisuals;
Atom overlayVisualsAtom; /* Parameters for XGetWindowProperty */
Atom actualType;
unsigned long numLongs, bytesAfter;
int actualFormat;
int nImageVisualsAlloced; /* Values to process the XVisualInfo */
int imageVisual; /* array */
/* First, get the list of visuals for this screen. */
getVisInfo.screen = screen;
@@ -1043,7 +1021,7 @@ GetXVisualInfo( /* Which X server (aka "display"). */
*pVisuals = XGetVisualInfo(display, mask, &getVisInfo, numVisuals);
if ((nVisuals = *numVisuals) <= 0) {
/* Return that the information wasn't sucessfully obtained: */
/* Return that the information wasn't successfully obtained: */
return (1);
}
pVis = *pVisuals;
@@ -1081,11 +1059,12 @@ GetXVisualInfo( /* Which X server (aka "display"). */
/* Process the pVisuals array. */
*numImageVisuals = 0;
nImageVisualsAlloced = 1;
pIVis = *pImageVisuals = (XVisualInfo **) malloc(sizeof(XVisualInfo *));
pIVis = *pImageVisuals = malloc(sizeof(XVisualInfo *));
while (--nVisuals >= 0) {
nOVisuals = *numOverlayVisuals;
pOVis = *pOverlayVisuals;
imageVisual = True;
int nOVisuals = *numOverlayVisuals;
OverlayInfo *pOVis = *pOverlayVisuals;
int imageVisual = True;
while (--nOVisuals >= 0) {
pOOldVis = (OverlayVisualPropertyRec *) pOVis;
if (pVis->visualid == pOOldVis->visualID) {
@@ -1109,7 +1088,7 @@ GetXVisualInfo( /* Which X server (aka "display"). */
pVis++;
}
/* Return that the information was sucessfully obtained: */
/* Return that the information was successfully obtained: */
return (0);
} /* GetXVisualInfo() */

View File

@@ -60,7 +60,7 @@ typedef struct
/* This is structure also describes the SERVER_OVERLAY_VISUAL property, but
* should be more useful than the one actually returned by the X server
* because it actually points to the visual's XVisualInfo struct rather than
* refering to the visual's ID.
* referring to the visual's ID.
*/
typedef struct
{
@@ -125,7 +125,7 @@ typedef struct
* the array of the screen's visuals, determining whether the visual is an
* overlay or image visual.
*
* If the routine sucessfully obtained the visual information, it returns zero.
* If the routine successfully obtained the visual information, it returns zero.
* If the routine didn't obtain the visual information, it returns non-zero.
*
******************************************************************************/
@@ -262,7 +262,7 @@ extern int FindOverlayPlanesVisual(
* upon the information passed in to the routine. While "created," the window
* has not been mapped.
*
* If the routine suceeds, it returns zero and the return parameters
* If the routine succeeds, it returns zero and the return parameters
* "imageWindow", "imageColormap" and "mustFreeImageColormap" are valid.
* Otherwise, the routine returns non-zero and the return parameters are
* NOT valid.
@@ -303,7 +303,7 @@ extern int CreateImagePlanesWindow(
* upon the information passed in to the routine. While "created," the window
* has not been mapped.
*
* If the routine suceeds, it returns zero and the return parameters
* If the routine succeeds, it returns zero and the return parameters
* "overlayWindow", "overlayColormap" and "mustFreeOverlayColormap" are valid.
* Otherwise, the routine returns non-zero and the return parameters are
* NOT valid.

View File

@@ -148,6 +148,23 @@ main(int argc, char **argv)
INIT_NAME;
/* Handle args that don't require opening a display */
for (int n = 1; n < argc; n++) {
const char *argn = argv[n];
/* accept single or double dash for -help & -version */
if (argn[0] == '-' && argn[1] == '-') {
argn++;
}
if (strcmp (argn, "-help") == 0) {
usage(NULL, EXIT_SUCCESS);
exit(0);
}
if (strcmp (argn, "-version") == 0) {
puts(PACKAGE_STRING);
exit(EXIT_SUCCESS);
}
}
Setup_Display_And_Screen(&argc, argv);
/* Get window select on command line, if any */
@@ -162,11 +179,9 @@ main(int argc, char **argv)
debug = True;
continue;
}
if (!strcmp(argv[i], "-help"))
usage(NULL);
if (!strcmp(argv[i], "-out")) {
if (++i >= argc)
usage("-out requires an argument");
usage("-out requires an argument", EXIT_FAILURE);
if (!(out_file = fopen(argv[i], "wb")))
Fatal_Error("Can't open output file as specified.");
standard_out = False;
@@ -186,7 +201,7 @@ main(int argc, char **argv)
}
if (!strcmp(argv[i], "-add")) {
if (++i >= argc)
usage("-add requires an argument");
usage("-add requires an argument", EXIT_FAILURE);
add_pixel_value = parse_long(argv[i]);
continue;
}
@@ -198,13 +213,9 @@ main(int argc, char **argv)
silent = True;
continue;
}
if (!strcmp(argv[i], "-version")) {
puts(PACKAGE_STRING);
exit(0);
}
fprintf(stderr, "%s: unrecognized argument '%s'\n",
program_name, argv[i]);
usage(NULL);
usage(NULL, EXIT_FAILURE);
}
#ifdef WIN32
if (standard_out)
@@ -236,7 +247,7 @@ Get24bitDirectColors(XColor **colors)
int i, ncolors = 256;
XColor *tcol;
*colors = tcol = (XColor *) malloc(sizeof(XColor) * ncolors);
*colors = tcol = malloc(sizeof(XColor) * ncolors);
for (i = 0; i < ncolors; i++) {
tcol[i].pixel = i << 16 | i << 8 | i;
@@ -328,10 +339,14 @@ Window_Dump(Window window, FILE *out)
dheight = DisplayHeight(dpy, screen);
/* clip to window */
if (absx < 0)
width += absx, absx = 0;
if (absy < 0)
height += absy, absy = 0;
if (absx < 0) {
width += absx;
absx = 0;
}
if (absy < 0) {
height += absy;
absy = 0;
}
if (absx + width > dwidth)
width = dwidth - absx;
if (absy + height > dheight)
@@ -508,7 +523,7 @@ Window_Dump(Window window, FILE *out)
* This copying of the bit stream (data) to a file is to be replaced
* by an Xlib call which hasn't been written yet. It is not clear
* what other functions of xwd will be taken over by this (as yet)
* non-existant X function.
* non-existent X function.
*/
if (fwrite(image->data, (int) buffer_size, 1, out) != 1) {
perror("xwd");
@@ -542,7 +557,7 @@ Window_Dump(Window window, FILE *out)
* Report the syntax for calling xwd.
*/
void
usage(const char *errmsg)
usage(const char *errmsg, int exitval)
{
if (errmsg != NULL)
fprintf(stderr, "%s: %s\n", program_name, errmsg);
@@ -568,7 +583,7 @@ usage(const char *errmsg)
" -icmap Use the first colormap of the screen\n"
" -screen Send the request against the root window\n"
" -silent Don't ring any bells\n", stderr);
exit(1);
exit(exitval);
}
/*
@@ -593,7 +608,7 @@ ReadColors(Visual *vis, Colormap cmap, XColor **colors)
ncolors = vis->map_entries;
if (!(*colors = (XColor *) malloc(sizeof(XColor) * ncolors)))
if (!(*colors = malloc(sizeof(XColor) * ncolors)))
Fatal_Error("Out of memory!");
if (vis->class == DirectColor || vis->class == TrueColor) {
@@ -650,11 +665,10 @@ Get_XColors(XWindowAttributes *win_info, XColor **colors)
void
_swapshort(register char *bp, register unsigned n)
{
register char c;
register char *ep = bp + n;
char *ep = bp + n;
while (bp < ep) {
c = *bp;
char c = *bp;
*bp = *(bp + 1);
bp++;
*bp++ = c;
@@ -664,11 +678,10 @@ _swapshort(register char *bp, register unsigned n)
void
_swaplong(register char *bp, register unsigned n)
{
register char c;
register char *ep = bp + n;
char *ep = bp + n;
while (bp < ep) {
c = bp[3];
char c = bp[3];
bp[3] = bp[0];
bp[0] = c;
c = bp[2];