Update to xauth 1.0.7

This commit is contained in:
matthieu 2012-04-07 15:39:35 +00:00
parent 9e2d9b2980
commit 2aaa135718
13 changed files with 10383 additions and 457 deletions

View File

@ -1,3 +1,48 @@
commit 374c8c7005200c13299fdcb7b7d1b12f9f4258ae
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Mar 22 21:41:35 2012 -0700
xauth 1.0.7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit fbc307f3445a549815efb2476e9476bd51250cf6
Author: Andreas Schwab <schwab@linux-m68k.org>
Date: Fri Sep 3 13:45:49 2010 +0200
Remove alarm handler in get_hostname
gethostbyaddr is not (required to be) async-signal-safe.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit ee3e046dfd84cda1588eef155c7e7c36df9bf5f4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Sep 28 19:57:15 2011 -0700
Add const attributes to fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7f7f8cd60795c9503156950d518caa04b30a94a2
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Sep 28 19:50:40 2011 -0700
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit eb5ed59c623aa360677f62a7fd6e398ee9f3cab5
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Sep 28 19:39:20 2011 -0700
convert strlen/malloc/strcpy combo to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b67f0df2dbfa372417d0687e26704635e2d10034
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Mon May 23 19:38:50 2011 -0700

View File

@ -1,6 +1,6 @@
#
#
# Copyright 2005 Red Hat, Inc.
#
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@ -10,7 +10,7 @@
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR

View File

@ -14,9 +14,9 @@
@SET_MAKE@
#
#
# Copyright 2005 Red Hat, Inc.
#
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@ -26,7 +26,7 @@
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@ -44,9 +44,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
install_sh_PROGRAM = ${SHELL} $(install_sh) -c
install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@ -122,6 +122,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -176,6 +177,7 @@ PKG_CONFIG = @PKG_CONFIG@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XAUTH_CFLAGS = @XAUTH_CFLAGS@

View File

@ -1,5 +1,5 @@
The xauth program is used to edit and display the authorization
information used in connecting to the X server.
The xauth program is used to edit and display the authorization
information used in connecting to the X server.
All questions regarding this software should be directed at the
Xorg mailing list:

501
app/xauth/aclocal.m4 vendored
View File

