datadir=@datadir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
SUBDIRS=lib libdyn clients server zhm zwgc
+build:
+ $(MAKE) all
+ $(MAKE) check
+
all:
for i in ${SUBDIRS}; do (cd $$i; ${MAKE} $@) || exit 1; done
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
top_builddir=../..
includedir=${prefix}/include
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
CFLAGS=@CFLAGS@
ALL_CFLAGS=${CFLAGS} -I${top_srcdir}/h -I${BUILDTOP}/h @X_CFLAGS@ ${CPPFLAGS}
LDFLAGS=@LDFLAGS@
-LIBS=${LIBZEPHYR} -lss -lreadline -lhistory -lcurses @LIBS@ -lcom_err
+LIBS=${LIBZEPHYR} @SS_LIBS@ @LIBS@ -lcom_err
OBJS= zctl.o zctl_cmds.o
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
-.\" $Id: znol.1 2091 2007-12-20 01:17:23Z kcr $
+.\" $Id: znol.1 2368 2009-03-29 16:02:11Z kcr@ATHENA.MIT.EDU $
.\"
.\" Copyright 1987,1988 by the Massachusetts Institute of Technology
.\" All rights reserved. The file /usr/include/zephyr/mit-copyright.h
for notices about those users.
.nf
.in +.5in
-znol -l -u foo
+znol \-l \-u foo
.in -.5in
.fi
prints the location (if visible) of the user 'foo'.
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
-.\" $Id: zwrite.1 2091 2007-12-20 01:17:23Z kcr $
+.\" $Id: zwrite.1 2370 2009-03-29 16:08:44Z kcr@ATHENA.MIT.EDU $
.\"
.\" Copyright 1987,1988 by the Massachusetts Institute of Technology
.\" All rights reserved. The file /usr/include/zephyr/mit-copyright.h
.SH SYNOPSIS
.B zwrite
[
-.BI -a
+.BI \-a
] [
-.BI -d
+.BI \-d
] [
-.BI -v
+.BI \-v
] [
-.BI -q
+.BI \-q
] [
-.BI -t
+.BI \-t
] [
-.BI -u
+.BI \-u
] [
-.BI -o
+.BI \-o
] [
-.BI -n
+.BI \-n
] [
-.BI -l
+.BI \-l
] [
-.BI -C
+.BI \-C
] [
-.BI -O
+.BI \-O
opcode ] [
-.BI -s
+.BI \-s
signature ] [
-.BI -c
+.BI \-c
class ] [
-.BI -i
+.BI \-i
instance ] [
-.BI -r
+.BI \-r
realm ] [
-.BI -f
+.BI \-f
arg ] [
.BI user \ ...
] [
-.BI -m
+.BI \-m
.BI message
]
.SH DESCRIPTION
is specified, the message is sent to recipient "*" unless an additional
list of recipients is specified.
.br
-This argument may not be used in conjunction with the -f option.
+This argument may not be used in conjunction with the \-f option.
.TP
.B \-i \fIinstance\fR
Allows a user to specify a different instance than the default.
the members subscribe to messages of class "MESSAGE", the specified instance,
and recipient "*".
.br
-This argument may not be used in conjunction with the -f option.
+This argument may not be used in conjunction with the \-f option.
.TP
.B \-r \fIrealm\fR
Allows a user to specify a different realm for the message, if the
.I arg
unmodified.
.br
-This option may not be used in conjunction with the -c or -i option.
+This option may not be used in conjunction with the \-c or \-i option.
.TP
.B \-m
.I Zwrite
KRB4_LIBS
krb5config
KRB5_LIBS
+LIBZEPHYR_LIBS
HESIOD_LIBS
REGEX_LIBS
+SS_LIBS
ARES_LIBS
LIBOBJS
LTLIBOBJS'
case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+{ echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
+if test "${ac_cv_target+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+echo "$as_me: error: invalid value of canonical target" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
# The aliases save the names the user supplied, while $host etc.
# will get canonicalized.
test -n "$target_alias" &&
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4148 "configure"' > conftest.$ac_ext
+ echo '#line 4193 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6714: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6759: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6718: \$? = $ac_status" >&5
+ echo "$as_me:6763: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6947: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6992: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6951: \$? = $ac_status" >&5
+ echo "$as_me:6996: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7007: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7052: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7011: \$? = $ac_status" >&5
+ echo "$as_me:7056: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 8337 "configure"' > conftest.$ac_ext
+ echo '#line 8382 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9175 "configure"
+#line 9220 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9273 "configure"
+#line 9318 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11452: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11497: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11456: \$? = $ac_status" >&5
+ echo "$as_me:11501: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11512: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11557: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11516: \$? = $ac_status" >&5
+ echo "$as_me:11561: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 12023 "configure"' > conftest.$ac_ext
+ echo '#line 12068 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12861 "configure"
+#line 12906 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12959 "configure"
+#line 13004 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13786: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13831: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13790: \$? = $ac_status" >&5
+ echo "$as_me:13835: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13846: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13891: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13850: \$? = $ac_status" >&5
+ echo "$as_me:13895: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 15156 "configure"' > conftest.$ac_ext
+ echo '#line 15201 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15900: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15945: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15904: \$? = $ac_status" >&5
+ echo "$as_me:15949: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16133: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16178: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16137: \$? = $ac_status" >&5
+ echo "$as_me:16182: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16193: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16238: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16197: \$? = $ac_status" >&5
+ echo "$as_me:16242: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 17523 "configure"' > conftest.$ac_ext
+ echo '#line 17568 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18361 "configure"
+#line 18406 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18459 "configure"
+#line 18504 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-
-for ac_header in fcntl.h paths.h termios.h sgtty.h unistd.h malloc.h term.h
+for ac_header in fcntl.h paths.h sgtty.h unistd.h malloc.h term.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
done
+for ac_header in arpa/nameser_compat.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
if test "$no_x" != "yes"; then
ZWGC_LIBX11=-lX11
fi
fi
-
-{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_dl_dlopen=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_dl_dlopen=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDL 1
-_ACEOF
-
- LIBS="-ldl $LIBS"
-
-fi
-
+# XXX? AC_CHECK_LIB(dl, dlopen)
{ echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6; }
fi
-# Hesiod needs -lresolv on Sun systems for res_send.
-if test "$hesiod" != "no"; then
{ echo "$as_me:$LINENO: checking for strerror in -l44bsd" >&5
echo $ECHO_N "checking for strerror in -l44bsd... $ECHO_C" >&6; }
fi
-{ echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5
-echo $ECHO_N "checking for res_send in -lresolv... $ECHO_C" >&6; }
-if test "${ac_cv_lib_resolv_res_send+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_send ();
-int
-main ()
-{
-return res_send ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_resolv_res_send=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_resolv_res_send=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv_res_send" >&6; }
-if test $ac_cv_lib_resolv_res_send = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
- LIBS="-lresolv $LIBS"
-
-fi
-
-
-{ echo "$as_me:$LINENO: checking for __res_send in -lresolv" >&5
-echo $ECHO_N "checking for __res_send in -lresolv... $ECHO_C" >&6; }
-if test "${ac_cv_lib_resolv___res_send+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char __res_send ();
-int
-main ()
-{
-return __res_send ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_resolv___res_send=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_resolv___res_send=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___res_send" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv___res_send" >&6; }
-if test $ac_cv_lib_resolv___res_send = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
- LIBS="-lresolv $LIBS"
-
-fi
-
-fi
{ echo "$as_me:$LINENO: checking for tgetstr in -lcurses" >&5
echo $ECHO_N "checking for tgetstr in -lcurses... $ECHO_C" >&6; }
fi
-{ echo "$as_me:$LINENO: checking for socket" >&5
+ { echo "$as_me:$LINENO: checking for socket" >&5
echo $ECHO_N "checking for socket... $ECHO_C" >&6; }
if test "${ac_cv_func_socket+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-if test "$krb4" != yes; then
- CPPFLAGS="$CPPFLAGS -I$krb4/include"
- if test -d "$krb4/include/kerberosIV"; then
- CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
+ if test "$krb4" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$krb4/include"
+ if test -d "$krb4/include/kerberosIV"; then
+ CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
+ fi
+ LDFLAGS="$LDFLAGS -L$krb4/lib"
fi
- LDFLAGS="$LDFLAGS -L$krb4/lib"
-fi
-{ echo "$as_me:$LINENO: checking for krb_rd_req in -lkrb4" >&5
+ { echo "$as_me:$LINENO: checking for krb_rd_req in -lkrb4" >&5
echo $ECHO_N "checking for krb_rd_req in -lkrb4... $ECHO_C" >&6; }
if test "${ac_cv_lib_krb4_krb_rd_req+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
#define HAVE_KRB4 1
_ACEOF
+ LIBZEPHYR_LIBS="$LIBZEPHYR_LIBS $KRB4_LIBS"
fi
{ (exit 1); exit 1; }; }
fi
- KRB5_LIBS="-lkrb5 -l5crypto -lcom_err"
+ KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
fi
cat >>confdefs.h <<\_ACEOF
#define HAVE_KRB5 1
_ACEOF
-fi
-
-
-
-# Check whether --with-hesiod was given.
-if test "${with_hesiod+set}" = set; then
- withval=$with_hesiod; hesiod="$withval"
-else
- hesiod=no
-fi
-
-if test "$hesiod" != no; then
- { echo "$as_me:$LINENO: checking for res_send" >&5
-echo $ECHO_N "checking for res_send... $ECHO_C" >&6; }
-if test "${ac_cv_func_res_send+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define res_send to an innocuous variant, in case <limits.h> declares res_send.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define res_send innocuous_res_send
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char res_send (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef res_send
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_send ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_res_send || defined __stub___res_send
-choke me
-#endif
-
-int
-main ()
-{
-return res_send ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_func_res_send=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_res_send=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_res_send" >&5
-echo "${ECHO_T}$ac_cv_func_res_send" >&6; }
-if test $ac_cv_func_res_send = yes; then
- :
-else
-
-{ echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5
+ LIBZEPHYR_LIBS="$LIBZEPHYR_LIBS $KRB5_LIBS"
+ # the zephyr library needs -lresolv if it's built with krb5
+ { echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5
echo $ECHO_N "checking for res_send in -lresolv... $ECHO_C" >&6; }
if test "${ac_cv_lib_resolv_res_send+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5
echo "${ECHO_T}$ac_cv_lib_resolv_res_send" >&6; }
if test $ac_cv_lib_resolv_res_send = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
-_ACEOF
-
- LIBS="-lresolv $LIBS"
-
-fi
-
-fi
-
-if test "$hesiod" != yes; then
- CPPFLAGS="$CPPFLAGS -I$hesiod/include"
- LDFLAGS="$LDFLAGS -L$hesiod/lib"
-fi
-{ echo "$as_me:$LINENO: checking for hes_resolve in -lhesiod" >&5
-echo $ECHO_N "checking for hes_resolve in -lhesiod... $ECHO_C" >&6; }
-if test "${ac_cv_lib_hesiod_hes_resolve+set}" = set; then
+ LIBZEPHYR_LIBS="-lresolv $LIBZEPHYR_LIBS"
+else
+ { echo "$as_me:$LINENO: checking for __res_send in -lresolv" >&5
+echo $ECHO_N "checking for __res_send in -lresolv... $ECHO_C" >&6; }
+if test "${ac_cv_lib_resolv___res_send+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lhesiod $LIBS $LIBS"
+LIBS="-lresolv $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char hes_resolve ();
+char __res_send ();
int
main ()
{
-return hes_resolve ();
+return __res_send ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_hesiod_hes_resolve=yes
+ ac_cv_lib_resolv___res_send=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_hesiod_hes_resolve=no
+ ac_cv_lib_resolv___res_send=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hes_resolve" >&5
-echo "${ECHO_T}$ac_cv_lib_hesiod_hes_resolve" >&6; }
-if test $ac_cv_lib_hesiod_hes_resolve = yes; then
- :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv___res_send" >&5
+echo "${ECHO_T}$ac_cv_lib_resolv___res_send" >&6; }
+if test $ac_cv_lib_resolv___res_send = yes; then
+ LIBZEPHYR_LIBS="-lresolv $LIBZEPHYR_LIBS"
else
- { { echo "$as_me:$LINENO: error: Hesiod library not found" >&5
-echo "$as_me: error: Hesiod library not found" >&2;}
+ { { echo "$as_me:$LINENO: error: Zephyr requires libresolv along with Kerberos V." >&5
+echo "$as_me: error: Zephyr requires libresolv along with Kerberos V." >&2;}
{ (exit 1); exit 1; }; }
fi
- HESIOD_LIBS="-lhesiod"
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_HESIOD 1
-_ACEOF
-
fi
-
-# Check whether --with-regex was given.
-if test "${with_regex+set}" = set; then
- withval=$with_regex; regex="$withval"
-else
- regex=no
+ case "$target_os" in
+ darwin*) KRB5_LIBS="$KRB5_LIBS -framework Kerberos" ;;
+ esac
fi
-if test "$regex" != no; then
- if test "$regex" != yes; then
- CPPFLAGS="$CPPFLAGS -I$regex/include"
- LDFLAGS="$LDFLAGS -L$regex/lib"
- fi
- { echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5
-echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6; }
-if test "${ac_cv_lib_regex_regcomp+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lregex $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char regcomp ();
-int
-main ()
-{
-return regcomp ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_regex_regcomp=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_regex_regcomp=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_regcomp" >&5
-echo "${ECHO_T}$ac_cv_lib_regex_regcomp" >&6; }
-if test $ac_cv_lib_regex_regcomp = yes; then
- REGEX_LIBS=-lregex
+
+# Check whether --with-hesiod was given.
+if test "${with_hesiod+set}" = set; then
+ withval=$with_hesiod; hesiod="$withval"
else
- { { echo "$as_me:$LINENO: error: regex library not found" >&5
-echo "$as_me: error: regex library not found" >&2;}
- { (exit 1); exit 1; }; }
+ hesiod=no
fi
-else
- { echo "$as_me:$LINENO: checking for regcomp" >&5
-echo $ECHO_N "checking for regcomp... $ECHO_C" >&6; }
-if test "${ac_cv_func_regcomp+set}" = set; then
+if test "$hesiod" != no; then
+ { echo "$as_me:$LINENO: checking for res_send" >&5
+echo $ECHO_N "checking for res_send... $ECHO_C" >&6; }
+if test "${ac_cv_func_res_send+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Define regcomp to an innocuous variant, in case <limits.h> declares regcomp.
+/* Define res_send to an innocuous variant, in case <limits.h> declares res_send.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define regcomp innocuous_regcomp
+#define res_send innocuous_res_send
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char regcomp (); below.
+ which can conflict with char res_send (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
# include <assert.h>
#endif
-#undef regcomp
+#undef res_send
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
#ifdef __cplusplus
extern "C"
#endif
-char regcomp ();
+char res_send ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_regcomp || defined __stub___regcomp
+#if defined __stub_res_send || defined __stub___res_send
choke me
#endif
int
main ()
{
-return regcomp ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_func_regcomp=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_func_regcomp=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_regcomp" >&5
-echo "${ECHO_T}$ac_cv_func_regcomp" >&6; }
-if test $ac_cv_func_regcomp = yes; then
- :
-else
- { { echo "$as_me:$LINENO: error: can't find POSIX regexp support" >&5
-echo "$as_me: error: can't find POSIX regexp support" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-
-
-# Check whether --with-com_err was given.
-if test "${with_com_err+set}" = set; then
- withval=$with_com_err; com_err="$withval"
-else
- com_err=yes
-fi
-
-if test "$com_err" != no; then
- if test "$com_err" != yes; then
- CPPFLAGS="$CPPFLAGS -I$com_err/include"
- LDFLAGS="$LDFLAGS -L$com_err/lib"
- fi
- { echo "$as_me:$LINENO: checking for com_err in -lcom_err" >&5
-echo $ECHO_N "checking for com_err in -lcom_err... $ECHO_C" >&6; }
-if test "${ac_cv_lib_com_err_com_err+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcom_err $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char com_err ();
-int
-main ()
-{
-return com_err ();
+return res_send ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_com_err_com_err=yes
+ ac_cv_func_res_send=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_com_err_com_err=no
+ ac_cv_func_res_send=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_com_err_com_err" >&5
-echo "${ECHO_T}$ac_cv_lib_com_err_com_err" >&6; }
-if test $ac_cv_lib_com_err_com_err = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_func_res_send" >&5
+echo "${ECHO_T}$ac_cv_func_res_send" >&6; }
+if test $ac_cv_func_res_send = yes; then
:
else
- { { echo "$as_me:$LINENO: error: com_err library not found" >&5
-echo "$as_me: error: com_err library not found" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- { { echo "$as_me:$LINENO: error: This package requires com_err." >&5
-echo "$as_me: error: This package requires com_err." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-# Check whether --with-ss was given.
-if test "${with_ss+set}" = set; then
- withval=$with_ss; ss="$withval"
-else
- ss=yes
-fi
-
-if test "$ss" != no; then
- if test "$ss" != yes; then
- CPPFLAGS="$CPPFLAGS -I$ss/include"
- LDFLAGS="$LDFLAGS -L$ss/lib"
- fi
-{ echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5
-echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; }
-if test "${ac_cv_lib_curses_initscr+set}" = set; then
+{ echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5
+echo $ECHO_N "checking for res_send in -lresolv... $ECHO_C" >&6; }
+if test "${ac_cv_lib_resolv_res_send+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcurses $LIBS"
+LIBS="-lresolv $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char initscr ();
+char res_send ();
int
main ()
{
-return initscr ();
+return res_send ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_curses_initscr=yes
+ ac_cv_lib_resolv_res_send=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_curses_initscr=no
+ ac_cv_lib_resolv_res_send=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5
-echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; }
-if test $ac_cv_lib_curses_initscr = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5
+echo "${ECHO_T}$ac_cv_lib_resolv_res_send" >&6; }
+if test $ac_cv_lib_resolv_res_send = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCURSES 1
+#define HAVE_LIBRESOLV 1
_ACEOF
- LIBS="-lcurses $LIBS"
+ LIBS="-lresolv $LIBS"
fi
+fi
-{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
-echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
-if test "${ac_cv_lib_readline_readline+set}" = set; then
+if test "$hesiod" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$hesiod/include"
+ LDFLAGS="$LDFLAGS -L$hesiod/lib"
+fi
+{ echo "$as_me:$LINENO: checking for hes_resolve in -lhesiod" >&5
+echo $ECHO_N "checking for hes_resolve in -lhesiod... $ECHO_C" >&6; }
+if test "${ac_cv_lib_hesiod_hes_resolve+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $LIBS"
+LIBS="-lhesiod $LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char readline ();
+char hes_resolve ();
int
main ()
{
-return readline ();
+return hes_resolve ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_readline_readline=yes
+ ac_cv_lib_hesiod_hes_resolve=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_readline_readline=no
+ ac_cv_lib_hesiod_hes_resolve=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
-echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
-if test $ac_cv_lib_readline_readline = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBREADLINE 1
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hes_resolve" >&5
+echo "${ECHO_T}$ac_cv_lib_hesiod_hes_resolve" >&6; }
+if test $ac_cv_lib_hesiod_hes_resolve = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: Hesiod library not found" >&5
+echo "$as_me: error: Hesiod library not found" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ HESIOD_LIBS="-lhesiod"
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HESIOD 1
_ACEOF
- LIBS="-lreadline $LIBS"
+fi
+
+# Check whether --with-regex was given.
+if test "${with_regex+set}" = set; then
+ withval=$with_regex; regex="$withval"
+else
+ regex=no
fi
- { echo "$as_me:$LINENO: checking for ss_perror in -lss" >&5
-echo $ECHO_N "checking for ss_perror in -lss... $ECHO_C" >&6; }
-if test "${ac_cv_lib_ss_ss_perror+set}" = set; then
+if test "$regex" != no; then
+ if test "$regex" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$regex/include"
+ LDFLAGS="$LDFLAGS -L$regex/lib"
+ fi
+ { echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5
+echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6; }
+if test "${ac_cv_lib_regex_regcomp+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lss -lcom_err $LIBS"
+LIBS="-lregex $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char ss_perror ();
+char regcomp ();
int
main ()
{
-return ss_perror ();
+return regcomp ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_ss_ss_perror=yes
+ ac_cv_lib_regex_regcomp=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_ss_ss_perror=no
+ ac_cv_lib_regex_regcomp=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ss_ss_perror" >&5
-echo "${ECHO_T}$ac_cv_lib_ss_ss_perror" >&6; }
-if test $ac_cv_lib_ss_ss_perror = yes; then
- :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_regex_regcomp" >&5
+echo "${ECHO_T}$ac_cv_lib_regex_regcomp" >&6; }
+if test $ac_cv_lib_regex_regcomp = yes; then
+ REGEX_LIBS=-lregex
else
- { { echo "$as_me:$LINENO: error: ss library not found" >&5
-echo "$as_me: error: ss library not found" >&2;}
+ { { echo "$as_me:$LINENO: error: regex library not found" >&5
+echo "$as_me: error: regex library not found" >&2;}
{ (exit 1); exit 1; }; }
fi
else
- { { echo "$as_me:$LINENO: error: This package requires ss." >&5
-echo "$as_me: error: This package requires ss." >&2;}
- { (exit 1); exit 1; }; }
-fi
-LIBS="$KRB5_LIBS $KRB4_LIBS $HESIOD_LIBS $LIBS"
-
-{ echo "$as_me:$LINENO: checking for res_send" >&5
-echo $ECHO_N "checking for res_send... $ECHO_C" >&6; }
-if test "${ac_cv_func_res_send+set}" = set; then
+ { echo "$as_me:$LINENO: checking for regcomp" >&5
+echo $ECHO_N "checking for regcomp... $ECHO_C" >&6; }
+if test "${ac_cv_func_regcomp+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Define res_send to an innocuous variant, in case <limits.h> declares res_send.
+/* Define regcomp to an innocuous variant, in case <limits.h> declares regcomp.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define res_send innocuous_res_send
+#define regcomp innocuous_regcomp
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char res_send (); below.
+ which can conflict with char regcomp (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
# include <assert.h>
#endif
-#undef res_send
+#undef regcomp
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
#ifdef __cplusplus
extern "C"
#endif
-char res_send ();
+char regcomp ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_res_send || defined __stub___res_send
+#if defined __stub_regcomp || defined __stub___regcomp
choke me
#endif
int
main ()
{
-return res_send ();
+return regcomp ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_func_res_send=yes
+ ac_cv_func_regcomp=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_func_res_send=no
+ ac_cv_func_regcomp=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_res_send" >&5
-echo "${ECHO_T}$ac_cv_func_res_send" >&6; }
-if test $ac_cv_func_res_send = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_func_regcomp" >&5
+echo "${ECHO_T}$ac_cv_func_regcomp" >&6; }
+if test $ac_cv_func_regcomp = yes; then
:
else
+ { { echo "$as_me:$LINENO: error: can't find POSIX regexp support" >&5
+echo "$as_me: error: can't find POSIX regexp support" >&2;}
+ { (exit 1); exit 1; }; }
+fi
-{ echo "$as_me:$LINENO: checking for res_send in -lresolv" >&5
-echo $ECHO_N "checking for res_send in -lresolv... $ECHO_C" >&6; }
-if test "${ac_cv_lib_resolv_res_send+set}" = set; then
+fi
+
+
+# Check whether --with-com_err was given.
+if test "${with_com_err+set}" = set; then
+ withval=$with_com_err; com_err="$withval"
+else
+ com_err=yes
+fi
+
+if test "$com_err" != no; then
+ if test "$com_err" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$com_err/include"
+ LDFLAGS="$LDFLAGS -L$com_err/lib"
+ fi
+ { echo "$as_me:$LINENO: checking for com_err in -lcom_err" >&5
+echo $ECHO_N "checking for com_err in -lcom_err... $ECHO_C" >&6; }
+if test "${ac_cv_lib_com_err_com_err+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv $LIBS"
+LIBS="-lcom_err $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
#ifdef __cplusplus
extern "C"
#endif
-char res_send ();
+char com_err ();
int
main ()
{
-return res_send ();
+return com_err ();
;
return 0;
}
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_resolv_res_send=yes
+ ac_cv_lib_com_err_com_err=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_resolv_res_send=no
+ ac_cv_lib_com_err_com_err=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_res_send" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv_res_send" >&6; }
-if test $ac_cv_lib_resolv_res_send = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRESOLV 1
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_com_err_com_err" >&5
+echo "${ECHO_T}$ac_cv_lib_com_err_com_err" >&6; }
+if test $ac_cv_lib_com_err_com_err = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: com_err library not found" >&5
+echo "$as_me: error: com_err library not found" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ { { echo "$as_me:$LINENO: error: This package requires com_err." >&5
+echo "$as_me: error: This package requires com_err." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+# Check whether --with-ss was given.
+if test "${with_ss+set}" = set; then
+ withval=$with_ss; ss="$withval"
+else
+ ss=yes
+fi
+
+if test "$ss" != no; then
+ if test "$ss" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$ss/include"
+ LDFLAGS="$LDFLAGS -L$ss/lib"
+ fi
+ #XXX
+ #AC_CHECK_LIB(curses, initscr)
+ #AC_CHECK_LIB(readline, readline)
+ { echo "$as_me:$LINENO: checking for ss_perror in -lss" >&5
+echo $ECHO_N "checking for ss_perror in -lss... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ss_ss_perror+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lss -lcom_err $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
- LIBS="-lresolv $LIBS"
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ss_perror ();
+int
+main ()
+{
+return ss_perror ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_ss_ss_perror=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ss_ss_perror=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ss_ss_perror" >&5
+echo "${ECHO_T}$ac_cv_lib_ss_ss_perror" >&6; }
+if test $ac_cv_lib_ss_ss_perror = yes; then
+ SS_LIBS=-lss
+else
+ { { echo "$as_me:$LINENO: error: ss library not found" >&5
+echo "$as_me: error: ss library not found" >&2;}
+ { (exit 1); exit 1; }; }
fi
+
+else
+ { { echo "$as_me:$LINENO: error: This package requires ss." >&5
+echo "$as_me: error: This package requires ss." >&2;}
+ { (exit 1); exit 1; }; }
fi
+LIBS="$KRB5_LIBS $KRB4_LIBS $LIBS"
+
+#XXX more looking for res_send
+#AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
{ echo "$as_me:$LINENO: checking for ares_getaddrinfo in -lcares" >&5
echo $ECHO_N "checking for ares_getaddrinfo in -lcares... $ECHO_C" >&6; }
if test "${ac_cv_lib_cares_ares_getaddrinfo+set}" = set; then
KRB4_LIBS!$KRB4_LIBS$ac_delim
krb5config!$krb5config$ac_delim
KRB5_LIBS!$KRB5_LIBS$ac_delim
+LIBZEPHYR_LIBS!$LIBZEPHYR_LIBS$ac_delim
HESIOD_LIBS!$HESIOD_LIBS$ac_delim
-REGEX_LIBS!$REGEX_LIBS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+REGEX_LIBS!$REGEX_LIBS$ac_delim
+SS_LIBS!$SS_LIBS$ac_delim
ARES_LIBS!$ARES_LIBS$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
AC_SUBST(lsbindir)
AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$host")
dnl Checks for programs.
AC_PATH_XTRA
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h paths.h termios.h sgtty.h unistd.h malloc.h term.h)
+AC_CHECK_HEADERS(fcntl.h paths.h sgtty.h unistd.h malloc.h term.h)
AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h sys/time.h sys/file.h sys/utsname.h)
AC_CHECK_HEADERS(sys/select.h sys/msgbuf.h sys/cdefs.h krb5_err.h termcap.h)
+AC_CHECK_HEADERS(arpa/nameser_compat.h)
if test "$no_x" != "yes"; then
ZWGC_LIBX11=-lX11
AC_MSG_RESULT(${int32})
AC_CHECK_LIB(w, wslen)
-AC_CHECK_LIB(dl, dlopen)
+# XXX? AC_CHECK_LIB(dl, dlopen)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
-# Hesiod needs -lresolv on Sun systems for res_send.
-if test "$hesiod" != "no"; then
- AC_CHECK_LIB(44bsd, strerror)
- AC_CHECK_LIB(resolv, res_send)
- AC_CHECK_LIB(resolv, __res_send)
-fi
+AC_CHECK_LIB(44bsd, strerror)
+
AC_CHECK_LIB(curses, tgetstr, [TLIB=-lcurses], [TLIB=-ltermcap])
AC_CHECK_LIB(src, srcsrpy, [SLIB=-lsrc; AC_DEFINE(HAVE_SRC)])
AC_SUBST(RLIB)
AC_SUBST(SLIB)
-ATHENA_KRB4
+AC_ARG_WITH(krb4,
+ [ --with-krb4=PREFIX Use Kerberos 4],
+ [krb4="$withval"], [krb4=no])
+if test "$krb4" != no; then
+ AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
+ AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
+ AC_CHECK_LIB(gen, compile)
+ if test "$krb4" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$krb4/include"
+ if test -d "$krb4/include/kerberosIV"; then
+ CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
+ fi
+ LDFLAGS="$LDFLAGS -L$krb4/lib"
+ fi
+ AC_CHECK_LIB(krb4, krb_rd_req,
+ [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
+ [AC_CHECK_LIB(krb, krb_rd_req,
+ [KRB4_LIBS="-lkrb -ldes"],
+ [AC_MSG_ERROR(Kerberos 4 libraries not found)],
+ -ldes)],
+ -ldes425 -lkrb5 -lk5crypto -lcom_err)
+ AC_DEFINE(HAVE_KRB4)
+ LIBZEPHYR_LIBS="$LIBZEPHYR_LIBS $KRB4_LIBS"
+fi
+AC_SUBST(KRB4_LIBS)
AC_ARG_WITH(krb5,
[ --with-krb5=PREFIX Use Kerberos 5],
AC_CHECK_LIB(krb5, krb5_init_context, :,
[AC_MSG_ERROR(Kerberos 5 libraries not found)],
-lk5crypto -lcom_err)
- KRB5_LIBS="-lkrb5 -l5crypto -lcom_err"
+ KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
fi
AC_DEFINE(HAVE_KRB5)
+ LIBZEPHYR_LIBS="$LIBZEPHYR_LIBS $KRB5_LIBS"
+ # the zephyr library needs -lresolv if it's built with krb5
+ AC_CHECK_LIB(resolv, res_send, LIBZEPHYR_LIBS="-lresolv $LIBZEPHYR_LIBS",
+ AC_CHECK_LIB(resolv, __res_send, LIBZEPHYR_LIBS="-lresolv $LIBZEPHYR_LIBS",
+ AC_MSG_ERROR(Zephyr requires libresolv along with Kerberos V.)))
+ case "$target_os" in
+ darwin*) KRB5_LIBS="$KRB5_LIBS -framework Kerberos" ;;
+ esac
fi
AC_SUBST(KRB5_LIBS)
+AC_SUBST(LIBZEPHYR_LIBS)
+
ATHENA_HESIOD
ATHENA_REGEXP
ATHENA_UTIL_COM_ERR
-ATHENA_UTIL_SS
-LIBS="$KRB5_LIBS $KRB4_LIBS $HESIOD_LIBS $LIBS"
+
+AC_ARG_WITH(ss,
+ [ --with-ss=PREFIX Specify location of ss (requires com_err)],
+ [ss="$withval"], [ss=yes])
+if test "$ss" != no; then
+ if test "$ss" != yes; then
+ CPPFLAGS="$CPPFLAGS -I$ss/include"
+ LDFLAGS="$LDFLAGS -L$ss/lib"
+ fi
+ #XXX
+ #AC_CHECK_LIB(curses, initscr)
+ #AC_CHECK_LIB(readline, readline)
+ AC_CHECK_LIB(ss, ss_perror, SS_LIBS=-lss,
+ [AC_MSG_ERROR(ss library not found)], -lcom_err)
+ AC_SUBST(SS_LIBS)
+else
+ AC_MSG_ERROR(This package requires ss.)
+fi
+
+LIBS="$KRB5_LIBS $KRB4_LIBS $LIBS"
dnl Checks for library functions.
-AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
+#XXX more looking for res_send
+#AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
AC_CHECK_LIB(cares, ares_getaddrinfo,
[ARES_LIBS="-lcares"
AC_DEFINE(HAVE_ARES)],
+zephyr (3.0~beta.2483-1) experimental; urgency=low
+
+ * new upstream version
+
+ -- Karl Ramm <kcr@debian.org> Tue, 16 Jun 2009 20:34:26 -0400
+
zephyr (3.0~beta.2362-1) experimental; urgency=low
* new upstream version
/* Define if `regcomp' exists and works. */
#undef HAVE_REGCOMP
+/* Define to 1 if you have the <arpa/nameser_compat.h> header file. */
+#undef HAVE_ARPA_NAMESER_COMPAT_H
/* Define to 1 if the `getpgrp' function requires zero arguments. */
#undef GETPGRP_VOID
/* Define to 1 if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H
-/* Define to 1 if you have the <termios.h> header file. */
-#undef HAVE_TERMIOS_H
-
/* Define to 1 if you have the <term.h> header file. */
#undef HAVE_TERM_H
#ifndef REALM_SZ /* XXX */
#include <arpa/nameser.h>
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif
#define REALM_SZ NS_MAXDNAME
#endif
#define MAX_PRINCIPAL_SIZE 1024
char *cksum_start, int cksum_len,
char *cstart, char *cend, int buffer_len,
int *length_ajdust);
-unsigned long z_quad_cksum(const unsigned char *, u_int32_t *, long,
+unsigned long z_quad_cksum(const unsigned char *, uint32_t *, long,
int, unsigned char *);
#endif
*
* Created by: Greg Hudson
*
- * $Id: sysdep.h 2145 2008-01-21 16:20:29Z kcr $
- * $Zephyr: /mit/zephyr/src/include/zephyr/RCS/zephyr_conf.h,v 1.8 90/12/21 17:40:40 raeburn Exp $
+ * $Id: sysdep.h 2423 2009-04-15 15:19:08Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1988,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#define STDERR_FILENO 2
#endif
-#ifdef HAVE_TERMIOS_H
-# include <termios.h>
-#else
-# ifdef HAVE_SYS_FILIO_H
-# include <sys/filio.h>
-# else
-# ifdef HAVE_SGTTY_H
-# include <sgtty.h>
-# endif
-# ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-# endif
-# endif
-#endif
+#include <termios.h>
/* Kerberos compatibility. */
#ifdef HAVE_KRB4
*
* Created by: Robert French
*
- * $Id: zephyr.h 2362 2009-03-28 21:05:19Z kcr@ATHENA.MIT.EDU $
+ * $Id: zephyr.h 2429 2009-04-17 18:18:39Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of
* Technology. For copying and distribution information, see the
Code_t ZCancelSubscriptions(unsigned int port);
int ZPending(void);
Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from);
+const char *ZGetCharsetString(char *charset);
unsigned short ZGetCharset(char *charset);
const char *ZCharsetToString(unsigned short charset);
+Code_t ZTransliterate(char *in, int inlen, char *inset, char *outset, char **out, int *outlen);
#ifdef Z_DEBUG
void Z_debug(const char *, ...);
#endif
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
top_builddir=..
includedir=${prefix}/include
ALL_CFLAGS=${CFLAGS} -DSYSCONFDIR=\"${sysconfdir}\" -I${top_srcdir}/h \
-I${BUILDTOP}/h ${CPPFLAGS}
LDFLAGS=@LDFLAGS@
-LIBS=@LIBS@ -lcom_err
+LIBS=@LIBZEPHYR_LIBS@ -lcom_err
OBJS = zephyr_err.lo ZAsyncLocate.lo ZCkAuth.lo ZCkIfNot.lo ZClosePort.lo \
ZCmpUID.lo ZCmpUIDP.lo ZFlsLocs.lo ZFlsSubs.lo ZFmtAuth.lo \
zephyr_err.c ${BUILDTOP}/h/zephyr/zephyr_err.h: zephyr_err.et
compile_et ${srcdir}/zephyr_err.et
- mv -f zephyr_err.h ${BUILDTOP}/h/zephyr
+ cp -f zephyr_err.h ${BUILDTOP}/h/zephyr
.c.lo:
${LIBTOOL} --mode=compile ${CC} -c -o $@ ${ALL_CFLAGS} $<
check:
+ python $(srcdir)/zephyr_tests.py --builddir=$(BUILDTOP)
+ $(srcdir)/zephyr_run_doctests --builddir=$(BUILDTOP)
install: libzephyr.la
${LIBTOOL} --mode=install ${INSTALL} -m 644 libzephyr.la \
*
* Created by: Robert French
*
- * $Id: ZCkAuth.c 2286 2009-03-02 03:14:23Z kcr $
+ * $Id: ZCkAuth.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
static const char rcsid_ZCheckAuthentication_c[] =
- "$Zephyr: /mit/zephyr/src/lib/RCS/ZCheckAuthentication.c,v 1.14 89/03/24 14:17:38 jtkohl Exp Locker: raeburn $";
+ "$Id: ZCkAuth.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $";
#endif
#include <internal.h>
#ifndef lint
static const char rcsid_ZCheckAuthentication_c[] =
- "$Zephyr: /mit/zephyr/src/lib/RCS/ZCheckAuthentication.c,v 1.14 89/03/24 14:17:38 jtkohl Exp Locker: raeburn $";
+ "$Id$";
#endif
#include <internal.h>
Code_t ZCheckZcodeAuthentication(ZNotice_t *notice,
struct sockaddr_in *from)
{
+#ifdef HAVE_KRB5
+ krb5_error_code result;
+ krb5_creds *creds;
+ krb5_keyblock *keyblock;
+ krb5_enctype enctype;
+ krb5_cksumtype cksumtype;
+ krb5_data cksumbuf;
+ int valid;
+ char *cksum0_base, *cksum1_base = NULL, *cksum2_base;
+ char *x;
+ unsigned char *asn1_data, *key_data;
+ int asn1_len, key_len, cksum0_len = 0, cksum1_len = 0, cksum2_len = 0;
+#endif
+
/* If the value is already known, return it. */
if (notice->z_checked_auth != ZAUTH_UNSET)
return (notice->z_checked_auth);
if (!notice->z_ascii_checksum)
return (ZAUTH_NO);
-#ifdef HAVE_KRB5
- {
- krb5_error_code result;
- krb5_creds *creds;
- krb5_keyblock *keyblock;
- krb5_enctype enctype;
- krb5_cksumtype cksumtype;
- krb5_data cksumbuf;
- int valid;
- char *cksum0_base, *cksum1_base, *cksum2_base;
- char *x;
- unsigned char *asn1_data, *key_data;
- int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len;
-
- result = ZGetCreds(&creds);
-
- if (result)
- return (ZAUTH_NO);
- /* HOLDING: creds */
-
- /* Figure out what checksum type to use */
- keyblock = Z_credskey(creds);
- key_data = Z_keydata(keyblock);
- key_len = Z_keylen(keyblock);
- result = Z_ExtractEncCksum(keyblock, &enctype, &cksumtype);
- if (result) {
- krb5_free_creds(Z_krb5_ctx, creds);
- return (ZAUTH_FAILED);
- }
- /* HOLDING: creds */
- /* Assemble the things to be checksummed */
- /* first part is from start of packet through z_default_format:
- * - z_version
- * - z_num_other_fields
- * - z_kind
- * - z_uid
- * - z_port
- * - z_auth
- * - z_authent_len
- * - z_ascii_authent
- * - z_class
- * - z_class_inst
- * - z_opcode
- * - z_sender
- * - z_recipient
- * - z_default_format
- */
- cksum0_base = notice->z_packet;
- x = notice->z_default_format;
- cksum0_len = x + strlen(x) + 1 - cksum0_base;
- /* second part is from z_multinotice through other fields:
- * - z_multinotice
- * - z_multiuid
- * - z_other_fields[]
- */
- cksum1_base = notice->z_multinotice;
- if (notice->z_num_other_fields)
+#ifdef HAVE_KRB5
+ result = ZGetCreds(&creds);
+
+ if (result)
+ return (ZAUTH_NO);
+ /* HOLDING: creds */
+
+ /* Figure out what checksum type to use */
+ keyblock = Z_credskey(creds);
+ key_data = Z_keydata(keyblock);
+ key_len = Z_keylen(keyblock);
+ result = Z_ExtractEncCksum(keyblock, &enctype, &cksumtype);
+ if (result) {
+ krb5_free_creds(Z_krb5_ctx, creds);
+ return (ZAUTH_FAILED);
+ }
+ /* HOLDING: creds */
+
+ /* Assemble the things to be checksummed */
+ /* first part is from start of packet through z_default_format:
+ * - z_version
+ * - z_num_other_fields
+ * - z_kind
+ * - z_uid
+ * - z_port
+ * - z_auth
+ * - z_authent_len
+ * - z_ascii_authent
+ * - z_class
+ * - z_class_inst
+ * - z_opcode
+ * - z_sender
+ * - z_recipient
+ * - z_default_format
+ */
+ cksum0_base = notice->z_packet;
+ x = notice->z_default_format;
+ cksum0_len = x + strlen(x) + 1 - cksum0_base;
+ /* second part is from z_multinotice through other fields:
+ * - z_multinotice
+ * - z_multiuid
+ * - z_sender_(sock)addr
+ * - z_charset
+ * - z_other_fields[]
+ */
+ if (notice->z_num_hdr_fields > 15 ) {
+ cksum1_base = notice->z_multinotice;
+ if (notice->z_num_other_fields)
x = notice->z_other_fields[notice->z_num_other_fields - 1];
- else {
- /* see also server/kstuff.c:ZCheckRealmAuthentication */
+ else {
+ /* see also server/kstuff.c:ZCheck{Realm,}Authentication */
/* XXXXXXXXXXXXXXXXXXXXXXX */
- x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
+ if (notice->z_num_hdr_fields > 16)
+ x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
if (notice->z_num_hdr_fields > 17)
x = x + strlen(x) + 1; /* multiuid */
if (notice->z_num_hdr_fields > 18)
x = x + strlen(x) + 1; /* sender */
}
cksum1_len = x + strlen(x) + 1 - cksum1_base; /* charset / extra field */
-
- /* last part is the message body */
- cksum2_base = notice->z_message;
- cksum2_len = notice->z_message_len;
-
- /* The following code checks for old-style checksums, which will go
- away once Kerberos 4 does. */
- if ((!notice->z_ascii_checksum || *notice->z_ascii_checksum != 'Z') &&
- key_len == 8 &&
- (enctype == ENCTYPE_DES_CBC_CRC ||
- enctype == ENCTYPE_DES_CBC_MD4 ||
- enctype == ENCTYPE_DES_CBC_MD5)) {
- /* try old-format checksum (covers cksum0 only) */
-
- ZChecksum_t our_checksum;
-
- our_checksum = z_quad_cksum((unsigned char *)cksum0_base, NULL, cksum0_len, 0,
- key_data);
- if (our_checksum == notice->z_checksum) {
- krb5_free_creds(Z_krb5_ctx, creds);
- return ZAUTH_YES;
- }
- }
- /* HOLDING: creds */
-
- cksumbuf.length = cksum0_len + cksum1_len + cksum2_len;
- cksumbuf.data = malloc(cksumbuf.length);
- if (!cksumbuf.data) {
+ }
+
+ /* last part is the message body */
+ cksum2_base = notice->z_message;
+ cksum2_len = notice->z_message_len;
+
+ /* The following code checks for old-style checksums, which will go
+ away once Kerberos 4 does. */
+ if ((!notice->z_ascii_checksum || *notice->z_ascii_checksum != 'Z') &&
+ key_len == 8 &&
+ (enctype == ENCTYPE_DES_CBC_CRC ||
+ enctype == ENCTYPE_DES_CBC_MD4 ||
+ enctype == ENCTYPE_DES_CBC_MD5)) {
+ /* try old-format checksum (covers cksum0 only) */
+
+ ZChecksum_t our_checksum;
+
+ our_checksum = z_quad_cksum((unsigned char *)cksum0_base, NULL, cksum0_len, 0,
+ key_data);
+ if (our_checksum == notice->z_checksum) {
krb5_free_creds(Z_krb5_ctx, creds);
- return ZAUTH_NO;
- }
- /* HOLDING: creds, cksumbuf.data */
-
- memcpy(cksumbuf.data, cksum0_base, cksum0_len);
- memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
- memcpy(cksumbuf.data + cksum0_len + cksum1_len,
- cksum2_base, cksum2_len);
-
- /* decode zcoded checksum */
- /* The encoded form is always longer than the original */
- asn1_len = strlen(notice->z_ascii_checksum) + 1;
- asn1_data = malloc(asn1_len);
- if (!asn1_data) {
- krb5_free_creds(Z_krb5_ctx, creds);
- free(cksumbuf.data);
- return ZAUTH_FAILED;
- }
- /* HOLDING: creds, asn1_data, cksumbuf.data */
- result = ZReadZcode((unsigned char *)notice->z_ascii_checksum,
- asn1_data, asn1_len, &asn1_len);
- if (result != ZERR_NONE) {
- krb5_free_creds(Z_krb5_ctx, creds);
- free(asn1_data);
- free(cksumbuf.data);
- return ZAUTH_FAILED;
- }
- /* HOLDING: creds, asn1_data, cksumbuf.data */
-
- valid = Z_krb5_verify_cksum(keyblock, &cksumbuf, cksumtype,
- asn1_data, asn1_len);
-
- free(asn1_data);
- krb5_free_creds(Z_krb5_ctx, creds);
- free(cksumbuf.data);
-
- if (valid)
- return ZAUTH_YES;
- else
- return ZAUTH_FAILED;
+ return ZAUTH_YES;
+ }
+ }
+ /* HOLDING: creds */
+
+ cksumbuf.length = cksum0_len + cksum1_len + cksum2_len;
+ cksumbuf.data = malloc(cksumbuf.length);
+ if (!cksumbuf.data) {
+ krb5_free_creds(Z_krb5_ctx, creds);
+ return ZAUTH_NO;
}
-#endif /* HAVE_KRB5 */
+ /* HOLDING: creds, cksumbuf.data */
+
+ memcpy(cksumbuf.data, cksum0_base, cksum0_len);
+ if (cksum1_len)
+ memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
+ memcpy(cksumbuf.data + cksum0_len + cksum1_len,
+ cksum2_base, cksum2_len);
+
+ /* decode zcoded checksum */
+ /* The encoded form is always longer than the original */
+ asn1_len = strlen(notice->z_ascii_checksum) + 1;
+ asn1_data = malloc(asn1_len);
+ if (!asn1_data) {
+ krb5_free_creds(Z_krb5_ctx, creds);
+ free(cksumbuf.data);
+ return ZAUTH_FAILED;
+ }
+ /* HOLDING: creds, asn1_data, cksumbuf.data */
+ result = ZReadZcode((unsigned char *)notice->z_ascii_checksum,
+ asn1_data, asn1_len, &asn1_len);
+ if (result != ZERR_NONE) {
+ krb5_free_creds(Z_krb5_ctx, creds);
+ free(asn1_data);
+ free(cksumbuf.data);
+ return ZAUTH_FAILED;
+ }
+ /* HOLDING: creds, asn1_data, cksumbuf.data */
+
+ valid = Z_krb5_verify_cksum(keyblock, &cksumbuf, cksumtype,
+ asn1_data, asn1_len);
+
+ free(asn1_data);
+ krb5_free_creds(Z_krb5_ctx, creds);
+ free(cksumbuf.data);
+
+ if (valid)
+ return ZAUTH_YES;
+ else
+ return ZAUTH_FAILED;
+#else /* HAVE_KRB5 */
return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO);
+#endif
}
expand[sizeof(expand)-1] = '\0';
result = krb5_free_host_realm(Z_krb5_ctx, list_realms);
return expand;
-#endif
+#else
#ifndef HAVE_KRB4
struct hostent *he;
return(krb_realm);
}
}
-#endif /* KERBEROS */
+#endif /* HAVE_KRB4 */
+#endif
}
*
* Created by: Robert French
*
- * $Id: ZInit.c 2276 2008-12-29 08:27:51Z kcr $
+ * $Id: ZInit.c 2440 2009-04-21 15:04:33Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
static const char rcsid_ZInitialize_c[] =
- "$Zephyr: /afs/athena.mit.edu/astaff/project/zephyr/src/lib/RCS/ZInitialize.c,v 1.17 89/05/30 18:11:25 jtkohl Exp $";
+ "$Id: ZInit.c 2440 2009-04-21 15:04:33Z kcr@ATHENA.MIT.EDU $";
#endif
#include <internal.h>
#if defined(HAVE_KRB5) && defined(KRB5_REFERRAL_REALM)
#include <profile.h>
-int z_get_host_realm_replacement(char *, char ***);
+static int z_get_host_realm_replacement(char *, char ***);
+#endif
+
+#if defined(HAVE_KRB5)
+int Zauthtype = 5;
+#elif defined(HAVE_KRB4)
+int Zauthtype = 4;
+#else
+int Zauthtype = 0;
#endif
Code_t
#endif
#endif
+ /* On OS X you don't need to initialize the Kerberos error tables
+ as long as you link with -framework Kerberos */
+#if !(defined(__APPLE__) && defined(__MACH__))
#ifdef HAVE_KRB4
initialize_krb_error_table();
#endif
#ifdef HAVE_KRB5
initialize_krb5_error_table();
#endif
+#endif
+#if defined(__APPLE__) && defined(__MACH__)
+ add_error_table(&et_zeph_error_table);
+#else
initialize_zeph_error_table();
+#endif
(void) memset((char *)&__HM_addr, 0, sizeof(__HM_addr));
#include <ctype.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif
#include <resolv.h>
static int txt_lookup(char *qname, char **result) {
if (left < 10)
return -1;
- type = ntohs(*(u_int16_t *)p);
+ type = ntohs(*(uint16_t *)p);
p += 2;
- class = ntohs(*(u_int16_t *)p);
+ class = ntohs(*(uint16_t *)p);
p += 6;
- ret = ntohs(*(u_int16_t *)p);
+ ret = ntohs(*(uint16_t *)p);
p += 2;
left -= 10;
return -1;
}
-int z_get_host_realm_replacement(char *inhost, char ***krealms) {
+static int
+z_get_host_realm_replacement(char *inhost, char ***krealms) {
char *host, *p;
char *realm = NULL;
char *default_realm = NULL;
*
* Created by: Robert French
*
- * $Id: ZLocations.c 2234 2008-12-21 08:30:34Z kcr $
+ * $Id: ZLocations.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
static const char rcsid_ZLocations_c[] =
- "$Zephyr: /afs/athena.mit.edu/astaff/project/zephyr/src/lib/RCS/ZLocations.c,v 1.30 90/12/20 03:04:39 raeburn Exp $";
+ "$Id: ZLocations.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $";
#endif
#include <internal.h>
*
* Created by: Robert French
*
- * $Id: ZMkAuth.c 2286 2009-03-02 03:14:23Z kcr $
+ * $Id: ZMkAuth.c 2385 2009-04-03 05:30:57Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <internal.h>
#ifndef lint
-static const char rcsid_ZMakeAuthentication_c[] = "$Id: ZMkAuth.c 2286 2009-03-02 03:14:23Z kcr $";
+static const char rcsid_ZMakeAuthentication_c[] = "$Id: ZMkAuth.c 2385 2009-04-03 05:30:57Z kcr@ATHENA.MIT.EDU $";
#endif
#ifdef HAVE_KRB4
result = krb5_build_principal(Z_krb5_ctx, &creds_in.server,
strlen(realm),
realm,
- SERVER_SERVICE, SERVER_INSTANCE, 0);
+ SERVER_SERVICE, SERVER_INSTANCE,
+ NULL);
if (result) {
krb5_cc_close(Z_krb5_ctx, ccache);
return result;
*
* Created by: Robert French
*
- * $Id: ZParseNot.c 2344 2009-03-24 03:40:55Z kcr $
+ * $Id: ZParseNot.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
static const char rcsid_ZParseNotice_c[] =
- "$Zephyr: /mit/zephyr/src/lib/RCS/ZParseNotice.c,v 1.22 91/03/29 03:34:46 raeburn Exp $";
+ "$Id: ZParseNot.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $";
#endif
#include <internal.h>
*
* Created by: Robert French
*
- * $Id: ZSendPkt.c 2135 2008-01-21 03:39:30Z kcr $
+ * $Id: ZSendPkt.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
static const char rcsid_ZSendPacket_c[] =
- "$Zephyr: /mit/zephyr/src/lib/RCS/ZSendPacket.c,v 1.29 91/03/21 11:57:08 raeburn Exp $";
+ "$Id: ZSendPkt.c 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $";
#endif
#include <internal.h>
#endif /* lint */
#include <internal.h>
+
#include <string.h>
#include <locale.h>
#include <langinfo.h>
#include <ctype.h>
+#include <iconv.h>
+#include <errno.h>
-unsigned short
-ZGetCharset(char *charset)
+const char *
+ZGetCharsetString(char *charset)
{
char *p;
- short retval;
static int once = 1;
if (charset == NULL)
for (p = charset; *p; p++)
*p = toupper(*p);
+ return charset;
+}
+
+unsigned short
+ZGetCharset(char *charset)
+{
+ short retval;
+
+ charset = (char *)ZGetCharsetString(charset);
if (!strcmp(charset, "NONE") || !strcmp(charset, "UNKNOWN"))
retval = ZCHARSET_UNKNOWN;
else if (!strcmp(charset, "ANSI_X3.4-1968"))
return "UTF-8";
return "UNKNOWN";
}
-
+
+Code_t
+ZTransliterate(char *in, int inlen, char *inset, char *outset, char **out, int *outlen)
+{
+ iconv_t ih;
+ char *outset_t, *inp, *outp;
+ int retval;
+ size_t size, inleft, outleft;
+
+ *out = NULL;
+ *outlen = 0;
+
+ outset_t = malloc(strlen(outset) + 11);
+ if (outset_t == NULL)
+ return errno;
+ sprintf(outset_t, "%s//TRANSLIT", outset);
+
+ ih = iconv_open(outset_t, inset);
+
+ free(outset_t);
+
+ if (ih != (iconv_t)-1) {
+ size = inlen; /* doubling this should be enough, but.. */
+ do {
+ size = size * 2;
+
+ *out = malloc(size);
+ if (*out == NULL) {
+ iconv_close(ih);
+ return errno;
+ }
+
+ inleft = inlen;
+ outleft = size;
+
+ inp = in;
+ outp = *out;
+
+ retval = iconv(ih, &inp, &inleft, &outp, &outleft);
+ if (retval < 0)
+ free(*out);
+ } while (retval < 0 && errno == E2BIG);
+
+ iconv_close(ih);
+ }
+
+ if (ih == (iconv_t)-1 || retval < 0)
+ return errno;
+
+ *outlen = size - outleft;
+
+ return ZERR_NONE;
+}
#ifdef HAVE_KRB5
unsigned long
z_quad_cksum(const unsigned char *in, /* input block */
- u_int32_t *out, /* optional longer output */
+ uint32_t *out, /* optional longer output */
long length, /* original length in bytes */
int out_count, /* number of iterations */
unsigned char *c_seed /* secret seed, 8 bytes */
* checksum is written unto the address pointed to.
*/
- register u_int32_t z;
- register u_int32_t z2;
- register u_int32_t x;
- register u_int32_t x2;
+ register uint32_t z;
+ register uint32_t z2;
+ register uint32_t x;
+ register uint32_t x2;
const unsigned char *p;
register int32_t len;
register int i;
--- /dev/null
+#!/usr/bin/python
+
+import doctest
+
+print doctest.testfile("zephyr_tests.txt")
+
--- /dev/null
+#!/usr/bin/python
+
+# zephyr test suite
+#
+# Operates on libraries in the build tree. To test purely internal
+# interfaces, stuff them in a testing library...
+
+
+"""Test Suite for libzephyr"""
+
+import optparse
+import os
+import socket
+import struct
+import ctypes
+import ctypes.util
+import time
+from ctypes import c_int, c_uint, c_ushort, c_char, c_ubyte
+from ctypes import c_uint16, c_uint32
+from ctypes import POINTER, c_void_p, c_char_p
+from ctypes import Structure, Union, sizeof
+
+__revision__ = "$Id: zephyr_tests.py 2450 2009-05-02 23:46:15Z eichin@THOK.ORG $"
+try:
+ __version__ = "%s/%s" % (__revision__.split()[3], __revision__.split()[2])
+except IndexError:
+ __version__ = "unknown"
+
+def print_line_or_lines(results, indent):
+ """short values on same line, multi-line on later ones..."""
+ if len(results) == 1:
+ print results[0]
+ else:
+ print
+ for result in results:
+ print indent + result
+
+def ctypes_pprint(cstruct, indent=""):
+ """pretty print a ctypes Structure or Union"""
+
+ for field_name, field_ctype in cstruct._fields_:
+ field_value = getattr(cstruct, field_name)
+ print indent + field_name,
+ next_indent = indent + " "
+ pprint_name = "pprint_%s" % field_name
+ pformat_name = "pformat_%s" % field_name
+ if hasattr(cstruct, pprint_name):
+ # no longer used
+ getattr(cstruct, pprint_name)(next_indent)
+ elif hasattr(cstruct, pformat_name):
+ # counted-array and other common cases
+ print_line_or_lines(getattr(cstruct, pformat_name)(), next_indent)
+ elif hasattr(field_value, "pformat"):
+ # common for small compound types
+ print_line_or_lines(field_value.pformat(), next_indent)
+ elif hasattr(field_value, "pprint"):
+ # useful for Union selectors
+ field_value.pprint(next_indent)
+ elif hasattr(field_value, "_fields_"):
+ # generic recursion
+ print
+ ctypes_pprint(field_value, next_indent)
+ else:
+ # generic simple (or unknown/uninteresting) value
+ print field_value
+
+class Enum(c_int):
+ def pformat(self):
+ try:
+ return ["%s(%d)" % (self._values_[self.value], self.value)]
+ except IndexError:
+ return ["unknown enum value(%d)" % (self.value)]
+
+def populate_enum(cls):
+ """make members for each of the enum values"""
+ for value, tag in enumerate(cls._values_):
+ setattr(cls, tag, cls(value))
+
+# not really an enum, but we get a richer effect by treating it as one
+class Enum_u16(c_uint16):
+ def pformat(self):
+ try:
+ return ["%s(%d)" % (self._values_[self.value], self.value)]
+ except IndexError:
+ return ["unknown enum value(%d)" % (self.value)]
+
+
+# TODO: pick some real framework later, we're just poking around for now
+class TestSuite(object):
+ """test collection and runner"""
+ def __init__(self, **kwargs):
+ for k, v in kwargs.items():
+ setattr(self, k, v)
+
+ def run(self):
+ tests = sorted([testname for testname in dir(self)
+ if testname.startswith("test_")])
+ failures = []
+ for test in tests:
+ try:
+ print "===", "starting", test, "==="
+ getattr(self, test)()
+ print "===", "done", test, "==="
+ except TestFailure, tf:
+ print "===", "FAILED", test, "==="
+ failures.append([test, tf])
+
+ return failures
+
+
+class TestFailure(Exception):
+ pass
+
+# POSIX socket types...
+class in_addr(Structure):
+ _fields_ = [
+ ("s_addr", c_uint32),
+ ]
+ def pformat(self):
+ return [socket.inet_ntoa(struct.pack("<I", self.s_addr))]
+
+class _U_in6_u(Union):
+ _fields_ = [
+ ("u6_addr8", c_ubyte * 16),
+ ("u6_addr16", c_uint16 * 8),
+ ("u6_addr32", c_uint32 * 4),
+ ]
+
+class in6_addr(Structure):
+ _fields_ = [
+ ("in6_u", _U_in6_u),
+ ]
+
+class AF_(Enum_u16):
+ _socket_af = dict([(v,n) for n,v in socket.__dict__.items() if n.startswith("AF_")])
+ _values_ = [_socket_af.get(k, "unknown address family") for k in range(min(_socket_af), max(_socket_af)+1)]
+
+populate_enum(AF_)
+
+class sockaddr(Structure):
+ _fields_ = [
+ ("sa_family", AF_),
+ ("sa_data", c_char * 14),
+ ]
+
+class sockaddr_in(Structure):
+ _fields_ = [
+ ("sin_family", AF_),
+ ("sin_port", c_uint16),
+ ("sin_addr", in_addr),
+ # hack from linux - do we actually need it?
+ ("sin_zero", c_ubyte * (sizeof(sockaddr)-sizeof(c_uint16)-sizeof(c_uint16)-sizeof(in_addr))),
+ ]
+ def pformat_sin_zero(self):
+ return ["[ignored]"]
+
+# RFC2553...
+class sockaddr_in6(Structure):
+ _fields_ = [
+ ("sin6_family", AF_),
+ ("sin6_port", c_uint16),
+ ("sin6_flowinfo", c_uint32),
+ ("sin6_addr", in6_addr),
+ ("sin6_scope_id", c_uint32),
+ ]
+
+# zephyr/zephyr.h
+#define Z_MAXOTHERFIELDS 10 /* Max unknown fields in ZNotice_t */
+Z_MAXOTHERFIELDS = 10
+#define ZAUTH (ZMakeAuthentication)
+#define ZCAUTH (ZMakeZcodeAuthentication)
+#define ZNOAUTH ((Z_AuthProc)0)
+ZNOAUTH = 0
+
+# typedef enum {
+# UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT
+# } ZNotice_Kind_t;
+# extern const char *ZNoticeKinds[9];
+
+class ZNotice_Kind_t(Enum):
+ _values_ = [
+ "UNSAFE", "UNACKED", "ACKED", "HMACK", "HMCTL", "SERVACK", "SERVNAK", "CLIENTACK", "STAT",
+ ]
+populate_enum(ZNotice_Kind_t)
+
+def pformat_timeval(tv_sec, tv_usec):
+ """format timeval parts as seconds and human-readable time"""
+ try:
+ timestr = time.ctime(tv_sec)
+ except ValueError:
+ timestr = "invalid unix time"
+ if tv_usec >= 1000000 or tv_usec < 0:
+ # invalid usec, still treat as numbers
+ return ["%dsec, %dusec (bad) (%s)" % (tv_sec, tv_usec, timestr)]
+ return ["%d.%06dsec (%s)" % (tv_sec, tv_usec, timestr)]
+
+# struct _ZTimeval {
+class _ZTimeval(Structure):
+ _fields_ = [
+# int tv_sec;
+ ("tv_sec", c_int),
+# int tv_usec;
+ ("tv_usec", c_int),
+# };
+ ]
+ def pformat(self):
+ return pformat_timeval(self.tv_sec, self.tv_usec)
+
+
+class _ZTimeval_Net(_ZTimeval):
+ """When _ZTimeval is used in a ZUnique_Id_t, the time parts are
+ stored in network byte order. Handle this by faking up a different type."""
+ def pformat(self):
+ return pformat_timeval(socket.ntohl(self.tv_sec), socket.ntohl(self.tv_usec))
+
+# typedef struct _ZUnique_Id_t {
+class ZUnique_Id_t(Structure):
+ _fields_ = [
+ # struct in_addr zuid_addr;
+ ("zuid_addr", in_addr),
+ # struct _ZTimeval tv;
+ ("tv", _ZTimeval_Net),
+ # } ZUnique_Id_t;
+ ]
+
+# union {
+class _U_z_sender_sockaddr(Union):
+ _fields_ = [
+ # struct sockaddr sa;
+ ("sa", sockaddr),
+ # struct sockaddr_in ip4;
+ ("ip4", sockaddr_in),
+ # struct sockaddr_in6 ip6;
+ ("ip6", sockaddr_in6),
+ # } z_sender_sockaddr;
+ ]
+ def pprint(self, indent):
+ print
+ if self.sa.sa_family.value == socket.AF_INET:
+ ctypes_pprint(self.ip4, indent + ".ip4:")
+ elif self.sa.sa_family.value == socket.AF_INET6:
+ ctypes_pprint(self.ip6, indent + ".ip6:")
+ else:
+ ctypes_pprint(self.sa, indent + ".sa:")
+
+# typedef struct _ZNotice_t {
+class ZNotice_t(Structure):
+ _fields_ = [
+ # char *z_packet;
+ ("z_packet", c_char_p),
+ # char *z_version;
+ ("z_version", c_char_p),
+ # ZNotice_Kind_t z_kind;
+ ("z_kind", ZNotice_Kind_t),
+ # ZUnique_Id_t z_uid;
+ ("z_uid", ZUnique_Id_t),
+ # union {
+ # struct sockaddr sa;
+ # struct sockaddr_in ip4;
+ # struct sockaddr_in6 ip6;
+ # } z_sender_sockaddr;
+ ("z_sender_sockaddr", _U_z_sender_sockaddr),
+
+ # /* heavily deprecated: */
+ # #define z_sender_addr z_sender_sockaddr.ip4.sin_addr
+ # /* probably a bad idea?: */
+ # struct _ZTimeval z_time;
+ ("z_time", _ZTimeval),
+ # unsigned short z_port;
+ ("z_port", c_ushort),
+ # unsigned short z_charset;
+ ("z_charset", c_ushort),
+ # int z_auth;
+ ("z_auth", c_int),
+ # int z_checked_auth;
+ # TODO: fake enum, for display
+ ("z_checked_auth", c_int),
+ # int z_authent_len;
+ ("z_authent_len", c_int),
+ # char *z_ascii_authent;
+ ("z_ascii_authent", c_char_p),
+ # char *z_class;
+ ("z_class", c_char_p),
+ # char *z_class_inst;
+ ("z_class_inst", c_char_p),
+ # char *z_opcode;
+ ("z_opcode", c_char_p),
+ # char *z_sender;
+ ("z_sender", c_char_p),
+ # char *z_recipient;
+ ("z_recipient", c_char_p),
+ # char *z_default_format;
+ ("z_default_format", c_char_p),
+ # char *z_multinotice;
+ ("z_multinotice", c_char_p),
+ # ZUnique_Id_t z_multiuid;
+ ("z_multiuid", ZUnique_Id_t),
+ # ZChecksum_t z_checksum;
+ ("z_checksum", c_uint),
+ # char *z_ascii_checksum;
+ ("z_ascii_checksum", c_char_p),
+ # int z_num_other_fields;
+ ("z_num_other_fields", c_int),
+ # char *z_other_fields[Z_MAXOTHERFIELDS];
+ ("z_other_fields", c_char_p * Z_MAXOTHERFIELDS),
+ # caddr_t z_message;
+ ("z_message", c_char_p), # not 1980
+ # int z_message_len;
+ ("z_message_len", c_int),
+ # int z_num_hdr_fields;
+ ("z_num_hdr_fields", c_int),
+ # char **z_hdr_fields;
+ ("z_hdr_fields", POINTER(c_char_p)),
+ # } ZNotice_t;
+ ]
+ def pformat_z_other_fields(self):
+ return ["%d: %s" % (n, self.z_other_fields[n])
+ for n in range(Z_MAXOTHERFIELDS)]
+ def pformat_z_hdr_fields(self):
+ if not self.z_hdr_fields:
+ return ["NULL"]
+ return ["%d: %s" % (n, self.z_hdr_fields[n])
+ for n in range(self.z_num_hdr_fields)]
+
+class libZephyr(object):
+ """wrappers for functions in libZephyr"""
+ testable_funcs = [
+ "ZInitialize",
+ "ZGetFD",
+ "ZGetRealm",
+ "ZGetSender",
+ "Z_FormatRawHeader",
+ "ZParseNotice",
+ "ZFormatNotice",
+ "ZCompareUID",
+ "ZExpandRealm",
+ "ZGetCharsetString",
+ "ZGetCharset",
+ "ZCharsetToString",
+ "ZTransliterate",
+ "ZOpenPort",
+ "ZClosePort",
+ "ZMakeAscii",
+ "ZMakeZcode",
+ "ZGetDestAddr",
+ "ZSetFD",
+ "ZPending",
+ ]
+ def __init__(self, library_path=None):
+ """connect to the library and build the wrappers"""
+ if not library_path:
+ library_path = ctypes.util.find_library("zephyr")
+ self._lib = ctypes.cdll.LoadLibrary(library_path)
+
+ # grab the Zauthtype variable
+ self.Zauthtype = ctypes.c_int.in_dll(self._lib, 'Zauthtype').value
+
+ # generic bindings?
+ for funcname in self.testable_funcs:
+ setattr(self, funcname, getattr(self._lib, funcname))
+
+ # TODO: fix return types, caller types in a more generic way later
+ # (perhaps by parsing the headers or code)
+ # perhaps metaprogramming or decorators...
+ self.ZGetRealm.restype = ctypes.c_char_p
+ self.ZGetSender.restype = ctypes.c_char_p
+
+ # Code_t
+ # Z_FormatRawHeader(ZNotice_t *notice,
+ # char *buffer,
+ # int buffer_len,
+ # int *len,
+ # char **cstart,
+ # char **cend)
+ # This stuffs a notice into a buffer; cstart/cend point into the checksum in buffer
+ self.Z_FormatRawHeader.argtypes = [
+ c_void_p, # *notice
+ c_char_p, # *buffer
+ c_int, # buffer_len
+ POINTER(c_int), # *len
+ POINTER(c_char_p), # **cstart
+ POINTER(c_char_p), # **cend
+ ]
+
+ # Code_t
+ # ZParseNotice(char *buffer,
+ # int len,
+ # ZNotice_t *notice)
+ self.ZParseNotice.argtypes = [
+ c_char_p, # *buffer
+ c_int, # len
+ POINTER(ZNotice_t), # *notice
+ ]
+
+ # Code_t
+ # ZFormatNotice(register ZNotice_t *notice,
+ # char **buffer,
+ # int *ret_len,
+ # Z_AuthProc cert_routine)
+ self.ZFormatNotice.argtypes = [
+ POINTER(ZNotice_t), # *notice
+ POINTER(c_char_p), # **buffer
+ POINTER(c_int), # *ret_len
+ c_void_p, # cert_routine
+ ]
+
+ # int
+ # ZCompareUID(ZUnique_Id_t *uid1,
+ # ZUnique_Id_t *uid2)
+ self.ZCompareUID.argtypes = [
+ POINTER(ZUnique_Id_t), # *uid1
+ POINTER(ZUnique_Id_t), # *uid2
+ ]
+
+ # char *
+ # ZExpandRealm(realm)
+ # char *realm; # mmm 80's
+ self.ZExpandRealm.restype = c_char_p
+ self.ZExpandRealm.argtypes = [
+ c_char_p, # realm
+ ]
+
+ # unsigned short
+ # ZGetCharset(char *charset)
+ self.ZGetCharset.restype = c_ushort
+ self.ZGetCharset.argtypes = [
+ c_char_p, # charset
+ ]
+
+ # const char *
+ # ZCharsetToString(unsigned short charset)
+ self.ZCharsetToString.restype = c_char_p
+ self.ZCharsetToString.argtypes = [
+ c_ushort, # charset
+ ]
+
+ # Code_t
+ # ZTransliterate(char *in,
+ # int inlen,
+ # char *inset,
+ # char *outset,
+ # char **out,
+ # int *outlen)
+ self.ZTransliterate.argtypes = [
+ c_char_p, # in
+ c_int, # inlnet,
+ c_char_p, # inset
+ c_char_p, # outset
+ POINTER(c_char_p), # out
+ POINTER(c_int), # outlen
+ ]
+
+ # Code_t ZOpenPort(u_short *port)
+ self.ZOpenPort.argtypes = [
+ POINTER(c_ushort), # port
+ ]
+
+ # const char *
+ # ZGetCharsetString(char *charset)
+ self.ZGetCharsetString.restype = c_char_p
+ self.ZGetCharsetString.argtypes = [
+ c_char_p, # charset
+ ]
+
+ # Code_t
+ # ZMakeAscii(register char *ptr,
+ # int len,
+ # unsigned char *field,
+ # int num)
+ self.ZMakeAscii.argtypes = [
+ c_char_p, # ptr
+ c_int, # len
+ c_char_p, # field; c_uchar_p?
+ c_int, # num
+ ]
+
+ # Code_t
+ # ZMakeZcode(register char *ptr,
+ # int len,
+ # unsigned char *field,
+ # int num)
+ self.ZMakeZcode.argtypes = [
+ c_char_p, # ptr
+ c_int, # len
+ c_char_p, # field; c_uchar_p?
+ c_int, # num
+ ]
+
+ # struct sockaddr_in ZGetDestAddr (void) {
+ self.ZGetDestAddr.restype = sockaddr_in
+
+ # library-specific setup...
+ self.ZInitialize()
+
+def py_make_ascii(input):
+ """reference ZMakeAscii expressed as python..."""
+ hexes = ["%02X" % ord(ch) for ch in input]
+ output = []
+ for i in range(0, len(hexes), 4):
+ output.append("0x" + "".join(hexes[i:i+4]))
+ return " ".join(output)
+
+def py_make_zcode(input):
+ """reference ZMakeZcode expressed as python..."""
+ return "Z" + input.replace("\xff", "\xff\xf1").replace("\0", "\xff\xf0")
+
+
+class ZephyrTestSuite(TestSuite):
+ """Tests for libzephyr"""
+ def setup(self):
+ # find the library
+ libzephyr_path = os.path.join(self.builddir, "libzephyr.so.4.0.0")
+ # check for libtool...
+ if not os.path.exists(libzephyr_path):
+ libzephyr_path = os.path.join(self.builddir, ".libs", "libzephyr.so.4.0.0")
+ self._libzephyr = libZephyr(libzephyr_path)
+
+ def cleanup(self):
+ # no cleanup needed yet
+ pass
+
+ def test_zinit(self):
+ """test that ZInitialize did something"""
+ print "fd", self._libzephyr.ZGetFD()
+ realm = self._libzephyr.ZGetRealm()
+ print "realm", realm
+ if not realm:
+ raise TestFailure("empty realm %s" % realm)
+ if self._libzephyr.Zauthtype and realm == 'local-realm':
+ raise TestFailure("useless realm %s" % realm)
+ if self._libzephyr.Zauthtype == 0 and realm != 'local-realm':
+ raise TestFailure("wrong realm %s (should be local-realm)" % realm)
+ print self._libzephyr.ZGetSender()
+
+ def test_notices(self):
+ """test notice construct/destruct"""
+ notice = ZNotice_t()
+ print "sizeof ZNotice_t", sizeof(notice)
+ zbuf = c_char_p(0)
+ zbuflen = c_int(0)
+ st = self._libzephyr.ZFormatNotice(notice, zbuf, zbuflen, ZNOAUTH)
+ print "ZFormatNotice:", "retval", st
+ print "\tzbuflen", zbuflen
+ print "\tzbuf", repr(zbuf.value)
+ new_notice = ZNotice_t()
+ st = self._libzephyr.ZParseNotice(zbuf, zbuflen, new_notice)
+ print "ZParseNotice:", "retval", st
+ print "\tz_version", new_notice.z_version
+ ctypes_pprint(new_notice)
+
+ def test_z_compare_uid(self):
+ """test ZCompareUID"""
+
+ uid1 = ZUnique_Id_t()
+ uid2 = ZUnique_Id_t()
+ assert self._libzephyr.ZCompareUID(uid1, uid2), "null uids don't match"
+
+ # there's no ZUnique_Id_t constructor - Z_FormatHeader and Z_NewFormatHeader initialize notice->z_uid directly
+ notice1 = ZNotice_t()
+ zbuf = c_char_p(0)
+ zbuflen = c_int(0)
+ st = self._libzephyr.ZFormatNotice(notice1, zbuf, zbuflen, ZNOAUTH)
+ assert st == 0, "ZFormatNotice notice1 failed"
+
+ notice2 = ZNotice_t()
+ zbuf = c_char_p(0)
+ zbuflen = c_int(0)
+ st = self._libzephyr.ZFormatNotice(notice2, zbuf, zbuflen, ZNOAUTH)
+ assert st == 0, "ZFormatNotice notice2 failed"
+
+ assert not self._libzephyr.ZCompareUID(notice1.z_uid, notice2.z_uid), "distinct notices don't compare as distinct"
+ # ctypes_pprint(notice1.z_uid)
+
+ def test_zauthtype(self):
+ """Make sure Zauthtype is an acceptable value"""
+ assert self._libzephyr.Zauthtype in (0, 4, 5)
+
+ def test_z_expand_realm(self):
+ """test ZExpandRealm"""
+ if self._libzephyr.Zauthtype:
+ assert self._libzephyr.ZExpandRealm("") == ""
+ assert self._libzephyr.ZExpandRealm("localhost") == ""
+ assert self._libzephyr.ZExpandRealm("bitsy.mit.edu") == "ATHENA.MIT.EDU"
+ else:
+ assert self._libzephyr.ZExpandRealm("") == ""
+ assert self._libzephyr.ZExpandRealm("localhost") == "LOCALHOST"
+ assert self._libzephyr.ZExpandRealm("bitsy.mit.edu") == "BITSY.MIT.EDU"
+
+def find_buildpath():
+ parser = optparse.OptionParser(usage=__doc__,
+ version = "%%prog %s" % __version__)
+ parser.add_option("--builddir", default="..",
+ help="where to find the top of the build tree")
+ parser.add_option("--verbose", "-v", action="store_true",
+ help="pass through for doctest.testfile")
+ opts, args = parser.parse_args()
+ assert not args, "no args yet"
+
+ return os.path.join(opts.builddir, "lib")
+
+def getsockname(fd):
+ """wrapped C lib getsocketname (works on raw fd)"""
+ libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library("c"))
+
+ call_getsockname = libc.getsockname
+ call_getsockname.argtypes = [
+ c_int, # int s
+ POINTER(sockaddr), # struct sockaddr *name
+ POINTER(c_int), # socklen_t *namelen
+ ]
+ name = sockaddr(0)
+ namelen = c_int(sizeof(name))
+ ret = call_getsockname(fd, name, namelen)
+ if ret == 0:
+ return name
+ # we can't get at errno until python 2.6...
+ print ret
+ raise EnvironmentError("getsockname failed")
+
+
+if __name__ == "__main__":
+ tester = ZephyrTestSuite(builddir=find_buildpath())
+ tester.setup()
+ failures = tester.run()
+ tester.cleanup()
+ for failure, exc in failures:
+ print "FAIL:", failure, str(exc)
--- /dev/null
+Zephyr Library Tests
+
+This file is a collection of doctests for the zephyr library.
+Minimum coverage goal is "every non-static function, and every data
+structure that shows up in those function prototypes."
+
+This file is also a test of the practicality of rich doctests as API
+documentation. It will start out as a bunch of snippets, and later be
+edited to use actual chapters and appendices - narrative structure
+beyond "here's a test! here's another test!" At that point we'll also
+pick a formatting language (probably ReStructured Text but for now, we
+need no more than whitespace separated paragraphs to be
+comprehensible.)
+
+Generic library setup that should be moved into zephyr_tests.py:
+
+ >>> import os
+ >>> import zephyr_tests
+ >>> buildpath = zephyr_tests.find_buildpath()
+ >>> libzephyr_path = os.path.join(buildpath, ".libs", "libzephyr.so.4.0.0")
+ >>> _z = zephyr_tests.libZephyr(libzephyr_path)
+
+ZInit() got run by libZephyr, internally. Make sure other things
+actually got set up:
+
+ >>> assert _z.ZGetFD() == -1
+ >>> Zauthtype = _z.Zauthtype
+ >>> assert Zauthtype in (0, 4, 5)
+ >>> realm = _z.ZGetRealm()
+ >>> assert realm
+ >>> if Zauthtype: assert realm != 'local-realm'
+ >>> if not Zauthtype: assert realm == 'local-realm'
+ >>> assert _z.ZGetSender()
+ >>> assert "@" in _z.ZGetSender()
+
+ZNotice_t structure pseudo-round-trip (needs a lot more explicit
+settings and assertions to be a real round-trip test...)
+
+ >>> notice = zephyr_tests.ZNotice_t()
+ >>> from ctypes import sizeof
+ >>> assert sizeof(notice) > 150
+ >>> from ctypes import c_char_p, c_int
+ >>> zbuf = c_char_p(0)
+ >>> zbuflen = c_int(0)
+ >>> st = _z.ZFormatNotice(notice, zbuf, zbuflen, zephyr_tests.ZNOAUTH)
+ >>> assert st == 0
+ >>> assert zbuf.value.startswith("ZEPH")
+ >>> new_notice = zephyr_tests.ZNotice_t()
+ >>> st = _z.ZParseNotice(zbuf, zbuflen, new_notice)
+ >>> assert st == 0
+ >>> assert new_notice.z_version.startswith("ZEPH")
+
+Should we check for ZEPH0.2 now, or leave that open?
+
+ >>> notice = zephyr_tests.ZNotice_t()
+ >>> notice.z_kind = zephyr_tests.ZNotice_Kind_t.UNSAFE
+ >>> notice.z_class = c_char_p("testclass")
+ >>> notice.z_class_inst = c_char_p("testinstance")
+ >>> notice.z_opcode = c_char_p("TESTOPCODE")
+ >>> notice.z_sender = c_char_p("someone")
+ >>> notice.z_recipient = c_char_p("someone_else")
+ >>> notice.z_message = c_char_p("short message body")
+ >>> notice.z_message_len = c_int(len("short message body"))
+ >>> zbuf = c_char_p(0)
+ >>> zbuflen = c_int(0)
+ >>> st = _z.ZFormatNotice(notice, zbuf, zbuflen, zephyr_tests.ZNOAUTH)
+ >>> assert st == 0
+ >>> assert zbuf.value.startswith("ZEPH")
+ >>> new_notice = zephyr_tests.ZNotice_t()
+ >>> st = _z.ZParseNotice(zbuf, zbuflen, new_notice)
+ >>> assert st == 0
+ >>> assert new_notice.z_version.startswith("ZEPH")
+ >>> new_notice.z_class
+ 'testclass'
+ >>> new_notice.z_class_inst
+ 'testinstance'
+ >>> new_notice.z_opcode
+ 'TESTOPCODE'
+ >>> new_notice.z_message[:new_notice.z_message_len]
+ 'short message body'
+
+Simple test of ZCompareUID:
+
+ >>> uid1 = zephyr_tests.ZUnique_Id_t()
+ >>> uid2 = zephyr_tests.ZUnique_Id_t()
+ >>> assert _z.ZCompareUID(uid1, uid2), "null uids don't match"
+
+There's no ZUnique_Id_t constructor - Z_FormatHeader and
+Z_NewFormatHeader initialize notice->z_uid directly, so cheat and use
+ZNotice_t as the constructor...
+
+ >>> notice1 = zephyr_tests.ZNotice_t()
+ >>> zbuf = c_char_p(0)
+ >>> zbuflen = c_int(0)
+ >>> st = _z.ZFormatNotice(notice1, zbuf, zbuflen, zephyr_tests.ZNOAUTH)
+ >>> assert st == 0, "ZFormatNotice notice1 failed"
+
+ >>> notice2 = zephyr_tests.ZNotice_t()
+ >>> zbuf = c_char_p(0)
+ >>> zbuflen = c_int(0)
+ >>> st = _z.ZFormatNotice(notice2, zbuf, zbuflen, zephyr_tests.ZNOAUTH)
+ >>> assert st == 0, "ZFormatNotice notice1 failed"
+
+ >>> assert not _z.ZCompareUID(notice1.z_uid, notice2.z_uid), "distinct notices don't compare as distinct"
+
+Trivial test of ZExpandRealm, using terribly well known hostnames:
+
+ >>> assert _z.ZExpandRealm("") == ""
+ >>> if Zauthtype: assert _z.ZExpandRealm("localhost") == ""
+ >>> if Zauthtype: assert _z.ZExpandRealm("bitsy.mit.edu") == "ATHENA.MIT.EDU"
+ >>> if not Zauthtype: assert _z.ZExpandRealm("localhost") == "LOCALHOST"
+ >>> if not Zauthtype: assert _z.ZExpandRealm("bitsy.mit.edu") == "BITSY.MIT.EDU"
+
+ZGetCharsetString is a utility function for clients that need to know the
+full name of the output character set, e.g. zwgc. Calling it
+with NULL will get it from $ZEPHYR_CHARSET or the locale.
+Trivial testing of ZGetCharsetString:
+
+ >>> os.environ['LANG'] = 'C'
+ >>> assert _z.ZGetCharsetString(None) == 'ANSI_X3.4-1968'
+ >>> os.environ['ZEPHYR_CHARSET'] = 'ISO-8859-1'
+ >>> assert _z.ZGetCharsetString(None) == 'ISO-8859-1'
+ >>> assert _z.ZGetCharsetString('UTF-8') == 'UTF-8'
+
+ZGetCharset is a utility function for clients that need to know the
+registry number of a character set, e.g. zwrite. It gets its defaults from
+alal the places that ZGetCharsetString does, because it calls it.
+Trivial testing of ZGetCharset:
+
+ >>> assert _z.ZGetCharset(None) == 4
+ >>> assert _z.ZGetCharset('NONE') == 0
+ >>> assert _z.ZGetCharset('UNKNOWN') == 0
+ >>> assert _z.ZGetCharset('ANSI_X3.4-1968') == 4
+ >>> assert _z.ZGetCharset('ISO-8859-1') == 4
+ >>> assert _z.ZGetCharset('UTF-8') == 106
+ >>> assert _z.ZGetCharset('GIANT RUBBER PANTS') == 0
+
+ZCharsetToString converts the registry numbers of the "allowed" character
+sets into strings.
+Trivial testing of ZCharsetToString:
+
+ >>> assert _z.ZCharsetToString(0) == 'UNKNOWN'
+ >>> assert _z.ZCharsetToString(4) == 'ISO-8859-1'
+ >>> assert _z.ZCharsetToString(106) == 'UTF-8'
+ >>> assert _z.ZCharsetToString(1701) == 'UNKNOWN'
+
+ZTransliterate does character set conversion for display purposes, and when
+it works, it sticks a malloc'd buffer in to **bufp.
+"Trivial" testing of ZTransliterate:
+
+ >>> from ctypes import c_char_p, c_int, byref, string_at
+ >>> from errno import EINVAL, EILSEQ
+ >>> bufp = c_char_p(None)
+ >>> length = c_int(0)
+ >>> assert _z.ZTransliterate('test', 4, 'ANSI_X3.4-1968', 'ANSI_X3.4-1968', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 'test'
+ >>> assert _z.ZTransliterate('test', 4, 'ANSI_X3.4-1968', 'UTF-8', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 'test'
+ >>> assert _z.ZTransliterate('test', 4, 'ISO-8859-1', 'ANSI_X3.4-1968', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 'test'
+ >>> assert _z.ZTransliterate('test', 4, 'ISO-8859-1', 'ANSI_X3.4-1968', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 'test'
+ >>> assert _z.ZTransliterate('t\xebst', 4, 'ISO-8859-1', 'ANSI_X3.4-1968', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 't?st'
+ >>> assert _z.ZTransliterate('t\xebst', 4, 'ISO-8859-1', 'UTF-8', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 't\xc3\xabst'
+ >>> assert _z.ZTransliterate('t\xc3\xabst', 5, 'UTF-8', 'ISO-8859-1', byref(bufp), byref(length)) == 0
+ >>> assert string_at(bufp, length) == 't\xebst'
+ >>> assert _z.ZTransliterate('t\xc3\xabst', 5, 'UTF-8', 'Oh, my bees', byref(bufp), byref(length)) == EINVAL
+ >>> assert _z.ZTransliterate('t\xc3x\xabst', 5, 'UTF-8', 'ISO-8859-1', byref(bufp), byref(length)) == EILSEQ
+
+Trivial test of ZOpenPort and ZClosePort:
+
+ >>> from ctypes import c_ushort
+ >>> port = c_ushort(0)
+ >>> st = _z.ZOpenPort(port)
+ >>> assert st == 0
+ >>> assert _z.ZGetFD() != -1
+ >>> zsock = zephyr_tests.getsockname(_z.ZGetFD())
+ >>> assert zsock
+ >>> from socket import AF_INET
+ >>> assert zsock.sa_family.value == AF_INET, zsock.sa_family
+
+(Here we're actually using getsockname as an "is that file descriptor
+ a socket" test; the wrapper is weak in that it can't check for
+ ENOTSOCK without requiring Python 2.6, so it just throws an exception
+ on any return of -1. If ctypes.cast worked on sockaddr, we could
+ also cast it to sockaddr_in and look at the address and port...)
+
+ >>> assert port != 0
+ >>> zephyr_tests.ctypes_pprint(_z.ZGetDestAddr())
+ ... # doctest: +ELLIPSIS
+ sin_family AF_INET(2)
+ sin_port ...
+ sin_addr 127.0.0.1
+ sin_zero [ignored]
+
+ >>> assert _z.ZClosePort() == 0
+ >>> assert _z.ZGetFD() == -1
+
+ZMakeAscii takes a target buffer and length and an input buffer and
+length, and generates the "special" Zephyr encoding.
+
+TODO: use the "reference" implementation to run a bunch of
+random-value comparison tests.
+
+ >>> sample = "test\0message"
+ >>> ref = zephyr_tests.py_make_ascii(sample)
+ >>> from ctypes import create_string_buffer
+ >>> outlen = len(sample) * 6
+ >>> outbuf = create_string_buffer(outlen)
+ >>> st = _z.ZMakeAscii(outbuf, outlen, sample, len(sample))
+ >>> assert st == 0
+ >>> assert outbuf.value == ref, "%r != %r" % (outbuf.value, ref)
+
+A few simple string tests:
+ >>> def zma(sample):
+ ... outlen = len(sample) * 6
+ ... outbuf = create_string_buffer(outlen)
+ ... st = _z.ZMakeAscii(outbuf, outlen, sample, len(sample))
+ ... assert st == 0
+ ... return outbuf.value
+ >>> zma("")
+ ''
+ >>> zma("j")
+ '0x6A'
+ >>> zma("jK")
+ '0x6A4B'
+ >>> zma("jK__\0")
+ '0x6A4B5F5F 0x00'
+
+Same thing with ZMakeZcode, a compact binary format that is still NUL-terminated...
+
+ >>> sample = "test\0message"
+ >>> ref = zephyr_tests.py_make_zcode(sample)
+ >>> from ctypes import create_string_buffer
+ >>> outlen = len(sample) * 2
+ >>> outbuf = create_string_buffer(outlen)
+ >>> st = _z.ZMakeZcode(outbuf, outlen, sample, len(sample))
+ >>> assert st == 0
+ >>> assert outbuf.value == ref, "%r != %r" % (outbuf.value, ref)
+
+
+Queued Packet Tests
+===================
+
+Eventually we'll want tests that install a realm (or several) and
+actually send and receive packets against them, so-called "system
+tests". In the meantime, a faster and more local test that
+synthesizes packets and feeds them through the queuing mechanism will
+get us some more coverage.
+
+ >>> from socket import SOCK_DGRAM, socket, ntohs
+ >>> port = c_ushort(0)
+ >>> st = _z.ZOpenPort(port)
+ >>> port = ntohs(port.value)
+ >>> assert port
+ >>> sock = socket(AF_INET, SOCK_DGRAM)
+ >>> assert sock
+ >>> assert _z.ZPending() == 0
+
+TODO: cook up test-specific notices, but for now we've got some lying
+around from above...
+
+ >>> zwhole = string_at(zbuf, size=zbuflen)
+ >>> wrote = sock.sendto(zwhole, ('127.0.0.1', port))
+ >>> assert wrote == zbuflen.value, "%s != %s" % (wrote, zbuflen.value)
+ >>> zcount = _z.ZPending()
+ >>> assert zcount == 1
+
+Coverage:
+
+Files complete:
+ ZOpenPort.c
+ ZClosePort.c
+ ZExpnRlm.c
+ ZCmpUID.c
+ charset.c
+ ZGetSender.c (needs richer test)
+
+Pending:
+
+ZRequestLocations (ZAsyncLocate.c)
+ZParseLocations (ZAsyncLocate.c)
+ZCompareALDPred (ZAsyncLocate.c)
+ZFreeALD (ZAsyncLocate.c)
+ZCheckAuthentication (ZCkAuth.c)
+ZCheckIfNotice (ZCkIfNot.c)
+ZCheckZcodeAuthentication (ZCkZAut.c)
+ZCompareUIDPred (ZCmpUIDP.c)
+ZCompareMultiUIDPred (ZCmpUIDP.c)
+ZFlushLocations (ZFlsLocs.c)
+ZFlushSubscriptions (ZFlsSubs.c)
+ZFormatAuthenticNotice (ZFmtAuth.c)
+ZFormatAuthenticNoticeV5 (ZFmtAuth.c)
+ZFormatNoticeList (ZFmtList.c)
+ZFormatNotice (ZFmtNotice.c)
+ZNewFormatNotice (ZFmtNotice.c)
+ZFormatRawNotice (ZFmtRaw.c)
+ZFormatRawNoticeList (ZFmtRawLst.c)
+ZFormatSmallRawNoticeList (ZFmtSmRLst.c)
+ZFormatSmallRawNotice (ZFmtSmRaw.c)
+ZNewFormatSmallRawNotice (ZFmtSmRaw.c)
+ZFreeNotice (ZFreeNot.c)
+ZGetLocations (ZGetLocs.c)
+ZGetSubscriptions (ZGetSubs.c)
+ZGetWGPort (ZGetWGPort.c)
+ZIfNotice (ZIfNotice.c)
+ZGetRealm (ZInit.c)
+ZQLength (ZInit.c)
+# not compiled anymore: ZLocateUser (ZLocateU.c)
+ZInitLocationInfo (ZLocations.c)
+ZSetLocation (ZLocations.c)
+ZUnsetLocation (ZLocations.c)
+ZFlushMyLocations (ZLocations.c)
+ZParseExposureLevel (ZLocations.c)
+Z_SendLocation (ZLocations.c)
+ZMakeAscii32 (ZMakeAscii.c)
+ZMakeAscii16 (ZMakeAscii.c)
+ZMakeZcode32 (ZMakeZcode.c)
+ZMakeZcode (ZMakeZcode.c)
+ZResetAuthentication (ZMkAuth.c)
+ZMakeAuthentication (ZMkAuth.c)
+ZMakeZcodeAuthentication (ZMkAuth.c)
+ZMakeZcodeRealmAuthentication (ZMkAuth.c)
+ZGetCreds (ZMkAuth.c)
+ZGetCredsRealm (ZMkAuth.c)
+ZLocateUser (ZNewLocU.c)
+ZParseNotice (ZParseNot.c)
+ZPeekIfNotice (ZPeekIfNot.c)
+ZPeekNotice (ZPeekNot.c)
+ZPeekPacket (ZPeekPkt.c)
+ZPending (ZPending.c)
+ZReadAscii (ZReadAscii.c)
+ZReadAscii32 (ZReadAscii.c)
+ZReadAscii16 (ZReadAscii.c)
+ZReadZcode (ZReadZcode.c)
+ZReceiveNotice (ZRecvNot.c)
+ZReceivePacket (ZRecvPkt.c)
+ZRetrieveSubscriptions (ZRetSubs.c)
+ZRetrieveDefaultSubscriptions (ZRetSubs.c)
+ZSendList (ZSendList.c)
+ZSrvSendList (ZSendList.c)
+ZSendNotice (ZSendNot.c)
+ZSrvSendNotice (ZSendNot.c)
+ZSendPacket (ZSendPkt.c)
+ZSendRawList (ZSendRLst.c)
+ZSrvSendRawList (ZSendRLst.c)
+ZSendRawNotice (ZSendRaw.c)
+ZSetDestAddr (ZSetDest.c)
+ZSetFD (ZSetFD.c)
+ZSetServerState (ZSetSrv.c)
+ZPunt (ZSubs.c)
+ZSubscribeTo (ZSubs.c)
+ZSubscribeToSansDefaults (ZSubs.c)
+ZUnsubscribeTo (ZSubs.c)
+ZCancelSubscriptions (ZSubs.c)
+ZGetVariable (ZVariables.c)
+ZSetVariable (ZVariables.c)
+ZUnsetVariable (ZVariables.c)
+Z_WaitForNotice (ZWait4Not.c)
+ZhmStat (ZhmStat.c)
+
+(...continue with Zinternal.c...)
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
-I${BUILDTOP}/h -I. ${CPPFLAGS}
LDFLAGS=@LDFLAGS@
LIBS=${LIBZEPHYR} @LIBS@ -lcom_err
+HESIOD_LIBS=@HESIOD_LIBS@
OBJS= zsrv_err.o access.o acl_files.o bdump.o class.o client.o common.o \
dispatch.o kstuff.o main.o server.o subscr.o timer.o uloc.o \
all: zephyrd
zephyrd: ${OBJS} ${LIBZEPHYR}
- ${LIBTOOL} --mode=link ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
+ ${LIBTOOL} --mode=link ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} ${HESIOD_LIBS}
zsrv_err.c zsrv_err.h: zsrv_err.et
compile_et ${srcdir}/zsrv_err.et
* Created by: John T. Kohl
*
* $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/bdump.c,v $
- * $Id: bdump.c 2346 2009-03-24 18:39:31Z kcr $
- * $Author: kcr $
+ * $Id: bdump.c 2449 2009-04-30 17:08:38Z kcr@ATHENA.MIT.EDU $
+ * $Author: kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <com_err.h>
#ifndef lint
-static const char rcsid_bdump_c[] = "$Id: bdump.c 2346 2009-03-24 18:39:31Z kcr $";
+static const char rcsid_bdump_c[] = "$Id: bdump.c 2449 2009-04-30 17:08:38Z kcr@ATHENA.MIT.EDU $";
#endif /* lint */
/*
strlen(ZGetRealm()),
ZGetRealm(),
SERVER_KRB5_SERVICE, SERVER_INSTANCE,
- 0);
+ NULL);
if (retval) {
- syslog(LOG_ERR, "bdump_send: krb5_build_principal: %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_send: krb5_build_principal: %s",
+ error_message(retval));
cleanup(server);
return;
}
retval = krb5_auth_con_init(Z_krb5_ctx, &bdump_ac);
if (retval) {
- syslog(LOG_ERR, "bdump_send: krb5_auth_con_init: %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_send: krb5_auth_con_init: %s",
+ error_message(retval));
cleanup(server);
return;
}
- retval = krb5_auth_con_setflags(Z_krb5_ctx, bdump_ac, KRB5_AUTH_CONTEXT_DO_SEQUENCE);
+ retval = krb5_auth_con_setflags(Z_krb5_ctx, bdump_ac,
+ KRB5_AUTH_CONTEXT_DO_SEQUENCE);
if (retval) {
- syslog(LOG_ERR, "bdump_send: krb5_auth_con_setflags: %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_send: krb5_auth_con_setflags: %s",
+ error_message(retval));
cleanup(server);
return;
}
strlen(ZGetRealm()),
ZGetRealm(),
SERVER_KRB5_SERVICE, SERVER_INSTANCE,
- 0);
+ NULL);
if (retval) {
- syslog(LOG_ERR, "bdump_get: krb5_build_principal: %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_get: krb5_build_principal: %s",
+ error_message(retval));
cleanup(server);
return;
}
retval = krb5_copy_principal(Z_krb5_ctx, principal, &creds.server);
if (retval) {
- syslog(LOG_ERR, "bdump_get: krb5_copy_principal (server): %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_get: krb5_copy_principal (server): %s",
+ error_message(retval));
krb5_free_principal(Z_krb5_ctx, principal);
cleanup(server);
return;
retval = krb5_copy_principal(Z_krb5_ctx, principal, &creds.client);
krb5_free_principal(Z_krb5_ctx, principal);
if (retval) {
- syslog(LOG_ERR, "bdump_get: krb5_copy_principal (client): %s", error_message(retval));
+ syslog(LOG_ERR, "bdump_get: krb5_copy_principal (client): %s",
+ error_message(retval));
krb5_free_cred_contents(Z_krb5_ctx, &creds);
cleanup(server);
return;
int num)
{
ZNotice_t notice;
- char *pack, addrbuf[100];
+ char *pack;
int packlen, count;
Code_t retval;
u_short length;
strlen(ZGetRealm()),
ZGetRealm(),
SERVER_KRB5_SERVICE, SERVER_INSTANCE,
- 0);
+ NULL);
if (retval) {
krb5_free_principal(Z_krb5_ctx, principal);
return(1);
} else {
retval = Z_krb5_init_keyblock(Z_krb5_ctx,
ntohl(*(krb5_enctype *)&buf[0]),
- ntohl(*(u_int32_t *)&buf[4]),
+ ntohl(*(uint32_t *)&buf[4]),
&client->session_keyblock);
if (retval) {
syslog(LOG_ERR, "brl failed to allocate keyblock: %s",
char *pack;
int packlen, count;
Code_t retval;
- u_short length;
+ unsigned short length;
memset (¬ice, 0, sizeof(notice));
}
#endif
- length = htons((u_short) packlen);
+ length = htons((unsigned short) packlen);
count = net_write(output, (char *) &length, sizeof(length));
if (count != sizeof(length)) {
static Code_t
get_packet(void *packet, int len, int *retlen)
{
- u_short length;
+ unsigned short length;
int result;
- result = net_read(input, (char *) &length, sizeof(u_short));
+ result = net_read(input, (char *) &length, sizeof(unsigned short));
if (result < sizeof(short)) {
if (result < 0) {
return errno;
if ((cp >= notice->z_message + notice->z_message_len) || (*cp == '\0')) {
return(ZSRV_PKSHORT);
}
- target->sin_port = htons((u_short) atoi(cp));
+ target->sin_port = htons((unsigned short)atoi(cp));
target->sin_family = AF_INET;
return ZERR_NONE;
}
krb5_data dout;
krb5_enc_data din;
-#ifdef HAS_KRB5_C_DECRYPT
+#ifdef HAVE_KRB5_C_DECRYPT
dout.length = 8;
- dout.data = out;
+ dout.data = (char *)out; /*What*/
din.ciphertext.length = 8;
- din.ciphertext.data = in;
+ din.ciphertext.data = (char *)in;
din.enctype = Z_enctype(server_key);
#ifdef HAVE_KRB5_CRYPTO_INIT
#endif
#else
des_ecb_encrypt((C_Block *)in, (C_Block *)out, serv_ksched.s, DES_DECRYPT);
-#endif
return 0; /* sigh */
+#endif
}
#endif
* Created by: John T. Kohl
*
* $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/dispatch.c,v $
- * $Author: kcr $
+ * $Author: kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
#ifndef SABER
static const char rcsid_dispatch_c[] =
-"$Id: dispatch.c 2334 2009-03-22 18:39:18Z kcr $";
+"$Id: dispatch.c 2433 2009-04-19 04:55:11Z kcr@ATHENA.MIT.EDU $";
#endif
#endif
-#define NACKTAB_HASHSIZE 1023
-#define NACKTAB_HASHVAL(sockaddr, uid) (((sockaddr).sin_addr.s_addr ^ \
- (sockaddr).sin_port ^ \
- (uid).zuid_addr.s_addr ^ \
- (uid).tv.tv_sec ^ \
- (uid).tv.tv_usec) % NACKTAB_HASHSIZE)
+enum {
+ NACKTAB_HASHSIZE = 1023
+};
+inline unsigned int
+nacktab_hashval(struct sockaddr_in sa, ZUnique_Id_t uid) {
+ return (sa.sin_addr.s_addr ^
+ sa.sin_port ^
+ uid.zuid_addr.s_addr ^
+ uid.tv.tv_sec ^
+ uid.tv.tv_usec) % NACKTAB_HASHSIZE;
+}
+
#define HOSTS_SIZE_INIT 256
#ifdef DEBUG
nacked->packsz = len;
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
- Unacked_insert(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked);
+ Unacked_insert(&nacktab[nacktab_hashval(sin, nacked->uid)], nacked);
return(ZERR_NONE);
}
nacked->packsz = packlen;
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
- Unacked_insert(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked);
+ Unacked_insert(&nacktab[nacktab_hashval(*dest, nacked->uid)], nacked);
}
/*
int hashval;
/* search the not-yet-acked table for this packet, and flush it. */
- hashval = NACKTAB_HASHVAL(*who, notice->z_uid);
+ hashval = nacktab_hashval(*who, notice->z_uid);
for (nacked = nacktab[hashval]; nacked; nacked = nacked->next) {
if (nacked->dest.addr.sin_addr.s_addr == who->sin_addr.s_addr
&& nacked->dest.addr.sin_port == who->sin_port
break;
}
newserver = (i < nservers);
+ sin.sin_family = AF_INET;
for (i = 0; i < num_hosts; i++) {
sin.sin_addr = hosts[i];
sin.sin_port = hm_port;
strcat (recipient, realm);
return recipient;
}
-
#ifndef lint
#ifndef SABER
-static const char rcsid_kstuff_c[] = "$Id: kstuff.c 2344 2009-03-24 03:40:55Z kcr $";
+static const char rcsid_kstuff_c[] = "$Id: kstuff.c 2405 2009-04-10 00:15:29Z kcr@ATHENA.MIT.EDU $";
#endif
#endif
krb5_cksumtype cksumtype;
krb5_data cksumbuf;
int valid;
- char *cksum0_base, *cksum1_base, *cksum2_base;
+ char *cksum0_base, *cksum1_base = NULL, *cksum2_base;
char *x;
unsigned char *asn1_data;
unsigned char *key_data;
- int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len;
+ int asn1_len, key_len, cksum0_len = 0, cksum1_len = 0, cksum2_len = 0;
+ krb5_flags acflags;
#ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
krb5_authenticator *authenticator;
#define KRB5AUTHENT authenticator
return (result);
}
+ result = krb5_auth_con_getflags(Z_krb5_ctx, authctx, &acflags);
+ if (result) {
+ krb5_kt_close(Z_krb5_ctx, keytabid);
+ free(authbuf);
+ return (result);
+ }
+
+ acflags &= ~KRB5_AUTH_CONTEXT_DO_TIME;
+
+ result = krb5_auth_con_setflags(Z_krb5_ctx, authctx, acflags);
+ if (result) {
+ krb5_kt_close(Z_krb5_ctx, keytabid);
+ free(authbuf);
+ return (result);
+ }
+
/* HOLDING: authbuf, authctx */
result = krb5_build_principal(Z_krb5_ctx, &server, strlen(__Zephyr_realm),
__Zephyr_realm, SERVER_SERVICE,
SERVER_INSTANCE, NULL);
if (!result) {
result = krb5_rd_req(Z_krb5_ctx, &authctx, &packet, server,
- keytabid, 0, &tkt);
+ keytabid, NULL, &tkt);
krb5_free_principal(Z_krb5_ctx, server);
}
krb5_kt_close(Z_krb5_ctx, keytabid);
if (result) {
- if (result == KRB5KRB_AP_ERR_REPEAT)
- syslog(LOG_DEBUG, "ZCheckRealmAuthentication: k5 auth failed: %s", error_message(result));
- else
- syslog(LOG_WARNING,"ZCheckRealmAuthentication: k5 auth failed: %s", error_message(result));
+ if (result == KRB5KRB_AP_ERR_REPEAT) {
+ syslog(LOG_DEBUG, "ZCheckRealmAuthentication: k5 auth failed: %s",
+ error_message(result));
+ } else {
+ syslog(LOG_WARNING,"ZCheckRealmAuthentication: k5 auth failed: %s",
+ error_message(result));
+ }
free(authbuf);
krb5_auth_con_free(Z_krb5_ctx, authctx);
return ZAUTH_FAILED;
* - z_sender_(sock)addr
* - z_charset
* - z_other_fields[]
- */
- cksum1_base = notice->z_multinotice;
- if (notice->z_num_other_fields)
- x = notice->z_other_fields[notice->z_num_other_fields - 1];
- else {
- /* see also lib/ZCkZaut.c:ZCheckZcodeAuthentication */
- /* XXXXXXXXXXXXXXXXXXXXXXX */
- x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
- if (notice->z_num_hdr_fields > 17)
- x = x + strlen(x) + 1; /* multiuid */
- if (notice->z_num_hdr_fields > 18)
- x = x + strlen(x) + 1; /* sender */
- }
- cksum1_len = x + strlen(x) + 1 - cksum1_base; /* charset / extra field */
-
+ */
+ if (notice->z_num_hdr_fields > 15 ) {
+ cksum1_base = notice->z_multinotice;
+ if (notice->z_num_other_fields)
+ x = notice->z_other_fields[notice->z_num_other_fields - 1];
+ else {
+ /* see also ZCheckAuthentication and
+ lib/ZCkZaut.c:ZCheckZcodeAuthentication */
+ /* XXXXXXXXXXXXXXXXXXXXXXX */
+ if (notice->z_num_hdr_fields > 16)
+ x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
+ if (notice->z_num_hdr_fields > 17)
+ x = x + strlen(x) + 1; /* multiuid */
+ if (notice->z_num_hdr_fields > 18)
+ x = x + strlen(x) + 1; /* sender */
+ }
+ cksum1_len = x + strlen(x) + 1 - cksum1_base; /* charset / extra field */
+ }
+
/* last part is the message body */
cksum2_base = notice->z_message;
cksum2_len = notice->z_message_len;
}
/* HOLDING: authctx, authenticator, cksumbuf.data */
- memcpy(cksumbuf.data, cksum0_base, cksum0_len);
- memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
+ memcpy(cksumbuf.data, cksum0_base, cksum0_len);
+ if (cksum1_len)
+ memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
memcpy(cksumbuf.data + cksum0_len + cksum1_len,
cksum2_base, cksum2_len);
krb5_cksumtype cksumtype;
krb5_data cksumbuf;
int valid;
- char *cksum0_base, *cksum1_base, *cksum2_base;
+ char *cksum0_base, *cksum1_base = NULL, *cksum2_base;
char *x;
unsigned char *asn1_data, *key_data;
- int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len;
+ int asn1_len, key_len, cksum0_len = 0, cksum1_len = 0, cksum2_len = 0;
+ krb5_flags acflags;
#ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
krb5_authenticator *authenticator;
#define KRB5AUTHENT authenticator
return (result);
}
+ result = krb5_auth_con_getflags(Z_krb5_ctx, authctx, &acflags);
+ if (result) {
+ krb5_kt_close(Z_krb5_ctx, keytabid);
+ free(authbuf);
+ return (result);
+ }
+
+ acflags &= ~KRB5_AUTH_CONTEXT_DO_TIME;
+
+ result = krb5_auth_con_setflags(Z_krb5_ctx, authctx, acflags);
+ if (result) {
+ krb5_kt_close(Z_krb5_ctx, keytabid);
+ free(authbuf);
+ return (result);
+ }
+
/* HOLDING: authbuf, authctx */
result = krb5_build_principal(Z_krb5_ctx, &server, strlen(__Zephyr_realm),
__Zephyr_realm, SERVER_SERVICE,
SERVER_INSTANCE, NULL);
if (!result) {
result = krb5_rd_req(Z_krb5_ctx, &authctx, &packet, server,
- keytabid, 0, &tkt);
+ keytabid, NULL, &tkt);
krb5_free_principal(Z_krb5_ctx, server);
}
krb5_kt_close(Z_krb5_ctx, keytabid);
if (result) {
if (result == KRB5KRB_AP_ERR_REPEAT)
- syslog(LOG_DEBUG, "ZCheckAuthentication: k5 auth failed: %s", error_message(result));
+ syslog(LOG_DEBUG, "ZCheckAuthentication: k5 auth failed: %s",
+ error_message(result));
else
- syslog(LOG_WARNING,"ZCheckAuthentication: k5 auth failed: %s", error_message(result));
+ syslog(LOG_WARNING,"ZCheckAuthentication: k5 auth failed: %s",
+ error_message(result));
free(authbuf);
krb5_auth_con_free(Z_krb5_ctx, authctx);
return ZAUTH_FAILED;
* - z_multiuid
* - z_other_fields[]
*/
- cksum1_base = notice->z_multinotice;
- if (notice->z_num_other_fields)
- x = notice->z_other_fields[notice->z_num_other_fields - 1];
- else
- x = cksum1_base + strlen(cksum1_base) + 1; /* multiuid */
- cksum1_len = x + strlen(x) + 1 - cksum1_base;
+ if (notice->z_num_hdr_fields > 15 ) {
+ cksum1_base = notice->z_multinotice;
+ if (notice->z_num_other_fields)
+ x = notice->z_other_fields[notice->z_num_other_fields - 1];
+ else {
+ /* see also ZCheckRealmAuthentication
+ and lib/ZCkZaut.c:ZCheckZcodeAuthentication */
+ /* XXXXXXXXXXXXXXXXXXXXXXX */
+ if (notice->z_num_hdr_fields > 16)
+ x = cksum1_base + strlen(cksum1_base) + 1; /* multinotice */
+ if (notice->z_num_hdr_fields > 17)
+ x = x + strlen(x) + 1; /* multiuid */
+ if (notice->z_num_hdr_fields > 18)
+ x = x + strlen(x) + 1; /* sender */
+ }
+ cksum1_len = x + strlen(x) + 1 - cksum1_base; /* charset / extra field */
+ }
/* last part is the message body */
cksum2_base = notice->z_message;
}
/* HOLDING: authctx, authenticator, cksumbuf.data */
- memcpy(cksumbuf.data, cksum0_base, cksum0_len);
- memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
+ memcpy(cksumbuf.data, cksum0_base, cksum0_len);
+ if (cksum1_len)
+ memcpy(cksumbuf.data + cksum0_len, cksum1_base, cksum1_len);
memcpy(cksumbuf.data + cksum0_len + cksum1_len,
cksum2_base, cksum2_len);
* Created by: John T. Kohl
*
* $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/main.c,v $
- * $Author: kcr $
+ * $Author: kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
#ifndef SABER
static const char rcsid_main_c[] =
- "$Id: main.c 2345 2009-03-24 03:59:25Z kcr $";
+ "$Id: main.c 2377 2009-04-02 23:58:21Z kcr@ATHENA.MIT.EDU $";
#endif
#endif
sprintf(list_file, "%s/zephyr/%s", SYSCONFDIR, SERVER_LIST_FILE);
#ifdef HAVE_KRB4
sprintf(srvtab_file, "%s/zephyr/%s", SYSCONFDIR, ZEPHYR_SRVTAB);
- sprintf(tkt_file, "%s/zephyr/%s", SYSCONFDIR, ZEPHYR_TKFILE);
+ strcpy(tkt_file, ZEPHYR_TKFILE);
#endif
#ifdef HAVE_KRB5
sprintf(keytab_file, "%s/zephyr/%s", SYSCONFDIR, ZEPHYR_KEYTAB);
- sprintf(tkt5_file, "FILE:%s/zephyr/%s", SYSCONFDIR, ZEPHYR_TK5FILE);
+ strcpy(tkt5_file, ZEPHYR_TK5FILE);
#endif
sprintf(acl_dir, "%s/zephyr/%s", SYSCONFDIR, ZEPHYR_ACL_DIR);
sprintf(subs_file, "%s/zephyr/%s", SYSCONFDIR, DEFAULT_SUBS_FILE);
if (*my_realm)
strcpy(__Zephyr_realm, my_realm);
#endif
- init_zsrv_err_tbl(); /* set up err table */
+
+ /* set up err table */
+#if defined(__APPLE__) && defined(__MACH__)
+ add_error_table(&et_zsrv_error_table);
+#else
+ init_zsrv_err_tbl();
+#endif
ZSetFD(srv_socket); /* set up the socket as the input fildes */
result = krb5_build_principal(Z_krb5_ctx, &creds_in.server,
strlen(realm),
realm,
- SERVER_KRB5_SERVICE, SERVER_INSTANCE, 0);
+ SERVER_KRB5_SERVICE, SERVER_INSTANCE,
+ NULL);
if (result) {
krb5_cc_close(Z_krb5_ctx, ccache);
return 0;
result = krb5_build_principal(Z_krb5_ctx, &creds_in.server,
strlen(realm->name), realm->name,
SERVER_KRB5_SERVICE, SERVER_INSTANCE,
- 0);
+ NULL);
/* HOLDING: creds_in.server */
syslog(LOG_INFO, "tkt_rtrv running for %s", realm->name);
while (1) {
- /* Get a pointer to the default ccache. We don't need to free this. */
+ /* Get a pointer to the default ccache.
+ We don't need to free this. */
result = krb5_cc_default(Z_krb5_ctx, &ccache);
/* GRRR. There's no allocator or constructor for krb5_creds */
memset(&creds_in, 0, sizeof(creds_in));
if (!result)
- result = krb5_cc_get_principal(Z_krb5_ctx, ccache, &creds_in.client);
+ result = krb5_cc_get_principal(Z_krb5_ctx, ccache,
+ &creds_in.client);
/* construct the service principal */
if (!result)
result = krb5_build_principal(Z_krb5_ctx, &creds_in.server,
strlen(realm->name), realm->name,
- SERVER_KRB5_SERVICE, SERVER_INSTANCE,
- 0);
+ SERVER_KRB5_SERVICE,
+ SERVER_INSTANCE,
+ NULL);
/* HOLDING: creds_in.server */
* Created by: John T. Kohl
*
* $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/server.c,v $
- * $Author: kcr $
+ * $Author: kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
#ifndef SABER
-static const char rcsid_server_c[] = "$Id: server.c 2157 2008-01-21 20:06:42Z kcr $";
+static const char rcsid_server_c[] = "$Id: server.c 2407 2009-04-10 01:17:18Z kcr@ATHENA.MIT.EDU $";
#endif
#endif
-#define SRV_NACKTAB_HASHSIZE 1023
-#define SRV_NACKTAB_HASHVAL(which, uid) (((which) ^ (uid).zuid_addr.s_addr ^ \
- (uid).tv.tv_sec ^ (uid).tv.tv_usec) \
- % SRV_NACKTAB_HASHSIZE)
+enum {
+ SRV_NACKTAB_HASHSIZE = 1023
+};
+inline unsigned int
+srv_nacktab_hashval(int which, ZUnique_Id_t uid) {
+ return (which ^
+ uid.zuid_addr.s_addr ^ uid.tv.tv_sec ^ uid.tv.tv_usec)
+ % SRV_NACKTAB_HASHSIZE;
+}
+
/*
* Server manager. Deal with traffic to and from other servers.
*
nacked->packsz = packlen;
nacked->uid = notice->z_uid;
nacked->timer = timer_set_rel(rexmit_times[0], srv_rexmit, nacked);
- hashval = SRV_NACKTAB_HASHVAL(nacked->dest.srv_idx, nacked->uid);
+ hashval = srv_nacktab_hashval(nacked->dest.srv_idx, nacked->uid);
Unacked_insert(&srv_nacktab[hashval], nacked);
}
syslog(LOG_ERR, "non-server ack?");
return;
}
- hashval = SRV_NACKTAB_HASHVAL(server - otherservers, notice->z_uid);
+ hashval = srv_nacktab_hashval(server - otherservers, notice->z_uid);
for (nacked = srv_nacktab[hashval]; nacked; nacked = nacked->next) {
if (nacked->dest.srv_idx == server - otherservers
&& ZCompareUID(&nacked->uid, ¬ice->z_uid)) {
* Created by: John T. Kohl
*
* $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/subscr.c,v $
- * $Author: kcr $
+ * $Author: kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#ifndef lint
#ifndef SABER
-static const char rcsid_subscr_c[] = "$Id: subscr.c 2335 2009-03-22 18:39:39Z kcr $";
+static const char rcsid_subscr_c[] = "$Id: subscr.c 2440 2009-04-21 15:04:33Z kcr@ATHENA.MIT.EDU $";
#endif
#endif
return errno;
}
*(krb5_enctype *)&bufp[0] = htonl(Z_enctype(client->session_keyblock));
- *(u_int32_t *)&bufp[4] = htonl(Z_keylen(client->session_keyblock));
+ *(uint32_t *)&bufp[4] = htonl(Z_keylen(client->session_keyblock));
memcpy(&bufp[8], Z_keydata(client->session_keyblock), Z_keylen(client->session_keyblock));
retval = ZMakeZcode(buf, sizeof(buf), bufp, Z_keylen(client->session_keyblock) + 8);
/* convert the address to a string of the form x.x.x.x/port */
strcpy(addr, inet_ntoa(who->addr.sin_addr));
if ((retval = ZMakeAscii(port, sizeof(port), (unsigned char *)
- &who->addr.sin_port, sizeof(u_short))) != ZERR_NONE)
+ &who->addr.sin_port, sizeof(unsigned short))) != ZERR_NONE)
{
syslog(LOG_ERR, "subscr_rlm_sendit make ascii: %s",
error_message(retval));
num = 0;
if ((retval = ZMakeAscii(port, sizeof(port), (unsigned char *)
- &num, sizeof(u_short))) != ZERR_NONE)
+ &num, sizeof(unsigned short))) != ZERR_NONE)
{
syslog(LOG_ERR, "subscr_rlm_sendit make ascii: %s",
error_message(retval));
snotice = *notice;
- if ((status = ZReadAscii(cp, strlen(cp), (unsigned char *)&snotice.z_port, sizeof(u_short)))
+ if ((status = ZReadAscii(cp, strlen(cp), (unsigned char *)&snotice.z_port,
+ sizeof(unsigned short)))
!= ZERR_NONE)
{
syslog(LOG_ERR, "subscr_foreign_user read ascii: %s",
-.\" $Id: zephyrd.8 2091 2007-12-20 01:17:23Z kcr $
+.\" $Id: zephyrd.8 2367 2009-03-29 15:59:59Z kcr@ATHENA.MIT.EDU $
.\"
.\" Copyright 1987 by the Massachusetts Institute of Technology
.\" All rights reserved. The file /usr/include/zephyr/mit-copyright.h
The class registry lists all classes which are restricted.
.SH FILES
.TP 10
-.I /usr/athena/lib/zephyr/class-registry.acl:
+.I /etc/zephyr/acl/class-registry.acl:
List of classes which are restricted
.TP
-.I /usr/athena/lib/zephyr/iws-*.acl:
+.I /etc/zephyr/acl/iws-*.acl:
Access Control Lists for instance-wildcard restrictions
.TP
-.I /usr/athena/lib/zephyr/iui-*.acl:
+.I /etc/zephyr/acl/iui-*.acl:
Access Control Lists for instance-identity restrictions
.TP
-.I /usr/athena/lib/zephyr/sub-*.acl:
+.I /etc/zephyr/acl/sub-*.acl:
Access Control Lists for subscribing
.TP
-.I /usr/athena/lib/zephyr/xmt-*.acl:
+.I /etc/zephyr/acl/xmt-*.acl:
Access Control Lists for transmitting
.TP
-.I /usr/athena/lib/zephyr/srvtab:
-Kerberos Service keys
+.I /etc/zephyr/srvtab:
+Kerberos 4 Service keys
.TP
-.I /usr/athena/lib/zephyr/ztkts:
+.I /etc/zephyr/krb5.keytab:
+Kerberos V Service keys
+.TP
+.I /etc/zephyr/ztkts:
Current Kerberos tickets for exchange with other servers
.TP
-.I /usr/tmp/zephyr.db:
+.I /var/tmp/zephyr.db:
File containing an ASCII dump of the database.
.SH BUGS
The current implementation of the Zephyr server (\fIzephyrd(8)\fR) makes
*
* Created by: John T. Kohl
*
- * $Source: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/zserver.h,v $
- * $Author: kcr $
- * $Zephyr: /mit/zephyr/src/server/RCS/zserver.h,v 1.34 91/03/08 12:53:24 raeburn Exp $
+ * $Id: zserver.h 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
*
* Created by: John T. Kohl
*
- * $Id: zsrv_conf.h 2094 2007-12-25 00:56:08Z kcr $
+ * $Id: zsrv_conf.h 2371 2009-03-31 15:35:01Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#define __ZSRV_CONF_H__
#include <zephyr/mit-copyright.h>
-/* Path names are relative to CONFDIR, except for the class registry. */
+/* Path names are relative to CONFDIR, except for the class registry and
+ ticket files. */
#define SERVER_LIST_FILE "server.list"
#define REALM_LIST_FILE "realm.list"
#ifdef HAVE_KRB5
#define ZEPHYR_KEYTAB "krb5.keytab"
-#define ZEPHYR_TK5FILE "z5tkts"
+#define ZEPHYR_TK5FILE "/var/run/zephyrd.tkt"
#endif
#ifdef HAVE_KRB4
#define ZEPHYR_SRVTAB "srvtab"
-#define ZEPHYR_TKFILE "ztkts"
+#define ZEPHYR_TKFILE "/var/run/zephyrd.tkt4"
#endif
#define ZEPHYR_ACL_DIR "acl/"
#define ZEPHYR_CLASS_REGISTRY "class-registry.acl"
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
CFLAGS=@CFLAGS@
ALL_CFLAGS=${CFLAGS} -I${top_srcdir}/h -I${BUILDTOP}/h ${CPPFLAGS}
LDFLAGS=@LDFLAGS@
-LIBS=${LIBZEPHYR} @LIBS@ -lcom_err
+HESIOD_LIBS=@HESIOD_LIBS@
OBJS= timer.o queue.o zhm.o zhm_client.o zhm_server.o
all: zhm
zhm: ${OBJS} ${LIBZEPHYR}
- ${LIBTOOL} --mode=link ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
+ ${LIBTOOL} --mode=link ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBZEPHYR} ${HESIOD_LIBS}
.c.o:
${CC} -c ${ALL_CFLAGS} $<
*
* Created by: David C. Jedlinsky
*
- * $Id: zhm.h 2144 2008-01-21 07:57:32Z kcr $
- * $Zephyr: /mit/zephyr/src.rw/zhm/RCS/zhm.h,v 1.13 90/10/19 07:11:48 raeburn Exp $
+ * $Id: zhm.h 2422 2009-04-14 12:57:11Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
sysconfdir=@sysconfdir@
sbindir=@sbindir@
lsbindir=@lsbindir@
+datarootdir=@datarootdir@
includedir=${prefix}/include
mandir=@mandir@
-I${BUILDTOP}/h -I${srcdir} -I. @X_CFLAGS@ ${CPPFLAGS}
YFLAGS=-d
LDFLAGS=@X_LIBS@ @LDFLAGS@
-LIBS=${LIBZEPHYR} @LIBS@ -lcom_err @X_PRE_LIBS@ @ZWGC_LIBX11@ @X_EXTRA_LIBS@ \
+LIBS=${LIBZEPHYR} @LIBS@ -lcom_err @ZWGC_LIBX11@ @X_EXTRA_LIBS@ \
@TLIB@ @REGEX_LIBS@ @ARES_LIBS@
OBJS= port_dictionary.o pointer_dictionary.o unsigned_long_dictionary.o \
browser.o: zwgc.h
buffer.o: new_memory.h buffer.h
character_class.o: character_class.h
-display.o: new_memory.h new_string.h variables.h display.h
eval.o: new_memory.h node.h eval.h substitute.h port.h buffer.h regexp.h
eval.o: text_operations.h zwgc.h variables.h
exec.o: new_memory.h exec.h eval.h node.h buffer.h port.h variables.h notice.h
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: X_fonts.c 2144 2008-01-21 07:57:32Z kcr $
+ * $Id: X_fonts.c 2439 2009-04-21 06:21:12Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_X_fonts_c[] = "$Id: X_fonts.c 2144 2008-01-21 07:57:32Z kcr $";
+static const char rcsid_X_fonts_c[] = "$Id: X_fonts.c 2439 2009-04-21 06:21:12Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
#include "zwgc.h"
/*
- * font_dict - Lookup cache for fonts (the value pointers are XFontStruct *'s)
+ * font_dict - Lookup cache for fonts (the value pointers are XFontSet's)
*/
static pointer_dictionary family_dict = NULL;
static pointer_dictionary fontname_dict = NULL;
static pointer_dictionary fontst_dict = NULL;
-static pointer_dictionary fidst_dict = NULL;
/*
* {face,size}_to_string - lookup tables for converting {face,size} int
static string size_to_string[] = { "small", "medium", "large" };
static char *
-get_family(char *style,
- char *substyle)
+get_family(char *style, char *substyle)
{
- char *desc;
- pointer_dictionary_binding *binding;
- int exists;
- char *family;
-
- desc=string_Concat("style.",style);
- desc=string_Concat2(desc,".substyle.");
- desc=string_Concat2(desc,substyle);
- desc=string_Concat2(desc,".fontfamily");
-
- if (!family_dict)
- family_dict = pointer_dictionary_Create(37);
- binding = pointer_dictionary_Define(family_dict,desc,&exists);
-
- if (exists) {
- free(desc);
- return((string) binding->value);
- } else {
-#define STYLE_CLASS "StyleKey.Style1.Style2.Style3.SubstyleKey.Substyle.FontfamilyKey"
- family=get_string_resource(desc,STYLE_CLASS);
-#undef STYLE_CLASS
- free(desc);
- if (family==NULL)
- pointer_dictionary_Delete(family_dict,binding);
- else
- binding->value=(pointer) family;
- return(family); /* If resource returns NULL, return NULL also */
- }
+ char *desc;
+ pointer_dictionary_binding *binding;
+ int exists;
+ char *family;
+
+ desc=string_Concat("style.", style);
+ desc=string_Concat2(desc, ".substyle.");
+ desc=string_Concat2(desc, substyle);
+ desc=string_Concat2(desc, ".fontfamily");
+
+ if (!family_dict)
+ family_dict = pointer_dictionary_Create(37);
+ binding = pointer_dictionary_Define(family_dict, desc, &exists);
+
+ if (exists) {
+ free(desc);
+ return((string) binding->value);
+ } else {
+ family = get_string_resource(desc,
+ "StyleKey.Style1.Style2.Style3.SubstyleKey.Substyle.FontfamilyKey");
+ free(desc);
+ if (family == NULL)
+ pointer_dictionary_Delete(family_dict, binding);
+ else
+ binding->value = (pointer)family;
+ return(family); /* If resource returns NULL, return NULL also */
+ }
}
static char *
get_specific_fontname(char *family,
- int size,
- int face)
+ int size,
+ int face)
{
- char *desc;
- pointer_dictionary_binding *binding;
- int exists;
- char *fontname;
-
- desc = string_Concat("fontfamily.",family);
- desc = string_Concat2(desc, ".");
- desc = string_Concat2(desc, size_to_string[size]);
- desc = string_Concat2(desc, ".");
- desc = string_Concat2(desc, face_to_string[face]);
-
- if (!fontname_dict)
- fontname_dict = pointer_dictionary_Create(37);
- binding = pointer_dictionary_Define(fontname_dict,desc,&exists);
-
- if (exists) {
+ char *desc;
+ pointer_dictionary_binding *binding;
+ int exists;
+ char *fontname;
+
+ desc = string_Concat("fontfamily.", family);
+ desc = string_Concat2(desc, ".");
+ desc = string_Concat2(desc, size_to_string[size]);
+ desc = string_Concat2(desc, ".");
+ desc = string_Concat2(desc, face_to_string[face]);
+
+ if (!fontname_dict)
+ fontname_dict = pointer_dictionary_Create(37);
+ binding = pointer_dictionary_Define(fontname_dict, desc, &exists);
+
+ if (exists) {
+ free(desc);
+ return (string)binding->value;
+ } else {
+ fontname = get_string_resource(desc, "FontfamilyKey.Fontfamily.Size.Face");
free(desc);
- return((string) binding->value);
- } else {
-#define FAMILY_CLASS "FontfamilyKey.Fontfamily.Size.Face"
- fontname=get_string_resource(desc,FAMILY_CLASS);
- free(desc);
- if (fontname==NULL)
- pointer_dictionary_Delete(fontname_dict,binding);
+ if (fontname == NULL)
+ pointer_dictionary_Delete(fontname_dict, binding);
else
- binding->value=(pointer) fontname;
- return(fontname); /* If resource returns NULL, return NULL also */
+ binding->value = (pointer)fontname;
+ return fontname; /* If resource returns NULL, return NULL also */
}
}
-/* fast function to convert Font to hex. Return value
- * is on the heap and must be freed. I'm cheating in
- * that I know that Font us really an unsigned long. */
-
-static char hexdigits[] = {"0123456789ABCDEF"};
-static char *
-Font_to_hex(Font num)
+static XFontSet
+get_fontst(Display *dpy, char *fontname)
{
- char *temp;
- int i;
-
- temp=(char *) malloc((sizeof(Font)<<1)+2);
-
- for (i=0;i<((sizeof(Font)<<1)+1);i++)
- temp[i] = hexdigits[(num>>(i*4))&0x0f];
- temp[i] = '\0';
-
- return(temp);
-}
-
-void
-add_fid(XFontStruct *font)
-{
-
- char *fidstr;
pointer_dictionary_binding *binding;
int exists;
+ XFontSet fontst;
+ char **missing_list;
+ int missing_count;
+ char *def_string;
- if (!fidst_dict)
- fidst_dict = pointer_dictionary_Create(37);
- fidstr=Font_to_hex(font->fid);
- binding = pointer_dictionary_Define(fidst_dict,fidstr,&exists);
- free(fidstr);
-
- if (!exists)
- binding->value=(pointer) font;
-}
-
-/* requires that the font already be cached. */
-XFontStruct *
-get_fontst_from_fid(Font fid)
-{
- char *fidstr;
- pointer_dictionary_binding *binding;
- int exists;
-
- fidstr=Font_to_hex(fid);
-
- binding = pointer_dictionary_Define(fidst_dict,fidstr,&exists);
- free(fidstr);
-#ifdef DEBUG
- if (exists) {
- return((XFontStruct *) binding->value);
- } else {
- printf("Font fid=0x%s not cached. Oops.\n",fidstr);
- abort();
- }
-#else
- return((XFontStruct *) binding->value);
-#endif
-}
+ if (!fontst_dict)
+ fontst_dict = pointer_dictionary_Create(37);
+ binding = pointer_dictionary_Define(fontst_dict, fontname, &exists);
-static XFontStruct *
-get_fontst(Display *dpy,
- char *fontname)
-{
- pointer_dictionary_binding *binding;
- int exists;
- XFontStruct *fontst;
+ if (exists)
+ return((XFontSet)binding->value);
- if (!fontst_dict)
- fontst_dict = pointer_dictionary_Create(37);
- binding = pointer_dictionary_Define(fontst_dict,fontname,&exists);
+ fontst = XCreateFontSet(dpy, fontname, &missing_list, &missing_count,
+ &def_string);
+ XFreeStringList(missing_list);
- if (exists) {
- return((XFontStruct *) binding->value);
- } else {
- fontst=XLoadQueryFont(dpy,fontname);
- if (fontst==NULL) {
- pointer_dictionary_Delete(fontst_dict,binding);
- } else {
- binding->value=(pointer) fontst;
- add_fid(fontst);
- } return(fontst); /* If resource returns NULL, return NULL also */
- }
+ if (fontst == NULL)
+ pointer_dictionary_Delete(fontst_dict,binding);
+ else
+ binding->value = (pointer)fontst;
+
+ return(fontst); /* If resource returns NULL, return NULL also */
}
static char *
-get_fontname(char *family,
- int size,
- int face)
+get_fontname(char *family, int size, int face)
{
- char *fontname;
-
- if (!(fontname=get_specific_fontname(family,size,face)))
- if (!(fontname=get_specific_fontname(family,size,ROMAN_FACE)))
- if (!(fontname=get_specific_fontname(family,MEDIUM_SIZE,face)))
- fontname=get_specific_fontname(family,MEDIUM_SIZE,ROMAN_FACE);
- return(fontname);
+ char *fontname;
+
+ fontname = get_specific_fontname(family, size, face);
+ if (!fontname)
+ fontname = get_specific_fontname(family, size, ROMAN_FACE);
+ if (!fontname)
+ fontname = get_specific_fontname(family, MEDIUM_SIZE, face);
+ if (!fontname)
+ fontname = get_specific_fontname(family, MEDIUM_SIZE, ROMAN_FACE);
+ return(fontname);
}
-static XFontStruct *
+static XFontSet
complete_get_fontst(Display *dpy,
- string style,
- string substyle,
- int size,
- int face)
+ string style,
+ string substyle,
+ int size,
+ int face)
{
- char *family,*fontname;
- XFontStruct *fontst;
-
- if ((family=get_family(style,substyle)))
- if ((fontname=get_fontname(family,size,face)))
- if ((fontst=get_fontst(dpy,fontname)))
- return(fontst);
- /* If any part fails, */
- return(NULL);
+ char *family, *fontname;
+ XFontSet fontst;
+
+ family = get_family(style, substyle);
+ if (!family)
+ return NULL;
+ fontname = get_fontname(family, size, face);
+ if (!fontname)
+ return NULL;
+ fontst = get_fontst(dpy, fontname);
+ if (!fontst)
+ return NULL;
+
+ return fontst;
}
/*
- * XFontStruct *get_font(string style, substyle; int size, face)
+ * XFontSet get_font(string style, substyle; int size, face)
* Requires: size is one of SMALL_SIZE, MEDIUM_SIZE, LARGE_SIZE and
* face is one of ROMAN_FACE, BOLD_FACE, ITALIC_FACE,
* BOLDITALIC_FACE.
* Effects: unknown
*/
-XFontStruct *
+XFontSet
get_font(Display *dpy,
- string style,
- string substyle,
- int size,
- int face)
+ string style,
+ string substyle,
+ int size,
+ int face)
{
char *family,*fontname;
- XFontStruct *fontst;
+ XFontSet fontst = NULL;
if (size == SPECIAL_SIZE) {
- /* attempt to process @font explicitly */
- if ((fontst = get_fontst(dpy, substyle)))
- return(fontst);
+ /* attempt to process @font explicitly */
+ fontst = get_fontst(dpy, substyle);
} else {
- if ((family = get_family(style, substyle))) {
- if ((fontname = get_fontname(family, size,face)))
- if ((fontst = get_fontst(dpy, fontname)))
- return(fontst);
- } else {
- if ((fontname = get_fontname(substyle, size, face)))
- if ((fontst = get_fontst(dpy, fontname)))
- return(fontst);
- }
-
- /* At this point, the no-failure case didn't happen, and the case
- of substyle being the fontfamily didn't happen, either. */
-
- fontst=NULL;
- if (!(fontst = complete_get_fontst(dpy,style,"text",size,face)))
- if (!(fontst = complete_get_fontst(dpy,"default",substyle,size,face)))
- if (!(fontst = complete_get_fontst(dpy,"default","text",size,face)))
- if ((fontname = get_fontname("default",size,face)))
- fontst = get_fontst(dpy,fontname);
- if (fontst) return(fontst);
+ family = get_family(style, substyle);
+
+ if (family)
+ fontname = get_fontname(family, size, face);
+ else
+ fontname = get_fontname(substyle, size, face);
+
+ if (fontname) {
+ fontst = get_fontst(dpy, fontname);
+ if (fontst)
+ return fontst;
+ }
+
+ /* At this point, the no-failure case didn't happen, and the case
+ of substyle being the fontfamily didn't happen, either. */
+
+ fontst = complete_get_fontst(dpy, style, "text", size, face);
+ if (!fontst)
+ fontst = complete_get_fontst(dpy, "default", substyle, size, face);
+ if (!fontst)
+ fontst = complete_get_fontst(dpy, "default", "text", size, face);
+ if (!fontst) {
+ fontname = get_fontname("default", size, face);
+ if (fontname)
+ fontst = get_fontst(dpy, fontname);
+ }
}
-
+ if (fontst)
+ return fontst;
+
/* If all else fails, try fixed */
- if ((fontst=get_fontst(dpy,"fixed"))) return(fontst);
-
+ fontst = get_fontst(dpy, "fixed");
+
+ if (fontst)
+ return fontst;
+
/* No fonts available. Die. */
-
+
ERROR("Unable to open font \"fixed\". Aborting...");
#ifdef DEBUG
abort();
}
#endif /* X_DISPLAY_MISSING */
-
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: X_fonts.h 2133 2008-01-21 03:11:44Z kcr $
+ * $Id: X_fonts.h 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#define LARGE_SIZE 2
/*
- * XFontStruct *get_font(string family; int size, face)
+ * XFontSet get_font(string family; int size, face)
* Requires: size is one of SMALL_SIZE, MEDIUM_SIZE, LARGE_SIZE and
* face is one of ROMAN_FACE, BOLD_FACE, ITALIC_FACE,
* BOLDITALIC_FACE.
* specified by default.medium.roman is used. <<<>>>
*/
-extern XFontStruct *get_font(Display *, string, string, int, int);
-extern XFontStruct *get_fontst_from_fid(Font);
+extern XFontSet get_font(Display *, string, string, int, int);
#endif
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: X_gram.c 2336 2009-03-22 18:59:56Z kcr $
+ * $Id: X_gram.c 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_X_gram_c[] = "$Id: X_gram.c 2336 2009-03-22 18:59:56Z kcr $";
+static const char rcsid_X_gram_c[] = "$Id: X_gram.c 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
static char *title_name,*icon_name;
static Cursor cursor;
static Window group_leader; /* In order to have transient windows,
- * I need a top-level window to always exist
- */
+ * I need a top-level window to always exist
+ */
static XClassHint classhint;
static XSetWindowAttributes xattributes;
static unsigned long xattributes_mask;
* and for individual zgrams:
*
* WM_TRANSIENT_FOR XSetTransientForHint(dpy,w,main_window);
- * WM_PROTOCOLS XSetWMProtocols(dpy,w,protocols,cnt);
+ * WM_PROTOCOLS XSetWMProtocols(dpy,w,protocols,cnt);
*/
/* set all properties defined in ICCCM. If main_window == 0,
/*ARGSUSED*/
void
x_set_icccm_hints(Display *dpy,
- Window w,
- char *name,
- char *icon_name,
- XSizeHints *psizehints,
- XWMHints *pwmhints,
- Window main_window)
+ Window w,
+ char *name,
+ char *icon_name,
+ XSizeHints *psizehints,
+ XWMHints *pwmhints,
+ Window main_window)
{
XStoreName(dpy,w,name);
XSetIconName(dpy,w,icon_name);
e.g. Motif wm */
if (main_window != None) {
if (set_transient)
- XSetTransientForHint(dpy,w,main_window);
+ XSetTransientForHint(dpy,w,main_window);
}
if (enable_delete)
XSetWMProtocols(dpy,w,&XA_WM_DELETE_WINDOW,1);
temp = get_string_resource("pointerColor", "Foreground");
if (temp) {
- char *temp2;
- XColor cursor_fore, cursor_back;
- /* XXX need to do our own parsing here, since the RecolorCursor
- routine requires an XColor, not an unsigned long (pixel) */
- if (!(temp2 = get_string_resource("background","Background"))) {
- if (default_bgcolor == WhitePixelOfScreen(DefaultScreenOfDisplay(dpy)))
- temp2 = "white";
- else
- temp2 = "black";
- }
- if (XParseColor(dpy,
- DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
- temp, &cursor_fore) &&
- XParseColor(dpy,
- DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
- temp2, &cursor_back)) {
- XRecolorCursor(dpy, cursor, &cursor_fore, &cursor_back);
- }
+ char *temp2;
+ XColor cursor_fore, cursor_back;
+ /* XXX need to do our own parsing here, since the RecolorCursor
+ routine requires an XColor, not an unsigned long (pixel) */
+ if (!(temp2 = get_string_resource("background","Background"))) {
+ if (default_bgcolor == WhitePixelOfScreen(DefaultScreenOfDisplay(dpy)))
+ temp2 = "white";
+ else
+ temp2 = "black";
+ }
+ if (XParseColor(dpy,
+ DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
+ temp, &cursor_fore) &&
+ XParseColor(dpy,
+ DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)),
+ temp2, &cursor_back)) {
+ XRecolorCursor(dpy, cursor, &cursor_fore, &cursor_back);
+ }
}
if (!(title_name=get_string_resource("title","Title")))
if (!(title_name=get_string_resource("name","Name")))
- title_name=app_instance;
+ title_name=app_instance;
if (!(icon_name=get_string_resource("iconName","IconName")))
if (!(icon_name=get_string_resource("name","Name")))
- icon_name=app_instance;
+ icon_name=app_instance;
if (!(temp=get_string_resource("name","Name")))
if (!(temp=(char *) getenv("RESOURCE_NAME")))
- temp=app_instance;
+ temp=app_instance;
classhint.res_name=string_Copy(temp);
classhint.res_class="Zwgc";
if (set_transient) {
group_leader=XCreateSimpleWindow(dpy,DefaultRootWindow(dpy),0,0,100,100,
- 0,default_bordercolor,default_bgcolor);
+ 0,default_bordercolor,default_bgcolor);
sizehints.x = 0;
sizehints.y = 0;
sizehints.width = 100;
wmhints.flags = InputHint | StateHint;
x_set_icccm_hints(dpy,group_leader,"ZwgcGroup","ZwgcGroup",&sizehints,
- &wmhints,0);
+ &wmhints,0);
}
xattributes.border_pixel = default_bordercolor;
xattributes.cursor = cursor;
xattributes.event_mask = (ExposureMask|ButtonReleaseMask|ButtonPressMask
- |LeaveWindowMask|Button1MotionMask
+ |LeaveWindowMask|Button1MotionMask
#ifdef CMU_ZWGCPLUS
- |KeyPressMask
+ |KeyPressMask
#endif
- |Button3MotionMask|StructureNotifyMask);
+ |Button3MotionMask|StructureNotifyMask);
xattributes_mask = (CWBackPixel|CWBorderPixel|CWEventMask|CWCursor);
set_all_desktops = get_bool_resource("allDesktops", "AllDesktops", True);
net_wm_desktop = XInternAtom(dpy, "_NET_WM_DESKTOP", False);
net_wm_window_type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
net_wm_window_type_utility = XInternAtom(dpy,
- "_NET_WM_WINDOW_TYPE_UTILITY",
- False);
+ "_NET_WM_WINDOW_TYPE_UTILITY",
+ False);
temp = get_string_resource ("backingStore", "BackingStore");
if (!temp)
- return;
+ return;
xattributes_mask |= CWBackingStore;
if (!strcasecmp (temp, "notuseful"))
- xattributes.backing_store = NotUseful;
+ xattributes.backing_store = NotUseful;
else if (!strcasecmp (temp, "whenmapped"))
- xattributes.backing_store = WhenMapped;
+ xattributes.backing_store = WhenMapped;
else if (!strcasecmp (temp, "always"))
- xattributes.backing_store = Always;
+ xattributes.backing_store = Always;
else if (!strcasecmp (temp, "default"))
- xattributes_mask &= ~CWBackingStore;
+ xattributes_mask &= ~CWBackingStore;
else {
- switch (get_bool_resource ("backingStore", "BackingStore", -1)) {
- case 0:
- xattributes.backing_store = NotUseful;
- break;
- case 1:
- xattributes.backing_store = WhenMapped;
- break;
- case -1:
- fprintf (stderr,
- "zwgc: Cannot interpret backing-store resource value `%s'.\n",
- temp);
- xattributes_mask &= ~CWBackingStore;
- break;
- }
+ switch (get_bool_resource ("backingStore", "BackingStore", -1)) {
+ case 0:
+ xattributes.backing_store = NotUseful;
+ break;
+ case 1:
+ xattributes.backing_store = WhenMapped;
+ break;
+ case -1:
+ fprintf (stderr,
+ "zwgc: Cannot interpret backing-store resource value `%s'.\n",
+ temp);
+ xattributes_mask &= ~CWBackingStore;
+ break;
+ }
}
}
int
x_calc_gravity(int xalign,
- int yalign)
+ int yalign)
{
- if (yalign > 0) { /* North */
- return (xalign > 0) ? NorthWestGravity
- : (xalign == 0) ? NorthGravity
- : NorthEastGravity;
- } else if (yalign == 0) { /* Center */
- return (xalign > 0) ? WestGravity
- : (xalign == 0) ? CenterGravity
- : EastGravity;
- } else { /* South */
- return (xalign > 0) ? SouthWestGravity
- : (xalign == 0) ? SouthGravity
- : SouthEastGravity;
+ if (yalign > 0) { /* North */
+ return (xalign > 0) ? NorthWestGravity
+ : (xalign == 0) ? NorthGravity
+ : NorthEastGravity;
+ } else if (yalign == 0) { /* Center */
+ return (xalign > 0) ? WestGravity
+ : (xalign == 0) ? CenterGravity
+ : EastGravity;
+ } else { /* South */
+ return (xalign > 0) ? SouthWestGravity
+ : (xalign == 0) ? SouthGravity
+ : SouthEastGravity;
}
}
void
x_gram_create(Display *dpy,
- x_gram *gram,
- int xalign,
- int yalign,
- int xpos,
- int ypos,
- int xsize,
- int ysize,
- int beepcount)
+ x_gram *gram,
+ int xalign,
+ int yalign,
+ int xpos,
+ int ypos,
+ int xsize,
+ int ysize,
+ int beepcount)
{
Window w;
XSizeHints sizehints;
/*
* Adjust xpos, ypos based on the alignments xalign, yalign and the sizes:
*/
- if (xalign<0)
- xpos = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xpos - xsize
- - 2*border_width;
+ if (xalign < 0)
+ xpos = WidthOfScreen(DefaultScreenOfDisplay(dpy))
+ - xpos - xsize - 2 * border_width;
else if (xalign == 0)
- xpos = ((WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize
- - 2*border_width)>>1) + xpos;
+ xpos = ((WidthOfScreen(DefaultScreenOfDisplay(dpy))
+ - xsize - 2 * border_width) >> 1) + xpos;
if (yalign<0)
- ypos = HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ypos - ysize
- - 2*border_width;
+ ypos = HeightOfScreen(DefaultScreenOfDisplay(dpy))
+ - ypos - ysize - 2 * border_width;
else if (yalign == 0)
- ypos = ((HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize
- - 2*border_width)>>1) + ypos;
+ ypos = ((HeightOfScreen(DefaultScreenOfDisplay(dpy))
+ - ysize - 2 * border_width) >> 1) + ypos;
/*
* Create the window:
attributes.background_pixel = gram->bgcolor;
gram->w = w = XCreateWindow (dpy, DefaultRootWindow (dpy), xpos, ypos,
- xsize, ysize, border_width, 0,
- CopyFromParent, CopyFromParent,
- xattributes_mask, &attributes);
+ xsize, ysize, border_width, 0,
+ CopyFromParent, CopyFromParent,
+ xattributes_mask, &attributes);
sizehints.x = xpos;
sizehints.y = ypos;
sizehints.width = xsize;
sizehints.height = ysize;
sizehints.win_gravity = x_calc_gravity(xalign, yalign);
- sizehints.flags = USPosition|USSize|PWinGravity;
+ sizehints.flags = USPosition | USSize | PWinGravity;
wmhints.input = False;
wmhints.initial_state = NormalState;
wmhints.window_group = group_leader;
wmhints.flags = InputHint | StateHint | WindowGroupHint;
- x_set_icccm_hints(dpy,w,title_name,icon_name,&sizehints,&wmhints,
- group_leader);
+ x_set_icccm_hints(dpy, w, title_name, icon_name, &sizehints, &wmhints,
+ group_leader);
} else {
wmhints.flags = InputHint | StateHint;
- x_set_icccm_hints(dpy,w,title_name,icon_name,&sizehints,&wmhints,0);
+ x_set_icccm_hints(dpy, w, title_name, icon_name, &sizehints, &wmhints, 0);
}
if (net_wm_window_type != None && net_wm_window_type_utility != None)
- XChangeProperty(dpy, w, net_wm_window_type, XA_ATOM, 32,
- PropModeReplace,
- (unsigned char *) &net_wm_window_type_utility, 1);
+ XChangeProperty(dpy, w, net_wm_window_type, XA_ATOM, 32, PropModeReplace,
+ (unsigned char *) &net_wm_window_type_utility, 1);
if (set_all_desktops && net_wm_desktop != None)
- XChangeProperty(dpy, w, net_wm_desktop, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *) &all_desktops, 1);
+ XChangeProperty(dpy, w, net_wm_desktop, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &all_desktops, 1);
XSaveContext(dpy, w, desc_context, (caddr_t)gram);
XMapWindow(dpy, w);
if (beepcount)
- XBell(dpy, 0);
+ XBell(dpy, 0);
xerror_happened = 0;
if (reverse_stack && bottom_gram) {
XWindowChanges winchanges;
- winchanges.sibling=bottom_gram->w;
- winchanges.stack_mode=Below;
+ winchanges.sibling = bottom_gram->w;
+ winchanges.stack_mode = Below;
/* Metacity may use border_width even if it's not specified in
- * the value mask, so we must initialize it. See:
- * http://bugzilla.gnome.org/show_bug.cgi?id=305257 */
- winchanges.border_width=border_width;
+ * the value mask, so we must initialize it. See:
+ * http://bugzilla.gnome.org/show_bug.cgi?id=305257 */
+ winchanges.border_width = border_width;
begin_xerror_trap (dpy);
XReconfigureWMWindow (dpy, w, DefaultScreen (dpy),
- CWSibling|CWStackMode, &winchanges);
+ CWSibling | CWStackMode, &winchanges);
end_xerror_trap (dpy);
if (xerror_happened) {
- /* The event didn't go. Print an error message, and continue. */
- ERROR ("Error configuring window to the bottom of the stack.\n");
+ /* The event didn't go. Print an error message, and continue. */
+ ERROR ("Error configuring window to the bottom of the stack.\n");
}
}
/* we always need to keep a linked list of windows */
pull_to_top(gram);
if (reset_saver)
- XResetScreenSaver(dpy);
+ XResetScreenSaver(dpy);
XFlush(dpy);
/* Because the flushing/syncing/etc with the error trapping can cause
x_get_input(dpy);
}
+inline static void
+SetFG(Display *dpy, GC gc, unsigned long foreground) {
+ XGCValues gcvals;
+
+ gcvals.foreground = foreground;
+ XChangeGC(dpy, gc, GCForeground, &gcvals);
+}
+
void
-x_gram_draw(Display *dpy,
- Window w,
- x_gram *gram,
- Region region)
+x_gram_draw(Display *dpy, Window w, x_gram *gram, Region region)
{
int i;
GC gc;
XGCValues gcvals;
xblock *xb;
- XTextItem text;
+#ifdef X_HAVE_UTF8_STRING
+ XmbTextItem text;
+#else
+ XwcTextItem text;
+#endif
int startblock, endblock, startpixel = 0, endpixel = 0;
-#define SetFG(fg) \
- gcvals.foreground=fg; \
- XChangeGC(dpy,gc,GCForeground,&gcvals)
-
gc = XCreateGC(dpy, w, 0, &gcvals);
- XSetRegion(dpy,gc,region);
+ XSetRegion(dpy, gc, region);
if ((markgram == gram) && (STARTBLOCK != -1) && (ENDBLOCK != -1)) {
if (xmarkSecond() == XMARK_END_BOUND) {
- startblock=STARTBLOCK;
- endblock=ENDBLOCK;
- startpixel=STARTPIXEL;
- endpixel=ENDPIXEL;
+ startblock = STARTBLOCK;
+ endblock = ENDBLOCK;
+ startpixel = STARTPIXEL;
+ endpixel = ENDPIXEL;
} else {
- startblock=ENDBLOCK;
- endblock=STARTBLOCK;
- startpixel=ENDPIXEL;
- endpixel=STARTPIXEL;
+ startblock = ENDBLOCK;
+ endblock = STARTBLOCK;
+ startpixel = ENDPIXEL;
+ endpixel = STARTPIXEL;
}
} else {
startblock = -1;
endblock = -1;
}
- for (i=0,xb=gram->blocks ; i<gram->numblocks ; i++,xb++) {
- if (XRectInRegion(region,xb->x1,xb->y1,xb->x2-xb->x1,
- xb->y2-xb->y1) != RectangleOut) {
- if (i==startblock) {
- if (i==endblock) {
- SetFG(gram->bgcolor);
- XFillRectangle(dpy,w,gc,xb->x1,xb->y1,startpixel,
- (xb->y2-xb->y1));
- SetFG(xb->fgcolor);
- XFillRectangle(dpy,w,gc,xb->x1+startpixel,xb->y1,
- (endpixel-startpixel),(xb->y2-xb->y1));
- SetFG(gram->bgcolor);
- XFillRectangle(dpy,w,gc,xb->x1+endpixel,xb->y1,
- (xb->x2-xb->x1-endpixel),(xb->y2-xb->y1));
- } else {
- SetFG(gram->bgcolor);
- XFillRectangle(dpy,w,gc,xb->x1,xb->y1,startpixel,
- (xb->y2-xb->y1));
- SetFG(xb->fgcolor);
- XFillRectangle(dpy,w,gc,xb->x1+startpixel,xb->y1,
- (xb->x2-xb->x1-startpixel),(xb->y2-xb->y1));
- }
- } else if (i==endblock) {
- SetFG(xb->fgcolor);
- XFillRectangle(dpy,w,gc,xb->x1,xb->y1,endpixel,
- (xb->y2-xb->y1));
- SetFG(gram->bgcolor);
- XFillRectangle(dpy,w,gc,xb->x1+endpixel,xb->y1,
- (xb->x2-xb->x1-endpixel),(xb->y2-xb->y1));
- } else {
- if ((startblock < i) && (i < endblock)) {
- SetFG(xb->fgcolor);
- } else {
- SetFG(gram->bgcolor);
- }
- XFillRectangle(dpy,w,gc,xb->x1,xb->y1,(xb->x2-xb->x1),
- (xb->y2-xb->y1));
- }
+ for (i=0, xb = gram->blocks; i < gram->numblocks; i++, xb++) {
+ if (XRectInRegion(region, xb->x1, xb->y1, xb->x2 - xb->x1,
+ xb->y2 - xb->y1) != RectangleOut) {
+ if (i == startblock) {
+ if (i == endblock) {
+ SetFG(dpy, gc, gram->bgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1, xb->y1, startpixel,
+ xb->y2 - xb->y1);
+ SetFG(dpy, gc, xb->fgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1 + startpixel, xb->y1,
+ endpixel - startpixel, xb->y2 - xb->y1);
+ SetFG(dpy, gc, gram->bgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1 + endpixel, xb->y1,
+ xb->x2 - xb->x1 - endpixel, xb->y2 - xb->y1);
+ } else {
+ SetFG(dpy, gc, gram->bgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1, xb->y1, startpixel,
+ xb->y2 - xb->y1);
+ SetFG(dpy, gc, xb->fgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1 + startpixel, xb->y1,
+ xb->x2 - xb->x1 - startpixel,xb->y2 - xb->y1);
+ }
+ } else if (i == endblock) {
+ SetFG(dpy, gc, xb->fgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1, xb->y1, endpixel,
+ xb->y2 - xb->y1);
+ SetFG(dpy, gc, gram->bgcolor);
+ XFillRectangle(dpy, w, gc, xb->x1 + endpixel, xb->y1,
+ xb->x2 - xb->x1 - endpixel, xb->y2 - xb->y1);
+ } else {
+ if (startblock < i && i < endblock) {
+ SetFG(dpy, gc, xb->fgcolor);
+ } else {
+ SetFG(dpy, gc, gram->bgcolor);
+ }
+ XFillRectangle(dpy, w, gc, xb->x1, xb->y1, xb->x2 - xb->x1,
+ xb->y2 - xb->y1);
+ }
}
}
- gcvals.function=GXxor;
- XChangeGC(dpy,gc,GCFunction,&gcvals);
-
- for (i=0,xb=gram->blocks ; i<gram->numblocks ; i++,xb++) {
- if (XRectInRegion(region,xb->x1,xb->y1,xb->x2-xb->x1,
- xb->y2-xb->y1) != RectangleOut) {
- SetFG(gram->bgcolor^xb->fgcolor);
- text.chars=gram->text+xb->strindex;
- text.nchars=xb->strlen;
- text.delta=0;
- text.font=xb->fid;
- XDrawText(dpy,w,gc,xb->x,xb->y,&text,1);
+ gcvals.function = GXxor;
+ XChangeGC(dpy, gc, GCFunction, &gcvals);
+
+ for (i=0, xb = gram->blocks; i < gram->numblocks; i++, xb++) {
+ if (XRectInRegion(region, xb->x1, xb->y1, xb->x2 - xb->x1,
+ xb->y2 - xb->y1) != RectangleOut) {
+ SetFG(dpy, gc, gram->bgcolor ^ xb->fgcolor);
+#ifdef X_HAVE_UTF8_STRING
+ text.chars = xb->wstr;
+#else
+ text.chars = (XChar2b *)xb->wstr;
+#endif
+ text.nchars = xb->wlen;
+ text.delta = 0;
+ text.font_set = xb->font;
+#ifdef X_HAVE_UTF8_STRING
+ Xutf8DrawText(dpy, w, gc, xb->x, xb->y, &text, 1);
+#else
+ XwcDrawText(dpy, w, gc, xb->x, xb->y, &text, 1);
+#endif
}
}
- XFreeGC(dpy,gc);
+ XFreeGC(dpy, gc);
}
void
x_gram_expose(Display *dpy,
- Window w,
- x_gram *gram,
- XExposeEvent *event)
+ Window w,
+ x_gram *gram,
+ XExposeEvent *event)
{
static Region region;
static int partregion;
#ifdef MARK_DEBUG
printf("----- xeventExpose:\nx=%d y=%d w=%d h=%d\n-----",
- event->x,event->y,event->width,event->height);
+ event->x,event->y,event->width,event->height);
#endif
if (! partregion) {
}
#endif /* X_DISPLAY_MISSING */
-
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: X_gram.h 2336 2009-03-22 18:59:56Z kcr $
+ * $Id: X_gram.h 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include "formatter.h"
typedef struct _xblock {
- unsigned long fgcolor;
- Font fid;
- int x,y;
- int x1,y1,x2,y2; /* bounds of block. used for cut and paste. */
- int strindex;
- int strlen;
+ unsigned long fgcolor;
+ XFontSet font;
+ int x,y;
+ int x1,y1,x2,y2; /* bounds of block. used for cut and paste. */
+ int strindex;
+ int strlen;
+ char *wstr;
+ int wlen;
} xblock;
typedef struct _x_gram {
} x_gram;
typedef struct _xauxblock {
- int align;
- XFontStruct *font;
- char *str;
- int len;
- int width;
+ int align;
+ XFontSet font;
+ char *str;
+ int len;
+ int width;
} xauxblock;
typedef struct _xmode {
+++ /dev/null
-/* This file is part of the Project Athena Zephyr Notification System.
- * It is one of the source files comprising zwgc, the Zephyr WindowGram
- * client.
- *
- * Created by: Marc Horowitz <marc@athena.mit.edu>
- *
- * $Id: display.c 2091 2007-12-20 01:17:23Z kcr $
- *
- * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- * For copying and distribution information, see the file
- * "mit-copyright.h".
- */
-
-#if (!defined(lint) && !defined(SABER))
-static char rcsid_display_c[] = "$Id: display.c 2091 2007-12-20 01:17:23Z kcr $";
-#endif
-
-#include <zephyr/mit-copyright.h>
-
-/****************************************************************************/
-/* */
-/* "Bus" module for plug in output driver modules: */
-/* */
-/****************************************************************************/
-
-#include <sysdep.h>
-#include "new_memory.h"
-#include "new_string.h"
-#include "variables.h"
-#include "display.h"
-
-/*
- * driver_table - <<<>>>
- */
-
-extern void tty_driver();
-extern void plain_driver();
-extern void raw_driver();
-
-extern int tty_driver_init();
-
-#ifndef X_DISPLAY_MISSING
-extern int X_driver_init();
-extern void X_driver();
-#endif
-
-static struct driver_info {
- string driver_name;
- void (*driver)();
- int (*driver_init)();
- void (*driver_reset)();
-} driver_table[] = {
-#ifndef X_DISPLAY_MISSING
- {"X", X_driver, X_driver_init, X_driver_reset},
-#endif
- {"tty", tty_driver, tty_driver_init, NULL},
- {"plain", plain_driver, NULL, NULL},
- {"raw", raw_driver, NULL, NULL},
- {NULL, NULL, NULL, NULL}
-};
-
-/*
- * <<<>>>
- */
-
-struct driver_info *get_driver_info(driver_name)
- string driver_name;
-{
- struct driver_info *d;
-
- for (d=driver_table; d->driver_name; d++)
- if (string_Eq(d->driver_name, driver_name) && d->driver)
- return(d);
-
- return(NULL);
-}
-
-/*
- * void init_display(int *pargc; char **argv)
- * Effects: <<<>>>
- */
-
-void display_init(pargc, argv)
- int *pargc;
- char **argv;
-{
- char **new, **current;
- struct driver_info *d;
- string first_working_driver = "";
- string default_driver = "";
-
- /*
- * Process argument list handling "-disable <driver>" and
- * "-default <driver>" arguments:
- */
- for (new=current=argv+1; *current; current++) {
- if (string_Eq(*current, "-disable")) {
- current++; *pargc -= 2;
- if (!*current)
- usage();
- if (d = get_driver_info(*current))
- d->driver = NULL;
- } else if (string_Eq(*current, "-default")) {
- current++; *pargc -= 2;
- if (!*current)
- usage();
- default_driver = *current;
- } else
- *(new++) = *current;
- }
- *new = *current;
-
- /*
- * Initialize all non-disabled drivers. If a driver reports an error,
- * disable that driver. Set default_driver if not already set
- * by the -default argument to the first non-disabled driver.
- */
- for (d = driver_table; d->driver_name; d++) {
- if (!d->driver)
- continue;
-
- if (d->driver_init && d->driver_init(pargc, argv)) {
- d->driver = NULL;
- continue;
- }
-
- if (!*first_working_driver)
- first_working_driver = d->driver_name;
- }
-
- if (!get_driver_info(default_driver))
- default_driver = first_working_driver;
-
- var_set_variable("output_driver", default_driver);
-}
-
-void display_reset()
-{
- for (d = driver_table; d->driver_name; d++)
- if (d->driver) d->driver_reset();
-}
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: main.c 2328 2009-03-22 17:34:39Z kcr $
+ * $Id: main.c 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#endif
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_main_c[] = "$Id: main.c 2328 2009-03-22 17:34:39Z kcr $";
+static const char rcsid_main_c[] = "$Id: main.c 2437 2009-04-21 04:11:03Z kcr@ATHENA.MIT.EDU $";
#endif
#include <netdb.h>
#include <arpa/nameser.h>
+#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#include <arpa/nameser_compat.h>
+#endif
#include <sys/socket.h>
#include <sys/resource.h>
+#include <locale.h>
#include <zephyr/mit-copyright.h>
#include <zephyr/zephyr.h>
#endif
#ifdef CMU_ZWGCPLUS
#include "plus.h"
-int zwgcplus = 0;
+int zwgcplus = 1;
#endif
void notice_handler(ZNotice_t *);
notice->z_auth = ZAUTH_YES;
notice->z_charset = ZCHARSET_UNKNOWN;
sprintf(msgbuf,"Zwgc mark II version %s now running...",
- zwgc_version_string);
+ zwgc_version_string);
notice->z_message = msgbuf;
notice->z_message_len = strlen(notice->z_message)+1;
status = system(progname);
if (status == 127) {
- perror("zwgc initprog exec");
- fprintf(stderr,"zwgc initprog of <%s> failed: no shell.\n",
- progname);
+ perror("zwgc initprog exec");
+ fprintf(stderr,"zwgc initprog of <%s> failed: no shell.\n",
+ progname);
} else if (status!=-1 && status>>8) {
- perror("zwgc initprog exec");
- fprintf(stderr,"zwgc initprog of <%s> failed with status [%d].\n",
- progname, status>>8);
+ perror("zwgc initprog exec");
+ fprintf(stderr,"zwgc initprog of <%s> failed with status [%d].\n",
+ progname, status>>8);
}
}
*/
int
-main(int argc,
- char **argv)
+main(int argc, char **argv)
{
char **new;
register char **current;
int status;
#endif
+ setlocale(LC_ALL, "");
progname = argv[0];
/*
* arguments, removing then from argc, argv:
*/
for (new=current=argv+1; *current; current++) {
- if (string_Eq(*current, "-debug")) {
- argc--;
+ if (string_Eq(*current, "-debug")) {
+ argc--;
#ifdef DEBUG
- zwgc_debug = 1;
+ zwgc_debug = 1;
#endif
- } else if (string_Eq(*current, "-f")) {
- argc -= 2; current++;
- if (!*current)
- usage();
- description_filename_override = *current;
- } else if (string_Eq(*current, "-subfile")) {
- argc -= 2; current++;
- if (!*current)
- usage();
- subscriptions_filename_override = *current;
- } else if (string_Eq(*current, "-nofork")) {
- argc--;
- dofork = 0;
- } else if (string_Eq(*current, "-reenter")) {
- argc--; /* just throw it away */
- } else if (string_Eq(*current, "-loc")) {
- argc -= 2; current++;
- if (!*current)
- usage();
- location_override = *current;
- } else
- *(new)++ = *current;
+ } else if (string_Eq(*current, "-f")) {
+ argc -= 2; current++;
+ if (!*current)
+ usage();
+ description_filename_override = *current;
+ } else if (string_Eq(*current, "-subfile")) {
+ argc -= 2; current++;
+ if (!*current)
+ usage();
+ subscriptions_filename_override = *current;
+ } else if (string_Eq(*current, "-nofork")) {
+ argc--;
+ dofork = 0;
+ } else if (string_Eq(*current, "-reenter")) {
+ argc--; /* just throw it away */
+ } else if (string_Eq(*current, "-loc")) {
+ argc -= 2; current++;
+ if (!*current)
+ usage();
+ location_override = *current;
+ } else
+ *(new)++ = *current;
}
*new = *current;
*/
status = ares_init(&achannel);
if (status != ARES_SUCCESS) {
- fprintf(stderr, "Couldn't initialize resolver: %s\n",
- ares_strerror(status));
- return(1);
+ fprintf(stderr, "Couldn't initialize resolver: %s\n",
+ ares_strerror(status));
+ return(1);
}
#endif
zephyr_init(notice_handler);
if (dofork)
- detach();
+ detach();
/*
* Run the initprogs program(s) now that we are all set to deal:
*/
dprintf("Test Zwgc parser.\n\n");
read_in_description_file();
-#ifdef CMU_ZWGCPLUS
- if (strcmp(progname, "zwgcplus") == 0)
- zwgcplus = 1;
-#endif
-
dprintf("Entering main loop\n");
mux_loop();
char *tmp;
if (!punt_reply.z_message) {
- punt_reply.z_message = (char *)malloc(PUNT_INC);
- punt_reply.z_message[0] = 0;
+ punt_reply.z_message = (char *)malloc(PUNT_INC);
+ punt_reply.z_message[0] = 0;
}
if ((punt_reply.z_message_len + key_len + 1) / PUNT_INC >
- (punt_reply.z_message_len + PUNT_INC - 1) / PUNT_INC) {
- char *new_message = (char *)malloc((punt_reply.z_message_len
- / PUNT_INC + 1) * PUNT_INC);
-
- strcpy(new_message, punt_reply.z_message);
-
- free(punt_reply.z_message);
- punt_reply.z_message = new_message;
+ (punt_reply.z_message_len + PUNT_INC - 1) / PUNT_INC) {
+ char *new_message = (char *)malloc((punt_reply.z_message_len
+ / PUNT_INC + 1) * PUNT_INC);
+
+ strcpy(new_message, punt_reply.z_message);
+
+ free(punt_reply.z_message);
+ punt_reply.z_message = new_message;
}
tmp = punt_reply.z_message + strlen(punt_reply.z_message);
strcat (punt_reply.z_message, punt->key);
#ifdef HAVE_ARES
ares_getnameinfo(achannel,
- (const struct sockaddr *)&(notice->z_sender_sockaddr),
- notice->z_sender_sockaddr.sa.sa_family == AF_INET ?
- sizeof(struct sockaddr_in) :
- notice->z_sender_sockaddr.sa.sa_family == AF_INET6 ?
- sizeof(struct sockaddr_in6) :
- sizeof(notice->z_sender_sockaddr), ARES_NI_LOOKUPHOST,
- notice_callback, notice);
+ (const struct sockaddr *)&(notice->z_sender_sockaddr),
+ notice->z_sender_sockaddr.sa.sa_family == AF_INET ?
+ sizeof(struct sockaddr_in) :
+ notice->z_sender_sockaddr.sa.sa_family == AF_INET6 ?
+ sizeof(struct sockaddr_in6) :
+ sizeof(notice->z_sender_sockaddr), ARES_NI_LOOKUPHOST,
+ notice_callback, notice);
#else
getnameinfo((const struct sockaddr *)&(notice->z_sender_sockaddr),
- sizeof(notice->z_sender_sockaddr),
- node, sizeof(node), NULL, 0, 0);
+ sizeof(notice->z_sender_sockaddr),
+ node, sizeof(node), NULL, 0, 0);
process_notice(notice, node);
#ifdef CMU_ZWGCPLUS
/*
static void
notice_callback(void *arg,
- int status,
- int timeouts,
- struct hostent *fromhost)
+ int status,
+ int timeouts,
+ struct hostent *fromhost)
*/
static void
notice_callback(void *arg,
- int status,
- int timeouts,
- char *node,
- char *service)
+ int status,
+ int timeouts,
+ char *node,
+ char *service)
{
ZNotice_t *notice = (ZNotice_t *) arg;
static void
process_notice(ZNotice_t *notice,
- char *hostname)
+ char *hostname)
{
char *control_opcode;
control_opcode = decode_notice(notice, hostname);
if (control_opcode) {
#ifdef DEBUG
- printf("got control opcode <%s>.\n", control_opcode);
+ printf("got control opcode <%s>.\n", control_opcode);
#endif
- if (!strcasecmp(control_opcode, USER_REREAD)) {
- read_in_description_file();
- } else if (!strcasecmp(control_opcode, USER_SHUTDOWN))
- zwgc_shutdown();
- else if (!strcasecmp(control_opcode, USER_STARTUP)) {
+ if (!strcasecmp(control_opcode, USER_REREAD)) {
+ read_in_description_file();
+ } else if (!strcasecmp(control_opcode, USER_SHUTDOWN))
+ zwgc_shutdown();
+ else if (!strcasecmp(control_opcode, USER_STARTUP)) {
#ifdef DEBUG_MEMORY
- report_memory_usage(); /* <<<>>> */
+ report_memory_usage(); /* <<<>>> */
#endif
- zwgc_startup();
- } else if (!strcasecmp(control_opcode, USER_SUPPRESS)) {
- string class = get_field(notice->z_message,
- notice->z_message_len, 1);
- string instance = get_field(notice->z_message,
- notice->z_message_len, 2);
- string recipient = get_field(notice->z_message,
- notice->z_message_len, 3);
- punt(class, instance, recipient);
- free(class);
- free(instance);
- free(recipient);
- } else if (!strcasecmp(control_opcode, USER_UNSUPPRESS)) {
- string class = get_field(notice->z_message,
- notice->z_message_len, 1);
- string instance = get_field(notice->z_message,
- notice->z_message_len, 2);
- string recipient = get_field(notice->z_message,
- notice->z_message_len, 3);
- unpunt(class, instance, recipient);
- free(class);
- free(instance);
- free(recipient);
+ zwgc_startup();
+ } else if (!strcasecmp(control_opcode, USER_SUPPRESS)) {
+ string class = get_field(notice->z_message,
+ notice->z_message_len, 1);
+ string instance = get_field(notice->z_message,
+ notice->z_message_len, 2);
+ string recipient = get_field(notice->z_message,
+ notice->z_message_len, 3);
+ punt(class, instance, recipient);
+ free(class);
+ free(instance);
+ free(recipient);
+ } else if (!strcasecmp(control_opcode, USER_UNSUPPRESS)) {
+ string class = get_field(notice->z_message,
+ notice->z_message_len, 1);
+ string instance = get_field(notice->z_message,
+ notice->z_message_len, 2);
+ string recipient = get_field(notice->z_message,
+ notice->z_message_len, 3);
+ unpunt(class, instance, recipient);
+ free(class);
+ free(instance);
+ free(recipient);
#ifdef CMU_ZCTL_PUNT
} else if (!strcasecmp(control_opcode, USER_LIST_SUPPRESSED)) {
- struct sockaddr_in old, to;
- int retval;
-
- if (!notice->z_port) {
- printf("zwgc: can't reply to LIST-SUPPRESSED request\n");
- return;
- }
- memset((char *) &punt_reply, 0, sizeof(ZNotice_t));
- punt_reply.z_kind = CLIENTACK;
- punt_reply.z_class = WG_CTL_CLASS;
- punt_reply.z_class_inst = "WG_REPLY";
- punt_reply.z_recipient = "zctl?";
- punt_reply.z_sender = "Zwgc";
- punt_reply.z_default_format = "";
- punt_reply.z_opcode = USER_LIST_SUPPRESSED;
- punt_reply.z_port = notice->z_port;
- punt_reply.z_message = NULL;
- punt_reply.z_message_len = 0;
-
- if (puntable_addresses_dict) {
- int_dictionary_Enumerate(puntable_addresses_dict,
- create_punt_reply);
- }
-
- old = ZGetDestAddr();
- to = old;
-
- to.sin_port = notice->z_port;
- if ((retval = ZSetDestAddr(&to)) != ZERR_NONE) {
- com_err("zwgc",retval,"while setting destination address");
- exit(1);
- }
-
- ZSendNotice(&punt_reply, ZNOAUTH);
-
- if ((retval = ZSetDestAddr(&old)) != ZERR_NONE) {
- com_err("zwgc",retval,"while resetting destination address");
- exit(1);
- }
-
- if (punt_reply.z_message) {
- free(punt_reply.z_message);
- punt_reply.z_message = NULL;
- }
+ struct sockaddr_in old, to;
+ int retval;
+
+ if (!notice->z_port) {
+ printf("zwgc: can't reply to LIST-SUPPRESSED request\n");
+ return;
+ }
+ memset((char *) &punt_reply, 0, sizeof(ZNotice_t));
+ punt_reply.z_kind = CLIENTACK;
+ punt_reply.z_class = WG_CTL_CLASS;
+ punt_reply.z_class_inst = "WG_REPLY";
+ punt_reply.z_recipient = "zctl?";
+ punt_reply.z_sender = "Zwgc";
+ punt_reply.z_default_format = "";
+ punt_reply.z_opcode = USER_LIST_SUPPRESSED;
+ punt_reply.z_port = notice->z_port;
+ punt_reply.z_message = NULL;
+ punt_reply.z_message_len = 0;
+
+ if (puntable_addresses_dict) {
+ int_dictionary_Enumerate(puntable_addresses_dict,
+ create_punt_reply);
+ }
+
+ old = ZGetDestAddr();
+ to = old;
+
+ to.sin_port = notice->z_port;
+ if ((retval = ZSetDestAddr(&to)) != ZERR_NONE) {
+ com_err("zwgc",retval,"while setting destination address");
+ exit(1);
+ }
+
+ ZSendNotice(&punt_reply, ZNOAUTH);
+
+ if ((retval = ZSetDestAddr(&old)) != ZERR_NONE) {
+ com_err("zwgc",retval,"while resetting destination address");
+ exit(1);
+ }
+
+ if (punt_reply.z_message) {
+ free(punt_reply.z_message);
+ punt_reply.z_message = NULL;
+ }
#endif
- } else if (!strcasecmp(control_opcode, USER_EXIT)) {
- signal_exit(0);
- } else
- printf("zwgc: unknown control opcode %s.\n", control_opcode);
+ } else if (!strcasecmp(control_opcode, USER_EXIT)) {
+ signal_exit(0);
+ } else
+ printf("zwgc: unknown control opcode %s.\n", control_opcode);
- goto cleanup;
+ goto cleanup;
}
if (!zwgc_active) {
#ifdef DEBUG
- if (zwgc_debug)
- printf("NON-ACTIVE: PUNTED <%s>!!!!\n", notice->z_class_inst);
+ if (zwgc_debug)
+ printf("NON-ACTIVE: PUNTED <%s>!!!!\n", notice->z_class_inst);
#endif
- goto cleanup;
+ goto cleanup;
}
if (puntable_address_p(notice->z_class,
- notice->z_class_inst,
- notice->z_recipient)) {
+ notice->z_class_inst,
+ notice->z_recipient)) {
#ifdef DEBUG
- if (zwgc_debug)
- printf("PUNTED <%s>!!!!\n", notice->z_class_inst);
+ if (zwgc_debug)
+ printf("PUNTED <%s>!!!!\n", notice->z_class_inst);
#endif
- goto cleanup;
+ goto cleanup;
}
exec_process_packet(program, notice);
sa.sa_flags = 0;
if (dofork) {
- sa.sa_handler = SIG_IGN;
- sigaction(SIGINT, &sa, (struct sigaction *)0);
- sigaction(SIGTSTP, &sa, (struct sigaction *)0);
- sigaction(SIGQUIT, &sa, (struct sigaction *)0);
- sigaction(SIGTTOU, &sa, (struct sigaction *)0);
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGINT, &sa, (struct sigaction *)0);
+ sigaction(SIGTSTP, &sa, (struct sigaction *)0);
+ sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+ sigaction(SIGTTOU, &sa, (struct sigaction *)0);
} else {
- /* clean up on SIGINT; exiting on logout is the user's problem, now. */
- sa.sa_handler = signal_exit;
- sigaction(SIGINT, &sa, (struct sigaction *)0);
+ /* clean up on SIGINT; exiting on logout is the user's problem, now. */
+ sa.sa_handler = signal_exit;
+ sigaction(SIGINT, &sa, (struct sigaction *)0);
}
/* behavior never changes */
#else /* !POSIX */
if (dofork) {
- /* Ignore keyboard signals if forking. Bad things will happen. */
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
- signal(SIGTTOU, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
+ /* Ignore keyboard signals if forking. Bad things will happen. */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGTSTP, SIG_IGN);
+ signal(SIGTTOU, SIG_IGN);
+ signal(SIGQUIT, SIG_IGN);
} else {
- /* clean up on SIGINT; exiting on logout is the user's problem, now. */
- signal(SIGINT, signal_exit);
+ /* clean up on SIGINT; exiting on logout is the user's problem, now. */
+ signal(SIGINT, signal_exit);
}
/* behavior never changes */
signal(SIGTERM, signal_exit);
signal(SIGHUP, signal_exit);
signal(SIGCHLD, signal_child);
- signal(SIGPIPE, SIG_IGN); /* so that Xlib gets an error */
+ signal(SIGPIPE, SIG_IGN); /* so that Xlib gets an error */
signal(SIGUSR1, signal_usr1);
#endif
}
i = fork();
if (i) {
if (i < 0) {
- perror("zwgc: cannot fork, aborting:");
- exit(1);
+ perror("zwgc: cannot fork, aborting:");
+ exit(1);
}
exit(0);
}
-}
+}
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: notice.c 2295 2009-03-15 22:13:16Z kcr $
+ * $Id: notice.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_notice_c[] = "$Id: notice.c 2295 2009-03-15 22:13:16Z kcr $";
+static const char rcsid_notice_c[] = "$Id: notice.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
var_set_variable("instance", notice->z_class_inst);
var_set_variable("opcode", notice->z_opcode);
var_set_variable("default", notice->z_default_format);
- var_set_variable("charset", (char *)ZCharsetToString(notice->z_charset)); /*XXX const*/
+ var_set_variable("notice_charset", (char *)ZCharsetToString(notice->z_charset)); /*XXX const*/
var_set_variable("recipient",
(notice->z_recipient[0] ? notice->z_recipient : "*"));
var_set_variable("fullsender", notice->z_sender);
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: standard_ports.c 2328 2009-03-22 17:34:39Z kcr $
+ * $Id: standard_ports.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_standard_ports_c[] = "$Id: standard_ports.c 2328 2009-03-22 17:34:39Z kcr $";
+static const char rcsid_standard_ports_c[] = "$Id: standard_ports.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
string default_port = "";
char **new, **current;
int fallback;
+ char *charset = NULL;
/*
* Process argument list handling "-disable <port>" and
* "-default <output port>" arguments, as well as "-ttymode"
+ * and -charset, because tty_filter_init gets run twice
*/
for (new=current=argv+1; *current; current++) {
if (string_Eq((string) *current, "-disable")) {
p = get_standard_port_info((string) *current);
if (p)
p->port_setup_status = DEFAULT_OK;
+ } else if (string_Eq((string) *current, "-charset")) {
+ current++; *pargc -= 2;
+ if (!*current)
+ usage();
+ charset = *current;
} else if (string_Eq((string) *current, "-ttymode")) {
default_port = (string) "tty";
(*pargc)--;
}
*new = *current;
+ var_set_variable_then_free_value("tty_charset", (string)ZGetCharsetString(charset));
+
fallback = boolean_value_of(ZGetVariable("fallback"));
/*
* Initialize all non-disabled ports. If a port reports an error,
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: tty_filter.c 2144 2008-01-21 07:57:32Z kcr $
+ * $Id: tty_filter.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_tty_filter_c[] = "$Id: tty_filter.c 2144 2008-01-21 07:57:32Z kcr $";
+static const char rcsid_tty_filter_c[] = "$Id: tty_filter.c 2432 2009-04-18 18:30:45Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
#endif
#endif
+#include <zephyr/zephyr.h>
+
#include "new_memory.h"
#include "new_string.h"
+#include "variables.h"
#include "string_dictionary_aux.h"
#include "formatter.h"
#include "zwgc.h"
int ex;
string_dictionary_binding *b;
int isrealtty = string_Eq(drivername, "tty");
-#ifdef HAVE_TERMIOS_H
struct termios tbuf;
ospeed = (tcgetattr(STDIN_FILENO, &tbuf) == 0) ? cfgetospeed(&tbuf) : 2400;
-#else
- struct sgttyb sgttyb;
-
- ospeed = (ioctl(0, TIOCGETP, &sgttyb) == 0) ? sgttyb.sg_ospeed : 2400;
-#endif
if (termcap_dict == (string_dictionary) NULL)
termcap_dict = string_dictionary_Create(7);
unsigned int ignore: 1;
} tty_str_info;
+const char *info_default_string = "";
+
static void
free_info(tty_str_info *info)
{
while (info) {
next_info = info->next;
+ if (info->str != info_default_string)
+ free(info->str);
free(info);
info = next_info;
}
return 0;
}
+static void
+zwgc_transliterate(char *in, int inlen, char **out, int *outlen){
+ int retval = 0;
+ string notice_charset = var_get_variable("notice_charset");
+ string tty_charset = var_get_variable("tty_charset");
+
+ if (string_Eq(notice_charset, "UNKNOWN") ||
+ string_Eq(notice_charset, tty_charset) ||
+ (retval = ZTransliterate(in, inlen,
+ notice_charset, tty_charset,
+ out, outlen)) != 0) {
+ *out = string_CreateFromData(in, inlen);
+ *outlen = inlen;
+ }
+ if (retval != 0)
+ var_set_variable("error", strerror(retval));
+}
+
static tty_str_info *
convert_desc_to_tty_str_info(desctype *desc)
{
tty_str_info current_mode;
current_mode.next = NULL;
- current_mode.str = "";
+ current_mode.str = info_default_string; /* "" */
current_mode.len = 0;
current_mode.alignment = 'l';
current_mode.bold_p = 0;
}
if (desc->code == DT_STR) {
/* just combine string info with current mode: */
- temp->str = desc->str;
- temp->len = desc->len;
+ zwgc_transliterate(desc->str, desc->len, &temp->str, &temp->len);
} else if (desc->code == DT_NL) {
/* make the new block a ' ' alignment block with an empty string */
temp->alignment = ' ';
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: xcut.c 2336 2009-03-22 18:59:56Z kcr $
+ * $Id: xcut.c 2436 2009-04-20 23:51:04Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
#include <sysdep.h>
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_xcut_c[] = "$Id: xcut.c 2336 2009-03-22 18:59:56Z kcr $";
+static const char rcsid_xcut_c[] = "$Id: xcut.c 2436 2009-04-20 23:51:04Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
x_gram *gram)
{
struct timeval now;
+ int i;
gettimeofday(&now,NULL);
if ((gram->can_die.tv_sec == 0) ||
XDestroyWindow(dpy, w);
delete_gram(gram);
free(gram->text);
+ for (i=0; i < gram->numblocks; i++)
+ free(gram->blocks[i].wstr);
free(gram->blocks);
#ifdef CMU_ZWGCPLUS
if (gram->notice)
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
- * $Id: xmark.c 2336 2009-03-22 18:59:56Z kcr $
+ * $Id: xmark.c 2441 2009-04-21 15:04:51Z kcr@ATHENA.MIT.EDU $
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
*/
#if (!defined(lint) && !defined(SABER))
-static const char rcsid_xmark_c[] = "$Id: xmark.c 2336 2009-03-22 18:59:56Z kcr $";
+static const char rcsid_xmark_c[] = "$Id: xmark.c 2441 2009-04-21 15:04:51Z kcr@ATHENA.MIT.EDU $";
#endif
#include <zephyr/mit-copyright.h>
void
xmarkSetBound(x_gram *gram,
- int x,
- int y,
- int which)
+ int x,
+ int y,
+ int which)
{
- int i,xofs,yofs;
- XFontStruct *font;
+ int i, xofs, yofs;
+ XFontSet font;
xblock *xb;
- unsigned char *s;
+ int num_chars;
+ XRectangle *ink, *logical;
#ifdef MARK_DEBUG
#define RETURN \
if ((oldblock[which] != markblock[which]) || \
(oldpixel[which] != markpixel[which])) { \
printf("----- SetBound:\noldblock[%d]=%d, oldpixel[%d]=%d\nmarkblock[%d]=%d, markpixel[%d]=%d\n-----", \
- which,oldblock[which],which,oldpixel[which], \
- which,markblock[which],which,markpixel[which]); \
+ which,oldblock[which],which,oldpixel[which], \
+ which,markblock[which],which,markpixel[which]); \
} \
return
#else
/* Start at the top, fastforward to first span not too high. */
for (i=0,xb=gram->blocks ;
- (i<gram->numblocks) && (xb->y2 < y) ;
- i++,xb++) ;
+ (i<gram->numblocks) && (xb->y2 < y) ;
+ i++,xb++) ;
/* the point is after the end */
if (i==gram->numblocks) {
for (yofs=xb->y1;(i<gram->numblocks) && (xb->y1 == yofs);i++,xb++) {
if (x <= xb->x2) {
- markblock[which]=i;
-
- xofs=xb->x1;
- if ((x < xofs) || (y < xb->y1)) {
- markchar[which]=0;
- RETURN;
- }
- font=get_fontst_from_fid(xb->fid);
- for (i=0,s=(unsigned char *)((gram->text)+(xb->strindex));
- xofs<x && i<xb->strlen;
- i++,s++) {
- /* if font->per_char is NULL, then we should use min_bounds */
- short usewidth = font->per_char ? font->per_char[*s - font->min_char_or_byte2].width : font->min_bounds.width;
- if (x <= (xofs+=usewidth)) {
- markchar[which]=i;
- markpixel[which]=xofs - xb->x1 - usewidth;
- RETURN;
- }
- }
+ markblock[which]=i;
+
+ xofs=xb->x1;
+ if ((x < xofs) || (y < xb->y1)) {
+ markchar[which]=0;
+ RETURN;
+ }
+ font = xb->font;
+#ifdef X_HAVE_UTF8_STRING
+ Xutf8TextPerCharExtents(font, xb->wstr, xb->wlen,
+ NULL, NULL, -1, &num_chars, NULL, NULL);
+#else
+ XwcTextPerCharExtents(font, (XChar2b *)xb->wstr, xb->wlen,
+ NULL, NULL, -1, &num_chars, NULL, NULL);
+#endif
+ ink = malloc(num_chars * sizeof(XRectangle));
+ logical = malloc(num_chars * sizeof(XRectangle));
+#ifdef X_HAVE_UTF8_STRING
+ Xutf8TextPerCharExtents(font, xb->wstr, xb->wlen,
+ ink, logical, num_chars, &num_chars, NULL, NULL);
+#else
+ XwcTextPerCharExtents(font, (XChar2b *)xb->wstr, xb->wlen,
+ ink, logical, num_chars, &num_chars, NULL, NULL);
+#endif
+ for (i=0;i<num_chars;i++) {
+ if (x <= xofs + logical[i].x + logical[i].width) {
+ markchar[which]=i;
+ markpixel[which]=xofs + logical[i].x - xb->x1;
+ free(ink);
+ free(logical);
+ RETURN;
+ }
+ }
+ free(ink);
+ free(logical);
}
}
/* needs both bounds to be valid (!= -1) */
static int
xmarkNearest(int x,
- int y)
+ int y)
{
int middle;
else {
middle=(ENDCHAR+STARTCHAR)/2;
if (markchar[XMARK_TEMP_BOUND] < middle)
- return(XMARK_START_BOUND);
+ return(XMARK_START_BOUND);
else
- return(XMARK_END_BOUND);
+ return(XMARK_END_BOUND);
}
}
void
xmarkExpose(Display *dpy,
- Window w,
- x_gram *gram,
- unsigned int b1,
- unsigned int p1,
- unsigned int b2,
- unsigned int p2)
+ Window w,
+ x_gram *gram,
+ unsigned int b1,
+ unsigned int p1,
+ unsigned int b2,
+ unsigned int p2)
{
#define swap(x,y) temp=(x); (x)=(y); (y)=temp
int i,temp;
for (i=b1;i<=b2;i++) {
if (b1==b2) {
- expose.x=gram->blocks[i].x1+p1;
- expose.y=gram->blocks[i].y1;
- expose.width=p2-p1;
- expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
- expose.count=0;
+ expose.x=gram->blocks[i].x1+p1;
+ expose.y=gram->blocks[i].y1;
+ expose.width=p2-p1;
+ expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
+ expose.count=0;
} else if (i==b1) {
- expose.x=gram->blocks[i].x1+p1;
- expose.y=gram->blocks[i].y1;
- expose.width=gram->blocks[i].x2-p1;
- expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
- expose.count=b2-i;
+ expose.x=gram->blocks[i].x1+p1;
+ expose.y=gram->blocks[i].y1;
+ expose.width=gram->blocks[i].x2-p1;
+ expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
+ expose.count=b2-i;
} else if (i==b2) {
- expose.x=gram->blocks[i].x1;
- expose.y=gram->blocks[i].y1;
- expose.width=p2;
- expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
- expose.count=b2-i;
+ expose.x=gram->blocks[i].x1;
+ expose.y=gram->blocks[i].y1;
+ expose.width=p2;
+ expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
+ expose.count=b2-i;
} else {
- expose.x=gram->blocks[i].x1;
- expose.y=gram->blocks[i].y1;
- expose.width=gram->blocks[i].x2-gram->blocks[i].x1;
- expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
- expose.count=b2-i;
+ expose.x=gram->blocks[i].x1;
+ expose.y=gram->blocks[i].y1;
+ expose.width=gram->blocks[i].x2-gram->blocks[i].x1;
+ expose.height=gram->blocks[i].y2-gram->blocks[i].y1;
+ expose.count=b2-i;
}
#ifdef MARK_DEBUG
if (expose.width && expose.height) {
printf("---- markExpose:\nb1=%d p1=%d b2=%d p2=%d\n",b1,p1,b2,p2);
printf("x=%d y=%d w=%d h=%d\n-----",
- expose.x,expose.y,expose.width,expose.height);
+ expose.x,expose.y,expose.width,expose.height);
}
#endif
if ((expose.width && expose.height) || (expose.count == 0))
- XSendEvent(dpy,w,True,ExposureMask,&event);
+ XSendEvent(dpy,w,True,ExposureMask,&event);
}
}
void
xmarkRedraw(Display *dpy,
- Window w,
- x_gram *gram,
- int range)
+ Window w,
+ x_gram *gram,
+ int range)
{
#define ob1 ((unsigned int) oldblock[XMARK_START_BOUND])
#define ob2 ((unsigned int) oldblock[XMARK_END_BOUND])
}
#ifdef DEBUG
else {
- printf("xmarkRedraw: This shouldn't happen!\n");
+ printf("xmarkRedraw: This shouldn't happen!\n");
}
#endif
}
return(XMARK_END_BOUND);
else {
if (STARTCHAR > ENDCHAR)
- return(XMARK_START_BOUND);
+ return(XMARK_START_BOUND);
else if (STARTCHAR < ENDCHAR)
- return(XMARK_END_BOUND);
+ return(XMARK_END_BOUND);
else
- return(XMARK_END_BOUND);
+ return(XMARK_END_BOUND);
}
}
int
xmarkExtendFromFirst(x_gram *gram,
- int x,
- int y)
+ int x,
+ int y)
{
if (markgram != gram) {
xmarkClear();
int
xmarkExtendFromNearest(x_gram *gram,
- int x,
- int y)
+ int x,
+ int y)
{
int bound;
if (xmarkValid()) {
if (xmarkSecond() == XMARK_END_BOUND) {
- startblock=STARTBLOCK;
- endblock=ENDBLOCK;
- startchar=STARTCHAR;
- endchar=ENDCHAR;
+ startblock=STARTBLOCK;
+ endblock=ENDBLOCK;
+ startchar=STARTCHAR;
+ endchar=ENDCHAR;
} else {
- startblock=ENDBLOCK;
- endblock=STARTBLOCK;
- startchar=ENDCHAR;
- endchar=STARTCHAR;
+ startblock=ENDBLOCK;
+ endblock=STARTBLOCK;
+ startchar=ENDCHAR;
+ endchar=STARTCHAR;
}
for (i=startblock; i<=endblock; i++) {
- if (last_y != -1 && last_y != markgram->blocks[i].y)
- text_so_far = string_Concat2(text_so_far, "\n");
- index = markgram->blocks[i].strindex;
- len = markgram->blocks[i].strlen;
- if (startblock == endblock)
- temp = string_CreateFromData(text+index+startchar,
- endchar-startchar);
- else if (i==startblock)
- temp = string_CreateFromData(text+index+startchar,len-startchar);
- else if (i==endblock)
- temp = string_CreateFromData(text+index,endchar);
- else
- temp = string_CreateFromData(text+index,len);
- text_so_far = string_Concat2(text_so_far, temp);
- free(temp);
- last_y = markgram->blocks[i].y;
+ if (last_y != -1 && last_y != markgram->blocks[i].y)
+ text_so_far = string_Concat2(text_so_far, "\n");
+ index = markgram->blocks[i].strindex;
+ len = markgram->blocks[i].strlen;
+ if (startblock == endblock)
+ temp = string_CreateFromData(text+index+startchar,
+ endchar-startchar);
+ else if (i==startblock)
+ temp = string_CreateFromData(text+index+startchar,len-startchar);
+ else if (i==endblock)
+ temp = string_CreateFromData(text+index,endchar);
+ else
+ temp = string_CreateFromData(text+index,len);
+ text_so_far = string_Concat2(text_so_far, temp);
+ free(temp);
+ last_y = markgram->blocks[i].y;
}
}
}
#endif /* X_DISPLAY_MISSING */
-
+++ /dev/null
-/* This file is part of the Project Athena Zephyr Notification System.
- * It is one of the source files comprising zwgc, the Zephyr WindowGram
- * client.
- *
- * Created by: Marc Horowitz <marc@athena.mit.edu>
- *
- * $Id: xshow.c 2336 2009-03-22 18:59:56Z kcr $
- *
- * Copyright (c) 1989 by the Massachusetts Institute of Technology.
- * For copying and distribution information, see the file
- * "mit-copyright.h".
- */
-
-#include <sysdep.h>
-
-#if (!defined(lint) && !defined(SABER))
-static const char rcsid_xshow_c[] = "$Id: xshow.c 2336 2009-03-22 18:59:56Z kcr $";
-#endif
-
-#include <zephyr/mit-copyright.h>
-
-#ifndef X_DISPLAY_MISSING
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xresource.h>
-#include <zephyr/zephyr.h>
-#include "pointer_dictionary.h"
-#include "new_memory.h"
-#include "new_string.h"
-#include "formatter.h"
-#include "variables.h"
-#include "zwgc.h"
-#include "X_driver.h"
-#include "X_fonts.h"
-#include "X_gram.h"
-#include "xmode_stack.h"
-#ifdef CMU_ZWGCPLUS
-#include <zephyr/zephyr.h>
-#include "xrevstack.h"
-#include "plus.h"
-#include "xcut.h"
-#endif
-
-#define max(a,b) ((a)>(b)?(a):(b))
-
-XContext desc_context;
-
-extern int internal_border_width;
-extern unsigned long default_bgcolor;
-extern unsigned long default_fgcolor;
-
-void
-xshowinit(void)
-{
- desc_context = XUniqueContext();
-}
-
-struct res_dict_type {
- pointer_dictionary dict;
- char * resname_suffix;
- char * resclass;
-};
-
-static char *
-xres_get_resource(struct res_dict_type *restype,
- char *style)
-{
- char *desc;
- pointer_dictionary_binding *binding;
- int exists;
- char *value;
-
- desc=string_Concat("style.", style);
- desc=string_Concat2(desc, restype->resname_suffix);
-
- if (!restype->dict)
- restype->dict = pointer_dictionary_Create(37);
- binding = pointer_dictionary_Define(restype->dict, desc, &exists);
-
- if (exists) {
- free(desc);
- return((string) binding->value);
- } else {
- value=get_string_resource(desc, restype->resclass);
- free(desc);
- if (value==NULL)
- pointer_dictionary_Delete(restype->dict, binding);
- else
- binding->value=(pointer) value;
- return value; /* If resource returns NULL, return NULL also */
- }
-}
-
-static struct res_dict_type geometry_resources = {
- NULL, ".geometry", "StyleKey.Style1.Style2.Style3.GeometryKey",
-};
-
-static struct res_dict_type bgcolor_resources = {
- NULL, ".background", "StyleKey.Style1.Style2.Style3.BackgroundKey",
-};
-
-#define xres_get_geometry(style) xres_get_resource(&geometry_resources,style)
-#define xres_get_bgcolor(style) xres_get_resource(&bgcolor_resources,style)
-
-static struct res_dict_type fgcolor_resources = {
- NULL, ".foreground",
- "StyleKey.Style1.Style2.Style3.SubstyleKey.Substyle.ForegroundKey",
-};
-
-/*ARGSUSED*/
-char *
-mode_to_colorname (Display *dpy,
- char *style,
- xmode *mode)
-{
- char *desc, *result;
-
- desc = string_Concat (style, ".substyle.");
- desc = string_Concat2 (desc, mode->substyle);
- result = xres_get_resource (&fgcolor_resources, desc);
- free (desc);
- return result;
-}
-
-void
-fixup_and_draw(Display *dpy,
- char *style,
- xauxblock *auxblocks,
- xblock *blocks,
- int num,
- xlinedesc *lines,
- int numlines,
- int beepcount)
-{
- int gram_xalign = 1;
- int gram_yalign = 1;
- int gram_xpos, gram_ypos, gram_xsize, gram_ysize;
-
- x_gram *gram;
- int strindex = 0;
-
- int line, block=0;
- int maxwidth=0, chars=0, maxascent, maxdescent;
- int ssize, lsize,csize, rsize, width = 0;
- int i, ascent, descent;
-
- int yofs = internal_border_width;
- int lofs, cofs, rofs;
- int ystart,yend;
-
- char *bgstr, *geometry, xpos[10], ypos[10], xfrom, yfrom;
-
- gram = (x_gram *)malloc(sizeof(x_gram));
-
- /* Find total lengths of left, center, and right parts. Also find the
- length of the longest line and the total number of characters. */
-
- for (line=0; line<numlines; line++) {
- lsize = csize = rsize = 0;
- maxascent = maxdescent = 0;
-
- /* add up sizes for each block, get max ascent and descent */
-
- for (i=0; i<lines[line].numblock; i++,block++) {
- chars += auxblocks[block].len;
- ssize = XTextWidth(auxblocks[block].font, auxblocks[block].str,
- auxblocks[block].len);
- auxblocks[block].width = ssize;
- ascent = auxblocks[block].font->ascent;
- descent = auxblocks[block].font->descent;
- if (ascent>maxascent)
- maxascent = ascent;
- if (descent>maxdescent)
- maxdescent = descent;
- switch (auxblocks[block].align) {
- case LEFTALIGN:
- lsize += ssize;
- break;
-
- case CENTERALIGN:
- csize += ssize;
- break;
-
- case RIGHTALIGN:
- rsize += ssize;
- break;
- }
- }
-
- /* save what we need to do size fixups */
-
- if (maxascent>lines[line].ascent)
- lines[line].ascent = maxascent;
- if (maxdescent>lines[line].descent)
- lines[line].descent = maxdescent;
- lines[line].lsize = lsize;
- lines[line].csize = csize;
- lines[line].rsize = rsize;
-
- /* get width of line and see if it is bigger than the max width */
-
- switch ((lsize?1:0)+(csize?2:0)+(rsize?4:0)) {
-#ifdef DEBUG
- default:
- abort();
-#endif
-
- case 0:
- width = 0;
- break;
-
- case 1:
- width = lsize;
- break;
-
- case 2:
- width = csize;
- break;
-
- case 3:
- /* in all these cases, we just want to add the width of *any*
- space, so the first font will do just fine. */
- /* XXX implicit assumption that a line must have at least one
- block, so that there is indeed a reasonable font in
- auxblocks[0].font */
- width = lsize*2+csize+XTextWidth(auxblocks[0].font," ",1);
- break;
-
- case 4:
- width = rsize;
- break;
-
- case 5:
- width = lsize+rsize+XTextWidth(auxblocks[0].font, " ", 1);
- break;
-
- case 6:
- width = csize+rsize*2+XTextWidth(auxblocks[0].font, " ", 1);
- break;
-
- case 7:
- width = max(lsize,rsize)*2+csize+
- XTextWidth(auxblocks[0].font," ",1)*2;
- break;
- }
- if (width>maxwidth)
- maxwidth = width;
- }
-
- /* fixup x,y for each block, create big string and indices into it */
- /* set x1,y1,x2,y2 of each block also. */
-
- gram->text = (char *)malloc(chars);
- block = 0;
-
- for (line=0; line<numlines; line++) {
- lofs = internal_border_width;
- cofs = ((maxwidth-lines[line].csize)>>1) + internal_border_width;
- rofs = maxwidth-lines[line].rsize + internal_border_width;
- ystart = yofs;
- yofs += lines[line].ascent;
- yend = yofs+lines[line].descent+1; /* +1 because lines look scrunched
- without it. */
-
- for (i=0; i<lines[line].numblock; i++,block++) {
- blocks[block].fid = auxblocks[block].font->fid;
- switch (auxblocks[block].align) {
- case LEFTALIGN:
- blocks[block].x = lofs;
- blocks[block].x1 = lofs;
- lofs += auxblocks[block].width;
- blocks[block].x2 = lofs;
- break;
-
- case CENTERALIGN:
- blocks[block].x = cofs;
- blocks[block].x1 = cofs;
- cofs += auxblocks[block].width;
- blocks[block].x2 = cofs;
- break;
-
- case RIGHTALIGN:
- blocks[block].x = rofs;
- blocks[block].x1 = rofs;
- rofs += auxblocks[block].width;
- blocks[block].x2 = rofs;
- break;
- }
- blocks[block].y = yofs;
- blocks[block].y1 = ystart;
- blocks[block].y2 = yend;
- blocks[block].strindex = strindex;
- blocks[block].strlen = auxblocks[block].len;
- strncpy(gram->text+strindex, auxblocks[block].str,
- auxblocks[block].len);
- strindex += blocks[block].strlen;
- }
-
- yofs = yend;
-
- }
-
- if ((geometry = var_get_variable("X_geometry")),(geometry[0]=='\0'))
- if ((geometry = xres_get_geometry(style))==NULL)
- if ((geometry = var_get_variable("default_X_geometry")),
- (geometry[0]=='\0'))
- geometry = "+0+0";
- sscanf(geometry, "%c%[0123456789c]%c%[0123456789c]", &xfrom, xpos,
- &yfrom, ypos);
-
- if (xpos[0]=='c') {
- gram_xalign = 0;
- gram_xpos = 0;
- } else
- gram_xpos = atoi(xpos);
- if (xfrom=='-')
- gram_xalign *= -1;
-
- if (ypos[0]=='c') {
- gram_yalign = 0;
- gram_ypos = 0;
- } else
- gram_ypos = atoi(ypos);
- if (yfrom=='-')
- gram_yalign *= -1;
-
- if ((bgstr = var_get_variable("X_background")),(bgstr[0]=='\0'))
- if ((bgstr = xres_get_bgcolor(style))==NULL)
- if ((bgstr = var_get_variable("default_X_background")),
- (bgstr[0]=='\0'))
- gram->bgcolor = default_bgcolor;
- if (bgstr && bgstr[0])
- gram->bgcolor = x_string_to_color(bgstr,default_bgcolor);
-
-
- gram_xsize = maxwidth+(internal_border_width<<1);
- gram_ysize = yofs+internal_border_width;
- gram->numblocks = num;
- gram->blocks = blocks;
-#ifdef CMU_ZWGCPLUS
- gram->notice = get_stored_notice();
-#endif
-
- x_gram_create(dpy, gram, gram_xalign, gram_yalign, gram_xpos,
- gram_ypos, gram_xsize, gram_ysize, beepcount);
-}
-
-/* Silly almost-but-not-quite-useless helper function */
-char *
-no_dots_downcase_var(char *str)
-{
- register char *var, *var2;
-
- var = string_Downcase(var_get_variable(str));
- var2 = var;
- while (*var++)
- if (*var == '.')
- *var = '_';
- return(var2);
-}
-
-#define MODE_TO_FONT(dpy,style,mode) \
- get_font((dpy),(style),(mode)->font?(mode)->font:(mode)->substyle, \
- (mode)->size, (mode)->bold+(mode)->italic*2)
-void
-xshow(Display *dpy,
- desctype *desc,
- int numstr,
- int numnl)
-{
- XFontStruct *font;
- xmode_stack modes = xmode_stack_create();
- xmode curmode;
- xlinedesc *lines;
- xblock *blocks;
- xauxblock *auxblocks;
- int nextblock=0;
- int line=0,linestart=0;
- char *style;
- int free_style = 0;
- int beepcount = 0;
-
- lines = (xlinedesc *)malloc(sizeof(xlinedesc)*(numnl+1));
-
- blocks = (xblock *)malloc(sizeof(xblock)*numstr);
- auxblocks = (xauxblock *)malloc(sizeof(xauxblock)*numstr);
-
- curmode.bold = 0;
- curmode.italic = 0;
- curmode.size = MEDIUM_SIZE;
- curmode.align = LEFTALIGN;
- curmode.expcolor = 0;
- curmode.substyle = string_Copy("default");
- curmode.font = NULL;
-
- style = var_get_variable("style");
- if (style[0] == '\0') {
- style = string_Concat(no_dots_downcase_var("class"),".");
- style = string_Concat2(style,no_dots_downcase_var("instance"));
- style = string_Concat2(style,".");
- style = string_Concat2(style,no_dots_downcase_var("sender"));
- string_Downcase(style);
- free_style = 1;
- }
-
- for (; desc->code!=DT_EOF; desc=desc->next) {
- switch (desc->code) {
- case DT_ENV:
- xmode_stack_push(modes, curmode);
- curmode.substyle = string_Copy(curmode.substyle);
- if (curmode.font)
- curmode.font = string_Copy(curmode.font);
-
-#define envmatch(string,length) ((desc->len==(length)) && (strncasecmp(desc->str,(string),(length))==0))
-
- if (envmatch("roman",5)) {
- curmode.bold = 0;
- curmode.italic = 0;
- } else if (envmatch("bold",4) || envmatch("b",1))
- curmode.bold = 1;
- else if (envmatch("italic",6)||envmatch("i",1))
- curmode.italic = 1;
- else if (envmatch("large",5))
- curmode.size = LARGE_SIZE;
- else if (envmatch("medium",6))
- curmode.size = MEDIUM_SIZE;
- else if (envmatch("small",5))
- curmode.size = SMALL_SIZE;
- else if (envmatch("left",4)||envmatch("l",1))
- curmode.align = LEFTALIGN;
- else if (envmatch("center",6)||envmatch("c",1))
- curmode.align = CENTERALIGN;
- else if (envmatch("right",5)||envmatch("r",1))
- curmode.align = RIGHTALIGN;
- else if (envmatch("beep",4))
- beepcount++;
- else if (envmatch("font",4)) {
- /* lookahead needed. desc->next->str should be the
- font name, and desc->next->next->code should be
- a DT_END*/
- if ((desc->next) &&
- (desc->next->next) &&
- (desc->next->code == DT_STR) &&
- (desc->next->next->code==DT_END)) {
-
- /* Since @font mutates the current environment, we have
- to pop the environment that this case usually pushes */
- free(curmode.substyle);
- curmode = xmode_stack_top(modes);
- xmode_stack_pop(modes);
-
- /* mutating... */
- curmode.size=SPECIAL_SIZE; /* This is an @font() */
- curmode.font=string_CreateFromData(desc->next->str,
- desc->next->len);
- /* skip over the rest of the @font */
- desc=desc->next->next;
- }
- } else if (envmatch("color",5)) {
- /* lookahead needed. desc->next->str should be the
- font name, and desc->next->next->code should be
- a DT_END*/
- if ((desc->next) &&
- (desc->next->next) &&
- (desc->next->code == DT_STR) &&
- (desc->next->next->code==DT_END)) {
- char *colorname;
-
- /* Since @font mutates the current environment, we have
- to pop the environment that this case usually pushes */
- free(curmode.substyle);
- curmode = xmode_stack_top(modes);
- xmode_stack_pop(modes);
-
- /* mutating... */
- colorname=string_CreateFromData(desc->next->str,
- desc->next->len);
- curmode.color = x_string_to_color(colorname,default_fgcolor);
- free(colorname);
- curmode.expcolor = 1;
- /* skip over the rest of the @font */
- desc=desc->next->next;
- }
- } else if (desc->len > 0) { /* avoid @{...} */
- free(curmode.substyle);
- if (curmode.font) {
- free(curmode.font);
- curmode.font = NULL;
- }
- curmode.substyle = string_CreateFromData(desc->str, desc->len);
- }
- break;
-
- case DT_STR:
- auxblocks[nextblock].align = curmode.align;
- auxblocks[nextblock].font = MODE_TO_FONT(dpy,style,&curmode);
- auxblocks[nextblock].str = desc->str;
- auxblocks[nextblock].len = desc->len;
- if (curmode.expcolor)
- blocks[nextblock].fgcolor = curmode.color;
- else
- blocks[nextblock].fgcolor =
- x_string_to_color(mode_to_colorname(dpy,style,&curmode),
- default_fgcolor);
- nextblock++;
- break;
-
- case DT_END:
- free(curmode.substyle);
- curmode = xmode_stack_top(modes);
- xmode_stack_pop(modes);
- break;
-
- case DT_NL:
- lines[line].startblock = linestart;
- lines[line].numblock = nextblock-linestart;
- font = MODE_TO_FONT(dpy,style,&curmode);
- lines[line].ascent = font->ascent;
- lines[line].descent = font->descent;
- line++;
- linestart = nextblock;
- break;
- }
- }
-
- /* case DT_EOF: will drop through to here. */
-
- if (linestart != nextblock) {
- lines[line].startblock = linestart;
- lines[line].numblock = nextblock-linestart;
- font = MODE_TO_FONT(dpy,style,&curmode);
- lines[line].ascent = 0;
- lines[line].descent = 0;
- line++;
- }
-
- free(curmode.substyle);
- fixup_and_draw(dpy, style, auxblocks, blocks, nextblock, lines, line,
- beepcount);
- free(lines);
- free(auxblocks);
- if (free_style)
- free(style);
-}
-
-static void
-xhandleevent(Display *dpy,
- Window w,
- XEvent *event)
-{
- x_gram *gram;
-
- if (XFindContext(dpy, w, desc_context, (caddr_t *)&gram))
- return;
-
- if (event->type == Expose)
- x_gram_expose(dpy, w, gram,&(event->xexpose));
- else
- xcut(dpy, event, desc_context);
-
- XFlush(dpy);
-}
-
-void
-x_get_input(Display *dpy)
-{
- XEvent event;
-
- dprintf1("Entering x_get_input(%x).\n",dpy);
-
- /*
- * Kludge to get around lossage in XPending:
- *
- * (the problem: XPending on a partial packet returns 0 without
- * reading in the packet. This causes a problem when the X server
- * dies in the middle of sending a packet.)
- */
- if (XPending(dpy)==0)
- XNoOp(dpy); /* Ensure server is still with us... */
-
- while (XPending(dpy)) {
- XNextEvent(dpy,&event);
- xhandleevent(dpy, event.xany.window, &event);
- }
-}
-
-#ifdef CMU_ZWGCPLUS
-void
-plus_window_deletions(ZNotice_t *notice)
-{
- x_gram *tmp, *fry;
- char *val;
- int done;
- static char class_nm[NAMESIZE], instance_nm[NAMESIZE], recip_nm[NAMESIZE];
-
- if (!dpy)
- return;
-
- val = var_get_variable("delete_window");
-
-#ifdef DEBUG_DELETION
- fprintf(stderr, "delete_window(%s)\n", val);
-#endif
- if (val) {
- if (!strcmp(val, "this")) {
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (tmp->notice == notice) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "s")) {
- /* I cheated. This is really sender, not class */
- strcpy(class_nm, notice->z_sender);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_sender, class_nm)) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "ns")) {
- /* I cheated. This is really sender, not class */
- strcpy(class_nm, notice->z_sender);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!!strcasecmp(((ZNotice_t *)(tmp->notice))->z_sender, class_nm)) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "r")) {
- strcpy(recip_nm, notice->z_recipient);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm)) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "nr")) {
- strcpy(recip_nm, notice->z_recipient);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!!strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm)) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "cir")) {
- strcpy(class_nm, notice->z_class);
- strcpy(instance_nm, notice->z_class_inst);
- strcpy(recip_nm, notice->z_recipient);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_class_inst, instance_nm)
- && !strcasecmp(((ZNotice_t *)(tmp->notice))->z_class, class_nm)
- && !strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm))
- {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "ci")) {
- strcpy(class_nm, notice->z_class);
- strcpy(instance_nm, notice->z_class_inst);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_class_inst, instance_nm)
- && !strcasecmp(((ZNotice_t *)(tmp->notice))->z_class, class_nm))
- {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "cr")) {
- strcpy(class_nm, notice->z_class);
- strcpy(recip_nm, notice->z_recipient);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_class, class_nm) &&
- !strcasecmp(((ZNotice_t *)(tmp->notice))->z_recipient, recip_nm))
- {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "c")) {
- strcpy(class_nm, notice->z_class);
- do {
- done = 1;
- tmp = bottom_gram;
- while (tmp) {
- if (!strcasecmp(((ZNotice_t *)(tmp->notice))->z_class, class_nm)) {
- fry = tmp;
- tmp = tmp->above;
- xdestroygram(dpy, fry->w, desc_context, fry);
- done = 0;
- } else {
- tmp = tmp->above;
- }
- }
- } while (!done);
- }
- else if (!strcmp(val, "all")) {
- while (bottom_gram) {
- xdestroygram(dpy, bottom_gram->w, desc_context, bottom_gram);
- }
- }
- }
-}
-#endif
-#endif /* X_DISPLAY_MISSING */
-
-.\" $Id: zwgc.1 2304 2009-03-17 13:22:22Z kcr $
+.\" $Id: zwgc.1 2370 2009-03-29 16:08:44Z kcr@ATHENA.MIT.EDU $
.\" # end of TP (cf }N below)
.\" # copied here, since we use @ in some of our tags, and that
.\" # messes up \w and \h
formats its output messages according to the commands in its
description file. The user's description file
.RI ( $HOME/.zwgc.desc
-by default, or whatever is specified by -f) is read, or the system file
+by default, or whatever is specified by \-f) is read, or the system file
is read if the user's does not exist.
.PP
Every time a notice is received,
The following sources are searched in order:
.nf
.in +5
-command-line arguments (-xrm)
+command-line arguments (\-xrm)
contents of file named by XENVIRONMENT environment variable
X server resource database (see \fIxrdb\fR(1))
application resources file
possible for your subscriptions to be lost. If \fIzctl retrieve\fR
returns nothing, then issue a \fIzctl load\fR command to re-subscribe
to your default set of subscriptions. If you use znol, then \fIznol
--q &\fR will restore the subscriptions you need for \fIznol\fR.
+\-q &\fR will restore the subscriptions you need for \fIznol\fR.
.PP
Portions of the text of a message may be selected for "pasting" into other X
applications by using the shift key in cooperation with the pointer
! For copying and distribution information, see the file
! "mit-copyright.h".
!
-! $Id: zwgc_resources 2091 2007-12-20 01:17:23Z kcr $
+! $Id: zwgc_resources 2438 2009-04-21 05:10:38Z kcr@ATHENA.MIT.EDU $
!
!
! Zwgc application specific global resources:
! 80, 100, 120, 140, 180, and 240. This family used to be courier.
!
-*fontfamily.default.small.roman: -adobe-courier-medium-r-*-80-*-m-*
-*fontfamily.default.small.bold: -adobe-courier-bold-r-*-80-*-m-*
-*fontfamily.default.small.italic: -adobe-courier-medium-o-*-80-*-m-*
-*fontfamily.default.small.bolditalic: -adobe-courier-bold-o-*-80-*-m-*
+*fontfamily.default.small.roman: *-courier-medium-r-*-80-*-m-*,*
+*fontfamily.default.small.bold: *-courier-bold-r-*-80-*-m-*,*
+*fontfamily.default.small.italic: *-courier-medium-o-*-80-*-m-*,*
+*fontfamily.default.small.bolditalic: *-courier-bold-o-*-80-*-m-*,*
-*fontfamily.default.medium.roman: -adobe-courier-medium-r-*-120-*-m-*
-*fontfamily.default.medium.bold: -adobe-courier-bold-r-*-120-*-m-*
-*fontfamily.default.medium.italic: -adobe-courier-medium-o-*-120-*-m-*
-*fontfamily.default.medium.bolditalic: -adobe-courier-bold-o-*-120-*-m-*
+*fontfamily.default.medium.roman: *-courier-medium-r-*-120-*-m-*,*
+*fontfamily.default.medium.bold: *-courier-bold-r-*-120-*-m-*,*
+*fontfamily.default.medium.italic: *-courier-medium-o-*-120-*-m-*,*
+*fontfamily.default.medium.bolditalic: *-courier-bold-o-*-120-*-m-*,*
-*fontfamily.default.large.roman: -adobe-courier-medium-r-*-240-*-m-*
-*fontfamily.default.large.bold: -adobe-courier-bold-r-*-240-*-m-*
-*fontfamily.default.large.italic: -adobe-courier-medium-o-*-240-*-m-*
-*fontfamily.default.large.bolditalic: -adobe-courier-bold-o-*-240-*-m-*
+*fontfamily.default.large.roman: *-courier-medium-r-*-240-*-m-*,*
+*fontfamily.default.large.bold: *-courier-bold-r-*-240-*-m-*,*
+*fontfamily.default.large.italic: *-courier-medium-o-*-240-*-m-*,*
+*fontfamily.default.large.bolditalic: *-courier-bold-o-*-240-*-m-*,*
!
! The following is the adobe-courier font family. Availiable sizes are
! 80, 100, 120, 140, 180, and 240. This family used to be courier.
!
-*fontfamily.courier.small.roman: *adobe-courier-medium-r-*-80-*-m-*
-*fontfamily.courier.small.bold: *adobe-courier-bold-r-*-80-*-m-*
-*fontfamily.courier.small.italic: *adobe-courier-medium-o-*-80-*-m-*
-*fontfamily.courier.small.bolditalic: *adobe-courier-bold-o-*-80-*-m-*
+*fontfamily.courier.small.roman: *-courier-medium-r-*-80-*-m-*,*
+*fontfamily.courier.small.bold: *-courier-bold-r-*-80-*-m-*,*
+*fontfamily.courier.small.italic: *-courier-medium-o-*-80-*-m-*,*
+*fontfamily.courier.small.bolditalic: *-courier-bold-o-*-80-*-m-*,*
-*fontfamily.courier.medium.roman: *adobe-courier-medium-r-*-120-*-m-*
-*fontfamily.courier.medium.bold: *adobe-courier-bold-r-*-120-*-m-*
-*fontfamily.courier.medium.italic: *adobe-courier-medium-o-*-120-*-m-*
-*fontfamily.courier.medium.bolditalic: *adobe-courier-bold-o-*-120-*-m-*
+*fontfamily.courier.medium.roman: *-courier-medium-r-*-120-*-m-*,*
+*fontfamily.courier.medium.bold: *-courier-bold-r-*-120-*-m-*,*
+*fontfamily.courier.medium.italic: *-courier-medium-o-*-120-*-m-*,*
+*fontfamily.courier.medium.bolditalic: *-courier-bold-o-*-120-*-m-*,*
-*fontfamily.courier.large.roman: *adobe-courier-medium-r-*-240-*-m-*
-*fontfamily.courier.large.bold: *adobe-courier-bold-r-*-240-*-m-*
-*fontfamily.courier.large.italic: *adobe-courier-medium-o-*-240-*-m-*
-*fontfamily.courier.large.bolditalic: *adobe-courier-bold-o-*-240-*-m-*
+*fontfamily.courier.large.roman: *-courier-medium-r-*-240-*-m-*,*
+*fontfamily.courier.large.bold: *-courier-bold-r-*-240-*-m-*,*
+*fontfamily.courier.large.italic: *-courier-medium-o-*-240-*-m-*,*
+*fontfamily.courier.large.bolditalic: *-courier-bold-o-*-240-*-m-*,*
!
! The following is the adobe-times font family. Availiable sizes are
! 80, 100, 120, 140, 180, and 240. This family used to be times-roman.
!
-*fontfamily.times.small.roman: *adobe-times-medium-r-*-80-*-p-*
-*fontfamily.times.small.bold: *adobe-times-bold-r-*-80-*-p-*
-*fontfamily.times.small.italic: *adobe-times-medium-i-*-80-*-p-*
-*fontfamily.times.small.bolditalic: *adobe-times-bold-i-*-80-*-p-*
+*fontfamily.times.small.roman: *-times-medium-r-*-80-*-p-*,*
+*fontfamily.times.small.bold: *-times-bold-r-*-80-*-p-*,*
+*fontfamily.times.small.italic: *-times-medium-i-*-80-*-p-*,*
+*fontfamily.times.small.bolditalic: *-times-bold-i-*-80-*-p-*,*
-*fontfamily.times.medium.roman: *adobe-times-medium-r-*-120-*-p-*
-*fontfamily.times.medium.bold: *adobe-times-bold-r-*-120-*-p-*
-*fontfamily.times.medium.italic: *adobe-times-medium-i-*-120-*-p-*
-*fontfamily.times.medium.bolditalic: *adobe-times-bold-i-*-120-*-p-*
+*fontfamily.times.medium.roman: *-times-medium-r-*-120-*-p-*,*
+*fontfamily.times.medium.bold: *-times-bold-r-*-120-*-p-*,*
+*fontfamily.times.medium.italic: *-times-medium-i-*-120-*-p-*,*
+*fontfamily.times.medium.bolditalic: *-times-bold-i-*-120-*-p-*,*
-*fontfamily.times.large.roman: *adobe-times-medium-r-*-240-*-p-*
-*fontfamily.times.large.bold: *adobe-times-bold-r-*-240-*-p-*
-*fontfamily.times.large.italic: *adobe-times-medium-i-*-240-*-p-*
-*fontfamily.times.large.bolditalic: *adobe-times-bold-i-*-240-*-p-*
+*fontfamily.times.large.roman: *-times-medium-r-*-240-*-p-*,*
+*fontfamily.times.large.bold: *-times-bold-r-*-240-*-p-*,*
+*fontfamily.times.large.italic: *-times-medium-i-*-240-*-p-*,*
+*fontfamily.times.large.bolditalic: *-times-bold-i-*-240-*-p-*,*
!
! The following is the adobe-helvetica font family. Availiable sizes are
! 80, 100, 120, 140, 180, and 240. This family used to be helvetica.
!
-*fontfamily.helvetica.small.roman: *adobe-helvetica-medium-r-*-80-*-p-*
-*fontfamily.helvetica.small.bold: *adobe-helvetica-bold-r-*-80-*-p-*
-*fontfamily.helvetica.small.italic: *adobe-helvetica-medium-o-*-80-*-p-*
-*fontfamily.helvetica.small.bolditalic: *adobe-helvetica-bold-o-*-80-*-p-*
+*fontfamily.helvetica.small.roman: *-helvetica-medium-r-*-80-*-p-*,*
+*fontfamily.helvetica.small.bold: *-helvetica-bold-r-*-80-*-p-*,*
+*fontfamily.helvetica.small.italic: *-helvetica-medium-o-*-80-*-p-*,*
+*fontfamily.helvetica.small.bolditalic: *-helvetica-bold-o-*-80-*-p-*,*
-*fontfamily.helvetica.medium.roman: *adobe-helvetica-medium-r-*-120-*-p-*
-*fontfamily.helvetica.medium.bold: *adobe-helvetica-bold-r-*-120-*-p-*
-*fontfamily.helvetica.medium.italic: *adobe-helvetica-medium-o-*-120-*-p-*
-*fontfamily.helvetica.medium.bolditalic:*adobe-helvetica-bold-o-*-120-*-p-*
+*fontfamily.helvetica.medium.roman: *-helvetica-medium-r-*-120-*-p-*,*
+*fontfamily.helvetica.medium.bold: *-helvetica-bold-r-*-120-*-p-*,*
+*fontfamily.helvetica.medium.italic: *-helvetica-medium-o-*-120-*-p-*,*
+*fontfamily.helvetica.medium.bolditalic:*-helvetica-bold-o-*-120-*-p-*,*
-*fontfamily.helvetica.large.roman: *adobe-helvetica-medium-r-*-240-*-p-*
-*fontfamily.helvetica.large.bold: *adobe-helvetica-bold-r-*-240-*-p-*
-*fontfamily.helvetica.large.italic: *adobe-helvetica-medium-o-*-240-*-p-*
-*fontfamily.helvetica.large.bolditalic: *adobe-helvetica-bold-o-*-240-*-p-*
+*fontfamily.helvetica.large.roman: *-helvetica-medium-r-*-240-*-p-*,*
+*fontfamily.helvetica.large.bold: *-helvetica-bold-r-*-240-*-p-*,*
+*fontfamily.helvetica.large.italic: *-helvetica-medium-o-*-240-*-p-*,*
+*fontfamily.helvetica.large.bolditalic: *-helvetica-bold-o-*-240-*-p-*,*
!
! Quick hack...
!
-*fontfamily.huge*roman: *bitstream-charter-medium-r-*-33-*-p-*
-*fontfamily.huge*bold: *bitstream-charter-bold-r-*-33-*-p-*
-*fontfamily.huge*italic: *bitstream-charter-medium-i-*-33-*-p-*
-*fontfamily.huge*bolditalic: *bitstream-charter-bold-i-*-33-*-p-*
+*fontfamily.huge*roman: *-charter-medium-r-*-33-*-p-*,*
+*fontfamily.huge*bold: *-charter-bold-r-*-33-*-p-*,*
+*fontfamily.huge*italic: *-charter-medium-i-*-33-*-p-*,*
+*fontfamily.huge*bolditalic: *-charter-bold-i-*-33-*-p-*,*