@ -1022,7 +1022,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.13.0])
m4_define([vers_have], [1.16.2])
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,,
@ -1049,7 +1049,7 @@ AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
# which is not the best choice for supporting other OS'es, but covers most
# of the ones we need for now.
AC_MSG_CHECKING([if $RAWCPP requires -undef])
AC_LANG_CONFTEST([Does cpp redefine unix ?])
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
AC_MSG_RESULT([no])
else
@ -1067,7 +1067,7 @@ fi
rm -f conftest.$ac_ext
AC_MSG_CHECKING([if $RAWCPP requires -traditional])
AC_LANG_CONFTEST([Does cpp preserve "whitespace"?])
AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])])
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no])
else
@ -1442,6 +1442,8 @@ AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
#
AC_DEFUN([XORG_WITH_XSLTPROC],[
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
# Preserves the interface, should it be implemented later
m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(xsltproc,
AS_HELP_STRING([--with-xsltproc],
@ -1472,13 +1474,65 @@ else
AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
fi
# Checking for minimum version is not implemented
# but we want to keep the interface consistent with other commands
m4_ifval([$1],[AC_MSG_WARN(Checking for MIN-VERSION is not implemented.)])
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
]) # XORG_WITH_XSLTPROC
# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
# ----------------------------------------
# Minimum version: 1.15.0
#
# PERL (Practical Extraction and Report Language) is a language optimized for
# scanning arbitrary text files, extracting information from those text files,
# and printing reports based on that information.
#
# When DEFAULT is not specified, --with-perl assumes 'auto'.
#
# Interface to module:
# HAVE_PERL: used in makefiles to conditionally scan text files
# PERL: returns the path of the perl program found
# returns the path set by the user in the environment
# --with-perl: 'yes' user instructs the module to use perl
# 'no' user instructs the module not to use perl
# have_perl: returns yes if perl found in PATH or no
#
# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
#
AC_DEFUN([XORG_WITH_PERL],[
AC_ARG_VAR([PERL], [Path to perl command])
# Preserves the interface, should it be implemented later
m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(perl,
AS_HELP_STRING([--with-perl],
[Use perl for extracting information from files (default: ]_defopt[)]),
[use_perl=$withval], [use_perl=]_defopt)
m4_undefine([_defopt])
if test "x$use_perl" = x"auto"; then
AC_PATH_PROG([PERL], [perl])
if test "x$PERL" = "x"; then
AC_MSG_WARN([perl not found - cannot extract information and report])
have_perl=no
else
have_perl=yes
fi
elif test "x$use_perl" = x"yes" ; then
AC_PATH_PROG([PERL], [perl])
if test "x$PERL" = "x"; then
AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
fi
have_perl=yes
elif test "x$use_perl" = x"no" ; then
if test "x$PERL" != "x"; then
AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
fi
have_perl=no
else
AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
fi
AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
]) # XORG_WITH_PERL
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
# ----------------
@ -1725,10 +1779,11 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
]) # XORG_WITH_GROFF
# XORG_WITH_FOP([DEFAULT])
# ----------------
# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
# ---------------------------------------
# Minimum version: 1.6.0
# Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional MIN-VERSION argument: 1.15.0
#
# 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
@ -1748,7 +1803,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
#
AC_DEFUN([XORG_WITH_FOP],[
AC_ARG_VAR([FOP], [Path to fop command])
m4_define([_defopt], m4_default([$1], [auto]))
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(fop,
AS_HELP_STRING([--with-fop],
[Use fop to regenerate documentation (default: ]_defopt[)]),
@ -1777,6 +1832,22 @@ elif test "x$use_fop" = x"no" ; then
else
AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
fi
# Test for a minimum version of fop, if provided.
m4_ifval([$1],
[if test "$have_fop" = yes; then
# scrape the fop version
AC_MSG_CHECKING([for fop minimum version])
fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
AC_MSG_RESULT([$fop_version])
AS_VERSION_COMPARE([$fop_version], [$1],
[if test "x$use_fop" = xauto; then
AC_MSG_WARN([fop version $fop_version found, but $1 needed])
have_fop=no
else
AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
fi])
fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP
@ -1959,6 +2030,7 @@ AC_MSG_RESULT([$build_specs])
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
AC_BEFORE([$0], [XORG_WITH_GLIB])
AC_BEFORE([$0], [XORG_LD_WRAP])
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
[Enable building unit test cases (default: ]_defopt[)]),
@ -1969,6 +2041,39 @@ AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_unit_tests])
]) # XORG_ENABLE_UNIT_TESTS
# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
# ------------------------------------------------------
# Minimum version: 1.17.0
#
# This macro enables a builder to enable/disable integration testing
# It makes no assumption about the test cases' implementation
# Test cases may or may not use Automake "Support for test suites"
#
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
# usually requires less dependencies and may be built and run under less
# stringent environments than integration tests.
#
# Interface to module:
# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
# enable_integration_tests: used in configure.ac for additional configuration
# --enable-integration-tests: 'yes' user instructs the module to build tests
# 'no' user instructs the module not to build tests
# parm1: specify the default value, yes or no.
#
AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
[Enable building integration test cases (default: ]_defopt[)]),
[enable_integration_tests=$enableval],
[enable_integration_tests=]_defopt)
m4_undefine([_defopt])
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
[test "x$enable_integration_tests" != xno])
AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_integration_tests])
]) # XORG_ENABLE_INTEGRATION_TESTS
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
# ----------------------------------------
# Minimum version: 1.13.0
@ -1979,6 +2084,10 @@ AC_MSG_RESULT([$enable_unit_tests])
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
# test support usually requires less dependencies and may be built and run under
# less stringent environments than integration tests.
#
# Interface to module:
# HAVE_GLIB: used in makefiles to conditionally build targets
# with_glib: used in configure.ac to know if GLib has been found
@ -2030,8 +2139,8 @@ fi
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
]) # XORG_WITH_GLIB
# XORG_LD_WRAP
# ------------
# XORG_LD_WRAP([required|optional])
# ---------------------------------
# Minimum version: 1.13.0
#
# Check if linker supports -wrap, passed via compiler flags
@ -2039,10 +2148,18 @@ AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
# Argument added in 1.16.0 - default is "required", to match existing behavior
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
# available, an argument of "optional" allows use when some unit tests require
# ld -wrap and others do not.
#
AC_DEFUN([XORG_LD_WRAP],[
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
[AC_LANG_PROGRAM([#include <stdlib.h>
void __wrap_exit(int status) { return; }],
[exit(0);])])
# Not having ld wrap when unit testing has been explicitly requested is an error
if test "x$enable_unit_tests" = x"yes"; then
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
if test "x$have_ld_wrap" = x"no"; then
AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
fi
@ -2055,7 +2172,7 @@ AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
# -----------------------
# SYNOPSIS
#
# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
#
# DESCRIPTION
#
@ -2065,6 +2182,8 @@ AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# PROGRAM-SOURCE is the program source to link with, if needed
#
# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
#
# LICENSE
@ -2105,7 +2224,7 @@ AS_LITERAL_IF([$1],
[AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
ax_save_FLAGS=$LDFLAGS
LDFLAGS="$1"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
LDFLAGS=$ax_save_FLAGS])],
@ -2124,6 +2243,52 @@ else
fi
]) # XORG_CHECK_LINKER_FLAGS
# XORG_MEMORY_CHECK_FLAGS
# -----------------------
# Minimum version: 1.16.0
#
# This macro attempts to find appropriate memory checking functionality
# for various platforms which unit testing code may use to catch various
# forms of memory allocation and access errors in testing.
#
# Interface to module:
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
# Usually added to TESTS_ENVIRONMENT in Makefile.am
#
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
#
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
[Environment variables to enable memory checking in tests])
# Check for different types of support on different platforms
case $host_os in
solaris*)
AC_CHECK_LIB([umem], [umem_alloc],
[malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
;;
*-gnu*) # GNU libc - Value is used as a single byte bit pattern,
# both directly and inverted, so should not be 0 or 255.
malloc_debug_env='MALLOC_PERTURB_=15'
;;
darwin*)
malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
;;
*bsd*)
malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
;;
esac
# User supplied flags override default flags
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
fi
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
]) # XORG_WITH_LINT
# XORG_CHECK_MALLOC_ZERO
# ----------------------
# Minimum version: 1.0.0
@ -2275,59 +2440,300 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
]) # XORG_LINT_LIBRARY
# XORG_COMPILER_BRAND
# -------------------
# Minimum version: 1.14.0
#
# Checks for various brands of compilers and sets flags as appropriate:
# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
# clang compiler - sets CLANGCC to "yes"
# Intel compiler - sets INTELCC to "yes"
# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
#
AC_DEFUN([XORG_COMPILER_BRAND], [
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
]
)
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
]) # XORG_COMPILER_BRAND
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
# ---------------
# 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
# 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
# compilers will simply ignore arguments that they do not understand, but we do
# attempt to weed out false positives by using -Werror=unknown-warning-option and
# -Werror=unused-command-line-argument
#
AC_DEFUN([XORG_TESTSET_CFLAG], [
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
AC_LANG_COMPILER_REQUIRE
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
define([PREFIX], [C])
define([CACHE_PREFIX], [cc])
define([COMPILER], [$CC])
],
[C++], [
define([PREFIX], [CXX])
define([CACHE_PREFIX], [cxx])
define([COMPILER], [$CXX])
]
)
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
[eval $cacheid=yes],
[eval $cacheid=no])])
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
eval supported=\$$cacheid
AC_MSG_RESULT([$supported])
if test "$supported" = "yes" ; then
$1="$$1 ]flag["
found="yes"
fi
fi
])
]) # XORG_TESTSET_CFLAG
# XORG_COMPILER_FLAGS
# ---------------
# Minimum version: 1.16.0
#
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
# arguments supported by the selected compiler which do NOT alter the generated
# code. These arguments will cause the compiler to print various warnings
# during compilation AND turn a conservative set of warnings into errors.
#
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
# future versions of util-macros as options are added to new compilers.
#
AC_DEFUN([XORG_COMPILER_FLAGS], [
AC_REQUIRE([XORG_COMPILER_BRAND])
AC_ARG_ENABLE(selective-werror,
AS_HELP_STRING([--disable-selective-werror],
[Turn off selective compiler errors. (default: enabled)]),
[SELECTIVE_WERROR=$enableval],
[SELECTIVE_WERROR=yes])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
# -v is too short to test reliably with XORG_TESTSET_CFLAG
if test "x$SUNCC" = "xyes"; then
[BASE_]PREFIX[FLAGS]="-v"
else
[BASE_]PREFIX[FLAGS]=""
fi
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
AC_LANG_CASE(
[C], [
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
]
)
# This chunk adds additional warnings that could catch undesired effects.
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
# These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
else
AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
fi
AC_SUBST([BASE_]PREFIX[FLAGS])
]) # XORG_COMPILER_FLAGS
# XORG_CWARNFLAGS
# ---------------
# Minimum version: 1.2.0
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
#
# Defines CWARNFLAGS to enable C compiler warnings.
#
# This function is deprecated because it defines -fno-strict-aliasing
# which alters the code generated by the compiler. If -fno-strict-aliasing
# is needed, then it should be added explicitly in the module when
# it is updated to use BASE_CFLAGS.
#
AC_DEFUN([XORG_CWARNFLAGS], [
AC_REQUIRE([AC_PROG_CC_C99])
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
;;
esac
else
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
if test "x$SUNCC" = "xyes"; then
CWARNFLAGS="-v"
fi
fi
AC_SUBST(CWARNFLAGS)
AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_REQUIRE([XORG_COMPILER_BRAND])
AC_LANG_CASE(
[C], [
CWARNFLAGS="$BASE_CFLAGS"
if test "x$GCC" = xyes ; then
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
fi
AC_SUBST(CWARNFLAGS)
]
)
]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION
# -----------------------
# Minimum version: 1.3.0
#
# Add configure option to enable strict compilation
# Add configure option to enable strict compilation flags, such as treating
# warnings as fatal errors.
# If --enable-strict-compilation is passed to configure, adds strict flags to
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
#
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
# when strict compilation is unconditionally desired.
AC_DEFUN([XORG_STRICT_OPTION], [
# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
AC_REQUIRE([AC_PROG_CC_C99])
AC_REQUIRE([XORG_CWARNFLAGS])
AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_ARG_ENABLE(strict-compilation,
AS_HELP_STRING([--enable-strict-compilation],
[Enable all warnings from compiler and make them errors (default: disabled)]),
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
[STRICT_]PREFIX[FLAGS]=""
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
# activate it with -Werror, so we add it here explicitly.
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
if test "x$STRICT_COMPILE" = "xyes"; then
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
if test "x$GCC" = xyes ; then
STRICT_CFLAGS="-pedantic -Werror"
elif test "x$SUNCC" = "xyes"; then
STRICT_CFLAGS="-errwarn"
elif test "x$INTELCC" = "xyes"; then
STRICT_CFLAGS="-Werror"
fi
[BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
fi
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
AC_SUBST([CWARNFLAGS])
AC_SUBST([STRICT_]PREFIX[FLAGS])
AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS
@ -2338,6 +2744,7 @@ AC_SUBST([CWARNFLAGS])
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION

9775
app/xauth/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
dnl Copyright 2005 Red Hat, Inc.
dnl
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
@ -9,7 +9,7 @@ dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. Red Hat makes no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
dnl
dnl
dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.60])
AC_INIT([xauth],
[1.0.6],
[1.0.7],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xauth])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@ -46,7 +46,7 @@ AC_CHECK_FUNCS([strlcpy])
PKG_CHECK_MODULES(XAUTH, x11 xau xext xmuu)
# Transport selection macro from xtrans.m4
# Needed to set *CONN defines for gethost.c & parsedpy.c
# Needed to set *CONN defines for gethost.c & parsedpy.c
XTRANS_CONNECTION_FLAGS
XORG_WITH_LINT

View File

@ -1,5 +1,5 @@
/*
*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@ -74,30 +74,7 @@ in this Software without prior written authorization from The Open Group.
#include <arpa/inet.h>
#endif
#ifdef SIGALRM
static volatile Bool nameserver_timedout = False;
/*
* get_hostname - Given an internet address, return a name (CHARON.MIT.EDU)
* or a string representing the address (18.58.0.13) if the name cannot
* be found. Stolen from xhost.
*/
static jmp_buf env;
static RETSIGTYPE
nameserver_lost(int sig)
{
nameserver_timedout = True;
longjmp (env, -1);
/* NOTREACHED */
#ifdef SIGNALRETURNSINT
return -1; /* for picky compilers */
#endif
}
#endif
char *
const char *
get_hostname (Xauth *auth)
{
static struct hostent *hp;
@ -114,7 +91,7 @@ get_hostname (Xauth *auth)
if (auth->family == FamilyInternet
#if defined(IPv6) && defined(AF_INET6)
|| auth->family == FamilyInternet6
#endif
#endif
)
{
#if defined(IPv6) && defined(AF_INET6)
@ -124,23 +101,7 @@ get_hostname (Xauth *auth)
#endif
af = AF_INET;
if (no_name_lookups == False) {
#ifdef SIGALRM
/* gethostbyaddr can take a LONG time if the host does not exist.
Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
that something is wrong and do not make the user wait.
gethostbyaddr will continue after a signal, so we have to
jump out of it.
*/
nameserver_timedout = False;
signal (SIGALRM, nameserver_lost);
alarm (4);
if (setjmp(env) == 0) {
#endif
hp = gethostbyaddr (auth->address, auth->address_length, af);
#ifdef SIGALRM
}
alarm (0);
#endif
}
if (hp)
return (hp->h_name);
@ -184,7 +145,7 @@ get_hostname (Xauth *auth)
/*
* cribbed from lib/X/XConnDis.c
*/
static Bool
static Bool
get_inet_address(char *name, unsigned int *resultp)
{
unsigned int hostinetaddr = inet_addr (name);
@ -207,8 +168,8 @@ get_inet_address(char *name, unsigned int *resultp)
errno = EPROTOTYPE;
return False;
}
memmove( (char *)&hostinetaddr, (char *)host_ptr->h_addr,
memmove( (char *)&hostinetaddr, (char *)host_ptr->h_addr,
sizeof(inaddr.sin_addr));
}
*resultp = hostinetaddr;
@ -238,13 +199,13 @@ static Bool get_dnet_address (name, resultp)
struct addrlist *get_address_info (
int family,
char *fulldpyname,
const char *fulldpyname,
int prefix,
char *host)
{
struct addrlist *retval = NULL;
int len = 0;
void *src = NULL;
const void *src = NULL;
#ifdef TCPCONN
#if defined(IPv6) && defined(AF_INET6)
struct addrlist *lastrv = NULL;
@ -287,7 +248,7 @@ struct addrlist *get_address_info (
#endif
c = strchr(buf, ':');
/* In the legacy case with no bundle id, use the full path */
if(c == buf) {
src = fulldpyname;
@ -309,7 +270,7 @@ struct addrlist *get_address_info (
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC; /* IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* only interested in TCP */
hints.ai_protocol = 0;
hints.ai_protocol = 0;
if (getaddrinfo(host,NULL,&hints,&firstai) !=0) return NULL;
for (ai = firstai; ai != NULL; ai = ai->ai_next) {
struct addrlist *duplicate;

View File

@ -23,9 +23,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
install_sh_PROGRAM = ${SHELL} $(install_sh) -c
install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@ -70,6 +70,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -124,6 +125,7 @@ PKG_CONFIG = @PKG_CONFIG@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XAUTH_CFLAGS = @XAUTH_CFLAGS@

View File

@ -2,7 +2,7 @@
*
* parse_displayname - utility routine for splitting up display name strings
*
*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@ -55,7 +55,7 @@ in this Software without prior written authorization from The Open Group.
*/
char *
copystring (char *src, int len)
copystring (const char *src, int len)
{
char *cp;
@ -83,7 +83,7 @@ copyhostname (void)
{
char buf[256];
return (get_local_hostname (buf, sizeof buf) ?
return (get_local_hostname (buf, sizeof buf) ?
copystring (buf, strlen (buf)) : NULL);
}
#endif
@ -91,8 +91,8 @@ copyhostname (void)
/*
* parse_displayname - display a display string up into its component parts
*/
Bool
parse_displayname (char *displayname,
Bool
parse_displayname (const char *displayname,
int *familyp, /* return */
char **hostp, /* return */
int *dpynump, /* return */
@ -180,7 +180,7 @@ parse_displayname (char *displayname,
free (host);
return False;
}
dpynum = atoi (ptr); /* it will handle num. as well */
ptr = cp;
}
@ -232,4 +232,4 @@ parse_displayname (char *displayname,
return True;
}

View File

@ -65,25 +65,25 @@ typedef struct _AuthList { /* linked list of entries */
Xauth *auth;
} AuthList;
typedef int (*ProcessFunc)(char *, int, int, char**);
typedef int (*ProcessFunc)(const char *, int, int, const char**);
#define add_to_list(h,t,e) {if (t) (t)->next = (e); else (h) = (e); (t) = (e);}
typedef struct _CommandTable { /* commands that are understood */
char *name; /* full name */
const char *name; /* full name */
int minlen; /* unique prefix */
int maxlen; /* strlen(name) */
ProcessFunc processfunc; /* handler */
char *helptext; /* what to print for help */
const char *helptext; /* what to print for help */
} CommandTable;
struct _extract_data { /* for iterating */
FILE *fp; /* input source */
char *filename; /* name of input */
const char *filename; /* name of input */
Bool used_stdout; /* whether or not need to close */
Bool numeric; /* format in which to write */
int nwritten; /* number of entries written */
char *cmd; /* for error messages */
const char *cmd; /* for error messages */
};
struct _list_data { /* for iterating */
@ -95,23 +95,23 @@ struct _list_data { /* for iterating */
/*
* private data
*/
static char *stdin_filename = "(stdin)"; /* for messages */
static char *stdout_filename = "(stdout)"; /* for messages */
static char *Yes = "yes"; /* for messages */
static char *No = "no"; /* for messages */
static const char *stdin_filename = "(stdin)"; /* for messages */
static const char *stdout_filename = "(stdout)"; /* for messages */
static const char *Yes = "yes"; /* for messages */
static const char *No = "no"; /* for messages */
static int do_help ( char *inputfilename, int lineno, int argc, char **argv );
static int do_questionmark ( char *inputfilename, int lineno, int argc, char **argv );
static int do_list ( char *inputfilename, int lineno, int argc, char **argv );
static int do_merge ( char *inputfilename, int lineno, int argc, char **argv );
static int do_extract ( char *inputfilename, int lineno, int argc, char **argv );
static int do_add ( char *inputfilename, int lineno, int argc, char **argv );
static int do_remove ( char *inputfilename, int lineno, int argc, char **argv );
static int do_info ( char *inputfilename, int lineno, int argc, char **argv );
static int do_exit ( char *inputfilename, int lineno, int argc, char **argv );
static int do_quit ( char *inputfilename, int lineno, int argc, char **argv );
static int do_source ( char *inputfilename, int lineno, int argc, char **argv );
static int do_generate ( char *inputfilename, int lineno, int argc, char **argv );
static int do_help ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_questionmark ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_list ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_merge ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_extract ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_add ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_remove ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_info ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_exit ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_quit ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_source ( const char *inputfilename, int lineno, int argc, const char **argv );
static int do_generate ( const char *inputfilename, int lineno, int argc, const char **argv );
static CommandTable command_table[] = { /* table of known commands */
{ "add", 2, 3, do_add,
@ -143,14 +143,14 @@ static CommandTable command_table[] = { /* table of known commands */
{ "?", 1, 1, do_questionmark,
"? list available commands" },
{ "generate", 1, 8, do_generate,
"generate dpyname protoname [options] use server to generate entry\n"
"generate dpyname protoname [options] use server to generate entry\n"
" options are:\n"
" timeout n authorization expiration time in seconds\n"
" trusted clients using this entry are trusted\n"
" untrusted clients using this entry are untrusted\n"
" group n clients using this entry belong to application group n\n"
" data hexkey auth protocol specific data needed to generate the entry\n"
},
},
{ NULL, 0, 0, NULL, NULL },
};
@ -159,39 +159,39 @@ static CommandTable command_table[] = { /* table of known commands */
static Bool okay_to_use_stdin = True; /* set to false after using */
static char *hex_table[] = { /* for printing hex digits */
"00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
"10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
"20", "21", "22", "23", "24", "25", "26", "27",
"28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
"30", "31", "32", "33", "34", "35", "36", "37",
"38", "39", "3a", "3b", "3c", "3d", "3e", "3f",
"40", "41", "42", "43", "44", "45", "46", "47",
"48", "49", "4a", "4b", "4c", "4d", "4e", "4f",
"50", "51", "52", "53", "54", "55", "56", "57",
"58", "59", "5a", "5b", "5c", "5d", "5e", "5f",
"60", "61", "62", "63", "64", "65", "66", "67",
"68", "69", "6a", "6b", "6c", "6d", "6e", "6f",
"70", "71", "72", "73", "74", "75", "76", "77",
"78", "79", "7a", "7b", "7c", "7d", "7e", "7f",
"80", "81", "82", "83", "84", "85", "86", "87",
"88", "89", "8a", "8b", "8c", "8d", "8e", "8f",
"90", "91", "92", "93", "94", "95", "96", "97",
"98", "99", "9a", "9b", "9c", "9d", "9e", "9f",
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
"a8", "a9", "aa", "ab", "ac", "ad", "ae", "af",
"b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
"b8", "b9", "ba", "bb", "bc", "bd", "be", "bf",
"c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7",
"c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf",
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
"d8", "d9", "da", "db", "dc", "dd", "de", "df",
"e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
"e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff",
static const char *hex_table[] = { /* for printing hex digits */
"00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
"10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
"20", "21", "22", "23", "24", "25", "26", "27",
"28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
"30", "31", "32", "33", "34", "35", "36", "37",
"38", "39", "3a", "3b", "3c", "3d", "3e", "3f",
"40", "41", "42", "43", "44", "45", "46", "47",
"48", "49", "4a", "4b", "4c", "4d", "4e", "4f",
"50", "51", "52", "53", "54", "55", "56", "57",
"58", "59", "5a", "5b", "5c", "5d", "5e", "5f",
"60", "61", "62", "63", "64", "65", "66", "67",
"68", "69", "6a", "6b", "6c", "6d", "6e", "6f",
"70", "71", "72", "73", "74", "75", "76", "77",
"78", "79", "7a", "7b", "7c", "7d", "7e", "7f",
"80", "81", "82", "83", "84", "85", "86", "87",
"88", "89", "8a", "8b", "8c", "8d", "8e", "8f",
"90", "91", "92", "93", "94", "95", "96", "97",
"98", "99", "9a", "9b", "9c", "9d", "9e", "9f",
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
"a8", "a9", "aa", "ab", "ac", "ad", "ae", "af",
"b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
"b8", "b9", "ba", "bb", "bc", "bd", "be", "bf",
"c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7",
"c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf",
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
"d8", "d9", "da", "db", "dc", "dd", "de", "df",
"e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
"e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff",
};
static unsigned int hexvalues[256]; /* for parsing hex input */
@ -203,21 +203,21 @@ static int original_umask = 0; /* for restoring */
* private utility procedures
*/
static void
prefix(char *fn, int n)
static void
prefix(const char *fn, int n)
{
fprintf (stderr, "%s: %s:%d: ", ProgramName, fn, n);
}
static void
baddisplayname(char *dpy, char *cmd)
static void
baddisplayname(const char *dpy, const char *cmd)
{
fprintf (stderr, "bad display name \"%s\" in \"%s\" command\n",
dpy, cmd);
}
static void
badcommandline(char *cmd)
static void
badcommandline(const char *cmd)
{
fprintf (stderr, "bad \"%s\" command line\n", cmd);
}
@ -286,12 +286,12 @@ split_into_words(char *src, int *argcp) /* argvify string */
static FILE *
open_file(char **filenamep,
char *mode,
Bool *usedstdp,
char *srcfn,
int srcln,
char *cmd)
open_file(const char **filenamep,
const char *mode,
Bool *usedstdp,
const char *srcfn,
int srcln,
const char *cmd)
{
FILE *fp;
@ -322,7 +322,7 @@ open_file(char **filenamep,
return fp;
}
static int
static int
getinput(FILE *fp)
{
register int c;
@ -331,7 +331,7 @@ getinput(FILE *fp)
return c;
}
static int
static int
get_short(FILE *fp, unsigned short *sp) /* for reading numeric input */
{
int c;
@ -415,7 +415,7 @@ read_numeric(FILE *fp)
goto bad;
if (!get_bytes (fp, (unsigned int) auth->data_length, &auth->data))
goto bad;
switch (getinput (fp)) { /* get end of line */
case EOF:
case '\n':
@ -429,7 +429,7 @@ read_numeric(FILE *fp)
typedef Xauth *(*ReadFunc)(FILE *);
static int
static int
read_auth_entries(FILE *fp, Bool numeric, AuthList **headp, AuthList **tailp)
{
ReadFunc readfunc = (numeric ? read_numeric : XauReadAuth);
@ -462,8 +462,8 @@ read_auth_entries(FILE *fp, Bool numeric, AuthList **headp, AuthList **tailp)
return n;
}
static Bool
get_displayname_auth(char *displayname, AuthList **authl)
static Bool
get_displayname_auth(const char *displayname, AuthList **authl)
{
int family;
char *host = NULL, *rest = NULL;
@ -481,7 +481,7 @@ get_displayname_auth(char *displayname, AuthList **authl)
cp = strchr(displayname, '/');
if (cp && strncmp (cp, "/unix:", 6) == 0)
prelen = (cp - displayname);
if (!parse_displayname (displayname + ((prelen > 0) ? prelen + 1 : 0),
&family, &host, &dpynum, &scrnum, &rest)) {
return False;
@ -540,12 +540,13 @@ get_displayname_auth(char *displayname, AuthList **authl)
}
}
static int
cvthexkey(char *hexstr, char **ptrp) /* turn hex key string into octets */
static int
cvthexkey(const char *hexstr, char **ptrp) /* turn hex key string into octets */
{
int i;
int len = 0;
char *retval, *s;
char *retval;
const char *s;
unsigned char *us;
char c;
char savec = '\0';
@ -591,16 +592,16 @@ cvthexkey(char *hexstr, char **ptrp) /* turn hex key string into octets */
return len;
}
static int
dispatch_command(char *inputfilename,
int lineno,
int argc,
char **argv,
CommandTable *tab,
static int
dispatch_command(const char *inputfilename,
int lineno,
int argc,
const char **argv,
CommandTable *tab,
int *statusp)
{
CommandTable *ct;
char *cmd;
const char *cmd;
int n;
/* scan table for command */
cmd = argv[0];
@ -624,7 +625,7 @@ static Bool xauth_existed = False; /* if was present at initialize */
static Bool xauth_modified = False; /* if added, removed, or merged */
static Bool xauth_allowed = True; /* if allowed to write auth file */
static Bool xauth_locked = False; /* if has been locked */
static char *xauth_filename = NULL;
static const char *xauth_filename = NULL;
static volatile Bool dieing = False;
@ -632,7 +633,7 @@ static volatile Bool dieing = False;
#define WRITES(fd, S) (void)write((fd), (S), strlen((S)))
/* ARGSUSED */
static RETSIGTYPE
static RETSIGTYPE
die(int sig)
{
dieing = True;
@ -643,7 +644,7 @@ die(int sig)
#endif
}
static RETSIGTYPE
static RETSIGTYPE
catchsig(int sig)
{
#ifdef SYSV
@ -665,7 +666,7 @@ catchsig(int sig)
#endif
}
static void
static void
register_signals(void)
{
signal (SIGINT, catchsig);
@ -684,15 +685,15 @@ register_signals(void)
* public procedures for parsing lines of input
*/
int
auth_initialize(char *authfilename)
int
auth_initialize(const char *authfilename)
{
int n;
AuthList *head, *tail;
FILE *authfp;
Bool exists;
xauth_filename = authfilename; /* used in cleanup, prevent race with
xauth_filename = authfilename; /* used in cleanup, prevent race with
signals */
register_signals ();
@ -723,10 +724,10 @@ auth_initialize(char *authfilename)
if (break_locks) XauUnlockAuth (authfilename);
} else {
n = XauLockAuth (authfilename, XAUTH_DEFAULT_RETRIES,
XAUTH_DEFAULT_TIMEOUT,
XAUTH_DEFAULT_TIMEOUT,
(break_locks ? 0L : XAUTH_DEFAULT_DEADTIME));
if (n != LOCK_SUCCESS) {
char *reason = "unknown error";
const char *reason = "unknown error";
switch (n) {
case LOCK_ERROR:
reason = "error";
@ -762,7 +763,7 @@ auth_initialize(char *authfilename)
errno = olderrno;
return -1;
} /* else ignore it */
fprintf (stderr,
fprintf (stderr,
"%s: file %s does not exist\n",
ProgramName, authfilename);
} else {
@ -778,24 +779,22 @@ auth_initialize(char *authfilename)
xauth_head = head;
}
n = strlen (authfilename);
xauth_filename = malloc (n + 1);
if (xauth_filename) strcpy (xauth_filename, authfilename);
else {
xauth_filename = strdup(authfilename);
if (!xauth_filename) {
fprintf(stderr,"cannot allocate memory\n");
return -1;
}
xauth_modified = False;
if (verbose) {
printf ("%s authority file %s\n",
printf ("%s authority file %s\n",
ignore_locks ? "Ignoring locks on" : "Using", authfilename);
}
return 0;
}
static int
static int
write_auth_file(char *tmp_nam)
{
FILE *fp = NULL;
@ -816,7 +815,7 @@ write_auth_file(char *tmp_nam)
fprintf (stderr, "%s: unable to open tmp file \"%s\"\n",
ProgramName, tmp_nam);
return -1;
}
}
/*
* Write MIT-MAGIC-COOKIE-1 first, because R4 Xlib knows
@ -845,7 +844,7 @@ write_auth_file(char *tmp_nam)
return 0;
}
int
int
auth_finalize(void)
{
char temp_name[1024]; /* large filename size */
@ -869,12 +868,12 @@ auth_finalize(void)
#endif
}
} else if (!xauth_allowed) {
fprintf (stderr,
fprintf (stderr,
"%s: %s not writable, changes ignored\n",
ProgramName, xauth_filename);
} else {
if (verbose) {
printf ("%s authority file %s\n",
printf ("%s authority file %s\n",
ignore_locks ? "Ignoring locks and writing" :
"Writing", xauth_filename);
}
@ -909,8 +908,8 @@ auth_finalize(void)
return 0;
}
int
process_command(char *inputfilename, int lineno, int argc, char **argv)
int
process_command(const char *inputfilename, int lineno, int argc, const char **argv)
{
int status;
@ -930,18 +929,18 @@ process_command(char *inputfilename, int lineno, int argc, char **argv)
* utility routines
*/
static char *
bintohex(unsigned int len, char *bindata)
static char *
bintohex(unsigned int len, const char *bindata)
{
char *hexdata, *starthex;
/* two chars per byte, plus null termination */
starthex = hexdata = (char *)malloc(2*len + 1);
starthex = hexdata = (char *)malloc(2*len + 1);
if (!hexdata)
return NULL;
for (; len > 0; len--, bindata++) {
register char *s = hex_table[(unsigned char)*bindata];
register const char *s = hex_table[(unsigned char)*bindata];
*hexdata++ = s[0];
*hexdata++ = s[1];
}
@ -949,7 +948,7 @@ bintohex(unsigned int len, char *bindata)
return starthex;
}
static void
static void
fprintfhex(register FILE *fp, int len, char *cp)
{
char *hex;
@ -976,8 +975,8 @@ dump_numeric(register FILE *fp, register Xauth *auth)
}
/* ARGSUSED */
static int
dump_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
static int
dump_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
{
struct _list_data *ld = (struct _list_data *) data;
FILE *fp = ld->fp;
@ -985,7 +984,7 @@ dump_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
if (ld->numeric) {
dump_numeric (fp, auth);
} else {
char *dpyname = NULL;
const char *dpyname = NULL;
switch (auth->family) {
case FamilyLocal:
@ -1025,8 +1024,8 @@ dump_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
return 0;
}
static int
extract_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
static int
extract_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
{
struct _extract_data *ed = (struct _extract_data *) data;
@ -1063,8 +1062,8 @@ eq_auth(Xauth *a, Xauth *b)
memcmp(a->name, b->name, a->name_length) == 0 &&
memcmp(a->data, b->data, a->data_length) == 0) ? 1 : 0);
}
static int
static int
match_auth_dpy(register Xauth *a, register Xauth *b)
{
return ((a->family == b->family &&
@ -1076,7 +1075,7 @@ match_auth_dpy(register Xauth *a, register Xauth *b)
/* return non-zero iff display and authorization type are the same */
static int
static int
match_auth(register Xauth *a, register Xauth *b)
{
return ((match_auth_dpy(a, b)
@ -1085,7 +1084,7 @@ match_auth(register Xauth *a, register Xauth *b)
}
static int
static int
merge_entries(AuthList **firstp, AuthList *second, int *nnewp, int *nreplp)
{
AuthList *a, *b, *first, *tail;
@ -1204,12 +1203,12 @@ copyAuth(Xauth *auth)
}
return a;
}
typedef int (*YesNoFunc)(char *, int, Xauth *, char *);
static int
iterdpy (char *inputfilename, int lineno, int start,
int argc, char *argv[],
typedef int (*YesNoFunc)(const char *, int, Xauth *, char *);
static int
iterdpy (const char *inputfilename, int lineno, int start,
int argc, const char *argv[],
YesNoFunc yfunc, YesNoFunc nfunc, char *data)
{
int i;
@ -1223,7 +1222,7 @@ iterdpy (char *inputfilename, int lineno, int start,
* iterate
*/
for (i = start; i < argc; i++) {
char *displayname = argv[i];
const char *displayname = argv[i];
if (!get_displayname_auth (displayname, &proto_head)) {
prefix (inputfilename, lineno);
baddisplayname (displayname, argv[0]);
@ -1273,8 +1272,8 @@ iterdpy (char *inputfilename, int lineno, int start,
}
/* ARGSUSED */
static int
remove_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
static int
remove_entry(const char *inputfilename, int lineno, Xauth *auth, char *data)
{
int *nremovedp = (int *) data;
AuthList **listp = &xauth_head;
@ -1300,8 +1299,8 @@ remove_entry(char *inputfilename, int lineno, Xauth *auth, char *data)
/*
* help
*/
int
print_help(FILE *fp, char *cmd, char *prefix)
int
print_help(FILE *fp, const char *cmd, const char *prefix)
{
CommandTable *ct;
int n = 0;
@ -1322,14 +1321,14 @@ print_help(FILE *fp, char *cmd, char *prefix)
}
}
}
return n;
}
static int
do_help(char *inputfilename, int lineno, int argc, char **argv)
static int
do_help(const char *inputfilename, int lineno, int argc, const char **argv)
{
char *cmd = (argc > 1 ? argv[1] : NULL);
const char *cmd = (argc > 1 ? argv[1] : NULL);
int n;
n = print_help (stdout, cmd, " "); /* a nice amount */
@ -1357,8 +1356,8 @@ do_help(char *inputfilename, int lineno, int argc, char **argv)
* questionmark
*/
/* ARGSUSED */
static int
do_questionmark(char *inputfilename, int lineno, int argc, char **argv)
static int
do_questionmark(const char *inputfilename, int lineno, int argc, const char **argv)
{
CommandTable *ct;
int i;
@ -1392,8 +1391,8 @@ do_questionmark(char *inputfilename, int lineno, int argc, char **argv)
/*
* list [displayname ...]
*/
static int
do_list (char *inputfilename, int lineno, int argc, char **argv)
static int
do_list (const char *inputfilename, int lineno, int argc, const char **argv)
{
struct _list_data ld;
@ -1418,8 +1417,8 @@ do_list (char *inputfilename, int lineno, int argc, char **argv)
/*
* merge filename [filename ...]
*/
static int
do_merge(char *inputfilename, int lineno, int argc, char **argv)
static int
do_merge(const char *inputfilename, int lineno, int argc, const char **argv)
{
int i;
int errors = 0;
@ -1437,7 +1436,7 @@ do_merge(char *inputfilename, int lineno, int argc, char **argv)
listhead = listtail = NULL;
for (i = 1; i < argc; i++) {
char *filename = argv[i];
const char *filename = argv[i];
FILE *fp;
Bool used_stdin = False;
@ -1469,8 +1468,8 @@ do_merge(char *inputfilename, int lineno, int argc, char **argv)
*/
if (listhead) {
nentries = merge_entries (&xauth_head, listhead, &nnew, &nrepl);
if (verbose)
printf ("%d entries read in: %d new, %d replacement%s\n",
if (verbose)
printf ("%d entries read in: %d new, %d replacement%s\n",
nentries, nnew, nrepl, nrepl != 1 ? "s" : "");
if (nentries > 0) xauth_modified = True;
}
@ -1481,8 +1480,8 @@ do_merge(char *inputfilename, int lineno, int argc, char **argv)
/*
* extract filename displayname [displayname ...]
*/
static int
do_extract(char *inputfilename, int lineno, int argc, char **argv)
static int
do_extract(const char *inputfilename, int lineno, int argc, const char **argv)
{
int errors;
struct _extract_data ed;
@ -1500,16 +1499,16 @@ do_extract(char *inputfilename, int lineno, int argc, char **argv)
ed.nwritten = 0;
ed.cmd = argv[0];
errors = iterdpy (inputfilename, lineno, 2, argc, argv,
errors = iterdpy (inputfilename, lineno, 2, argc, argv,
extract_entry, NULL, (char *) &ed);
if (!ed.fp) {
fprintf (stderr,
fprintf (stderr,
"No matches found, authority file \"%s\" not written\n",
ed.filename);
} else {
if (verbose) {
printf ("%d entries written to \"%s\"\n",
printf ("%d entries written to \"%s\"\n",
ed.nwritten, ed.filename);
}
if (!ed.used_stdout) {
@ -1524,14 +1523,15 @@ do_extract(char *inputfilename, int lineno, int argc, char **argv)
/*
* add displayname protocolname hexkey
*/
static int
do_add(char *inputfilename, int lineno, int argc, char **argv)
{
static int
do_add(const char *inputfilename, int lineno, int argc, const char **argv)
{
int n, nnew, nrepl;
int len;
char *dpyname;
char *protoname;
char *hexkey;
const char *dpyname;
const char *protoname;
const char *hexkey;
char *key;
AuthList *list, *list_cur, *list_next;
@ -1628,8 +1628,8 @@ do_add(char *inputfilename, int lineno, int argc, char **argv)
/*
* remove displayname
*/
static int
do_remove(char *inputfilename, int lineno, int argc, char **argv)
static int
do_remove(const char *inputfilename, int lineno, int argc, const char **argv)
{
int nremoved = 0;
int errors;
@ -1649,8 +1649,8 @@ do_remove(char *inputfilename, int lineno, int argc, char **argv)
/*
* info
*/
static int
do_info(char *inputfilename, int lineno, int argc, char **argv)
static int
do_info(const char *inputfilename, int lineno, int argc, const char **argv)
{
int n;
AuthList *l;
@ -1681,8 +1681,8 @@ do_info(char *inputfilename, int lineno, int argc, char **argv)
static Bool alldone = False;
/* ARGSUSED */
static int
do_exit(char *inputfilename, int lineno, int argc, char **argv)
static int
do_exit(const char *inputfilename, int lineno, int argc, const char **argv)
{
/* allow bogus stuff */
alldone = True;
@ -1693,8 +1693,8 @@ do_exit(char *inputfilename, int lineno, int argc, char **argv)
* quit
*/
/* ARGSUSED */
static int
do_quit(char *inputfilename, int lineno, int argc, char **argv)
static int
do_quit(const char *inputfilename, int lineno, int argc, const char **argv)
{
/* allow bogus stuff */
die (0);
@ -1706,17 +1706,17 @@ do_quit(char *inputfilename, int lineno, int argc, char **argv)
/*
* source filename
*/
static int
do_source(char *inputfilename, int lineno, int argc, char **argv)
static int
do_source(const char *inputfilename, int lineno, int argc, const char **argv)
{
char *script;
const char *script;
char buf[BUFSIZ];
FILE *fp;
Bool used_stdin = False;
int len;
int errors = 0, status;
int sublineno = 0;
char **subargv;
const char **subargv;
int subargc;
Bool prompt = False; /* only true if reading from tty */
@ -1752,10 +1752,10 @@ do_source(char *inputfilename, int lineno, int argc, char **argv)
break;
}
buf[--len] = '\0'; /* remove new line */
subargv = split_into_words (buf, &subargc);
subargv = (const char **) split_into_words (buf, &subargc);
if (subargv) {
status = process_command (script, sublineno, subargc, subargv);
free ((char *) subargv);
free (subargv);
errors += status;
} else {
prefix (script, sublineno);
@ -1784,10 +1784,10 @@ catch_x_protocol_error(Display *dpy, XErrorEvent *errevent)
/*
* generate
*/
static int
do_generate(char *inputfilename, int lineno, int argc, char **argv)
static int
do_generate(const char *inputfilename, int lineno, int argc, const char **argv)
{
char *displayname;
const char *displayname;
int major_version, minor_version;
XSecurityAuthorization id_return;
Xauth *auth_in, *auth_return;
@ -1795,11 +1795,11 @@ do_generate(char *inputfilename, int lineno, int argc, char **argv)
unsigned long attrmask = 0;
Display *dpy;
int status;
char *args[4];
char *protoname = ".";
const char *args[4];
const char *protoname = ".";
int i;
int authdatalen = 0;
char *hexdata;
const char *hexdata;
char *authdata = NULL;
if (argc < 2 || !argv[1]) {
@ -1820,7 +1820,7 @@ do_generate(char *inputfilename, int lineno, int argc, char **argv)
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
return 1;
}
}
attributes.timeout = atoi(argv[i]);
attrmask |= XSecurityTimeout;
@ -1837,7 +1837,7 @@ do_generate(char *inputfilename, int lineno, int argc, char **argv)
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
return 1;
}
}
attributes.group = atoi(argv[i]);
attrmask |= XSecurityGroup;
@ -1846,7 +1846,7 @@ do_generate(char *inputfilename, int lineno, int argc, char **argv)
prefix (inputfilename, lineno);
badcommandline (argv[i-1]);
return 1;
}
}
hexdata = argv[i];
authdatalen = strlen(hexdata);
if (hexdata[0] == '"' && hexdata[authdatalen-1] == '"') {
@ -1927,7 +1927,7 @@ do_generate(char *inputfilename, int lineno, int argc, char **argv)
if (authdata) free(authdata);
XSecurityFreeXauth(auth_in);
XSecurityFreeXauth(auth_return);
free(args[3]); /* hex data */
free((char *) args[3]); /* hex data */
XCloseDisplay(dpy);
return status;
}

View File

@ -2,7 +2,7 @@
*
* xauth - manipulate authorization file
*
*
*
Copyright 1989,1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group.
/*
* global data
*/
char *ProgramName; /* argv[0], set at top of main() */
const char *ProgramName; /* argv[0], set at top of main() */
int verbose = -1; /* print certain messages */
Bool ignore_locks = False; /* for error recovery */
Bool break_locks = False; /* for error recovery */
@ -48,18 +48,18 @@ Bool no_name_lookups = False; /* show addresses instead of names */
* local data
*/
static char *authfilename = NULL; /* filename of cookie file */
static char *defcmds[] = { "source", "-", NULL }; /* default command */
static const char *authfilename = NULL; /* filename of cookie file */
static const char *defcmds[] = { "source", "-", NULL }; /* default command */
static int ndefcmds = 2;
static char *defsource = "(stdin)";
static const char *defsource = "(stdin)";
/*
* utility routines
*/
static void
static void
usage(void)
{
static char *prefixmsg[] = {
static const char *prefixmsg[] = {
"",
"where options include:",
" -f authfilename name of authority file to use",
@ -71,12 +71,12 @@ usage(void)
"and commands have the following syntax:",
"",
NULL };
static char *suffixmsg[] = {
static const char *suffixmsg[] = {
"A dash may be used with the \"merge\" and \"source\" to read from the",
"standard input. Commands beginning with \"n\" use numeric format.",
"",
NULL };
char **msg;
const char **msg;
fprintf (stderr, "usage: %s [-options ...] [command arg ...]\n",
ProgramName);
@ -96,21 +96,21 @@ NULL };
* The main routine - parses command line and calls action procedures
*/
int
main(int argc, char *argv[])
main(int argc, const char *argv[])
{
int i;
char *sourcename = defsource;
char **arglist = defcmds;
const char *sourcename = defsource;
const char **arglist = defcmds;
int nargs = ndefcmds;
int status;
ProgramName = argv[0];
for (i = 1; i < argc; i++) {
char *arg = argv[i];
const char *arg = argv[i];
if (arg[0] == '-') {
char *flag;
const char *flag;
for (flag = (arg + 1); *flag; flag++) {
switch (*flag) {

View File

@ -1,5 +1,5 @@
/*
*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@ -36,7 +36,7 @@ typedef int Bool;
#define True 1
#endif
extern char *ProgramName;
extern const char *ProgramName;
#include <stdlib.h>
@ -47,15 +47,15 @@ struct addrlist {
int family;
};
extern char *get_hostname ( Xauth *auth );
extern struct addrlist *get_address_info ( int family, char *fulldpyname, int prefix, char *host);
extern char *copystring ( char *src, int len );
extern const char *get_hostname ( Xauth *auth );
extern struct addrlist *get_address_info ( int family, const char *fulldpyname, int prefix, char *host);
extern char *copystring ( const char *src, int len );
extern char *get_local_hostname ( char *buf, int maxlen );
extern Bool parse_displayname ( char *displayname, int *familyp, char **hostp, int *dpynump, int *scrnump, char **restp );
extern int auth_initialize ( char *authfilename );
extern Bool parse_displayname ( const char *displayname, int *familyp, char **hostp, int *dpynump, int *scrnump, char **restp );
extern int auth_initialize ( const char *authfilename );
extern int auth_finalize ( void );
extern int process_command ( char *inputfilename, int lineno, int argc, char **argv );
extern int print_help ( FILE *fp, char *cmd, char *prefix );
extern int process_command ( const char *inputfilename, int lineno, int argc, const char **argv );
extern int print_help ( FILE *fp, const char *cmd, const char *prefix );
extern int verbose;
extern Bool ignore_locks;
extern Bool break_locks;