summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
commit972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch)
tree97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-bsp
downloadpoky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-bsp')
-rw-r--r--meta/recipes-bsp/acpid/acpid.inc30
-rw-r--r--meta/recipes-bsp/acpid/acpid/acpid.service10
-rwxr-xr-xmeta/recipes-bsp/acpid/acpid/init31
-rw-r--r--meta/recipes-bsp/acpid/acpid_2.0.22.bb7
-rw-r--r--meta/recipes-bsp/alsa-state/alsa-state.bb65
-rwxr-xr-xmeta/recipes-bsp/alsa-state/alsa-state/alsa-state-init39
-rw-r--r--meta/recipes-bsp/alsa-state/alsa-state/asound.conf1
-rw-r--r--meta/recipes-bsp/alsa-state/alsa-state/asound.state1
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd.service7
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy91
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy.conf16
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/default8
-rwxr-xr-xmeta/recipes-bsp/apmd/apmd-3.2.2-14/init51
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/libtool.patch33
-rw-r--r--meta/recipes-bsp/apmd/apmd-3.2.2-14/unlinux.patch25
-rw-r--r--meta/recipes-bsp/apmd/apmd_3.2.2-14.bb82
-rw-r--r--meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb39
-rw-r--r--meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs8
-rw-r--r--meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch22
-rw-r--r--meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch60
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/config50
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/machconfig0
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemuarm/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemuarmv6/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemuarmv7/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemumips/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemuppc/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemux86-64/machconfig10
-rwxr-xr-xmeta/recipes-bsp/formfactor/files/qemux86/machconfig10
-rw-r--r--meta/recipes-bsp/formfactor/formfactor_0.0.bb21
-rw-r--r--meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch48
-rw-r--r--meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch22
-rw-r--r--meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb33
-rw-r--r--meta/recipes-bsp/grub/files/0001-Fix-build-with-glibc-2.20.patch32
-rw-r--r--meta/recipes-bsp/grub/files/cfg2
-rw-r--r--meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch33
-rw-r--r--meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch21
-rw-r--r--meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch53
-rw-r--r--meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch27
-rw-r--r--meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch24
-rw-r--r--meta/recipes-bsp/grub/files/grub-2.00-ignore-gnulib-gets-stupidity.patch28
-rw-r--r--meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch131
-rw-r--r--meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch32
-rw-r--r--meta/recipes-bsp/grub/files/grub-no-unused-result.patch19
-rw-r--r--meta/recipes-bsp/grub/grub-0.97/autohell.patch21
-rw-r--r--meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch101
-rw-r--r--meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch74
-rw-r--r--meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch31
-rw-r--r--meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch40
-rw-r--r--meta/recipes-bsp/grub/grub-2.00/fix-endianness-problem.patch44
-rw-r--r--meta/recipes-bsp/grub/grub-2.00/grub-install.in.patch20
-rw-r--r--meta/recipes-bsp/grub/grub-2.00/grub2-remove-sparc64-setup-from-x86-builds.patch104
-rw-r--r--meta/recipes-bsp/grub/grub-2.00/remove-gets.patch20
-rw-r--r--meta/recipes-bsp/grub/grub-efi_2.00.bb92
-rw-r--r--meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch34
-rw-r--r--meta/recipes-bsp/grub/grub_0.97.bb35
-rw-r--r--meta/recipes-bsp/grub/grub_2.00.bb51
-rw-r--r--meta/recipes-bsp/grub/grub_git.bb64
-rw-r--r--meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch39
-rw-r--r--meta/recipes-bsp/gummiboot/gummiboot_git.bb34
-rw-r--r--meta/recipes-bsp/hostap/files/COPYING.patch346
-rw-r--r--meta/recipes-bsp/hostap/files/hostap-fw-load.patch22
-rw-r--r--meta/recipes-bsp/hostap/files/hostap_cs.conf193
-rw-r--r--meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream191
-rw-r--r--meta/recipes-bsp/hostap/files/hostap_cs.modalias28
-rw-r--r--meta/recipes-bsp/hostap/hostap-conf_1.0.bb21
-rw-r--r--meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch27
-rw-r--r--meta/recipes-bsp/hostap/hostap-utils.inc26
-rw-r--r--meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb5
-rw-r--r--meta/recipes-bsp/keymaps/files/GPLv2.patch347
-rwxr-xr-xmeta/recipes-bsp/keymaps/files/keymap.sh16
-rw-r--r--meta/recipes-bsp/keymaps/keymaps_1.0.bb48
-rw-r--r--meta/recipes-bsp/libacpi/files/ldflags.patch41
-rw-r--r--meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch47
-rw-r--r--meta/recipes-bsp/libacpi/files/makefile-fix.patch47
-rw-r--r--meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch23
-rw-r--r--meta/recipes-bsp/libacpi/libacpi_0.2.bb30
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch19
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch39
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch21884
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch32
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch49
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch22
-rw-r--r--meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb46
-rw-r--r--meta/recipes-bsp/pciutils/pciutils/configure.patch104
-rw-r--r--meta/recipes-bsp/pciutils/pciutils/guess-fix.patch37
-rw-r--r--meta/recipes-bsp/pciutils/pciutils/lib-build-fix.patch92
-rw-r--r--meta/recipes-bsp/pciutils/pciutils/makefile.patch26
-rw-r--r--meta/recipes-bsp/pciutils/pciutils_3.2.1.bb66
-rw-r--r--meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch101
-rw-r--r--meta/recipes-bsp/pcmciautils/pcmciautils.inc33
-rw-r--r--meta/recipes-bsp/pcmciautils/pcmciautils_018.bb11
-rw-r--r--meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb26
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/COPYING2
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/pointercal0
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercalbin0 -> 36 bytes
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal1
-rw-r--r--meta/recipes-bsp/pointercal/pointercal_0.0.bb22
-rw-r--r--meta/recipes-bsp/setserial/setserial/add_stdlib.patch18
-rw-r--r--meta/recipes-bsp/setserial/setserial/ldflags.patch24
-rw-r--r--meta/recipes-bsp/setserial/setserial_2.17.bb29
-rw-r--r--meta/recipes-bsp/u-boot/files/0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch74
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb38
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb35
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-mkimage_2013.07.bb32
-rw-r--r--meta/recipes-bsp/u-boot/u-boot.inc122
-rw-r--r--meta/recipes-bsp/u-boot/u-boot_2013.07.bb9
-rw-r--r--meta/recipes-bsp/usbinit/usbinit.bb21
-rw-r--r--meta/recipes-bsp/usbinit/usbinit/COPYING.GPL339
-rwxr-xr-xmeta/recipes-bsp/usbinit/usbinit/usb-gether23
-rw-r--r--meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch28
-rw-r--r--meta/recipes-bsp/usbutils/usbutils/iconv.patch40
-rw-r--r--meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch30
-rw-r--r--meta/recipes-bsp/usbutils/usbutils_007.bb31
-rw-r--r--meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch21766
-rw-r--r--meta/recipes-bsp/v86d/v86d/ar-from-env.patch33
-rwxr-xr-xmeta/recipes-bsp/v86d/v86d/fbsetup3
-rw-r--r--meta/recipes-bsp/v86d/v86d/uvesafb.conf2
-rw-r--r--meta/recipes-bsp/v86d/v86d_0.1.10.bb69
124 files changed, 48917 insertions, 0 deletions
diff --git a/meta/recipes-bsp/acpid/acpid.inc b/meta/recipes-bsp/acpid/acpid.inc
new file mode 100644
index 0000000000..e0156192a0
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid.inc
@@ -0,0 +1,30 @@
1SUMMARY = "A daemon for delivering ACPI events"
2HOMEPAGE = "http://sourceforge.net/projects/acpid/"
3BUGTRACKER = "http://sourceforge.net/tracker/?group_id=33140&atid=407341"
4SECTION = "base"
5LICENSE = "GPLv2+"
6
7SRC_URI = "${SOURCEFORGE_MIRROR}/acpid2/acpid-${PV}.tar.xz \
8 file://init \
9 file://acpid.service \
10 "
11
12inherit autotools update-rc.d systemd
13
14INITSCRIPT_NAME = "acpid"
15INITSCRIPT_PARAMS = "defaults"
16
17SYSTEMD_SERVICE_${PN} = "acpid.service"
18
19do_install_append () {
20 install -d ${D}${sysconfdir}/init.d
21 sed -e 's,/usr/sbin,${sbindir},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/acpid
22 chmod 755 ${D}${sysconfdir}/init.d/acpid
23
24 install -d ${D}${sysconfdir}/acpi
25 install -d ${D}${sysconfdir}/acpi/events
26
27 install -d ${D}${systemd_unitdir}/system
28 install -m 0644 ${WORKDIR}/acpid.service ${D}${systemd_unitdir}/system
29 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/acpid.service
30}
diff --git a/meta/recipes-bsp/acpid/acpid/acpid.service b/meta/recipes-bsp/acpid/acpid/acpid.service
new file mode 100644
index 0000000000..f70e740965
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid/acpid.service
@@ -0,0 +1,10 @@
1[Unit]
2Description=ACPI Event Daemon
3After=syslog.target
4
5[Service]
6Type=forking
7ExecStart=@SBINDIR@/acpid
8
9[Install]
10WantedBy=multi-user.target
diff --git a/meta/recipes-bsp/acpid/acpid/init b/meta/recipes-bsp/acpid/acpid/init
new file mode 100755
index 0000000000..40ff385c10
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid/init
@@ -0,0 +1,31 @@
1#! /bin/sh -e
2
3test -x /usr/sbin/acpid || exit 0
4test -d /proc/acpi || exit 0
5mkdir -p /etc/acpi/events
6
7case "$1" in
8 start)
9 echo -n "Starting Advanced Configuration and Power Interface daemon: "
10 if [ ! -d /etc/acpi/events ]; then
11 echo "There is not any rule configuration file."
12 else
13 start-stop-daemon -o -S -x /usr/sbin/acpid -- -c /etc/acpi/events
14 echo "acpid."
15 fi
16 ;;
17 stop)
18 echo -n "Stopping Advanced Configuration and Power Interface daemon: "
19 start-stop-daemon -o -K -x /usr/sbin/acpid
20 echo "acpid."
21 ;;
22 restart|force-reload)
23 $0 stop
24 $0 start
25 ;;
26 *)
27 echo "Usage: /etc/init.d/acpid {start|stop|restart|force-reload}"
28 exit 1
29esac
30
31exit 0
diff --git a/meta/recipes-bsp/acpid/acpid_2.0.22.bb b/meta/recipes-bsp/acpid/acpid_2.0.22.bb
new file mode 100644
index 0000000000..603fc2be9f
--- /dev/null
+++ b/meta/recipes-bsp/acpid/acpid_2.0.22.bb
@@ -0,0 +1,7 @@
1require acpid.inc
2
3LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
4 file://acpid.h;endline=24;md5=324a9cf225ae69ddaad1bf9d942115b5"
5
6SRC_URI[md5sum] = "c8ba756030d1b21fc973ec3d640f27f1"
7SRC_URI[sha256sum] = "3d11454f4283c8f771d8dbd5eb6b5f2bbd9d94d9f77d68bab89e35d98b67ab31"
diff --git a/meta/recipes-bsp/alsa-state/alsa-state.bb b/meta/recipes-bsp/alsa-state/alsa-state.bb
new file mode 100644
index 0000000000..17c2d002d5
--- /dev/null
+++ b/meta/recipes-bsp/alsa-state/alsa-state.bb
@@ -0,0 +1,65 @@
1# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
2# License: MIT (see http://www.opensource.org/licenses/mit-license.php
3# for a copy of the license)
4#
5# Filename: alsa-state.bb
6
7SUMMARY = "Alsa scenario files to enable alsa state restoration"
8DESCRIPTION = "Alsa Scenario Files - an init script and state files to restore \
9sound state at system boot and save it at system shut down."
10LICENSE = "MIT"
11LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
12PV = "0.2.0"
13PR = "r5"
14
15SRC_URI = "\
16 file://asound.conf \
17 file://asound.state \
18 file://alsa-state-init \
19"
20
21# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
22# manually to avoid unnecessary postinst/preinst generated.
23python __anonymous() {
24 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
25 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
26}
27
28inherit update-rc.d
29
30INITSCRIPT_NAME = "alsa-state"
31INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ."
32
33do_install() {
34 # Only install the init script when 'sysvinit' is in DISTRO_FEATURES.
35 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
36 sed -i -e "s:#STATEDIR#:${localstatedir}/lib/alsa:g" ${WORKDIR}/alsa-state-init
37 install -d ${D}${sysconfdir}/init.d
38 install -m 0755 ${WORKDIR}/alsa-state-init ${D}${sysconfdir}/init.d/alsa-state
39 fi
40
41 install -d ${D}/${localstatedir}/lib/alsa
42 install -d ${D}${sysconfdir}
43 install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir}
44 install -m 0644 ${WORKDIR}/*.state ${D}${localstatedir}/lib/alsa
45}
46
47PACKAGES += "alsa-states"
48
49RRECOMMENDS_alsa-state = "alsa-states"
50
51RDEPENDS_${PN} = "alsa-utils-alsactl"
52FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf"
53CONFFILES_${PN} = "${sysconfdir}/asound.conf"
54
55FILES_alsa-states = "${localstatedir}/lib/alsa/*.state"
56
57pkg_postinst_${PN}() {
58 if test -z "$D"
59 then
60 if test -x ${sbindir}/alsactl
61 then
62 ${sbindir}/alsactl -f ${localstatedir}/lib/alsa/asound.state restore
63 fi
64 fi
65}
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init
new file mode 100755
index 0000000000..eee59cb321
--- /dev/null
+++ b/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init
@@ -0,0 +1,39 @@
1#! /bin/sh
2#
3# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
4# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
5#
6# Filename: alsa-state
7# Date: 20070308 (YMD)
8
9# source function library
10. /etc/init.d/functions
11
12asound_restore(){
13 echo "ALSA: Restoring mixer settings..."
14 if test -x /usr/sbin/alsactl -a -e #STATEDIR#/asound.state
15 then
16 /usr/sbin/alsactl -f #STATEDIR#/asound.state restore &
17 fi
18}
19
20asound_store(){
21 echo "ALSA: Storing mixer settings..."
22 if test -x /usr/sbin/alsactl
23 then
24 /usr/sbin/alsactl -f #STATEDIR#/asound.state store
25 fi
26}
27
28case "$1" in
29start) asound_restore ;;
30stop) asound_store ;;
31 status)
32 status /usr/sbin/alsactl;
33 exit $?
34 ;;
35 *)
36 echo "Usage: /etc/init.d/alsa-state {start|stop|status}"
37 exit 1
38 ;;
39esac
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/asound.conf b/meta/recipes-bsp/alsa-state/alsa-state/asound.conf
new file mode 100644
index 0000000000..03653cfb2d
--- /dev/null
+++ b/meta/recipes-bsp/alsa-state/alsa-state/asound.conf
@@ -0,0 +1 @@
# Global alsa-lib configuration
diff --git a/meta/recipes-bsp/alsa-state/alsa-state/asound.state b/meta/recipes-bsp/alsa-state/alsa-state/asound.state
new file mode 100644
index 0000000000..ddd1cce85d
--- /dev/null
+++ b/meta/recipes-bsp/alsa-state/alsa-state/asound.state
@@ -0,0 +1 @@
# Dummy file, do not delete
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd.service b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd.service
new file mode 100644
index 0000000000..ffab82334f
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd.service
@@ -0,0 +1,7 @@
1[Unit]
2Description=Advanced Power Management daemon
3After=remote-fs.target
4
5[Service]
6EnvironmentFile=-@SYSCONFDIR@/default/apmd
7ExecStart=@SBINDIR@/apmd -P @SYSCONFDIR@/apm/apmd_proxy $APMD
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy
new file mode 100644
index 0000000000..c48ee4e5d5
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy
@@ -0,0 +1,91 @@
1#!/bin/sh
2#
3# apmd_proxy - program dispatcher for APM daemon
4#
5# Written by Craig Markwardt (craigm@lheamail.gsfc.nasa.gov) 21 May 1999
6# Modified for Debian by Avery Pennarun
7#
8# This shell script is called by the APM daemon (apmd) when a power
9# management event occurs. Its first and second arguments describe the
10# event. For example, apmd will call "apmd_proxy suspend system" just
11# before the system is suspended.
12#
13# Here are the possible arguments:
14#
15# start - APM daemon has started
16# stop - APM daemon is shutting down
17# suspend critical - APM system indicates critical suspend (++)
18# suspend system - APM system has requested suspend mode
19# suspend user - User has requested suspend mode
20# standby system - APM system has requested standby mode
21# standby user - User has requested standby mode
22# resume suspend - System has resumed from suspend mode
23# resume standby - System has resumed from standby mode
24# resume critical - System has resumed from critical suspend
25# change battery - APM system reported low battery
26# change power - APM system reported AC/battery change
27# change time - APM system reported time change (*)
28# change capability - APM system reported config. change (+)
29#
30# (*) - APM daemon may be configured to not call these sequences
31# (+) - Available if APM kernel supports it.
32# (++) - "suspend critical" is never passed to apmd from the kernel,
33# so we will never see it here. Scripts that process "resume
34# critical" events need to take this into account.
35#
36# It is the proxy script's responsibility to examine the APM status
37# (via /proc/apm) or other status and to take appropriate actions.
38# For example, the script might unmount network drives before the
39# machine is suspended.
40#
41# In Debian, the usual way of adding functionality to the proxy is to
42# add a script to /etc/apm/event.d. This script will be called by
43# apmd_proxy (via run-parts) with the same arguments.
44#
45# If it is important that a certain set of script be run in a certain
46# order on suspend and in a different order on resume, then put all
47# the scripts in /etc/apm/scripts.d instead of /etc/apm/event.d and
48# symlink to these from /etc/apm/suspend.d, /etc/apm/resume.d and
49# /etc/apm/other.d using names whose lexicographical order is the same
50# as the desired order of execution.
51#
52# If the kernel's APM driver supports it, apmd_proxy can return a non-zero
53# exit status on suspend and standby events, indicating that the suspend
54# or standby event should be rejected.
55#
56# *******************************************************************
57
58set -e
59
60# The following doesn't yet work, because current kernels (up to at least
61# 2.4.20) do not support rejection of APM events. Supporting this would
62# require substantial modifications to the APM driver. We will re-enable
63# this feature if the driver is ever modified. -- cph@debian.org
64#
65#SUSPEND_ON_AC=false
66#[ -r /etc/apm/apmd_proxy.conf ] && . /etc/apm/apmd_proxy.conf
67#
68#if [ "${SUSPEND_ON_AC}" = "false" -a "${2}" = "system" ] \
69# && on_ac_power >/dev/null; then
70# # Reject system suspends and standbys if we are on AC power
71# exit 1 # Reject (NOTE kernel support must be enabled)
72#fi
73
74if [ "${1}" = "suspend" -o "${1}" = "standby" ]; then
75 run-parts -a "${1}" -a "${2}" /etc/apm/event.d
76 if [ -d /etc/apm/suspend.d ]; then
77 run-parts -a "${1}" -a "${2}" /etc/apm/suspend.d
78 fi
79elif [ "${1}" = "resume" ]; then
80 if [ -d /etc/apm/resume.d ]; then
81 run-parts -a "${1}" -a "${2}" /etc/apm/resume.d
82 fi
83 run-parts -a "${1}" -a "${2}" /etc/apm/event.d
84else
85 run-parts -a "${1}" -a "${2}" /etc/apm/event.d
86 if [ -d /etc/apm/other.d ]; then
87 run-parts -a "${1}" -a "${2}" /etc/apm/other.d
88 fi
89fi
90
91exit 0
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy.conf b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy.conf
new file mode 100644
index 0000000000..751145c522
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/apmd_proxy.conf
@@ -0,0 +1,16 @@
1# /etc/apm/apmd_proxy.conf: configuration file for apmd.
2#
3# This file is managed by debconf when installing or reconfiguring the
4# package. It is generated by merging the answers gathered by debconf
5# into the template file "/usr/share/apmd/apmd_proxy.conf".
6
7# The following doesn't yet work, because current kernels (up to at least
8# 2.4.20) do not support rejection of APM events. Supporting this would
9# require substantial modifications to the APM driver. We will re-enable
10# this feature if the driver is ever modified. -- cph@debian.org
11#
12# Set the following to "false" if you want to reject system suspend or
13# system standby requests when the computer is running on AC power.
14# Otherwise set this to "true". Such requests are never rejected when
15# the computer is running on battery power.
16#SUSPEND_ON_AC=true
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/default b/meta/recipes-bsp/apmd/apmd-3.2.2-14/default
new file mode 100644
index 0000000000..4b7965abf8
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/default
@@ -0,0 +1,8 @@
1#
2# Default for /etc/init.d/apmd
3#
4
5# As apmd can be called with arguments, we use the following variable
6# to store them, e.g., APMD="-w 5 -p 2".
7# See the manual page apmd(8) for details.
8APMD="--proxy-timeout 30"
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/init b/meta/recipes-bsp/apmd/apmd-3.2.2-14/init
new file mode 100755
index 0000000000..c0b41aa9d1
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/init
@@ -0,0 +1,51 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: apmd
4# Required-Start: $remote_fs
5# Required-Stop: $remote_fs
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Advanced Power Management daemon
9### END INIT INFO
10
11# Source function library.
12. /etc/init.d/functions
13
14PATH=/bin:/usr/bin:/sbin:/usr/sbin
15
16[ -f /etc/default/rcS ] && . /etc/default/rcS
17[ -f /etc/default/apmd ] && . /etc/default/apmd
18
19case "$1" in
20 start)
21 echo -n "Starting advanced power management daemon: "
22 start-stop-daemon -S -x /usr/sbin/apmd -- \
23 -P /etc/apm/apmd_proxy $APMD
24 if [ $? = 0 ]; then
25 echo "apmd."
26 else
27 echo "(failed.)"
28 fi
29 ;;
30 stop)
31 echo -n "Stopping advanced power management daemon: "
32 start-stop-daemon -K \
33 -x /usr/sbin/apmd
34 echo "apmd."
35 ;;
36 status)
37 status /usr/sbin/apmd;
38 exit $?
39 ;;
40 restart|force-reload)
41 $0 stop
42 $0 start
43 exit
44 ;;
45 *)
46 echo "Usage: /etc/init.d/apmd {start|stop|status|restart|force-reload}"
47 exit 1
48 ;;
49esac
50
51exit 0
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/libtool.patch b/meta/recipes-bsp/apmd/apmd-3.2.2-14/libtool.patch
new file mode 100644
index 0000000000..834ee080a1
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/libtool.patch
@@ -0,0 +1,33 @@
1Add by RP to address "unable to infer tagged configuration" error:
2 commit 35de05e61b88c0808a5e885bb0efdf420555d5ad
3 Author: Richard Purdie <rpurdie@rpsys.net>
4 Date: Sun Jun 1 16:13:38 2008 +0000
5
6 apmd: Use libtool --tag options to avoid problems with libtool 2.2.4 (from poky)
7
8However I didn't see same issue with current libtool-2.2.10. Also per my understanding,
9the default tag, if not specified, falls back to CC. So disable it from patching, but
10keep it here. If we encounter similar issue in the future, we could then push upstream
11
12Comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-16
13
14Upstream-Status: Pending
15
16Signed-off-by: Scott Garman <scott.a.garman@intel.com>
17
18Index: apmd-3.2.2.orig/Makefile
19===================================================================
20--- apmd-3.2.2.orig.orig/Makefile 2004-01-04 08:13:18.000000000 +0000
21+++ apmd-3.2.2.orig/Makefile 2008-04-21 17:10:03.000000000 +0100
22@@ -58,9 +57,8 @@
23 #CFLAGS=-O3 -m486 -fomit-frame-pointer
24 #LDFLAGS=-s
25
26-LIBTOOL=libtool --quiet
27-LT_COMPILE = $(LIBTOOL) --mode=compile $(CC)
28-LT_LINK = $(LIBTOOL) --mode=link $(CC)
29+LT_COMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC)
30+LT_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC)
31 LT_INSTALL = $(LIBTOOL) --mode=install install
32 LT_CLEAN = $(LIBTOOL) --mode=clean rm
33
diff --git a/meta/recipes-bsp/apmd/apmd-3.2.2-14/unlinux.patch b/meta/recipes-bsp/apmd/apmd-3.2.2-14/unlinux.patch
new file mode 100644
index 0000000000..ec8206cf17
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd-3.2.2-14/unlinux.patch
@@ -0,0 +1,25 @@
1copy OE commit message here:
2 commit 9456cdc1cf43e3ba9e6d88c63560c1b6fdee4359
3 Author: Michael Krelin <hacker@klever.net>
4 Date: Tue May 29 12:27:45 2007 +0000
5
6 apmd: prevent build from interferring with host kernel headers. Closes #1257
7
8comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-13
9
10Upstream-Status: Pending
11
12Signed-off-by: Scott Garman <scott.a.garman@intel.com>
13
14--- apmd-3.2.2.orig/Makefile
15+++ apmd-3.2.2/Makefile
16@@ -43,8 +43,7 @@
17
18 CC=gcc
19 CFLAGS=-O -g
20-XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include -I/usr/X11R6/include \
21- -I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \
22+XTRACFLAGS=-Wall -pipe -I. \
23 -DVERSION=\"$(VERSION)\" \
24 -DDEFAULT_PROXY_NAME=\"$(PROXY_DIR)/apmd_proxy\"
25 LDFLAGS=
diff --git a/meta/recipes-bsp/apmd/apmd_3.2.2-14.bb b/meta/recipes-bsp/apmd/apmd_3.2.2-14.bb
new file mode 100644
index 0000000000..ab7de65cf0
--- /dev/null
+++ b/meta/recipes-bsp/apmd/apmd_3.2.2-14.bb
@@ -0,0 +1,82 @@
1SUMMARY = "Utilities for Advanced Power Management"
2DESCRIPTION = "The Advanced Power Management (APM) support provides \
3access to battery status information and a set of tools for managing \
4notebook power consumption."
5HOMEPAGE = "http://apenwarr.ca/apmd/"
6SECTION = "base"
7LICENSE = "GPLv2+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
9 file://apm.h;beginline=6;endline=18;md5=7d4acc1250910a89f84ce3cc6557c4c2"
10DEPENDS = "libtool-cross"
11PR = "r2"
12
13SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_3.2.2.orig.tar.gz;name=tarball \
14 ${DEBIAN_MIRROR}/main/a/apmd/apmd_${PV}.diff.gz;name=patch \
15 file://libtool.patch \
16 file://unlinux.patch \
17 file://init \
18 file://default \
19 file://apmd_proxy \
20 file://apmd_proxy.conf \
21 file://apmd.service"
22
23SRC_URI[tarball.md5sum] = "b1e6309e8331e0f4e6efd311c2d97fa8"
24SRC_URI[tarball.sha256sum] = "7f7d9f60b7766b852881d40b8ff91d8e39fccb0d1d913102a5c75a2dbb52332d"
25
26SRC_URI[patch.md5sum] = "57e1b689264ea80f78353519eece0c92"
27SRC_URI[patch.sha256sum] = "7905ff96be93d725544d0040e425c42f9c05580db3c272f11cff75b9aa89d430"
28
29S = "${WORKDIR}/apmd-3.2.2.orig"
30
31inherit update-rc.d systemd
32
33INITSCRIPT_NAME = "apmd"
34INITSCRIPT_PARAMS = "defaults"
35
36SYSTEMD_SERVICE_${PN} = "apmd.service"
37SYSTEMD_AUTO_ENABLE = "disable"
38
39do_compile() {
40 # apmd doesn't use whole autotools. Just libtool for installation
41 oe_runmake "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool" apm apmd
42}
43
44do_install() {
45 install -d ${D}${sysconfdir}
46 install -d ${D}${sysconfdir}/apm
47 install -d ${D}${sysconfdir}/apm/event.d
48 install -d ${D}${sysconfdir}/apm/other.d
49 install -d ${D}${sysconfdir}/apm/suspend.d
50 install -d ${D}${sysconfdir}/apm/resume.d
51 install -d ${D}${sysconfdir}/apm/scripts.d
52 install -d ${D}${sysconfdir}/default
53 install -d ${D}${sysconfdir}/init.d
54 install -d ${D}${sbindir}
55 install -d ${D}${bindir}
56 install -d ${D}${libdir}
57 install -d ${D}${datadir}/apmd
58 install -d ${D}${includedir}
59
60 install -m 4755 ${S}/.libs/apm ${D}${bindir}/apm
61 install -m 0755 ${S}/.libs/apmd ${D}${sbindir}/apmd
62 install -m 0755 ${WORKDIR}/apmd_proxy ${D}${sysconfdir}/apm/
63 install -m 0644 ${WORKDIR}/apmd_proxy.conf ${D}${datadir}/apmd/
64 install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/apmd
65 oe_libinstall -so libapm ${D}${libdir}
66 install -m 0644 apm.h ${D}${includedir}
67
68 sed -e 's,/usr/sbin,${sbindir},g; s,/etc,${sysconfdir},g;' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/apmd
69 chmod 755 ${D}${sysconfdir}/init.d/apmd
70
71 install -d ${D}${systemd_unitdir}/system
72 install -m 0644 ${WORKDIR}/apmd.service ${D}${systemd_unitdir}/system/
73 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
74 -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apmd.service
75}
76
77PACKAGES =+ "libapm libapm-dev libapm-staticdev apm"
78
79FILES_libapm = "${libdir}/libapm${SOLIBS}"
80FILES_libapm-dev = "${libdir}/libapm${SOLIBSDEV} ${includedir} ${libdir}/libapm.la"
81FILES_libapm-staticdev = "${libdir}/libapm.a"
82FILES_apm = "${bindir}/apm*"
diff --git a/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb b/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb
new file mode 100644
index 0000000000..c2a02aadbb
--- /dev/null
+++ b/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb
@@ -0,0 +1,39 @@
1SUMMARY = "eeePC specific ACPI scripts"
2HOMEPAGE = "http://alioth.debian.org/projects/debian-eeepc/"
3SECTION = "base"
4
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://debian/copyright;md5=77ef83ab5f4af938a93edb61f7b74f2c"
7
8SRCREV = "9d4cdedca25b396405f8587f9c4fbf8229e041c2"
9PV = "1.1.12+git${SRCPV}"
10
11SRC_URI = "git://git.debian.org/git/debian-eeepc/eeepc-acpi-scripts.git \
12 file://remove-doc-check.patch \
13 file://powerbtn.patch \
14 file://policy-funcs "
15
16S = "${WORKDIR}/git"
17
18FILES_${PN} = "${datadir}/acpi-support/ \
19 ${datadir}/eeepc-acpi-scripts \
20 ${sysconfdir}/default/ \
21 ${sysconfdir}/acpi/"
22
23do_install () {
24 install -d ${D}${sysconfdir}/default/
25 install -d ${D}${sysconfdir}/acpi/actions/
26 install -d ${D}${sysconfdir}/acpi/events/
27 install -d ${D}${sysconfdir}/acpi/lib/udev/rules.d
28 install -d ${D}${datadir}/eeepc-acpi-scripts/
29 install -d ${D}${datadir}/acpi-support/
30 install -m 644 ${S}/events/* ${D}${sysconfdir}/acpi/events/
31 install -m 644 ${S}/lib/udev/rules.d/* ${D}${sysconfdir}/acpi/lib/udev/rules.d/
32 install ${S}/actions/* ${D}${sysconfdir}/acpi/actions/
33 install -m 0644 ${S}/acpilib/functions.sh ${D}${datadir}/eeepc-acpi-scripts/
34 install -m 0644 ${WORKDIR}/policy-funcs ${D}${datadir}/acpi-support/
35 install -m 0644 ${S}/debian/eeepc-acpi-scripts.default* ${D}${sysconfdir}/default/
36}
37
38RDEPENDS_${PN} = "pm-utils"
39
diff --git a/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs b/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs
new file mode 100644
index 0000000000..fd099df0d8
--- /dev/null
+++ b/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs
@@ -0,0 +1,8 @@
1CheckPolicy() {
2 if pidof gnome-power-manager kpowersave > /dev/null ||
3 (pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop kded kded loadedModules | grep -q klaptopdaemon) ; then
4 echo 0;
5 else
6 echo 1;
7 fi
8}
diff --git a/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch b/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch
new file mode 100644
index 0000000000..403e5569b8
--- /dev/null
+++ b/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch
@@ -0,0 +1,22 @@
1---
2 actions/power.sh | 3 +++
3 events/powerbtn | 2 ++
4 2 files changed, 5 insertions(+)
5
6Upstream-Status: Inappropriate [enable feature]
7
8Index: git/events/powerbtn
9===================================================================
10--- /dev/null 1970-01-01 00:00:00.000000000 +0000
11+++ git/events/powerbtn 2008-10-08 17:43:35.000000000 +0200
12@@ -0,0 +1,2 @@
13+event=button/power PWRF
14+action=/etc/acpi/actions/power.sh
15Index: git/actions/power.sh
16===================================================================
17--- /dev/null 1970-01-01 00:00:00.000000000 +0000
18+++ git/actions/power.sh 2008-10-08 17:45:26.000000000 +0200
19@@ -0,0 +1,3 @@
20+#!/bin/sh
21+
22+/sbin/shutdown -h now "Power button pressed"
diff --git a/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch b/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch
new file mode 100644
index 0000000000..efb3dca7ac
--- /dev/null
+++ b/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch
@@ -0,0 +1,60 @@
1---
2 actions/hotkey.sh | 3 ---
3 actions/suspend.sh | 3 ---
4 actions/vga-toggle.sh | 3 ---
5 actions/volume.sh | 3 ---
6 4 files changed, 12 deletions(-)
7
8Upstream-Status: Inappropriate [configuration]
9
10Index: git/eeepc-acpi-scripts/volume.sh
11===================================================================
12--- git.orig/eeepc-acpi-scripts/volume.sh 2011-11-29 19:21:55.000000000 +0800
13+++ git/eeepc-acpi-scripts/volume.sh 2011-11-29 19:41:36.000000000 +0800
14@@ -3,12 +3,10 @@
15 [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
16 # Volume controls
17
18-# do nothing if package is removed
19 PKG=eeepc-acpi-scripts
20 PKG_DIR=/usr/share/acpi-support/$PKG
21 FUNC_LIB=$PKG_DIR/lib/functions.sh
22 DEFAULT=/etc/default/$PKG
23-[ -e "$FUNC_LIB" ] || exit 0
24
25 . $FUNC_LIB
26 . $PKG_DIR/lib/sound.sh
27Index: git/eeepc-acpi-scripts/hotkey.sh
28===================================================================
29--- git.orig/eeepc-acpi-scripts/hotkey.sh 2011-11-29 19:21:55.000000000 +0800
30+++ git/eeepc-acpi-scripts/hotkey.sh 2011-11-29 19:39:51.000000000 +0800
31@@ -1,12 +1,10 @@
32 #!/bin/sh
33
34 [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
35-# do nothing if package is removed
36 PKG=eeepc-acpi-scripts
37 PKG_DIR=/usr/share/acpi-support/$PKG
38 FUNC_LIB=$PKG_DIR/lib/functions.sh
39 DEFAULT=/etc/default/$PKG
40-[ -e "$FUNC_LIB" ] || exit 0
41
42 case $(runlevel) in
43 *0|*6)
44Index: git/eeepc-acpi-scripts/vga-toggle.sh
45===================================================================
46--- git.orig/eeepc-acpi-scripts/vga-toggle.sh 2011-11-29 19:21:55.000000000 +0800
47+++ git/eeepc-acpi-scripts/vga-toggle.sh 2011-11-29 19:40:24.000000000 +0800
48@@ -1,12 +1,10 @@
49 #!/bin/sh
50
51 [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
52-# do nothing if package is removed
53 PKG=eeepc-acpi-scripts
54 PKG_DIR=/usr/share/acpi-support/$PKG
55 FUNC_LIB=$PKG_DIR/lib/functions.sh
56 DEFAULT=/etc/default/$PKG
57-[ -e "$FUNC_LIB" ] || exit 0
58
59 if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
60 . $FUNC_LIB
diff --git a/meta/recipes-bsp/formfactor/files/config b/meta/recipes-bsp/formfactor/files/config
new file mode 100755
index 0000000000..41066def97
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/config
@@ -0,0 +1,50 @@
1#!/bin/sh
2
3if [ -e /etc/formfactor/machconfig ]; then
4 . /etc/formfactor/machconfig
5fi
6
7if [ -z "$HAVE_TOUCHSCREEN" ]; then
8 HAVE_TOUCHSCREEN=0
9fi
10
11if [ -z "$HAVE_KEYBOARD" ]; then
12 HAVE_KEYBOARD=0
13fi
14
15if [ -z "$HAVE_KEYBOARD_PORTRAIT" ]; then
16 HAVE_KEYBOARD_PORTRAIT=0
17fi
18
19if [ -z "$HAVE_KEYBOARD_LANDSCAPE" ]; then
20 HAVE_KEYBOARD_LANDSCAPE=0
21fi
22
23if [ -z "$DISPLAY_CAN_ROTATE" ]; then
24 DISPLAY_CAN_ROTATE=0
25fi
26
27if [ -z "$DISPLAY_ORIENTATION" ]; then
28 DISPLAY_ORIENTATION=0
29fi
30
31if [ -e "/dev/fb" ]; then
32 if [ -z "$DISPLAY_WIDTH_PIXELS" ]; then
33 DISPLAY_WIDTH_PIXELS=`/usr/sbin/fbset | grep geometry | awk '{ print $2 }'`
34 fi
35
36 if [ -z "$DISPLAY_HEIGHT_PIXELS" ]; then
37 DISPLAY_HEIGHT_PIXELS=`/usr/sbin/fbset | grep geometry | awk '{ print $3 }'`
38 fi
39
40 if [ -z "$DISPLAY_BPP" ]; then
41 DISPLAY_BPP=`/usr/sbin/fbset | grep geometry | awk '{ print $6 }'`
42 fi
43fi
44
45#
46# No way to guess these or have any defaults
47#
48#DISPLAY_WIDTH_MM
49#DISPLAY_HEIGHT_MM
50#DISPLAY_SUBPIXEL_ORDER=
diff --git a/meta/recipes-bsp/formfactor/files/machconfig b/meta/recipes-bsp/formfactor/files/machconfig
new file mode 100755
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/machconfig
diff --git a/meta/recipes-bsp/formfactor/files/qemuarm/machconfig b/meta/recipes-bsp/formfactor/files/qemuarm/machconfig
new file mode 100755
index 0000000000..56a2ae2e3c
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemuarm/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6#DISPLAY_WIDTH_PIXELS=640
7#DISPLAY_HEIGHT_PIXELS=480
8#DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig b/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig
new file mode 100755
index 0000000000..56a2ae2e3c
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6#DISPLAY_WIDTH_PIXELS=640
7#DISPLAY_HEIGHT_PIXELS=480
8#DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig b/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig
new file mode 100755
index 0000000000..56a2ae2e3c
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6#DISPLAY_WIDTH_PIXELS=640
7#DISPLAY_HEIGHT_PIXELS=480
8#DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemumips/machconfig b/meta/recipes-bsp/formfactor/files/qemumips/machconfig
new file mode 100755
index 0000000000..56777b6e2e
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemumips/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6DISPLAY_WIDTH_PIXELS=640
7DISPLAY_HEIGHT_PIXELS=480
8DISPLAY_BPP=16
9DISPLAY_DPI=150
10#DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemuppc/machconfig b/meta/recipes-bsp/formfactor/files/qemuppc/machconfig
new file mode 100755
index 0000000000..5ea2270cd8
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemuppc/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6DISPLAY_WIDTH_PIXELS=800
7DISPLAY_HEIGHT_PIXELS=600
8DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig b/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig
new file mode 100755
index 0000000000..56a2ae2e3c
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6#DISPLAY_WIDTH_PIXELS=640
7#DISPLAY_HEIGHT_PIXELS=480
8#DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/files/qemux86/machconfig b/meta/recipes-bsp/formfactor/files/qemux86/machconfig
new file mode 100755
index 0000000000..56a2ae2e3c
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/files/qemux86/machconfig
@@ -0,0 +1,10 @@
1HAVE_TOUCHSCREEN=1
2HAVE_KEYBOARD=1
3
4DISPLAY_CAN_ROTATE=0
5DISPLAY_ORIENTATION=0
6#DISPLAY_WIDTH_PIXELS=640
7#DISPLAY_HEIGHT_PIXELS=480
8#DISPLAY_BPP=16
9DISPLAY_DPI=150
10DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/meta/recipes-bsp/formfactor/formfactor_0.0.bb b/meta/recipes-bsp/formfactor/formfactor_0.0.bb
new file mode 100644
index 0000000000..5c30bd510d
--- /dev/null
+++ b/meta/recipes-bsp/formfactor/formfactor_0.0.bb
@@ -0,0 +1,21 @@
1SUMMARY = "Device formfactor information"
2SECTION = "base"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
5 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
6PR = "r45"
7
8SRC_URI = "file://config file://machconfig"
9S = "${WORKDIR}"
10
11PACKAGE_ARCH = "${MACHINE_ARCH}"
12INHIBIT_DEFAULT_DEPS = "1"
13
14do_install() {
15 # Install file only if it has contents
16 install -d ${D}${sysconfdir}/formfactor/
17 install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/
18 if [ -s "${S}/machconfig" ]; then
19 install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/
20 fi
21}
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
new file mode 100644
index 0000000000..e5b47c197a
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
@@ -0,0 +1,48 @@
1Fix parallel make failure for archives
2
3Upstream-Status: Pending
4
5The lib and gnuefi makefiles were using the lib.a() form which compiles
6and ar's as a pair instead of compiling all and then ar'ing which can
7parallelize better. This was resulting in build failures on larger values
8of -j.
9
10See http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
11for details.
12
13Signed-off-by: Saul Wold <sgw@linux.intel.com>
14Signed-off-by: Darren Hart <dvhart@linux.intel.com>
15---
16---
17 gnuefi/Makefile | 3 ++-
18 lib/Makefile | 3 ++-
19 2 files changed, 4 insertions(+), 2 deletions(-)
20
21Index: gnu-efi-3.0/lib/Makefile
22===================================================================
23--- gnu-efi-3.0.orig/lib/Makefile
24+++ gnu-efi-3.0/lib/Makefile
25@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
26 libsubdirs:
27 for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
28
29-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
30+libefi.a: $(OBJS)
31+ $(AR) rv $@ $(OBJS)
32
33 clean:
34 rm -f libefi.a *~ $(OBJS) */*.o
35Index: gnu-efi-3.0/gnuefi/Makefile
36===================================================================
37--- gnu-efi-3.0.orig/gnuefi/Makefile
38+++ gnu-efi-3.0/gnuefi/Makefile
39@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
40
41 all: $(TARGETS)
42
43-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
44+libgnuefi.a: $(OBJS)
45+ $(AR) rv $@ $(OBJS)
46
47 clean:
48 rm -f $(TARGETS) *~ *.o $(OBJS)
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
new file mode 100644
index 0000000000..27c94e8a74
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
@@ -0,0 +1,22 @@
1Fix parallel make failure
2
3Upstream-Status: Submitted [Maintainer directly]
4
5Add a missing dependency which resulted in a race leading to failure
6on larger values of -j.
7
8Signed-off-by: Darren Hart <dvhart@linux.intel.com>
9
10Index: gnu-efi-3.0/Makefile
11===================================================================
12--- gnu-efi-3.0.orig/Makefile
13+++ gnu-efi-3.0/Makefile
14@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
15
16 SUBDIRS = lib gnuefi inc apps
17
18+gnuefi: lib
19+
20 all: check_gcc $(SUBDIRS)
21
22 $(SUBDIRS):
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
new file mode 100644
index 0000000000..dbf2a07a8a
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
@@ -0,0 +1,33 @@
1SUMMARY = "Libraries for producing EFI binaries"
2HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
3SECTION = "devel"
4LICENSE = "GPLv2+"
5LIC_FILES_CHKSUM = "file://debian/copyright;md5=5fb358a180f484b285b0d99acdc29666"
6
7SRC_URI = "http://downloads.sourceforge.net/gnu-efi/gnu-efi_3.0u.orig.tar.gz \
8 file://parallel-make.patch \
9 file://parallel-make-archives.patch \
10 "
11SRC_URI[md5sum] = "d15d3c700e79a1e2938544d73edc572d"
12SRC_URI[sha256sum] = "3c0d450d5829204ca05dcb3b2aae772e52c379b7c7e09146759c6315606f934e"
13
14COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
15
16S = "${WORKDIR}/gnu-efi-3.0"
17
18def gnu_efi_arch(d):
19 import re
20 tarch = d.getVar("TARGET_ARCH", True)
21 if re.match("i[3456789]86", tarch):
22 return "ia32"
23 return tarch
24
25EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
26 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}' 'LIBDIR=${libdir}' \
27 "
28
29do_install() {
30 oe_runmake install INSTALLROOT="${D}"
31}
32
33FILES_${PN} += "${libdir}/*.lds"
diff --git a/meta/recipes-bsp/grub/files/0001-Fix-build-with-glibc-2.20.patch b/meta/recipes-bsp/grub/files/0001-Fix-build-with-glibc-2.20.patch
new file mode 100644
index 0000000000..46aaa97cf2
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0001-Fix-build-with-glibc-2.20.patch
@@ -0,0 +1,32 @@
1From 275fe0269ecc00af4788afaf9dc151a50b25645b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 28 Aug 2014 19:26:14 -0700
4Subject: [PATCH] Fix build with glibc 2.20
5
6* grub-core/kern/emu/hostfs.c: squahes below warning
7 warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Submitted
12
13---
14 grub-core/kern/emu/hostfs.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
18index 7e725f6..8dd8e65 100644
19--- a/grub-core/kern/emu/hostfs.c
20+++ b/grub-core/kern/emu/hostfs.c
21@@ -19,7 +19,7 @@
22
23 #include <config-util.h>
24
25-#define _BSD_SOURCE
26+#define _DEFAULT_SOURCE
27 #include <grub/fs.h>
28 #include <grub/file.h>
29 #include <grub/disk.h>
30--
312.1.0
32
diff --git a/meta/recipes-bsp/grub/files/cfg b/meta/recipes-bsp/grub/files/cfg
new file mode 100644
index 0000000000..ffffe47638
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/cfg
@@ -0,0 +1,2 @@
1search.file /EFI/BOOT/grub.cfg root
2set prefix=($root)/EFI/BOOT
diff --git a/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch b/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
new file mode 100644
index 0000000000..0eece082f8
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
@@ -0,0 +1,33 @@
1Disable liblzma if --enable-liblzma=no
2
3Upstream-Status: Inappropriate [configuration]
4
5Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
6
7--- a/configure.ac
8+++ b/configure.ac
9@@ -1029,10 +1029,20 @@ fi
10
11 AC_SUBST([LIBGEOM])
12
13-AC_CHECK_LIB([lzma], [lzma_code],
14- [LIBLZMA="-llzma"
15- AC_DEFINE([HAVE_LIBLZMA], [1],
16- [Define to 1 if you have the LZMA library.])],)
17+AC_ARG_ENABLE([liblzma],
18+ [AS_HELP_STRING([--enable-liblzma],
19+ [enable liblzma integration (default=guessed)])])
20+if test x"$enable_liblzma" = xno ; then
21+ liblzma_excuse="explicitly disabled"
22+fi
23+
24+if test x"$liblzma_excuse" = x ; then
25+ AC_CHECK_LIB([lzma], [lzma_code],
26+ [LIBLZMA="-llzma"
27+ AC_DEFINE([HAVE_LIBLZMA], [1],
28+ [Define to 1 if you have the LZMA library.])],)
29+fi
30+
31 AC_SUBST([LIBLZMA])
32
33 AC_ARG_ENABLE([libzfs],
diff --git a/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch b/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
new file mode 100644
index 0000000000..61ae2f5372
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
@@ -0,0 +1,21 @@
1Upstream-Status: Backport
2
3This fixes compilation issues when using flex-2.5.37. It was taken from upstream.
4
5Original author is: Vladimir Serbinenko <phcoder@gmail.com>
6
7Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
8
9Index: grub-2.00/grub-core/script/yylex.l
10===================================================================
11--- grub-2.00.orig/grub-core/script/yylex.l 2012-06-08 23:24:15.000000000 +0300
12+++ grub-2.00/grub-core/script/yylex.l 2013-07-31 14:34:40.708100982 +0300
13@@ -29,6 +29,8 @@
14 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
15 #pragma GCC diagnostic ignored "-Wmissing-declarations"
16 #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
17+#pragma GCC diagnostic ignored "-Wunused-function"
18+#pragma GCC diagnostic ignored "-Wsign-compare"
19
20 #define yyfree grub_lexer_yyfree
21 #define yyalloc grub_lexer_yyalloc
diff --git a/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch b/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
new file mode 100644
index 0000000000..eb8916cb72
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
@@ -0,0 +1,53 @@
1From 7ab576a7c61406b7e63739d1b11017ae336b9008 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Mon, 3 Mar 2014 03:34:48 -0500
4Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
5
6Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
7that the grub-mkconfig and grub-install can work correctly.
8
9We only need add the bzImage to util/grub.d/10_linux.in, but also add it
10to util/grub.d/20_linux_xen.in to keep compatibility.
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15---
16 util/grub.d/10_linux.in | 4 ++--
17 util/grub.d/20_linux_xen.in | 2 +-
18 2 files changed, 3 insertions(+), 3 deletions(-)
19
20diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
21index 14402e8..c58f417 100644
22--- a/util/grub.d/10_linux.in
23+++ b/util/grub.d/10_linux.in
24@@ -153,11 +153,11 @@ EOF
25 machine=`uname -m`
26 case "x$machine" in
27 xi?86 | xx86_64)
28- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
29+ list=`for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
30 if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
31 done` ;;
32 *)
33- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
34+ list=`for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
35 if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
36 done` ;;
37 esac
38diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
39index 1d94502..b2decf3 100644
40--- a/util/grub.d/20_linux_xen.in
41+++ b/util/grub.d/20_linux_xen.in
42@@ -138,7 +138,7 @@ EOF
43 EOF
44 }
45
46-linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
47+linux_list=`for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
48 if grub_file_is_not_garbage "$i"; then
49 basename=$(basename $i)
50 version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
51--
521.7.10.4
53
diff --git a/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch b/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
new file mode 100644
index 0000000000..09ef4dbff9
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Pending
2
3
4This patch avoids this configure failure
5
6configure:20306: checking whether `ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow' generates calls to `__enable_execute_stack()'
7configure:20320: ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -mfpmath=387 -fno-dwarf2-cfi-asm -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -falign-loops=1 -S conftest.c
8conftest.c:308:6: error: no previous prototype for 'g' [-Werror=missing-prototypes]
9cc1: all warnings being treated as errors
10configure:20323: $? = 1
11configure:20327: error: ccache i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/builddisk/build/build0/tmp/sysroots/emenlow failed to produce assembly code
12
13Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
142012/04/13
15
16Index: grub-2.00/acinclude.m4
17===================================================================
18--- grub-2.00.orig/acinclude.m4
19+++ grub-2.00/acinclude.m4
20@@ -317,6 +317,7 @@ dnl Check if the C compiler generates ca
21 AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
22 AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
23 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
24+void g (int);
25 void f (int (*p) (void));
26 void g (int i)
27 {
diff --git a/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch b/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
new file mode 100644
index 0000000000..c557f13e23
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
@@ -0,0 +1,24 @@
1Upstream-Status: pending
2
3This patch fixes this configure issue for grub when -mfpmath=sse is in the gcc parameters.
4
5configure:20574: i586-poky-linux-gcc -m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse --sysroot=/usr/local/dev/yocto/grubtest2/build/tmp/sysroots/emenlow -o conftest -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -nostdlib -Wl,--defsym,___main=0x8100 -Wall -W -I$(top_srcdir)/include -I$(top_builddir)/include -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c >&5
6conftest.c:1:0: error: SSE instruction set disabled, using 387 arithmetics [-Werror]
7cc1: all warnings being treated as errors
8
9Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
102012/04/13
11
12Index: grub-1.99/configure.ac
13===================================================================
14--- grub-1.99.orig/configure.ac
15+++ grub-1.99/configure.ac
16@@ -378,7 +378,7 @@ if test "x$target_cpu" = xi386; then
17
18 # Some toolchains enable these features by default, but they need
19 # registers that aren't set up properly in GRUB.
20- TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
21+ TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -mfpmath=387"
22 fi
23
24 # By default, GCC 4.4 generates .eh_frame sections containing unwind
diff --git a/meta/recipes-bsp/grub/files/grub-2.00-ignore-gnulib-gets-stupidity.patch b/meta/recipes-bsp/grub/files/grub-2.00-ignore-gnulib-gets-stupidity.patch
new file mode 100644
index 0000000000..70f60015c2
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-2.00-ignore-gnulib-gets-stupidity.patch
@@ -0,0 +1,28 @@
1From f66d54b934710f54999debb72e8b7c620edece1d Mon Sep 17 00:00:00 2001
2From: Peter Jones <pjones@redhat.com>
3Date: Fri, 25 May 2012 15:28:19 -0400
4Subject: [PATCH] gnulib accused in build breaking shocker.
5
6Upstream-Status: pending [Fedora will push this]
7
8---
9 grub-core/gnulib/stdio.in.h | 2 ++
10 1 file changed, 2 insertions(+)
11
12diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h
13index 80b9dbf..69932d9 100644
14--- a/grub-core/gnulib/stdio.in.h
15+++ b/grub-core/gnulib/stdio.in.h
16@@ -141,7 +141,9 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
17 so any use of gets warrants an unconditional warning. Assume it is
18 always declared, since it is required by C89. */
19 #undef gets
20+#if 0
21 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
22+#endif
23
24 #if @GNULIB_FOPEN@
25 # if @REPLACE_FOPEN@
26--
271.7.10.1
28
diff --git a/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
new file mode 100644
index 0000000000..4588fca4ba
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
@@ -0,0 +1,131 @@
1Allow a compilation without -mcmodel=large
2
3It's provided by Vladimir Serbinenko, and he will commit
4it upstream so it should be backport patch.
5
6Upstream-Status: Backport
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9
10--
11diff --git a/configure.ac b/configure.ac
12index 9f8fb8a..2c5e6ed 100644
13--- a/configure.ac
14+++ b/configure.ac
15@@ -723,9 +723,7 @@ if test "$target_cpu" = x86_64; then
16 [grub_cv_cc_mcmodel=yes],
17 [grub_cv_cc_mcmodel=no])
18 ])
19- if test "x$grub_cv_cc_mcmodel" = xno; then
20- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
21- else
22+ if test "x$grub_cv_cc_mcmodel" = xyes; then
23 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
24 fi
25 fi
26diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
27index 1409b5d..6e9dace 100644
28--- a/grub-core/kern/efi/mm.c
29+++ b/grub-core/kern/efi/mm.c
30@@ -32,6 +32,12 @@
31 #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
32 #define PAGES_TO_BYTES(pages) ((pages) << 12)
33
34+#if defined (__code_model_large__) || !defined (__x86_64__)
35+#define MAX_USABLE_ADDRESS 0xffffffff
36+#else
37+#define MAX_USABLE_ADDRESS 0x7fffffff
38+#endif
39+
40 /* The size of a memory map obtained from the firmware. This must be
41 a multiplier of 4KB. */
42 #define MEMORY_MAP_SIZE 0x3000
43@@ -58,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
44
45 #if 1
46 /* Limit the memory access to less than 4GB for 32-bit platforms. */
47- if (address > 0xffffffff)
48+ if (address > MAX_USABLE_ADDRESS)
49 return 0;
50 #endif
51
52@@ -66,7 +72,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
53 if (address == 0)
54 {
55 type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
56- address = 0xffffffff;
57+ address = MAX_USABLE_ADDRESS;
58 }
59 else
60 type = GRUB_EFI_ALLOCATE_ADDRESS;
61@@ -86,7 +92,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
62 {
63 /* Uggh, the address 0 was allocated... This is too annoying,
64 so reallocate another one. */
65- address = 0xffffffff;
66+ address = MAX_USABLE_ADDRESS;
67 status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address);
68 grub_efi_free_pages (0, pages);
69 if (status != GRUB_EFI_SUCCESS)
70@@ -319,7 +325,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
71 {
72 if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
73 #if 1
74- && desc->physical_start <= 0xffffffff
75+ && desc->physical_start <= MAX_USABLE_ADDRESS
76 #endif
77 && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
78 && desc->num_pages != 0)
79@@ -337,9 +343,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
80 #if 1
81 if (BYTES_TO_PAGES (filtered_desc->physical_start)
82 + filtered_desc->num_pages
83- > BYTES_TO_PAGES (0x100000000LL))
84+ > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL))
85 filtered_desc->num_pages
86- = (BYTES_TO_PAGES (0x100000000LL)
87+ = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)
88 - BYTES_TO_PAGES (filtered_desc->physical_start));
89 #endif
90
91diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
92index 65f09ef..17c1215 100644
93--- a/grub-core/kern/x86_64/dl.c
94+++ b/grub-core/kern/x86_64/dl.c
95@@ -100,14 +100,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
96 break;
97
98 case R_X86_64_PC32:
99- *addr32 += rel->r_addend + sym->st_value -
100- (Elf64_Xword) seg->addr - rel->r_offset;
101+ {
102+ grub_int64_t value;
103+ value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
104+ (Elf64_Xword) seg->addr - rel->r_offset;
105+ if (value != (grub_int32_t) value)
106+ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
107+ *addr32 = value;
108+ }
109 break;
110
111 case R_X86_64_32:
112+ {
113+ grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
114+ if (value != (grub_uint32_t) value)
115+ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
116+ *addr32 = value;
117+ }
118+ break;
119 case R_X86_64_32S:
120- *addr32 += rel->r_addend + sym->st_value;
121- break;
122+ {
123+ grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
124+ if (value != (grub_int32_t) value)
125+ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
126+ *addr32 = value;
127+ }
128+ break;
129
130 default:
131 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
diff --git a/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch b/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
new file mode 100644
index 0000000000..4f12628a4b
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
@@ -0,0 +1,32 @@
1From eb6368e65f6988eebad26cebdec057f797bceb40 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Tue, 9 Sep 2014 00:02:30 -0700
4Subject: [PATCH] Fix build with glibc 2.20
5
6* grub-core/kern/emu/hostfs.c: squahes below warning
7 warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
8
9Upstream-Status: Submitted
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
13---
14 grub-core/kern/emu/hostfs.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
18index 3cb089c..a51ee32 100644
19--- a/grub-core/kern/emu/hostfs.c
20+++ b/grub-core/kern/emu/hostfs.c
21@@ -16,7 +16,7 @@
22 * You should have received a copy of the GNU General Public License
23 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
24 */
25-#define _BSD_SOURCE
26+#define _DEFAULT_SOURCE
27 #include <grub/fs.h>
28 #include <grub/file.h>
29 #include <grub/disk.h>
30--
311.7.9.5
32
diff --git a/meta/recipes-bsp/grub/files/grub-no-unused-result.patch b/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
new file mode 100644
index 0000000000..4cbd0838d1
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
@@ -0,0 +1,19 @@
1Signed-off-by: Radu Moisan <radu.moisan@intel.com>
2Upstream-Status: Pending
3
4I had an error because of an unused return value for read().
5I added -Wno-unused-result.
6
7Index: grub-2.00/configure.ac
8===================================================================
9--- grub-2.00.orig/configure.ac 2012-08-13 16:32:33.000000000 +0300
10+++ grub-2.00/configure.ac 2012-08-13 16:38:22.000000000 +0300
11@@ -394,7 +394,7 @@
12 LIBS=""
13
14 # debug flags.
15-WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
16+WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wno-unused-result -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
17 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
18 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
19 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
diff --git a/meta/recipes-bsp/grub/grub-0.97/autohell.patch b/meta/recipes-bsp/grub/grub-0.97/autohell.patch
new file mode 100644
index 0000000000..d66207ae6c
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-0.97/autohell.patch
@@ -0,0 +1,21 @@
1Upstream-Status: Inappropriate [configuration]
2
3---
4 configure.ac | 4 ++--
5 1 file changed, 2 insertions(+), 2 deletions(-)
6
7Index: grub-0.97/configure.ac
8===================================================================
9--- grub-0.97.orig/configure.ac 2008-09-12 17:39:52.000000000 +0200
10+++ grub-0.97/configure.ac 2008-09-12 17:40:21.000000000 +0200
11@@ -60,8 +60,8 @@ AC_PROG_CC
12 _AM_DEPENDENCIES(CC)
13
14 dnl Because recent automake complains about AS, set it here.
15-CCAS="$CC"
16-AC_SUBST(CCAS)
17+AM_PROG_AS
18+AC_SUBST(AS)
19
20 AC_ARG_WITH(binutils,
21 [ --with-binutils=DIR search the directory DIR to find binutils])
diff --git a/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch b/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
new file mode 100644
index 0000000000..d225d13dce
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
@@ -0,0 +1,101 @@
1Upstream-Status: Inappropriate [No Longer Maintained]
2
3diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
4--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
5+++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
6@@ -79,7 +79,52 @@
7 __u32 s_rev_level; /* Revision level */
8 __u16 s_def_resuid; /* Default uid for reserved blocks */
9 __u16 s_def_resgid; /* Default gid for reserved blocks */
10- __u32 s_reserved[235]; /* Padding to the end of the block */
11+ /*
12+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
13+ *
14+ * Note: the difference between the compatible feature set and
15+ * the incompatible feature set is that if there is a bit set
16+ * in the incompatible feature set that the kernel doesn't
17+ * know about, it should refuse to mount the filesystem.
18+ *
19+ * e2fsck's requirements are more strict; if it doesn't know
20+ * about a feature in either the compatible or incompatible
21+ * feature set, it must abort and not try to meddle with
22+ * things it doesn't understand...
23+ */
24+ __u32 s_first_ino; /* First non-reserved inode */
25+ __u16 s_inode_size; /* size of inode structure */
26+ __u16 s_block_group_nr; /* block group # of this superblock */
27+ __u32 s_feature_compat; /* compatible feature set */
28+ __u32 s_feature_incompat; /* incompatible feature set */
29+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
30+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
31+ char s_volume_name[16]; /* volume name */
32+ char s_last_mounted[64]; /* directory where last mounted */
33+ __u32 s_algorithm_usage_bitmap; /* For compression */
34+ /*
35+ * Performance hints. Directory preallocation should only
36+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
37+ */
38+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
39+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
40+ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
41+ /*
42+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
43+ */
44+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
45+ __u32 s_journal_inum; /* inode number of journal file */
46+ __u32 s_journal_dev; /* device number of journal file */
47+ __u32 s_last_orphan; /* start of list of inodes to delete */
48+ __u32 s_hash_seed[4]; /* HTREE hash seed */
49+ __u8 s_def_hash_version; /* Default hash version to use */
50+ __u8 s_jnl_backup_type; /* Default type of journal backup */
51+ __u16 s_reserved_word_pad;
52+ __u32 s_default_mount_opts;
53+ __u32 s_first_meta_bg; /* First metablock group */
54+ __u32 s_mkfs_time; /* When the filesystem was created */
55+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
56+ __u32 s_reserved[172]; /* Padding to the end of the block */
57 };
58
59 struct ext2_group_desc
60@@ -218,6 +263,14 @@
61 #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
62 #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
63
64+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
65+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
66+#define EXT2_GOOD_OLD_INODE_SIZE 128
67+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
68+ EXT2_GOOD_OLD_INODE_SIZE : \
69+ (s)->s_inode_size)
70+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
71+
72 /* linux/ext2_fs.h */
73 #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
74 /* kind of from ext2/super.c */
75@@ -553,7 +606,7 @@
76 gdp = GROUP_DESC;
77 ino_blk = gdp[desc].bg_inode_table +
78 (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
79- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
80+ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
81 #ifdef E2DEBUG
82 printf ("inode table fsblock=%d\n", ino_blk);
83 #endif /* E2DEBUG */
84@@ -565,13 +618,12 @@
85 /* reset indirect blocks! */
86 mapblock2 = mapblock1 = -1;
87
88- raw_inode = INODE +
89- ((current_ino - 1)
90- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
91+ raw_inode = (struct ext2_inode *)((char *)INODE +
92+ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
93+ EXT2_INODE_SIZE (SUPERBLOCK));
94 #ifdef E2DEBUG
95 printf ("ipb=%d, sizeof(inode)=%d\n",
96- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
97- sizeof (struct ext2_inode));
98+ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
99 printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
100 printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
101 for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
diff --git a/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch b/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
new file mode 100644
index 0000000000..0cf7dc96d7
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
@@ -0,0 +1,74 @@
1Upstream-Status: Inappropriate
2
3Subject: [PATCH] grub: fix for automake-1.12
4
5automake 1.12 has depricated automatic de-ANSI-fication support
6
7this patch avoids these kinds of errors:
8
9| stage1/Makefile.am:2: error: 'pkglibdir' is not a legitimate directory for 'DATA'
10| stage2/Makefile.am:35: error: 'pkglibdir' is not a legitimate directory for 'DATA'
11| stage2/Makefile.am:46: error: 'pkglibdir' is not a legitimate directory for 'DATA'
12| autoreconf: automake failed with exit status: 1
13| ERROR: autoreconf execution failed.
14
15The upstream status is marked as 'Inappropriate' because this problem is not uncommon,
16it has been there for a long time and no change in upstream.
17
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19
20Index: grub-0.97/stage1/Makefile.am
21===================================================================
22--- a/stage1/Makefile.am
23+++ b/stage1/Makefile.am
24@@ -1,7 +1,7 @@
25-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
26-nodist_pkglib_DATA = stage1
27+pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
28+nodist_pkgdata_DATA = stage1
29
30-CLEANFILES = $(nodist_pkglib_DATA)
31+CLEANFILES = $(nodist_pkgdata_DATA)
32
33 # We can't use builtins or standard includes.
34 AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
35Index: grub-0.97/stage2/Makefile.am
36===================================================================
37--- a/stage2/Makefile.am
38+++ b/stage2/Makefile.am
39@@ -27,12 +27,12 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
40 -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
41
42 # Stage 2 and Stage 1.5's.
43-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
44+pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
45
46 EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
47
48 if DISKLESS_SUPPORT
49-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
50+pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
51 ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
52 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
53 nbgrub pxegrub
54@@ -43,7 +43,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
55 reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
56 xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
57 else
58-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
59+pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
60 ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
61 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
62 noinst_DATA = pre_stage2 start start_eltorito
63@@ -105,7 +105,7 @@ else
64 BUILT_SOURCES = stage2_size.h
65 endif
66
67-CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
68+CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES)
69
70 stage2_size.h: pre_stage2
71 -rm -f stage2_size.h
72--
731.7.9.5
74
diff --git a/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch b/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
new file mode 100644
index 0000000000..70037e47c7
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Inappropriate [disable feature]
2
3After the commit "tcmode-default: switch to gcc 4.6.0 for x86, x86-64 & arm",
4we got bug 1099 (http://bugzilla.yoctoproject.org/show_bug.cgi?id=1099):
5
6Running "install --stage2=/ssd/boot/grub/stage2 /boot/grub/stage1(hd0)
7 /boot/grub/stage2 p /boot/grub/menu list" failed
8Error 6: Mismatched or corrupt version of stage1/stage2
9
10This turned out to be a gcc's bug. See
11https://bugs.gentoo.org/show_bug.cgi?id=360513
12http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
13
14Upstream gcc seems uninterested in the bug, so at present we can disable the
15option as a workaround. Thanks Ryan Hill for the investigation and the
16workaround patch.
17
18Dexuan Cui <dexuan.cui@intel.com>
19Wed Jun 29 20:21:39 CST 2011
20
21--- grub-0.97/stage2/Makefile.am.orig
22+++ grub-0.97/stage2/Makefile.am
23@@ -79,7 +79,7 @@
24 HERCULES_FLAGS =
25 endif
26
27-STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
28+STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-reorder-functions -fno-builtin -nostdinc \
29 $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
30
31 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
diff --git a/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch b/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
new file mode 100644
index 0000000000..bd8e0a89fc
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
@@ -0,0 +1,40 @@
1
2This patch is from ubuntu:
3 * objcopy-absolute.diff (update): Remove .note, .comment, and
4 .note.gnu.build-id sections from images (LP: #444703).
5
6Upstream-Status: Inappropriate [no longer maintained]
7
8Index: b/acinclude.m4
9===================================================================
10--- a/acinclude.m4
11+++ b/acinclude.m4
12@@ -61,7 +61,7 @@
13 else
14 AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
15 fi
16- if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
17+ if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
18 else
19 AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
20 fi
21Index: b/stage1/Makefile.am
22===================================================================
23--- a/stage1/Makefile.am
24+++ b/stage1/Makefile.am
25@@ -12,4 +12,4 @@
26
27 SUFFIXES = .exec
28 .exec:
29- $(OBJCOPY) -O binary $< $@
30+ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
31Index: b/stage2/Makefile.am
32===================================================================
33--- a/stage2/Makefile.am
34+++ b/stage2/Makefile.am
35@@ -293,4 +293,4 @@
36 # General rule for making a raw binary.
37 SUFFIXES = .exec
38 .exec:
39- $(OBJCOPY) -O binary $< $@
40+ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
diff --git a/meta/recipes-bsp/grub/grub-2.00/fix-endianness-problem.patch b/meta/recipes-bsp/grub/grub-2.00/fix-endianness-problem.patch
new file mode 100644
index 0000000000..079992afba
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-2.00/fix-endianness-problem.patch
@@ -0,0 +1,44 @@
1grub-core/net/tftp.c: fix endianness problem.
2
3 * grub-core/net/tftp.c (ack): Fix endianness problem.
4 (tftp_receive): Likewise.
5 Reported by: Michael Davidsaver.
6
7Upstream-Status: Backport
8
9diff --git a/ChangeLog b/ChangeLog
10index 81bdae9..c2f42d5 100644
11--- a/ChangeLog
12+++ b/ChangeLog
13@@ -1,3 +1,9 @@
14+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
15+
16+ * grub-core/net/tftp.c (ack): Fix endianness problem.
17+ (tftp_receive): Likewise.
18+ Reported by: Michael Davidsaver.
19+
20 2012-06-27 Vladimir Serbinenko <phcoder@gmail.com>
21
22 * configure.ac: Bump version to 2.00.
23diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
24index 9c70efb..d0f39ea 100644
25--- a/grub-core/net/tftp.c
26+++ b/grub-core/net/tftp.c
27@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
28
29 tftph_ack = (struct tftphdr *) nb_ack.data;
30 tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
31- tftph_ack->u.ack.block = block;
32+ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
33
34 err = grub_net_send_udp_packet (data->sock, &nb_ack);
35 if (err)
36@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
37 grub_priority_queue_pop (data->pq);
38
39 if (file->device->net->packs.count < 50)
40- err = ack (data, tftph->u.data.block);
41+ err = ack (data, data->block + 1);
42 else
43 {
44 file->device->net->stall = 1;
diff --git a/meta/recipes-bsp/grub/grub-2.00/grub-install.in.patch b/meta/recipes-bsp/grub/grub-2.00/grub-install.in.patch
new file mode 100644
index 0000000000..326951df44
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-2.00/grub-install.in.patch
@@ -0,0 +1,20 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Our use of grub-install doesn't require the -x option, so we should be
4be able make use of grep versions that don't support it.
5
6Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
7
8Index: grub-1.99/util/grub-install.in
9===================================================================
10--- grub-1.99.orig/util/grub-install.in 2011-09-09 22:37:20.093906679 -0500
11+++ grub-1.99/util/grub-install.in 2011-09-09 22:37:30.854737882 -0500
12@@ -510,7 +510,7 @@
13
14 if [ "x${devabstraction_module}" = "x" ] ; then
15 if [ x"${install_device}" != x ]; then
16- if echo "${install_device}" | grep -qx "(.*)" ; then
17+ if echo "${install_device}" | grep -q "(.*)" ; then
18 install_drive="${install_device}"
19 else
20 install_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${install_device}"`" || exit 1
diff --git a/meta/recipes-bsp/grub/grub-2.00/grub2-remove-sparc64-setup-from-x86-builds.patch b/meta/recipes-bsp/grub/grub-2.00/grub2-remove-sparc64-setup-from-x86-builds.patch
new file mode 100644
index 0000000000..6259a1abe3
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-2.00/grub2-remove-sparc64-setup-from-x86-builds.patch
@@ -0,0 +1,104 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3remove the grub-sparc64-setup files from the x86 builds.
4
5Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
6
7--- a/Makefile.util.am 2014-08-15 11:41:02.441011278 -0700
8+++ b/Makefile.util.am 2014-08-15 11:44:26.245021142 -0700
9@@ -4692,9 +4692,9 @@
10 endif
11
12 if COND_emu
13-sbin_PROGRAMS += grub-sparc64-setup
14+sbin_PROGRAMS +=
15 if COND_MAN_PAGES
16-man_MANS += grub-sparc64-setup.8
17+man_MANS +=
18
19 grub-sparc64-setup.8: grub-sparc64-setup
20 chmod a+x grub-sparc64-setup
21@@ -4715,9 +4715,9 @@
22 endif
23
24 if COND_i386_pc
25-sbin_PROGRAMS += grub-sparc64-setup
26+sbin_PROGRAMS +=
27 if COND_MAN_PAGES
28-man_MANS += grub-sparc64-setup.8
29+man_MANS +=
30
31 grub-sparc64-setup.8: grub-sparc64-setup
32 chmod a+x grub-sparc64-setup
33@@ -4738,9 +4738,9 @@
34 endif
35
36 if COND_i386_efi
37-sbin_PROGRAMS += grub-sparc64-setup
38+sbin_PROGRAMS +=
39 if COND_MAN_PAGES
40-man_MANS += grub-sparc64-setup.8
41+man_MANS +=
42
43 grub-sparc64-setup.8: grub-sparc64-setup
44 chmod a+x grub-sparc64-setup
45@@ -4761,9 +4761,9 @@
46 endif
47
48 if COND_i386_qemu
49-sbin_PROGRAMS += grub-sparc64-setup
50+sbin_PROGRAMS +=
51 if COND_MAN_PAGES
52-man_MANS += grub-sparc64-setup.8
53+man_MANS +=
54
55 grub-sparc64-setup.8: grub-sparc64-setup
56 chmod a+x grub-sparc64-setup
57@@ -4784,9 +4784,9 @@
58 endif
59
60 if COND_i386_coreboot
61-sbin_PROGRAMS += grub-sparc64-setup
62+sbin_PROGRAMS +=
63 if COND_MAN_PAGES
64-man_MANS += grub-sparc64-setup.8
65+man_MANS +=
66
67 grub-sparc64-setup.8: grub-sparc64-setup
68 chmod a+x grub-sparc64-setup
69@@ -4807,9 +4807,9 @@
70 endif
71
72 if COND_i386_multiboot
73-sbin_PROGRAMS += grub-sparc64-setup
74+sbin_PROGRAMS +=
75 if COND_MAN_PAGES
76-man_MANS += grub-sparc64-setup.8
77+man_MANS +=
78
79 grub-sparc64-setup.8: grub-sparc64-setup
80 chmod a+x grub-sparc64-setup
81@@ -4830,9 +4830,9 @@
82 endif
83
84 if COND_i386_ieee1275
85-sbin_PROGRAMS += grub-sparc64-setup
86+sbin_PROGRAMS +=
87 if COND_MAN_PAGES
88-man_MANS += grub-sparc64-setup.8
89+man_MANS +=
90
91 grub-sparc64-setup.8: grub-sparc64-setup
92 chmod a+x grub-sparc64-setup
93@@ -4853,9 +4853,9 @@
94 endif
95
96 if COND_x86_64_efi
97-sbin_PROGRAMS += grub-sparc64-setup
98+sbin_PROGRAMS +=
99 if COND_MAN_PAGES
100-man_MANS += grub-sparc64-setup.8
101+man_MANS +=
102
103 grub-sparc64-setup.8: grub-sparc64-setup
104 chmod a+x grub-sparc64-setup
diff --git a/meta/recipes-bsp/grub/grub-2.00/remove-gets.patch b/meta/recipes-bsp/grub/grub-2.00/remove-gets.patch
new file mode 100644
index 0000000000..463f7847ad
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-2.00/remove-gets.patch
@@ -0,0 +1,20 @@
1ISO C11 removes the specification of gets() from the C language, eglibc 2.16+ removed it
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4
5Upstream-Status: Pending
6Index: grub-1.99/grub-core/gnulib/stdio.in.h
7===================================================================
8--- grub-1.99.orig/grub-core/gnulib/stdio.in.h 2010-12-01 06:45:43.000000000 -0800
9+++ grub-1.99/grub-core/gnulib/stdio.in.h 2012-07-04 12:25:02.057099107 -0700
10@@ -140,8 +140,10 @@
11 /* It is very rare that the developer ever has full control of stdin,
12 so any use of gets warrants an unconditional warning. Assume it is
13 always declared, since it is required by C89. */
14+#if defined gets
15 #undef gets
16 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
17+#endif
18
19 #if @GNULIB_FOPEN@
20 # if @REPLACE_FOPEN@
diff --git a/meta/recipes-bsp/grub/grub-efi_2.00.bb b/meta/recipes-bsp/grub/grub-efi_2.00.bb
new file mode 100644
index 0000000000..d213f31a20
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb
@@ -0,0 +1,92 @@
1SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
2
3DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
4intended to unify bootloading across x86 operating systems. In \
5addition to loading the Linux kernel, it implements the Multiboot \
6standard, which allows for flexible loading of multiple boot images. \
7This recipe builds an EFI binary for the target. It does not install \
8or package anything, it only deploys a target-arch GRUB EFI image."
9
10HOMEPAGE = "http://www.gnu.org/software/grub/"
11SECTION = "bootloaders"
12
13LICENSE = "GPLv3"
14LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
15
16# FIXME: We should be able to optionally drop freetype as a dependency
17DEPENDS = "autogen-native flex-native bison-native"
18DEPENDS_class-target = "grub-efi-native"
19PR = "r2"
20
21SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
22 file://cfg \
23 file://grub-2.00-fpmath-sse-387-fix.patch \
24 file://grub-2.00-fix-enable_execute_stack-check.patch \
25 file://check-if-liblzma-is-disabled.patch \
26 file://grub-no-unused-result.patch \
27 file://grub-2.00-ignore-gnulib-gets-stupidity.patch \
28 file://fix-issue-with-flex-2.5.37.patch \
29 file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \
30 file://grub-2.00-add-oe-kernel.patch \
31 file://grub-efi-fix-with-glibc-2.20.patch \
32 "
33SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
34SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
35
36COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
37
38S = "${WORKDIR}/grub-${PV}"
39
40# Determine the target arch for the grub modules
41python __anonymous () {
42 import re
43 target = d.getVar('TARGET_ARCH', True)
44 if target == "x86_64":
45 grubtarget = 'x86_64'
46 grubimage = "bootx64.efi"
47 elif re.match('i.86', target):
48 grubtarget = 'i386'
49 grubimage = "bootia32.efi"
50 else:
51 raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target)
52 d.setVar("GRUB_TARGET", grubtarget)
53 d.setVar("GRUB_IMAGE", grubimage)
54}
55
56inherit autotools-brokensep gettext texinfo deploy
57
58CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
59EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
60 --enable-efiemu=no --program-prefix='' \
61 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
62
63do_install_class-target() {
64 :
65}
66
67do_install_class-native() {
68 install -d ${D}${bindir}
69 install -m 755 grub-mkimage ${D}${bindir}
70}
71
72GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search"
73
74do_deploy() {
75 # Search for the grub.cfg on the local boot media by using the
76 # built in cfg file provided via this recipe
77 grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
78 -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
79 ${GRUB_BUILDIN}
80 install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
81}
82
83do_deploy_class-native() {
84 :
85}
86
87addtask deploy after do_install before do_build
88
89FILES_${PN}-dbg += "${libdir}/${BPN}/${GRUB_TARGET}-efi/.debug"
90
91BBCLASSEXTEND = "native"
92ALLOW_EMPTY_${PN} = "1"
diff --git a/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch b/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
new file mode 100644
index 0000000000..fc5aa4e313
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
@@ -0,0 +1,34 @@
1From ff8f68cc48fd3c30d55e1d570d51f2e0952c968e Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sat, 25 Jan 2014 23:49:44 -0500
4Subject: [PATCH] autogen.sh: exclude .pc from po/POTFILES.in
5
6Exclude the .pc from po/POTFILES.in since quilt uses "patch --backup",
7which will create the backup file under .pc, this may cause unexpected
8errors, for example, on CentOS 5.x, if the backup file is null
9(newfile), it's mode will be 000, then we will get errors when xgettext
10try to read it.
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15---
16 autogen.sh | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/autogen.sh b/autogen.sh
20index 7424428..843619e 100755
21--- a/autogen.sh
22+++ b/autogen.sh
23@@ -5,7 +5,7 @@ set -e
24 export LC_COLLATE=C
25 unset LC_ALL
26
27-find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' |sort > po/POTFILES.in
28+find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './build-aux/*' ! -ipath './grub-core/lib/libgcrypt/src/misc.c' ! -ipath './grub-core/lib/libgcrypt/src/global.c' ! -ipath './grub-core/lib/libgcrypt/src/secmem.c' ! -ipath './util/grub-gen-widthspec.c' ! -ipath './util/grub-gen-asciih.c' ! -path './.pc/*' | sort > po/POTFILES.in
29 find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
30
31 echo "Importing unicode..."
32--
331.7.10.4
34
diff --git a/meta/recipes-bsp/grub/grub_0.97.bb b/meta/recipes-bsp/grub/grub_0.97.bb
new file mode 100644
index 0000000000..997a045b2e
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub_0.97.bb
@@ -0,0 +1,35 @@
1SUMMARY = "GRUB is the GRand Unified Bootloader"
2DESCRIPTION = "GRUB is a GPLed bootloader intended to unify bootloading across x86 \
3operating systems. In addition to loading the Linux kernel, it implements the Multiboot \
4standard, which allows for flexible loading of multiple boot images."
5HOMEPAGE = "http://www.gnu.org/software/grub/"
6SECTION = "bootloaders"
7
8LICENSE = "GPLv2+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b \
10 file://grub/main.c;beginline=3;endline=9;md5=22a5f28d2130fff9f2a17ed54be90ed6"
11
12RDEPENDS_${PN} = "diffutils"
13PR = "r6"
14
15SRC_URI = "ftp://alpha.gnu.org/gnu/grub/grub-${PV}.tar.gz; \
16 file://no-reorder-functions.patch \
17 file://autohell.patch \
18 file://grub_fix_for_automake-1.12.patch \
19 file://objcopy-absolute.patch \
20 file://grub-support-256byte-inode.patch \
21"
22
23SRC_URI[md5sum] = "cd3f3eb54446be6003156158d51f4884"
24SRC_URI[sha256sum] = "4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b"
25
26inherit autotools texinfo
27
28COMPATIBLE_HOST = "i.86.*-linux"
29
30EXTRA_OECONF = "--without-curses"
31
32do_install_append_vmware() {
33 mkdir -p ${D}/boot/
34 ln -sf ../usr/lib/grub/{$TARGET_ARCH}{$TARGET_VENDOR}/ ${D}/boot/grub
35}
diff --git a/meta/recipes-bsp/grub/grub_2.00.bb b/meta/recipes-bsp/grub/grub_2.00.bb
new file mode 100644
index 0000000000..e2fcbb98f5
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub_2.00.bb
@@ -0,0 +1,51 @@
1SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
2
3DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
4intended to unify bootloading across x86 operating systems. In \
5addition to loading the Linux kernel, it implements the Multiboot \
6standard, which allows for flexible loading of multiple boot images."
7
8HOMEPAGE = "http://www.gnu.org/software/grub/"
9SECTION = "bootloaders"
10
11LICENSE = "GPLv3"
12LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
13
14DEPENDS = "autogen-native flex-native bison-native xz"
15RDEPENDS_${PN} = "diffutils freetype"
16PR = "r1"
17
18SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
19 file://grub-install.in.patch \
20 file://grub-2.00-fpmath-sse-387-fix.patch \
21 file://remove-gets.patch \
22 file://check-if-liblzma-is-disabled.patch \
23 file://fix-issue-with-flex-2.5.37.patch \
24 file://grub-2.00-add-oe-kernel.patch \
25 file://fix-endianness-problem.patch \
26 file://grub2-remove-sparc64-setup-from-x86-builds.patch \
27 "
28
29SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
30SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
31
32COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
33
34FILES_${PN}-dbg += "${libdir}/${BPN}/i386-pc/.debug"
35
36
37inherit autotools gettext texinfo
38
39PACKAGECONFIG ??= ""
40PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
41PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2"
42
43EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --program-prefix="" \
44 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
45
46do_install_append () {
47 install -d ${D}${sysconfdir}/grub.d
48}
49
50INSANE_SKIP_${PN} = "arch"
51INSANE_SKIP_${PN}-dbg = "arch"
diff --git a/meta/recipes-bsp/grub/grub_git.bb b/meta/recipes-bsp/grub/grub_git.bb
new file mode 100644
index 0000000000..2a6392b82e
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub_git.bb
@@ -0,0 +1,64 @@
1SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
2
3DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
4intended to unify bootloading across x86 operating systems. In \
5addition to loading the Linux kernel, it implements the Multiboot \
6standard, which allows for flexible loading of multiple boot images."
7
8HOMEPAGE = "http://www.gnu.org/software/grub/"
9SECTION = "bootloaders"
10
11LICENSE = "GPLv3"
12LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
13
14DEPENDS = "autogen-native flex-native bison-native xz freetype"
15
16DEFAULT_PREFERENCE = "-1"
17DEFAULT_PREFERENCE_arm = "1"
18
19PV = "2.00+${SRCPV}"
20SRCREV = "87de66d9d83446ecddb29cfbdf7369102c8e209e"
21SRC_URI = "git://git.savannah.gnu.org/grub.git \
22 file://autogen.sh-exclude-pc.patch \
23 file://grub-2.00-add-oe-kernel.patch \
24 file://0001-Fix-build-with-glibc-2.20.patch \
25 "
26
27S = "${WORKDIR}/git"
28
29COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
30
31inherit autotools gettext texinfo
32
33PACKAGECONFIG ??= ""
34PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
35PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2"
36
37# configure.ac has code to set this automagically from the target tuple
38# but the OE freeform one (core2-foo-bar-linux) don't work with that.
39
40GRUBPLATFORM_arm = "uboot"
41GRUBPLATFORM_aarch64 = "efi"
42GRUBPLATFORM ??= "pc"
43
44EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont --program-prefix="" \
45 --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
46
47do_configure_prepend() {
48 ( cd ${S}
49 ${S}/autogen.sh )
50}
51
52do_install_append () {
53 install -d ${D}${sysconfdir}/grub.d
54
55}
56
57# debugedit chokes on bare metal binaries
58INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
59
60RDEPENDS_${PN} = "diffutils freetype"
61FILES_${PN}-dbg += "${libdir}/${BPN}/*/.debug"
62
63INSANE_SKIP_${PN} = "arch"
64INSANE_SKIP_${PN}-dbg = "arch"
diff --git a/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch b/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch
new file mode 100644
index 0000000000..2683f835e9
--- /dev/null
+++ b/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch
@@ -0,0 +1,39 @@
1From 0f7f9e3bb1d0e1b93f3ad8a1d5d7bdd3fbf27494 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 27 Mar 2014 07:20:33 +0000
4Subject: [PATCH] Makefile.am: use objcopy from the env
5
6It uses the "objcopy" directly, which is not suitable for cross compile.
7
8Upstream-Status: Pending
9
10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
11---
12 Makefile.am | 4 +++-
13 1 file changed, 3 insertions(+), 1 deletion(-)
14
15diff --git a/Makefile.am b/Makefile.am
16index d224418..dcd95b0 100644
17--- a/Makefile.am
18+++ b/Makefile.am
19@@ -19,6 +19,8 @@
20 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
21 AM_MAKEFLAGS = --no-print-directory
22
23+OBJCOPY ?= objcopy
24+
25 gummibootlibdir = $(prefix)/lib/gummiboot
26
27 AM_CPPFLAGS = -include config.h
28@@ -143,7 +145,7 @@ $(efi_solib): $(efi_objects)
29 .DELETE_ON_ERROR: $(efi_solib)
30
31 $(efi_loadername): $(efi_solib)
32- $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
33+ $(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
34 -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
35 --target=efi-app-$(ARCH) $< $@
36
37--
381.8.3.4
39
diff --git a/meta/recipes-bsp/gummiboot/gummiboot_git.bb b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
new file mode 100644
index 0000000000..7fc908e4fe
--- /dev/null
+++ b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
@@ -0,0 +1,34 @@
1SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images."
2HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
3
4LICENSE = "LGPLv2.1"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
6
7DEPENDS = "gnu-efi util-linux"
8
9inherit autotools pkgconfig
10inherit deploy
11
12PV = "43+git${SRCPV}"
13SRCREV = "4062c51075ba054d4949c714fe06123f9ad3097d"
14SRC_URI = "git://anongit.freedesktop.org/gummiboot \
15 file://fix-objcopy.patch \
16 "
17
18# Note: Add COMPATIBLE_HOST here is only because it depends on gnu-efi
19# which has set the COMPATIBLE_HOST, the gummiboot itself may work on
20# more hosts.
21COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
22
23S = "${WORKDIR}/git"
24
25EXTRA_OECONF = "--disable-manpages --with-efi-includedir=${STAGING_INCDIR} \
26 --with-efi-ldsdir=${STAGING_LIBDIR} \
27 --with-efi-libdir=${STAGING_LIBDIR}"
28
29EXTRA_OEMAKE += "gummibootlibdir=${libdir}/gummiboot"
30
31do_deploy () {
32 install ${B}/gummiboot*.efi ${DEPLOYDIR}
33}
34addtask deploy before do_build after do_compile
diff --git a/meta/recipes-bsp/hostap/files/COPYING.patch b/meta/recipes-bsp/hostap/files/COPYING.patch
new file mode 100644
index 0000000000..05c70c92e5
--- /dev/null
+++ b/meta/recipes-bsp/hostap/files/COPYING.patch
@@ -0,0 +1,346 @@
1Upstream-Status: Inappropriate [other]
2
3diff -ruN hostap-conf-1.0-orig/COPYING hostap-conf-1.0/COPYING
4--- hostap-conf-1.0-orig/COPYING 1970-01-01 08:00:00.000000000 +0800
5+++ hostap-conf-1.0/COPYING 2010-12-09 16:36:48.000000000 +0800
6@@ -0,0 +1,340 @@
7+ GNU GENERAL PUBLIC LICENSE
8+ Version 2, June 1991
9+
10+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
11+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12+ Everyone is permitted to copy and distribute verbatim copies
13+ of this license document, but changing it is not allowed.
14+
15+ Preamble
16+
17+ The licenses for most software are designed to take away your
18+freedom to share and change it. By contrast, the GNU General Public
19+License is intended to guarantee your freedom to share and change free
20+software--to make sure the software is free for all its users. This
21+General Public License applies to most of the Free Software
22+Foundation's software and to any other program whose authors commit to
23+using it. (Some other Free Software Foundation software is covered by
24+the GNU Library General Public License instead.) You can apply it to
25+your programs, too.
26+
27+ When we speak of free software, we are referring to freedom, not
28+price. Our General Public Licenses are designed to make sure that you
29+have the freedom to distribute copies of free software (and charge for
30+this service if you wish), that you receive source code or can get it
31+if you want it, that you can change the software or use pieces of it
32+in new free programs; and that you know you can do these things.
33+
34+ To protect your rights, we need to make restrictions that forbid
35+anyone to deny you these rights or to ask you to surrender the rights.
36+These restrictions translate to certain responsibilities for you if you
37+distribute copies of the software, or if you modify it.
38+
39+ For example, if you distribute copies of such a program, whether
40+gratis or for a fee, you must give the recipients all the rights that
41+you have. You must make sure that they, too, receive or can get the
42+source code. And you must show them these terms so they know their
43+rights.
44+
45+ We protect your rights with two steps: (1) copyright the software, and
46+(2) offer you this license which gives you legal permission to copy,
47+distribute and/or modify the software.
48+
49+ Also, for each author's protection and ours, we want to make certain
50+that everyone understands that there is no warranty for this free
51+software. If the software is modified by someone else and passed on, we
52+want its recipients to know that what they have is not the original, so
53+that any problems introduced by others will not reflect on the original
54+authors' reputations.
55+
56+ Finally, any free program is threatened constantly by software
57+patents. We wish to avoid the danger that redistributors of a free
58+program will individually obtain patent licenses, in effect making the
59+program proprietary. To prevent this, we have made it clear that any
60+patent must be licensed for everyone's free use or not licensed at all.
61+
62+ The precise terms and conditions for copying, distribution and
63+modification follow.
64+
65+ GNU GENERAL PUBLIC LICENSE
66+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
67+
68+ 0. This License applies to any program or other work which contains
69+a notice placed by the copyright holder saying it may be distributed
70+under the terms of this General Public License. The "Program", below,
71+refers to any such program or work, and a "work based on the Program"
72+means either the Program or any derivative work under copyright law:
73+that is to say, a work containing the Program or a portion of it,
74+either verbatim or with modifications and/or translated into another
75+language. (Hereinafter, translation is included without limitation in
76+the term "modification".) Each licensee is addressed as "you".
77+
78+Activities other than copying, distribution and modification are not
79+covered by this License; they are outside its scope. The act of
80+running the Program is not restricted, and the output from the Program
81+is covered only if its contents constitute a work based on the
82+Program (independent of having been made by running the Program).
83+Whether that is true depends on what the Program does.
84+
85+ 1. You may copy and distribute verbatim copies of the Program's
86+source code as you receive it, in any medium, provided that you
87+conspicuously and appropriately publish on each copy an appropriate
88+copyright notice and disclaimer of warranty; keep intact all the
89+notices that refer to this License and to the absence of any warranty;
90+and give any other recipients of the Program a copy of this License
91+along with the Program.
92+
93+You may charge a fee for the physical act of transferring a copy, and
94+you may at your option offer warranty protection in exchange for a fee.
95+
96+ 2. You may modify your copy or copies of the Program or any portion
97+of it, thus forming a work based on the Program, and copy and
98+distribute such modifications or work under the terms of Section 1
99+above, provided that you also meet all of these conditions:
100+
101+ a) You must cause the modified files to carry prominent notices
102+ stating that you changed the files and the date of any change.
103+
104+ b) You must cause any work that you distribute or publish, that in
105+ whole or in part contains or is derived from the Program or any
106+ part thereof, to be licensed as a whole at no charge to all third
107+ parties under the terms of this License.
108+
109+ c) If the modified program normally reads commands interactively
110+ when run, you must cause it, when started running for such
111+ interactive use in the most ordinary way, to print or display an
112+ announcement including an appropriate copyright notice and a
113+ notice that there is no warranty (or else, saying that you provide
114+ a warranty) and that users may redistribute the program under
115+ these conditions, and telling the user how to view a copy of this
116+ License. (Exception: if the Program itself is interactive but
117+ does not normally print such an announcement, your work based on
118+ the Program is not required to print an announcement.)
119+
120+These requirements apply to the modified work as a whole. If
121+identifiable sections of that work are not derived from the Program,
122+and can be reasonably considered independent and separate works in
123+themselves, then this License, and its terms, do not apply to those
124+sections when you distribute them as separate works. But when you
125+distribute the same sections as part of a whole which is a work based
126+on the Program, the distribution of the whole must be on the terms of
127+this License, whose permissions for other licensees extend to the
128+entire whole, and thus to each and every part regardless of who wrote it.
129+
130+Thus, it is not the intent of this section to claim rights or contest
131+your rights to work written entirely by you; rather, the intent is to
132+exercise the right to control the distribution of derivative or
133+collective works based on the Program.
134+
135+In addition, mere aggregation of another work not based on the Program
136+with the Program (or with a work based on the Program) on a volume of
137+a storage or distribution medium does not bring the other work under
138+the scope of this License.
139+
140+ 3. You may copy and distribute the Program (or a work based on it,
141+under Section 2) in object code or executable form under the terms of
142+Sections 1 and 2 above provided that you also do one of the following:
143+
144+ a) Accompany it with the complete corresponding machine-readable
145+ source code, which must be distributed under the terms of Sections
146+ 1 and 2 above on a medium customarily used for software interchange; or,
147+
148+ b) Accompany it with a written offer, valid for at least three
149+ years, to give any third party, for a charge no more than your
150+ cost of physically performing source distribution, a complete
151+ machine-readable copy of the corresponding source code, to be
152+ distributed under the terms of Sections 1 and 2 above on a medium
153+ customarily used for software interchange; or,
154+
155+ c) Accompany it with the information you received as to the offer
156+ to distribute corresponding source code. (This alternative is
157+ allowed only for noncommercial distribution and only if you
158+ received the program in object code or executable form with such
159+ an offer, in accord with Subsection b above.)
160+
161+The source code for a work means the preferred form of the work for
162+making modifications to it. For an executable work, complete source
163+code means all the source code for all modules it contains, plus any
164+associated interface definition files, plus the scripts used to
165+control compilation and installation of the executable. However, as a
166+special exception, the source code distributed need not include
167+anything that is normally distributed (in either source or binary
168+form) with the major components (compiler, kernel, and so on) of the
169+operating system on which the executable runs, unless that component
170+itself accompanies the executable.
171+
172+If distribution of executable or object code is made by offering
173+access to copy from a designated place, then offering equivalent
174+access to copy the source code from the same place counts as
175+distribution of the source code, even though third parties are not
176+compelled to copy the source along with the object code.
177+
178+ 4. You may not copy, modify, sublicense, or distribute the Program
179+except as expressly provided under this License. Any attempt
180+otherwise to copy, modify, sublicense or distribute the Program is
181+void, and will automatically terminate your rights under this License.
182+However, parties who have received copies, or rights, from you under
183+this License will not have their licenses terminated so long as such
184+parties remain in full compliance.
185+
186+ 5. You are not required to accept this License, since you have not
187+signed it. However, nothing else grants you permission to modify or
188+distribute the Program or its derivative works. These actions are
189+prohibited by law if you do not accept this License. Therefore, by
190+modifying or distributing the Program (or any work based on the
191+Program), you indicate your acceptance of this License to do so, and
192+all its terms and conditions for copying, distributing or modifying
193+the Program or works based on it.
194+
195+ 6. Each time you redistribute the Program (or any work based on the
196+Program), the recipient automatically receives a license from the
197+original licensor to copy, distribute or modify the Program subject to
198+these terms and conditions. You may not impose any further
199+restrictions on the recipients' exercise of the rights granted herein.
200+You are not responsible for enforcing compliance by third parties to
201+this License.
202+
203+ 7. If, as a consequence of a court judgment or allegation of patent
204+infringement or for any other reason (not limited to patent issues),
205+conditions are imposed on you (whether by court order, agreement or
206+otherwise) that contradict the conditions of this License, they do not
207+excuse you from the conditions of this License. If you cannot
208+distribute so as to satisfy simultaneously your obligations under this
209+License and any other pertinent obligations, then as a consequence you
210+may not distribute the Program at all. For example, if a patent
211+license would not permit royalty-free redistribution of the Program by
212+all those who receive copies directly or indirectly through you, then
213+the only way you could satisfy both it and this License would be to
214+refrain entirely from distribution of the Program.
215+
216+If any portion of this section is held invalid or unenforceable under
217+any particular circumstance, the balance of the section is intended to
218+apply and the section as a whole is intended to apply in other
219+circumstances.
220+
221+It is not the purpose of this section to induce you to infringe any
222+patents or other property right claims or to contest validity of any
223+such claims; this section has the sole purpose of protecting the
224+integrity of the free software distribution system, which is
225+implemented by public license practices. Many people have made
226+generous contributions to the wide range of software distributed
227+through that system in reliance on consistent application of that
228+system; it is up to the author/donor to decide if he or she is willing
229+to distribute software through any other system and a licensee cannot
230+impose that choice.
231+
232+This section is intended to make thoroughly clear what is believed to
233+be a consequence of the rest of this License.
234+
235+ 8. If the distribution and/or use of the Program is restricted in
236+certain countries either by patents or by copyrighted interfaces, the
237+original copyright holder who places the Program under this License
238+may add an explicit geographical distribution limitation excluding
239+those countries, so that distribution is permitted only in or among
240+countries not thus excluded. In such case, this License incorporates
241+the limitation as if written in the body of this License.
242+
243+ 9. The Free Software Foundation may publish revised and/or new versions
244+of the General Public License from time to time. Such new versions will
245+be similar in spirit to the present version, but may differ in detail to
246+address new problems or concerns.
247+
248+Each version is given a distinguishing version number. If the Program
249+specifies a version number of this License which applies to it and "any
250+later version", you have the option of following the terms and conditions
251+either of that version or of any later version published by the Free
252+Software Foundation. If the Program does not specify a version number of
253+this License, you may choose any version ever published by the Free Software
254+Foundation.
255+
256+ 10. If you wish to incorporate parts of the Program into other free
257+programs whose distribution conditions are different, write to the author
258+to ask for permission. For software which is copyrighted by the Free
259+Software Foundation, write to the Free Software Foundation; we sometimes
260+make exceptions for this. Our decision will be guided by the two goals
261+of preserving the free status of all derivatives of our free software and
262+of promoting the sharing and reuse of software generally.
263+
264+ NO WARRANTY
265+
266+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
267+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
268+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
269+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
270+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
271+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
272+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
273+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
274+REPAIR OR CORRECTION.
275+
276+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
277+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
278+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
279+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
280+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
281+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
282+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
283+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
284+POSSIBILITY OF SUCH DAMAGES.
285+
286+ END OF TERMS AND CONDITIONS
287+
288+ How to Apply These Terms to Your New Programs
289+
290+ If you develop a new program, and you want it to be of the greatest
291+possible use to the public, the best way to achieve this is to make it
292+free software which everyone can redistribute and change under these terms.
293+
294+ To do so, attach the following notices to the program. It is safest
295+to attach them to the start of each source file to most effectively
296+convey the exclusion of warranty; and each file should have at least
297+the "copyright" line and a pointer to where the full notice is found.
298+
299+ <one line to give the program's name and a brief idea of what it does.>
300+ Copyright (C) <year> <name of author>
301+
302+ This program is free software; you can redistribute it and/or modify
303+ it under the terms of the GNU General Public License as published by
304+ the Free Software Foundation; either version 2 of the License, or
305+ (at your option) any later version.
306+
307+ This program is distributed in the hope that it will be useful,
308+ but WITHOUT ANY WARRANTY; without even the implied warranty of
309+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
310+ GNU General Public License for more details.
311+
312+ You should have received a copy of the GNU General Public License
313+ along with this program; if not, write to the Free Software
314+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
315+
316+
317+Also add information on how to contact you by electronic and paper mail.
318+
319+If the program is interactive, make it output a short notice like this
320+when it starts in an interactive mode:
321+
322+ Gnomovision version 69, Copyright (C) year name of author
323+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
324+ This is free software, and you are welcome to redistribute it
325+ under certain conditions; type `show c' for details.
326+
327+The hypothetical commands `show w' and `show c' should show the appropriate
328+parts of the General Public License. Of course, the commands you use may
329+be called something other than `show w' and `show c'; they could even be
330+mouse-clicks or menu items--whatever suits your program.
331+
332+You should also get your employer (if you work as a programmer) or your
333+school, if any, to sign a "copyright disclaimer" for the program, if
334+necessary. Here is a sample; alter the names:
335+
336+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
337+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
338+
339+ <signature of Ty Coon>, 1 April 1989
340+ Ty Coon, President of Vice
341+
342+This General Public License does not permit incorporating your program into
343+proprietary programs. If your program is a subroutine library, you may
344+consider it more useful to permit linking proprietary applications with the
345+library. If this is what you want to do, use the GNU Library General
346+Public License instead of this License.
diff --git a/meta/recipes-bsp/hostap/files/hostap-fw-load.patch b/meta/recipes-bsp/hostap/files/hostap-fw-load.patch
new file mode 100644
index 0000000000..050bdc113c
--- /dev/null
+++ b/meta/recipes-bsp/hostap/files/hostap-fw-load.patch
@@ -0,0 +1,22 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6Upstream-Status: Inappropriate [configuration]
7
8--- hostap-utils-0.2.4/hostap_fw_load~hostap-fw-load
9+++ hostap-utils-0.2.4/hostap_fw_load
10@@ -6,9 +6,9 @@
11 # Firmware images for the card
12 # TODO: could try to select correct firmware type automatically
13
14-PRI=/etc/pcmcia/PM010102.HEX
15-STA=/etc/pcmcia/RF010802.HEX
16-PRISM2_SREC=/usr/local/bin/prism2_srec
17+PRI=/etc/pcmcia/pm010102.hex
18+STA=/etc/pcmcia/rf010804.hex
19+PRISM2_SREC=/usr/sbin/prism2_srec
20
21 set -e
22
diff --git a/meta/recipes-bsp/hostap/files/hostap_cs.conf b/meta/recipes-bsp/hostap/files/hostap_cs.conf
new file mode 100644
index 0000000000..8dda82aad3
--- /dev/null
+++ b/meta/recipes-bsp/hostap/files/hostap_cs.conf
@@ -0,0 +1,193 @@
1module "hostap_cs" opts "channel=3 iw_mode=2 essid=any ignore_cis_vcc=1"
2
3card "Actiontec 802CI2"
4 manfid 0x1668, 0x0101
5 bind "hostap_cs"
6
7card "AirWay 802.11 Adapter (PCMCIA)"
8 #version "AirWay", "802.11 Adapter (PCMCIA)"
9 manfid 0x0261, 0x0002
10 bind "hostap_cs"
11
12card "Asus SpaceLink WL110"
13 manfid 0x02aa,0x0002
14 bind "hostap_cs"
15
16## handhelds.org bug 964
17card "Belkin F5D6060 Ethernet"
18 #version "PCMCIA", "11M WLAN Card v2.5", "ISL37300P", "RevA"
19 manfid 0x0274, 0x1612
20 bind "hostap_cs"
21
22card "Compaq 11Mbps Wireless PC Card"
23 manfid 0x028a, 0x0002
24 bind "hostap_cs"
25
26card "Compaq WL100 11 Mbps Wireless Adapter"
27 manfid 0x0138, 0x0002
28 bind "hostap_cs"
29
30card "Compaq HNW-100 11 Mbps Wireless Adapter"
31 manfid 0x028a, 0x0002
32 bind "hostap_cs"
33
34card "D-Link DWL-650"
35 version "D", "Link DWL-650 11Mbps WLAN Card"
36 bind "hostap_cs"
37
38card "D-Link DRC-650"
39 version "D", "Link DRC-650 11Mbps WLAN Card"
40 bind "hostap_cs"
41
42card "D-Link DCF660"
43 manfid 0xd601, 0x0005
44 bind "hostap_cs"
45
46card "Farallon SkyLINE"
47 version "INTERSIL", "HFA384x/IEEE"
48 bind "hostap_cs"
49
50card "HyperLink Wireless PC Card 11Mbps"
51 version "HyperLink", "Wireless PC Card 11Mbps"
52 bind "hostap_cs"
53
54# card "Intersil PRISM2 11 Mbps Wireless Adapter"
55# manfid 0x0156, 0x0002
56# bind "hostap_cs"
57
58card "LA4111 Spectrum24 Wireless LAN PC Card"
59 version "Symbol Technologies"
60 bind "hostap_cs"
61
62card "Linksys WPC11 11Mbps 802.11b WLAN Card"
63 version "Instant Wireless ", " Network PC CARD", "Version 01.02"
64 bind "hostap_cs"
65
66card "Linksys WCF11 11Mbps 802.11b WLAN Card"
67 manfid 0x0274, 0x3301
68 bind "hostap_cs"
69
70## handhelds.org bug #790
71card "Linksys Wireless CompactFlash Card WCF12"
72 manfid 0x028a, 0x0673
73 bind "hostap_cs"
74
75card "Linksys WLAN CF Card"
76 manfid 0x0274, 0x3301
77 bind "hostap_cs"
78
79card "NETGEAR MA701 Wireless CF Card"
80 manfid 0xd601, 0x0002
81 bind "hostap_cs"
82
83card "Nortel Networks eMobility 802.11 Wireless Adapter"
84 manfid 0x01eb, 0x080a
85 bind "hostap_cs"
86
87card "PLANEX GeoWave GW-CF110"
88 version "PLANEX", "GeoWave/GW-CF110"
89 bind "hostap_cs"
90
91card "PROXIM LAN PC CARD HARMONY 80211B"
92 version "PROXIM", "LAN PC CARD HARMONY 80211B"
93 bind "hostap_cs"
94
95card "Proxim RangeLAN/DS"
96 version "PROXIM","RangeLAN-DS/LAN PC CARD"
97 manfid 0x0126, 0x8000
98 bind "hostap_cs"
99
100card "Safeway 802.11b Wireless Adapter"
101 manfid 0xd601, 0x0002
102 bind "hostap_cs"
103
104card "SAMSUNG 11Mbps WLAN Card"
105 version "SAMSUNG", "11Mbps WLAN Card"
106 bind "hostap_cs"
107
108# needs firmware upload via hostap_fw_load
109card "SanDisk ConnectPlus OEM (0MB)"
110 manfid 0xd601, 0x0010
111 bind "hostap_cs"
112
113# needs special activation (>=hostap 0.3.2 only) plus firmware upload
114card "SanDisk ConnectPlus w/ Memory"
115 version "SanDisk", "ConnectPlus"
116 manfid 0xd601, 0x0101
117 bind "hostap_cs" to 0
118# bind "ide-cs" to 1
119
120card "Senao/Origo 80211b WLAN Card"
121 manfid 0x000b,0x7100
122 bind "hostap_cs"
123
124card "Sitecom WL-007 WLAN CF Card"
125 manfid 0xd601, 0x0004
126 bind "hostap_cs"
127
128card "SMC2632 802.11 (prism2) Card"
129 version "SMC", "SMC2632W", "Version 01.02", ""
130 bind "hostap_cs"
131
132card "SpeedStream SS1021 Wireless Adapter"
133 #version "Siemens", "SpeedStream Wireless PCMCIA"
134 manfid 0x02ac, 0x0002
135 bind "hostap_cs"
136
137card "ZCOMAX AirRunner/XI-300"
138 #version "ZCOMAX", "AirRunner/XI-300"
139 manfid 0xd601, 0x0002
140 bind "hostap_cs"
141
142card "Zonet ZCF1100"
143 manfid 0x000b, 0x7100
144 bind "hostap_cs"
145
146card "Wireless LAN Adapter Version 01.02"
147 version "Wireless", "LAN Adapter", "Version 01.02"
148# manfid 0x0156, 0x0002
149 bind "hostap_cs"
150
151card "Ambicom WL1100C 11Mbs Card 802.11b"
152 version "AmbiCom", "WL1100C 802.11b CF-Card", "2.2"
153 manfid 0xd601,0x0002
154 bind "hostap_cs"
155
156card "Ambicom WL1100C 11Mbs Card 802.11b"
157 manfid 0xd601,0x0002
158 bind "hostap_cs"
159
160card "Sandisk Connect SDWCFB-000"
161 manfid 0xd601,0x0005
162 bind "hostap_cs"
163
164# Cards with Intersil firmware (Prism chipset)
165
166card "Linksys WPC11 11Mbps 802.11b WLAN Card"
167 version "The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", "RevA"
168 bind "hostap_cs"
169
170card "Linksys CompactFlash Wireless Card"
171 version "Linksys", "Wireless CompactFlash Card"
172 bind "hostap_cs"
173
174card "ACTIONTEC PRISM Wireless LAN PC Card"
175 version "ACTIONTEC", "PRISM Wireless LAN PC Card"
176 bind "hostap_cs"
177
178card "Linksys WPC11 Version 3"
179 manfid 0x0274,0x1613
180 bind "hostap_cs"
181
182card "BENQ AWL100"
183 version "BENQ", "AWL100 PCMCIA ADAPTER"
184 bind "hostap_cs"
185
186card "Pretec WLAN"
187 version "Pretec", "CompactWLAN Card 802.11b", "2.5"
188 manfid 0x0156, 0x0002
189 bind "hostap_cs"
190
191card "TrendNet TEW PC16"
192 manfid 0x0274, 0x1601
193 bind "hostap_cs"
diff --git a/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream b/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream
new file mode 100644
index 0000000000..5b7385a7cb
--- /dev/null
+++ b/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream
@@ -0,0 +1,191 @@
1device "hostap_cs"
2 class "network" module "hostap", "hostap_cs"
3
4card "Intersil PRISM2 Reference Design 11Mb/s WLAN Card"
5 version "INTERSIL", "HFA384x/IEEE"
6 bind "hostap_cs"
7
8card "Compaq WL100 11Mb/s WLAN Card"
9 manfid 0x0138, 0x0002
10 bind "hostap_cs"
11
12card "Compaq WL200"
13 version "Compaq", "WL200_11Mbps_Wireless_PCI_Card"
14 bind "hostap_cs"
15
16card "EMTAC A2424i 11Mbps WLAN Card"
17 manfid 0xc250, 0x0002
18# cis "cis/Emtac.dat"
19 bind "hostap_cs"
20
21card "Linksys WPC11 11Mbps WLAN Card"
22 version "Instant Wireless ", " Network PC CARD", "Version 01.02"
23 bind "hostap_cs"
24
25card "Linksys WPC11 Ver 2.5 11Mbps WLAN Card"
26 manfid 0x0274, 0x1612
27 bind "hostap_cs"
28
29card "Linksys WPC11 Ver 3 11Mbps WLAN Card"
30 manfid 0x0274, 0x1613
31 bind "hostap_cs"
32
33card "Linksys WCF12 Wireless CompactFlash Card"
34 version "Linksys", "Wireless CompactFlash Card"
35 bind "hostap_cs"
36
37card "D-Link DWL-650 11Mbps WLAN Card"
38 version "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02"
39 bind "hostap_cs"
40
41card "D-Link DRC-650 11Mbps WLAN Card"
42# version "D", "Link DRC-650 11Mbps WLAN Card", "Version 01.02"
43 manfid 0x028a, 0x0002
44 bind "hostap_cs"
45
46card "ZoomAir 4100 11Mb/s WLAN Card"
47 version "ZoomAir 11Mbps High", "Rate wireless Networking"
48 bind "hostap_cs"
49
50card "Addtron AWP-100 11Mbps WLAN Card"
51 version "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02"
52 bind "hostap_cs"
53
54card "Samsung SWL2000-N 11Mb/s WLAN Card"
55 manfid 0x0250, 0x0002
56 bind "hostap_cs"
57
58card "SMC 2632W 11Mbps WLAN Card"
59 version "SMC", "SMC2632W", "Version 01.02"
60 bind "hostap_cs"
61
62card "BroMax Freeport 11Mbps WLAN Card"
63 version "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA"
64 bind "hostap_cs"
65
66card "Z-Com XI300 11Mb/s WLAN Card"
67 manfid 0xd601, 0x0002
68 bind "hostap_cs"
69
70card "Zcomax XI-325H 200mW"
71# version " ", "IEEE 802.11 Wireless LAN/PC Card"
72 manfid 0xd601, 0x0005
73 bind "hostap_cs"
74
75card "3Com AirConnect PCI 777A"
76 manfid 0x0101, 0x0777
77 bind "hostap_cs"
78
79card "U.S. Robotics IEEE 802.11b PC-CARD"
80 version "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02"
81# manfid 0x0156, 0x0002
82 bind "hostap_cs"
83
84card "Longshine LCR-8531 11Mbps WLAN PCMCIA CARD"
85 version "OEM", "PRISM2 IEEE 802.11 PC-Card", "Version 01.02"
86# manfid 0x0156, 0x0002
87 bind "hostap_cs"
88
89card "Philips 802.11b WLAN PCMCIA"
90 manfid 0x000b, 0x7300
91 bind "hostap_cs"
92
93card "Proxim RangeLAN"
94# version "PROXIM", "RangeLAN-DS/LAN PC CARD"
95 manfid 0x0126, 0x8000
96 bind "hostap_cs"
97
98card "Buffalo WLI-CF-S11G"
99 version "BUFFALO", "WLI-CF-S11G"
100# manfid 0x026f, 0x030b
101 bind "hostap_cs"
102
103card "Level-One WPC-0100"
104 version "Digital Data Communications", "WPC-0100", "Version 00.00"
105 manfid 0x0156, 0x0002
106 bind "hostap_cs"
107
108card "Belkin 802.11b WLAN PCMCIA"
109 version "Belkin", "11Mbps Wireless Notebook Network Adapter", "Version 01.02"
110 manfid 0x0156, 0x0002
111 bind "hostap_cs"
112
113card "Senao SL-2011CD/SL-2011CDPLUS"
114 version "INTERSIL", "HFA384x/IEEE", "Version 01.02"
115 manfid 0x0156, 0x0002
116 bind "hostap_cs"
117
118card "Fulbond Airbond XI-300B"
119 version " ", "IEEE 802.11 Wireless LAN/PC Card"
120 manfid 0xd601, 0x0002
121 bind "hostap_cs"
122
123card "Netgear MA401"
124 version "NETGEAR MA401 Wireless PC", "Card", "Version 01.00"
125# manfid 0x0156, 0x0002
126 bind "hostap_cs"
127
128card "D-Link DWL-650 Rev. P1"
129 version "D-Link", "DWL-650 Wireless PC Card RevP", "ISL37101P-10", "A3"
130# manfid 0x000b, 0x7110
131 bind "hostap_cs"
132
133card "SonicWALL Long Range Wireless Card"
134 version "SonicWALL", "Long Range Wireless Card", "ISL37100P", "1.0"
135 manfid 0x000b, 0x7100
136 bind "hostap_cs"
137
138card "Senao NL-2011CD PLUS Ext2 Mercury"
139 version "WLAN", "11Mbps_PC-Card_3.0", "ISL37100P", "Eval-RevA"
140 manfid 0x000b, 0x7100
141 bind "hostap_cs"
142
143card "Airvast WL100"
144 version "AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863"
145 manfid 0x50c2, 0x0001
146 bind "hostap_cs"
147
148card "Microsoft Wireless Notebook Adapter MN-520 1.0.3"
149 version "Microsoft", "Wireless Notebook Adapter MN-520", "", "1.0.3"
150 manfid 0x02d2, 0x0001
151 bind "hostap_cs"
152
153card "NETGEAR MA401RA"
154 version "NETGEAR MA401RA Wireless PC", "Card", "ISL37300P", "Eval-RevA"
155 manfid 0x000b, 0x7300
156 bind "hostap_cs"
157
158card "Allied Telesyn AT-WCL452"
159 version "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", "Ver. 1.00"
160 manfid 0xc00f, 0x0000
161 bind "hostap_cs"
162
163card "corega WL PCCL-11"
164 version "corega", "WL PCCL-11", "ISL37300P", "RevA"
165 manfid 0xc00f, 0x0000
166 bind "hostap_cs"
167
168card "SanDisk ConnectPlus"
169 version "SanDisk", "ConnectPlus"
170 manfid 0xd601, 0x0101
171 bind "hostap_cs" to 0
172 bind "ide-cs" to 1
173
174card "ASUS WL-100 8011b WLAN PC Card"
175 version "ASUS", "802_11b_PC_CARD_25", "Version 01.00"
176 manfid 0x02aa, 0x0002
177 bind "hostap_cs"
178
179card "ZyXel Zyair B-101 802.11b WLAN card"
180 version " ", "IEEE 802.11 Wireless LAN/PC Card"
181 manfid 0xd601, 0x0010
182 bind "hostap_cs"
183
184card "WLAN PRISM PCMCIA CARD 37300P RevB6"
185 version "WLAN", "PRISM PCMCIA CARD", "37300P", "Revision B6"
186 manfid 0x50c2, 0x7300
187 bind "hostap_cs"
188
189
190# Optional configuration parameters for hostap_cs.o
191# module "hostap_cs" opts "channel=3 iw_mode=3 essid=test ignore_cis_vcc=0"
diff --git a/meta/recipes-bsp/hostap/files/hostap_cs.modalias b/meta/recipes-bsp/hostap/files/hostap_cs.modalias
new file mode 100644
index 0000000000..2848351510
--- /dev/null
+++ b/meta/recipes-bsp/hostap/files/hostap_cs.modalias
@@ -0,0 +1,28 @@
1# product info: "Pretec", "CompactWLAN Card 802.11b", "2.5"
2alias pcmcia:m0156c0002f06fn00pfn00pa1CADD3E5pbE697636Cpc7A5BFCF1pd00000000 hostap_cs
3
4# manufacturer ID which exist in orinoco_cs AND in hostap_cs
5alias pcmcia:m000Bc7100f06fn00pfn00pa*pb*pc*pd* hostap_cs
6alias pcmcia:m000Bc7300f06fn00pfn00pa*pb*pc*pd* hostap_cs
7alias pcmcia:m0126c8000f06fn00pfn00pa*pb*pc*pd* hostap_cs
8alias pcmcia:m0138c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
9alias pcmcia:m0250c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
10alias pcmcia:m0274c1612f06fn00pfn00pa*pb*pc*pd* hostap_cs
11alias pcmcia:m0274c1613f06fn00pfn00pa*pb*pc*pd* hostap_cs
12alias pcmcia:m028Ac0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
13alias pcmcia:m02AAc0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
14alias pcmcia:m50C2c7300f06fn00pfn00pa*pb*pc*pd* hostap_cs
15alias pcmcia:mD601c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
16alias pcmcia:mD601c0005f06fn00pfn00pa*pb*pc*pd* hostap_cs
17
18# product info: "Linksys", "Wireless CompactFlash Card", "", ""
19alias pcmcia:m028Ac0673f06fn00pfn00pa0733CC81pb0C52F395pc00000000pd00000000 hostap_cs
20
21# product info:"PLANEX COMMUNICATION INC","PLANEX GW-CF11X Wireless CF Card", "", ""
22alias pcmcia:mD601c0010f06fn00pfn00pa4703CF68pbFAD7318Dpc00000000pd00000000 hostap_cs
23
24# 0x0156, 0x0002 and "Version 01.02" only appear for Prism based cards.
25alias pcmcia:m0156c0002f06fn00pfn00pa*pb*pc4B74BAA0pd00000000 hostap_cs
26
27# "BUFFALO", "WLI-CF-S11G", "", ""
28alias pcmcia:m026Fc030Bf06fn00pfn00pa2DECECE3pb82067C18pc00000000pd00000000 hostap_cs
diff --git a/meta/recipes-bsp/hostap/hostap-conf_1.0.bb b/meta/recipes-bsp/hostap/hostap-conf_1.0.bb
new file mode 100644
index 0000000000..e2c7cc0344
--- /dev/null
+++ b/meta/recipes-bsp/hostap/hostap-conf_1.0.bb
@@ -0,0 +1,21 @@
1SUMMARY = "Configuration files for HostAP (wifi) driver"
2DESCRIPTION = "PCMCIA-cs configuration files for wireless LAN cards based on Intersil's Prism2/2.5/3 chipset."
3SECTION = "kernel/modules"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
6PR = "r15"
7
8SRC_URI = "file://hostap_cs.modalias \
9 file://COPYING.patch"
10
11inherit allarch
12
13do_compile() {
14}
15
16do_install() {
17 install -d ${D}${sysconfdir}/modprobe.d
18
19 install -m 0644 ${WORKDIR}/hostap_cs.modalias ${D}${sysconfdir}/modprobe.d/hostap_cs.conf
20}
21
diff --git a/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch b/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch
new file mode 100644
index 0000000000..c4655cf092
--- /dev/null
+++ b/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch
@@ -0,0 +1,27 @@
1Obey LDFLAGS
2
3Signed-off-by: Christopher Larson <chris_larson@mentor.com>
4Upstream-status: Pending
5
6--- hostap-utils-0.4.7.orig/Makefile
7+++ hostap-utils-0.4.7/Makefile
8@@ -14,17 +14,17 @@ prism2_srec.o: prism2_srec.c util.h
9 hostap_crypt_conf: hostap_crypt_conf.c
10
11 hostap_diag: hostap_diag.o util.o
12- $(CC) -o hostap_diag $(CFLAGS) hostap_diag.o util.o
13+ $(CC) -o hostap_diag $(CFLAGS) $(LDFLAGS) hostap_diag.o util.o
14
15 hostap_diag.o: hostap_diag.c util.h
16
17 util.o: util.c util.h
18
19 hostap_io_debug: hostap_io_debug.c
20- $(CC) -o hostap_io_debug $(CFLAGS) hostap_io_debug.c
21+ $(CC) -o hostap_io_debug $(CFLAGS) $(LDFLAGS) hostap_io_debug.c
22
23 hostap_rid: hostap_rid.o util.o
24- $(CC) -o hostap_rid $(CFLAGS) hostap_rid.o util.o
25+ $(CC) -o hostap_rid $(CFLAGS) $(LDFLAGS) hostap_rid.o util.o
26
27 hostap_rid.o: hostap_rid.c util.h
diff --git a/meta/recipes-bsp/hostap/hostap-utils.inc b/meta/recipes-bsp/hostap/hostap-utils.inc
new file mode 100644
index 0000000000..89d977a65e
--- /dev/null
+++ b/meta/recipes-bsp/hostap/hostap-utils.inc
@@ -0,0 +1,26 @@
1SUMMARY = "User mode helpers for the hostap driver"
2DESCRIPTION = "The hostap driver supports Host AP mode, it allows for IEEE 802.11 \
3management functions on the host computer and allows the system to act as an access point."
4HOMEPAGE = "http://hostap.epitest.fi"
5BUGTRACKER = "http://hostap.epitest.fi/bugz/"
6LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
8 file://util.c;beginline=1;endline=9;md5=d3b9280851302e5ba34e5fb717489b6d"
9SECTION = "kernel/userland"
10PR = "r4"
11
12SRC_URI = "http://hostap.epitest.fi/releases/hostap-utils-${PV}.tar.gz \
13 file://hostap-fw-load.patch"
14S = "${WORKDIR}/hostap-utils-${PV}"
15
16BINARIES = "hostap_crypt_conf hostap_diag hostap_fw_load hostap_io_debug \
17 hostap_rid prism2_param prism2_srec split_combined_hex"
18
19do_install() {
20 install -d ${D}${sbindir}/
21 for f in ${BINARIES}
22 do
23 install -m 0755 $f ${D}${sbindir}/
24 done
25}
26
diff --git a/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb b/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb
new file mode 100644
index 0000000000..be5481f6f7
--- /dev/null
+++ b/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb
@@ -0,0 +1,5 @@
1require hostap-utils.inc
2
3SRC_URI += "file://ldflags.patch"
4SRC_URI[md5sum] = "afe041581b8f01666e353bec20917c85"
5SRC_URI[sha256sum] = "c6f598d8e356c1620fa009eca0a700bf1105e16817eefd77d891994261009355"
diff --git a/meta/recipes-bsp/keymaps/files/GPLv2.patch b/meta/recipes-bsp/keymaps/files/GPLv2.patch
new file mode 100644
index 0000000000..1ee8181f12
--- /dev/null
+++ b/meta/recipes-bsp/keymaps/files/GPLv2.patch
@@ -0,0 +1,347 @@
1Upstream-Status: Inappropriate [licensing]
2
3diff --git a/COPYING b/COPYING
4new file mode 100644
5index 0000000..d511905
6--- /dev/null
7+++ b/COPYING
8@@ -0,0 +1,339 @@
9+ GNU GENERAL PUBLIC LICENSE
10+ Version 2, June 1991
11+
12+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
13+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14+ Everyone is permitted to copy and distribute verbatim copies
15+ of this license document, but changing it is not allowed.
16+
17+ Preamble
18+
19+ The licenses for most software are designed to take away your
20+freedom to share and change it. By contrast, the GNU General Public
21+License is intended to guarantee your freedom to share and change free
22+software--to make sure the software is free for all its users. This
23+General Public License applies to most of the Free Software
24+Foundation's software and to any other program whose authors commit to
25+using it. (Some other Free Software Foundation software is covered by
26+the GNU Lesser General Public License instead.) You can apply it to
27+your programs, too.
28+
29+ When we speak of free software, we are referring to freedom, not
30+price. Our General Public Licenses are designed to make sure that you
31+have the freedom to distribute copies of free software (and charge for
32+this service if you wish), that you receive source code or can get it
33+if you want it, that you can change the software or use pieces of it
34+in new free programs; and that you know you can do these things.
35+
36+ To protect your rights, we need to make restrictions that forbid
37+anyone to deny you these rights or to ask you to surrender the rights.
38+These restrictions translate to certain responsibilities for you if you
39+distribute copies of the software, or if you modify it.
40+
41+ For example, if you distribute copies of such a program, whether
42+gratis or for a fee, you must give the recipients all the rights that
43+you have. You must make sure that they, too, receive or can get the
44+source code. And you must show them these terms so they know their
45+rights.
46+
47+ We protect your rights with two steps: (1) copyright the software, and
48+(2) offer you this license which gives you legal permission to copy,
49+distribute and/or modify the software.
50+
51+ Also, for each author's protection and ours, we want to make certain
52+that everyone understands that there is no warranty for this free
53+software. If the software is modified by someone else and passed on, we
54+want its recipients to know that what they have is not the original, so
55+that any problems introduced by others will not reflect on the original
56+authors' reputations.
57+
58+ Finally, any free program is threatened constantly by software
59+patents. We wish to avoid the danger that redistributors of a free
60+program will individually obtain patent licenses, in effect making the
61+program proprietary. To prevent this, we have made it clear that any
62+patent must be licensed for everyone's free use or not licensed at all.
63+
64+ The precise terms and conditions for copying, distribution and
65+modification follow.
66+
67+ GNU GENERAL PUBLIC LICENSE
68+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
69+
70+ 0. This License applies to any program or other work which contains
71+a notice placed by the copyright holder saying it may be distributed
72+under the terms of this General Public License. The "Program", below,
73+refers to any such program or work, and a "work based on the Program"
74+means either the Program or any derivative work under copyright law:
75+that is to say, a work containing the Program or a portion of it,
76+either verbatim or with modifications and/or translated into another
77+language. (Hereinafter, translation is included without limitation in
78+the term "modification".) Each licensee is addressed as "you".
79+
80+Activities other than copying, distribution and modification are not
81+covered by this License; they are outside its scope. The act of
82+running the Program is not restricted, and the output from the Program
83+is covered only if its contents constitute a work based on the
84+Program (independent of having been made by running the Program).
85+Whether that is true depends on what the Program does.
86+
87+ 1. You may copy and distribute verbatim copies of the Program's
88+source code as you receive it, in any medium, provided that you
89+conspicuously and appropriately publish on each copy an appropriate
90+copyright notice and disclaimer of warranty; keep intact all the
91+notices that refer to this License and to the absence of any warranty;
92+and give any other recipients of the Program a copy of this License
93+along with the Program.
94+
95+You may charge a fee for the physical act of transferring a copy, and
96+you may at your option offer warranty protection in exchange for a fee.
97+
98+ 2. You may modify your copy or copies of the Program or any portion
99+of it, thus forming a work based on the Program, and copy and
100+distribute such modifications or work under the terms of Section 1
101+above, provided that you also meet all of these conditions:
102+
103+ a) You must cause the modified files to carry prominent notices
104+ stating that you changed the files and the date of any change.
105+
106+ b) You must cause any work that you distribute or publish, that in
107+ whole or in part contains or is derived from the Program or any
108+ part thereof, to be licensed as a whole at no charge to all third
109+ parties under the terms of this License.
110+
111+ c) If the modified program normally reads commands interactively
112+ when run, you must cause it, when started running for such
113+ interactive use in the most ordinary way, to print or display an
114+ announcement including an appropriate copyright notice and a
115+ notice that there is no warranty (or else, saying that you provide
116+ a warranty) and that users may redistribute the program under
117+ these conditions, and telling the user how to view a copy of this
118+ License. (Exception: if the Program itself is interactive but
119+ does not normally print such an announcement, your work based on
120+ the Program is not required to print an announcement.)
121+
122+These requirements apply to the modified work as a whole. If
123+identifiable sections of that work are not derived from the Program,
124+and can be reasonably considered independent and separate works in
125+themselves, then this License, and its terms, do not apply to those
126+sections when you distribute them as separate works. But when you
127+distribute the same sections as part of a whole which is a work based
128+on the Program, the distribution of the whole must be on the terms of
129+this License, whose permissions for other licensees extend to the
130+entire whole, and thus to each and every part regardless of who wrote it.
131+
132+Thus, it is not the intent of this section to claim rights or contest
133+your rights to work written entirely by you; rather, the intent is to
134+exercise the right to control the distribution of derivative or
135+collective works based on the Program.
136+
137+In addition, mere aggregation of another work not based on the Program
138+with the Program (or with a work based on the Program) on a volume of
139+a storage or distribution medium does not bring the other work under
140+the scope of this License.
141+
142+ 3. You may copy and distribute the Program (or a work based on it,
143+under Section 2) in object code or executable form under the terms of
144+Sections 1 and 2 above provided that you also do one of the following:
145+
146+ a) Accompany it with the complete corresponding machine-readable
147+ source code, which must be distributed under the terms of Sections
148+ 1 and 2 above on a medium customarily used for software interchange; or,
149+
150+ b) Accompany it with a written offer, valid for at least three
151+ years, to give any third party, for a charge no more than your
152+ cost of physically performing source distribution, a complete
153+ machine-readable copy of the corresponding source code, to be
154+ distributed under the terms of Sections 1 and 2 above on a medium
155+ customarily used for software interchange; or,
156+
157+ c) Accompany it with the information you received as to the offer
158+ to distribute corresponding source code. (This alternative is
159+ allowed only for noncommercial distribution and only if you
160+ received the program in object code or executable form with such
161+ an offer, in accord with Subsection b above.)
162+
163+The source code for a work means the preferred form of the work for
164+making modifications to it. For an executable work, complete source
165+code means all the source code for all modules it contains, plus any
166+associated interface definition files, plus the scripts used to
167+control compilation and installation of the executable. However, as a
168+special exception, the source code distributed need not include
169+anything that is normally distributed (in either source or binary
170+form) with the major components (compiler, kernel, and so on) of the
171+operating system on which the executable runs, unless that component
172+itself accompanies the executable.
173+
174+If distribution of executable or object code is made by offering
175+access to copy from a designated place, then offering equivalent
176+access to copy the source code from the same place counts as
177+distribution of the source code, even though third parties are not
178+compelled to copy the source along with the object code.
179+
180+ 4. You may not copy, modify, sublicense, or distribute the Program
181+except as expressly provided under this License. Any attempt
182+otherwise to copy, modify, sublicense or distribute the Program is
183+void, and will automatically terminate your rights under this License.
184+However, parties who have received copies, or rights, from you under
185+this License will not have their licenses terminated so long as such
186+parties remain in full compliance.
187+
188+ 5. You are not required to accept this License, since you have not
189+signed it. However, nothing else grants you permission to modify or
190+distribute the Program or its derivative works. These actions are
191+prohibited by law if you do not accept this License. Therefore, by
192+modifying or distributing the Program (or any work based on the
193+Program), you indicate your acceptance of this License to do so, and
194+all its terms and conditions for copying, distributing or modifying
195+the Program or works based on it.
196+
197+ 6. Each time you redistribute the Program (or any work based on the
198+Program), the recipient automatically receives a license from the
199+original licensor to copy, distribute or modify the Program subject to
200+these terms and conditions. You may not impose any further
201+restrictions on the recipients' exercise of the rights granted herein.
202+You are not responsible for enforcing compliance by third parties to
203+this License.
204+
205+ 7. If, as a consequence of a court judgment or allegation of patent
206+infringement or for any other reason (not limited to patent issues),
207+conditions are imposed on you (whether by court order, agreement or
208+otherwise) that contradict the conditions of this License, they do not
209+excuse you from the conditions of this License. If you cannot
210+distribute so as to satisfy simultaneously your obligations under this
211+License and any other pertinent obligations, then as a consequence you
212+may not distribute the Program at all. For example, if a patent
213+license would not permit royalty-free redistribution of the Program by
214+all those who receive copies directly or indirectly through you, then
215+the only way you could satisfy both it and this License would be to
216+refrain entirely from distribution of the Program.
217+
218+If any portion of this section is held invalid or unenforceable under
219+any particular circumstance, the balance of the section is intended to
220+apply and the section as a whole is intended to apply in other
221+circumstances.
222+
223+It is not the purpose of this section to induce you to infringe any
224+patents or other property right claims or to contest validity of any
225+such claims; this section has the sole purpose of protecting the
226+integrity of the free software distribution system, which is
227+implemented by public license practices. Many people have made
228+generous contributions to the wide range of software distributed
229+through that system in reliance on consistent application of that
230+system; it is up to the author/donor to decide if he or she is willing
231+to distribute software through any other system and a licensee cannot
232+impose that choice.
233+
234+This section is intended to make thoroughly clear what is believed to
235+be a consequence of the rest of this License.
236+
237+ 8. If the distribution and/or use of the Program is restricted in
238+certain countries either by patents or by copyrighted interfaces, the
239+original copyright holder who places the Program under this License
240+may add an explicit geographical distribution limitation excluding
241+those countries, so that distribution is permitted only in or among
242+countries not thus excluded. In such case, this License incorporates
243+the limitation as if written in the body of this License.
244+
245+ 9. The Free Software Foundation may publish revised and/or new versions
246+of the General Public License from time to time. Such new versions will
247+be similar in spirit to the present version, but may differ in detail to
248+address new problems or concerns.
249+
250+Each version is given a distinguishing version number. If the Program
251+specifies a version number of this License which applies to it and "any
252+later version", you have the option of following the terms and conditions
253+either of that version or of any later version published by the Free
254+Software Foundation. If the Program does not specify a version number of
255+this License, you may choose any version ever published by the Free Software
256+Foundation.
257+
258+ 10. If you wish to incorporate parts of the Program into other free
259+programs whose distribution conditions are different, write to the author
260+to ask for permission. For software which is copyrighted by the Free
261+Software Foundation, write to the Free Software Foundation; we sometimes
262+make exceptions for this. Our decision will be guided by the two goals
263+of preserving the free status of all derivatives of our free software and
264+of promoting the sharing and reuse of software generally.
265+
266+ NO WARRANTY
267+
268+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
269+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
270+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
271+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
272+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
273+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
274+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
275+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
276+REPAIR OR CORRECTION.
277+
278+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
279+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
280+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
281+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
282+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
283+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
284+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
285+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
286+POSSIBILITY OF SUCH DAMAGES.
287+
288+ END OF TERMS AND CONDITIONS
289+
290+ How to Apply These Terms to Your New Programs
291+
292+ If you develop a new program, and you want it to be of the greatest
293+possible use to the public, the best way to achieve this is to make it
294+free software which everyone can redistribute and change under these terms.
295+
296+ To do so, attach the following notices to the program. It is safest
297+to attach them to the start of each source file to most effectively
298+convey the exclusion of warranty; and each file should have at least
299+the "copyright" line and a pointer to where the full notice is found.
300+
301+ <one line to give the program's name and a brief idea of what it does.>
302+ Copyright (C) <year> <name of author>
303+
304+ This program is free software; you can redistribute it and/or modify
305+ it under the terms of the GNU General Public License as published by
306+ the Free Software Foundation; either version 2 of the License, or
307+ (at your option) any later version.
308+
309+ This program is distributed in the hope that it will be useful,
310+ but WITHOUT ANY WARRANTY; without even the implied warranty of
311+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
312+ GNU General Public License for more details.
313+
314+ You should have received a copy of the GNU General Public License along
315+ with this program; if not, write to the Free Software Foundation, Inc.,
316+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
317+
318+Also add information on how to contact you by electronic and paper mail.
319+
320+If the program is interactive, make it output a short notice like this
321+when it starts in an interactive mode:
322+
323+ Gnomovision version 69, Copyright (C) year name of author
324+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
325+ This is free software, and you are welcome to redistribute it
326+ under certain conditions; type `show c' for details.
327+
328+The hypothetical commands `show w' and `show c' should show the appropriate
329+parts of the General Public License. Of course, the commands you use may
330+be called something other than `show w' and `show c'; they could even be
331+mouse-clicks or menu items--whatever suits your program.
332+
333+You should also get your employer (if you work as a programmer) or your
334+school, if any, to sign a "copyright disclaimer" for the program, if
335+necessary. Here is a sample; alter the names:
336+
337+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
338+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
339+
340+ <signature of Ty Coon>, 1 April 1989
341+ Ty Coon, President of Vice
342+
343+This General Public License does not permit incorporating your program into
344+proprietary programs. If your program is a subroutine library, you may
345+consider it more useful to permit linking proprietary applications with the
346+library. If this is what you want to do, use the GNU Lesser General
347+Public License instead of this License.
diff --git a/meta/recipes-bsp/keymaps/files/keymap.sh b/meta/recipes-bsp/keymaps/files/keymap.sh
new file mode 100755
index 0000000000..6ebc634266
--- /dev/null
+++ b/meta/recipes-bsp/keymaps/files/keymap.sh
@@ -0,0 +1,16 @@
1#!/bin/sh
2#
3# load keymap, if existing
4
5KERNEL_MAJMIN=`uname -r | cut -d '.' -f 1,2`
6if [ -e /etc/keymap-$KERNEL_MAJMIN.map ]; then
7 loadkeys /etc/keymap-$KERNEL_MAJMIN.map
8fi
9
10if ( ls "/etc" | grep -q "keymap-extension-${KERNEL_MAJMIN}" )
11then
12 for extension in `ls -1 /etc/keymap-extension-$KERNEL_MAJMIN*`
13 do
14 loadkeys "$extension"
15 done
16fi
diff --git a/meta/recipes-bsp/keymaps/keymaps_1.0.bb b/meta/recipes-bsp/keymaps/keymaps_1.0.bb
new file mode 100644
index 0000000000..925161b5d2
--- /dev/null
+++ b/meta/recipes-bsp/keymaps/keymaps_1.0.bb
@@ -0,0 +1,48 @@
1SUMMARY = "Keyboard maps"
2DESCRIPTION = "Keymaps and initscript to set the keymap on bootup."
3SECTION = "base"
4
5RDEPENDS_${PN} = "kbd"
6
7LICENSE = "GPLv2"
8LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
9PACKAGE_ARCH = "${MACHINE_ARCH}"
10PR = "r31"
11
12INHIBIT_DEFAULT_DEPS = "1"
13
14# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
15# manually to avoid unnecessary postinst/preinst generated.
16python __anonymous() {
17 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
18 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
19}
20
21inherit update-rc.d
22
23SRC_URI = "file://keymap.sh \
24 file://GPLv2.patch"
25
26INITSCRIPT_NAME = "keymap.sh"
27INITSCRIPT_PARAMS = "start 01 S ."
28
29do_install () {
30 # Only install the script if 'sysvinit' is in DISTRO_FEATURES
31 # THe ulitity this script provides could be achieved by systemd-vconsole-setup.service
32 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
33 install -d ${D}${sysconfdir}/init.d/
34 install -m 0755 ${WORKDIR}/keymap.sh ${D}${sysconfdir}/init.d/
35 fi
36}
37
38DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
39pkg_postinst_${PN} () {
40 if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
41 if [ -n "$D" ]; then
42 OPTS="--root=$D"
43 fi
44 systemctl $OPTS mask keymap.service
45 fi
46}
47
48ALLOW_EMPTY_${PN} = "1"
diff --git a/meta/recipes-bsp/libacpi/files/ldflags.patch b/meta/recipes-bsp/libacpi/files/ldflags.patch
new file mode 100644
index 0000000000..a7424c39da
--- /dev/null
+++ b/meta/recipes-bsp/libacpi/files/ldflags.patch
@@ -0,0 +1,41 @@
1libacpi: Remove QA warning: No GNU_HASH in the elf binary
2
3Upstream-Status: Inappropriate [other]
4 Useful within bitbake environment only.
5
6Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
7
8---
9 Makefile | 3 ++-
10 config.mk | 1 +
11 2 files changed, 3 insertions(+), 1 deletion(-)
12
13--- libacpi-0.2.orig/Makefile
14+++ libacpi-0.2/Makefile
15@@ -19,6 +19,7 @@ options:
16 @echo "CFLAGS = ${CFLAGS}"
17 @echo "CC = ${CC}"
18 @echo "SOFLAGS = ${SOFLAGS}"
19+ @echo "LDFLAGS = ${LDFLAGS}"
20 @echo "LD = ${LD}"
21
22 .c.o:
23@@ -34,7 +35,7 @@ libacpi.a: ${OBJ}
24
25 libacpi.so: ${OBJ}
26 @echo LD $@
27- @${CC} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
28+ @${CC} ${SOFLAGS} ${LDFLAGS} -o $@.${SOVERSION} ${OBJ}
29
30 test-libacpi: ${OBJ_test}
31 @echo LD $@
32--- libacpi-0.2.orig/config.mk
33+++ libacpi-0.2/config.mk
34@@ -10,6 +10,7 @@ MANPREFIX = ${PREFIX}/share/man
35 SOFLAGS = -shared -Wl,-soname,${SONAME}
36 CFLAGS += -fPIC -g --pedantic -Wall -Wextra
37 ARFLAGS = cr
38+LDFLAGS =
39
40 # Compiler and linker
41 CC = cc
diff --git a/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch b/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch
new file mode 100644
index 0000000000..2fed344ba5
--- /dev/null
+++ b/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch
@@ -0,0 +1,47 @@
1Upstream-Status: Pending
2
3Fix libacpi for x32
4
5 libacpi doesn't use base_libdir for install. This patch adds
6 base_libdir support so that x32 libraries are installed properly.
7
8Patch Received from: H.J. Lu <hjl.tools@gmail.com>
9
10Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/05
11
12Index: libacpi-0.2/Makefile
13===================================================================
14--- libacpi-0.2.orig/Makefile
15+++ libacpi-0.2/Makefile
16@@ -8,6 +8,10 @@ SRC_test = test-libacpi.c libacpi.c list
17 OBJ = ${SRC:.c=.o}
18 OBJ_test = ${SRC_test:.c=.o}
19
20+ifndef base_libdir
21+base_libdir=/lib
22+endif
23+
24 all: options libacpi.a libacpi.so test-libacpi
25
26 options:
27@@ -42,13 +46,13 @@ install: all
28 @mkdir -p ${DESTDIR}${PREFIX}/include
29 @cp -f libacpi.h ${DESTDIR}${PREFIX}/include
30 @chmod 644 ${DESTDIR}${PREFIX}/include/libacpi.h
31- @echo installing library to ${DESTDIR}${PREFIX}/lib
32- @mkdir -p ${DESTDIR}${PREFIX}/lib
33- @cp -f libacpi.a ${DESTDIR}${PREFIX}/lib
34- @chmod 644 ${DESTDIR}${PREFIX}/lib/libacpi.a
35- @cp -f ${SONAME} ${DESTDIR}${PREFIX}/lib/
36- @chmod 644 ${DESTDIR}${PREFIX}/lib/${SONAME}
37- @ln -s ${SONAME} ${DESTDIR}${PREFIX}/lib/libacpi.so
38+ @echo installing library to ${DESTDIR}${PREFIX}${base_libdir}
39+ @mkdir -p ${DESTDIR}${PREFIX}${base_libdir}
40+ @cp -f libacpi.a ${DESTDIR}${PREFIX}${base_libdir}
41+ @chmod 644 ${DESTDIR}${PREFIX}${base_libdir}/libacpi.a
42+ @cp -f ${SONAME} ${DESTDIR}${PREFIX}${base_libdir}/
43+ @chmod 644 ${DESTDIR}${PREFIX}${base_libdir}/${SONAME}
44+ @ln -s ${SONAME} ${DESTDIR}${PREFIX}${base_libdir}/libacpi.so
45 @echo installing test-libacpi to ${DESTDIR}${PREFIX}/bin
46 @mkdir -p ${DESTDIR}${PREFIX}/bin
47 @cp -f test-libacpi ${DESTDIR}${PREFIX}/bin
diff --git a/meta/recipes-bsp/libacpi/files/makefile-fix.patch b/meta/recipes-bsp/libacpi/files/makefile-fix.patch
new file mode 100644
index 0000000000..c34ef34e09
--- /dev/null
+++ b/meta/recipes-bsp/libacpi/files/makefile-fix.patch
@@ -0,0 +1,47 @@
1Upstream-Status: Pending
2
3---
4 Makefile | 6 +++---
5 config.mk | 3 ++-
6 2 files changed, 5 insertions(+), 4 deletions(-)
7
8Index: libacpi-0.2/Makefile
9===================================================================
10--- libacpi-0.2.orig/Makefile 2007-07-29 14:09:34.000000000 +0200
11+++ libacpi-0.2/Makefile 2008-09-26 10:34:53.000000000 +0200
12@@ -25,16 +25,16 @@ ${OBJ}: config.mk libacpi.h
13
14 libacpi.a: ${OBJ}
15 @echo AR $@
16- @${AR} $@ ${OBJ}
17+ ${AR} ${ARFLAGS} $@ ${OBJ}
18 @${RANLIB} $@
19
20 libacpi.so: ${OBJ}
21 @echo LD $@
22- @${LD} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
23+ @${CC} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
24
25 test-libacpi: ${OBJ_test}
26 @echo LD $@
27- @${LD} -o $@ ${OBJ_test} ${LDFLAGS}
28+ @${CC} -o $@ ${OBJ_test} ${LDFLAGS}
29 @strip $@
30
31 install: all
32Index: libacpi-0.2/config.mk
33===================================================================
34--- libacpi-0.2.orig/config.mk 2007-07-29 14:09:34.000000000 +0200
35+++ libacpi-0.2/config.mk 2008-09-26 10:34:33.000000000 +0200
36@@ -9,9 +9,10 @@ MANPREFIX = ${PREFIX}/share/man
37 # flags
38 SOFLAGS = -shared -Wl,-soname,${SONAME}
39 CFLAGS += -fPIC -g --pedantic -Wall -Wextra
40+ARFLAGS = cr
41
42 # Compiler and linker
43 CC = cc
44 LD = ${CC}
45-AR = ar cr
46+AR = ar
47 RANLIB = ranlib
diff --git a/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch b/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch
new file mode 100644
index 0000000000..bca75fb472
--- /dev/null
+++ b/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch
@@ -0,0 +1,23 @@
1Upstream-Status: Pending
2
3Used the cross strip instead of host strip to avoid this build error:
4
5| strip: Unable to recognise the format of the input file `test-libacpi'
6| make: *** [test-libacpi] Error 1
7| ERROR: oe_runmake failed
8
9Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/07
10
11Index: libacpi-0.2/Makefile
12===================================================================
13--- libacpi-0.2.orig/Makefile
14+++ libacpi-0.2/Makefile
15@@ -39,7 +39,7 @@ libacpi.so: ${OBJ}
16 test-libacpi: ${OBJ_test}
17 @echo LD $@
18 @${CC} -o $@ ${OBJ_test} ${LDFLAGS}
19- @strip $@
20+ @${STRIP} $@
21
22 install: all
23 @echo installing header to ${DESTDIR}${PREFIX}/include
diff --git a/meta/recipes-bsp/libacpi/libacpi_0.2.bb b/meta/recipes-bsp/libacpi/libacpi_0.2.bb
new file mode 100644
index 0000000000..bf302f3ce4
--- /dev/null
+++ b/meta/recipes-bsp/libacpi/libacpi_0.2.bb
@@ -0,0 +1,30 @@
1SUMMARY = "ACPI data gathering library"
2DESCRIPTION = "General purpose shared library for programs gathering ACPI data on Linux. \
3Thermal zones, battery infomration, fan information and AC states are implemented."
4SECTION = "base"
5HOMEPAGE = "http://www.ngolde.de/libacpi.html"
6LICENSE = "MIT"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=fec17f82f16630adf2dfb7d2a46f21c5"
8PR = "r6"
9
10SRC_URI = "http://www.ngolde.de/download/libacpi-${PV}.tar.gz \
11 file://makefile-fix.patch \
12 file://libacpi_fix_for_x32.patch \
13 file://use_correct_strip_in_cross_environment.patch \
14 file://ldflags.patch "
15
16SRC_URI[md5sum] = "05b53dd7bead66dda35fec502b91066c"
17SRC_URI[sha256sum] = "13086e31d428b9c125954d48ac497b754bbbce2ef34ea29ecd903e82e25bad29"
18
19inherit lib_package
20
21COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)'
22
23CFLAGS += "-fPIC"
24EXTRA_OEMAKE += 'STRIP="echo"'
25
26TARGET_CC_ARCH += "${LDFLAGS}"
27
28do_install() {
29 oe_runmake install DESTDIR=${D} PREFIX=${exec_prefix}
30}
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch
new file mode 100644
index 0000000000..682cf416e2
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch
@@ -0,0 +1,19 @@
1Add a description to the AC_DEFINE for LOCALEDIR so that it appears in config.h
2and silences a fatal warning.
3
4Upstream-Status:Pending
5Signed-off-by: Ross Burton <ross.burton@intel.com>
6
7diff --git a/configure.in b/configure.in
8index c10460c..aa20263 100644
9--- a/configure.in
10+++ b/configure.in
11@@ -258,7 +258,7 @@ AC_SUBST(LIBS)
12
13 AM_GNU_GETTEXT
14
15-AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
16+AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME",[locale directory])
17
18 AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile m4/Makefile \
19 man/Makefile po/Makefile.in src/Makefile debian/rules Specfile systype \
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch
new file mode 100644
index 0000000000..394519855e
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch
@@ -0,0 +1,39 @@
1Upstream-Status: Inappropriate [configuration]
2
3--- lrzsz-0.12.20/acinclude.m4~autotools 1998-12-27 17:08:59.000000000 -0500
4+++ lrzsz-0.12.20/acinclude.m4 2004-05-09 22:26:19.000000000 -0400
5@@ -1,12 +1,11 @@
6 dnl AC_REPLACE_GNU_GETOPT
7-AC_DEFUN(AC_REPLACE_GNU_GETOPT,
8-[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
9-AC_SUBST(LIBOBJS)dnl
10-])
11+AC_DEFUN([AC_REPLACE_GNU_GETOPT],
12+[AC_CHECK_FUNC(getopt_long, , [AC_LIBOBJ([getopt1])
13+AC_LIBOBJ([getopt])dnl])])
14
15 dnl
16 dnl taken from taylor uucp
17-AC_DEFUN(LRZSZ_ERRNO_DECL,[
18+AC_DEFUN([LRZSZ_ERRNO_DECL],[
19 AC_MSG_CHECKING(for errno declaration)
20 AC_CACHE_VAL(lrzsz_cv_decl_errno,
21 [AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
22@@ -23,7 +21,7 @@
23 ])
24
25 dnl LRZSZ_TYPE_SPEED_T
26-AC_DEFUN(LRZSZ_TYPE_SPEED_T,[
27+AC_DEFUN([LRZSZ_TYPE_SPEED_T],[
28 AC_REQUIRE([AC_HEADER_STDC])dnl
29 AC_REQUIRE([LRZSZ_HEADERS_TERM_IO])dnl
30 AC_MSG_CHECKING(for speed_t)
31@@ -61,7 +59,7 @@
32 fi
33 ])
34
35-AC_DEFUN(lrzsz_HEADER_SYS_SELECT,
36+AC_DEFUN([lrzsz_HEADER_SYS_SELECT],
37 [AC_CACHE_CHECK([whether sys/time.h and sys/select.h may both be included],
38 lrzsz_cv_header_sys_select,
39 [AC_TRY_COMPILE([#include <sys/types.h>
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch
new file mode 100644
index 0000000000..1a24a1f05e
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch
@@ -0,0 +1,21884 @@
1Upstream-Status: Inappropriate [configuration]
2
3--- lrzsz-0.12.20.safe/ABOUT-NLS 1998-04-26 09:22:30.000000000 -0400
4+++ lrzsz-0.12.20/ABOUT-NLS 2004-09-12 14:40:34.323752952 -0400
5@@ -1,14 +1,14 @@
6 Notes on the Free Translation Project
7 *************************************
8
9- Free software is going international! The Free Translation Project
10-is a way to get maintainers of free software, translators, and users all
11+Free software is going international! The Free Translation Project is
12+a way to get maintainers of free software, translators, and users all
13 together, so that will gradually become able to speak many languages.
14 A few packages already provide translations for their messages.
15
16 If you found this `ABOUT-NLS' file inside a distribution, you may
17 assume that the distributed package does use GNU `gettext' internally,
18-itself available at your nearest GNU archive site. But you do *not*
19+itself available at your nearest GNU archive site. But you do _not_
20 need to install GNU `gettext' prior to configuring, installing or using
21 this package with messages translated.
22
23@@ -22,10 +22,10 @@
24 `gettext' which is used. The information can be found in the
25 `intl/VERSION' file, in internationalized packages.
26
27-One advise in advance
28-=====================
29+Quick configuration advice
30+==========================
31
32- If you want to exploit the full power of internationalization, you
33+If you want to exploit the full power of internationalization, you
34 should configure it using
35
36 ./configure --with-included-gettext
37@@ -34,42 +34,40 @@
38 package, despite the existence of internationalizing capabilities in the
39 operating system where this package is being installed. So far, only
40 the `gettext' implementation in the GNU C library version 2 provides as
41-many features (such as locale alias or message inheritance) as the
42-implementation here. It is also not possible to offer this additional
43-functionality on top of a `catgets' implementation. Future versions of
44-GNU `gettext' will very likely convey even more functionality. So it
45-might be a good idea to change to GNU `gettext' as soon as possible.
46+many features (such as locale alias, message inheritance, automatic
47+charset conversion or plural form handling) as the implementation here.
48+It is also not possible to offer this additional functionality on top
49+of a `catgets' implementation. Future versions of GNU `gettext' will
50+very likely convey even more functionality. So it might be a good idea
51+to change to GNU `gettext' as soon as possible.
52
53- So you need not provide this option if you are using GNU libc 2 or
54+ So you need _not_ provide this option if you are using GNU libc 2 or
55 you have installed a recent copy of the GNU gettext package with the
56 included `libintl'.
57
58 INSTALL Matters
59 ===============
60
61- Some packages are "localizable" when properly installed; the
62-programs they contain can be made to speak your own native language.
63-Most such packages use GNU `gettext'. Other packages have their own
64-ways to internationalization, predating GNU `gettext'.
65+Some packages are "localizable" when properly installed; the programs
66+they contain can be made to speak your own native language. Most such
67+packages use GNU `gettext'. Other packages have their own ways to
68+internationalization, predating GNU `gettext'.
69
70 By default, this package will be installed to allow translation of
71-messages. It will automatically detect whether the system provides
72-usable `catgets' (if using this is selected by the installer) or
73-`gettext' functions. If neither is available, the GNU `gettext' own
74+messages. It will automatically detect whether the system already
75+provides the GNU `gettext' functions. If not, the GNU `gettext' own
76 library will be used. This library is wholly contained within this
77 package, usually in the `intl/' subdirectory, so prior installation of
78-the GNU `gettext' package is *not* required. Installers may use
79+the GNU `gettext' package is _not_ required. Installers may use
80 special options at configuration time for changing the default
81 behaviour. The commands:
82
83 ./configure --with-included-gettext
84- ./configure --with-catgets
85 ./configure --disable-nls
86
87-will respectively bypass any pre-existing `catgets' or `gettext' to use
88-the internationalizing routines provided within this package, enable
89-the use of the `catgets' functions (if found on the locale system), or
90-else, *totally* disable translation of messages.
91+will respectively bypass any pre-existing `gettext' to use the
92+internationalizing routines provided within this package, or else,
93+_totally_ disable translation of messages.
94
95 When you already have GNU `gettext' installed on your system and run
96 configure without an option for your new package, `configure' will
97@@ -83,18 +81,10 @@
98
99 to prevent auto-detection.
100
101- By default the configuration process will not test for the `catgets'
102-function and therefore they will not be used. The reasons are already
103-given above: the emulation on top of `catgets' cannot provide all the
104-extensions provided by the GNU `gettext' library. If you nevertheless
105-want to use the `catgets' functions use
106-
107- ./configure --with-catgets
108-
109-to enable the test for `catgets' (this causes no harm if `catgets' is
110-not available on your system). If you really select this option we
111-would like to hear about the reasons because we cannot think of any
112-good one ourself.
113+ The configuration process will not test for the `catgets' function
114+and therefore it will not be used. The reason is that even an
115+emulation of `gettext' on top of `catgets' could not provide all the
116+extensions of the GNU `gettext' library.
117
118 Internationalized packages have usually many `po/LL.po' files, where
119 LL gives an ISO 639 two-letter code identifying the language. Unless
120@@ -108,57 +98,73 @@
121 Using This Package
122 ==================
123
124- As a user, if your language has been installed for this package, you
125+As a user, if your language has been installed for this package, you
126 only have to set the `LANG' environment variable to the appropriate
127-ISO 639 `LL' two-letter code prior to using the programs in the
128-package. For example, let's suppose that you speak German. At the
129-shell prompt, merely execute `setenv LANG de' (in `csh'),
130-`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
131-can be done from your `.login' or `.profile' file, once and for all.
132+`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
133+and `CC' is an ISO 3166 two-letter country code. For example, let's
134+suppose that you speak German and live in Germany. At the shell
135+prompt, merely execute `setenv LANG de_DE' (in `csh'),
136+`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
137+This can be done from your `.login' or `.profile' file, once and for
138+all.
139
140- An operating system might already offer message localization for
141-many of its programs, while other programs have been installed locally
142-with the full capabilities of GNU `gettext'. Just using `gettext'
143-extended syntax for `LANG' would break proper localization of already
144-available operating system programs. In this case, users should set
145-both `LANGUAGE' and `LANG' variables in their environment, as programs
146-using GNU `gettext' give preference to `LANGUAGE'. For example, some
147-Swedish users would rather read translations in German than English for
148-when Swedish is not available. This is easily accomplished by setting
149-`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
150+ You might think that the country code specification is redundant.
151+But in fact, some languages have dialects in different countries. For
152+example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
153+country code serves to distinguish the dialects.
154+
155+ The locale naming convention of `LL_CC', with `LL' denoting the
156+language and `CC' denoting the country, is the one use on systems based
157+on GNU libc. On other systems, some variations of this scheme are
158+used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
159+locales supported by your system for your country by running the command
160+`locale -a | grep '^LL''.
161+
162+ Not all programs have translations for all languages. By default, an
163+English message is shown in place of a nonexistent translation. If you
164+understand other languages, you can set up a priority list of languages.
165+This is done through a different environment variable, called
166+`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
167+for the purpose of message handling, but you still need to have `LANG'
168+set to the primary language; this is required by other parts of the
169+system libraries. For example, some Swedish users who would rather
170+read translations in German than English for when Swedish is not
171+available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
172+
173+ Special advice for Norwegian users: The language code for Norwegian
174+bokma*l changed from `no' to `nb' recently (in 2003). During the
175+transition period, while some message catalogs for this language are
176+installed under `nb' and some older ones under `no', it's recommended
177+for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
178+older translations are used.
179+
180+ In the `LANGUAGE' environment variable, but not in the `LANG'
181+environment variable, `LL_CC' combinations can be abbreviated as `LL'
182+to denote the language's main dialect. For example, `de' is equivalent
183+to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
184+(Portuguese as spoken in Portugal) in this context.
185
186 Translating Teams
187 =================
188
189- For the Free Translation Project to be a success, we need interested
190+For the Free Translation Project to be a success, we need interested
191 people who like their own language and write it well, and who are also
192 able to synergize with other translators speaking the same language.
193-Each translation team has its own mailing list, courtesy of Linux
194-International. You may reach your translation team at the address
195-`LL@li.org', replacing LL by the two-letter ISO 639 code for your
196-language. Language codes are *not* the same as the country codes given
197-in ISO 3166. The following translation teams exist, as of August 1997:
198-
199- Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
200- Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
201- `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
202- Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
203- `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
204- Swedish `sv', and Turkish `tr'.
205-
206-For example, you may reach the Chinese translation team by writing to
207-`zh@li.org'.
208+Each translation team has its own mailing list. The up-to-date list of
209+teams can be found at the Free Translation Project's homepage,
210+`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
211+area.
212
213- If you'd like to volunteer to *work* at translating messages, you
214+ If you'd like to volunteer to _work_ at translating messages, you
215 should become a member of the translating team for your own language.
216-The subscribing address is *not* the same as the list itself, it has
217+The subscribing address is _not_ the same as the list itself, it has
218 `-request' appended. For example, speakers of Swedish can send a
219 message to `sv-request@li.org', having this message body:
220
221 subscribe
222
223 Keep in mind that team members are expected to participate
224-*actively* in translations, or at solving translational difficulties,
225+_actively_ in translations, or at solving translational difficulties,
226 rather than merely lurking around. If your team does not exist yet and
227 you want to start one, or if you are unsure about what to do or how to
228 get started, please write to `translation@iro.umontreal.ca' to reach the
229@@ -171,43 +177,559 @@
230 Available Packages
231 ==================
232
233- Languages are not equally supported in all packages. The following
234-matrix shows the current state of internationalization, as of August
235-1997. The matrix shows, in regard of each package, for which languages
236-PO files have been submitted to translation coordination.
237+Languages are not equally supported in all packages. The following
238+matrix shows the current state of internationalization, as of January
239+2004. The matrix shows, in regard of each package, for which languages
240+PO files have been submitted to translation coordination, with a
241+translation percentage of at least 50%.
242
243- Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv
244- .-------------------------------------------------.
245- bash | [] [] [] | 3
246- bison | [] [] [] | 3
247- clisp | [] [] [] [] | 4
248- cpio | [] [] [] [] [] | 5
249- diffutils | [] [] [] [] [] | 5
250- enscript | [] [] [] [] [] [] | 6
251- fileutils | [] [] [] [] [] [] [] [] [] [] | 10
252- findutils | [] [] [] [] [] [] [] [] | 8
253- flex | [] [] [] [] | 4
254- gcal | [] [] [] [] [] | 5
255- gettext | [] [] [] [] [] [] [] [] [] [] | 11
256- grep | [] [] [] [] [] [] [] [] [] | 9
257- hello | [] [] [] [] [] [] [] [] [] [] | 10
258- id-utils | [] [] [] | 3
259- indent | [] [] [] [] | 4
260- libc | [] [] [] [] [] [] [] | 7
261- m4 | [] [] [] [] [] | 5
262- make | [] [] [] [] [] [] | 6
263- music | [] [] | 2
264- ptx | [] [] [] [] [] [] [] [] | 8
265- recode | [] [] [] [] [] [] [] [] [] | 9
266- sh-utils | [] [] [] [] [] [] [] | 7
267- sharutils | [] [] [] [] [] | 5
268- tar | [] [] [] [] [] [] [] [] [] [] | 10
269- texinfo | [] | 1
270- textutils | [] [] [] [] [] [] [] [] [] | 9
271- wdiff | [] [] [] [] [] [] [] [] | 8
272- `-------------------------------------------------'
273- 16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv
274- 27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167
275+ Ready PO files af am ar az be bg bs ca cs da de el en en_GB eo es
276+ +----------------------------------------------------+
277+ a2ps | [] [] [] [] |
278+ aegis | () |
279+ ant-phone | () |
280+ anubis | |
281+ ap-utils | |
282+ aspell | [] |
283+ bash | [] [] [] [] |
284+ batchelor | |
285+ bfd | [] [] |
286+ binutils | [] [] |
287+ bison | [] [] [] |
288+ bluez-pin | [] [] [] |
289+ clisp | |
290+ clisp | [] [] [] |
291+ console-tools | [] [] |
292+ coreutils | [] [] [] [] |
293+ cpio | [] [] [] |
294+ darkstat | [] () [] |
295+ diffutils | [] [] [] [] [] [] [] |
296+ e2fsprogs | [] [] [] |
297+ enscript | [] [] [] [] |
298+ error | [] [] [] [] [] |
299+ fetchmail | [] () [] [] [] [] |
300+ fileutils | [] [] [] |
301+ findutils | [] [] [] [] [] [] [] |
302+ flex | [] [] [] [] |
303+ fslint | |
304+ gas | [] |
305+ gawk | [] [] [] [] |
306+ gbiff | [] |
307+ gcal | [] |
308+ gcc | [] [] |
309+ gettext | [] [] [] [] [] |
310+ gettext-examples | [] [] [] [] |
311+ gettext-runtime | [] [] [] [] [] |
312+ gettext-tools | [] [] [] |
313+ gimp-print | [] [] [] [] [] |
314+ gliv | |
315+ glunarclock | [] [] |
316+ gnubiff | [] |
317+ gnucash | [] () [] [] |
318+ gnucash-glossary | [] () [] |
319+ gnupg | [] () [] [] [] [] |
320+ gpe-aerial | [] |
321+ gpe-beam | [] [] |
322+ gpe-calendar | [] [] |
323+ gpe-clock | [] [] |
324+ gpe-conf | [] [] |
325+ gpe-contacts | [] [] |
326+ gpe-edit | [] |
327+ gpe-go | [] |
328+ gpe-login | [] [] |
329+ gpe-ownerinfo | [] [] |
330+ gpe-sketchbook | [] [] |
331+ gpe-su | [] [] |
332+ gpe-taskmanager | [] [] |
333+ gpe-timesheet | [] |
334+ gpe-today | [] [] |
335+ gpe-todo | [] [] |
336+ gphoto2 | [] [] [] [] |
337+ gprof | [] [] [] |
338+ gpsdrive | () () () |
339+ gramadoir | [] |
340+ grep | [] [] [] [] [] [] |
341+ gretl | [] |
342+ gtick | [] () |
343+ hello | [] [] [] [] [] [] |
344+ id-utils | [] [] |
345+ indent | [] [] [] [] |
346+ iso_3166 | [] [] [] [] [] [] [] [] [] [] |
347+ iso_3166_1 | [] [] [] [] [] [] |
348+ iso_3166_2 | |
349+ iso_3166_3 | [] |
350+ iso_4217 | [] [] [] [] |
351+ iso_639 | |
352+ jpilot | [] [] [] |
353+ jtag | |
354+ jwhois | [] |
355+ kbd | [] [] [] [] [] |
356+ latrine | () |
357+ ld | [] [] |
358+ libc | [] [] [] [] [] [] |
359+ libgpewidget | [] [] |
360+ libiconv | [] [] [] [] [] |
361+ lifelines | [] () |
362+ lilypond | [] |
363+ lingoteach | |
364+ lingoteach_lessons | () () |
365+ lynx | [] [] [] [] |
366+ m4 | [] [] [] [] |
367+ mailutils | [] [] |
368+ make | [] [] [] |
369+ man-db | [] () [] [] () |
370+ minicom | [] [] [] |
371+ mysecretdiary | [] [] [] |
372+ nano | [] () [] [] [] |
373+ nano_1_0 | [] () [] [] [] |
374+ opcodes | [] |
375+ parted | [] [] [] [] [] |
376+ ptx | [] [] [] [] [] |
377+ python | |
378+ radius | [] |
379+ recode | [] [] [] [] [] [] [] |
380+ rpm | [] [] |
381+ screem | |
382+ scrollkeeper | [] [] [] [] [] [] |
383+ sed | [] [] [] [] [] [] |
384+ sh-utils | [] [] [] |
385+ shared-mime-info | |
386+ sharutils | [] [] [] [] [] [] |
387+ silky | () |
388+ skencil | [] () [] |
389+ sketch | [] () [] |
390+ soundtracker | [] [] [] |
391+ sp | [] |
392+ tar | [] [] [] [] |
393+ texinfo | [] [] [] |
394+ textutils | [] [] [] [] |
395+ tin | () () |
396+ tp-robot | |
397+ tuxpaint | [] [] [] [] [] [] [] |
398+ unicode-han-tra... | |
399+ unicode-transla... | |
400+ util-linux | [] [] [] [] [] |
401+ vorbis-tools | [] [] [] [] |
402+ wastesedge | () |
403+ wdiff | [] [] [] [] |
404+ wget | [] [] [] [] [] [] |
405+ xchat | [] [] [] [] |
406+ xfree86_xkb_xml | [] [] |
407+ xpad | [] |
408+ +----------------------------------------------------+
409+ af am ar az be bg bs ca cs da de el en en_GB eo es
410+ 4 0 0 1 9 4 1 40 41 60 78 17 1 5 13 68
411+
412+ et eu fa fi fr ga gl he hr hu id is it ja ko lg
413+ +-------------------------------------------------+
414+ a2ps | [] [] [] () () |
415+ aegis | |
416+ ant-phone | [] |
417+ anubis | [] |
418+ ap-utils | [] |
419+ aspell | [] [] |
420+ bash | [] [] |
421+ batchelor | [] [] |
422+ bfd | [] |
423+ binutils | [] [] |
424+ bison | [] [] [] [] |
425+ bluez-pin | [] [] [] [] [] |
426+ clisp | |
427+ clisp | [] |
428+ console-tools | |
429+ coreutils | [] [] [] [] [] [] |
430+ cpio | [] [] [] [] |
431+ darkstat | () [] [] [] |
432+ diffutils | [] [] [] [] [] [] [] |
433+ e2fsprogs | |
434+ enscript | [] [] |
435+ error | [] [] [] [] |
436+ fetchmail | [] |
437+ fileutils | [] [] [] [] [] [] |
438+ findutils | [] [] [] [] [] [] [] [] [] [] [] |
439+ flex | [] [] [] |
440+ fslint | [] |
441+ gas | [] |
442+ gawk | [] [] [] |
443+ gbiff | [] |
444+ gcal | [] |
445+ gcc | [] |
446+ gettext | [] [] [] |
447+ gettext-examples | [] [] |
448+ gettext-runtime | [] [] [] [] [] |
449+ gettext-tools | [] [] [] |
450+ gimp-print | [] [] |
451+ gliv | () |
452+ glunarclock | [] [] [] [] |
453+ gnubiff | [] |
454+ gnucash | () [] |
455+ gnucash-glossary | [] |
456+ gnupg | [] [] [] [] [] [] [] |
457+ gpe-aerial | [] |
458+ gpe-beam | [] |
459+ gpe-calendar | [] [] [] |
460+ gpe-clock | [] |
461+ gpe-conf | [] |
462+ gpe-contacts | [] [] |
463+ gpe-edit | [] [] |
464+ gpe-go | [] |
465+ gpe-login | [] [] |
466+ gpe-ownerinfo | [] [] [] |
467+ gpe-sketchbook | [] |
468+ gpe-su | [] |
469+ gpe-taskmanager | [] |
470+ gpe-timesheet | [] [] [] |
471+ gpe-today | [] [] |
472+ gpe-todo | [] [] |
473+ gphoto2 | [] [] [] |
474+ gprof | [] [] |
475+ gpsdrive | () () () |
476+ gramadoir | [] [] |
477+ grep | [] [] [] [] [] [] [] [] [] [] [] |
478+ gretl | [] [] |
479+ gtick | [] [] [] |
480+ hello | [] [] [] [] [] [] [] [] [] [] [] [] [] |
481+ id-utils | [] [] [] [] |
482+ indent | [] [] [] [] [] [] [] [] [] |
483+ iso_3166 | [] [] [] [] [] [] [] |
484+ iso_3166_1 | [] [] [] [] [] |
485+ iso_3166_2 | |
486+ iso_3166_3 | |
487+ iso_4217 | [] [] [] [] [] [] |
488+ iso_639 | |
489+ jpilot | [] () |
490+ jtag | [] |
491+ jwhois | [] [] [] [] |
492+ kbd | [] |
493+ latrine | [] |
494+ ld | [] |
495+ libc | [] [] [] [] [] [] |
496+ libgpewidget | [] [] [] [] |
497+ libiconv | [] [] [] [] [] [] [] [] [] |
498+ lifelines | () |
499+ lilypond | [] |
500+ lingoteach | [] [] |
501+ lingoteach_lessons | |
502+ lynx | [] [] [] [] |
503+ m4 | [] [] [] [] |
504+ mailutils | |
505+ make | [] [] [] [] [] [] |
506+ man-db | () () |
507+ minicom | [] [] [] [] |
508+ mysecretdiary | [] [] |
509+ nano | [] [] [] [] |
510+ nano_1_0 | [] [] [] [] |
511+ opcodes | [] |
512+ parted | [] [] [] |
513+ ptx | [] [] [] [] [] [] [] |
514+ python | |
515+ radius | [] |
516+ recode | [] [] [] [] [] [] |
517+ rpm | [] [] |
518+ screem | |
519+ scrollkeeper | [] |
520+ sed | [] [] [] [] [] [] [] [] [] |
521+ sh-utils | [] [] [] [] [] [] [] |
522+ shared-mime-info | [] [] [] |
523+ sharutils | [] [] [] [] [] |
524+ silky | () [] () () |
525+ skencil | [] |
526+ sketch | [] |
527+ soundtracker | [] [] |
528+ sp | [] () |
529+ tar | [] [] [] [] [] [] [] [] [] |
530+ texinfo | [] [] [] [] |
531+ textutils | [] [] [] [] [] [] |
532+ tin | [] () |
533+ tp-robot | [] |
534+ tuxpaint | [] [] [] [] [] [] [] [] [] |
535+ unicode-han-tra... | |
536+ unicode-transla... | [] [] |
537+ util-linux | [] [] [] [] () [] |
538+ vorbis-tools | [] |
539+ wastesedge | () |
540+ wdiff | [] [] [] [] [] [] |
541+ wget | [] [] [] [] [] [] [] |
542+ xchat | [] [] [] |
543+ xfree86_xkb_xml | [] [] |
544+ xpad | [] [] |
545+ +-------------------------------------------------+
546+ et eu fa fi fr ga gl he hr hu id is it ja ko lg
547+ 22 2 1 26 106 28 24 8 10 41 33 1 26 33 12 0
548+
549+ lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru
550+ +-----------------------------------------------------+
551+ a2ps | [] [] () () [] [] [] |
552+ aegis | () () () |
553+ ant-phone | [] [] |
554+ anubis | [] [] [] [] [] [] |
555+ ap-utils | [] () [] |
556+ aspell | [] |
557+ bash | [] [] [] |
558+ batchelor | [] |
559+ bfd | [] |
560+ binutils | [] |
561+ bison | [] [] [] [] [] |
562+ bluez-pin | [] [] [] |
563+ clisp | |
564+ clisp | [] |
565+ console-tools | [] |
566+ coreutils | [] [] |
567+ cpio | [] [] [] [] [] |
568+ darkstat | [] [] [] [] |
569+ diffutils | [] [] [] [] [] [] |
570+ e2fsprogs | [] |
571+ enscript | [] [] [] [] |
572+ error | [] [] [] |
573+ fetchmail | [] [] () [] |
574+ fileutils | [] [] [] |
575+ findutils | [] [] [] [] [] |
576+ flex | [] [] [] [] |
577+ fslint | [] [] |
578+ gas | |
579+ gawk | [] [] [] |
580+ gbiff | [] [] |
581+ gcal | |
582+ gcc | |
583+ gettext | [] [] [] |
584+ gettext-examples | [] [] [] |
585+ gettext-runtime | [] [] [] [] |
586+ gettext-tools | [] [] |
587+ gimp-print | [] |
588+ gliv | [] [] [] |
589+ glunarclock | [] [] [] [] |
590+ gnubiff | [] |
591+ gnucash | [] [] () [] |
592+ gnucash-glossary | [] [] |
593+ gnupg | [] |
594+ gpe-aerial | [] [] [] [] |
595+ gpe-beam | [] [] [] [] |
596+ gpe-calendar | [] [] [] [] |
597+ gpe-clock | [] [] [] [] |
598+ gpe-conf | [] [] [] [] |
599+ gpe-contacts | [] [] [] [] |
600+ gpe-edit | [] [] [] [] |
601+ gpe-go | [] [] [] |
602+ gpe-login | [] [] [] [] |
603+ gpe-ownerinfo | [] [] [] [] |
604+ gpe-sketchbook | [] [] [] [] |
605+ gpe-su | [] [] [] [] |
606+ gpe-taskmanager | [] [] [] [] |
607+ gpe-timesheet | [] [] [] [] |
608+ gpe-today | [] [] [] [] |
609+ gpe-todo | [] [] [] [] |
610+ gphoto2 | [] |
611+ gprof | [] [] |
612+ gpsdrive | () () [] |
613+ gramadoir | () [] |
614+ grep | [] [] [] [] [] |
615+ gretl | |
616+ gtick | [] [] [] |
617+ hello | [] [] [] [] [] [] [] [] [] [] |
618+ id-utils | [] [] [] [] |
619+ indent | [] [] [] [] |
620+ iso_3166 | [] [] [] |
621+ iso_3166_1 | [] [] |
622+ iso_3166_2 | |
623+ iso_3166_3 | [] |
624+ iso_4217 | [] [] [] [] [] [] [] [] |
625+ iso_639 | [] |
626+ jpilot | () () |
627+ jtag | |
628+ jwhois | [] [] [] [] () |
629+ kbd | [] [] [] |
630+ latrine | [] |
631+ ld | |
632+ libc | [] [] [] [] |
633+ libgpewidget | [] [] [] |
634+ libiconv | [] [] [] [] [] |
635+ lifelines | |
636+ lilypond | |
637+ lingoteach | |
638+ lingoteach_lessons | |
639+ lynx | [] [] [] |
640+ m4 | [] [] [] [] [] |
641+ mailutils | [] [] [] |
642+ make | [] [] [] [] |
643+ man-db | [] |
644+ minicom | [] [] [] [] |
645+ mysecretdiary | [] [] [] |
646+ nano | [] [] [] [] [] |
647+ nano_1_0 | [] [] [] [] [] [] |
648+ opcodes | [] [] |
649+ parted | [] [] [] [] |
650+ ptx | [] [] [] [] [] [] [] [] |
651+ python | |
652+ radius | [] [] |
653+ recode | [] [] [] [] |
654+ rpm | [] [] [] |
655+ screem | |
656+ scrollkeeper | [] [] [] [] [] |
657+ sed | [] [] [] |
658+ sh-utils | [] [] |
659+ shared-mime-info | [] [] |
660+ sharutils | [] [] |
661+ silky | () |
662+ skencil | [] [] |
663+ sketch | [] [] |
664+ soundtracker | |
665+ sp | |
666+ tar | [] [] [] [] [] [] |
667+ texinfo | [] [] [] [] |
668+ textutils | [] [] |
669+ tin | |
670+ tp-robot | [] |
671+ tuxpaint | [] [] [] [] [] [] [] [] |
672+ unicode-han-tra... | |
673+ unicode-transla... | |
674+ util-linux | [] [] [] |
675+ vorbis-tools | [] [] [] |
676+ wastesedge | |
677+ wdiff | [] [] [] [] [] |
678+ wget | [] [] [] |
679+ xchat | [] [] [] |
680+ xfree86_xkb_xml | [] [] |
681+ xpad | [] [] |
682+ +-----------------------------------------------------+
683+ lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru
684+ 1 2 0 3 12 0 10 69 6 7 1 40 26 36 76 63
685+
686+ sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu
687+ +-----------------------------------------------------+
688+ a2ps | [] [] [] [] | 16
689+ aegis | | 0
690+ ant-phone | | 3
691+ anubis | [] [] | 9
692+ ap-utils | () | 3
693+ aspell | | 4
694+ bash | | 9
695+ batchelor | | 3
696+ bfd | [] [] | 6
697+ binutils | [] [] [] | 8
698+ bison | [] [] | 14
699+ bluez-pin | [] [] [] | 14
700+ clisp | | 0
701+ clisp | | 5
702+ console-tools | | 3
703+ coreutils | [] [] [] [] | 16
704+ cpio | [] [] | 14
705+ darkstat | [] [] [] () () | 12
706+ diffutils | [] [] [] | 23
707+ e2fsprogs | [] [] | 6
708+ enscript | [] [] | 12
709+ error | [] [] [] | 15
710+ fetchmail | [] [] | 11
711+ fileutils | [] [] [] [] [] | 17
712+ findutils | [] [] [] [] [] [] | 29
713+ flex | [] [] | 13
714+ fslint | | 3
715+ gas | [] | 3
716+ gawk | [] [] | 12
717+ gbiff | | 4
718+ gcal | [] [] | 4
719+ gcc | [] | 4
720+ gettext | [] [] [] [] [] | 16
721+ gettext-examples | [] [] [] [] [] | 14
722+ gettext-runtime | [] [] [] [] [] [] [] [] | 22
723+ gettext-tools | [] [] [] [] [] [] | 14
724+ gimp-print | [] [] | 10
725+ gliv | | 3
726+ glunarclock | [] [] [] | 13
727+ gnubiff | | 3
728+ gnucash | [] [] | 9
729+ gnucash-glossary | [] [] [] | 8
730+ gnupg | [] [] [] [] | 17
731+ gpe-aerial | [] | 7
732+ gpe-beam | [] | 8
733+ gpe-calendar | [] [] [] [] | 13
734+ gpe-clock | [] [] [] | 10
735+ gpe-conf | [] [] | 9
736+ gpe-contacts | [] [] [] | 11
737+ gpe-edit | [] [] [] [] [] | 12
738+ gpe-go | | 5
739+ gpe-login | [] [] [] [] [] | 13
740+ gpe-ownerinfo | [] [] [] [] | 13
741+ gpe-sketchbook | [] [] | 9
742+ gpe-su | [] [] [] | 10
743+ gpe-taskmanager | [] [] [] | 10
744+ gpe-timesheet | [] [] [] [] | 12
745+ gpe-today | [] [] [] [] [] | 13
746+ gpe-todo | [] [] [] [] | 12
747+ gphoto2 | [] [] [] | 11
748+ gprof | [] [] | 9
749+ gpsdrive | [] [] | 3
750+ gramadoir | [] | 5
751+ grep | [] [] [] [] | 26
752+ gretl | | 3
753+ gtick | | 7
754+ hello | [] [] [] [] [] | 34
755+ id-utils | [] [] | 12
756+ indent | [] [] [] [] | 21
757+ iso_3166 | [] [] [] [] [] [] [] | 27
758+ iso_3166_1 | [] [] [] | 16
759+ iso_3166_2 | | 0
760+ iso_3166_3 | | 2
761+ iso_4217 | [] [] [] [] [] [] | 24
762+ iso_639 | | 1
763+ jpilot | [] [] [] [] [] | 9
764+ jtag | [] | 2
765+ jwhois | () [] [] | 11
766+ kbd | [] [] | 11
767+ latrine | | 2
768+ ld | [] [] | 5
769+ libc | [] [] [] [] | 20
770+ libgpewidget | [] [] [] [] | 13
771+ libiconv | [] [] [] [] [] [] [] [] | 27
772+ lifelines | [] | 2
773+ lilypond | [] | 3
774+ lingoteach | | 2
775+ lingoteach_lessons | () | 0
776+ lynx | [] [] [] | 14
777+ m4 | [] [] | 15
778+ mailutils | | 5
779+ make | [] [] [] | 16
780+ man-db | [] | 5
781+ minicom | | 11
782+ mysecretdiary | [] [] | 10
783+ nano | [] [] [] [] | 17
784+ nano_1_0 | [] [] [] | 17
785+ opcodes | [] [] | 6
786+ parted | [] [] [] | 15
787+ ptx | [] [] | 22
788+ python | | 0
789+ radius | | 4
790+ recode | [] [] [] | 20
791+ rpm | [] [] | 9
792+ screem | [] [] | 2
793+ scrollkeeper | [] [] [] | 15
794+ sed | [] [] [] [] [] [] | 24
795+ sh-utils | [] [] | 14
796+ shared-mime-info | [] [] | 7
797+ sharutils | [] [] [] [] | 17
798+ silky | () | 3
799+ skencil | [] | 6
800+ sketch | [] | 6
801+ soundtracker | [] [] | 7
802+ sp | [] | 3
803+ tar | [] [] [] [] [] | 24
804+ texinfo | [] [] [] | 14
805+ textutils | [] [] [] [] | 16
806+ tin | | 1
807+ tp-robot | | 2
808+ tuxpaint | [] [] [] [] [] | 29
809+ unicode-han-tra... | | 0
810+ unicode-transla... | | 2
811+ util-linux | [] [] | 15
812+ vorbis-tools | | 8
813+ wastesedge | | 0
814+ wdiff | [] [] [] | 18
815+ wget | [] [] [] [] [] [] [] [] | 24
816+ xchat | [] [] [] [] [] | 15
817+ xfree86_xkb_xml | [] [] [] [] [] | 11
818+ xpad | | 5
819+ +-----------------------------------------------------+
820+ 63 teams sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu
821+ 131 domains 47 19 28 83 0 0 59 13 1 1 11 0 22 22 0 1373
822
823 Some counters in the preceding matrix are higher than the number of
824 visible blocks let us expect. This is because a few extra PO files are
825@@ -220,6 +742,27 @@
826 lag between the mere existence a PO file and its wide availability in a
827 distribution.
828
829- If August 1997 seems to be old, you may fetch a more recent copy of
830-this `ABOUT-NLS' file on most GNU archive sites.
831+ If January 2004 seems to be old, you may fetch a more recent copy of
832+this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
833+matrix with full percentage details can be found at
834+`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
835+
836+Using `gettext' in new packages
837+===============================
838+
839+If you are writing a freely available program and want to
840+internationalize it you are welcome to use GNU `gettext' in your
841+package. Of course you have to respect the GNU Library General Public
842+License which covers the use of the GNU `gettext' library. This means
843+in particular that even non-free programs can use `libintl' as a shared
844+library, whereas only free software can use `libintl' as a static
845+library or use modified versions of `libintl'.
846+
847+ Once the sources are changed appropriately and the setup can handle
848+the use of `gettext' the only thing missing are the translations. The
849+Free Translation Project is also available for packages which are not
850+developed inside the GNU project. Therefore the information given above
851+applies also for every other Free Software Project. Contact
852+`translation@iro.umontreal.ca' to make the `.pot' files available to
853+the translation teams.
854
855--- lrzsz-0.12.20.safe/ChangeLog 1998-12-29 17:49:56.000000000 -0500
856+++ lrzsz-0.12.20/ChangeLog 2004-09-12 14:40:35.846521456 -0400
857@@ -1,3 +1,11 @@
858+2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
859+
860+ * Makefile.am (ACLOCAL_AMFLAGS): New variable.
861+ (EXTRA_DIST): Add config.rpath.
862+ * configure.in (AC_OUTPUT): Add m4/Makefile.
863+ (AC_OUTPUT): Remove command that created po/Makefile.
864+ (AC_LINK_FILES): Remove invocation.
865+
866 1998-12-29 Uwe Ohse <uwe@ohse.de>
867
868 * src/lrz.c: removed stpcpy call.
869--- lrzsz-0.12.20.safe/config.rpath 1969-12-31 19:00:00.000000000 -0500
870+++ lrzsz-0.12.20/config.rpath 2004-09-12 14:40:34.329752040 -0400
871@@ -0,0 +1,548 @@
872+#! /bin/sh
873+# Output a system dependent set of variables, describing how to set the
874+# run time search path of shared libraries in an executable.
875+#
876+# Copyright 1996-2003 Free Software Foundation, Inc.
877+# Taken from GNU libtool, 2001
878+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
879+#
880+# This program is free software; you can redistribute it and/or modify
881+# it under the terms of the GNU General Public License as published by
882+# the Free Software Foundation; either version 2 of the License, or
883+# (at your option) any later version.
884+#
885+# This program is distributed in the hope that it will be useful, but
886+# WITHOUT ANY WARRANTY; without even the implied warranty of
887+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
888+# General Public License for more details.
889+#
890+# You should have received a copy of the GNU General Public License
891+# along with this program; if not, write to the Free Software
892+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
893+#
894+# As a special exception to the GNU General Public License, if you
895+# distribute this file as part of a program that contains a
896+# configuration script generated by Autoconf, you may include it under
897+# the same distribution terms that you use for the rest of that program.
898+#
899+# The first argument passed to this file is the canonical host specification,
900+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
901+# or
902+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
903+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
904+# should be set by the caller.
905+#
906+# The set of defined variables is at the end of this script.
907+
908+# Known limitations:
909+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
910+# than 256 bytes, otherwise the compiler driver will dump core. The only
911+# known workaround is to choose shorter directory names for the build
912+# directory and/or the installation directory.
913+
914+# All known linkers require a `.a' archive for static linking (except M$VC,
915+# which needs '.lib').
916+libext=a
917+shrext=.so
918+
919+host="$1"
920+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
921+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
922+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
923+
924+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
925+
926+wl=
927+if test "$GCC" = yes; then
928+ wl='-Wl,'
929+else
930+ case "$host_os" in
931+ aix*)
932+ wl='-Wl,'
933+ ;;
934+ mingw* | pw32* | os2*)
935+ ;;
936+ hpux9* | hpux10* | hpux11*)
937+ wl='-Wl,'
938+ ;;
939+ irix5* | irix6* | nonstopux*)
940+ wl='-Wl,'
941+ ;;
942+ newsos6)
943+ ;;
944+ linux*)
945+ case $CC in
946+ icc|ecc)
947+ wl='-Wl,'
948+ ;;
949+ ccc)
950+ wl='-Wl,'
951+ ;;
952+ esac
953+ ;;
954+ osf3* | osf4* | osf5*)
955+ wl='-Wl,'
956+ ;;
957+ sco3.2v5*)
958+ ;;
959+ solaris*)
960+ wl='-Wl,'
961+ ;;
962+ sunos4*)
963+ wl='-Qoption ld '
964+ ;;
965+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
966+ wl='-Wl,'
967+ ;;
968+ sysv4*MP*)
969+ ;;
970+ uts4*)
971+ ;;
972+ esac
973+fi
974+
975+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
976+
977+hardcode_libdir_flag_spec=
978+hardcode_libdir_separator=
979+hardcode_direct=no
980+hardcode_minus_L=no
981+
982+case "$host_os" in
983+ cygwin* | mingw* | pw32*)
984+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
985+ # When not using gcc, we currently assume that we are using
986+ # Microsoft Visual C++.
987+ if test "$GCC" != yes; then
988+ with_gnu_ld=no
989+ fi
990+ ;;
991+ openbsd*)
992+ with_gnu_ld=no
993+ ;;
994+esac
995+
996+ld_shlibs=yes
997+if test "$with_gnu_ld" = yes; then
998+ case "$host_os" in
999+ aix3* | aix4* | aix5*)
1000+ # On AIX/PPC, the GNU linker is very broken
1001+ if test "$host_cpu" != ia64; then
1002+ ld_shlibs=no
1003+ fi
1004+ ;;
1005+ amigaos*)
1006+ hardcode_libdir_flag_spec='-L$libdir'
1007+ hardcode_minus_L=yes
1008+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
1009+ # that the semantics of dynamic libraries on AmigaOS, at least up
1010+ # to version 4, is to share data among multiple programs linked
1011+ # with the same dynamic library. Since this doesn't match the
1012+ # behavior of shared libraries on other platforms, we can use
1013+ # them.
1014+ ld_shlibs=no
1015+ ;;
1016+ beos*)
1017+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
1018+ :
1019+ else
1020+ ld_shlibs=no
1021+ fi
1022+ ;;
1023+ cygwin* | mingw* | pw32*)
1024+ # hardcode_libdir_flag_spec is actually meaningless, as there is
1025+ # no search path for DLLs.
1026+ hardcode_libdir_flag_spec='-L$libdir'
1027+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
1028+ :
1029+ else
1030+ ld_shlibs=no
1031+ fi
1032+ ;;
1033+ netbsd*)
1034+ ;;
1035+ solaris* | sysv5*)
1036+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
1037+ ld_shlibs=no
1038+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
1039+ :
1040+ else
1041+ ld_shlibs=no
1042+ fi
1043+ ;;
1044+ sunos4*)
1045+ hardcode_direct=yes
1046+ ;;
1047+ *)
1048+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
1049+ :
1050+ else
1051+ ld_shlibs=no
1052+ fi
1053+ ;;
1054+ esac
1055+ if test "$ld_shlibs" = yes; then
1056+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
1057+ # option of GNU ld is called -rpath, not --rpath.
1058+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1059+ fi
1060+else
1061+ case "$host_os" in
1062+ aix3*)
1063+ # Note: this linker hardcodes the directories in LIBPATH if there
1064+ # are no directories specified by -L.
1065+ hardcode_minus_L=yes
1066+ if test "$GCC" = yes; then
1067+ # Neither direct hardcoding nor static linking is supported with a
1068+ # broken collect2.
1069+ hardcode_direct=unsupported
1070+ fi
1071+ ;;
1072+ aix4* | aix5*)
1073+ if test "$host_cpu" = ia64; then
1074+ # On IA64, the linker does run time linking by default, so we don't
1075+ # have to do anything special.
1076+ aix_use_runtimelinking=no
1077+ else
1078+ aix_use_runtimelinking=no
1079+ # Test if we are trying to use run time linking or normal
1080+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
1081+ # need to do runtime linking.
1082+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
1083+ for ld_flag in $LDFLAGS; do
1084+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
1085+ aix_use_runtimelinking=yes
1086+ break
1087+ fi
1088+ done
1089+ esac
1090+ fi
1091+ hardcode_direct=yes
1092+ hardcode_libdir_separator=':'
1093+ if test "$GCC" = yes; then
1094+ case $host_os in aix4.[012]|aix4.[012].*)
1095+ collect2name=`${CC} -print-prog-name=collect2`
1096+ if test -f "$collect2name" && \
1097+ strings "$collect2name" | grep resolve_lib_name >/dev/null
1098+ then
1099+ # We have reworked collect2
1100+ hardcode_direct=yes
1101+ else
1102+ # We have old collect2
1103+ hardcode_direct=unsupported
1104+ hardcode_minus_L=yes
1105+ hardcode_libdir_flag_spec='-L$libdir'
1106+ hardcode_libdir_separator=
1107+ fi
1108+ esac
1109+ fi
1110+ # Begin _LT_AC_SYS_LIBPATH_AIX.
1111+ echo 'int main () { return 0; }' > conftest.c
1112+ ${CC} ${LDFLAGS} conftest.c -o conftest
1113+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
1114+}'`
1115+ if test -z "$aix_libpath"; then
1116+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
1117+}'`
1118+ fi
1119+ if test -z "$aix_libpath"; then
1120+ aix_libpath="/usr/lib:/lib"
1121+ fi
1122+ rm -f conftest.c conftest
1123+ # End _LT_AC_SYS_LIBPATH_AIX.
1124+ if test "$aix_use_runtimelinking" = yes; then
1125+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
1126+ else
1127+ if test "$host_cpu" = ia64; then
1128+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
1129+ else
1130+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
1131+ fi
1132+ fi
1133+ ;;
1134+ amigaos*)
1135+ hardcode_libdir_flag_spec='-L$libdir'
1136+ hardcode_minus_L=yes
1137+ # see comment about different semantics on the GNU ld section
1138+ ld_shlibs=no
1139+ ;;
1140+ bsdi4*)
1141+ ;;
1142+ cygwin* | mingw* | pw32*)
1143+ # When not using gcc, we currently assume that we are using
1144+ # Microsoft Visual C++.
1145+ # hardcode_libdir_flag_spec is actually meaningless, as there is
1146+ # no search path for DLLs.
1147+ hardcode_libdir_flag_spec=' '
1148+ libext=lib
1149+ ;;
1150+ darwin* | rhapsody*)
1151+ if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
1152+ hardcode_direct=no
1153+ fi
1154+ ;;
1155+ dgux*)
1156+ hardcode_libdir_flag_spec='-L$libdir'
1157+ ;;
1158+ freebsd1*)
1159+ ld_shlibs=no
1160+ ;;
1161+ freebsd2.2*)
1162+ hardcode_libdir_flag_spec='-R$libdir'
1163+ hardcode_direct=yes
1164+ ;;
1165+ freebsd2*)
1166+ hardcode_direct=yes
1167+ hardcode_minus_L=yes
1168+ ;;
1169+ freebsd*)
1170+ hardcode_libdir_flag_spec='-R$libdir'
1171+ hardcode_direct=yes
1172+ ;;
1173+ hpux9*)
1174+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
1175+ hardcode_libdir_separator=:
1176+ hardcode_direct=yes
1177+ # hardcode_minus_L: Not really in the search PATH,
1178+ # but as the default location of the library.
1179+ hardcode_minus_L=yes
1180+ ;;
1181+ hpux10* | hpux11*)
1182+ if test "$with_gnu_ld" = no; then
1183+ case "$host_cpu" in
1184+ hppa*64*)
1185+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
1186+ hardcode_libdir_separator=:
1187+ hardcode_direct=no
1188+ ;;
1189+ ia64*)
1190+ hardcode_libdir_flag_spec='-L$libdir'
1191+ hardcode_direct=no
1192+ # hardcode_minus_L: Not really in the search PATH,
1193+ # but as the default location of the library.
1194+ hardcode_minus_L=yes
1195+ ;;
1196+ *)
1197+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
1198+ hardcode_libdir_separator=:
1199+ hardcode_direct=yes
1200+ # hardcode_minus_L: Not really in the search PATH,
1201+ # but as the default location of the library.
1202+ hardcode_minus_L=yes
1203+ ;;
1204+ esac
1205+ fi
1206+ ;;
1207+ irix5* | irix6* | nonstopux*)
1208+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1209+ hardcode_libdir_separator=:
1210+ ;;
1211+ netbsd*)
1212+ hardcode_libdir_flag_spec='-R$libdir'
1213+ hardcode_direct=yes
1214+ ;;
1215+ newsos6)
1216+ hardcode_direct=yes
1217+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1218+ hardcode_libdir_separator=:
1219+ ;;
1220+ openbsd*)
1221+ hardcode_direct=yes
1222+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
1223+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
1224+ else
1225+ case "$host_os" in
1226+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
1227+ hardcode_libdir_flag_spec='-R$libdir'
1228+ ;;
1229+ *)
1230+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
1231+ ;;
1232+ esac
1233+ fi
1234+ ;;
1235+ os2*)
1236+ hardcode_libdir_flag_spec='-L$libdir'
1237+ hardcode_minus_L=yes
1238+ ;;
1239+ osf3*)
1240+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1241+ hardcode_libdir_separator=:
1242+ ;;
1243+ osf4* | osf5*)
1244+ if test "$GCC" = yes; then
1245+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
1246+ else
1247+ # Both cc and cxx compiler support -rpath directly
1248+ hardcode_libdir_flag_spec='-rpath $libdir'
1249+ fi
1250+ hardcode_libdir_separator=:
1251+ ;;
1252+ sco3.2v5*)
1253+ ;;
1254+ solaris*)
1255+ hardcode_libdir_flag_spec='-R$libdir'
1256+ ;;
1257+ sunos4*)
1258+ hardcode_libdir_flag_spec='-L$libdir'
1259+ hardcode_direct=yes
1260+ hardcode_minus_L=yes
1261+ ;;
1262+ sysv4)
1263+ case $host_vendor in
1264+ sni)
1265+ hardcode_direct=yes # is this really true???
1266+ ;;
1267+ siemens)
1268+ hardcode_direct=no
1269+ ;;
1270+ motorola)
1271+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
1272+ ;;
1273+ esac
1274+ ;;
1275+ sysv4.3*)
1276+ ;;
1277+ sysv4*MP*)
1278+ if test -d /usr/nec; then
1279+ ld_shlibs=yes
1280+ fi
1281+ ;;
1282+ sysv4.2uw2*)
1283+ hardcode_direct=yes
1284+ hardcode_minus_L=no
1285+ ;;
1286+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
1287+ ;;
1288+ sysv5*)
1289+ hardcode_libdir_flag_spec=
1290+ ;;
1291+ uts4*)
1292+ hardcode_libdir_flag_spec='-L$libdir'
1293+ ;;
1294+ *)
1295+ ld_shlibs=no
1296+ ;;
1297+ esac
1298+fi
1299+
1300+# Check dynamic linker characteristics
1301+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
1302+libname_spec='lib$name'
1303+case "$host_os" in
1304+ aix3*)
1305+ ;;
1306+ aix4* | aix5*)
1307+ ;;
1308+ amigaos*)
1309+ ;;
1310+ beos*)
1311+ ;;
1312+ bsdi4*)
1313+ ;;
1314+ cygwin* | mingw* | pw32*)
1315+ shrext=.dll
1316+ ;;
1317+ darwin* | rhapsody*)
1318+ shrext=.dylib
1319+ ;;
1320+ dgux*)
1321+ ;;
1322+ freebsd1*)
1323+ ;;
1324+ freebsd*)
1325+ ;;
1326+ gnu*)
1327+ ;;
1328+ hpux9* | hpux10* | hpux11*)
1329+ case "$host_cpu" in
1330+ ia64*)
1331+ shrext=.so
1332+ ;;
1333+ hppa*64*)
1334+ shrext=.sl
1335+ ;;
1336+ *)
1337+ shrext=.sl
1338+ ;;
1339+ esac
1340+ ;;
1341+ irix5* | irix6* | nonstopux*)
1342+ case "$host_os" in
1343+ irix5* | nonstopux*)
1344+ libsuff= shlibsuff=
1345+ ;;
1346+ *)
1347+ case $LD in
1348+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
1349+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
1350+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
1351+ *) libsuff= shlibsuff= ;;
1352+ esac
1353+ ;;
1354+ esac
1355+ ;;
1356+ linux*oldld* | linux*aout* | linux*coff*)
1357+ ;;
1358+ linux*)
1359+ ;;
1360+ netbsd*)
1361+ ;;
1362+ newsos6)
1363+ ;;
1364+ nto-qnx)
1365+ ;;
1366+ openbsd*)
1367+ ;;
1368+ os2*)
1369+ libname_spec='$name'
1370+ shrext=.dll
1371+ ;;
1372+ osf3* | osf4* | osf5*)
1373+ ;;
1374+ sco3.2v5*)
1375+ ;;
1376+ solaris*)
1377+ ;;
1378+ sunos4*)
1379+ ;;
1380+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1381+ ;;
1382+ sysv4*MP*)
1383+ ;;
1384+ uts4*)
1385+ ;;
1386+esac
1387+
1388+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
1389+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
1390+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
1391+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
1392+
1393+sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
1394+
1395+# How to pass a linker flag through the compiler.
1396+wl="$escaped_wl"
1397+
1398+# Static library suffix (normally "a").
1399+libext="$libext"
1400+
1401+# Shared library suffix (normally "so").
1402+shlibext="$shlibext"
1403+
1404+# Flag to hardcode \$libdir into a binary during linking.
1405+# This must work even if \$libdir does not exist.
1406+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
1407+
1408+# Whether we need a single -rpath flag with a separated argument.
1409+hardcode_libdir_separator="$hardcode_libdir_separator"
1410+
1411+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
1412+# resulting binary.
1413+hardcode_direct="$hardcode_direct"
1414+
1415+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
1416+# resulting binary.
1417+hardcode_minus_L="$hardcode_minus_L"
1418+
1419+EOF
1420--- lrzsz-0.12.20.safe/configure.in 2004-09-12 14:39:55.161706488 -0400
1421+++ lrzsz-0.12.20/configure.in 2004-09-12 14:40:35.816526016 -0400
1422@@ -260,11 +260,10 @@
1423 AM_GNU_GETTEXT
1424
1425 AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
1426-AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
1427
1428-AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile \
1429+AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile m4/Makefile \
1430 man/Makefile po/Makefile.in src/Makefile debian/rules Specfile systype \
1431 src/lrzszbug],
1432-[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile;
1433+[
1434 chmod +x debian/rules;
1435 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
1436--- lrzsz-0.12.20.safe/intl/bindtextdom.c 1998-04-26 09:22:36.000000000 -0400
1437+++ lrzsz-0.12.20/intl/bindtextdom.c 2004-09-12 14:40:34.343749912 -0400
1438@@ -1,59 +1,75 @@
1439 /* Implementation of the bindtextdomain(3) function
1440- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
1441+ Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
1442
1443- This program is free software; you can redistribute it and/or modify
1444- it under the terms of the GNU General Public License as published by
1445- the Free Software Foundation; either version 2, or (at your option)
1446+ This program is free software; you can redistribute it and/or modify it
1447+ under the terms of the GNU Library General Public License as published
1448+ by the Free Software Foundation; either version 2, or (at your option)
1449 any later version.
1450
1451 This program is distributed in the hope that it will be useful,
1452 but WITHOUT ANY WARRANTY; without even the implied warranty of
1453- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1454- GNU General Public License for more details.
1455+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1456+ Library General Public License for more details.
1457
1458- You should have received a copy of the GNU General Public License
1459- along with this program; if not, write to the Free Software Foundation,
1460- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1461+ You should have received a copy of the GNU Library General Public
1462+ License along with this program; if not, write to the Free Software
1463+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1464+ USA. */
1465
1466 #ifdef HAVE_CONFIG_H
1467 # include <config.h>
1468 #endif
1469
1470-#if defined STDC_HEADERS || defined _LIBC
1471-# include <stdlib.h>
1472-#else
1473-# ifdef HAVE_MALLOC_H
1474-# include <malloc.h>
1475-# else
1476-void free ();
1477-# endif
1478-#endif
1479+#include <stddef.h>
1480+#include <stdlib.h>
1481+#include <string.h>
1482
1483-#if defined HAVE_STRING_H || defined _LIBC
1484-# include <string.h>
1485+#ifdef _LIBC
1486+# include <libintl.h>
1487 #else
1488-# include <strings.h>
1489-# ifndef memcpy
1490-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
1491-# endif
1492+# include "libgnuintl.h"
1493 #endif
1494+#include "gettextP.h"
1495
1496 #ifdef _LIBC
1497-# include <libintl.h>
1498+/* We have to handle multi-threaded applications. */
1499+# include <bits/libc-lock.h>
1500 #else
1501-# include "libgettext.h"
1502+/* Provide dummy implementation if this is outside glibc. */
1503+# define __libc_rwlock_define(CLASS, NAME)
1504+# define __libc_rwlock_wrlock(NAME)
1505+# define __libc_rwlock_unlock(NAME)
1506+#endif
1507+
1508+/* The internal variables in the standalone libintl.a must have different
1509+ names than the internal variables in GNU libc, otherwise programs
1510+ using libintl.a cannot be linked statically. */
1511+#if !defined _LIBC
1512+# define _nl_default_dirname libintl_nl_default_dirname
1513+# define _nl_domain_bindings libintl_nl_domain_bindings
1514+#endif
1515+
1516+/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
1517+#ifndef offsetof
1518+# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
1519 #endif
1520-#include "gettext.h"
1521-#include "gettextP.h"
1522
1523 /* @@ end of prolog @@ */
1524
1525 /* Contains the default location of the message catalogs. */
1526 extern const char _nl_default_dirname[];
1527+#ifdef _LIBC
1528+extern const char _nl_default_dirname_internal[] attribute_hidden;
1529+#else
1530+# define INTUSE(name) name
1531+#endif
1532
1533 /* List with bindings of specific domains. */
1534 extern struct binding *_nl_domain_bindings;
1535
1536+/* Lock variable to protect the global data in the gettext implementation. */
1537+__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
1538+
1539
1540 /* Names for the libintl functions are a problem. They must not clash
1541 with existing names and they should follow ANSI C. But this source
1542@@ -61,23 +77,41 @@
1543 prefix. So we have to make a difference here. */
1544 #ifdef _LIBC
1545 # define BINDTEXTDOMAIN __bindtextdomain
1546-# define strdup(str) __strdup (str)
1547+# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
1548+# ifndef strdup
1549+# define strdup(str) __strdup (str)
1550+# endif
1551 #else
1552-# define BINDTEXTDOMAIN bindtextdomain__
1553+# define BINDTEXTDOMAIN libintl_bindtextdomain
1554+# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
1555 #endif
1556
1557-/* Specify that the DOMAINNAME message catalog will be found
1558- in DIRNAME rather than in the system locale data base. */
1559-char *
1560-BINDTEXTDOMAIN (domainname, dirname)
1561- const char *domainname;
1562- const char *dirname;
1563+/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
1564+ to be used for the DOMAINNAME message catalog.
1565+ If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
1566+ modified, only the current value is returned.
1567+ If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
1568+ modified nor returned. */
1569+static void
1570+set_binding_values (const char *domainname,
1571+ const char **dirnamep, const char **codesetp)
1572 {
1573 struct binding *binding;
1574+ int modified;
1575
1576 /* Some sanity checks. */
1577 if (domainname == NULL || domainname[0] == '\0')
1578- return NULL;
1579+ {
1580+ if (dirnamep)
1581+ *dirnamep = NULL;
1582+ if (codesetp)
1583+ *codesetp = NULL;
1584+ return;
1585+ }
1586+
1587+ __libc_rwlock_wrlock (_nl_state_lock);
1588+
1589+ modified = 0;
1590
1591 for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
1592 {
1593@@ -93,81 +127,173 @@
1594 }
1595 }
1596
1597- if (dirname == NULL)
1598- /* The current binding has be to returned. */
1599- return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
1600-
1601 if (binding != NULL)
1602 {
1603- /* The domain is already bound. If the new value and the old
1604- one are equal we simply do nothing. Otherwise replace the
1605- old binding. */
1606- if (strcmp (dirname, binding->dirname) != 0)
1607+ if (dirnamep)
1608 {
1609- char *new_dirname;
1610+ const char *dirname = *dirnamep;
1611
1612- if (strcmp (dirname, _nl_default_dirname) == 0)
1613- new_dirname = (char *) _nl_default_dirname;
1614+ if (dirname == NULL)
1615+ /* The current binding has be to returned. */
1616+ *dirnamep = binding->dirname;
1617 else
1618 {
1619+ /* The domain is already bound. If the new value and the old
1620+ one are equal we simply do nothing. Otherwise replace the
1621+ old binding. */
1622+ char *result = binding->dirname;
1623+ if (strcmp (dirname, result) != 0)
1624+ {
1625+ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
1626+ result = (char *) INTUSE(_nl_default_dirname);
1627+ else
1628+ {
1629 #if defined _LIBC || defined HAVE_STRDUP
1630- new_dirname = strdup (dirname);
1631- if (new_dirname == NULL)
1632- return NULL;
1633+ result = strdup (dirname);
1634 #else
1635- size_t len = strlen (dirname) + 1;
1636- new_dirname = (char *) malloc (len);
1637- if (new_dirname == NULL)
1638- return NULL;
1639-
1640- memcpy (new_dirname, dirname, len);
1641+ size_t len = strlen (dirname) + 1;
1642+ result = (char *) malloc (len);
1643+ if (__builtin_expect (result != NULL, 1))
1644+ memcpy (result, dirname, len);
1645 #endif
1646+ }
1647+
1648+ if (__builtin_expect (result != NULL, 1))
1649+ {
1650+ if (binding->dirname != INTUSE(_nl_default_dirname))
1651+ free (binding->dirname);
1652+
1653+ binding->dirname = result;
1654+ modified = 1;
1655+ }
1656+ }
1657+ *dirnamep = result;
1658 }
1659+ }
1660
1661- if (binding->dirname != _nl_default_dirname)
1662- free (binding->dirname);
1663+ if (codesetp)
1664+ {
1665+ const char *codeset = *codesetp;
1666
1667- binding->dirname = new_dirname;
1668+ if (codeset == NULL)
1669+ /* The current binding has be to returned. */
1670+ *codesetp = binding->codeset;
1671+ else
1672+ {
1673+ /* The domain is already bound. If the new value and the old
1674+ one are equal we simply do nothing. Otherwise replace the
1675+ old binding. */
1676+ char *result = binding->codeset;
1677+ if (result == NULL || strcmp (codeset, result) != 0)
1678+ {
1679+#if defined _LIBC || defined HAVE_STRDUP
1680+ result = strdup (codeset);
1681+#else
1682+ size_t len = strlen (codeset) + 1;
1683+ result = (char *) malloc (len);
1684+ if (__builtin_expect (result != NULL, 1))
1685+ memcpy (result, codeset, len);
1686+#endif
1687+
1688+ if (__builtin_expect (result != NULL, 1))
1689+ {
1690+ if (binding->codeset != NULL)
1691+ free (binding->codeset);
1692+
1693+ binding->codeset = result;
1694+ binding->codeset_cntr++;
1695+ modified = 1;
1696+ }
1697+ }
1698+ *codesetp = result;
1699+ }
1700 }
1701 }
1702+ else if ((dirnamep == NULL || *dirnamep == NULL)
1703+ && (codesetp == NULL || *codesetp == NULL))
1704+ {
1705+ /* Simply return the default values. */
1706+ if (dirnamep)
1707+ *dirnamep = INTUSE(_nl_default_dirname);
1708+ if (codesetp)
1709+ *codesetp = NULL;
1710+ }
1711 else
1712 {
1713 /* We have to create a new binding. */
1714- size_t len;
1715+ size_t len = strlen (domainname) + 1;
1716 struct binding *new_binding =
1717- (struct binding *) malloc (sizeof (*new_binding));
1718+ (struct binding *) malloc (offsetof (struct binding, domainname) + len);
1719
1720- if (new_binding == NULL)
1721- return NULL;
1722+ if (__builtin_expect (new_binding == NULL, 0))
1723+ goto failed;
1724
1725+ memcpy (new_binding->domainname, domainname, len);
1726+
1727+ if (dirnamep)
1728+ {
1729+ const char *dirname = *dirnamep;
1730+
1731+ if (dirname == NULL)
1732+ /* The default value. */
1733+ dirname = INTUSE(_nl_default_dirname);
1734+ else
1735+ {
1736+ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
1737+ dirname = INTUSE(_nl_default_dirname);
1738+ else
1739+ {
1740+ char *result;
1741 #if defined _LIBC || defined HAVE_STRDUP
1742- new_binding->domainname = strdup (domainname);
1743- if (new_binding->domainname == NULL)
1744- return NULL;
1745+ result = strdup (dirname);
1746+ if (__builtin_expect (result == NULL, 0))
1747+ goto failed_dirname;
1748 #else
1749- len = strlen (domainname) + 1;
1750- new_binding->domainname = (char *) malloc (len);
1751- if (new_binding->domainname == NULL)
1752- return NULL;
1753- memcpy (new_binding->domainname, domainname, len);
1754+ size_t len = strlen (dirname) + 1;
1755+ result = (char *) malloc (len);
1756+ if (__builtin_expect (result == NULL, 0))
1757+ goto failed_dirname;
1758+ memcpy (result, dirname, len);
1759 #endif
1760-
1761- if (strcmp (dirname, _nl_default_dirname) == 0)
1762- new_binding->dirname = (char *) _nl_default_dirname;
1763+ dirname = result;
1764+ }
1765+ }
1766+ *dirnamep = dirname;
1767+ new_binding->dirname = (char *) dirname;
1768+ }
1769 else
1770+ /* The default value. */
1771+ new_binding->dirname = (char *) INTUSE(_nl_default_dirname);
1772+
1773+ new_binding->codeset_cntr = 0;
1774+
1775+ if (codesetp)
1776 {
1777+ const char *codeset = *codesetp;
1778+
1779+ if (codeset != NULL)
1780+ {
1781+ char *result;
1782+
1783 #if defined _LIBC || defined HAVE_STRDUP
1784- new_binding->dirname = strdup (dirname);
1785- if (new_binding->dirname == NULL)
1786- return NULL;
1787+ result = strdup (codeset);
1788+ if (__builtin_expect (result == NULL, 0))
1789+ goto failed_codeset;
1790 #else
1791- len = strlen (dirname) + 1;
1792- new_binding->dirname = (char *) malloc (len);
1793- if (new_binding->dirname == NULL)
1794- return NULL;
1795- memcpy (new_binding->dirname, dirname, len);
1796+ size_t len = strlen (codeset) + 1;
1797+ result = (char *) malloc (len);
1798+ if (__builtin_expect (result == NULL, 0))
1799+ goto failed_codeset;
1800+ memcpy (result, codeset, len);
1801 #endif
1802+ codeset = result;
1803+ new_binding->codeset_cntr++;
1804+ }
1805+ *codesetp = codeset;
1806+ new_binding->codeset = (char *) codeset;
1807 }
1808+ else
1809+ new_binding->codeset = NULL;
1810
1811 /* Now enqueue it. */
1812 if (_nl_domain_bindings == NULL
1813@@ -187,13 +313,51 @@
1814 binding->next = new_binding;
1815 }
1816
1817- binding = new_binding;
1818+ modified = 1;
1819+
1820+ /* Here we deal with memory allocation failures. */
1821+ if (0)
1822+ {
1823+ failed_codeset:
1824+ if (new_binding->dirname != INTUSE(_nl_default_dirname))
1825+ free (new_binding->dirname);
1826+ failed_dirname:
1827+ free (new_binding);
1828+ failed:
1829+ if (dirnamep)
1830+ *dirnamep = NULL;
1831+ if (codesetp)
1832+ *codesetp = NULL;
1833+ }
1834 }
1835
1836- return binding->dirname;
1837+ /* If we modified any binding, we flush the caches. */
1838+ if (modified)
1839+ ++_nl_msg_cat_cntr;
1840+
1841+ __libc_rwlock_unlock (_nl_state_lock);
1842+}
1843+
1844+/* Specify that the DOMAINNAME message catalog will be found
1845+ in DIRNAME rather than in the system locale data base. */
1846+char *
1847+BINDTEXTDOMAIN (const char *domainname, const char *dirname)
1848+{
1849+ set_binding_values (domainname, &dirname, NULL);
1850+ return (char *) dirname;
1851+}
1852+
1853+/* Specify the character encoding in which the messages from the
1854+ DOMAINNAME message catalog will be returned. */
1855+char *
1856+BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset)
1857+{
1858+ set_binding_values (domainname, NULL, &codeset);
1859+ return (char *) codeset;
1860 }
1861
1862 #ifdef _LIBC
1863-/* Alias for function name in GNU C Library. */
1864+/* Aliases for function names in GNU C Library. */
1865 weak_alias (__bindtextdomain, bindtextdomain);
1866+weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
1867 #endif
1868--- lrzsz-0.12.20.safe/intl/cat-compat.c 1998-04-26 09:22:37.000000000 -0400
1869+++ lrzsz-0.12.20/intl/cat-compat.c 1969-12-31 19:00:00.000000000 -0500
1870@@ -1,262 +0,0 @@
1871-/* Compatibility code for gettext-using-catgets interface.
1872- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
1873-
1874- This program is free software; you can redistribute it and/or modify
1875- it under the terms of the GNU General Public License as published by
1876- the Free Software Foundation; either version 2, or (at your option)
1877- any later version.
1878-
1879- This program is distributed in the hope that it will be useful,
1880- but WITHOUT ANY WARRANTY; without even the implied warranty of
1881- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1882- GNU General Public License for more details.
1883-
1884- You should have received a copy of the GNU General Public License
1885- along with this program; if not, write to the Free Software Foundation,
1886- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1887-
1888-#ifdef HAVE_CONFIG_H
1889-# include <config.h>
1890-#endif
1891-
1892-#include <stdio.h>
1893-
1894-#ifdef STDC_HEADERS
1895-# include <stdlib.h>
1896-# include <string.h>
1897-#else
1898-char *getenv ();
1899-# ifdef HAVE_MALLOC_H
1900-# include <malloc.h>
1901-# endif
1902-#endif
1903-
1904-#ifdef HAVE_NL_TYPES_H
1905-# include <nl_types.h>
1906-#endif
1907-
1908-#include "libgettext.h"
1909-
1910-/* @@ end of prolog @@ */
1911-
1912-/* XPG3 defines the result of `setlocale (category, NULL)' as:
1913- ``Directs `setlocale()' to query `category' and return the current
1914- setting of `local'.''
1915- However it does not specify the exact format. And even worse: POSIX
1916- defines this not at all. So we can use this feature only on selected
1917- system (e.g. those using GNU C Library). */
1918-#ifdef _LIBC
1919-# define HAVE_LOCALE_NULL
1920-#endif
1921-
1922-/* The catalog descriptor. */
1923-static nl_catd catalog = (nl_catd) -1;
1924-
1925-/* Name of the default catalog. */
1926-static const char default_catalog_name[] = "messages";
1927-
1928-/* Name of currently used catalog. */
1929-static const char *catalog_name = default_catalog_name;
1930-
1931-/* Get ID for given string. If not found return -1. */
1932-static int msg_to_cat_id PARAMS ((const char *msg));
1933-
1934-/* Substitution for systems lacking this function in their C library. */
1935-#if !_LIBC && !HAVE_STPCPY
1936-static char *stpcpy PARAMS ((char *dest, const char *src));
1937-#endif
1938-
1939-
1940-/* Set currently used domain/catalog. */
1941-char *
1942-textdomain (domainname)
1943- const char *domainname;
1944-{
1945- nl_catd new_catalog;
1946- char *new_name;
1947- size_t new_name_len;
1948- char *lang;
1949-
1950-#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \
1951- && defined HAVE_LOCALE_NULL
1952- lang = setlocale (LC_MESSAGES, NULL);
1953-#else
1954- lang = getenv ("LC_ALL");
1955- if (lang == NULL || lang[0] == '\0')
1956- {
1957- lang = getenv ("LC_MESSAGES");
1958- if (lang == NULL || lang[0] == '\0')
1959- lang = getenv ("LANG");
1960- }
1961-#endif
1962- if (lang == NULL || lang[0] == '\0')
1963- lang = "C";
1964-
1965- /* See whether name of currently used domain is asked. */
1966- if (domainname == NULL)
1967- return (char *) catalog_name;
1968-
1969- if (domainname[0] == '\0')
1970- domainname = default_catalog_name;
1971-
1972- /* Compute length of added path element. */
1973- new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang)
1974- + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1
1975- + sizeof (".cat");
1976-
1977- new_name = (char *) malloc (new_name_len);
1978- if (new_name == NULL)
1979- return NULL;
1980-
1981- strcpy (new_name, PACKAGE);
1982- new_catalog = catopen (new_name, 0);
1983-
1984- if (new_catalog == (nl_catd) -1)
1985- {
1986- /* NLSPATH search didn't work, try absolute path */
1987- sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang,
1988- PACKAGE);
1989- new_catalog = catopen (new_name, 0);
1990-
1991- if (new_catalog == (nl_catd) -1)
1992- {
1993- free (new_name);
1994- return (char *) catalog_name;
1995- }
1996- }
1997-
1998- /* Close old catalog. */
1999- if (catalog != (nl_catd) -1)
2000- catclose (catalog);
2001- if (catalog_name != default_catalog_name)
2002- free ((char *) catalog_name);
2003-
2004- catalog = new_catalog;
2005- catalog_name = new_name;
2006-
2007- return (char *) catalog_name;
2008-}
2009-
2010-char *
2011-bindtextdomain (domainname, dirname)
2012- const char *domainname;
2013- const char *dirname;
2014-{
2015-#if HAVE_SETENV || HAVE_PUTENV
2016- char *old_val, *new_val, *cp;
2017- size_t new_val_len;
2018-
2019- /* This does not make much sense here but to be compatible do it. */
2020- if (domainname == NULL)
2021- return NULL;
2022-
2023- /* Compute length of added path element. If we use setenv we don't need
2024- the first byts for NLSPATH=, but why complicate the code for this
2025- peanuts. */
2026- new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname)
2027- + sizeof ("/%L/LC_MESSAGES/%N.cat");
2028-
2029- old_val = getenv ("NLSPATH");
2030- if (old_val == NULL || old_val[0] == '\0')
2031- {
2032- old_val = NULL;
2033- new_val_len += 1 + sizeof (LOCALEDIR) - 1
2034- + sizeof ("/%L/LC_MESSAGES/%N.cat");
2035- }
2036- else
2037- new_val_len += strlen (old_val);
2038-
2039- new_val = (char *) malloc (new_val_len);
2040- if (new_val == NULL)
2041- return NULL;
2042-
2043-# if HAVE_SETENV
2044- cp = new_val;
2045-# else
2046- cp = stpcpy (new_val, "NLSPATH=");
2047-# endif
2048-
2049- cp = stpcpy (cp, dirname);
2050- cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:");
2051-
2052- if (old_val == NULL)
2053- {
2054-# if __STDC__
2055- stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat");
2056-# else
2057-
2058- cp = stpcpy (cp, LOCALEDIR);
2059- stpcpy (cp, "/%L/LC_MESSAGES/%N.cat");
2060-# endif
2061- }
2062- else
2063- stpcpy (cp, old_val);
2064-
2065-# if HAVE_SETENV
2066- setenv ("NLSPATH", new_val, 1);
2067- free (new_val);
2068-# else
2069- putenv (new_val);
2070- /* Do *not* free the environment entry we just entered. It is used
2071- from now on. */
2072-# endif
2073-
2074-#endif
2075-
2076- return (char *) domainname;
2077-}
2078-
2079-#undef gettext
2080-char *
2081-gettext (msg)
2082- const char *msg;
2083-{
2084- int msgid;
2085-
2086- if (msg == NULL || catalog == (nl_catd) -1)
2087- return (char *) msg;
2088-
2089- /* Get the message from the catalog. We always use set number 1.
2090- The message ID is computed by the function `msg_to_cat_id'
2091- which works on the table generated by `po-to-tbl'. */
2092- msgid = msg_to_cat_id (msg);
2093- if (msgid == -1)
2094- return (char *) msg;
2095-
2096- return catgets (catalog, 1, msgid, (char *) msg);
2097-}
2098-
2099-/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries
2100- for the one equal to msg. If it is found return the ID. In case when
2101- the string is not found return -1. */
2102-static int
2103-msg_to_cat_id (msg)
2104- const char *msg;
2105-{
2106- int cnt;
2107-
2108- for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
2109- if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
2110- return _msg_tbl[cnt]._msg_number;
2111-
2112- return -1;
2113-}
2114-
2115-
2116-/* @@ begin of epilog @@ */
2117-
2118-/* We don't want libintl.a to depend on any other library. So we
2119- avoid the non-standard function stpcpy. In GNU C Library this
2120- function is available, though. Also allow the symbol HAVE_STPCPY
2121- to be defined. */
2122-#if !_LIBC && !HAVE_STPCPY
2123-static char *
2124-stpcpy (dest, src)
2125- char *dest;
2126- const char *src;
2127-{
2128- while ((*dest++ = *src++) != '\0')
2129- /* Do nothing. */ ;
2130- return dest - 1;
2131-}
2132-#endif
2133--- lrzsz-0.12.20.safe/intl/ChangeLog 1998-04-26 09:22:35.000000000 -0400
2134+++ lrzsz-0.12.20/intl/ChangeLog 2004-09-12 14:40:34.349749000 -0400
2135@@ -1,1022 +1,4 @@
2136-1997-09-06 02:10 Ulrich Drepper <drepper@cygnus.com>
2137-
2138- * intlh.inst.in: Reformat copyright.
2139-
2140-1997-08-19 15:22 Ulrich Drepper <drepper@cygnus.com>
2141-
2142- * dcgettext.c (DCGETTEXT): Remove wrong comment.
2143-
2144-1997-08-16 00:13 Ulrich Drepper <drepper@cygnus.com>
2145-
2146- * Makefile.in (install-data): Don't change directory to install.
2147-
2148-1997-08-01 14:30 Ulrich Drepper <drepper@cygnus.com>
2149-
2150- * cat-compat.c: Fix copyright.
2151-
2152- * localealias.c: Don't define strchr unless !HAVE_STRCHR.
2153-
2154- * loadmsgcat.c: Update copyright. Fix typos.
2155-
2156- * l10nflist.c: Don't define strchr unless !HAVE_STRCHR.
2157- (_nl_make_l10nflist): Handle sponsor and revision correctly.
2158-
2159- * gettext.c: Update copyright.
2160- * gettext.h: Likewise.
2161- * hash-string.h: Likewise.
2162-
2163- * finddomain.c: Remoave dead code. Define strchr only if
2164- !HAVE_STRCHR.
2165-
2166- * explodename.c: Include <sys/types.h>.
2167-
2168- * explodename.c: Reformat copyright text.
2169- (_nl_explode_name): Fix typo.
2170-
2171- * dcgettext.c: Define and use __set_errno.
2172- (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is
2173- not defined.
2174-
2175- * bindtextdom.c: Pretty printing.
2176-
2177-1997-05-01 02:25 Ulrich Drepper <drepper@cygnus.com>
2178-
2179- * dcgettext.c (guess_category_value): Don't depend on
2180- HAVE_LC_MESSAGES. We don't need the macro here.
2181- Patch by Bruno Haible <haible@ilog.fr>.
2182-
2183- * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL
2184- macro. Instead use HAVE_LOCALE_NULL and define it when using
2185- glibc, as in dcgettext.c.
2186- Patch by Bruno Haible <haible@ilog.fr>.
2187-
2188- * Makefile.in (CPPFLAGS): New variable. Reported by Franc,ois
2189- Pinard.
2190-
2191-Mon Mar 10 06:51:17 1997 Ulrich Drepper <drepper@cygnus.com>
2192-
2193- * Makefile.in: Implement handling of libtool.
2194-
2195- * gettextP.h: Change data structures for use of generic lowlevel
2196- i18n file handling.
2197-
2198-Wed Dec 4 20:21:18 1996 Ulrich Drepper <drepper@cygnus.com>
2199-
2200- * textdomain.c: Put parentheses around arguments of memcpy macro
2201- definition.
2202- * localealias.c: Likewise.
2203- * l10nflist.c: Likewise.
2204- * finddomain.c: Likewise.
2205- * bindtextdom.c: Likewise.
2206- Reported by Thomas Esken.
2207-
2208-Mon Nov 25 22:57:51 1996 Ulrich Drepper <drepper@cygnus.com>
2209-
2210- * textdomain.c: Move definition of `memcpy` macro to right
2211- position.
2212-
2213-Fri Nov 22 04:01:58 1996 Ulrich Drepper <drepper@cygnus.com>
2214-
2215- * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using
2216- bcopy if not already defined. Reported by Thomas Esken.
2217- * bindtextdom.c: Likewise.
2218- * l10nflist.c: Likewise.
2219- * localealias.c: Likewise.
2220- * textdomain.c: Likewise.
2221-
2222-Tue Oct 29 11:10:27 1996 Ulrich Drepper <drepper@cygnus.com>
2223-
2224- * Makefile.in (libdir): Change to use exec_prefix instead of
2225- prefix. Reported by Knut-HåvardAksnes <etokna@eto.ericsson.se>.
2226-
2227-Sat Aug 31 03:07:09 1996 Ulrich Drepper <drepper@cygnus.com>
2228-
2229- * l10nflist.c (_nl_normalize_codeset): We convert to lower case,
2230- so don't prepend uppercase `ISO' for only numeric arg.
2231-
2232-Fri Jul 19 00:15:46 1996 Ulrich Drepper <drepper@cygnus.com>
2233-
2234- * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after
2235- definition of _GNU_SOURCE. Patch by Roland McGrath.
2236-
2237- * Makefile.in (uninstall): Fix another bug with `for' loop and
2238- empty arguments. Patch by Jim Meyering. Correct name os
2239- uninstalled files: no intl- prefix anymore.
2240-
2241- * Makefile.in (install-data): Again work around shells which
2242- cannot handle mpty for list. Reported by Jim Meyering.
2243-
2244-Sat Jul 13 18:11:35 1996 Ulrich Drepper <drepper@cygnus.com>
2245-
2246- * Makefile.in (install): Split goal. Now depend on install-exec
2247- and install-data.
2248- (install-exec, install-data): New goals. Created from former
2249- install goal.
2250- Reported by Karl Berry.
2251-
2252-Sat Jun 22 04:58:14 1996 Ulrich Drepper <drepper@cygnus.com>
2253-
2254- * Makefile.in (MKINSTALLDIRS): New variable. Path to
2255- mkinstalldirs script.
2256- (install): use MKINSTALLDIRS variable or if the script is not present
2257- try to find it in the $top_scrdir).
2258-
2259-Wed Jun 19 02:56:56 1996 Ulrich Drepper <drepper@cygnus.com>
2260-
2261- * l10nflist.c: Linux libc *partly* includes the argz_* functions.
2262- Grr. Work around by renaming the static version and use macros
2263- for renaming.
2264-
2265-Tue Jun 18 20:11:17 1996 Ulrich Drepper <drepper@cygnus.com>
2266-
2267- * l10nflist.c: Correct presence test macros of __argz_* functions.
2268-
2269- * l10nflist.c: Include <argz.h> based on test of it instead when
2270- __argz_* functions are available.
2271- Reported by Andreas Schwab.
2272-
2273-Thu Jun 13 15:17:44 1996 Ulrich Drepper <drepper@cygnus.com>
2274-
2275- * explodename.c, l10nflist.c: Define NULL for dumb systems.
2276-
2277-Tue Jun 11 17:05:13 1996 Ulrich Drepper <drepper@cygnus.com>
2278-
2279- * intlh.inst.in, libgettext.h (dcgettext): Rename local variable
2280- result to __result to prevent name clash.
2281-
2282- * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to
2283- get prototype for stpcpy and strcasecmp.
2284-
2285- * intlh.inst.in, libgettext.h: Move declaration of
2286- `_nl_msg_cat_cntr' outside __extension__ block to prevent warning
2287- from gcc's -Wnested-extern option.
2288-
2289-Fri Jun 7 01:58:00 1996 Ulrich Drepper <drepper@cygnus.com>
2290-
2291- * Makefile.in (install): Remove comment.
2292-
2293-Thu Jun 6 17:28:17 1996 Ulrich Drepper <drepper@cygnus.com>
2294-
2295- * Makefile.in (install): Work around for another Buglix stupidity.
2296- Always use an `else' close for `if's. Reported by Nelson Beebe.
2297-
2298- * Makefile.in (intlh.inst): Correct typo in phony rule.
2299- Reported by Nelson Beebe.
2300-
2301-Thu Jun 6 01:49:52 1996 Ulrich Drepper <drepper@cygnus.com>
2302-
2303- * dcgettext.c (read_alias_file): Rename variable alloca_list to
2304- block_list as the macro calls assume.
2305- Patch by Eric Backus.
2306-
2307- * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using
2308- malloc.
2309- (read_alias_file): Rename varriabe alloca_list to block_list as the
2310- macro calls assume.
2311- Patch by Eric Backus.
2312-
2313- * l10nflist.c: Correct conditional for <argz.h> inclusion.
2314- Reported by Roland McGrath.
2315-
2316- * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not
2317- all-@USE_NLS@.
2318-
2319- * Makefile.in (install): intlh.inst comes from local dir, not
2320- $(srcdir).
2321-
2322- * Makefile.in (intlh.inst): Special handling of this goal. If
2323- used in gettext, this is really a rul to construct this file. If
2324- used in any other package it is defined as a .PHONY rule with
2325- empty body.
2326-
2327- * finddomain.c: Extract locale file information handling into
2328- l10nfile.c. Rename local stpcpy__ function to stpcpy.
2329-
2330- * dcgettext.c (stpcpy): Add local definition.
2331-
2332- * l10nflist.c: Solve some portability problems. Patches partly by
2333- Thomas Esken. Add local definition of stpcpy.
2334-
2335-Tue Jun 4 02:47:49 1996 Ulrich Drepper <drepper@cygnus.com>
2336-
2337- * intlh.inst.in: Don't depend including <locale.h> on
2338- HAVE_LOCALE_H. Instead configure must rewrite this fiile
2339- depending on the result of the configure run.
2340-
2341- * Makefile.in (install): libintl.inst is now called intlh.inst.
2342- Add rules for updating intlh.inst from intlh.inst.in.
2343-
2344- * libintl.inst: Renamed to intlh.inst.in.
2345-
2346- * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1
2347- because gcc has __buitlin_alloca.
2348- Reported by Roland McGrath.
2349-
2350-Mon Jun 3 00:32:16 1996 Ulrich Drepper <drepper@cygnus.com>
2351-
2352- * Makefile.in (installcheck): New goal to fulfill needs of
2353- automake's distcheck.
2354-
2355- * Makefile.in (install): Reorder commands so that VERSION is
2356- found.
2357-
2358- * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in
2359- @datadir@/gettext.
2360- (COMSRCS): Add l10nfile.c.
2361- (OBJECTS): Add l10nfile.o.
2362- (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common).
2363- (DISTFILE.gettext): Remove $(DISTFILES.common).
2364- (all-gettext): Remove goal.
2365- (install): If $(PACKAGE) = gettext install, otherwose do nothing. No
2366- package but gettext itself should install libintl.h + headers.
2367- (dist): Extend goal to work for gettext, too.
2368- (dist-gettext): Remove goal.
2369-
2370- * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc.
2371-
2372-Sun Jun 2 17:33:06 1996 Ulrich Drepper <drepper@cygnus.com>
2373-
2374- * loadmsgcat.c (_nl_load_domain): Parameter is now comes from
2375- find_l10nfile.
2376-
2377-Sat Jun 1 02:23:03 1996 Ulrich Drepper <drepper@cygnus.com>
2378-
2379- * l10nflist.c (__argz_next): Add definition.
2380-
2381- * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca
2382- code. Use new l10nfile handling.
2383-
2384- * localealias.c [!HAVE_ALLOCA]: Add code for handling missing
2385- alloca code.
2386-
2387- * l10nflist.c: Initial revision.
2388-
2389-Tue Apr 2 18:51:18 1996 Ulrich Drepper <drepper@myware>
2390-
2391- * Makefile.in (all-gettext): New goal. Same as all-yes.
2392-
2393-Thu Mar 28 23:01:22 1996 Karl Eichwalder <ke@ke.central.de>
2394-
2395- * Makefile.in (gettextsrcdir): Define using @datadir@.
2396-
2397-Tue Mar 26 12:39:14 1996 Ulrich Drepper <drepper@myware>
2398-
2399- * finddomain.c: Include <ctype.h>. Reported by Roland McGrath.
2400-
2401-Sat Mar 23 02:00:35 1996 Ulrich Drepper <drepper@myware>
2402-
2403- * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing
2404- with external declaration.
2405-
2406-Sat Mar 2 00:47:09 1996 Ulrich Drepper <drepper@myware>
2407-
2408- * Makefile.in (all-no): Rename from all_no.
2409-
2410-Sat Feb 17 00:25:59 1996 Ulrich Drepper <drepper@myware>
2411-
2412- * gettextP.h [loaded_domain]: Array `successor' must now contain up
2413- to 63 elements (because of codeset name normalization).
2414-
2415- * finddomain.c: Implement codeset name normalization.
2416-
2417-Thu Feb 15 04:39:09 1996 Ulrich Drepper <drepper@myware>
2418-
2419- * Makefile.in (all): Define to `all-@USE_NLS@'.
2420- (all-yes, all_no): New goals. `all-no' is noop, `all-yes'
2421- is former all.
2422-
2423-Mon Jan 15 21:46:01 1996 Howard Gayle <howard@hal.com>
2424-
2425- * localealias.c (alias_compare): Increment string pointers in loop
2426- of strcasecmp replacement.
2427-
2428-Fri Dec 29 21:16:34 1995 Ulrich Drepper <drepper@myware>
2429-
2430- * Makefile.in (install-src): Who commented this goal out ? :-)
2431-
2432-Fri Dec 29 15:08:16 1995 Ulrich Drepper <drepper@myware>
2433-
2434- * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls
2435- should not effect it because a missing catalog is no error.
2436- Reported by Harald K<o:>nig <koenig@tat.physik.uni-tuebingen.de>.
2437-
2438-Tue Dec 19 22:09:13 1995 Ulrich Drepper <drepper@myware>
2439-
2440- * Makefile.in (Makefile): Explicitly use $(SHELL) for running
2441- shell scripts.
2442-
2443-Fri Dec 15 17:34:59 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
2444-
2445- * Makefile.in (install-src): Only install library and header when
2446- we use the own implementation. Don't do it when using the
2447- system's gettext or catgets functions.
2448-
2449- * dcgettext.c (find_msg): Must not swap domain->hash_size here.
2450-
2451-Sat Dec 9 16:24:37 1995 Ulrich Drepper <drepper@myware>
2452-
2453- * localealias.c, libintl.inst, libgettext.h, hash-string.h,
2454- gettextP.h, finddomain.c, dcgettext.c, cat-compat.c:
2455- Use PARAMS instead of __P. Suggested by Roland McGrath.
2456-
2457-Tue Dec 5 11:39:14 1995 Larry Schwimmer <rosebud@cyclone.stanford.edu>
2458-
2459- * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if
2460- !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty.
2461-
2462-Mon Dec 4 15:42:07 1995 Ulrich Drepper <drepper@myware>
2463-
2464- * Makefile.in (install-src):
2465- Install libintl.inst instead of libintl.h.install.
2466-
2467-Sat Dec 2 22:51:38 1995 Marcus Daniels <marcus@sysc.pdx.edu>
2468-
2469- * cat-compat.c (textdomain):
2470- Reverse order in which files are tried you load. First
2471- try local file, when this failed absolute path.
2472-
2473-Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
2474-
2475- * cat-compat.c (bindtextdomain): Add missing { }.
2476-
2477-Sun Nov 26 18:21:41 1995 Ulrich Drepper <drepper@myware>
2478-
2479- * libintl.inst: Add missing __P definition. Reported by Nelson Beebe.
2480-
2481- * Makefile.in:
2482- Add dummy `all' and `dvi' goals. Reported by Tom Tromey.
2483-
2484-Sat Nov 25 16:12:01 1995 Franc,ois Pinard <pinard@iro.umontreal.ca>
2485-
2486- * hash-string.h: Capitalize arguments of macros.
2487-
2488-Sat Nov 25 12:01:36 1995 Ulrich Drepper <drepper@myware>
2489-
2490- * Makefile.in (DISTFILES): Prevent files names longer than 13
2491- characters. libintl.h.glibc->libintl.glibc,
2492- libintl.h.install->libintl.inst. Reported by Joshua R. Poulson.
2493-
2494-Sat Nov 25 11:31:12 1995 Eric Backus <ericb@lsid.hp.com>
2495-
2496- * dcgettext.c: Fix bug in preprocessor conditionals.
2497-
2498-Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
2499-
2500- * libgettext.h: Solaris cc does not understand
2501- #if !SYMBOL1 && !SYMBOL2. Sad but true.
2502-
2503-Thu Nov 23 16:22:14 1995 Ulrich Drepper <drepper@myware>
2504-
2505- * hash-string.h (hash_string):
2506- Fix for machine with >32 bit `unsigned long's.
2507-
2508- * dcgettext.c (DCGETTEXT):
2509- Fix horrible bug in loop for alternative translation.
2510-
2511-Thu Nov 23 01:45:29 1995 Ulrich Drepper <drepper@myware>
2512-
2513- * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed:
2514- Some further simplifications in message number generation.
2515-
2516-Mon Nov 20 21:08:43 1995 Ulrich Drepper <drepper@myware>
2517-
2518- * libintl.h.glibc: Use __const instead of const in prototypes.
2519-
2520- * Makefile.in (install-src):
2521- Install libintl.h.install instead of libintl.h. This
2522- is a stripped-down version. Suggested by Peter Miller.
2523-
2524- * libintl.h.install, libintl.h.glibc: Initial revision.
2525-
2526- * localealias.c (_nl_expand_alias, read_alias_file):
2527- Protect prototypes in type casts by __P.
2528-
2529-Tue Nov 14 16:43:58 1995 Ulrich Drepper <drepper@myware>
2530-
2531- * hash-string.h: Correct prototype for hash_string.
2532-
2533-Sun Nov 12 12:42:30 1995 Ulrich Drepper <drepper@myware>
2534-
2535- * hash-string.h (hash_string): Add prototype.
2536-
2537- * gettextP.h: Fix copyright.
2538- (SWAP): Add prototype.
2539-
2540-Wed Nov 8 22:56:33 1995 Ulrich Drepper <drepper@myware>
2541-
2542- * localealias.c (read_alias_file): Forgot sizeof.
2543- Avoid calling *printf function. This introduces a big overhead.
2544- Patch by Roland McGrath.
2545-
2546-Tue Nov 7 14:21:08 1995 Ulrich Drepper <drepper@myware>
2547-
2548- * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy.
2549-
2550- * finddomain.c (stpcpy):
2551- Define substitution function local. The macro was to flaky.
2552-
2553- * cat-compat.c: Fix typo.
2554-
2555- * xopen-msg.sed, linux-msg.sed:
2556- While bringing message number to right place only accept digits.
2557-
2558- * linux-msg.sed, xopen-msg.sed: Now that the counter does not have
2559- leading 0s we don't need to remove them. Reported by Marcus
2560- Daniels.
2561-
2562- * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in
2563- dependency. Reported by Marcus Daniels.
2564-
2565- * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement.
2566- Generally cleanup using #if instead of #ifndef.
2567-
2568- * Makefile.in: Correct typos in comment. By Franc,ois Pinard.
2569-
2570-Mon Nov 6 00:27:02 1995 Ulrich Drepper <drepper@myware>
2571-
2572- * Makefile.in (install-src): Don't install libintl.h and libintl.a
2573- if we use an available gettext implementation.
2574-
2575-Sun Nov 5 22:02:08 1995 Ulrich Drepper <drepper@myware>
2576-
2577- * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported
2578- by Franc,ois Pinard.
2579-
2580- * libgettext.h: Use #if instead of #ifdef/#ifndef.
2581-
2582- * finddomain.c:
2583- Comments describing what has to be done should start with FIXME.
2584-
2585-Sun Nov 5 19:38:01 1995 Ulrich Drepper <drepper@myware>
2586-
2587- * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning.
2588- DISTFILES.common names the files common to both dist goals.
2589- DISTFILES.gettext are the files only distributed in GNU gettext.
2590-
2591-Sun Nov 5 17:32:54 1995 Ulrich Drepper <drepper@myware>
2592-
2593- * dcgettext.c (DCGETTEXT): Correct searching in derived locales.
2594- This was necessary since a change in _nl_find_msg several weeks
2595- ago. I really don't know this is still not fixed.
2596-
2597-Sun Nov 5 12:43:12 1995 Ulrich Drepper <drepper@myware>
2598-
2599- * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This
2600- might mark a special condition.
2601-
2602- * finddomain.c (make_entry_rec): Don't make illegal entry as decided.
2603-
2604- * Makefile.in (dist): Suppress error message when ln failed.
2605- Get files from $(srcdir) explicitly.
2606-
2607- * libgettext.h (gettext_const): Rename to gettext_noop.
2608-
2609-Fri Nov 3 07:36:50 1995 Ulrich Drepper <drepper@myware>
2610-
2611- * finddomain.c (make_entry_rec):
2612- Protect against wrong locale names by testing mask.
2613-
2614- * libgettext.h (gettext_const): Add macro definition.
2615- Capitalize macro arguments.
2616-
2617-Thu Nov 2 23:15:51 1995 Ulrich Drepper <drepper@myware>
2618-
2619- * finddomain.c (_nl_find_domain):
2620- Test for pointer != NULL before accessing value.
2621- Reported by Tom Tromey.
2622-
2623- * gettext.c (NULL):
2624- Define as (void*)0 instad of 0. Reported by Franc,ois Pinard.
2625-
2626-Mon Oct 30 21:28:52 1995 Ulrich Drepper <drepper@myware>
2627-
2628- * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering.
2629-
2630-Sat Oct 28 23:20:47 1995 Ulrich Drepper <drepper@myware>
2631-
2632- * libgettext.h: Disable dcgettext optimization for Solaris 2.3.
2633-
2634- * localealias.c (alias_compare):
2635- Peter Miller reported that tolower in some systems is
2636- even dumber than I thought. Protect call by `isupper'.
2637-
2638-Fri Oct 27 22:22:51 1995 Ulrich Drepper <drepper@myware>
2639-
2640- * Makefile.in (libdir, includedir): New variables.
2641- (install-src): Install libintl.a and libintl.h in correct dirs.
2642-
2643-Fri Oct 27 22:07:29 1995 Ulrich Drepper <drepper@myware>
2644-
2645- * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c.
2646-
2647- * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques.
2648-
2649- * localealias.c:
2650- Fix typo and superflous test. Reported by Christian von Roques.
2651-
2652-Fri Oct 6 11:52:05 1995 Ulrich Drepper <drepper@myware>
2653-
2654- * finddomain.c (_nl_find_domain):
2655- Correct some remainder from the pre-CEN syntax. Now
2656- we don't have a constant number of successors anymore.
2657-
2658-Wed Sep 27 21:41:13 1995 Ulrich Drepper <drepper@myware>
2659-
2660- * Makefile.in (DISTFILES): Add libintl.h.glibc.
2661-
2662- * Makefile.in (dist-libc): Add goal for packing sources for glibc.
2663- (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc.
2664-
2665- * loadmsgcat.c: Forget to continue #if line.
2666-
2667- * localealias.c:
2668- [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name
2669- space clean.
2670-
2671- * dcgettext.c, finddomain.c: Better comment to last change.
2672-
2673- * loadmsgcat.c:
2674- [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to
2675- __fstat, __open, __close, __read, __mmap, and __munmap resp
2676- to keep ANSI C name space clean.
2677-
2678- * finddomain.c:
2679- [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean.
2680-
2681- * dcgettext.c:
2682- [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to
2683- keep ANSI C name space clean.
2684-
2685- * libgettext.h:
2686- Include sys/types.h for those old SysV systems out there.
2687- Reported by Francesco Potorti`.
2688-
2689- * loadmsgcat.c (use_mmap): Define if compiled for glibc.
2690-
2691- * bindtextdom.c: Include all those standard headers
2692- unconditionally if _LIBC is defined.
2693-
2694- * finddomain.c: Fix 2 times defiend -> defined.
2695-
2696- * textdomain.c: Include libintl.h instead of libgettext.h when
2697- compiling for glibc. Include all those standard headers
2698- unconditionally if _LIBC is defined.
2699-
2700- * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc.
2701-
2702- * gettext.c:
2703- Include libintl.h instead of libgettext.h when compiling for glibc.
2704- Get NULL from stddef.h if we compile for glibc.
2705-
2706- * finddomain.c: Include libintl.h instead of libgettext.h when
2707- compiling for glibc. Include all those standard headers
2708- unconditionally if _LIBC is defined.
2709-
2710- * dcgettext.c: Include all those standard headers unconditionally
2711- if _LIBC is defined.
2712-
2713- * dgettext.c: If compiled in glibc include libintl.h instead of
2714- libgettext.h.
2715- (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc.
2716-
2717- * dcgettext.c: If compiled in glibc include libintl.h instead of
2718- libgettext.h.
2719- (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc.
2720-
2721- * bindtextdom.c:
2722- If compiled in glibc include libintl.h instead of libgettext.h.
2723-
2724-Mon Sep 25 22:23:06 1995 Ulrich Drepper <drepper@myware>
2725-
2726- * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0.
2727- Reported by Marcus Daniels.
2728-
2729- * cat-compat.c (bindtextdomain):
2730- String used in putenv must not be recycled.
2731- Reported by Marcus Daniels.
2732-
2733- * libgettext.h (__USE_GNU_GETTEXT):
2734- Additional symbol to signal that we use GNU gettext
2735- library.
2736-
2737- * cat-compat.c (bindtextdomain):
2738- Fix bug with the strange stpcpy replacement.
2739- Reported by Nelson Beebe.
2740-
2741-Sat Sep 23 08:23:51 1995 Ulrich Drepper <drepper@myware>
2742-
2743- * cat-compat.c: Include <string.h> for stpcpy prototype.
2744-
2745- * localealias.c (read_alias_file):
2746- While expand strdup code temporary variable `cp' hided
2747- higher level variable with same name. Rename to `tp'.
2748-
2749- * textdomain.c (textdomain):
2750- Avoid warning by using temporary variable in strdup code.
2751-
2752- * finddomain.c (_nl_find_domain): Remove unused variable `application'.
2753-
2754-Thu Sep 21 15:51:44 1995 Ulrich Drepper <drepper@myware>
2755-
2756- * localealias.c (alias_compare):
2757- Use strcasecmp() only if available. Else use
2758- implementation in place.
2759-
2760- * intl-compat.c:
2761- Wrapper functions now call *__ functions instead of __*.
2762-
2763- * libgettext.h: Declare prototypes for *__ functions instead for __*.
2764-
2765- * cat-compat.c, loadmsgcat.c:
2766- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
2767- of the standard libc and so prevent libintl.a from being used
2768- standalone.
2769-
2770- * bindtextdom.c:
2771- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
2772- of the standard libc and so prevent libintl.a from being used
2773- standalone.
2774- Rename to bindtextdomain__ if not used in GNU C Library.
2775-
2776- * dgettext.c:
2777- Rename function to dgettext__ if not used in GNU C Library.
2778-
2779- * gettext.c:
2780- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
2781- of the standard libc and so prevent libintl.a from being used
2782- standalone.
2783- Functions now called gettext__ if not used in GNU C Library.
2784-
2785- * dcgettext.c, localealias.c, textdomain.c, finddomain.c:
2786- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
2787- of the standard libc and so prevent libintl.a from being used
2788- standalone.
2789-
2790-Sun Sep 17 23:14:49 1995 Ulrich Drepper <drepper@myware>
2791-
2792- * finddomain.c: Correct some bugs in handling of CEN standard
2793- locale definitions.
2794-
2795-Thu Sep 7 01:49:28 1995 Ulrich Drepper <drepper@myware>
2796-
2797- * finddomain.c: Implement CEN syntax.
2798-
2799- * gettextP.h (loaded_domain): Extend number of successors to 31.
2800-
2801-Sat Aug 19 19:25:29 1995 Ulrich Drepper <drepper@myware>
2802-
2803- * Makefile.in (aliaspath): Remove path to X11 locale dir.
2804-
2805- * Makefile.in: Make install-src depend on install. This helps
2806- gettext to install the sources and other packages can use the
2807- install goal.
2808-
2809-Sat Aug 19 15:19:33 1995 Ulrich Drepper <drepper@myware>
2810-
2811- * Makefile.in (uninstall): Remove stuff installed by install-src.
2812-
2813-Tue Aug 15 13:13:53 1995 Ulrich Drepper <drepper@myware>
2814-
2815- * VERSION.in: Initial revision.
2816-
2817- * Makefile.in (DISTFILES):
2818- Add VERSION file. This is not necessary for gettext, but
2819- for other packages using this library.
2820-
2821-Tue Aug 15 06:16:44 1995 Ulrich Drepper <drepper@myware>
2822-
2823- * gettextP.h (_nl_find_domain):
2824- New prototype after changing search strategy.
2825-
2826- * finddomain.c (_nl_find_domain):
2827- We now try only to find a specified catalog. Fall back to other
2828- catalogs listed in the locale list is now done in __dcgettext.
2829-
2830- * dcgettext.c (__dcgettext):
2831- Now we provide message fall back even to different languages.
2832- I.e. if a message is not available in one language all the other
2833- in the locale list a tried. Formerly fall back was only possible
2834- within one language. Implemented by moving one loop from
2835- _nl_find_domain to here.
2836-
2837-Mon Aug 14 23:45:50 1995 Ulrich Drepper <drepper@myware>
2838-
2839- * Makefile.in (gettextsrcdir):
2840- Directory where source of GNU gettext library are made
2841- available.
2842- (INSTALL, INSTALL_DATA): Programs used for installing sources.
2843- (gettext-src): New. Rule to install GNU gettext sources for use in
2844- gettextize shell script.
2845-
2846-Sun Aug 13 14:40:48 1995 Ulrich Drepper <drepper@myware>
2847-
2848- * loadmsgcat.c (_nl_load_domain):
2849- Use mmap for loading only when munmap function is
2850- also available.
2851-
2852- * Makefile.in (install): Depend on `all' goal.
2853-
2854-Wed Aug 9 11:04:33 1995 Ulrich Drepper <drepper@myware>
2855-
2856- * localealias.c (read_alias_file):
2857- Do not overwrite '\n' when terminating alias value string.
2858-
2859- * localealias.c (read_alias_file):
2860- Handle long lines. Ignore the rest not fitting in
2861- the buffer after the initial `fgets' call.
2862-
2863-Wed Aug 9 00:54:29 1995 Ulrich Drepper <drepper@myware>
2864-
2865- * gettextP.h (_nl_load_domain):
2866- Add prototype, replacing prototype for _nl_load_msg_cat.
2867-
2868- * finddomain.c (_nl_find_domain):
2869- Remove unneeded variable filename and filename_len.
2870- (expand_alias): Remove prototype because functions does not
2871- exist anymore.
2872-
2873- * localealias.c (read_alias_file):
2874- Change type of fname_len parameter to int.
2875- (xmalloc): Add prototype.
2876-
2877- * loadmsgcat.c: Better prototypes for xmalloc.
2878-
2879-Tue Aug 8 22:30:39 1995 Ulrich Drepper <drepper@myware>
2880-
2881- * finddomain.c (_nl_find_domain):
2882- Allow alias name to be constructed from the four components.
2883-
2884- * Makefile.in (aliaspath): New variable. Set to preliminary value.
2885- (SOURCES): Add localealias.c.
2886- (OBJECTS): Add localealias.o.
2887-
2888- * gettextP.h: Add prototype for _nl_expand_alias.
2889-
2890- * finddomain.c: Aliasing handled in intl/localealias.c.
2891-
2892- * localealias.c: Aliasing for locale names.
2893-
2894- * bindtextdom.c: Better prototypes for xmalloc and xstrdup.
2895-
2896-Mon Aug 7 23:47:42 1995 Ulrich Drepper <drepper@myware>
2897-
2898- * Makefile.in (DISTFILES): gettext.perl is now found in misc/.
2899-
2900- * cat-compat.c (bindtextdomain):
2901- Correct implementation. dirname parameter was not used.
2902- Reported by Marcus Daniels.
2903-
2904- * gettextP.h (loaded_domain):
2905- New fields `successor' and `decided' for oo, lazy
2906- message handling implementation.
2907-
2908- * dcgettext.c:
2909- Adopt for oo, lazy message handliing.
2910- Now we can inherit translations from less specific locales.
2911- (find_msg): New function.
2912-
2913- * loadmsgcat.c, finddomain.c:
2914- Complete rewrite. Implement oo, lazy message handling :-).
2915- We now have an additional environment variable `LANGUAGE' with
2916- a higher priority than LC_ALL for the LC_MESSAGE locale.
2917- Here we can set a colon separated list of specifications each
2918- of the form `language[_territory[.codeset]][@modifier]'.
2919-
2920-Sat Aug 5 09:55:42 1995 Ulrich Drepper <drepper@myware>
2921-
2922- * finddomain.c (unistd.h):
2923- Include to get _PC_PATH_MAX defined on system having it.
2924-
2925-Fri Aug 4 22:42:00 1995 Ulrich Drepper <drepper@myware>
2926-
2927- * finddomain.c (stpcpy): Include prototype.
2928-
2929- * Makefile.in (dist): Remove `copying instead' message.
2930-
2931-Wed Aug 2 18:52:03 1995 Ulrich Drepper <drepper@myware>
2932-
2933- * Makefile.in (ID, TAGS): Do not use $^.
2934-
2935-Tue Aug 1 20:07:11 1995 Ulrich Drepper <drepper@myware>
2936-
2937- * Makefile.in (TAGS, ID): Use $^ as command argument.
2938- (TAGS): Give etags -o option t write to current directory,
2939- not $(srcdir).
2940- (ID): Use $(srcdir) instead os $(top_srcdir)/src.
2941- (distclean): Remove ID.
2942-
2943-Sun Jul 30 11:51:46 1995 Ulrich Drepper <drepper@myware>
2944-
2945- * Makefile.in (gnulocaledir):
2946- New variable, always using share/ for data directory.
2947- (DEFS): Add GNULOCALEDIR, used in finddomain.c.
2948-
2949- * finddomain.c (_nl_default_dirname):
2950- Set to GNULOCALEDIR, because it always has to point
2951- to the directory where GNU gettext Library writes it to.
2952-
2953- * intl-compat.c (textdomain, bindtextdomain):
2954- Undefine macros before function definition.
2955-
2956-Sat Jul 22 01:10:02 1995 Ulrich Drepper <drepper@myware>
2957-
2958- * libgettext.h (_LIBINTL_H):
2959- Protect definition in case where this file is included as
2960- libgettext.h on Solaris machines. Add comment about this.
2961-
2962-Wed Jul 19 02:36:42 1995 Ulrich Drepper <drepper@myware>
2963-
2964- * intl-compat.c (textdomain): Correct typo.
2965-
2966-Wed Jul 19 01:51:35 1995 Ulrich Drepper <drepper@myware>
2967-
2968- * dcgettext.c (dcgettext): Function now called __dcgettext.
2969-
2970- * dgettext.c (dgettext): Now called __dgettext and calls
2971- __dcgettext.
2972-
2973- * gettext.c (gettext):
2974- Function now called __gettext and calls __dgettext.
2975-
2976- * textdomain.c (textdomain): Function now called __textdomain.
2977-
2978- * bindtextdom.c (bindtextdomain): Function now called
2979- __bindtextdomain.
2980-
2981- * intl-compat.c: Initial revision.
2982-
2983- * Makefile.in (SOURCES): Add intl-compat.c.
2984- (OBJECTS): We always compile the GNU gettext library functions.
2985- OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o,
2986- and intl-compat.o.
2987- (GETTOBJS): Contains now only intl-compat.o.
2988-
2989- * libgettext.h:
2990- Re-include protection matches dualistic character of libgettext.h.
2991- For all functions in GNU gettext library define __ counter part.
2992-
2993- * finddomain.c (strchr): Define as index if not found in C library.
2994- (_nl_find_domain): For relative paths paste / in between.
2995-
2996-Tue Jul 18 16:37:45 1995 Ulrich Drepper <drepper@myware>
2997-
2998- * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h.
2999-
3000- * xopen-msg.sed: Fix bug with `msgstr ""' lines.
3001- A little bit better comments.
3002-
3003-Tue Jul 18 01:18:27 1995 Ulrich Drepper <drepper@myware>
3004-
3005- * Makefile.in:
3006- po-mode.el, makelinks, combine-sh are now found in ../misc.
3007-
3008- * po-mode.el, makelinks, combine-sh, elisp-comp:
3009- Moved to ../misc/.
3010-
3011- * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__.
3012-
3013-Sun Jul 16 22:33:02 1995 Ulrich Drepper <drepper@myware>
3014-
3015- * Makefile.in (INSTALL, INSTALL_DATA): New variables.
3016- (install-data, uninstall): Install/uninstall .elc file.
3017-
3018- * po-mode.el (Installation comment):
3019- Add .pox as possible extension of .po files.
3020-
3021-Sun Jul 16 13:23:27 1995 Ulrich Drepper <drepper@myware>
3022-
3023- * elisp-comp: Complete new version by Franc,ois: This does not
3024- fail when not compiling in the source directory.
3025-
3026-Sun Jul 16 00:12:17 1995 Ulrich Drepper <drepper@myware>
3027-
3028- * Makefile.in (../po/cat-id-tbl.o):
3029- Use $(MAKE) instead of make for recursive make.
3030-
3031- * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh.
3032- (install-exec): Add missing dummy goal.
3033- (install-data, uninstall): @ in multi-line shell command at
3034- beginning, not in front of echo. Reported by Eric Backus.
3035-
3036-Sat Jul 15 00:21:28 1995 Ulrich Drepper <drepper@myware>
3037-
3038- * Makefile.in (DISTFILES):
3039- Rename libgettext.perl to gettext.perl to fit in 14 chars
3040- file systems.
3041-
3042- * gettext.perl:
3043- Rename to gettext.perl to fit in 14 chars file systems.
3044-
3045-Thu Jul 13 23:17:20 1995 Ulrich Drepper <drepper@myware>
3046-
3047- * cat-compat.c: If !STDC_HEADERS try to include malloc.h.
3048-
3049-Thu Jul 13 20:55:02 1995 Ulrich Drepper <drepper@myware>
3050-
3051- * po2tbl.sed.in: Pretty printing.
3052-
3053- * linux-msg.sed, xopen-msg.sed:
3054- Correct bugs with handling substitute flags in branches.
3055-
3056- * hash-string.h (hash_string):
3057- Old K&R compilers don't under stand `unsigned char'.
3058-
3059- * gettext.h (nls_uint32):
3060- Some old K&R compilers (eg HP) don't understand `unsigned int'.
3061-
3062- * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes.
3063-
3064-Thu Jul 13 01:34:33 1995 Ulrich Drepper <drepper@myware>
3065-
3066- * Makefile.in (ELCFILES): New variable.
3067- (DISTFILES): Add elisp-comp.
3068- Add implicit rule for .el -> .elc compilation.
3069- (install-data): install $ELCFILES
3070- (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp.
3071-
3072- * elisp-comp: Initial revision
3073-
3074-Wed Jul 12 16:14:52 1995 Ulrich Drepper <drepper@myware>
3075-
3076- * Makefile.in:
3077- cat-id-tbl.c is now found in po/. This enables us to use an identical
3078- intl/ directory in all packages.
3079-
3080- * dcgettext.c (dcgettext): hashing does not work for table size <= 2.
3081-
3082- * textdomain.c: fix typo (#if def -> #if defined)
3083-
3084-Tue Jul 11 18:44:43 1995 Ulrich Drepper <drepper@myware>
3085-
3086- * Makefile.in (stamp-cat-id): use top_srcdir to address source files
3087- (DISTFILES,distclean): move tupdate.perl to src/
3088-
3089- * po-to-tbl.sed.in:
3090- add additional jump to clear change flag to recognize multiline strings
3091-
3092-Tue Jul 11 01:32:50 1995 Ulrich Drepper <drepper@myware>
3093-
3094- * textdomain.c: Protect inclusion of stdlib.h and string.h.
3095-
3096- * loadmsgcat.c: Protect inclusion of stdlib.h.
3097-
3098- * libgettext.h: Protect inclusion of locale.h.
3099- Allow use in C++ programs.
3100- Define NULL is not happened already.
3101-
3102- * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of
3103- po-to-tbl.sed.
3104- (distclean): remove po-to-tbl.sed and tupdate.perl.
3105-
3106- * tupdate.perl.in: Substitute Perl path even in exec line.
3107- Don't include entries without translation from old .po file.
3108-
3109-Tue Jul 4 00:41:51 1995 Ulrich Drepper <drepper@myware>
3110-
3111- * tupdate.perl.in: use "Updated: " in msgid "".
3112-
3113- * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR).
3114- Define getenv if !__STDC__.
3115-
3116- * bindtextdom.c: Protect stdlib.h and string.h inclusion.
3117- Define free if !__STDC__.
3118-
3119- * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
3120- Define free if !__STDC__.
3121-
3122- * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
3123-
3124-Mon Jul 3 23:56:30 1995 Ulrich Drepper <drepper@myware>
3125-
3126- * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR.
3127- Remove unneeded $(srcdir) from Makefile.in dependency.
3128-
3129- * makelinks: Add copyright and short description.
3130-
3131- * po-mode.el: Last version for 0.7.
3132-
3133- * tupdate.perl.in: Fix die message.
3134-
3135- * dcgettext.c: Protect include of string.h.
3136-
3137- * gettext.c: Protect include of stdlib.h and further tries to get NULL.
3138-
3139- * finddomain.c: Some corrections in includes.
3140-
3141- * Makefile.in (INCLUDES): Prune list correct path to Makefile.in.
3142-
3143- * po-to-tbl.sed: Adopt for new .po file format.
3144-
3145- * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format.
3146-
3147-Sun Jul 2 23:55:03 1995 Ulrich Drepper <drepper@myware>
3148-
3149- * tupdate.perl.in: Complete rewrite for new .po file format.
3150+2004-01-29 GNU <bug-gnu-gettext@gnu.org>
3151
3152-Sun Jul 2 02:06:50 1995 Ulrich Drepper <drepper@myware>
3153+ * Version 0.14.1 released.
3154
3155- * First official release. This directory contains all the code
3156- needed to internationalize own packages. It provides functions
3157- which allow to use the X/Open catgets function with an interface
3158- like the Uniforum gettext function. For system which does not
3159- have neither of those a complete implementation is provided.
3160--- lrzsz-0.12.20.safe/intl/config.charset 1969-12-31 19:00:00.000000000 -0500
3161+++ lrzsz-0.12.20/intl/config.charset 2004-09-12 14:40:34.354748240 -0400
3162@@ -0,0 +1,608 @@
3163+#! /bin/sh
3164+# Output a system dependent table of character encoding aliases.
3165+#
3166+# Copyright (C) 2000-2004 Free Software Foundation, Inc.
3167+#
3168+# This program is free software; you can redistribute it and/or modify it
3169+# under the terms of the GNU Library General Public License as published
3170+# by the Free Software Foundation; either version 2, or (at your option)
3171+# any later version.
3172+#
3173+# This program is distributed in the hope that it will be useful,
3174+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3175+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3176+# Library General Public License for more details.
3177+#
3178+# You should have received a copy of the GNU Library General Public
3179+# License along with this program; if not, write to the Free Software
3180+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3181+# USA.
3182+#
3183+# The table consists of lines of the form
3184+# ALIAS CANONICAL
3185+#
3186+# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
3187+# ALIAS is compared in a case sensitive way.
3188+#
3189+# CANONICAL is the GNU canonical name for this character encoding.
3190+# It must be an encoding supported by libiconv. Support by GNU libc is
3191+# also desirable. CANONICAL is case insensitive. Usually an upper case
3192+# MIME charset name is preferred.
3193+# The current list of GNU canonical charset names is as follows.
3194+#
3195+# name MIME? used by which systems
3196+# ASCII, ANSI_X3.4-1968 glibc solaris freebsd darwin
3197+# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd darwin
3198+# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd darwin
3199+# ISO-8859-3 Y glibc solaris
3200+# ISO-8859-4 Y osf solaris freebsd darwin
3201+# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd darwin
3202+# ISO-8859-6 Y glibc aix hpux solaris
3203+# ISO-8859-7 Y glibc aix hpux irix osf solaris
3204+# ISO-8859-8 Y glibc aix hpux osf solaris
3205+# ISO-8859-9 Y glibc aix hpux irix osf solaris
3206+# ISO-8859-13 glibc
3207+# ISO-8859-14 glibc
3208+# ISO-8859-15 glibc aix osf solaris freebsd
3209+# KOI8-R Y glibc solaris freebsd darwin
3210+# KOI8-U Y glibc freebsd darwin
3211+# KOI8-T glibc
3212+# CP437 dos
3213+# CP775 dos
3214+# CP850 aix osf dos
3215+# CP852 dos
3216+# CP855 dos
3217+# CP856 aix
3218+# CP857 dos
3219+# CP861 dos
3220+# CP862 dos
3221+# CP864 dos
3222+# CP865 dos
3223+# CP866 freebsd darwin dos
3224+# CP869 dos
3225+# CP874 woe32 dos
3226+# CP922 aix
3227+# CP932 aix woe32 dos
3228+# CP943 aix
3229+# CP949 osf woe32 dos
3230+# CP950 woe32 dos
3231+# CP1046 aix
3232+# CP1124 aix
3233+# CP1125 dos
3234+# CP1129 aix
3235+# CP1250 woe32
3236+# CP1251 glibc solaris darwin woe32
3237+# CP1252 aix woe32
3238+# CP1253 woe32
3239+# CP1254 woe32
3240+# CP1255 glibc woe32
3241+# CP1256 woe32
3242+# CP1257 woe32
3243+# GB2312 Y glibc aix hpux irix solaris freebsd darwin
3244+# EUC-JP Y glibc aix hpux irix osf solaris freebsd darwin
3245+# EUC-KR Y glibc aix hpux irix osf solaris freebsd darwin
3246+# EUC-TW glibc aix hpux irix osf solaris
3247+# BIG5 Y glibc aix hpux osf solaris freebsd darwin
3248+# BIG5-HKSCS glibc solaris
3249+# GBK glibc aix osf solaris woe32 dos
3250+# GB18030 glibc solaris
3251+# SHIFT_JIS Y hpux osf solaris freebsd darwin
3252+# JOHAB glibc solaris woe32
3253+# TIS-620 glibc aix hpux osf solaris
3254+# VISCII Y glibc
3255+# TCVN5712-1 glibc
3256+# GEORGIAN-PS glibc
3257+# HP-ROMAN8 hpux
3258+# HP-ARABIC8 hpux
3259+# HP-GREEK8 hpux
3260+# HP-HEBREW8 hpux
3261+# HP-TURKISH8 hpux
3262+# HP-KANA8 hpux
3263+# DEC-KANJI osf
3264+# DEC-HANYU osf
3265+# UTF-8 Y glibc aix hpux osf solaris
3266+#
3267+# Note: Names which are not marked as being a MIME name should not be used in
3268+# Internet protocols for information interchange (mail, news, etc.).
3269+#
3270+# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
3271+# must understand both names and treat them as equivalent.
3272+#
3273+# The first argument passed to this file is the canonical host specification,
3274+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
3275+# or
3276+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
3277+
3278+host="$1"
3279+os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
3280+echo "# This file contains a table of character encoding aliases,"
3281+echo "# suitable for operating system '${os}'."
3282+echo "# It was automatically generated from config.charset."
3283+# List of references, updated during installation:
3284+echo "# Packages using this file: "
3285+case "$os" in
3286+ linux-gnulibc1*)
3287+ # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
3288+ # localcharset.c falls back to using the full locale name
3289+ # from the environment variables.
3290+ echo "C ASCII"
3291+ echo "POSIX ASCII"
3292+ for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
3293+ en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
3294+ en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
3295+ es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
3296+ et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
3297+ fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
3298+ it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
3299+ sv_FI sv_SE; do
3300+ echo "$l ISO-8859-1"
3301+ echo "$l.iso-8859-1 ISO-8859-1"
3302+ echo "$l.iso-8859-15 ISO-8859-15"
3303+ echo "$l.iso-8859-15@euro ISO-8859-15"
3304+ echo "$l@euro ISO-8859-15"
3305+ echo "$l.cp-437 CP437"
3306+ echo "$l.cp-850 CP850"
3307+ echo "$l.cp-1252 CP1252"
3308+ echo "$l.cp-1252@euro CP1252"
3309+ #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
3310+ echo "$l.utf-8 UTF-8"
3311+ echo "$l.utf-8@euro UTF-8"
3312+ done
3313+ for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
3314+ sl_SI sr sr_CS sr_YU; do
3315+ echo "$l ISO-8859-2"
3316+ echo "$l.iso-8859-2 ISO-8859-2"
3317+ echo "$l.cp-852 CP852"
3318+ echo "$l.cp-1250 CP1250"
3319+ echo "$l.utf-8 UTF-8"
3320+ done
3321+ for l in mk mk_MK ru ru_RU; do
3322+ echo "$l ISO-8859-5"
3323+ echo "$l.iso-8859-5 ISO-8859-5"
3324+ echo "$l.koi8-r KOI8-R"
3325+ echo "$l.cp-866 CP866"
3326+ echo "$l.cp-1251 CP1251"
3327+ echo "$l.utf-8 UTF-8"
3328+ done
3329+ for l in ar ar_SA; do
3330+ echo "$l ISO-8859-6"
3331+ echo "$l.iso-8859-6 ISO-8859-6"
3332+ echo "$l.cp-864 CP864"
3333+ #echo "$l.cp-868 CP868" # not a commonly used encoding
3334+ echo "$l.cp-1256 CP1256"
3335+ echo "$l.utf-8 UTF-8"
3336+ done
3337+ for l in el el_GR gr gr_GR; do
3338+ echo "$l ISO-8859-7"
3339+ echo "$l.iso-8859-7 ISO-8859-7"
3340+ echo "$l.cp-869 CP869"
3341+ echo "$l.cp-1253 CP1253"
3342+ echo "$l.cp-1253@euro CP1253"
3343+ echo "$l.utf-8 UTF-8"
3344+ echo "$l.utf-8@euro UTF-8"
3345+ done
3346+ for l in he he_IL iw iw_IL; do
3347+ echo "$l ISO-8859-8"
3348+ echo "$l.iso-8859-8 ISO-8859-8"
3349+ echo "$l.cp-862 CP862"
3350+ echo "$l.cp-1255 CP1255"
3351+ echo "$l.utf-8 UTF-8"
3352+ done
3353+ for l in tr tr_TR; do
3354+ echo "$l ISO-8859-9"
3355+ echo "$l.iso-8859-9 ISO-8859-9"
3356+ echo "$l.cp-857 CP857"
3357+ echo "$l.cp-1254 CP1254"
3358+ echo "$l.utf-8 UTF-8"
3359+ done
3360+ for l in lt lt_LT lv lv_LV; do
3361+ #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
3362+ echo "$l ISO-8859-13"
3363+ done
3364+ for l in ru_UA uk uk_UA; do
3365+ echo "$l KOI8-U"
3366+ done
3367+ for l in zh zh_CN; do
3368+ #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
3369+ echo "$l GB2312"
3370+ done
3371+ for l in ja ja_JP ja_JP.EUC; do
3372+ echo "$l EUC-JP"
3373+ done
3374+ for l in ko ko_KR; do
3375+ echo "$l EUC-KR"
3376+ done
3377+ for l in th th_TH; do
3378+ echo "$l TIS-620"
3379+ done
3380+ for l in fa fa_IR; do
3381+ #echo "$l ISIRI-3342" # a broken encoding
3382+ echo "$l.utf-8 UTF-8"
3383+ done
3384+ ;;
3385+ linux* | *-gnu*)
3386+ # With glibc-2.1 or newer, we don't need any canonicalization,
3387+ # because glibc has iconv and both glibc and libiconv support all
3388+ # GNU canonical names directly. Therefore, the Makefile does not
3389+ # need to install the alias file at all.
3390+ # The following applies only to glibc-2.0.x and older libcs.
3391+ echo "ISO_646.IRV:1983 ASCII"
3392+ ;;
3393+ aix*)
3394+ echo "ISO8859-1 ISO-8859-1"
3395+ echo "ISO8859-2 ISO-8859-2"
3396+ echo "ISO8859-5 ISO-8859-5"
3397+ echo "ISO8859-6 ISO-8859-6"
3398+ echo "ISO8859-7 ISO-8859-7"
3399+ echo "ISO8859-8 ISO-8859-8"
3400+ echo "ISO8859-9 ISO-8859-9"
3401+ echo "ISO8859-15 ISO-8859-15"
3402+ echo "IBM-850 CP850"
3403+ echo "IBM-856 CP856"
3404+ echo "IBM-921 ISO-8859-13"
3405+ echo "IBM-922 CP922"
3406+ echo "IBM-932 CP932"
3407+ echo "IBM-943 CP943"
3408+ echo "IBM-1046 CP1046"
3409+ echo "IBM-1124 CP1124"
3410+ echo "IBM-1129 CP1129"
3411+ echo "IBM-1252 CP1252"
3412+ echo "IBM-eucCN GB2312"
3413+ echo "IBM-eucJP EUC-JP"
3414+ echo "IBM-eucKR EUC-KR"
3415+ echo "IBM-eucTW EUC-TW"
3416+ echo "big5 BIG5"
3417+ echo "GBK GBK"
3418+ echo "TIS-620 TIS-620"
3419+ echo "UTF-8 UTF-8"
3420+ ;;
3421+ hpux*)
3422+ echo "iso88591 ISO-8859-1"
3423+ echo "iso88592 ISO-8859-2"
3424+ echo "iso88595 ISO-8859-5"
3425+ echo "iso88596 ISO-8859-6"
3426+ echo "iso88597 ISO-8859-7"
3427+ echo "iso88598 ISO-8859-8"
3428+ echo "iso88599 ISO-8859-9"
3429+ echo "iso885915 ISO-8859-15"
3430+ echo "roman8 HP-ROMAN8"
3431+ echo "arabic8 HP-ARABIC8"
3432+ echo "greek8 HP-GREEK8"
3433+ echo "hebrew8 HP-HEBREW8"
3434+ echo "turkish8 HP-TURKISH8"
3435+ echo "kana8 HP-KANA8"
3436+ echo "tis620 TIS-620"
3437+ echo "big5 BIG5"
3438+ echo "eucJP EUC-JP"
3439+ echo "eucKR EUC-KR"
3440+ echo "eucTW EUC-TW"
3441+ echo "hp15CN GB2312"
3442+ #echo "ccdc ?" # what is this?
3443+ echo "SJIS SHIFT_JIS"
3444+ echo "utf8 UTF-8"
3445+ ;;
3446+ irix*)
3447+ echo "ISO8859-1 ISO-8859-1"
3448+ echo "ISO8859-2 ISO-8859-2"
3449+ echo "ISO8859-5 ISO-8859-5"
3450+ echo "ISO8859-7 ISO-8859-7"
3451+ echo "ISO8859-9 ISO-8859-9"
3452+ echo "eucCN GB2312"
3453+ echo "eucJP EUC-JP"
3454+ echo "eucKR EUC-KR"
3455+ echo "eucTW EUC-TW"
3456+ ;;
3457+ osf*)
3458+ echo "ISO8859-1 ISO-8859-1"
3459+ echo "ISO8859-2 ISO-8859-2"
3460+ echo "ISO8859-4 ISO-8859-4"
3461+ echo "ISO8859-5 ISO-8859-5"
3462+ echo "ISO8859-7 ISO-8859-7"
3463+ echo "ISO8859-8 ISO-8859-8"
3464+ echo "ISO8859-9 ISO-8859-9"
3465+ echo "ISO8859-15 ISO-8859-15"
3466+ echo "cp850 CP850"
3467+ echo "big5 BIG5"
3468+ echo "dechanyu DEC-HANYU"
3469+ echo "dechanzi GB2312"
3470+ echo "deckanji DEC-KANJI"
3471+ echo "deckorean EUC-KR"
3472+ echo "eucJP EUC-JP"
3473+ echo "eucKR EUC-KR"
3474+ echo "eucTW EUC-TW"
3475+ echo "GBK GBK"
3476+ echo "KSC5601 CP949"
3477+ echo "sdeckanji EUC-JP"
3478+ echo "SJIS SHIFT_JIS"
3479+ echo "TACTIS TIS-620"
3480+ echo "UTF-8 UTF-8"
3481+ ;;
3482+ solaris*)
3483+ echo "646 ASCII"
3484+ echo "ISO8859-1 ISO-8859-1"
3485+ echo "ISO8859-2 ISO-8859-2"
3486+ echo "ISO8859-3 ISO-8859-3"
3487+ echo "ISO8859-4 ISO-8859-4"
3488+ echo "ISO8859-5 ISO-8859-5"
3489+ echo "ISO8859-6 ISO-8859-6"
3490+ echo "ISO8859-7 ISO-8859-7"
3491+ echo "ISO8859-8 ISO-8859-8"
3492+ echo "ISO8859-9 ISO-8859-9"
3493+ echo "ISO8859-15 ISO-8859-15"
3494+ echo "koi8-r KOI8-R"
3495+ echo "ansi-1251 CP1251"
3496+ echo "BIG5 BIG5"
3497+ echo "Big5-HKSCS BIG5-HKSCS"
3498+ echo "gb2312 GB2312"
3499+ echo "GBK GBK"
3500+ echo "GB18030 GB18030"
3501+ echo "cns11643 EUC-TW"
3502+ echo "5601 EUC-KR"
3503+ echo "ko_KR.johap92 JOHAB"
3504+ echo "eucJP EUC-JP"
3505+ echo "PCK SHIFT_JIS"
3506+ echo "TIS620.2533 TIS-620"
3507+ #echo "sun_eu_greek ?" # what is this?
3508+ echo "UTF-8 UTF-8"
3509+ ;;
3510+ freebsd* | os2*)
3511+ # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
3512+ # localcharset.c falls back to using the full locale name
3513+ # from the environment variables.
3514+ # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
3515+ # reuse FreeBSD's locale data for OS/2.
3516+ echo "C ASCII"
3517+ echo "US-ASCII ASCII"
3518+ for l in la_LN lt_LN; do
3519+ echo "$l.ASCII ASCII"
3520+ done
3521+ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
3522+ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
3523+ lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
3524+ echo "$l.ISO_8859-1 ISO-8859-1"
3525+ echo "$l.DIS_8859-15 ISO-8859-15"
3526+ done
3527+ for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
3528+ echo "$l.ISO_8859-2 ISO-8859-2"
3529+ done
3530+ for l in la_LN lt_LT; do
3531+ echo "$l.ISO_8859-4 ISO-8859-4"
3532+ done
3533+ for l in ru_RU ru_SU; do
3534+ echo "$l.KOI8-R KOI8-R"
3535+ echo "$l.ISO_8859-5 ISO-8859-5"
3536+ echo "$l.CP866 CP866"
3537+ done
3538+ echo "uk_UA.KOI8-U KOI8-U"
3539+ echo "zh_TW.BIG5 BIG5"
3540+ echo "zh_TW.Big5 BIG5"
3541+ echo "zh_CN.EUC GB2312"
3542+ echo "ja_JP.EUC EUC-JP"
3543+ echo "ja_JP.SJIS SHIFT_JIS"
3544+ echo "ja_JP.Shift_JIS SHIFT_JIS"
3545+ echo "ko_KR.EUC EUC-KR"
3546+ ;;
3547+ netbsd*)
3548+ echo "646 ASCII"
3549+ echo "ISO8859-1 ISO-8859-1"
3550+ echo "ISO8859-2 ISO-8859-2"
3551+ echo "ISO8859-4 ISO-8859-4"
3552+ echo "ISO8859-5 ISO-8859-5"
3553+ echo "ISO8859-15 ISO-8859-15"
3554+ echo "eucCN GB2312"
3555+ echo "eucJP EUC-JP"
3556+ echo "eucKR EUC-KR"
3557+ echo "eucTW EUC-TW"
3558+ echo "BIG5 BIG5"
3559+ echo "SJIS SHIFT_JIS"
3560+ ;;
3561+ darwin*)
3562+ # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
3563+ # localcharset.c falls back to using the full locale name
3564+ # from the environment variables.
3565+ echo "C ASCII"
3566+ for l in en_AU en_CA en_GB en_US la_LN; do
3567+ echo "$l.US-ASCII ASCII"
3568+ done
3569+ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
3570+ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
3571+ nl_NL no_NO pt_PT sv_SE; do
3572+ echo "$l ISO-8859-1"
3573+ echo "$l.ISO8859-1 ISO-8859-1"
3574+ echo "$l.ISO8859-15 ISO-8859-15"
3575+ done
3576+ for l in la_LN; do
3577+ echo "$l.ISO8859-1 ISO-8859-1"
3578+ echo "$l.ISO8859-15 ISO-8859-15"
3579+ done
3580+ for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
3581+ echo "$l.ISO8859-2 ISO-8859-2"
3582+ done
3583+ for l in la_LN lt_LT; do
3584+ echo "$l.ISO8859-4 ISO-8859-4"
3585+ done
3586+ for l in ru_RU; do
3587+ echo "$l.KOI8-R KOI8-R"
3588+ echo "$l.ISO8859-5 ISO-8859-5"
3589+ echo "$l.CP866 CP866"
3590+ done
3591+ for l in bg_BG; do
3592+ echo "$l.CP1251 CP1251"
3593+ done
3594+ echo "uk_UA.KOI8-U KOI8-U"
3595+ echo "zh_TW.BIG5 BIG5"
3596+ echo "zh_TW.Big5 BIG5"
3597+ echo "zh_CN.EUC GB2312"
3598+ echo "ja_JP.EUC EUC-JP"
3599+ echo "ja_JP.SJIS SHIFT_JIS"
3600+ echo "ko_KR.EUC EUC-KR"
3601+ ;;
3602+ beos*)
3603+ # BeOS has a single locale, and it has UTF-8 encoding.
3604+ echo "* UTF-8"
3605+ ;;
3606+ msdosdjgpp*)
3607+ # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
3608+ # localcharset.c falls back to using the full locale name
3609+ # from the environment variables.
3610+ echo "#"
3611+ echo "# The encodings given here may not all be correct."
3612+ echo "# If you find that the encoding given for your language and"
3613+ echo "# country is not the one your DOS machine actually uses, just"
3614+ echo "# correct it in this file, and send a mail to"
3615+ echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
3616+ echo "# and Bruno Haible <bruno@clisp.org>."
3617+ echo "#"
3618+ echo "C ASCII"
3619+ # ISO-8859-1 languages
3620+ echo "ca CP850"
3621+ echo "ca_ES CP850"
3622+ echo "da CP865" # not CP850 ??
3623+ echo "da_DK CP865" # not CP850 ??
3624+ echo "de CP850"
3625+ echo "de_AT CP850"
3626+ echo "de_CH CP850"
3627+ echo "de_DE CP850"
3628+ echo "en CP850"
3629+ echo "en_AU CP850" # not CP437 ??
3630+ echo "en_CA CP850"
3631+ echo "en_GB CP850"
3632+ echo "en_NZ CP437"
3633+ echo "en_US CP437"
3634+ echo "en_ZA CP850" # not CP437 ??
3635+ echo "es CP850"
3636+ echo "es_AR CP850"
3637+ echo "es_BO CP850"
3638+ echo "es_CL CP850"
3639+ echo "es_CO CP850"
3640+ echo "es_CR CP850"
3641+ echo "es_CU CP850"
3642+ echo "es_DO CP850"
3643+ echo "es_EC CP850"
3644+ echo "es_ES CP850"
3645+ echo "es_GT CP850"
3646+ echo "es_HN CP850"
3647+ echo "es_MX CP850"
3648+ echo "es_NI CP850"
3649+ echo "es_PA CP850"
3650+ echo "es_PY CP850"
3651+ echo "es_PE CP850"
3652+ echo "es_SV CP850"
3653+ echo "es_UY CP850"
3654+ echo "es_VE CP850"
3655+ echo "et CP850"
3656+ echo "et_EE CP850"
3657+ echo "eu CP850"
3658+ echo "eu_ES CP850"
3659+ echo "fi CP850"
3660+ echo "fi_FI CP850"
3661+ echo "fr CP850"
3662+ echo "fr_BE CP850"
3663+ echo "fr_CA CP850"
3664+ echo "fr_CH CP850"
3665+ echo "fr_FR CP850"
3666+ echo "ga CP850"
3667+ echo "ga_IE CP850"
3668+ echo "gd CP850"
3669+ echo "gd_GB CP850"
3670+ echo "gl CP850"
3671+ echo "gl_ES CP850"
3672+ echo "id CP850" # not CP437 ??
3673+ echo "id_ID CP850" # not CP437 ??
3674+ echo "is CP861" # not CP850 ??
3675+ echo "is_IS CP861" # not CP850 ??
3676+ echo "it CP850"
3677+ echo "it_CH CP850"
3678+ echo "it_IT CP850"
3679+ echo "lt CP775"
3680+ echo "lt_LT CP775"
3681+ echo "lv CP775"
3682+ echo "lv_LV CP775"
3683+ echo "nb CP865" # not CP850 ??
3684+ echo "nb_NO CP865" # not CP850 ??
3685+ echo "nl CP850"
3686+ echo "nl_BE CP850"
3687+ echo "nl_NL CP850"
3688+ echo "nn CP865" # not CP850 ??
3689+ echo "nn_NO CP865" # not CP850 ??
3690+ echo "no CP865" # not CP850 ??
3691+ echo "no_NO CP865" # not CP850 ??
3692+ echo "pt CP850"
3693+ echo "pt_BR CP850"
3694+ echo "pt_PT CP850"
3695+ echo "sv CP850"
3696+ echo "sv_SE CP850"
3697+ # ISO-8859-2 languages
3698+ echo "cs CP852"
3699+ echo "cs_CZ CP852"
3700+ echo "hr CP852"
3701+ echo "hr_HR CP852"
3702+ echo "hu CP852"
3703+ echo "hu_HU CP852"
3704+ echo "pl CP852"
3705+ echo "pl_PL CP852"
3706+ echo "ro CP852"
3707+ echo "ro_RO CP852"
3708+ echo "sk CP852"
3709+ echo "sk_SK CP852"
3710+ echo "sl CP852"
3711+ echo "sl_SI CP852"
3712+ echo "sq CP852"
3713+ echo "sq_AL CP852"
3714+ echo "sr CP852" # CP852 or CP866 or CP855 ??
3715+ echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
3716+ echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
3717+ # ISO-8859-3 languages
3718+ echo "mt CP850"
3719+ echo "mt_MT CP850"
3720+ # ISO-8859-5 languages
3721+ echo "be CP866"
3722+ echo "be_BE CP866"
3723+ echo "bg CP866" # not CP855 ??
3724+ echo "bg_BG CP866" # not CP855 ??
3725+ echo "mk CP866" # not CP855 ??
3726+ echo "mk_MK CP866" # not CP855 ??
3727+ echo "ru CP866"
3728+ echo "ru_RU CP866"
3729+ echo "uk CP1125"
3730+ echo "uk_UA CP1125"
3731+ # ISO-8859-6 languages
3732+ echo "ar CP864"
3733+ echo "ar_AE CP864"
3734+ echo "ar_DZ CP864"
3735+ echo "ar_EG CP864"
3736+ echo "ar_IQ CP864"
3737+ echo "ar_IR CP864"
3738+ echo "ar_JO CP864"
3739+ echo "ar_KW CP864"
3740+ echo "ar_MA CP864"
3741+ echo "ar_OM CP864"
3742+ echo "ar_QA CP864"
3743+ echo "ar_SA CP864"
3744+ echo "ar_SY CP864"
3745+ # ISO-8859-7 languages
3746+ echo "el CP869"
3747+ echo "el_GR CP869"
3748+ # ISO-8859-8 languages
3749+ echo "he CP862"
3750+ echo "he_IL CP862"
3751+ # ISO-8859-9 languages
3752+ echo "tr CP857"
3753+ echo "tr_TR CP857"
3754+ # Japanese
3755+ echo "ja CP932"
3756+ echo "ja_JP CP932"
3757+ # Chinese
3758+ echo "zh_CN GBK"
3759+ echo "zh_TW CP950" # not CP938 ??
3760+ # Korean
3761+ echo "kr CP949" # not CP934 ??
3762+ echo "kr_KR CP949" # not CP934 ??
3763+ # Thai
3764+ echo "th CP874"
3765+ echo "th_TH CP874"
3766+ # Other
3767+ echo "eo CP850"
3768+ echo "eo_EO CP850"
3769+ ;;
3770+esac
3771--- lrzsz-0.12.20.safe/intl/dcgettext.c 1998-04-26 09:22:36.000000000 -0400
3772+++ lrzsz-0.12.20/intl/dcgettext.c 2004-09-12 14:40:34.359747480 -0400
3773@@ -1,593 +1,56 @@
3774-/* Implementation of the dcgettext(3) function
3775- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3776+/* Implementation of the dcgettext(3) function.
3777+ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
3778
3779- This program is free software; you can redistribute it and/or modify
3780- it under the terms of the GNU General Public License as published by
3781- the Free Software Foundation; either version 2, or (at your option)
3782+ This program is free software; you can redistribute it and/or modify it
3783+ under the terms of the GNU Library General Public License as published
3784+ by the Free Software Foundation; either version 2, or (at your option)
3785 any later version.
3786
3787 This program is distributed in the hope that it will be useful,
3788 but WITHOUT ANY WARRANTY; without even the implied warranty of
3789- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3790- GNU General Public License for more details.
3791+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3792+ Library General Public License for more details.
3793
3794- You should have received a copy of the GNU General Public License
3795- along with this program; if not, write to the Free Software Foundation,
3796- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
3797+ You should have received a copy of the GNU Library General Public
3798+ License along with this program; if not, write to the Free Software
3799+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3800+ USA. */
3801
3802 #ifdef HAVE_CONFIG_H
3803 # include <config.h>
3804 #endif
3805
3806-#include <sys/types.h>
3807-
3808-#ifdef __GNUC__
3809-# define alloca __builtin_alloca
3810-# define HAVE_ALLOCA 1
3811-#else
3812-# if defined HAVE_ALLOCA_H || defined _LIBC
3813-# include <alloca.h>
3814-# else
3815-# ifdef _AIX
3816- #pragma alloca
3817-# else
3818-# ifndef alloca
3819-char *alloca ();
3820-# endif
3821-# endif
3822-# endif
3823-#endif
3824-
3825-#include <errno.h>
3826-#ifndef errno
3827-extern int errno;
3828-#endif
3829-#ifndef __set_errno
3830-# define __set_errno(val) errno = (val)
3831-#endif
3832-
3833-#if defined STDC_HEADERS || defined _LIBC
3834-# include <stdlib.h>
3835-#else
3836-char *getenv ();
3837-# ifdef HAVE_MALLOC_H
3838-# include <malloc.h>
3839-# else
3840-void free ();
3841-# endif
3842-#endif
3843-
3844-#if defined HAVE_STRING_H || defined _LIBC
3845-# ifndef _GNU_SOURCE
3846-# define _GNU_SOURCE 1
3847-# endif
3848-# include <string.h>
3849-#else
3850-# include <strings.h>
3851-#endif
3852-#if !HAVE_STRCHR && !defined _LIBC
3853-# ifndef strchr
3854-# define strchr index
3855-# endif
3856-#endif
3857-
3858-#if defined HAVE_UNISTD_H || defined _LIBC
3859-# include <unistd.h>
3860-#endif
3861-
3862-#include "gettext.h"
3863 #include "gettextP.h"
3864 #ifdef _LIBC
3865 # include <libintl.h>
3866 #else
3867-# include "libgettext.h"
3868+# include "libgnuintl.h"
3869 #endif
3870-#include "hash-string.h"
3871
3872 /* @@ end of prolog @@ */
3873
3874-#ifdef _LIBC
3875-/* Rename the non ANSI C functions. This is required by the standard
3876- because some ANSI C functions will require linking with this object
3877- file and the name space must not be polluted. */
3878-# define getcwd __getcwd
3879-# define stpcpy __stpcpy
3880-#else
3881-# if !defined HAVE_GETCWD
3882-char *getwd ();
3883-# define getcwd(buf, max) getwd (buf)
3884-# else
3885-char *getcwd ();
3886-# endif
3887-# ifndef HAVE_STPCPY
3888-static char *stpcpy PARAMS ((char *dest, const char *src));
3889-# endif
3890-#endif
3891-
3892-/* Amount to increase buffer size by in each try. */
3893-#define PATH_INCR 32
3894-
3895-/* The following is from pathmax.h. */
3896-/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
3897- PATH_MAX but might cause redefinition warnings when sys/param.h is
3898- later included (as on MORE/BSD 4.3). */
3899-#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
3900-# include <limits.h>
3901-#endif
3902-
3903-#ifndef _POSIX_PATH_MAX
3904-# define _POSIX_PATH_MAX 255
3905-#endif
3906-
3907-#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
3908-# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
3909-#endif
3910-
3911-/* Don't include sys/param.h if it already has been. */
3912-#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
3913-# include <sys/param.h>
3914-#endif
3915-
3916-#if !defined(PATH_MAX) && defined(MAXPATHLEN)
3917-# define PATH_MAX MAXPATHLEN
3918-#endif
3919-
3920-#ifndef PATH_MAX
3921-# define PATH_MAX _POSIX_PATH_MAX
3922-#endif
3923-
3924-/* XPG3 defines the result of `setlocale (category, NULL)' as:
3925- ``Directs `setlocale()' to query `category' and return the current
3926- setting of `local'.''
3927- However it does not specify the exact format. And even worse: POSIX
3928- defines this not at all. So we can use this feature only on selected
3929- system (e.g. those using GNU C Library). */
3930-#ifdef _LIBC
3931-# define HAVE_LOCALE_NULL
3932-#endif
3933-
3934-/* Name of the default domain used for gettext(3) prior any call to
3935- textdomain(3). The default value for this is "messages". */
3936-const char _nl_default_default_domain[] = "messages";
3937-
3938-/* Value used as the default domain for gettext(3). */
3939-const char *_nl_current_default_domain = _nl_default_default_domain;
3940-
3941-/* Contains the default location of the message catalogs. */
3942-const char _nl_default_dirname[] = GNULOCALEDIR;
3943-
3944-/* List with bindings of specific domains created by bindtextdomain()
3945- calls. */
3946-struct binding *_nl_domain_bindings;
3947-
3948-/* Prototypes for local functions. */
3949-static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
3950- const char *msgid));
3951-static const char *category_to_name PARAMS ((int category));
3952-static const char *guess_category_value PARAMS ((int category,
3953- const char *categoryname));
3954-
3955-
3956-/* For those loosing systems which don't have `alloca' we have to add
3957- some additional code emulating it. */
3958-#ifdef HAVE_ALLOCA
3959-/* Nothing has to be done. */
3960-# define ADD_BLOCK(list, address) /* nothing */
3961-# define FREE_BLOCKS(list) /* nothing */
3962-#else
3963-struct block_list
3964-{
3965- void *address;
3966- struct block_list *next;
3967-};
3968-# define ADD_BLOCK(list, addr) \
3969- do { \
3970- struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
3971- /* If we cannot get a free block we cannot add the new element to \
3972- the list. */ \
3973- if (newp != NULL) { \
3974- newp->address = (addr); \
3975- newp->next = (list); \
3976- (list) = newp; \
3977- } \
3978- } while (0)
3979-# define FREE_BLOCKS(list) \
3980- do { \
3981- while (list != NULL) { \
3982- struct block_list *old = list; \
3983- list = list->next; \
3984- free (old); \
3985- } \
3986- } while (0)
3987-# undef alloca
3988-# define alloca(size) (malloc (size))
3989-#endif /* have alloca */
3990-
3991-
3992 /* Names for the libintl functions are a problem. They must not clash
3993 with existing names and they should follow ANSI C. But this source
3994 code is also used in GNU C Library where the names have a __
3995 prefix. So we have to make a difference here. */
3996 #ifdef _LIBC
3997 # define DCGETTEXT __dcgettext
3998+# define DCIGETTEXT __dcigettext
3999 #else
4000-# define DCGETTEXT dcgettext__
4001+# define DCGETTEXT libintl_dcgettext
4002+# define DCIGETTEXT libintl_dcigettext
4003 #endif
4004
4005 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
4006 locale. */
4007 char *
4008-DCGETTEXT (domainname, msgid, category)
4009- const char *domainname;
4010- const char *msgid;
4011- int category;
4012+DCGETTEXT (const char *domainname, const char *msgid, int category)
4013 {
4014-#ifndef HAVE_ALLOCA
4015- struct block_list *block_list = NULL;
4016-#endif
4017- struct loaded_l10nfile *domain;
4018- struct binding *binding;
4019- const char *categoryname;
4020- const char *categoryvalue;
4021- char *dirname, *xdomainname;
4022- char *single_locale;
4023- char *retval;
4024- int saved_errno = errno;
4025-
4026- /* If no real MSGID is given return NULL. */
4027- if (msgid == NULL)
4028- return NULL;
4029-
4030- /* If DOMAINNAME is NULL, we are interested in the default domain. If
4031- CATEGORY is not LC_MESSAGES this might not make much sense but the
4032- defintion left this undefined. */
4033- if (domainname == NULL)
4034- domainname = _nl_current_default_domain;
4035-
4036- /* First find matching binding. */
4037- for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
4038- {
4039- int compare = strcmp (domainname, binding->domainname);
4040- if (compare == 0)
4041- /* We found it! */
4042- break;
4043- if (compare < 0)
4044- {
4045- /* It is not in the list. */
4046- binding = NULL;
4047- break;
4048- }
4049- }
4050-
4051- if (binding == NULL)
4052- dirname = (char *) _nl_default_dirname;
4053- else if (binding->dirname[0] == '/')
4054- dirname = binding->dirname;
4055- else
4056- {
4057- /* We have a relative path. Make it absolute now. */
4058- size_t dirname_len = strlen (binding->dirname) + 1;
4059- size_t path_max;
4060- char *ret;
4061-
4062- path_max = (unsigned) PATH_MAX;
4063- path_max += 2; /* The getcwd docs say to do this. */
4064-
4065- dirname = (char *) alloca (path_max + dirname_len);
4066- ADD_BLOCK (block_list, dirname);
4067-
4068- __set_errno (0);
4069- while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
4070- {
4071- path_max += PATH_INCR;
4072- dirname = (char *) alloca (path_max + dirname_len);
4073- ADD_BLOCK (block_list, dirname);
4074- __set_errno (0);
4075- }
4076-
4077- if (ret == NULL)
4078- {
4079- /* We cannot get the current working directory. Don't signal an
4080- error but simply return the default string. */
4081- FREE_BLOCKS (block_list);
4082- __set_errno (saved_errno);
4083- return (char *) msgid;
4084- }
4085-
4086- stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
4087- }
4088-
4089- /* Now determine the symbolic name of CATEGORY and its value. */
4090- categoryname = category_to_name (category);
4091- categoryvalue = guess_category_value (category, categoryname);
4092-
4093- xdomainname = (char *) alloca (strlen (categoryname)
4094- + strlen (domainname) + 5);
4095- ADD_BLOCK (block_list, xdomainname);
4096-
4097- stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
4098- domainname),
4099- ".mo");
4100-
4101- /* Creating working area. */
4102- single_locale = (char *) alloca (strlen (categoryvalue) + 1);
4103- ADD_BLOCK (block_list, single_locale);
4104-
4105-
4106- /* Search for the given string. This is a loop because we perhaps
4107- got an ordered list of languages to consider for th translation. */
4108- while (1)
4109- {
4110- /* Make CATEGORYVALUE point to the next element of the list. */
4111- while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
4112- ++categoryvalue;
4113- if (categoryvalue[0] == '\0')
4114- {
4115- /* The whole contents of CATEGORYVALUE has been searched but
4116- no valid entry has been found. We solve this situation
4117- by implicitly appending a "C" entry, i.e. no translation
4118- will take place. */
4119- single_locale[0] = 'C';
4120- single_locale[1] = '\0';
4121- }
4122- else
4123- {
4124- char *cp = single_locale;
4125- while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
4126- *cp++ = *categoryvalue++;
4127- *cp = '\0';
4128- }
4129-
4130- /* If the current locale value is C (or POSIX) we don't load a
4131- domain. Return the MSGID. */
4132- if (strcmp (single_locale, "C") == 0
4133- || strcmp (single_locale, "POSIX") == 0)
4134- {
4135- FREE_BLOCKS (block_list);
4136- __set_errno (saved_errno);
4137- return (char *) msgid;
4138- }
4139-
4140-
4141- /* Find structure describing the message catalog matching the
4142- DOMAINNAME and CATEGORY. */
4143- domain = _nl_find_domain (dirname, single_locale, xdomainname);
4144-
4145- if (domain != NULL)
4146- {
4147- retval = find_msg (domain, msgid);
4148-
4149- if (retval == NULL)
4150- {
4151- int cnt;
4152-
4153- for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
4154- {
4155- retval = find_msg (domain->successor[cnt], msgid);
4156-
4157- if (retval != NULL)
4158- break;
4159- }
4160- }
4161-
4162- if (retval != NULL)
4163- {
4164- FREE_BLOCKS (block_list);
4165- __set_errno (saved_errno);
4166- return retval;
4167- }
4168- }
4169- }
4170- /* NOTREACHED */
4171+ return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
4172 }
4173
4174 #ifdef _LIBC
4175 /* Alias for function name in GNU C Library. */
4176+INTDEF(__dcgettext)
4177 weak_alias (__dcgettext, dcgettext);
4178 #endif
4179-
4180-
4181-static char *
4182-find_msg (domain_file, msgid)
4183- struct loaded_l10nfile *domain_file;
4184- const char *msgid;
4185-{
4186- size_t top, act, bottom;
4187- struct loaded_domain *domain;
4188-
4189- if (domain_file->decided == 0)
4190- _nl_load_domain (domain_file);
4191-
4192- if (domain_file->data == NULL)
4193- return NULL;
4194-
4195- domain = (struct loaded_domain *) domain_file->data;
4196-
4197- /* Locate the MSGID and its translation. */
4198- if (domain->hash_size > 2 && domain->hash_tab != NULL)
4199- {
4200- /* Use the hashing table. */
4201- nls_uint32 len = strlen (msgid);
4202- nls_uint32 hash_val = hash_string (msgid);
4203- nls_uint32 idx = hash_val % domain->hash_size;
4204- nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
4205- nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
4206-
4207- if (nstr == 0)
4208- /* Hash table entry is empty. */
4209- return NULL;
4210-
4211- if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
4212- && strcmp (msgid,
4213- domain->data + W (domain->must_swap,
4214- domain->orig_tab[nstr - 1].offset)) == 0)
4215- return (char *) domain->data + W (domain->must_swap,
4216- domain->trans_tab[nstr - 1].offset);
4217-
4218- while (1)
4219- {
4220- if (idx >= domain->hash_size - incr)
4221- idx -= domain->hash_size - incr;
4222- else
4223- idx += incr;
4224-
4225- nstr = W (domain->must_swap, domain->hash_tab[idx]);
4226- if (nstr == 0)
4227- /* Hash table entry is empty. */
4228- return NULL;
4229-
4230- if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
4231- && strcmp (msgid,
4232- domain->data + W (domain->must_swap,
4233- domain->orig_tab[nstr - 1].offset))
4234- == 0)
4235- return (char *) domain->data
4236- + W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
4237- }
4238- /* NOTREACHED */
4239- }
4240-
4241- /* Now we try the default method: binary search in the sorted
4242- array of messages. */
4243- bottom = 0;
4244- top = domain->nstrings;
4245- while (bottom < top)
4246- {
4247- int cmp_val;
4248-
4249- act = (bottom + top) / 2;
4250- cmp_val = strcmp (msgid, domain->data
4251- + W (domain->must_swap,
4252- domain->orig_tab[act].offset));
4253- if (cmp_val < 0)
4254- top = act;
4255- else if (cmp_val > 0)
4256- bottom = act + 1;
4257- else
4258- break;
4259- }
4260-
4261- /* If an translation is found return this. */
4262- return bottom >= top ? NULL : (char *) domain->data
4263- + W (domain->must_swap,
4264- domain->trans_tab[act].offset);
4265-}
4266-
4267-
4268-/* Return string representation of locale CATEGORY. */
4269-static const char *
4270-category_to_name (category)
4271- int category;
4272-{
4273- const char *retval;
4274-
4275- switch (category)
4276- {
4277-#ifdef LC_COLLATE
4278- case LC_COLLATE:
4279- retval = "LC_COLLATE";
4280- break;
4281-#endif
4282-#ifdef LC_CTYPE
4283- case LC_CTYPE:
4284- retval = "LC_CTYPE";
4285- break;
4286-#endif
4287-#ifdef LC_MONETARY
4288- case LC_MONETARY:
4289- retval = "LC_MONETARY";
4290- break;
4291-#endif
4292-#ifdef LC_NUMERIC
4293- case LC_NUMERIC:
4294- retval = "LC_NUMERIC";
4295- break;
4296-#endif
4297-#ifdef LC_TIME
4298- case LC_TIME:
4299- retval = "LC_TIME";
4300- break;
4301-#endif
4302-#ifdef LC_MESSAGES
4303- case LC_MESSAGES:
4304- retval = "LC_MESSAGES";
4305- break;
4306-#endif
4307-#ifdef LC_RESPONSE
4308- case LC_RESPONSE:
4309- retval = "LC_RESPONSE";
4310- break;
4311-#endif
4312-#ifdef LC_ALL
4313- case LC_ALL:
4314- /* This might not make sense but is perhaps better than any other
4315- value. */
4316- retval = "LC_ALL";
4317- break;
4318-#endif
4319- default:
4320- /* If you have a better idea for a default value let me know. */
4321- retval = "LC_XXX";
4322- }
4323-
4324- return retval;
4325-}
4326-
4327-/* Guess value of current locale from value of the environment variables. */
4328-static const char *
4329-guess_category_value (category, categoryname)
4330- int category;
4331- const char *categoryname;
4332-{
4333- const char *retval;
4334-
4335- /* The highest priority value is the `LANGUAGE' environment
4336- variable. This is a GNU extension. */
4337- retval = getenv ("LANGUAGE");
4338- if (retval != NULL && retval[0] != '\0')
4339- return retval;
4340-
4341- /* `LANGUAGE' is not set. So we have to proceed with the POSIX
4342- methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
4343- systems this can be done by the `setlocale' function itself. */
4344-#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
4345- return setlocale (category, NULL);
4346-#else
4347- /* Setting of LC_ALL overwrites all other. */
4348- retval = getenv ("LC_ALL");
4349- if (retval != NULL && retval[0] != '\0')
4350- return retval;
4351-
4352- /* Next comes the name of the desired category. */
4353- retval = getenv (categoryname);
4354- if (retval != NULL && retval[0] != '\0')
4355- return retval;
4356-
4357- /* Last possibility is the LANG environment variable. */
4358- retval = getenv ("LANG");
4359- if (retval != NULL && retval[0] != '\0')
4360- return retval;
4361-
4362- /* We use C as the default domain. POSIX says this is implementation
4363- defined. */
4364- return "C";
4365-#endif
4366-}
4367-
4368-/* @@ begin of epilog @@ */
4369-
4370-/* We don't want libintl.a to depend on any other library. So we
4371- avoid the non-standard function stpcpy. In GNU C Library this
4372- function is available, though. Also allow the symbol HAVE_STPCPY
4373- to be defined. */
4374-#if !_LIBC && !HAVE_STPCPY
4375-static char *
4376-stpcpy (dest, src)
4377- char *dest;
4378- const char *src;
4379-{
4380- while ((*dest++ = *src++) != '\0')
4381- /* Do nothing. */ ;
4382- return dest - 1;
4383-}
4384-#endif
4385--- lrzsz-0.12.20.safe/intl/dcigettext.c 1969-12-31 19:00:00.000000000 -0500
4386+++ lrzsz-0.12.20/intl/dcigettext.c 2004-09-12 14:40:34.369745960 -0400
4387@@ -0,0 +1,1219 @@
4388+/* Implementation of the internal dcigettext function.
4389+ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
4390+
4391+ This program is free software; you can redistribute it and/or modify it
4392+ under the terms of the GNU Library General Public License as published
4393+ by the Free Software Foundation; either version 2, or (at your option)
4394+ any later version.
4395+
4396+ This program is distributed in the hope that it will be useful,
4397+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4398+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4399+ Library General Public License for more details.
4400+
4401+ You should have received a copy of the GNU Library General Public
4402+ License along with this program; if not, write to the Free Software
4403+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4404+ USA. */
4405+
4406+/* Tell glibc's <string.h> to provide a prototype for mempcpy().
4407+ This must come before <config.h> because <config.h> may include
4408+ <features.h>, and once <features.h> has been included, it's too late. */
4409+#ifndef _GNU_SOURCE
4410+# define _GNU_SOURCE 1
4411+#endif
4412+
4413+#ifdef HAVE_CONFIG_H
4414+# include <config.h>
4415+#endif
4416+
4417+#include <sys/types.h>
4418+
4419+#ifdef __GNUC__
4420+# define alloca __builtin_alloca
4421+# define HAVE_ALLOCA 1
4422+#else
4423+# ifdef _MSC_VER
4424+# include <malloc.h>
4425+# define alloca _alloca
4426+# else
4427+# if defined HAVE_ALLOCA_H || defined _LIBC
4428+# include <alloca.h>
4429+# else
4430+# ifdef _AIX
4431+ #pragma alloca
4432+# else
4433+# ifndef alloca
4434+char *alloca ();
4435+# endif
4436+# endif
4437+# endif
4438+# endif
4439+#endif
4440+
4441+#include <errno.h>
4442+#ifndef errno
4443+extern int errno;
4444+#endif
4445+#ifndef __set_errno
4446+# define __set_errno(val) errno = (val)
4447+#endif
4448+
4449+#include <stddef.h>
4450+#include <stdlib.h>
4451+#include <string.h>
4452+
4453+#if defined HAVE_UNISTD_H || defined _LIBC
4454+# include <unistd.h>
4455+#endif
4456+
4457+#include <locale.h>
4458+
4459+#ifdef _LIBC
4460+ /* Guess whether integer division by zero raises signal SIGFPE.
4461+ Set to 1 only if you know for sure. In case of doubt, set to 0. */
4462+# if defined __alpha__ || defined __arm__ || defined __i386__ \
4463+ || defined __m68k__ || defined __s390__
4464+# define INTDIV0_RAISES_SIGFPE 1
4465+# else
4466+# define INTDIV0_RAISES_SIGFPE 0
4467+# endif
4468+#endif
4469+#if !INTDIV0_RAISES_SIGFPE
4470+# include <signal.h>
4471+#endif
4472+
4473+#if defined HAVE_SYS_PARAM_H || defined _LIBC
4474+# include <sys/param.h>
4475+#endif
4476+
4477+#include "gettextP.h"
4478+#include "plural-exp.h"
4479+#ifdef _LIBC
4480+# include <libintl.h>
4481+#else
4482+# include "libgnuintl.h"
4483+#endif
4484+#include "hash-string.h"
4485+
4486+/* Thread safetyness. */
4487+#ifdef _LIBC
4488+# include <bits/libc-lock.h>
4489+#else
4490+/* Provide dummy implementation if this is outside glibc. */
4491+# define __libc_lock_define_initialized(CLASS, NAME)
4492+# define __libc_lock_lock(NAME)
4493+# define __libc_lock_unlock(NAME)
4494+# define __libc_rwlock_define_initialized(CLASS, NAME)
4495+# define __libc_rwlock_rdlock(NAME)
4496+# define __libc_rwlock_unlock(NAME)
4497+#endif
4498+
4499+/* Alignment of types. */
4500+#if defined __GNUC__ && __GNUC__ >= 2
4501+# define alignof(TYPE) __alignof__ (TYPE)
4502+#else
4503+# define alignof(TYPE) \
4504+ ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
4505+#endif
4506+
4507+/* The internal variables in the standalone libintl.a must have different
4508+ names than the internal variables in GNU libc, otherwise programs
4509+ using libintl.a cannot be linked statically. */
4510+#if !defined _LIBC
4511+# define _nl_default_default_domain libintl_nl_default_default_domain
4512+# define _nl_current_default_domain libintl_nl_current_default_domain
4513+# define _nl_default_dirname libintl_nl_default_dirname
4514+# define _nl_domain_bindings libintl_nl_domain_bindings
4515+#endif
4516+
4517+/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
4518+#ifndef offsetof
4519+# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
4520+#endif
4521+
4522+/* @@ end of prolog @@ */
4523+
4524+#ifdef _LIBC
4525+/* Rename the non ANSI C functions. This is required by the standard
4526+ because some ANSI C functions will require linking with this object
4527+ file and the name space must not be polluted. */
4528+# define getcwd __getcwd
4529+# ifndef stpcpy
4530+# define stpcpy __stpcpy
4531+# endif
4532+# define tfind __tfind
4533+#else
4534+# if !defined HAVE_GETCWD
4535+char *getwd ();
4536+# define getcwd(buf, max) getwd (buf)
4537+# else
4538+# if VMS
4539+# define getcwd(buf, max) (getcwd) (buf, max, 0)
4540+# else
4541+char *getcwd ();
4542+# endif
4543+# endif
4544+# ifndef HAVE_STPCPY
4545+static char *stpcpy (char *dest, const char *src);
4546+# endif
4547+# ifndef HAVE_MEMPCPY
4548+static void *mempcpy (void *dest, const void *src, size_t n);
4549+# endif
4550+#endif
4551+
4552+/* Amount to increase buffer size by in each try. */
4553+#define PATH_INCR 32
4554+
4555+/* The following is from pathmax.h. */
4556+/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
4557+ PATH_MAX but might cause redefinition warnings when sys/param.h is
4558+ later included (as on MORE/BSD 4.3). */
4559+#if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__)
4560+# include <limits.h>
4561+#endif
4562+
4563+#ifndef _POSIX_PATH_MAX
4564+# define _POSIX_PATH_MAX 255
4565+#endif
4566+
4567+#if !defined PATH_MAX && defined _PC_PATH_MAX
4568+# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
4569+#endif
4570+
4571+/* Don't include sys/param.h if it already has been. */
4572+#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
4573+# include <sys/param.h>
4574+#endif
4575+
4576+#if !defined PATH_MAX && defined MAXPATHLEN
4577+# define PATH_MAX MAXPATHLEN
4578+#endif
4579+
4580+#ifndef PATH_MAX
4581+# define PATH_MAX _POSIX_PATH_MAX
4582+#endif
4583+
4584+/* Pathname support.
4585+ ISSLASH(C) tests whether C is a directory separator character.
4586+ IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
4587+ it may be concatenated to a directory pathname.
4588+ IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
4589+ */
4590+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
4591+ /* Win32, OS/2, DOS */
4592+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
4593+# define HAS_DEVICE(P) \
4594+ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
4595+ && (P)[1] == ':')
4596+# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
4597+# define IS_PATH_WITH_DIR(P) \
4598+ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
4599+#else
4600+ /* Unix */
4601+# define ISSLASH(C) ((C) == '/')
4602+# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
4603+# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
4604+#endif
4605+
4606+/* This is the type used for the search tree where known translations
4607+ are stored. */
4608+struct known_translation_t
4609+{
4610+ /* Domain in which to search. */
4611+ char *domainname;
4612+
4613+ /* The category. */
4614+ int category;
4615+
4616+ /* State of the catalog counter at the point the string was found. */
4617+ int counter;
4618+
4619+ /* Catalog where the string was found. */
4620+ struct loaded_l10nfile *domain;
4621+
4622+ /* And finally the translation. */
4623+ const char *translation;
4624+ size_t translation_length;
4625+
4626+ /* Pointer to the string in question. */
4627+ char msgid[ZERO];
4628+};
4629+
4630+/* Root of the search tree with known translations. We can use this
4631+ only if the system provides the `tsearch' function family. */
4632+#if defined HAVE_TSEARCH || defined _LIBC
4633+# include <search.h>
4634+
4635+static void *root;
4636+
4637+# ifdef _LIBC
4638+# define tsearch __tsearch
4639+# endif
4640+
4641+/* Function to compare two entries in the table of known translations. */
4642+static int
4643+transcmp (const void *p1, const void *p2)
4644+{
4645+ const struct known_translation_t *s1;
4646+ const struct known_translation_t *s2;
4647+ int result;
4648+
4649+ s1 = (const struct known_translation_t *) p1;
4650+ s2 = (const struct known_translation_t *) p2;
4651+
4652+ result = strcmp (s1->msgid, s2->msgid);
4653+ if (result == 0)
4654+ {
4655+ result = strcmp (s1->domainname, s2->domainname);
4656+ if (result == 0)
4657+ /* We compare the category last (though this is the cheapest
4658+ operation) since it is hopefully always the same (namely
4659+ LC_MESSAGES). */
4660+ result = s1->category - s2->category;
4661+ }
4662+
4663+ return result;
4664+}
4665+#endif
4666+
4667+#ifndef INTVARDEF
4668+# define INTVARDEF(name)
4669+#endif
4670+#ifndef INTUSE
4671+# define INTUSE(name) name
4672+#endif
4673+
4674+/* Name of the default domain used for gettext(3) prior any call to
4675+ textdomain(3). The default value for this is "messages". */
4676+const char _nl_default_default_domain[] attribute_hidden = "messages";
4677+
4678+/* Value used as the default domain for gettext(3). */
4679+const char *_nl_current_default_domain attribute_hidden
4680+ = _nl_default_default_domain;
4681+
4682+/* Contains the default location of the message catalogs. */
4683+#if defined __EMX__
4684+extern const char _nl_default_dirname[];
4685+#else
4686+const char _nl_default_dirname[] = LOCALEDIR;
4687+INTVARDEF (_nl_default_dirname)
4688+#endif
4689+
4690+/* List with bindings of specific domains created by bindtextdomain()
4691+ calls. */
4692+struct binding *_nl_domain_bindings;
4693+
4694+/* Prototypes for local functions. */
4695+static char *plural_lookup (struct loaded_l10nfile *domain,
4696+ unsigned long int n,
4697+ const char *translation, size_t translation_len)
4698+ internal_function;
4699+static const char *guess_category_value (int category,
4700+ const char *categoryname)
4701+ internal_function;
4702+#ifdef _LIBC
4703+# include "../locale/localeinfo.h"
4704+# define category_to_name(category) _nl_category_names[category]
4705+#else
4706+static const char *category_to_name (int category) internal_function;
4707+#endif
4708+
4709+
4710+/* For those loosing systems which don't have `alloca' we have to add
4711+ some additional code emulating it. */
4712+#ifdef HAVE_ALLOCA
4713+/* Nothing has to be done. */
4714+# define freea(p) /* nothing */
4715+# define ADD_BLOCK(list, address) /* nothing */
4716+# define FREE_BLOCKS(list) /* nothing */
4717+#else
4718+struct block_list
4719+{
4720+ void *address;
4721+ struct block_list *next;
4722+};
4723+# define ADD_BLOCK(list, addr) \
4724+ do { \
4725+ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
4726+ /* If we cannot get a free block we cannot add the new element to \
4727+ the list. */ \
4728+ if (newp != NULL) { \
4729+ newp->address = (addr); \
4730+ newp->next = (list); \
4731+ (list) = newp; \
4732+ } \
4733+ } while (0)
4734+# define FREE_BLOCKS(list) \
4735+ do { \
4736+ while (list != NULL) { \
4737+ struct block_list *old = list; \
4738+ list = list->next; \
4739+ free (old->address); \
4740+ free (old); \
4741+ } \
4742+ } while (0)
4743+# undef alloca
4744+# define alloca(size) (malloc (size))
4745+# define freea(p) free (p)
4746+#endif /* have alloca */
4747+
4748+
4749+#ifdef _LIBC
4750+/* List of blocks allocated for translations. */
4751+typedef struct transmem_list
4752+{
4753+ struct transmem_list *next;
4754+ char data[ZERO];
4755+} transmem_block_t;
4756+static struct transmem_list *transmem_list;
4757+#else
4758+typedef unsigned char transmem_block_t;
4759+#endif
4760+
4761+
4762+/* Names for the libintl functions are a problem. They must not clash
4763+ with existing names and they should follow ANSI C. But this source
4764+ code is also used in GNU C Library where the names have a __
4765+ prefix. So we have to make a difference here. */
4766+#ifdef _LIBC
4767+# define DCIGETTEXT __dcigettext
4768+#else
4769+# define DCIGETTEXT libintl_dcigettext
4770+#endif
4771+
4772+/* Lock variable to protect the global data in the gettext implementation. */
4773+#ifdef _LIBC
4774+__libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden)
4775+#endif
4776+
4777+/* Checking whether the binaries runs SUID must be done and glibc provides
4778+ easier methods therefore we make a difference here. */
4779+#ifdef _LIBC
4780+# define ENABLE_SECURE __libc_enable_secure
4781+# define DETERMINE_SECURE
4782+#else
4783+# ifndef HAVE_GETUID
4784+# define getuid() 0
4785+# endif
4786+# ifndef HAVE_GETGID
4787+# define getgid() 0
4788+# endif
4789+# ifndef HAVE_GETEUID
4790+# define geteuid() getuid()
4791+# endif
4792+# ifndef HAVE_GETEGID
4793+# define getegid() getgid()
4794+# endif
4795+static int enable_secure;
4796+# define ENABLE_SECURE (enable_secure == 1)
4797+# define DETERMINE_SECURE \
4798+ if (enable_secure == 0) \
4799+ { \
4800+ if (getuid () != geteuid () || getgid () != getegid ()) \
4801+ enable_secure = 1; \
4802+ else \
4803+ enable_secure = -1; \
4804+ }
4805+#endif
4806+
4807+/* Get the function to evaluate the plural expression. */
4808+#include "eval-plural.h"
4809+
4810+/* Look up MSGID in the DOMAINNAME message catalog for the current
4811+ CATEGORY locale and, if PLURAL is nonzero, search over string
4812+ depending on the plural form determined by N. */
4813+char *
4814+DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
4815+ int plural, unsigned long int n, int category)
4816+{
4817+#ifndef HAVE_ALLOCA
4818+ struct block_list *block_list = NULL;
4819+#endif
4820+ struct loaded_l10nfile *domain;
4821+ struct binding *binding;
4822+ const char *categoryname;
4823+ const char *categoryvalue;
4824+ char *dirname, *xdomainname;
4825+ char *single_locale;
4826+ char *retval;
4827+ size_t retlen;
4828+ int saved_errno;
4829+#if defined HAVE_TSEARCH || defined _LIBC
4830+ struct known_translation_t *search;
4831+ struct known_translation_t **foundp = NULL;
4832+ size_t msgid_len;
4833+#endif
4834+ size_t domainname_len;
4835+
4836+ /* If no real MSGID is given return NULL. */
4837+ if (msgid1 == NULL)
4838+ return NULL;
4839+
4840+#ifdef _LIBC
4841+ if (category < 0 || category >= __LC_LAST || category == LC_ALL)
4842+ /* Bogus. */
4843+ return (plural == 0
4844+ ? (char *) msgid1
4845+ /* Use the Germanic plural rule. */
4846+ : n == 1 ? (char *) msgid1 : (char *) msgid2);
4847+#endif
4848+
4849+ __libc_rwlock_rdlock (_nl_state_lock);
4850+
4851+ /* If DOMAINNAME is NULL, we are interested in the default domain. If
4852+ CATEGORY is not LC_MESSAGES this might not make much sense but the
4853+ definition left this undefined. */
4854+ if (domainname == NULL)
4855+ domainname = _nl_current_default_domain;
4856+
4857+ /* OS/2 specific: backward compatibility with older libintl versions */
4858+#ifdef LC_MESSAGES_COMPAT
4859+ if (category == LC_MESSAGES_COMPAT)
4860+ category = LC_MESSAGES;
4861+#endif
4862+
4863+#if defined HAVE_TSEARCH || defined _LIBC
4864+ msgid_len = strlen (msgid1) + 1;
4865+
4866+ /* Try to find the translation among those which we found at
4867+ some time. */
4868+ search = (struct known_translation_t *)
4869+ alloca (offsetof (struct known_translation_t, msgid) + msgid_len);
4870+ memcpy (search->msgid, msgid1, msgid_len);
4871+ search->domainname = (char *) domainname;
4872+ search->category = category;
4873+
4874+ foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
4875+ freea (search);
4876+ if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
4877+ {
4878+ /* Now deal with plural. */
4879+ if (plural)
4880+ retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation,
4881+ (*foundp)->translation_length);
4882+ else
4883+ retval = (char *) (*foundp)->translation;
4884+
4885+ __libc_rwlock_unlock (_nl_state_lock);
4886+ return retval;
4887+ }
4888+#endif
4889+
4890+ /* Preserve the `errno' value. */
4891+ saved_errno = errno;
4892+
4893+ /* See whether this is a SUID binary or not. */
4894+ DETERMINE_SECURE;
4895+
4896+ /* First find matching binding. */
4897+ for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
4898+ {
4899+ int compare = strcmp (domainname, binding->domainname);
4900+ if (compare == 0)
4901+ /* We found it! */
4902+ break;
4903+ if (compare < 0)
4904+ {
4905+ /* It is not in the list. */
4906+ binding = NULL;
4907+ break;
4908+ }
4909+ }
4910+
4911+ if (binding == NULL)
4912+ dirname = (char *) INTUSE(_nl_default_dirname);
4913+ else if (IS_ABSOLUTE_PATH (binding->dirname))
4914+ dirname = binding->dirname;
4915+ else
4916+ {
4917+ /* We have a relative path. Make it absolute now. */
4918+ size_t dirname_len = strlen (binding->dirname) + 1;
4919+ size_t path_max;
4920+ char *ret;
4921+
4922+ path_max = (unsigned int) PATH_MAX;
4923+ path_max += 2; /* The getcwd docs say to do this. */
4924+
4925+ for (;;)
4926+ {
4927+ dirname = (char *) alloca (path_max + dirname_len);
4928+ ADD_BLOCK (block_list, dirname);
4929+
4930+ __set_errno (0);
4931+ ret = getcwd (dirname, path_max);
4932+ if (ret != NULL || errno != ERANGE)
4933+ break;
4934+
4935+ path_max += path_max / 2;
4936+ path_max += PATH_INCR;
4937+ }
4938+
4939+ if (ret == NULL)
4940+ /* We cannot get the current working directory. Don't signal an
4941+ error but simply return the default string. */
4942+ goto return_untranslated;
4943+
4944+ stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
4945+ }
4946+
4947+ /* Now determine the symbolic name of CATEGORY and its value. */
4948+ categoryname = category_to_name (category);
4949+ categoryvalue = guess_category_value (category, categoryname);
4950+
4951+ domainname_len = strlen (domainname);
4952+ xdomainname = (char *) alloca (strlen (categoryname)
4953+ + domainname_len + 5);
4954+ ADD_BLOCK (block_list, xdomainname);
4955+
4956+ stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
4957+ domainname, domainname_len),
4958+ ".mo");
4959+
4960+ /* Creating working area. */
4961+ single_locale = (char *) alloca (strlen (categoryvalue) + 1);
4962+ ADD_BLOCK (block_list, single_locale);
4963+
4964+
4965+ /* Search for the given string. This is a loop because we perhaps
4966+ got an ordered list of languages to consider for the translation. */
4967+ while (1)
4968+ {
4969+ /* Make CATEGORYVALUE point to the next element of the list. */
4970+ while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
4971+ ++categoryvalue;
4972+ if (categoryvalue[0] == '\0')
4973+ {
4974+ /* The whole contents of CATEGORYVALUE has been searched but
4975+ no valid entry has been found. We solve this situation
4976+ by implicitly appending a "C" entry, i.e. no translation
4977+ will take place. */
4978+ single_locale[0] = 'C';
4979+ single_locale[1] = '\0';
4980+ }
4981+ else
4982+ {
4983+ char *cp = single_locale;
4984+ while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
4985+ *cp++ = *categoryvalue++;
4986+ *cp = '\0';
4987+
4988+ /* When this is a SUID binary we must not allow accessing files
4989+ outside the dedicated directories. */
4990+ if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale))
4991+ /* Ingore this entry. */
4992+ continue;
4993+ }
4994+
4995+ /* If the current locale value is C (or POSIX) we don't load a
4996+ domain. Return the MSGID. */
4997+ if (strcmp (single_locale, "C") == 0
4998+ || strcmp (single_locale, "POSIX") == 0)
4999+ break;
5000+
5001+ /* Find structure describing the message catalog matching the
5002+ DOMAINNAME and CATEGORY. */
5003+ domain = _nl_find_domain (dirname, single_locale, xdomainname, binding);
5004+
5005+ if (domain != NULL)
5006+ {
5007+ retval = _nl_find_msg (domain, binding, msgid1, &retlen);
5008+
5009+ if (retval == NULL)
5010+ {
5011+ int cnt;
5012+
5013+ for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
5014+ {
5015+ retval = _nl_find_msg (domain->successor[cnt], binding,
5016+ msgid1, &retlen);
5017+
5018+ if (retval != NULL)
5019+ {
5020+ domain = domain->successor[cnt];
5021+ break;
5022+ }
5023+ }
5024+ }
5025+
5026+ if (retval != NULL)
5027+ {
5028+ /* Found the translation of MSGID1 in domain DOMAIN:
5029+ starting at RETVAL, RETLEN bytes. */
5030+ FREE_BLOCKS (block_list);
5031+#if defined HAVE_TSEARCH || defined _LIBC
5032+ if (foundp == NULL)
5033+ {
5034+ /* Create a new entry and add it to the search tree. */
5035+ struct known_translation_t *newp;
5036+
5037+ newp = (struct known_translation_t *)
5038+ malloc (offsetof (struct known_translation_t, msgid)
5039+ + msgid_len + domainname_len + 1);
5040+ if (newp != NULL)
5041+ {
5042+ newp->domainname =
5043+ mempcpy (newp->msgid, msgid1, msgid_len);
5044+ memcpy (newp->domainname, domainname, domainname_len + 1);
5045+ newp->category = category;
5046+ newp->counter = _nl_msg_cat_cntr;
5047+ newp->domain = domain;
5048+ newp->translation = retval;
5049+ newp->translation_length = retlen;
5050+
5051+ /* Insert the entry in the search tree. */
5052+ foundp = (struct known_translation_t **)
5053+ tsearch (newp, &root, transcmp);
5054+ if (foundp == NULL
5055+ || __builtin_expect (*foundp != newp, 0))
5056+ /* The insert failed. */
5057+ free (newp);
5058+ }
5059+ }
5060+ else
5061+ {
5062+ /* We can update the existing entry. */
5063+ (*foundp)->counter = _nl_msg_cat_cntr;
5064+ (*foundp)->domain = domain;
5065+ (*foundp)->translation = retval;
5066+ (*foundp)->translation_length = retlen;
5067+ }
5068+#endif
5069+ __set_errno (saved_errno);
5070+
5071+ /* Now deal with plural. */
5072+ if (plural)
5073+ retval = plural_lookup (domain, n, retval, retlen);
5074+
5075+ __libc_rwlock_unlock (_nl_state_lock);
5076+ return retval;
5077+ }
5078+ }
5079+ }
5080+
5081+ return_untranslated:
5082+ /* Return the untranslated MSGID. */
5083+ FREE_BLOCKS (block_list);
5084+ __libc_rwlock_unlock (_nl_state_lock);
5085+#ifndef _LIBC
5086+ if (!ENABLE_SECURE)
5087+ {
5088+ extern void _nl_log_untranslated (const char *logfilename,
5089+ const char *domainname,
5090+ const char *msgid1, const char *msgid2,
5091+ int plural);
5092+ const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED");
5093+
5094+ if (logfilename != NULL && logfilename[0] != '\0')
5095+ _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural);
5096+ }
5097+#endif
5098+ __set_errno (saved_errno);
5099+ return (plural == 0
5100+ ? (char *) msgid1
5101+ /* Use the Germanic plural rule. */
5102+ : n == 1 ? (char *) msgid1 : (char *) msgid2);
5103+}
5104+
5105+
5106+char *
5107+internal_function
5108+_nl_find_msg (struct loaded_l10nfile *domain_file,
5109+ struct binding *domainbinding, const char *msgid,
5110+ size_t *lengthp)
5111+{
5112+ struct loaded_domain *domain;
5113+ nls_uint32 nstrings;
5114+ size_t act;
5115+ char *result;
5116+ size_t resultlen;
5117+
5118+ if (domain_file->decided == 0)
5119+ _nl_load_domain (domain_file, domainbinding);
5120+
5121+ if (domain_file->data == NULL)
5122+ return NULL;
5123+
5124+ domain = (struct loaded_domain *) domain_file->data;
5125+
5126+ nstrings = domain->nstrings;
5127+
5128+ /* Locate the MSGID and its translation. */
5129+ if (domain->hash_tab != NULL)
5130+ {
5131+ /* Use the hashing table. */
5132+ nls_uint32 len = strlen (msgid);
5133+ nls_uint32 hash_val = hash_string (msgid);
5134+ nls_uint32 idx = hash_val % domain->hash_size;
5135+ nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
5136+
5137+ while (1)
5138+ {
5139+ nls_uint32 nstr =
5140+ W (domain->must_swap_hash_tab, domain->hash_tab[idx]);
5141+
5142+ if (nstr == 0)
5143+ /* Hash table entry is empty. */
5144+ return NULL;
5145+
5146+ nstr--;
5147+
5148+ /* Compare msgid with the original string at index nstr.
5149+ We compare the lengths with >=, not ==, because plural entries
5150+ are represented by strings with an embedded NUL. */
5151+ if (nstr < nstrings
5152+ ? W (domain->must_swap, domain->orig_tab[nstr].length) >= len
5153+ && (strcmp (msgid,
5154+ domain->data + W (domain->must_swap,
5155+ domain->orig_tab[nstr].offset))
5156+ == 0)
5157+ : domain->orig_sysdep_tab[nstr - nstrings].length > len
5158+ && (strcmp (msgid,
5159+ domain->orig_sysdep_tab[nstr - nstrings].pointer)
5160+ == 0))
5161+ {
5162+ act = nstr;
5163+ goto found;
5164+ }
5165+
5166+ if (idx >= domain->hash_size - incr)
5167+ idx -= domain->hash_size - incr;
5168+ else
5169+ idx += incr;
5170+ }
5171+ /* NOTREACHED */
5172+ }
5173+ else
5174+ {
5175+ /* Try the default method: binary search in the sorted array of
5176+ messages. */
5177+ size_t top, bottom;
5178+
5179+ bottom = 0;
5180+ top = nstrings;
5181+ while (bottom < top)
5182+ {
5183+ int cmp_val;
5184+
5185+ act = (bottom + top) / 2;
5186+ cmp_val = strcmp (msgid, (domain->data
5187+ + W (domain->must_swap,
5188+ domain->orig_tab[act].offset)));
5189+ if (cmp_val < 0)
5190+ top = act;
5191+ else if (cmp_val > 0)
5192+ bottom = act + 1;
5193+ else
5194+ goto found;
5195+ }
5196+ /* No translation was found. */
5197+ return NULL;
5198+ }
5199+
5200+ found:
5201+ /* The translation was found at index ACT. If we have to convert the
5202+ string to use a different character set, this is the time. */
5203+ if (act < nstrings)
5204+ {
5205+ result = (char *)
5206+ (domain->data + W (domain->must_swap, domain->trans_tab[act].offset));
5207+ resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1;
5208+ }
5209+ else
5210+ {
5211+ result = (char *) domain->trans_sysdep_tab[act - nstrings].pointer;
5212+ resultlen = domain->trans_sysdep_tab[act - nstrings].length;
5213+ }
5214+
5215+#if defined _LIBC || HAVE_ICONV
5216+ if (domain->codeset_cntr
5217+ != (domainbinding != NULL ? domainbinding->codeset_cntr : 0))
5218+ {
5219+ /* The domain's codeset has changed through bind_textdomain_codeset()
5220+ since the message catalog was initialized or last accessed. We
5221+ have to reinitialize the converter. */
5222+ _nl_free_domain_conv (domain);
5223+ _nl_init_domain_conv (domain_file, domain, domainbinding);
5224+ }
5225+
5226+ if (
5227+# ifdef _LIBC
5228+ domain->conv != (__gconv_t) -1
5229+# else
5230+# if HAVE_ICONV
5231+ domain->conv != (iconv_t) -1
5232+# endif
5233+# endif
5234+ )
5235+ {
5236+ /* We are supposed to do a conversion. First allocate an
5237+ appropriate table with the same structure as the table
5238+ of translations in the file, where we can put the pointers
5239+ to the converted strings in.
5240+ There is a slight complication with plural entries. They
5241+ are represented by consecutive NUL terminated strings. We
5242+ handle this case by converting RESULTLEN bytes, including
5243+ NULs. */
5244+
5245+ if (domain->conv_tab == NULL
5246+ && ((domain->conv_tab =
5247+ (char **) calloc (nstrings + domain->n_sysdep_strings,
5248+ sizeof (char *)))
5249+ == NULL))
5250+ /* Mark that we didn't succeed allocating a table. */
5251+ domain->conv_tab = (char **) -1;
5252+
5253+ if (__builtin_expect (domain->conv_tab == (char **) -1, 0))
5254+ /* Nothing we can do, no more memory. */
5255+ goto converted;
5256+
5257+ if (domain->conv_tab[act] == NULL)
5258+ {
5259+ /* We haven't used this string so far, so it is not
5260+ translated yet. Do this now. */
5261+ /* We use a bit more efficient memory handling.
5262+ We allocate always larger blocks which get used over
5263+ time. This is faster than many small allocations. */
5264+ __libc_lock_define_initialized (static, lock)
5265+# define INITIAL_BLOCK_SIZE 4080
5266+ static unsigned char *freemem;
5267+ static size_t freemem_size;
5268+
5269+ const unsigned char *inbuf;
5270+ unsigned char *outbuf;
5271+ int malloc_count;
5272+# ifndef _LIBC
5273+ transmem_block_t *transmem_list = NULL;
5274+# endif
5275+
5276+ __libc_lock_lock (lock);
5277+
5278+ inbuf = (const unsigned char *) result;
5279+ outbuf = freemem + sizeof (size_t);
5280+
5281+ malloc_count = 0;
5282+ while (1)
5283+ {
5284+ transmem_block_t *newmem;
5285+# ifdef _LIBC
5286+ size_t non_reversible;
5287+ int res;
5288+
5289+ if (freemem_size < sizeof (size_t))
5290+ goto resize_freemem;
5291+
5292+ res = __gconv (domain->conv,
5293+ &inbuf, inbuf + resultlen,
5294+ &outbuf,
5295+ outbuf + freemem_size - sizeof (size_t),
5296+ &non_reversible);
5297+
5298+ if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
5299+ break;
5300+
5301+ if (res != __GCONV_FULL_OUTPUT)
5302+ {
5303+ __libc_lock_unlock (lock);
5304+ goto converted;
5305+ }
5306+
5307+ inbuf = result;
5308+# else
5309+# if HAVE_ICONV
5310+ const char *inptr = (const char *) inbuf;
5311+ size_t inleft = resultlen;
5312+ char *outptr = (char *) outbuf;
5313+ size_t outleft;
5314+
5315+ if (freemem_size < sizeof (size_t))
5316+ goto resize_freemem;
5317+
5318+ outleft = freemem_size - sizeof (size_t);
5319+ if (iconv (domain->conv,
5320+ (ICONV_CONST char **) &inptr, &inleft,
5321+ &outptr, &outleft)
5322+ != (size_t) (-1))
5323+ {
5324+ outbuf = (unsigned char *) outptr;
5325+ break;
5326+ }
5327+ if (errno != E2BIG)
5328+ {
5329+ __libc_lock_unlock (lock);
5330+ goto converted;
5331+ }
5332+# endif
5333+# endif
5334+
5335+ resize_freemem:
5336+ /* We must allocate a new buffer or resize the old one. */
5337+ if (malloc_count > 0)
5338+ {
5339+ ++malloc_count;
5340+ freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
5341+ newmem = (transmem_block_t *) realloc (transmem_list,
5342+ freemem_size);
5343+# ifdef _LIBC
5344+ if (newmem != NULL)
5345+ transmem_list = transmem_list->next;
5346+ else
5347+ {
5348+ struct transmem_list *old = transmem_list;
5349+
5350+ transmem_list = transmem_list->next;
5351+ free (old);
5352+ }
5353+# endif
5354+ }
5355+ else
5356+ {
5357+ malloc_count = 1;
5358+ freemem_size = INITIAL_BLOCK_SIZE;
5359+ newmem = (transmem_block_t *) malloc (freemem_size);
5360+ }
5361+ if (__builtin_expect (newmem == NULL, 0))
5362+ {
5363+ freemem = NULL;
5364+ freemem_size = 0;
5365+ __libc_lock_unlock (lock);
5366+ goto converted;
5367+ }
5368+
5369+# ifdef _LIBC
5370+ /* Add the block to the list of blocks we have to free
5371+ at some point. */
5372+ newmem->next = transmem_list;
5373+ transmem_list = newmem;
5374+
5375+ freemem = newmem->data;
5376+ freemem_size -= offsetof (struct transmem_list, data);
5377+# else
5378+ transmem_list = newmem;
5379+ freemem = newmem;
5380+# endif
5381+
5382+ outbuf = freemem + sizeof (size_t);
5383+ }
5384+
5385+ /* We have now in our buffer a converted string. Put this
5386+ into the table of conversions. */
5387+ *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
5388+ domain->conv_tab[act] = (char *) freemem;
5389+ /* Shrink freemem, but keep it aligned. */
5390+ freemem_size -= outbuf - freemem;
5391+ freemem = outbuf;
5392+ freemem += freemem_size & (alignof (size_t) - 1);
5393+ freemem_size = freemem_size & ~ (alignof (size_t) - 1);
5394+
5395+ __libc_lock_unlock (lock);
5396+ }
5397+
5398+ /* Now domain->conv_tab[act] contains the translation of all
5399+ the plural variants. */
5400+ result = domain->conv_tab[act] + sizeof (size_t);
5401+ resultlen = *(size_t *) domain->conv_tab[act];
5402+ }
5403+
5404+ converted:
5405+ /* The result string is converted. */
5406+
5407+#endif /* _LIBC || HAVE_ICONV */
5408+
5409+ *lengthp = resultlen;
5410+ return result;
5411+}
5412+
5413+
5414+/* Look up a plural variant. */
5415+static char *
5416+internal_function
5417+plural_lookup (struct loaded_l10nfile *domain, unsigned long int n,
5418+ const char *translation, size_t translation_len)
5419+{
5420+ struct loaded_domain *domaindata = (struct loaded_domain *) domain->data;
5421+ unsigned long int index;
5422+ const char *p;
5423+
5424+ index = plural_eval (domaindata->plural, n);
5425+ if (index >= domaindata->nplurals)
5426+ /* This should never happen. It means the plural expression and the
5427+ given maximum value do not match. */
5428+ index = 0;
5429+
5430+ /* Skip INDEX strings at TRANSLATION. */
5431+ p = translation;
5432+ while (index-- > 0)
5433+ {
5434+#ifdef _LIBC
5435+ p = __rawmemchr (p, '\0');
5436+#else
5437+ p = strchr (p, '\0');
5438+#endif
5439+ /* And skip over the NUL byte. */
5440+ p++;
5441+
5442+ if (p >= translation + translation_len)
5443+ /* This should never happen. It means the plural expression
5444+ evaluated to a value larger than the number of variants
5445+ available for MSGID1. */
5446+ return (char *) translation;
5447+ }
5448+ return (char *) p;
5449+}
5450+
5451+#ifndef _LIBC
5452+/* Return string representation of locale CATEGORY. */
5453+static const char *
5454+internal_function
5455+category_to_name (int category)
5456+{
5457+ const char *retval;
5458+
5459+ switch (category)
5460+ {
5461+#ifdef LC_COLLATE
5462+ case LC_COLLATE:
5463+ retval = "LC_COLLATE";
5464+ break;
5465+#endif
5466+#ifdef LC_CTYPE
5467+ case LC_CTYPE:
5468+ retval = "LC_CTYPE";
5469+ break;
5470+#endif
5471+#ifdef LC_MONETARY
5472+ case LC_MONETARY:
5473+ retval = "LC_MONETARY";
5474+ break;
5475+#endif
5476+#ifdef LC_NUMERIC
5477+ case LC_NUMERIC:
5478+ retval = "LC_NUMERIC";
5479+ break;
5480+#endif
5481+#ifdef LC_TIME
5482+ case LC_TIME:
5483+ retval = "LC_TIME";
5484+ break;
5485+#endif
5486+#ifdef LC_MESSAGES
5487+ case LC_MESSAGES:
5488+ retval = "LC_MESSAGES";
5489+ break;
5490+#endif
5491+#ifdef LC_RESPONSE
5492+ case LC_RESPONSE:
5493+ retval = "LC_RESPONSE";
5494+ break;
5495+#endif
5496+#ifdef LC_ALL
5497+ case LC_ALL:
5498+ /* This might not make sense but is perhaps better than any other
5499+ value. */
5500+ retval = "LC_ALL";
5501+ break;
5502+#endif
5503+ default:
5504+ /* If you have a better idea for a default value let me know. */
5505+ retval = "LC_XXX";
5506+ }
5507+
5508+ return retval;
5509+}
5510+#endif
5511+
5512+/* Guess value of current locale from value of the environment variables. */
5513+static const char *
5514+internal_function
5515+guess_category_value (int category, const char *categoryname)
5516+{
5517+ const char *language;
5518+ const char *retval;
5519+
5520+ /* The highest priority value is the `LANGUAGE' environment
5521+ variable. But we don't use the value if the currently selected
5522+ locale is the C locale. This is a GNU extension. */
5523+ language = getenv ("LANGUAGE");
5524+ if (language != NULL && language[0] == '\0')
5525+ language = NULL;
5526+
5527+ /* We have to proceed with the POSIX methods of looking to `LC_ALL',
5528+ `LC_xxx', and `LANG'. On some systems this can be done by the
5529+ `setlocale' function itself. */
5530+#ifdef _LIBC
5531+ retval = __current_locale_name (category);
5532+#else
5533+ retval = _nl_locale_name (category, categoryname);
5534+#endif
5535+
5536+ /* Ignore LANGUAGE if the locale is set to "C" because
5537+ 1. "C" locale usually uses the ASCII encoding, and most international
5538+ messages use non-ASCII characters. These characters get displayed
5539+ as question marks (if using glibc's iconv()) or as invalid 8-bit
5540+ characters (because other iconv()s refuse to convert most non-ASCII
5541+ characters to ASCII). In any case, the output is ugly.
5542+ 2. The precise output of some programs in the "C" locale is specified
5543+ by POSIX and should not depend on environment variables like
5544+ "LANGUAGE". We allow such programs to use gettext(). */
5545+ return language != NULL && strcmp (retval, "C") != 0 ? language : retval;
5546+}
5547+
5548+/* @@ begin of epilog @@ */
5549+
5550+/* We don't want libintl.a to depend on any other library. So we
5551+ avoid the non-standard function stpcpy. In GNU C Library this
5552+ function is available, though. Also allow the symbol HAVE_STPCPY
5553+ to be defined. */
5554+#if !_LIBC && !HAVE_STPCPY
5555+static char *
5556+stpcpy (char *dest, const char *src)
5557+{
5558+ while ((*dest++ = *src++) != '\0')
5559+ /* Do nothing. */ ;
5560+ return dest - 1;
5561+}
5562+#endif
5563+
5564+#if !_LIBC && !HAVE_MEMPCPY
5565+static void *
5566+mempcpy (void *dest, const void *src, size_t n)
5567+{
5568+ return (void *) ((char *) memcpy (dest, src, n) + n);
5569+}
5570+#endif
5571+
5572+
5573+#ifdef _LIBC
5574+/* If we want to free all resources we have to do some work at
5575+ program's end. */
5576+libc_freeres_fn (free_mem)
5577+{
5578+ void *old;
5579+
5580+ while (_nl_domain_bindings != NULL)
5581+ {
5582+ struct binding *oldp = _nl_domain_bindings;
5583+ _nl_domain_bindings = _nl_domain_bindings->next;
5584+ if (oldp->dirname != INTUSE(_nl_default_dirname))
5585+ /* Yes, this is a pointer comparison. */
5586+ free (oldp->dirname);
5587+ free (oldp->codeset);
5588+ free (oldp);
5589+ }
5590+
5591+ if (_nl_current_default_domain != _nl_default_default_domain)
5592+ /* Yes, again a pointer comparison. */
5593+ free ((char *) _nl_current_default_domain);
5594+
5595+ /* Remove the search tree with the known translations. */
5596+ __tdestroy (root, free);
5597+ root = NULL;
5598+
5599+ while (transmem_list != NULL)
5600+ {
5601+ old = transmem_list;
5602+ transmem_list = transmem_list->next;
5603+ free (old);
5604+ }
5605+}
5606+#endif
5607--- lrzsz-0.12.20.safe/intl/dcngettext.c 1969-12-31 19:00:00.000000000 -0500
5608+++ lrzsz-0.12.20/intl/dcngettext.c 2004-09-12 14:40:34.375745048 -0400
5609@@ -0,0 +1,57 @@
5610+/* Implementation of the dcngettext(3) function.
5611+ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
5612+
5613+ This program is free software; you can redistribute it and/or modify it
5614+ under the terms of the GNU Library General Public License as published
5615+ by the Free Software Foundation; either version 2, or (at your option)
5616+ any later version.
5617+
5618+ This program is distributed in the hope that it will be useful,
5619+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5620+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5621+ Library General Public License for more details.
5622+
5623+ You should have received a copy of the GNU Library General Public
5624+ License along with this program; if not, write to the Free Software
5625+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
5626+ USA. */
5627+
5628+#ifdef HAVE_CONFIG_H
5629+# include <config.h>
5630+#endif
5631+
5632+#include "gettextP.h"
5633+#ifdef _LIBC
5634+# include <libintl.h>
5635+#else
5636+# include "libgnuintl.h"
5637+#endif
5638+
5639+/* @@ end of prolog @@ */
5640+
5641+/* Names for the libintl functions are a problem. They must not clash
5642+ with existing names and they should follow ANSI C. But this source
5643+ code is also used in GNU C Library where the names have a __
5644+ prefix. So we have to make a difference here. */
5645+#ifdef _LIBC
5646+# define DCNGETTEXT __dcngettext
5647+# define DCIGETTEXT __dcigettext
5648+#else
5649+# define DCNGETTEXT libintl_dcngettext
5650+# define DCIGETTEXT libintl_dcigettext
5651+#endif
5652+
5653+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
5654+ locale. */
5655+char *
5656+DCNGETTEXT (const char *domainname,
5657+ const char *msgid1, const char *msgid2, unsigned long int n,
5658+ int category)
5659+{
5660+ return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
5661+}
5662+
5663+#ifdef _LIBC
5664+/* Alias for function name in GNU C Library. */
5665+weak_alias (__dcngettext, dcngettext);
5666+#endif
5667--- lrzsz-0.12.20.safe/intl/dgettext.c 1998-04-26 09:20:52.000000000 -0400
5668+++ lrzsz-0.12.20/intl/dgettext.c 2004-09-12 14:40:34.380744288 -0400
5669@@ -1,32 +1,33 @@
5670-/* dgettext.c -- implementation of the dgettext(3) function
5671- Copyright (C) 1995 Software Foundation, Inc.
5672+/* Implementation of the dgettext(3) function.
5673+ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
5674
5675-This program is free software; you can redistribute it and/or modify
5676-it under the terms of the GNU General Public License as published by
5677-the Free Software Foundation; either version 2, or (at your option)
5678-any later version.
5679+ This program is free software; you can redistribute it and/or modify it
5680+ under the terms of the GNU Library General Public License as published
5681+ by the Free Software Foundation; either version 2, or (at your option)
5682+ any later version.
5683
5684-This program is distributed in the hope that it will be useful,
5685-but WITHOUT ANY WARRANTY; without even the implied warranty of
5686-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5687-GNU General Public License for more details.
5688+ This program is distributed in the hope that it will be useful,
5689+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5690+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5691+ Library General Public License for more details.
5692
5693-You should have received a copy of the GNU General Public License
5694-along with this program; if not, write to the Free Software
5695-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
5696+ You should have received a copy of the GNU Library General Public
5697+ License along with this program; if not, write to the Free Software
5698+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
5699+ USA. */
5700
5701 #ifdef HAVE_CONFIG_H
5702 # include <config.h>
5703 #endif
5704
5705-#if defined HAVE_LOCALE_H || defined _LIBC
5706-# include <locale.h>
5707-#endif
5708+#include "gettextP.h"
5709+
5710+#include <locale.h>
5711
5712 #ifdef _LIBC
5713 # include <libintl.h>
5714 #else
5715-# include "libgettext.h"
5716+# include "libgnuintl.h"
5717 #endif
5718
5719 /* @@ end of prolog @@ */
5720@@ -37,18 +38,16 @@
5721 prefix. So we have to make a difference here. */
5722 #ifdef _LIBC
5723 # define DGETTEXT __dgettext
5724-# define DCGETTEXT __dcgettext
5725+# define DCGETTEXT INTUSE(__dcgettext)
5726 #else
5727-# define DGETTEXT dgettext__
5728-# define DCGETTEXT dcgettext__
5729+# define DGETTEXT libintl_dgettext
5730+# define DCGETTEXT libintl_dcgettext
5731 #endif
5732
5733 /* Look up MSGID in the DOMAINNAME message catalog of the current
5734 LC_MESSAGES locale. */
5735 char *
5736-DGETTEXT (domainname, msgid)
5737- const char *domainname;
5738- const char *msgid;
5739+DGETTEXT (const char *domainname, const char *msgid)
5740 {
5741 return DCGETTEXT (domainname, msgid, LC_MESSAGES);
5742 }
5743--- lrzsz-0.12.20.safe/intl/dngettext.c 1969-12-31 19:00:00.000000000 -0500
5744+++ lrzsz-0.12.20/intl/dngettext.c 2004-09-12 14:40:34.385743528 -0400
5745@@ -0,0 +1,59 @@
5746+/* Implementation of the dngettext(3) function.
5747+ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
5748+
5749+ This program is free software; you can redistribute it and/or modify it
5750+ under the terms of the GNU Library General Public License as published
5751+ by the Free Software Foundation; either version 2, or (at your option)
5752+ any later version.
5753+
5754+ This program is distributed in the hope that it will be useful,
5755+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5756+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5757+ Library General Public License for more details.
5758+
5759+ You should have received a copy of the GNU Library General Public
5760+ License along with this program; if not, write to the Free Software
5761+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
5762+ USA. */
5763+
5764+#ifdef HAVE_CONFIG_H
5765+# include <config.h>
5766+#endif
5767+
5768+#include "gettextP.h"
5769+
5770+#include <locale.h>
5771+
5772+#ifdef _LIBC
5773+# include <libintl.h>
5774+#else
5775+# include "libgnuintl.h"
5776+#endif
5777+
5778+/* @@ end of prolog @@ */
5779+
5780+/* Names for the libintl functions are a problem. They must not clash
5781+ with existing names and they should follow ANSI C. But this source
5782+ code is also used in GNU C Library where the names have a __
5783+ prefix. So we have to make a difference here. */
5784+#ifdef _LIBC
5785+# define DNGETTEXT __dngettext
5786+# define DCNGETTEXT __dcngettext
5787+#else
5788+# define DNGETTEXT libintl_dngettext
5789+# define DCNGETTEXT libintl_dcngettext
5790+#endif
5791+
5792+/* Look up MSGID in the DOMAINNAME message catalog of the current
5793+ LC_MESSAGES locale and skip message according to the plural form. */
5794+char *
5795+DNGETTEXT (const char *domainname,
5796+ const char *msgid1, const char *msgid2, unsigned long int n)
5797+{
5798+ return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
5799+}
5800+
5801+#ifdef _LIBC
5802+/* Alias for function name in GNU C Library. */
5803+weak_alias (__dngettext, dngettext);
5804+#endif
5805--- lrzsz-0.12.20.safe/intl/eval-plural.h 1969-12-31 19:00:00.000000000 -0500
5806+++ lrzsz-0.12.20/intl/eval-plural.h 2004-09-12 14:40:34.390742768 -0400
5807@@ -0,0 +1,108 @@
5808+/* Plural expression evaluation.
5809+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
5810+
5811+ This program is free software; you can redistribute it and/or modify it
5812+ under the terms of the GNU Library General Public License as published
5813+ by the Free Software Foundation; either version 2, or (at your option)
5814+ any later version.
5815+
5816+ This program is distributed in the hope that it will be useful,
5817+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5818+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5819+ Library General Public License for more details.
5820+
5821+ You should have received a copy of the GNU Library General Public
5822+ License along with this program; if not, write to the Free Software
5823+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
5824+ USA. */
5825+
5826+#ifndef STATIC
5827+#define STATIC static
5828+#endif
5829+
5830+/* Evaluate the plural expression and return an index value. */
5831+STATIC
5832+unsigned long int
5833+internal_function
5834+plural_eval (struct expression *pexp, unsigned long int n)
5835+{
5836+ switch (pexp->nargs)
5837+ {
5838+ case 0:
5839+ switch (pexp->operation)
5840+ {
5841+ case var:
5842+ return n;
5843+ case num:
5844+ return pexp->val.num;
5845+ default:
5846+ break;
5847+ }
5848+ /* NOTREACHED */
5849+ break;
5850+ case 1:
5851+ {
5852+ /* pexp->operation must be lnot. */
5853+ unsigned long int arg = plural_eval (pexp->val.args[0], n);
5854+ return ! arg;
5855+ }
5856+ case 2:
5857+ {
5858+ unsigned long int leftarg = plural_eval (pexp->val.args[0], n);
5859+ if (pexp->operation == lor)
5860+ return leftarg || plural_eval (pexp->val.args[1], n);
5861+ else if (pexp->operation == land)
5862+ return leftarg && plural_eval (pexp->val.args[1], n);
5863+ else
5864+ {
5865+ unsigned long int rightarg = plural_eval (pexp->val.args[1], n);
5866+
5867+ switch (pexp->operation)
5868+ {
5869+ case mult:
5870+ return leftarg * rightarg;
5871+ case divide:
5872+#if !INTDIV0_RAISES_SIGFPE
5873+ if (rightarg == 0)
5874+ raise (SIGFPE);
5875+#endif
5876+ return leftarg / rightarg;
5877+ case module:
5878+#if !INTDIV0_RAISES_SIGFPE
5879+ if (rightarg == 0)
5880+ raise (SIGFPE);
5881+#endif
5882+ return leftarg % rightarg;
5883+ case plus:
5884+ return leftarg + rightarg;
5885+ case minus:
5886+ return leftarg - rightarg;
5887+ case less_than:
5888+ return leftarg < rightarg;
5889+ case greater_than:
5890+ return leftarg > rightarg;
5891+ case less_or_equal:
5892+ return leftarg <= rightarg;
5893+ case greater_or_equal:
5894+ return leftarg >= rightarg;
5895+ case equal:
5896+ return leftarg == rightarg;
5897+ case not_equal:
5898+ return leftarg != rightarg;
5899+ default:
5900+ break;
5901+ }
5902+ }
5903+ /* NOTREACHED */
5904+ break;
5905+ }
5906+ case 3:
5907+ {
5908+ /* pexp->operation must be qmop. */
5909+ unsigned long int boolarg = plural_eval (pexp->val.args[0], n);
5910+ return plural_eval (pexp->val.args[boolarg ? 1 : 2], n);
5911+ }
5912+ }
5913+ /* NOTREACHED */
5914+ return 0;
5915+}
5916--- lrzsz-0.12.20.safe/intl/explodename.c 1998-04-26 09:22:37.000000000 -0400
5917+++ lrzsz-0.12.20/intl/explodename.c 2004-09-12 14:40:34.395742008 -0400
5918@@ -1,19 +1,20 @@
5919-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
5920+/* Copyright (C) 1995-1998, 2000-2001, 2003 Free Software Foundation, Inc.
5921 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
5922
5923- This program is free software; you can redistribute it and/or modify
5924- it under the terms of the GNU General Public License as published by
5925- the Free Software Foundation; either version 2, or (at your option)
5926+ This program is free software; you can redistribute it and/or modify it
5927+ under the terms of the GNU Library General Public License as published
5928+ by the Free Software Foundation; either version 2, or (at your option)
5929 any later version.
5930
5931 This program is distributed in the hope that it will be useful,
5932 but WITHOUT ANY WARRANTY; without even the implied warranty of
5933- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5934- GNU General Public License for more details.
5935+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5936+ Library General Public License for more details.
5937
5938- You should have received a copy of the GNU General Public License
5939- along with this program; if not, write to the Free Software Foundation,
5940- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
5941+ You should have received a copy of the GNU Library General Public
5942+ License along with this program; if not, write to the Free Software
5943+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
5944+ USA. */
5945
5946 #ifdef HAVE_CONFIG_H
5947 # include <config.h>
5948@@ -36,18 +37,23 @@
5949
5950 /* @@ end of prolog @@ */
5951
5952+char *
5953+_nl_find_language (const char *name)
5954+{
5955+ while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
5956+ && name[0] != '+' && name[0] != ',')
5957+ ++name;
5958+
5959+ return (char *) name;
5960+}
5961+
5962+
5963 int
5964-_nl_explode_name (name, language, modifier, territory, codeset,
5965- normalized_codeset, special, sponsor, revision)
5966- char *name;
5967- const char **language;
5968- const char **modifier;
5969- const char **territory;
5970- const char **codeset;
5971- const char **normalized_codeset;
5972- const char **special;
5973- const char **sponsor;
5974- const char **revision;
5975+_nl_explode_name (char *name,
5976+ const char **language, const char **modifier,
5977+ const char **territory, const char **codeset,
5978+ const char **normalized_codeset, const char **special,
5979+ const char **sponsor, const char **revision)
5980 {
5981 enum { undecided, xpg, cen } syntax;
5982 char *cp;
5983@@ -67,9 +73,7 @@
5984 mask = 0;
5985 syntax = undecided;
5986 *language = cp = name;
5987- while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@'
5988- && cp[0] != '+' && cp[0] != ',')
5989- ++cp;
5990+ cp = _nl_find_language (*language);
5991
5992 if (*language == cp)
5993 /* This does not make sense: language has to be specified. Use
5994--- lrzsz-0.12.20.safe/intl/finddomain.c 1998-04-26 09:22:36.000000000 -0400
5995+++ lrzsz-0.12.20/intl/finddomain.c 2004-09-12 14:40:34.415738968 -0400
5996@@ -1,64 +1,40 @@
5997 /* Handle list of needed message catalogs
5998- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
5999- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
6000+ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
6001+ Written by Ulrich Drepper <drepper@gnu.org>, 1995.
6002
6003- This program is free software; you can redistribute it and/or modify
6004- it under the terms of the GNU General Public License as published by
6005- the Free Software Foundation; either version 2, or (at your option)
6006+ This program is free software; you can redistribute it and/or modify it
6007+ under the terms of the GNU Library General Public License as published
6008+ by the Free Software Foundation; either version 2, or (at your option)
6009 any later version.
6010
6011 This program is distributed in the hope that it will be useful,
6012 but WITHOUT ANY WARRANTY; without even the implied warranty of
6013- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6014- GNU General Public License for more details.
6015+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6016+ Library General Public License for more details.
6017
6018- You should have received a copy of the GNU General Public License
6019- along with this program; if not, write to the Free Software Foundation,
6020- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
6021+ You should have received a copy of the GNU Library General Public
6022+ License along with this program; if not, write to the Free Software
6023+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6024+ USA. */
6025
6026 #ifdef HAVE_CONFIG_H
6027 # include <config.h>
6028 #endif
6029
6030-#include <ctype.h>
6031-#include <errno.h>
6032 #include <stdio.h>
6033 #include <sys/types.h>
6034-
6035-#if defined STDC_HEADERS || defined _LIBC
6036-# include <stdlib.h>
6037-#else
6038-# ifdef HAVE_MALLOC_H
6039-# include <malloc.h>
6040-# else
6041-void free ();
6042-# endif
6043-#endif
6044-
6045-#if defined HAVE_STRING_H || defined _LIBC
6046-# include <string.h>
6047-#else
6048-# include <strings.h>
6049-# ifndef memcpy
6050-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
6051-# endif
6052-#endif
6053-#if !HAVE_STRCHR && !defined _LIBC
6054-# ifndef strchr
6055-# define strchr index
6056-# endif
6057-#endif
6058+#include <stdlib.h>
6059+#include <string.h>
6060
6061 #if defined HAVE_UNISTD_H || defined _LIBC
6062 # include <unistd.h>
6063 #endif
6064
6065-#include "gettext.h"
6066 #include "gettextP.h"
6067 #ifdef _LIBC
6068 # include <libintl.h>
6069 #else
6070-# include "libgettext.h"
6071+# include "libgnuintl.h"
6072 #endif
6073
6074 /* @@ end of prolog @@ */
6075@@ -70,10 +46,9 @@
6076 the DOMAINNAME and CATEGORY parameters with respect to the currently
6077 established bindings. */
6078 struct loaded_l10nfile *
6079-_nl_find_domain (dirname, locale, domainname)
6080- const char *dirname;
6081- char *locale;
6082- const char *domainname;
6083+internal_function
6084+_nl_find_domain (const char *dirname, char *locale,
6085+ const char *domainname, struct binding *domainbinding)
6086 {
6087 struct loaded_l10nfile *retval;
6088 const char *language;
6089@@ -95,9 +70,9 @@
6090
6091 language[_territory][+audience][+special][,[sponsor][_revision]]
6092
6093- Beside the first all of them are allowed to be missing. If the
6094- full specified locale is not found, the less specific one are
6095- looked for. The various part will be stripped of according to
6096+ Beside the first part all of them are allowed to be missing. If
6097+ the full specified locale is not found, the less specific one are
6098+ looked for. The various parts will be stripped off according to
6099 the following order:
6100 (1) revision
6101 (2) sponsor
6102@@ -119,7 +94,7 @@
6103 int cnt;
6104
6105 if (retval->decided == 0)
6106- _nl_load_domain (retval);
6107+ _nl_load_domain (retval, domainbinding);
6108
6109 if (retval->data != NULL)
6110 return retval;
6111@@ -127,7 +102,7 @@
6112 for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
6113 {
6114 if (retval->successor[cnt]->decided == 0)
6115- _nl_load_domain (retval->successor[cnt]);
6116+ _nl_load_domain (retval->successor[cnt], domainbinding);
6117
6118 if (retval->successor[cnt]->data != NULL)
6119 break;
6120@@ -142,12 +117,18 @@
6121 alias_value = _nl_expand_alias (locale);
6122 if (alias_value != NULL)
6123 {
6124+#if defined _LIBC || defined HAVE_STRDUP
6125+ locale = strdup (alias_value);
6126+ if (locale == NULL)
6127+ return NULL;
6128+#else
6129 size_t len = strlen (alias_value) + 1;
6130 locale = (char *) malloc (len);
6131 if (locale == NULL)
6132 return NULL;
6133
6134 memcpy (locale, alias_value, len);
6135+#endif
6136 }
6137
6138 /* Now we determine the single parts of the locale name. First
6139@@ -168,14 +149,14 @@
6140 return NULL;
6141
6142 if (retval->decided == 0)
6143- _nl_load_domain (retval);
6144+ _nl_load_domain (retval, domainbinding);
6145 if (retval->data == NULL)
6146 {
6147 int cnt;
6148 for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
6149 {
6150 if (retval->successor[cnt]->decided == 0)
6151- _nl_load_domain (retval->successor[cnt]);
6152+ _nl_load_domain (retval->successor[cnt], domainbinding);
6153 if (retval->successor[cnt]->data != NULL)
6154 break;
6155 }
6156@@ -185,5 +166,27 @@
6157 if (alias_value != NULL)
6158 free (locale);
6159
6160+ /* The space for normalized_codeset is dynamically allocated. Free it. */
6161+ if (mask & XPG_NORM_CODESET)
6162+ free ((void *) normalized_codeset);
6163+
6164 return retval;
6165 }
6166+
6167+
6168+#ifdef _LIBC
6169+libc_freeres_fn (free_mem)
6170+{
6171+ struct loaded_l10nfile *runp = _nl_loaded_domains;
6172+
6173+ while (runp != NULL)
6174+ {
6175+ struct loaded_l10nfile *here = runp;
6176+ if (runp->data != NULL)
6177+ _nl_unload_domain ((struct loaded_domain *) runp->data);
6178+ runp = runp->next;
6179+ free ((char *) here->filename);
6180+ free (here);
6181+ }
6182+}
6183+#endif
6184--- lrzsz-0.12.20.safe/intl/gettext.c 1998-04-26 09:22:36.000000000 -0400
6185+++ lrzsz-0.12.20/intl/gettext.c 2004-09-12 14:40:34.420738208 -0400
6186@@ -1,19 +1,20 @@
6187-/* Implementation of gettext(3) function
6188- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
6189+/* Implementation of gettext(3) function.
6190+ Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
6191
6192- This program is free software; you can redistribute it and/or modify
6193- it under the terms of the GNU General Public License as published by
6194- the Free Software Foundation; either version 2, or (at your option)
6195+ This program is free software; you can redistribute it and/or modify it
6196+ under the terms of the GNU Library General Public License as published
6197+ by the Free Software Foundation; either version 2, or (at your option)
6198 any later version.
6199
6200 This program is distributed in the hope that it will be useful,
6201 but WITHOUT ANY WARRANTY; without even the implied warranty of
6202- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6203- GNU General Public License for more details.
6204+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6205+ Library General Public License for more details.
6206
6207- You should have received a copy of the GNU General Public License
6208- along with this program; if not, write to the Free Software Foundation,
6209- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
6210+ You should have received a copy of the GNU Library General Public
6211+ License along with this program; if not, write to the Free Software
6212+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6213+ USA. */
6214
6215 #ifdef HAVE_CONFIG_H
6216 # include <config.h>
6217@@ -23,21 +24,14 @@
6218 # define __need_NULL
6219 # include <stddef.h>
6220 #else
6221-# ifdef STDC_HEADERS
6222-# include <stdlib.h> /* Just for NULL. */
6223-# else
6224-# ifdef HAVE_STRING_H
6225-# include <string.h>
6226-# else
6227-# define NULL ((void *) 0)
6228-# endif
6229-# endif
6230+# include <stdlib.h> /* Just for NULL. */
6231 #endif
6232
6233+#include "gettextP.h"
6234 #ifdef _LIBC
6235 # include <libintl.h>
6236 #else
6237-# include "libgettext.h"
6238+# include "libgnuintl.h"
6239 #endif
6240
6241 /* @@ end of prolog @@ */
6242@@ -48,20 +42,19 @@
6243 prefix. So we have to make a difference here. */
6244 #ifdef _LIBC
6245 # define GETTEXT __gettext
6246-# define DGETTEXT __dgettext
6247+# define DCGETTEXT INTUSE(__dcgettext)
6248 #else
6249-# define GETTEXT gettext__
6250-# define DGETTEXT dgettext__
6251+# define GETTEXT libintl_gettext
6252+# define DCGETTEXT libintl_dcgettext
6253 #endif
6254
6255 /* Look up MSGID in the current default message catalog for the current
6256 LC_MESSAGES locale. If not found, returns MSGID itself (the default
6257 text). */
6258 char *
6259-GETTEXT (msgid)
6260- const char *msgid;
6261+GETTEXT (const char *msgid)
6262 {
6263- return DGETTEXT (NULL, msgid);
6264+ return DCGETTEXT (NULL, msgid, LC_MESSAGES);
6265 }
6266
6267 #ifdef _LIBC
6268--- lrzsz-0.12.20.safe/intl/gettext.h 1998-04-26 09:22:35.000000000 -0400
6269+++ lrzsz-0.12.20/intl/gettext.h 1969-12-31 19:00:00.000000000 -0500
6270@@ -1,105 +0,0 @@
6271-/* Internal header for GNU gettext internationalization functions
6272- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
6273-
6274- This program is free software; you can redistribute it and/or modify
6275- it under the terms of the GNU General Public License as published by
6276- the Free Software Foundation; either version 2, or (at your option)
6277- any later version.
6278-
6279- This program is distributed in the hope that it will be useful,
6280- but WITHOUT ANY WARRANTY; without even the implied warranty of
6281- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6282- GNU General Public License for more details.
6283-
6284- You should have received a copy of the GNU Library General Public
6285- License along with the GNU C Library; see the file COPYING.LIB. If not,
6286- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6287- Boston, MA 02111-1307, USA. */
6288-
6289-#ifndef _GETTEXT_H
6290-#define _GETTEXT_H 1
6291-
6292-#include <stdio.h>
6293-
6294-#if HAVE_LIMITS_H || _LIBC
6295-# include <limits.h>
6296-#endif
6297-
6298-/* @@ end of prolog @@ */
6299-
6300-/* The magic number of the GNU message catalog format. */
6301-#define _MAGIC 0x950412de
6302-#define _MAGIC_SWAPPED 0xde120495
6303-
6304-/* Revision number of the currently used .mo (binary) file format. */
6305-#define MO_REVISION_NUMBER 0
6306-
6307-/* The following contortions are an attempt to use the C preprocessor
6308- to determine an unsigned integral type that is 32 bits wide. An
6309- alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
6310- doing that would require that the configure script compile and *run*
6311- the resulting executable. Locally running cross-compiled executables
6312- is usually not possible. */
6313-
6314-#if __STDC__
6315-# define UINT_MAX_32_BITS 4294967295U
6316-#else
6317-# define UINT_MAX_32_BITS 0xFFFFFFFF
6318-#endif
6319-
6320-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
6321- This should be valid for all systems GNU cares about because
6322- that doesn't include 16-bit systems, and only modern systems
6323- (that certainly have <limits.h>) have 64+-bit integral types. */
6324-
6325-#ifndef UINT_MAX
6326-# define UINT_MAX UINT_MAX_32_BITS
6327-#endif
6328-
6329-#if UINT_MAX == UINT_MAX_32_BITS
6330-typedef unsigned nls_uint32;
6331-#else
6332-# if USHRT_MAX == UINT_MAX_32_BITS
6333-typedef unsigned short nls_uint32;
6334-# else
6335-# if ULONG_MAX == UINT_MAX_32_BITS
6336-typedef unsigned long nls_uint32;
6337-# else
6338- /* The following line is intended to throw an error. Using #error is
6339- not portable enough. */
6340- "Cannot determine unsigned 32-bit data type."
6341-# endif
6342-# endif
6343-#endif
6344-
6345-
6346-/* Header for binary .mo file format. */
6347-struct mo_file_header
6348-{
6349- /* The magic number. */
6350- nls_uint32 magic;
6351- /* The revision number of the file format. */
6352- nls_uint32 revision;
6353- /* The number of strings pairs. */
6354- nls_uint32 nstrings;
6355- /* Offset of table with start offsets of original strings. */
6356- nls_uint32 orig_tab_offset;
6357- /* Offset of table with start offsets of translation strings. */
6358- nls_uint32 trans_tab_offset;
6359- /* Size of hashing table. */
6360- nls_uint32 hash_tab_size;
6361- /* Offset of first hashing entry. */
6362- nls_uint32 hash_tab_offset;
6363-};
6364-
6365-struct string_desc
6366-{
6367- /* Length of addressed string. */
6368- nls_uint32 length;
6369- /* Offset of string in file. */
6370- nls_uint32 offset;
6371-};
6372-
6373-/* @@ begin of epilog @@ */
6374-
6375-#endif /* gettext.h */
6376--- lrzsz-0.12.20.safe/intl/gettextP.h 1998-04-26 09:22:35.000000000 -0400
6377+++ lrzsz-0.12.20/intl/gettextP.h 2004-09-12 14:40:34.426737296 -0400
6378@@ -1,33 +1,53 @@
6379-/* Header describing internals of gettext library
6380- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
6381+/* Header describing internals of libintl library.
6382+ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
6383+ Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
6384
6385- This program is free software; you can redistribute it and/or modify
6386- it under the terms of the GNU General Public License as published by
6387- the Free Software Foundation; either version 2, or (at your option)
6388+ This program is free software; you can redistribute it and/or modify it
6389+ under the terms of the GNU Library General Public License as published
6390+ by the Free Software Foundation; either version 2, or (at your option)
6391 any later version.
6392
6393 This program is distributed in the hope that it will be useful,
6394 but WITHOUT ANY WARRANTY; without even the implied warranty of
6395- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6396- GNU General Public License for more details.
6397+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6398+ Library General Public License for more details.
6399
6400- You should have received a copy of the GNU General Public License
6401- along with this program; if not, write to the Free Software Foundation,
6402- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
6403+ You should have received a copy of the GNU Library General Public
6404+ License along with this program; if not, write to the Free Software
6405+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6406+ USA. */
6407
6408 #ifndef _GETTEXTP_H
6409 #define _GETTEXTP_H
6410
6411+#include <stddef.h> /* Get size_t. */
6412+
6413+#ifdef _LIBC
6414+# include "../iconv/gconv_int.h"
6415+#else
6416+# if HAVE_ICONV
6417+# include <iconv.h>
6418+# endif
6419+#endif
6420+
6421 #include "loadinfo.h"
6422
6423+#include "gmo.h" /* Get nls_uint32. */
6424+
6425 /* @@ end of prolog @@ */
6426
6427-#ifndef PARAMS
6428-# if __STDC__
6429-# define PARAMS(args) args
6430-# else
6431-# define PARAMS(args) ()
6432-# endif
6433+#ifndef internal_function
6434+# define internal_function
6435+#endif
6436+
6437+#ifndef attribute_hidden
6438+# define attribute_hidden
6439+#endif
6440+
6441+/* Tell the compiler when a conditional or integer expression is
6442+ almost always true or almost always false. */
6443+#ifndef HAVE_BUILTIN_EXPECT
6444+# define __builtin_expect(expr, val) (expr)
6445 #endif
6446
6447 #ifndef W
6448@@ -35,38 +55,160 @@
6449 #endif
6450
6451
6452-static nls_uint32 SWAP PARAMS ((nls_uint32 i));
6453-
6454+#ifdef _LIBC
6455+# include <byteswap.h>
6456+# define SWAP(i) bswap_32 (i)
6457+#else
6458 static inline nls_uint32
6459 SWAP (i)
6460 nls_uint32 i;
6461 {
6462 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
6463 }
6464+#endif
6465+
6466
6467+/* In-memory representation of system dependent string. */
6468+struct sysdep_string_desc
6469+{
6470+ /* Length of addressed string, including the trailing NUL. */
6471+ size_t length;
6472+ /* Pointer to addressed string. */
6473+ const char *pointer;
6474+};
6475
6476+/* The representation of an opened message catalog. */
6477 struct loaded_domain
6478 {
6479+ /* Pointer to memory containing the .mo file. */
6480 const char *data;
6481+ /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
6482+ int use_mmap;
6483+ /* Size of mmap()ed memory. */
6484+ size_t mmap_size;
6485+ /* 1 if the .mo file uses a different endianness than this machine. */
6486 int must_swap;
6487+ /* Pointer to additional malloc()ed memory. */
6488+ void *malloced;
6489+
6490+ /* Number of static strings pairs. */
6491 nls_uint32 nstrings;
6492- struct string_desc *orig_tab;
6493- struct string_desc *trans_tab;
6494+ /* Pointer to descriptors of original strings in the file. */
6495+ const struct string_desc *orig_tab;
6496+ /* Pointer to descriptors of translated strings in the file. */
6497+ const struct string_desc *trans_tab;
6498+
6499+ /* Number of system dependent strings pairs. */
6500+ nls_uint32 n_sysdep_strings;
6501+ /* Pointer to descriptors of original sysdep strings. */
6502+ const struct sysdep_string_desc *orig_sysdep_tab;
6503+ /* Pointer to descriptors of translated sysdep strings. */
6504+ const struct sysdep_string_desc *trans_sysdep_tab;
6505+
6506+ /* Size of hash table. */
6507 nls_uint32 hash_size;
6508- nls_uint32 *hash_tab;
6509+ /* Pointer to hash table. */
6510+ const nls_uint32 *hash_tab;
6511+ /* 1 if the hash table uses a different endianness than this machine. */
6512+ int must_swap_hash_tab;
6513+
6514+ int codeset_cntr;
6515+#ifdef _LIBC
6516+ __gconv_t conv;
6517+#else
6518+# if HAVE_ICONV
6519+ iconv_t conv;
6520+# endif
6521+#endif
6522+ char **conv_tab;
6523+
6524+ struct expression *plural;
6525+ unsigned long int nplurals;
6526 };
6527
6528+/* We want to allocate a string at the end of the struct. But ISO C
6529+ doesn't allow zero sized arrays. */
6530+#ifdef __GNUC__
6531+# define ZERO 0
6532+#else
6533+# define ZERO 1
6534+#endif
6535+
6536+/* A set of settings bound to a message domain. Used to store settings
6537+ from bindtextdomain() and bind_textdomain_codeset(). */
6538 struct binding
6539 {
6540 struct binding *next;
6541- char *domainname;
6542 char *dirname;
6543+ int codeset_cntr; /* Incremented each time codeset changes. */
6544+ char *codeset;
6545+ char domainname[ZERO];
6546 };
6547
6548-struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
6549- char *__locale,
6550- const char *__domainname));
6551-void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
6552+/* A counter which is incremented each time some previous translations
6553+ become invalid.
6554+ This variable is part of the external ABI of the GNU libintl. */
6555+extern int _nl_msg_cat_cntr;
6556+
6557+#ifndef _LIBC
6558+const char *_nl_locale_name (int category, const char *categoryname);
6559+#endif
6560+
6561+struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
6562+ const char *__domainname,
6563+ struct binding *__domainbinding)
6564+ internal_function;
6565+void _nl_load_domain (struct loaded_l10nfile *__domain,
6566+ struct binding *__domainbinding)
6567+ internal_function;
6568+void _nl_unload_domain (struct loaded_domain *__domain)
6569+ internal_function;
6570+const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
6571+ struct loaded_domain *__domain,
6572+ struct binding *__domainbinding)
6573+ internal_function;
6574+void _nl_free_domain_conv (struct loaded_domain *__domain)
6575+ internal_function;
6576+
6577+char *_nl_find_msg (struct loaded_l10nfile *domain_file,
6578+ struct binding *domainbinding, const char *msgid,
6579+ size_t *lengthp)
6580+ internal_function;
6581+
6582+#ifdef _LIBC
6583+extern char *__gettext (const char *__msgid);
6584+extern char *__dgettext (const char *__domainname, const char *__msgid);
6585+extern char *__dcgettext (const char *__domainname, const char *__msgid,
6586+ int __category);
6587+extern char *__ngettext (const char *__msgid1, const char *__msgid2,
6588+ unsigned long int __n);
6589+extern char *__dngettext (const char *__domainname,
6590+ const char *__msgid1, const char *__msgid2,
6591+ unsigned long int n);
6592+extern char *__dcngettext (const char *__domainname,
6593+ const char *__msgid1, const char *__msgid2,
6594+ unsigned long int __n, int __category);
6595+extern char *__dcigettext (const char *__domainname,
6596+ const char *__msgid1, const char *__msgid2,
6597+ int __plural, unsigned long int __n,
6598+ int __category);
6599+extern char *__textdomain (const char *__domainname);
6600+extern char *__bindtextdomain (const char *__domainname,
6601+ const char *__dirname);
6602+extern char *__bind_textdomain_codeset (const char *__domainname,
6603+ const char *__codeset);
6604+#else
6605+/* Declare the exported libintl_* functions, in a way that allows us to
6606+ call them under their real name. */
6607+# undef _INTL_REDIRECT_INLINE
6608+# undef _INTL_REDIRECT_MACROS
6609+# define _INTL_REDIRECT_MACROS
6610+# include "libgnuintl.h"
6611+extern char *libintl_dcigettext (const char *__domainname,
6612+ const char *__msgid1, const char *__msgid2,
6613+ int __plural, unsigned long int __n,
6614+ int __category);
6615+#endif
6616
6617 /* @@ begin of epilog @@ */
6618
6619--- lrzsz-0.12.20.safe/intl/gmo.h 1969-12-31 19:00:00.000000000 -0500
6620+++ lrzsz-0.12.20/intl/gmo.h 2004-09-12 14:40:34.431736536 -0400
6621@@ -0,0 +1,149 @@
6622+/* Description of GNU message catalog format: general file layout.
6623+ Copyright (C) 1995, 1997, 2000-2002, 2004 Free Software Foundation, Inc.
6624+
6625+ This program is free software; you can redistribute it and/or modify it
6626+ under the terms of the GNU Library General Public License as published
6627+ by the Free Software Foundation; either version 2, or (at your option)
6628+ any later version.
6629+
6630+ This program is distributed in the hope that it will be useful,
6631+ but WITHOUT ANY WARRANTY; without even the implied warranty of
6632+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6633+ Library General Public License for more details.
6634+
6635+ You should have received a copy of the GNU Library General Public
6636+ License along with this program; if not, write to the Free Software
6637+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6638+ USA. */
6639+
6640+#ifndef _GETTEXT_H
6641+#define _GETTEXT_H 1
6642+
6643+#include <limits.h>
6644+
6645+/* @@ end of prolog @@ */
6646+
6647+/* The magic number of the GNU message catalog format. */
6648+#define _MAGIC 0x950412de
6649+#define _MAGIC_SWAPPED 0xde120495
6650+
6651+/* Revision number of the currently used .mo (binary) file format. */
6652+#define MO_REVISION_NUMBER 0
6653+#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
6654+
6655+/* The following contortions are an attempt to use the C preprocessor
6656+ to determine an unsigned integral type that is 32 bits wide. An
6657+ alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
6658+ as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
6659+ when cross-compiling. */
6660+
6661+#if __STDC__
6662+# define UINT_MAX_32_BITS 4294967295U
6663+#else
6664+# define UINT_MAX_32_BITS 0xFFFFFFFF
6665+#endif
6666+
6667+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
6668+ This should be valid for all systems GNU cares about because
6669+ that doesn't include 16-bit systems, and only modern systems
6670+ (that certainly have <limits.h>) have 64+-bit integral types. */
6671+
6672+#ifndef UINT_MAX
6673+# define UINT_MAX UINT_MAX_32_BITS
6674+#endif
6675+
6676+#if UINT_MAX == UINT_MAX_32_BITS
6677+typedef unsigned nls_uint32;
6678+#else
6679+# if USHRT_MAX == UINT_MAX_32_BITS
6680+typedef unsigned short nls_uint32;
6681+# else
6682+# if ULONG_MAX == UINT_MAX_32_BITS
6683+typedef unsigned long nls_uint32;
6684+# else
6685+ /* The following line is intended to throw an error. Using #error is
6686+ not portable enough. */
6687+ "Cannot determine unsigned 32-bit data type."
6688+# endif
6689+# endif
6690+#endif
6691+
6692+
6693+/* Header for binary .mo file format. */
6694+struct mo_file_header
6695+{
6696+ /* The magic number. */
6697+ nls_uint32 magic;
6698+ /* The revision number of the file format. */
6699+ nls_uint32 revision;
6700+
6701+ /* The following are only used in .mo files with major revision 0 or 1. */
6702+
6703+ /* The number of strings pairs. */
6704+ nls_uint32 nstrings;
6705+ /* Offset of table with start offsets of original strings. */
6706+ nls_uint32 orig_tab_offset;
6707+ /* Offset of table with start offsets of translated strings. */
6708+ nls_uint32 trans_tab_offset;
6709+ /* Size of hash table. */
6710+ nls_uint32 hash_tab_size;
6711+ /* Offset of first hash table entry. */
6712+ nls_uint32 hash_tab_offset;
6713+
6714+ /* The following are only used in .mo files with minor revision >= 1. */
6715+
6716+ /* The number of system dependent segments. */
6717+ nls_uint32 n_sysdep_segments;
6718+ /* Offset of table describing system dependent segments. */
6719+ nls_uint32 sysdep_segments_offset;
6720+ /* The number of system dependent strings pairs. */
6721+ nls_uint32 n_sysdep_strings;
6722+ /* Offset of table with start offsets of original sysdep strings. */
6723+ nls_uint32 orig_sysdep_tab_offset;
6724+ /* Offset of table with start offsets of translated sysdep strings. */
6725+ nls_uint32 trans_sysdep_tab_offset;
6726+};
6727+
6728+/* Descriptor for static string contained in the binary .mo file. */
6729+struct string_desc
6730+{
6731+ /* Length of addressed string, not including the trailing NUL. */
6732+ nls_uint32 length;
6733+ /* Offset of string in file. */
6734+ nls_uint32 offset;
6735+};
6736+
6737+/* The following are only used in .mo files with minor revision >= 1. */
6738+
6739+/* Descriptor for system dependent string segment. */
6740+struct sysdep_segment
6741+{
6742+ /* Length of addressed string, including the trailing NUL. */
6743+ nls_uint32 length;
6744+ /* Offset of string in file. */
6745+ nls_uint32 offset;
6746+};
6747+
6748+/* Descriptor for system dependent string. */
6749+struct sysdep_string
6750+{
6751+ /* Offset of static string segments in file. */
6752+ nls_uint32 offset;
6753+ /* Alternating sequence of static and system dependent segments.
6754+ The last segment is a static segment, including the trailing NUL. */
6755+ struct segment_pair
6756+ {
6757+ /* Size of static segment. */
6758+ nls_uint32 segsize;
6759+ /* Reference to system dependent string segment, or ~0 at the end. */
6760+ nls_uint32 sysdepref;
6761+ } segments[1];
6762+};
6763+
6764+/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
6765+ regardless whether 'int' is 16 bit, 32 bit, or 64 bit. */
6766+#define SEGMENTS_END ((nls_uint32) ~0)
6767+
6768+/* @@ begin of epilog @@ */
6769+
6770+#endif /* gettext.h */
6771--- lrzsz-0.12.20.safe/intl/hash-string.h 1998-04-26 09:22:36.000000000 -0400
6772+++ lrzsz-0.12.20/intl/hash-string.h 2004-09-12 14:40:34.436735776 -0400
6773@@ -1,35 +1,23 @@
6774-/* Implements a string hashing function.
6775- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
6776+/* Description of GNU message catalog format: string hashing function.
6777+ Copyright (C) 1995, 1997-1998, 2000-2003 Free Software Foundation, Inc.
6778
6779- This program is free software; you can redistribute it and/or modify
6780- it under the terms of the GNU General Public License as published by
6781- the Free Software Foundation; either version 2, or (at your option)
6782+ This program is free software; you can redistribute it and/or modify it
6783+ under the terms of the GNU Library General Public License as published
6784+ by the Free Software Foundation; either version 2, or (at your option)
6785 any later version.
6786
6787 This program is distributed in the hope that it will be useful,
6788 but WITHOUT ANY WARRANTY; without even the implied warranty of
6789- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6790- GNU General Public License for more details.
6791+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6792+ Library General Public License for more details.
6793
6794 You should have received a copy of the GNU Library General Public
6795- License along with the GNU C Library; see the file COPYING.LIB. If not,
6796- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6797- Boston, MA 02111-1307, USA. */
6798-
6799-#ifdef HAVE_VALUES_H
6800-# include <values.h>
6801-#endif
6802+ License along with this program; if not, write to the Free Software
6803+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6804+ USA. */
6805
6806 /* @@ end of prolog @@ */
6807
6808-#ifndef PARAMS
6809-# if __STDC__
6810-# define PARAMS(Args) Args
6811-# else
6812-# define PARAMS(Args) ()
6813-# endif
6814-#endif
6815-
6816 /* We assume to have `unsigned long int' value with at least 32 bits. */
6817 #define HASHWORDBITS 32
6818
6819@@ -37,11 +25,8 @@
6820 /* Defines the so called `hashpjw' function by P.J. Weinberger
6821 [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
6822 1986, 1987 Bell Telephone Laboratories, Inc.] */
6823-static unsigned long hash_string PARAMS ((const char *__str_param));
6824-
6825-static inline unsigned long
6826-hash_string (str_param)
6827- const char *str_param;
6828+static inline unsigned long int
6829+hash_string (const char *str_param)
6830 {
6831 unsigned long int hval, g;
6832 const char *str = str_param;
6833@@ -51,8 +36,8 @@
6834 while (*str != '\0')
6835 {
6836 hval <<= 4;
6837- hval += (unsigned long) *str++;
6838- g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
6839+ hval += (unsigned char) *str++;
6840+ g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
6841 if (g != 0)
6842 {
6843 hval ^= g >> (HASHWORDBITS - 8);
6844--- lrzsz-0.12.20.safe/intl/intl-compat.c 1998-04-26 09:20:52.000000000 -0400
6845+++ lrzsz-0.12.20/intl/intl-compat.c 2004-09-12 14:40:34.441735016 -0400
6846@@ -1,76 +1,131 @@
6847 /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
6848 Library.
6849- Copyright (C) 1995 Software Foundation, Inc.
6850+ Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
6851
6852-This program is free software; you can redistribute it and/or modify
6853-it under the terms of the GNU General Public License as published by
6854-the Free Software Foundation; either version 2, or (at your option)
6855-any later version.
6856+ This program is free software; you can redistribute it and/or modify it
6857+ under the terms of the GNU Library General Public License as published
6858+ by the Free Software Foundation; either version 2, or (at your option)
6859+ any later version.
6860
6861-This program is distributed in the hope that it will be useful,
6862-but WITHOUT ANY WARRANTY; without even the implied warranty of
6863-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6864-GNU General Public License for more details.
6865+ This program is distributed in the hope that it will be useful,
6866+ but WITHOUT ANY WARRANTY; without even the implied warranty of
6867+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6868+ Library General Public License for more details.
6869
6870-You should have received a copy of the GNU General Public License
6871-along with this program; if not, write to the Free Software
6872-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
6873+ You should have received a copy of the GNU Library General Public
6874+ License along with this program; if not, write to the Free Software
6875+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
6876+ USA. */
6877
6878 #ifdef HAVE_CONFIG_H
6879 # include <config.h>
6880 #endif
6881
6882-#include "libgettext.h"
6883+#include "gettextP.h"
6884
6885 /* @@ end of prolog @@ */
6886
6887+/* This file redirects the gettext functions (without prefix) to those
6888+ defined in the included GNU libintl library (with "libintl_" prefix).
6889+ It is compiled into libintl in order to make the AM_GNU_GETTEXT test
6890+ of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
6891+ has the redirections primarily in the <libintl.h> include file.
6892+ It is also compiled into libgnuintl so that libgnuintl.so can be used
6893+ as LD_PRELOADable library on glibc systems, to provide the extra
6894+ features that the functions in the libc don't have (namely, logging). */
6895+
6896
6897 #undef gettext
6898 #undef dgettext
6899 #undef dcgettext
6900+#undef ngettext
6901+#undef dngettext
6902+#undef dcngettext
6903 #undef textdomain
6904 #undef bindtextdomain
6905+#undef bind_textdomain_codeset
6906+
6907+
6908+/* When building a DLL, we must export some functions. Note that because
6909+ the functions are only defined for binary backward compatibility, we
6910+ don't need to use __declspec(dllimport) in any case. */
6911+#if defined _MSC_VER && BUILDING_DLL
6912+# define DLL_EXPORTED __declspec(dllexport)
6913+#else
6914+# define DLL_EXPORTED
6915+#endif
6916
6917
6918+DLL_EXPORTED
6919 char *
6920-bindtextdomain (domainname, dirname)
6921- const char *domainname;
6922- const char *dirname;
6923+gettext (const char *msgid)
6924 {
6925- return bindtextdomain__ (domainname, dirname);
6926+ return libintl_gettext (msgid);
6927 }
6928
6929
6930+DLL_EXPORTED
6931 char *
6932-dcgettext (domainname, msgid, category)
6933- const char *domainname;
6934- const char *msgid;
6935- int category;
6936+dgettext (const char *domainname, const char *msgid)
6937 {
6938- return dcgettext__ (domainname, msgid, category);
6939+ return libintl_dgettext (domainname, msgid);
6940 }
6941
6942
6943+DLL_EXPORTED
6944 char *
6945-dgettext (domainname, msgid)
6946- const char *domainname;
6947- const char *msgid;
6948+dcgettext (const char *domainname, const char *msgid, int category)
6949 {
6950- return dgettext__ (domainname, msgid);
6951+ return libintl_dcgettext (domainname, msgid, category);
6952 }
6953
6954
6955+DLL_EXPORTED
6956 char *
6957-gettext (msgid)
6958- const char *msgid;
6959+ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
6960 {
6961- return gettext__ (msgid);
6962+ return libintl_ngettext (msgid1, msgid2, n);
6963 }
6964
6965
6966+DLL_EXPORTED
6967 char *
6968-textdomain (domainname)
6969- const char *domainname;
6970+dngettext (const char *domainname,
6971+ const char *msgid1, const char *msgid2, unsigned long int n)
6972 {
6973- return textdomain__ (domainname);
6974+ return libintl_dngettext (domainname, msgid1, msgid2, n);
6975+}
6976+
6977+
6978+DLL_EXPORTED
6979+char *
6980+dcngettext (const char *domainname,
6981+ const char *msgid1, const char *msgid2, unsigned long int n,
6982+ int category)
6983+{
6984+ return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
6985+}
6986+
6987+
6988+DLL_EXPORTED
6989+char *
6990+textdomain (const char *domainname)
6991+{
6992+ return libintl_textdomain (domainname);
6993+}
6994+
6995+
6996+DLL_EXPORTED
6997+char *
6998+bindtextdomain (const char *domainname, const char *dirname)
6999+{
7000+ return libintl_bindtextdomain (domainname, dirname);
7001+}
7002+
7003+
7004+DLL_EXPORTED
7005+char *
7006+bind_textdomain_codeset (const char *domainname, const char *codeset)
7007+{
7008+ return libintl_bind_textdomain_codeset (domainname, codeset);
7009 }
7010--- lrzsz-0.12.20.safe/intl/l10nflist.c 1998-04-26 09:22:37.000000000 -0400
7011+++ lrzsz-0.12.20/intl/l10nflist.c 2004-09-12 14:40:34.457732584 -0400
7012@@ -1,52 +1,40 @@
7013-/* Handle list of needed message catalogs
7014- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
7015- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
7016+/* Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
7017+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
7018
7019- This program is free software; you can redistribute it and/or modify
7020- it under the terms of the GNU General Public License as published by
7021- the Free Software Foundation; either version 2, or (at your option)
7022+ This program is free software; you can redistribute it and/or modify it
7023+ under the terms of the GNU Library General Public License as published
7024+ by the Free Software Foundation; either version 2, or (at your option)
7025 any later version.
7026
7027 This program is distributed in the hope that it will be useful,
7028 but WITHOUT ANY WARRANTY; without even the implied warranty of
7029- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7030- GNU General Public License for more details.
7031+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7032+ Library General Public License for more details.
7033
7034- You should have received a copy of the GNU General Public License
7035- along with this program; if not, write to the Free Software Foundation,
7036- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7037+ You should have received a copy of the GNU Library General Public
7038+ License along with this program; if not, write to the Free Software
7039+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
7040+ USA. */
7041+
7042+/* Tell glibc's <string.h> to provide a prototype for stpcpy().
7043+ This must come before <config.h> because <config.h> may include
7044+ <features.h>, and once <features.h> has been included, it's too late. */
7045+#ifndef _GNU_SOURCE
7046+# define _GNU_SOURCE 1
7047+#endif
7048
7049 #ifdef HAVE_CONFIG_H
7050 # include <config.h>
7051 #endif
7052
7053-
7054-#if defined HAVE_STRING_H || defined _LIBC
7055-# ifndef _GNU_SOURCE
7056-# define _GNU_SOURCE 1
7057-# endif
7058-# include <string.h>
7059-#else
7060-# include <strings.h>
7061-# ifndef memcpy
7062-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
7063-# endif
7064-#endif
7065-#if !HAVE_STRCHR && !defined _LIBC
7066-# ifndef strchr
7067-# define strchr index
7068-# endif
7069-#endif
7070+#include <string.h>
7071
7072 #if defined _LIBC || defined HAVE_ARGZ_H
7073 # include <argz.h>
7074 #endif
7075 #include <ctype.h>
7076 #include <sys/types.h>
7077-
7078-#if defined STDC_HEADERS || defined _LIBC
7079-# include <stdlib.h>
7080-#endif
7081+#include <stdlib.h>
7082
7083 #include "loadinfo.h"
7084
7085@@ -65,23 +53,39 @@
7086 /* Rename the non ANSI C functions. This is required by the standard
7087 because some ANSI C functions will require linking with this object
7088 file and the name space must not be polluted. */
7089-# define stpcpy(dest, src) __stpcpy(dest, src)
7090+# ifndef stpcpy
7091+# define stpcpy(dest, src) __stpcpy(dest, src)
7092+# endif
7093 #else
7094 # ifndef HAVE_STPCPY
7095-static char *stpcpy PARAMS ((char *dest, const char *src));
7096+static char *stpcpy (char *dest, const char *src);
7097 # endif
7098 #endif
7099
7100+/* Pathname support.
7101+ ISSLASH(C) tests whether C is a directory separator character.
7102+ IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
7103+ it may be concatenated to a directory pathname.
7104+ */
7105+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
7106+ /* Win32, OS/2, DOS */
7107+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
7108+# define HAS_DEVICE(P) \
7109+ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
7110+ && (P)[1] == ':')
7111+# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
7112+#else
7113+ /* Unix */
7114+# define ISSLASH(C) ((C) == '/')
7115+# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
7116+#endif
7117+
7118 /* Define function which are usually not available. */
7119
7120 #if !defined _LIBC && !defined HAVE___ARGZ_COUNT
7121 /* Returns the number of strings in ARGZ. */
7122-static size_t argz_count__ PARAMS ((const char *argz, size_t len));
7123-
7124 static size_t
7125-argz_count__ (argz, len)
7126- const char *argz;
7127- size_t len;
7128+argz_count__ (const char *argz, size_t len)
7129 {
7130 size_t count = 0;
7131 while (len > 0)
7132@@ -95,18 +99,17 @@
7133 }
7134 # undef __argz_count
7135 # define __argz_count(argz, len) argz_count__ (argz, len)
7136+#else
7137+# ifdef _LIBC
7138+# define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
7139+# endif
7140 #endif /* !_LIBC && !HAVE___ARGZ_COUNT */
7141
7142 #if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
7143 /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
7144 except the last into the character SEP. */
7145-static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
7146-
7147 static void
7148-argz_stringify__ (argz, len, sep)
7149- char *argz;
7150- size_t len;
7151- int sep;
7152+argz_stringify__ (char *argz, size_t len, int sep)
7153 {
7154 while (len > 0)
7155 {
7156@@ -119,17 +122,16 @@
7157 }
7158 # undef __argz_stringify
7159 # define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
7160+#else
7161+# ifdef _LIBC
7162+# define __argz_stringify(argz, len, sep) \
7163+ INTUSE(__argz_stringify) (argz, len, sep)
7164+# endif
7165 #endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
7166
7167 #if !defined _LIBC && !defined HAVE___ARGZ_NEXT
7168-static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
7169- const char *entry));
7170-
7171 static char *
7172-argz_next__ (argz, argz_len, entry)
7173- char *argz;
7174- size_t argz_len;
7175- const char *entry;
7176+argz_next__ (char *argz, size_t argz_len, const char *entry)
7177 {
7178 if (entry)
7179 {
7180@@ -150,11 +152,8 @@
7181
7182
7183 /* Return number of bits set in X. */
7184-static int pop PARAMS ((int x));
7185-
7186 static inline int
7187-pop (x)
7188- int x;
7189+pop (int x)
7190 {
7191 /* We assume that no more than 16 bits are used. */
7192 x = ((x & ~0x5555) >> 1) + (x & 0x5555);
7193@@ -167,31 +166,27 @@
7194
7195
7196 struct loaded_l10nfile *
7197-_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
7198- territory, codeset, normalized_codeset, modifier, special,
7199- sponsor, revision, filename, do_allocate)
7200- struct loaded_l10nfile **l10nfile_list;
7201- const char *dirlist;
7202- size_t dirlist_len;
7203- int mask;
7204- const char *language;
7205- const char *territory;
7206- const char *codeset;
7207- const char *normalized_codeset;
7208- const char *modifier;
7209- const char *special;
7210- const char *sponsor;
7211- const char *revision;
7212- const char *filename;
7213- int do_allocate;
7214+_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
7215+ const char *dirlist, size_t dirlist_len,
7216+ int mask, const char *language, const char *territory,
7217+ const char *codeset, const char *normalized_codeset,
7218+ const char *modifier, const char *special,
7219+ const char *sponsor, const char *revision,
7220+ const char *filename, int do_allocate)
7221 {
7222 char *abs_filename;
7223- struct loaded_l10nfile *last = NULL;
7224+ struct loaded_l10nfile **lastp;
7225 struct loaded_l10nfile *retval;
7226 char *cp;
7227+ size_t dirlist_count;
7228 size_t entries;
7229 int cnt;
7230
7231+ /* If LANGUAGE contains an absolute directory specification, we ignore
7232+ DIRLIST. */
7233+ if (IS_ABSOLUTE_PATH (language))
7234+ dirlist_len = 0;
7235+
7236 /* Allocate room for the full file name. */
7237 abs_filename = (char *) malloc (dirlist_len
7238 + strlen (language)
7239@@ -209,7 +204,7 @@
7240 + (((mask & CEN_SPONSOR) != 0
7241 || (mask & CEN_REVISION) != 0)
7242 ? (1 + ((mask & CEN_SPONSOR) != 0
7243- ? strlen (sponsor) + 1 : 0)
7244+ ? strlen (sponsor) : 0)
7245 + ((mask & CEN_REVISION) != 0
7246 ? strlen (revision) + 1 : 0)) : 0)
7247 + 1 + strlen (filename) + 1);
7248@@ -217,14 +212,16 @@
7249 if (abs_filename == NULL)
7250 return NULL;
7251
7252- retval = NULL;
7253- last = NULL;
7254-
7255 /* Construct file name. */
7256- memcpy (abs_filename, dirlist, dirlist_len);
7257- __argz_stringify (abs_filename, dirlist_len, ':');
7258- cp = abs_filename + (dirlist_len - 1);
7259- *cp++ = '/';
7260+ cp = abs_filename;
7261+ if (dirlist_len > 0)
7262+ {
7263+ memcpy (cp, dirlist, dirlist_len);
7264+ __argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
7265+ cp += dirlist_len;
7266+ cp[-1] = '/';
7267+ }
7268+
7269 cp = stpcpy (cp, language);
7270
7271 if ((mask & TERRITORY) != 0)
7272@@ -271,7 +268,7 @@
7273
7274 /* Look in list of already loaded domains whether it is already
7275 available. */
7276- last = NULL;
7277+ lastp = l10nfile_list;
7278 for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
7279 if (retval->filename != NULL)
7280 {
7281@@ -286,7 +283,7 @@
7282 break;
7283 }
7284
7285- last = retval;
7286+ lastp = &retval->next;
7287 }
7288
7289 if (retval != NULL || do_allocate == 0)
7290@@ -295,48 +292,66 @@
7291 return retval;
7292 }
7293
7294- retval = (struct loaded_l10nfile *)
7295- malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
7296- * (1 << pop (mask))
7297- * sizeof (struct loaded_l10nfile *)));
7298+ dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
7299+
7300+ /* Allocate a new loaded_l10nfile. */
7301+ retval =
7302+ (struct loaded_l10nfile *)
7303+ malloc (sizeof (*retval)
7304+ + (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
7305+ * sizeof (struct loaded_l10nfile *)));
7306 if (retval == NULL)
7307 return NULL;
7308
7309 retval->filename = abs_filename;
7310- retval->decided = (__argz_count (dirlist, dirlist_len) != 1
7311+
7312+ /* We set retval->data to NULL here; it is filled in later.
7313+ Setting retval->decided to 1 here means that retval does not
7314+ correspond to a real file (dirlist_count > 1) or is not worth
7315+ looking up (if an unnormalized codeset was specified). */
7316+ retval->decided = (dirlist_count > 1
7317 || ((mask & XPG_CODESET) != 0
7318 && (mask & XPG_NORM_CODESET) != 0));
7319 retval->data = NULL;
7320
7321- if (last == NULL)
7322- {
7323- retval->next = *l10nfile_list;
7324- *l10nfile_list = retval;
7325- }
7326- else
7327- {
7328- retval->next = last->next;
7329- last->next = retval;
7330- }
7331+ retval->next = *lastp;
7332+ *lastp = retval;
7333
7334 entries = 0;
7335- /* If the DIRLIST is a real list the RETVAL entry corresponds not to
7336- a real file. So we have to use the DIRLIST separation mechanism
7337- of the inner loop. */
7338- cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
7339- for (; cnt >= 0; --cnt)
7340+ /* Recurse to fill the inheritance list of RETVAL.
7341+ If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
7342+ entry does not correspond to a real file; retval->filename contains
7343+ colons. In this case we loop across all elements of DIRLIST and
7344+ across all bit patterns dominated by MASK.
7345+ If the DIRLIST is a single directory or entirely redundant (i.e.
7346+ DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
7347+ MASK, excluding MASK itself.
7348+ In either case, we loop down from MASK to 0. This has the effect
7349+ that the extra bits in the locale name are dropped in this order:
7350+ first the modifier, then the territory, then the codeset, then the
7351+ normalized_codeset. */
7352+ for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
7353 if ((cnt & ~mask) == 0
7354 && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
7355 && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
7356 {
7357- /* Iterate over all elements of the DIRLIST. */
7358- char *dir = NULL;
7359+ if (dirlist_count > 1)
7360+ {
7361+ /* Iterate over all elements of the DIRLIST. */
7362+ char *dir = NULL;
7363
7364- while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
7365- != NULL)
7366+ while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
7367+ != NULL)
7368+ retval->successor[entries++]
7369+ = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
7370+ cnt, language, territory, codeset,
7371+ normalized_codeset, modifier, special,
7372+ sponsor, revision, filename, 1);
7373+ }
7374+ else
7375 retval->successor[entries++]
7376- = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
7377- language, territory, codeset,
7378+ = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
7379+ cnt, language, territory, codeset,
7380 normalized_codeset, modifier, special,
7381 sponsor, revision, filename, 1);
7382 }
7383@@ -347,11 +362,10 @@
7384
7385 /* Normalize codeset name. There is no standard for the codeset
7386 names. Normalization allows the user to use any of the common
7387- names. */
7388+ names. The return value is dynamically allocated and has to be
7389+ freed by the caller. */
7390 const char *
7391-_nl_normalize_codeset (codeset, name_len)
7392- const char *codeset;
7393- size_t name_len;
7394+_nl_normalize_codeset (const char *codeset, size_t name_len)
7395 {
7396 int len = 0;
7397 int only_digit = 1;
7398@@ -360,11 +374,11 @@
7399 size_t cnt;
7400
7401 for (cnt = 0; cnt < name_len; ++cnt)
7402- if (isalnum (codeset[cnt]))
7403+ if (isalnum ((unsigned char) codeset[cnt]))
7404 {
7405 ++len;
7406
7407- if (isalpha (codeset[cnt]))
7408+ if (isalpha ((unsigned char) codeset[cnt]))
7409 only_digit = 0;
7410 }
7411
7412@@ -378,9 +392,9 @@
7413 wp = retval;
7414
7415 for (cnt = 0; cnt < name_len; ++cnt)
7416- if (isalpha (codeset[cnt]))
7417- *wp++ = tolower (codeset[cnt]);
7418- else if (isdigit (codeset[cnt]))
7419+ if (isalpha ((unsigned char) codeset[cnt]))
7420+ *wp++ = tolower ((unsigned char) codeset[cnt]);
7421+ else if (isdigit ((unsigned char) codeset[cnt]))
7422 *wp++ = codeset[cnt];
7423
7424 *wp = '\0';
7425@@ -398,9 +412,7 @@
7426 to be defined. */
7427 #if !_LIBC && !HAVE_STPCPY
7428 static char *
7429-stpcpy (dest, src)
7430- char *dest;
7431- const char *src;
7432+stpcpy (char *dest, const char *src)
7433 {
7434 while ((*dest++ = *src++) != '\0')
7435 /* Do nothing. */ ;
7436--- lrzsz-0.12.20.safe/intl/libgettext.h 1998-04-26 09:22:36.000000000 -0400
7437+++ lrzsz-0.12.20/intl/libgettext.h 1969-12-31 19:00:00.000000000 -0500
7438@@ -1,182 +0,0 @@
7439-/* Message catalogs for internationalization.
7440- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
7441-
7442- This program is free software; you can redistribute it and/or modify
7443- it under the terms of the GNU General Public License as published by
7444- the Free Software Foundation; either version 2, or (at your option)
7445- any later version.
7446-
7447- This program is distributed in the hope that it will be useful,
7448- but WITHOUT ANY WARRANTY; without even the implied warranty of
7449- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7450- GNU General Public License for more details.
7451-
7452- You should have received a copy of the GNU General Public License
7453- along with this program; if not, write to the Free Software Foundation,
7454- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
7455-
7456-/* Because on some systems (e.g. Solaris) we sometimes have to include
7457- the systems libintl.h as well as this file we have more complex
7458- include protection above. But the systems header might perhaps also
7459- define _LIBINTL_H and therefore we have to protect the definition here. */
7460-
7461-#if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
7462-#if !defined (_LIBINTL_H)
7463-# define _LIBINTL_H 1
7464-#endif
7465-#define _LIBGETTEXT_H 1
7466-
7467-/* We define an additional symbol to signal that we use the GNU
7468- implementation of gettext. */
7469-#define __USE_GNU_GETTEXT 1
7470-
7471-#include <sys/types.h>
7472-
7473-#if HAVE_LOCALE_H
7474-# include <locale.h>
7475-#endif
7476-
7477-
7478-#ifdef __cplusplus
7479-extern "C" {
7480-#endif
7481-
7482-/* @@ end of prolog @@ */
7483-
7484-#ifndef PARAMS
7485-# if __STDC__
7486-# define PARAMS(args) args
7487-# else
7488-# define PARAMS(args) ()
7489-# endif
7490-#endif
7491-
7492-#ifndef NULL
7493-# if !defined __cplusplus || defined __GNUC__
7494-# define NULL ((void *) 0)
7495-# else
7496-# define NULL (0)
7497-# endif
7498-#endif
7499-
7500-#if !HAVE_LC_MESSAGES
7501-/* This value determines the behaviour of the gettext() and dgettext()
7502- function. But some system does not have this defined. Define it
7503- to a default value. */
7504-# define LC_MESSAGES (-1)
7505-#endif
7506-
7507-
7508-/* Declarations for gettext-using-catgets interface. Derived from
7509- Jim Meyering's libintl.h. */
7510-struct _msg_ent
7511-{
7512- const char *_msg;
7513- int _msg_number;
7514-};
7515-
7516-
7517-#if HAVE_CATGETS
7518-/* These two variables are defined in the automatically by po-to-tbl.sed
7519- generated file `cat-id-tbl.c'. */
7520-extern const struct _msg_ent _msg_tbl[];
7521-extern int _msg_tbl_length;
7522-#endif
7523-
7524-
7525-/* For automatical extraction of messages sometimes no real
7526- translation is needed. Instead the string itself is the result. */
7527-#define gettext_noop(Str) (Str)
7528-
7529-/* Look up MSGID in the current default message catalog for the current
7530- LC_MESSAGES locale. If not found, returns MSGID itself (the default
7531- text). */
7532-extern char *gettext PARAMS ((const char *__msgid));
7533-extern char *gettext__ PARAMS ((const char *__msgid));
7534-
7535-/* Look up MSGID in the DOMAINNAME message catalog for the current
7536- LC_MESSAGES locale. */
7537-extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
7538-extern char *dgettext__ PARAMS ((const char *__domainname,
7539- const char *__msgid));
7540-
7541-/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
7542- locale. */
7543-extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
7544- int __category));
7545-extern char *dcgettext__ PARAMS ((const char *__domainname,
7546- const char *__msgid, int __category));
7547-
7548-
7549-/* Set the current default message catalog to DOMAINNAME.
7550- If DOMAINNAME is null, return the current default.
7551- If DOMAINNAME is "", reset to the default of "messages". */
7552-extern char *textdomain PARAMS ((const char *__domainname));
7553-extern char *textdomain__ PARAMS ((const char *__domainname));
7554-
7555-/* Specify that the DOMAINNAME message catalog will be found
7556- in DIRNAME rather than in the system locale data base. */
7557-extern char *bindtextdomain PARAMS ((const char *__domainname,
7558- const char *__dirname));
7559-extern char *bindtextdomain__ PARAMS ((const char *__domainname,
7560- const char *__dirname));
7561-
7562-#if ENABLE_NLS
7563-
7564-/* Solaris 2.3 has the gettext function but dcgettext is missing.
7565- So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
7566- has dcgettext. */
7567-# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
7568-
7569-# define gettext(Msgid) \
7570- dgettext (NULL, Msgid)
7571-
7572-# define dgettext(Domainname, Msgid) \
7573- dcgettext (Domainname, Msgid, LC_MESSAGES)
7574-
7575-# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
7576-/* This global variable is defined in loadmsgcat.c. We need a sign,
7577- whether a new catalog was loaded, which can be associated with all
7578- translations. */
7579-extern int _nl_msg_cat_cntr;
7580-
7581-# define dcgettext(Domainname, Msgid, Category) \
7582- (__extension__ \
7583- ({ \
7584- char *__result; \
7585- if (__builtin_constant_p (Msgid)) \
7586- { \
7587- static char *__translation__; \
7588- static int __catalog_counter__; \
7589- if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
7590- { \
7591- __translation__ = \
7592- dcgettext__ (Domainname, Msgid, Category); \
7593- __catalog_counter__ = _nl_msg_cat_cntr; \
7594- } \
7595- __result = __translation__; \
7596- } \
7597- else \
7598- __result = dcgettext__ (Domainname, Msgid, Category); \
7599- __result; \
7600- }))
7601-# endif
7602-# endif
7603-
7604-#else
7605-
7606-# define gettext(Msgid) (Msgid)
7607-# define dgettext(Domainname, Msgid) (Msgid)
7608-# define dcgettext(Domainname, Msgid, Category) (Msgid)
7609-# define textdomain(Domainname) while (0) /* nothing */
7610-# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
7611-
7612-#endif
7613-
7614-/* @@ begin of epilog @@ */
7615-
7616-#ifdef __cplusplus
7617-}
7618-#endif
7619-
7620-#endif
7621--- lrzsz-0.12.20.safe/intl/libgnuintl.h.in 1969-12-31 19:00:00.000000000 -0500
7622+++ lrzsz-0.12.20/intl/libgnuintl.h.in 2004-09-12 14:40:34.462731824 -0400
7623@@ -0,0 +1,383 @@
7624+/* Message catalogs for internationalization.
7625+ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
7626+
7627+ This program is free software; you can redistribute it and/or modify it
7628+ under the terms of the GNU Library General Public License as published
7629+ by the Free Software Foundation; either version 2, or (at your option)
7630+ any later version.
7631+
7632+ This program is distributed in the hope that it will be useful,
7633+ but WITHOUT ANY WARRANTY; without even the implied warranty of
7634+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7635+ Library General Public License for more details.
7636+
7637+ You should have received a copy of the GNU Library General Public
7638+ License along with this program; if not, write to the Free Software
7639+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
7640+ USA. */
7641+
7642+#ifndef _LIBINTL_H
7643+#define _LIBINTL_H 1
7644+
7645+#include <locale.h>
7646+
7647+/* The LC_MESSAGES locale category is the category used by the functions
7648+ gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
7649+ On systems that don't define it, use an arbitrary value instead.
7650+ On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
7651+ then includes <libintl.h> (i.e. this file!) and then only defines
7652+ LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
7653+ in this case. */
7654+#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
7655+# define LC_MESSAGES 1729
7656+#endif
7657+
7658+/* We define an additional symbol to signal that we use the GNU
7659+ implementation of gettext. */
7660+#define __USE_GNU_GETTEXT 1
7661+
7662+/* Provide information about the supported file formats. Returns the
7663+ maximum minor revision number supported for a given major revision. */
7664+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
7665+ ((major) == 0 ? 1 : -1)
7666+
7667+/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
7668+ precedence over _conio_gettext. */
7669+#ifdef __DJGPP__
7670+# undef gettext
7671+#endif
7672+
7673+#ifdef __cplusplus
7674+extern "C" {
7675+#endif
7676+
7677+
7678+/* We redirect the functions to those prefixed with "libintl_". This is
7679+ necessary, because some systems define gettext/textdomain/... in the C
7680+ library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
7681+ If we used the unprefixed names, there would be cases where the
7682+ definition in the C library would override the one in the libintl.so
7683+ shared library. Recall that on ELF systems, the symbols are looked
7684+ up in the following order:
7685+ 1. in the executable,
7686+ 2. in the shared libraries specified on the link command line, in order,
7687+ 3. in the dependencies of the shared libraries specified on the link
7688+ command line,
7689+ 4. in the dlopen()ed shared libraries, in the order in which they were
7690+ dlopen()ed.
7691+ The definition in the C library would override the one in libintl.so if
7692+ either
7693+ * -lc is given on the link command line and -lintl isn't, or
7694+ * -lc is given on the link command line before -lintl, or
7695+ * libintl.so is a dependency of a dlopen()ed shared library but not
7696+ linked to the executable at link time.
7697+ Since Solaris gettext() behaves differently than GNU gettext(), this
7698+ would be unacceptable.
7699+
7700+ The redirection happens by default through macros in C, so that &gettext
7701+ is independent of the compilation unit, but through inline functions in
7702+ C++, in order not to interfere with the name mangling of class fields or
7703+ class methods called 'gettext'. */
7704+
7705+/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
7706+ If he doesn't, we choose the method. A third possible method is
7707+ _INTL_REDIRECT_ASM, supported only by GCC. */
7708+#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
7709+# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
7710+# define _INTL_REDIRECT_ASM
7711+# else
7712+# ifdef __cplusplus
7713+# define _INTL_REDIRECT_INLINE
7714+# else
7715+# define _INTL_REDIRECT_MACROS
7716+# endif
7717+# endif
7718+#endif
7719+/* Auxiliary macros. */
7720+#ifdef _INTL_REDIRECT_ASM
7721+# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
7722+# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
7723+# define _INTL_STRINGIFY(prefix) #prefix
7724+#else
7725+# define _INTL_ASM(cname)
7726+#endif
7727+
7728+/* Look up MSGID in the current default message catalog for the current
7729+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
7730+ text). */
7731+#ifdef _INTL_REDIRECT_INLINE
7732+extern char *libintl_gettext (const char *__msgid);
7733+static inline char *gettext (const char *__msgid)
7734+{
7735+ return libintl_gettext (__msgid);
7736+}
7737+#else
7738+#ifdef _INTL_REDIRECT_MACROS
7739+# define gettext libintl_gettext
7740+#endif
7741+extern char *gettext (const char *__msgid)
7742+ _INTL_ASM (libintl_gettext);
7743+#endif
7744+
7745+/* Look up MSGID in the DOMAINNAME message catalog for the current
7746+ LC_MESSAGES locale. */
7747+#ifdef _INTL_REDIRECT_INLINE
7748+extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
7749+static inline char *dgettext (const char *__domainname, const char *__msgid)
7750+{
7751+ return libintl_dgettext (__domainname, __msgid);
7752+}
7753+#else
7754+#ifdef _INTL_REDIRECT_MACROS
7755+# define dgettext libintl_dgettext
7756+#endif
7757+extern char *dgettext (const char *__domainname, const char *__msgid)
7758+ _INTL_ASM (libintl_dgettext);
7759+#endif
7760+
7761+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
7762+ locale. */
7763+#ifdef _INTL_REDIRECT_INLINE
7764+extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
7765+ int __category);
7766+static inline char *dcgettext (const char *__domainname, const char *__msgid,
7767+ int __category)
7768+{
7769+ return libintl_dcgettext (__domainname, __msgid, __category);
7770+}
7771+#else
7772+#ifdef _INTL_REDIRECT_MACROS
7773+# define dcgettext libintl_dcgettext
7774+#endif
7775+extern char *dcgettext (const char *__domainname, const char *__msgid,
7776+ int __category)
7777+ _INTL_ASM (libintl_dcgettext);
7778+#endif
7779+
7780+
7781+/* Similar to `gettext' but select the plural form corresponding to the
7782+ number N. */
7783+#ifdef _INTL_REDIRECT_INLINE
7784+extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
7785+ unsigned long int __n);
7786+static inline char *ngettext (const char *__msgid1, const char *__msgid2,
7787+ unsigned long int __n)
7788+{
7789+ return libintl_ngettext (__msgid1, __msgid2, __n);
7790+}
7791+#else
7792+#ifdef _INTL_REDIRECT_MACROS
7793+# define ngettext libintl_ngettext
7794+#endif
7795+extern char *ngettext (const char *__msgid1, const char *__msgid2,
7796+ unsigned long int __n)
7797+ _INTL_ASM (libintl_ngettext);
7798+#endif
7799+
7800+/* Similar to `dgettext' but select the plural form corresponding to the
7801+ number N. */
7802+#ifdef _INTL_REDIRECT_INLINE
7803+extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
7804+ const char *__msgid2, unsigned long int __n);
7805+static inline char *dngettext (const char *__domainname, const char *__msgid1,
7806+ const char *__msgid2, unsigned long int __n)
7807+{
7808+ return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
7809+}
7810+#else
7811+#ifdef _INTL_REDIRECT_MACROS
7812+# define dngettext libintl_dngettext
7813+#endif
7814+extern char *dngettext (const char *__domainname,
7815+ const char *__msgid1, const char *__msgid2,
7816+ unsigned long int __n)
7817+ _INTL_ASM (libintl_dngettext);
7818+#endif
7819+
7820+/* Similar to `dcgettext' but select the plural form corresponding to the
7821+ number N. */
7822+#ifdef _INTL_REDIRECT_INLINE
7823+extern char *libintl_dcngettext (const char *__domainname,
7824+ const char *__msgid1, const char *__msgid2,
7825+ unsigned long int __n, int __category);
7826+static inline char *dcngettext (const char *__domainname,
7827+ const char *__msgid1, const char *__msgid2,
7828+ unsigned long int __n, int __category)
7829+{
7830+ return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
7831+}
7832+#else
7833+#ifdef _INTL_REDIRECT_MACROS
7834+# define dcngettext libintl_dcngettext
7835+#endif
7836+extern char *dcngettext (const char *__domainname,
7837+ const char *__msgid1, const char *__msgid2,
7838+ unsigned long int __n, int __category)
7839+ _INTL_ASM (libintl_dcngettext);
7840+#endif
7841+
7842+
7843+/* Set the current default message catalog to DOMAINNAME.
7844+ If DOMAINNAME is null, return the current default.
7845+ If DOMAINNAME is "", reset to the default of "messages". */
7846+#ifdef _INTL_REDIRECT_INLINE
7847+extern char *libintl_textdomain (const char *__domainname);
7848+static inline char *textdomain (const char *__domainname)
7849+{
7850+ return libintl_textdomain (__domainname);
7851+}
7852+#else
7853+#ifdef _INTL_REDIRECT_MACROS
7854+# define textdomain libintl_textdomain
7855+#endif
7856+extern char *textdomain (const char *__domainname)
7857+ _INTL_ASM (libintl_textdomain);
7858+#endif
7859+
7860+/* Specify that the DOMAINNAME message catalog will be found
7861+ in DIRNAME rather than in the system locale data base. */
7862+#ifdef _INTL_REDIRECT_INLINE
7863+extern char *libintl_bindtextdomain (const char *__domainname,
7864+ const char *__dirname);
7865+static inline char *bindtextdomain (const char *__domainname,
7866+ const char *__dirname)
7867+{
7868+ return libintl_bindtextdomain (__domainname, __dirname);
7869+}
7870+#else
7871+#ifdef _INTL_REDIRECT_MACROS
7872+# define bindtextdomain libintl_bindtextdomain
7873+#endif
7874+extern char *bindtextdomain (const char *__domainname, const char *__dirname)
7875+ _INTL_ASM (libintl_bindtextdomain);
7876+#endif
7877+
7878+/* Specify the character encoding in which the messages from the
7879+ DOMAINNAME message catalog will be returned. */
7880+#ifdef _INTL_REDIRECT_INLINE
7881+extern char *libintl_bind_textdomain_codeset (const char *__domainname,
7882+ const char *__codeset);
7883+static inline char *bind_textdomain_codeset (const char *__domainname,
7884+ const char *__codeset)
7885+{
7886+ return libintl_bind_textdomain_codeset (__domainname, __codeset);
7887+}
7888+#else
7889+#ifdef _INTL_REDIRECT_MACROS
7890+# define bind_textdomain_codeset libintl_bind_textdomain_codeset
7891+#endif
7892+extern char *bind_textdomain_codeset (const char *__domainname,
7893+ const char *__codeset)
7894+ _INTL_ASM (libintl_bind_textdomain_codeset);
7895+#endif
7896+
7897+
7898+/* Support for format strings with positions in *printf(), following the
7899+ POSIX/XSI specification.
7900+ Note: These replacements for the *printf() functions are visible only
7901+ in source files that #include <libintl.h> or #include "gettext.h".
7902+ Packages that use *printf() in source files that don't refer to _()
7903+ or gettext() but for which the format string could be the return value
7904+ of _() or gettext() need to add this #include. Oh well. */
7905+
7906+#if !@HAVE_POSIX_PRINTF@
7907+
7908+#include <stdio.h>
7909+#include <stddef.h>
7910+
7911+/* Get va_list. */
7912+#if __STDC__ || defined __cplusplus || defined _MSC_VER
7913+# include <stdarg.h>
7914+#else
7915+# include <varargs.h>
7916+#endif
7917+
7918+#undef fprintf
7919+#define fprintf libintl_fprintf
7920+extern int fprintf (FILE *, const char *, ...);
7921+#undef vfprintf
7922+#define vfprintf libintl_vfprintf
7923+extern int vfprintf (FILE *, const char *, va_list);
7924+
7925+#undef printf
7926+#define printf libintl_printf
7927+extern int printf (const char *, ...);
7928+#undef vprintf
7929+#define vprintf libintl_vprintf
7930+extern int vprintf (const char *, va_list);
7931+
7932+#undef sprintf
7933+#define sprintf libintl_sprintf
7934+extern int sprintf (char *, const char *, ...);
7935+#undef vsprintf
7936+#define vsprintf libintl_vsprintf
7937+extern int vsprintf (char *, const char *, va_list);
7938+
7939+#if @HAVE_SNPRINTF@
7940+
7941+#undef snprintf
7942+#define snprintf libintl_snprintf
7943+extern int snprintf (char *, size_t, const char *, ...);
7944+#undef vsnprintf
7945+#define vsnprintf libintl_vsnprintf
7946+extern int vsnprintf (char *, size_t, const char *, va_list);
7947+
7948+#endif
7949+
7950+#if @HAVE_ASPRINTF@
7951+
7952+#undef asprintf
7953+#define asprintf libintl_asprintf
7954+extern int asprintf (char **, const char *, ...);
7955+#undef vasprintf
7956+#define vasprintf libintl_vasprintf
7957+extern int vasprintf (char **, const char *, va_list);
7958+
7959+#endif
7960+
7961+#if @HAVE_WPRINTF@
7962+
7963+#undef fwprintf
7964+#define fwprintf libintl_fwprintf
7965+extern int fwprintf (FILE *, const wchar_t *, ...);
7966+#undef vfwprintf
7967+#define vfwprintf libintl_vfwprintf
7968+extern int vfwprintf (FILE *, const wchar_t *, va_list);
7969+
7970+#undef wprintf
7971+#define wprintf libintl_wprintf
7972+extern int wprintf (const wchar_t *, ...);
7973+#undef vwprintf
7974+#define vwprintf libintl_vwprintf
7975+extern int vwprintf (const wchar_t *, va_list);
7976+
7977+#undef swprintf
7978+#define swprintf libintl_swprintf
7979+extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
7980+#undef vswprintf
7981+#define vswprintf libintl_vswprintf
7982+extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
7983+
7984+#endif
7985+
7986+#endif
7987+
7988+
7989+/* Support for relocatable packages. */
7990+
7991+/* Sets the original and the current installation prefix of the package.
7992+ Relocation simply replaces a pathname starting with the original prefix
7993+ by the corresponding pathname with the current prefix instead. Both
7994+ prefixes should be directory names without trailing slash (i.e. use ""
7995+ instead of "/"). */
7996+#define libintl_set_relocation_prefix libintl_set_relocation_prefix
7997+extern void
7998+ libintl_set_relocation_prefix (const char *orig_prefix,
7999+ const char *curr_prefix);
8000+
8001+
8002+#ifdef __cplusplus
8003+}
8004+#endif
8005+
8006+#endif /* libintl.h */
8007--- lrzsz-0.12.20.safe/intl/linux-msg.sed 1998-04-26 09:20:52.000000000 -0400
8008+++ lrzsz-0.12.20/intl/linux-msg.sed 1969-12-31 19:00:00.000000000 -0500
8009@@ -1,100 +0,0 @@
8010-# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
8011-# Copyright (C) 1995 Free Software Foundation, Inc.
8012-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
8013-#
8014-# This program is free software; you can redistribute it and/or modify
8015-# it under the terms of the GNU General Public License as published by
8016-# the Free Software Foundation; either version 2, or (at your option)
8017-# any later version.
8018-#
8019-# This program is distributed in the hope that it will be useful,
8020-# but WITHOUT ANY WARRANTY; without even the implied warranty of
8021-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8022-# GNU General Public License for more details.
8023-#
8024-# You should have received a copy of the GNU General Public License
8025-# along with this program; if not, write to the Free Software
8026-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
8027-#
8028-#
8029-# The first directive in the .msg should be the definition of the
8030-# message set number. We use always set number 1.
8031-#
8032-1 {
8033- i\
8034-$set 1 # Automatically created by po2msg.sed
8035- h
8036- s/.*/0/
8037- x
8038-}
8039-#
8040-# Mitch's old catalog format does not allow comments.
8041-#
8042-# We copy the original message as a comment into the .msg file.
8043-#
8044-/^msgid/ {
8045- s/msgid[ ]*"//
8046-#
8047-# This does not work now with the new format.
8048-# /"$/! {
8049-# s/\\$//
8050-# s/$/ ... (more lines following)"/
8051-# }
8052- x
8053-# The following nice solution is by
8054-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
8055- td
8056-# Increment a decimal number in pattern space.
8057-# First hide trailing `9' digits.
8058- :d
8059- s/9\(_*\)$/_\1/
8060- td
8061-# Assure at least one digit is available.
8062- s/^\(_*\)$/0\1/
8063-# Increment the last digit.
8064- s/8\(_*\)$/9\1/
8065- s/7\(_*\)$/8\1/
8066- s/6\(_*\)$/7\1/
8067- s/5\(_*\)$/6\1/
8068- s/4\(_*\)$/5\1/
8069- s/3\(_*\)$/4\1/
8070- s/2\(_*\)$/3\1/
8071- s/1\(_*\)$/2\1/
8072- s/0\(_*\)$/1\1/
8073-# Convert the hidden `9' digits to `0's.
8074- s/_/0/g
8075- x
8076- G
8077- s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
8078-}
8079-#
8080-# The .msg file contains, other then the .po file, only the translations
8081-# but each given a unique ID. Starting from 1 and incrementing by 1 for
8082-# each message we assign them to the messages.
8083-# It is important that the .po file used to generate the cat-id-tbl.c file
8084-# (with po-to-tbl) is the same as the one used here. (At least the order
8085-# of declarations must not be changed.)
8086-#
8087-/^msgstr/ {
8088- s/msgstr[ ]*"\(.*\)"/# \1/
8089-# Clear substitution flag.
8090- tb
8091-# Append the next line.
8092- :b
8093- N
8094-# Look whether second part is continuation line.
8095- s/\(.*\n\)"\(.*\)"/\1\2/
8096-# Yes, then branch.
8097- ta
8098- P
8099- D
8100-# Note that D includes a jump to the start!!
8101-# We found a continuation line. But before printing insert '\'.
8102- :a
8103- s/\(.*\)\(\n.*\)/\1\\\2/
8104- P
8105-# We cannot use D here.
8106- s/.*\n\(.*\)/\1/
8107- tb
8108-}
8109-d
8110--- lrzsz-0.12.20.safe/intl/loadinfo.h 1998-04-26 09:20:52.000000000 -0400
8111+++ lrzsz-0.12.20/intl/loadinfo.h 2004-09-12 14:40:34.468730912 -0400
8112@@ -1,9 +1,54 @@
8113-#ifndef PARAMS
8114-# if __STDC__
8115-# define PARAMS(args) args
8116-# else
8117-# define PARAMS(args) ()
8118-# endif
8119+/* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
8120+ This file is part of the GNU C Library.
8121+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
8122+
8123+ This program is free software; you can redistribute it and/or modify it
8124+ under the terms of the GNU Library General Public License as published
8125+ by the Free Software Foundation; either version 2, or (at your option)
8126+ any later version.
8127+
8128+ This program is distributed in the hope that it will be useful,
8129+ but WITHOUT ANY WARRANTY; without even the implied warranty of
8130+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8131+ Library General Public License for more details.
8132+
8133+ You should have received a copy of the GNU Library General Public
8134+ License along with this program; if not, write to the Free Software
8135+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
8136+ USA. */
8137+
8138+#ifndef _LOADINFO_H
8139+#define _LOADINFO_H 1
8140+
8141+/* Declarations of locale dependent catalog lookup functions.
8142+ Implemented in
8143+
8144+ localealias.c Possibly replace a locale name by another.
8145+ explodename.c Split a locale name into its various fields.
8146+ l10nflist.c Generate a list of filenames of possible message catalogs.
8147+ finddomain.c Find and open the relevant message catalogs.
8148+
8149+ The main function _nl_find_domain() in finddomain.c is declared
8150+ in gettextP.h.
8151+ */
8152+
8153+#ifndef internal_function
8154+# define internal_function
8155+#endif
8156+
8157+/* Tell the compiler when a conditional or integer expression is
8158+ almost always true or almost always false. */
8159+#ifndef HAVE_BUILTIN_EXPECT
8160+# define __builtin_expect(expr, val) (expr)
8161+#endif
8162+
8163+/* Separator in PATH like lists of pathnames. */
8164+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
8165+ /* Win32, OS/2, DOS */
8166+# define PATH_SEPARATOR ';'
8167+#else
8168+ /* Unix */
8169+# define PATH_SEPARATOR ':'
8170 #endif
8171
8172 /* Encoding of locale name parts. */
8173@@ -32,27 +77,69 @@
8174 };
8175
8176
8177-extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
8178- size_t name_len));
8179+/* Normalize codeset name. There is no standard for the codeset
8180+ names. Normalization allows the user to use any of the common
8181+ names. The return value is dynamically allocated and has to be
8182+ freed by the caller. */
8183+extern const char *_nl_normalize_codeset (const char *codeset,
8184+ size_t name_len);
8185
8186+/* Lookup a locale dependent file.
8187+ *L10NFILE_LIST denotes a pool of lookup results of locale dependent
8188+ files of the same kind, sorted in decreasing order of ->filename.
8189+ DIRLIST and DIRLIST_LEN are an argz list of directories in which to
8190+ look, containing at least one directory (i.e. DIRLIST_LEN > 0).
8191+ MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
8192+ SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
8193+ produced by _nl_explode_name(). FILENAME is the filename suffix.
8194+ The return value is the lookup result, either found in *L10NFILE_LIST,
8195+ or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
8196+ If the return value is non-NULL, it is added to *L10NFILE_LIST, and
8197+ its ->next field denotes the chaining inside *L10NFILE_LIST, and
8198+ furthermore its ->successor[] field contains a list of other lookup
8199+ results from which this lookup result inherits. */
8200 extern struct loaded_l10nfile *
8201-_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
8202- const char *dirlist, size_t dirlist_len, int mask,
8203- const char *language, const char *territory,
8204- const char *codeset,
8205- const char *normalized_codeset,
8206- const char *modifier, const char *special,
8207- const char *sponsor, const char *revision,
8208- const char *filename, int do_allocate));
8209+_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
8210+ const char *dirlist, size_t dirlist_len, int mask,
8211+ const char *language, const char *territory,
8212+ const char *codeset, const char *normalized_codeset,
8213+ const char *modifier, const char *special,
8214+ const char *sponsor, const char *revision,
8215+ const char *filename, int do_allocate);
8216
8217+/* Lookup the real locale name for a locale alias NAME, or NULL if
8218+ NAME is not a locale alias (but possibly a real locale name).
8219+ The return value is statically allocated and must not be freed. */
8220+extern const char *_nl_expand_alias (const char *name);
8221
8222-extern const char *_nl_expand_alias PARAMS ((const char *name));
8223+/* Split a locale name NAME into its pieces: language, modifier,
8224+ territory, codeset, special, sponsor, revision.
8225+ NAME gets destructively modified: NUL bytes are inserted here and
8226+ there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
8227+ *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
8228+ pointer into the old NAME string, or NULL. *NORMALIZED_CODESET
8229+ gets assigned the expanded *CODESET, if it is different from *CODESET;
8230+ this one is dynamically allocated and has to be freed by the caller.
8231+ The return value is a bitmask, where each bit corresponds to one
8232+ filled-in value:
8233+ XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER,
8234+ TERRITORY for *TERRITORY,
8235+ XPG_CODESET for *CODESET,
8236+ XPG_NORM_CODESET for *NORMALIZED_CODESET,
8237+ CEN_SPECIAL for *SPECIAL,
8238+ CEN_SPONSOR for *SPONSOR,
8239+ CEN_REVISION for *REVISION.
8240+ */
8241+extern int _nl_explode_name (char *name, const char **language,
8242+ const char **modifier, const char **territory,
8243+ const char **codeset,
8244+ const char **normalized_codeset,
8245+ const char **special, const char **sponsor,
8246+ const char **revision);
8247
8248-extern int _nl_explode_name PARAMS ((char *name, const char **language,
8249- const char **modifier,
8250- const char **territory,
8251- const char **codeset,
8252- const char **normalized_codeset,
8253- const char **special,
8254- const char **sponsor,
8255- const char **revision));
8256+/* Split a locale name NAME into a leading language part and all the
8257+ rest. Return a pointer to the first character after the language,
8258+ i.e. to the first byte of the rest. */
8259+extern char *_nl_find_language (const char *name);
8260+
8261+#endif /* loadinfo.h */
8262--- lrzsz-0.12.20.safe/intl/loadmsgcat.c 1998-04-26 09:22:37.000000000 -0400
8263+++ lrzsz-0.12.20/intl/loadmsgcat.c 2004-09-12 14:40:34.473730152 -0400
8264@@ -1,42 +1,455 @@
8265-/* Load needed message catalogs
8266- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
8267+/* Load needed message catalogs.
8268+ Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
8269
8270- This program is free software; you can redistribute it and/or modify
8271- it under the terms of the GNU General Public License as published by
8272- the Free Software Foundation; either version 2, or (at your option)
8273+ This program is free software; you can redistribute it and/or modify it
8274+ under the terms of the GNU Library General Public License as published
8275+ by the Free Software Foundation; either version 2, or (at your option)
8276 any later version.
8277
8278 This program is distributed in the hope that it will be useful,
8279 but WITHOUT ANY WARRANTY; without even the implied warranty of
8280- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8281- GNU General Public License for more details.
8282+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8283+ Library General Public License for more details.
8284
8285- You should have received a copy of the GNU General Public License
8286- along with this program; if not, write to the Free Software Foundation,
8287- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
8288+ You should have received a copy of the GNU Library General Public
8289+ License along with this program; if not, write to the Free Software
8290+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
8291+ USA. */
8292+
8293+/* Tell glibc's <string.h> to provide a prototype for mempcpy().
8294+ This must come before <config.h> because <config.h> may include
8295+ <features.h>, and once <features.h> has been included, it's too late. */
8296+#ifndef _GNU_SOURCE
8297+# define _GNU_SOURCE 1
8298+#endif
8299
8300 #ifdef HAVE_CONFIG_H
8301 # include <config.h>
8302 #endif
8303
8304+#include <ctype.h>
8305+#include <errno.h>
8306 #include <fcntl.h>
8307 #include <sys/types.h>
8308 #include <sys/stat.h>
8309
8310-#if defined STDC_HEADERS || defined _LIBC
8311-# include <stdlib.h>
8312+#ifdef __GNUC__
8313+# undef alloca
8314+# define alloca __builtin_alloca
8315+# define HAVE_ALLOCA 1
8316+#else
8317+# ifdef _MSC_VER
8318+# include <malloc.h>
8319+# define alloca _alloca
8320+# else
8321+# if defined HAVE_ALLOCA_H || defined _LIBC
8322+# include <alloca.h>
8323+# else
8324+# ifdef _AIX
8325+ #pragma alloca
8326+# else
8327+# ifndef alloca
8328+char *alloca ();
8329+# endif
8330+# endif
8331+# endif
8332+# endif
8333 #endif
8334
8335+#include <stdlib.h>
8336+#include <string.h>
8337+
8338 #if defined HAVE_UNISTD_H || defined _LIBC
8339 # include <unistd.h>
8340 #endif
8341
8342-#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
8343+#ifdef _LIBC
8344+# include <langinfo.h>
8345+# include <locale.h>
8346+#endif
8347+
8348+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
8349+ || (defined _LIBC && defined _POSIX_MAPPED_FILES)
8350 # include <sys/mman.h>
8351+# undef HAVE_MMAP
8352+# define HAVE_MMAP 1
8353+#else
8354+# undef HAVE_MMAP
8355 #endif
8356
8357-#include "gettext.h"
8358+#if defined HAVE_STDINT_H_WITH_UINTMAX || defined _LIBC
8359+# include <stdint.h>
8360+#endif
8361+#if defined HAVE_INTTYPES_H || defined _LIBC
8362+# include <inttypes.h>
8363+#endif
8364+
8365+#include "gmo.h"
8366 #include "gettextP.h"
8367+#include "hash-string.h"
8368+#include "plural-exp.h"
8369+
8370+#ifdef _LIBC
8371+# include "../locale/localeinfo.h"
8372+#endif
8373+
8374+/* Provide fallback values for macros that ought to be defined in <inttypes.h>.
8375+ Note that our fallback values need not be literal strings, because we don't
8376+ use them with preprocessor string concatenation. */
8377+#if !defined PRId8 || PRI_MACROS_BROKEN
8378+# undef PRId8
8379+# define PRId8 "d"
8380+#endif
8381+#if !defined PRIi8 || PRI_MACROS_BROKEN
8382+# undef PRIi8
8383+# define PRIi8 "i"
8384+#endif
8385+#if !defined PRIo8 || PRI_MACROS_BROKEN
8386+# undef PRIo8
8387+# define PRIo8 "o"
8388+#endif
8389+#if !defined PRIu8 || PRI_MACROS_BROKEN
8390+# undef PRIu8
8391+# define PRIu8 "u"
8392+#endif
8393+#if !defined PRIx8 || PRI_MACROS_BROKEN
8394+# undef PRIx8
8395+# define PRIx8 "x"
8396+#endif
8397+#if !defined PRIX8 || PRI_MACROS_BROKEN
8398+# undef PRIX8
8399+# define PRIX8 "X"
8400+#endif
8401+#if !defined PRId16 || PRI_MACROS_BROKEN
8402+# undef PRId16
8403+# define PRId16 "d"
8404+#endif
8405+#if !defined PRIi16 || PRI_MACROS_BROKEN
8406+# undef PRIi16
8407+# define PRIi16 "i"
8408+#endif
8409+#if !defined PRIo16 || PRI_MACROS_BROKEN
8410+# undef PRIo16
8411+# define PRIo16 "o"
8412+#endif
8413+#if !defined PRIu16 || PRI_MACROS_BROKEN
8414+# undef PRIu16
8415+# define PRIu16 "u"
8416+#endif
8417+#if !defined PRIx16 || PRI_MACROS_BROKEN
8418+# undef PRIx16
8419+# define PRIx16 "x"
8420+#endif
8421+#if !defined PRIX16 || PRI_MACROS_BROKEN
8422+# undef PRIX16
8423+# define PRIX16 "X"
8424+#endif
8425+#if !defined PRId32 || PRI_MACROS_BROKEN
8426+# undef PRId32
8427+# define PRId32 "d"
8428+#endif
8429+#if !defined PRIi32 || PRI_MACROS_BROKEN
8430+# undef PRIi32
8431+# define PRIi32 "i"
8432+#endif
8433+#if !defined PRIo32 || PRI_MACROS_BROKEN
8434+# undef PRIo32
8435+# define PRIo32 "o"
8436+#endif
8437+#if !defined PRIu32 || PRI_MACROS_BROKEN
8438+# undef PRIu32
8439+# define PRIu32 "u"
8440+#endif
8441+#if !defined PRIx32 || PRI_MACROS_BROKEN
8442+# undef PRIx32
8443+# define PRIx32 "x"
8444+#endif
8445+#if !defined PRIX32 || PRI_MACROS_BROKEN
8446+# undef PRIX32
8447+# define PRIX32 "X"
8448+#endif
8449+#if !defined PRId64 || PRI_MACROS_BROKEN
8450+# undef PRId64
8451+# define PRId64 (sizeof (long) == 8 ? "ld" : "lld")
8452+#endif
8453+#if !defined PRIi64 || PRI_MACROS_BROKEN
8454+# undef PRIi64
8455+# define PRIi64 (sizeof (long) == 8 ? "li" : "lli")
8456+#endif
8457+#if !defined PRIo64 || PRI_MACROS_BROKEN
8458+# undef PRIo64
8459+# define PRIo64 (sizeof (long) == 8 ? "lo" : "llo")
8460+#endif
8461+#if !defined PRIu64 || PRI_MACROS_BROKEN
8462+# undef PRIu64
8463+# define PRIu64 (sizeof (long) == 8 ? "lu" : "llu")
8464+#endif
8465+#if !defined PRIx64 || PRI_MACROS_BROKEN
8466+# undef PRIx64
8467+# define PRIx64 (sizeof (long) == 8 ? "lx" : "llx")
8468+#endif
8469+#if !defined PRIX64 || PRI_MACROS_BROKEN
8470+# undef PRIX64
8471+# define PRIX64 (sizeof (long) == 8 ? "lX" : "llX")
8472+#endif
8473+#if !defined PRIdLEAST8 || PRI_MACROS_BROKEN
8474+# undef PRIdLEAST8
8475+# define PRIdLEAST8 "d"
8476+#endif
8477+#if !defined PRIiLEAST8 || PRI_MACROS_BROKEN
8478+# undef PRIiLEAST8
8479+# define PRIiLEAST8 "i"
8480+#endif
8481+#if !defined PRIoLEAST8 || PRI_MACROS_BROKEN
8482+# undef PRIoLEAST8
8483+# define PRIoLEAST8 "o"
8484+#endif
8485+#if !defined PRIuLEAST8 || PRI_MACROS_BROKEN
8486+# undef PRIuLEAST8
8487+# define PRIuLEAST8 "u"
8488+#endif
8489+#if !defined PRIxLEAST8 || PRI_MACROS_BROKEN
8490+# undef PRIxLEAST8
8491+# define PRIxLEAST8 "x"
8492+#endif
8493+#if !defined PRIXLEAST8 || PRI_MACROS_BROKEN
8494+# undef PRIXLEAST8
8495+# define PRIXLEAST8 "X"
8496+#endif
8497+#if !defined PRIdLEAST16 || PRI_MACROS_BROKEN
8498+# undef PRIdLEAST16
8499+# define PRIdLEAST16 "d"
8500+#endif
8501+#if !defined PRIiLEAST16 || PRI_MACROS_BROKEN
8502+# undef PRIiLEAST16
8503+# define PRIiLEAST16 "i"
8504+#endif
8505+#if !defined PRIoLEAST16 || PRI_MACROS_BROKEN
8506+# undef PRIoLEAST16
8507+# define PRIoLEAST16 "o"
8508+#endif
8509+#if !defined PRIuLEAST16 || PRI_MACROS_BROKEN
8510+# undef PRIuLEAST16
8511+# define PRIuLEAST16 "u"
8512+#endif
8513+#if !defined PRIxLEAST16 || PRI_MACROS_BROKEN
8514+# undef PRIxLEAST16
8515+# define PRIxLEAST16 "x"
8516+#endif
8517+#if !defined PRIXLEAST16 || PRI_MACROS_BROKEN
8518+# undef PRIXLEAST16
8519+# define PRIXLEAST16 "X"
8520+#endif
8521+#if !defined PRIdLEAST32 || PRI_MACROS_BROKEN
8522+# undef PRIdLEAST32
8523+# define PRIdLEAST32 "d"
8524+#endif
8525+#if !defined PRIiLEAST32 || PRI_MACROS_BROKEN
8526+# undef PRIiLEAST32
8527+# define PRIiLEAST32 "i"
8528+#endif
8529+#if !defined PRIoLEAST32 || PRI_MACROS_BROKEN
8530+# undef PRIoLEAST32
8531+# define PRIoLEAST32 "o"
8532+#endif
8533+#if !defined PRIuLEAST32 || PRI_MACROS_BROKEN
8534+# undef PRIuLEAST32
8535+# define PRIuLEAST32 "u"
8536+#endif
8537+#if !defined PRIxLEAST32 || PRI_MACROS_BROKEN
8538+# undef PRIxLEAST32
8539+# define PRIxLEAST32 "x"
8540+#endif
8541+#if !defined PRIXLEAST32 || PRI_MACROS_BROKEN
8542+# undef PRIXLEAST32
8543+# define PRIXLEAST32 "X"
8544+#endif
8545+#if !defined PRIdLEAST64 || PRI_MACROS_BROKEN
8546+# undef PRIdLEAST64
8547+# define PRIdLEAST64 PRId64
8548+#endif
8549+#if !defined PRIiLEAST64 || PRI_MACROS_BROKEN
8550+# undef PRIiLEAST64
8551+# define PRIiLEAST64 PRIi64
8552+#endif
8553+#if !defined PRIoLEAST64 || PRI_MACROS_BROKEN
8554+# undef PRIoLEAST64
8555+# define PRIoLEAST64 PRIo64
8556+#endif
8557+#if !defined PRIuLEAST64 || PRI_MACROS_BROKEN
8558+# undef PRIuLEAST64
8559+# define PRIuLEAST64 PRIu64
8560+#endif
8561+#if !defined PRIxLEAST64 || PRI_MACROS_BROKEN
8562+# undef PRIxLEAST64
8563+# define PRIxLEAST64 PRIx64
8564+#endif
8565+#if !defined PRIXLEAST64 || PRI_MACROS_BROKEN
8566+# undef PRIXLEAST64
8567+# define PRIXLEAST64 PRIX64
8568+#endif
8569+#if !defined PRIdFAST8 || PRI_MACROS_BROKEN
8570+# undef PRIdFAST8
8571+# define PRIdFAST8 "d"
8572+#endif
8573+#if !defined PRIiFAST8 || PRI_MACROS_BROKEN
8574+# undef PRIiFAST8
8575+# define PRIiFAST8 "i"
8576+#endif
8577+#if !defined PRIoFAST8 || PRI_MACROS_BROKEN
8578+# undef PRIoFAST8
8579+# define PRIoFAST8 "o"
8580+#endif
8581+#if !defined PRIuFAST8 || PRI_MACROS_BROKEN
8582+# undef PRIuFAST8
8583+# define PRIuFAST8 "u"
8584+#endif
8585+#if !defined PRIxFAST8 || PRI_MACROS_BROKEN
8586+# undef PRIxFAST8
8587+# define PRIxFAST8 "x"
8588+#endif
8589+#if !defined PRIXFAST8 || PRI_MACROS_BROKEN
8590+# undef PRIXFAST8
8591+# define PRIXFAST8 "X"
8592+#endif
8593+#if !defined PRIdFAST16 || PRI_MACROS_BROKEN
8594+# undef PRIdFAST16
8595+# define PRIdFAST16 "d"
8596+#endif
8597+#if !defined PRIiFAST16 || PRI_MACROS_BROKEN
8598+# undef PRIiFAST16
8599+# define PRIiFAST16 "i"
8600+#endif
8601+#if !defined PRIoFAST16 || PRI_MACROS_BROKEN
8602+# undef PRIoFAST16
8603+# define PRIoFAST16 "o"
8604+#endif
8605+#if !defined PRIuFAST16 || PRI_MACROS_BROKEN
8606+# undef PRIuFAST16
8607+# define PRIuFAST16 "u"
8608+#endif
8609+#if !defined PRIxFAST16 || PRI_MACROS_BROKEN
8610+# undef PRIxFAST16
8611+# define PRIxFAST16 "x"
8612+#endif
8613+#if !defined PRIXFAST16 || PRI_MACROS_BROKEN
8614+# undef PRIXFAST16
8615+# define PRIXFAST16 "X"
8616+#endif
8617+#if !defined PRIdFAST32 || PRI_MACROS_BROKEN
8618+# undef PRIdFAST32
8619+# define PRIdFAST32 "d"
8620+#endif
8621+#if !defined PRIiFAST32 || PRI_MACROS_BROKEN
8622+# undef PRIiFAST32
8623+# define PRIiFAST32 "i"
8624+#endif
8625+#if !defined PRIoFAST32 || PRI_MACROS_BROKEN
8626+# undef PRIoFAST32
8627+# define PRIoFAST32 "o"
8628+#endif
8629+#if !defined PRIuFAST32 || PRI_MACROS_BROKEN
8630+# undef PRIuFAST32
8631+# define PRIuFAST32 "u"
8632+#endif
8633+#if !defined PRIxFAST32 || PRI_MACROS_BROKEN
8634+# undef PRIxFAST32
8635+# define PRIxFAST32 "x"
8636+#endif
8637+#if !defined PRIXFAST32 || PRI_MACROS_BROKEN
8638+# undef PRIXFAST32
8639+# define PRIXFAST32 "X"
8640+#endif
8641+#if !defined PRIdFAST64 || PRI_MACROS_BROKEN
8642+# undef PRIdFAST64
8643+# define PRIdFAST64 PRId64
8644+#endif
8645+#if !defined PRIiFAST64 || PRI_MACROS_BROKEN
8646+# undef PRIiFAST64
8647+# define PRIiFAST64 PRIi64
8648+#endif
8649+#if !defined PRIoFAST64 || PRI_MACROS_BROKEN
8650+# undef PRIoFAST64
8651+# define PRIoFAST64 PRIo64
8652+#endif
8653+#if !defined PRIuFAST64 || PRI_MACROS_BROKEN
8654+# undef PRIuFAST64
8655+# define PRIuFAST64 PRIu64
8656+#endif
8657+#if !defined PRIxFAST64 || PRI_MACROS_BROKEN
8658+# undef PRIxFAST64
8659+# define PRIxFAST64 PRIx64
8660+#endif
8661+#if !defined PRIXFAST64 || PRI_MACROS_BROKEN
8662+# undef PRIXFAST64
8663+# define PRIXFAST64 PRIX64
8664+#endif
8665+#if !defined PRIdMAX || PRI_MACROS_BROKEN
8666+# undef PRIdMAX
8667+# define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld")
8668+#endif
8669+#if !defined PRIiMAX || PRI_MACROS_BROKEN
8670+# undef PRIiMAX
8671+# define PRIiMAX (sizeof (uintmax_t) == sizeof (long) ? "li" : "lli")
8672+#endif
8673+#if !defined PRIoMAX || PRI_MACROS_BROKEN
8674+# undef PRIoMAX
8675+# define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo")
8676+#endif
8677+#if !defined PRIuMAX || PRI_MACROS_BROKEN
8678+# undef PRIuMAX
8679+# define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu")
8680+#endif
8681+#if !defined PRIxMAX || PRI_MACROS_BROKEN
8682+# undef PRIxMAX
8683+# define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx")
8684+#endif
8685+#if !defined PRIXMAX || PRI_MACROS_BROKEN
8686+# undef PRIXMAX
8687+# define PRIXMAX (sizeof (uintmax_t) == sizeof (long) ? "lX" : "llX")
8688+#endif
8689+#if !defined PRIdPTR || PRI_MACROS_BROKEN
8690+# undef PRIdPTR
8691+# define PRIdPTR \
8692+ (sizeof (void *) == sizeof (long) ? "ld" : \
8693+ sizeof (void *) == sizeof (int) ? "d" : \
8694+ "lld")
8695+#endif
8696+#if !defined PRIiPTR || PRI_MACROS_BROKEN
8697+# undef PRIiPTR
8698+# define PRIiPTR \
8699+ (sizeof (void *) == sizeof (long) ? "li" : \
8700+ sizeof (void *) == sizeof (int) ? "i" : \
8701+ "lli")
8702+#endif
8703+#if !defined PRIoPTR || PRI_MACROS_BROKEN
8704+# undef PRIoPTR
8705+# define PRIoPTR \
8706+ (sizeof (void *) == sizeof (long) ? "lo" : \
8707+ sizeof (void *) == sizeof (int) ? "o" : \
8708+ "llo")
8709+#endif
8710+#if !defined PRIuPTR || PRI_MACROS_BROKEN
8711+# undef PRIuPTR
8712+# define PRIuPTR \
8713+ (sizeof (void *) == sizeof (long) ? "lu" : \
8714+ sizeof (void *) == sizeof (int) ? "u" : \
8715+ "llu")
8716+#endif
8717+#if !defined PRIxPTR || PRI_MACROS_BROKEN
8718+# undef PRIxPTR
8719+# define PRIxPTR \
8720+ (sizeof (void *) == sizeof (long) ? "lx" : \
8721+ sizeof (void *) == sizeof (int) ? "x" : \
8722+ "llx")
8723+#endif
8724+#if !defined PRIXPTR || PRI_MACROS_BROKEN
8725+# undef PRIXPTR
8726+# define PRIXPTR \
8727+ (sizeof (void *) == sizeof (long) ? "lX" : \
8728+ sizeof (void *) == sizeof (int) ? "X" : \
8729+ "llX")
8730+#endif
8731
8732 /* @@ end of prolog @@ */
8733
8734@@ -44,7 +457,6 @@
8735 /* Rename the non ISO C functions. This is required by the standard
8736 because some ISO C functions will require linking with this object
8737 file and the name space must not be polluted. */
8738-# define fstat __fstat
8739 # define open __open
8740 # define close __close
8741 # define read __read
8742@@ -52,30 +464,471 @@
8743 # define munmap __munmap
8744 #endif
8745
8746+/* For those losing systems which don't have `alloca' we have to add
8747+ some additional code emulating it. */
8748+#ifdef HAVE_ALLOCA
8749+# define freea(p) /* nothing */
8750+#else
8751+# define alloca(n) malloc (n)
8752+# define freea(p) free (p)
8753+#endif
8754+
8755+/* For systems that distinguish between text and binary I/O.
8756+ O_BINARY is usually declared in <fcntl.h>. */
8757+#if !defined O_BINARY && defined _O_BINARY
8758+ /* For MSC-compatible compilers. */
8759+# define O_BINARY _O_BINARY
8760+# define O_TEXT _O_TEXT
8761+#endif
8762+#ifdef __BEOS__
8763+ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
8764+# undef O_BINARY
8765+# undef O_TEXT
8766+#endif
8767+/* On reasonable systems, binary I/O is the default. */
8768+#ifndef O_BINARY
8769+# define O_BINARY 0
8770+#endif
8771+
8772+
8773 /* We need a sign, whether a new catalog was loaded, which can be associated
8774 with all translations. This is important if the translations are
8775 cached by one of GCC's features. */
8776-int _nl_msg_cat_cntr = 0;
8777+int _nl_msg_cat_cntr;
8778
8779
8780+/* Expand a system dependent string segment. Return NULL if unsupported. */
8781+static const char *
8782+get_sysdep_segment_value (const char *name)
8783+{
8784+ /* Test for an ISO C 99 section 7.8.1 format string directive.
8785+ Syntax:
8786+ P R I { d | i | o | u | x | X }
8787+ { { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR } */
8788+ /* We don't use a table of 14 times 6 'const char *' strings here, because
8789+ data relocations cost startup time. */
8790+ if (name[0] == 'P' && name[1] == 'R' && name[2] == 'I')
8791+ {
8792+ if (name[3] == 'd' || name[3] == 'i' || name[3] == 'o' || name[3] == 'u'
8793+ || name[3] == 'x' || name[3] == 'X')
8794+ {
8795+ if (name[4] == '8' && name[5] == '\0')
8796+ {
8797+ if (name[3] == 'd')
8798+ return PRId8;
8799+ if (name[3] == 'i')
8800+ return PRIi8;
8801+ if (name[3] == 'o')
8802+ return PRIo8;
8803+ if (name[3] == 'u')
8804+ return PRIu8;
8805+ if (name[3] == 'x')
8806+ return PRIx8;
8807+ if (name[3] == 'X')
8808+ return PRIX8;
8809+ abort ();
8810+ }
8811+ if (name[4] == '1' && name[5] == '6' && name[6] == '\0')
8812+ {
8813+ if (name[3] == 'd')
8814+ return PRId16;
8815+ if (name[3] == 'i')
8816+ return PRIi16;
8817+ if (name[3] == 'o')
8818+ return PRIo16;
8819+ if (name[3] == 'u')
8820+ return PRIu16;
8821+ if (name[3] == 'x')
8822+ return PRIx16;
8823+ if (name[3] == 'X')
8824+ return PRIX16;
8825+ abort ();
8826+ }
8827+ if (name[4] == '3' && name[5] == '2' && name[6] == '\0')
8828+ {
8829+ if (name[3] == 'd')
8830+ return PRId32;
8831+ if (name[3] == 'i')
8832+ return PRIi32;
8833+ if (name[3] == 'o')
8834+ return PRIo32;
8835+ if (name[3] == 'u')
8836+ return PRIu32;
8837+ if (name[3] == 'x')
8838+ return PRIx32;
8839+ if (name[3] == 'X')
8840+ return PRIX32;
8841+ abort ();
8842+ }
8843+ if (name[4] == '6' && name[5] == '4' && name[6] == '\0')
8844+ {
8845+ if (name[3] == 'd')
8846+ return PRId64;
8847+ if (name[3] == 'i')
8848+ return PRIi64;
8849+ if (name[3] == 'o')
8850+ return PRIo64;
8851+ if (name[3] == 'u')
8852+ return PRIu64;
8853+ if (name[3] == 'x')
8854+ return PRIx64;
8855+ if (name[3] == 'X')
8856+ return PRIX64;
8857+ abort ();
8858+ }
8859+ if (name[4] == 'L' && name[5] == 'E' && name[6] == 'A'
8860+ && name[7] == 'S' && name[8] == 'T')
8861+ {
8862+ if (name[9] == '8' && name[10] == '\0')
8863+ {
8864+ if (name[3] == 'd')
8865+ return PRIdLEAST8;
8866+ if (name[3] == 'i')
8867+ return PRIiLEAST8;
8868+ if (name[3] == 'o')
8869+ return PRIoLEAST8;
8870+ if (name[3] == 'u')
8871+ return PRIuLEAST8;
8872+ if (name[3] == 'x')
8873+ return PRIxLEAST8;
8874+ if (name[3] == 'X')
8875+ return PRIXLEAST8;
8876+ abort ();
8877+ }
8878+ if (name[9] == '1' && name[10] == '6' && name[11] == '\0')
8879+ {
8880+ if (name[3] == 'd')
8881+ return PRIdLEAST16;
8882+ if (name[3] == 'i')
8883+ return PRIiLEAST16;
8884+ if (name[3] == 'o')
8885+ return PRIoLEAST16;
8886+ if (name[3] == 'u')
8887+ return PRIuLEAST16;
8888+ if (name[3] == 'x')
8889+ return PRIxLEAST16;
8890+ if (name[3] == 'X')
8891+ return PRIXLEAST16;
8892+ abort ();
8893+ }
8894+ if (name[9] == '3' && name[10] == '2' && name[11] == '\0')
8895+ {
8896+ if (name[3] == 'd')
8897+ return PRIdLEAST32;
8898+ if (name[3] == 'i')
8899+ return PRIiLEAST32;
8900+ if (name[3] == 'o')
8901+ return PRIoLEAST32;
8902+ if (name[3] == 'u')
8903+ return PRIuLEAST32;
8904+ if (name[3] == 'x')
8905+ return PRIxLEAST32;
8906+ if (name[3] == 'X')
8907+ return PRIXLEAST32;
8908+ abort ();
8909+ }
8910+ if (name[9] == '6' && name[10] == '4' && name[11] == '\0')
8911+ {
8912+ if (name[3] == 'd')
8913+ return PRIdLEAST64;
8914+ if (name[3] == 'i')
8915+ return PRIiLEAST64;
8916+ if (name[3] == 'o')
8917+ return PRIoLEAST64;
8918+ if (name[3] == 'u')
8919+ return PRIuLEAST64;
8920+ if (name[3] == 'x')
8921+ return PRIxLEAST64;
8922+ if (name[3] == 'X')
8923+ return PRIXLEAST64;
8924+ abort ();
8925+ }
8926+ }
8927+ if (name[4] == 'F' && name[5] == 'A' && name[6] == 'S'
8928+ && name[7] == 'T')
8929+ {
8930+ if (name[8] == '8' && name[9] == '\0')
8931+ {
8932+ if (name[3] == 'd')
8933+ return PRIdFAST8;
8934+ if (name[3] == 'i')
8935+ return PRIiFAST8;
8936+ if (name[3] == 'o')
8937+ return PRIoFAST8;
8938+ if (name[3] == 'u')
8939+ return PRIuFAST8;
8940+ if (name[3] == 'x')
8941+ return PRIxFAST8;
8942+ if (name[3] == 'X')
8943+ return PRIXFAST8;
8944+ abort ();
8945+ }
8946+ if (name[8] == '1' && name[9] == '6' && name[10] == '\0')
8947+ {
8948+ if (name[3] == 'd')
8949+ return PRIdFAST16;
8950+ if (name[3] == 'i')
8951+ return PRIiFAST16;
8952+ if (name[3] == 'o')
8953+ return PRIoFAST16;
8954+ if (name[3] == 'u')
8955+ return PRIuFAST16;
8956+ if (name[3] == 'x')
8957+ return PRIxFAST16;
8958+ if (name[3] == 'X')
8959+ return PRIXFAST16;
8960+ abort ();
8961+ }
8962+ if (name[8] == '3' && name[9] == '2' && name[10] == '\0')
8963+ {
8964+ if (name[3] == 'd')
8965+ return PRIdFAST32;
8966+ if (name[3] == 'i')
8967+ return PRIiFAST32;
8968+ if (name[3] == 'o')
8969+ return PRIoFAST32;
8970+ if (name[3] == 'u')
8971+ return PRIuFAST32;
8972+ if (name[3] == 'x')
8973+ return PRIxFAST32;
8974+ if (name[3] == 'X')
8975+ return PRIXFAST32;
8976+ abort ();
8977+ }
8978+ if (name[8] == '6' && name[9] == '4' && name[10] == '\0')
8979+ {
8980+ if (name[3] == 'd')
8981+ return PRIdFAST64;
8982+ if (name[3] == 'i')
8983+ return PRIiFAST64;
8984+ if (name[3] == 'o')
8985+ return PRIoFAST64;
8986+ if (name[3] == 'u')
8987+ return PRIuFAST64;
8988+ if (name[3] == 'x')
8989+ return PRIxFAST64;
8990+ if (name[3] == 'X')
8991+ return PRIXFAST64;
8992+ abort ();
8993+ }
8994+ }
8995+ if (name[4] == 'M' && name[5] == 'A' && name[6] == 'X'
8996+ && name[7] == '\0')
8997+ {
8998+ if (name[3] == 'd')
8999+ return PRIdMAX;
9000+ if (name[3] == 'i')
9001+ return PRIiMAX;
9002+ if (name[3] == 'o')
9003+ return PRIoMAX;
9004+ if (name[3] == 'u')
9005+ return PRIuMAX;
9006+ if (name[3] == 'x')
9007+ return PRIxMAX;
9008+ if (name[3] == 'X')
9009+ return PRIXMAX;
9010+ abort ();
9011+ }
9012+ if (name[4] == 'P' && name[5] == 'T' && name[6] == 'R'
9013+ && name[7] == '\0')
9014+ {
9015+ if (name[3] == 'd')
9016+ return PRIdPTR;
9017+ if (name[3] == 'i')
9018+ return PRIiPTR;
9019+ if (name[3] == 'o')
9020+ return PRIoPTR;
9021+ if (name[3] == 'u')
9022+ return PRIuPTR;
9023+ if (name[3] == 'x')
9024+ return PRIxPTR;
9025+ if (name[3] == 'X')
9026+ return PRIXPTR;
9027+ abort ();
9028+ }
9029+ }
9030+ }
9031+ /* Test for a glibc specific printf() format directive flag. */
9032+ if (name[0] == 'I' && name[1] == '\0')
9033+ {
9034+#if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
9035+ /* The 'I' flag, in numeric format directives, replaces ASCII digits
9036+ with the 'outdigits' defined in the LC_CTYPE locale facet. This is
9037+ used for Farsi (Persian) and maybe Arabic. */
9038+ return "I";
9039+#else
9040+ return "";
9041+#endif
9042+ }
9043+ /* Other system dependent strings are not valid. */
9044+ return NULL;
9045+}
9046+
9047+/* Initialize the codeset dependent parts of an opened message catalog.
9048+ Return the header entry. */
9049+const char *
9050+internal_function
9051+_nl_init_domain_conv (struct loaded_l10nfile *domain_file,
9052+ struct loaded_domain *domain,
9053+ struct binding *domainbinding)
9054+{
9055+ /* Find out about the character set the file is encoded with.
9056+ This can be found (in textual form) in the entry "". If this
9057+ entry does not exist or if this does not contain the `charset='
9058+ information, we will assume the charset matches the one the
9059+ current locale and we don't have to perform any conversion. */
9060+ char *nullentry;
9061+ size_t nullentrylen;
9062+
9063+ /* Preinitialize fields, to avoid recursion during _nl_find_msg. */
9064+ domain->codeset_cntr =
9065+ (domainbinding != NULL ? domainbinding->codeset_cntr : 0);
9066+#ifdef _LIBC
9067+ domain->conv = (__gconv_t) -1;
9068+#else
9069+# if HAVE_ICONV
9070+ domain->conv = (iconv_t) -1;
9071+# endif
9072+#endif
9073+ domain->conv_tab = NULL;
9074+
9075+ /* Get the header entry. */
9076+ nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
9077+
9078+ if (nullentry != NULL)
9079+ {
9080+#if defined _LIBC || HAVE_ICONV
9081+ const char *charsetstr;
9082+
9083+ charsetstr = strstr (nullentry, "charset=");
9084+ if (charsetstr != NULL)
9085+ {
9086+ size_t len;
9087+ char *charset;
9088+ const char *outcharset;
9089+
9090+ charsetstr += strlen ("charset=");
9091+ len = strcspn (charsetstr, " \t\n");
9092+
9093+ charset = (char *) alloca (len + 1);
9094+# if defined _LIBC || HAVE_MEMPCPY
9095+ *((char *) mempcpy (charset, charsetstr, len)) = '\0';
9096+# else
9097+ memcpy (charset, charsetstr, len);
9098+ charset[len] = '\0';
9099+# endif
9100+
9101+ /* The output charset should normally be determined by the
9102+ locale. But sometimes the locale is not used or not correctly
9103+ set up, so we provide a possibility for the user to override
9104+ this. Moreover, the value specified through
9105+ bind_textdomain_codeset overrides both. */
9106+ if (domainbinding != NULL && domainbinding->codeset != NULL)
9107+ outcharset = domainbinding->codeset;
9108+ else
9109+ {
9110+ outcharset = getenv ("OUTPUT_CHARSET");
9111+ if (outcharset == NULL || outcharset[0] == '\0')
9112+ {
9113+# ifdef _LIBC
9114+ outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
9115+# else
9116+# if HAVE_ICONV
9117+ extern const char *locale_charset (void);
9118+ outcharset = locale_charset ();
9119+# endif
9120+# endif
9121+ }
9122+ }
9123+
9124+# ifdef _LIBC
9125+ /* We always want to use transliteration. */
9126+ outcharset = norm_add_slashes (outcharset, "TRANSLIT");
9127+ charset = norm_add_slashes (charset, NULL);
9128+ if (__gconv_open (outcharset, charset, &domain->conv,
9129+ GCONV_AVOID_NOCONV)
9130+ != __GCONV_OK)
9131+ domain->conv = (__gconv_t) -1;
9132+# else
9133+# if HAVE_ICONV
9134+ /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
9135+ we want to use transliteration. */
9136+# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
9137+ || _LIBICONV_VERSION >= 0x0105
9138+ if (strchr (outcharset, '/') == NULL)
9139+ {
9140+ char *tmp;
9141+
9142+ len = strlen (outcharset);
9143+ tmp = (char *) alloca (len + 10 + 1);
9144+ memcpy (tmp, outcharset, len);
9145+ memcpy (tmp + len, "//TRANSLIT", 10 + 1);
9146+ outcharset = tmp;
9147+
9148+ domain->conv = iconv_open (outcharset, charset);
9149+
9150+ freea (outcharset);
9151+ }
9152+ else
9153+# endif
9154+ domain->conv = iconv_open (outcharset, charset);
9155+# endif
9156+# endif
9157+
9158+ freea (charset);
9159+ }
9160+#endif /* _LIBC || HAVE_ICONV */
9161+ }
9162+
9163+ return nullentry;
9164+}
9165+
9166+/* Frees the codeset dependent parts of an opened message catalog. */
9167+void
9168+internal_function
9169+_nl_free_domain_conv (struct loaded_domain *domain)
9170+{
9171+ if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
9172+ free (domain->conv_tab);
9173+
9174+#ifdef _LIBC
9175+ if (domain->conv != (__gconv_t) -1)
9176+ __gconv_close (domain->conv);
9177+#else
9178+# if HAVE_ICONV
9179+ if (domain->conv != (iconv_t) -1)
9180+ iconv_close (domain->conv);
9181+# endif
9182+#endif
9183+}
9184+
9185 /* Load the message catalogs specified by FILENAME. If it is no valid
9186 message catalog do nothing. */
9187 void
9188-_nl_load_domain (domain_file)
9189- struct loaded_l10nfile *domain_file;
9190+internal_function
9191+_nl_load_domain (struct loaded_l10nfile *domain_file,
9192+ struct binding *domainbinding)
9193 {
9194 int fd;
9195+ size_t size;
9196+#ifdef _LIBC
9197+ struct stat64 st;
9198+#else
9199 struct stat st;
9200+#endif
9201 struct mo_file_header *data = (struct mo_file_header *) -1;
9202-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
9203- || defined _LIBC
9204 int use_mmap = 0;
9205-#endif
9206 struct loaded_domain *domain;
9207+ int revision;
9208+ const char *nullentry;
9209
9210 domain_file->decided = 1;
9211 domain_file->data = NULL;
9212
9213+ /* Note that it would be useless to store domainbinding in domain_file
9214+ because domainbinding might be == NULL now but != NULL later (after
9215+ a call to bind_textdomain_codeset). */
9216+
9217 /* If the record does not represent a valid locale the FILENAME
9218 might be NULL. This can happen when according to the given
9219 specification the locale file name is different for XPG and CEN
9220@@ -84,27 +937,32 @@
9221 return;
9222
9223 /* Try to open the addressed file. */
9224- fd = open (domain_file->filename, O_RDONLY);
9225+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
9226 if (fd == -1)
9227 return;
9228
9229 /* We must know about the size of the file. */
9230- if (fstat (fd, &st) != 0
9231- && st.st_size < (off_t) sizeof (struct mo_file_header))
9232+ if (
9233+#ifdef _LIBC
9234+ __builtin_expect (fstat64 (fd, &st) != 0, 0)
9235+#else
9236+ __builtin_expect (fstat (fd, &st) != 0, 0)
9237+#endif
9238+ || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
9239+ || __builtin_expect (size < sizeof (struct mo_file_header), 0))
9240 {
9241 /* Something went wrong. */
9242 close (fd);
9243 return;
9244 }
9245
9246-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
9247- || defined _LIBC
9248+#ifdef HAVE_MMAP
9249 /* Now we are ready to load the file. If mmap() is available we try
9250 this first. If not available or it failed we try to load it. */
9251- data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
9252+ data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
9253 MAP_PRIVATE, fd, 0);
9254
9255- if (data != (struct mo_file_header *) -1)
9256+ if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
9257 {
9258 /* mmap() call was successful. */
9259 close (fd);
9260@@ -116,24 +974,27 @@
9261 it manually. */
9262 if (data == (struct mo_file_header *) -1)
9263 {
9264- off_t to_read;
9265+ size_t to_read;
9266 char *read_ptr;
9267
9268- data = (struct mo_file_header *) malloc (st.st_size);
9269+ data = (struct mo_file_header *) malloc (size);
9270 if (data == NULL)
9271 return;
9272
9273- to_read = st.st_size;
9274+ to_read = size;
9275 read_ptr = (char *) data;
9276 do
9277 {
9278 long int nb = (long int) read (fd, read_ptr, to_read);
9279- if (nb == -1)
9280+ if (nb <= 0)
9281 {
9282+#ifdef EINTR
9283+ if (nb == -1 && errno == EINTR)
9284+ continue;
9285+#endif
9286 close (fd);
9287 return;
9288 }
9289-
9290 read_ptr += nb;
9291 to_read -= nb;
9292 }
9293@@ -144,47 +1005,378 @@
9294
9295 /* Using the magic number we can test whether it really is a message
9296 catalog file. */
9297- if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
9298+ if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
9299+ 0))
9300 {
9301 /* The magic number is wrong: not a message catalog file. */
9302-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
9303- || defined _LIBC
9304+#ifdef HAVE_MMAP
9305 if (use_mmap)
9306- munmap ((caddr_t) data, st.st_size);
9307+ munmap ((caddr_t) data, size);
9308 else
9309 #endif
9310 free (data);
9311 return;
9312 }
9313
9314- domain_file->data
9315- = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
9316- if (domain_file->data == NULL)
9317+ domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
9318+ if (domain == NULL)
9319 return;
9320+ domain_file->data = domain;
9321
9322- domain = (struct loaded_domain *) domain_file->data;
9323 domain->data = (char *) data;
9324+ domain->use_mmap = use_mmap;
9325+ domain->mmap_size = size;
9326 domain->must_swap = data->magic != _MAGIC;
9327+ domain->malloced = NULL;
9328
9329 /* Fill in the information about the available tables. */
9330- switch (W (domain->must_swap, data->revision))
9331+ revision = W (domain->must_swap, data->revision);
9332+ /* We support only the major revisions 0 and 1. */
9333+ switch (revision >> 16)
9334 {
9335 case 0:
9336+ case 1:
9337 domain->nstrings = W (domain->must_swap, data->nstrings);
9338- domain->orig_tab = (struct string_desc *)
9339+ domain->orig_tab = (const struct string_desc *)
9340 ((char *) data + W (domain->must_swap, data->orig_tab_offset));
9341- domain->trans_tab = (struct string_desc *)
9342+ domain->trans_tab = (const struct string_desc *)
9343 ((char *) data + W (domain->must_swap, data->trans_tab_offset));
9344 domain->hash_size = W (domain->must_swap, data->hash_tab_size);
9345- domain->hash_tab = (nls_uint32 *)
9346- ((char *) data + W (domain->must_swap, data->hash_tab_offset));
9347+ domain->hash_tab =
9348+ (domain->hash_size > 2
9349+ ? (const nls_uint32 *)
9350+ ((char *) data + W (domain->must_swap, data->hash_tab_offset))
9351+ : NULL);
9352+ domain->must_swap_hash_tab = domain->must_swap;
9353+
9354+ /* Now dispatch on the minor revision. */
9355+ switch (revision & 0xffff)
9356+ {
9357+ case 0:
9358+ domain->n_sysdep_strings = 0;
9359+ domain->orig_sysdep_tab = NULL;
9360+ domain->trans_sysdep_tab = NULL;
9361+ break;
9362+ case 1:
9363+ default:
9364+ {
9365+ nls_uint32 n_sysdep_strings;
9366+
9367+ if (domain->hash_tab == NULL)
9368+ /* This is invalid. These minor revisions need a hash table. */
9369+ goto invalid;
9370+
9371+ n_sysdep_strings =
9372+ W (domain->must_swap, data->n_sysdep_strings);
9373+ if (n_sysdep_strings > 0)
9374+ {
9375+ nls_uint32 n_sysdep_segments;
9376+ const struct sysdep_segment *sysdep_segments;
9377+ const char **sysdep_segment_values;
9378+ const nls_uint32 *orig_sysdep_tab;
9379+ const nls_uint32 *trans_sysdep_tab;
9380+ nls_uint32 n_inmem_sysdep_strings;
9381+ size_t memneed;
9382+ char *mem;
9383+ struct sysdep_string_desc *inmem_orig_sysdep_tab;
9384+ struct sysdep_string_desc *inmem_trans_sysdep_tab;
9385+ nls_uint32 *inmem_hash_tab;
9386+ unsigned int i, j;
9387+
9388+ /* Get the values of the system dependent segments. */
9389+ n_sysdep_segments =
9390+ W (domain->must_swap, data->n_sysdep_segments);
9391+ sysdep_segments = (const struct sysdep_segment *)
9392+ ((char *) data
9393+ + W (domain->must_swap, data->sysdep_segments_offset));
9394+ sysdep_segment_values =
9395+ alloca (n_sysdep_segments * sizeof (const char *));
9396+ for (i = 0; i < n_sysdep_segments; i++)
9397+ {
9398+ const char *name =
9399+ (char *) data
9400+ + W (domain->must_swap, sysdep_segments[i].offset);
9401+ nls_uint32 namelen =
9402+ W (domain->must_swap, sysdep_segments[i].length);
9403+
9404+ if (!(namelen > 0 && name[namelen - 1] == '\0'))
9405+ {
9406+ freea (sysdep_segment_values);
9407+ goto invalid;
9408+ }
9409+
9410+ sysdep_segment_values[i] = get_sysdep_segment_value (name);
9411+ }
9412+
9413+ orig_sysdep_tab = (const nls_uint32 *)
9414+ ((char *) data
9415+ + W (domain->must_swap, data->orig_sysdep_tab_offset));
9416+ trans_sysdep_tab = (const nls_uint32 *)
9417+ ((char *) data
9418+ + W (domain->must_swap, data->trans_sysdep_tab_offset));
9419+
9420+ /* Compute the amount of additional memory needed for the
9421+ system dependent strings and the augmented hash table.
9422+ At the same time, also drop string pairs which refer to
9423+ an undefined system dependent segment. */
9424+ n_inmem_sysdep_strings = 0;
9425+ memneed = domain->hash_size * sizeof (nls_uint32);
9426+ for (i = 0; i < n_sysdep_strings; i++)
9427+ {
9428+ int valid = 1;
9429+ size_t needs[2];
9430+
9431+ for (j = 0; j < 2; j++)
9432+ {
9433+ const struct sysdep_string *sysdep_string =
9434+ (const struct sysdep_string *)
9435+ ((char *) data
9436+ + W (domain->must_swap,
9437+ j == 0
9438+ ? orig_sysdep_tab[i]
9439+ : trans_sysdep_tab[i]));
9440+ size_t need = 0;
9441+ const struct segment_pair *p = sysdep_string->segments;
9442+
9443+ if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END)
9444+ for (p = sysdep_string->segments;; p++)
9445+ {
9446+ nls_uint32 sysdepref;
9447+
9448+ need += W (domain->must_swap, p->segsize);
9449+
9450+ sysdepref = W (domain->must_swap, p->sysdepref);
9451+ if (sysdepref == SEGMENTS_END)
9452+ break;
9453+
9454+ if (sysdepref >= n_sysdep_segments)
9455+ {
9456+ /* Invalid. */
9457+ freea (sysdep_segment_values);
9458+ goto invalid;
9459+ }
9460+
9461+ if (sysdep_segment_values[sysdepref] == NULL)
9462+ {
9463+ /* This particular string pair is invalid. */
9464+ valid = 0;
9465+ break;
9466+ }
9467+
9468+ need += strlen (sysdep_segment_values[sysdepref]);
9469+ }
9470+
9471+ needs[j] = need;
9472+ if (!valid)
9473+ break;
9474+ }
9475+
9476+ if (valid)
9477+ {
9478+ n_inmem_sysdep_strings++;
9479+ memneed += needs[0] + needs[1];
9480+ }
9481+ }
9482+ memneed += 2 * n_inmem_sysdep_strings
9483+ * sizeof (struct sysdep_string_desc);
9484+
9485+ if (n_inmem_sysdep_strings > 0)
9486+ {
9487+ unsigned int k;
9488+
9489+ /* Allocate additional memory. */
9490+ mem = (char *) malloc (memneed);
9491+ if (mem == NULL)
9492+ goto invalid;
9493+
9494+ domain->malloced = mem;
9495+ inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem;
9496+ mem += n_inmem_sysdep_strings
9497+ * sizeof (struct sysdep_string_desc);
9498+ inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem;
9499+ mem += n_inmem_sysdep_strings
9500+ * sizeof (struct sysdep_string_desc);
9501+ inmem_hash_tab = (nls_uint32 *) mem;
9502+ mem += domain->hash_size * sizeof (nls_uint32);
9503+
9504+ /* Compute the system dependent strings. */
9505+ k = 0;
9506+ for (i = 0; i < n_sysdep_strings; i++)
9507+ {
9508+ int valid = 1;
9509+
9510+ for (j = 0; j < 2; j++)
9511+ {
9512+ const struct sysdep_string *sysdep_string =
9513+ (const struct sysdep_string *)
9514+ ((char *) data
9515+ + W (domain->must_swap,
9516+ j == 0
9517+ ? orig_sysdep_tab[i]
9518+ : trans_sysdep_tab[i]));
9519+ const struct segment_pair *p =
9520+ sysdep_string->segments;
9521+
9522+ if (W (domain->must_swap, p->sysdepref)
9523+ != SEGMENTS_END)
9524+ for (p = sysdep_string->segments;; p++)
9525+ {
9526+ nls_uint32 sysdepref;
9527+
9528+ sysdepref =
9529+ W (domain->must_swap, p->sysdepref);
9530+ if (sysdepref == SEGMENTS_END)
9531+ break;
9532+
9533+ if (sysdep_segment_values[sysdepref] == NULL)
9534+ {
9535+ /* This particular string pair is
9536+ invalid. */
9537+ valid = 0;
9538+ break;
9539+ }
9540+ }
9541+
9542+ if (!valid)
9543+ break;
9544+ }
9545+
9546+ if (valid)
9547+ {
9548+ for (j = 0; j < 2; j++)
9549+ {
9550+ const struct sysdep_string *sysdep_string =
9551+ (const struct sysdep_string *)
9552+ ((char *) data
9553+ + W (domain->must_swap,
9554+ j == 0
9555+ ? orig_sysdep_tab[i]
9556+ : trans_sysdep_tab[i]));
9557+ const char *static_segments =
9558+ (char *) data
9559+ + W (domain->must_swap, sysdep_string->offset);
9560+ const struct segment_pair *p =
9561+ sysdep_string->segments;
9562+
9563+ /* Concatenate the segments, and fill
9564+ inmem_orig_sysdep_tab[k] (for j == 0) and
9565+ inmem_trans_sysdep_tab[k] (for j == 1). */
9566+
9567+ struct sysdep_string_desc *inmem_tab_entry =
9568+ (j == 0
9569+ ? inmem_orig_sysdep_tab
9570+ : inmem_trans_sysdep_tab)
9571+ + k;
9572+
9573+ if (W (domain->must_swap, p->sysdepref)
9574+ == SEGMENTS_END)
9575+ {
9576+ /* Only one static segment. */
9577+ inmem_tab_entry->length =
9578+ W (domain->must_swap, p->segsize);
9579+ inmem_tab_entry->pointer = static_segments;
9580+ }
9581+ else
9582+ {
9583+ inmem_tab_entry->pointer = mem;
9584+
9585+ for (p = sysdep_string->segments;; p++)
9586+ {
9587+ nls_uint32 segsize =
9588+ W (domain->must_swap, p->segsize);
9589+ nls_uint32 sysdepref =
9590+ W (domain->must_swap, p->sysdepref);
9591+ size_t n;
9592+
9593+ if (segsize > 0)
9594+ {
9595+ memcpy (mem, static_segments, segsize);
9596+ mem += segsize;
9597+ static_segments += segsize;
9598+ }
9599+
9600+ if (sysdepref == SEGMENTS_END)
9601+ break;
9602+
9603+ n = strlen (sysdep_segment_values[sysdepref]);
9604+ memcpy (mem, sysdep_segment_values[sysdepref], n);
9605+ mem += n;
9606+ }
9607+
9608+ inmem_tab_entry->length =
9609+ mem - inmem_tab_entry->pointer;
9610+ }
9611+ }
9612+
9613+ k++;
9614+ }
9615+ }
9616+ if (k != n_inmem_sysdep_strings)
9617+ abort ();
9618+
9619+ /* Compute the augmented hash table. */
9620+ for (i = 0; i < domain->hash_size; i++)
9621+ inmem_hash_tab[i] =
9622+ W (domain->must_swap_hash_tab, domain->hash_tab[i]);
9623+ for (i = 0; i < n_inmem_sysdep_strings; i++)
9624+ {
9625+ const char *msgid = inmem_orig_sysdep_tab[i].pointer;
9626+ nls_uint32 hash_val = hash_string (msgid);
9627+ nls_uint32 idx = hash_val % domain->hash_size;
9628+ nls_uint32 incr =
9629+ 1 + (hash_val % (domain->hash_size - 2));
9630+
9631+ for (;;)
9632+ {
9633+ if (inmem_hash_tab[idx] == 0)
9634+ {
9635+ /* Hash table entry is empty. Use it. */
9636+ inmem_hash_tab[idx] = 1 + domain->nstrings + i;
9637+ break;
9638+ }
9639+
9640+ if (idx >= domain->hash_size - incr)
9641+ idx -= domain->hash_size - incr;
9642+ else
9643+ idx += incr;
9644+ }
9645+ }
9646+
9647+ domain->n_sysdep_strings = n_inmem_sysdep_strings;
9648+ domain->orig_sysdep_tab = inmem_orig_sysdep_tab;
9649+ domain->trans_sysdep_tab = inmem_trans_sysdep_tab;
9650+
9651+ domain->hash_tab = inmem_hash_tab;
9652+ domain->must_swap_hash_tab = 0;
9653+ }
9654+ else
9655+ {
9656+ domain->n_sysdep_strings = 0;
9657+ domain->orig_sysdep_tab = NULL;
9658+ domain->trans_sysdep_tab = NULL;
9659+ }
9660+
9661+ freea (sysdep_segment_values);
9662+ }
9663+ else
9664+ {
9665+ domain->n_sysdep_strings = 0;
9666+ domain->orig_sysdep_tab = NULL;
9667+ domain->trans_sysdep_tab = NULL;
9668+ }
9669+ }
9670+ break;
9671+ }
9672 break;
9673 default:
9674- /* This is an illegal revision. */
9675-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
9676- || defined _LIBC
9677+ /* This is an invalid revision. */
9678+ invalid:
9679+ /* This is an invalid .mo file. */
9680+ if (domain->malloced)
9681+ free (domain->malloced);
9682+#ifdef HAVE_MMAP
9683 if (use_mmap)
9684- munmap ((caddr_t) data, st.st_size);
9685+ munmap ((caddr_t) data, size);
9686 else
9687 #endif
9688 free (data);
9689@@ -193,7 +1385,36 @@
9690 return;
9691 }
9692
9693- /* Show that one domain is changed. This might make some cached
9694- translations invalid. */
9695- ++_nl_msg_cat_cntr;
9696+ /* Now initialize the character set converter from the character set
9697+ the file is encoded with (found in the header entry) to the domain's
9698+ specified character set or the locale's character set. */
9699+ nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
9700+
9701+ /* Also look for a plural specification. */
9702+ EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
9703 }
9704+
9705+
9706+#ifdef _LIBC
9707+void
9708+internal_function
9709+_nl_unload_domain (struct loaded_domain *domain)
9710+{
9711+ if (domain->plural != &__gettext_germanic_plural)
9712+ __gettext_free_exp (domain->plural);
9713+
9714+ _nl_free_domain_conv (domain);
9715+
9716+ if (domain->malloced)
9717+ free (domain->malloced);
9718+
9719+# ifdef _POSIX_MAPPED_FILES
9720+ if (domain->use_mmap)
9721+ munmap ((caddr_t) domain->data, domain->mmap_size);
9722+ else
9723+# endif /* _POSIX_MAPPED_FILES */
9724+ free ((void *) domain->data);
9725+
9726+ free (domain);
9727+}
9728+#endif
9729--- lrzsz-0.12.20.safe/intl/localcharset.c 1969-12-31 19:00:00.000000000 -0500
9730+++ lrzsz-0.12.20/intl/localcharset.c 2004-09-12 14:40:34.478729392 -0400
9731@@ -0,0 +1,398 @@
9732+/* Determine a canonical name for the current locale's character encoding.
9733+
9734+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
9735+
9736+ This program is free software; you can redistribute it and/or modify it
9737+ under the terms of the GNU Library General Public License as published
9738+ by the Free Software Foundation; either version 2, or (at your option)
9739+ any later version.
9740+
9741+ This program is distributed in the hope that it will be useful,
9742+ but WITHOUT ANY WARRANTY; without even the implied warranty of
9743+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9744+ Library General Public License for more details.
9745+
9746+ You should have received a copy of the GNU Library General Public
9747+ License along with this program; if not, write to the Free Software
9748+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
9749+ USA. */
9750+
9751+/* Written by Bruno Haible <bruno@clisp.org>. */
9752+
9753+#ifdef HAVE_CONFIG_H
9754+# include <config.h>
9755+#endif
9756+
9757+/* Specification. */
9758+#include "localcharset.h"
9759+
9760+#if HAVE_STDDEF_H
9761+# include <stddef.h>
9762+#endif
9763+
9764+#include <stdio.h>
9765+#if HAVE_STRING_H
9766+# include <string.h>
9767+#else
9768+# include <strings.h>
9769+#endif
9770+#if HAVE_STDLIB_H
9771+# include <stdlib.h>
9772+#endif
9773+
9774+#if defined _WIN32 || defined __WIN32__
9775+# undef WIN32 /* avoid warning on mingw32 */
9776+# define WIN32
9777+#endif
9778+
9779+#if defined __EMX__
9780+/* Assume EMX program runs on OS/2, even if compiled under DOS. */
9781+# define OS2
9782+#endif
9783+
9784+#if !defined WIN32
9785+# if HAVE_LANGINFO_CODESET
9786+# include <langinfo.h>
9787+# else
9788+# if HAVE_SETLOCALE
9789+# include <locale.h>
9790+# endif
9791+# endif
9792+#elif defined WIN32
9793+# define WIN32_LEAN_AND_MEAN
9794+# include <windows.h>
9795+#endif
9796+#if defined OS2
9797+# define INCL_DOS
9798+# include <os2.h>
9799+#endif
9800+
9801+#if ENABLE_RELOCATABLE
9802+# include "relocatable.h"
9803+#else
9804+# define relocate(pathname) (pathname)
9805+#endif
9806+
9807+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
9808+ /* Win32, OS/2, DOS */
9809+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
9810+#endif
9811+
9812+#ifndef DIRECTORY_SEPARATOR
9813+# define DIRECTORY_SEPARATOR '/'
9814+#endif
9815+
9816+#ifndef ISSLASH
9817+# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
9818+#endif
9819+
9820+#if HAVE_DECL_GETC_UNLOCKED
9821+# undef getc
9822+# define getc getc_unlocked
9823+#endif
9824+
9825+/* The following static variable is declared 'volatile' to avoid a
9826+ possible multithread problem in the function get_charset_aliases. If we
9827+ are running in a threaded environment, and if two threads initialize
9828+ 'charset_aliases' simultaneously, both will produce the same value,
9829+ and everything will be ok if the two assignments to 'charset_aliases'
9830+ are atomic. But I don't know what will happen if the two assignments mix. */
9831+#if __STDC__ != 1
9832+# define volatile /* empty */
9833+#endif
9834+/* Pointer to the contents of the charset.alias file, if it has already been
9835+ read, else NULL. Its format is:
9836+ ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
9837+static const char * volatile charset_aliases;
9838+
9839+/* Return a pointer to the contents of the charset.alias file. */
9840+static const char *
9841+get_charset_aliases ()
9842+{
9843+ const char *cp;
9844+
9845+ cp = charset_aliases;
9846+ if (cp == NULL)
9847+ {
9848+#if !(defined VMS || defined WIN32)
9849+ FILE *fp;
9850+ const char *dir = relocate (LIBDIR);
9851+ const char *base = "charset.alias";
9852+ char *file_name;
9853+
9854+ /* Concatenate dir and base into freshly allocated file_name. */
9855+ {
9856+ size_t dir_len = strlen (dir);
9857+ size_t base_len = strlen (base);
9858+ int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
9859+ file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
9860+ if (file_name != NULL)
9861+ {
9862+ memcpy (file_name, dir, dir_len);
9863+ if (add_slash)
9864+ file_name[dir_len] = DIRECTORY_SEPARATOR;
9865+ memcpy (file_name + dir_len + add_slash, base, base_len + 1);
9866+ }
9867+ }
9868+
9869+ if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
9870+ /* Out of memory or file not found, treat it as empty. */
9871+ cp = "";
9872+ else
9873+ {
9874+ /* Parse the file's contents. */
9875+ int c;
9876+ char buf1[50+1];
9877+ char buf2[50+1];
9878+ char *res_ptr = NULL;
9879+ size_t res_size = 0;
9880+ size_t l1, l2;
9881+
9882+ for (;;)
9883+ {
9884+ c = getc (fp);
9885+ if (c == EOF)
9886+ break;
9887+ if (c == '\n' || c == ' ' || c == '\t')
9888+ continue;
9889+ if (c == '#')
9890+ {
9891+ /* Skip comment, to end of line. */
9892+ do
9893+ c = getc (fp);
9894+ while (!(c == EOF || c == '\n'));
9895+ if (c == EOF)
9896+ break;
9897+ continue;
9898+ }
9899+ ungetc (c, fp);
9900+ if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
9901+ break;
9902+ l1 = strlen (buf1);
9903+ l2 = strlen (buf2);
9904+ if (res_size == 0)
9905+ {
9906+ res_size = l1 + 1 + l2 + 1;
9907+ res_ptr = (char *) malloc (res_size + 1);
9908+ }
9909+ else
9910+ {
9911+ res_size += l1 + 1 + l2 + 1;
9912+ res_ptr = (char *) realloc (res_ptr, res_size + 1);
9913+ }
9914+ if (res_ptr == NULL)
9915+ {
9916+ /* Out of memory. */
9917+ res_size = 0;
9918+ break;
9919+ }
9920+ strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
9921+ strcpy (res_ptr + res_size - (l2 + 1), buf2);
9922+ }
9923+ fclose (fp);
9924+ if (res_size == 0)
9925+ cp = "";
9926+ else
9927+ {
9928+ *(res_ptr + res_size) = '\0';
9929+ cp = res_ptr;
9930+ }
9931+ }
9932+
9933+ if (file_name != NULL)
9934+ free (file_name);
9935+
9936+#else
9937+
9938+# if defined VMS
9939+ /* To avoid the troubles of an extra file charset.alias_vms in the
9940+ sources of many GNU packages, simply inline the aliases here. */
9941+ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
9942+ "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
9943+ section 10.7 "Handling Different Character Sets". */
9944+ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
9945+ "ISO8859-2" "\0" "ISO-8859-2" "\0"
9946+ "ISO8859-5" "\0" "ISO-8859-5" "\0"
9947+ "ISO8859-7" "\0" "ISO-8859-7" "\0"
9948+ "ISO8859-8" "\0" "ISO-8859-8" "\0"
9949+ "ISO8859-9" "\0" "ISO-8859-9" "\0"
9950+ /* Japanese */
9951+ "eucJP" "\0" "EUC-JP" "\0"
9952+ "SJIS" "\0" "SHIFT_JIS" "\0"
9953+ "DECKANJI" "\0" "DEC-KANJI" "\0"
9954+ "SDECKANJI" "\0" "EUC-JP" "\0"
9955+ /* Chinese */
9956+ "eucTW" "\0" "EUC-TW" "\0"
9957+ "DECHANYU" "\0" "DEC-HANYU" "\0"
9958+ "DECHANZI" "\0" "GB2312" "\0"
9959+ /* Korean */
9960+ "DECKOREAN" "\0" "EUC-KR" "\0";
9961+# endif
9962+
9963+# if defined WIN32
9964+ /* To avoid the troubles of installing a separate file in the same
9965+ directory as the DLL and of retrieving the DLL's directory at
9966+ runtime, simply inline the aliases here. */
9967+
9968+ cp = "CP936" "\0" "GBK" "\0"
9969+ "CP1361" "\0" "JOHAB" "\0"
9970+ "CP20127" "\0" "ASCII" "\0"
9971+ "CP20866" "\0" "KOI8-R" "\0"
9972+ "CP21866" "\0" "KOI8-RU" "\0"
9973+ "CP28591" "\0" "ISO-8859-1" "\0"
9974+ "CP28592" "\0" "ISO-8859-2" "\0"
9975+ "CP28593" "\0" "ISO-8859-3" "\0"
9976+ "CP28594" "\0" "ISO-8859-4" "\0"
9977+ "CP28595" "\0" "ISO-8859-5" "\0"
9978+ "CP28596" "\0" "ISO-8859-6" "\0"
9979+ "CP28597" "\0" "ISO-8859-7" "\0"
9980+ "CP28598" "\0" "ISO-8859-8" "\0"
9981+ "CP28599" "\0" "ISO-8859-9" "\0"
9982+ "CP28605" "\0" "ISO-8859-15" "\0";
9983+# endif
9984+#endif
9985+
9986+ charset_aliases = cp;
9987+ }
9988+
9989+ return cp;
9990+}
9991+
9992+/* Determine the current locale's character encoding, and canonicalize it
9993+ into one of the canonical names listed in config.charset.
9994+ The result must not be freed; it is statically allocated.
9995+ If the canonical name cannot be determined, the result is a non-canonical
9996+ name. */
9997+
9998+#ifdef STATIC
9999+STATIC
10000+#endif
10001+const char *
10002+locale_charset ()
10003+{
10004+ const char *codeset;
10005+ const char *aliases;
10006+
10007+#if !(defined WIN32 || defined OS2)
10008+
10009+# if HAVE_LANGINFO_CODESET
10010+
10011+ /* Most systems support nl_langinfo (CODESET) nowadays. */
10012+ codeset = nl_langinfo (CODESET);
10013+
10014+# else
10015+
10016+ /* On old systems which lack it, use setlocale or getenv. */
10017+ const char *locale = NULL;
10018+
10019+ /* But most old systems don't have a complete set of locales. Some
10020+ (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
10021+ use setlocale here; it would return "C" when it doesn't support the
10022+ locale name the user has set. */
10023+# if HAVE_SETLOCALE && 0
10024+ locale = setlocale (LC_CTYPE, NULL);
10025+# endif
10026+ if (locale == NULL || locale[0] == '\0')
10027+ {
10028+ locale = getenv ("LC_ALL");
10029+ if (locale == NULL || locale[0] == '\0')
10030+ {
10031+ locale = getenv ("LC_CTYPE");
10032+ if (locale == NULL || locale[0] == '\0')
10033+ locale = getenv ("LANG");
10034+ }
10035+ }
10036+
10037+ /* On some old systems, one used to set locale = "iso8859_1". On others,
10038+ you set it to "language_COUNTRY.charset". In any case, we resolve it
10039+ through the charset.alias file. */
10040+ codeset = locale;
10041+
10042+# endif
10043+
10044+#elif defined WIN32
10045+
10046+ static char buf[2 + 10 + 1];
10047+
10048+ /* Woe32 has a function returning the locale's codepage as a number. */
10049+ sprintf (buf, "CP%u", GetACP ());
10050+ codeset = buf;
10051+
10052+#elif defined OS2
10053+
10054+ const char *locale;
10055+ static char buf[2 + 10 + 1];
10056+ ULONG cp[3];
10057+ ULONG cplen;
10058+
10059+ /* Allow user to override the codeset, as set in the operating system,
10060+ with standard language environment variables. */
10061+ locale = getenv ("LC_ALL");
10062+ if (locale == NULL || locale[0] == '\0')
10063+ {
10064+ locale = getenv ("LC_CTYPE");
10065+ if (locale == NULL || locale[0] == '\0')
10066+ locale = getenv ("LANG");
10067+ }
10068+ if (locale != NULL && locale[0] != '\0')
10069+ {
10070+ /* If the locale name contains an encoding after the dot, return it. */
10071+ const char *dot = strchr (locale, '.');
10072+
10073+ if (dot != NULL)
10074+ {
10075+ const char *modifier;
10076+
10077+ dot++;
10078+ /* Look for the possible @... trailer and remove it, if any. */
10079+ modifier = strchr (dot, '@');
10080+ if (modifier == NULL)
10081+ return dot;
10082+ if (modifier - dot < sizeof (buf))
10083+ {
10084+ memcpy (buf, dot, modifier - dot);
10085+ buf [modifier - dot] = '\0';
10086+ return buf;
10087+ }
10088+ }
10089+
10090+ /* Resolve through the charset.alias file. */
10091+ codeset = locale;
10092+ }
10093+ else
10094+ {
10095+ /* OS/2 has a function returning the locale's codepage as a number. */
10096+ if (DosQueryCp (sizeof (cp), cp, &cplen))
10097+ codeset = "";
10098+ else
10099+ {
10100+ sprintf (buf, "CP%u", cp[0]);
10101+ codeset = buf;
10102+ }
10103+ }
10104+
10105+#endif
10106+
10107+ if (codeset == NULL)
10108+ /* The canonical name cannot be determined. */
10109+ codeset = "";
10110+
10111+ /* Resolve alias. */
10112+ for (aliases = get_charset_aliases ();
10113+ *aliases != '\0';
10114+ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
10115+ if (strcmp (codeset, aliases) == 0
10116+ || (aliases[0] == '*' && aliases[1] == '\0'))
10117+ {
10118+ codeset = aliases + strlen (aliases) + 1;
10119+ break;
10120+ }
10121+
10122+ /* Don't return an empty string. GNU libc and GNU libiconv interpret
10123+ the empty string as denoting "the locale's character encoding",
10124+ thus GNU libiconv would call this function a second time. */
10125+ if (codeset[0] == '\0')
10126+ codeset = "ASCII";
10127+
10128+ return codeset;
10129+}
10130--- lrzsz-0.12.20.safe/intl/localcharset.h 1969-12-31 19:00:00.000000000 -0500
10131+++ lrzsz-0.12.20/intl/localcharset.h 2004-09-12 14:40:34.483728632 -0400
10132@@ -0,0 +1,42 @@
10133+/* Determine a canonical name for the current locale's character encoding.
10134+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
10135+ This file is part of the GNU CHARSET Library.
10136+
10137+ This program is free software; you can redistribute it and/or modify it
10138+ under the terms of the GNU Library General Public License as published
10139+ by the Free Software Foundation; either version 2, or (at your option)
10140+ any later version.
10141+
10142+ This program is distributed in the hope that it will be useful,
10143+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10144+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10145+ Library General Public License for more details.
10146+
10147+ You should have received a copy of the GNU Library General Public
10148+ License along with this program; if not, write to the Free Software
10149+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
10150+ USA. */
10151+
10152+#ifndef _LOCALCHARSET_H
10153+#define _LOCALCHARSET_H
10154+
10155+
10156+#ifdef __cplusplus
10157+extern "C" {
10158+#endif
10159+
10160+
10161+/* Determine the current locale's character encoding, and canonicalize it
10162+ into one of the canonical names listed in config.charset.
10163+ The result must not be freed; it is statically allocated.
10164+ If the canonical name cannot be determined, the result is a non-canonical
10165+ name. */
10166+extern const char * locale_charset (void);
10167+
10168+
10169+#ifdef __cplusplus
10170+}
10171+#endif
10172+
10173+
10174+#endif /* _LOCALCHARSET_H */
10175--- lrzsz-0.12.20.safe/intl/locale.alias 1969-12-31 19:00:00.000000000 -0500
10176+++ lrzsz-0.12.20/intl/locale.alias 2004-09-12 14:40:34.499726200 -0400
10177@@ -0,0 +1,78 @@
10178+# Locale name alias data base.
10179+# Copyright (C) 1996-2001,2003 Free Software Foundation, Inc.
10180+#
10181+# This program is free software; you can redistribute it and/or modify it
10182+# under the terms of the GNU Library General Public License as published
10183+# by the Free Software Foundation; either version 2, or (at your option)
10184+# any later version.
10185+#
10186+# This program is distributed in the hope that it will be useful,
10187+# but WITHOUT ANY WARRANTY; without even the implied warranty of
10188+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10189+# Library General Public License for more details.
10190+#
10191+# You should have received a copy of the GNU Library General Public
10192+# License along with this program; if not, write to the Free Software
10193+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
10194+# USA.
10195+
10196+# The format of this file is the same as for the corresponding file of
10197+# the X Window System, which normally can be found in
10198+# /usr/lib/X11/locale/locale.alias
10199+# A single line contains two fields: an alias and a substitution value.
10200+# All entries are case independent.
10201+
10202+# Note: This file is far from being complete. If you have a value for
10203+# your own site which you think might be useful for others too, share
10204+# it with the rest of us. Send it using the `glibcbug' script to
10205+# bugs@gnu.org.
10206+
10207+# Packages using this file:
10208+
10209+bokmal nb_NO.ISO-8859-1
10210+bokmål nb_NO.ISO-8859-1
10211+catalan ca_ES.ISO-8859-1
10212+croatian hr_HR.ISO-8859-2
10213+czech cs_CZ.ISO-8859-2
10214+danish da_DK.ISO-8859-1
10215+dansk da_DK.ISO-8859-1
10216+deutsch de_DE.ISO-8859-1
10217+dutch nl_NL.ISO-8859-1
10218+eesti et_EE.ISO-8859-1
10219+estonian et_EE.ISO-8859-1
10220+finnish fi_FI.ISO-8859-1
10221+français fr_FR.ISO-8859-1
10222+french fr_FR.ISO-8859-1
10223+galego gl_ES.ISO-8859-1
10224+galician gl_ES.ISO-8859-1
10225+german de_DE.ISO-8859-1
10226+greek el_GR.ISO-8859-7
10227+hebrew he_IL.ISO-8859-8
10228+hrvatski hr_HR.ISO-8859-2
10229+hungarian hu_HU.ISO-8859-2
10230+icelandic is_IS.ISO-8859-1
10231+italian it_IT.ISO-8859-1
10232+japanese ja_JP.eucJP
10233+japanese.euc ja_JP.eucJP
10234+ja_JP ja_JP.eucJP
10235+ja_JP.ujis ja_JP.eucJP
10236+japanese.sjis ja_JP.SJIS
10237+korean ko_KR.eucKR
10238+korean.euc ko_KR.eucKR
10239+ko_KR ko_KR.eucKR
10240+lithuanian lt_LT.ISO-8859-13
10241+no_NO nb_NO.ISO-8859-1
10242+no_NO.ISO-8859-1 nb_NO.ISO-8859-1
10243+norwegian nb_NO.ISO-8859-1
10244+nynorsk nn_NO.ISO-8859-1
10245+polish pl_PL.ISO-8859-2
10246+portuguese pt_PT.ISO-8859-1
10247+romanian ro_RO.ISO-8859-2
10248+russian ru_RU.ISO-8859-5
10249+slovak sk_SK.ISO-8859-2
10250+slovene sl_SI.ISO-8859-2
10251+slovenian sl_SI.ISO-8859-2
10252+spanish es_ES.ISO-8859-1
10253+swedish sv_SE.ISO-8859-1
10254+thai th_TH.TIS-620
10255+turkish tr_TR.ISO-8859-9
10256--- lrzsz-0.12.20.safe/intl/localealias.c 1998-04-26 09:22:37.000000000 -0400
10257+++ lrzsz-0.12.20/intl/localealias.c 2004-09-12 14:40:34.505725288 -0400
10258@@ -1,20 +1,27 @@
10259-/* Handle aliases for locale names
10260- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
10261- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
10262+/* Handle aliases for locale names.
10263+ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
10264
10265- This program is free software; you can redistribute it and/or modify
10266- it under the terms of the GNU General Public License as published by
10267- the Free Software Foundation; either version 2, or (at your option)
10268+ This program is free software; you can redistribute it and/or modify it
10269+ under the terms of the GNU Library General Public License as published
10270+ by the Free Software Foundation; either version 2, or (at your option)
10271 any later version.
10272
10273 This program is distributed in the hope that it will be useful,
10274 but WITHOUT ANY WARRANTY; without even the implied warranty of
10275- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10276- GNU General Public License for more details.
10277+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10278+ Library General Public License for more details.
10279
10280- You should have received a copy of the GNU General Public License
10281- along with this program; if not, write to the Free Software Foundation,
10282- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
10283+ You should have received a copy of the GNU Library General Public
10284+ License along with this program; if not, write to the Free Software
10285+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
10286+ USA. */
10287+
10288+/* Tell glibc's <string.h> to provide a prototype for mempcpy().
10289+ This must come before <config.h> because <config.h> may include
10290+ <features.h>, and once <features.h> has been included, it's too late. */
10291+#ifndef _GNU_SOURCE
10292+# define _GNU_SOURCE 1
10293+#endif
10294
10295 #ifdef HAVE_CONFIG_H
10296 # include <config.h>
10297@@ -22,56 +29,45 @@
10298
10299 #include <ctype.h>
10300 #include <stdio.h>
10301+#if defined _LIBC || defined HAVE___FSETLOCKING
10302+# include <stdio_ext.h>
10303+#endif
10304 #include <sys/types.h>
10305
10306 #ifdef __GNUC__
10307+# undef alloca
10308 # define alloca __builtin_alloca
10309 # define HAVE_ALLOCA 1
10310 #else
10311-# if defined HAVE_ALLOCA_H || defined _LIBC
10312-# include <alloca.h>
10313+# ifdef _MSC_VER
10314+# include <malloc.h>
10315+# define alloca _alloca
10316 # else
10317-# ifdef _AIX
10318- #pragma alloca
10319+# if defined HAVE_ALLOCA_H || defined _LIBC
10320+# include <alloca.h>
10321 # else
10322-# ifndef alloca
10323+# ifdef _AIX
10324+ #pragma alloca
10325+# else
10326+# ifndef alloca
10327 char *alloca ();
10328+# endif
10329 # endif
10330 # endif
10331 # endif
10332 #endif
10333
10334-#if defined STDC_HEADERS || defined _LIBC
10335-# include <stdlib.h>
10336-#else
10337-char *getenv ();
10338-# ifdef HAVE_MALLOC_H
10339-# include <malloc.h>
10340-# else
10341-void free ();
10342-# endif
10343-#endif
10344+#include <stdlib.h>
10345+#include <string.h>
10346
10347-#if defined HAVE_STRING_H || defined _LIBC
10348-# ifndef _GNU_SOURCE
10349-# define _GNU_SOURCE 1
10350-# endif
10351-# include <string.h>
10352+#include "gettextP.h"
10353+
10354+#if ENABLE_RELOCATABLE
10355+# include "relocatable.h"
10356 #else
10357-# include <strings.h>
10358-# ifndef memcpy
10359-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
10360-# endif
10361-#endif
10362-#if !HAVE_STRCHR && !defined _LIBC
10363-# ifndef strchr
10364-# define strchr index
10365-# endif
10366+# define relocate(pathname) (pathname)
10367 #endif
10368
10369-#include "gettext.h"
10370-#include "gettextP.h"
10371-
10372 /* @@ end of prolog @@ */
10373
10374 #ifdef _LIBC
10375@@ -79,43 +75,49 @@
10376 because some ANSI C functions will require linking with this object
10377 file and the name space must not be polluted. */
10378 # define strcasecmp __strcasecmp
10379+
10380+# ifndef mempcpy
10381+# define mempcpy __mempcpy
10382+# endif
10383+# define HAVE_MEMPCPY 1
10384+# define HAVE___FSETLOCKING 1
10385+
10386+/* We need locking here since we can be called from different places. */
10387+# include <bits/libc-lock.h>
10388+
10389+__libc_lock_define_initialized (static, lock);
10390+#endif
10391+
10392+#ifndef internal_function
10393+# define internal_function
10394 #endif
10395
10396+/* Some optimizations for glibc. */
10397+#ifdef _LIBC
10398+# define FEOF(fp) feof_unlocked (fp)
10399+# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp)
10400+#else
10401+# define FEOF(fp) feof (fp)
10402+# define FGETS(buf, n, fp) fgets (buf, n, fp)
10403+#endif
10404
10405-/* For those loosing systems which don't have `alloca' we have to add
10406+/* For those losing systems which don't have `alloca' we have to add
10407 some additional code emulating it. */
10408 #ifdef HAVE_ALLOCA
10409-/* Nothing has to be done. */
10410-# define ADD_BLOCK(list, address) /* nothing */
10411-# define FREE_BLOCKS(list) /* nothing */
10412+# define freea(p) /* nothing */
10413 #else
10414-struct block_list
10415-{
10416- void *address;
10417- struct block_list *next;
10418-};
10419-# define ADD_BLOCK(list, addr) \
10420- do { \
10421- struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
10422- /* If we cannot get a free block we cannot add the new element to \
10423- the list. */ \
10424- if (newp != NULL) { \
10425- newp->address = (addr); \
10426- newp->next = (list); \
10427- (list) = newp; \
10428- } \
10429- } while (0)
10430-# define FREE_BLOCKS(list) \
10431- do { \
10432- while (list != NULL) { \
10433- struct block_list *old = list; \
10434- list = list->next; \
10435- free (old); \
10436- } \
10437- } while (0)
10438-# undef alloca
10439-# define alloca(size) (malloc (size))
10440-#endif /* have alloca */
10441+# define alloca(n) malloc (n)
10442+# define freea(p) free (p)
10443+#endif
10444+
10445+#if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED
10446+# undef fgets
10447+# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
10448+#endif
10449+#if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED
10450+# undef feof
10451+# define feof(s) feof_unlocked (s)
10452+#endif
10453
10454
10455 struct alias_map
10456@@ -125,26 +127,41 @@
10457 };
10458
10459
10460-static struct alias_map *map;
10461-static size_t nmap = 0;
10462-static size_t maxmap = 0;
10463+#ifndef _LIBC
10464+# define libc_freeres_ptr(decl) decl
10465+#endif
10466+
10467+libc_freeres_ptr (static char *string_space);
10468+static size_t string_space_act;
10469+static size_t string_space_max;
10470+libc_freeres_ptr (static struct alias_map *map);
10471+static size_t nmap;
10472+static size_t maxmap;
10473
10474
10475 /* Prototypes for local functions. */
10476-static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
10477-static void extend_alias_table PARAMS ((void));
10478-static int alias_compare PARAMS ((const struct alias_map *map1,
10479- const struct alias_map *map2));
10480+static size_t read_alias_file (const char *fname, int fname_len)
10481+ internal_function;
10482+static int extend_alias_table (void);
10483+static int alias_compare (const struct alias_map *map1,
10484+ const struct alias_map *map2);
10485
10486
10487 const char *
10488-_nl_expand_alias (name)
10489- const char *name;
10490+_nl_expand_alias (const char *name)
10491 {
10492- static const char *locale_alias_path = LOCALE_ALIAS_PATH;
10493+ static const char *locale_alias_path;
10494 struct alias_map *retval;
10495+ const char *result = NULL;
10496 size_t added;
10497
10498+#ifdef _LIBC
10499+ __libc_lock_lock (lock);
10500+#endif
10501+
10502+ if (locale_alias_path == NULL)
10503+ locale_alias_path = LOCALE_ALIAS_PATH;
10504+
10505 do
10506 {
10507 struct alias_map item;
10508@@ -154,15 +171,18 @@
10509 if (nmap > 0)
10510 retval = (struct alias_map *) bsearch (&item, map, nmap,
10511 sizeof (struct alias_map),
10512- (int (*) PARAMS ((const void *,
10513- const void *))
10514+ (int (*) (const void *,
10515+ const void *)
10516 ) alias_compare);
10517 else
10518 retval = NULL;
10519
10520 /* We really found an alias. Return the value. */
10521 if (retval != NULL)
10522- return retval->value;
10523+ {
10524+ result = retval->value;
10525+ break;
10526+ }
10527
10528 /* Perhaps we can find another alias file. */
10529 added = 0;
10530@@ -170,11 +190,12 @@
10531 {
10532 const char *start;
10533
10534- while (locale_alias_path[0] == ':')
10535+ while (locale_alias_path[0] == PATH_SEPARATOR)
10536 ++locale_alias_path;
10537 start = locale_alias_path;
10538
10539- while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
10540+ while (locale_alias_path[0] != '\0'
10541+ && locale_alias_path[0] != PATH_SEPARATOR)
10542 ++locale_alias_path;
10543
10544 if (start < locale_alias_path)
10545@@ -183,78 +204,87 @@
10546 }
10547 while (added != 0);
10548
10549- return NULL;
10550+#ifdef _LIBC
10551+ __libc_lock_unlock (lock);
10552+#endif
10553+
10554+ return result;
10555 }
10556
10557
10558 static size_t
10559-read_alias_file (fname, fname_len)
10560- const char *fname;
10561- int fname_len;
10562+internal_function
10563+read_alias_file (const char *fname, int fname_len)
10564 {
10565-#ifndef HAVE_ALLOCA
10566- struct block_list *block_list = NULL;
10567-#endif
10568 FILE *fp;
10569 char *full_fname;
10570 size_t added;
10571 static const char aliasfile[] = "/locale.alias";
10572
10573 full_fname = (char *) alloca (fname_len + sizeof aliasfile);
10574- ADD_BLOCK (block_list, full_fname);
10575+#ifdef HAVE_MEMPCPY
10576+ mempcpy (mempcpy (full_fname, fname, fname_len),
10577+ aliasfile, sizeof aliasfile);
10578+#else
10579 memcpy (full_fname, fname, fname_len);
10580 memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
10581+#endif
10582
10583- fp = fopen (full_fname, "r");
10584+ fp = fopen (relocate (full_fname), "r");
10585+ freea (full_fname);
10586 if (fp == NULL)
10587- {
10588- FREE_BLOCKS (block_list);
10589- return 0;
10590- }
10591+ return 0;
10592+
10593+#ifdef HAVE___FSETLOCKING
10594+ /* No threads present. */
10595+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
10596+#endif
10597
10598 added = 0;
10599- while (!feof (fp))
10600+ while (!FEOF (fp))
10601 {
10602 /* It is a reasonable approach to use a fix buffer here because
10603 a) we are only interested in the first two fields
10604 b) these fields must be usable as file names and so must not
10605 be that long
10606- */
10607- char buf[BUFSIZ];
10608+ We avoid a multi-kilobyte buffer here since this would use up
10609+ stack space which we might not have if the program ran out of
10610+ memory. */
10611+ char buf[400];
10612 char *alias;
10613 char *value;
10614 char *cp;
10615
10616- if (fgets (buf, BUFSIZ, fp) == NULL)
10617+ if (FGETS (buf, sizeof buf, fp) == NULL)
10618 /* EOF reached. */
10619 break;
10620
10621 cp = buf;
10622 /* Ignore leading white space. */
10623- while (isspace (cp[0]))
10624+ while (isspace ((unsigned char) cp[0]))
10625 ++cp;
10626
10627 /* A leading '#' signals a comment line. */
10628 if (cp[0] != '\0' && cp[0] != '#')
10629 {
10630 alias = cp++;
10631- while (cp[0] != '\0' && !isspace (cp[0]))
10632+ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
10633 ++cp;
10634 /* Terminate alias name. */
10635 if (cp[0] != '\0')
10636 *cp++ = '\0';
10637
10638 /* Now look for the beginning of the value. */
10639- while (isspace (cp[0]))
10640+ while (isspace ((unsigned char) cp[0]))
10641 ++cp;
10642
10643 if (cp[0] != '\0')
10644 {
10645- char *tp;
10646- size_t len;
10647+ size_t alias_len;
10648+ size_t value_len;
10649
10650 value = cp++;
10651- while (cp[0] != '\0' && !isspace (cp[0]))
10652+ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
10653 ++cp;
10654 /* Terminate value. */
10655 if (cp[0] == '\n')
10656@@ -269,28 +299,44 @@
10657 *cp++ = '\0';
10658
10659 if (nmap >= maxmap)
10660- extend_alias_table ();
10661-
10662- /* We cannot depend on strdup available in the libc. Sigh! */
10663- len = strlen (alias) + 1;
10664- tp = (char *) malloc (len);
10665- if (tp == NULL)
10666- {
10667- FREE_BLOCKS (block_list);
10668+ if (__builtin_expect (extend_alias_table (), 0))
10669 return added;
10670- }
10671- memcpy (tp, alias, len);
10672- map[nmap].alias = tp;
10673
10674- len = strlen (value) + 1;
10675- tp = (char *) malloc (len);
10676- if (tp == NULL)
10677+ alias_len = strlen (alias) + 1;
10678+ value_len = strlen (value) + 1;
10679+
10680+ if (string_space_act + alias_len + value_len > string_space_max)
10681 {
10682- FREE_BLOCKS (block_list);
10683- return added;
10684+ /* Increase size of memory pool. */
10685+ size_t new_size = (string_space_max
10686+ + (alias_len + value_len > 1024
10687+ ? alias_len + value_len : 1024));
10688+ char *new_pool = (char *) realloc (string_space, new_size);
10689+ if (new_pool == NULL)
10690+ return added;
10691+
10692+ if (__builtin_expect (string_space != new_pool, 0))
10693+ {
10694+ size_t i;
10695+
10696+ for (i = 0; i < nmap; i++)
10697+ {
10698+ map[i].alias += new_pool - string_space;
10699+ map[i].value += new_pool - string_space;
10700+ }
10701+ }
10702+
10703+ string_space = new_pool;
10704+ string_space_max = new_size;
10705 }
10706- memcpy (tp, value, len);
10707- map[nmap].value = tp;
10708+
10709+ map[nmap].alias = memcpy (&string_space[string_space_act],
10710+ alias, alias_len);
10711+ string_space_act += alias_len;
10712+
10713+ map[nmap].value = memcpy (&string_space[string_space_act],
10714+ value, value_len);
10715+ string_space_act += value_len;
10716
10717 ++nmap;
10718 ++added;
10719@@ -299,14 +345,11 @@
10720
10721 /* Possibly not the whole line fits into the buffer. Ignore
10722 the rest of the line. */
10723- while (strchr (cp, '\n') == NULL)
10724- {
10725- cp = buf;
10726- if (fgets (buf, BUFSIZ, fp) == NULL)
10727- /* Make sure the inner loop will be left. The outer loop
10728- will exit at the `feof' test. */
10729- *cp = '\n';
10730- }
10731+ while (strchr (buf, '\n') == NULL)
10732+ if (FGETS (buf, sizeof buf, fp) == NULL)
10733+ /* Make sure the inner loop will be left. The outer loop
10734+ will exit at the `feof' test. */
10735+ break;
10736 }
10737
10738 /* Should we test for ferror()? I think we have to silently ignore
10739@@ -315,40 +358,33 @@
10740
10741 if (added > 0)
10742 qsort (map, nmap, sizeof (struct alias_map),
10743- (int (*) PARAMS ((const void *, const void *))) alias_compare);
10744+ (int (*) (const void *, const void *)) alias_compare);
10745
10746- FREE_BLOCKS (block_list);
10747 return added;
10748 }
10749
10750
10751-static void
10752+static int
10753 extend_alias_table ()
10754 {
10755 size_t new_size;
10756 struct alias_map *new_map;
10757
10758 new_size = maxmap == 0 ? 100 : 2 * maxmap;
10759- new_map = (struct alias_map *) malloc (new_size
10760- * sizeof (struct alias_map));
10761+ new_map = (struct alias_map *) realloc (map, (new_size
10762+ * sizeof (struct alias_map)));
10763 if (new_map == NULL)
10764 /* Simply don't extend: we don't have any more core. */
10765- return;
10766-
10767- memcpy (new_map, map, nmap * sizeof (struct alias_map));
10768-
10769- if (maxmap != 0)
10770- free (map);
10771+ return -1;
10772
10773 map = new_map;
10774 maxmap = new_size;
10775+ return 0;
10776 }
10777
10778
10779 static int
10780-alias_compare (map1, map2)
10781- const struct alias_map *map1;
10782- const struct alias_map *map2;
10783+alias_compare (const struct alias_map *map1, const struct alias_map *map2)
10784 {
10785 #if defined _LIBC || defined HAVE_STRCASECMP
10786 return strcasecmp (map1->alias, map2->alias);
10787--- lrzsz-0.12.20.safe/intl/localename.c 1969-12-31 19:00:00.000000000 -0500
10788+++ lrzsz-0.12.20/intl/localename.c 2004-09-12 14:40:34.510724528 -0400
10789@@ -0,0 +1,1142 @@
10790+/* Determine the current selected locale.
10791+ Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
10792+
10793+ This program is free software; you can redistribute it and/or modify it
10794+ under the terms of the GNU Library General Public License as published
10795+ by the Free Software Foundation; either version 2, or (at your option)
10796+ any later version.
10797+
10798+ This program is distributed in the hope that it will be useful,
10799+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10800+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10801+ Library General Public License for more details.
10802+
10803+ You should have received a copy of the GNU Library General Public
10804+ License along with this program; if not, write to the Free Software
10805+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
10806+ USA. */
10807+
10808+/* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */
10809+/* Win32 code written by Tor Lillqvist <tml@iki.fi>. */
10810+
10811+#ifdef HAVE_CONFIG_H
10812+# include <config.h>
10813+#endif
10814+
10815+#include <stdlib.h>
10816+#include <locale.h>
10817+
10818+#if defined _WIN32 || defined __WIN32__
10819+# undef WIN32 /* avoid warning on mingw32 */
10820+# define WIN32
10821+#endif
10822+
10823+#ifdef WIN32
10824+# define WIN32_LEAN_AND_MEAN
10825+# include <windows.h>
10826+/* List of language codes, sorted by value:
10827+ 0x01 LANG_ARABIC
10828+ 0x02 LANG_BULGARIAN
10829+ 0x03 LANG_CATALAN
10830+ 0x04 LANG_CHINESE
10831+ 0x05 LANG_CZECH
10832+ 0x06 LANG_DANISH
10833+ 0x07 LANG_GERMAN
10834+ 0x08 LANG_GREEK
10835+ 0x09 LANG_ENGLISH
10836+ 0x0a LANG_SPANISH
10837+ 0x0b LANG_FINNISH
10838+ 0x0c LANG_FRENCH
10839+ 0x0d LANG_HEBREW
10840+ 0x0e LANG_HUNGARIAN
10841+ 0x0f LANG_ICELANDIC
10842+ 0x10 LANG_ITALIAN
10843+ 0x11 LANG_JAPANESE
10844+ 0x12 LANG_KOREAN
10845+ 0x13 LANG_DUTCH
10846+ 0x14 LANG_NORWEGIAN
10847+ 0x15 LANG_POLISH
10848+ 0x16 LANG_PORTUGUESE
10849+ 0x17 LANG_RHAETO_ROMANCE
10850+ 0x18 LANG_ROMANIAN
10851+ 0x19 LANG_RUSSIAN
10852+ 0x1a LANG_CROATIAN == LANG_SERBIAN
10853+ 0x1b LANG_SLOVAK
10854+ 0x1c LANG_ALBANIAN
10855+ 0x1d LANG_SWEDISH
10856+ 0x1e LANG_THAI
10857+ 0x1f LANG_TURKISH
10858+ 0x20 LANG_URDU
10859+ 0x21 LANG_INDONESIAN
10860+ 0x22 LANG_UKRAINIAN
10861+ 0x23 LANG_BELARUSIAN
10862+ 0x24 LANG_SLOVENIAN
10863+ 0x25 LANG_ESTONIAN
10864+ 0x26 LANG_LATVIAN
10865+ 0x27 LANG_LITHUANIAN
10866+ 0x28 LANG_TAJIK
10867+ 0x29 LANG_FARSI
10868+ 0x2a LANG_VIETNAMESE
10869+ 0x2b LANG_ARMENIAN
10870+ 0x2c LANG_AZERI
10871+ 0x2d LANG_BASQUE
10872+ 0x2e LANG_SORBIAN
10873+ 0x2f LANG_MACEDONIAN
10874+ 0x30 LANG_SUTU
10875+ 0x31 LANG_TSONGA
10876+ 0x32 LANG_TSWANA
10877+ 0x33 LANG_VENDA
10878+ 0x34 LANG_XHOSA
10879+ 0x35 LANG_ZULU
10880+ 0x36 LANG_AFRIKAANS
10881+ 0x37 LANG_GEORGIAN
10882+ 0x38 LANG_FAEROESE
10883+ 0x39 LANG_HINDI
10884+ 0x3a LANG_MALTESE
10885+ 0x3b LANG_SAAMI
10886+ 0x3c LANG_GAELIC
10887+ 0x3d LANG_YIDDISH
10888+ 0x3e LANG_MALAY
10889+ 0x3f LANG_KAZAK
10890+ 0x40 LANG_KYRGYZ
10891+ 0x41 LANG_SWAHILI
10892+ 0x42 LANG_TURKMEN
10893+ 0x43 LANG_UZBEK
10894+ 0x44 LANG_TATAR
10895+ 0x45 LANG_BENGALI
10896+ 0x46 LANG_PUNJABI
10897+ 0x47 LANG_GUJARATI
10898+ 0x48 LANG_ORIYA
10899+ 0x49 LANG_TAMIL
10900+ 0x4a LANG_TELUGU
10901+ 0x4b LANG_KANNADA
10902+ 0x4c LANG_MALAYALAM
10903+ 0x4d LANG_ASSAMESE
10904+ 0x4e LANG_MARATHI
10905+ 0x4f LANG_SANSKRIT
10906+ 0x50 LANG_MONGOLIAN
10907+ 0x51 LANG_TIBETAN
10908+ 0x52 LANG_WELSH
10909+ 0x53 LANG_CAMBODIAN
10910+ 0x54 LANG_LAO
10911+ 0x55 LANG_BURMESE
10912+ 0x56 LANG_GALICIAN
10913+ 0x57 LANG_KONKANI
10914+ 0x58 LANG_MANIPURI
10915+ 0x59 LANG_SINDHI
10916+ 0x5a LANG_SYRIAC
10917+ 0x5b LANG_SINHALESE
10918+ 0x5c LANG_CHEROKEE
10919+ 0x5d LANG_INUKTITUT
10920+ 0x5e LANG_AMHARIC
10921+ 0x5f LANG_TAMAZIGHT
10922+ 0x60 LANG_KASHMIRI
10923+ 0x61 LANG_NEPALI
10924+ 0x62 LANG_FRISIAN
10925+ 0x63 LANG_PASHTO
10926+ 0x64 LANG_TAGALOG
10927+ 0x65 LANG_DIVEHI
10928+ 0x66 LANG_EDO
10929+ 0x67 LANG_FULFULDE
10930+ 0x68 LANG_HAUSA
10931+ 0x69 LANG_IBIBIO
10932+ 0x6a LANG_YORUBA
10933+ 0x70 LANG_IGBO
10934+ 0x71 LANG_KANURI
10935+ 0x72 LANG_OROMO
10936+ 0x73 LANG_TIGRINYA
10937+ 0x74 LANG_GUARANI
10938+ 0x75 LANG_HAWAIIAN
10939+ 0x76 LANG_LATIN
10940+ 0x77 LANG_SOMALI
10941+ 0x78 LANG_YI
10942+ 0x79 LANG_PAPIAMENTU
10943+*/
10944+/* Mingw headers don't have latest language and sublanguage codes. */
10945+# ifndef LANG_AFRIKAANS
10946+# define LANG_AFRIKAANS 0x36
10947+# endif
10948+# ifndef LANG_ALBANIAN
10949+# define LANG_ALBANIAN 0x1c
10950+# endif
10951+# ifndef LANG_AMHARIC
10952+# define LANG_AMHARIC 0x5e
10953+# endif
10954+# ifndef LANG_ARABIC
10955+# define LANG_ARABIC 0x01
10956+# endif
10957+# ifndef LANG_ARMENIAN
10958+# define LANG_ARMENIAN 0x2b
10959+# endif
10960+# ifndef LANG_ASSAMESE
10961+# define LANG_ASSAMESE 0x4d
10962+# endif
10963+# ifndef LANG_AZERI
10964+# define LANG_AZERI 0x2c
10965+# endif
10966+# ifndef LANG_BASQUE
10967+# define LANG_BASQUE 0x2d
10968+# endif
10969+# ifndef LANG_BELARUSIAN
10970+# define LANG_BELARUSIAN 0x23
10971+# endif
10972+# ifndef LANG_BENGALI
10973+# define LANG_BENGALI 0x45
10974+# endif
10975+# ifndef LANG_BURMESE
10976+# define LANG_BURMESE 0x55
10977+# endif
10978+# ifndef LANG_CAMBODIAN
10979+# define LANG_CAMBODIAN 0x53
10980+# endif
10981+# ifndef LANG_CATALAN
10982+# define LANG_CATALAN 0x03
10983+# endif
10984+# ifndef LANG_CHEROKEE
10985+# define LANG_CHEROKEE 0x5c
10986+# endif
10987+# ifndef LANG_DIVEHI
10988+# define LANG_DIVEHI 0x65
10989+# endif
10990+# ifndef LANG_EDO
10991+# define LANG_EDO 0x66
10992+# endif
10993+# ifndef LANG_ESTONIAN
10994+# define LANG_ESTONIAN 0x25
10995+# endif
10996+# ifndef LANG_FAEROESE
10997+# define LANG_FAEROESE 0x38
10998+# endif
10999+# ifndef LANG_FARSI
11000+# define LANG_FARSI 0x29
11001+# endif
11002+# ifndef LANG_FRISIAN
11003+# define LANG_FRISIAN 0x62
11004+# endif
11005+# ifndef LANG_FULFULDE
11006+# define LANG_FULFULDE 0x67
11007+# endif
11008+# ifndef LANG_GAELIC
11009+# define LANG_GAELIC 0x3c
11010+# endif
11011+# ifndef LANG_GALICIAN
11012+# define LANG_GALICIAN 0x56
11013+# endif
11014+# ifndef LANG_GEORGIAN
11015+# define LANG_GEORGIAN 0x37
11016+# endif
11017+# ifndef LANG_GUARANI
11018+# define LANG_GUARANI 0x74
11019+# endif
11020+# ifndef LANG_GUJARATI
11021+# define LANG_GUJARATI 0x47
11022+# endif
11023+# ifndef LANG_HAUSA
11024+# define LANG_HAUSA 0x68
11025+# endif
11026+# ifndef LANG_HAWAIIAN
11027+# define LANG_HAWAIIAN 0x75
11028+# endif
11029+# ifndef LANG_HEBREW
11030+# define LANG_HEBREW 0x0d
11031+# endif
11032+# ifndef LANG_HINDI
11033+# define LANG_HINDI 0x39
11034+# endif
11035+# ifndef LANG_IBIBIO
11036+# define LANG_IBIBIO 0x69
11037+# endif
11038+# ifndef LANG_IGBO
11039+# define LANG_IGBO 0x70
11040+# endif
11041+# ifndef LANG_INDONESIAN
11042+# define LANG_INDONESIAN 0x21
11043+# endif
11044+# ifndef LANG_INUKTITUT
11045+# define LANG_INUKTITUT 0x5d
11046+# endif
11047+# ifndef LANG_KANNADA
11048+# define LANG_KANNADA 0x4b
11049+# endif
11050+# ifndef LANG_KANURI
11051+# define LANG_KANURI 0x71
11052+# endif
11053+# ifndef LANG_KASHMIRI
11054+# define LANG_KASHMIRI 0x60
11055+# endif
11056+# ifndef LANG_KAZAK
11057+# define LANG_KAZAK 0x3f
11058+# endif
11059+# ifndef LANG_KONKANI
11060+# define LANG_KONKANI 0x57
11061+# endif
11062+# ifndef LANG_KYRGYZ
11063+# define LANG_KYRGYZ 0x40
11064+# endif
11065+# ifndef LANG_LAO
11066+# define LANG_LAO 0x54
11067+# endif
11068+# ifndef LANG_LATIN
11069+# define LANG_LATIN 0x76
11070+# endif
11071+# ifndef LANG_LATVIAN
11072+# define LANG_LATVIAN 0x26
11073+# endif
11074+# ifndef LANG_LITHUANIAN
11075+# define LANG_LITHUANIAN 0x27
11076+# endif
11077+# ifndef LANG_MACEDONIAN
11078+# define LANG_MACEDONIAN 0x2f
11079+# endif
11080+# ifndef LANG_MALAY
11081+# define LANG_MALAY 0x3e
11082+# endif
11083+# ifndef LANG_MALAYALAM
11084+# define LANG_MALAYALAM 0x4c
11085+# endif
11086+# ifndef LANG_MALTESE
11087+# define LANG_MALTESE 0x3a
11088+# endif
11089+# ifndef LANG_MANIPURI
11090+# define LANG_MANIPURI 0x58
11091+# endif
11092+# ifndef LANG_MARATHI
11093+# define LANG_MARATHI 0x4e
11094+# endif
11095+# ifndef LANG_MONGOLIAN
11096+# define LANG_MONGOLIAN 0x50
11097+# endif
11098+# ifndef LANG_NEPALI
11099+# define LANG_NEPALI 0x61
11100+# endif
11101+# ifndef LANG_ORIYA
11102+# define LANG_ORIYA 0x48
11103+# endif
11104+# ifndef LANG_OROMO
11105+# define LANG_OROMO 0x72
11106+# endif
11107+# ifndef LANG_PAPIAMENTU
11108+# define LANG_PAPIAMENTU 0x79
11109+# endif
11110+# ifndef LANG_PASHTO
11111+# define LANG_PASHTO 0x63
11112+# endif
11113+# ifndef LANG_PUNJABI
11114+# define LANG_PUNJABI 0x46
11115+# endif
11116+# ifndef LANG_RHAETO_ROMANCE
11117+# define LANG_RHAETO_ROMANCE 0x17
11118+# endif
11119+# ifndef LANG_SAAMI
11120+# define LANG_SAAMI 0x3b
11121+# endif
11122+# ifndef LANG_SANSKRIT
11123+# define LANG_SANSKRIT 0x4f
11124+# endif
11125+# ifndef LANG_SERBIAN
11126+# define LANG_SERBIAN 0x1a
11127+# endif
11128+# ifndef LANG_SINDHI
11129+# define LANG_SINDHI 0x59
11130+# endif
11131+# ifndef LANG_SINHALESE
11132+# define LANG_SINHALESE 0x5b
11133+# endif
11134+# ifndef LANG_SLOVAK
11135+# define LANG_SLOVAK 0x1b
11136+# endif
11137+# ifndef LANG_SOMALI
11138+# define LANG_SOMALI 0x77
11139+# endif
11140+# ifndef LANG_SORBIAN
11141+# define LANG_SORBIAN 0x2e
11142+# endif
11143+# ifndef LANG_SUTU
11144+# define LANG_SUTU 0x30
11145+# endif
11146+# ifndef LANG_SWAHILI
11147+# define LANG_SWAHILI 0x41
11148+# endif
11149+# ifndef LANG_SYRIAC
11150+# define LANG_SYRIAC 0x5a
11151+# endif
11152+# ifndef LANG_TAGALOG
11153+# define LANG_TAGALOG 0x64
11154+# endif
11155+# ifndef LANG_TAJIK
11156+# define LANG_TAJIK 0x28
11157+# endif
11158+# ifndef LANG_TAMAZIGHT
11159+# define LANG_TAMAZIGHT 0x5f
11160+# endif
11161+# ifndef LANG_TAMIL
11162+# define LANG_TAMIL 0x49
11163+# endif
11164+# ifndef LANG_TATAR
11165+# define LANG_TATAR 0x44
11166+# endif
11167+# ifndef LANG_TELUGU
11168+# define LANG_TELUGU 0x4a
11169+# endif
11170+# ifndef LANG_THAI
11171+# define LANG_THAI 0x1e
11172+# endif
11173+# ifndef LANG_TIBETAN
11174+# define LANG_TIBETAN 0x51
11175+# endif
11176+# ifndef LANG_TIGRINYA
11177+# define LANG_TIGRINYA 0x73
11178+# endif
11179+# ifndef LANG_TSONGA
11180+# define LANG_TSONGA 0x31
11181+# endif
11182+# ifndef LANG_TSWANA
11183+# define LANG_TSWANA 0x32
11184+# endif
11185+# ifndef LANG_TURKMEN
11186+# define LANG_TURKMEN 0x42
11187+# endif
11188+# ifndef LANG_UKRAINIAN
11189+# define LANG_UKRAINIAN 0x22
11190+# endif
11191+# ifndef LANG_URDU
11192+# define LANG_URDU 0x20
11193+# endif
11194+# ifndef LANG_UZBEK
11195+# define LANG_UZBEK 0x43
11196+# endif
11197+# ifndef LANG_VENDA
11198+# define LANG_VENDA 0x33
11199+# endif
11200+# ifndef LANG_VIETNAMESE
11201+# define LANG_VIETNAMESE 0x2a
11202+# endif
11203+# ifndef LANG_WELSH
11204+# define LANG_WELSH 0x52
11205+# endif
11206+# ifndef LANG_XHOSA
11207+# define LANG_XHOSA 0x34
11208+# endif
11209+# ifndef LANG_YI
11210+# define LANG_YI 0x78
11211+# endif
11212+# ifndef LANG_YIDDISH
11213+# define LANG_YIDDISH 0x3d
11214+# endif
11215+# ifndef LANG_YORUBA
11216+# define LANG_YORUBA 0x6a
11217+# endif
11218+# ifndef LANG_ZULU
11219+# define LANG_ZULU 0x35
11220+# endif
11221+# ifndef SUBLANG_ARABIC_SAUDI_ARABIA
11222+# define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
11223+# endif
11224+# ifndef SUBLANG_ARABIC_IRAQ
11225+# define SUBLANG_ARABIC_IRAQ 0x02
11226+# endif
11227+# ifndef SUBLANG_ARABIC_EGYPT
11228+# define SUBLANG_ARABIC_EGYPT 0x03
11229+# endif
11230+# ifndef SUBLANG_ARABIC_LIBYA
11231+# define SUBLANG_ARABIC_LIBYA 0x04
11232+# endif
11233+# ifndef SUBLANG_ARABIC_ALGERIA
11234+# define SUBLANG_ARABIC_ALGERIA 0x05
11235+# endif
11236+# ifndef SUBLANG_ARABIC_MOROCCO
11237+# define SUBLANG_ARABIC_MOROCCO 0x06
11238+# endif
11239+# ifndef SUBLANG_ARABIC_TUNISIA
11240+# define SUBLANG_ARABIC_TUNISIA 0x07
11241+# endif
11242+# ifndef SUBLANG_ARABIC_OMAN
11243+# define SUBLANG_ARABIC_OMAN 0x08
11244+# endif
11245+# ifndef SUBLANG_ARABIC_YEMEN
11246+# define SUBLANG_ARABIC_YEMEN 0x09
11247+# endif
11248+# ifndef SUBLANG_ARABIC_SYRIA
11249+# define SUBLANG_ARABIC_SYRIA 0x0a
11250+# endif
11251+# ifndef SUBLANG_ARABIC_JORDAN
11252+# define SUBLANG_ARABIC_JORDAN 0x0b
11253+# endif
11254+# ifndef SUBLANG_ARABIC_LEBANON
11255+# define SUBLANG_ARABIC_LEBANON 0x0c
11256+# endif
11257+# ifndef SUBLANG_ARABIC_KUWAIT
11258+# define SUBLANG_ARABIC_KUWAIT 0x0d
11259+# endif
11260+# ifndef SUBLANG_ARABIC_UAE
11261+# define SUBLANG_ARABIC_UAE 0x0e
11262+# endif
11263+# ifndef SUBLANG_ARABIC_BAHRAIN
11264+# define SUBLANG_ARABIC_BAHRAIN 0x0f
11265+# endif
11266+# ifndef SUBLANG_ARABIC_QATAR
11267+# define SUBLANG_ARABIC_QATAR 0x10
11268+# endif
11269+# ifndef SUBLANG_AZERI_LATIN
11270+# define SUBLANG_AZERI_LATIN 0x01
11271+# endif
11272+# ifndef SUBLANG_AZERI_CYRILLIC
11273+# define SUBLANG_AZERI_CYRILLIC 0x02
11274+# endif
11275+# ifndef SUBLANG_BENGALI_INDIA
11276+# define SUBLANG_BENGALI_INDIA 0x00
11277+# endif
11278+# ifndef SUBLANG_BENGALI_BANGLADESH
11279+# define SUBLANG_BENGALI_BANGLADESH 0x01
11280+# endif
11281+# ifndef SUBLANG_CHINESE_MACAU
11282+# define SUBLANG_CHINESE_MACAU 0x05
11283+# endif
11284+# ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
11285+# define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
11286+# endif
11287+# ifndef SUBLANG_ENGLISH_JAMAICA
11288+# define SUBLANG_ENGLISH_JAMAICA 0x08
11289+# endif
11290+# ifndef SUBLANG_ENGLISH_CARIBBEAN
11291+# define SUBLANG_ENGLISH_CARIBBEAN 0x09
11292+# endif
11293+# ifndef SUBLANG_ENGLISH_BELIZE
11294+# define SUBLANG_ENGLISH_BELIZE 0x0a
11295+# endif
11296+# ifndef SUBLANG_ENGLISH_TRINIDAD
11297+# define SUBLANG_ENGLISH_TRINIDAD 0x0b
11298+# endif
11299+# ifndef SUBLANG_ENGLISH_ZIMBABWE
11300+# define SUBLANG_ENGLISH_ZIMBABWE 0x0c
11301+# endif
11302+# ifndef SUBLANG_ENGLISH_PHILIPPINES
11303+# define SUBLANG_ENGLISH_PHILIPPINES 0x0d
11304+# endif
11305+# ifndef SUBLANG_ENGLISH_INDONESIA
11306+# define SUBLANG_ENGLISH_INDONESIA 0x0e
11307+# endif
11308+# ifndef SUBLANG_ENGLISH_HONGKONG
11309+# define SUBLANG_ENGLISH_HONGKONG 0x0f
11310+# endif
11311+# ifndef SUBLANG_ENGLISH_INDIA
11312+# define SUBLANG_ENGLISH_INDIA 0x10
11313+# endif
11314+# ifndef SUBLANG_ENGLISH_MALAYSIA
11315+# define SUBLANG_ENGLISH_MALAYSIA 0x11
11316+# endif
11317+# ifndef SUBLANG_ENGLISH_SINGAPORE
11318+# define SUBLANG_ENGLISH_SINGAPORE 0x12
11319+# endif
11320+# ifndef SUBLANG_FRENCH_LUXEMBOURG
11321+# define SUBLANG_FRENCH_LUXEMBOURG 0x05
11322+# endif
11323+# ifndef SUBLANG_FRENCH_MONACO
11324+# define SUBLANG_FRENCH_MONACO 0x06
11325+# endif
11326+# ifndef SUBLANG_FRENCH_WESTINDIES
11327+# define SUBLANG_FRENCH_WESTINDIES 0x07
11328+# endif
11329+# ifndef SUBLANG_FRENCH_REUNION
11330+# define SUBLANG_FRENCH_REUNION 0x08
11331+# endif
11332+# ifndef SUBLANG_FRENCH_CONGO
11333+# define SUBLANG_FRENCH_CONGO 0x09
11334+# endif
11335+# ifndef SUBLANG_FRENCH_SENEGAL
11336+# define SUBLANG_FRENCH_SENEGAL 0x0a
11337+# endif
11338+# ifndef SUBLANG_FRENCH_CAMEROON
11339+# define SUBLANG_FRENCH_CAMEROON 0x0b
11340+# endif
11341+# ifndef SUBLANG_FRENCH_COTEDIVOIRE
11342+# define SUBLANG_FRENCH_COTEDIVOIRE 0x0c
11343+# endif
11344+# ifndef SUBLANG_FRENCH_MALI
11345+# define SUBLANG_FRENCH_MALI 0x0d
11346+# endif
11347+# ifndef SUBLANG_FRENCH_MOROCCO
11348+# define SUBLANG_FRENCH_MOROCCO 0x0e
11349+# endif
11350+# ifndef SUBLANG_FRENCH_HAITI
11351+# define SUBLANG_FRENCH_HAITI 0x0f
11352+# endif
11353+# ifndef SUBLANG_GERMAN_LUXEMBOURG
11354+# define SUBLANG_GERMAN_LUXEMBOURG 0x04
11355+# endif
11356+# ifndef SUBLANG_GERMAN_LIECHTENSTEIN
11357+# define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
11358+# endif
11359+# ifndef SUBLANG_KASHMIRI_INDIA
11360+# define SUBLANG_KASHMIRI_INDIA 0x02
11361+# endif
11362+# ifndef SUBLANG_MALAY_MALAYSIA
11363+# define SUBLANG_MALAY_MALAYSIA 0x01
11364+# endif
11365+# ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
11366+# define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
11367+# endif
11368+# ifndef SUBLANG_NEPALI_INDIA
11369+# define SUBLANG_NEPALI_INDIA 0x02
11370+# endif
11371+# ifndef SUBLANG_PUNJABI_INDIA
11372+# define SUBLANG_PUNJABI_INDIA 0x00
11373+# endif
11374+# ifndef SUBLANG_PUNJABI_PAKISTAN
11375+# define SUBLANG_PUNJABI_PAKISTAN 0x01
11376+# endif
11377+# ifndef SUBLANG_ROMANIAN_ROMANIA
11378+# define SUBLANG_ROMANIAN_ROMANIA 0x00
11379+# endif
11380+# ifndef SUBLANG_ROMANIAN_MOLDOVA
11381+# define SUBLANG_ROMANIAN_MOLDOVA 0x01
11382+# endif
11383+# ifndef SUBLANG_SERBIAN_LATIN
11384+# define SUBLANG_SERBIAN_LATIN 0x02
11385+# endif
11386+# ifndef SUBLANG_SERBIAN_CYRILLIC
11387+# define SUBLANG_SERBIAN_CYRILLIC 0x03
11388+# endif
11389+# ifndef SUBLANG_SINDHI_INDIA
11390+# define SUBLANG_SINDHI_INDIA 0x00
11391+# endif
11392+# ifndef SUBLANG_SINDHI_PAKISTAN
11393+# define SUBLANG_SINDHI_PAKISTAN 0x01
11394+# endif
11395+# ifndef SUBLANG_SPANISH_GUATEMALA
11396+# define SUBLANG_SPANISH_GUATEMALA 0x04
11397+# endif
11398+# ifndef SUBLANG_SPANISH_COSTA_RICA
11399+# define SUBLANG_SPANISH_COSTA_RICA 0x05
11400+# endif
11401+# ifndef SUBLANG_SPANISH_PANAMA
11402+# define SUBLANG_SPANISH_PANAMA 0x06
11403+# endif
11404+# ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
11405+# define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
11406+# endif
11407+# ifndef SUBLANG_SPANISH_VENEZUELA
11408+# define SUBLANG_SPANISH_VENEZUELA 0x08
11409+# endif
11410+# ifndef SUBLANG_SPANISH_COLOMBIA
11411+# define SUBLANG_SPANISH_COLOMBIA 0x09
11412+# endif
11413+# ifndef SUBLANG_SPANISH_PERU
11414+# define SUBLANG_SPANISH_PERU 0x0a
11415+# endif
11416+# ifndef SUBLANG_SPANISH_ARGENTINA
11417+# define SUBLANG_SPANISH_ARGENTINA 0x0b
11418+# endif
11419+# ifndef SUBLANG_SPANISH_ECUADOR
11420+# define SUBLANG_SPANISH_ECUADOR 0x0c
11421+# endif
11422+# ifndef SUBLANG_SPANISH_CHILE
11423+# define SUBLANG_SPANISH_CHILE 0x0d
11424+# endif
11425+# ifndef SUBLANG_SPANISH_URUGUAY
11426+# define SUBLANG_SPANISH_URUGUAY 0x0e
11427+# endif
11428+# ifndef SUBLANG_SPANISH_PARAGUAY
11429+# define SUBLANG_SPANISH_PARAGUAY 0x0f
11430+# endif
11431+# ifndef SUBLANG_SPANISH_BOLIVIA
11432+# define SUBLANG_SPANISH_BOLIVIA 0x10
11433+# endif
11434+# ifndef SUBLANG_SPANISH_EL_SALVADOR
11435+# define SUBLANG_SPANISH_EL_SALVADOR 0x11
11436+# endif
11437+# ifndef SUBLANG_SPANISH_HONDURAS
11438+# define SUBLANG_SPANISH_HONDURAS 0x12
11439+# endif
11440+# ifndef SUBLANG_SPANISH_NICARAGUA
11441+# define SUBLANG_SPANISH_NICARAGUA 0x13
11442+# endif
11443+# ifndef SUBLANG_SPANISH_PUERTO_RICO
11444+# define SUBLANG_SPANISH_PUERTO_RICO 0x14
11445+# endif
11446+# ifndef SUBLANG_SWEDISH_FINLAND
11447+# define SUBLANG_SWEDISH_FINLAND 0x02
11448+# endif
11449+# ifndef SUBLANG_TAMAZIGHT_ARABIC
11450+# define SUBLANG_TAMAZIGHT_ARABIC 0x01
11451+# endif
11452+# ifndef SUBLANG_TAMAZIGHT_LATIN
11453+# define SUBLANG_TAMAZIGHT_LATIN 0x02
11454+# endif
11455+# ifndef SUBLANG_TIGRINYA_ETHIOPIA
11456+# define SUBLANG_TIGRINYA_ETHIOPIA 0x00
11457+# endif
11458+# ifndef SUBLANG_TIGRINYA_ERITREA
11459+# define SUBLANG_TIGRINYA_ERITREA 0x01
11460+# endif
11461+# ifndef SUBLANG_URDU_PAKISTAN
11462+# define SUBLANG_URDU_PAKISTAN 0x01
11463+# endif
11464+# ifndef SUBLANG_URDU_INDIA
11465+# define SUBLANG_URDU_INDIA 0x02
11466+# endif
11467+# ifndef SUBLANG_UZBEK_LATIN
11468+# define SUBLANG_UZBEK_LATIN 0x01
11469+# endif
11470+# ifndef SUBLANG_UZBEK_CYRILLIC
11471+# define SUBLANG_UZBEK_CYRILLIC 0x02
11472+# endif
11473+#endif
11474+
11475+/* XPG3 defines the result of 'setlocale (category, NULL)' as:
11476+ "Directs 'setlocale()' to query 'category' and return the current
11477+ setting of 'local'."
11478+ However it does not specify the exact format. Neither do SUSV2 and
11479+ ISO C 99. So we can use this feature only on selected systems (e.g.
11480+ those using GNU C Library). */
11481+#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
11482+# define HAVE_LOCALE_NULL
11483+#endif
11484+
11485+/* Determine the current locale's name, and canonicalize it into XPG syntax
11486+ language[_territory[.codeset]][@modifier]
11487+ The codeset part in the result is not reliable; the locale_charset()
11488+ should be used for codeset information instead.
11489+ The result must not be freed; it is statically allocated. */
11490+
11491+const char *
11492+_nl_locale_name (int category, const char *categoryname)
11493+{
11494+ const char *retval;
11495+
11496+#ifndef WIN32
11497+
11498+ /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
11499+ On some systems this can be done by the 'setlocale' function itself. */
11500+# if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
11501+ retval = setlocale (category, NULL);
11502+# else
11503+ /* Setting of LC_ALL overwrites all other. */
11504+ retval = getenv ("LC_ALL");
11505+ if (retval == NULL || retval[0] == '\0')
11506+ {
11507+ /* Next comes the name of the desired category. */
11508+ retval = getenv (categoryname);
11509+ if (retval == NULL || retval[0] == '\0')
11510+ {
11511+ /* Last possibility is the LANG environment variable. */
11512+ retval = getenv ("LANG");
11513+ if (retval == NULL || retval[0] == '\0')
11514+ /* We use C as the default domain. POSIX says this is
11515+ implementation defined. */
11516+ retval = "C";
11517+ }
11518+ }
11519+# endif
11520+
11521+ return retval;
11522+
11523+#else /* WIN32 */
11524+
11525+ /* Return an XPG style locale name language[_territory][@modifier].
11526+ Don't even bother determining the codeset; it's not useful in this
11527+ context, because message catalogs are not specific to a single
11528+ codeset. */
11529+
11530+ LCID lcid;
11531+ LANGID langid;
11532+ int primary, sub;
11533+
11534+ /* Let the user override the system settings through environment
11535+ variables, as on POSIX systems. */
11536+ retval = getenv ("LC_ALL");
11537+ if (retval != NULL && retval[0] != '\0')
11538+ return retval;
11539+ retval = getenv (categoryname);
11540+ if (retval != NULL && retval[0] != '\0')
11541+ return retval;
11542+ retval = getenv ("LANG");
11543+ if (retval != NULL && retval[0] != '\0')
11544+ return retval;
11545+
11546+ /* Use native Win32 API locale ID. */
11547+ lcid = GetThreadLocale ();
11548+
11549+ /* Strip off the sorting rules, keep only the language part. */
11550+ langid = LANGIDFROMLCID (lcid);
11551+
11552+ /* Split into language and territory part. */
11553+ primary = PRIMARYLANGID (langid);
11554+ sub = SUBLANGID (langid);
11555+
11556+ /* Dispatch on language.
11557+ See also http://www.unicode.org/unicode/onlinedat/languages.html .
11558+ For details about languages, see http://www.ethnologue.com/ . */
11559+ switch (primary)
11560+ {
11561+ case LANG_AFRIKAANS: return "af_ZA";
11562+ case LANG_ALBANIAN: return "sq_AL";
11563+ case LANG_AMHARIC: return "am_ET";
11564+ case LANG_ARABIC:
11565+ switch (sub)
11566+ {
11567+ case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
11568+ case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
11569+ case SUBLANG_ARABIC_EGYPT: return "ar_EG";
11570+ case SUBLANG_ARABIC_LIBYA: return "ar_LY";
11571+ case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
11572+ case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
11573+ case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
11574+ case SUBLANG_ARABIC_OMAN: return "ar_OM";
11575+ case SUBLANG_ARABIC_YEMEN: return "ar_YE";
11576+ case SUBLANG_ARABIC_SYRIA: return "ar_SY";
11577+ case SUBLANG_ARABIC_JORDAN: return "ar_JO";
11578+ case SUBLANG_ARABIC_LEBANON: return "ar_LB";
11579+ case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
11580+ case SUBLANG_ARABIC_UAE: return "ar_AE";
11581+ case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
11582+ case SUBLANG_ARABIC_QATAR: return "ar_QA";
11583+ }
11584+ return "ar";
11585+ case LANG_ARMENIAN: return "hy_AM";
11586+ case LANG_ASSAMESE: return "as_IN";
11587+ case LANG_AZERI:
11588+ switch (sub)
11589+ {
11590+ /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
11591+ case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
11592+ case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
11593+ }
11594+ return "az";
11595+ case LANG_BASQUE:
11596+ return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */
11597+ case LANG_BELARUSIAN: return "be_BY";
11598+ case LANG_BENGALI:
11599+ switch (sub)
11600+ {
11601+ case SUBLANG_BENGALI_INDIA: return "bn_IN";
11602+ case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
11603+ }
11604+ return "bn";
11605+ case LANG_BULGARIAN: return "bg_BG";
11606+ case LANG_BURMESE: return "my_MM";
11607+ case LANG_CAMBODIAN: return "km_KH";
11608+ case LANG_CATALAN: return "ca_ES";
11609+ case LANG_CHEROKEE: return "chr_US";
11610+ case LANG_CHINESE:
11611+ switch (sub)
11612+ {
11613+ case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
11614+ case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
11615+ case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
11616+ case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
11617+ case SUBLANG_CHINESE_MACAU: return "zh_MO";
11618+ }
11619+ return "zh";
11620+ case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN
11621+ * What used to be called Serbo-Croatian
11622+ * should really now be two separate
11623+ * languages because of political reasons.
11624+ * (Says tml, who knows nothing about Serbian
11625+ * or Croatian.)
11626+ * (I can feel those flames coming already.)
11627+ */
11628+ switch (sub)
11629+ {
11630+ case SUBLANG_DEFAULT: return "hr_HR";
11631+ case SUBLANG_SERBIAN_LATIN: return "sr_CS";
11632+ case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic";
11633+ }
11634+ return "hr";
11635+ case LANG_CZECH: return "cs_CZ";
11636+ case LANG_DANISH: return "da_DK";
11637+ case LANG_DIVEHI: return "dv_MV";
11638+ case LANG_DUTCH:
11639+ switch (sub)
11640+ {
11641+ case SUBLANG_DUTCH: return "nl_NL";
11642+ case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
11643+ }
11644+ return "nl";
11645+ case LANG_EDO: return "bin_NG";
11646+ case LANG_ENGLISH:
11647+ switch (sub)
11648+ {
11649+ /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
11650+ * English was the language spoken in England.
11651+ * Oh well.
11652+ */
11653+ case SUBLANG_ENGLISH_US: return "en_US";
11654+ case SUBLANG_ENGLISH_UK: return "en_GB";
11655+ case SUBLANG_ENGLISH_AUS: return "en_AU";
11656+ case SUBLANG_ENGLISH_CAN: return "en_CA";
11657+ case SUBLANG_ENGLISH_NZ: return "en_NZ";
11658+ case SUBLANG_ENGLISH_EIRE: return "en_IE";
11659+ case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
11660+ case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
11661+ case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
11662+ case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
11663+ case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
11664+ case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
11665+ case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
11666+ case SUBLANG_ENGLISH_INDONESIA: return "en_ID";
11667+ case SUBLANG_ENGLISH_HONGKONG: return "en_HK";
11668+ case SUBLANG_ENGLISH_INDIA: return "en_IN";
11669+ case SUBLANG_ENGLISH_MALAYSIA: return "en_MY";
11670+ case SUBLANG_ENGLISH_SINGAPORE: return "en_SG";
11671+ }
11672+ return "en";
11673+ case LANG_ESTONIAN: return "et_EE";
11674+ case LANG_FAEROESE: return "fo_FO";
11675+ case LANG_FARSI: return "fa_IR";
11676+ case LANG_FINNISH: return "fi_FI";
11677+ case LANG_FRENCH:
11678+ switch (sub)
11679+ {
11680+ case SUBLANG_FRENCH: return "fr_FR";
11681+ case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
11682+ case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
11683+ case SUBLANG_FRENCH_SWISS: return "fr_CH";
11684+ case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
11685+ case SUBLANG_FRENCH_MONACO: return "fr_MC";
11686+ case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */
11687+ case SUBLANG_FRENCH_REUNION: return "fr_RE";
11688+ case SUBLANG_FRENCH_CONGO: return "fr_CG";
11689+ case SUBLANG_FRENCH_SENEGAL: return "fr_SN";
11690+ case SUBLANG_FRENCH_CAMEROON: return "fr_CM";
11691+ case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI";
11692+ case SUBLANG_FRENCH_MALI: return "fr_ML";
11693+ case SUBLANG_FRENCH_MOROCCO: return "fr_MA";
11694+ case SUBLANG_FRENCH_HAITI: return "fr_HT";
11695+ }
11696+ return "fr";
11697+ case LANG_FRISIAN: return "fy_NL";
11698+ case LANG_FULFULDE:
11699+ /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */
11700+ return "ff_NG";
11701+ case LANG_GAELIC:
11702+ switch (sub)
11703+ {
11704+ case 0x01: /* SCOTTISH */ return "gd_GB";
11705+ case 0x02: /* IRISH */ return "ga_IE";
11706+ }
11707+ return "C";
11708+ case LANG_GALICIAN: return "gl_ES";
11709+ case LANG_GEORGIAN: return "ka_GE";
11710+ case LANG_GERMAN:
11711+ switch (sub)
11712+ {
11713+ case SUBLANG_GERMAN: return "de_DE";
11714+ case SUBLANG_GERMAN_SWISS: return "de_CH";
11715+ case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
11716+ case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
11717+ case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
11718+ }
11719+ return "de";
11720+ case LANG_GREEK: return "el_GR";
11721+ case LANG_GUARANI: return "gn_PY";
11722+ case LANG_GUJARATI: return "gu_IN";
11723+ case LANG_HAUSA: return "ha_NG";
11724+ case LANG_HAWAIIAN:
11725+ /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
11726+ or Hawaii Creole English ("cpe_US", 600000 speakers)? */
11727+ return "cpe_US";
11728+ case LANG_HEBREW: return "he_IL";
11729+ case LANG_HINDI: return "hi_IN";
11730+ case LANG_HUNGARIAN: return "hu_HU";
11731+ case LANG_IBIBIO: return "nic_NG";
11732+ case LANG_ICELANDIC: return "is_IS";
11733+ case LANG_IGBO: return "ig_NG";
11734+ case LANG_INDONESIAN: return "id_ID";
11735+ case LANG_INUKTITUT: return "iu_CA";
11736+ case LANG_ITALIAN:
11737+ switch (sub)
11738+ {
11739+ case SUBLANG_ITALIAN: return "it_IT";
11740+ case SUBLANG_ITALIAN_SWISS: return "it_CH";
11741+ }
11742+ return "it";
11743+ case LANG_JAPANESE: return "ja_JP";
11744+ case LANG_KANNADA: return "kn_IN";
11745+ case LANG_KANURI: return "kr_NG";
11746+ case LANG_KASHMIRI:
11747+ switch (sub)
11748+ {
11749+ case SUBLANG_DEFAULT: return "ks_PK";
11750+ case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
11751+ }
11752+ return "ks";
11753+ case LANG_KAZAK: return "kk_KZ";
11754+ case LANG_KONKANI:
11755+ /* FIXME: Adjust this when such locales appear on Unix. */
11756+ return "kok_IN";
11757+ case LANG_KOREAN: return "ko_KR";
11758+ case LANG_KYRGYZ: return "ky_KG";
11759+ case LANG_LAO: return "lo_LA";
11760+ case LANG_LATIN: return "la_VA";
11761+ case LANG_LATVIAN: return "lv_LV";
11762+ case LANG_LITHUANIAN: return "lt_LT";
11763+ case LANG_MACEDONIAN: return "mk_MK";
11764+ case LANG_MALAY:
11765+ switch (sub)
11766+ {
11767+ case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
11768+ case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
11769+ }
11770+ return "ms";
11771+ case LANG_MALAYALAM: return "ml_IN";
11772+ case LANG_MALTESE: return "mt_MT";
11773+ case LANG_MANIPURI:
11774+ /* FIXME: Adjust this when such locales appear on Unix. */
11775+ return "mni_IN";
11776+ case LANG_MARATHI: return "mr_IN";
11777+ case LANG_MONGOLIAN:
11778+ return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */
11779+ case LANG_NEPALI:
11780+ switch (sub)
11781+ {
11782+ case SUBLANG_DEFAULT: return "ne_NP";
11783+ case SUBLANG_NEPALI_INDIA: return "ne_IN";
11784+ }
11785+ return "ne";
11786+ case LANG_NORWEGIAN:
11787+ switch (sub)
11788+ {
11789+ case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
11790+ case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
11791+ }
11792+ return "no";
11793+ case LANG_ORIYA: return "or_IN";
11794+ case LANG_OROMO: return "om_ET";
11795+ case LANG_PAPIAMENTU: return "pap_AN";
11796+ case LANG_PASHTO:
11797+ return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */
11798+ case LANG_POLISH: return "pl_PL";
11799+ case LANG_PORTUGUESE:
11800+ switch (sub)
11801+ {
11802+ case SUBLANG_PORTUGUESE: return "pt_PT";
11803+ /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
11804+ Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
11805+ case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
11806+ }
11807+ return "pt";
11808+ case LANG_PUNJABI:
11809+ switch (sub)
11810+ {
11811+ case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */
11812+ case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */
11813+ }
11814+ return "pa";
11815+ case LANG_RHAETO_ROMANCE: return "rm_CH";
11816+ case LANG_ROMANIAN:
11817+ switch (sub)
11818+ {
11819+ case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO";
11820+ case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD";
11821+ }
11822+ return "ro";
11823+ case LANG_RUSSIAN:
11824+ return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */
11825+ case LANG_SAAMI: /* actually Northern Sami */ return "se_NO";
11826+ case LANG_SANSKRIT: return "sa_IN";
11827+ case LANG_SINDHI:
11828+ switch (sub)
11829+ {
11830+ case SUBLANG_SINDHI_INDIA: return "sd_IN";
11831+ case SUBLANG_SINDHI_PAKISTAN: return "sd_PK";
11832+ }
11833+ return "sd";
11834+ case LANG_SINHALESE: return "si_LK";
11835+ case LANG_SLOVAK: return "sk_SK";
11836+ case LANG_SLOVENIAN: return "sl_SI";
11837+ case LANG_SOMALI: return "so_SO";
11838+ case LANG_SORBIAN:
11839+ /* FIXME: Adjust this when such locales appear on Unix. */
11840+ return "wen_DE";
11841+ case LANG_SPANISH:
11842+ switch (sub)
11843+ {
11844+ case SUBLANG_SPANISH: return "es_ES";
11845+ case SUBLANG_SPANISH_MEXICAN: return "es_MX";
11846+ case SUBLANG_SPANISH_MODERN:
11847+ return "es_ES@modern"; /* not seen on Unix */
11848+ case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
11849+ case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
11850+ case SUBLANG_SPANISH_PANAMA: return "es_PA";
11851+ case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
11852+ case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
11853+ case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
11854+ case SUBLANG_SPANISH_PERU: return "es_PE";
11855+ case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
11856+ case SUBLANG_SPANISH_ECUADOR: return "es_EC";
11857+ case SUBLANG_SPANISH_CHILE: return "es_CL";
11858+ case SUBLANG_SPANISH_URUGUAY: return "es_UY";
11859+ case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
11860+ case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
11861+ case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
11862+ case SUBLANG_SPANISH_HONDURAS: return "es_HN";
11863+ case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
11864+ case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
11865+ }
11866+ return "es";
11867+ case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */
11868+ case LANG_SWAHILI: return "sw_KE";
11869+ case LANG_SWEDISH:
11870+ switch (sub)
11871+ {
11872+ case SUBLANG_DEFAULT: return "sv_SE";
11873+ case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
11874+ }
11875+ return "sv";
11876+ case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */
11877+ case LANG_TAGALOG: return "tl_PH";
11878+ case LANG_TAJIK: return "tg_TJ";
11879+ case LANG_TAMAZIGHT:
11880+ switch (sub)
11881+ {
11882+ /* FIXME: Adjust this when Tamazight locales appear on Unix. */
11883+ case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic";
11884+ case SUBLANG_TAMAZIGHT_LATIN: return "ber_MA@latin";
11885+ }
11886+ return "ber_MA";
11887+ case LANG_TAMIL:
11888+ return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */
11889+ case LANG_TATAR: return "tt_RU";
11890+ case LANG_TELUGU: return "te_IN";
11891+ case LANG_THAI: return "th_TH";
11892+ case LANG_TIBETAN: return "bo_CN";
11893+ case LANG_TIGRINYA:
11894+ switch (sub)
11895+ {
11896+ case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET";
11897+ case SUBLANG_TIGRINYA_ERITREA: return "ti_ER";
11898+ }
11899+ return "ti";
11900+ case LANG_TSONGA: return "ts_ZA";
11901+ case LANG_TSWANA: return "tn_BW";
11902+ case LANG_TURKISH: return "tr_TR";
11903+ case LANG_TURKMEN: return "tk_TM";
11904+ case LANG_UKRAINIAN: return "uk_UA";
11905+ case LANG_URDU:
11906+ switch (sub)
11907+ {
11908+ case SUBLANG_URDU_PAKISTAN: return "ur_PK";
11909+ case SUBLANG_URDU_INDIA: return "ur_IN";
11910+ }
11911+ return "ur";
11912+ case LANG_UZBEK:
11913+ switch (sub)
11914+ {
11915+ case SUBLANG_UZBEK_LATIN: return "uz_UZ";
11916+ case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
11917+ }
11918+ return "uz";
11919+ case LANG_VENDA: return "ve_ZA";
11920+ case LANG_VIETNAMESE: return "vi_VN";
11921+ case LANG_WELSH: return "cy_GB";
11922+ case LANG_XHOSA: return "xh_ZA";
11923+ case LANG_YI: return "sit_CN";
11924+ case LANG_YIDDISH: return "yi_IL";
11925+ case LANG_YORUBA: return "yo_NG";
11926+ case LANG_ZULU: return "zu_ZA";
11927+ default: return "C";
11928+ }
11929+
11930+#endif
11931+}
11932--- lrzsz-0.12.20.safe/intl/log.c 1969-12-31 19:00:00.000000000 -0500
11933+++ lrzsz-0.12.20/intl/log.c 2004-09-12 14:40:34.515723768 -0400
11934@@ -0,0 +1,98 @@
11935+/* Log file output.
11936+ Copyright (C) 2003 Free Software Foundation, Inc.
11937+
11938+ This program is free software; you can redistribute it and/or modify it
11939+ under the terms of the GNU Library General Public License as published
11940+ by the Free Software Foundation; either version 2, or (at your option)
11941+ any later version.
11942+
11943+ This program is distributed in the hope that it will be useful,
11944+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11945+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11946+ Library General Public License for more details.
11947+
11948+ You should have received a copy of the GNU Library General Public
11949+ License along with this program; if not, write to the Free Software
11950+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
11951+ USA. */
11952+
11953+/* Written by Bruno Haible <bruno@clisp.org>. */
11954+
11955+#ifdef HAVE_CONFIG_H
11956+# include <config.h>
11957+#endif
11958+
11959+#include <stdio.h>
11960+#include <stdlib.h>
11961+#include <string.h>
11962+
11963+/* Print an ASCII string with quotes and escape sequences where needed. */
11964+static void
11965+print_escaped (FILE *stream, const char *str)
11966+{
11967+ putc ('"', stream);
11968+ for (; *str != '\0'; str++)
11969+ if (*str == '\n')
11970+ {
11971+ fputs ("\\n\"", stream);
11972+ if (str[1] == '\0')
11973+ return;
11974+ fputs ("\n\"", stream);
11975+ }
11976+ else
11977+ {
11978+ if (*str == '"' || *str == '\\')
11979+ putc ('\\', stream);
11980+ putc (*str, stream);
11981+ }
11982+ putc ('"', stream);
11983+}
11984+
11985+/* Add to the log file an entry denoting a failed translation. */
11986+void
11987+_nl_log_untranslated (const char *logfilename, const char *domainname,
11988+ const char *msgid1, const char *msgid2, int plural)
11989+{
11990+ static char *last_logfilename = NULL;
11991+ static FILE *last_logfile = NULL;
11992+ FILE *logfile;
11993+
11994+ /* Can we reuse the last opened logfile? */
11995+ if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
11996+ {
11997+ /* Close the last used logfile. */
11998+ if (last_logfilename != NULL)
11999+ {
12000+ if (last_logfile != NULL)
12001+ {
12002+ fclose (last_logfile);
12003+ last_logfile = NULL;
12004+ }
12005+ free (last_logfilename);
12006+ last_logfilename = NULL;
12007+ }
12008+ /* Open the logfile. */
12009+ last_logfilename = (char *) malloc (strlen (logfilename) + 1);
12010+ if (last_logfilename == NULL)
12011+ return;
12012+ strcpy (last_logfilename, logfilename);
12013+ last_logfile = fopen (logfilename, "a");
12014+ if (last_logfile == NULL)
12015+ return;
12016+ }
12017+ logfile = last_logfile;
12018+
12019+ fprintf (logfile, "domain ");
12020+ print_escaped (logfile, domainname);
12021+ fprintf (logfile, "\nmsgid ");
12022+ print_escaped (logfile, msgid1);
12023+ if (plural)
12024+ {
12025+ fprintf (logfile, "\nmsgid_plural ");
12026+ print_escaped (logfile, msgid2);
12027+ fprintf (logfile, "\nmsgstr[0] \"\"\n");
12028+ }
12029+ else
12030+ fprintf (logfile, "\nmsgstr \"\"\n");
12031+ putc ('\n', logfile);
12032+}
12033--- lrzsz-0.12.20.safe/intl/Makefile.in 1998-04-26 09:22:35.000000000 -0400
12034+++ lrzsz-0.12.20/intl/Makefile.in 2004-09-12 14:40:34.521722856 -0400
12035@@ -1,19 +1,20 @@
12036-# Makefile for directory with message catalog handling in GNU NLS Utilities.
12037-# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
12038+# Makefile for directory with message catalog handling library of GNU gettext
12039+# Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
12040 #
12041-# This program is free software; you can redistribute it and/or modify
12042-# it under the terms of the GNU General Public License as published by
12043-# the Free Software Foundation; either version 2, or (at your option)
12044+# This program is free software; you can redistribute it and/or modify it
12045+# under the terms of the GNU Library General Public License as published
12046+# by the Free Software Foundation; either version 2, or (at your option)
12047 # any later version.
12048 #
12049 # This program is distributed in the hope that it will be useful,
12050 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12051-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12052-# GNU General Public License for more details.
12053+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12054+# Library General Public License for more details.
12055 #
12056-# You should have received a copy of the GNU General Public License
12057-# along with this program; if not, write to the Free Software
12058-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12059+# You should have received a copy of the GNU Library General Public
12060+# License along with this program; if not, write to the Free Software
12061+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12062+# USA.
12063
12064 PACKAGE = @PACKAGE@
12065 VERSION = @VERSION@
12066@@ -23,118 +24,341 @@
12067 srcdir = @srcdir@
12068 top_srcdir = @top_srcdir@
12069 top_builddir = ..
12070-VPATH = @srcdir@
12071+#VPATH = $(srcdir)
12072
12073 prefix = @prefix@
12074 exec_prefix = @exec_prefix@
12075 transform = @program_transform_name@
12076-libdir = $(exec_prefix)/lib
12077-includedir = $(prefix)/include
12078-datadir = $(prefix)/@DATADIRNAME@
12079+libdir = @libdir@
12080+includedir = @includedir@
12081+datadir = @datadir@
12082 localedir = $(datadir)/locale
12083-gnulocaledir = $(prefix)/share/locale
12084-gettextsrcdir = @datadir@/gettext/intl
12085-aliaspath = $(localedir):.
12086+gettextsrcdir = $(datadir)/gettext/intl
12087+aliaspath = $(localedir)
12088 subdir = intl
12089
12090 INSTALL = @INSTALL@
12091 INSTALL_DATA = @INSTALL_DATA@
12092 MKINSTALLDIRS = @MKINSTALLDIRS@
12093+mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
12094
12095-l = @l@
12096+l = @INTL_LIBTOOL_SUFFIX_PREFIX@
12097
12098 AR = ar
12099 CC = @CC@
12100 LIBTOOL = @LIBTOOL@
12101 RANLIB = @RANLIB@
12102+YACC = @INTLBISON@ -y -d
12103+YFLAGS = --name-prefix=__gettext
12104
12105-DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
12106--DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
12107+DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
12108+-DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \
12109+-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
12110+-Dset_relocation_prefix=libintl_set_relocation_prefix \
12111+-Drelocate=libintl_relocate \
12112+-DDEPENDS_ON_LIBICONV=1 @DEFS@
12113 CPPFLAGS = @CPPFLAGS@
12114 CFLAGS = @CFLAGS@
12115 LDFLAGS = @LDFLAGS@
12116+LIBS = @LIBS@
12117
12118 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
12119
12120-HEADERS = $(COMHDRS) libgettext.h loadinfo.h
12121-COMHDRS = gettext.h gettextP.h hash-string.h
12122-SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
12123-COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
12124-finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
12125-explodename.c
12126-OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
12127-finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
12128-explodename.$lo
12129-CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
12130-GETTOBJS = intl-compat.$lo
12131-DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
12132-xopen-msg.sed $(HEADERS) $(SOURCES)
12133+HEADERS = \
12134+ gmo.h \
12135+ gettextP.h \
12136+ hash-string.h \
12137+ loadinfo.h \
12138+ plural-exp.h \
12139+ eval-plural.h \
12140+ localcharset.h \
12141+ relocatable.h \
12142+ xsize.h \
12143+ printf-args.h printf-args.c \
12144+ printf-parse.h wprintf-parse.h printf-parse.c \
12145+ vasnprintf.h vasnwprintf.h vasnprintf.c \
12146+ os2compat.h \
12147+ libgnuintl.h.in
12148+SOURCES = \
12149+ bindtextdom.c \
12150+ dcgettext.c \
12151+ dgettext.c \
12152+ gettext.c \
12153+ finddomain.c \
12154+ loadmsgcat.c \
12155+ localealias.c \
12156+ textdomain.c \
12157+ l10nflist.c \
12158+ explodename.c \
12159+ dcigettext.c \
12160+ dcngettext.c \
12161+ dngettext.c \
12162+ ngettext.c \
12163+ plural.y \
12164+ plural-exp.c \
12165+ localcharset.c \
12166+ relocatable.c \
12167+ localename.c \
12168+ log.c \
12169+ printf.c \
12170+ osdep.c \
12171+ os2compat.c \
12172+ intl-compat.c
12173+OBJECTS = \
12174+ bindtextdom.$lo \
12175+ dcgettext.$lo \
12176+ dgettext.$lo \
12177+ gettext.$lo \
12178+ finddomain.$lo \
12179+ loadmsgcat.$lo \
12180+ localealias.$lo \
12181+ textdomain.$lo \
12182+ l10nflist.$lo \
12183+ explodename.$lo \
12184+ dcigettext.$lo \
12185+ dcngettext.$lo \
12186+ dngettext.$lo \
12187+ ngettext.$lo \
12188+ plural.$lo \
12189+ plural-exp.$lo \
12190+ localcharset.$lo \
12191+ relocatable.$lo \
12192+ localename.$lo \
12193+ log.$lo \
12194+ printf.$lo \
12195+ osdep.$lo \
12196+ intl-compat.$lo
12197+DISTFILES.common = Makefile.in \
12198+config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
12199+DISTFILES.generated = plural.c
12200 DISTFILES.normal = VERSION
12201-DISTFILES.gettext = libintl.glibc intlh.inst.in
12202+DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
12203+libgnuintl.h_vms Makefile.vms \
12204+libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc
12205+DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
12206+COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h
12207+
12208+all: all-@USE_INCLUDED_LIBINTL@
12209+all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
12210+all-no: all-no-@BUILD_INCLUDED_LIBINTL@
12211+all-no-yes: libgnuintl.$la
12212+all-no-no:
12213+
12214+libintl.a libgnuintl.a: $(OBJECTS)
12215+ rm -f $@
12216+ $(AR) cru $@ $(OBJECTS)
12217+ $(RANLIB) $@
12218+
12219+libintl.la libgnuintl.la: $(OBJECTS)
12220+ $(LIBTOOL) --mode=link \
12221+ $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
12222+ $(OBJECTS) @LTLIBICONV@ $(LIBS) -lc \
12223+ -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
12224+ -rpath $(libdir) \
12225+ -no-undefined
12226+
12227+# Libtool's library version information for libintl.
12228+# Before making a gettext release, the gettext maintainer must change this
12229+# according to the libtool documentation, section "Library interface versions".
12230+# Maintainers of other packages that include the intl directory must *not*
12231+# change these values.
12232+LTV_CURRENT=7
12233+LTV_REVISION=0
12234+LTV_AGE=4
12235
12236 .SUFFIXES:
12237-.SUFFIXES: .c .o .lo
12238+.SUFFIXES: .c .y .o .lo .sin .sed
12239+
12240 .c.o:
12241 $(COMPILE) $<
12242-.c.lo:
12243- $(LIBTOOL) --mode=compile $(COMPILE) $<
12244
12245-INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
12246+.y.c:
12247+ $(YACC) $(YFLAGS) --output $@ $<
12248+ rm -f $*.h
12249
12250-all: all-@USE_INCLUDED_LIBINTL@
12251+bindtextdom.lo: $(srcdir)/bindtextdom.c
12252+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
12253+dcgettext.lo: $(srcdir)/dcgettext.c
12254+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcgettext.c
12255+dgettext.lo: $(srcdir)/dgettext.c
12256+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dgettext.c
12257+gettext.lo: $(srcdir)/gettext.c
12258+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
12259+finddomain.lo: $(srcdir)/finddomain.c
12260+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
12261+loadmsgcat.lo: $(srcdir)/loadmsgcat.c
12262+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
12263+localealias.lo: $(srcdir)/localealias.c
12264+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localealias.c
12265+textdomain.lo: $(srcdir)/textdomain.c
12266+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/textdomain.c
12267+l10nflist.lo: $(srcdir)/l10nflist.c
12268+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/l10nflist.c
12269+explodename.lo: $(srcdir)/explodename.c
12270+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/explodename.c
12271+dcigettext.lo: $(srcdir)/dcigettext.c
12272+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcigettext.c
12273+dcngettext.lo: $(srcdir)/dcngettext.c
12274+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcngettext.c
12275+dngettext.lo: $(srcdir)/dngettext.c
12276+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dngettext.c
12277+ngettext.lo: $(srcdir)/ngettext.c
12278+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/ngettext.c
12279+plural.lo: $(srcdir)/plural.c
12280+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural.c
12281+plural-exp.lo: $(srcdir)/plural-exp.c
12282+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
12283+localcharset.lo: $(srcdir)/localcharset.c
12284+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
12285+relocatable.lo: $(srcdir)/relocatable.c
12286+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
12287+localename.lo: $(srcdir)/localename.c
12288+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c
12289+log.lo: $(srcdir)/log.c
12290+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c
12291+printf.lo: $(srcdir)/printf.c
12292+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c
12293+osdep.lo: $(srcdir)/osdep.c
12294+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c
12295+intl-compat.lo: $(srcdir)/intl-compat.c
12296+ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/intl-compat.c
12297
12298-all-yes: libintl.$la intlh.inst
12299-all-no:
12300+ref-add.sed: $(srcdir)/ref-add.sin
12301+ sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed
12302+ mv t-ref-add.sed ref-add.sed
12303+ref-del.sed: $(srcdir)/ref-del.sin
12304+ sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed
12305+ mv t-ref-del.sed ref-del.sed
12306
12307-libintl.a: $(OBJECTS)
12308- rm -f $@
12309- $(AR) cru $@ $(OBJECTS)
12310- $(RANLIB) $@
12311+INCLUDES = -I. -I$(srcdir) -I..
12312
12313-libintl.la: $(OBJECTS)
12314- $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
12315- -version-info 1:0 -rpath $(libdir)
12316+libgnuintl.h: $(srcdir)/libgnuintl.h.in
12317+ sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
12318+ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
12319+ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
12320+ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
12321+ < $(srcdir)/libgnuintl.h.in > libgnuintl.h
12322
12323-../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
12324- cd ../po && $(MAKE) cat-id-tbl.$lo
12325+libintl.h: libgnuintl.h
12326+ cp libgnuintl.h libintl.h
12327
12328-check: all
12329+charset.alias: $(srcdir)/config.charset
12330+ $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
12331+ mv t-$@ $@
12332
12333-# This installation goal is only used in GNU gettext. Packages which
12334-# only use the library should use install instead.
12335+check: all
12336
12337 # We must not install the libintl.h/libintl.a files if we are on a
12338-# system which has the gettext() function in its C library or in a
12339-# separate library or use the catgets interface. A special case is
12340-# where configure found a previously installed GNU gettext library.
12341+# system which has the GNU gettext() function in its C library or in a
12342+# separate library.
12343 # If you want to use the one which comes with this version of the
12344 # package, you have to use `configure --with-included-gettext'.
12345 install: install-exec install-data
12346 install-exec: all
12347- if test "$(PACKAGE)" = "gettext" \
12348- && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
12349- if test -r $(MKINSTALLDIRS); then \
12350- $(MKINSTALLDIRS) $(libdir) $(includedir); \
12351- else \
12352- $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
12353+ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
12354+ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
12355+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
12356+ $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
12357+ $(LIBTOOL) --mode=install \
12358+ $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
12359+ if test "@RELOCATABLE@" = yes; then \
12360+ dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \
12361+ if test -n "$$dependencies"; then \
12362+ rm -f $(DESTDIR)$(libdir)/libintl.la; \
12363+ fi; \
12364 fi; \
12365- $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
12366- $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
12367 else \
12368 : ; \
12369 fi
12370-install-data: all
12371- if test "$(PACKAGE)" = "gettext"; then \
12372- if test -r $(MKINSTALLDIRS); then \
12373- $(MKINSTALLDIRS) $(gettextsrcdir); \
12374+ if test "$(PACKAGE)" = "gettext-tools" \
12375+ && test '@USE_INCLUDED_LIBINTL@' = no; then \
12376+ $(mkinstalldirs) $(DESTDIR)$(libdir); \
12377+ $(LIBTOOL) --mode=install \
12378+ $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
12379+ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
12380+ $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \
12381+ $(LIBTOOL) --mode=uninstall \
12382+ rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \
12383+ else \
12384+ : ; \
12385+ fi
12386+ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
12387+ test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
12388+ temp=$(DESTDIR)$(libdir)/t-charset.alias; \
12389+ dest=$(DESTDIR)$(libdir)/charset.alias; \
12390+ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
12391+ orig=$(DESTDIR)$(libdir)/charset.alias; \
12392+ sed -f ref-add.sed $$orig > $$temp; \
12393+ $(INSTALL_DATA) $$temp $$dest; \
12394+ rm -f $$temp; \
12395 else \
12396- $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
12397+ if test @GLIBC21@ = no; then \
12398+ orig=charset.alias; \
12399+ sed -f ref-add.sed $$orig > $$temp; \
12400+ $(INSTALL_DATA) $$temp $$dest; \
12401+ rm -f $$temp; \
12402+ fi; \
12403 fi; \
12404- $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
12405- dists="$(DISTFILES.common)"; \
12406+ $(mkinstalldirs) $(DESTDIR)$(localedir); \
12407+ test -f $(DESTDIR)$(localedir)/locale.alias \
12408+ && orig=$(DESTDIR)$(localedir)/locale.alias \
12409+ || orig=$(srcdir)/locale.alias; \
12410+ temp=$(DESTDIR)$(localedir)/t-locale.alias; \
12411+ dest=$(DESTDIR)$(localedir)/locale.alias; \
12412+ sed -f ref-add.sed $$orig > $$temp; \
12413+ $(INSTALL_DATA) $$temp $$dest; \
12414+ rm -f $$temp; \
12415+ else \
12416+ : ; \
12417+ fi
12418+install-data: all
12419+ if test "$(PACKAGE)" = "gettext-tools"; then \
12420+ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
12421+ $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
12422+ $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
12423+ dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
12424 for file in $$dists; do \
12425- $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
12426+ $(INSTALL_DATA) $(srcdir)/$$file \
12427+ $(DESTDIR)$(gettextsrcdir)/$$file; \
12428 done; \
12429+ chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
12430+ dists="$(DISTFILES.generated)"; \
12431+ for file in $$dists; do \
12432+ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
12433+ $(INSTALL_DATA) $$dir/$$file \
12434+ $(DESTDIR)$(gettextsrcdir)/$$file; \
12435+ done; \
12436+ dists="$(DISTFILES.obsolete)"; \
12437+ for file in $$dists; do \
12438+ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
12439+ done; \
12440+ else \
12441+ : ; \
12442+ fi
12443+
12444+install-strip: install
12445+
12446+installdirs:
12447+ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
12448+ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
12449+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
12450+ else \
12451+ : ; \
12452+ fi
12453+ if test "$(PACKAGE)" = "gettext-tools" \
12454+ && test '@USE_INCLUDED_LIBINTL@' = no; then \
12455+ $(mkinstalldirs) $(DESTDIR)$(libdir); \
12456+ else \
12457+ : ; \
12458+ fi
12459+ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
12460+ test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
12461+ $(mkinstalldirs) $(DESTDIR)$(localedir); \
12462+ else \
12463+ : ; \
12464+ fi
12465+ if test "$(PACKAGE)" = "gettext-tools"; then \
12466+ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
12467 else \
12468 : ; \
12469 fi
12470@@ -143,22 +367,76 @@
12471 installcheck:
12472
12473 uninstall:
12474- dists="$(DISTFILES.common)"; \
12475- for file in $$dists; do \
12476- rm -f $(gettextsrcdir)/$$file; \
12477- done
12478+ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
12479+ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
12480+ rm -f $(DESTDIR)$(includedir)/libintl.h; \
12481+ $(LIBTOOL) --mode=uninstall \
12482+ rm -f $(DESTDIR)$(libdir)/libintl.$la; \
12483+ else \
12484+ : ; \
12485+ fi
12486+ if test "$(PACKAGE)" = "gettext-tools" \
12487+ && test '@USE_INCLUDED_LIBINTL@' = no; then \
12488+ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
12489+ else \
12490+ : ; \
12491+ fi
12492+ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
12493+ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
12494+ temp=$(DESTDIR)$(libdir)/t-charset.alias; \
12495+ dest=$(DESTDIR)$(libdir)/charset.alias; \
12496+ sed -f ref-del.sed $$dest > $$temp; \
12497+ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
12498+ rm -f $$dest; \
12499+ else \
12500+ $(INSTALL_DATA) $$temp $$dest; \
12501+ fi; \
12502+ rm -f $$temp; \
12503+ fi; \
12504+ if test -f $(DESTDIR)$(localedir)/locale.alias; then \
12505+ temp=$(DESTDIR)$(localedir)/t-locale.alias; \
12506+ dest=$(DESTDIR)$(localedir)/locale.alias; \
12507+ sed -f ref-del.sed $$dest > $$temp; \
12508+ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
12509+ rm -f $$dest; \
12510+ else \
12511+ $(INSTALL_DATA) $$temp $$dest; \
12512+ fi; \
12513+ rm -f $$temp; \
12514+ fi; \
12515+ else \
12516+ : ; \
12517+ fi
12518+ if test "$(PACKAGE)" = "gettext-tools"; then \
12519+ for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
12520+ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
12521+ done; \
12522+ else \
12523+ : ; \
12524+ fi
12525
12526-info dvi:
12527+info dvi ps pdf html:
12528
12529-$(OBJECTS): ../config.h libgettext.h
12530-bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
12531-dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
12532+$(OBJECTS): ../config.h libgnuintl.h
12533+bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
12534+dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
12535+explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
12536+dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
12537+dcigettext.$lo: $(srcdir)/eval-plural.h
12538+localcharset.$lo: $(srcdir)/localcharset.h
12539+localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
12540+printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
12541
12542 tags: TAGS
12543
12544 TAGS: $(HEADERS) $(SOURCES)
12545 here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
12546
12547+ctags: CTAGS
12548+
12549+CTAGS: $(HEADERS) $(SOURCES)
12550+ here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
12551+
12552 id: ID
12553
12554 ID: $(HEADERS) $(SOURCES)
12555@@ -166,12 +444,19 @@
12556
12557
12558 mostlyclean:
12559- rm -f *.a *.o *.lo core core.*
12560+ rm -f *.a *.la *.o *.obj *.lo core core.*
12561+ rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
12562+ rm -f -r .libs _libs
12563
12564 clean: mostlyclean
12565
12566 distclean: clean
12567- rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h
12568+ rm -f Makefile ID TAGS
12569+ if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \
12570+ rm -f ChangeLog.inst $(DISTFILES.normal); \
12571+ else \
12572+ : ; \
12573+ fi
12574
12575 maintainer-clean: distclean
12576 @echo "This command is intended for maintainers to use;"
12577@@ -181,33 +466,27 @@
12578 # GNU gettext needs not contain the file `VERSION' but contains some
12579 # other files which should not be distributed in other packages.
12580 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
12581-dist distdir: Makefile $(DISTFILES)
12582- if test "$(PACKAGE)" = gettext; then \
12583- additional="$(DISTFILES.gettext)"; \
12584+dist distdir: Makefile
12585+ if test "$(PACKAGE)" = "gettext-tools"; then \
12586+ : ; \
12587 else \
12588- additional="$(DISTFILES.normal)"; \
12589- fi; \
12590- for file in $(DISTFILES.common) $$additional; do \
12591- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
12592- || cp -p $(srcdir)/$$file $(distdir); \
12593- done
12594-
12595-dist-libc:
12596- tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
12597-
12598-Makefile: Makefile.in ../config.status
12599- cd .. \
12600- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
12601+ if test "$(PACKAGE)" = "gettext-runtime"; then \
12602+ additional="$(DISTFILES.gettext)"; \
12603+ else \
12604+ additional="$(DISTFILES.normal)"; \
12605+ fi; \
12606+ $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
12607+ for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
12608+ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
12609+ cp -p $$dir/$$file $(distdir); \
12610+ done; \
12611+ fi
12612
12613-# The dependency for intlh.inst is different in gettext and all other
12614-# packages. Because we cannot you GNU make features we have to solve
12615-# the problem while rewriting Makefile.in.
12616-@GT_YES@intlh.inst: intlh.inst.in ../config.status
12617-@GT_YES@ cd .. \
12618-@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
12619-@GT_YES@ $(SHELL) ./config.status
12620-@GT_NO@.PHONY: intlh.inst
12621-@GT_NO@intlh.inst:
12622+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
12623+ cd $(top_builddir) && $(SHELL) ./config.status
12624+# This would be more efficient, but doesn't work any more with autoconf-2.57,
12625+# when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
12626+# cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
12627
12628 # Tell versions [3.59,3.63) of GNU make not to export all variables.
12629 # Otherwise a system limit (for SysV at least) may be exceeded.
12630--- lrzsz-0.12.20.safe/intl/ngettext.c 1969-12-31 19:00:00.000000000 -0500
12631+++ lrzsz-0.12.20/intl/ngettext.c 2004-09-12 14:40:34.533721032 -0400
12632@@ -0,0 +1,65 @@
12633+/* Implementation of ngettext(3) function.
12634+ Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
12635+
12636+ This program is free software; you can redistribute it and/or modify it
12637+ under the terms of the GNU Library General Public License as published
12638+ by the Free Software Foundation; either version 2, or (at your option)
12639+ any later version.
12640+
12641+ This program is distributed in the hope that it will be useful,
12642+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12643+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12644+ Library General Public License for more details.
12645+
12646+ You should have received a copy of the GNU Library General Public
12647+ License along with this program; if not, write to the Free Software
12648+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12649+ USA. */
12650+
12651+#ifdef HAVE_CONFIG_H
12652+# include <config.h>
12653+#endif
12654+
12655+#ifdef _LIBC
12656+# define __need_NULL
12657+# include <stddef.h>
12658+#else
12659+# include <stdlib.h> /* Just for NULL. */
12660+#endif
12661+
12662+#include "gettextP.h"
12663+#ifdef _LIBC
12664+# include <libintl.h>
12665+#else
12666+# include "libgnuintl.h"
12667+#endif
12668+
12669+#include <locale.h>
12670+
12671+/* @@ end of prolog @@ */
12672+
12673+/* Names for the libintl functions are a problem. They must not clash
12674+ with existing names and they should follow ANSI C. But this source
12675+ code is also used in GNU C Library where the names have a __
12676+ prefix. So we have to make a difference here. */
12677+#ifdef _LIBC
12678+# define NGETTEXT __ngettext
12679+# define DCNGETTEXT __dcngettext
12680+#else
12681+# define NGETTEXT libintl_ngettext
12682+# define DCNGETTEXT libintl_dcngettext
12683+#endif
12684+
12685+/* Look up MSGID in the current default message catalog for the current
12686+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
12687+ text). */
12688+char *
12689+NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n)
12690+{
12691+ return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
12692+}
12693+
12694+#ifdef _LIBC
12695+/* Alias for function name in GNU C Library. */
12696+weak_alias (__ngettext, ngettext);
12697+#endif
12698--- lrzsz-0.12.20.safe/intl/os2compat.c 1969-12-31 19:00:00.000000000 -0500
12699+++ lrzsz-0.12.20/intl/os2compat.c 2004-09-12 14:40:34.539720120 -0400
12700@@ -0,0 +1,98 @@
12701+/* OS/2 compatibility functions.
12702+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
12703+
12704+ This program is free software; you can redistribute it and/or modify it
12705+ under the terms of the GNU Library General Public License as published
12706+ by the Free Software Foundation; either version 2, or (at your option)
12707+ any later version.
12708+
12709+ This program is distributed in the hope that it will be useful,
12710+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12711+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12712+ Library General Public License for more details.
12713+
12714+ You should have received a copy of the GNU Library General Public
12715+ License along with this program; if not, write to the Free Software
12716+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12717+ USA. */
12718+
12719+#define OS2_AWARE
12720+#ifdef HAVE_CONFIG_H
12721+#include <config.h>
12722+#endif
12723+
12724+#include <stdlib.h>
12725+#include <string.h>
12726+#include <sys/param.h>
12727+
12728+/* A version of getenv() that works from DLLs */
12729+extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
12730+
12731+char *
12732+_nl_getenv (const char *name)
12733+{
12734+ unsigned char *value;
12735+ if (DosScanEnv (name, &value))
12736+ return NULL;
12737+ else
12738+ return value;
12739+}
12740+
12741+/* A fixed size buffer. */
12742+char libintl_nl_default_dirname[MAXPATHLEN+1];
12743+
12744+char *_nlos2_libdir = NULL;
12745+char *_nlos2_localealiaspath = NULL;
12746+char *_nlos2_localedir = NULL;
12747+
12748+static __attribute__((constructor)) void
12749+nlos2_initialize ()
12750+{
12751+ char *root = getenv ("UNIXROOT");
12752+ char *gnulocaledir = getenv ("GNULOCALEDIR");
12753+
12754+ _nlos2_libdir = gnulocaledir;
12755+ if (!_nlos2_libdir)
12756+ {
12757+ if (root)
12758+ {
12759+ size_t sl = strlen (root);
12760+ _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
12761+ memcpy (_nlos2_libdir, root, sl);
12762+ memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
12763+ }
12764+ else
12765+ _nlos2_libdir = LIBDIR;
12766+ }
12767+
12768+ _nlos2_localealiaspath = gnulocaledir;
12769+ if (!_nlos2_localealiaspath)
12770+ {
12771+ if (root)
12772+ {
12773+ size_t sl = strlen (root);
12774+ _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
12775+ memcpy (_nlos2_localealiaspath, root, sl);
12776+ memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
12777+ }
12778+ else
12779+ _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
12780+ }
12781+
12782+ _nlos2_localedir = gnulocaledir;
12783+ if (!_nlos2_localedir)
12784+ {
12785+ if (root)
12786+ {
12787+ size_t sl = strlen (root);
12788+ _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
12789+ memcpy (_nlos2_localedir, root, sl);
12790+ memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
12791+ }
12792+ else
12793+ _nlos2_localedir = LOCALEDIR;
12794+ }
12795+
12796+ if (strlen (_nlos2_localedir) <= MAXPATHLEN)
12797+ strcpy (libintl_nl_default_dirname, _nlos2_localedir);
12798+}
12799--- lrzsz-0.12.20.safe/intl/os2compat.h 1969-12-31 19:00:00.000000000 -0500
12800+++ lrzsz-0.12.20/intl/os2compat.h 2004-09-12 14:40:34.544719360 -0400
12801@@ -0,0 +1,46 @@
12802+/* OS/2 compatibility defines.
12803+ This file is intended to be included from config.h
12804+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
12805+
12806+ This program is free software; you can redistribute it and/or modify it
12807+ under the terms of the GNU Library General Public License as published
12808+ by the Free Software Foundation; either version 2, or (at your option)
12809+ any later version.
12810+
12811+ This program is distributed in the hope that it will be useful,
12812+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12813+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12814+ Library General Public License for more details.
12815+
12816+ You should have received a copy of the GNU Library General Public
12817+ License along with this program; if not, write to the Free Software
12818+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12819+ USA. */
12820+
12821+/* When included from os2compat.h we need all the original definitions */
12822+#ifndef OS2_AWARE
12823+
12824+#undef LIBDIR
12825+#define LIBDIR _nlos2_libdir
12826+extern char *_nlos2_libdir;
12827+
12828+#undef LOCALEDIR
12829+#define LOCALEDIR _nlos2_localedir
12830+extern char *_nlos2_localedir;
12831+
12832+#undef LOCALE_ALIAS_PATH
12833+#define LOCALE_ALIAS_PATH _nlos2_localealiaspath
12834+extern char *_nlos2_localealiaspath;
12835+
12836+#endif
12837+
12838+#undef HAVE_STRCASECMP
12839+#define HAVE_STRCASECMP 1
12840+#define strcasecmp stricmp
12841+#define strncasecmp strnicmp
12842+
12843+/* We have our own getenv() which works even if library is compiled as DLL */
12844+#define getenv _nl_getenv
12845+
12846+/* Older versions of gettext used -1 as the value of LC_MESSAGES */
12847+#define LC_MESSAGES_COMPAT (-1)
12848--- lrzsz-0.12.20.safe/intl/osdep.c 1969-12-31 19:00:00.000000000 -0500
12849+++ lrzsz-0.12.20/intl/osdep.c 2004-09-12 14:40:34.550718448 -0400
12850@@ -0,0 +1,24 @@
12851+/* OS dependent parts of libintl.
12852+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
12853+
12854+ This program is free software; you can redistribute it and/or modify it
12855+ under the terms of the GNU Library General Public License as published
12856+ by the Free Software Foundation; either version 2, or (at your option)
12857+ any later version.
12858+
12859+ This program is distributed in the hope that it will be useful,
12860+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12861+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12862+ Library General Public License for more details.
12863+
12864+ You should have received a copy of the GNU Library General Public
12865+ License along with this program; if not, write to the Free Software
12866+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12867+ USA. */
12868+
12869+#if defined __EMX__
12870+# include "os2compat.c"
12871+#else
12872+/* Avoid AIX compiler warning. */
12873+typedef int dummy;
12874+#endif
12875--- lrzsz-0.12.20.safe/intl/plural.c 1969-12-31 19:00:00.000000000 -0500
12876+++ lrzsz-0.12.20/intl/plural.c 2004-09-12 14:40:36.571411256 -0400
12877@@ -0,0 +1,1490 @@
12878+/* A Bison parser, made from plural.y
12879+ by GNU bison 1.35. */
12880+
12881+#define YYBISON 1 /* Identify Bison output. */
12882+
12883+#define yyparse __gettextparse
12884+#define yylex __gettextlex
12885+#define yyerror __gettexterror
12886+#define yylval __gettextlval
12887+#define yychar __gettextchar
12888+#define yydebug __gettextdebug
12889+#define yynerrs __gettextnerrs
12890+# define EQUOP2 257
12891+# define CMPOP2 258
12892+# define ADDOP2 259
12893+# define MULOP2 260
12894+# define NUMBER 261
12895+
12896+#line 1 "plural.y"
12897+
12898+/* Expression parsing for plural form selection.
12899+ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
12900+ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
12901+
12902+ This program is free software; you can redistribute it and/or modify it
12903+ under the terms of the GNU Library General Public License as published
12904+ by the Free Software Foundation; either version 2, or (at your option)
12905+ any later version.
12906+
12907+ This program is distributed in the hope that it will be useful,
12908+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12909+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12910+ Library General Public License for more details.
12911+
12912+ You should have received a copy of the GNU Library General Public
12913+ License along with this program; if not, write to the Free Software
12914+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
12915+ USA. */
12916+
12917+/* The bison generated parser uses alloca. AIX 3 forces us to put this
12918+ declaration at the beginning of the file. The declaration in bison's
12919+ skeleton file comes too late. This must come before <config.h>
12920+ because <config.h> may include arbitrary system headers. */
12921+#if defined _AIX && !defined __GNUC__
12922+ #pragma alloca
12923+#endif
12924+
12925+#ifdef HAVE_CONFIG_H
12926+# include <config.h>
12927+#endif
12928+
12929+#include <stddef.h>
12930+#include <stdlib.h>
12931+#include "plural-exp.h"
12932+
12933+/* The main function generated by the parser is called __gettextparse,
12934+ but we want it to be called PLURAL_PARSE. */
12935+#ifndef _LIBC
12936+# define __gettextparse PLURAL_PARSE
12937+#endif
12938+
12939+#define YYLEX_PARAM &((struct parse_args *) arg)->cp
12940+#define YYPARSE_PARAM arg
12941+
12942+#line 49 "plural.y"
12943+#ifndef YYSTYPE
12944+typedef union {
12945+ unsigned long int num;
12946+ enum operator op;
12947+ struct expression *exp;
12948+} yystype;
12949+# define YYSTYPE yystype
12950+# define YYSTYPE_IS_TRIVIAL 1
12951+#endif
12952+#line 55 "plural.y"
12953+
12954+/* Prototypes for local functions. */
12955+static int yylex (YYSTYPE *lval, const char **pexp);
12956+static void yyerror (const char *str);
12957+
12958+/* Allocation of expressions. */
12959+
12960+static struct expression *
12961+new_exp (int nargs, enum operator op, struct expression * const *args)
12962+{
12963+ int i;
12964+ struct expression *newp;
12965+
12966+ /* If any of the argument could not be malloc'ed, just return NULL. */
12967+ for (i = nargs - 1; i >= 0; i--)
12968+ if (args[i] == NULL)
12969+ goto fail;
12970+
12971+ /* Allocate a new expression. */
12972+ newp = (struct expression *) malloc (sizeof (*newp));
12973+ if (newp != NULL)
12974+ {
12975+ newp->nargs = nargs;
12976+ newp->operation = op;
12977+ for (i = nargs - 1; i >= 0; i--)
12978+ newp->val.args[i] = args[i];
12979+ return newp;
12980+ }
12981+
12982+ fail:
12983+ for (i = nargs - 1; i >= 0; i--)
12984+ FREE_EXPRESSION (args[i]);
12985+
12986+ return NULL;
12987+}
12988+
12989+static inline struct expression *
12990+new_exp_0 (enum operator op)
12991+{
12992+ return new_exp (0, op, NULL);
12993+}
12994+
12995+static inline struct expression *
12996+new_exp_1 (enum operator op, struct expression *right)
12997+{
12998+ struct expression *args[1];
12999+
13000+ args[0] = right;
13001+ return new_exp (1, op, args);
13002+}
13003+
13004+static struct expression *
13005+new_exp_2 (enum operator op, struct expression *left, struct expression *right)
13006+{
13007+ struct expression *args[2];
13008+
13009+ args[0] = left;
13010+ args[1] = right;
13011+ return new_exp (2, op, args);
13012+}
13013+
13014+static inline struct expression *
13015+new_exp_3 (enum operator op, struct expression *bexp,
13016+ struct expression *tbranch, struct expression *fbranch)
13017+{
13018+ struct expression *args[3];
13019+
13020+ args[0] = bexp;
13021+ args[1] = tbranch;
13022+ args[2] = fbranch;
13023+ return new_exp (3, op, args);
13024+}
13025+
13026+#ifndef YYDEBUG
13027+# define YYDEBUG 0
13028+#endif
13029+
13030+
13031+
13032+#define YYFINAL 27
13033+#define YYFLAG -32768
13034+#define YYNTBASE 16
13035+
13036+/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
13037+#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
13038+
13039+/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
13040+static const char yytranslate[] =
13041+{
13042+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13043+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13044+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13045+ 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
13046+ 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
13047+ 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
13048+ 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
13049+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13050+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13051+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13052+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13053+ 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13054+ 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
13055+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13056+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13057+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13058+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13059+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13060+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13061+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13062+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13063+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13064+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13065+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13066+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
13067+ 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
13068+ 9, 11
13069+};
13070+
13071+#if YYDEBUG
13072+static const short yyprhs[] =
13073+{
13074+ 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
13075+ 35, 37, 39
13076+};
13077+static const short yyrhs[] =
13078+{
13079+ 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
13080+ 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
13081+ 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
13082+ 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
13083+ 17, 15, 0
13084+};
13085+
13086+#endif
13087+
13088+#if YYDEBUG
13089+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
13090+static const short yyrline[] =
13091+{
13092+ 0, 150, 158, 162, 166, 170, 174, 178, 182, 186,
13093+ 190, 194, 199
13094+};
13095+#endif
13096+
13097+
13098+#if (YYDEBUG) || defined YYERROR_VERBOSE
13099+
13100+/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
13101+static const char *const yytname[] =
13102+{
13103+ "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
13104+ "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
13105+ "start", "exp", 0
13106+};
13107+#endif
13108+
13109+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
13110+static const short yyr1[] =
13111+{
13112+ 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
13113+ 17, 17, 17
13114+};
13115+
13116+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
13117+static const short yyr2[] =
13118+{
13119+ 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
13120+ 1, 1, 3
13121+};
13122+
13123+/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
13124+ doesn't specify something else to do. Zero means the default is an
13125+ error. */
13126+static const short yydefact[] =
13127+{
13128+ 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
13129+ 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
13130+ 6, 7, 8, 0, 2, 0, 0, 0
13131+};
13132+
13133+static const short yydefgoto[] =
13134+{
13135+ 25, 5
13136+};
13137+
13138+static const short yypact[] =
13139+{
13140+ -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
13141+ -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
13142+ 26, -3,-32768, -9, 34, 21, 53,-32768
13143+};
13144+
13145+static const short yypgoto[] =
13146+{
13147+ -32768, -1
13148+};
13149+
13150+
13151+#define YYLAST 53
13152+
13153+
13154+static const short yytable[] =
13155+{
13156+ 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
13157+ 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
13158+ 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
13159+ 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
13160+ 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
13161+ 12, 13, 14, 27
13162+};
13163+
13164+static const short yycheck[] =
13165+{
13166+ 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
13167+ 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
13168+ 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
13169+ 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
13170+ 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
13171+ 7, 8, 9, 0
13172+};
13173+#define YYPURE 1
13174+
13175+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
13176+#line 3 "/usr/local/share/bison/bison.simple"
13177+
13178+/* Skeleton output parser for bison,
13179+
13180+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
13181+ Foundation, Inc.
13182+
13183+ This program is free software; you can redistribute it and/or modify
13184+ it under the terms of the GNU General Public License as published by
13185+ the Free Software Foundation; either version 2, or (at your option)
13186+ any later version.
13187+
13188+ This program is distributed in the hope that it will be useful,
13189+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13190+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13191+ GNU General Public License for more details.
13192+
13193+ You should have received a copy of the GNU General Public License
13194+ along with this program; if not, write to the Free Software
13195+ Foundation, Inc., 59 Temple Place - Suite 330,
13196+ Boston, MA 02111-1307, USA. */
13197+
13198+/* As a special exception, when this file is copied by Bison into a
13199+ Bison output file, you may use that output file without restriction.
13200+ This special exception was added by the Free Software Foundation
13201+ in version 1.24 of Bison. */
13202+
13203+/* This is the parser code that is written into each bison parser when
13204+ the %semantic_parser declaration is not specified in the grammar.
13205+ It was written by Richard Stallman by simplifying the hairy parser
13206+ used when %semantic_parser is specified. */
13207+
13208+/* All symbols defined below should begin with yy or YY, to avoid
13209+ infringing on user name space. This should be done even for local
13210+ variables, as they might otherwise be expanded by user macros.
13211+ There are some unavoidable exceptions within include files to
13212+ define necessary library symbols; they are noted "INFRINGES ON
13213+ USER NAME SPACE" below. */
13214+
13215+#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
13216+
13217+/* The parser invokes alloca or malloc; define the necessary symbols. */
13218+
13219+# if YYSTACK_USE_ALLOCA
13220+# define YYSTACK_ALLOC alloca
13221+# else
13222+# ifndef YYSTACK_USE_ALLOCA
13223+# if defined (alloca) || defined (_ALLOCA_H)
13224+# define YYSTACK_ALLOC alloca
13225+# else
13226+# ifdef __GNUC__
13227+# define YYSTACK_ALLOC __builtin_alloca
13228+# endif
13229+# endif
13230+# endif
13231+# endif
13232+
13233+# ifdef YYSTACK_ALLOC
13234+ /* Pacify GCC's `empty if-body' warning. */
13235+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
13236+# else
13237+# if defined (__STDC__) || defined (__cplusplus)
13238+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
13239+# define YYSIZE_T size_t
13240+# endif
13241+# define YYSTACK_ALLOC malloc
13242+# define YYSTACK_FREE free
13243+# endif
13244+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
13245+
13246+
13247+#if (! defined (yyoverflow) \
13248+ && (! defined (__cplusplus) \
13249+ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
13250+
13251+/* A type that is properly aligned for any stack member. */
13252+union yyalloc
13253+{
13254+ short yyss;
13255+ YYSTYPE yyvs;
13256+# if YYLSP_NEEDED
13257+ YYLTYPE yyls;
13258+# endif
13259+};
13260+
13261+/* The size of the maximum gap between one aligned stack and the next. */
13262+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
13263+
13264+/* The size of an array large to enough to hold all stacks, each with
13265+ N elements. */
13266+# if YYLSP_NEEDED
13267+# define YYSTACK_BYTES(N) \
13268+ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
13269+ + 2 * YYSTACK_GAP_MAX)
13270+# else
13271+# define YYSTACK_BYTES(N) \
13272+ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
13273+ + YYSTACK_GAP_MAX)
13274+# endif
13275+
13276+/* Copy COUNT objects from FROM to TO. The source and destination do
13277+ not overlap. */
13278+# ifndef YYCOPY
13279+# if 1 < __GNUC__
13280+# define YYCOPY(To, From, Count) \
13281+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
13282+# else
13283+# define YYCOPY(To, From, Count) \
13284+ do \
13285+ { \
13286+ register YYSIZE_T yyi; \
13287+ for (yyi = 0; yyi < (Count); yyi++) \
13288+ (To)[yyi] = (From)[yyi]; \
13289+ } \
13290+ while (0)
13291+# endif
13292+# endif
13293+
13294+/* Relocate STACK from its old location to the new one. The
13295+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
13296+ elements in the stack, and YYPTR gives the new location of the
13297+ stack. Advance YYPTR to a properly aligned location for the next
13298+ stack. */
13299+# define YYSTACK_RELOCATE(Stack) \
13300+ do \
13301+ { \
13302+ YYSIZE_T yynewbytes; \
13303+ YYCOPY (&yyptr->Stack, Stack, yysize); \
13304+ Stack = &yyptr->Stack; \
13305+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
13306+ yyptr += yynewbytes / sizeof (*yyptr); \
13307+ } \
13308+ while (0)
13309+
13310+#endif
13311+
13312+
13313+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
13314+# define YYSIZE_T __SIZE_TYPE__
13315+#endif
13316+#if ! defined (YYSIZE_T) && defined (size_t)
13317+# define YYSIZE_T size_t
13318+#endif
13319+#if ! defined (YYSIZE_T)
13320+# if defined (__STDC__) || defined (__cplusplus)
13321+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
13322+# define YYSIZE_T size_t
13323+# endif
13324+#endif
13325+#if ! defined (YYSIZE_T)
13326+# define YYSIZE_T unsigned int
13327+#endif
13328+
13329+#define yyerrok (yyerrstatus = 0)
13330+#define yyclearin (yychar = YYEMPTY)
13331+#define YYEMPTY -2
13332+#define YYEOF 0
13333+#define YYACCEPT goto yyacceptlab
13334+#define YYABORT goto yyabortlab
13335+#define YYERROR goto yyerrlab1
13336+/* Like YYERROR except do call yyerror. This remains here temporarily
13337+ to ease the transition to the new meaning of YYERROR, for GCC.
13338+ Once GCC version 2 has supplanted version 1, this can go. */
13339+#define YYFAIL goto yyerrlab
13340+#define YYRECOVERING() (!!yyerrstatus)
13341+#define YYBACKUP(Token, Value) \
13342+do \
13343+ if (yychar == YYEMPTY && yylen == 1) \
13344+ { \
13345+ yychar = (Token); \
13346+ yylval = (Value); \
13347+ yychar1 = YYTRANSLATE (yychar); \
13348+ YYPOPSTACK; \
13349+ goto yybackup; \
13350+ } \
13351+ else \
13352+ { \
13353+ yyerror ("syntax error: cannot back up"); \
13354+ YYERROR; \
13355+ } \
13356+while (0)
13357+
13358+#define YYTERROR 1
13359+#define YYERRCODE 256
13360+
13361+
13362+/* YYLLOC_DEFAULT -- Compute the default location (before the actions
13363+ are run).
13364+
13365+ When YYLLOC_DEFAULT is run, CURRENT is set the location of the
13366+ first token. By default, to implement support for ranges, extend
13367+ its range to the last symbol. */
13368+
13369+#ifndef YYLLOC_DEFAULT
13370+# define YYLLOC_DEFAULT(Current, Rhs, N) \
13371+ Current.last_line = Rhs[N].last_line; \
13372+ Current.last_column = Rhs[N].last_column;
13373+#endif
13374+
13375+
13376+/* YYLEX -- calling `yylex' with the right arguments. */
13377+
13378+#if YYPURE
13379+# if YYLSP_NEEDED
13380+# ifdef YYLEX_PARAM
13381+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
13382+# else
13383+# define YYLEX yylex (&yylval, &yylloc)
13384+# endif
13385+# else /* !YYLSP_NEEDED */
13386+# ifdef YYLEX_PARAM
13387+# define YYLEX yylex (&yylval, YYLEX_PARAM)
13388+# else
13389+# define YYLEX yylex (&yylval)
13390+# endif
13391+# endif /* !YYLSP_NEEDED */
13392+#else /* !YYPURE */
13393+# define YYLEX yylex ()
13394+#endif /* !YYPURE */
13395+
13396+
13397+/* Enable debugging if requested. */
13398+#if YYDEBUG
13399+
13400+# ifndef YYFPRINTF
13401+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
13402+# define YYFPRINTF fprintf
13403+# endif
13404+
13405+# define YYDPRINTF(Args) \
13406+do { \
13407+ if (yydebug) \
13408+ YYFPRINTF Args; \
13409+} while (0)
13410+/* Nonzero means print parse trace. It is left uninitialized so that
13411+ multiple parsers can coexist. */
13412+int yydebug;
13413+#else /* !YYDEBUG */
13414+# define YYDPRINTF(Args)
13415+#endif /* !YYDEBUG */
13416+
13417+/* YYINITDEPTH -- initial size of the parser's stacks. */
13418+#ifndef YYINITDEPTH
13419+# define YYINITDEPTH 200
13420+#endif
13421+
13422+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
13423+ if the built-in stack extension method is used).
13424+
13425+ Do not make this value too large; the results are undefined if
13426+ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
13427+ evaluated with infinite-precision integer arithmetic. */
13428+
13429+#if YYMAXDEPTH == 0
13430+# undef YYMAXDEPTH
13431+#endif
13432+
13433+#ifndef YYMAXDEPTH
13434+# define YYMAXDEPTH 10000
13435+#endif
13436+
13437+#ifdef YYERROR_VERBOSE
13438+
13439+# ifndef yystrlen
13440+# if defined (__GLIBC__) && defined (_STRING_H)
13441+# define yystrlen strlen
13442+# else
13443+/* Return the length of YYSTR. */
13444+static YYSIZE_T
13445+# if defined (__STDC__) || defined (__cplusplus)
13446+yystrlen (const char *yystr)
13447+# else
13448+yystrlen (yystr)
13449+ const char *yystr;
13450+# endif
13451+{
13452+ register const char *yys = yystr;
13453+
13454+ while (*yys++ != '\0')
13455+ continue;
13456+
13457+ return yys - yystr - 1;
13458+}
13459+# endif
13460+# endif
13461+
13462+# ifndef yystpcpy
13463+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
13464+# define yystpcpy stpcpy
13465+# else
13466+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
13467+ YYDEST. */
13468+static char *
13469+# if defined (__STDC__) || defined (__cplusplus)
13470+yystpcpy (char *yydest, const char *yysrc)
13471+# else
13472+yystpcpy (yydest, yysrc)
13473+ char *yydest;
13474+ const char *yysrc;
13475+# endif
13476+{
13477+ register char *yyd = yydest;
13478+ register const char *yys = yysrc;
13479+
13480+ while ((*yyd++ = *yys++) != '\0')
13481+ continue;
13482+
13483+ return yyd - 1;
13484+}
13485+# endif
13486+# endif
13487+#endif
13488+
13489+#line 315 "/usr/local/share/bison/bison.simple"
13490+
13491+
13492+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
13493+ into yyparse. The argument should have type void *.
13494+ It should actually point to an object.
13495+ Grammar actions can access the variable by casting it
13496+ to the proper pointer type. */
13497+
13498+#ifdef YYPARSE_PARAM
13499+# if defined (__STDC__) || defined (__cplusplus)
13500+# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
13501+# define YYPARSE_PARAM_DECL
13502+# else
13503+# define YYPARSE_PARAM_ARG YYPARSE_PARAM
13504+# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
13505+# endif
13506+#else /* !YYPARSE_PARAM */
13507+# define YYPARSE_PARAM_ARG
13508+# define YYPARSE_PARAM_DECL
13509+#endif /* !YYPARSE_PARAM */
13510+
13511+/* Prevent warning if -Wstrict-prototypes. */
13512+#ifdef __GNUC__
13513+# ifdef YYPARSE_PARAM
13514+int yyparse (void *);
13515+# else
13516+int yyparse (void);
13517+# endif
13518+#endif
13519+
13520+/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
13521+ variables are global, or local to YYPARSE. */
13522+
13523+#define YY_DECL_NON_LSP_VARIABLES \
13524+/* The lookahead symbol. */ \
13525+int yychar; \
13526+ \
13527+/* The semantic value of the lookahead symbol. */ \
13528+YYSTYPE yylval; \
13529+ \
13530+/* Number of parse errors so far. */ \
13531+int yynerrs;
13532+
13533+#if YYLSP_NEEDED
13534+# define YY_DECL_VARIABLES \
13535+YY_DECL_NON_LSP_VARIABLES \
13536+ \
13537+/* Location data for the lookahead symbol. */ \
13538+YYLTYPE yylloc;
13539+#else
13540+# define YY_DECL_VARIABLES \
13541+YY_DECL_NON_LSP_VARIABLES
13542+#endif
13543+
13544+
13545+/* If nonreentrant, generate the variables here. */
13546+
13547+#if !YYPURE
13548+YY_DECL_VARIABLES
13549+#endif /* !YYPURE */
13550+
13551+int
13552+yyparse (YYPARSE_PARAM_ARG)
13553+ YYPARSE_PARAM_DECL
13554+{
13555+ /* If reentrant, generate the variables here. */
13556+#if YYPURE
13557+ YY_DECL_VARIABLES
13558+#endif /* !YYPURE */
13559+
13560+ register int yystate;
13561+ register int yyn;
13562+ int yyresult;
13563+ /* Number of tokens to shift before error messages enabled. */
13564+ int yyerrstatus;
13565+ /* Lookahead token as an internal (translated) token number. */
13566+ int yychar1 = 0;
13567+
13568+ /* Three stacks and their tools:
13569+ `yyss': related to states,
13570+ `yyvs': related to semantic values,
13571+ `yyls': related to locations.
13572+
13573+ Refer to the stacks thru separate pointers, to allow yyoverflow
13574+ to reallocate them elsewhere. */
13575+
13576+ /* The state stack. */
13577+ short yyssa[YYINITDEPTH];
13578+ short *yyss = yyssa;
13579+ register short *yyssp;
13580+
13581+ /* The semantic value stack. */
13582+ YYSTYPE yyvsa[YYINITDEPTH];
13583+ YYSTYPE *yyvs = yyvsa;
13584+ register YYSTYPE *yyvsp;
13585+
13586+#if YYLSP_NEEDED
13587+ /* The location stack. */
13588+ YYLTYPE yylsa[YYINITDEPTH];
13589+ YYLTYPE *yyls = yylsa;
13590+ YYLTYPE *yylsp;
13591+#endif
13592+
13593+#if YYLSP_NEEDED
13594+# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
13595+#else
13596+# define YYPOPSTACK (yyvsp--, yyssp--)
13597+#endif
13598+
13599+ YYSIZE_T yystacksize = YYINITDEPTH;
13600+
13601+
13602+ /* The variables used to return semantic value and location from the
13603+ action routines. */
13604+ YYSTYPE yyval;
13605+#if YYLSP_NEEDED
13606+ YYLTYPE yyloc;
13607+#endif
13608+
13609+ /* When reducing, the number of symbols on the RHS of the reduced
13610+ rule. */
13611+ int yylen;
13612+
13613+ YYDPRINTF ((stderr, "Starting parse\n"));
13614+
13615+ yystate = 0;
13616+ yyerrstatus = 0;
13617+ yynerrs = 0;
13618+ yychar = YYEMPTY; /* Cause a token to be read. */
13619+
13620+ /* Initialize stack pointers.
13621+ Waste one element of value and location stack
13622+ so that they stay on the same level as the state stack.
13623+ The wasted elements are never initialized. */
13624+
13625+ yyssp = yyss;
13626+ yyvsp = yyvs;
13627+#if YYLSP_NEEDED
13628+ yylsp = yyls;
13629+#endif
13630+ goto yysetstate;
13631+
13632+/*------------------------------------------------------------.
13633+| yynewstate -- Push a new state, which is found in yystate. |
13634+`------------------------------------------------------------*/
13635+ yynewstate:
13636+ /* In all cases, when you get here, the value and location stacks
13637+ have just been pushed. so pushing a state here evens the stacks.
13638+ */
13639+ yyssp++;
13640+
13641+ yysetstate:
13642+ *yyssp = yystate;
13643+
13644+ if (yyssp >= yyss + yystacksize - 1)
13645+ {
13646+ /* Get the current used size of the three stacks, in elements. */
13647+ YYSIZE_T yysize = yyssp - yyss + 1;
13648+
13649+#ifdef yyoverflow
13650+ {
13651+ /* Give user a chance to reallocate the stack. Use copies of
13652+ these so that the &'s don't force the real ones into
13653+ memory. */
13654+ YYSTYPE *yyvs1 = yyvs;
13655+ short *yyss1 = yyss;
13656+
13657+ /* Each stack pointer address is followed by the size of the
13658+ data in use in that stack, in bytes. */
13659+# if YYLSP_NEEDED
13660+ YYLTYPE *yyls1 = yyls;
13661+ /* This used to be a conditional around just the two extra args,
13662+ but that might be undefined if yyoverflow is a macro. */
13663+ yyoverflow ("parser stack overflow",
13664+ &yyss1, yysize * sizeof (*yyssp),
13665+ &yyvs1, yysize * sizeof (*yyvsp),
13666+ &yyls1, yysize * sizeof (*yylsp),
13667+ &yystacksize);
13668+ yyls = yyls1;
13669+# else
13670+ yyoverflow ("parser stack overflow",
13671+ &yyss1, yysize * sizeof (*yyssp),
13672+ &yyvs1, yysize * sizeof (*yyvsp),
13673+ &yystacksize);
13674+# endif
13675+ yyss = yyss1;
13676+ yyvs = yyvs1;
13677+ }
13678+#else /* no yyoverflow */
13679+# ifndef YYSTACK_RELOCATE
13680+ goto yyoverflowlab;
13681+# else
13682+ /* Extend the stack our own way. */
13683+ if (yystacksize >= YYMAXDEPTH)
13684+ goto yyoverflowlab;
13685+ yystacksize *= 2;
13686+ if (yystacksize > YYMAXDEPTH)
13687+ yystacksize = YYMAXDEPTH;
13688+
13689+ {
13690+ short *yyss1 = yyss;
13691+ union yyalloc *yyptr =
13692+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
13693+ if (! yyptr)
13694+ goto yyoverflowlab;
13695+ YYSTACK_RELOCATE (yyss);
13696+ YYSTACK_RELOCATE (yyvs);
13697+# if YYLSP_NEEDED
13698+ YYSTACK_RELOCATE (yyls);
13699+# endif
13700+# undef YYSTACK_RELOCATE
13701+ if (yyss1 != yyssa)
13702+ YYSTACK_FREE (yyss1);
13703+ }
13704+# endif
13705+#endif /* no yyoverflow */
13706+
13707+ yyssp = yyss + yysize - 1;
13708+ yyvsp = yyvs + yysize - 1;
13709+#if YYLSP_NEEDED
13710+ yylsp = yyls + yysize - 1;
13711+#endif
13712+
13713+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
13714+ (unsigned long int) yystacksize));
13715+
13716+ if (yyssp >= yyss + yystacksize - 1)
13717+ YYABORT;
13718+ }
13719+
13720+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
13721+
13722+ goto yybackup;
13723+
13724+
13725+/*-----------.
13726+| yybackup. |
13727+`-----------*/
13728+yybackup:
13729+
13730+/* Do appropriate processing given the current state. */
13731+/* Read a lookahead token if we need one and don't already have one. */
13732+/* yyresume: */
13733+
13734+ /* First try to decide what to do without reference to lookahead token. */
13735+
13736+ yyn = yypact[yystate];
13737+ if (yyn == YYFLAG)
13738+ goto yydefault;
13739+
13740+ /* Not known => get a lookahead token if don't already have one. */
13741+
13742+ /* yychar is either YYEMPTY or YYEOF
13743+ or a valid token in external form. */
13744+
13745+ if (yychar == YYEMPTY)
13746+ {
13747+ YYDPRINTF ((stderr, "Reading a token: "));
13748+ yychar = YYLEX;
13749+ }
13750+
13751+ /* Convert token to internal form (in yychar1) for indexing tables with */
13752+
13753+ if (yychar <= 0) /* This means end of input. */
13754+ {
13755+ yychar1 = 0;
13756+ yychar = YYEOF; /* Don't call YYLEX any more */
13757+
13758+ YYDPRINTF ((stderr, "Now at end of input.\n"));
13759+ }
13760+ else
13761+ {
13762+ yychar1 = YYTRANSLATE (yychar);
13763+
13764+#if YYDEBUG
13765+ /* We have to keep this `#if YYDEBUG', since we use variables
13766+ which are defined only if `YYDEBUG' is set. */
13767+ if (yydebug)
13768+ {
13769+ YYFPRINTF (stderr, "Next token is %d (%s",
13770+ yychar, yytname[yychar1]);
13771+ /* Give the individual parser a way to print the precise
13772+ meaning of a token, for further debugging info. */
13773+# ifdef YYPRINT
13774+ YYPRINT (stderr, yychar, yylval);
13775+# endif
13776+ YYFPRINTF (stderr, ")\n");
13777+ }
13778+#endif
13779+ }
13780+
13781+ yyn += yychar1;
13782+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
13783+ goto yydefault;
13784+
13785+ yyn = yytable[yyn];
13786+
13787+ /* yyn is what to do for this token type in this state.
13788+ Negative => reduce, -yyn is rule number.
13789+ Positive => shift, yyn is new state.
13790+ New state is final state => don't bother to shift,
13791+ just return success.
13792+ 0, or most negative number => error. */
13793+
13794+ if (yyn < 0)
13795+ {
13796+ if (yyn == YYFLAG)
13797+ goto yyerrlab;
13798+ yyn = -yyn;
13799+ goto yyreduce;
13800+ }
13801+ else if (yyn == 0)
13802+ goto yyerrlab;
13803+
13804+ if (yyn == YYFINAL)
13805+ YYACCEPT;
13806+
13807+ /* Shift the lookahead token. */
13808+ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
13809+ yychar, yytname[yychar1]));
13810+
13811+ /* Discard the token being shifted unless it is eof. */
13812+ if (yychar != YYEOF)
13813+ yychar = YYEMPTY;
13814+
13815+ *++yyvsp = yylval;
13816+#if YYLSP_NEEDED
13817+ *++yylsp = yylloc;
13818+#endif
13819+
13820+ /* Count tokens shifted since error; after three, turn off error
13821+ status. */
13822+ if (yyerrstatus)
13823+ yyerrstatus--;
13824+
13825+ yystate = yyn;
13826+ goto yynewstate;
13827+
13828+
13829+/*-----------------------------------------------------------.
13830+| yydefault -- do the default action for the current state. |
13831+`-----------------------------------------------------------*/
13832+yydefault:
13833+ yyn = yydefact[yystate];
13834+ if (yyn == 0)
13835+ goto yyerrlab;
13836+ goto yyreduce;
13837+
13838+
13839+/*-----------------------------.
13840+| yyreduce -- Do a reduction. |
13841+`-----------------------------*/
13842+yyreduce:
13843+ /* yyn is the number of a rule to reduce with. */
13844+ yylen = yyr2[yyn];
13845+
13846+ /* If YYLEN is nonzero, implement the default value of the action:
13847+ `$$ = $1'.
13848+
13849+ Otherwise, the following line sets YYVAL to the semantic value of
13850+ the lookahead token. This behavior is undocumented and Bison
13851+ users should not rely upon it. Assigning to YYVAL
13852+ unconditionally makes the parser a bit smaller, and it avoids a
13853+ GCC warning that YYVAL may be used uninitialized. */
13854+ yyval = yyvsp[1-yylen];
13855+
13856+#if YYLSP_NEEDED
13857+ /* Similarly for the default location. Let the user run additional
13858+ commands if for instance locations are ranges. */
13859+ yyloc = yylsp[1-yylen];
13860+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
13861+#endif
13862+
13863+#if YYDEBUG
13864+ /* We have to keep this `#if YYDEBUG', since we use variables which
13865+ are defined only if `YYDEBUG' is set. */
13866+ if (yydebug)
13867+ {
13868+ int yyi;
13869+
13870+ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
13871+ yyn, yyrline[yyn]);
13872+
13873+ /* Print the symbols being reduced, and their result. */
13874+ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
13875+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
13876+ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
13877+ }
13878+#endif
13879+
13880+ switch (yyn) {
13881+
13882+case 1:
13883+#line 151 "plural.y"
13884+{
13885+ if (yyvsp[0].exp == NULL)
13886+ YYABORT;
13887+ ((struct parse_args *) arg)->res = yyvsp[0].exp;
13888+ }
13889+ break;
13890+case 2:
13891+#line 159 "plural.y"
13892+{
13893+ yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
13894+ }
13895+ break;
13896+case 3:
13897+#line 163 "plural.y"
13898+{
13899+ yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
13900+ }
13901+ break;
13902+case 4:
13903+#line 167 "plural.y"
13904+{
13905+ yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
13906+ }
13907+ break;
13908+case 5:
13909+#line 171 "plural.y"
13910+{
13911+ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
13912+ }
13913+ break;
13914+case 6:
13915+#line 175 "plural.y"
13916+{
13917+ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
13918+ }
13919+ break;
13920+case 7:
13921+#line 179 "plural.y"
13922+{
13923+ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
13924+ }
13925+ break;
13926+case 8:
13927+#line 183 "plural.y"
13928+{
13929+ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
13930+ }
13931+ break;
13932+case 9:
13933+#line 187 "plural.y"
13934+{
13935+ yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
13936+ }
13937+ break;
13938+case 10:
13939+#line 191 "plural.y"
13940+{
13941+ yyval.exp = new_exp_0 (var);
13942+ }
13943+ break;
13944+case 11:
13945+#line 195 "plural.y"
13946+{
13947+ if ((yyval.exp = new_exp_0 (num)) != NULL)
13948+ yyval.exp->val.num = yyvsp[0].num;
13949+ }
13950+ break;
13951+case 12:
13952+#line 200 "plural.y"
13953+{
13954+ yyval.exp = yyvsp[-1].exp;
13955+ }
13956+ break;
13957+}
13958+
13959+#line 705 "/usr/local/share/bison/bison.simple"
13960+
13961+
13962+ yyvsp -= yylen;
13963+ yyssp -= yylen;
13964+#if YYLSP_NEEDED
13965+ yylsp -= yylen;
13966+#endif
13967+
13968+#if YYDEBUG
13969+ if (yydebug)
13970+ {
13971+ short *yyssp1 = yyss - 1;
13972+ YYFPRINTF (stderr, "state stack now");
13973+ while (yyssp1 != yyssp)
13974+ YYFPRINTF (stderr, " %d", *++yyssp1);
13975+ YYFPRINTF (stderr, "\n");
13976+ }
13977+#endif
13978+
13979+ *++yyvsp = yyval;
13980+#if YYLSP_NEEDED
13981+ *++yylsp = yyloc;
13982+#endif
13983+
13984+ /* Now `shift' the result of the reduction. Determine what state
13985+ that goes to, based on the state we popped back to and the rule
13986+ number reduced by. */
13987+
13988+ yyn = yyr1[yyn];
13989+
13990+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
13991+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
13992+ yystate = yytable[yystate];
13993+ else
13994+ yystate = yydefgoto[yyn - YYNTBASE];
13995+
13996+ goto yynewstate;
13997+
13998+
13999+/*------------------------------------.
14000+| yyerrlab -- here on detecting error |
14001+`------------------------------------*/
14002+yyerrlab:
14003+ /* If not already recovering from an error, report this error. */
14004+ if (!yyerrstatus)
14005+ {
14006+ ++yynerrs;
14007+
14008+#ifdef YYERROR_VERBOSE
14009+ yyn = yypact[yystate];
14010+
14011+ if (yyn > YYFLAG && yyn < YYLAST)
14012+ {
14013+ YYSIZE_T yysize = 0;
14014+ char *yymsg;
14015+ int yyx, yycount;
14016+
14017+ yycount = 0;
14018+ /* Start YYX at -YYN if negative to avoid negative indexes in
14019+ YYCHECK. */
14020+ for (yyx = yyn < 0 ? -yyn : 0;
14021+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
14022+ if (yycheck[yyx + yyn] == yyx)
14023+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
14024+ yysize += yystrlen ("parse error, unexpected ") + 1;
14025+ yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
14026+ yymsg = (char *) YYSTACK_ALLOC (yysize);
14027+ if (yymsg != 0)
14028+ {
14029+ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
14030+ yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
14031+
14032+ if (yycount < 5)
14033+ {
14034+ yycount = 0;
14035+ for (yyx = yyn < 0 ? -yyn : 0;
14036+ yyx < (int) (sizeof (yytname) / sizeof (char *));
14037+ yyx++)
14038+ if (yycheck[yyx + yyn] == yyx)
14039+ {
14040+ const char *yyq = ! yycount ? ", expecting " : " or ";
14041+ yyp = yystpcpy (yyp, yyq);
14042+ yyp = yystpcpy (yyp, yytname[yyx]);
14043+ yycount++;
14044+ }
14045+ }
14046+ yyerror (yymsg);
14047+ YYSTACK_FREE (yymsg);
14048+ }
14049+ else
14050+ yyerror ("parse error; also virtual memory exhausted");
14051+ }
14052+ else
14053+#endif /* defined (YYERROR_VERBOSE) */
14054+ yyerror ("parse error");
14055+ }
14056+ goto yyerrlab1;
14057+
14058+
14059+/*--------------------------------------------------.
14060+| yyerrlab1 -- error raised explicitly by an action |
14061+`--------------------------------------------------*/
14062+yyerrlab1:
14063+ if (yyerrstatus == 3)
14064+ {
14065+ /* If just tried and failed to reuse lookahead token after an
14066+ error, discard it. */
14067+
14068+ /* return failure if at end of input */
14069+ if (yychar == YYEOF)
14070+ YYABORT;
14071+ YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
14072+ yychar, yytname[yychar1]));
14073+ yychar = YYEMPTY;
14074+ }
14075+
14076+ /* Else will try to reuse lookahead token after shifting the error
14077+ token. */
14078+
14079+ yyerrstatus = 3; /* Each real token shifted decrements this */
14080+
14081+ goto yyerrhandle;
14082+
14083+
14084+/*-------------------------------------------------------------------.
14085+| yyerrdefault -- current state does not do anything special for the |
14086+| error token. |
14087+`-------------------------------------------------------------------*/
14088+yyerrdefault:
14089+#if 0
14090+ /* This is wrong; only states that explicitly want error tokens
14091+ should shift them. */
14092+
14093+ /* If its default is to accept any token, ok. Otherwise pop it. */
14094+ yyn = yydefact[yystate];
14095+ if (yyn)
14096+ goto yydefault;
14097+#endif
14098+
14099+
14100+/*---------------------------------------------------------------.
14101+| yyerrpop -- pop the current state because it cannot handle the |
14102+| error token |
14103+`---------------------------------------------------------------*/
14104+yyerrpop:
14105+ if (yyssp == yyss)
14106+ YYABORT;
14107+ yyvsp--;
14108+ yystate = *--yyssp;
14109+#if YYLSP_NEEDED
14110+ yylsp--;
14111+#endif
14112+
14113+#if YYDEBUG
14114+ if (yydebug)
14115+ {
14116+ short *yyssp1 = yyss - 1;
14117+ YYFPRINTF (stderr, "Error: state stack now");
14118+ while (yyssp1 != yyssp)
14119+ YYFPRINTF (stderr, " %d", *++yyssp1);
14120+ YYFPRINTF (stderr, "\n");
14121+ }
14122+#endif
14123+
14124+/*--------------.
14125+| yyerrhandle. |
14126+`--------------*/
14127+yyerrhandle:
14128+ yyn = yypact[yystate];
14129+ if (yyn == YYFLAG)
14130+ goto yyerrdefault;
14131+
14132+ yyn += YYTERROR;
14133+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
14134+ goto yyerrdefault;
14135+
14136+ yyn = yytable[yyn];
14137+ if (yyn < 0)
14138+ {
14139+ if (yyn == YYFLAG)
14140+ goto yyerrpop;
14141+ yyn = -yyn;
14142+ goto yyreduce;
14143+ }
14144+ else if (yyn == 0)
14145+ goto yyerrpop;
14146+
14147+ if (yyn == YYFINAL)
14148+ YYACCEPT;
14149+
14150+ YYDPRINTF ((stderr, "Shifting error token, "));
14151+
14152+ *++yyvsp = yylval;
14153+#if YYLSP_NEEDED
14154+ *++yylsp = yylloc;
14155+#endif
14156+
14157+ yystate = yyn;
14158+ goto yynewstate;
14159+
14160+
14161+/*-------------------------------------.
14162+| yyacceptlab -- YYACCEPT comes here. |
14163+`-------------------------------------*/
14164+yyacceptlab:
14165+ yyresult = 0;
14166+ goto yyreturn;
14167+
14168+/*-----------------------------------.
14169+| yyabortlab -- YYABORT comes here. |
14170+`-----------------------------------*/
14171+yyabortlab:
14172+ yyresult = 1;
14173+ goto yyreturn;
14174+
14175+/*---------------------------------------------.
14176+| yyoverflowab -- parser overflow comes here. |
14177+`---------------------------------------------*/
14178+yyoverflowlab:
14179+ yyerror ("parser stack overflow");
14180+ yyresult = 2;
14181+ /* Fall through. */
14182+
14183+yyreturn:
14184+#ifndef yyoverflow
14185+ if (yyss != yyssa)
14186+ YYSTACK_FREE (yyss);
14187+#endif
14188+ return yyresult;
14189+}
14190+#line 205 "plural.y"
14191+
14192+
14193+void
14194+internal_function
14195+FREE_EXPRESSION (struct expression *exp)
14196+{
14197+ if (exp == NULL)
14198+ return;
14199+
14200+ /* Handle the recursive case. */
14201+ switch (exp->nargs)
14202+ {
14203+ case 3:
14204+ FREE_EXPRESSION (exp->val.args[2]);
14205+ /* FALLTHROUGH */
14206+ case 2:
14207+ FREE_EXPRESSION (exp->val.args[1]);
14208+ /* FALLTHROUGH */
14209+ case 1:
14210+ FREE_EXPRESSION (exp->val.args[0]);
14211+ /* FALLTHROUGH */
14212+ default:
14213+ break;
14214+ }
14215+
14216+ free (exp);
14217+}
14218+
14219+
14220+static int
14221+yylex (YYSTYPE *lval, const char **pexp)
14222+{
14223+ const char *exp = *pexp;
14224+ int result;
14225+
14226+ while (1)
14227+ {
14228+ if (exp[0] == '\0')
14229+ {
14230+ *pexp = exp;
14231+ return YYEOF;
14232+ }
14233+
14234+ if (exp[0] != ' ' && exp[0] != '\t')
14235+ break;
14236+
14237+ ++exp;
14238+ }
14239+
14240+ result = *exp++;
14241+ switch (result)
14242+ {
14243+ case '0': case '1': case '2': case '3': case '4':
14244+ case '5': case '6': case '7': case '8': case '9':
14245+ {
14246+ unsigned long int n = result - '0';
14247+ while (exp[0] >= '0' && exp[0] <= '9')
14248+ {
14249+ n *= 10;
14250+ n += exp[0] - '0';
14251+ ++exp;
14252+ }
14253+ lval->num = n;
14254+ result = NUMBER;
14255+ }
14256+ break;
14257+
14258+ case '=':
14259+ if (exp[0] == '=')
14260+ {
14261+ ++exp;
14262+ lval->op = equal;
14263+ result = EQUOP2;
14264+ }
14265+ else
14266+ result = YYERRCODE;
14267+ break;
14268+
14269+ case '!':
14270+ if (exp[0] == '=')
14271+ {
14272+ ++exp;
14273+ lval->op = not_equal;
14274+ result = EQUOP2;
14275+ }
14276+ break;
14277+
14278+ case '&':
14279+ case '|':
14280+ if (exp[0] == result)
14281+ ++exp;
14282+ else
14283+ result = YYERRCODE;
14284+ break;
14285+
14286+ case '<':
14287+ if (exp[0] == '=')
14288+ {
14289+ ++exp;
14290+ lval->op = less_or_equal;
14291+ }
14292+ else
14293+ lval->op = less_than;
14294+ result = CMPOP2;
14295+ break;
14296+
14297+ case '>':
14298+ if (exp[0] == '=')
14299+ {
14300+ ++exp;
14301+ lval->op = greater_or_equal;
14302+ }
14303+ else
14304+ lval->op = greater_than;
14305+ result = CMPOP2;
14306+ break;
14307+
14308+ case '*':
14309+ lval->op = mult;
14310+ result = MULOP2;
14311+ break;
14312+
14313+ case '/':
14314+ lval->op = divide;
14315+ result = MULOP2;
14316+ break;
14317+
14318+ case '%':
14319+ lval->op = module;
14320+ result = MULOP2;
14321+ break;
14322+
14323+ case '+':
14324+ lval->op = plus;
14325+ result = ADDOP2;
14326+ break;
14327+
14328+ case '-':
14329+ lval->op = minus;
14330+ result = ADDOP2;
14331+ break;
14332+
14333+ case 'n':
14334+ case '?':
14335+ case ':':
14336+ case '(':
14337+ case ')':
14338+ /* Nothing, just return the character. */
14339+ break;
14340+
14341+ case ';':
14342+ case '\n':
14343+ case '\0':
14344+ /* Be safe and let the user call this function again. */
14345+ --exp;
14346+ result = YYEOF;
14347+ break;
14348+
14349+ default:
14350+ result = YYERRCODE;
14351+#if YYDEBUG != 0
14352+ --exp;
14353+#endif
14354+ break;
14355+ }
14356+
14357+ *pexp = exp;
14358+
14359+ return result;
14360+}
14361+
14362+
14363+static void
14364+yyerror (const char *str)
14365+{
14366+ /* Do nothing. We don't print error messages here. */
14367+}
14368--- lrzsz-0.12.20.safe/intl/plural-exp.c 1969-12-31 19:00:00.000000000 -0500
14369+++ lrzsz-0.12.20/intl/plural-exp.c 2004-09-12 14:40:34.578714192 -0400
14370@@ -0,0 +1,154 @@
14371+/* Expression parsing for plural form selection.
14372+ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
14373+ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
14374+
14375+ This program is free software; you can redistribute it and/or modify it
14376+ under the terms of the GNU Library General Public License as published
14377+ by the Free Software Foundation; either version 2, or (at your option)
14378+ any later version.
14379+
14380+ This program is distributed in the hope that it will be useful,
14381+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14382+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14383+ Library General Public License for more details.
14384+
14385+ You should have received a copy of the GNU Library General Public
14386+ License along with this program; if not, write to the Free Software
14387+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
14388+ USA. */
14389+
14390+#ifdef HAVE_CONFIG_H
14391+# include <config.h>
14392+#endif
14393+
14394+#include <ctype.h>
14395+#include <stdlib.h>
14396+#include <string.h>
14397+
14398+#include "plural-exp.h"
14399+
14400+#if (defined __GNUC__ && !defined __APPLE_CC__) \
14401+ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
14402+
14403+/* These structs are the constant expression for the germanic plural
14404+ form determination. It represents the expression "n != 1". */
14405+static const struct expression plvar =
14406+{
14407+ .nargs = 0,
14408+ .operation = var,
14409+};
14410+static const struct expression plone =
14411+{
14412+ .nargs = 0,
14413+ .operation = num,
14414+ .val =
14415+ {
14416+ .num = 1
14417+ }
14418+};
14419+struct expression GERMANIC_PLURAL =
14420+{
14421+ .nargs = 2,
14422+ .operation = not_equal,
14423+ .val =
14424+ {
14425+ .args =
14426+ {
14427+ [0] = (struct expression *) &plvar,
14428+ [1] = (struct expression *) &plone
14429+ }
14430+ }
14431+};
14432+
14433+# define INIT_GERMANIC_PLURAL()
14434+
14435+#else
14436+
14437+/* For compilers without support for ISO C 99 struct/union initializers:
14438+ Initialization at run-time. */
14439+
14440+static struct expression plvar;
14441+static struct expression plone;
14442+struct expression GERMANIC_PLURAL;
14443+
14444+static void
14445+init_germanic_plural ()
14446+{
14447+ if (plone.val.num == 0)
14448+ {
14449+ plvar.nargs = 0;
14450+ plvar.operation = var;
14451+
14452+ plone.nargs = 0;
14453+ plone.operation = num;
14454+ plone.val.num = 1;
14455+
14456+ GERMANIC_PLURAL.nargs = 2;
14457+ GERMANIC_PLURAL.operation = not_equal;
14458+ GERMANIC_PLURAL.val.args[0] = &plvar;
14459+ GERMANIC_PLURAL.val.args[1] = &plone;
14460+ }
14461+}
14462+
14463+# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
14464+
14465+#endif
14466+
14467+void
14468+internal_function
14469+EXTRACT_PLURAL_EXPRESSION (const char *nullentry, struct expression **pluralp,
14470+ unsigned long int *npluralsp)
14471+{
14472+ if (nullentry != NULL)
14473+ {
14474+ const char *plural;
14475+ const char *nplurals;
14476+
14477+ plural = strstr (nullentry, "plural=");
14478+ nplurals = strstr (nullentry, "nplurals=");
14479+ if (plural == NULL || nplurals == NULL)
14480+ goto no_plural;
14481+ else
14482+ {
14483+ char *endp;
14484+ unsigned long int n;
14485+ struct parse_args args;
14486+
14487+ /* First get the number. */
14488+ nplurals += 9;
14489+ while (*nplurals != '\0' && isspace ((unsigned char) *nplurals))
14490+ ++nplurals;
14491+ if (!(*nplurals >= '0' && *nplurals <= '9'))
14492+ goto no_plural;
14493+#if defined HAVE_STRTOUL || defined _LIBC
14494+ n = strtoul (nplurals, &endp, 10);
14495+#else
14496+ for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
14497+ n = n * 10 + (*endp - '0');
14498+#endif
14499+ if (nplurals == endp)
14500+ goto no_plural;
14501+ *npluralsp = n;
14502+
14503+ /* Due to the restrictions bison imposes onto the interface of the
14504+ scanner function we have to put the input string and the result
14505+ passed up from the parser into the same structure which address
14506+ is passed down to the parser. */
14507+ plural += 7;
14508+ args.cp = plural;
14509+ if (PLURAL_PARSE (&args) != 0)
14510+ goto no_plural;
14511+ *pluralp = args.res;
14512+ }
14513+ }
14514+ else
14515+ {
14516+ /* By default we are using the Germanic form: singular form only
14517+ for `one', the plural form otherwise. Yes, this is also what
14518+ English is using since English is a Germanic language. */
14519+ no_plural:
14520+ INIT_GERMANIC_PLURAL ();
14521+ *pluralp = &GERMANIC_PLURAL;
14522+ *npluralsp = 2;
14523+ }
14524+}
14525--- lrzsz-0.12.20.safe/intl/plural-exp.h 1969-12-31 19:00:00.000000000 -0500
14526+++ lrzsz-0.12.20/intl/plural-exp.h 2004-09-12 14:40:34.584713280 -0400
14527@@ -0,0 +1,118 @@
14528+/* Expression parsing and evaluation for plural form selection.
14529+ Copyright (C) 2000-2003 Free Software Foundation, Inc.
14530+ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
14531+
14532+ This program is free software; you can redistribute it and/or modify it
14533+ under the terms of the GNU Library General Public License as published
14534+ by the Free Software Foundation; either version 2, or (at your option)
14535+ any later version.
14536+
14537+ This program is distributed in the hope that it will be useful,
14538+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14539+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14540+ Library General Public License for more details.
14541+
14542+ You should have received a copy of the GNU Library General Public
14543+ License along with this program; if not, write to the Free Software
14544+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
14545+ USA. */
14546+
14547+#ifndef _PLURAL_EXP_H
14548+#define _PLURAL_EXP_H
14549+
14550+#ifndef internal_function
14551+# define internal_function
14552+#endif
14553+
14554+#ifndef attribute_hidden
14555+# define attribute_hidden
14556+#endif
14557+
14558+
14559+/* This is the representation of the expressions to determine the
14560+ plural form. */
14561+struct expression
14562+{
14563+ int nargs; /* Number of arguments. */
14564+ enum operator
14565+ {
14566+ /* Without arguments: */
14567+ var, /* The variable "n". */
14568+ num, /* Decimal number. */
14569+ /* Unary operators: */
14570+ lnot, /* Logical NOT. */
14571+ /* Binary operators: */
14572+ mult, /* Multiplication. */
14573+ divide, /* Division. */
14574+ module, /* Modulo operation. */
14575+ plus, /* Addition. */
14576+ minus, /* Subtraction. */
14577+ less_than, /* Comparison. */
14578+ greater_than, /* Comparison. */
14579+ less_or_equal, /* Comparison. */
14580+ greater_or_equal, /* Comparison. */
14581+ equal, /* Comparison for equality. */
14582+ not_equal, /* Comparison for inequality. */
14583+ land, /* Logical AND. */
14584+ lor, /* Logical OR. */
14585+ /* Ternary operators: */
14586+ qmop /* Question mark operator. */
14587+ } operation;
14588+ union
14589+ {
14590+ unsigned long int num; /* Number value for `num'. */
14591+ struct expression *args[3]; /* Up to three arguments. */
14592+ } val;
14593+};
14594+
14595+/* This is the data structure to pass information to the parser and get
14596+ the result in a thread-safe way. */
14597+struct parse_args
14598+{
14599+ const char *cp;
14600+ struct expression *res;
14601+};
14602+
14603+
14604+/* Names for the libintl functions are a problem. This source code is used
14605+ 1. in the GNU C Library library,
14606+ 2. in the GNU libintl library,
14607+ 3. in the GNU gettext tools.
14608+ The function names in each situation must be different, to allow for
14609+ binary incompatible changes in 'struct expression'. Furthermore,
14610+ 1. in the GNU C Library library, the names have a __ prefix,
14611+ 2.+3. in the GNU libintl library and in the GNU gettext tools, the names
14612+ must follow ANSI C and not start with __.
14613+ So we have to distinguish the three cases. */
14614+#ifdef _LIBC
14615+# define FREE_EXPRESSION __gettext_free_exp
14616+# define PLURAL_PARSE __gettextparse
14617+# define GERMANIC_PLURAL __gettext_germanic_plural
14618+# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
14619+#elif defined (IN_LIBINTL)
14620+# define FREE_EXPRESSION libintl_gettext_free_exp
14621+# define PLURAL_PARSE libintl_gettextparse
14622+# define GERMANIC_PLURAL libintl_gettext_germanic_plural
14623+# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
14624+#else
14625+# define FREE_EXPRESSION free_plural_expression
14626+# define PLURAL_PARSE parse_plural_expression
14627+# define GERMANIC_PLURAL germanic_plural
14628+# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
14629+#endif
14630+
14631+extern void FREE_EXPRESSION (struct expression *exp)
14632+ internal_function;
14633+extern int PLURAL_PARSE (void *arg);
14634+extern struct expression GERMANIC_PLURAL attribute_hidden;
14635+extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
14636+ struct expression **pluralp,
14637+ unsigned long int *npluralsp)
14638+ internal_function;
14639+
14640+#if !defined (_LIBC) && !defined (IN_LIBINTL)
14641+extern unsigned long int plural_eval (struct expression *pexp,
14642+ unsigned long int n);
14643+#endif
14644+
14645+#endif /* _PLURAL_EXP_H */
14646--- lrzsz-0.12.20.safe/intl/plural.y 1969-12-31 19:00:00.000000000 -0500
14647+++ lrzsz-0.12.20/intl/plural.y 2004-09-12 14:40:34.589712520 -0400
14648@@ -0,0 +1,381 @@
14649+%{
14650+/* Expression parsing for plural form selection.
14651+ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
14652+ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
14653+
14654+ This program is free software; you can redistribute it and/or modify it
14655+ under the terms of the GNU Library General Public License as published
14656+ by the Free Software Foundation; either version 2, or (at your option)
14657+ any later version.
14658+
14659+ This program is distributed in the hope that it will be useful,
14660+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14661+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14662+ Library General Public License for more details.
14663+
14664+ You should have received a copy of the GNU Library General Public
14665+ License along with this program; if not, write to the Free Software
14666+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
14667+ USA. */
14668+
14669+/* The bison generated parser uses alloca. AIX 3 forces us to put this
14670+ declaration at the beginning of the file. The declaration in bison's
14671+ skeleton file comes too late. This must come before <config.h>
14672+ because <config.h> may include arbitrary system headers. */
14673+#if defined _AIX && !defined __GNUC__
14674+ #pragma alloca
14675+#endif
14676+
14677+#ifdef HAVE_CONFIG_H
14678+# include <config.h>
14679+#endif
14680+
14681+#include <stddef.h>
14682+#include <stdlib.h>
14683+#include "plural-exp.h"
14684+
14685+/* The main function generated by the parser is called __gettextparse,
14686+ but we want it to be called PLURAL_PARSE. */
14687+#ifndef _LIBC
14688+# define __gettextparse PLURAL_PARSE
14689+#endif
14690+
14691+#define YYLEX_PARAM &((struct parse_args *) arg)->cp
14692+#define YYPARSE_PARAM arg
14693+%}
14694+%pure_parser
14695+%expect 7
14696+
14697+%union {
14698+ unsigned long int num;
14699+ enum operator op;
14700+ struct expression *exp;
14701+}
14702+
14703+%{
14704+/* Prototypes for local functions. */
14705+static int yylex (YYSTYPE *lval, const char **pexp);
14706+static void yyerror (const char *str);
14707+
14708+/* Allocation of expressions. */
14709+
14710+static struct expression *
14711+new_exp (int nargs, enum operator op, struct expression * const *args)
14712+{
14713+ int i;
14714+ struct expression *newp;
14715+
14716+ /* If any of the argument could not be malloc'ed, just return NULL. */
14717+ for (i = nargs - 1; i >= 0; i--)
14718+ if (args[i] == NULL)
14719+ goto fail;
14720+
14721+ /* Allocate a new expression. */
14722+ newp = (struct expression *) malloc (sizeof (*newp));
14723+ if (newp != NULL)
14724+ {
14725+ newp->nargs = nargs;
14726+ newp->operation = op;
14727+ for (i = nargs - 1; i >= 0; i--)
14728+ newp->val.args[i] = args[i];
14729+ return newp;
14730+ }
14731+
14732+ fail:
14733+ for (i = nargs - 1; i >= 0; i--)
14734+ FREE_EXPRESSION (args[i]);
14735+
14736+ return NULL;
14737+}
14738+
14739+static inline struct expression *
14740+new_exp_0 (enum operator op)
14741+{
14742+ return new_exp (0, op, NULL);
14743+}
14744+
14745+static inline struct expression *
14746+new_exp_1 (enum operator op, struct expression *right)
14747+{
14748+ struct expression *args[1];
14749+
14750+ args[0] = right;
14751+ return new_exp (1, op, args);
14752+}
14753+
14754+static struct expression *
14755+new_exp_2 (enum operator op, struct expression *left, struct expression *right)
14756+{
14757+ struct expression *args[2];
14758+
14759+ args[0] = left;
14760+ args[1] = right;
14761+ return new_exp (2, op, args);
14762+}
14763+
14764+static inline struct expression *
14765+new_exp_3 (enum operator op, struct expression *bexp,
14766+ struct expression *tbranch, struct expression *fbranch)
14767+{
14768+ struct expression *args[3];
14769+
14770+ args[0] = bexp;
14771+ args[1] = tbranch;
14772+ args[2] = fbranch;
14773+ return new_exp (3, op, args);
14774+}
14775+
14776+%}
14777+
14778+/* This declares that all operators have the same associativity and the
14779+ precedence order as in C. See [Harbison, Steele: C, A Reference Manual].
14780+ There is no unary minus and no bitwise operators.
14781+ Operators with the same syntactic behaviour have been merged into a single
14782+ token, to save space in the array generated by bison. */
14783+%right '?' /* ? */
14784+%left '|' /* || */
14785+%left '&' /* && */
14786+%left EQUOP2 /* == != */
14787+%left CMPOP2 /* < > <= >= */
14788+%left ADDOP2 /* + - */
14789+%left MULOP2 /* * / % */
14790+%right '!' /* ! */
14791+
14792+%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
14793+%token <num> NUMBER
14794+%type <exp> exp
14795+
14796+%%
14797+
14798+start: exp
14799+ {
14800+ if ($1 == NULL)
14801+ YYABORT;
14802+ ((struct parse_args *) arg)->res = $1;
14803+ }
14804+ ;
14805+
14806+exp: exp '?' exp ':' exp
14807+ {
14808+ $$ = new_exp_3 (qmop, $1, $3, $5);
14809+ }
14810+ | exp '|' exp
14811+ {
14812+ $$ = new_exp_2 (lor, $1, $3);
14813+ }
14814+ | exp '&' exp
14815+ {
14816+ $$ = new_exp_2 (land, $1, $3);
14817+ }
14818+ | exp EQUOP2 exp
14819+ {
14820+ $$ = new_exp_2 ($2, $1, $3);
14821+ }
14822+ | exp CMPOP2 exp
14823+ {
14824+ $$ = new_exp_2 ($2, $1, $3);
14825+ }
14826+ | exp ADDOP2 exp
14827+ {
14828+ $$ = new_exp_2 ($2, $1, $3);
14829+ }
14830+ | exp MULOP2 exp
14831+ {
14832+ $$ = new_exp_2 ($2, $1, $3);
14833+ }
14834+ | '!' exp
14835+ {
14836+ $$ = new_exp_1 (lnot, $2);
14837+ }
14838+ | 'n'
14839+ {
14840+ $$ = new_exp_0 (var);
14841+ }
14842+ | NUMBER
14843+ {
14844+ if (($$ = new_exp_0 (num)) != NULL)
14845+ $$->val.num = $1;
14846+ }
14847+ | '(' exp ')'
14848+ {
14849+ $$ = $2;
14850+ }
14851+ ;
14852+
14853+%%
14854+
14855+void
14856+internal_function
14857+FREE_EXPRESSION (struct expression *exp)
14858+{
14859+ if (exp == NULL)
14860+ return;
14861+
14862+ /* Handle the recursive case. */
14863+ switch (exp->nargs)
14864+ {
14865+ case 3:
14866+ FREE_EXPRESSION (exp->val.args[2]);
14867+ /* FALLTHROUGH */
14868+ case 2:
14869+ FREE_EXPRESSION (exp->val.args[1]);
14870+ /* FALLTHROUGH */
14871+ case 1:
14872+ FREE_EXPRESSION (exp->val.args[0]);
14873+ /* FALLTHROUGH */
14874+ default:
14875+ break;
14876+ }
14877+
14878+ free (exp);
14879+}
14880+
14881+
14882+static int
14883+yylex (YYSTYPE *lval, const char **pexp)
14884+{
14885+ const char *exp = *pexp;
14886+ int result;
14887+
14888+ while (1)
14889+ {
14890+ if (exp[0] == '\0')
14891+ {
14892+ *pexp = exp;
14893+ return YYEOF;
14894+ }
14895+
14896+ if (exp[0] != ' ' && exp[0] != '\t')
14897+ break;
14898+
14899+ ++exp;
14900+ }
14901+
14902+ result = *exp++;
14903+ switch (result)
14904+ {
14905+ case '0': case '1': case '2': case '3': case '4':
14906+ case '5': case '6': case '7': case '8': case '9':
14907+ {
14908+ unsigned long int n = result - '0';
14909+ while (exp[0] >= '0' && exp[0] <= '9')
14910+ {
14911+ n *= 10;
14912+ n += exp[0] - '0';
14913+ ++exp;
14914+ }
14915+ lval->num = n;
14916+ result = NUMBER;
14917+ }
14918+ break;
14919+
14920+ case '=':
14921+ if (exp[0] == '=')
14922+ {
14923+ ++exp;
14924+ lval->op = equal;
14925+ result = EQUOP2;
14926+ }
14927+ else
14928+ result = YYERRCODE;
14929+ break;
14930+
14931+ case '!':
14932+ if (exp[0] == '=')
14933+ {
14934+ ++exp;
14935+ lval->op = not_equal;
14936+ result = EQUOP2;
14937+ }
14938+ break;
14939+
14940+ case '&':
14941+ case '|':
14942+ if (exp[0] == result)
14943+ ++exp;
14944+ else
14945+ result = YYERRCODE;
14946+ break;
14947+
14948+ case '<':
14949+ if (exp[0] == '=')
14950+ {
14951+ ++exp;
14952+ lval->op = less_or_equal;
14953+ }
14954+ else
14955+ lval->op = less_than;
14956+ result = CMPOP2;
14957+ break;
14958+
14959+ case '>':
14960+ if (exp[0] == '=')
14961+ {
14962+ ++exp;
14963+ lval->op = greater_or_equal;
14964+ }
14965+ else
14966+ lval->op = greater_than;
14967+ result = CMPOP2;
14968+ break;
14969+
14970+ case '*':
14971+ lval->op = mult;
14972+ result = MULOP2;
14973+ break;
14974+
14975+ case '/':
14976+ lval->op = divide;
14977+ result = MULOP2;
14978+ break;
14979+
14980+ case '%':
14981+ lval->op = module;
14982+ result = MULOP2;
14983+ break;
14984+
14985+ case '+':
14986+ lval->op = plus;
14987+ result = ADDOP2;
14988+ break;
14989+
14990+ case '-':
14991+ lval->op = minus;
14992+ result = ADDOP2;
14993+ break;
14994+
14995+ case 'n':
14996+ case '?':
14997+ case ':':
14998+ case '(':
14999+ case ')':
15000+ /* Nothing, just return the character. */
15001+ break;
15002+
15003+ case ';':
15004+ case '\n':
15005+ case '\0':
15006+ /* Be safe and let the user call this function again. */
15007+ --exp;
15008+ result = YYEOF;
15009+ break;
15010+
15011+ default:
15012+ result = YYERRCODE;
15013+#if YYDEBUG != 0
15014+ --exp;
15015+#endif
15016+ break;
15017+ }
15018+
15019+ *pexp = exp;
15020+
15021+ return result;
15022+}
15023+
15024+
15025+static void
15026+yyerror (const char *str)
15027+{
15028+ /* Do nothing. We don't print error messages here. */
15029+}
15030--- lrzsz-0.12.20.safe/intl/po2tbl.sed.in 1998-04-26 09:20:52.000000000 -0400
15031+++ lrzsz-0.12.20/intl/po2tbl.sed.in 1969-12-31 19:00:00.000000000 -0500
15032@@ -1,102 +0,0 @@
15033-# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
15034-# Copyright (C) 1995 Free Software Foundation, Inc.
15035-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
15036-#
15037-# This program is free software; you can redistribute it and/or modify
15038-# it under the terms of the GNU General Public License as published by
15039-# the Free Software Foundation; either version 2, or (at your option)
15040-# any later version.
15041-#
15042-# This program is distributed in the hope that it will be useful,
15043-# but WITHOUT ANY WARRANTY; without even the implied warranty of
15044-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15045-# GNU General Public License for more details.
15046-#
15047-# You should have received a copy of the GNU General Public License
15048-# along with this program; if not, write to the Free Software
15049-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15050-#
15051-1 {
15052- i\
15053-/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
15054-\
15055-#if HAVE_CONFIG_H\
15056-# include <config.h>\
15057-#endif\
15058-\
15059-#include "libgettext.h"\
15060-\
15061-const struct _msg_ent _msg_tbl[] = {
15062- h
15063- s/.*/0/
15064- x
15065-}
15066-#
15067-# Write msgid entries in C array form.
15068-#
15069-/^msgid/ {
15070- s/msgid[ ]*\(".*"\)/ {\1/
15071- tb
15072-# Append the next line
15073- :b
15074- N
15075-# Look whether second part is continuation line.
15076- s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
15077-# Yes, then branch.
15078- ta
15079-# Because we assume that the input file correctly formed the line
15080-# just read cannot be again be a msgid line. So it's safe to ignore
15081-# it.
15082- s/\(.*\)\n.*/\1/
15083- bc
15084-# We found a continuation line. But before printing insert '\'.
15085- :a
15086- s/\(.*\)\(\n.*\)/\1\\\2/
15087- P
15088-# We cannot use D here.
15089- s/.*\n\(.*\)/\1/
15090-# Some buggy seds do not clear the `successful substitution since last ``t'''
15091-# flag on `N', so we do a `t' here to clear it.
15092- tb
15093-# Not reached
15094- :c
15095- x
15096-# The following nice solution is by
15097-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
15098- td
15099-# Increment a decimal number in pattern space.
15100-# First hide trailing `9' digits.
15101- :d
15102- s/9\(_*\)$/_\1/
15103- td
15104-# Assure at least one digit is available.
15105- s/^\(_*\)$/0\1/
15106-# Increment the last digit.
15107- s/8\(_*\)$/9\1/
15108- s/7\(_*\)$/8\1/
15109- s/6\(_*\)$/7\1/
15110- s/5\(_*\)$/6\1/
15111- s/4\(_*\)$/5\1/
15112- s/3\(_*\)$/4\1/
15113- s/2\(_*\)$/3\1/
15114- s/1\(_*\)$/2\1/
15115- s/0\(_*\)$/1\1/
15116-# Convert the hidden `9' digits to `0's.
15117- s/_/0/g
15118- x
15119- G
15120- s/\(.*\)\n\([0-9]*\)/\1, \2},/
15121- s/\(.*\)"$/\1/
15122- p
15123-}
15124-#
15125-# Last line.
15126-#
15127-$ {
15128- i\
15129-};\
15130-
15131- g
15132- s/0*\(.*\)/int _msg_tbl_length = \1;/p
15133-}
15134-d
15135--- lrzsz-0.12.20.safe/intl/printf-args.c 1969-12-31 19:00:00.000000000 -0500
15136+++ lrzsz-0.12.20/intl/printf-args.c 2004-09-12 14:40:34.595711608 -0400
15137@@ -0,0 +1,119 @@
15138+/* Decomposed printf argument list.
15139+ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
15140+
15141+ This program is free software; you can redistribute it and/or modify it
15142+ under the terms of the GNU Library General Public License as published
15143+ by the Free Software Foundation; either version 2, or (at your option)
15144+ any later version.
15145+
15146+ This program is distributed in the hope that it will be useful,
15147+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15148+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15149+ Library General Public License for more details.
15150+
15151+ You should have received a copy of the GNU Library General Public
15152+ License along with this program; if not, write to the Free Software
15153+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
15154+ USA. */
15155+
15156+#ifdef HAVE_CONFIG_H
15157+# include <config.h>
15158+#endif
15159+
15160+/* Specification. */
15161+#include "printf-args.h"
15162+
15163+#ifdef STATIC
15164+STATIC
15165+#endif
15166+int
15167+printf_fetchargs (va_list args, arguments *a)
15168+{
15169+ size_t i;
15170+ argument *ap;
15171+
15172+ for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
15173+ switch (ap->type)
15174+ {
15175+ case TYPE_SCHAR:
15176+ ap->a.a_schar = va_arg (args, /*signed char*/ int);
15177+ break;
15178+ case TYPE_UCHAR:
15179+ ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
15180+ break;
15181+ case TYPE_SHORT:
15182+ ap->a.a_short = va_arg (args, /*short*/ int);
15183+ break;
15184+ case TYPE_USHORT:
15185+ ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
15186+ break;
15187+ case TYPE_INT:
15188+ ap->a.a_int = va_arg (args, int);
15189+ break;
15190+ case TYPE_UINT:
15191+ ap->a.a_uint = va_arg (args, unsigned int);
15192+ break;
15193+ case TYPE_LONGINT:
15194+ ap->a.a_longint = va_arg (args, long int);
15195+ break;
15196+ case TYPE_ULONGINT:
15197+ ap->a.a_ulongint = va_arg (args, unsigned long int);
15198+ break;
15199+#ifdef HAVE_LONG_LONG
15200+ case TYPE_LONGLONGINT:
15201+ ap->a.a_longlongint = va_arg (args, long long int);
15202+ break;
15203+ case TYPE_ULONGLONGINT:
15204+ ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
15205+ break;
15206+#endif
15207+ case TYPE_DOUBLE:
15208+ ap->a.a_double = va_arg (args, double);
15209+ break;
15210+#ifdef HAVE_LONG_DOUBLE
15211+ case TYPE_LONGDOUBLE:
15212+ ap->a.a_longdouble = va_arg (args, long double);
15213+ break;
15214+#endif
15215+ case TYPE_CHAR:
15216+ ap->a.a_char = va_arg (args, int);
15217+ break;
15218+#ifdef HAVE_WINT_T
15219+ case TYPE_WIDE_CHAR:
15220+ ap->a.a_wide_char = va_arg (args, wint_t);
15221+ break;
15222+#endif
15223+ case TYPE_STRING:
15224+ ap->a.a_string = va_arg (args, const char *);
15225+ break;
15226+#ifdef HAVE_WCHAR_T
15227+ case TYPE_WIDE_STRING:
15228+ ap->a.a_wide_string = va_arg (args, const wchar_t *);
15229+ break;
15230+#endif
15231+ case TYPE_POINTER:
15232+ ap->a.a_pointer = va_arg (args, void *);
15233+ break;
15234+ case TYPE_COUNT_SCHAR_POINTER:
15235+ ap->a.a_count_schar_pointer = va_arg (args, signed char *);
15236+ break;
15237+ case TYPE_COUNT_SHORT_POINTER:
15238+ ap->a.a_count_short_pointer = va_arg (args, short *);
15239+ break;
15240+ case TYPE_COUNT_INT_POINTER:
15241+ ap->a.a_count_int_pointer = va_arg (args, int *);
15242+ break;
15243+ case TYPE_COUNT_LONGINT_POINTER:
15244+ ap->a.a_count_longint_pointer = va_arg (args, long int *);
15245+ break;
15246+#ifdef HAVE_LONG_LONG
15247+ case TYPE_COUNT_LONGLONGINT_POINTER:
15248+ ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
15249+ break;
15250+#endif
15251+ default:
15252+ /* Unknown type. */
15253+ return -1;
15254+ }
15255+ return 0;
15256+}
15257--- lrzsz-0.12.20.safe/intl/printf-args.h 1969-12-31 19:00:00.000000000 -0500
15258+++ lrzsz-0.12.20/intl/printf-args.h 2004-09-12 14:40:34.601710696 -0400
15259@@ -0,0 +1,137 @@
15260+/* Decomposed printf argument list.
15261+ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
15262+
15263+ This program is free software; you can redistribute it and/or modify it
15264+ under the terms of the GNU Library General Public License as published
15265+ by the Free Software Foundation; either version 2, or (at your option)
15266+ any later version.
15267+
15268+ This program is distributed in the hope that it will be useful,
15269+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15270+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15271+ Library General Public License for more details.
15272+
15273+ You should have received a copy of the GNU Library General Public
15274+ License along with this program; if not, write to the Free Software
15275+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
15276+ USA. */
15277+
15278+#ifndef _PRINTF_ARGS_H
15279+#define _PRINTF_ARGS_H
15280+
15281+/* Get size_t. */
15282+#include <stddef.h>
15283+
15284+/* Get wchar_t. */
15285+#ifdef HAVE_WCHAR_T
15286+# include <stddef.h>
15287+#endif
15288+
15289+/* Get wint_t. */
15290+#ifdef HAVE_WINT_T
15291+# include <wchar.h>
15292+#endif
15293+
15294+/* Get va_list. */
15295+#include <stdarg.h>
15296+
15297+
15298+/* Argument types */
15299+typedef enum
15300+{
15301+ TYPE_NONE,
15302+ TYPE_SCHAR,
15303+ TYPE_UCHAR,
15304+ TYPE_SHORT,
15305+ TYPE_USHORT,
15306+ TYPE_INT,
15307+ TYPE_UINT,
15308+ TYPE_LONGINT,
15309+ TYPE_ULONGINT,
15310+#ifdef HAVE_LONG_LONG
15311+ TYPE_LONGLONGINT,
15312+ TYPE_ULONGLONGINT,
15313+#endif
15314+ TYPE_DOUBLE,
15315+#ifdef HAVE_LONG_DOUBLE
15316+ TYPE_LONGDOUBLE,
15317+#endif
15318+ TYPE_CHAR,
15319+#ifdef HAVE_WINT_T
15320+ TYPE_WIDE_CHAR,
15321+#endif
15322+ TYPE_STRING,
15323+#ifdef HAVE_WCHAR_T
15324+ TYPE_WIDE_STRING,
15325+#endif
15326+ TYPE_POINTER,
15327+ TYPE_COUNT_SCHAR_POINTER,
15328+ TYPE_COUNT_SHORT_POINTER,
15329+ TYPE_COUNT_INT_POINTER,
15330+ TYPE_COUNT_LONGINT_POINTER
15331+#ifdef HAVE_LONG_LONG
15332+, TYPE_COUNT_LONGLONGINT_POINTER
15333+#endif
15334+} arg_type;
15335+
15336+/* Polymorphic argument */
15337+typedef struct
15338+{
15339+ arg_type type;
15340+ union
15341+ {
15342+ signed char a_schar;
15343+ unsigned char a_uchar;
15344+ short a_short;
15345+ unsigned short a_ushort;
15346+ int a_int;
15347+ unsigned int a_uint;
15348+ long int a_longint;
15349+ unsigned long int a_ulongint;
15350+#ifdef HAVE_LONG_LONG
15351+ long long int a_longlongint;
15352+ unsigned long long int a_ulonglongint;
15353+#endif
15354+ float a_float;
15355+ double a_double;
15356+#ifdef HAVE_LONG_DOUBLE
15357+ long double a_longdouble;
15358+#endif
15359+ int a_char;
15360+#ifdef HAVE_WINT_T
15361+ wint_t a_wide_char;
15362+#endif
15363+ const char* a_string;
15364+#ifdef HAVE_WCHAR_T
15365+ const wchar_t* a_wide_string;
15366+#endif
15367+ void* a_pointer;
15368+ signed char * a_count_schar_pointer;
15369+ short * a_count_short_pointer;
15370+ int * a_count_int_pointer;
15371+ long int * a_count_longint_pointer;
15372+#ifdef HAVE_LONG_LONG
15373+ long long int * a_count_longlongint_pointer;
15374+#endif
15375+ }
15376+ a;
15377+}
15378+argument;
15379+
15380+typedef struct
15381+{
15382+ size_t count;
15383+ argument *arg;
15384+}
15385+arguments;
15386+
15387+
15388+/* Fetch the arguments, putting them into a. */
15389+#ifdef STATIC
15390+STATIC
15391+#else
15392+extern
15393+#endif
15394+int printf_fetchargs (va_list args, arguments *a);
15395+
15396+#endif /* _PRINTF_ARGS_H */
15397--- lrzsz-0.12.20.safe/intl/printf.c 1969-12-31 19:00:00.000000000 -0500
15398+++ lrzsz-0.12.20/intl/printf.c 2004-09-12 14:40:34.607709784 -0400
15399@@ -0,0 +1,371 @@
15400+/* Formatted output to strings, using POSIX/XSI format strings with positions.
15401+ Copyright (C) 2003 Free Software Foundation, Inc.
15402+ Written by Bruno Haible <bruno@clisp.org>, 2003.
15403+
15404+ This program is free software; you can redistribute it and/or modify it
15405+ under the terms of the GNU Library General Public License as published
15406+ by the Free Software Foundation; either version 2, or (at your option)
15407+ any later version.
15408+
15409+ This program is distributed in the hope that it will be useful,
15410+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15411+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15412+ Library General Public License for more details.
15413+
15414+ You should have received a copy of the GNU Library General Public
15415+ License along with this program; if not, write to the Free Software
15416+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
15417+ USA. */
15418+
15419+#ifdef HAVE_CONFIG_H
15420+# include <config.h>
15421+#endif
15422+
15423+#ifdef __GNUC__
15424+# define alloca __builtin_alloca
15425+# define HAVE_ALLOCA 1
15426+#else
15427+# ifdef _MSC_VER
15428+# include <malloc.h>
15429+# define alloca _alloca
15430+# else
15431+# if defined HAVE_ALLOCA_H || defined _LIBC
15432+# include <alloca.h>
15433+# else
15434+# ifdef _AIX
15435+ #pragma alloca
15436+# else
15437+# ifndef alloca
15438+char *alloca ();
15439+# endif
15440+# endif
15441+# endif
15442+# endif
15443+#endif
15444+
15445+#include <stdio.h>
15446+
15447+#if !HAVE_POSIX_PRINTF
15448+
15449+#include <stdlib.h>
15450+#include <string.h>
15451+
15452+/* When building a DLL, we must export some functions. Note that because
15453+ the functions are only defined for binary backward compatibility, we
15454+ don't need to use __declspec(dllimport) in any case. */
15455+#if defined _MSC_VER && BUILDING_DLL
15456+# define DLL_EXPORTED __declspec(dllexport)
15457+#else
15458+# define DLL_EXPORTED
15459+#endif
15460+
15461+#define STATIC static
15462+
15463+/* Define auxiliary functions declared in "printf-args.h". */
15464+#include "printf-args.c"
15465+
15466+/* Define auxiliary functions declared in "printf-parse.h". */
15467+#include "printf-parse.c"
15468+
15469+/* Define functions declared in "vasnprintf.h". */
15470+#define vasnprintf libintl_vasnprintf
15471+#include "vasnprintf.c"
15472+#if 0 /* not needed */
15473+#define asnprintf libintl_asnprintf
15474+#include "asnprintf.c"
15475+#endif
15476+
15477+DLL_EXPORTED
15478+int
15479+libintl_vfprintf (FILE *stream, const char *format, va_list args)
15480+{
15481+ if (strchr (format, '$') == NULL)
15482+ return vfprintf (stream, format, args);
15483+ else
15484+ {
15485+ size_t length;
15486+ char *result = libintl_vasnprintf (NULL, &length, format, args);
15487+ int retval = -1;
15488+ if (result != NULL)
15489+ {
15490+ if (fwrite (result, 1, length, stream) == length)
15491+ retval = length;
15492+ free (result);
15493+ }
15494+ return retval;
15495+ }
15496+}
15497+
15498+DLL_EXPORTED
15499+int
15500+libintl_fprintf (FILE *stream, const char *format, ...)
15501+{
15502+ va_list args;
15503+ int retval;
15504+
15505+ va_start (args, format);
15506+ retval = libintl_vfprintf (stream, format, args);
15507+ va_end (args);
15508+ return retval;
15509+}
15510+
15511+DLL_EXPORTED
15512+int
15513+libintl_vprintf (const char *format, va_list args)
15514+{
15515+ return libintl_vfprintf (stdout, format, args);
15516+}
15517+
15518+DLL_EXPORTED
15519+int
15520+libintl_printf (const char *format, ...)
15521+{
15522+ va_list args;
15523+ int retval;
15524+
15525+ va_start (args, format);
15526+ retval = libintl_vprintf (format, args);
15527+ va_end (args);
15528+ return retval;
15529+}
15530+
15531+DLL_EXPORTED
15532+int
15533+libintl_vsprintf (char *resultbuf, const char *format, va_list args)
15534+{
15535+ if (strchr (format, '$') == NULL)
15536+ return vsprintf (resultbuf, format, args);
15537+ else
15538+ {
15539+ size_t length = (size_t) ~0 / (4 * sizeof (char));
15540+ char *result = libintl_vasnprintf (resultbuf, &length, format, args);
15541+ if (result != resultbuf)
15542+ {
15543+ free (result);
15544+ return -1;
15545+ }
15546+ else
15547+ return length;
15548+ }
15549+}
15550+
15551+DLL_EXPORTED
15552+int
15553+libintl_sprintf (char *resultbuf, const char *format, ...)
15554+{
15555+ va_list args;
15556+ int retval;
15557+
15558+ va_start (args, format);
15559+ retval = libintl_vsprintf (resultbuf, format, args);
15560+ va_end (args);
15561+ return retval;
15562+}
15563+
15564+#if HAVE_SNPRINTF
15565+
15566+# if HAVE_DECL__SNPRINTF
15567+ /* Windows. */
15568+# define system_vsnprintf _vsnprintf
15569+# else
15570+ /* Unix. */
15571+# define system_vsnprintf vsnprintf
15572+# endif
15573+
15574+DLL_EXPORTED
15575+int
15576+libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list args)
15577+{
15578+ if (strchr (format, '$') == NULL)
15579+ return system_vsnprintf (resultbuf, length, format, args);
15580+ else
15581+ {
15582+ size_t maxlength = length;
15583+ char *result = libintl_vasnprintf (resultbuf, &length, format, args);
15584+ if (result != resultbuf)
15585+ {
15586+ if (maxlength > 0)
15587+ {
15588+ if (length < maxlength)
15589+ abort ();
15590+ memcpy (resultbuf, result, maxlength - 1);
15591+ resultbuf[maxlength - 1] = '\0';
15592+ }
15593+ free (result);
15594+ return -1;
15595+ }
15596+ else
15597+ return length;
15598+ }
15599+}
15600+
15601+DLL_EXPORTED
15602+int
15603+libintl_snprintf (char *resultbuf, size_t length, const char *format, ...)
15604+{
15605+ va_list args;
15606+ int retval;
15607+
15608+ va_start (args, format);
15609+ retval = libintl_vsnprintf (resultbuf, length, format, args);
15610+ va_end (args);
15611+ return retval;
15612+}
15613+
15614+#endif
15615+
15616+#if HAVE_ASPRINTF
15617+
15618+DLL_EXPORTED
15619+int
15620+libintl_vasprintf (char **resultp, const char *format, va_list args)
15621+{
15622+ size_t length;
15623+ char *result = libintl_vasnprintf (NULL, &length, format, args);
15624+ if (result == NULL)
15625+ return -1;
15626+ *resultp = result;
15627+ return length;
15628+}
15629+
15630+DLL_EXPORTED
15631+int
15632+libintl_asprintf (char **resultp, const char *format, ...)
15633+{
15634+ va_list args;
15635+ int retval;
15636+
15637+ va_start (args, format);
15638+ retval = libintl_vasprintf (resultp, format, args);
15639+ va_end (args);
15640+ return retval;
15641+}
15642+
15643+#endif
15644+
15645+#if HAVE_FWPRINTF
15646+
15647+#include <wchar.h>
15648+
15649+#define WIDE_CHAR_VERSION 1
15650+
15651+/* Define auxiliary functions declared in "wprintf-parse.h". */
15652+#include "printf-parse.c"
15653+
15654+/* Define functions declared in "vasnprintf.h". */
15655+#define vasnwprintf libintl_vasnwprintf
15656+#include "vasnprintf.c"
15657+#if 0 /* not needed */
15658+#define asnwprintf libintl_asnwprintf
15659+#include "asnprintf.c"
15660+#endif
15661+
15662+# if HAVE_DECL__SNWPRINTF
15663+ /* Windows. */
15664+# define system_vswprintf _vsnwprintf
15665+# else
15666+ /* Unix. */
15667+# define system_vswprintf vswprintf
15668+# endif
15669+
15670+DLL_EXPORTED
15671+int
15672+libintl_vfwprintf (FILE *stream, const wchar_t *format, va_list args)
15673+{
15674+ if (wcschr (format, '$') == NULL)
15675+ return vfwprintf (stream, format, args);
15676+ else
15677+ {
15678+ size_t length;
15679+ wchar_t *result = libintl_vasnwprintf (NULL, &length, format, args);
15680+ int retval = -1;
15681+ if (result != NULL)
15682+ {
15683+ size_t i;
15684+ for (i = 0; i < length; i++)
15685+ if (fputwc (result[i], stream) == WEOF)
15686+ break;
15687+ if (i == length)
15688+ retval = length;
15689+ free (result);
15690+ }
15691+ return retval;
15692+ }
15693+}
15694+
15695+DLL_EXPORTED
15696+int
15697+libintl_fwprintf (FILE *stream, const wchar_t *format, ...)
15698+{
15699+ va_list args;
15700+ int retval;
15701+
15702+ va_start (args, format);
15703+ retval = libintl_vfwprintf (stream, format, args);
15704+ va_end (args);
15705+ return retval;
15706+}
15707+
15708+DLL_EXPORTED
15709+int
15710+libintl_vwprintf (const wchar_t *format, va_list args)
15711+{
15712+ return libintl_vfwprintf (stdout, format, args);
15713+}
15714+
15715+DLL_EXPORTED
15716+int
15717+libintl_wprintf (const wchar_t *format, ...)
15718+{
15719+ va_list args;
15720+ int retval;
15721+
15722+ va_start (args, format);
15723+ retval = libintl_vwprintf (format, args);
15724+ va_end (args);
15725+ return retval;
15726+}
15727+
15728+DLL_EXPORTED
15729+int
15730+libintl_vswprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, va_list args)
15731+{
15732+ if (wcschr (format, '$') == NULL)
15733+ return system_vswprintf (resultbuf, length, format, args);
15734+ else
15735+ {
15736+ size_t maxlength = length;
15737+ wchar_t *result = libintl_vasnwprintf (resultbuf, &length, format, args);
15738+ if (result != resultbuf)
15739+ {
15740+ if (maxlength > 0)
15741+ {
15742+ if (length < maxlength)
15743+ abort ();
15744+ memcpy (resultbuf, result, (maxlength - 1) * sizeof (wchar_t));
15745+ resultbuf[maxlength - 1] = 0;
15746+ }
15747+ free (result);
15748+ return -1;
15749+ }
15750+ else
15751+ return length;
15752+ }
15753+}
15754+
15755+DLL_EXPORTED
15756+int
15757+libintl_swprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, ...)
15758+{
15759+ va_list args;
15760+ int retval;
15761+
15762+ va_start (args, format);
15763+ retval = libintl_vswprintf (resultbuf, length, format, args);
15764+ va_end (args);
15765+ return retval;
15766+}
15767+
15768+#endif
15769+
15770+#endif
15771--- lrzsz-0.12.20.safe/intl/printf-parse.c 1969-12-31 19:00:00.000000000 -0500
15772+++ lrzsz-0.12.20/intl/printf-parse.c 2004-09-12 14:40:34.622707504 -0400
15773@@ -0,0 +1,537 @@
15774+/* Formatted output to strings.
15775+ Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc.
15776+
15777+ This program is free software; you can redistribute it and/or modify it
15778+ under the terms of the GNU Library General Public License as published
15779+ by the Free Software Foundation; either version 2, or (at your option)
15780+ any later version.
15781+
15782+ This program is distributed in the hope that it will be useful,
15783+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15784+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15785+ Library General Public License for more details.
15786+
15787+ You should have received a copy of the GNU Library General Public
15788+ License along with this program; if not, write to the Free Software
15789+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
15790+ USA. */
15791+
15792+#ifdef HAVE_CONFIG_H
15793+# include <config.h>
15794+#endif
15795+
15796+/* Specification. */
15797+#if WIDE_CHAR_VERSION
15798+# include "wprintf-parse.h"
15799+#else
15800+# include "printf-parse.h"
15801+#endif
15802+
15803+/* Get size_t, NULL. */
15804+#include <stddef.h>
15805+
15806+/* Get intmax_t. */
15807+#if HAVE_STDINT_H_WITH_UINTMAX
15808+# include <stdint.h>
15809+#endif
15810+#if HAVE_INTTYPES_H_WITH_UINTMAX
15811+# include <inttypes.h>
15812+#endif
15813+
15814+/* malloc(), realloc(), free(). */
15815+#include <stdlib.h>
15816+
15817+/* Checked size_t computations. */
15818+#include "xsize.h"
15819+
15820+#if WIDE_CHAR_VERSION
15821+# define PRINTF_PARSE wprintf_parse
15822+# define CHAR_T wchar_t
15823+# define DIRECTIVE wchar_t_directive
15824+# define DIRECTIVES wchar_t_directives
15825+#else
15826+# define PRINTF_PARSE printf_parse
15827+# define CHAR_T char
15828+# define DIRECTIVE char_directive
15829+# define DIRECTIVES char_directives
15830+#endif
15831+
15832+#ifdef STATIC
15833+STATIC
15834+#endif
15835+int
15836+PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
15837+{
15838+ const CHAR_T *cp = format; /* pointer into format */
15839+ size_t arg_posn = 0; /* number of regular arguments consumed */
15840+ size_t d_allocated; /* allocated elements of d->dir */
15841+ size_t a_allocated; /* allocated elements of a->arg */
15842+ size_t max_width_length = 0;
15843+ size_t max_precision_length = 0;
15844+
15845+ d->count = 0;
15846+ d_allocated = 1;
15847+ d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
15848+ if (d->dir == NULL)
15849+ /* Out of memory. */
15850+ return -1;
15851+
15852+ a->count = 0;
15853+ a_allocated = 0;
15854+ a->arg = NULL;
15855+
15856+#define REGISTER_ARG(_index_,_type_) \
15857+ { \
15858+ size_t n = (_index_); \
15859+ if (n >= a_allocated) \
15860+ { \
15861+ size_t memory_size; \
15862+ argument *memory; \
15863+ \
15864+ a_allocated = xtimes (a_allocated, 2); \
15865+ if (a_allocated <= n) \
15866+ a_allocated = xsum (n, 1); \
15867+ memory_size = xtimes (a_allocated, sizeof (argument)); \
15868+ if (size_overflow_p (memory_size)) \
15869+ /* Overflow, would lead to out of memory. */ \
15870+ goto error; \
15871+ memory = (a->arg \
15872+ ? realloc (a->arg, memory_size) \
15873+ : malloc (memory_size)); \
15874+ if (memory == NULL) \
15875+ /* Out of memory. */ \
15876+ goto error; \
15877+ a->arg = memory; \
15878+ } \
15879+ while (a->count <= n) \
15880+ a->arg[a->count++].type = TYPE_NONE; \
15881+ if (a->arg[n].type == TYPE_NONE) \
15882+ a->arg[n].type = (_type_); \
15883+ else if (a->arg[n].type != (_type_)) \
15884+ /* Ambiguous type for positional argument. */ \
15885+ goto error; \
15886+ }
15887+
15888+ while (*cp != '\0')
15889+ {
15890+ CHAR_T c = *cp++;
15891+ if (c == '%')
15892+ {
15893+ size_t arg_index = ARG_NONE;
15894+ DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
15895+
15896+ /* Initialize the next directive. */
15897+ dp->dir_start = cp - 1;
15898+ dp->flags = 0;
15899+ dp->width_start = NULL;
15900+ dp->width_end = NULL;
15901+ dp->width_arg_index = ARG_NONE;
15902+ dp->precision_start = NULL;
15903+ dp->precision_end = NULL;
15904+ dp->precision_arg_index = ARG_NONE;
15905+ dp->arg_index = ARG_NONE;
15906+
15907+ /* Test for positional argument. */
15908+ if (*cp >= '0' && *cp <= '9')
15909+ {
15910+ const CHAR_T *np;
15911+
15912+ for (np = cp; *np >= '0' && *np <= '9'; np++)
15913+ ;
15914+ if (*np == '$')
15915+ {
15916+ size_t n = 0;
15917+
15918+ for (np = cp; *np >= '0' && *np <= '9'; np++)
15919+ n = xsum (xtimes (n, 10), *np - '0');
15920+ if (n == 0)
15921+ /* Positional argument 0. */
15922+ goto error;
15923+ if (size_overflow_p (n))
15924+ /* n too large, would lead to out of memory later. */
15925+ goto error;
15926+ arg_index = n - 1;
15927+ cp = np + 1;
15928+ }
15929+ }
15930+
15931+ /* Read the flags. */
15932+ for (;;)
15933+ {
15934+ if (*cp == '\'')
15935+ {
15936+ dp->flags |= FLAG_GROUP;
15937+ cp++;
15938+ }
15939+ else if (*cp == '-')
15940+ {
15941+ dp->flags |= FLAG_LEFT;
15942+ cp++;
15943+ }
15944+ else if (*cp == '+')
15945+ {
15946+ dp->flags |= FLAG_SHOWSIGN;
15947+ cp++;
15948+ }
15949+ else if (*cp == ' ')
15950+ {
15951+ dp->flags |= FLAG_SPACE;
15952+ cp++;
15953+ }
15954+ else if (*cp == '#')
15955+ {
15956+ dp->flags |= FLAG_ALT;
15957+ cp++;
15958+ }
15959+ else if (*cp == '0')
15960+ {
15961+ dp->flags |= FLAG_ZERO;
15962+ cp++;
15963+ }
15964+ else
15965+ break;
15966+ }
15967+
15968+ /* Parse the field width. */
15969+ if (*cp == '*')
15970+ {
15971+ dp->width_start = cp;
15972+ cp++;
15973+ dp->width_end = cp;
15974+ if (max_width_length < 1)
15975+ max_width_length = 1;
15976+
15977+ /* Test for positional argument. */
15978+ if (*cp >= '0' && *cp <= '9')
15979+ {
15980+ const CHAR_T *np;
15981+
15982+ for (np = cp; *np >= '0' && *np <= '9'; np++)
15983+ ;
15984+ if (*np == '$')
15985+ {
15986+ size_t n = 0;
15987+
15988+ for (np = cp; *np >= '0' && *np <= '9'; np++)
15989+ n = xsum (xtimes (n, 10), *np - '0');
15990+ if (n == 0)
15991+ /* Positional argument 0. */
15992+ goto error;
15993+ if (size_overflow_p (n))
15994+ /* n too large, would lead to out of memory later. */
15995+ goto error;
15996+ dp->width_arg_index = n - 1;
15997+ cp = np + 1;
15998+ }
15999+ }
16000+ if (dp->width_arg_index == ARG_NONE)
16001+ {
16002+ dp->width_arg_index = arg_posn++;
16003+ if (dp->width_arg_index == ARG_NONE)
16004+ /* arg_posn wrapped around. */
16005+ goto error;
16006+ }
16007+ REGISTER_ARG (dp->width_arg_index, TYPE_INT);
16008+ }
16009+ else if (*cp >= '0' && *cp <= '9')
16010+ {
16011+ size_t width_length;
16012+
16013+ dp->width_start = cp;
16014+ for (; *cp >= '0' && *cp <= '9'; cp++)
16015+ ;
16016+ dp->width_end = cp;
16017+ width_length = dp->width_end - dp->width_start;
16018+ if (max_width_length < width_length)
16019+ max_width_length = width_length;
16020+ }
16021+
16022+ /* Parse the precision. */
16023+ if (*cp == '.')
16024+ {
16025+ cp++;
16026+ if (*cp == '*')
16027+ {
16028+ dp->precision_start = cp - 1;
16029+ cp++;
16030+ dp->precision_end = cp;
16031+ if (max_precision_length < 2)
16032+ max_precision_length = 2;
16033+
16034+ /* Test for positional argument. */
16035+ if (*cp >= '0' && *cp <= '9')
16036+ {
16037+ const CHAR_T *np;
16038+
16039+ for (np = cp; *np >= '0' && *np <= '9'; np++)
16040+ ;
16041+ if (*np == '$')
16042+ {
16043+ size_t n = 0;
16044+
16045+ for (np = cp; *np >= '0' && *np <= '9'; np++)
16046+ n = xsum (xtimes (n, 10), *np - '0');
16047+ if (n == 0)
16048+ /* Positional argument 0. */
16049+ goto error;
16050+ if (size_overflow_p (n))
16051+ /* n too large, would lead to out of memory
16052+ later. */
16053+ goto error;
16054+ dp->precision_arg_index = n - 1;
16055+ cp = np + 1;
16056+ }
16057+ }
16058+ if (dp->precision_arg_index == ARG_NONE)
16059+ {
16060+ dp->precision_arg_index = arg_posn++;
16061+ if (dp->precision_arg_index == ARG_NONE)
16062+ /* arg_posn wrapped around. */
16063+ goto error;
16064+ }
16065+ REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
16066+ }
16067+ else
16068+ {
16069+ size_t precision_length;
16070+
16071+ dp->precision_start = cp - 1;
16072+ for (; *cp >= '0' && *cp <= '9'; cp++)
16073+ ;
16074+ dp->precision_end = cp;
16075+ precision_length = dp->precision_end - dp->precision_start;
16076+ if (max_precision_length < precision_length)
16077+ max_precision_length = precision_length;
16078+ }
16079+ }
16080+
16081+ {
16082+ arg_type type;
16083+
16084+ /* Parse argument type/size specifiers. */
16085+ {
16086+ int flags = 0;
16087+
16088+ for (;;)
16089+ {
16090+ if (*cp == 'h')
16091+ {
16092+ flags |= (1 << (flags & 1));
16093+ cp++;
16094+ }
16095+ else if (*cp == 'L')
16096+ {
16097+ flags |= 4;
16098+ cp++;
16099+ }
16100+ else if (*cp == 'l')
16101+ {
16102+ flags += 8;
16103+ cp++;
16104+ }
16105+#ifdef HAVE_INTMAX_T
16106+ else if (*cp == 'j')
16107+ {
16108+ if (sizeof (intmax_t) > sizeof (long))
16109+ {
16110+ /* intmax_t = long long */
16111+ flags += 16;
16112+ }
16113+ else if (sizeof (intmax_t) > sizeof (int))
16114+ {
16115+ /* intmax_t = long */
16116+ flags += 8;
16117+ }
16118+ cp++;
16119+ }
16120+#endif
16121+ else if (*cp == 'z' || *cp == 'Z')
16122+ {
16123+ /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
16124+ because the warning facility in gcc-2.95.2 understands
16125+ only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
16126+ if (sizeof (size_t) > sizeof (long))
16127+ {
16128+ /* size_t = long long */
16129+ flags += 16;
16130+ }
16131+ else if (sizeof (size_t) > sizeof (int))
16132+ {
16133+ /* size_t = long */
16134+ flags += 8;
16135+ }
16136+ cp++;
16137+ }
16138+ else if (*cp == 't')
16139+ {
16140+ if (sizeof (ptrdiff_t) > sizeof (long))
16141+ {
16142+ /* ptrdiff_t = long long */
16143+ flags += 16;
16144+ }
16145+ else if (sizeof (ptrdiff_t) > sizeof (int))
16146+ {
16147+ /* ptrdiff_t = long */
16148+ flags += 8;
16149+ }
16150+ cp++;
16151+ }
16152+ else
16153+ break;
16154+ }
16155+
16156+ /* Read the conversion character. */
16157+ c = *cp++;
16158+ switch (c)
16159+ {
16160+ case 'd': case 'i':
16161+#ifdef HAVE_LONG_LONG
16162+ if (flags >= 16 || (flags & 4))
16163+ type = TYPE_LONGLONGINT;
16164+ else
16165+#endif
16166+ if (flags >= 8)
16167+ type = TYPE_LONGINT;
16168+ else if (flags & 2)
16169+ type = TYPE_SCHAR;
16170+ else if (flags & 1)
16171+ type = TYPE_SHORT;
16172+ else
16173+ type = TYPE_INT;
16174+ break;
16175+ case 'o': case 'u': case 'x': case 'X':
16176+#ifdef HAVE_LONG_LONG
16177+ if (flags >= 16 || (flags & 4))
16178+ type = TYPE_ULONGLONGINT;
16179+ else
16180+#endif
16181+ if (flags >= 8)
16182+ type = TYPE_ULONGINT;
16183+ else if (flags & 2)
16184+ type = TYPE_UCHAR;
16185+ else if (flags & 1)
16186+ type = TYPE_USHORT;
16187+ else
16188+ type = TYPE_UINT;
16189+ break;
16190+ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
16191+ case 'a': case 'A':
16192+#ifdef HAVE_LONG_DOUBLE
16193+ if (flags >= 16 || (flags & 4))
16194+ type = TYPE_LONGDOUBLE;
16195+ else
16196+#endif
16197+ type = TYPE_DOUBLE;
16198+ break;
16199+ case 'c':
16200+ if (flags >= 8)
16201+#ifdef HAVE_WINT_T
16202+ type = TYPE_WIDE_CHAR;
16203+#else
16204+ goto error;
16205+#endif
16206+ else
16207+ type = TYPE_CHAR;
16208+ break;
16209+#ifdef HAVE_WINT_T
16210+ case 'C':
16211+ type = TYPE_WIDE_CHAR;
16212+ c = 'c';
16213+ break;
16214+#endif
16215+ case 's':
16216+ if (flags >= 8)
16217+#ifdef HAVE_WCHAR_T
16218+ type = TYPE_WIDE_STRING;
16219+#else
16220+ goto error;
16221+#endif
16222+ else
16223+ type = TYPE_STRING;
16224+ break;
16225+#ifdef HAVE_WCHAR_T
16226+ case 'S':
16227+ type = TYPE_WIDE_STRING;
16228+ c = 's';
16229+ break;
16230+#endif
16231+ case 'p':
16232+ type = TYPE_POINTER;
16233+ break;
16234+ case 'n':
16235+#ifdef HAVE_LONG_LONG
16236+ if (flags >= 16 || (flags & 4))
16237+ type = TYPE_COUNT_LONGLONGINT_POINTER;
16238+ else
16239+#endif
16240+ if (flags >= 8)
16241+ type = TYPE_COUNT_LONGINT_POINTER;
16242+ else if (flags & 2)
16243+ type = TYPE_COUNT_SCHAR_POINTER;
16244+ else if (flags & 1)
16245+ type = TYPE_COUNT_SHORT_POINTER;
16246+ else
16247+ type = TYPE_COUNT_INT_POINTER;
16248+ break;
16249+ case '%':
16250+ type = TYPE_NONE;
16251+ break;
16252+ default:
16253+ /* Unknown conversion character. */
16254+ goto error;
16255+ }
16256+ }
16257+
16258+ if (type != TYPE_NONE)
16259+ {
16260+ dp->arg_index = arg_index;
16261+ if (dp->arg_index == ARG_NONE)
16262+ {
16263+ dp->arg_index = arg_posn++;
16264+ if (dp->arg_index == ARG_NONE)
16265+ /* arg_posn wrapped around. */
16266+ goto error;
16267+ }
16268+ REGISTER_ARG (dp->arg_index, type);
16269+ }
16270+ dp->conversion = c;
16271+ dp->dir_end = cp;
16272+ }
16273+
16274+ d->count++;
16275+ if (d->count >= d_allocated)
16276+ {
16277+ size_t memory_size;
16278+ DIRECTIVE *memory;
16279+
16280+ d_allocated = xtimes (d_allocated, 2);
16281+ memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
16282+ if (size_overflow_p (memory_size))
16283+ /* Overflow, would lead to out of memory. */
16284+ goto error;
16285+ memory = realloc (d->dir, memory_size);
16286+ if (memory == NULL)
16287+ /* Out of memory. */
16288+ goto error;
16289+ d->dir = memory;
16290+ }
16291+ }
16292+ }
16293+ d->dir[d->count].dir_start = cp;
16294+
16295+ d->max_width_length = max_width_length;
16296+ d->max_precision_length = max_precision_length;
16297+ return 0;
16298+
16299+error:
16300+ if (a->arg)
16301+ free (a->arg);
16302+ if (d->dir)
16303+ free (d->dir);
16304+ return -1;
16305+}
16306+
16307+#undef DIRECTIVES
16308+#undef DIRECTIVE
16309+#undef CHAR_T
16310+#undef PRINTF_PARSE
16311--- lrzsz-0.12.20.safe/intl/printf-parse.h 1969-12-31 19:00:00.000000000 -0500
16312+++ lrzsz-0.12.20/intl/printf-parse.h 2004-09-12 14:40:34.628706592 -0400
16313@@ -0,0 +1,75 @@
16314+/* Parse printf format string.
16315+ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
16316+
16317+ This program is free software; you can redistribute it and/or modify it
16318+ under the terms of the GNU Library General Public License as published
16319+ by the Free Software Foundation; either version 2, or (at your option)
16320+ any later version.
16321+
16322+ This program is distributed in the hope that it will be useful,
16323+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16324+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16325+ Library General Public License for more details.
16326+
16327+ You should have received a copy of the GNU Library General Public
16328+ License along with this program; if not, write to the Free Software
16329+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16330+ USA. */
16331+
16332+#ifndef _PRINTF_PARSE_H
16333+#define _PRINTF_PARSE_H
16334+
16335+#include "printf-args.h"
16336+
16337+
16338+/* Flags */
16339+#define FLAG_GROUP 1 /* ' flag */
16340+#define FLAG_LEFT 2 /* - flag */
16341+#define FLAG_SHOWSIGN 4 /* + flag */
16342+#define FLAG_SPACE 8 /* space flag */
16343+#define FLAG_ALT 16 /* # flag */
16344+#define FLAG_ZERO 32
16345+
16346+/* arg_index value indicating that no argument is consumed. */
16347+#define ARG_NONE (~(size_t)0)
16348+
16349+/* A parsed directive. */
16350+typedef struct
16351+{
16352+ const char* dir_start;
16353+ const char* dir_end;
16354+ int flags;
16355+ const char* width_start;
16356+ const char* width_end;
16357+ size_t width_arg_index;
16358+ const char* precision_start;
16359+ const char* precision_end;
16360+ size_t precision_arg_index;
16361+ char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
16362+ size_t arg_index;
16363+}
16364+char_directive;
16365+
16366+/* A parsed format string. */
16367+typedef struct
16368+{
16369+ size_t count;
16370+ char_directive *dir;
16371+ size_t max_width_length;
16372+ size_t max_precision_length;
16373+}
16374+char_directives;
16375+
16376+
16377+/* Parses the format string. Fills in the number N of directives, and fills
16378+ in directives[0], ..., directives[N-1], and sets directives[N].dir_start
16379+ to the end of the format string. Also fills in the arg_type fields of the
16380+ arguments and the needed count of arguments. */
16381+#ifdef STATIC
16382+STATIC
16383+#else
16384+extern
16385+#endif
16386+int printf_parse (const char *format, char_directives *d, arguments *a);
16387+
16388+#endif /* _PRINTF_PARSE_H */
16389--- lrzsz-0.12.20.safe/intl/ref-add.sin 1969-12-31 19:00:00.000000000 -0500
16390+++ lrzsz-0.12.20/intl/ref-add.sin 2004-09-12 14:40:34.633705832 -0400
16391@@ -0,0 +1,31 @@
16392+# Add this package to a list of references stored in a text file.
16393+#
16394+# Copyright (C) 2000 Free Software Foundation, Inc.
16395+#
16396+# This program is free software; you can redistribute it and/or modify it
16397+# under the terms of the GNU Library General Public License as published
16398+# by the Free Software Foundation; either version 2, or (at your option)
16399+# any later version.
16400+#
16401+# This program is distributed in the hope that it will be useful,
16402+# but WITHOUT ANY WARRANTY; without even the implied warranty of
16403+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16404+# Library General Public License for more details.
16405+#
16406+# You should have received a copy of the GNU Library General Public
16407+# License along with this program; if not, write to the Free Software
16408+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16409+# USA.
16410+#
16411+# Written by Bruno Haible <haible@clisp.cons.org>.
16412+#
16413+/^# Packages using this file: / {
16414+ s/# Packages using this file://
16415+ ta
16416+ :a
16417+ s/ @PACKAGE@ / @PACKAGE@ /
16418+ tb
16419+ s/ $/ @PACKAGE@ /
16420+ :b
16421+ s/^/# Packages using this file:/
16422+}
16423--- lrzsz-0.12.20.safe/intl/ref-del.sin 1969-12-31 19:00:00.000000000 -0500
16424+++ lrzsz-0.12.20/intl/ref-del.sin 2004-09-12 14:40:34.638705072 -0400
16425@@ -0,0 +1,26 @@
16426+# Remove this package from a list of references stored in a text file.
16427+#
16428+# Copyright (C) 2000 Free Software Foundation, Inc.
16429+#
16430+# This program is free software; you can redistribute it and/or modify it
16431+# under the terms of the GNU Library General Public License as published
16432+# by the Free Software Foundation; either version 2, or (at your option)
16433+# any later version.
16434+#
16435+# This program is distributed in the hope that it will be useful,
16436+# but WITHOUT ANY WARRANTY; without even the implied warranty of
16437+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16438+# Library General Public License for more details.
16439+#
16440+# You should have received a copy of the GNU Library General Public
16441+# License along with this program; if not, write to the Free Software
16442+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16443+# USA.
16444+#
16445+# Written by Bruno Haible <haible@clisp.cons.org>.
16446+#
16447+/^# Packages using this file: / {
16448+ s/# Packages using this file://
16449+ s/ @PACKAGE@ / /
16450+ s/^/# Packages using this file:/
16451+}
16452--- lrzsz-0.12.20.safe/intl/relocatable.c 1969-12-31 19:00:00.000000000 -0500
16453+++ lrzsz-0.12.20/intl/relocatable.c 2004-09-12 14:40:34.644704160 -0400
16454@@ -0,0 +1,449 @@
16455+/* Provide relocatable packages.
16456+ Copyright (C) 2003 Free Software Foundation, Inc.
16457+ Written by Bruno Haible <bruno@clisp.org>, 2003.
16458+
16459+ This program is free software; you can redistribute it and/or modify it
16460+ under the terms of the GNU Library General Public License as published
16461+ by the Free Software Foundation; either version 2, or (at your option)
16462+ any later version.
16463+
16464+ This program is distributed in the hope that it will be useful,
16465+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16466+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16467+ Library General Public License for more details.
16468+
16469+ You should have received a copy of the GNU Library General Public
16470+ License along with this program; if not, write to the Free Software
16471+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16472+ USA. */
16473+
16474+
16475+/* Tell glibc's <stdio.h> to provide a prototype for getline().
16476+ This must come before <config.h> because <config.h> may include
16477+ <features.h>, and once <features.h> has been included, it's too late. */
16478+#ifndef _GNU_SOURCE
16479+# define _GNU_SOURCE 1
16480+#endif
16481+
16482+#ifdef HAVE_CONFIG_H
16483+# include "config.h"
16484+#endif
16485+
16486+/* Specification. */
16487+#include "relocatable.h"
16488+
16489+#if ENABLE_RELOCATABLE
16490+
16491+#include <stddef.h>
16492+#include <stdio.h>
16493+#include <stdlib.h>
16494+#include <string.h>
16495+
16496+#ifdef NO_XMALLOC
16497+# define xmalloc malloc
16498+#else
16499+# include "xalloc.h"
16500+#endif
16501+
16502+#if defined _WIN32 || defined __WIN32__
16503+# define WIN32_LEAN_AND_MEAN
16504+# include <windows.h>
16505+#endif
16506+
16507+#if DEPENDS_ON_LIBCHARSET
16508+# include <libcharset.h>
16509+#endif
16510+#if DEPENDS_ON_LIBICONV && HAVE_ICONV
16511+# include <iconv.h>
16512+#endif
16513+#if DEPENDS_ON_LIBINTL && ENABLE_NLS
16514+# include <libintl.h>
16515+#endif
16516+
16517+/* Faked cheap 'bool'. */
16518+#undef bool
16519+#undef false
16520+#undef true
16521+#define bool int
16522+#define false 0
16523+#define true 1
16524+
16525+/* Pathname support.
16526+ ISSLASH(C) tests whether C is a directory separator character.
16527+ IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
16528+ */
16529+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
16530+ /* Win32, OS/2, DOS */
16531+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
16532+# define HAS_DEVICE(P) \
16533+ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
16534+ && (P)[1] == ':')
16535+# define IS_PATH_WITH_DIR(P) \
16536+ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
16537+# define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
16538+#else
16539+ /* Unix */
16540+# define ISSLASH(C) ((C) == '/')
16541+# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
16542+# define FILESYSTEM_PREFIX_LEN(P) 0
16543+#endif
16544+
16545+/* Original installation prefix. */
16546+static char *orig_prefix;
16547+static size_t orig_prefix_len;
16548+/* Current installation prefix. */
16549+static char *curr_prefix;
16550+static size_t curr_prefix_len;
16551+/* These prefixes do not end in a slash. Anything that will be concatenated
16552+ to them must start with a slash. */
16553+
16554+/* Sets the original and the current installation prefix of this module.
16555+ Relocation simply replaces a pathname starting with the original prefix
16556+ by the corresponding pathname with the current prefix instead. Both
16557+ prefixes should be directory names without trailing slash (i.e. use ""
16558+ instead of "/"). */
16559+static void
16560+set_this_relocation_prefix (const char *orig_prefix_arg,
16561+ const char *curr_prefix_arg)
16562+{
16563+ if (orig_prefix_arg != NULL && curr_prefix_arg != NULL
16564+ /* Optimization: if orig_prefix and curr_prefix are equal, the
16565+ relocation is a nop. */
16566+ && strcmp (orig_prefix_arg, curr_prefix_arg) != 0)
16567+ {
16568+ /* Duplicate the argument strings. */
16569+ char *memory;
16570+
16571+ orig_prefix_len = strlen (orig_prefix_arg);
16572+ curr_prefix_len = strlen (curr_prefix_arg);
16573+ memory = (char *) xmalloc (orig_prefix_len + 1 + curr_prefix_len + 1);
16574+#ifdef NO_XMALLOC
16575+ if (memory != NULL)
16576+#endif
16577+ {
16578+ memcpy (memory, orig_prefix_arg, orig_prefix_len + 1);
16579+ orig_prefix = memory;
16580+ memory += orig_prefix_len + 1;
16581+ memcpy (memory, curr_prefix_arg, curr_prefix_len + 1);
16582+ curr_prefix = memory;
16583+ return;
16584+ }
16585+ }
16586+ orig_prefix = NULL;
16587+ curr_prefix = NULL;
16588+ /* Don't worry about wasted memory here - this function is usually only
16589+ called once. */
16590+}
16591+
16592+/* Sets the original and the current installation prefix of the package.
16593+ Relocation simply replaces a pathname starting with the original prefix
16594+ by the corresponding pathname with the current prefix instead. Both
16595+ prefixes should be directory names without trailing slash (i.e. use ""
16596+ instead of "/"). */
16597+void
16598+set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg)
16599+{
16600+ set_this_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
16601+
16602+ /* Now notify all dependent libraries. */
16603+#if DEPENDS_ON_LIBCHARSET
16604+ libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
16605+#endif
16606+#if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109
16607+ libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
16608+#endif
16609+#if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix
16610+ libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
16611+#endif
16612+}
16613+
16614+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
16615+
16616+/* Convenience function:
16617+ Computes the current installation prefix, based on the original
16618+ installation prefix, the original installation directory of a particular
16619+ file, and the current pathname of this file. Returns NULL upon failure. */
16620+#ifdef IN_LIBRARY
16621+#define compute_curr_prefix local_compute_curr_prefix
16622+static
16623+#endif
16624+const char *
16625+compute_curr_prefix (const char *orig_installprefix,
16626+ const char *orig_installdir,
16627+ const char *curr_pathname)
16628+{
16629+ const char *curr_installdir;
16630+ const char *rel_installdir;
16631+
16632+ if (curr_pathname == NULL)
16633+ return NULL;
16634+
16635+ /* Determine the relative installation directory, relative to the prefix.
16636+ This is simply the difference between orig_installprefix and
16637+ orig_installdir. */
16638+ if (strncmp (orig_installprefix, orig_installdir, strlen (orig_installprefix))
16639+ != 0)
16640+ /* Shouldn't happen - nothing should be installed outside $(prefix). */
16641+ return NULL;
16642+ rel_installdir = orig_installdir + strlen (orig_installprefix);
16643+
16644+ /* Determine the current installation directory. */
16645+ {
16646+ const char *p_base = curr_pathname + FILESYSTEM_PREFIX_LEN (curr_pathname);
16647+ const char *p = curr_pathname + strlen (curr_pathname);
16648+ char *q;
16649+
16650+ while (p > p_base)
16651+ {
16652+ p--;
16653+ if (ISSLASH (*p))
16654+ break;
16655+ }
16656+
16657+ q = (char *) xmalloc (p - curr_pathname + 1);
16658+#ifdef NO_XMALLOC
16659+ if (q == NULL)
16660+ return NULL;
16661+#endif
16662+ memcpy (q, curr_pathname, p - curr_pathname);
16663+ q[p - curr_pathname] = '\0';
16664+ curr_installdir = q;
16665+ }
16666+
16667+ /* Compute the current installation prefix by removing the trailing
16668+ rel_installdir from it. */
16669+ {
16670+ const char *rp = rel_installdir + strlen (rel_installdir);
16671+ const char *cp = curr_installdir + strlen (curr_installdir);
16672+ const char *cp_base =
16673+ curr_installdir + FILESYSTEM_PREFIX_LEN (curr_installdir);
16674+
16675+ while (rp > rel_installdir && cp > cp_base)
16676+ {
16677+ bool same = false;
16678+ const char *rpi = rp;
16679+ const char *cpi = cp;
16680+
16681+ while (rpi > rel_installdir && cpi > cp_base)
16682+ {
16683+ rpi--;
16684+ cpi--;
16685+ if (ISSLASH (*rpi) || ISSLASH (*cpi))
16686+ {
16687+ if (ISSLASH (*rpi) && ISSLASH (*cpi))
16688+ same = true;
16689+ break;
16690+ }
16691+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
16692+ /* Win32, OS/2, DOS - case insignificant filesystem */
16693+ if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi)
16694+ != (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi))
16695+ break;
16696+#else
16697+ if (*rpi != *cpi)
16698+ break;
16699+#endif
16700+ }
16701+ if (!same)
16702+ break;
16703+ /* The last pathname component was the same. opi and cpi now point
16704+ to the slash before it. */
16705+ rp = rpi;
16706+ cp = cpi;
16707+ }
16708+
16709+ if (rp > rel_installdir)
16710+ /* Unexpected: The curr_installdir does not end with rel_installdir. */
16711+ return NULL;
16712+
16713+ {
16714+ size_t curr_prefix_len = cp - curr_installdir;
16715+ char *curr_prefix;
16716+
16717+ curr_prefix = (char *) xmalloc (curr_prefix_len + 1);
16718+#ifdef NO_XMALLOC
16719+ if (curr_prefix == NULL)
16720+ return NULL;
16721+#endif
16722+ memcpy (curr_prefix, curr_installdir, curr_prefix_len);
16723+ curr_prefix[curr_prefix_len] = '\0';
16724+
16725+ return curr_prefix;
16726+ }
16727+ }
16728+}
16729+
16730+#endif /* !IN_LIBRARY || PIC */
16731+
16732+#if defined PIC && defined INSTALLDIR
16733+
16734+/* Full pathname of shared library, or NULL. */
16735+static char *shared_library_fullname;
16736+
16737+#if defined _WIN32 || defined __WIN32__
16738+
16739+/* Determine the full pathname of the shared library when it is loaded. */
16740+
16741+BOOL WINAPI
16742+DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
16743+{
16744+ (void) reserved;
16745+
16746+ if (event == DLL_PROCESS_ATTACH)
16747+ {
16748+ /* The DLL is being loaded into an application's address range. */
16749+ static char location[MAX_PATH];
16750+
16751+ if (!GetModuleFileName (module_handle, location, sizeof (location)))
16752+ /* Shouldn't happen. */
16753+ return FALSE;
16754+
16755+ if (!IS_PATH_WITH_DIR (location))
16756+ /* Shouldn't happen. */
16757+ return FALSE;
16758+
16759+ shared_library_fullname = strdup (location);
16760+ }
16761+
16762+ return TRUE;
16763+}
16764+
16765+#else /* Unix */
16766+
16767+static void
16768+find_shared_library_fullname ()
16769+{
16770+#if defined __linux__ && __GLIBC__ >= 2
16771+ /* Linux has /proc/self/maps. glibc 2 has the getline() function. */
16772+ FILE *fp;
16773+
16774+ /* Open the current process' maps file. It describes one VMA per line. */
16775+ fp = fopen ("/proc/self/maps", "r");
16776+ if (fp)
16777+ {
16778+ unsigned long address = (unsigned long) &find_shared_library_fullname;
16779+ for (;;)
16780+ {
16781+ unsigned long start, end;
16782+ int c;
16783+
16784+ if (fscanf (fp, "%lx-%lx", &start, &end) != 2)
16785+ break;
16786+ if (address >= start && address <= end - 1)
16787+ {
16788+ /* Found it. Now see if this line contains a filename. */
16789+ while (c = getc (fp), c != EOF && c != '\n' && c != '/')
16790+ continue;
16791+ if (c == '/')
16792+ {
16793+ size_t size;
16794+ int len;
16795+
16796+ ungetc (c, fp);
16797+ shared_library_fullname = NULL; size = 0;
16798+ len = getline (&shared_library_fullname, &size, fp);
16799+ if (len >= 0)
16800+ {
16801+ /* Success: filled shared_library_fullname. */
16802+ if (len > 0 && shared_library_fullname[len - 1] == '\n')
16803+ shared_library_fullname[len - 1] = '\0';
16804+ }
16805+ }
16806+ break;
16807+ }
16808+ while (c = getc (fp), c != EOF && c != '\n')
16809+ continue;
16810+ }
16811+ fclose (fp);
16812+ }
16813+#endif
16814+}
16815+
16816+#endif /* WIN32 / Unix */
16817+
16818+/* Return the full pathname of the current shared library.
16819+ Return NULL if unknown.
16820+ Guaranteed to work only on Linux and Woe32. */
16821+static char *
16822+get_shared_library_fullname ()
16823+{
16824+#if !(defined _WIN32 || defined __WIN32__)
16825+ static bool tried_find_shared_library_fullname;
16826+ if (!tried_find_shared_library_fullname)
16827+ {
16828+ find_shared_library_fullname ();
16829+ tried_find_shared_library_fullname = true;
16830+ }
16831+#endif
16832+ return shared_library_fullname;
16833+}
16834+
16835+#endif /* PIC */
16836+
16837+/* Returns the pathname, relocated according to the current installation
16838+ directory. */
16839+const char *
16840+relocate (const char *pathname)
16841+{
16842+#if defined PIC && defined INSTALLDIR
16843+ static int initialized;
16844+
16845+ /* Initialization code for a shared library. */
16846+ if (!initialized)
16847+ {
16848+ /* At this point, orig_prefix and curr_prefix likely have already been
16849+ set through the main program's set_program_name_and_installdir
16850+ function. This is sufficient in the case that the library has
16851+ initially been installed in the same orig_prefix. But we can do
16852+ better, to also cover the cases that 1. it has been installed
16853+ in a different prefix before being moved to orig_prefix and (later)
16854+ to curr_prefix, 2. unlike the program, it has not moved away from
16855+ orig_prefix. */
16856+ const char *orig_installprefix = INSTALLPREFIX;
16857+ const char *orig_installdir = INSTALLDIR;
16858+ const char *curr_prefix_better;
16859+
16860+ curr_prefix_better =
16861+ compute_curr_prefix (orig_installprefix, orig_installdir,
16862+ get_shared_library_fullname ());
16863+ if (curr_prefix_better == NULL)
16864+ curr_prefix_better = curr_prefix;
16865+
16866+ set_relocation_prefix (orig_installprefix, curr_prefix_better);
16867+
16868+ initialized = 1;
16869+ }
16870+#endif
16871+
16872+ /* Note: It is not necessary to perform case insensitive comparison here,
16873+ even for DOS-like filesystems, because the pathname argument was
16874+ typically created from the same Makefile variable as orig_prefix came
16875+ from. */
16876+ if (orig_prefix != NULL && curr_prefix != NULL
16877+ && strncmp (pathname, orig_prefix, orig_prefix_len) == 0)
16878+ {
16879+ if (pathname[orig_prefix_len] == '\0')
16880+ /* pathname equals orig_prefix. */
16881+ return curr_prefix;
16882+ if (ISSLASH (pathname[orig_prefix_len]))
16883+ {
16884+ /* pathname starts with orig_prefix. */
16885+ const char *pathname_tail = &pathname[orig_prefix_len];
16886+ char *result =
16887+ (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
16888+
16889+#ifdef NO_XMALLOC
16890+ if (result != NULL)
16891+#endif
16892+ {
16893+ memcpy (result, curr_prefix, curr_prefix_len);
16894+ strcpy (result + curr_prefix_len, pathname_tail);
16895+ return result;
16896+ }
16897+ }
16898+ }
16899+ /* Nothing to relocate. */
16900+ return pathname;
16901+}
16902+
16903+#endif
16904--- lrzsz-0.12.20.safe/intl/relocatable.h 1969-12-31 19:00:00.000000000 -0500
16905+++ lrzsz-0.12.20/intl/relocatable.h 2004-09-12 14:40:34.651703096 -0400
16906@@ -0,0 +1,77 @@
16907+/* Provide relocatable packages.
16908+ Copyright (C) 2003 Free Software Foundation, Inc.
16909+ Written by Bruno Haible <bruno@clisp.org>, 2003.
16910+
16911+ This program is free software; you can redistribute it and/or modify it
16912+ under the terms of the GNU Library General Public License as published
16913+ by the Free Software Foundation; either version 2, or (at your option)
16914+ any later version.
16915+
16916+ This program is distributed in the hope that it will be useful,
16917+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16918+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16919+ Library General Public License for more details.
16920+
16921+ You should have received a copy of the GNU Library General Public
16922+ License along with this program; if not, write to the Free Software
16923+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16924+ USA. */
16925+
16926+#ifndef _RELOCATABLE_H
16927+#define _RELOCATABLE_H
16928+
16929+#ifdef __cplusplus
16930+extern "C" {
16931+#endif
16932+
16933+
16934+/* This can be enabled through the configure --enable-relocatable option. */
16935+#if ENABLE_RELOCATABLE
16936+
16937+/* When building a DLL, we must export some functions. Note that because
16938+ this is a private .h file, we don't need to use __declspec(dllimport)
16939+ in any case. */
16940+#if defined _MSC_VER && BUILDING_DLL
16941+# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
16942+#else
16943+# define RELOCATABLE_DLL_EXPORTED
16944+#endif
16945+
16946+/* Sets the original and the current installation prefix of the package.
16947+ Relocation simply replaces a pathname starting with the original prefix
16948+ by the corresponding pathname with the current prefix instead. Both
16949+ prefixes should be directory names without trailing slash (i.e. use ""
16950+ instead of "/"). */
16951+extern RELOCATABLE_DLL_EXPORTED void
16952+ set_relocation_prefix (const char *orig_prefix,
16953+ const char *curr_prefix);
16954+
16955+/* Returns the pathname, relocated according to the current installation
16956+ directory. */
16957+extern const char * relocate (const char *pathname);
16958+
16959+/* Memory management: relocate() leaks memory, because it has to construct
16960+ a fresh pathname. If this is a problem because your program calls
16961+ relocate() frequently, think about caching the result. */
16962+
16963+/* Convenience function:
16964+ Computes the current installation prefix, based on the original
16965+ installation prefix, the original installation directory of a particular
16966+ file, and the current pathname of this file. Returns NULL upon failure. */
16967+extern const char * compute_curr_prefix (const char *orig_installprefix,
16968+ const char *orig_installdir,
16969+ const char *curr_pathname);
16970+
16971+#else
16972+
16973+/* By default, we use the hardwired pathnames. */
16974+#define relocate(pathname) (pathname)
16975+
16976+#endif
16977+
16978+
16979+#ifdef __cplusplus
16980+}
16981+#endif
16982+
16983+#endif /* _RELOCATABLE_H */
16984--- lrzsz-0.12.20.safe/intl/textdomain.c 1998-04-26 09:22:37.000000000 -0400
16985+++ lrzsz-0.12.20/intl/textdomain.c 2004-09-12 14:40:34.656702336 -0400
16986@@ -1,51 +1,60 @@
16987-/* Implementation of the textdomain(3) function
16988- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
16989- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
16990+/* Implementation of the textdomain(3) function.
16991+ Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
16992
16993- This program is free software; you can redistribute it and/or modify
16994- it under the terms of the GNU General Public License as published by
16995- the Free Software Foundation; either version 2, or (at your option)
16996+ This program is free software; you can redistribute it and/or modify it
16997+ under the terms of the GNU Library General Public License as published
16998+ by the Free Software Foundation; either version 2, or (at your option)
16999 any later version.
17000
17001 This program is distributed in the hope that it will be useful,
17002 but WITHOUT ANY WARRANTY; without even the implied warranty of
17003- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17004- GNU General Public License for more details.
17005+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17006+ Library General Public License for more details.
17007
17008- You should have received a copy of the GNU General Public License
17009- along with this program; if not, write to the Free Software Foundation,
17010- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17011+ You should have received a copy of the GNU Library General Public
17012+ License along with this program; if not, write to the Free Software
17013+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17014+ USA. */
17015
17016 #ifdef HAVE_CONFIG_H
17017 # include <config.h>
17018 #endif
17019
17020-#if defined STDC_HEADERS || defined _LIBC
17021-# include <stdlib.h>
17022-#endif
17023+#include <stdlib.h>
17024+#include <string.h>
17025
17026-#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
17027-# include <string.h>
17028+#ifdef _LIBC
17029+# include <libintl.h>
17030 #else
17031-# include <strings.h>
17032-# ifndef memcpy
17033-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
17034-# endif
17035+# include "libgnuintl.h"
17036 #endif
17037+#include "gettextP.h"
17038
17039 #ifdef _LIBC
17040-# include <libintl.h>
17041+/* We have to handle multi-threaded applications. */
17042+# include <bits/libc-lock.h>
17043 #else
17044-# include "libgettext.h"
17045+/* Provide dummy implementation if this is outside glibc. */
17046+# define __libc_rwlock_define(CLASS, NAME)
17047+# define __libc_rwlock_wrlock(NAME)
17048+# define __libc_rwlock_unlock(NAME)
17049+#endif
17050+
17051+/* The internal variables in the standalone libintl.a must have different
17052+ names than the internal variables in GNU libc, otherwise programs
17053+ using libintl.a cannot be linked statically. */
17054+#if !defined _LIBC
17055+# define _nl_default_default_domain libintl_nl_default_default_domain
17056+# define _nl_current_default_domain libintl_nl_current_default_domain
17057 #endif
17058
17059 /* @@ end of prolog @@ */
17060
17061 /* Name of the default text domain. */
17062-extern const char _nl_default_default_domain[];
17063+extern const char _nl_default_default_domain[] attribute_hidden;
17064
17065 /* Default text domain in which entries for gettext(3) are to be found. */
17066-extern const char *_nl_current_default_domain;
17067+extern const char *_nl_current_default_domain attribute_hidden;
17068
17069
17070 /* Names for the libintl functions are a problem. They must not clash
17071@@ -54,50 +63,76 @@
17072 prefix. So we have to make a difference here. */
17073 #ifdef _LIBC
17074 # define TEXTDOMAIN __textdomain
17075-# define strdup(str) __strdup (str)
17076+# ifndef strdup
17077+# define strdup(str) __strdup (str)
17078+# endif
17079 #else
17080-# define TEXTDOMAIN textdomain__
17081+# define TEXTDOMAIN libintl_textdomain
17082 #endif
17083
17084+/* Lock variable to protect the global data in the gettext implementation. */
17085+__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
17086+
17087 /* Set the current default message catalog to DOMAINNAME.
17088 If DOMAINNAME is null, return the current default.
17089 If DOMAINNAME is "", reset to the default of "messages". */
17090 char *
17091-TEXTDOMAIN (domainname)
17092- const char *domainname;
17093+TEXTDOMAIN (const char *domainname)
17094 {
17095- char *old;
17096+ char *new_domain;
17097+ char *old_domain;
17098
17099 /* A NULL pointer requests the current setting. */
17100 if (domainname == NULL)
17101 return (char *) _nl_current_default_domain;
17102
17103- old = (char *) _nl_current_default_domain;
17104+ __libc_rwlock_wrlock (_nl_state_lock);
17105+
17106+ old_domain = (char *) _nl_current_default_domain;
17107
17108 /* If domain name is the null string set to default domain "messages". */
17109 if (domainname[0] == '\0'
17110 || strcmp (domainname, _nl_default_default_domain) == 0)
17111- _nl_current_default_domain = _nl_default_default_domain;
17112+ {
17113+ _nl_current_default_domain = _nl_default_default_domain;
17114+ new_domain = (char *) _nl_current_default_domain;
17115+ }
17116+ else if (strcmp (domainname, old_domain) == 0)
17117+ /* This can happen and people will use it to signal that some
17118+ environment variable changed. */
17119+ new_domain = old_domain;
17120 else
17121 {
17122 /* If the following malloc fails `_nl_current_default_domain'
17123 will be NULL. This value will be returned and so signals we
17124 are out of core. */
17125 #if defined _LIBC || defined HAVE_STRDUP
17126- _nl_current_default_domain = strdup (domainname);
17127+ new_domain = strdup (domainname);
17128 #else
17129 size_t len = strlen (domainname) + 1;
17130- char *cp = (char *) malloc (len);
17131- if (cp != NULL)
17132- memcpy (cp, domainname, len);
17133- _nl_current_default_domain = cp;
17134+ new_domain = (char *) malloc (len);
17135+ if (new_domain != NULL)
17136+ memcpy (new_domain, domainname, len);
17137 #endif
17138+
17139+ if (new_domain != NULL)
17140+ _nl_current_default_domain = new_domain;
17141 }
17142
17143- if (old != _nl_default_default_domain)
17144- free (old);
17145+ /* We use this possibility to signal a change of the loaded catalogs
17146+ since this is most likely the case and there is no other easy we
17147+ to do it. Do it only when the call was successful. */
17148+ if (new_domain != NULL)
17149+ {
17150+ ++_nl_msg_cat_cntr;
17151
17152- return (char *) _nl_current_default_domain;
17153+ if (old_domain != new_domain && old_domain != _nl_default_default_domain)
17154+ free (old_domain);
17155+ }
17156+
17157+ __libc_rwlock_unlock (_nl_state_lock);
17158+
17159+ return new_domain;
17160 }
17161
17162 #ifdef _LIBC
17163--- lrzsz-0.12.20.safe/intl/vasnprintf.c 1969-12-31 19:00:00.000000000 -0500
17164+++ lrzsz-0.12.20/intl/vasnprintf.c 2004-09-12 14:40:34.662701424 -0400
17165@@ -0,0 +1,887 @@
17166+/* vsprintf with automatic memory allocation.
17167+ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
17168+
17169+ This program is free software; you can redistribute it and/or modify it
17170+ under the terms of the GNU Library General Public License as published
17171+ by the Free Software Foundation; either version 2, or (at your option)
17172+ any later version.
17173+
17174+ This program is distributed in the hope that it will be useful,
17175+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17176+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17177+ Library General Public License for more details.
17178+
17179+ You should have received a copy of the GNU Library General Public
17180+ License along with this program; if not, write to the Free Software
17181+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17182+ USA. */
17183+
17184+/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
17185+ This must come before <config.h> because <config.h> may include
17186+ <features.h>, and once <features.h> has been included, it's too late. */
17187+#ifndef _GNU_SOURCE
17188+# define _GNU_SOURCE 1
17189+#endif
17190+
17191+#ifdef HAVE_CONFIG_H
17192+# include <config.h>
17193+#endif
17194+#ifndef IN_LIBINTL
17195+# include <alloca.h>
17196+#endif
17197+
17198+/* Specification. */
17199+#if WIDE_CHAR_VERSION
17200+# include "vasnwprintf.h"
17201+#else
17202+# include "vasnprintf.h"
17203+#endif
17204+
17205+#include <stdio.h> /* snprintf(), sprintf() */
17206+#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
17207+#include <string.h> /* memcpy(), strlen() */
17208+#include <errno.h> /* errno */
17209+#include <limits.h> /* CHAR_BIT */
17210+#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
17211+#if WIDE_CHAR_VERSION
17212+# include "wprintf-parse.h"
17213+#else
17214+# include "printf-parse.h"
17215+#endif
17216+
17217+/* Checked size_t computations. */
17218+#include "xsize.h"
17219+
17220+#ifdef HAVE_WCHAR_T
17221+# ifdef HAVE_WCSLEN
17222+# define local_wcslen wcslen
17223+# else
17224+ /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
17225+ a dependency towards this library, here is a local substitute.
17226+ Define this substitute only once, even if this file is included
17227+ twice in the same compilation unit. */
17228+# ifndef local_wcslen_defined
17229+# define local_wcslen_defined 1
17230+static size_t
17231+local_wcslen (const wchar_t *s)
17232+{
17233+ const wchar_t *ptr;
17234+
17235+ for (ptr = s; *ptr != (wchar_t) 0; ptr++)
17236+ ;
17237+ return ptr - s;
17238+}
17239+# endif
17240+# endif
17241+#endif
17242+
17243+#if WIDE_CHAR_VERSION
17244+# define VASNPRINTF vasnwprintf
17245+# define CHAR_T wchar_t
17246+# define DIRECTIVE wchar_t_directive
17247+# define DIRECTIVES wchar_t_directives
17248+# define PRINTF_PARSE wprintf_parse
17249+# define USE_SNPRINTF 1
17250+# if HAVE_DECL__SNWPRINTF
17251+ /* On Windows, the function swprintf() has a different signature than
17252+ on Unix; we use the _snwprintf() function instead. */
17253+# define SNPRINTF _snwprintf
17254+# else
17255+ /* Unix. */
17256+# define SNPRINTF swprintf
17257+# endif
17258+#else
17259+# define VASNPRINTF vasnprintf
17260+# define CHAR_T char
17261+# define DIRECTIVE char_directive
17262+# define DIRECTIVES char_directives
17263+# define PRINTF_PARSE printf_parse
17264+# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF)
17265+# if HAVE_DECL__SNPRINTF
17266+ /* Windows. */
17267+# define SNPRINTF _snprintf
17268+# else
17269+ /* Unix. */
17270+# define SNPRINTF snprintf
17271+# endif
17272+#endif
17273+
17274+CHAR_T *
17275+VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args)
17276+{
17277+ DIRECTIVES d;
17278+ arguments a;
17279+
17280+ if (PRINTF_PARSE (format, &d, &a) < 0)
17281+ {
17282+ errno = EINVAL;
17283+ return NULL;
17284+ }
17285+
17286+#define CLEANUP() \
17287+ free (d.dir); \
17288+ if (a.arg) \
17289+ free (a.arg);
17290+
17291+ if (printf_fetchargs (args, &a) < 0)
17292+ {
17293+ CLEANUP ();
17294+ errno = EINVAL;
17295+ return NULL;
17296+ }
17297+
17298+ {
17299+ size_t buf_neededlength;
17300+ CHAR_T *buf;
17301+ CHAR_T *buf_malloced;
17302+ const CHAR_T *cp;
17303+ size_t i;
17304+ DIRECTIVE *dp;
17305+ /* Output string accumulator. */
17306+ CHAR_T *result;
17307+ size_t allocated;
17308+ size_t length;
17309+
17310+ /* Allocate a small buffer that will hold a directive passed to
17311+ sprintf or snprintf. */
17312+ buf_neededlength =
17313+ xsum4 (7, d.max_width_length, d.max_precision_length, 6);
17314+#if HAVE_ALLOCA
17315+ if (buf_neededlength < 4000 / sizeof (CHAR_T))
17316+ {
17317+ buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T));
17318+ buf_malloced = NULL;
17319+ }
17320+ else
17321+#endif
17322+ {
17323+ size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T));
17324+ if (size_overflow_p (buf_memsize))
17325+ goto out_of_memory_1;
17326+ buf = (CHAR_T *) malloc (buf_memsize);
17327+ if (buf == NULL)
17328+ goto out_of_memory_1;
17329+ buf_malloced = buf;
17330+ }
17331+
17332+ if (resultbuf != NULL)
17333+ {
17334+ result = resultbuf;
17335+ allocated = *lengthp;
17336+ }
17337+ else
17338+ {
17339+ result = NULL;
17340+ allocated = 0;
17341+ }
17342+ length = 0;
17343+ /* Invariants:
17344+ result is either == resultbuf or == NULL or malloc-allocated.
17345+ If length > 0, then result != NULL. */
17346+
17347+ /* Ensures that allocated >= needed. Aborts through a jump to
17348+ out_of_memory if needed is SIZE_MAX or otherwise too big. */
17349+#define ENSURE_ALLOCATION(needed) \
17350+ if ((needed) > allocated) \
17351+ { \
17352+ size_t memory_size; \
17353+ CHAR_T *memory; \
17354+ \
17355+ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \
17356+ if ((needed) > allocated) \
17357+ allocated = (needed); \
17358+ memory_size = xtimes (allocated, sizeof (CHAR_T)); \
17359+ if (size_overflow_p (memory_size)) \
17360+ goto out_of_memory; \
17361+ if (result == resultbuf || result == NULL) \
17362+ memory = (CHAR_T *) malloc (memory_size); \
17363+ else \
17364+ memory = (CHAR_T *) realloc (result, memory_size); \
17365+ if (memory == NULL) \
17366+ goto out_of_memory; \
17367+ if (result == resultbuf && length > 0) \
17368+ memcpy (memory, result, length * sizeof (CHAR_T)); \
17369+ result = memory; \
17370+ }
17371+
17372+ for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
17373+ {
17374+ if (cp != dp->dir_start)
17375+ {
17376+ size_t n = dp->dir_start - cp;
17377+ size_t augmented_length = xsum (length, n);
17378+
17379+ ENSURE_ALLOCATION (augmented_length);
17380+ memcpy (result + length, cp, n * sizeof (CHAR_T));
17381+ length = augmented_length;
17382+ }
17383+ if (i == d.count)
17384+ break;
17385+
17386+ /* Execute a single directive. */
17387+ if (dp->conversion == '%')
17388+ {
17389+ size_t augmented_length;
17390+
17391+ if (!(dp->arg_index == ARG_NONE))
17392+ abort ();
17393+ augmented_length = xsum (length, 1);
17394+ ENSURE_ALLOCATION (augmented_length);
17395+ result[length] = '%';
17396+ length = augmented_length;
17397+ }
17398+ else
17399+ {
17400+ if (!(dp->arg_index != ARG_NONE))
17401+ abort ();
17402+
17403+ if (dp->conversion == 'n')
17404+ {
17405+ switch (a.arg[dp->arg_index].type)
17406+ {
17407+ case TYPE_COUNT_SCHAR_POINTER:
17408+ *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
17409+ break;
17410+ case TYPE_COUNT_SHORT_POINTER:
17411+ *a.arg[dp->arg_index].a.a_count_short_pointer = length;
17412+ break;
17413+ case TYPE_COUNT_INT_POINTER:
17414+ *a.arg[dp->arg_index].a.a_count_int_pointer = length;
17415+ break;
17416+ case TYPE_COUNT_LONGINT_POINTER:
17417+ *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
17418+ break;
17419+#ifdef HAVE_LONG_LONG
17420+ case TYPE_COUNT_LONGLONGINT_POINTER:
17421+ *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
17422+ break;
17423+#endif
17424+ default:
17425+ abort ();
17426+ }
17427+ }
17428+ else
17429+ {
17430+ arg_type type = a.arg[dp->arg_index].type;
17431+ CHAR_T *p;
17432+ unsigned int prefix_count;
17433+ int prefixes[2];
17434+#if !USE_SNPRINTF
17435+ size_t tmp_length;
17436+ CHAR_T tmpbuf[700];
17437+ CHAR_T *tmp;
17438+
17439+ /* Allocate a temporary buffer of sufficient size for calling
17440+ sprintf. */
17441+ {
17442+ size_t width;
17443+ size_t precision;
17444+
17445+ width = 0;
17446+ if (dp->width_start != dp->width_end)
17447+ {
17448+ if (dp->width_arg_index != ARG_NONE)
17449+ {
17450+ int arg;
17451+
17452+ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
17453+ abort ();
17454+ arg = a.arg[dp->width_arg_index].a.a_int;
17455+ width = (arg < 0 ? (unsigned int) (-arg) : arg);
17456+ }
17457+ else
17458+ {
17459+ const CHAR_T *digitp = dp->width_start;
17460+
17461+ do
17462+ width = xsum (xtimes (width, 10), *digitp++ - '0');
17463+ while (digitp != dp->width_end);
17464+ }
17465+ }
17466+
17467+ precision = 6;
17468+ if (dp->precision_start != dp->precision_end)
17469+ {
17470+ if (dp->precision_arg_index != ARG_NONE)
17471+ {
17472+ int arg;
17473+
17474+ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
17475+ abort ();
17476+ arg = a.arg[dp->precision_arg_index].a.a_int;
17477+ precision = (arg < 0 ? 0 : arg);
17478+ }
17479+ else
17480+ {
17481+ const CHAR_T *digitp = dp->precision_start + 1;
17482+
17483+ precision = 0;
17484+ do
17485+ precision = xsum (xtimes (precision, 10), *digitp++ - '0');
17486+ while (digitp != dp->precision_end);
17487+ }
17488+ }
17489+
17490+ switch (dp->conversion)
17491+ {
17492+
17493+ case 'd': case 'i': case 'u':
17494+# ifdef HAVE_LONG_LONG
17495+ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
17496+ tmp_length =
17497+ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
17498+ * 0.30103 /* binary -> decimal */
17499+ * 2 /* estimate for FLAG_GROUP */
17500+ )
17501+ + 1 /* turn floor into ceil */
17502+ + 1; /* account for leading sign */
17503+ else
17504+# endif
17505+ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
17506+ tmp_length =
17507+ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
17508+ * 0.30103 /* binary -> decimal */
17509+ * 2 /* estimate for FLAG_GROUP */
17510+ )
17511+ + 1 /* turn floor into ceil */
17512+ + 1; /* account for leading sign */
17513+ else
17514+ tmp_length =
17515+ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
17516+ * 0.30103 /* binary -> decimal */
17517+ * 2 /* estimate for FLAG_GROUP */
17518+ )
17519+ + 1 /* turn floor into ceil */
17520+ + 1; /* account for leading sign */
17521+ break;
17522+
17523+ case 'o':
17524+# ifdef HAVE_LONG_LONG
17525+ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
17526+ tmp_length =
17527+ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
17528+ * 0.333334 /* binary -> octal */
17529+ )
17530+ + 1 /* turn floor into ceil */
17531+ + 1; /* account for leading sign */
17532+ else
17533+# endif
17534+ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
17535+ tmp_length =
17536+ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
17537+ * 0.333334 /* binary -> octal */
17538+ )
17539+ + 1 /* turn floor into ceil */
17540+ + 1; /* account for leading sign */
17541+ else
17542+ tmp_length =
17543+ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
17544+ * 0.333334 /* binary -> octal */
17545+ )
17546+ + 1 /* turn floor into ceil */
17547+ + 1; /* account for leading sign */
17548+ break;
17549+
17550+ case 'x': case 'X':
17551+# ifdef HAVE_LONG_LONG
17552+ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
17553+ tmp_length =
17554+ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
17555+ * 0.25 /* binary -> hexadecimal */
17556+ )
17557+ + 1 /* turn floor into ceil */
17558+ + 2; /* account for leading sign or alternate form */
17559+ else
17560+# endif
17561+ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
17562+ tmp_length =
17563+ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
17564+ * 0.25 /* binary -> hexadecimal */
17565+ )
17566+ + 1 /* turn floor into ceil */
17567+ + 2; /* account for leading sign or alternate form */
17568+ else
17569+ tmp_length =
17570+ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
17571+ * 0.25 /* binary -> hexadecimal */
17572+ )
17573+ + 1 /* turn floor into ceil */
17574+ + 2; /* account for leading sign or alternate form */
17575+ break;
17576+
17577+ case 'f': case 'F':
17578+# ifdef HAVE_LONG_DOUBLE
17579+ if (type == TYPE_LONGDOUBLE)
17580+ tmp_length =
17581+ (unsigned int) (LDBL_MAX_EXP
17582+ * 0.30103 /* binary -> decimal */
17583+ * 2 /* estimate for FLAG_GROUP */
17584+ )
17585+ + 1 /* turn floor into ceil */
17586+ + 10; /* sign, decimal point etc. */
17587+ else
17588+# endif
17589+ tmp_length =
17590+ (unsigned int) (DBL_MAX_EXP
17591+ * 0.30103 /* binary -> decimal */
17592+ * 2 /* estimate for FLAG_GROUP */
17593+ )
17594+ + 1 /* turn floor into ceil */
17595+ + 10; /* sign, decimal point etc. */
17596+ tmp_length = xsum (tmp_length, precision);
17597+ break;
17598+
17599+ case 'e': case 'E': case 'g': case 'G':
17600+ case 'a': case 'A':
17601+ tmp_length =
17602+ 12; /* sign, decimal point, exponent etc. */
17603+ tmp_length = xsum (tmp_length, precision);
17604+ break;
17605+
17606+ case 'c':
17607+# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION
17608+ if (type == TYPE_WIDE_CHAR)
17609+ tmp_length = MB_CUR_MAX;
17610+ else
17611+# endif
17612+ tmp_length = 1;
17613+ break;
17614+
17615+ case 's':
17616+# ifdef HAVE_WCHAR_T
17617+ if (type == TYPE_WIDE_STRING)
17618+ {
17619+ tmp_length =
17620+ local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
17621+
17622+# if !WIDE_CHAR_VERSION
17623+ tmp_length = xtimes (tmp_length, MB_CUR_MAX);
17624+# endif
17625+ }
17626+ else
17627+# endif
17628+ tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
17629+ break;
17630+
17631+ case 'p':
17632+ tmp_length =
17633+ (unsigned int) (sizeof (void *) * CHAR_BIT
17634+ * 0.25 /* binary -> hexadecimal */
17635+ )
17636+ + 1 /* turn floor into ceil */
17637+ + 2; /* account for leading 0x */
17638+ break;
17639+
17640+ default:
17641+ abort ();
17642+ }
17643+
17644+ if (tmp_length < width)
17645+ tmp_length = width;
17646+
17647+ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
17648+ }
17649+
17650+ if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T))
17651+ tmp = tmpbuf;
17652+ else
17653+ {
17654+ size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T));
17655+
17656+ if (size_overflow_p (tmp_memsize))
17657+ /* Overflow, would lead to out of memory. */
17658+ goto out_of_memory;
17659+ tmp = (CHAR_T *) malloc (tmp_memsize);
17660+ if (tmp == NULL)
17661+ /* Out of memory. */
17662+ goto out_of_memory;
17663+ }
17664+#endif
17665+
17666+ /* Construct the format string for calling snprintf or
17667+ sprintf. */
17668+ p = buf;
17669+ *p++ = '%';
17670+ if (dp->flags & FLAG_GROUP)
17671+ *p++ = '\'';
17672+ if (dp->flags & FLAG_LEFT)
17673+ *p++ = '-';
17674+ if (dp->flags & FLAG_SHOWSIGN)
17675+ *p++ = '+';
17676+ if (dp->flags & FLAG_SPACE)
17677+ *p++ = ' ';
17678+ if (dp->flags & FLAG_ALT)
17679+ *p++ = '#';
17680+ if (dp->flags & FLAG_ZERO)
17681+ *p++ = '0';
17682+ if (dp->width_start != dp->width_end)
17683+ {
17684+ size_t n = dp->width_end - dp->width_start;
17685+ memcpy (p, dp->width_start, n * sizeof (CHAR_T));
17686+ p += n;
17687+ }
17688+ if (dp->precision_start != dp->precision_end)
17689+ {
17690+ size_t n = dp->precision_end - dp->precision_start;
17691+ memcpy (p, dp->precision_start, n * sizeof (CHAR_T));
17692+ p += n;
17693+ }
17694+
17695+ switch (type)
17696+ {
17697+#ifdef HAVE_LONG_LONG
17698+ case TYPE_LONGLONGINT:
17699+ case TYPE_ULONGLONGINT:
17700+ *p++ = 'l';
17701+ /*FALLTHROUGH*/
17702+#endif
17703+ case TYPE_LONGINT:
17704+ case TYPE_ULONGINT:
17705+#ifdef HAVE_WINT_T
17706+ case TYPE_WIDE_CHAR:
17707+#endif
17708+#ifdef HAVE_WCHAR_T
17709+ case TYPE_WIDE_STRING:
17710+#endif
17711+ *p++ = 'l';
17712+ break;
17713+#ifdef HAVE_LONG_DOUBLE
17714+ case TYPE_LONGDOUBLE:
17715+ *p++ = 'L';
17716+ break;
17717+#endif
17718+ default:
17719+ break;
17720+ }
17721+ *p = dp->conversion;
17722+#if USE_SNPRINTF
17723+ p[1] = '%';
17724+ p[2] = 'n';
17725+ p[3] = '\0';
17726+#else
17727+ p[1] = '\0';
17728+#endif
17729+
17730+ /* Construct the arguments for calling snprintf or sprintf. */
17731+ prefix_count = 0;
17732+ if (dp->width_arg_index != ARG_NONE)
17733+ {
17734+ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
17735+ abort ();
17736+ prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
17737+ }
17738+ if (dp->precision_arg_index != ARG_NONE)
17739+ {
17740+ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
17741+ abort ();
17742+ prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
17743+ }
17744+
17745+#if USE_SNPRINTF
17746+ /* Prepare checking whether snprintf returns the count
17747+ via %n. */
17748+ ENSURE_ALLOCATION (xsum (length, 1));
17749+ result[length] = '\0';
17750+#endif
17751+
17752+ for (;;)
17753+ {
17754+ size_t maxlen;
17755+ int count;
17756+ int retcount;
17757+
17758+ maxlen = allocated - length;
17759+ count = -1;
17760+ retcount = 0;
17761+
17762+#if USE_SNPRINTF
17763+# define SNPRINTF_BUF(arg) \
17764+ switch (prefix_count) \
17765+ { \
17766+ case 0: \
17767+ retcount = SNPRINTF (result + length, maxlen, buf, \
17768+ arg, &count); \
17769+ break; \
17770+ case 1: \
17771+ retcount = SNPRINTF (result + length, maxlen, buf, \
17772+ prefixes[0], arg, &count); \
17773+ break; \
17774+ case 2: \
17775+ retcount = SNPRINTF (result + length, maxlen, buf, \
17776+ prefixes[0], prefixes[1], arg, \
17777+ &count); \
17778+ break; \
17779+ default: \
17780+ abort (); \
17781+ }
17782+#else
17783+# define SNPRINTF_BUF(arg) \
17784+ switch (prefix_count) \
17785+ { \
17786+ case 0: \
17787+ count = sprintf (tmp, buf, arg); \
17788+ break; \
17789+ case 1: \
17790+ count = sprintf (tmp, buf, prefixes[0], arg); \
17791+ break; \
17792+ case 2: \
17793+ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
17794+ arg); \
17795+ break; \
17796+ default: \
17797+ abort (); \
17798+ }
17799+#endif
17800+
17801+ switch (type)
17802+ {
17803+ case TYPE_SCHAR:
17804+ {
17805+ int arg = a.arg[dp->arg_index].a.a_schar;
17806+ SNPRINTF_BUF (arg);
17807+ }
17808+ break;
17809+ case TYPE_UCHAR:
17810+ {
17811+ unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
17812+ SNPRINTF_BUF (arg);
17813+ }
17814+ break;
17815+ case TYPE_SHORT:
17816+ {
17817+ int arg = a.arg[dp->arg_index].a.a_short;
17818+ SNPRINTF_BUF (arg);
17819+ }
17820+ break;
17821+ case TYPE_USHORT:
17822+ {
17823+ unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
17824+ SNPRINTF_BUF (arg);
17825+ }
17826+ break;
17827+ case TYPE_INT:
17828+ {
17829+ int arg = a.arg[dp->arg_index].a.a_int;
17830+ SNPRINTF_BUF (arg);
17831+ }
17832+ break;
17833+ case TYPE_UINT:
17834+ {
17835+ unsigned int arg = a.arg[dp->arg_index].a.a_uint;
17836+ SNPRINTF_BUF (arg);
17837+ }
17838+ break;
17839+ case TYPE_LONGINT:
17840+ {
17841+ long int arg = a.arg[dp->arg_index].a.a_longint;
17842+ SNPRINTF_BUF (arg);
17843+ }
17844+ break;
17845+ case TYPE_ULONGINT:
17846+ {
17847+ unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
17848+ SNPRINTF_BUF (arg);
17849+ }
17850+ break;
17851+#ifdef HAVE_LONG_LONG
17852+ case TYPE_LONGLONGINT:
17853+ {
17854+ long long int arg = a.arg[dp->arg_index].a.a_longlongint;
17855+ SNPRINTF_BUF (arg);
17856+ }
17857+ break;
17858+ case TYPE_ULONGLONGINT:
17859+ {
17860+ unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
17861+ SNPRINTF_BUF (arg);
17862+ }
17863+ break;
17864+#endif
17865+ case TYPE_DOUBLE:
17866+ {
17867+ double arg = a.arg[dp->arg_index].a.a_double;
17868+ SNPRINTF_BUF (arg);
17869+ }
17870+ break;
17871+#ifdef HAVE_LONG_DOUBLE
17872+ case TYPE_LONGDOUBLE:
17873+ {
17874+ long double arg = a.arg[dp->arg_index].a.a_longdouble;
17875+ SNPRINTF_BUF (arg);
17876+ }
17877+ break;
17878+#endif
17879+ case TYPE_CHAR:
17880+ {
17881+ int arg = a.arg[dp->arg_index].a.a_char;
17882+ SNPRINTF_BUF (arg);
17883+ }
17884+ break;
17885+#ifdef HAVE_WINT_T
17886+ case TYPE_WIDE_CHAR:
17887+ {
17888+ wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
17889+ SNPRINTF_BUF (arg);
17890+ }
17891+ break;
17892+#endif
17893+ case TYPE_STRING:
17894+ {
17895+ const char *arg = a.arg[dp->arg_index].a.a_string;
17896+ SNPRINTF_BUF (arg);
17897+ }
17898+ break;
17899+#ifdef HAVE_WCHAR_T
17900+ case TYPE_WIDE_STRING:
17901+ {
17902+ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
17903+ SNPRINTF_BUF (arg);
17904+ }
17905+ break;
17906+#endif
17907+ case TYPE_POINTER:
17908+ {
17909+ void *arg = a.arg[dp->arg_index].a.a_pointer;
17910+ SNPRINTF_BUF (arg);
17911+ }
17912+ break;
17913+ default:
17914+ abort ();
17915+ }
17916+
17917+#if USE_SNPRINTF
17918+ /* Portability: Not all implementations of snprintf()
17919+ are ISO C 99 compliant. Determine the number of
17920+ bytes that snprintf() has produced or would have
17921+ produced. */
17922+ if (count >= 0)
17923+ {
17924+ /* Verify that snprintf() has NUL-terminated its
17925+ result. */
17926+ if (count < maxlen && result[length + count] != '\0')
17927+ abort ();
17928+ /* Portability hack. */
17929+ if (retcount > count)
17930+ count = retcount;
17931+ }
17932+ else
17933+ {
17934+ /* snprintf() doesn't understand the '%n'
17935+ directive. */
17936+ if (p[1] != '\0')
17937+ {
17938+ /* Don't use the '%n' directive; instead, look
17939+ at the snprintf() return value. */
17940+ p[1] = '\0';
17941+ continue;
17942+ }
17943+ else
17944+ {
17945+ /* Look at the snprintf() return value. */
17946+ if (retcount < 0)
17947+ {
17948+ /* HP-UX 10.20 snprintf() is doubly deficient:
17949+ It doesn't understand the '%n' directive,
17950+ *and* it returns -1 (rather than the length
17951+ that would have been required) when the
17952+ buffer is too small. */
17953+ size_t bigger_need =
17954+ xsum (xtimes (allocated, 2), 12);
17955+ ENSURE_ALLOCATION (bigger_need);
17956+ continue;
17957+ }
17958+ else
17959+ count = retcount;
17960+ }
17961+ }
17962+#endif
17963+
17964+ /* Attempt to handle failure. */
17965+ if (count < 0)
17966+ {
17967+ if (!(result == resultbuf || result == NULL))
17968+ free (result);
17969+ if (buf_malloced != NULL)
17970+ free (buf_malloced);
17971+ CLEANUP ();
17972+ errno = EINVAL;
17973+ return NULL;
17974+ }
17975+
17976+#if !USE_SNPRINTF
17977+ if (count >= tmp_length)
17978+ /* tmp_length was incorrectly calculated - fix the
17979+ code above! */
17980+ abort ();
17981+#endif
17982+
17983+ /* Make room for the result. */
17984+ if (count >= maxlen)
17985+ {
17986+ /* Need at least count bytes. But allocate
17987+ proportionally, to avoid looping eternally if
17988+ snprintf() reports a too small count. */
17989+ size_t n =
17990+ xmax (xsum (length, count), xtimes (allocated, 2));
17991+
17992+ ENSURE_ALLOCATION (n);
17993+#if USE_SNPRINTF
17994+ continue;
17995+#endif
17996+ }
17997+
17998+#if USE_SNPRINTF
17999+ /* The snprintf() result did fit. */
18000+#else
18001+ /* Append the sprintf() result. */
18002+ memcpy (result + length, tmp, count * sizeof (CHAR_T));
18003+ if (tmp != tmpbuf)
18004+ free (tmp);
18005+#endif
18006+
18007+ length += count;
18008+ break;
18009+ }
18010+ }
18011+ }
18012+ }
18013+
18014+ /* Add the final NUL. */
18015+ ENSURE_ALLOCATION (xsum (length, 1));
18016+ result[length] = '\0';
18017+
18018+ if (result != resultbuf && length + 1 < allocated)
18019+ {
18020+ /* Shrink the allocated memory if possible. */
18021+ CHAR_T *memory;
18022+
18023+ memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T));
18024+ if (memory != NULL)
18025+ result = memory;
18026+ }
18027+
18028+ if (buf_malloced != NULL)
18029+ free (buf_malloced);
18030+ CLEANUP ();
18031+ *lengthp = length;
18032+ return result;
18033+
18034+ out_of_memory:
18035+ if (!(result == resultbuf || result == NULL))
18036+ free (result);
18037+ if (buf_malloced != NULL)
18038+ free (buf_malloced);
18039+ out_of_memory_1:
18040+ CLEANUP ();
18041+ errno = ENOMEM;
18042+ return NULL;
18043+ }
18044+}
18045+
18046+#undef SNPRINTF
18047+#undef USE_SNPRINTF
18048+#undef PRINTF_PARSE
18049+#undef DIRECTIVES
18050+#undef DIRECTIVE
18051+#undef CHAR_T
18052+#undef VASNPRINTF
18053--- lrzsz-0.12.20.safe/intl/vasnprintf.h 1969-12-31 19:00:00.000000000 -0500
18054+++ lrzsz-0.12.20/intl/vasnprintf.h 2004-09-12 14:40:34.667700664 -0400
18055@@ -0,0 +1,61 @@
18056+/* vsprintf with automatic memory allocation.
18057+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
18058+
18059+ This program is free software; you can redistribute it and/or modify it
18060+ under the terms of the GNU Library General Public License as published
18061+ by the Free Software Foundation; either version 2, or (at your option)
18062+ any later version.
18063+
18064+ This program is distributed in the hope that it will be useful,
18065+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18066+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18067+ Library General Public License for more details.
18068+
18069+ You should have received a copy of the GNU Library General Public
18070+ License along with this program; if not, write to the Free Software
18071+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18072+ USA. */
18073+
18074+#ifndef _VASNPRINTF_H
18075+#define _VASNPRINTF_H
18076+
18077+/* Get va_list. */
18078+#include <stdarg.h>
18079+
18080+/* Get size_t. */
18081+#include <stddef.h>
18082+
18083+#ifndef __attribute__
18084+/* This feature is available in gcc versions 2.5 and later. */
18085+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
18086+# define __attribute__(Spec) /* empty */
18087+# endif
18088+/* The __-protected variants of `format' and `printf' attributes
18089+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
18090+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
18091+# define __format__ format
18092+# define __printf__ printf
18093+# endif
18094+#endif
18095+
18096+#ifdef __cplusplus
18097+extern "C" {
18098+#endif
18099+
18100+/* Write formatted output to a string dynamically allocated with malloc().
18101+ You can pass a preallocated buffer for the result in RESULTBUF and its
18102+ size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
18103+ If successful, return the address of the string (this may be = RESULTBUF
18104+ if no dynamic memory allocation was necessary) and set *LENGTHP to the
18105+ number of resulting bytes, excluding the trailing NUL. Upon error, set
18106+ errno and return NULL. */
18107+extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
18108+ __attribute__ ((__format__ (__printf__, 3, 4)));
18109+extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
18110+ __attribute__ ((__format__ (__printf__, 3, 0)));
18111+
18112+#ifdef __cplusplus
18113+}
18114+#endif
18115+
18116+#endif /* _VASNPRINTF_H */
18117--- lrzsz-0.12.20.safe/intl/vasnwprintf.h 1969-12-31 19:00:00.000000000 -0500
18118+++ lrzsz-0.12.20/intl/vasnwprintf.h 2004-09-12 14:40:34.673699752 -0400
18119@@ -0,0 +1,46 @@
18120+/* vswprintf with automatic memory allocation.
18121+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
18122+
18123+ This program is free software; you can redistribute it and/or modify it
18124+ under the terms of the GNU Library General Public License as published
18125+ by the Free Software Foundation; either version 2, or (at your option)
18126+ any later version.
18127+
18128+ This program is distributed in the hope that it will be useful,
18129+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18130+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18131+ Library General Public License for more details.
18132+
18133+ You should have received a copy of the GNU Library General Public
18134+ License along with this program; if not, write to the Free Software
18135+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18136+ USA. */
18137+
18138+#ifndef _VASNWPRINTF_H
18139+#define _VASNWPRINTF_H
18140+
18141+/* Get va_list. */
18142+#include <stdarg.h>
18143+
18144+/* Get wchar_t, size_t. */
18145+#include <stddef.h>
18146+
18147+#ifdef __cplusplus
18148+extern "C" {
18149+#endif
18150+
18151+/* Write formatted output to a string dynamically allocated with malloc().
18152+ You can pass a preallocated buffer for the result in RESULTBUF and its
18153+ size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
18154+ If successful, return the address of the string (this may be = RESULTBUF
18155+ if no dynamic memory allocation was necessary) and set *LENGTHP to the
18156+ number of resulting bytes, excluding the trailing NUL. Upon error, set
18157+ errno and return NULL. */
18158+extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...);
18159+extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args);
18160+
18161+#ifdef __cplusplus
18162+}
18163+#endif
18164+
18165+#endif /* _VASNWPRINTF_H */
18166--- lrzsz-0.12.20.safe/intl/VERSION 1998-04-26 09:22:37.000000000 -0400
18167+++ lrzsz-0.12.20/intl/VERSION 2004-09-12 14:40:34.679698840 -0400
18168@@ -1 +1 @@
18169-GNU gettext library from gettext-0.10.32
18170+GNU gettext library from gettext-0.14.1
18171--- lrzsz-0.12.20.safe/intl/wprintf-parse.h 1969-12-31 19:00:00.000000000 -0500
18172+++ lrzsz-0.12.20/intl/wprintf-parse.h 2004-09-12 14:40:34.695696408 -0400
18173@@ -0,0 +1,75 @@
18174+/* Parse printf format string.
18175+ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
18176+
18177+ This program is free software; you can redistribute it and/or modify it
18178+ under the terms of the GNU Library General Public License as published
18179+ by the Free Software Foundation; either version 2, or (at your option)
18180+ any later version.
18181+
18182+ This program is distributed in the hope that it will be useful,
18183+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18184+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18185+ Library General Public License for more details.
18186+
18187+ You should have received a copy of the GNU Library General Public
18188+ License along with this program; if not, write to the Free Software
18189+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18190+ USA. */
18191+
18192+#ifndef _WPRINTF_PARSE_H
18193+#define _WPRINTF_PARSE_H
18194+
18195+#include "printf-args.h"
18196+
18197+
18198+/* Flags */
18199+#define FLAG_GROUP 1 /* ' flag */
18200+#define FLAG_LEFT 2 /* - flag */
18201+#define FLAG_SHOWSIGN 4 /* + flag */
18202+#define FLAG_SPACE 8 /* space flag */
18203+#define FLAG_ALT 16 /* # flag */
18204+#define FLAG_ZERO 32
18205+
18206+/* arg_index value indicating that no argument is consumed. */
18207+#define ARG_NONE (~(size_t)0)
18208+
18209+/* A parsed directive. */
18210+typedef struct
18211+{
18212+ const wchar_t* dir_start;
18213+ const wchar_t* dir_end;
18214+ int flags;
18215+ const wchar_t* width_start;
18216+ const wchar_t* width_end;
18217+ size_t width_arg_index;
18218+ const wchar_t* precision_start;
18219+ const wchar_t* precision_end;
18220+ size_t precision_arg_index;
18221+ wchar_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */
18222+ size_t arg_index;
18223+}
18224+wchar_t_directive;
18225+
18226+/* A parsed format string. */
18227+typedef struct
18228+{
18229+ size_t count;
18230+ wchar_t_directive *dir;
18231+ size_t max_width_length;
18232+ size_t max_precision_length;
18233+}
18234+wchar_t_directives;
18235+
18236+
18237+/* Parses the format string. Fills in the number N of directives, and fills
18238+ in directives[0], ..., directives[N-1], and sets directives[N].dir_start
18239+ to the end of the format string. Also fills in the arg_type fields of the
18240+ arguments and the needed count of arguments. */
18241+#ifdef STATIC
18242+STATIC
18243+#else
18244+extern
18245+#endif
18246+int wprintf_parse (const wchar_t *format, wchar_t_directives *d, arguments *a);
18247+
18248+#endif /* _WPRINTF_PARSE_H */
18249--- lrzsz-0.12.20.safe/intl/xopen-msg.sed 1998-04-26 09:20:52.000000000 -0400
18250+++ lrzsz-0.12.20/intl/xopen-msg.sed 1969-12-31 19:00:00.000000000 -0500
18251@@ -1,104 +0,0 @@
18252-# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
18253-# Copyright (C) 1995 Free Software Foundation, Inc.
18254-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
18255-#
18256-# This program is free software; you can redistribute it and/or modify
18257-# it under the terms of the GNU General Public License as published by
18258-# the Free Software Foundation; either version 2, or (at your option)
18259-# any later version.
18260-#
18261-# This program is distributed in the hope that it will be useful,
18262-# but WITHOUT ANY WARRANTY; without even the implied warranty of
18263-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18264-# GNU General Public License for more details.
18265-#
18266-# You should have received a copy of the GNU General Public License
18267-# along with this program; if not, write to the Free Software
18268-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18269-#
18270-#
18271-# The first directive in the .msg should be the definition of the
18272-# message set number. We use always set number 1.
18273-#
18274-1 {
18275- i\
18276-$set 1 # Automatically created by po2msg.sed
18277- h
18278- s/.*/0/
18279- x
18280-}
18281-#
18282-# We copy all comments into the .msg file. Perhaps they can help.
18283-#
18284-/^#/ s/^#[ ]*/$ /p
18285-#
18286-# We copy the original message as a comment into the .msg file.
18287-#
18288-/^msgid/ {
18289-# Does not work now
18290-# /"$/! {
18291-# s/\\$//
18292-# s/$/ ... (more lines following)"/
18293-# }
18294- s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
18295- p
18296-}
18297-#
18298-# The .msg file contains, other then the .po file, only the translations
18299-# but each given a unique ID. Starting from 1 and incrementing by 1 for
18300-# each message we assign them to the messages.
18301-# It is important that the .po file used to generate the cat-id-tbl.c file
18302-# (with po-to-tbl) is the same as the one used here. (At least the order
18303-# of declarations must not be changed.)
18304-#
18305-/^msgstr/ {
18306- s/msgstr[ ]*"\(.*\)"/\1/
18307- x
18308-# The following nice solution is by
18309-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
18310- td
18311-# Increment a decimal number in pattern space.
18312-# First hide trailing `9' digits.
18313- :d
18314- s/9\(_*\)$/_\1/
18315- td
18316-# Assure at least one digit is available.
18317- s/^\(_*\)$/0\1/
18318-# Increment the last digit.
18319- s/8\(_*\)$/9\1/
18320- s/7\(_*\)$/8\1/
18321- s/6\(_*\)$/7\1/
18322- s/5\(_*\)$/6\1/
18323- s/4\(_*\)$/5\1/
18324- s/3\(_*\)$/4\1/
18325- s/2\(_*\)$/3\1/
18326- s/1\(_*\)$/2\1/
18327- s/0\(_*\)$/1\1/
18328-# Convert the hidden `9' digits to `0's.
18329- s/_/0/g
18330- x
18331-# Bring the line in the format `<number> <message>'
18332- G
18333- s/^[^\n]*$/& /
18334- s/\(.*\)\n\([0-9]*\)/\2 \1/
18335-# Clear flag from last substitution.
18336- tb
18337-# Append the next line.
18338- :b
18339- N
18340-# Look whether second part is a continuation line.
18341- s/\(.*\n\)"\(.*\)"/\1\2/
18342-# Yes, then branch.
18343- ta
18344- P
18345- D
18346-# Note that `D' includes a jump to the start!!
18347-# We found a continuation line. But before printing insert '\'.
18348- :a
18349- s/\(.*\)\(\n.*\)/\1\\\2/
18350- P
18351-# We cannot use the sed command `D' here
18352- s/.*\n\(.*\)/\1/
18353- tb
18354-}
18355-d
18356--- lrzsz-0.12.20.safe/intl/xsize.h 1969-12-31 19:00:00.000000000 -0500
18357+++ lrzsz-0.12.20/intl/xsize.h 2004-09-12 14:40:34.700695648 -0400
18358@@ -0,0 +1,109 @@
18359+/* xsize.h -- Checked size_t computations.
18360+
18361+ Copyright (C) 2003 Free Software Foundation, Inc.
18362+
18363+ This program is free software; you can redistribute it and/or modify it
18364+ under the terms of the GNU Library General Public License as published
18365+ by the Free Software Foundation; either version 2, or (at your option)
18366+ any later version.
18367+
18368+ This program is distributed in the hope that it will be useful,
18369+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18370+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18371+ Library General Public License for more details.
18372+
18373+ You should have received a copy of the GNU Library General Public
18374+ License along with this program; if not, write to the Free Software
18375+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18376+ USA. */
18377+
18378+#ifndef _XSIZE_H
18379+#define _XSIZE_H
18380+
18381+/* Get size_t. */
18382+#include <stddef.h>
18383+
18384+/* Get SIZE_MAX. */
18385+#include <limits.h>
18386+#if HAVE_STDINT_H
18387+# include <stdint.h>
18388+#endif
18389+
18390+/* The size of memory objects is often computed through expressions of
18391+ type size_t. Example:
18392+ void* p = malloc (header_size + n * element_size).
18393+ These computations can lead to overflow. When this happens, malloc()
18394+ returns a piece of memory that is way too small, and the program then
18395+ crashes while attempting to fill the memory.
18396+ To avoid this, the functions and macros in this file check for overflow.
18397+ The convention is that SIZE_MAX represents overflow.
18398+ malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
18399+ implementation that uses mmap --, it's recommended to use size_overflow_p()
18400+ or size_in_bounds_p() before invoking malloc().
18401+ The example thus becomes:
18402+ size_t size = xsum (header_size, xtimes (n, element_size));
18403+ void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
18404+*/
18405+
18406+/* Convert an arbitrary value >= 0 to type size_t. */
18407+#define xcast_size_t(N) \
18408+ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
18409+
18410+/* Sum of two sizes, with overflow check. */
18411+static inline size_t
18412+#if __GNUC__ >= 3
18413+__attribute__ ((__pure__))
18414+#endif
18415+xsum (size_t size1, size_t size2)
18416+{
18417+ size_t sum = size1 + size2;
18418+ return (sum >= size1 ? sum : SIZE_MAX);
18419+}
18420+
18421+/* Sum of three sizes, with overflow check. */
18422+static inline size_t
18423+#if __GNUC__ >= 3
18424+__attribute__ ((__pure__))
18425+#endif
18426+xsum3 (size_t size1, size_t size2, size_t size3)
18427+{
18428+ return xsum (xsum (size1, size2), size3);
18429+}
18430+
18431+/* Sum of four sizes, with overflow check. */
18432+static inline size_t
18433+#if __GNUC__ >= 3
18434+__attribute__ ((__pure__))
18435+#endif
18436+xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
18437+{
18438+ return xsum (xsum (xsum (size1, size2), size3), size4);
18439+}
18440+
18441+/* Maximum of two sizes, with overflow check. */
18442+static inline size_t
18443+#if __GNUC__ >= 3
18444+__attribute__ ((__pure__))
18445+#endif
18446+xmax (size_t size1, size_t size2)
18447+{
18448+ /* No explicit check is needed here, because for any n:
18449+ max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
18450+ return (size1 >= size2 ? size1 : size2);
18451+}
18452+
18453+/* Multiplication of a count with an element size, with overflow check.
18454+ The count must be >= 0 and the element size must be > 0.
18455+ This is a macro, not an inline function, so that it works correctly even
18456+ when N is of a wider tupe and N > SIZE_MAX. */
18457+#define xtimes(N, ELSIZE) \
18458+ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
18459+
18460+/* Check for overflow. */
18461+#define size_overflow_p(SIZE) \
18462+ ((SIZE) == SIZE_MAX)
18463+/* Check against overflow. */
18464+#define size_in_bounds_p(SIZE) \
18465+ ((SIZE) != SIZE_MAX)
18466+
18467+#endif /* _XSIZE_H */
18468--- lrzsz-0.12.20.safe/m4/ChangeLog 1969-12-31 19:00:00.000000000 -0500
18469+++ lrzsz-0.12.20/m4/ChangeLog 2004-09-12 14:40:35.054641840 -0400
18470@@ -0,0 +1,32 @@
18471+2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
18472+
18473+ * codeset.m4: New file, from gettext-0.14.1.
18474+ * gettext.m4: New file, from gettext-0.14.1.
18475+ * glibc21.m4: New file, from gettext-0.14.1.
18476+ * iconv.m4: New file, from gettext-0.14.1.
18477+ * intdiv0.m4: New file, from gettext-0.14.1.
18478+ * intmax.m4: New file, from gettext-0.14.1.
18479+ * inttypes.m4: New file, from gettext-0.14.1.
18480+ * inttypes_h.m4: New file, from gettext-0.14.1.
18481+ * inttypes-pri.m4: New file, from gettext-0.14.1.
18482+ * isc-posix.m4: New file, from gettext-0.14.1.
18483+ * lcmessage.m4: New file, from gettext-0.14.1.
18484+ * lib-ld.m4: New file, from gettext-0.14.1.
18485+ * lib-link.m4: New file, from gettext-0.14.1.
18486+ * lib-prefix.m4: New file, from gettext-0.14.1.
18487+ * longdouble.m4: New file, from gettext-0.14.1.
18488+ * longlong.m4: New file, from gettext-0.14.1.
18489+ * nls.m4: New file, from gettext-0.14.1.
18490+ * po.m4: New file, from gettext-0.14.1.
18491+ * printf-posix.m4: New file, from gettext-0.14.1.
18492+ * progtest.m4: New file, from gettext-0.14.1.
18493+ * signed.m4: New file, from gettext-0.14.1.
18494+ * size_max.m4: New file, from gettext-0.14.1.
18495+ * stdint_h.m4: New file, from gettext-0.14.1.
18496+ * uintmax_t.m4: New file, from gettext-0.14.1.
18497+ * ulonglong.m4: New file, from gettext-0.14.1.
18498+ * wchar_t.m4: New file, from gettext-0.14.1.
18499+ * wint_t.m4: New file, from gettext-0.14.1.
18500+ * xsize.m4: New file, from gettext-0.14.1.
18501+ * Makefile.am: New file.
18502+
18503--- lrzsz-0.12.20.safe/m4/codeset.m4 1969-12-31 19:00:00.000000000 -0500
18504+++ lrzsz-0.12.20/m4/codeset.m4 2004-09-12 14:40:34.820677408 -0400
18505@@ -0,0 +1,23 @@
18506+# codeset.m4 serial AM1 (gettext-0.10.40)
18507+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
18508+dnl This file is free software, distributed under the terms of the GNU
18509+dnl General Public License. As a special exception to the GNU General
18510+dnl Public License, this file may be distributed as part of a program
18511+dnl that contains a configuration script generated by Autoconf, under
18512+dnl the same distribution terms as the rest of that program.
18513+
18514+dnl From Bruno Haible.
18515+
18516+AC_DEFUN([AM_LANGINFO_CODESET],
18517+[
18518+ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
18519+ [AC_TRY_LINK([#include <langinfo.h>],
18520+ [char* cs = nl_langinfo(CODESET);],
18521+ am_cv_langinfo_codeset=yes,
18522+ am_cv_langinfo_codeset=no)
18523+ ])
18524+ if test $am_cv_langinfo_codeset = yes; then
18525+ AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
18526+ [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
18527+ fi
18528+])
18529--- lrzsz-0.12.20.safe/m4/gettext.m4 1969-12-31 19:00:00.000000000 -0500
18530+++ lrzsz-0.12.20/m4/gettext.m4 2004-09-12 14:40:34.826676496 -0400
18531@@ -0,0 +1,487 @@
18532+# gettext.m4 serial 28 (gettext-0.13)
18533+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
18534+dnl This file is free software, distributed under the terms of the GNU
18535+dnl General Public License. As a special exception to the GNU General
18536+dnl Public License, this file may be distributed as part of a program
18537+dnl that contains a configuration script generated by Autoconf, under
18538+dnl the same distribution terms as the rest of that program.
18539+dnl
18540+dnl This file can can be used in projects which are not available under
18541+dnl the GNU General Public License or the GNU Library General Public
18542+dnl License but which still want to provide support for the GNU gettext
18543+dnl functionality.
18544+dnl Please note that the actual code of the GNU gettext library is covered
18545+dnl by the GNU Library General Public License, and the rest of the GNU
18546+dnl gettext package package is covered by the GNU General Public License.
18547+dnl They are *not* in the public domain.
18548+
18549+dnl Authors:
18550+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18551+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
18552+
18553+dnl Macro to add for using GNU gettext.
18554+
18555+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
18556+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
18557+dnl default (if it is not specified or empty) is 'no-libtool'.
18558+dnl INTLSYMBOL should be 'external' for packages with no intl directory,
18559+dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
18560+dnl If INTLSYMBOL is 'use-libtool', then a libtool library
18561+dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
18562+dnl depending on --{enable,disable}-{shared,static} and on the presence of
18563+dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
18564+dnl $(top_builddir)/intl/libintl.a will be created.
18565+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
18566+dnl implementations (in libc or libintl) without the ngettext() function
18567+dnl will be ignored. If NEEDSYMBOL is specified and is
18568+dnl 'need-formatstring-macros', then GNU gettext implementations that don't
18569+dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
18570+dnl INTLDIR is used to find the intl libraries. If empty,
18571+dnl the value `$(top_builddir)/intl/' is used.
18572+dnl
18573+dnl The result of the configuration is one of three cases:
18574+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
18575+dnl and used.
18576+dnl Catalog format: GNU --> install in $(datadir)
18577+dnl Catalog extension: .mo after installation, .gmo in source tree
18578+dnl 2) GNU gettext has been found in the system's C library.
18579+dnl Catalog format: GNU --> install in $(datadir)
18580+dnl Catalog extension: .mo after installation, .gmo in source tree
18581+dnl 3) No internationalization, always use English msgid.
18582+dnl Catalog format: none
18583+dnl Catalog extension: none
18584+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
18585+dnl The use of .gmo is historical (it was needed to avoid overwriting the
18586+dnl GNU format catalogs when building on a platform with an X/Open gettext),
18587+dnl but we keep it in order not to force irrelevant filename changes on the
18588+dnl maintainers.
18589+dnl
18590+AC_DEFUN([AM_GNU_GETTEXT],
18591+[
18592+ dnl Argument checking.
18593+ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
18594+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
18595+])])])])])
18596+ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
18597+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
18598+])])])])
18599+ define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
18600+ define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
18601+
18602+ AC_REQUIRE([AM_PO_SUBDIRS])dnl
18603+ ifelse(gt_included_intl, yes, [
18604+ AC_REQUIRE([AM_INTL_SUBDIR])dnl
18605+ ])
18606+
18607+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
18608+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18609+ AC_REQUIRE([AC_LIB_RPATH])
18610+
18611+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
18612+ dnl Ideally we would do this search only after the
18613+ dnl if test "$USE_NLS" = "yes"; then
18614+ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
18615+ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
18616+ dnl the configure script would need to contain the same shell code
18617+ dnl again, outside any 'if'. There are two solutions:
18618+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
18619+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
18620+ dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
18621+ dnl documented, we avoid it.
18622+ ifelse(gt_included_intl, yes, , [
18623+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
18624+ ])
18625+
18626+ dnl Set USE_NLS.
18627+ AM_NLS
18628+
18629+ ifelse(gt_included_intl, yes, [
18630+ BUILD_INCLUDED_LIBINTL=no
18631+ USE_INCLUDED_LIBINTL=no
18632+ ])
18633+ LIBINTL=
18634+ LTLIBINTL=
18635+ POSUB=
18636+
18637+ dnl If we use NLS figure out what method
18638+ if test "$USE_NLS" = "yes"; then
18639+ gt_use_preinstalled_gnugettext=no
18640+ ifelse(gt_included_intl, yes, [
18641+ AC_MSG_CHECKING([whether included gettext is requested])
18642+ AC_ARG_WITH(included-gettext,
18643+ [ --with-included-gettext use the GNU gettext library included here],
18644+ nls_cv_force_use_gnu_gettext=$withval,
18645+ nls_cv_force_use_gnu_gettext=no)
18646+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
18647+
18648+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
18649+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
18650+ ])
18651+ dnl User does not insist on using GNU NLS library. Figure out what
18652+ dnl to use. If GNU gettext is available we use this. Else we have
18653+ dnl to fall back to GNU NLS library.
18654+
18655+ dnl Add a version number to the cache macros.
18656+ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
18657+ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
18658+ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
18659+
18660+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
18661+ [AC_TRY_LINK([#include <libintl.h>
18662+]ifelse([$2], [need-formatstring-macros],
18663+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
18664+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
18665+#endif
18666+changequote(,)dnl
18667+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
18668+changequote([,])dnl
18669+], [])[extern int _nl_msg_cat_cntr;
18670+extern int *_nl_domain_bindings;],
18671+ [bindtextdomain ("", "");
18672+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
18673+ gt_cv_func_gnugettext_libc=yes,
18674+ gt_cv_func_gnugettext_libc=no)])
18675+
18676+ if test "$gt_cv_func_gnugettext_libc" != "yes"; then
18677+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
18678+ ifelse(gt_included_intl, yes, , [
18679+ AM_ICONV_LINK
18680+ ])
18681+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
18682+ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
18683+ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
18684+ dnl even if libiconv doesn't exist.
18685+ AC_LIB_LINKFLAGS_BODY([intl])
18686+ AC_CACHE_CHECK([for GNU gettext in libintl],
18687+ gt_cv_func_gnugettext_libintl,
18688+ [gt_save_CPPFLAGS="$CPPFLAGS"
18689+ CPPFLAGS="$CPPFLAGS $INCINTL"
18690+ gt_save_LIBS="$LIBS"
18691+ LIBS="$LIBS $LIBINTL"
18692+ dnl Now see whether libintl exists and does not depend on libiconv.
18693+ AC_TRY_LINK([#include <libintl.h>
18694+]ifelse([$2], [need-formatstring-macros],
18695+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
18696+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
18697+#endif
18698+changequote(,)dnl
18699+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
18700+changequote([,])dnl
18701+], [])[extern int _nl_msg_cat_cntr;
18702+extern
18703+#ifdef __cplusplus
18704+"C"
18705+#endif
18706+const char *_nl_expand_alias ();],
18707+ [bindtextdomain ("", "");
18708+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
18709+ gt_cv_func_gnugettext_libintl=yes,
18710+ gt_cv_func_gnugettext_libintl=no)
18711+ dnl Now see whether libintl exists and depends on libiconv.
18712+ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
18713+ LIBS="$LIBS $LIBICONV"
18714+ AC_TRY_LINK([#include <libintl.h>
18715+]ifelse([$2], [need-formatstring-macros],
18716+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
18717+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
18718+#endif
18719+changequote(,)dnl
18720+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
18721+changequote([,])dnl
18722+], [])[extern int _nl_msg_cat_cntr;
18723+extern
18724+#ifdef __cplusplus
18725+"C"
18726+#endif
18727+const char *_nl_expand_alias ();],
18728+ [bindtextdomain ("", "");
18729+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
18730+ [LIBINTL="$LIBINTL $LIBICONV"
18731+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
18732+ gt_cv_func_gnugettext_libintl=yes
18733+ ])
18734+ fi
18735+ CPPFLAGS="$gt_save_CPPFLAGS"
18736+ LIBS="$gt_save_LIBS"])
18737+ fi
18738+
18739+ dnl If an already present or preinstalled GNU gettext() is found,
18740+ dnl use it. But if this macro is used in GNU gettext, and GNU
18741+ dnl gettext is already preinstalled in libintl, we update this
18742+ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
18743+ if test "$gt_cv_func_gnugettext_libc" = "yes" \
18744+ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
18745+ && test "$PACKAGE" != gettext-runtime \
18746+ && test "$PACKAGE" != gettext-tools; }; then
18747+ gt_use_preinstalled_gnugettext=yes
18748+ else
18749+ dnl Reset the values set by searching for libintl.
18750+ LIBINTL=
18751+ LTLIBINTL=
18752+ INCINTL=
18753+ fi
18754+
18755+ ifelse(gt_included_intl, yes, [
18756+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
18757+ dnl GNU gettext is not found in the C library.
18758+ dnl Fall back on included GNU gettext library.
18759+ nls_cv_use_gnu_gettext=yes
18760+ fi
18761+ fi
18762+
18763+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
18764+ dnl Mark actions used to generate GNU NLS library.
18765+ BUILD_INCLUDED_LIBINTL=yes
18766+ USE_INCLUDED_LIBINTL=yes
18767+ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
18768+ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
18769+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
18770+ fi
18771+
18772+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
18773+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
18774+ dnl Mark actions to use GNU gettext tools.
18775+ CATOBJEXT=.gmo
18776+ fi
18777+ ])
18778+
18779+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
18780+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
18781+ AC_DEFINE(ENABLE_NLS, 1,
18782+ [Define to 1 if translation of program messages to the user's native language
18783+ is requested.])
18784+ else
18785+ USE_NLS=no
18786+ fi
18787+ fi
18788+
18789+ AC_MSG_CHECKING([whether to use NLS])
18790+ AC_MSG_RESULT([$USE_NLS])
18791+ if test "$USE_NLS" = "yes"; then
18792+ AC_MSG_CHECKING([where the gettext function comes from])
18793+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
18794+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
18795+ gt_source="external libintl"
18796+ else
18797+ gt_source="libc"
18798+ fi
18799+ else
18800+ gt_source="included intl directory"
18801+ fi
18802+ AC_MSG_RESULT([$gt_source])
18803+ fi
18804+
18805+ if test "$USE_NLS" = "yes"; then
18806+
18807+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
18808+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
18809+ AC_MSG_CHECKING([how to link with libintl])
18810+ AC_MSG_RESULT([$LIBINTL])
18811+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
18812+ fi
18813+
18814+ dnl For backward compatibility. Some packages may be using this.
18815+ AC_DEFINE(HAVE_GETTEXT, 1,
18816+ [Define if the GNU gettext() function is already present or preinstalled.])
18817+ AC_DEFINE(HAVE_DCGETTEXT, 1,
18818+ [Define if the GNU dcgettext() function is already present or preinstalled.])
18819+ fi
18820+
18821+ dnl We need to process the po/ directory.
18822+ POSUB=po
18823+ fi
18824+
18825+ ifelse(gt_included_intl, yes, [
18826+ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
18827+ dnl to 'yes' because some of the testsuite requires it.
18828+ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
18829+ BUILD_INCLUDED_LIBINTL=yes
18830+ fi
18831+
18832+ dnl Make all variables we use known to autoconf.
18833+ AC_SUBST(BUILD_INCLUDED_LIBINTL)
18834+ AC_SUBST(USE_INCLUDED_LIBINTL)
18835+ AC_SUBST(CATOBJEXT)
18836+
18837+ dnl For backward compatibility. Some configure.ins may be using this.
18838+ nls_cv_header_intl=
18839+ nls_cv_header_libgt=
18840+
18841+ dnl For backward compatibility. Some Makefiles may be using this.
18842+ DATADIRNAME=share
18843+ AC_SUBST(DATADIRNAME)
18844+
18845+ dnl For backward compatibility. Some Makefiles may be using this.
18846+ INSTOBJEXT=.mo
18847+ AC_SUBST(INSTOBJEXT)
18848+
18849+ dnl For backward compatibility. Some Makefiles may be using this.
18850+ GENCAT=gencat
18851+ AC_SUBST(GENCAT)
18852+
18853+ dnl For backward compatibility. Some Makefiles may be using this.
18854+ if test "$USE_INCLUDED_LIBINTL" = yes; then
18855+ INTLOBJS="\$(GETTOBJS)"
18856+ fi
18857+ AC_SUBST(INTLOBJS)
18858+
18859+ dnl Enable libtool support if the surrounding package wishes it.
18860+ INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
18861+ AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
18862+ ])
18863+
18864+ dnl For backward compatibility. Some Makefiles may be using this.
18865+ INTLLIBS="$LIBINTL"
18866+ AC_SUBST(INTLLIBS)
18867+
18868+ dnl Make all documented variables known to autoconf.
18869+ AC_SUBST(LIBINTL)
18870+ AC_SUBST(LTLIBINTL)
18871+ AC_SUBST(POSUB)
18872+])
18873+
18874+
18875+dnl Checks for all prerequisites of the intl subdirectory,
18876+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
18877+dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
18878+AC_DEFUN([AM_INTL_SUBDIR],
18879+[
18880+ AC_REQUIRE([AC_PROG_INSTALL])dnl
18881+ AC_REQUIRE([AM_MKINSTALLDIRS])dnl
18882+ AC_REQUIRE([AC_PROG_CC])dnl
18883+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
18884+ AC_REQUIRE([AC_PROG_RANLIB])dnl
18885+ AC_REQUIRE([AC_ISC_POSIX])dnl
18886+ AC_REQUIRE([AC_HEADER_STDC])dnl
18887+ AC_REQUIRE([AC_C_CONST])dnl
18888+ AC_REQUIRE([bh_C_SIGNED])dnl
18889+ AC_REQUIRE([AC_C_INLINE])dnl
18890+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
18891+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
18892+ AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
18893+ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
18894+ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
18895+ AC_REQUIRE([gt_TYPE_WINT_T])dnl
18896+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
18897+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
18898+ AC_REQUIRE([gt_TYPE_INTMAX_T])
18899+ AC_REQUIRE([gt_PRINTF_POSIX])
18900+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
18901+ AC_REQUIRE([AC_FUNC_MMAP])dnl
18902+ AC_REQUIRE([jm_GLIBC21])dnl
18903+ AC_REQUIRE([gt_INTDIV0])dnl
18904+ AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
18905+ AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
18906+ AC_REQUIRE([gt_INTTYPES_PRI])dnl
18907+ AC_REQUIRE([gl_XSIZE])dnl
18908+
18909+ AC_CHECK_TYPE([ptrdiff_t], ,
18910+ [AC_DEFINE([ptrdiff_t], [long],
18911+ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
18912+ ])
18913+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
18914+stdlib.h string.h unistd.h sys/param.h])
18915+ AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
18916+mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
18917+strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
18918+__fsetlocking])
18919+
18920+ dnl Use the _snprintf function only if it is declared (because on NetBSD it
18921+ dnl is defined as a weak alias of snprintf; we prefer to use the latter).
18922+ gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
18923+ gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
18924+
18925+ dnl Use the *_unlocked functions only if they are declared.
18926+ dnl (because some of them were defined without being declared in Solaris
18927+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
18928+ dnl on Solaris 2.5.1 to run on Solaris 2.6).
18929+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
18930+ gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
18931+ gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
18932+ gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
18933+
18934+ case $gt_cv_func_printf_posix in
18935+ *yes) HAVE_POSIX_PRINTF=1 ;;
18936+ *) HAVE_POSIX_PRINTF=0 ;;
18937+ esac
18938+ AC_SUBST([HAVE_POSIX_PRINTF])
18939+ if test "$ac_cv_func_asprintf" = yes; then
18940+ HAVE_ASPRINTF=1
18941+ else
18942+ HAVE_ASPRINTF=0
18943+ fi
18944+ AC_SUBST([HAVE_ASPRINTF])
18945+ if test "$ac_cv_func_snprintf" = yes; then
18946+ HAVE_SNPRINTF=1
18947+ else
18948+ HAVE_SNPRINTF=0
18949+ fi
18950+ AC_SUBST([HAVE_SNPRINTF])
18951+ if test "$ac_cv_func_wprintf" = yes; then
18952+ HAVE_WPRINTF=1
18953+ else
18954+ HAVE_WPRINTF=0
18955+ fi
18956+ AC_SUBST([HAVE_WPRINTF])
18957+
18958+ AM_ICONV
18959+ AM_LANGINFO_CODESET
18960+ if test $ac_cv_header_locale_h = yes; then
18961+ AM_LC_MESSAGES
18962+ fi
18963+
18964+ dnl intl/plural.c is generated from intl/plural.y. It requires bison,
18965+ dnl because plural.y uses bison specific features. It requires at least
18966+ dnl bison-1.26 because earlier versions generate a plural.c that doesn't
18967+ dnl compile.
18968+ dnl bison is only needed for the maintainer (who touches plural.y). But in
18969+ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
18970+ dnl the rule in general Makefile. Now, some people carelessly touch the
18971+ dnl files or have a broken "make" program, hence the plural.c rule will
18972+ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
18973+ dnl present or too old.
18974+ AC_CHECK_PROGS([INTLBISON], [bison])
18975+ if test -z "$INTLBISON"; then
18976+ ac_verc_fail=yes
18977+ else
18978+ dnl Found it, now check the version.
18979+ AC_MSG_CHECKING([version of bison])
18980+changequote(<<,>>)dnl
18981+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
18982+ case $ac_prog_version in
18983+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
18984+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
18985+changequote([,])dnl
18986+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
18987+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
18988+ esac
18989+ AC_MSG_RESULT([$ac_prog_version])
18990+ fi
18991+ if test $ac_verc_fail = yes; then
18992+ INTLBISON=:
18993+ fi
18994+])
18995+
18996+
18997+dnl gt_CHECK_DECL(FUNC, INCLUDES)
18998+dnl Check whether a function is declared.
18999+AC_DEFUN([gt_CHECK_DECL],
19000+[
19001+ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
19002+ [AC_TRY_COMPILE([$2], [
19003+#ifndef $1
19004+ char *p = (char *) $1;
19005+#endif
19006+], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
19007+ if test $ac_cv_have_decl_$1 = yes; then
19008+ gt_value=1
19009+ else
19010+ gt_value=0
19011+ fi
19012+ AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
19013+ [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
19014+])
19015+
19016+
19017+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
19018+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
19019--- lrzsz-0.12.20.safe/m4/glibc21.m4 1969-12-31 19:00:00.000000000 -0500
19020+++ lrzsz-0.12.20/m4/glibc21.m4 2004-09-12 14:40:34.833675432 -0400
19021@@ -0,0 +1,32 @@
19022+# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
19023+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
19024+dnl This file is free software, distributed under the terms of the GNU
19025+dnl General Public License. As a special exception to the GNU General
19026+dnl Public License, this file may be distributed as part of a program
19027+dnl that contains a configuration script generated by Autoconf, under
19028+dnl the same distribution terms as the rest of that program.
19029+
19030+# Test for the GNU C Library, version 2.1 or newer.
19031+# From Bruno Haible.
19032+
19033+AC_DEFUN([jm_GLIBC21],
19034+ [
19035+ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
19036+ ac_cv_gnu_library_2_1,
19037+ [AC_EGREP_CPP([Lucky GNU user],
19038+ [
19039+#include <features.h>
19040+#ifdef __GNU_LIBRARY__
19041+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
19042+ Lucky GNU user
19043+ #endif
19044+#endif
19045+ ],
19046+ ac_cv_gnu_library_2_1=yes,
19047+ ac_cv_gnu_library_2_1=no)
19048+ ]
19049+ )
19050+ AC_SUBST(GLIBC21)
19051+ GLIBC21="$ac_cv_gnu_library_2_1"
19052+ ]
19053+)
19054--- lrzsz-0.12.20.safe/m4/iconv.m4 1969-12-31 19:00:00.000000000 -0500
19055+++ lrzsz-0.12.20/m4/iconv.m4 2004-09-12 14:40:34.839674520 -0400
19056@@ -0,0 +1,103 @@
19057+# iconv.m4 serial AM4 (gettext-0.11.3)
19058+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
19059+dnl This file is free software, distributed under the terms of the GNU
19060+dnl General Public License. As a special exception to the GNU General
19061+dnl Public License, this file may be distributed as part of a program
19062+dnl that contains a configuration script generated by Autoconf, under
19063+dnl the same distribution terms as the rest of that program.
19064+
19065+dnl From Bruno Haible.
19066+
19067+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
19068+[
19069+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
19070+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
19071+ AC_REQUIRE([AC_LIB_RPATH])
19072+
19073+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
19074+ dnl accordingly.
19075+ AC_LIB_LINKFLAGS_BODY([iconv])
19076+])
19077+
19078+AC_DEFUN([AM_ICONV_LINK],
19079+[
19080+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
19081+ dnl those with the standalone portable GNU libiconv installed).
19082+
19083+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
19084+ dnl accordingly.
19085+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
19086+
19087+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
19088+ dnl because if the user has installed libiconv and not disabled its use
19089+ dnl via --without-libiconv-prefix, he wants to use it. The first
19090+ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
19091+ am_save_CPPFLAGS="$CPPFLAGS"
19092+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
19093+
19094+ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
19095+ am_cv_func_iconv="no, consider installing GNU libiconv"
19096+ am_cv_lib_iconv=no
19097+ AC_TRY_LINK([#include <stdlib.h>
19098+#include <iconv.h>],
19099+ [iconv_t cd = iconv_open("","");
19100+ iconv(cd,NULL,NULL,NULL,NULL);
19101+ iconv_close(cd);],
19102+ am_cv_func_iconv=yes)
19103+ if test "$am_cv_func_iconv" != yes; then
19104+ am_save_LIBS="$LIBS"
19105+ LIBS="$LIBS $LIBICONV"
19106+ AC_TRY_LINK([#include <stdlib.h>
19107+#include <iconv.h>],
19108+ [iconv_t cd = iconv_open("","");
19109+ iconv(cd,NULL,NULL,NULL,NULL);
19110+ iconv_close(cd);],
19111+ am_cv_lib_iconv=yes
19112+ am_cv_func_iconv=yes)
19113+ LIBS="$am_save_LIBS"
19114+ fi
19115+ ])
19116+ if test "$am_cv_func_iconv" = yes; then
19117+ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
19118+ fi
19119+ if test "$am_cv_lib_iconv" = yes; then
19120+ AC_MSG_CHECKING([how to link with libiconv])
19121+ AC_MSG_RESULT([$LIBICONV])
19122+ else
19123+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
19124+ dnl either.
19125+ CPPFLAGS="$am_save_CPPFLAGS"
19126+ LIBICONV=
19127+ LTLIBICONV=
19128+ fi
19129+ AC_SUBST(LIBICONV)
19130+ AC_SUBST(LTLIBICONV)
19131+])
19132+
19133+AC_DEFUN([AM_ICONV],
19134+[
19135+ AM_ICONV_LINK
19136+ if test "$am_cv_func_iconv" = yes; then
19137+ AC_MSG_CHECKING([for iconv declaration])
19138+ AC_CACHE_VAL(am_cv_proto_iconv, [
19139+ AC_TRY_COMPILE([
19140+#include <stdlib.h>
19141+#include <iconv.h>
19142+extern
19143+#ifdef __cplusplus
19144+"C"
19145+#endif
19146+#if defined(__STDC__) || defined(__cplusplus)
19147+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
19148+#else
19149+size_t iconv();
19150+#endif
19151+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
19152+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
19153+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
19154+ AC_MSG_RESULT([$]{ac_t:-
19155+ }[$]am_cv_proto_iconv)
19156+ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
19157+ [Define as const if the declaration of iconv() needs const.])
19158+ fi
19159+])
19160--- lrzsz-0.12.20.safe/m4/intdiv0.m4 1969-12-31 19:00:00.000000000 -0500
19161+++ lrzsz-0.12.20/m4/intdiv0.m4 2004-09-12 14:40:34.845673608 -0400
19162@@ -0,0 +1,72 @@
19163+# intdiv0.m4 serial 1 (gettext-0.11.3)
19164+dnl Copyright (C) 2002 Free Software Foundation, Inc.
19165+dnl This file is free software, distributed under the terms of the GNU
19166+dnl General Public License. As a special exception to the GNU General
19167+dnl Public License, this file may be distributed as part of a program
19168+dnl that contains a configuration script generated by Autoconf, under
19169+dnl the same distribution terms as the rest of that program.
19170+
19171+dnl From Bruno Haible.
19172+
19173+AC_DEFUN([gt_INTDIV0],
19174+[
19175+ AC_REQUIRE([AC_PROG_CC])dnl
19176+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
19177+
19178+ AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
19179+ gt_cv_int_divbyzero_sigfpe,
19180+ [
19181+ AC_TRY_RUN([
19182+#include <stdlib.h>
19183+#include <signal.h>
19184+
19185+static void
19186+#ifdef __cplusplus
19187+sigfpe_handler (int sig)
19188+#else
19189+sigfpe_handler (sig) int sig;
19190+#endif
19191+{
19192+ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
19193+ exit (sig != SIGFPE);
19194+}
19195+
19196+int x = 1;
19197+int y = 0;
19198+int z;
19199+int nan;
19200+
19201+int main ()
19202+{
19203+ signal (SIGFPE, sigfpe_handler);
19204+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
19205+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
19206+ signal (SIGTRAP, sigfpe_handler);
19207+#endif
19208+/* Linux/SPARC yields signal SIGILL. */
19209+#if defined (__sparc__) && defined (__linux__)
19210+ signal (SIGILL, sigfpe_handler);
19211+#endif
19212+
19213+ z = x / y;
19214+ nan = y / y;
19215+ exit (1);
19216+}
19217+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
19218+ [
19219+ # Guess based on the CPU.
19220+ case "$host_cpu" in
19221+ alpha* | i[34567]86 | m68k | s390*)
19222+ gt_cv_int_divbyzero_sigfpe="guessing yes";;
19223+ *)
19224+ gt_cv_int_divbyzero_sigfpe="guessing no";;
19225+ esac
19226+ ])
19227+ ])
19228+ case "$gt_cv_int_divbyzero_sigfpe" in
19229+ *yes) value=1;;
19230+ *) value=0;;
19231+ esac
19232+ AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
19233+ [Define if integer division by zero raises signal SIGFPE.])
19234+])
19235--- lrzsz-0.12.20.safe/m4/intmax.m4 1969-12-31 19:00:00.000000000 -0500
19236+++ lrzsz-0.12.20/m4/intmax.m4 2004-09-12 14:40:34.855672088 -0400
19237@@ -0,0 +1,32 @@
19238+# intmax.m4 serial 1 (gettext-0.12)
19239+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
19240+dnl This file is free software, distributed under the terms of the GNU
19241+dnl General Public License. As a special exception to the GNU General
19242+dnl Public License, this file may be distributed as part of a program
19243+dnl that contains a configuration script generated by Autoconf, under
19244+dnl the same distribution terms as the rest of that program.
19245+
19246+dnl From Bruno Haible.
19247+dnl Test whether the system has the 'intmax_t' type, but don't attempt to
19248+dnl find a replacement if it is lacking.
19249+
19250+AC_DEFUN([gt_TYPE_INTMAX_T],
19251+[
19252+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
19253+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
19254+ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
19255+ [AC_TRY_COMPILE([
19256+#include <stddef.h>
19257+#include <stdlib.h>
19258+#if HAVE_STDINT_H_WITH_UINTMAX
19259+#include <stdint.h>
19260+#endif
19261+#if HAVE_INTTYPES_H_WITH_UINTMAX
19262+#include <inttypes.h>
19263+#endif
19264+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
19265+ if test $gt_cv_c_intmax_t = yes; then
19266+ AC_DEFINE(HAVE_INTMAX_T, 1,
19267+ [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
19268+ fi
19269+])
19270--- lrzsz-0.12.20.safe/m4/inttypes_h.m4 1969-12-31 19:00:00.000000000 -0500
19271+++ lrzsz-0.12.20/m4/inttypes_h.m4 2004-09-12 14:40:34.868670112 -0400
19272@@ -0,0 +1,28 @@
19273+# inttypes_h.m4 serial 5 (gettext-0.12)
19274+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
19275+dnl This file is free software, distributed under the terms of the GNU
19276+dnl General Public License. As a special exception to the GNU General
19277+dnl Public License, this file may be distributed as part of a program
19278+dnl that contains a configuration script generated by Autoconf, under
19279+dnl the same distribution terms as the rest of that program.
19280+
19281+dnl From Paul Eggert.
19282+
19283+# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
19284+# doesn't clash with <sys/types.h>, and declares uintmax_t.
19285+
19286+AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
19287+[
19288+ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
19289+ [AC_TRY_COMPILE(
19290+ [#include <sys/types.h>
19291+#include <inttypes.h>],
19292+ [uintmax_t i = (uintmax_t) -1;],
19293+ jm_ac_cv_header_inttypes_h=yes,
19294+ jm_ac_cv_header_inttypes_h=no)])
19295+ if test $jm_ac_cv_header_inttypes_h = yes; then
19296+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
19297+ [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
19298+ and declares uintmax_t. ])
19299+ fi
19300+])
19301--- lrzsz-0.12.20.safe/m4/inttypes.m4 1969-12-31 19:00:00.000000000 -0500
19302+++ lrzsz-0.12.20/m4/inttypes.m4 2004-09-12 14:40:34.861671176 -0400
19303@@ -0,0 +1,27 @@
19304+# inttypes.m4 serial 1 (gettext-0.11.4)
19305+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
19306+dnl This file is free software, distributed under the terms of the GNU
19307+dnl General Public License. As a special exception to the GNU General
19308+dnl Public License, this file may be distributed as part of a program
19309+dnl that contains a configuration script generated by Autoconf, under
19310+dnl the same distribution terms as the rest of that program.
19311+
19312+dnl From Paul Eggert.
19313+
19314+# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
19315+# <sys/types.h>.
19316+
19317+AC_DEFUN([gt_HEADER_INTTYPES_H],
19318+[
19319+ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
19320+ [
19321+ AC_TRY_COMPILE(
19322+ [#include <sys/types.h>
19323+#include <inttypes.h>],
19324+ [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
19325+ ])
19326+ if test $gt_cv_header_inttypes_h = yes; then
19327+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
19328+ [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
19329+ fi
19330+])
19331--- lrzsz-0.12.20.safe/m4/inttypes-pri.m4 1969-12-31 19:00:00.000000000 -0500
19332+++ lrzsz-0.12.20/m4/inttypes-pri.m4 2004-09-12 14:40:34.874669200 -0400
19333@@ -0,0 +1,32 @@
19334+# inttypes-pri.m4 serial 1 (gettext-0.11.4)
19335+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
19336+dnl This file is free software, distributed under the terms of the GNU
19337+dnl General Public License. As a special exception to the GNU General
19338+dnl Public License, this file may be distributed as part of a program
19339+dnl that contains a configuration script generated by Autoconf, under
19340+dnl the same distribution terms as the rest of that program.
19341+
19342+dnl From Bruno Haible.
19343+
19344+# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
19345+# macros to non-string values. This is the case on AIX 4.3.3.
19346+
19347+AC_DEFUN([gt_INTTYPES_PRI],
19348+[
19349+ AC_REQUIRE([gt_HEADER_INTTYPES_H])
19350+ if test $gt_cv_header_inttypes_h = yes; then
19351+ AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
19352+ gt_cv_inttypes_pri_broken,
19353+ [
19354+ AC_TRY_COMPILE([#include <inttypes.h>
19355+#ifdef PRId32
19356+char *p = PRId32;
19357+#endif
19358+], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
19359+ ])
19360+ fi
19361+ if test "$gt_cv_inttypes_pri_broken" = yes; then
19362+ AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
19363+ [Define if <inttypes.h> exists and defines unusable PRI* macros.])
19364+ fi
19365+])
19366--- lrzsz-0.12.20.safe/m4/isc-posix.m4 1969-12-31 19:00:00.000000000 -0500
19367+++ lrzsz-0.12.20/m4/isc-posix.m4 2004-09-12 14:40:34.885667528 -0400
19368@@ -0,0 +1,26 @@
19369+# isc-posix.m4 serial 2 (gettext-0.11.2)
19370+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
19371+dnl This file is free software, distributed under the terms of the GNU
19372+dnl General Public License. As a special exception to the GNU General
19373+dnl Public License, this file may be distributed as part of a program
19374+dnl that contains a configuration script generated by Autoconf, under
19375+dnl the same distribution terms as the rest of that program.
19376+
19377+# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
19378+
19379+# This test replaces the one in autoconf.
19380+# Currently this macro should have the same name as the autoconf macro
19381+# because gettext's gettext.m4 (distributed in the automake package)
19382+# still uses it. Otherwise, the use in gettext.m4 makes autoheader
19383+# give these diagnostics:
19384+# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
19385+# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
19386+
19387+undefine([AC_ISC_POSIX])
19388+
19389+AC_DEFUN([AC_ISC_POSIX],
19390+ [
19391+ dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
19392+ AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
19393+ ]
19394+)
19395--- lrzsz-0.12.20.safe/m4/lcmessage.m4 1969-12-31 19:00:00.000000000 -0500
19396+++ lrzsz-0.12.20/m4/lcmessage.m4 2004-09-12 14:40:34.902664944 -0400
19397@@ -0,0 +1,32 @@
19398+# lcmessage.m4 serial 3 (gettext-0.11.3)
19399+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
19400+dnl This file is free software, distributed under the terms of the GNU
19401+dnl General Public License. As a special exception to the GNU General
19402+dnl Public License, this file may be distributed as part of a program
19403+dnl that contains a configuration script generated by Autoconf, under
19404+dnl the same distribution terms as the rest of that program.
19405+dnl
19406+dnl This file can can be used in projects which are not available under
19407+dnl the GNU General Public License or the GNU Library General Public
19408+dnl License but which still want to provide support for the GNU gettext
19409+dnl functionality.
19410+dnl Please note that the actual code of the GNU gettext library is covered
19411+dnl by the GNU Library General Public License, and the rest of the GNU
19412+dnl gettext package package is covered by the GNU General Public License.
19413+dnl They are *not* in the public domain.
19414+
19415+dnl Authors:
19416+dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
19417+
19418+# Check whether LC_MESSAGES is available in <locale.h>.
19419+
19420+AC_DEFUN([AM_LC_MESSAGES],
19421+[
19422+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
19423+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
19424+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
19425+ if test $am_cv_val_LC_MESSAGES = yes; then
19426+ AC_DEFINE(HAVE_LC_MESSAGES, 1,
19427+ [Define if your <locale.h> file defines LC_MESSAGES.])
19428+ fi
19429+])
19430--- lrzsz-0.12.20.safe/m4/lib-ld.m4 1969-12-31 19:00:00.000000000 -0500
19431+++ lrzsz-0.12.20/m4/lib-ld.m4 2004-09-12 14:40:34.908664032 -0400
19432@@ -0,0 +1,112 @@
19433+# lib-ld.m4 serial 3 (gettext-0.13)
19434+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
19435+dnl This file is free software, distributed under the terms of the GNU
19436+dnl General Public License. As a special exception to the GNU General
19437+dnl Public License, this file may be distributed as part of a program
19438+dnl that contains a configuration script generated by Autoconf, under
19439+dnl the same distribution terms as the rest of that program.
19440+
19441+dnl Subroutines of libtool.m4,
19442+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
19443+dnl with libtool.m4.
19444+
19445+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
19446+AC_DEFUN([AC_LIB_PROG_LD_GNU],
19447+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
19448+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
19449+case `$LD -v 2>&1 </dev/null` in
19450+*GNU* | *'with BFD'*)
19451+ acl_cv_prog_gnu_ld=yes ;;
19452+*)
19453+ acl_cv_prog_gnu_ld=no ;;
19454+esac])
19455+with_gnu_ld=$acl_cv_prog_gnu_ld
19456+])
19457+
19458+dnl From libtool-1.4. Sets the variable LD.
19459+AC_DEFUN([AC_LIB_PROG_LD],
19460+[AC_ARG_WITH(gnu-ld,
19461+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
19462+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
19463+AC_REQUIRE([AC_PROG_CC])dnl
19464+AC_REQUIRE([AC_CANONICAL_HOST])dnl
19465+# Prepare PATH_SEPARATOR.
19466+# The user is always right.
19467+if test "${PATH_SEPARATOR+set}" != set; then
19468+ echo "#! /bin/sh" >conf$$.sh
19469+ echo "exit 0" >>conf$$.sh
19470+ chmod +x conf$$.sh
19471+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
19472+ PATH_SEPARATOR=';'
19473+ else
19474+ PATH_SEPARATOR=:
19475+ fi
19476+ rm -f conf$$.sh
19477+fi
19478+ac_prog=ld
19479+if test "$GCC" = yes; then
19480+ # Check if gcc -print-prog-name=ld gives a path.
19481+ AC_MSG_CHECKING([for ld used by GCC])
19482+ case $host in
19483+ *-*-mingw*)
19484+ # gcc leaves a trailing carriage return which upsets mingw
19485+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
19486+ *)
19487+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
19488+ esac
19489+ case $ac_prog in
19490+ # Accept absolute paths.
19491+ [[\\/]* | [A-Za-z]:[\\/]*)]
19492+ [re_direlt='/[^/][^/]*/\.\./']
19493+ # Canonicalize the path of ld
19494+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
19495+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
19496+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
19497+ done
19498+ test -z "$LD" && LD="$ac_prog"
19499+ ;;
19500+ "")
19501+ # If it fails, then pretend we aren't using GCC.
19502+ ac_prog=ld
19503+ ;;
19504+ *)
19505+ # If it is relative, then search for the first ld in PATH.
19506+ with_gnu_ld=unknown
19507+ ;;
19508+ esac
19509+elif test "$with_gnu_ld" = yes; then
19510+ AC_MSG_CHECKING([for GNU ld])
19511+else
19512+ AC_MSG_CHECKING([for non-GNU ld])
19513+fi
19514+AC_CACHE_VAL(acl_cv_path_LD,
19515+[if test -z "$LD"; then
19516+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
19517+ for ac_dir in $PATH; do
19518+ test -z "$ac_dir" && ac_dir=.
19519+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
19520+ acl_cv_path_LD="$ac_dir/$ac_prog"
19521+ # Check to see if the program is GNU ld. I'd rather use --version,
19522+ # but apparently some GNU ld's only accept -v.
19523+ # Break only if it was the GNU/non-GNU ld that we prefer.
19524+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
19525+ *GNU* | *'with BFD'*)
19526+ test "$with_gnu_ld" != no && break ;;
19527+ *)
19528+ test "$with_gnu_ld" != yes && break ;;
19529+ esac
19530+ fi
19531+ done
19532+ IFS="$ac_save_ifs"
19533+else
19534+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
19535+fi])
19536+LD="$acl_cv_path_LD"
19537+if test -n "$LD"; then
19538+ AC_MSG_RESULT($LD)
19539+else
19540+ AC_MSG_RESULT(no)
19541+fi
19542+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
19543+AC_LIB_PROG_LD_GNU
19544+])
19545--- lrzsz-0.12.20.safe/m4/lib-link.m4 1969-12-31 19:00:00.000000000 -0500
19546+++ lrzsz-0.12.20/m4/lib-link.m4 2004-09-12 14:40:34.914663120 -0400
19547@@ -0,0 +1,551 @@
19548+# lib-link.m4 serial 4 (gettext-0.12)
19549+dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
19550+dnl This file is free software, distributed under the terms of the GNU
19551+dnl General Public License. As a special exception to the GNU General
19552+dnl Public License, this file may be distributed as part of a program
19553+dnl that contains a configuration script generated by Autoconf, under
19554+dnl the same distribution terms as the rest of that program.
19555+
19556+dnl From Bruno Haible.
19557+
19558+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
19559+dnl the libraries corresponding to explicit and implicit dependencies.
19560+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
19561+dnl augments the CPPFLAGS variable.
19562+AC_DEFUN([AC_LIB_LINKFLAGS],
19563+[
19564+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
19565+ AC_REQUIRE([AC_LIB_RPATH])
19566+ define([Name],[translit([$1],[./-], [___])])
19567+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
19568+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
19569+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
19570+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
19571+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
19572+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
19573+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
19574+ ])
19575+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
19576+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
19577+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
19578+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
19579+ AC_SUBST([LIB]NAME)
19580+ AC_SUBST([LTLIB]NAME)
19581+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
19582+ dnl results of this search when this library appears as a dependency.
19583+ HAVE_LIB[]NAME=yes
19584+ undefine([Name])
19585+ undefine([NAME])
19586+])
19587+
19588+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
19589+dnl searches for libname and the libraries corresponding to explicit and
19590+dnl implicit dependencies, together with the specified include files and
19591+dnl the ability to compile and link the specified testcode. If found, it
19592+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
19593+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
19594+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
19595+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
19596+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
19597+[
19598+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
19599+ AC_REQUIRE([AC_LIB_RPATH])
19600+ define([Name],[translit([$1],[./-], [___])])
19601+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
19602+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
19603+
19604+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
19605+ dnl accordingly.
19606+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
19607+
19608+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
19609+ dnl because if the user has installed lib[]Name and not disabled its use
19610+ dnl via --without-lib[]Name-prefix, he wants to use it.
19611+ ac_save_CPPFLAGS="$CPPFLAGS"
19612+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
19613+
19614+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
19615+ ac_save_LIBS="$LIBS"
19616+ LIBS="$LIBS $LIB[]NAME"
19617+ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
19618+ LIBS="$ac_save_LIBS"
19619+ ])
19620+ if test "$ac_cv_lib[]Name" = yes; then
19621+ HAVE_LIB[]NAME=yes
19622+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
19623+ AC_MSG_CHECKING([how to link with lib[]$1])
19624+ AC_MSG_RESULT([$LIB[]NAME])
19625+ else
19626+ HAVE_LIB[]NAME=no
19627+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
19628+ dnl $INC[]NAME either.
19629+ CPPFLAGS="$ac_save_CPPFLAGS"
19630+ LIB[]NAME=
19631+ LTLIB[]NAME=
19632+ fi
19633+ AC_SUBST([HAVE_LIB]NAME)
19634+ AC_SUBST([LIB]NAME)
19635+ AC_SUBST([LTLIB]NAME)
19636+ undefine([Name])
19637+ undefine([NAME])
19638+])
19639+
19640+dnl Determine the platform dependent parameters needed to use rpath:
19641+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
19642+dnl hardcode_direct, hardcode_minus_L.
19643+AC_DEFUN([AC_LIB_RPATH],
19644+[
19645+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
19646+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
19647+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
19648+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
19649+ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
19650+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
19651+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
19652+ . ./conftest.sh
19653+ rm -f ./conftest.sh
19654+ acl_cv_rpath=done
19655+ ])
19656+ wl="$acl_cv_wl"
19657+ libext="$acl_cv_libext"
19658+ shlibext="$acl_cv_shlibext"
19659+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
19660+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
19661+ hardcode_direct="$acl_cv_hardcode_direct"
19662+ hardcode_minus_L="$acl_cv_hardcode_minus_L"
19663+ dnl Determine whether the user wants rpath handling at all.
19664+ AC_ARG_ENABLE(rpath,
19665+ [ --disable-rpath do not hardcode runtime library paths],
19666+ :, enable_rpath=yes)
19667+])
19668+
19669+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
19670+dnl the libraries corresponding to explicit and implicit dependencies.
19671+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
19672+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
19673+[
19674+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
19675+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
19676+ dnl By default, look in $includedir and $libdir.
19677+ use_additional=yes
19678+ AC_LIB_WITH_FINAL_PREFIX([
19679+ eval additional_includedir=\"$includedir\"
19680+ eval additional_libdir=\"$libdir\"
19681+ ])
19682+ AC_LIB_ARG_WITH([lib$1-prefix],
19683+[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
19684+ --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
19685+[
19686+ if test "X$withval" = "Xno"; then
19687+ use_additional=no
19688+ else
19689+ if test "X$withval" = "X"; then
19690+ AC_LIB_WITH_FINAL_PREFIX([
19691+ eval additional_includedir=\"$includedir\"
19692+ eval additional_libdir=\"$libdir\"
19693+ ])
19694+ else
19695+ additional_includedir="$withval/include"
19696+ additional_libdir="$withval/lib"
19697+ fi
19698+ fi
19699+])
19700+ dnl Search the library and its dependencies in $additional_libdir and
19701+ dnl $LDFLAGS. Using breadth-first-seach.
19702+ LIB[]NAME=
19703+ LTLIB[]NAME=
19704+ INC[]NAME=
19705+ rpathdirs=
19706+ ltrpathdirs=
19707+ names_already_handled=
19708+ names_next_round='$1 $2'
19709+ while test -n "$names_next_round"; do
19710+ names_this_round="$names_next_round"
19711+ names_next_round=
19712+ for name in $names_this_round; do
19713+ already_handled=
19714+ for n in $names_already_handled; do
19715+ if test "$n" = "$name"; then
19716+ already_handled=yes
19717+ break
19718+ fi
19719+ done
19720+ if test -z "$already_handled"; then
19721+ names_already_handled="$names_already_handled $name"
19722+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
19723+ dnl or AC_LIB_HAVE_LINKFLAGS call.
19724+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
19725+ eval value=\"\$HAVE_LIB$uppername\"
19726+ if test -n "$value"; then
19727+ if test "$value" = yes; then
19728+ eval value=\"\$LIB$uppername\"
19729+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
19730+ eval value=\"\$LTLIB$uppername\"
19731+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
19732+ else
19733+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
19734+ dnl that this library doesn't exist. So just drop it.
19735+ :
19736+ fi
19737+ else
19738+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
19739+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
19740+ found_dir=
19741+ found_la=
19742+ found_so=
19743+ found_a=
19744+ if test $use_additional = yes; then
19745+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
19746+ found_dir="$additional_libdir"
19747+ found_so="$additional_libdir/lib$name.$shlibext"
19748+ if test -f "$additional_libdir/lib$name.la"; then
19749+ found_la="$additional_libdir/lib$name.la"
19750+ fi
19751+ else
19752+ if test -f "$additional_libdir/lib$name.$libext"; then
19753+ found_dir="$additional_libdir"
19754+ found_a="$additional_libdir/lib$name.$libext"
19755+ if test -f "$additional_libdir/lib$name.la"; then
19756+ found_la="$additional_libdir/lib$name.la"
19757+ fi
19758+ fi
19759+ fi
19760+ fi
19761+ if test "X$found_dir" = "X"; then
19762+ for x in $LDFLAGS $LTLIB[]NAME; do
19763+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
19764+ case "$x" in
19765+ -L*)
19766+ dir=`echo "X$x" | sed -e 's/^X-L//'`
19767+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
19768+ found_dir="$dir"
19769+ found_so="$dir/lib$name.$shlibext"
19770+ if test -f "$dir/lib$name.la"; then
19771+ found_la="$dir/lib$name.la"
19772+ fi
19773+ else
19774+ if test -f "$dir/lib$name.$libext"; then
19775+ found_dir="$dir"
19776+ found_a="$dir/lib$name.$libext"
19777+ if test -f "$dir/lib$name.la"; then
19778+ found_la="$dir/lib$name.la"
19779+ fi
19780+ fi
19781+ fi
19782+ ;;
19783+ esac
19784+ if test "X$found_dir" != "X"; then
19785+ break
19786+ fi
19787+ done
19788+ fi
19789+ if test "X$found_dir" != "X"; then
19790+ dnl Found the library.
19791+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
19792+ if test "X$found_so" != "X"; then
19793+ dnl Linking with a shared library. We attempt to hardcode its
19794+ dnl directory into the executable's runpath, unless it's the
19795+ dnl standard /usr/lib.
19796+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
19797+ dnl No hardcoding is needed.
19798+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
19799+ else
19800+ dnl Use an explicit option to hardcode DIR into the resulting
19801+ dnl binary.
19802+ dnl Potentially add DIR to ltrpathdirs.
19803+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
19804+ haveit=
19805+ for x in $ltrpathdirs; do
19806+ if test "X$x" = "X$found_dir"; then
19807+ haveit=yes
19808+ break
19809+ fi
19810+ done
19811+ if test -z "$haveit"; then
19812+ ltrpathdirs="$ltrpathdirs $found_dir"
19813+ fi
19814+ dnl The hardcoding into $LIBNAME is system dependent.
19815+ if test "$hardcode_direct" = yes; then
19816+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
19817+ dnl resulting binary.
19818+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
19819+ else
19820+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
19821+ dnl Use an explicit option to hardcode DIR into the resulting
19822+ dnl binary.
19823+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
19824+ dnl Potentially add DIR to rpathdirs.
19825+ dnl The rpathdirs will be appended to $LIBNAME at the end.
19826+ haveit=
19827+ for x in $rpathdirs; do
19828+ if test "X$x" = "X$found_dir"; then
19829+ haveit=yes
19830+ break
19831+ fi
19832+ done
19833+ if test -z "$haveit"; then
19834+ rpathdirs="$rpathdirs $found_dir"
19835+ fi
19836+ else
19837+ dnl Rely on "-L$found_dir".
19838+ dnl But don't add it if it's already contained in the LDFLAGS
19839+ dnl or the already constructed $LIBNAME
19840+ haveit=
19841+ for x in $LDFLAGS $LIB[]NAME; do
19842+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
19843+ if test "X$x" = "X-L$found_dir"; then
19844+ haveit=yes
19845+ break
19846+ fi
19847+ done
19848+ if test -z "$haveit"; then
19849+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
19850+ fi
19851+ if test "$hardcode_minus_L" != no; then
19852+ dnl FIXME: Not sure whether we should use
19853+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
19854+ dnl here.
19855+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
19856+ else
19857+ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
19858+ dnl here, because this doesn't fit in flags passed to the
19859+ dnl compiler. So give up. No hardcoding. This affects only
19860+ dnl very old systems.
19861+ dnl FIXME: Not sure whether we should use
19862+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
19863+ dnl here.
19864+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
19865+ fi
19866+ fi
19867+ fi
19868+ fi
19869+ else
19870+ if test "X$found_a" != "X"; then
19871+ dnl Linking with a static library.
19872+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
19873+ else
19874+ dnl We shouldn't come here, but anyway it's good to have a
19875+ dnl fallback.
19876+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
19877+ fi
19878+ fi
19879+ dnl Assume the include files are nearby.
19880+ additional_includedir=
19881+ case "$found_dir" in
19882+ */lib | */lib/)
19883+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
19884+ additional_includedir="$basedir/include"
19885+ ;;
19886+ esac
19887+ if test "X$additional_includedir" != "X"; then
19888+ dnl Potentially add $additional_includedir to $INCNAME.
19889+ dnl But don't add it
19890+ dnl 1. if it's the standard /usr/include,
19891+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
19892+ dnl 3. if it's already present in $CPPFLAGS or the already
19893+ dnl constructed $INCNAME,
19894+ dnl 4. if it doesn't exist as a directory.
19895+ if test "X$additional_includedir" != "X/usr/include"; then
19896+ haveit=
19897+ if test "X$additional_includedir" = "X/usr/local/include"; then
19898+ if test -n "$GCC"; then
19899+ case $host_os in
19900+ linux*) haveit=yes;;
19901+ esac
19902+ fi
19903+ fi
19904+ if test -z "$haveit"; then
19905+ for x in $CPPFLAGS $INC[]NAME; do
19906+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
19907+ if test "X$x" = "X-I$additional_includedir"; then
19908+ haveit=yes
19909+ break
19910+ fi
19911+ done
19912+ if test -z "$haveit"; then
19913+ if test -d "$additional_includedir"; then
19914+ dnl Really add $additional_includedir to $INCNAME.
19915+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
19916+ fi
19917+ fi
19918+ fi
19919+ fi
19920+ fi
19921+ dnl Look for dependencies.
19922+ if test -n "$found_la"; then
19923+ dnl Read the .la file. It defines the variables
19924+ dnl dlname, library_names, old_library, dependency_libs, current,
19925+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
19926+ save_libdir="$libdir"
19927+ case "$found_la" in
19928+ */* | *\\*) . "$found_la" ;;
19929+ *) . "./$found_la" ;;
19930+ esac
19931+ libdir="$save_libdir"
19932+ dnl We use only dependency_libs.
19933+ for dep in $dependency_libs; do
19934+ case "$dep" in
19935+ -L*)
19936+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
19937+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
19938+ dnl But don't add it
19939+ dnl 1. if it's the standard /usr/lib,
19940+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
19941+ dnl 3. if it's already present in $LDFLAGS or the already
19942+ dnl constructed $LIBNAME,
19943+ dnl 4. if it doesn't exist as a directory.
19944+ if test "X$additional_libdir" != "X/usr/lib"; then
19945+ haveit=
19946+ if test "X$additional_libdir" = "X/usr/local/lib"; then
19947+ if test -n "$GCC"; then
19948+ case $host_os in
19949+ linux*) haveit=yes;;
19950+ esac
19951+ fi
19952+ fi
19953+ if test -z "$haveit"; then
19954+ haveit=
19955+ for x in $LDFLAGS $LIB[]NAME; do
19956+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
19957+ if test "X$x" = "X-L$additional_libdir"; then
19958+ haveit=yes
19959+ break
19960+ fi
19961+ done
19962+ if test -z "$haveit"; then
19963+ if test -d "$additional_libdir"; then
19964+ dnl Really add $additional_libdir to $LIBNAME.
19965+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
19966+ fi
19967+ fi
19968+ haveit=
19969+ for x in $LDFLAGS $LTLIB[]NAME; do
19970+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
19971+ if test "X$x" = "X-L$additional_libdir"; then
19972+ haveit=yes
19973+ break
19974+ fi
19975+ done
19976+ if test -z "$haveit"; then
19977+ if test -d "$additional_libdir"; then
19978+ dnl Really add $additional_libdir to $LTLIBNAME.
19979+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
19980+ fi
19981+ fi
19982+ fi
19983+ fi
19984+ ;;
19985+ -R*)
19986+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
19987+ if test "$enable_rpath" != no; then
19988+ dnl Potentially add DIR to rpathdirs.
19989+ dnl The rpathdirs will be appended to $LIBNAME at the end.
19990+ haveit=
19991+ for x in $rpathdirs; do
19992+ if test "X$x" = "X$dir"; then
19993+ haveit=yes
19994+ break
19995+ fi
19996+ done
19997+ if test -z "$haveit"; then
19998+ rpathdirs="$rpathdirs $dir"
19999+ fi
20000+ dnl Potentially add DIR to ltrpathdirs.
20001+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
20002+ haveit=
20003+ for x in $ltrpathdirs; do
20004+ if test "X$x" = "X$dir"; then
20005+ haveit=yes
20006+ break
20007+ fi
20008+ done
20009+ if test -z "$haveit"; then
20010+ ltrpathdirs="$ltrpathdirs $dir"
20011+ fi
20012+ fi
20013+ ;;
20014+ -l*)
20015+ dnl Handle this in the next round.
20016+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
20017+ ;;
20018+ *.la)
20019+ dnl Handle this in the next round. Throw away the .la's
20020+ dnl directory; it is already contained in a preceding -L
20021+ dnl option.
20022+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
20023+ ;;
20024+ *)
20025+ dnl Most likely an immediate library name.
20026+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
20027+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
20028+ ;;
20029+ esac
20030+ done
20031+ fi
20032+ else
20033+ dnl Didn't find the library; assume it is in the system directories
20034+ dnl known to the linker and runtime loader. (All the system
20035+ dnl directories known to the linker should also be known to the
20036+ dnl runtime loader, otherwise the system is severely misconfigured.)
20037+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
20038+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
20039+ fi
20040+ fi
20041+ fi
20042+ done
20043+ done
20044+ if test "X$rpathdirs" != "X"; then
20045+ if test -n "$hardcode_libdir_separator"; then
20046+ dnl Weird platform: only the last -rpath option counts, the user must
20047+ dnl pass all path elements in one option. We can arrange that for a
20048+ dnl single library, but not when more than one $LIBNAMEs are used.
20049+ alldirs=
20050+ for found_dir in $rpathdirs; do
20051+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
20052+ done
20053+ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
20054+ acl_save_libdir="$libdir"
20055+ libdir="$alldirs"
20056+ eval flag=\"$hardcode_libdir_flag_spec\"
20057+ libdir="$acl_save_libdir"
20058+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
20059+ else
20060+ dnl The -rpath options are cumulative.
20061+ for found_dir in $rpathdirs; do
20062+ acl_save_libdir="$libdir"
20063+ libdir="$found_dir"
20064+ eval flag=\"$hardcode_libdir_flag_spec\"
20065+ libdir="$acl_save_libdir"
20066+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
20067+ done
20068+ fi
20069+ fi
20070+ if test "X$ltrpathdirs" != "X"; then
20071+ dnl When using libtool, the option that works for both libraries and
20072+ dnl executables is -R. The -R options are cumulative.
20073+ for found_dir in $ltrpathdirs; do
20074+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
20075+ done
20076+ fi
20077+])
20078+
20079+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
20080+dnl unless already present in VAR.
20081+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
20082+dnl contains two or three consecutive elements that belong together.
20083+AC_DEFUN([AC_LIB_APPENDTOVAR],
20084+[
20085+ for element in [$2]; do
20086+ haveit=
20087+ for x in $[$1]; do
20088+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
20089+ if test "X$x" = "X$element"; then
20090+ haveit=yes
20091+ break
20092+ fi
20093+ done
20094+ if test -z "$haveit"; then
20095+ [$1]="${[$1]}${[$1]:+ }$element"
20096+ fi
20097+ done
20098+])
20099--- lrzsz-0.12.20.safe/m4/lib-prefix.m4 1969-12-31 19:00:00.000000000 -0500
20100+++ lrzsz-0.12.20/m4/lib-prefix.m4 2004-09-12 14:40:34.921662056 -0400
20101@@ -0,0 +1,155 @@
20102+# lib-prefix.m4 serial 3 (gettext-0.13)
20103+dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
20104+dnl This file is free software, distributed under the terms of the GNU
20105+dnl General Public License. As a special exception to the GNU General
20106+dnl Public License, this file may be distributed as part of a program
20107+dnl that contains a configuration script generated by Autoconf, under
20108+dnl the same distribution terms as the rest of that program.
20109+
20110+dnl From Bruno Haible.
20111+
20112+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
20113+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
20114+dnl require excessive bracketing.
20115+ifdef([AC_HELP_STRING],
20116+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
20117+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
20118+
20119+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
20120+dnl to access previously installed libraries. The basic assumption is that
20121+dnl a user will want packages to use other packages he previously installed
20122+dnl with the same --prefix option.
20123+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
20124+dnl libraries, but is otherwise very convenient.
20125+AC_DEFUN([AC_LIB_PREFIX],
20126+[
20127+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
20128+ AC_REQUIRE([AC_PROG_CC])
20129+ AC_REQUIRE([AC_CANONICAL_HOST])
20130+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20131+ dnl By default, look in $includedir and $libdir.
20132+ use_additional=yes
20133+ AC_LIB_WITH_FINAL_PREFIX([
20134+ eval additional_includedir=\"$includedir\"
20135+ eval additional_libdir=\"$libdir\"
20136+ ])
20137+ AC_LIB_ARG_WITH([lib-prefix],
20138+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
20139+ --without-lib-prefix don't search for libraries in includedir and libdir],
20140+[
20141+ if test "X$withval" = "Xno"; then
20142+ use_additional=no
20143+ else
20144+ if test "X$withval" = "X"; then
20145+ AC_LIB_WITH_FINAL_PREFIX([
20146+ eval additional_includedir=\"$includedir\"
20147+ eval additional_libdir=\"$libdir\"
20148+ ])
20149+ else
20150+ additional_includedir="$withval/include"
20151+ additional_libdir="$withval/lib"
20152+ fi
20153+ fi
20154+])
20155+ if test $use_additional = yes; then
20156+ dnl Potentially add $additional_includedir to $CPPFLAGS.
20157+ dnl But don't add it
20158+ dnl 1. if it's the standard /usr/include,
20159+ dnl 2. if it's already present in $CPPFLAGS,
20160+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
20161+ dnl 4. if it doesn't exist as a directory.
20162+ if test "X$additional_includedir" != "X/usr/include"; then
20163+ haveit=
20164+ for x in $CPPFLAGS; do
20165+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
20166+ if test "X$x" = "X-I$additional_includedir"; then
20167+ haveit=yes
20168+ break
20169+ fi
20170+ done
20171+ if test -z "$haveit"; then
20172+ if test "X$additional_includedir" = "X/usr/local/include"; then
20173+ if test -n "$GCC"; then
20174+ case $host_os in
20175+ linux*) haveit=yes;;
20176+ esac
20177+ fi
20178+ fi
20179+ if test -z "$haveit"; then
20180+ if test -d "$additional_includedir"; then
20181+ dnl Really add $additional_includedir to $CPPFLAGS.
20182+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
20183+ fi
20184+ fi
20185+ fi
20186+ fi
20187+ dnl Potentially add $additional_libdir to $LDFLAGS.
20188+ dnl But don't add it
20189+ dnl 1. if it's the standard /usr/lib,
20190+ dnl 2. if it's already present in $LDFLAGS,
20191+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
20192+ dnl 4. if it doesn't exist as a directory.
20193+ if test "X$additional_libdir" != "X/usr/lib"; then
20194+ haveit=
20195+ for x in $LDFLAGS; do
20196+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
20197+ if test "X$x" = "X-L$additional_libdir"; then
20198+ haveit=yes
20199+ break
20200+ fi
20201+ done
20202+ if test -z "$haveit"; then
20203+ if test "X$additional_libdir" = "X/usr/local/lib"; then
20204+ if test -n "$GCC"; then
20205+ case $host_os in
20206+ linux*) haveit=yes;;
20207+ esac
20208+ fi
20209+ fi
20210+ if test -z "$haveit"; then
20211+ if test -d "$additional_libdir"; then
20212+ dnl Really add $additional_libdir to $LDFLAGS.
20213+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
20214+ fi
20215+ fi
20216+ fi
20217+ fi
20218+ fi
20219+])
20220+
20221+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
20222+dnl acl_final_exec_prefix, containing the values to which $prefix and
20223+dnl $exec_prefix will expand at the end of the configure script.
20224+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
20225+[
20226+ dnl Unfortunately, prefix and exec_prefix get only finally determined
20227+ dnl at the end of configure.
20228+ if test "X$prefix" = "XNONE"; then
20229+ acl_final_prefix="$ac_default_prefix"
20230+ else
20231+ acl_final_prefix="$prefix"
20232+ fi
20233+ if test "X$exec_prefix" = "XNONE"; then
20234+ acl_final_exec_prefix='${prefix}'
20235+ else
20236+ acl_final_exec_prefix="$exec_prefix"
20237+ fi
20238+ acl_save_prefix="$prefix"
20239+ prefix="$acl_final_prefix"
20240+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
20241+ prefix="$acl_save_prefix"
20242+])
20243+
20244+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
20245+dnl variables prefix and exec_prefix bound to the values they will have
20246+dnl at the end of the configure script.
20247+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
20248+[
20249+ acl_save_prefix="$prefix"
20250+ prefix="$acl_final_prefix"
20251+ acl_save_exec_prefix="$exec_prefix"
20252+ exec_prefix="$acl_final_exec_prefix"
20253+ $1
20254+ exec_prefix="$acl_save_exec_prefix"
20255+ prefix="$acl_save_prefix"
20256+])
20257--- lrzsz-0.12.20.safe/m4/longdouble.m4 1969-12-31 19:00:00.000000000 -0500
20258+++ lrzsz-0.12.20/m4/longdouble.m4 2004-09-12 14:40:34.942658864 -0400
20259@@ -0,0 +1,30 @@
20260+# longdouble.m4 serial 1 (gettext-0.12)
20261+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
20262+dnl This file is free software, distributed under the terms of the GNU
20263+dnl General Public License. As a special exception to the GNU General
20264+dnl Public License, this file may be distributed as part of a program
20265+dnl that contains a configuration script generated by Autoconf, under
20266+dnl the same distribution terms as the rest of that program.
20267+
20268+dnl From Bruno Haible.
20269+dnl Test whether the compiler supports the 'long double' type.
20270+dnl Prerequisite: AC_PROG_CC
20271+
20272+AC_DEFUN([gt_TYPE_LONGDOUBLE],
20273+[
20274+ AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
20275+ [if test "$GCC" = yes; then
20276+ gt_cv_c_long_double=yes
20277+ else
20278+ AC_TRY_COMPILE([
20279+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */
20280+ long double foo = 0.0;
20281+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
20282+ int array [2*(sizeof(long double) >= sizeof(double)) - 1];
20283+ ], ,
20284+ gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
20285+ fi])
20286+ if test $gt_cv_c_long_double = yes; then
20287+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
20288+ fi
20289+])
20290--- lrzsz-0.12.20.safe/m4/longlong.m4 1969-12-31 19:00:00.000000000 -0500
20291+++ lrzsz-0.12.20/m4/longlong.m4 2004-09-12 14:40:34.949657800 -0400
20292@@ -0,0 +1,25 @@
20293+# longlong.m4 serial 4
20294+dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
20295+dnl This file is free software, distributed under the terms of the GNU
20296+dnl General Public License. As a special exception to the GNU General
20297+dnl Public License, this file may be distributed as part of a program
20298+dnl that contains a configuration script generated by Autoconf, under
20299+dnl the same distribution terms as the rest of that program.
20300+
20301+dnl From Paul Eggert.
20302+
20303+# Define HAVE_LONG_LONG if 'long long' works.
20304+
20305+AC_DEFUN([jm_AC_TYPE_LONG_LONG],
20306+[
20307+ AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
20308+ [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
20309+ [long long llmax = (long long) -1;
20310+ return ll << i | ll >> i | llmax / ll | llmax % ll;],
20311+ ac_cv_type_long_long=yes,
20312+ ac_cv_type_long_long=no)])
20313+ if test $ac_cv_type_long_long = yes; then
20314+ AC_DEFINE(HAVE_LONG_LONG, 1,
20315+ [Define if you have the 'long long' type.])
20316+ fi
20317+])
20318--- lrzsz-0.12.20.safe/m4/Makefile.am 1969-12-31 19:00:00.000000000 -0500
20319+++ lrzsz-0.12.20/m4/Makefile.am 2004-09-12 14:40:35.048642752 -0400
20320@@ -0,0 +1 @@
20321+EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 intmax.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4
20322--- lrzsz-0.12.20.safe/m4/nls.m4 1969-12-31 19:00:00.000000000 -0500
20323+++ lrzsz-0.12.20/m4/nls.m4 2004-09-12 14:40:34.955656888 -0400
20324@@ -0,0 +1,49 @@
20325+# nls.m4 serial 1 (gettext-0.12)
20326+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
20327+dnl This file is free software, distributed under the terms of the GNU
20328+dnl General Public License. As a special exception to the GNU General
20329+dnl Public License, this file may be distributed as part of a program
20330+dnl that contains a configuration script generated by Autoconf, under
20331+dnl the same distribution terms as the rest of that program.
20332+dnl
20333+dnl This file can can be used in projects which are not available under
20334+dnl the GNU General Public License or the GNU Library General Public
20335+dnl License but which still want to provide support for the GNU gettext
20336+dnl functionality.
20337+dnl Please note that the actual code of the GNU gettext library is covered
20338+dnl by the GNU Library General Public License, and the rest of the GNU
20339+dnl gettext package package is covered by the GNU General Public License.
20340+dnl They are *not* in the public domain.
20341+
20342+dnl Authors:
20343+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20344+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
20345+
20346+AC_DEFUN([AM_NLS],
20347+[
20348+ AC_MSG_CHECKING([whether NLS is requested])
20349+ dnl Default is enabled NLS
20350+ AC_ARG_ENABLE(nls,
20351+ [ --disable-nls do not use Native Language Support],
20352+ USE_NLS=$enableval, USE_NLS=yes)
20353+ AC_MSG_RESULT($USE_NLS)
20354+ AC_SUBST(USE_NLS)
20355+])
20356+
20357+AC_DEFUN([AM_MKINSTALLDIRS],
20358+[
20359+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
20360+ dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
20361+ dnl Try to locate it.
20362+ MKINSTALLDIRS=
20363+ if test -n "$ac_aux_dir"; then
20364+ case "$ac_aux_dir" in
20365+ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
20366+ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
20367+ esac
20368+ fi
20369+ if test -z "$MKINSTALLDIRS"; then
20370+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
20371+ fi
20372+ AC_SUBST(MKINSTALLDIRS)
20373+])
20374--- lrzsz-0.12.20.safe/m4/po.m4 1969-12-31 19:00:00.000000000 -0500
20375+++ lrzsz-0.12.20/m4/po.m4 2004-09-12 14:40:34.961655976 -0400
20376@@ -0,0 +1,426 @@
20377+# po.m4 serial 3 (gettext-0.14)
20378+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
20379+dnl This file is free software, distributed under the terms of the GNU
20380+dnl General Public License. As a special exception to the GNU General
20381+dnl Public License, this file may be distributed as part of a program
20382+dnl that contains a configuration script generated by Autoconf, under
20383+dnl the same distribution terms as the rest of that program.
20384+dnl
20385+dnl This file can can be used in projects which are not available under
20386+dnl the GNU General Public License or the GNU Library General Public
20387+dnl License but which still want to provide support for the GNU gettext
20388+dnl functionality.
20389+dnl Please note that the actual code of the GNU gettext library is covered
20390+dnl by the GNU Library General Public License, and the rest of the GNU
20391+dnl gettext package package is covered by the GNU General Public License.
20392+dnl They are *not* in the public domain.
20393+
20394+dnl Authors:
20395+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20396+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
20397+
20398+dnl Checks for all prerequisites of the po subdirectory.
20399+AC_DEFUN([AM_PO_SUBDIRS],
20400+[
20401+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
20402+ AC_REQUIRE([AC_PROG_INSTALL])dnl
20403+ AC_REQUIRE([AM_MKINSTALLDIRS])dnl
20404+ AC_REQUIRE([AM_NLS])dnl
20405+
20406+ dnl Perform the following tests also if --disable-nls has been given,
20407+ dnl because they are needed for "make dist" to work.
20408+
20409+ dnl Search for GNU msgfmt in the PATH.
20410+ dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
20411+ dnl The second test excludes FreeBSD msgfmt.
20412+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
20413+ [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
20414+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
20415+ :)
20416+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
20417+
20418+ dnl Search for GNU xgettext 0.12 or newer in the PATH.
20419+ dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
20420+ dnl The second test excludes FreeBSD xgettext.
20421+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
20422+ [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
20423+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
20424+ :)
20425+ dnl Remove leftover from FreeBSD xgettext call.
20426+ rm -f messages.po
20427+
20428+ dnl Search for GNU msgmerge 0.11 or newer in the PATH.
20429+ AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
20430+ [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
20431+
20432+ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
20433+ dnl Test whether we really found GNU msgfmt.
20434+ if test "$GMSGFMT" != ":"; then
20435+ dnl If it is no GNU msgfmt we define it as : so that the
20436+ dnl Makefiles still can work.
20437+ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
20438+ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
20439+ : ;
20440+ else
20441+ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
20442+ AC_MSG_RESULT(
20443+ [found $GMSGFMT program is not GNU msgfmt; ignore it])
20444+ GMSGFMT=":"
20445+ fi
20446+ fi
20447+
20448+ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
20449+ dnl Test whether we really found GNU xgettext.
20450+ if test "$XGETTEXT" != ":"; then
20451+ dnl If it is no GNU xgettext we define it as : so that the
20452+ dnl Makefiles still can work.
20453+ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
20454+ (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
20455+ : ;
20456+ else
20457+ AC_MSG_RESULT(
20458+ [found xgettext program is not GNU xgettext; ignore it])
20459+ XGETTEXT=":"
20460+ fi
20461+ dnl Remove leftover from FreeBSD xgettext call.
20462+ rm -f messages.po
20463+ fi
20464+
20465+ AC_OUTPUT_COMMANDS([
20466+ for ac_file in $CONFIG_FILES; do
20467+ # Support "outfile[:infile[:infile...]]"
20468+ case "$ac_file" in
20469+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
20470+ esac
20471+ # PO directories have a Makefile.in generated from Makefile.in.in.
20472+ case "$ac_file" in */Makefile.in)
20473+ # Adjust a relative srcdir.
20474+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
20475+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
20476+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
20477+ # In autoconf-2.13 it is called $ac_given_srcdir.
20478+ # In autoconf-2.50 it is called $srcdir.
20479+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
20480+ case "$ac_given_srcdir" in
20481+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
20482+ /*) top_srcdir="$ac_given_srcdir" ;;
20483+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
20484+ esac
20485+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
20486+ rm -f "$ac_dir/POTFILES"
20487+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
20488+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
20489+ POMAKEFILEDEPS="POTFILES.in"
20490+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
20491+ # on $ac_dir but don't depend on user-specified configuration
20492+ # parameters.
20493+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
20494+ # The LINGUAS file contains the set of available languages.
20495+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
20496+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
20497+ fi
20498+ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
20499+ # Hide the ALL_LINGUAS assigment from automake.
20500+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
20501+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
20502+ else
20503+ # The set of available languages was given in configure.in.
20504+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
20505+ fi
20506+ # Compute POFILES
20507+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
20508+ # Compute UPDATEPOFILES
20509+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
20510+ # Compute DUMMYPOFILES
20511+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
20512+ # Compute GMOFILES
20513+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
20514+ case "$ac_given_srcdir" in
20515+ .) srcdirpre= ;;
20516+ *) srcdirpre='$(srcdir)/' ;;
20517+ esac
20518+ POFILES=
20519+ UPDATEPOFILES=
20520+ DUMMYPOFILES=
20521+ GMOFILES=
20522+ for lang in $ALL_LINGUAS; do
20523+ POFILES="$POFILES $srcdirpre$lang.po"
20524+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
20525+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
20526+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
20527+ done
20528+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
20529+ # environment variable.
20530+ INST_LINGUAS=
20531+ if test -n "$ALL_LINGUAS"; then
20532+ for presentlang in $ALL_LINGUAS; do
20533+ useit=no
20534+ if test "%UNSET%" != "$LINGUAS"; then
20535+ desiredlanguages="$LINGUAS"
20536+ else
20537+ desiredlanguages="$ALL_LINGUAS"
20538+ fi
20539+ for desiredlang in $desiredlanguages; do
20540+ # Use the presentlang catalog if desiredlang is
20541+ # a. equal to presentlang, or
20542+ # b. a variant of presentlang (because in this case,
20543+ # presentlang can be used as a fallback for messages
20544+ # which are not translated in the desiredlang catalog).
20545+ case "$desiredlang" in
20546+ "$presentlang"*) useit=yes;;
20547+ esac
20548+ done
20549+ if test $useit = yes; then
20550+ INST_LINGUAS="$INST_LINGUAS $presentlang"
20551+ fi
20552+ done
20553+ fi
20554+ CATALOGS=
20555+ if test -n "$INST_LINGUAS"; then
20556+ for lang in $INST_LINGUAS; do
20557+ CATALOGS="$CATALOGS $lang.gmo"
20558+ done
20559+ fi
20560+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
20561+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
20562+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
20563+ if test -f "$f"; then
20564+ case "$f" in
20565+ *.orig | *.bak | *~) ;;
20566+ *) cat "$f" >> "$ac_dir/Makefile" ;;
20567+ esac
20568+ fi
20569+ done
20570+ fi
20571+ ;;
20572+ esac
20573+ done],
20574+ [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
20575+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
20576+ # from automake.
20577+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
20578+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
20579+ LINGUAS="${LINGUAS-%UNSET%}"
20580+ ])
20581+])
20582+
20583+dnl Postprocesses a Makefile in a directory containing PO files.
20584+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
20585+[
20586+ # When this code is run, in config.status, two variables have already been
20587+ # set:
20588+ # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
20589+ # - LINGUAS is the value of the environment variable LINGUAS at configure
20590+ # time.
20591+
20592+changequote(,)dnl
20593+ # Adjust a relative srcdir.
20594+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
20595+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
20596+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
20597+ # In autoconf-2.13 it is called $ac_given_srcdir.
20598+ # In autoconf-2.50 it is called $srcdir.
20599+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
20600+ case "$ac_given_srcdir" in
20601+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
20602+ /*) top_srcdir="$ac_given_srcdir" ;;
20603+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
20604+ esac
20605+
20606+ # Find a way to echo strings without interpreting backslash.
20607+ if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
20608+ gt_echo='echo'
20609+ else
20610+ if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
20611+ gt_echo='printf %s\n'
20612+ else
20613+ echo_func () {
20614+ cat <<EOT
20615+$*
20616+EOT
20617+ }
20618+ gt_echo='echo_func'
20619+ fi
20620+ fi
20621+
20622+ # A sed script that extracts the value of VARIABLE from a Makefile.
20623+ sed_x_variable='
20624+# Test if the hold space is empty.
20625+x
20626+s/P/P/
20627+x
20628+ta
20629+# Yes it was empty. Look if we have the expected variable definition.
20630+/^[ ]*VARIABLE[ ]*=/{
20631+ # Seen the first line of the variable definition.
20632+ s/^[ ]*VARIABLE[ ]*=//
20633+ ba
20634+}
20635+bd
20636+:a
20637+# Here we are processing a line from the variable definition.
20638+# Remove comment, more precisely replace it with a space.
20639+s/#.*$/ /
20640+# See if the line ends in a backslash.
20641+tb
20642+:b
20643+s/\\$//
20644+# Print the line, without the trailing backslash.
20645+p
20646+tc
20647+# There was no trailing backslash. The end of the variable definition is
20648+# reached. Clear the hold space.
20649+s/^.*$//
20650+x
20651+bd
20652+:c
20653+# A trailing backslash means that the variable definition continues in the
20654+# next line. Put a nonempty string into the hold space to indicate this.
20655+s/^.*$/P/
20656+x
20657+:d
20658+'
20659+changequote([,])dnl
20660+
20661+ # Set POTFILES to the value of the Makefile variable POTFILES.
20662+ sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
20663+ POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
20664+ # Compute POTFILES_DEPS as
20665+ # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
20666+ POTFILES_DEPS=
20667+ for file in $POTFILES; do
20668+ POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
20669+ done
20670+ POMAKEFILEDEPS=""
20671+
20672+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
20673+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
20674+ fi
20675+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
20676+ # The LINGUAS file contains the set of available languages.
20677+ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
20678+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
20679+ else
20680+ # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
20681+ sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
20682+ ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
20683+ fi
20684+ # Hide the ALL_LINGUAS assigment from automake.
20685+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
20686+ # Compute POFILES
20687+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
20688+ # Compute UPDATEPOFILES
20689+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
20690+ # Compute DUMMYPOFILES
20691+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
20692+ # Compute GMOFILES
20693+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
20694+ # Compute PROPERTIESFILES
20695+ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
20696+ # Compute CLASSFILES
20697+ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
20698+ # Compute QMFILES
20699+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
20700+ # Compute MSGFILES
20701+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
20702+ # Compute RESOURCESDLLFILES
20703+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
20704+ case "$ac_given_srcdir" in
20705+ .) srcdirpre= ;;
20706+ *) srcdirpre='$(srcdir)/' ;;
20707+ esac
20708+ POFILES=
20709+ UPDATEPOFILES=
20710+ DUMMYPOFILES=
20711+ GMOFILES=
20712+ PROPERTIESFILES=
20713+ CLASSFILES=
20714+ QMFILES=
20715+ MSGFILES=
20716+ RESOURCESDLLFILES=
20717+ for lang in $ALL_LINGUAS; do
20718+ POFILES="$POFILES $srcdirpre$lang.po"
20719+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
20720+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
20721+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
20722+ PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
20723+ CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
20724+ QMFILES="$QMFILES $srcdirpre$lang.qm"
20725+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
20726+ MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
20727+ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
20728+ RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
20729+ done
20730+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
20731+ # environment variable.
20732+ INST_LINGUAS=
20733+ if test -n "$ALL_LINGUAS"; then
20734+ for presentlang in $ALL_LINGUAS; do
20735+ useit=no
20736+ if test "%UNSET%" != "$LINGUAS"; then
20737+ desiredlanguages="$LINGUAS"
20738+ else
20739+ desiredlanguages="$ALL_LINGUAS"
20740+ fi
20741+ for desiredlang in $desiredlanguages; do
20742+ # Use the presentlang catalog if desiredlang is
20743+ # a. equal to presentlang, or
20744+ # b. a variant of presentlang (because in this case,
20745+ # presentlang can be used as a fallback for messages
20746+ # which are not translated in the desiredlang catalog).
20747+ case "$desiredlang" in
20748+ "$presentlang"*) useit=yes;;
20749+ esac
20750+ done
20751+ if test $useit = yes; then
20752+ INST_LINGUAS="$INST_LINGUAS $presentlang"
20753+ fi
20754+ done
20755+ fi
20756+ CATALOGS=
20757+ JAVACATALOGS=
20758+ QTCATALOGS=
20759+ TCLCATALOGS=
20760+ CSHARPCATALOGS=
20761+ if test -n "$INST_LINGUAS"; then
20762+ for lang in $INST_LINGUAS; do
20763+ CATALOGS="$CATALOGS $lang.gmo"
20764+ JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
20765+ QTCATALOGS="$QTCATALOGS $lang.qm"
20766+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
20767+ TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
20768+ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
20769+ CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
20770+ done
20771+ fi
20772+
20773+ sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
20774+ if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
20775+ # Add dependencies that cannot be formulated as a simple suffix rule.
20776+ for lang in $ALL_LINGUAS; do
20777+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
20778+ cat >> "$ac_file.tmp" <<EOF
20779+$frobbedlang.msg: $lang.po
20780+ @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
20781+ \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
20782+EOF
20783+ done
20784+ fi
20785+ if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
20786+ # Add dependencies that cannot be formulated as a simple suffix rule.
20787+ for lang in $ALL_LINGUAS; do
20788+ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
20789+ cat >> "$ac_file.tmp" <<EOF
20790+$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
20791+ @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
20792+ \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
20793+EOF
20794+ done
20795+ fi
20796+ if test -n "$POMAKEFILEDEPS"; then
20797+ cat >> "$ac_file.tmp" <<EOF
20798+Makefile: $POMAKEFILEDEPS
20799+EOF
20800+ fi
20801+ mv "$ac_file.tmp" "$ac_file"
20802+])
20803--- lrzsz-0.12.20.safe/m4/printf-posix.m4 1969-12-31 19:00:00.000000000 -0500
20804+++ lrzsz-0.12.20/m4/printf-posix.m4 2004-09-12 14:40:34.974654000 -0400
20805@@ -0,0 +1,46 @@
20806+# printf-posix.m4 serial 2 (gettext-0.13.1)
20807+dnl Copyright (C) 2003 Free Software Foundation, Inc.
20808+dnl This file is free software, distributed under the terms of the GNU
20809+dnl General Public License. As a special exception to the GNU General
20810+dnl Public License, this file may be distributed as part of a program
20811+dnl that contains a configuration script generated by Autoconf, under
20812+dnl the same distribution terms as the rest of that program.
20813+
20814+dnl From Bruno Haible.
20815+dnl Test whether the printf() function supports POSIX/XSI format strings with
20816+dnl positions.
20817+
20818+AC_DEFUN([gt_PRINTF_POSIX],
20819+[
20820+ AC_REQUIRE([AC_PROG_CC])
20821+ AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
20822+ gt_cv_func_printf_posix,
20823+ [
20824+ AC_TRY_RUN([
20825+#include <stdio.h>
20826+#include <string.h>
20827+/* The string "%2$d %1$d", with dollar characters protected from the shell's
20828+ dollar expansion (possibly an autoconf bug). */
20829+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
20830+static char buf[100];
20831+int main ()
20832+{
20833+ sprintf (buf, format, 33, 55);
20834+ return (strcmp (buf, "55 33") != 0);
20835+}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
20836+ [
20837+ AC_EGREP_CPP(notposix, [
20838+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
20839+ notposix
20840+#endif
20841+ ], gt_cv_func_printf_posix="guessing no",
20842+ gt_cv_func_printf_posix="guessing yes")
20843+ ])
20844+ ])
20845+ case $gt_cv_func_printf_posix in
20846+ *yes)
20847+ AC_DEFINE(HAVE_POSIX_PRINTF, 1,
20848+ [Define if your printf() function supports format strings with positions.])
20849+ ;;
20850+ esac
20851+])
20852--- lrzsz-0.12.20.safe/m4/progtest.m4 1969-12-31 19:00:00.000000000 -0500
20853+++ lrzsz-0.12.20/m4/progtest.m4 2004-09-12 14:40:34.990651568 -0400
20854@@ -0,0 +1,91 @@
20855+# progtest.m4 serial 3 (gettext-0.12)
20856+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
20857+dnl This file is free software, distributed under the terms of the GNU
20858+dnl General Public License. As a special exception to the GNU General
20859+dnl Public License, this file may be distributed as part of a program
20860+dnl that contains a configuration script generated by Autoconf, under
20861+dnl the same distribution terms as the rest of that program.
20862+dnl
20863+dnl This file can can be used in projects which are not available under
20864+dnl the GNU General Public License or the GNU Library General Public
20865+dnl License but which still want to provide support for the GNU gettext
20866+dnl functionality.
20867+dnl Please note that the actual code of the GNU gettext library is covered
20868+dnl by the GNU Library General Public License, and the rest of the GNU
20869+dnl gettext package package is covered by the GNU General Public License.
20870+dnl They are *not* in the public domain.
20871+
20872+dnl Authors:
20873+dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
20874+
20875+# Search path for a program which passes the given test.
20876+
20877+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
20878+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
20879+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
20880+[
20881+# Prepare PATH_SEPARATOR.
20882+# The user is always right.
20883+if test "${PATH_SEPARATOR+set}" != set; then
20884+ echo "#! /bin/sh" >conf$$.sh
20885+ echo "exit 0" >>conf$$.sh
20886+ chmod +x conf$$.sh
20887+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
20888+ PATH_SEPARATOR=';'
20889+ else
20890+ PATH_SEPARATOR=:
20891+ fi
20892+ rm -f conf$$.sh
20893+fi
20894+
20895+# Find out how to test for executable files. Don't use a zero-byte file,
20896+# as systems may use methods other than mode bits to determine executability.
20897+cat >conf$$.file <<_ASEOF
20898+#! /bin/sh
20899+exit 0
20900+_ASEOF
20901+chmod +x conf$$.file
20902+if test -x conf$$.file >/dev/null 2>&1; then
20903+ ac_executable_p="test -x"
20904+else
20905+ ac_executable_p="test -f"
20906+fi
20907+rm -f conf$$.file
20908+
20909+# Extract the first word of "$2", so it can be a program name with args.
20910+set dummy $2; ac_word=[$]2
20911+AC_MSG_CHECKING([for $ac_word])
20912+AC_CACHE_VAL(ac_cv_path_$1,
20913+[case "[$]$1" in
20914+ [[\\/]]* | ?:[[\\/]]*)
20915+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
20916+ ;;
20917+ *)
20918+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
20919+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
20920+ IFS="$ac_save_IFS"
20921+ test -z "$ac_dir" && ac_dir=.
20922+ for ac_exec_ext in '' $ac_executable_extensions; do
20923+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
20924+ if [$3]; then
20925+ ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
20926+ break 2
20927+ fi
20928+ fi
20929+ done
20930+ done
20931+ IFS="$ac_save_IFS"
20932+dnl If no 4th arg is given, leave the cache variable unset,
20933+dnl so AC_PATH_PROGS will keep looking.
20934+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
20935+])dnl
20936+ ;;
20937+esac])dnl
20938+$1="$ac_cv_path_$1"
20939+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
20940+ AC_MSG_RESULT([$]$1)
20941+else
20942+ AC_MSG_RESULT(no)
20943+fi
20944+AC_SUBST($1)dnl
20945+])
20946--- lrzsz-0.12.20.safe/m4/signed.m4 1969-12-31 19:00:00.000000000 -0500
20947+++ lrzsz-0.12.20/m4/signed.m4 2004-09-12 14:40:34.996650656 -0400
20948@@ -0,0 +1,19 @@
20949+# signed.m4 serial 1 (gettext-0.10.40)
20950+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
20951+dnl This file is free software, distributed under the terms of the GNU
20952+dnl General Public License. As a special exception to the GNU General
20953+dnl Public License, this file may be distributed as part of a program
20954+dnl that contains a configuration script generated by Autoconf, under
20955+dnl the same distribution terms as the rest of that program.
20956+
20957+dnl From Bruno Haible.
20958+
20959+AC_DEFUN([bh_C_SIGNED],
20960+[
20961+ AC_CACHE_CHECK([for signed], bh_cv_c_signed,
20962+ [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
20963+ if test $bh_cv_c_signed = no; then
20964+ AC_DEFINE(signed, ,
20965+ [Define to empty if the C compiler doesn't support this keyword.])
20966+ fi
20967+])
20968--- lrzsz-0.12.20.safe/m4/size_max.m4 1969-12-31 19:00:00.000000000 -0500
20969+++ lrzsz-0.12.20/m4/size_max.m4 2004-09-12 14:40:35.003649592 -0400
20970@@ -0,0 +1,61 @@
20971+# size_max.m4 serial 2
20972+dnl Copyright (C) 2003 Free Software Foundation, Inc.
20973+dnl This file is free software, distributed under the terms of the GNU
20974+dnl General Public License. As a special exception to the GNU General
20975+dnl Public License, this file may be distributed as part of a program
20976+dnl that contains a configuration script generated by Autoconf, under
20977+dnl the same distribution terms as the rest of that program.
20978+
20979+dnl From Bruno Haible.
20980+
20981+AC_DEFUN([gl_SIZE_MAX],
20982+[
20983+ AC_CHECK_HEADERS(stdint.h)
20984+ dnl First test whether the system already has SIZE_MAX.
20985+ AC_MSG_CHECKING([for SIZE_MAX])
20986+ result=
20987+ AC_EGREP_CPP([Found it], [
20988+#include <limits.h>
20989+#if HAVE_STDINT_H
20990+#include <stdint.h>
20991+#endif
20992+#ifdef SIZE_MAX
20993+Found it
20994+#endif
20995+], result=yes)
20996+ if test -z "$result"; then
20997+ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
20998+ dnl than the type 'unsigned long'.
20999+ dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
21000+ dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
21001+ _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
21002+ [#include <stddef.h>], result=?)
21003+ _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
21004+ [#include <stddef.h>], result=?)
21005+ _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
21006+ [#include <stddef.h>], result=?)
21007+ if test "$fits_in_uint" = 1; then
21008+ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
21009+ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
21010+ AC_TRY_COMPILE([#include <stddef.h>
21011+ extern size_t foo;
21012+ extern unsigned long foo;
21013+ ], [], fits_in_uint=0)
21014+ fi
21015+ if test -z "$result"; then
21016+ if test "$fits_in_uint" = 1; then
21017+ result="$res_hi$res_lo"U
21018+ else
21019+ result="$res_hi$res_lo"UL
21020+ fi
21021+ else
21022+ dnl Shouldn't happen, but who knows...
21023+ result='~(size_t)0'
21024+ fi
21025+ fi
21026+ AC_MSG_RESULT([$result])
21027+ if test "$result" != yes; then
21028+ AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
21029+ [Define as the maximum value of type 'size_t', if the system doesn't define it.])
21030+ fi
21031+])
21032--- lrzsz-0.12.20.safe/m4/stdint_h.m4 1969-12-31 19:00:00.000000000 -0500
21033+++ lrzsz-0.12.20/m4/stdint_h.m4 2004-09-12 14:40:35.009648680 -0400
21034@@ -0,0 +1,28 @@
21035+# stdint_h.m4 serial 3 (gettext-0.12)
21036+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
21037+dnl This file is free software, distributed under the terms of the GNU
21038+dnl General Public License. As a special exception to the GNU General
21039+dnl Public License, this file may be distributed as part of a program
21040+dnl that contains a configuration script generated by Autoconf, under
21041+dnl the same distribution terms as the rest of that program.
21042+
21043+dnl From Paul Eggert.
21044+
21045+# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
21046+# doesn't clash with <sys/types.h>, and declares uintmax_t.
21047+
21048+AC_DEFUN([jm_AC_HEADER_STDINT_H],
21049+[
21050+ AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
21051+ [AC_TRY_COMPILE(
21052+ [#include <sys/types.h>
21053+#include <stdint.h>],
21054+ [uintmax_t i = (uintmax_t) -1;],
21055+ jm_ac_cv_header_stdint_h=yes,
21056+ jm_ac_cv_header_stdint_h=no)])
21057+ if test $jm_ac_cv_header_stdint_h = yes; then
21058+ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
21059+ [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
21060+ and declares uintmax_t. ])
21061+ fi
21062+])
21063--- lrzsz-0.12.20.safe/m4/uintmax_t.m4 1969-12-31 19:00:00.000000000 -0500
21064+++ lrzsz-0.12.20/m4/uintmax_t.m4 2004-09-12 14:40:35.021646856 -0400
21065@@ -0,0 +1,32 @@
21066+# uintmax_t.m4 serial 7 (gettext-0.12)
21067+dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
21068+dnl This file is free software, distributed under the terms of the GNU
21069+dnl General Public License. As a special exception to the GNU General
21070+dnl Public License, this file may be distributed as part of a program
21071+dnl that contains a configuration script generated by Autoconf, under
21072+dnl the same distribution terms as the rest of that program.
21073+
21074+dnl From Paul Eggert.
21075+
21076+AC_PREREQ(2.13)
21077+
21078+# Define uintmax_t to 'unsigned long' or 'unsigned long long'
21079+# if it is not already defined in <stdint.h> or <inttypes.h>.
21080+
21081+AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
21082+[
21083+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
21084+ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
21085+ if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
21086+ AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
21087+ test $ac_cv_type_unsigned_long_long = yes \
21088+ && ac_type='unsigned long long' \
21089+ || ac_type='unsigned long'
21090+ AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
21091+ [Define to unsigned long or unsigned long long
21092+ if <stdint.h> and <inttypes.h> don't define.])
21093+ else
21094+ AC_DEFINE(HAVE_UINTMAX_T, 1,
21095+ [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
21096+ fi
21097+])
21098--- lrzsz-0.12.20.safe/m4/ulonglong.m4 1969-12-31 19:00:00.000000000 -0500
21099+++ lrzsz-0.12.20/m4/ulonglong.m4 2004-09-12 14:40:35.028645792 -0400
21100@@ -0,0 +1,25 @@
21101+# ulonglong.m4 serial 3
21102+dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
21103+dnl This file is free software, distributed under the terms of the GNU
21104+dnl General Public License. As a special exception to the GNU General
21105+dnl Public License, this file may be distributed as part of a program
21106+dnl that contains a configuration script generated by Autoconf, under
21107+dnl the same distribution terms as the rest of that program.
21108+
21109+dnl From Paul Eggert.
21110+
21111+# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
21112+
21113+AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
21114+[
21115+ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
21116+ [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
21117+ [unsigned long long ullmax = (unsigned long long) -1;
21118+ return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
21119+ ac_cv_type_unsigned_long_long=yes,
21120+ ac_cv_type_unsigned_long_long=no)])
21121+ if test $ac_cv_type_unsigned_long_long = yes; then
21122+ AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
21123+ [Define if you have the 'unsigned long long' type.])
21124+ fi
21125+])
21126--- lrzsz-0.12.20.safe/m4/wchar_t.m4 1969-12-31 19:00:00.000000000 -0500
21127+++ lrzsz-0.12.20/m4/wchar_t.m4 2004-09-12 14:40:35.034644880 -0400
21128@@ -0,0 +1,22 @@
21129+# wchar_t.m4 serial 1 (gettext-0.12)
21130+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
21131+dnl This file is free software, distributed under the terms of the GNU
21132+dnl General Public License. As a special exception to the GNU General
21133+dnl Public License, this file may be distributed as part of a program
21134+dnl that contains a configuration script generated by Autoconf, under
21135+dnl the same distribution terms as the rest of that program.
21136+
21137+dnl From Bruno Haible.
21138+dnl Test whether <stddef.h> has the 'wchar_t' type.
21139+dnl Prerequisite: AC_PROG_CC
21140+
21141+AC_DEFUN([gt_TYPE_WCHAR_T],
21142+[
21143+ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
21144+ [AC_TRY_COMPILE([#include <stddef.h>
21145+ wchar_t foo = (wchar_t)'\0';], ,
21146+ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
21147+ if test $gt_cv_c_wchar_t = yes; then
21148+ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
21149+ fi
21150+])
21151--- lrzsz-0.12.20.safe/m4/wint_t.m4 1969-12-31 19:00:00.000000000 -0500
21152+++ lrzsz-0.12.20/m4/wint_t.m4 2004-09-12 14:40:35.040643968 -0400
21153@@ -0,0 +1,22 @@
21154+# wint_t.m4 serial 1 (gettext-0.12)
21155+dnl Copyright (C) 2003 Free Software Foundation, Inc.
21156+dnl This file is free software, distributed under the terms of the GNU
21157+dnl General Public License. As a special exception to the GNU General
21158+dnl Public License, this file may be distributed as part of a program
21159+dnl that contains a configuration script generated by Autoconf, under
21160+dnl the same distribution terms as the rest of that program.
21161+
21162+dnl From Bruno Haible.
21163+dnl Test whether <wchar.h> has the 'wint_t' type.
21164+dnl Prerequisite: AC_PROG_CC
21165+
21166+AC_DEFUN([gt_TYPE_WINT_T],
21167+[
21168+ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
21169+ [AC_TRY_COMPILE([#include <wchar.h>
21170+ wint_t foo = (wchar_t)'\0';], ,
21171+ gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
21172+ if test $gt_cv_c_wint_t = yes; then
21173+ AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
21174+ fi
21175+])
21176--- lrzsz-0.12.20.safe/m4/xsize.m4 1969-12-31 19:00:00.000000000 -0500
21177+++ lrzsz-0.12.20/m4/xsize.m4 2004-09-12 14:40:35.047642904 -0400
21178@@ -0,0 +1,14 @@
21179+# xsize.m4 serial 2
21180+dnl Copyright (C) 2003 Free Software Foundation, Inc.
21181+dnl This file is free software, distributed under the terms of the GNU
21182+dnl General Public License. As a special exception to the GNU General
21183+dnl Public License, this file may be distributed as part of a program
21184+dnl that contains a configuration script generated by Autoconf, under
21185+dnl the same distribution terms as the rest of that program.
21186+
21187+AC_DEFUN([gl_XSIZE],
21188+[
21189+ dnl Prerequisites of lib/xsize.h.
21190+ AC_REQUIRE([gl_SIZE_MAX])
21191+ AC_CHECK_HEADERS(stdint.h)
21192+])
21193--- lrzsz-0.12.20.safe/Makefile.am 1998-12-30 06:19:40.000000000 -0500
21194+++ lrzsz-0.12.20/Makefile.am 2004-09-12 14:40:35.121631656 -0400
21195@@ -1,5 +1,5 @@
21196 SUBDIRS = lib intl src po man testsuite
21197-EXTRA_DIST = check.lrzsz COMPATABILITY README.cvs README.isdn4linux \
21198+EXTRA_DIST = config.rpath check.lrzsz COMPATABILITY README.cvs README.isdn4linux \
21199 README.gettext rpmrc buildrpm systype.in fastcheck.sh README.tests \
21200 beos-runpiped.c fastcheck.beos
21201 noinst_SCRIPTS=systype
21202@@ -83,3 +83,5 @@
21203 rpm: $(PR).tar.gz Specfile
21204 $(srcdir)/buildrpm $(srcdir)
21205
21206+
21207+ACLOCAL_AMFLAGS = -I m4
21208--- lrzsz-0.12.20.safe/Makefile.in 1998-12-30 11:31:40.000000000 -0500
21209+++ lrzsz-0.12.20/Makefile.in 2004-09-12 14:40:35.109633480 -0400
21210@@ -125,7 +125,7 @@
21211 && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
21212
21213 $(ACLOCAL_M4): configure.in acinclude.m4
21214- cd $(srcdir) && $(ACLOCAL)
21215+ cd $(srcdir) && $(ACLOCAL) -I m4
21216
21217 config.status: $(srcdir)/configure
21218 $(SHELL) ./config.status --recheck
21219--- lrzsz-0.12.20.safe/mkinstalldirs 1998-04-26 09:20:52.000000000 -0400
21220+++ lrzsz-0.12.20/mkinstalldirs 2004-09-12 14:40:34.337750824 -0400
21221@@ -1,34 +1,150 @@
21222 #! /bin/sh
21223 # mkinstalldirs --- make directory hierarchy
21224-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
21225+
21226+scriptversion=2004-02-15.20
21227+
21228+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
21229 # Created: 1993-05-16
21230-# Last modified: 1995-03-05
21231-# Public domain
21232+# Public domain.
21233+#
21234+# This file is maintained in Automake, please report
21235+# bugs to <bug-automake@gnu.org> or send patches to
21236+# <automake-patches@gnu.org>.
21237
21238 errstatus=0
21239+dirmode=""
21240
21241-for file in ${1+"$@"} ; do
21242- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
21243- shift
21244+usage="\
21245+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
21246
21247- pathcomp=
21248- for d in ${1+"$@"} ; do
21249- pathcomp="$pathcomp$d"
21250- case "$pathcomp" in
21251- -* ) pathcomp=./$pathcomp ;;
21252- esac
21253+Create each directory DIR (with mode MODE, if specified), including all
21254+leading file name components.
21255
21256- if test ! -d "$pathcomp"; then
21257- echo "mkdir $pathcomp" 1>&2
21258- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
21259- fi
21260+Report bugs to <bug-automake@gnu.org>."
21261
21262- if test ! -d "$pathcomp"; then
21263+# process command line arguments
21264+while test $# -gt 0 ; do
21265+ case $1 in
21266+ -h | --help | --h*) # -h for help
21267+ echo "$usage"
21268+ exit 0
21269+ ;;
21270+ -m) # -m PERM arg
21271+ shift
21272+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
21273+ dirmode=$1
21274+ shift
21275+ ;;
21276+ --version)
21277+ echo "$0 $scriptversion"
21278+ exit 0
21279+ ;;
21280+ --) # stop option processing
21281+ shift
21282+ break
21283+ ;;
21284+ -*) # unknown option
21285+ echo "$usage" 1>&2
21286+ exit 1
21287+ ;;
21288+ *) # first non-opt arg
21289+ break
21290+ ;;
21291+ esac
21292+done
21293+
21294+for file
21295+do
21296+ if test -d "$file"; then
21297+ shift
21298+ else
21299+ break
21300+ fi
21301+done
21302+
21303+case $# in
21304+ 0) exit 0 ;;
21305+esac
21306+
21307+# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
21308+# mkdir -p a/c at the same time, both will detect that a is missing,
21309+# one will create a, then the other will try to create a and die with
21310+# a "File exists" error. This is a problem when calling mkinstalldirs
21311+# from a parallel make. We use --version in the probe to restrict
21312+# ourselves to GNU mkdir, which is thread-safe.
21313+case $dirmode in
21314+ '')
21315+ if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
21316+ echo "mkdir -p -- $*"
21317+ exec mkdir -p -- "$@"
21318+ else
21319+ # On NextStep and OpenStep, the `mkdir' command does not
21320+ # recognize any option. It will interpret all options as
21321+ # directories to create, and then abort because `.' already
21322+ # exists.
21323+ test -d ./-p && rmdir ./-p
21324+ test -d ./--version && rmdir ./--version
21325+ fi
21326+ ;;
21327+ *)
21328+ if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
21329+ test ! -d ./--version; then
21330+ echo "mkdir -m $dirmode -p -- $*"
21331+ exec mkdir -m "$dirmode" -p -- "$@"
21332+ else
21333+ # Clean up after NextStep and OpenStep mkdir.
21334+ for d in ./-m ./-p ./--version "./$dirmode";
21335+ do
21336+ test -d $d && rmdir $d
21337+ done
21338+ fi
21339+ ;;
21340+esac
21341+
21342+for file
21343+do
21344+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
21345+ shift
21346+
21347+ pathcomp=
21348+ for d
21349+ do
21350+ pathcomp="$pathcomp$d"
21351+ case $pathcomp in
21352+ -*) pathcomp=./$pathcomp ;;
21353+ esac
21354+
21355+ if test ! -d "$pathcomp"; then
21356+ echo "mkdir $pathcomp"
21357+
21358+ mkdir "$pathcomp" || lasterr=$?
21359+
21360+ if test ! -d "$pathcomp"; then
21361 errstatus=$lasterr
21362- fi
21363+ else
21364+ if test ! -z "$dirmode"; then
21365+ echo "chmod $dirmode $pathcomp"
21366+ lasterr=""
21367+ chmod "$dirmode" "$pathcomp" || lasterr=$?
21368
21369- pathcomp="$pathcomp/"
21370- done
21371+ if test ! -z "$lasterr"; then
21372+ errstatus=$lasterr
21373+ fi
21374+ fi
21375+ fi
21376+ fi
21377+
21378+ pathcomp="$pathcomp/"
21379+ done
21380 done
21381
21382 exit $errstatus
21383+
21384+# Local Variables:
21385+# mode: shell-script
21386+# sh-indentation: 2
21387+# eval: (add-hook 'write-file-hooks 'time-stamp)
21388+# time-stamp-start: "scriptversion="
21389+# time-stamp-format: "%:y-%02m-%02d.%02H"
21390+# time-stamp-end: "$"
21391+# End:
21392--- lrzsz-0.12.20.safe/po/boldquot.sed 1969-12-31 19:00:00.000000000 -0500
21393+++ lrzsz-0.12.20/po/boldquot.sed 2004-09-12 14:40:34.723692152 -0400
21394@@ -0,0 +1,10 @@
21395+s/"\([^"]*\)"/“\1â€/g
21396+s/`\([^`']*\)'/‘\1’/g
21397+s/ '\([^`']*\)' / ‘\1’ /g
21398+s/ '\([^`']*\)'$/ ‘\1’/g
21399+s/^'\([^`']*\)' /‘\1’ /g
21400+s/“â€/""/g
21401+s/“/“/g
21402+s/â€/â€/g
21403+s/‘/‘/g
21404+s/’/’/g
21405--- lrzsz-0.12.20.safe/po/cat-id-tbl.c 1998-12-29 04:24:24.000000000 -0500
21406+++ lrzsz-0.12.20/po/cat-id-tbl.c 1969-12-31 19:00:00.000000000 -0500
21407@@ -1,234 +0,0 @@
21408-/* Automatically generated by po2tbl.sed from lrzsz.pot. */
21409-
21410-#if HAVE_CONFIG_H
21411-# include <config.h>
21412-#endif
21413-
21414-#include "libgettext.h"
21415-
21416-const struct _msg_ent _msg_tbl[] = {
21417- {"", 1},
21418- {"io_mode(,2) in rbsb.c not implemented\n", 2},
21419- {"caught signal %d; exiting", 3},
21420- {"command tries", 4},
21421- {"packetlength", 5},
21422- {"packetlength out of range 24..%ld", 6},
21423- {"framelength", 7},
21424- {"framelength out of range 32..%ld", 8},
21425- {"min_bps", 9},
21426- {"min_bps must be >= 0", 10},
21427- {"min_bps_time", 11},
21428- {"min_bps_time must be > 1", 12},
21429- {"hour to large (0..23)", 13},
21430- {"unparsable stop time\n", 14},
21431- {"minute to large (0..59)", 15},
21432- {"stop time to small", 16},
21433- {"stop-at", 17},
21434- {"timeout", 18},
21435- {"timeout out of range 10..1000", 19},
21436- {"security violation: can't do that under restricted shell\n", 20},
21437- {"window size", 21},
21438- {"cannot turnoff syslog", 22},
21439- {"startup delay", 23},
21440- {"out of memory", 24},
21441- {"this program was never intended to be used setuid\n", 25},
21442- {"need at least one file to send", 26},
21443- {"Can't send command in restricted mode\n", 27},
21444- {"hostname too long\n", 28},
21445- {"illegal server address\n", 29},
21446- {"can read only one file from stdin", 30},
21447- {"Transfer incomplete\n", 31},
21448- {"Transfer complete\n", 32},
21449- {"send_pseudo %s: cannot open tmpfile %s: %s", 33},
21450- {"send_pseudo %s: cannot lstat tmpfile %s: %s", 34},
21451- {"send_pseudo %s: avoiding symlink trap", 35},
21452- {"send_pseudo %s: cannot write to tmpfile %s: %s", 36},
21453- {"send_pseudo %s: failed", 37},
21454- {"send_pseudo %s: ok", 38},
21455- {"tcp protocol init failed\n", 39},
21456- {"Answering TIMESYNC at %s", 40},
21457- {"timezone", 41},
21458- {"timezone unknown", 42},
21459- {"Can't open any requested files.", 43},
21460- {"security violation: not allowed to upload from %s", 44},
21461- {"cannot open %s", 45},
21462- {"is not a file: %s", 46},
21463- {"%s/%s: error occured", 47},
21464- {"skipped: %s", 48},
21465- {"%s/%s: skipped", 49},
21466- {"Bytes Sent:%7ld BPS:%-8ld \n", 50},
21467- {"Sending %s, %ld blocks: ", 51},
21468- {"Give your local XMODEM receive command now.", 52},
21469- {"Sending: %s\n", 53},
21470- {"Timeout on pathname", 54},
21471- {"Receiver Cancelled", 55},
21472- {"No ACK on EOT", 56},
21473- {"Xmodem sectors/kbytes sent: %3d/%2dk", 57},
21474- {"Ymodem sectors/kbytes sent: %3d/%2dk", 58},
21475- {"Cancelled", 59},
21476- {"Timeout on sector ACK", 60},
21477- {"NAK on sector", 61},
21478- {"Got burst for sector ACK", 62},
21479- {"Got %02x for sector ACK", 63},
21480- {"Retry Count Exceeded", 64},
21481- {"Try `%s --help' for more information.\n", 65},
21482- {"%s version %s\n", 66},
21483- {"Usage: %s [options] file ...\n", 67},
21484- {" or: %s [options] -{c|i} COMMAND\n", 68},
21485- {"Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n", 69},
21486- {"\
21487- (X) = option applies to XMODEM only\n\
21488- (Y) = option applies to YMODEM only\n\
21489- (Z) = option applies to ZMODEM only\n", 70},
21490- {"\
21491- -+, --append append to existing destination file (Z)\n\
21492- -2, --twostop use 2 stop bits\n\
21493- -4, --try-4k go up to 4K blocksize\n\
21494- --start-4k start with 4K blocksize (doesn't try 8)\n\
21495- -8, --try-8k go up to 8K blocksize\n\
21496- --start-8k start with 8K blocksize\n\
21497- -a, --ascii ASCII transfer (change CR/LF to LF)\n\
21498- -b, --binary binary transfer\n\
21499- -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
21500- -c, --command COMMAND execute remote command COMMAND (Z)\n\
21501- -C, --command-tries N try N times to execute a command (Z)\n\
21502- -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n\
21503- --delay-startup N sleep N seconds before doing anything\n\
21504- -e, --escape escape all control characters (Z)\n\
21505- -E, --rename force receiver to rename files it already has\n\
21506- -f, --full-path send full pathname (Y/Z)\n\
21507- -i, --immediate-command CMD send remote CMD, return immediately (Z)\n\
21508- -h, --help print this usage message\n\
21509- -k, --1k send 1024 byte packets (X)\n\
21510- -L, --packetlen N limit subpacket length to N bytes (Z)\n\
21511- -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n\
21512- -m, --min-bps N stop transmission if BPS below N\n\
21513- -M, --min-bps-time N for at least N seconds (default: 120)\n", 71},
21514- {"\
21515- -n, --newer send file if source newer (Z)\n\
21516- -N, --newer-or-longer send file if source newer or longer (Z)\n\
21517- -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n\
21518- -O, --disable-timeouts disable timeout code, wait forever\n\
21519- -p, --protect protect existing destination file (Z)\n\
21520- -r, --resume resume interrupted file transfer (Z)\n\
21521- -R, --restricted restricted, more secure mode\n\
21522- -q, --quiet quiet (no progress reports)\n\
21523- -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
21524- --tcp build a TCP connection to transmit files\n\
21525- --tcp-server open socket, wait for connection\n\
21526- -u, --unlink unlink file after transmission\n\
21527- -U, --unrestrict turn off restricted mode (if allowed to)\n\
21528- -v, --verbose be verbose, provide debugging information\n\
21529- -w, --windowsize N Window is N bytes (Z)\n\
21530- -X, --xmodem use XMODEM protocol\n\
21531- -y, --overwrite overwrite existing files\n\
21532- -Y, --overwrite-or-skip overwrite existing files, else skip\n\
21533- --ymodem use YMODEM protocol\n\
21534- -Z, --zmodem use ZMODEM protocol\n\
21535-\n\
21536-short options use the same arguments as the long ones\n", 72},
21537- {"got ZRQINIT", 73},
21538- {"got ZCAN", 74},
21539- {"blklen now %d\n", 75},
21540- {"zsendfdata: bps rate %ld below min %ld", 76},
21541- {"zsendfdata: reached stop time", 77},
21542- {"Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d ", 78},
21543- {"calc_blklen: reduced to %d due to error\n", 79},
21544- {"calc_blklen: returned old value %d due to low bpe diff\n", 80},
21545- {"calc_blklen: old %ld, new %ld, d %ld\n", 81},
21546- {"calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n", 82},
21547- {"calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n", 83},
21548- {"calc_blklen: returned %d as best\n", 84},
21549- {"\
21550-\n\
21551-countem: Total %d %ld\n", 85},
21552- {"Bad escape sequence %x", 86},
21553- {"Sender Canceled", 87},
21554- {"TIMEOUT", 88},
21555- {"Bad data subpacket", 89},
21556- {"Data subpacket too long", 90},
21557- {"Garbage count exceeded", 91},
21558- {"Got %s", 92},
21559- {"Retry %d: ", 93},
21560- {"don't have settimeofday, will not set time\n", 94},
21561- {"not running as root (this is good!), can not set time\n", 95},
21562- {"bytes_per_error", 96},
21563- {"bytes-per-error should be >100", 97},
21564- {"O_SYNC not supported by the kernel", 98},
21565- {"garbage on commandline", 99},
21566- {"Usage: %s [options] [filename.if.xmodem]\n", 100},
21567- {"Receive files with ZMODEM/YMODEM/XMODEM protocol\n", 101},
21568- {"\
21569- -+, --append append to existing files\n\
21570- -a, --ascii ASCII transfer (change CR/LF to LF)\n\
21571- -b, --binary binary transfer\n\
21572- -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
21573- -c, --with-crc Use 16 bit CRC (X)\n\
21574- -C, --allow-remote-commands allow execution of remote commands (Z)\n\
21575- -D, --null write all received data to /dev/null\n\
21576- --delay-startup N sleep N seconds before doing anything\n\
21577- -e, --escape Escape control characters (Z)\n\
21578- -E, --rename rename any files already existing\n\
21579- --errors N generate CRC error every N bytes (debugging)\n\
21580- -h, --help Help, print this usage message\n\
21581- -m, --min-bps N stop transmission if BPS below N\n\
21582- -M, --min-bps-time N for at least N seconds (default: 120)\n\
21583- -O, --disable-timeouts disable timeout code, wait forever for data\n\
21584- --o-sync open output file(s) in synchronous write mode\n\
21585- -p, --protect protect existing files\n\
21586- -q, --quiet quiet, no progress reports\n\
21587- -r, --resume try to resume interrupted file transfer (Z)\n\
21588- -R, --restricted restricted, more secure mode\n\
21589- -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
21590- -S, --timesync request remote time (twice: set local time)\n\
21591- --syslog[=off] turn syslog on or off, if possible\n\
21592- -t, --timeout N set timeout to N tenths of a second\n\
21593- -u, --keep-uppercase keep upper case filenames\n\
21594- -U, --unrestrict disable restricted mode (if allowed to)\n\
21595- -v, --verbose be verbose, provide debugging information\n\
21596- -w, --windowsize N Window is N bytes (Z)\n\
21597- -X --xmodem use XMODEM protocol\n\
21598- -y, --overwrite Yes, clobber existing file if any\n\
21599- --ymodem use YMODEM protocol\n\
21600- -Z, --zmodem use ZMODEM protocol\n\
21601-\n\
21602-short options use the same arguments as the long ones\n", 102},
21603- {"%s waiting to receive.", 103},
21604- {"\rBytes received: %7ld/%7ld BPS:%-6ld \r\n", 104},
21605- {"%s: ready to receive %s", 105},
21606- {"\rBytes received: %7ld BPS:%-6ld \r\n", 106},
21607- {"\
21608-\r\n\
21609-%s: %s removed.\r\n", 107},
21610- {"Pathname fetch returned EOT", 108},
21611- {"Received dup Sector", 109},
21612- {"Sync Error", 110},
21613- {"CRC", 111},
21614- {"Checksum", 112},
21615- {"Sector number garbled", 113},
21616- {"Sender Cancelled", 114},
21617- {"Got 0%o sector header", 115},
21618- {"file name ends with a /, skipped: %s\n", 116},
21619- {"zmanag=%d, Lzmanag=%d\n", 117},
21620- {"zconv=%d\n", 118},
21621- {"file exists, skipped: %s\n", 119},
21622- {"TIMESYNC: here %ld, remote %ld, diff %ld seconds\n", 120},
21623- {"TIMESYNC: cannot set time: %s\n", 121},
21624- {"cannot tmpfile() for tcp protocol synchronization", 122},
21625- {"Topipe", 123},
21626- {"Receiving: %s\n", 124},
21627- {"Blocks received: %d", 125},
21628- {"%s: %s exists\n", 126},
21629- {"%s:\tSecurity Violation", 127},
21630- {"remote command execution requested", 128},
21631- {"not executed", 129},
21632- {"got ZRINIT", 130},
21633- {"Skipped", 131},
21634- {"rzfile: bps rate %ld below min %ld", 132},
21635- {"rzfile: reached stop time", 133},
21636- {"\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d ", 134},
21637- {"fgets for tcp protocol synchronization failed: ", 135},
21638- {"file close error", 136},
21639-};
21640-
21641-int _msg_tbl_length = 136;
21642--- lrzsz-0.12.20.safe/po/ChangeLog 1998-04-26 09:20:52.000000000 -0400
21643+++ lrzsz-0.12.20/po/ChangeLog 2004-09-12 14:40:34.793681512 -0400
21644@@ -1,3 +1,15 @@
21645+2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
21646+
21647+ * boldquot.sed: New file, from gettext-0.14.1.
21648+ * en@boldquot.header: New file, from gettext-0.14.1.
21649+ * en@quot.header: New file, from gettext-0.14.1.
21650+ * insert-header.sin: New file, from gettext-0.14.1.
21651+ * quot.sed: New file, from gettext-0.14.1.
21652+ * remove-potcdate.sin: New file, from gettext-0.14.1.
21653+ * Rules-quot: New file, from gettext-0.14.1.
21654+ * cat-id-tbl.c: Remove file.
21655+ * stamp-cat-id: Remove file.
21656+
21657 /* Automatically generated by po2tbl.sed from lrzsz.pot. */
21658
21659 #if HAVE_CONFIG_H
21660--- lrzsz-0.12.20.safe/po/en@boldquot.header 1969-12-31 19:00:00.000000000 -0500
21661+++ lrzsz-0.12.20/po/en@boldquot.header 2004-09-12 14:40:34.731690936 -0400
21662@@ -0,0 +1,25 @@
21663+# All this catalog "translates" are quotation characters.
21664+# The msgids must be ASCII and therefore cannot contain real quotation
21665+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
21666+# and double quote (0x22). These substitutes look strange; see
21667+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
21668+#
21669+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
21670+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
21671+# It also translates pairs of apostrophe (0x27) to
21672+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
21673+# and pairs of quotation mark (0x22) to
21674+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
21675+#
21676+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
21677+# When output to an ISO-8859-1 terminal, the single quotation marks are
21678+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
21679+# grave/acute accent (by libiconv), and the double quotation marks are
21680+# transliterated to 0x22.
21681+# When output to an ASCII terminal, the single quotation marks are
21682+# transliterated to apostrophes, and the double quotation marks are
21683+# transliterated to 0x22.
21684+#
21685+# This catalog furthermore displays the text between the quotation marks in
21686+# bold face, assuming the VT100/XTerm escape sequences.
21687+#
21688--- lrzsz-0.12.20.safe/po/en@quot.header 1969-12-31 19:00:00.000000000 -0500
21689+++ lrzsz-0.12.20/po/en@quot.header 2004-09-12 14:40:34.737690024 -0400
21690@@ -0,0 +1,22 @@
21691+# All this catalog "translates" are quotation characters.
21692+# The msgids must be ASCII and therefore cannot contain real quotation
21693+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
21694+# and double quote (0x22). These substitutes look strange; see
21695+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
21696+#
21697+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
21698+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
21699+# It also translates pairs of apostrophe (0x27) to
21700+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
21701+# and pairs of quotation mark (0x22) to
21702+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
21703+#
21704+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
21705+# When output to an ISO-8859-1 terminal, the single quotation marks are
21706+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
21707+# grave/acute accent (by libiconv), and the double quotation marks are
21708+# transliterated to 0x22.
21709+# When output to an ASCII terminal, the single quotation marks are
21710+# transliterated to apostrophes, and the double quotation marks are
21711+# transliterated to 0x22.
21712+#
21713--- lrzsz-0.12.20.safe/po/insert-header.sin 1969-12-31 19:00:00.000000000 -0500
21714+++ lrzsz-0.12.20/po/insert-header.sin 2004-09-12 14:40:34.743689112 -0400
21715@@ -0,0 +1,23 @@
21716+# Sed script that inserts the file called HEADER before the header entry.
21717+#
21718+# At each occurrence of a line starting with "msgid ", we execute the following
21719+# commands. At the first occurrence, insert the file. At the following
21720+# occurrences, do nothing. The distinction between the first and the following
21721+# occurrences is achieved by looking at the hold space.
21722+/^msgid /{
21723+x
21724+# Test if the hold space is empty.
21725+s/m/m/
21726+ta
21727+# Yes it was empty. First occurrence. Read the file.
21728+r HEADER
21729+# Output the file's contents by reading the next line. But don't lose the
21730+# current line while doing this.
21731+g
21732+N
21733+bb
21734+:a
21735+# The hold space was nonempty. Following occurrences. Do nothing.
21736+x
21737+:b
21738+}
21739--- lrzsz-0.12.20.safe/po/Makevars 1969-12-31 19:00:00.000000000 -0500
21740+++ lrzsz-0.12.20/po/Makevars 2004-09-12 14:40:34.748688352 -0400
21741@@ -0,0 +1,41 @@
21742+# Makefile variables for PO directory in any package using GNU gettext.
21743+
21744+# Usually the message domain is the same as the package name.
21745+DOMAIN = $(PACKAGE)
21746+
21747+# These two variables depend on the location of this directory.
21748+subdir = po
21749+top_builddir = ..
21750+
21751+# These options get passed to xgettext.
21752+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
21753+
21754+# This is the copyright holder that gets inserted into the header of the
21755+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
21756+# package. (Note that the msgstr strings, extracted from the package's
21757+# sources, belong to the copyright holder of the package.) Translators are
21758+# expected to transfer the copyright for their translations to this person
21759+# or entity, or to disclaim their copyright. The empty string stands for
21760+# the public domain; in this case the translators are expected to disclaim
21761+# their copyright.
21762+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
21763+
21764+# This is the email address or URL to which the translators shall report
21765+# bugs in the untranslated strings:
21766+# - Strings which are not entire sentences, see the maintainer guidelines
21767+# in the GNU gettext documentation, section 'Preparing Strings'.
21768+# - Strings which use unclear terms or require additional context to be
21769+# understood.
21770+# - Strings which make invalid assumptions about notation of date, time or
21771+# money.
21772+# - Pluralisation problems.
21773+# - Incorrect English spelling.
21774+# - Incorrect formatting.
21775+# It can be your email address, or a mailing list address where translators
21776+# can write to without being subscribed, or the URL of a web page through
21777+# which the translators can contact you.
21778+MSGID_BUGS_ADDRESS =
21779+
21780+# This is the list of locale categories, beyond LC_MESSAGES, for which the
21781+# message catalogs shall be used. It is usually empty.
21782+EXTRA_LOCALE_CATEGORIES =
21783--- lrzsz-0.12.20.safe/po/quot.sed 1969-12-31 19:00:00.000000000 -0500
21784+++ lrzsz-0.12.20/po/quot.sed 2004-09-12 14:40:34.754687440 -0400
21785@@ -0,0 +1,6 @@
21786+s/"\([^"]*\)"/“\1â€/g
21787+s/`\([^`']*\)'/‘\1’/g
21788+s/ '\([^`']*\)' / ‘\1’ /g
21789+s/ '\([^`']*\)'$/ ‘\1’/g
21790+s/^'\([^`']*\)' /‘\1’ /g
21791+s/“â€/""/g
21792--- lrzsz-0.12.20.safe/po/remove-potcdate.sin 1969-12-31 19:00:00.000000000 -0500
21793+++ lrzsz-0.12.20/po/remove-potcdate.sin 2004-09-12 14:40:34.762686224 -0400
21794@@ -0,0 +1,19 @@
21795+# Sed script that remove the POT-Creation-Date line in the header entry
21796+# from a POT file.
21797+#
21798+# The distinction between the first and the following occurrences of the
21799+# pattern is achieved by looking at the hold space.
21800+/^"POT-Creation-Date: .*"$/{
21801+x
21802+# Test if the hold space is empty.
21803+s/P/P/
21804+ta
21805+# Yes it was empty. First occurrence. Remove the line.
21806+g
21807+d
21808+bb
21809+:a
21810+# The hold space was nonempty. Following occurrences. Do nothing.
21811+x
21812+:b
21813+}
21814--- lrzsz-0.12.20.safe/po/Rules-quot 1969-12-31 19:00:00.000000000 -0500
21815+++ lrzsz-0.12.20/po/Rules-quot 2004-09-12 14:40:34.778683792 -0400
21816@@ -0,0 +1,47 @@
21817+# Special Makefile rules for English message catalogs with quotation marks.
21818+
21819+DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
21820+
21821+.SUFFIXES: .insert-header .po-update-en
21822+
21823+en@quot.po-create:
21824+ $(MAKE) en@quot.po-update
21825+en@boldquot.po-create:
21826+ $(MAKE) en@boldquot.po-update
21827+
21828+en@quot.po-update: en@quot.po-update-en
21829+en@boldquot.po-update: en@boldquot.po-update-en
21830+
21831+.insert-header.po-update-en:
21832+ @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
21833+ if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
21834+ tmpdir=`pwd`; \
21835+ echo "$$lang:"; \
21836+ ll=`echo $$lang | sed -e 's/@.*//'`; \
21837+ LC_ALL=C; export LC_ALL; \
21838+ cd $(srcdir); \
21839+ if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
21840+ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
21841+ rm -f $$tmpdir/$$lang.new.po; \
21842+ else \
21843+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
21844+ :; \
21845+ else \
21846+ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
21847+ exit 1; \
21848+ fi; \
21849+ fi; \
21850+ else \
21851+ echo "creation of $$lang.po failed!" 1>&2; \
21852+ rm -f $$tmpdir/$$lang.new.po; \
21853+ fi
21854+
21855+en@quot.insert-header: insert-header.sin
21856+ sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
21857+
21858+en@boldquot.insert-header: insert-header.sin
21859+ sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
21860+
21861+mostlyclean: mostlyclean-quot
21862+mostlyclean-quot:
21863+ rm -f *.insert-header
21864--- lrzsz-0.12.20.safe/po/stamp-cat-id 1998-12-30 02:50:01.000000000 -0500
21865+++ lrzsz-0.12.20/po/stamp-cat-id 1969-12-31 19:00:00.000000000 -0500
21866@@ -1 +0,0 @@
21867-timestamp
21868--- lrzsz-0.12.20.safe/src/Makefile.am 1998-12-28 03:38:47.000000000 -0500
21869+++ lrzsz-0.12.20/src/Makefile.am 2004-09-12 14:40:53.665812512 -0400
21870@@ -2,12 +2,12 @@
21871 lrz_SOURCES=lrz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
21872 lsz_SOURCES=lsz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
21873 noinst_HEADERS = timing.h zglobal.h zmodem.h
21874-datadir = $(prefix)/@DATADIRNAME@
21875+datadir = $(prefix)/share
21876 localedir = $(datadir)/locale
21877 CFLAGS=@CFLAGS@
21878 DISTCLEAN_FILES=lrzszbug
21879
21880-LDADD = ../lib/libzmodem.a @INTLLIBS@
21881+LDADD = ../lib/libzmodem.a @LIBINTL@
21882 AUTOMAKE_OPTIONS=ansi2knr
21883 EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
21884 INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch
new file mode 100644
index 0000000000..9e46dfa070
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch
@@ -0,0 +1,32 @@
1From 28b473c3c96682a820e292cc1be006e19aee11bc Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Fri, 24 May 2013 01:07:24 -0400
4Subject: [PATCH] lrzsz check locale.h
5
6fix the build failure when using -O0 in a debug build:
7lrz.c:284:13: error: 'LC_ALL' undeclared (first use in this function)
8
9Upstream-Status: Submitted [uwe@ohse.de]
10
11Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
12Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
13---
14 configure.in | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/configure.in b/configure.in
18index 6e2064c..c10460c 100644
19--- a/configure.in
20+++ b/configure.in
21@@ -130,7 +130,7 @@ AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/times.h)
22 LRZSZ_HEADERS_TERM_IO
23 AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)
24 AC_CHECK_HEADERS(sys/mman.h utime.h syslog.h sys/syslog.h sys/param.h)
25-AC_CHECK_HEADERS(sys/select.h strings.h arpa/inet.h)
26+AC_CHECK_HEADERS(sys/select.h strings.h locale.h arpa/inet.h)
27
28 dnl Checks for typedefs, structures, and compiler characteristics.
29 AC_TYPE_SIZE_T
30--
311.7.9.5
32
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch
new file mode 100644
index 0000000000..b4529f4c7a
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch
@@ -0,0 +1,49 @@
1Upstream-Status: Pending
2
3This patch fixes following issue with automake 1.12
4
5| configure.in:95: error: automatic de-ANSI-fication support has been removed
6...
7| lib/Makefile.am:3: error: automatic de-ANSI-fication support has been removed
8| lib/Makefile.am: installing './depcomp'
9| src/Makefile.am:11: error: automatic de-ANSI-fication support has been removed
10
11
12Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
132012/05/03
14
15Index: lrzsz-0.12.20/configure.in
16===================================================================
17--- lrzsz-0.12.20.orig/configure.in
18+++ lrzsz-0.12.20/configure.in
19@@ -92,7 +92,6 @@ AC_PROG_RANLIB
20 AC_ISC_POSIX
21 AC_AIX
22 AC_MINIX
23-AM_C_PROTOTYPES
24 AC_C_CONST
25 AC_C_INLINE
26
27Index: lrzsz-0.12.20/lib/Makefile.am
28===================================================================
29--- lrzsz-0.12.20.orig/lib/Makefile.am
30+++ lrzsz-0.12.20/lib/Makefile.am
31@@ -1,6 +1,5 @@
32 noinst_LIBRARIES=libzmodem.a
33 CFLAGS=@CFLAGS@
34-AUTOMAKE_OPTIONS=ansi2knr
35
36 EXTRA_DIST = alloca.c ansi2knr.1 ansi2knr.c \
37 getopt.c getopt1.c mkdir.c mktime.c \
38Index: lrzsz-0.12.20/src/Makefile.am
39===================================================================
40--- lrzsz-0.12.20.orig/src/Makefile.am
41+++ lrzsz-0.12.20/src/Makefile.am
42@@ -8,7 +8,6 @@ CFLAGS=@CFLAGS@
43 DISTCLEAN_FILES=lrzszbug
44
45 LDADD = ../lib/libzmodem.a @LIBINTL@
46-AUTOMAKE_OPTIONS=ansi2knr
47 EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
48 INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
49 #DEFS = -DLOCALEDIR=\"$(localedir)\" -DOS=\"@host_os@\" -DCPU=\"@host_cpu@\"
diff --git a/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch
new file mode 100644
index 0000000000..ace592c8f2
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch
@@ -0,0 +1,22 @@
1Upstream-Status: Inappropriate [configuration]
2
3diff -ruN lrzsz-0.12.20_org/src/Makefile.in lrzsz-0.12.20_patch/src/Makefile.in
4--- lrzsz-0.12.20_org/src/Makefile.in 1998-12-30 17:31:46.000000000 +0100
5+++ lrzsz-0.12.20_patch/src/Makefile.in 2004-04-29 13:57:33.434909656 +0200
6@@ -372,13 +372,13 @@
7 rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'`
8 ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
9 $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
10- rm -f $(bindir)/`echo lsx | sed -e '$(transform)'`
11+ rm -f $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'`
12 ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
13 $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
14- rm -f $(bindir)/`echo lrb | sed -e '$(transform)'`
15+ rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'`
16 ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
17 $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
18- rm -f $(bindir)/`echo lrx | sed -e '$(transform)'`
19+ rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'`
20 ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
21 $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
22 # rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'`
diff --git a/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb b/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb
new file mode 100644
index 0000000000..e0ce57d020
--- /dev/null
+++ b/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb
@@ -0,0 +1,46 @@
1SUMMARY = "Tools for zmodem/xmodem/ymodem file transfer"
2DESCRIPTION = "Lrzsz is a cosmetically modified zmodem/ymodem/xmodem package built from \
3the public-domain version of Chuck Forsberg's rzsz package. \
4These programs use error correcting protocols ({z,x,y}modem) to send (sz, sx, sb) and \
5receive (rz, rx, rb) files over a dial-in serial port from a variety of programs \
6running under various operating systems. "
7HOMEPAGE = "http://www.ohse.de/uwe/software/lrzsz.html"
8LICENSE = "GPLv2+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
10 file://src/lrz.c;beginline=1;endline=10;md5=5276956373ff7d8758837f6399a1045f"
11SECTION = "console/network"
12DEPENDS = ""
13PR = "r6"
14
15SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
16 file://autotools.patch \
17 file://makefile.patch \
18 file://gettext.patch \
19 file://acdefine.patch \
20 file://lrzsz_fix_for_automake-1.12.patch \
21 file://lrzsz-check-locale.h.patch \
22 "
23
24SRC_URI[md5sum] = "b5ce6a74abc9b9eb2af94dffdfd372a4"
25SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
26
27inherit autotools gettext
28
29do_install() {
30 install -d ${D}${bindir}/
31 install -m 0755 src/lrz src/lsz ${D}${bindir}/
32}
33
34inherit update-alternatives
35
36ALTERNATIVE_PRIORITY = "100"
37
38ALTERNATIVE_${PN} = "rz rx rb sz sx sb"
39
40ALTERNATIVE_TARGET[rz] = "${bindir}/lrz"
41ALTERNATIVE_TARGET[rx] = "${bindir}/lrz"
42ALTERNATIVE_TARGET[rb] = "${bindir}/lrz"
43
44ALTERNATIVE_TARGET[sz] = "${bindir}/lsz"
45ALTERNATIVE_TARGET[sx] = "${bindir}/lsz"
46ALTERNATIVE_TARGET[sb] = "${bindir}/lsz"
diff --git a/meta/recipes-bsp/pciutils/pciutils/configure.patch b/meta/recipes-bsp/pciutils/pciutils/configure.patch
new file mode 100644
index 0000000000..66c9f91630
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils/configure.patch
@@ -0,0 +1,104 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3#
4# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
5#
6---
7
87/30/2010 - rebased to 3.1.5 by Qing He <qing.he@intel.com>
91/22/2012 - rebased to 3.1.9 by Shane Wang <shane.wang@intel.com>
10
11diff -r af2b10cc3c14 Makefile
12--- a/Makefile Sun Jan 22 18:36:34 2012 +0800
13+++ b/Makefile Sun Jan 22 18:38:54 2012 +0800
14@@ -37,7 +37,6 @@
15 # Commands
16 INSTALL=install
17 DIRINSTALL=install -d
18-STRIP=-s
19 CC=$(CROSS_COMPILE)gcc
20 AR=$(CROSS_COMPILE)ar
21 RANLIB=$(CROSS_COMPILE)ranlib
22@@ -86,7 +85,7 @@
23 example.o: example.c $(PCIINC)
24
25 %: %.o
26- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
27+ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@
28
29 %.8 %.7: %.man
30 M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@IDSDIR@#$(IDSDIR)#"
31@@ -101,7 +100,7 @@
32 install: all
33 # -c is ignored on Linux, but required on FreeBSD
34 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
35- $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
36+ $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR)
37 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
38 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
39 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
40diff -r af2b10cc3c14 lib/configure
41--- a/lib/configure Sun Jan 22 18:36:34 2012 +0800
42+++ b/lib/configure Sun Jan 22 18:38:54 2012 +0800
43@@ -14,6 +14,10 @@
44 fi
45 }
46
47+VERSION=$1
48+IDSDIR=$2
49+DNS=yes
50+
51 if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
52 echo >&2 "Please run the configure script from the top-level Makefile"
53 exit 1
54@@ -21,8 +25,8 @@
55
56 echo_n "Configuring libpci for your system..."
57 if [ -z "$HOST" ] ; then
58- sys=`uname -s`
59- rel=`uname -r`
60+ sys=${3:-`uname -s`}
61+ rel=
62 realsys="$sys"
63 if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
64 then
65@@ -30,7 +34,7 @@
66 proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
67 cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
68 else
69- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
70+ cpu=${4:-`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`}
71 fi
72 if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
73 then
74@@ -40,7 +44,7 @@
75 then
76 sys=cygwin
77 fi
78- HOST=${3:-$cpu-$sys}
79+ HOST=$cpu-$sys
80 fi
81 [ -n "$RELEASE" ] && rel="${RELEASE}"
82 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
83@@ -49,6 +53,21 @@
84 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
85 echo " $host $rel $cpu $sys"
86
87+if [ "$host" = "linux--gnueabi" ]
88+then
89+ sys=linux
90+fi
91+
92+if [ "$host" = "linux--uclibc" ]
93+then
94+ sys=linux
95+fi
96+
97+if [ "$host" = "linux--uclibceabi" ]
98+then
99+ sys=linux
100+fi
101+
102 c=config.h
103 m=config.mk
104 echo >$c '#define PCI_CONFIG_H'
diff --git a/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch b/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch
new file mode 100644
index 0000000000..540b4a0d13
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch
@@ -0,0 +1,37 @@
1the original guess algorithm is broken for many archs
2for example, the following two would break:
3 arm-linux-gnueabi --> sys=gnueabi
4 x86_64-unknown-pc-linux-gnu --> sys = pc-linux-gnu
5
6use a simpler scheme here and hope it works for all the cases
7
8Upstream-Status: Pending
9
107/30/2010 - created by Qing He <qing.he@intel.com>
11
12diff --git a/lib/configure b/lib/configure
13index 4318b05..84f6acb 100755
14--- a/lib/configure
15+++ b/lib/configure
16@@ -53,20 +53,7 @@ cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
17 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
18 echo " $host $rel $cpu $sys"
19
20-if [ "$host" = "linux--gnueabi" ]
21-then
22- sys=linux
23-fi
24-
25-if [ "$host" = "linux--uclibc" ]
26-then
27- sys=linux
28-fi
29-
30-if [ "$host" = "linux--uclibceabi" ]
31-then
32- sys=linux
33-fi
34+{ echo "$host" | grep linux; } && sys=linux
35
36 c=config.h
37 m=config.mk
diff --git a/meta/recipes-bsp/pciutils/pciutils/lib-build-fix.patch b/meta/recipes-bsp/pciutils/pciutils/lib-build-fix.patch
new file mode 100644
index 0000000000..413ef0e1e5
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils/lib-build-fix.patch
@@ -0,0 +1,92 @@
1Link directly to lib/libpci.so.3.1.5 will hard code this versioned
2string into lspci and other utilities, which is not desirable and
3won't work. In the other hand, linking to a symbolic link lib/libpci.so
4doesn't have this issue.
5
6Upstream-Status: Pending
7
87/30/2010 - created by Qing He <qing.he@intel.com>
9
10diff --git a/Makefile b/Makefile
11index 74c570a..31337e0 100644
12--- a/Makefile
13+++ b/Makefile
14@@ -56,9 +56,9 @@ PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
15
16 export
17
18-all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
19+all: lib/$(PCILIB_DEV) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
20
21-lib/$(PCILIB): $(PCIINC) force
22+lib/$(PCILIB) lib/$(PCILIB_DEV): $(PCIINC) force
23 $(MAKE) -C lib all
24
25 force:
26@@ -66,8 +66,8 @@ force:
27 lib/config.h lib/config.mk:
28 cd lib && ./configure
29
30-lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
31-setpci: setpci.o common.o lib/$(PCILIB)
32+lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB_DEV)
33+setpci: setpci.o common.o lib/$(PCILIB_DEV)
34
35 LSPCIINC=lspci.h pciutils.h $(PCIINC)
36 lspci.o: lspci.c $(LSPCIINC)
37@@ -89,7 +89,7 @@ update-pciids: update-pciids.sh
38 chmod +x $@
39
40 # The example of use of libpci
41-example: example.o lib/$(PCILIB)
42+example: example.o lib/$(PCILIB_DEV)
43 example.o: example.c $(PCIINC)
44
45 %: %.o
46diff --git a/lib/Makefile b/lib/Makefile
47index 1eb06a5..a8dab56 100644
48--- a/lib/Makefile
49+++ b/lib/Makefile
50@@ -42,7 +42,7 @@ ifdef PCI_HAVE_PM_NBSD_LIBPCI
51 OBJS += nbsd-libpci
52 endif
53
54-all: $(PCILIB) $(PCILIBPC)
55+all: $(PCILIB_DEV) $(PCILIBPC)
56
57 ifeq ($(SHARED),no)
58 $(PCILIB): $(addsuffix .o,$(OBJS))
59@@ -53,6 +53,9 @@ else
60 CFLAGS += -fPIC -fvisibility=hidden
61 $(PCILIB): $(addsuffix .o,$(OBJS))
62 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS)
63+
64+$(PCILIB_DEV): $(PCILIB)
65+ ln -s $< $@
66 endif
67
68 $(PCILIBPC): libpci.pc.in
69diff --git a/lib/configure b/lib/configure
70index 27388bc..6c508cf 100755
71--- a/lib/configure
72+++ b/lib/configure
73@@ -216,16 +216,18 @@ fi
74 echo "Checking whether to build a shared library... $SHARED (set manually)"
75 if [ "$SHARED" = no ] ; then
76 echo >>$m 'PCILIB=$(LIBNAME).a'
77+ echo >>$m 'PCILIB_DEV=$(LIBNAME).a'
78 echo >>$m 'LDLIBS=$(WITH_LIBS)'
79 echo >>$m 'LIB_LDLIBS='
80 else
81 echo >>$m 'PCILIB=$(LIBNAME).so.$(VERSION)'
82+ echo >>$m 'PCILIB_DEV=$(LIBNAME).so'
83 # We link the dependencies _to_ the library, so we do not need explicit deps in .pc
84 echo >>$m 'LDLIBS='
85 echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
86 echo >>$c '#define PCI_SHARED_LIB'
87 if [ "$SHARED" = yes ] ; then
88- echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
89+ echo >>$m 'SONAME=-Wl,-soname -Wl,$(LIBNAME).so$(ABI_VERSION)'
90 fi
91 fi
92 echo >>$m 'PCILIBPC=$(LIBNAME).pc'
diff --git a/meta/recipes-bsp/pciutils/pciutils/makefile.patch b/meta/recipes-bsp/pciutils/pciutils/makefile.patch
new file mode 100644
index 0000000000..c3fbc6f9b1
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils/makefile.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Inappropriate [configuration]
2
3Signed-off-by: Ionut Radu <ionutx.radu@intel.com>
4
5Index: pciutils-3.2.0/Makefile
6===================================================================
7--- pciutils-3.2.0.orig/Makefile
8+++ pciutils-3.2.0/Makefile
9@@ -35,7 +35,7 @@ SHAREDIR=$(PREFIX)/share
10 IDSDIR=$(SHAREDIR)
11 MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
12 INCDIR=$(PREFIX)/include
13-LIBDIR=$(PREFIX)/lib
14+LIBDIR=$(libdir)
15 PKGCFDIR=$(LIBDIR)/pkgconfig
16
17 # Commands
18@@ -94,7 +94,7 @@ example: example.o lib/$(PCILIB_DEV)
19 example.o: example.c $(PCIINC)
20
21 %: %.o
22- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@
23+ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) $(LDLIBS) -o $@
24
25 %.8 %.7: %.man
26 M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@IDSDIR@#$(IDSDIR)#"
diff --git a/meta/recipes-bsp/pciutils/pciutils_3.2.1.bb b/meta/recipes-bsp/pciutils/pciutils_3.2.1.bb
new file mode 100644
index 0000000000..6e29953210
--- /dev/null
+++ b/meta/recipes-bsp/pciutils/pciutils_3.2.1.bb
@@ -0,0 +1,66 @@
1SUMMARY = "PCI utilities"
2DESCRIPTION = 'The PCI Utilities package contains a library for portable access \
3to PCI bus configuration space and several utilities based on this library.'
4HOMEPAGE = "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml"
5SECTION = "console/utils"
6
7LICENSE = "GPLv2+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
9DEPENDS = "zlib kmod"
10
11SRC_URI = "${KERNELORG_MIRROR}/software/utils/pciutils/pciutils-${PV}.tar.bz2 \
12 file://configure.patch \
13 file://lib-build-fix.patch \
14 file://guess-fix.patch \
15 file://makefile.patch"
16
17SRC_URI[md5sum] = "425b1acad6854cc2bbb06ac8e48e76fc"
18SRC_URI[sha256sum] = "12d52b19042e2fd058af12e7d877bbbce72213cb3a0b5ec7ff0703ac09e3dcde"
19
20inherit multilib_header
21
22PARALLEL_MAKE = ""
23
24PCI_CONF_FLAG = "ZLIB=yes DNS=yes SHARED=yes"
25
26# see configure.patch
27do_configure () {
28 (
29 cd lib && \
30 ${PCI_CONF_FLAG} ./configure ${PV} ${datadir} ${TARGET_OS} ${TARGET_ARCH}
31 )
32}
33
34do_compile_prepend () {
35 # Avoid this error: ln: failed to create symbolic link `libpci.so': File exists
36 rm -f ${S}/lib/libpci.so
37}
38
39export PREFIX = "${prefix}"
40export SBINDIR = "${sbindir}"
41export SHAREDIR = "${datadir}"
42export MANDIR = "${mandir}"
43
44EXTRA_OEMAKE += "${PCI_CONF_FLAG}"
45
46# The configure script breaks if the HOST variable is set
47HOST[unexport] = "1"
48
49do_install () {
50 oe_runmake DESTDIR=${D} install install-lib
51
52 install -d ${D}${bindir}
53 ln -s ../sbin/lspci ${D}${bindir}/lspci
54
55 oe_multilib_header pci/config.h
56}
57
58PACKAGES =+ "${PN}-ids libpci libpci-dev libpci-dbg"
59FILES_${PN}-ids = "${datadir}/pci.ids*"
60FILES_libpci = "${libdir}/libpci.so.*"
61FILES_libpci-dbg = "${libdir}/.debug"
62FILES_libpci-dev = "${libdir}/libpci.a ${libdir}/libpci.la ${libdir}/libpci.so \
63 ${includedir}/pci ${libdir}/pkgconfig"
64SUMMARY_${PN}-ids = "PCI utilities - device ID database"
65DESCRIPTION_${PN}-ids = "Package providing the PCI device ID database for pciutils."
66RDEPENDS_${PN} += "${PN}-ids"
diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch b/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch
new file mode 100644
index 0000000000..7b0ce21194
--- /dev/null
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch
@@ -0,0 +1,101 @@
1Upstream-Status: Inappropriate [configuration]
2
3Hardcoded paths are bad...
4This lets us use the install from OE's native sysroot
5rebase the patch to 018, removing hardcoded path for true
6as well. Removing of -D in install invocation is a little
7questionable, is it some GNU extention?
8
9-Khem Raj <raj.khem@gmail.com>
10
11Index: pcmciautils-018/Makefile
12===================================================================
13--- pcmciautils-018.orig/Makefile
14+++ pcmciautils-018/Makefile
15@@ -76,7 +76,7 @@ sbindir = ${exec_prefix}/sbin
16 mandir = ${prefix}/usr/share/man
17 udevdir = ${prefix}/lib/udev
18
19-INSTALL = /usr/bin/install -c
20+INSTALL = install -c
21 INSTALL_PROGRAM = ${INSTALL}
22 INSTALL_DATA = ${INSTALL} -m 644
23 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
24@@ -180,7 +180,7 @@ endif
25 # if DEBUG is enabled, then we do not strip or optimize
26 ifeq ($(strip $(DEBUG)),true)
27 CFLAGS += -O1 -g -DDEBUG -D_GNU_SOURCE
28- STRIPCMD = /bin/true -Since_we_are_debugging
29+ STRIPCMD = true -Since_we_are_debugging
30 else
31 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE
32 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
33@@ -273,30 +273,32 @@ clean:
34
35 install-hotplug:
36 $(INSTALL) -d $(DESTDIR)$(hotplugdir)
37- $(INSTALL_PROGRAM) -D hotplug/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.agent
38- $(INSTALL_PROGRAM) -D hotplug/pcmcia.rc $(DESTDIR)$(hotplugdir)/pcmcia.rc
39+ $(INSTALL_PROGRAM) hotplug/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.agent
40+ $(INSTALL_PROGRAM) hotplug/pcmcia.rc $(DESTDIR)$(hotplugdir)/pcmcia.rc
41
42 uninstall-hotplug:
43 - rm -f $(DESTDIR)$(hotplugdir)/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.rc
44
45 install-socket-hotplug:
46- $(INSTALL_PROGRAM) -D hotplug/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent
47- $(INSTALL_PROGRAM) -D hotplug/pcmcia_socket.rc $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
48+ $(INSTALL_PROGRAM) hotplug/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent
49+ $(INSTALL_PROGRAM) hotplug/pcmcia_socket.rc $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
50
51 uninstall-socket-hotplug:
52 - rm -f $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
53
54 install-socket-tools:
55- $(INSTALL_PROGRAM) -D $(PCMCIA_SOCKET_STARTUP) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
56+ $(INSTALL) -d $(DESTDIR)$(udevhelperdir)
57+ $(INSTALL_PROGRAM) $(PCMCIA_SOCKET_STARTUP) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
58
59 uninstall-socket-tools:
60 - rm -f $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
61
62 install-tools:
63 $(INSTALL) -d $(DESTDIR)$(sbindir)
64- $(INSTALL_PROGRAM) -D $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(PCCARDCTL)
65+ $(INSTALL) -d $(DESTDIR)$(udevhelperdir)
66+ $(INSTALL_PROGRAM) $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(PCCARDCTL)
67 $(SYMLINK) $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(LSPCMCIA)
68- $(INSTALL_PROGRAM) -D $(PCMCIA_CHECK_BROKEN_CIS) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_CHECK_BROKEN_CIS)
69+ $(INSTALL_PROGRAM) $(PCMCIA_CHECK_BROKEN_CIS) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_CHECK_BROKEN_CIS)
70
71 uninstall-tools:
72 - rm -f $(DESTDIR)$(sbindir)/$(PCCARDCTL)
73@@ -305,22 +307,24 @@ uninstall-tools:
74
75 install-config:
76 $(INSTALL) -d $(DESTDIR)$(pcmciaconfdir)
77- $(INSTALL_DATA) -D config/config.opts $(DESTDIR)$(pcmciaconfdir)/config.opts
78+ $(INSTALL_DATA) config/config.opts $(DESTDIR)$(pcmciaconfdir)/config.opts
79 if [ -f config/config.opts.$(ARCH) ]; then \
80- $(INSTALL_DATA) -D config/config.opts.$(ARCH) $(DESTDIR)$(pcmciaconfdir)/config.opts; \
81+ $(INSTALL_DATA) config/config.opts.$(ARCH) $(DESTDIR)$(pcmciaconfdir)/config.opts; \
82 fi
83
84 uninstall-config:
85 # - rm -f $(DESTDIR)$(pcmciaconfdir)/config.opts
86
87 install-udev:
88- $(INSTALL_DATA) -D $(UDEV_RULES_FILE) $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
89+ $(INSTALL) -d $(DESTDIR)$(udevrulesdir)
90+ $(INSTALL_DATA) $(UDEV_RULES_FILE) $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
91
92 uninstall-udev:
93 - rm -f $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
94
95 install-man:
96- $(INSTALL_DATA) -D man/man8/pccardctl.8 $(DESTDIR)$(mandir)/man8/pccardctl.8
97+ $(INSTALL) -d $(DESTDIR)$(mandir)/man8
98+ $(INSTALL_DATA) man/man8/pccardctl.8 $(DESTDIR)$(mandir)/man8/pccardctl.8
99 $(SYMLINK) pccardctl.8 $(DESTDIR)$(mandir)/man8/lspcmcia.8
100
101 uninstall-man:
diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils.inc b/meta/recipes-bsp/pcmciautils/pcmciautils.inc
new file mode 100644
index 0000000000..eafe82045c
--- /dev/null
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils.inc
@@ -0,0 +1,33 @@
1SUMMARY = "Linux kernel userland utilities for the PCMCIA subsystem"
2HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html"
3SECTION = "kernel/userland"
4
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
7
8DEPENDS = "udev sysfsutils flex-native"
9RDEPENDS_${PN} = "udev module-init-tools"
10
11SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/pcmcia/pcmciautils-${PV}.tar.bz2"
12
13S = "${WORKDIR}/pcmciautils-${PV}"
14
15export HOSTCC = "${BUILD_CC}"
16export etcdir = "${sysconfdir}"
17export sbindir = "${base_sbindir}"
18export pcmciaconfdir = "${sysconfdir}/pcmcia"
19export udevdir = "`pkg-config --variable=udevdir udev`"
20export udevrulesdir = "`pkg-config --variable=udevdir udev`/rules.d"
21export UDEV = "1"
22LD = "${CC}"
23CFLAGS =+ "-I${S}/src"
24CFLAGS =+ "-DPCMCIAUTILS_VERSION=\\"${PV}\\""
25
26PARALLEL_MAKE = ""
27EXTRA_OEMAKE = "-e 'STRIP=echo' 'LIB_OBJS=-lc -lsysfs' 'LEX=flex'"
28
29do_install () {
30 oe_runmake 'DESTDIR=${D}' install
31}
32
33CONFFILES_${PN} += "${sysconfdir}/pcmcia/config.opts"
diff --git a/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb b/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
new file mode 100644
index 0000000000..50629b4b14
--- /dev/null
+++ b/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
@@ -0,0 +1,11 @@
1require pcmciautils.inc
2
3SRC_URI += "file://makefile_fix.patch"
4
5SRC_URI[md5sum] = "5d85669b3440baa4532363da6caaf1b4"
6SRC_URI[sha256sum] = "79e6ae441278e178c07501d492394ed2c0326fdb66894f6d040ec811b0dc8ed5"
7
8PR = "r1"
9
10FILES_${PN}-dbg += "*/udev/.debug"
11FILES_${PN} += "*/udev"
diff --git a/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb b/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb
new file mode 100644
index 0000000000..8d35187d63
--- /dev/null
+++ b/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb
@@ -0,0 +1,26 @@
1SECTION = "base"
2SUMMARY = "Utilities and scripts for power management"
3DESCRIPTION = "Simple shell command line tools to suspend and hibernate."
4HOMEPAGE = "http://pm-utils.freedesktop.org/wiki/"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
7 file://src/pm-pmu.c;beginline=1;endline=22;md5=3c1ddbc54e735fb4a0386e14c78a3147"
8
9PR = "r1"
10
11SRC_URI = "http://pm-utils.freedesktop.org/releases/pm-utils-${PV}.tar.gz"
12
13SRC_URI[md5sum] = "1742a556089c36c3a89eb1b957da5a60"
14SRC_URI[sha256sum] = "8ed899032866d88b2933a1d34cc75e8ae42dcde20e1cc21836baaae3d4370c0b"
15
16inherit pkgconfig autotools
17
18RDEPENDS_${PN} = "grep bash"
19
20do_configure_prepend () {
21 ( cd ${S}; autoreconf -f -i -s )
22}
23
24FILES_${PN} += "${libdir}/${BPN}/*"
25FILES_${PN}-dbg += "${libdir}/${BPN}/bin/.debug \
26 ${datadir}/doc/pm-utils/README.debugging"
diff --git a/meta/recipes-bsp/pointercal/pointercal/COPYING b/meta/recipes-bsp/pointercal/pointercal/COPYING
new file mode 100644
index 0000000000..63f5293810
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/COPYING
@@ -0,0 +1,2 @@
1This is a blank COPYING file, and should be filled in by original author in future.
2
diff --git a/meta/recipes-bsp/pointercal/pointercal/pointercal b/meta/recipes-bsp/pointercal/pointercal/pointercal
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/pointercal
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal
new file mode 100644
index 0000000000..abd84ca4b5
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal
@@ -0,0 +1 @@
8313 4 -8526 7 8334 -82604 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal
new file mode 100644
index 0000000000..abd84ca4b5
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal
@@ -0,0 +1 @@
8313 4 -8526 7 8334 -82604 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal
new file mode 100644
index 0000000000..abd84ca4b5
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal
@@ -0,0 +1 @@
8313 4 -8526 7 8334 -82604 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal
new file mode 100644
index 0000000000..abd84ca4b5
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal
@@ -0,0 +1 @@
8313 4 -8526 7 8334 -82604 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal
new file mode 100644
index 0000000000..c2d6e37bf0
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal
Binary files differ
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal
new file mode 100644
index 0000000000..640053d393
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal
@@ -0,0 +1 @@
1280 0 1002 0 960 328 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal b/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal
new file mode 100644
index 0000000000..640053d393
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal
@@ -0,0 +1 @@
1280 0 1002 0 960 328 65536
diff --git a/meta/recipes-bsp/pointercal/pointercal_0.0.bb b/meta/recipes-bsp/pointercal/pointercal_0.0.bb
new file mode 100644
index 0000000000..df735a59f2
--- /dev/null
+++ b/meta/recipes-bsp/pointercal/pointercal_0.0.bb
@@ -0,0 +1,22 @@
1SUMMARY = "Touchscreen calibration data"
2SECTION = "base"
3PR = "r11"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://COPYING;md5=4b5fcfc87fb615860d398b5e38685edf"
6
7SRC_URI = "file://pointercal \
8 file://COPYING"
9
10S = "${WORKDIR}"
11
12do_install() {
13 # Only install file if it has a contents
14 if [ -s ${S}/pointercal ]; then
15 install -d ${D}${sysconfdir}/
16 install -m 0644 ${S}/pointercal ${D}${sysconfdir}/
17 fi
18}
19
20ALLOW_EMPTY_${PN} = "1"
21PACKAGE_ARCH = "${MACHINE_ARCH}"
22INHIBIT_DEFAULT_DEPS = "1"
diff --git a/meta/recipes-bsp/setserial/setserial/add_stdlib.patch b/meta/recipes-bsp/setserial/setserial/add_stdlib.patch
new file mode 100644
index 0000000000..e34f262a89
--- /dev/null
+++ b/meta/recipes-bsp/setserial/setserial/add_stdlib.patch
@@ -0,0 +1,18 @@
1# This patch addes stdlib.h to fix compiler warnings due to the exit
2# built-in not being defined and getting an incorrect implicit definition
3
4Upstream-Status: Pending
5
6Created-by: Saul Wold <saul.wold@intel.com>
7
8--- setserial-2.17/setserial.c 2010-09-02 14:11:27.569763088 -0700
9+++ setserial-2.17_fixed/setserial.c 2010-09-02 14:11:08.546264139 -0700
10@@ -11,6 +11,7 @@
11 */
12
13 #include <stdio.h>
14+#include <stdlib.h>
15 #include <fcntl.h>
16 #include <termios.h>
17 #include <string.h>
18
diff --git a/meta/recipes-bsp/setserial/setserial/ldflags.patch b/meta/recipes-bsp/setserial/setserial/ldflags.patch
new file mode 100644
index 0000000000..4313d2c797
--- /dev/null
+++ b/meta/recipes-bsp/setserial/setserial/ldflags.patch
@@ -0,0 +1,24 @@
1Obey LDFLAGS
2
3Signed-off-by: Christopher Larson <chris_larson@mentor.com>
4Upstream-status: Pending
5
6--- setserial-2.17.orig/Makefile.in
7+++ setserial-2.17/Makefile.in
8@@ -13,6 +13,7 @@ STRIP = @STRIP@
9 CC = @CC@
10 RM = rm -f
11 CFLAGS = @CFLAGS@
12+LDFLAGS = @LDFLAGS@
13 DEFS = @DEFS@
14 INCS = -I.
15 TAR = tar
16@@ -20,7 +21,7 @@ TAR = tar
17 all: setserial setserial.cat
18
19 setserial: setserial.c
20- $(CC) $(CFLAGS) $(DEFS) $(INCS) setserial.c -o setserial
21+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) $(INCS) setserial.c -o setserial
22
23 setserial.cat: setserial.8
24 nroff -man setserial.8 > setserial.cat
diff --git a/meta/recipes-bsp/setserial/setserial_2.17.bb b/meta/recipes-bsp/setserial/setserial_2.17.bb
new file mode 100644
index 0000000000..8dbddd7dc5
--- /dev/null
+++ b/meta/recipes-bsp/setserial/setserial_2.17.bb
@@ -0,0 +1,29 @@
1SUMMARY = "Controls the configuration of serial ports"
2DESCRIPTION = "setserial is a program designed to set and/or report the configuration information associated with a serial port"
3HOMEPAGE = "http://setserial.sourceforge.net"
4AUTHOR = "Theodore Ts'o <tytso@mit.edu>"
5SECTION = "console/utils"
6
7LICENSE = "GPLv2.0"
8LIC_FILES_CHKSUM = "file://version.h;beginline=1;endline=6;md5=2e7c59cb9e57e356ae81f50f4e4dfd99"
9PR = "r3"
10
11DEPENDS += "groff-native"
12
13inherit autotools-brokensep
14
15SRC_URI = "${SOURCEFORGE_MIRROR}/setserial/${BPN}-${PV}.tar.gz \
16 file://add_stdlib.patch \
17 file://ldflags.patch \
18 "
19
20SRC_URI[md5sum] = "c4867d72c41564318e0107745eb7a0f2"
21SRC_URI[sha256sum] = "7e4487d320ac31558563424189435d396ddf77953bb23111a17a3d1487b5794a"
22
23do_install() {
24 install -d ${D}${bindir}
25 install -d ${D}${mandir}/man8
26
27 install -m 0755 ${S}/setserial ${D}${bindir}
28 install -m 0644 ${S}/setserial.8 ${D}${mandir}/man8
29}
diff --git a/meta/recipes-bsp/u-boot/files/0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch b/meta/recipes-bsp/u-boot/files/0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch
new file mode 100644
index 0000000000..77e35bbc7c
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch
@@ -0,0 +1,74 @@
1From 5701384cea4a829b772bf7a96a74825b58c22385 Mon Sep 17 00:00:00 2001
2From: Denys Dmytriyenko <denys@ti.com>
3Date: Thu, 17 Apr 2014 12:25:40 -0400
4Subject: [PATCH] am335x_evm.h: Add, use DEFAULT_LINUX_BOOT_ENV environment
5 string
6
7Modified version of the patch currently being reviewed for mainline:
8http://patchwork.ozlabs.org/patch/334861/
9
10To deal with a reoccurring problem properly we need to specify addresses
11for the Linux kernel, Flatted Device Tree and ramdisk that obey the
12constraints within the kernel's Documentation/arm/Booting file but also
13make sure that we relocate things within a valid address range.
14
15Signed-off-by: Denys Dmytriyenko <denys@ti.com>
16Signed-off-by: Tom Rini <trini@ti.com>
17
18Upstream-Status: Pending
19---
20 include/configs/am335x_evm.h | 31 ++++++++++++++++++++++++++-----
21 1 file changed, 26 insertions(+), 5 deletions(-)
22
23diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
24index c5a6d4b..01e32b3 100644
25--- a/include/configs/am335x_evm.h
26+++ b/include/configs/am335x_evm.h
27@@ -54,10 +54,7 @@
28 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
29 #ifndef CONFIG_SPL_BUILD
30 #define CONFIG_EXTRA_ENV_SETTINGS \
31- "loadaddr=0x80200000\0" \
32- "fdtaddr=0x80F80000\0" \
33- "fdt_high=0xffffffff\0" \
34- "rdaddr=0x81000000\0" \
35+ DEFAULT_LINUX_BOOT_ENV \
36 "bootdir=/boot\0" \
37 "bootfile=uImage\0" \
38 "fdtfile=undefined\0" \
39@@ -197,7 +194,31 @@
40 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START \
41 + (8 * 1024 * 1024))
42
43-#define CONFIG_SYS_LOAD_ADDR 0x81000000 /* Default load address */
44+/*
45+ * Our DDR memory always starts at 0x80000000 and U-Boot shall have
46+ * relocated itself to higher in memory by the time this value is used.
47+ * However, set this to a 32MB offset to allow for easier Linux kernel
48+ * booting as the default is often used as the kernel load address.
49+ */
50+#define CONFIG_SYS_LOAD_ADDR 0x82000000 /* Default load address */
51+
52+/*
53+ * We setup defaults based on constraints from the Linux kernel, which should
54+ * also be safe elsewhere. We have the default load at 32MB into DDR (for
55+ * the kernel), FDT above 128MB (the maximum location for the end of the
56+ * kernel), and the ramdisk 512KB above that (allowing for hopefully never
57+ * seen large trees). We say all of this must be within the first 256MB
58+ * as that will normally be within the kernel lowmem and thus visible via
59+ * bootm_size and we only run on platforms with 256MB or more of memory.
60+ */
61+#define DEFAULT_LINUX_BOOT_ENV \
62+ "loadaddr=0x82000000\0" \
63+ "kernel_addr_r=0x82000000\0" \
64+ "fdtaddr=0x88000000\0" \
65+ "fdt_addr_r=0x88000000\0" \
66+ "rdaddr=0x88080000\0" \
67+ "ramdisk_addr_r=0x88080000\0" \
68+ "bootm_size=0x10000000\0"
69
70 #define CONFIG_MMC
71 #define CONFIG_GENERIC_MMC
72--
731.9.2
74
diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb b/meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb
new file mode 100644
index 0000000000..d686b33621
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb
@@ -0,0 +1,38 @@
1SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"
4SECTION = "bootloader"
5DEPENDS = "mtd-utils"
6
7# This revision corresponds to the tag "v2013.07"
8# We use the revision in order to avoid having to fetch it from the
9# repo during parse
10SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
11
12PV = "v2013.07+git${SRCPV}"
13
14SRC_URI = "git://git.denx.de/u-boot.git;branch=master;protocol=git"
15
16S = "${WORKDIR}/git"
17
18inherit uboot-config cross
19
20EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"'
21
22do_compile () {
23 oe_runmake ${UBOOT_MACHINE}
24 oe_runmake env
25}
26
27do_install () {
28 install -d ${D}${bindir_cross}
29 install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
30 install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
31}
32
33SYSROOT_PREPROCESS_FUNCS = "uboot_fw_utils_cross"
34uboot_fw_utils_cross() {
35 sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
36}
37
38PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
new file mode 100644
index 0000000000..8bab432a76
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb
@@ -0,0 +1,35 @@
1SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"
4SECTION = "bootloader"
5DEPENDS = "mtd-utils"
6
7# This revision corresponds to the tag "v2013.07"
8# We use the revision in order to avoid having to fetch it from the
9# repo during parse
10SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
11
12PV = "v2013.07+git${SRCPV}"
13
14SRC_URI = "git://git.denx.de/u-boot.git;branch=master;protocol=git"
15
16S = "${WORKDIR}/git"
17
18EXTRA_OEMAKE = 'HOSTCC="${CC}" HOSTSTRIP="true"'
19
20inherit uboot-config
21
22do_compile () {
23 oe_runmake ${UBOOT_MACHINE}
24 oe_runmake env
25}
26
27do_install () {
28 install -d ${D}${base_sbindir}
29 install -d ${D}${sysconfdir}
30 install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
31 install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
32 install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
33}
34
35PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-bsp/u-boot/u-boot-mkimage_2013.07.bb b/meta/recipes-bsp/u-boot/u-boot-mkimage_2013.07.bb
new file mode 100644
index 0000000000..3173b0ac73
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot-mkimage_2013.07.bb
@@ -0,0 +1,32 @@
1SUMMARY = "U-Boot bootloader image creation tool"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb"
4SECTION = "bootloader"
5
6# This revision corresponds to the tag "v2013.07"
7# We use the revision in order to avoid having to fetch it from the
8# repo during parse
9SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
10
11PV = "v2013.07+git${SRCPV}"
12
13SRC_URI = "git://git.denx.de/u-boot.git;branch=master;protocol=git"
14
15S = "${WORKDIR}/git"
16
17EXTRA_OEMAKE = 'HOSTCC="${CC}" HOSTLD="${LD}" HOSTLDFLAGS="${LDFLAGS}" HOSTSTRIP=true'
18
19do_compile () {
20 # Make sure the recompile is OK
21 rm -f ${B}/tools/.depend
22
23 oe_runmake tools
24}
25
26do_install () {
27 install -d ${D}${bindir}
28 install -m 0755 tools/mkimage ${D}${bindir}/uboot-mkimage
29 ln -sf uboot-mkimage ${D}${bindir}/mkimage
30}
31
32BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc
new file mode 100644
index 0000000000..602b71f39d
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -0,0 +1,122 @@
1SUMMARY = "Universal Boot Loader for embedded devices"
2HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
3SECTION = "bootloaders"
4PROVIDES = "virtual/bootloader"
5
6LICENSE = "GPLv2+"
7LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb \
8 file://README;beginline=1;endline=22;md5=78b195c11cb6ef63e6985140db7d7bab"
9
10SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
11
12S = "${WORKDIR}/git"
13
14PACKAGE_ARCH = "${MACHINE_ARCH}"
15
16inherit uboot-config deploy
17
18EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"'
19
20# Allow setting an additional version string that will be picked up by the
21# u-boot build system and appended to the u-boot version. If the .scmversion
22# file already exists it will not be overwritten.
23UBOOT_LOCALVERSION ?= ""
24
25# Some versions of u-boot use .bin and others use .img. By default use .bin
26# but enable individual recipes to change this value.
27UBOOT_SUFFIX ?= "bin"
28UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
29UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
30UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
31UBOOT_MAKE_TARGET ?= "all"
32
33# Some versions of u-boot build an SPL (Second Program Loader) image that
34# should be packaged along with the u-boot binary as well as placed in the
35# deploy directory. For those versions they can set the following variables
36# to allow packaging the SPL.
37SPL_BINARY ?= ""
38SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}"
39SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}"
40
41# Additional environment variables or a script can be installed alongside
42# u-boot to be used automatically on boot. This file, typically 'uEnv.txt'
43# or 'boot.scr', should be packaged along with u-boot as well as placed in the
44# deploy directory. Machine configurations needing one of these files should
45# include it in the SRC_URI and set the UBOOT_ENV parameter.
46UBOOT_ENV_SUFFIX ?= "txt"
47UBOOT_ENV ?= ""
48UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
49UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
50UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
51
52do_compile () {
53 if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
54 sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
55 fi
56
57 unset LDFLAGS
58 unset CFLAGS
59 unset CPPFLAGS
60
61 if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
62 then
63 echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
64 echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
65 fi
66
67 oe_runmake ${UBOOT_MACHINE}
68 oe_runmake ${UBOOT_MAKE_TARGET}
69}
70
71do_install () {
72 install -d ${D}/boot
73 install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
74 ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
75
76 if [ -e ${WORKDIR}/fw_env.config ] ; then
77 install -d ${D}${sysconfdir}
78 install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
79 fi
80
81 if [ "x${SPL_BINARY}" != "x" ]
82 then
83 install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
84 ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARY}
85 fi
86
87 if [ "x${UBOOT_ENV}" != "x" ]
88 then
89 install ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
90 ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
91 fi
92}
93
94FILES_${PN} = "/boot ${sysconfdir}"
95
96do_deploy () {
97 install -d ${DEPLOYDIR}
98 install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
99
100 cd ${DEPLOYDIR}
101 rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
102 ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
103 ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
104
105 if [ "x${SPL_BINARY}" != "x" ]
106 then
107 install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
108 rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK}
109 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY}
110 ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
111 fi
112
113 if [ "x${UBOOT_ENV}" != "x" ]
114 then
115 install ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
116 rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
117 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
118 ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
119 fi
120}
121
122addtask deploy before do_build after do_compile
diff --git a/meta/recipes-bsp/u-boot/u-boot_2013.07.bb b/meta/recipes-bsp/u-boot/u-boot_2013.07.bb
new file mode 100644
index 0000000000..f07fd7c567
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/u-boot_2013.07.bb
@@ -0,0 +1,9 @@
1require u-boot.inc
2
3# This revision corresponds to the tag "v2013.07"
4# We use the revision in order to avoid having to fetch it from the repo during parse
5SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c"
6
7PV = "v2013.07+git${SRCPV}"
8
9SRC_URI += "file://0001-am335x_evm.h-Add-use-DEFAULT_LINUX_BOOT_ENV-environm.patch"
diff --git a/meta/recipes-bsp/usbinit/usbinit.bb b/meta/recipes-bsp/usbinit/usbinit.bb
new file mode 100644
index 0000000000..aba44b4068
--- /dev/null
+++ b/meta/recipes-bsp/usbinit/usbinit.bb
@@ -0,0 +1,21 @@
1SUMMARY = "Initscript for enabling USB gadget Ethernet"
2
3LICENSE = "GPLv2"
4LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe"
5
6PR = "r3"
7
8SRC_URI = "file://usb-gether \
9 file://COPYING.GPL"
10S = "${WORKDIR}"
11
12do_install() {
13 install -d ${D}${sysconfdir}
14 install -d ${D}${sysconfdir}/init.d
15 install usb-gether ${D}${sysconfdir}/init.d
16}
17
18inherit update-rc.d allarch
19
20INITSCRIPT_NAME = "usb-gether"
21INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
diff --git a/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL b/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL
new file mode 100644
index 0000000000..d511905c16
--- /dev/null
+++ b/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL
@@ -0,0 +1,339 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Lesser General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License along
307 with this program; if not, write to the Free Software Foundation, Inc.,
308 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
310Also add information on how to contact you by electronic and paper mail.
311
312If the program is interactive, make it output a short notice like this
313when it starts in an interactive mode:
314
315 Gnomovision version 69, Copyright (C) year name of author
316 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 This is free software, and you are welcome to redistribute it
318 under certain conditions; type `show c' for details.
319
320The hypothetical commands `show w' and `show c' should show the appropriate
321parts of the General Public License. Of course, the commands you use may
322be called something other than `show w' and `show c'; they could even be
323mouse-clicks or menu items--whatever suits your program.
324
325You should also get your employer (if you work as a programmer) or your
326school, if any, to sign a "copyright disclaimer" for the program, if
327necessary. Here is a sample; alter the names:
328
329 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
332 <signature of Ty Coon>, 1 April 1989
333 Ty Coon, President of Vice
334
335This General Public License does not permit incorporating your program into
336proprietary programs. If your program is a subroutine library, you may
337consider it more useful to permit linking proprietary applications with the
338library. If this is what you want to do, use the GNU Lesser General
339Public License instead of this License.
diff --git a/meta/recipes-bsp/usbinit/usbinit/usb-gether b/meta/recipes-bsp/usbinit/usbinit/usb-gether
new file mode 100755
index 0000000000..e80a0bb30e
--- /dev/null
+++ b/meta/recipes-bsp/usbinit/usbinit/usb-gether
@@ -0,0 +1,23 @@
1#! /bin/sh
2#
3# usb-ether Start up the gadget usb ethernet interface.
4#
5
6case "$1" in
7 start|"")
8 test "$VERBOSE" != no && echo "Initializing g_ether gadget..."
9 modprobe g_ether
10 ifup usb0
11 ;;
12 stop)
13 test "$VERBOSE" != no && echo "Disabling g_ether..."
14 ifdown usb0
15 rmmod g_ether
16 ;;
17 *)
18 echo "Usage: usb-ether {start|stop}" >&2
19 exit 1
20 ;;
21esac
22
23exit 0
diff --git a/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch b/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch
new file mode 100644
index 0000000000..0efdc59fc6
--- /dev/null
+++ b/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch
@@ -0,0 +1,28 @@
1Fix NULL pointer crash.
2
3Before use usbbuslist, we should check if it is valid.
4
5Upstream-Status: Pending
6Signed-off-by: Roy.Li <rongqing.li@windriver.com>
7---
8 lsusb-t.c | 4 ++++
9 1 files changed, 4 insertions(+), 0 deletions(-)
10
11diff --git a/lsusb-t.c b/lsusb-t.c
12index f604155..583a46a 100644
13--- a/lsusb-t.c
14+++ b/lsusb-t.c
15@@ -643,6 +643,10 @@ static void sort_busses(void)
16 /* need to reverse sort bus numbers */
17 struct usbbusnode *t, *p, **pp;
18 int swapped;
19+
20+ if (!usbbuslist)
21+ return;
22+
23 do {
24 p = usbbuslist;
25 pp = &usbbuslist;
26--
271.7.4.1
28
diff --git a/meta/recipes-bsp/usbutils/usbutils/iconv.patch b/meta/recipes-bsp/usbutils/usbutils/iconv.patch
new file mode 100644
index 0000000000..c557334a75
--- /dev/null
+++ b/meta/recipes-bsp/usbutils/usbutils/iconv.patch
@@ -0,0 +1,40 @@
1This patch adds support for detecting iconv support using autotools
2uclibc does not have iconv implementation inside libc like glibc, therefore
3the existing checks were not sufficient, it worked for glibc but not for
4uclibc. The new patch portably detects the iconv support and adds the
5libiconv to linker cmdline
6
7This patch should be submitted upstream too
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Index: usbutils-007/configure.ac
14===================================================================
15--- usbutils-007.orig/configure.ac
16+++ usbutils-007/configure.ac
17@@ -10,7 +10,9 @@ AC_USE_SYSTEM_EXTENSIONS
18 AC_SYS_LARGEFILE
19
20 AC_CHECK_HEADERS([byteswap.h])
21-AC_CHECK_FUNCS([nl_langinfo iconv])
22+
23+AM_GNU_GETTEXT
24+AM_ICONV
25
26 AC_ARG_ENABLE(zlib,
27 AS_HELP_STRING(--disable-zlib,disable support for zlib))
28Index: usbutils-007/Makefile.am
29===================================================================
30--- usbutils-007.orig/Makefile.am
31+++ usbutils-007/Makefile.am
32@@ -27,7 +27,7 @@ lsusb_CPPFLAGS = \
33 -DDATADIR=\"$(datadir)\"
34
35 lsusb_LDADD = \
36- $(LIBUSB_LIBS)
37+ $(LIBUSB_LIBS) $(LIBICONV)
38
39 if HAVE_ZLIB
40 lsusb_CPPFLAGS += -DHAVE_LIBZ
diff --git a/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch b/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch
new file mode 100644
index 0000000000..a6b241f854
--- /dev/null
+++ b/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch
@@ -0,0 +1,30 @@
1From 333d5fbbc03481f1aa222bd68c2609db168ae3e0 Mon Sep 17 00:00:00 2001
2From: Paul Eggleton <paul.eggleton@linux.intel.com>
3Date: Thu, 26 Jul 2012 10:37:32 +0100
4Subject: [PATCH] usb-devices: avoid dependency on bash
5
6By virtue of having #!/bin/bash this script declared that it requires
7bash, however manual examination, checkbashisms and tests with dash
8and busybox show that it doesn't contain any bashisms, so change the
9header to avoid the dependency.
10
11Upstream-Status: Pending
12
13Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
14---
15 usb-devices | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/usb-devices b/usb-devices
19index b2052e2..14a5358 100755
20--- a/usb-devices
21+++ b/usb-devices
22@@ -1,4 +1,4 @@
23-#!/bin/bash
24+#!/bin/sh
25
26 # Copyright: 2009 Greg Kroah-Hartman <greg@kroah.com>
27 # 2009 Randy Dunlap <rdunlap@xenotime.net>
28--
291.7.9.5
30
diff --git a/meta/recipes-bsp/usbutils/usbutils_007.bb b/meta/recipes-bsp/usbutils/usbutils_007.bb
new file mode 100644
index 0000000000..b93b2bd9e5
--- /dev/null
+++ b/meta/recipes-bsp/usbutils/usbutils_007.bb
@@ -0,0 +1,31 @@
1SUMMARY = "Host side USB console utilities"
2DESCRIPTION = "Contains the lsusb utility for inspecting the devices connected to the USB bus."
3HOMEPAGE = "http://www.linux-usb.org"
4SECTION = "base"
5
6LICENSE = "GPLv2+"
7LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
8
9DEPENDS = "libusb zlib virtual/libiconv"
10
11SRC_URI = "${KERNELORG_MIRROR}/linux/utils/usb/usbutils/usbutils-${PV}.tar.gz \
12 file://usb-devices-avoid-dependency-on-bash.patch \
13 file://Fix-NULL-pointer-crash.patch \
14 file://iconv.patch \
15 "
16
17SRC_URI[md5sum] = "be6c42294be5c940f208190d3479d50c"
18SRC_URI[sha256sum] = "e65c234cadf7c81b6b1567c440e3b9b31b44f51c27df3e45741b88848d8b37d3"
19
20inherit autotools gettext pkgconfig
21
22do_install_append() {
23 # We only need the compressed copy, remove the uncompressed version
24 rm -f ${D}${datadir}/usb.ids
25}
26
27PACKAGES += "${PN}-ids"
28FILES_${PN}-dev += "${datadir}/pkgconfig"
29FILES_${PN}-ids = "${datadir}/usb*"
30
31RDEPENDS_${PN} = "${PN}-ids"
diff --git a/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch b/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch
new file mode 100644
index 0000000000..a09e2a257e
--- /dev/null
+++ b/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch
@@ -0,0 +1,21766 @@
1From 1a410ae58f28eeab32fa87626cfd5a663ba33c51 Mon Sep 17 00:00:00 2001
2From: Bernhard Walle <bernhard@bwalle.de>
3Date: Tue, 13 May 2014 23:40:56 +0200
4Subject: [PATCH 2/2] Update x86emu from X.org
5
6This commit updates the x86emu copy from X.org tarball
7(ftp://mirror.csclub.uwaterloo.ca/x.org/current/src/xserver/xorg-server-1.12.2.tar.bz2).
8
9This fixes a compatibility issue between v86d and SeaBIOS VGA BIOS where
10the leal instruction is not decoded properly. Read the
11http://thread.gmane.org/gmane.comp.emulators.qemu/271806 thread for more
12details.
13
14Upstream-Status: Backport
15
16Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
17---
18 libs/x86emu/LICENSE | 17 -
19 libs/x86emu/debug.c | 509 +++---
20 libs/x86emu/decode.c | 1069 ++++++------
21 libs/x86emu/fpu.c | 463 +++---
22 libs/x86emu/ops.c | 2940 +++++++++++++++++++--------------
23 libs/x86emu/ops2.c | 1929 +++++++++++-----------
24 libs/x86emu/prim_ops.c | 3219 +++++++++++++++++++------------------
25 libs/x86emu/sys.c | 583 +++----
26 libs/x86emu/validate.c | 52 +-
27 libs/x86emu/x86emu.h | 75 +-
28 libs/x86emu/x86emu/debug.h | 163 +-
29 libs/x86emu/x86emu/decode.h | 57 +-
30 libs/x86emu/x86emu/fpu.h | 23 +-
31 libs/x86emu/x86emu/fpu_regs.h | 44 +-
32 libs/x86emu/x86emu/ops.h | 6 +-
33 libs/x86emu/x86emu/prim_asm.h | 251 ++-
34 libs/x86emu/x86emu/prim_ops.h | 188 +--
35 libs/x86emu/x86emu/prim_x86_gcc.h | 77 +
36 libs/x86emu/x86emu/regs.h | 101 +-
37 libs/x86emu/x86emu/types.h | 50 +-
38 libs/x86emu/x86emu/x86emui.h | 34 +-
39 21 files changed, 6379 insertions(+), 5471 deletions(-)
40 delete mode 100644 libs/x86emu/LICENSE
41 create mode 100644 libs/x86emu/x86emu/prim_x86_gcc.h
42
43diff --git a/libs/x86emu/LICENSE b/libs/x86emu/LICENSE
44deleted file mode 100644
45index a3ede4a..0000000
46--- a/libs/x86emu/LICENSE
47+++ /dev/null
48@@ -1,17 +0,0 @@
49- License information
50- -------------------
51-
52-The x86emu library is under a BSD style license, comaptible
53-with the XFree86 and X licenses used by XFree86. The
54-original x86emu libraries were under the GNU General Public
55-License. Due to license incompatibilities between the GPL
56-and the XFree86 license, the original authors of the code
57-decided to allow a license change. If you have submitted
58-code to the original x86emu project, and you don't agree
59-with the license change, please contact us and let you
60-know. Your code will be removed to comply with your wishes.
61-
62-If you have any questions about this, please send email to
63-x86emu@linuxlabs.com or KendallB@scitechsoft.com for
64-clarification.
65-
66diff --git a/libs/x86emu/debug.c b/libs/x86emu/debug.c
67index 6fd7f11..1a8d1d6 100644
68--- a/libs/x86emu/debug.c
69+++ b/libs/x86emu/debug.c
70@@ -38,6 +38,8 @@
71 ****************************************************************************/
72
73 #include "x86emu/x86emui.h"
74+#include <stdio.h>
75+#include <string.h>
76 #ifndef NO_SYS_HEADERS
77 #include <stdarg.h>
78 #include <stdlib.h>
79@@ -47,46 +49,51 @@
80
81 #ifdef DEBUG
82
83-static void print_encoded_bytes (u16 s, u16 o);
84-static void print_decoded_instruction (void);
85-static int parse_line (char *s, int *ps, int *n);
86-
87+static void print_encoded_bytes(u16 s, u16 o);
88+static void print_decoded_instruction(void);
89+static int parse_line(char *s, int *ps, int *n);
90+
91 /* should look something like debug's output. */
92-void X86EMU_trace_regs (void)
93+void
94+X86EMU_trace_regs(void)
95 {
96- if (DEBUG_TRACE()) {
97- x86emu_dump_regs();
98+ if (DEBUG_TRACE()) {
99+ x86emu_dump_regs();
100 }
101- if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
102- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
103- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
104- print_decoded_instruction();
105+ if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) {
106+ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
107+ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
108+ print_decoded_instruction();
109 }
110 }
111
112-void X86EMU_trace_xregs (void)
113+void
114+X86EMU_trace_xregs(void)
115 {
116- if (DEBUG_TRACE()) {
117- x86emu_dump_xregs();
118+ if (DEBUG_TRACE()) {
119+ x86emu_dump_xregs();
120 }
121 }
122
123-void x86emu_just_disassemble (void)
124+void
125+x86emu_just_disassemble(void)
126 {
127 /*
128 * This routine called if the flag DEBUG_DISASSEMBLE is set kind
129 * of a hack!
130 */
131- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
132- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
133- print_decoded_instruction();
134+ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
135+ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
136+ print_decoded_instruction();
137 }
138
139-static void disassemble_forward (u16 seg, u16 off, int n)
140+static void
141+disassemble_forward(u16 seg, u16 off, int n)
142 {
143- X86EMU_sysEnv tregs;
144- int i;
145- u8 op1;
146+ X86EMU_sysEnv tregs;
147+ int i;
148+ u8 op1;
149+
150 /*
151 * hack, hack, hack. What we do is use the exact machinery set up
152 * for execution, except that now there is an additional state
153@@ -111,17 +118,17 @@ static void disassemble_forward (u16 seg, u16 off, int n)
154 * This was done for an entirely different reason, but makes a
155 * nice way to get the system to help debug codes.
156 */
157- tregs = M;
158+ tregs = M;
159 tregs.x86.R_IP = off;
160 tregs.x86.R_CS = seg;
161-
162+
163 /* reset the decoding buffers */
164 tregs.x86.enc_str_pos = 0;
165 tregs.x86.enc_pos = 0;
166-
167+
168 /* turn on the "disassemble only, no execute" flag */
169 tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
170-
171+
172 /* DUMP NEXT n instructions to screen in straight_line fashion */
173 /*
174 * This looks like the regular instruction fetch stream, except
175@@ -130,299 +137,359 @@ static void disassemble_forward (u16 seg, u16 off, int n)
176 * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
177 * Note the use of a copy of the register structure...
178 */
179- for (i=0; i<n; i++) {
180- op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
181- (x86emu_optab[op1])(op1);
182+ for (i = 0; i < n; i++) {
183+ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
184+ (x86emu_optab[op1]) (op1);
185 }
186 /* end major hack mode. */
187 }
188
189-void x86emu_check_ip_access (void)
190+void
191+x86emu_check_ip_access(void)
192 {
193 /* NULL as of now */
194 }
195
196-void x86emu_check_sp_access (void)
197+void
198+x86emu_check_sp_access(void)
199 {
200 }
201
202-void x86emu_check_mem_access (u32 dummy)
203+void
204+x86emu_check_mem_access(u32 dummy)
205 {
206- /* check bounds, etc */
207+ /* check bounds, etc */
208 }
209
210-void x86emu_check_data_access (uint dummy1, uint dummy2)
211+void
212+x86emu_check_data_access(uint dummy1, uint dummy2)
213 {
214- /* check bounds, etc */
215+ /* check bounds, etc */
216 }
217
218-void x86emu_inc_decoded_inst_len (int x)
219+void
220+x86emu_inc_decoded_inst_len(int x)
221 {
222- M.x86.enc_pos += x;
223+ M.x86.enc_pos += x;
224 }
225
226-void x86emu_decode_printf (char *x)
227+void
228+x86emu_decode_printf(const char *x)
229 {
230- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
231- M.x86.enc_str_pos += strlen(x);
232+ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", x);
233+ M.x86.enc_str_pos += strlen(x);
234 }
235
236-void x86emu_decode_printf2 (char *x, int y)
237+void
238+x86emu_decode_printf2(const char *x, int y)
239 {
240- char temp[100];
241- sprintf(temp,x,y);
242- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
243- M.x86.enc_str_pos += strlen(temp);
244+ char temp[100];
245+
246+ snprintf(temp, sizeof(temp), x, y);
247+ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp);
248+ M.x86.enc_str_pos += strlen(temp);
249 }
250
251-void x86emu_end_instr (void)
252+void
253+x86emu_end_instr(void)
254 {
255- M.x86.enc_str_pos = 0;
256- M.x86.enc_pos = 0;
257+ M.x86.enc_str_pos = 0;
258+ M.x86.enc_pos = 0;
259 }
260
261-static void print_encoded_bytes (u16 s, u16 o)
262+static void
263+print_encoded_bytes(u16 s, u16 o)
264 {
265 int i;
266 char buf1[64];
267- for (i=0; i< M.x86.enc_pos; i++) {
268- sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
269+
270+ for (i = 0; i < M.x86.enc_pos; i++) {
271+ sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i));
272 }
273- printk("%-20s",buf1);
274+ printk("%-20s", buf1);
275 }
276
277-static void print_decoded_instruction (void)
278+static void
279+print_decoded_instruction(void)
280 {
281- printk("%s", M.x86.decoded_buf);
282+ printk("%s", M.x86.decoded_buf);
283 }
284
285-void x86emu_print_int_vect (u16 iv)
286+void
287+x86emu_print_int_vect(u16 iv)
288 {
289- u16 seg,off;
290+ u16 seg, off;
291
292- if (iv > 256) return;
293- seg = fetch_data_word_abs(0,iv*4);
294- off = fetch_data_word_abs(0,iv*4+2);
295- printk("%04x:%04x ", seg, off);
296+ if (iv > 256)
297+ return;
298+ seg = fetch_data_word_abs(0, iv * 4);
299+ off = fetch_data_word_abs(0, iv * 4 + 2);
300+ printk("%04x:%04x ", seg, off);
301 }
302
303-void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
304+void
305+X86EMU_dump_memory(u16 seg, u16 off, u32 amt)
306 {
307- u32 start = off & 0xfffffff0;
308- u32 end = (off+16) & 0xfffffff0;
309- u32 i;
310- u32 current;
311-
312- current = start;
313- while (end <= off + amt) {
314- printk("%04x:%04x ", seg, start);
315- for (i=start; i< off; i++)
316- printk(" ");
317- for ( ; i< end; i++)
318- printk("%02x ", fetch_data_byte_abs(seg,i));
319- printk("\n");
320- start = end;
321- end = start + 16;
322- }
323+ u32 start = off & 0xfffffff0;
324+ u32 end = (off + 16) & 0xfffffff0;
325+ u32 i;
326+ u32 current;
327+
328+ current = start;
329+ while (end <= off + amt) {
330+ printk("%04x:%04x ", seg, start);
331+ for (i = start; i < off; i++)
332+ printk(" ");
333+ for (; i < end; i++)
334+ printk("%02x ", fetch_data_byte_abs(seg, i));
335+ printk("\n");
336+ start = end;
337+ end = start + 16;
338+ }
339 }
340
341-void x86emu_single_step (void)
342+void
343+x86emu_single_step(void)
344 {
345 char s[1024];
346 int ps[10];
347 int ntok;
348 int cmd;
349 int done;
350- int segment;
351+ int segment;
352 int offset;
353 static int breakpoint;
354 static int noDecode = 1;
355-
356+
357 char *p;
358
359- if (DEBUG_BREAK()) {
360- if (M.x86.saved_ip != breakpoint) {
361- return;
362- } else {
363- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
364- M.x86.debug |= DEBUG_TRACE_F;
365- M.x86.debug &= ~DEBUG_BREAK_F;
366- print_decoded_instruction ();
367- X86EMU_trace_regs();
368- }
369- }
370- done=0;
371- offset = M.x86.saved_ip;
372+ if (DEBUG_BREAK()) {
373+ if (M.x86.saved_ip != breakpoint) {
374+ return;
375+ }
376+ else {
377+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
378+ M.x86.debug |= DEBUG_TRACE_F;
379+ M.x86.debug &= ~DEBUG_BREAK_F;
380+ print_decoded_instruction();
381+ X86EMU_trace_regs();
382+ }
383+ }
384+ done = 0;
385+ offset = M.x86.saved_ip;
386 while (!done) {
387 printk("-");
388 p = fgets(s, 1023, stdin);
389 cmd = parse_line(s, ps, &ntok);
390- switch(cmd) {
391- case 'u':
392- disassemble_forward(M.x86.saved_cs,(u16)offset,10);
393+ switch (cmd) {
394+ case 'u':
395+ disassemble_forward(M.x86.saved_cs, (u16) offset, 10);
396 break;
397- case 'd':
398- if (ntok == 2) {
399- segment = M.x86.saved_cs;
400- offset = ps[1];
401- X86EMU_dump_memory(segment,(u16)offset,16);
402- offset += 16;
403- } else if (ntok == 3) {
404- segment = ps[1];
405- offset = ps[2];
406- X86EMU_dump_memory(segment,(u16)offset,16);
407- offset += 16;
408- } else {
409- segment = M.x86.saved_cs;
410- X86EMU_dump_memory(segment,(u16)offset,16);
411- offset += 16;
412- }
413+ case 'd':
414+ if (ntok == 2) {
415+ segment = M.x86.saved_cs;
416+ offset = ps[1];
417+ X86EMU_dump_memory(segment, (u16) offset, 16);
418+ offset += 16;
419+ }
420+ else if (ntok == 3) {
421+ segment = ps[1];
422+ offset = ps[2];
423+ X86EMU_dump_memory(segment, (u16) offset, 16);
424+ offset += 16;
425+ }
426+ else {
427+ segment = M.x86.saved_cs;
428+ X86EMU_dump_memory(segment, (u16) offset, 16);
429+ offset += 16;
430+ }
431 break;
432- case 'c':
433- M.x86.debug ^= DEBUG_TRACECALL_F;
434+ case 'c':
435+ M.x86.debug ^= DEBUG_TRACECALL_F;
436 break;
437- case 's':
438- M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
439+ case 's':
440+ M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
441 break;
442- case 'r':
443- X86EMU_trace_regs();
444+ case 'r':
445+ X86EMU_trace_regs();
446 break;
447- case 'x':
448- X86EMU_trace_xregs();
449+ case 'x':
450+ X86EMU_trace_xregs();
451 break;
452- case 'g':
453+ case 'g':
454 if (ntok == 2) {
455 breakpoint = ps[1];
456- if (noDecode) {
457- M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
458- } else {
459- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
460- }
461- M.x86.debug &= ~DEBUG_TRACE_F;
462- M.x86.debug |= DEBUG_BREAK_F;
463- done = 1;
464+ if (noDecode) {
465+ M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
466+ }
467+ else {
468+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
469+ }
470+ M.x86.debug &= ~DEBUG_TRACE_F;
471+ M.x86.debug |= DEBUG_BREAK_F;
472+ done = 1;
473 }
474 break;
475- case 'q':
476- M.x86.debug |= DEBUG_EXIT;
477- return;
478- case 'P':
479- noDecode = (noDecode)?0:1;
480- printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
481- break;
482- case 't':
483- case 0:
484+ case 'q':
485+ M.x86.debug |= DEBUG_EXIT;
486+ return;
487+ case 'P':
488+ noDecode = (noDecode) ? 0 : 1;
489+ printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE");
490+ break;
491+ case 't':
492+ case 0:
493 done = 1;
494 break;
495- }
496+ }
497 }
498 }
499
500-int X86EMU_trace_on(void)
501+int
502+X86EMU_trace_on(void)
503 {
504- return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
505+ return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
506 }
507
508-int X86EMU_trace_off(void)
509+int
510+X86EMU_trace_off(void)
511 {
512- return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
513+ return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
514 }
515
516-static int parse_line (char *s, int *ps, int *n)
517+static int
518+parse_line(char *s, int *ps, int *n)
519 {
520 int cmd;
521
522 *n = 0;
523- while(*s == ' ' || *s == '\t') s++;
524+ while (*s == ' ' || *s == '\t')
525+ s++;
526 ps[*n] = *s;
527 switch (*s) {
528- case '\n':
529+ case '\n':
530 *n += 1;
531 return 0;
532- default:
533+ default:
534 cmd = *s;
535 *n += 1;
536 }
537
538- while (1) {
539- while (*s != ' ' && *s != '\t' && *s != '\n') s++;
540-
541- if (*s == '\n')
542- return cmd;
543-
544- while(*s == ' ' || *s == '\t') s++;
545-
546- sscanf(s,"%x",&ps[*n]);
547- *n += 1;
548- }
549+ while (1) {
550+ while (*s != ' ' && *s != '\t' && *s != '\n')
551+ s++;
552+
553+ if (*s == '\n')
554+ return cmd;
555+
556+ while (*s == ' ' || *s == '\t')
557+ s++;
558+
559+ sscanf(s, "%x", &ps[*n]);
560+ *n += 1;
561+ }
562 }
563
564-#endif /* DEBUG */
565+#endif /* DEBUG */
566
567-void x86emu_dump_regs (void)
568+void
569+x86emu_dump_regs(void)
570 {
571- printk("\tAX=%04x ", M.x86.R_AX );
572- printk("BX=%04x ", M.x86.R_BX );
573- printk("CX=%04x ", M.x86.R_CX );
574- printk("DX=%04x ", M.x86.R_DX );
575- printk("SP=%04x ", M.x86.R_SP );
576- printk("BP=%04x ", M.x86.R_BP );
577- printk("SI=%04x ", M.x86.R_SI );
578- printk("DI=%04x\n", M.x86.R_DI );
579- printk("\tDS=%04x ", M.x86.R_DS );
580- printk("ES=%04x ", M.x86.R_ES );
581- printk("SS=%04x ", M.x86.R_SS );
582- printk("CS=%04x ", M.x86.R_CS );
583- printk("IP=%04x ", M.x86.R_IP );
584- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
585- else printk("NV ");
586- if (ACCESS_FLAG(F_DF)) printk("DN ");
587- else printk("UP ");
588- if (ACCESS_FLAG(F_IF)) printk("EI ");
589- else printk("DI ");
590- if (ACCESS_FLAG(F_SF)) printk("NG ");
591- else printk("PL ");
592- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
593- else printk("NZ ");
594- if (ACCESS_FLAG(F_AF)) printk("AC ");
595- else printk("NA ");
596- if (ACCESS_FLAG(F_PF)) printk("PE ");
597- else printk("PO ");
598- if (ACCESS_FLAG(F_CF)) printk("CY ");
599- else printk("NC ");
600- printk("\n");
601+ printk("\tAX=%04x ", M.x86.R_AX);
602+ printk("BX=%04x ", M.x86.R_BX);
603+ printk("CX=%04x ", M.x86.R_CX);
604+ printk("DX=%04x ", M.x86.R_DX);
605+ printk("SP=%04x ", M.x86.R_SP);
606+ printk("BP=%04x ", M.x86.R_BP);
607+ printk("SI=%04x ", M.x86.R_SI);
608+ printk("DI=%04x\n", M.x86.R_DI);
609+ printk("\tDS=%04x ", M.x86.R_DS);
610+ printk("ES=%04x ", M.x86.R_ES);
611+ printk("SS=%04x ", M.x86.R_SS);
612+ printk("CS=%04x ", M.x86.R_CS);
613+ printk("IP=%04x ", M.x86.R_IP);
614+ if (ACCESS_FLAG(F_OF))
615+ printk("OV "); /* CHECKED... */
616+ else
617+ printk("NV ");
618+ if (ACCESS_FLAG(F_DF))
619+ printk("DN ");
620+ else
621+ printk("UP ");
622+ if (ACCESS_FLAG(F_IF))
623+ printk("EI ");
624+ else
625+ printk("DI ");
626+ if (ACCESS_FLAG(F_SF))
627+ printk("NG ");
628+ else
629+ printk("PL ");
630+ if (ACCESS_FLAG(F_ZF))
631+ printk("ZR ");
632+ else
633+ printk("NZ ");
634+ if (ACCESS_FLAG(F_AF))
635+ printk("AC ");
636+ else
637+ printk("NA ");
638+ if (ACCESS_FLAG(F_PF))
639+ printk("PE ");
640+ else
641+ printk("PO ");
642+ if (ACCESS_FLAG(F_CF))
643+ printk("CY ");
644+ else
645+ printk("NC ");
646+ printk("\n");
647 }
648
649-void x86emu_dump_xregs (void)
650+void
651+x86emu_dump_xregs(void)
652 {
653- printk("\tEAX=%08x ", M.x86.R_EAX );
654- printk("EBX=%08x ", M.x86.R_EBX );
655- printk("ECX=%08x ", M.x86.R_ECX );
656- printk("EDX=%08x \n", M.x86.R_EDX );
657- printk("\tESP=%08x ", M.x86.R_ESP );
658- printk("EBP=%08x ", M.x86.R_EBP );
659- printk("ESI=%08x ", M.x86.R_ESI );
660- printk("EDI=%08x\n", M.x86.R_EDI );
661- printk("\tDS=%04x ", M.x86.R_DS );
662- printk("ES=%04x ", M.x86.R_ES );
663- printk("SS=%04x ", M.x86.R_SS );
664- printk("CS=%04x ", M.x86.R_CS );
665- printk("EIP=%08x\n\t", M.x86.R_EIP );
666- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
667- else printk("NV ");
668- if (ACCESS_FLAG(F_DF)) printk("DN ");
669- else printk("UP ");
670- if (ACCESS_FLAG(F_IF)) printk("EI ");
671- else printk("DI ");
672- if (ACCESS_FLAG(F_SF)) printk("NG ");
673- else printk("PL ");
674- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
675- else printk("NZ ");
676- if (ACCESS_FLAG(F_AF)) printk("AC ");
677- else printk("NA ");
678- if (ACCESS_FLAG(F_PF)) printk("PE ");
679- else printk("PO ");
680- if (ACCESS_FLAG(F_CF)) printk("CY ");
681- else printk("NC ");
682- printk("\n");
683+ printk("\tEAX=%08x ", M.x86.R_EAX);
684+ printk("EBX=%08x ", M.x86.R_EBX);
685+ printk("ECX=%08x ", M.x86.R_ECX);
686+ printk("EDX=%08x \n", M.x86.R_EDX);
687+ printk("\tESP=%08x ", M.x86.R_ESP);
688+ printk("EBP=%08x ", M.x86.R_EBP);
689+ printk("ESI=%08x ", M.x86.R_ESI);
690+ printk("EDI=%08x\n", M.x86.R_EDI);
691+ printk("\tDS=%04x ", M.x86.R_DS);
692+ printk("ES=%04x ", M.x86.R_ES);
693+ printk("SS=%04x ", M.x86.R_SS);
694+ printk("CS=%04x ", M.x86.R_CS);
695+ printk("EIP=%08x\n\t", M.x86.R_EIP);
696+ if (ACCESS_FLAG(F_OF))
697+ printk("OV "); /* CHECKED... */
698+ else
699+ printk("NV ");
700+ if (ACCESS_FLAG(F_DF))
701+ printk("DN ");
702+ else
703+ printk("UP ");
704+ if (ACCESS_FLAG(F_IF))
705+ printk("EI ");
706+ else
707+ printk("DI ");
708+ if (ACCESS_FLAG(F_SF))
709+ printk("NG ");
710+ else
711+ printk("PL ");
712+ if (ACCESS_FLAG(F_ZF))
713+ printk("ZR ");
714+ else
715+ printk("NZ ");
716+ if (ACCESS_FLAG(F_AF))
717+ printk("AC ");
718+ else
719+ printk("NA ");
720+ if (ACCESS_FLAG(F_PF))
721+ printk("PE ");
722+ else
723+ printk("PO ");
724+ if (ACCESS_FLAG(F_CF))
725+ printk("CY ");
726+ else
727+ printk("NC ");
728+ printk("\n");
729 }
730diff --git a/libs/x86emu/decode.c b/libs/x86emu/decode.c
731index 7d9a34a..12f8fb8 100644
732--- a/libs/x86emu/decode.c
733+++ b/libs/x86emu/decode.c
734@@ -46,25 +46,27 @@
735 REMARKS:
736 Handles any pending asychronous interrupts.
737 ****************************************************************************/
738-static void x86emu_intr_handle(void)
739+static void
740+x86emu_intr_handle(void)
741 {
742- u8 intno;
743-
744- if (M.x86.intr & INTR_SYNCH) {
745- intno = M.x86.intno;
746- if (_X86EMU_intrTab[intno]) {
747- (*_X86EMU_intrTab[intno])(intno);
748- } else {
749- push_word((u16)M.x86.R_FLG);
750- CLEAR_FLAG(F_IF);
751- CLEAR_FLAG(F_TF);
752- push_word(M.x86.R_CS);
753- M.x86.R_CS = mem_access_word(intno * 4 + 2);
754- push_word(M.x86.R_IP);
755- M.x86.R_IP = mem_access_word(intno * 4);
756- M.x86.intr = 0;
757- }
758- }
759+ u8 intno;
760+
761+ if (M.x86.intr & INTR_SYNCH) {
762+ intno = M.x86.intno;
763+ if (_X86EMU_intrTab[intno]) {
764+ (*_X86EMU_intrTab[intno]) (intno);
765+ }
766+ else {
767+ push_word((u16) M.x86.R_FLG);
768+ CLEAR_FLAG(F_IF);
769+ CLEAR_FLAG(F_TF);
770+ push_word(M.x86.R_CS);
771+ M.x86.R_CS = mem_access_word(intno * 4 + 2);
772+ push_word(M.x86.R_IP);
773+ M.x86.R_IP = mem_access_word(intno * 4);
774+ M.x86.intr = 0;
775+ }
776+ }
777 }
778
779 /****************************************************************************
780@@ -75,11 +77,11 @@ REMARKS:
781 Raise the specified interrupt to be handled before the execution of the
782 next instruction.
783 ****************************************************************************/
784-void x86emu_intr_raise(
785- u8 intrnum)
786+void
787+x86emu_intr_raise(u8 intrnum)
788 {
789- M.x86.intno = intrnum;
790- M.x86.intr |= INTR_SYNCH;
791+ M.x86.intno = intrnum;
792+ M.x86.intr |= INTR_SYNCH;
793 }
794
795 /****************************************************************************
796@@ -88,39 +90,39 @@ Main execution loop for the emulator. We return from here when the system
797 halts, which is normally caused by a stack fault when we return from the
798 original real mode call.
799 ****************************************************************************/
800-void X86EMU_exec(void)
801+void
802+X86EMU_exec(void)
803 {
804- u8 op1;
805-
806- M.x86.intr = 0;
807- DB(x86emu_end_instr();)
808-
809- for (;;) {
810-DB( if (CHECK_IP_FETCH())
811- x86emu_check_ip_access();)
812- /* If debugging, save the IP and CS values. */
813- SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
814- INC_DECODED_INST_LEN(1);
815- if (M.x86.intr) {
816- if (M.x86.intr & INTR_HALTED) {
817-DB( if (M.x86.R_SP != 0) {
818- printk("halted\n");
819- X86EMU_trace_regs();
820- }
821- else {
822- if (M.x86.debug)
823- printk("Service completed successfully\n");
824- })
825- return;
826+ u8 op1;
827+
828+ M.x86.intr = 0;
829+ DB(x86emu_end_instr();
830+ )
831+
832+ for (;;) {
833+ DB(if (CHECK_IP_FETCH())
834+ x86emu_check_ip_access();)
835+ /* If debugging, save the IP and CS values. */
836+ SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
837+ INC_DECODED_INST_LEN(1);
838+ if (M.x86.intr) {
839+ if (M.x86.intr & INTR_HALTED) {
840+ DB(if (M.x86.R_SP != 0) {
841+ printk("halted\n"); X86EMU_trace_regs();}
842+ else {
843+ if (M.x86.debug)
844+ printk("Service completed successfully\n");}
845+ )
846+ return;
847 }
848- if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) ||
849- !ACCESS_FLAG(F_IF)) {
850- x86emu_intr_handle();
851- }
852- }
853-
854- op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
855- (*x86emu_optab[op1])(op1);
856+ if (((M.x86.intr & INTR_SYNCH) &&
857+ (M.x86.intno == 0 || M.x86.intno == 2)) ||
858+ !ACCESS_FLAG(F_IF)) {
859+ x86emu_intr_handle();
860+ }
861+ }
862+ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
863+ (*x86emu_optab[op1]) (op1);
864 if (M.x86.debug & DEBUG_EXIT) {
865 M.x86.debug &= ~DEBUG_EXIT;
866 return;
867@@ -132,9 +134,10 @@ DB( if (M.x86.R_SP != 0) {
868 REMARKS:
869 Halts the system by setting the halted system flag.
870 ****************************************************************************/
871-void X86EMU_halt_sys(void)
872+void
873+X86EMU_halt_sys(void)
874 {
875- M.x86.intr |= INTR_HALTED;
876+ M.x86.intr |= INTR_HALTED;
877 }
878
879 /****************************************************************************
880@@ -149,19 +152,17 @@ next instruction.
881
882 NOTE: Do not inline this function, as (*sys_rdb) is already inline!
883 ****************************************************************************/
884-void fetch_decode_modrm(
885- int *mod,
886- int *regh,
887- int *regl)
888+void
889+fetch_decode_modrm(int *mod, int *regh, int *regl)
890 {
891- int fetched;
892-
893-DB( if (CHECK_IP_FETCH())
894- x86emu_check_ip_access();)
895- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
896- INC_DECODED_INST_LEN(1);
897- *mod = (fetched >> 6) & 0x03;
898- *regh = (fetched >> 3) & 0x07;
899+ int fetched;
900+
901+ DB(if (CHECK_IP_FETCH())
902+ x86emu_check_ip_access();)
903+ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
904+ INC_DECODED_INST_LEN(1);
905+ *mod = (fetched >> 6) & 0x03;
906+ *regh = (fetched >> 3) & 0x07;
907 *regl = (fetched >> 0) & 0x07;
908 }
909
910@@ -175,15 +176,16 @@ moves the instruction pointer to the next value.
911
912 NOTE: Do not inline this function, as (*sys_rdb) is already inline!
913 ****************************************************************************/
914-u8 fetch_byte_imm(void)
915+u8
916+fetch_byte_imm(void)
917 {
918- u8 fetched;
919+ u8 fetched;
920
921-DB( if (CHECK_IP_FETCH())
922- x86emu_check_ip_access();)
923- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
924- INC_DECODED_INST_LEN(1);
925- return fetched;
926+ DB(if (CHECK_IP_FETCH())
927+ x86emu_check_ip_access();)
928+ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
929+ INC_DECODED_INST_LEN(1);
930+ return fetched;
931 }
932
933 /****************************************************************************
934@@ -196,16 +198,17 @@ moves the instruction pointer to the next value.
935
936 NOTE: Do not inline this function, as (*sys_rdw) is already inline!
937 ****************************************************************************/
938-u16 fetch_word_imm(void)
939+u16
940+fetch_word_imm(void)
941 {
942- u16 fetched;
943-
944-DB( if (CHECK_IP_FETCH())
945- x86emu_check_ip_access();)
946- fetched = (*sys_rdw)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
947- M.x86.R_IP += 2;
948- INC_DECODED_INST_LEN(2);
949- return fetched;
950+ u16 fetched;
951+
952+ DB(if (CHECK_IP_FETCH())
953+ x86emu_check_ip_access();)
954+ fetched = (*sys_rdw) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
955+ M.x86.R_IP += 2;
956+ INC_DECODED_INST_LEN(2);
957+ return fetched;
958 }
959
960 /****************************************************************************
961@@ -218,16 +221,17 @@ moves the instruction pointer to the next value.
962
963 NOTE: Do not inline this function, as (*sys_rdw) is already inline!
964 ****************************************************************************/
965-u32 fetch_long_imm(void)
966+u32
967+fetch_long_imm(void)
968 {
969- u32 fetched;
970-
971-DB( if (CHECK_IP_FETCH())
972- x86emu_check_ip_access();)
973- fetched = (*sys_rdl)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
974- M.x86.R_IP += 4;
975- INC_DECODED_INST_LEN(4);
976- return fetched;
977+ u32 fetched;
978+
979+ DB(if (CHECK_IP_FETCH())
980+ x86emu_check_ip_access();)
981+ fetched = (*sys_rdl) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
982+ M.x86.R_IP += 4;
983+ INC_DECODED_INST_LEN(4);
984+ return fetched;
985 }
986
987 /****************************************************************************
988@@ -259,38 +263,39 @@ cpu-state-varible M.x86.mode. There are several potential states:
989
990 Each of the above 7 items are handled with a bit in the mode field.
991 ****************************************************************************/
992-_INLINE u32 get_data_segment(void)
993+_INLINE u32
994+get_data_segment(void)
995 {
996 #define GET_SEGMENT(segment)
997- switch (M.x86.mode & SYSMODE_SEGMASK) {
998- case 0: /* default case: use ds register */
999- case SYSMODE_SEGOVR_DS:
1000- case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
1001- return M.x86.R_DS;
1002- case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
1003- return M.x86.R_SS;
1004- case SYSMODE_SEGOVR_CS:
1005- case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
1006- return M.x86.R_CS;
1007- case SYSMODE_SEGOVR_ES:
1008- case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
1009- return M.x86.R_ES;
1010- case SYSMODE_SEGOVR_FS:
1011- case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
1012- return M.x86.R_FS;
1013- case SYSMODE_SEGOVR_GS:
1014- case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
1015- return M.x86.R_GS;
1016- case SYSMODE_SEGOVR_SS:
1017- case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
1018- return M.x86.R_SS;
1019- default:
1020+ switch (M.x86.mode & SYSMODE_SEGMASK) {
1021+ case 0: /* default case: use ds register */
1022+ case SYSMODE_SEGOVR_DS:
1023+ case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
1024+ return M.x86.R_DS;
1025+ case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
1026+ return M.x86.R_SS;
1027+ case SYSMODE_SEGOVR_CS:
1028+ case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
1029+ return M.x86.R_CS;
1030+ case SYSMODE_SEGOVR_ES:
1031+ case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
1032+ return M.x86.R_ES;
1033+ case SYSMODE_SEGOVR_FS:
1034+ case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
1035+ return M.x86.R_FS;
1036+ case SYSMODE_SEGOVR_GS:
1037+ case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
1038+ return M.x86.R_GS;
1039+ case SYSMODE_SEGOVR_SS:
1040+ case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
1041+ return M.x86.R_SS;
1042+ default:
1043 #ifdef DEBUG
1044- printk("error: should not happen: multiple overrides.\n");
1045+ printk("error: should not happen: multiple overrides.\n");
1046 #endif
1047- HALT_SYS();
1048- return 0;
1049- }
1050+ HALT_SYS();
1051+ return 0;
1052+ }
1053 }
1054
1055 /****************************************************************************
1056@@ -302,14 +307,14 @@ Byte value read from the absolute memory location.
1057
1058 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1059 ****************************************************************************/
1060-u8 fetch_data_byte(
1061- uint offset)
1062+u8
1063+fetch_data_byte(uint offset)
1064 {
1065 #ifdef DEBUG
1066- if (CHECK_DATA_ACCESS())
1067- x86emu_check_data_access((u16)get_data_segment(), offset);
1068+ if (CHECK_DATA_ACCESS())
1069+ x86emu_check_data_access((u16) get_data_segment(), offset);
1070 #endif
1071- return (*sys_rdb)((get_data_segment() << 4) + offset);
1072+ return (*sys_rdb) ((get_data_segment() << 4) + offset);
1073 }
1074
1075 /****************************************************************************
1076@@ -321,14 +326,14 @@ Word value read from the absolute memory location.
1077
1078 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1079 ****************************************************************************/
1080-u16 fetch_data_word(
1081- uint offset)
1082+u16
1083+fetch_data_word(uint offset)
1084 {
1085 #ifdef DEBUG
1086- if (CHECK_DATA_ACCESS())
1087- x86emu_check_data_access((u16)get_data_segment(), offset);
1088+ if (CHECK_DATA_ACCESS())
1089+ x86emu_check_data_access((u16) get_data_segment(), offset);
1090 #endif
1091- return (*sys_rdw)((get_data_segment() << 4) + offset);
1092+ return (*sys_rdw) ((get_data_segment() << 4) + offset);
1093 }
1094
1095 /****************************************************************************
1096@@ -340,14 +345,14 @@ Long value read from the absolute memory location.
1097
1098 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1099 ****************************************************************************/
1100-u32 fetch_data_long(
1101- uint offset)
1102+u32
1103+fetch_data_long(uint offset)
1104 {
1105 #ifdef DEBUG
1106- if (CHECK_DATA_ACCESS())
1107- x86emu_check_data_access((u16)get_data_segment(), offset);
1108+ if (CHECK_DATA_ACCESS())
1109+ x86emu_check_data_access((u16) get_data_segment(), offset);
1110 #endif
1111- return (*sys_rdl)((get_data_segment() << 4) + offset);
1112+ return (*sys_rdl) ((get_data_segment() << 4) + offset);
1113 }
1114
1115 /****************************************************************************
1116@@ -360,15 +365,14 @@ Byte value read from the absolute memory location.
1117
1118 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1119 ****************************************************************************/
1120-u8 fetch_data_byte_abs(
1121- uint segment,
1122- uint offset)
1123+u8
1124+fetch_data_byte_abs(uint segment, uint offset)
1125 {
1126 #ifdef DEBUG
1127- if (CHECK_DATA_ACCESS())
1128- x86emu_check_data_access(segment, offset);
1129+ if (CHECK_DATA_ACCESS())
1130+ x86emu_check_data_access(segment, offset);
1131 #endif
1132- return (*sys_rdb)(((u32)segment << 4) + offset);
1133+ return (*sys_rdb) (((u32) segment << 4) + offset);
1134 }
1135
1136 /****************************************************************************
1137@@ -381,15 +385,14 @@ Word value read from the absolute memory location.
1138
1139 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1140 ****************************************************************************/
1141-u16 fetch_data_word_abs(
1142- uint segment,
1143- uint offset)
1144+u16
1145+fetch_data_word_abs(uint segment, uint offset)
1146 {
1147 #ifdef DEBUG
1148- if (CHECK_DATA_ACCESS())
1149- x86emu_check_data_access(segment, offset);
1150+ if (CHECK_DATA_ACCESS())
1151+ x86emu_check_data_access(segment, offset);
1152 #endif
1153- return (*sys_rdw)(((u32)segment << 4) + offset);
1154+ return (*sys_rdw) (((u32) segment << 4) + offset);
1155 }
1156
1157 /****************************************************************************
1158@@ -402,15 +405,14 @@ Long value read from the absolute memory location.
1159
1160 NOTE: Do not inline this function as (*sys_rdX) is already inline!
1161 ****************************************************************************/
1162-u32 fetch_data_long_abs(
1163- uint segment,
1164- uint offset)
1165+u32
1166+fetch_data_long_abs(uint segment, uint offset)
1167 {
1168 #ifdef DEBUG
1169- if (CHECK_DATA_ACCESS())
1170- x86emu_check_data_access(segment, offset);
1171+ if (CHECK_DATA_ACCESS())
1172+ x86emu_check_data_access(segment, offset);
1173 #endif
1174- return (*sys_rdl)(((u32)segment << 4) + offset);
1175+ return (*sys_rdl) (((u32) segment << 4) + offset);
1176 }
1177
1178 /****************************************************************************
1179@@ -424,15 +426,14 @@ the current 'default' segment, which may have been overridden.
1180
1181 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1182 ****************************************************************************/
1183-void store_data_byte(
1184- uint offset,
1185- u8 val)
1186+void
1187+store_data_byte(uint offset, u8 val)
1188 {
1189 #ifdef DEBUG
1190- if (CHECK_DATA_ACCESS())
1191- x86emu_check_data_access((u16)get_data_segment(), offset);
1192+ if (CHECK_DATA_ACCESS())
1193+ x86emu_check_data_access((u16) get_data_segment(), offset);
1194 #endif
1195- (*sys_wrb)((get_data_segment() << 4) + offset, val);
1196+ (*sys_wrb) ((get_data_segment() << 4) + offset, val);
1197 }
1198
1199 /****************************************************************************
1200@@ -446,15 +447,14 @@ the current 'default' segment, which may have been overridden.
1201
1202 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1203 ****************************************************************************/
1204-void store_data_word(
1205- uint offset,
1206- u16 val)
1207+void
1208+store_data_word(uint offset, u16 val)
1209 {
1210 #ifdef DEBUG
1211- if (CHECK_DATA_ACCESS())
1212- x86emu_check_data_access((u16)get_data_segment(), offset);
1213+ if (CHECK_DATA_ACCESS())
1214+ x86emu_check_data_access((u16) get_data_segment(), offset);
1215 #endif
1216- (*sys_wrw)((get_data_segment() << 4) + offset, val);
1217+ (*sys_wrw) ((get_data_segment() << 4) + offset, val);
1218 }
1219
1220 /****************************************************************************
1221@@ -468,15 +468,14 @@ the current 'default' segment, which may have been overridden.
1222
1223 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1224 ****************************************************************************/
1225-void store_data_long(
1226- uint offset,
1227- u32 val)
1228+void
1229+store_data_long(uint offset, u32 val)
1230 {
1231 #ifdef DEBUG
1232- if (CHECK_DATA_ACCESS())
1233- x86emu_check_data_access((u16)get_data_segment(), offset);
1234+ if (CHECK_DATA_ACCESS())
1235+ x86emu_check_data_access((u16) get_data_segment(), offset);
1236 #endif
1237- (*sys_wrl)((get_data_segment() << 4) + offset, val);
1238+ (*sys_wrl) ((get_data_segment() << 4) + offset, val);
1239 }
1240
1241 /****************************************************************************
1242@@ -490,16 +489,14 @@ Writes a byte value to an absolute memory location.
1243
1244 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1245 ****************************************************************************/
1246-void store_data_byte_abs(
1247- uint segment,
1248- uint offset,
1249- u8 val)
1250+void
1251+store_data_byte_abs(uint segment, uint offset, u8 val)
1252 {
1253 #ifdef DEBUG
1254- if (CHECK_DATA_ACCESS())
1255- x86emu_check_data_access(segment, offset);
1256+ if (CHECK_DATA_ACCESS())
1257+ x86emu_check_data_access(segment, offset);
1258 #endif
1259- (*sys_wrb)(((u32)segment << 4) + offset, val);
1260+ (*sys_wrb) (((u32) segment << 4) + offset, val);
1261 }
1262
1263 /****************************************************************************
1264@@ -513,16 +510,14 @@ Writes a word value to an absolute memory location.
1265
1266 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1267 ****************************************************************************/
1268-void store_data_word_abs(
1269- uint segment,
1270- uint offset,
1271- u16 val)
1272+void
1273+store_data_word_abs(uint segment, uint offset, u16 val)
1274 {
1275 #ifdef DEBUG
1276- if (CHECK_DATA_ACCESS())
1277- x86emu_check_data_access(segment, offset);
1278+ if (CHECK_DATA_ACCESS())
1279+ x86emu_check_data_access(segment, offset);
1280 #endif
1281- (*sys_wrw)(((u32)segment << 4) + offset, val);
1282+ (*sys_wrw) (((u32) segment << 4) + offset, val);
1283 }
1284
1285 /****************************************************************************
1286@@ -536,16 +531,14 @@ Writes a long value to an absolute memory location.
1287
1288 NOTE: Do not inline this function as (*sys_wrX) is already inline!
1289 ****************************************************************************/
1290-void store_data_long_abs(
1291- uint segment,
1292- uint offset,
1293- u32 val)
1294+void
1295+store_data_long_abs(uint segment, uint offset, u32 val)
1296 {
1297 #ifdef DEBUG
1298- if (CHECK_DATA_ACCESS())
1299- x86emu_check_data_access(segment, offset);
1300+ if (CHECK_DATA_ACCESS())
1301+ x86emu_check_data_access(segment, offset);
1302 #endif
1303- (*sys_wrl)(((u32)segment << 4) + offset, val);
1304+ (*sys_wrl) (((u32) segment << 4) + offset, val);
1305 }
1306
1307 /****************************************************************************
1308@@ -559,37 +552,37 @@ REMARKS:
1309 Return a pointer to the register given by the R/RM field of the
1310 modrm byte, for byte operands. Also enables the decoding of instructions.
1311 ****************************************************************************/
1312-u8* decode_rm_byte_register(
1313- int reg)
1314+u8 *
1315+decode_rm_byte_register(int reg)
1316 {
1317- switch (reg) {
1318- case 0:
1319- DECODE_PRINTF("AL");
1320- return &M.x86.R_AL;
1321- case 1:
1322- DECODE_PRINTF("CL");
1323- return &M.x86.R_CL;
1324- case 2:
1325- DECODE_PRINTF("DL");
1326- return &M.x86.R_DL;
1327- case 3:
1328- DECODE_PRINTF("BL");
1329- return &M.x86.R_BL;
1330- case 4:
1331- DECODE_PRINTF("AH");
1332- return &M.x86.R_AH;
1333- case 5:
1334- DECODE_PRINTF("CH");
1335- return &M.x86.R_CH;
1336- case 6:
1337- DECODE_PRINTF("DH");
1338- return &M.x86.R_DH;
1339- case 7:
1340- DECODE_PRINTF("BH");
1341- return &M.x86.R_BH;
1342- }
1343- HALT_SYS();
1344- return NULL; /* NOT REACHED OR REACHED ON ERROR */
1345+ switch (reg) {
1346+ case 0:
1347+ DECODE_PRINTF("AL");
1348+ return &M.x86.R_AL;
1349+ case 1:
1350+ DECODE_PRINTF("CL");
1351+ return &M.x86.R_CL;
1352+ case 2:
1353+ DECODE_PRINTF("DL");
1354+ return &M.x86.R_DL;
1355+ case 3:
1356+ DECODE_PRINTF("BL");
1357+ return &M.x86.R_BL;
1358+ case 4:
1359+ DECODE_PRINTF("AH");
1360+ return &M.x86.R_AH;
1361+ case 5:
1362+ DECODE_PRINTF("CH");
1363+ return &M.x86.R_CH;
1364+ case 6:
1365+ DECODE_PRINTF("DH");
1366+ return &M.x86.R_DH;
1367+ case 7:
1368+ DECODE_PRINTF("BH");
1369+ return &M.x86.R_BH;
1370+ }
1371+ HALT_SYS();
1372+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
1373 }
1374
1375 /****************************************************************************
1376@@ -603,36 +596,36 @@ REMARKS:
1377 Return a pointer to the register given by the R/RM field of the
1378 modrm byte, for word operands. Also enables the decoding of instructions.
1379 ****************************************************************************/
1380-u16* decode_rm_word_register(
1381- int reg)
1382+u16 *
1383+decode_rm_word_register(int reg)
1384 {
1385- switch (reg) {
1386- case 0:
1387- DECODE_PRINTF("AX");
1388- return &M.x86.R_AX;
1389- case 1:
1390- DECODE_PRINTF("CX");
1391- return &M.x86.R_CX;
1392- case 2:
1393- DECODE_PRINTF("DX");
1394- return &M.x86.R_DX;
1395- case 3:
1396- DECODE_PRINTF("BX");
1397- return &M.x86.R_BX;
1398- case 4:
1399- DECODE_PRINTF("SP");
1400- return &M.x86.R_SP;
1401- case 5:
1402- DECODE_PRINTF("BP");
1403- return &M.x86.R_BP;
1404- case 6:
1405- DECODE_PRINTF("SI");
1406- return &M.x86.R_SI;
1407- case 7:
1408- DECODE_PRINTF("DI");
1409- return &M.x86.R_DI;
1410- }
1411- HALT_SYS();
1412+ switch (reg) {
1413+ case 0:
1414+ DECODE_PRINTF("AX");
1415+ return &M.x86.R_AX;
1416+ case 1:
1417+ DECODE_PRINTF("CX");
1418+ return &M.x86.R_CX;
1419+ case 2:
1420+ DECODE_PRINTF("DX");
1421+ return &M.x86.R_DX;
1422+ case 3:
1423+ DECODE_PRINTF("BX");
1424+ return &M.x86.R_BX;
1425+ case 4:
1426+ DECODE_PRINTF("SP");
1427+ return &M.x86.R_SP;
1428+ case 5:
1429+ DECODE_PRINTF("BP");
1430+ return &M.x86.R_BP;
1431+ case 6:
1432+ DECODE_PRINTF("SI");
1433+ return &M.x86.R_SI;
1434+ case 7:
1435+ DECODE_PRINTF("DI");
1436+ return &M.x86.R_DI;
1437+ }
1438+ HALT_SYS();
1439 return NULL; /* NOTREACHED OR REACHED ON ERROR */
1440 }
1441
1442@@ -647,36 +640,36 @@ REMARKS:
1443 Return a pointer to the register given by the R/RM field of the
1444 modrm byte, for dword operands. Also enables the decoding of instructions.
1445 ****************************************************************************/
1446-u32* decode_rm_long_register(
1447- int reg)
1448+u32 *
1449+decode_rm_long_register(int reg)
1450 {
1451 switch (reg) {
1452- case 0:
1453- DECODE_PRINTF("EAX");
1454- return &M.x86.R_EAX;
1455- case 1:
1456- DECODE_PRINTF("ECX");
1457- return &M.x86.R_ECX;
1458- case 2:
1459- DECODE_PRINTF("EDX");
1460- return &M.x86.R_EDX;
1461- case 3:
1462- DECODE_PRINTF("EBX");
1463- return &M.x86.R_EBX;
1464- case 4:
1465- DECODE_PRINTF("ESP");
1466- return &M.x86.R_ESP;
1467- case 5:
1468- DECODE_PRINTF("EBP");
1469- return &M.x86.R_EBP;
1470- case 6:
1471- DECODE_PRINTF("ESI");
1472- return &M.x86.R_ESI;
1473- case 7:
1474- DECODE_PRINTF("EDI");
1475- return &M.x86.R_EDI;
1476- }
1477- HALT_SYS();
1478+ case 0:
1479+ DECODE_PRINTF("EAX");
1480+ return &M.x86.R_EAX;
1481+ case 1:
1482+ DECODE_PRINTF("ECX");
1483+ return &M.x86.R_ECX;
1484+ case 2:
1485+ DECODE_PRINTF("EDX");
1486+ return &M.x86.R_EDX;
1487+ case 3:
1488+ DECODE_PRINTF("EBX");
1489+ return &M.x86.R_EBX;
1490+ case 4:
1491+ DECODE_PRINTF("ESP");
1492+ return &M.x86.R_ESP;
1493+ case 5:
1494+ DECODE_PRINTF("EBP");
1495+ return &M.x86.R_EBP;
1496+ case 6:
1497+ DECODE_PRINTF("ESI");
1498+ return &M.x86.R_ESI;
1499+ case 7:
1500+ DECODE_PRINTF("EDI");
1501+ return &M.x86.R_EDI;
1502+ }
1503+ HALT_SYS();
1504 return NULL; /* NOTREACHED OR REACHED ON ERROR */
1505 }
1506
1507@@ -692,126 +685,129 @@ Return a pointer to the register given by the R/RM field of the
1508 modrm byte, for word operands, modified from above for the weirdo
1509 special case of segreg operands. Also enables the decoding of instructions.
1510 ****************************************************************************/
1511-u16* decode_rm_seg_register(
1512- int reg)
1513+u16 *
1514+decode_rm_seg_register(int reg)
1515 {
1516- switch (reg) {
1517- case 0:
1518- DECODE_PRINTF("ES");
1519- return &M.x86.R_ES;
1520- case 1:
1521- DECODE_PRINTF("CS");
1522- return &M.x86.R_CS;
1523- case 2:
1524- DECODE_PRINTF("SS");
1525- return &M.x86.R_SS;
1526- case 3:
1527- DECODE_PRINTF("DS");
1528- return &M.x86.R_DS;
1529- case 4:
1530- DECODE_PRINTF("FS");
1531- return &M.x86.R_FS;
1532- case 5:
1533- DECODE_PRINTF("GS");
1534- return &M.x86.R_GS;
1535- case 6:
1536- case 7:
1537- DECODE_PRINTF("ILLEGAL SEGREG");
1538- break;
1539- }
1540- HALT_SYS();
1541- return NULL; /* NOT REACHED OR REACHED ON ERROR */
1542+ switch (reg) {
1543+ case 0:
1544+ DECODE_PRINTF("ES");
1545+ return &M.x86.R_ES;
1546+ case 1:
1547+ DECODE_PRINTF("CS");
1548+ return &M.x86.R_CS;
1549+ case 2:
1550+ DECODE_PRINTF("SS");
1551+ return &M.x86.R_SS;
1552+ case 3:
1553+ DECODE_PRINTF("DS");
1554+ return &M.x86.R_DS;
1555+ case 4:
1556+ DECODE_PRINTF("FS");
1557+ return &M.x86.R_FS;
1558+ case 5:
1559+ DECODE_PRINTF("GS");
1560+ return &M.x86.R_GS;
1561+ case 6:
1562+ case 7:
1563+ DECODE_PRINTF("ILLEGAL SEGREG");
1564+ break;
1565+ }
1566+ HALT_SYS();
1567+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
1568 }
1569
1570 /*
1571 *
1572 * return offset from the SIB Byte
1573 */
1574-u32 decode_sib_address(int sib, int mod)
1575+u32
1576+decode_sib_address(int sib, int mod)
1577 {
1578 u32 base = 0, i = 0, scale = 1;
1579
1580- switch(sib & 0x07) {
1581+ switch (sib & 0x07) {
1582 case 0:
1583- DECODE_PRINTF("[EAX]");
1584- base = M.x86.R_EAX;
1585- break;
1586+ DECODE_PRINTF("[EAX]");
1587+ base = M.x86.R_EAX;
1588+ break;
1589 case 1:
1590- DECODE_PRINTF("[ECX]");
1591- base = M.x86.R_ECX;
1592- break;
1593+ DECODE_PRINTF("[ECX]");
1594+ base = M.x86.R_ECX;
1595+ break;
1596 case 2:
1597- DECODE_PRINTF("[EDX]");
1598- base = M.x86.R_EDX;
1599- break;
1600+ DECODE_PRINTF("[EDX]");
1601+ base = M.x86.R_EDX;
1602+ break;
1603 case 3:
1604- DECODE_PRINTF("[EBX]");
1605- base = M.x86.R_EBX;
1606- break;
1607+ DECODE_PRINTF("[EBX]");
1608+ base = M.x86.R_EBX;
1609+ break;
1610 case 4:
1611- DECODE_PRINTF("[ESP]");
1612- base = M.x86.R_ESP;
1613- M.x86.mode |= SYSMODE_SEG_DS_SS;
1614- break;
1615+ DECODE_PRINTF("[ESP]");
1616+ base = M.x86.R_ESP;
1617+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1618+ break;
1619 case 5:
1620- if (mod == 0) {
1621- base = fetch_long_imm();
1622- DECODE_PRINTF2("%08x", base);
1623- } else {
1624- DECODE_PRINTF("[EBP]");
1625- base = M.x86.R_ESP;
1626- M.x86.mode |= SYSMODE_SEG_DS_SS;
1627- }
1628- break;
1629+ if (mod == 0) {
1630+ base = fetch_long_imm();
1631+ DECODE_PRINTF2("%08x", base);
1632+ }
1633+ else {
1634+ DECODE_PRINTF("[EBP]");
1635+ base = M.x86.R_ESP;
1636+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1637+ }
1638+ break;
1639 case 6:
1640- DECODE_PRINTF("[ESI]");
1641- base = M.x86.R_ESI;
1642- break;
1643+ DECODE_PRINTF("[ESI]");
1644+ base = M.x86.R_ESI;
1645+ break;
1646 case 7:
1647- DECODE_PRINTF("[EDI]");
1648- base = M.x86.R_EDI;
1649- break;
1650+ DECODE_PRINTF("[EDI]");
1651+ base = M.x86.R_EDI;
1652+ break;
1653 }
1654 switch ((sib >> 3) & 0x07) {
1655 case 0:
1656- DECODE_PRINTF("[EAX");
1657- i = M.x86.R_EAX;
1658- break;
1659+ DECODE_PRINTF("[EAX");
1660+ i = M.x86.R_EAX;
1661+ break;
1662 case 1:
1663- DECODE_PRINTF("[ECX");
1664- i = M.x86.R_ECX;
1665- break;
1666+ DECODE_PRINTF("[ECX");
1667+ i = M.x86.R_ECX;
1668+ break;
1669 case 2:
1670- DECODE_PRINTF("[EDX");
1671- i = M.x86.R_EDX;
1672- break;
1673+ DECODE_PRINTF("[EDX");
1674+ i = M.x86.R_EDX;
1675+ break;
1676 case 3:
1677- DECODE_PRINTF("[EBX");
1678- i = M.x86.R_EBX;
1679- break;
1680+ DECODE_PRINTF("[EBX");
1681+ i = M.x86.R_EBX;
1682+ break;
1683 case 4:
1684- i = 0;
1685- break;
1686+ i = 0;
1687+ break;
1688 case 5:
1689- DECODE_PRINTF("[EBP");
1690- i = M.x86.R_EBP;
1691- break;
1692+ DECODE_PRINTF("[EBP");
1693+ i = M.x86.R_EBP;
1694+ break;
1695 case 6:
1696- DECODE_PRINTF("[ESI");
1697- i = M.x86.R_ESI;
1698- break;
1699+ DECODE_PRINTF("[ESI");
1700+ i = M.x86.R_ESI;
1701+ break;
1702 case 7:
1703- DECODE_PRINTF("[EDI");
1704- i = M.x86.R_EDI;
1705- break;
1706+ DECODE_PRINTF("[EDI");
1707+ i = M.x86.R_EDI;
1708+ break;
1709 }
1710 scale = 1 << ((sib >> 6) & 0x03);
1711 if (((sib >> 3) & 0x07) != 4) {
1712- if (scale == 1) {
1713- DECODE_PRINTF("]");
1714- } else {
1715- DECODE_PRINTF2("*%d]", scale);
1716- }
1717+ if (scale == 1) {
1718+ DECODE_PRINTF("]");
1719+ }
1720+ else {
1721+ DECODE_PRINTF2("*%d]", scale);
1722+ }
1723 }
1724 return base + (i * scale);
1725 }
1726@@ -836,74 +832,75 @@ NOTE: The code which specifies the corresponding segment (ds vs ss)
1727 if a SS access is needed, set this bit. Otherwise, DS access
1728 occurs (unless any of the segment override bits are set).
1729 ****************************************************************************/
1730-u32 decode_rm00_address(
1731- int rm)
1732+u32
1733+decode_rm00_address(int rm)
1734 {
1735 u32 offset;
1736 int sib;
1737
1738 if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
1739 /* 32-bit addressing */
1740- switch (rm) {
1741- case 0:
1742- DECODE_PRINTF("[EAX]");
1743- return M.x86.R_EAX;
1744- case 1:
1745- DECODE_PRINTF("[ECX]");
1746- return M.x86.R_ECX;
1747- case 2:
1748- DECODE_PRINTF("[EDX]");
1749- return M.x86.R_EDX;
1750- case 3:
1751- DECODE_PRINTF("[EBX]");
1752- return M.x86.R_EBX;
1753- case 4:
1754- sib = fetch_byte_imm();
1755- return decode_sib_address(sib, 0);
1756- case 5:
1757- offset = fetch_long_imm();
1758- DECODE_PRINTF2("[%08x]", offset);
1759- return offset;
1760- case 6:
1761- DECODE_PRINTF("[ESI]");
1762- return M.x86.R_ESI;
1763- case 7:
1764- DECODE_PRINTF("[EDI]");
1765- return M.x86.R_EDI;
1766- }
1767- HALT_SYS();
1768- } else {
1769+ switch (rm) {
1770+ case 0:
1771+ DECODE_PRINTF("[EAX]");
1772+ return M.x86.R_EAX;
1773+ case 1:
1774+ DECODE_PRINTF("[ECX]");
1775+ return M.x86.R_ECX;
1776+ case 2:
1777+ DECODE_PRINTF("[EDX]");
1778+ return M.x86.R_EDX;
1779+ case 3:
1780+ DECODE_PRINTF("[EBX]");
1781+ return M.x86.R_EBX;
1782+ case 4:
1783+ sib = fetch_byte_imm();
1784+ return decode_sib_address(sib, 0);
1785+ case 5:
1786+ offset = fetch_long_imm();
1787+ DECODE_PRINTF2("[%08x]", offset);
1788+ return offset;
1789+ case 6:
1790+ DECODE_PRINTF("[ESI]");
1791+ return M.x86.R_ESI;
1792+ case 7:
1793+ DECODE_PRINTF("[EDI]");
1794+ return M.x86.R_EDI;
1795+ }
1796+ HALT_SYS();
1797+ }
1798+ else {
1799 /* 16-bit addressing */
1800- switch (rm) {
1801- case 0:
1802- DECODE_PRINTF("[BX+SI]");
1803+ switch (rm) {
1804+ case 0:
1805+ DECODE_PRINTF("[BX+SI]");
1806 return (M.x86.R_BX + M.x86.R_SI) & 0xffff;
1807- case 1:
1808- DECODE_PRINTF("[BX+DI]");
1809+ case 1:
1810+ DECODE_PRINTF("[BX+DI]");
1811 return (M.x86.R_BX + M.x86.R_DI) & 0xffff;
1812- case 2:
1813- DECODE_PRINTF("[BP+SI]");
1814- M.x86.mode |= SYSMODE_SEG_DS_SS;
1815+ case 2:
1816+ DECODE_PRINTF("[BP+SI]");
1817+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1818 return (M.x86.R_BP + M.x86.R_SI) & 0xffff;
1819- case 3:
1820- DECODE_PRINTF("[BP+DI]");
1821- M.x86.mode |= SYSMODE_SEG_DS_SS;
1822+ case 3:
1823+ DECODE_PRINTF("[BP+DI]");
1824+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1825 return (M.x86.R_BP + M.x86.R_DI) & 0xffff;
1826- case 4:
1827- DECODE_PRINTF("[SI]");
1828- return M.x86.R_SI;
1829- case 5:
1830- DECODE_PRINTF("[DI]");
1831- return M.x86.R_DI;
1832- case 6:
1833- offset = fetch_word_imm();
1834- DECODE_PRINTF2("[%04x]", offset);
1835- return offset;
1836- case 7:
1837- DECODE_PRINTF("[BX]");
1838- return M.x86.R_BX;
1839- }
1840- HALT_SYS();
1841+ case 4:
1842+ DECODE_PRINTF("[SI]");
1843+ return M.x86.R_SI;
1844+ case 5:
1845+ DECODE_PRINTF("[DI]");
1846+ return M.x86.R_DI;
1847+ case 6:
1848+ offset = fetch_word_imm();
1849+ DECODE_PRINTF2("[%04x]", offset);
1850+ return offset;
1851+ case 7:
1852+ DECODE_PRINTF("[BX]");
1853+ return M.x86.R_BX;
1854+ }
1855+ HALT_SYS();
1856 }
1857 return 0;
1858 }
1859@@ -919,79 +916,80 @@ REMARKS:
1860 Return the offset given by mod=01 addressing. Also enables the
1861 decoding of instructions.
1862 ****************************************************************************/
1863-u32 decode_rm01_address(
1864- int rm)
1865+u32
1866+decode_rm01_address(int rm)
1867 {
1868 int displacement = 0;
1869 int sib;
1870
1871 /* Fetch disp8 if no SIB byte */
1872 if (!((M.x86.mode & SYSMODE_PREFIX_ADDR) && (rm == 4)))
1873- displacement = (s8)fetch_byte_imm();
1874+ displacement = (s8) fetch_byte_imm();
1875
1876 if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
1877 /* 32-bit addressing */
1878- switch (rm) {
1879- case 0:
1880- DECODE_PRINTF2("%d[EAX]", displacement);
1881- return M.x86.R_EAX + displacement;
1882- case 1:
1883- DECODE_PRINTF2("%d[ECX]", displacement);
1884- return M.x86.R_ECX + displacement;
1885- case 2:
1886- DECODE_PRINTF2("%d[EDX]", displacement);
1887- return M.x86.R_EDX + displacement;
1888- case 3:
1889- DECODE_PRINTF2("%d[EBX]", displacement);
1890- return M.x86.R_EBX + displacement;
1891- case 4:
1892- sib = fetch_byte_imm();
1893- displacement = (s8)fetch_byte_imm();
1894- DECODE_PRINTF2("%d", displacement);
1895- return decode_sib_address(sib, 1) + displacement;
1896- case 5:
1897- DECODE_PRINTF2("%d[EBP]", displacement);
1898- return M.x86.R_EBP + displacement;
1899- case 6:
1900- DECODE_PRINTF2("%d[ESI]", displacement);
1901- return M.x86.R_ESI + displacement;
1902- case 7:
1903- DECODE_PRINTF2("%d[EDI]", displacement);
1904- return M.x86.R_EDI + displacement;
1905- }
1906- HALT_SYS();
1907- } else {
1908+ switch (rm) {
1909+ case 0:
1910+ DECODE_PRINTF2("%d[EAX]", displacement);
1911+ return M.x86.R_EAX + displacement;
1912+ case 1:
1913+ DECODE_PRINTF2("%d[ECX]", displacement);
1914+ return M.x86.R_ECX + displacement;
1915+ case 2:
1916+ DECODE_PRINTF2("%d[EDX]", displacement);
1917+ return M.x86.R_EDX + displacement;
1918+ case 3:
1919+ DECODE_PRINTF2("%d[EBX]", displacement);
1920+ return M.x86.R_EBX + displacement;
1921+ case 4:
1922+ sib = fetch_byte_imm();
1923+ displacement = (s8) fetch_byte_imm();
1924+ DECODE_PRINTF2("%d", displacement);
1925+ return decode_sib_address(sib, 1) + displacement;
1926+ case 5:
1927+ DECODE_PRINTF2("%d[EBP]", displacement);
1928+ return M.x86.R_EBP + displacement;
1929+ case 6:
1930+ DECODE_PRINTF2("%d[ESI]", displacement);
1931+ return M.x86.R_ESI + displacement;
1932+ case 7:
1933+ DECODE_PRINTF2("%d[EDI]", displacement);
1934+ return M.x86.R_EDI + displacement;
1935+ }
1936+ HALT_SYS();
1937+ }
1938+ else {
1939 /* 16-bit addressing */
1940- switch (rm) {
1941- case 0:
1942- DECODE_PRINTF2("%d[BX+SI]", displacement);
1943+ switch (rm) {
1944+ case 0:
1945+ DECODE_PRINTF2("%d[BX+SI]", displacement);
1946 return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
1947- case 1:
1948- DECODE_PRINTF2("%d[BX+DI]", displacement);
1949+ case 1:
1950+ DECODE_PRINTF2("%d[BX+DI]", displacement);
1951 return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
1952- case 2:
1953- DECODE_PRINTF2("%d[BP+SI]", displacement);
1954- M.x86.mode |= SYSMODE_SEG_DS_SS;
1955+ case 2:
1956+ DECODE_PRINTF2("%d[BP+SI]", displacement);
1957+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1958 return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
1959- case 3:
1960- DECODE_PRINTF2("%d[BP+DI]", displacement);
1961- M.x86.mode |= SYSMODE_SEG_DS_SS;
1962+ case 3:
1963+ DECODE_PRINTF2("%d[BP+DI]", displacement);
1964+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1965 return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
1966- case 4:
1967- DECODE_PRINTF2("%d[SI]", displacement);
1968+ case 4:
1969+ DECODE_PRINTF2("%d[SI]", displacement);
1970 return (M.x86.R_SI + displacement) & 0xffff;
1971- case 5:
1972- DECODE_PRINTF2("%d[DI]", displacement);
1973+ case 5:
1974+ DECODE_PRINTF2("%d[DI]", displacement);
1975 return (M.x86.R_DI + displacement) & 0xffff;
1976- case 6:
1977- DECODE_PRINTF2("%d[BP]", displacement);
1978- M.x86.mode |= SYSMODE_SEG_DS_SS;
1979+ case 6:
1980+ DECODE_PRINTF2("%d[BP]", displacement);
1981+ M.x86.mode |= SYSMODE_SEG_DS_SS;
1982 return (M.x86.R_BP + displacement) & 0xffff;
1983- case 7:
1984- DECODE_PRINTF2("%d[BX]", displacement);
1985+ case 7:
1986+ DECODE_PRINTF2("%d[BX]", displacement);
1987 return (M.x86.R_BX + displacement) & 0xffff;
1988- }
1989- HALT_SYS();
1990+ }
1991+ HALT_SYS();
1992 }
1993 return 0; /* SHOULD NOT HAPPEN */
1994 }
1995@@ -1007,86 +1005,87 @@ REMARKS:
1996 Return the offset given by mod=10 addressing. Also enables the
1997 decoding of instructions.
1998 ****************************************************************************/
1999-u32 decode_rm10_address(
2000- int rm)
2001+u32
2002+decode_rm10_address(int rm)
2003 {
2004 u32 displacement = 0;
2005 int sib;
2006
2007 /* Fetch disp16 if 16-bit addr mode */
2008 if (!(M.x86.mode & SYSMODE_PREFIX_ADDR))
2009- displacement = (u16)fetch_word_imm();
2010+ displacement = (u16) fetch_word_imm();
2011 else {
2012- /* Fetch disp32 if no SIB byte */
2013- if (rm != 4)
2014- displacement = (u32)fetch_long_imm();
2015+ /* Fetch disp32 if no SIB byte */
2016+ if (rm != 4)
2017+ displacement = (u32) fetch_long_imm();
2018 }
2019
2020 if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
2021 /* 32-bit addressing */
2022- switch (rm) {
2023- case 0:
2024- DECODE_PRINTF2("%08x[EAX]", displacement);
2025- return M.x86.R_EAX + displacement;
2026- case 1:
2027- DECODE_PRINTF2("%08x[ECX]", displacement);
2028- return M.x86.R_ECX + displacement;
2029- case 2:
2030- DECODE_PRINTF2("%08x[EDX]", displacement);
2031- M.x86.mode |= SYSMODE_SEG_DS_SS;
2032- return M.x86.R_EDX + displacement;
2033- case 3:
2034- DECODE_PRINTF2("%08x[EBX]", displacement);
2035- return M.x86.R_EBX + displacement;
2036- case 4:
2037- sib = fetch_byte_imm();
2038- displacement = (u32)fetch_long_imm();
2039- DECODE_PRINTF2("%08x", displacement);
2040- return decode_sib_address(sib, 2) + displacement;
2041- break;
2042- case 5:
2043- DECODE_PRINTF2("%08x[EBP]", displacement);
2044- return M.x86.R_EBP + displacement;
2045- case 6:
2046- DECODE_PRINTF2("%08x[ESI]", displacement);
2047- return M.x86.R_ESI + displacement;
2048- case 7:
2049- DECODE_PRINTF2("%08x[EDI]", displacement);
2050- return M.x86.R_EDI + displacement;
2051- }
2052- HALT_SYS();
2053- } else {
2054+ switch (rm) {
2055+ case 0:
2056+ DECODE_PRINTF2("%08x[EAX]", displacement);
2057+ return M.x86.R_EAX + displacement;
2058+ case 1:
2059+ DECODE_PRINTF2("%08x[ECX]", displacement);
2060+ return M.x86.R_ECX + displacement;
2061+ case 2:
2062+ DECODE_PRINTF2("%08x[EDX]", displacement);
2063+ M.x86.mode |= SYSMODE_SEG_DS_SS;
2064+ return M.x86.R_EDX + displacement;
2065+ case 3:
2066+ DECODE_PRINTF2("%08x[EBX]", displacement);
2067+ return M.x86.R_EBX + displacement;
2068+ case 4:
2069+ sib = fetch_byte_imm();
2070+ displacement = (u32) fetch_long_imm();
2071+ DECODE_PRINTF2("%08x", displacement);
2072+ return decode_sib_address(sib, 2) + displacement;
2073+ break;
2074+ case 5:
2075+ DECODE_PRINTF2("%08x[EBP]", displacement);
2076+ return M.x86.R_EBP + displacement;
2077+ case 6:
2078+ DECODE_PRINTF2("%08x[ESI]", displacement);
2079+ return M.x86.R_ESI + displacement;
2080+ case 7:
2081+ DECODE_PRINTF2("%08x[EDI]", displacement);
2082+ return M.x86.R_EDI + displacement;
2083+ }
2084+ HALT_SYS();
2085+ }
2086+ else {
2087 /* 16-bit addressing */
2088- switch (rm) {
2089- case 0:
2090+ switch (rm) {
2091+ case 0:
2092 DECODE_PRINTF2("%04x[BX+SI]", displacement);
2093 return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
2094- case 1:
2095+ case 1:
2096 DECODE_PRINTF2("%04x[BX+DI]", displacement);
2097 return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
2098- case 2:
2099- DECODE_PRINTF2("%04x[BP+SI]", displacement);
2100- M.x86.mode |= SYSMODE_SEG_DS_SS;
2101+ case 2:
2102+ DECODE_PRINTF2("%04x[BP+SI]", displacement);
2103+ M.x86.mode |= SYSMODE_SEG_DS_SS;
2104 return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
2105- case 3:
2106- DECODE_PRINTF2("%04x[BP+DI]", displacement);
2107- M.x86.mode |= SYSMODE_SEG_DS_SS;
2108+ case 3:
2109+ DECODE_PRINTF2("%04x[BP+DI]", displacement);
2110+ M.x86.mode |= SYSMODE_SEG_DS_SS;
2111 return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
2112- case 4:
2113+ case 4:
2114 DECODE_PRINTF2("%04x[SI]", displacement);
2115 return (M.x86.R_SI + displacement) & 0xffff;
2116- case 5:
2117+ case 5:
2118 DECODE_PRINTF2("%04x[DI]", displacement);
2119 return (M.x86.R_DI + displacement) & 0xffff;
2120- case 6:
2121- DECODE_PRINTF2("%04x[BP]", displacement);
2122- M.x86.mode |= SYSMODE_SEG_DS_SS;
2123+ case 6:
2124+ DECODE_PRINTF2("%04x[BP]", displacement);
2125+ M.x86.mode |= SYSMODE_SEG_DS_SS;
2126 return (M.x86.R_BP + displacement) & 0xffff;
2127- case 7:
2128+ case 7:
2129 DECODE_PRINTF2("%04x[BX]", displacement);
2130 return (M.x86.R_BX + displacement) & 0xffff;
2131- }
2132- HALT_SYS();
2133+ }
2134+ HALT_SYS();
2135 }
2136 return 0;
2137 /*NOTREACHED */
2138diff --git a/libs/x86emu/fpu.c b/libs/x86emu/fpu.c
2139index b72de1e..0dab05c 100644
2140--- a/libs/x86emu/fpu.c
2141+++ b/libs/x86emu/fpu.c
2142@@ -42,7 +42,8 @@
2143 /*----------------------------- Implementation ----------------------------*/
2144
2145 /* opcode=0xd8 */
2146-void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
2147+void
2148+x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
2149 {
2150 START_OF_INSTR();
2151 DECODE_PRINTF("ESC D8\n");
2152@@ -52,7 +53,7 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
2153
2154 #ifdef DEBUG
2155
2156-static char *x86emu_fpu_op_d9_tab[] = {
2157+static const char *x86emu_fpu_op_d9_tab[] = {
2158 "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
2159 "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
2160
2161@@ -63,7 +64,7 @@ static char *x86emu_fpu_op_d9_tab[] = {
2162 "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
2163 };
2164
2165-static char *x86emu_fpu_op_d9_tab1[] = {
2166+static const char *x86emu_fpu_op_d9_tab1[] = {
2167 "FLD\t", "FLD\t", "FLD\t", "FLD\t",
2168 "FLD\t", "FLD\t", "FLD\t", "FLD\t",
2169
2170@@ -89,10 +90,11 @@ static char *x86emu_fpu_op_d9_tab1[] = {
2171 "FRNDINT", "FSCALE", "ESC_D9", "ESC_D9",
2172 };
2173
2174-#endif /* DEBUG */
2175+#endif /* DEBUG */
2176
2177 /* opcode=0xd9 */
2178-void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
2179+void
2180+x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
2181 {
2182 int mod, rl, rh;
2183 uint destoffset = 0;
2184@@ -103,56 +105,58 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
2185 #ifdef DEBUG
2186 if (mod != 3) {
2187 DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
2188- } else {
2189+ }
2190+ else {
2191 DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
2192 }
2193 #endif
2194 switch (mod) {
2195- case 0:
2196+ case 0:
2197 destoffset = decode_rm00_address(rl);
2198 DECODE_PRINTF("\n");
2199 break;
2200- case 1:
2201+ case 1:
2202 destoffset = decode_rm01_address(rl);
2203 DECODE_PRINTF("\n");
2204 break;
2205- case 2:
2206+ case 2:
2207 destoffset = decode_rm10_address(rl);
2208 DECODE_PRINTF("\n");
2209 break;
2210- case 3: /* register to register */
2211- stkelem = (u8)rl;
2212- if (rh < 4) {
2213- DECODE_PRINTF2("ST(%d)\n", stkelem);
2214- } else {
2215- DECODE_PRINTF("\n");
2216- }
2217+ case 3: /* register to register */
2218+ stkelem = (u8) rl;
2219+ if (rh < 4) {
2220+ DECODE_PRINTF2("ST(%d)\n", stkelem);
2221+ }
2222+ else {
2223+ DECODE_PRINTF("\n");
2224+ }
2225 break;
2226 }
2227 #ifdef X86EMU_FPU_PRESENT
2228 /* execute */
2229 switch (mod) {
2230- case 3:
2231+ case 3:
2232 switch (rh) {
2233- case 0:
2234+ case 0:
2235 x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
2236 break;
2237- case 1:
2238+ case 1:
2239 x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
2240 break;
2241- case 2:
2242+ case 2:
2243 switch (rl) {
2244- case 0:
2245+ case 0:
2246 x86emu_fpu_R_nop();
2247 break;
2248- default:
2249+ default:
2250 x86emu_fpu_illegal();
2251 break;
2252 }
2253- case 3:
2254+ case 3:
2255 x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
2256 break;
2257- case 4:
2258+ case 4:
2259 switch (rl) {
2260 case 0:
2261 x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
2262@@ -173,133 +177,133 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
2263 }
2264 break;
2265
2266- case 5:
2267+ case 5:
2268 switch (rl) {
2269- case 0:
2270+ case 0:
2271 x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
2272 break;
2273- case 1:
2274+ case 1:
2275 x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
2276 break;
2277- case 2:
2278+ case 2:
2279 x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
2280 break;
2281- case 3:
2282+ case 3:
2283 x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
2284 break;
2285- case 4:
2286+ case 4:
2287 x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
2288 break;
2289- case 5:
2290+ case 5:
2291 x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
2292 break;
2293- case 6:
2294+ case 6:
2295 x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
2296 break;
2297- default:
2298+ default:
2299 /* 7 */
2300 x86emu_fpu_illegal();
2301 break;
2302 }
2303 break;
2304
2305- case 6:
2306+ case 6:
2307 switch (rl) {
2308- case 0:
2309+ case 0:
2310 x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
2311 break;
2312- case 1:
2313+ case 1:
2314 x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
2315 break;
2316- case 2:
2317+ case 2:
2318 x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
2319 break;
2320- case 3:
2321+ case 3:
2322 x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
2323 break;
2324- case 4:
2325+ case 4:
2326 x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
2327 break;
2328- case 5:
2329+ case 5:
2330 x86emu_fpu_illegal();
2331 break;
2332- case 6:
2333+ case 6:
2334 x86emu_fpu_R_decstp();
2335 break;
2336- case 7:
2337+ case 7:
2338 x86emu_fpu_R_incstp();
2339 break;
2340 }
2341 break;
2342
2343- case 7:
2344+ case 7:
2345 switch (rl) {
2346- case 0:
2347+ case 0:
2348 x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
2349 break;
2350- case 1:
2351+ case 1:
2352 x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
2353 break;
2354- case 2:
2355+ case 2:
2356 x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
2357 break;
2358- case 3:
2359+ case 3:
2360 x86emu_fpu_illegal();
2361 break;
2362- case 4:
2363+ case 4:
2364 x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
2365 break;
2366- case 5:
2367+ case 5:
2368 x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
2369 break;
2370- case 6:
2371- case 7:
2372- default:
2373+ case 6:
2374+ case 7:
2375+ default:
2376 x86emu_fpu_illegal();
2377 break;
2378 }
2379 break;
2380
2381- default:
2382+ default:
2383 switch (rh) {
2384- case 0:
2385+ case 0:
2386 x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
2387 break;
2388- case 1:
2389+ case 1:
2390 x86emu_fpu_illegal();
2391 break;
2392- case 2:
2393+ case 2:
2394 x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
2395 break;
2396- case 3:
2397+ case 3:
2398 x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
2399 break;
2400- case 4:
2401+ case 4:
2402 x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
2403 break;
2404- case 5:
2405+ case 5:
2406 x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
2407 break;
2408- case 6:
2409+ case 6:
2410 x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
2411 break;
2412- case 7:
2413+ case 7:
2414 x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
2415 break;
2416 }
2417 }
2418 }
2419 #else
2420- (void)destoffset;
2421- (void)stkelem;
2422-#endif /* X86EMU_FPU_PRESENT */
2423+ (void) destoffset;
2424+ (void) stkelem;
2425+#endif /* X86EMU_FPU_PRESENT */
2426 DECODE_CLEAR_SEGOVR();
2427 END_OF_INSTR_NO_TRACE();
2428 }
2429
2430 #ifdef DEBUG
2431
2432-char *x86emu_fpu_op_da_tab[] = {
2433+static const char *x86emu_fpu_op_da_tab[] = {
2434 "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
2435 "FICOMP\tDWORD PTR ",
2436 "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
2437@@ -309,7 +313,7 @@ char *x86emu_fpu_op_da_tab[] = {
2438 "FICOMP\tDWORD PTR ",
2439 "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
2440 "FIDIVR\tDWORD PTR ",
2441-
2442+
2443 "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
2444 "FICOMP\tDWORD PTR ",
2445 "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
2446@@ -319,10 +323,11 @@ char *x86emu_fpu_op_da_tab[] = {
2447 "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ",
2448 };
2449
2450-#endif /* DEBUG */
2451+#endif /* DEBUG */
2452
2453 /* opcode=0xda */
2454-void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
2455+void
2456+x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
2457 {
2458 int mod, rl, rh;
2459 uint destoffset = 0;
2460@@ -332,59 +337,59 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
2461 FETCH_DECODE_MODRM(mod, rh, rl);
2462 DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
2463 switch (mod) {
2464- case 0:
2465+ case 0:
2466 destoffset = decode_rm00_address(rl);
2467 DECODE_PRINTF("\n");
2468 break;
2469- case 1:
2470+ case 1:
2471 destoffset = decode_rm01_address(rl);
2472 DECODE_PRINTF("\n");
2473 break;
2474- case 2:
2475+ case 2:
2476 destoffset = decode_rm10_address(rl);
2477 DECODE_PRINTF("\n");
2478 break;
2479- case 3: /* register to register */
2480- stkelem = (u8)rl;
2481+ case 3: /* register to register */
2482+ stkelem = (u8) rl;
2483 DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
2484 break;
2485 }
2486 #ifdef X86EMU_FPU_PRESENT
2487 switch (mod) {
2488- case 3:
2489+ case 3:
2490 x86emu_fpu_illegal();
2491 break;
2492- default:
2493+ default:
2494 switch (rh) {
2495- case 0:
2496+ case 0:
2497 x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
2498 break;
2499- case 1:
2500+ case 1:
2501 x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
2502 break;
2503- case 2:
2504+ case 2:
2505 x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
2506 break;
2507- case 3:
2508+ case 3:
2509 x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
2510 break;
2511- case 4:
2512+ case 4:
2513 x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
2514 break;
2515- case 5:
2516+ case 5:
2517 x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
2518 break;
2519- case 6:
2520+ case 6:
2521 x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
2522 break;
2523- case 7:
2524+ case 7:
2525 x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
2526 break;
2527 }
2528 }
2529 #else
2530- (void)destoffset;
2531- (void)stkelem;
2532+ (void) destoffset;
2533+ (void) stkelem;
2534 #endif
2535 DECODE_CLEAR_SEGOVR();
2536 END_OF_INSTR_NO_TRACE();
2537@@ -392,7 +397,7 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
2538
2539 #ifdef DEBUG
2540
2541-char *x86emu_fpu_op_db_tab[] = {
2542+static const char *x86emu_fpu_op_db_tab[] = {
2543 "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
2544 "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
2545
2546@@ -403,10 +408,11 @@ char *x86emu_fpu_op_db_tab[] = {
2547 "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
2548 };
2549
2550-#endif /* DEBUG */
2551+#endif /* DEBUG */
2552
2553 /* opcode=0xdb */
2554-void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
2555+void
2556+x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
2557 {
2558 int mod, rl, rh;
2559 uint destoffset = 0;
2560@@ -416,104 +422,106 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
2561 #ifdef DEBUG
2562 if (mod != 3) {
2563 DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
2564- } else if (rh == 4) { /* === 11 10 0 nnn */
2565+ }
2566+ else if (rh == 4) { /* === 11 10 0 nnn */
2567 switch (rl) {
2568- case 0:
2569+ case 0:
2570 DECODE_PRINTF("FENI\n");
2571 break;
2572- case 1:
2573+ case 1:
2574 DECODE_PRINTF("FDISI\n");
2575 break;
2576- case 2:
2577+ case 2:
2578 DECODE_PRINTF("FCLEX\n");
2579 break;
2580- case 3:
2581+ case 3:
2582 DECODE_PRINTF("FINIT\n");
2583 break;
2584 }
2585- } else {
2586+ }
2587+ else {
2588 DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
2589 }
2590-#endif /* DEBUG */
2591+#endif /* DEBUG */
2592 switch (mod) {
2593- case 0:
2594+ case 0:
2595 destoffset = decode_rm00_address(rl);
2596 break;
2597- case 1:
2598+ case 1:
2599 destoffset = decode_rm01_address(rl);
2600 break;
2601- case 2:
2602+ case 2:
2603 destoffset = decode_rm10_address(rl);
2604 break;
2605- case 3: /* register to register */
2606+ case 3: /* register to register */
2607 break;
2608 }
2609 #ifdef X86EMU_FPU_PRESENT
2610 /* execute */
2611 switch (mod) {
2612- case 3:
2613+ case 3:
2614 switch (rh) {
2615- case 4:
2616+ case 4:
2617 switch (rl) {
2618- case 0:
2619+ case 0:
2620 x86emu_fpu_R_feni();
2621 break;
2622- case 1:
2623+ case 1:
2624 x86emu_fpu_R_fdisi();
2625 break;
2626- case 2:
2627+ case 2:
2628 x86emu_fpu_R_fclex();
2629 break;
2630- case 3:
2631+ case 3:
2632 x86emu_fpu_R_finit();
2633 break;
2634- default:
2635+ default:
2636 x86emu_fpu_illegal();
2637 break;
2638 }
2639 break;
2640- default:
2641+ default:
2642 x86emu_fpu_illegal();
2643 break;
2644 }
2645 break;
2646- default:
2647+ default:
2648 switch (rh) {
2649- case 0:
2650+ case 0:
2651 x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
2652 break;
2653- case 1:
2654+ case 1:
2655 x86emu_fpu_illegal();
2656 break;
2657- case 2:
2658+ case 2:
2659 x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
2660 break;
2661- case 3:
2662+ case 3:
2663 x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
2664 break;
2665- case 4:
2666+ case 4:
2667 x86emu_fpu_illegal();
2668 break;
2669- case 5:
2670+ case 5:
2671 x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
2672 break;
2673- case 6:
2674+ case 6:
2675 x86emu_fpu_illegal();
2676 break;
2677- case 7:
2678+ case 7:
2679 x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
2680 break;
2681 }
2682 }
2683 #else
2684- (void)destoffset;
2685+ (void) destoffset;
2686 #endif
2687 DECODE_CLEAR_SEGOVR();
2688 END_OF_INSTR_NO_TRACE();
2689 }
2690
2691 #ifdef DEBUG
2692-char *x86emu_fpu_op_dc_tab[] = {
2693+static const char *x86emu_fpu_op_dc_tab[] = {
2694 "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
2695 "FCOMP\tQWORD PTR ",
2696 "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
2697@@ -532,10 +540,11 @@ char *x86emu_fpu_op_dc_tab[] = {
2698 "FADD\t", "FMUL\t", "FCOM\t", "FCOMP\t",
2699 "FSUBR\t", "FSUB\t", "FDIVR\t", "FDIV\t",
2700 };
2701-#endif /* DEBUG */
2702+#endif /* DEBUG */
2703
2704 /* opcode=0xdc */
2705-void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
2706+void
2707+x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
2708 {
2709 int mod, rl, rh;
2710 uint destoffset = 0;
2711@@ -545,85 +554,85 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
2712 FETCH_DECODE_MODRM(mod, rh, rl);
2713 DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
2714 switch (mod) {
2715- case 0:
2716+ case 0:
2717 destoffset = decode_rm00_address(rl);
2718 DECODE_PRINTF("\n");
2719 break;
2720- case 1:
2721+ case 1:
2722 destoffset = decode_rm01_address(rl);
2723 DECODE_PRINTF("\n");
2724 break;
2725- case 2:
2726+ case 2:
2727 destoffset = decode_rm10_address(rl);
2728 DECODE_PRINTF("\n");
2729 break;
2730- case 3: /* register to register */
2731- stkelem = (u8)rl;
2732+ case 3: /* register to register */
2733+ stkelem = (u8) rl;
2734 DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
2735 break;
2736 }
2737 #ifdef X86EMU_FPU_PRESENT
2738 /* execute */
2739 switch (mod) {
2740- case 3:
2741+ case 3:
2742 switch (rh) {
2743- case 0:
2744+ case 0:
2745 x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
2746 break;
2747- case 1:
2748+ case 1:
2749 x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
2750 break;
2751- case 2:
2752+ case 2:
2753 x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
2754 break;
2755- case 3:
2756+ case 3:
2757 x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
2758 break;
2759- case 4:
2760+ case 4:
2761 x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
2762 break;
2763- case 5:
2764+ case 5:
2765 x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
2766 break;
2767- case 6:
2768+ case 6:
2769 x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
2770 break;
2771- case 7:
2772+ case 7:
2773 x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
2774 break;
2775 }
2776 break;
2777- default:
2778+ default:
2779 switch (rh) {
2780- case 0:
2781+ case 0:
2782 x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
2783 break;
2784- case 1:
2785+ case 1:
2786 x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
2787 break;
2788- case 2:
2789+ case 2:
2790 x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
2791 break;
2792- case 3:
2793+ case 3:
2794 x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
2795 break;
2796- case 4:
2797+ case 4:
2798 x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
2799 break;
2800- case 5:
2801+ case 5:
2802 x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
2803 break;
2804- case 6:
2805+ case 6:
2806 x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
2807 break;
2808- case 7:
2809+ case 7:
2810 x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
2811 break;
2812 }
2813 }
2814 #else
2815- (void)destoffset;
2816- (void)stkelem;
2817+ (void) destoffset;
2818+ (void) stkelem;
2819 #endif
2820 DECODE_CLEAR_SEGOVR();
2821 END_OF_INSTR_NO_TRACE();
2822@@ -631,7 +640,7 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
2823
2824 #ifdef DEBUG
2825
2826-static char *x86emu_fpu_op_dd_tab[] = {
2827+static const char *x86emu_fpu_op_dd_tab[] = {
2828 "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
2829 "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
2830
2831@@ -645,10 +654,11 @@ static char *x86emu_fpu_op_dd_tab[] = {
2832 "ESC_DD\t2C,", "ESC_DD\t2D,", "ESC_DD\t2E,", "ESC_DD\t2F,",
2833 };
2834
2835-#endif /* DEBUG */
2836+#endif /* DEBUG */
2837
2838 /* opcode=0xdd */
2839-void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
2840+void
2841+x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
2842 {
2843 int mod, rl, rh;
2844 uint destoffset = 0;
2845@@ -658,75 +668,75 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
2846 FETCH_DECODE_MODRM(mod, rh, rl);
2847 DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
2848 switch (mod) {
2849- case 0:
2850+ case 0:
2851 destoffset = decode_rm00_address(rl);
2852 DECODE_PRINTF("\n");
2853 break;
2854- case 1:
2855+ case 1:
2856 destoffset = decode_rm01_address(rl);
2857 DECODE_PRINTF("\n");
2858 break;
2859- case 2:
2860+ case 2:
2861 destoffset = decode_rm10_address(rl);
2862 DECODE_PRINTF("\n");
2863 break;
2864- case 3: /* register to register */
2865- stkelem = (u8)rl;
2866+ case 3: /* register to register */
2867+ stkelem = (u8) rl;
2868 DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
2869 break;
2870 }
2871 #ifdef X86EMU_FPU_PRESENT
2872 switch (mod) {
2873- case 3:
2874+ case 3:
2875 switch (rh) {
2876- case 0:
2877+ case 0:
2878 x86emu_fpu_R_ffree(stkelem);
2879 break;
2880- case 1:
2881+ case 1:
2882 x86emu_fpu_R_fxch(stkelem);
2883 break;
2884- case 2:
2885+ case 2:
2886 x86emu_fpu_R_fst(stkelem); /* register version */
2887 break;
2888- case 3:
2889+ case 3:
2890 x86emu_fpu_R_fstp(stkelem); /* register version */
2891 break;
2892- default:
2893+ default:
2894 x86emu_fpu_illegal();
2895 break;
2896 }
2897 break;
2898- default:
2899+ default:
2900 switch (rh) {
2901- case 0:
2902+ case 0:
2903 x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
2904 break;
2905- case 1:
2906+ case 1:
2907 x86emu_fpu_illegal();
2908 break;
2909- case 2:
2910+ case 2:
2911 x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
2912 break;
2913- case 3:
2914+ case 3:
2915 x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
2916 break;
2917- case 4:
2918+ case 4:
2919 x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
2920 break;
2921- case 5:
2922+ case 5:
2923 x86emu_fpu_illegal();
2924 break;
2925- case 6:
2926+ case 6:
2927 x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
2928 break;
2929- case 7:
2930+ case 7:
2931 x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
2932 break;
2933 }
2934 }
2935 #else
2936- (void)destoffset;
2937- (void)stkelem;
2938+ (void) destoffset;
2939+ (void) stkelem;
2940 #endif
2941 DECODE_CLEAR_SEGOVR();
2942 END_OF_INSTR_NO_TRACE();
2943@@ -734,8 +744,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
2944
2945 #ifdef DEBUG
2946
2947-static char *x86emu_fpu_op_de_tab[] =
2948-{
2949+static const char *x86emu_fpu_op_de_tab[] = {
2950 "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
2951 "FICOMP\tWORD PTR ",
2952 "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
2953@@ -755,10 +764,11 @@ static char *x86emu_fpu_op_de_tab[] =
2954 "FSUBRP\t", "FSUBP\t", "FDIVRP\t", "FDIVP\t",
2955 };
2956
2957-#endif /* DEBUG */
2958+#endif /* DEBUG */
2959
2960 /* opcode=0xde */
2961-void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
2962+void
2963+x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
2964 {
2965 int mod, rl, rh;
2966 uint destoffset = 0;
2967@@ -768,87 +778,87 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
2968 FETCH_DECODE_MODRM(mod, rh, rl);
2969 DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
2970 switch (mod) {
2971- case 0:
2972+ case 0:
2973 destoffset = decode_rm00_address(rl);
2974 DECODE_PRINTF("\n");
2975 break;
2976- case 1:
2977+ case 1:
2978 destoffset = decode_rm01_address(rl);
2979 DECODE_PRINTF("\n");
2980 break;
2981- case 2:
2982+ case 2:
2983 destoffset = decode_rm10_address(rl);
2984 DECODE_PRINTF("\n");
2985 break;
2986- case 3: /* register to register */
2987- stkelem = (u8)rl;
2988+ case 3: /* register to register */
2989+ stkelem = (u8) rl;
2990 DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
2991 break;
2992 }
2993 #ifdef X86EMU_FPU_PRESENT
2994 switch (mod) {
2995- case 3:
2996+ case 3:
2997 switch (rh) {
2998- case 0:
2999+ case 0:
3000 x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
3001 break;
3002- case 1:
3003+ case 1:
3004 x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
3005 break;
3006- case 2:
3007+ case 2:
3008 x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
3009 break;
3010- case 3:
3011+ case 3:
3012 if (stkelem == 1)
3013- x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
3014+ x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
3015 else
3016- x86emu_fpu_illegal();
3017+ x86emu_fpu_illegal();
3018 break;
3019- case 4:
3020+ case 4:
3021 x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
3022 break;
3023- case 5:
3024+ case 5:
3025 x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
3026 break;
3027- case 6:
3028+ case 6:
3029 x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
3030 break;
3031- case 7:
3032+ case 7:
3033 x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
3034 break;
3035 }
3036 break;
3037- default:
3038+ default:
3039 switch (rh) {
3040- case 0:
3041+ case 0:
3042 x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
3043 break;
3044- case 1:
3045+ case 1:
3046 x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
3047 break;
3048- case 2:
3049+ case 2:
3050 x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
3051 break;
3052- case 3:
3053+ case 3:
3054 x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
3055 break;
3056- case 4:
3057+ case 4:
3058 x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
3059 break;
3060- case 5:
3061+ case 5:
3062 x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
3063 break;
3064- case 6:
3065+ case 6:
3066 x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
3067 break;
3068- case 7:
3069+ case 7:
3070 x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
3071 break;
3072 }
3073 }
3074 #else
3075- (void)destoffset;
3076- (void)stkelem;
3077+ (void) destoffset;
3078+ (void) stkelem;
3079 #endif
3080 DECODE_CLEAR_SEGOVR();
3081 END_OF_INSTR_NO_TRACE();
3082@@ -856,7 +866,7 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
3083
3084 #ifdef DEBUG
3085
3086-static char *x86emu_fpu_op_df_tab[] = {
3087+static const char *x86emu_fpu_op_df_tab[] = {
3088 /* mod == 00 */
3089 "FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
3090 "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
3091@@ -877,10 +887,11 @@ static char *x86emu_fpu_op_df_tab[] = {
3092 "ESC_DF\t3C,", "ESC_DF\t3D,", "ESC_DF\t3E,", "ESC_DF\t3F,"
3093 };
3094
3095-#endif /* DEBUG */
3096+#endif /* DEBUG */
3097
3098 /* opcode=0xdf */
3099-void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
3100+void
3101+x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
3102 {
3103 int mod, rl, rh;
3104 uint destoffset = 0;
3105@@ -890,75 +901,75 @@ void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
3106 FETCH_DECODE_MODRM(mod, rh, rl);
3107 DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
3108 switch (mod) {
3109- case 0:
3110+ case 0:
3111 destoffset = decode_rm00_address(rl);
3112 DECODE_PRINTF("\n");
3113 break;
3114- case 1:
3115+ case 1:
3116 destoffset = decode_rm01_address(rl);
3117 DECODE_PRINTF("\n");
3118 break;
3119- case 2:
3120+ case 2:
3121 destoffset = decode_rm10_address(rl);
3122 DECODE_PRINTF("\n");
3123 break;
3124- case 3: /* register to register */
3125- stkelem = (u8)rl;
3126+ case 3: /* register to register */
3127+ stkelem = (u8) rl;
3128 DECODE_PRINTF2("\tST(%d)\n", stkelem);
3129 break;
3130 }
3131 #ifdef X86EMU_FPU_PRESENT
3132 switch (mod) {
3133- case 3:
3134+ case 3:
3135 switch (rh) {
3136- case 0:
3137+ case 0:
3138 x86emu_fpu_R_ffree(stkelem);
3139 break;
3140- case 1:
3141+ case 1:
3142 x86emu_fpu_R_fxch(stkelem);
3143 break;
3144- case 2:
3145+ case 2:
3146 x86emu_fpu_R_fst(stkelem); /* register version */
3147 break;
3148- case 3:
3149+ case 3:
3150 x86emu_fpu_R_fstp(stkelem); /* register version */
3151 break;
3152- default:
3153+ default:
3154 x86emu_fpu_illegal();
3155 break;
3156 }
3157 break;
3158- default:
3159+ default:
3160 switch (rh) {
3161- case 0:
3162+ case 0:
3163 x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
3164 break;
3165- case 1:
3166+ case 1:
3167 x86emu_fpu_illegal();
3168 break;
3169- case 2:
3170+ case 2:
3171 x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
3172 break;
3173- case 3:
3174+ case 3:
3175 x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
3176 break;
3177- case 4:
3178+ case 4:
3179 x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
3180 break;
3181- case 5:
3182+ case 5:
3183 x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
3184 break;
3185- case 6:
3186+ case 6:
3187 x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
3188 break;
3189- case 7:
3190+ case 7:
3191 x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
3192 break;
3193 }
3194 }
3195 #else
3196- (void)destoffset;
3197- (void)stkelem;
3198+ (void) destoffset;
3199+ (void) stkelem;
3200 #endif
3201 DECODE_CLEAR_SEGOVR();
3202 END_OF_INSTR_NO_TRACE();
3203diff --git a/libs/x86emu/ops.c b/libs/x86emu/ops.c
3204index 4f504c9..76b8358 100644
3205--- a/libs/x86emu/ops.c
3206+++ b/libs/x86emu/ops.c
3207@@ -81,17 +81,17 @@ op1 - Instruction op code
3208 REMARKS:
3209 Handles illegal opcodes.
3210 ****************************************************************************/
3211-static void x86emuOp_illegal_op(
3212- u8 op1)
3213+static void
3214+x86emuOp_illegal_op(u8 op1)
3215 {
3216 START_OF_INSTR();
3217 if (M.x86.R_SP != 0) {
3218- DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
3219- TRACE_REGS();
3220- printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
3221- M.x86.R_CS, M.x86.R_IP-1,op1);
3222- HALT_SYS();
3223- }
3224+ DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
3225+ TRACE_REGS();
3226+ DB(printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
3227+ M.x86.R_CS, M.x86.R_IP - 1, op1));
3228+ HALT_SYS();
3229+ }
3230 else {
3231 /* If we get here, it means the stack pointer is back to zero
3232 * so we are just returning from an emulator service call
3233@@ -100,7 +100,7 @@ static void x86emuOp_illegal_op(
3234 * call.
3235 */
3236 X86EMU_halt_sys();
3237- }
3238+ }
3239 END_OF_INSTR();
3240 }
3241
3242@@ -108,7 +108,8 @@ static void x86emuOp_illegal_op(
3243 REMARKS:
3244 Handles opcode 0x00
3245 ****************************************************************************/
3246-static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
3247+static void
3248+x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
3249 {
3250 int mod, rl, rh;
3251 uint destoffset;
3252@@ -149,7 +150,7 @@ static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
3253 destval = add_byte(destval, *srcreg);
3254 store_data_byte(destoffset, destval);
3255 break;
3256- case 3: /* register to register */
3257+ case 3: /* register to register */
3258 destreg = DECODE_RM_BYTE_REGISTER(rl);
3259 DECODE_PRINTF(",");
3260 srcreg = DECODE_RM_BYTE_REGISTER(rh);
3261@@ -166,7 +167,8 @@ static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
3262 REMARKS:
3263 Handles opcode 0x01
3264 ****************************************************************************/
3265-static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3266+static void
3267+x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3268 {
3269 int mod, rl, rh;
3270 uint destoffset;
3271@@ -188,7 +190,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3272 TRACE_AND_STEP();
3273 destval = add_long(destval, *srcreg);
3274 store_data_long(destoffset, destval);
3275- } else {
3276+ }
3277+ else {
3278 u16 destval;
3279 u16 *srcreg;
3280
3281@@ -215,7 +218,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3282 TRACE_AND_STEP();
3283 destval = add_long(destval, *srcreg);
3284 store_data_long(destoffset, destval);
3285- } else {
3286+ }
3287+ else {
3288 u16 destval;
3289 u16 *srcreg;
3290
3291@@ -242,7 +246,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3292 TRACE_AND_STEP();
3293 destval = add_long(destval, *srcreg);
3294 store_data_long(destoffset, destval);
3295- } else {
3296+ }
3297+ else {
3298 u16 destval;
3299 u16 *srcreg;
3300
3301@@ -256,9 +261,9 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3302 store_data_word(destoffset, destval);
3303 }
3304 break;
3305- case 3: /* register to register */
3306+ case 3: /* register to register */
3307 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3308- u32 *destreg,*srcreg;
3309+ u32 *destreg, *srcreg;
3310
3311 destreg = DECODE_RM_LONG_REGISTER(rl);
3312 DECODE_PRINTF(",");
3313@@ -266,8 +271,9 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3314 DECODE_PRINTF("\n");
3315 TRACE_AND_STEP();
3316 *destreg = add_long(*destreg, *srcreg);
3317- } else {
3318- u16 *destreg,*srcreg;
3319+ }
3320+ else {
3321+ u16 *destreg, *srcreg;
3322
3323 destreg = DECODE_RM_WORD_REGISTER(rl);
3324 DECODE_PRINTF(",");
3325@@ -286,7 +292,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
3326 REMARKS:
3327 Handles opcode 0x02
3328 ****************************************************************************/
3329-static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
3330+static void
3331+x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
3332 {
3333 int mod, rl, rh;
3334 u8 *destreg, *srcreg;
3335@@ -324,7 +331,7 @@ static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
3336 TRACE_AND_STEP();
3337 *destreg = add_byte(*destreg, srcval);
3338 break;
3339- case 3: /* register to register */
3340+ case 3: /* register to register */
3341 destreg = DECODE_RM_BYTE_REGISTER(rh);
3342 DECODE_PRINTF(",");
3343 srcreg = DECODE_RM_BYTE_REGISTER(rl);
3344@@ -341,7 +348,8 @@ static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
3345 REMARKS:
3346 Handles opcode 0x03
3347 ****************************************************************************/
3348-static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3349+static void
3350+x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3351 {
3352 int mod, rl, rh;
3353 uint srcoffset;
3354@@ -362,7 +370,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3355 DECODE_PRINTF("\n");
3356 TRACE_AND_STEP();
3357 *destreg = add_long(*destreg, srcval);
3358- } else {
3359+ }
3360+ else {
3361 u16 *destreg;
3362 u16 srcval;
3363
3364@@ -387,7 +396,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3365 DECODE_PRINTF("\n");
3366 TRACE_AND_STEP();
3367 *destreg = add_long(*destreg, srcval);
3368- } else {
3369+ }
3370+ else {
3371 u16 *destreg;
3372 u16 srcval;
3373
3374@@ -412,7 +422,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3375 DECODE_PRINTF("\n");
3376 TRACE_AND_STEP();
3377 *destreg = add_long(*destreg, srcval);
3378- } else {
3379+ }
3380+ else {
3381 u16 *destreg;
3382 u16 srcval;
3383
3384@@ -425,9 +436,9 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3385 *destreg = add_word(*destreg, srcval);
3386 }
3387 break;
3388- case 3: /* register to register */
3389+ case 3: /* register to register */
3390 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3391- u32 *destreg,*srcreg;
3392+ u32 *destreg, *srcreg;
3393
3394 destreg = DECODE_RM_LONG_REGISTER(rh);
3395 DECODE_PRINTF(",");
3396@@ -435,8 +446,9 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3397 DECODE_PRINTF("\n");
3398 TRACE_AND_STEP();
3399 *destreg = add_long(*destreg, *srcreg);
3400- } else {
3401- u16 *destreg,*srcreg;
3402+ }
3403+ else {
3404+ u16 *destreg, *srcreg;
3405
3406 destreg = DECODE_RM_WORD_REGISTER(rh);
3407 DECODE_PRINTF(",");
3408@@ -455,7 +467,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
3409 REMARKS:
3410 Handles opcode 0x04
3411 ****************************************************************************/
3412-static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3413+static void
3414+x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3415 {
3416 u8 srcval;
3417
3418@@ -473,7 +486,8 @@ static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3419 REMARKS:
3420 Handles opcode 0x05
3421 ****************************************************************************/
3422-static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3423+static void
3424+x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3425 {
3426 u32 srcval;
3427
3428@@ -481,7 +495,8 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3429 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3430 DECODE_PRINTF("ADD\tEAX,");
3431 srcval = fetch_long_imm();
3432- } else {
3433+ }
3434+ else {
3435 DECODE_PRINTF("ADD\tAX,");
3436 srcval = fetch_word_imm();
3437 }
3438@@ -489,8 +504,9 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3439 TRACE_AND_STEP();
3440 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3441 M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
3442- } else {
3443- M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
3444+ }
3445+ else {
3446+ M.x86.R_AX = add_word(M.x86.R_AX, (u16) srcval);
3447 }
3448 DECODE_CLEAR_SEGOVR();
3449 END_OF_INSTR();
3450@@ -500,7 +516,8 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3451 REMARKS:
3452 Handles opcode 0x06
3453 ****************************************************************************/
3454-static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
3455+static void
3456+x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
3457 {
3458 START_OF_INSTR();
3459 DECODE_PRINTF("PUSH\tES\n");
3460@@ -514,7 +531,8 @@ static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
3461 REMARKS:
3462 Handles opcode 0x07
3463 ****************************************************************************/
3464-static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
3465+static void
3466+x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
3467 {
3468 START_OF_INSTR();
3469 DECODE_PRINTF("POP\tES\n");
3470@@ -528,7 +546,8 @@ static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
3471 REMARKS:
3472 Handles opcode 0x08
3473 ****************************************************************************/
3474-static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
3475+static void
3476+x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
3477 {
3478 int mod, rl, rh;
3479 u8 *destreg, *srcreg;
3480@@ -569,7 +588,7 @@ static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
3481 destval = or_byte(destval, *srcreg);
3482 store_data_byte(destoffset, destval);
3483 break;
3484- case 3: /* register to register */
3485+ case 3: /* register to register */
3486 destreg = DECODE_RM_BYTE_REGISTER(rl);
3487 DECODE_PRINTF(",");
3488 srcreg = DECODE_RM_BYTE_REGISTER(rh);
3489@@ -586,7 +605,8 @@ static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
3490 REMARKS:
3491 Handles opcode 0x09
3492 ****************************************************************************/
3493-static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3494+static void
3495+x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3496 {
3497 int mod, rl, rh;
3498 uint destoffset;
3499@@ -608,7 +628,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3500 TRACE_AND_STEP();
3501 destval = or_long(destval, *srcreg);
3502 store_data_long(destoffset, destval);
3503- } else {
3504+ }
3505+ else {
3506 u16 destval;
3507 u16 *srcreg;
3508
3509@@ -635,7 +656,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3510 TRACE_AND_STEP();
3511 destval = or_long(destval, *srcreg);
3512 store_data_long(destoffset, destval);
3513- } else {
3514+ }
3515+ else {
3516 u16 destval;
3517 u16 *srcreg;
3518
3519@@ -662,7 +684,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3520 TRACE_AND_STEP();
3521 destval = or_long(destval, *srcreg);
3522 store_data_long(destoffset, destval);
3523- } else {
3524+ }
3525+ else {
3526 u16 destval;
3527 u16 *srcreg;
3528
3529@@ -676,9 +699,9 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3530 store_data_word(destoffset, destval);
3531 }
3532 break;
3533- case 3: /* register to register */
3534+ case 3: /* register to register */
3535 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3536- u32 *destreg,*srcreg;
3537+ u32 *destreg, *srcreg;
3538
3539 destreg = DECODE_RM_LONG_REGISTER(rl);
3540 DECODE_PRINTF(",");
3541@@ -686,8 +709,9 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3542 DECODE_PRINTF("\n");
3543 TRACE_AND_STEP();
3544 *destreg = or_long(*destreg, *srcreg);
3545- } else {
3546- u16 *destreg,*srcreg;
3547+ }
3548+ else {
3549+ u16 *destreg, *srcreg;
3550
3551 destreg = DECODE_RM_WORD_REGISTER(rl);
3552 DECODE_PRINTF(",");
3553@@ -706,7 +730,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
3554 REMARKS:
3555 Handles opcode 0x0a
3556 ****************************************************************************/
3557-static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
3558+static void
3559+x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
3560 {
3561 int mod, rl, rh;
3562 u8 *destreg, *srcreg;
3563@@ -744,7 +769,7 @@ static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
3564 TRACE_AND_STEP();
3565 *destreg = or_byte(*destreg, srcval);
3566 break;
3567- case 3: /* register to register */
3568+ case 3: /* register to register */
3569 destreg = DECODE_RM_BYTE_REGISTER(rh);
3570 DECODE_PRINTF(",");
3571 srcreg = DECODE_RM_BYTE_REGISTER(rl);
3572@@ -761,7 +786,8 @@ static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
3573 REMARKS:
3574 Handles opcode 0x0b
3575 ****************************************************************************/
3576-static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3577+static void
3578+x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3579 {
3580 int mod, rl, rh;
3581 uint srcoffset;
3582@@ -782,7 +808,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3583 DECODE_PRINTF("\n");
3584 TRACE_AND_STEP();
3585 *destreg = or_long(*destreg, srcval);
3586- } else {
3587+ }
3588+ else {
3589 u16 *destreg;
3590 u16 srcval;
3591
3592@@ -807,7 +834,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3593 DECODE_PRINTF("\n");
3594 TRACE_AND_STEP();
3595 *destreg = or_long(*destreg, srcval);
3596- } else {
3597+ }
3598+ else {
3599 u16 *destreg;
3600 u16 srcval;
3601
3602@@ -832,7 +860,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3603 DECODE_PRINTF("\n");
3604 TRACE_AND_STEP();
3605 *destreg = or_long(*destreg, srcval);
3606- } else {
3607+ }
3608+ else {
3609 u16 *destreg;
3610 u16 srcval;
3611
3612@@ -845,9 +874,9 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3613 *destreg = or_word(*destreg, srcval);
3614 }
3615 break;
3616- case 3: /* register to register */
3617+ case 3: /* register to register */
3618 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3619- u32 *destreg,*srcreg;
3620+ u32 *destreg, *srcreg;
3621
3622 destreg = DECODE_RM_LONG_REGISTER(rh);
3623 DECODE_PRINTF(",");
3624@@ -855,8 +884,9 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3625 DECODE_PRINTF("\n");
3626 TRACE_AND_STEP();
3627 *destreg = or_long(*destreg, *srcreg);
3628- } else {
3629- u16 *destreg,*srcreg;
3630+ }
3631+ else {
3632+ u16 *destreg, *srcreg;
3633
3634 destreg = DECODE_RM_WORD_REGISTER(rh);
3635 DECODE_PRINTF(",");
3636@@ -875,7 +905,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
3637 REMARKS:
3638 Handles opcode 0x0c
3639 ****************************************************************************/
3640-static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3641+static void
3642+x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3643 {
3644 u8 srcval;
3645
3646@@ -893,7 +924,8 @@ static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3647 REMARKS:
3648 Handles opcode 0x0d
3649 ****************************************************************************/
3650-static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3651+static void
3652+x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3653 {
3654 u32 srcval;
3655
3656@@ -901,7 +933,8 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3657 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3658 DECODE_PRINTF("OR\tEAX,");
3659 srcval = fetch_long_imm();
3660- } else {
3661+ }
3662+ else {
3663 DECODE_PRINTF("OR\tAX,");
3664 srcval = fetch_word_imm();
3665 }
3666@@ -909,8 +942,9 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3667 TRACE_AND_STEP();
3668 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3669 M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
3670- } else {
3671- M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
3672+ }
3673+ else {
3674+ M.x86.R_AX = or_word(M.x86.R_AX, (u16) srcval);
3675 }
3676 DECODE_CLEAR_SEGOVR();
3677 END_OF_INSTR();
3678@@ -920,7 +954,8 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3679 REMARKS:
3680 Handles opcode 0x0e
3681 ****************************************************************************/
3682-static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
3683+static void
3684+x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
3685 {
3686 START_OF_INSTR();
3687 DECODE_PRINTF("PUSH\tCS\n");
3688@@ -934,18 +969,21 @@ static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
3689 REMARKS:
3690 Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
3691 ****************************************************************************/
3692-static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
3693+static void
3694+x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
3695 {
3696- u8 op2 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
3697+ u8 op2 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
3698+
3699 INC_DECODED_INST_LEN(1);
3700- (*x86emu_optab2[op2])(op2);
3701+ (*x86emu_optab2[op2]) (op2);
3702 }
3703
3704 /****************************************************************************
3705 REMARKS:
3706 Handles opcode 0x10
3707 ****************************************************************************/
3708-static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
3709+static void
3710+x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
3711 {
3712 int mod, rl, rh;
3713 u8 *destreg, *srcreg;
3714@@ -986,7 +1024,7 @@ static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
3715 destval = adc_byte(destval, *srcreg);
3716 store_data_byte(destoffset, destval);
3717 break;
3718- case 3: /* register to register */
3719+ case 3: /* register to register */
3720 destreg = DECODE_RM_BYTE_REGISTER(rl);
3721 DECODE_PRINTF(",");
3722 srcreg = DECODE_RM_BYTE_REGISTER(rh);
3723@@ -1003,7 +1041,8 @@ static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
3724 REMARKS:
3725 Handles opcode 0x11
3726 ****************************************************************************/
3727-static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3728+static void
3729+x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3730 {
3731 int mod, rl, rh;
3732 uint destoffset;
3733@@ -1025,7 +1064,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3734 TRACE_AND_STEP();
3735 destval = adc_long(destval, *srcreg);
3736 store_data_long(destoffset, destval);
3737- } else {
3738+ }
3739+ else {
3740 u16 destval;
3741 u16 *srcreg;
3742
3743@@ -1052,7 +1092,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3744 TRACE_AND_STEP();
3745 destval = adc_long(destval, *srcreg);
3746 store_data_long(destoffset, destval);
3747- } else {
3748+ }
3749+ else {
3750 u16 destval;
3751 u16 *srcreg;
3752
3753@@ -1079,7 +1120,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3754 TRACE_AND_STEP();
3755 destval = adc_long(destval, *srcreg);
3756 store_data_long(destoffset, destval);
3757- } else {
3758+ }
3759+ else {
3760 u16 destval;
3761 u16 *srcreg;
3762
3763@@ -1093,9 +1135,9 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3764 store_data_word(destoffset, destval);
3765 }
3766 break;
3767- case 3: /* register to register */
3768+ case 3: /* register to register */
3769 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3770- u32 *destreg,*srcreg;
3771+ u32 *destreg, *srcreg;
3772
3773 destreg = DECODE_RM_LONG_REGISTER(rl);
3774 DECODE_PRINTF(",");
3775@@ -1103,8 +1145,9 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3776 DECODE_PRINTF("\n");
3777 TRACE_AND_STEP();
3778 *destreg = adc_long(*destreg, *srcreg);
3779- } else {
3780- u16 *destreg,*srcreg;
3781+ }
3782+ else {
3783+ u16 *destreg, *srcreg;
3784
3785 destreg = DECODE_RM_WORD_REGISTER(rl);
3786 DECODE_PRINTF(",");
3787@@ -1123,7 +1166,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
3788 REMARKS:
3789 Handles opcode 0x12
3790 ****************************************************************************/
3791-static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
3792+static void
3793+x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
3794 {
3795 int mod, rl, rh;
3796 u8 *destreg, *srcreg;
3797@@ -1161,7 +1205,7 @@ static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
3798 TRACE_AND_STEP();
3799 *destreg = adc_byte(*destreg, srcval);
3800 break;
3801- case 3: /* register to register */
3802+ case 3: /* register to register */
3803 destreg = DECODE_RM_BYTE_REGISTER(rh);
3804 DECODE_PRINTF(",");
3805 srcreg = DECODE_RM_BYTE_REGISTER(rl);
3806@@ -1178,7 +1222,8 @@ static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
3807 REMARKS:
3808 Handles opcode 0x13
3809 ****************************************************************************/
3810-static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3811+static void
3812+x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3813 {
3814 int mod, rl, rh;
3815 uint srcoffset;
3816@@ -1199,7 +1244,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3817 DECODE_PRINTF("\n");
3818 TRACE_AND_STEP();
3819 *destreg = adc_long(*destreg, srcval);
3820- } else {
3821+ }
3822+ else {
3823 u16 *destreg;
3824 u16 srcval;
3825
3826@@ -1224,7 +1270,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3827 DECODE_PRINTF("\n");
3828 TRACE_AND_STEP();
3829 *destreg = adc_long(*destreg, srcval);
3830- } else {
3831+ }
3832+ else {
3833 u16 *destreg;
3834 u16 srcval;
3835
3836@@ -1249,7 +1296,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3837 DECODE_PRINTF("\n");
3838 TRACE_AND_STEP();
3839 *destreg = adc_long(*destreg, srcval);
3840- } else {
3841+ }
3842+ else {
3843 u16 *destreg;
3844 u16 srcval;
3845
3846@@ -1262,9 +1310,9 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3847 *destreg = adc_word(*destreg, srcval);
3848 }
3849 break;
3850- case 3: /* register to register */
3851+ case 3: /* register to register */
3852 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3853- u32 *destreg,*srcreg;
3854+ u32 *destreg, *srcreg;
3855
3856 destreg = DECODE_RM_LONG_REGISTER(rh);
3857 DECODE_PRINTF(",");
3858@@ -1272,8 +1320,9 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3859 DECODE_PRINTF("\n");
3860 TRACE_AND_STEP();
3861 *destreg = adc_long(*destreg, *srcreg);
3862- } else {
3863- u16 *destreg,*srcreg;
3864+ }
3865+ else {
3866+ u16 *destreg, *srcreg;
3867
3868 destreg = DECODE_RM_WORD_REGISTER(rh);
3869 DECODE_PRINTF(",");
3870@@ -1292,7 +1341,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
3871 REMARKS:
3872 Handles opcode 0x14
3873 ****************************************************************************/
3874-static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3875+static void
3876+x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3877 {
3878 u8 srcval;
3879
3880@@ -1310,7 +1360,8 @@ static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
3881 REMARKS:
3882 Handles opcode 0x15
3883 ****************************************************************************/
3884-static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3885+static void
3886+x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3887 {
3888 u32 srcval;
3889
3890@@ -1318,7 +1369,8 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3891 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3892 DECODE_PRINTF("ADC\tEAX,");
3893 srcval = fetch_long_imm();
3894- } else {
3895+ }
3896+ else {
3897 DECODE_PRINTF("ADC\tAX,");
3898 srcval = fetch_word_imm();
3899 }
3900@@ -1326,8 +1378,9 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3901 TRACE_AND_STEP();
3902 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3903 M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
3904- } else {
3905- M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
3906+ }
3907+ else {
3908+ M.x86.R_AX = adc_word(M.x86.R_AX, (u16) srcval);
3909 }
3910 DECODE_CLEAR_SEGOVR();
3911 END_OF_INSTR();
3912@@ -1337,7 +1390,8 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
3913 REMARKS:
3914 Handles opcode 0x16
3915 ****************************************************************************/
3916-static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
3917+static void
3918+x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
3919 {
3920 START_OF_INSTR();
3921 DECODE_PRINTF("PUSH\tSS\n");
3922@@ -1351,7 +1405,8 @@ static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
3923 REMARKS:
3924 Handles opcode 0x17
3925 ****************************************************************************/
3926-static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
3927+static void
3928+x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
3929 {
3930 START_OF_INSTR();
3931 DECODE_PRINTF("POP\tSS\n");
3932@@ -1365,7 +1420,8 @@ static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
3933 REMARKS:
3934 Handles opcode 0x18
3935 ****************************************************************************/
3936-static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
3937+static void
3938+x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
3939 {
3940 int mod, rl, rh;
3941 u8 *destreg, *srcreg;
3942@@ -1406,7 +1462,7 @@ static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
3943 destval = sbb_byte(destval, *srcreg);
3944 store_data_byte(destoffset, destval);
3945 break;
3946- case 3: /* register to register */
3947+ case 3: /* register to register */
3948 destreg = DECODE_RM_BYTE_REGISTER(rl);
3949 DECODE_PRINTF(",");
3950 srcreg = DECODE_RM_BYTE_REGISTER(rh);
3951@@ -1423,7 +1479,8 @@ static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
3952 REMARKS:
3953 Handles opcode 0x19
3954 ****************************************************************************/
3955-static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3956+static void
3957+x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3958 {
3959 int mod, rl, rh;
3960 uint destoffset;
3961@@ -1445,7 +1502,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3962 TRACE_AND_STEP();
3963 destval = sbb_long(destval, *srcreg);
3964 store_data_long(destoffset, destval);
3965- } else {
3966+ }
3967+ else {
3968 u16 destval;
3969 u16 *srcreg;
3970
3971@@ -1472,7 +1530,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3972 TRACE_AND_STEP();
3973 destval = sbb_long(destval, *srcreg);
3974 store_data_long(destoffset, destval);
3975- } else {
3976+ }
3977+ else {
3978 u16 destval;
3979 u16 *srcreg;
3980
3981@@ -1499,7 +1558,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3982 TRACE_AND_STEP();
3983 destval = sbb_long(destval, *srcreg);
3984 store_data_long(destoffset, destval);
3985- } else {
3986+ }
3987+ else {
3988 u16 destval;
3989 u16 *srcreg;
3990
3991@@ -1513,9 +1573,9 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
3992 store_data_word(destoffset, destval);
3993 }
3994 break;
3995- case 3: /* register to register */
3996+ case 3: /* register to register */
3997 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
3998- u32 *destreg,*srcreg;
3999+ u32 *destreg, *srcreg;
4000
4001 destreg = DECODE_RM_LONG_REGISTER(rl);
4002 DECODE_PRINTF(",");
4003@@ -1523,8 +1583,9 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
4004 DECODE_PRINTF("\n");
4005 TRACE_AND_STEP();
4006 *destreg = sbb_long(*destreg, *srcreg);
4007- } else {
4008- u16 *destreg,*srcreg;
4009+ }
4010+ else {
4011+ u16 *destreg, *srcreg;
4012
4013 destreg = DECODE_RM_WORD_REGISTER(rl);
4014 DECODE_PRINTF(",");
4015@@ -1543,7 +1604,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
4016 REMARKS:
4017 Handles opcode 0x1a
4018 ****************************************************************************/
4019-static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
4020+static void
4021+x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
4022 {
4023 int mod, rl, rh;
4024 u8 *destreg, *srcreg;
4025@@ -1581,7 +1643,7 @@ static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
4026 TRACE_AND_STEP();
4027 *destreg = sbb_byte(*destreg, srcval);
4028 break;
4029- case 3: /* register to register */
4030+ case 3: /* register to register */
4031 destreg = DECODE_RM_BYTE_REGISTER(rh);
4032 DECODE_PRINTF(",");
4033 srcreg = DECODE_RM_BYTE_REGISTER(rl);
4034@@ -1598,7 +1660,8 @@ static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
4035 REMARKS:
4036 Handles opcode 0x1b
4037 ****************************************************************************/
4038-static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4039+static void
4040+x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4041 {
4042 int mod, rl, rh;
4043 uint srcoffset;
4044@@ -1619,7 +1682,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4045 DECODE_PRINTF("\n");
4046 TRACE_AND_STEP();
4047 *destreg = sbb_long(*destreg, srcval);
4048- } else {
4049+ }
4050+ else {
4051 u16 *destreg;
4052 u16 srcval;
4053
4054@@ -1644,7 +1708,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4055 DECODE_PRINTF("\n");
4056 TRACE_AND_STEP();
4057 *destreg = sbb_long(*destreg, srcval);
4058- } else {
4059+ }
4060+ else {
4061 u16 *destreg;
4062 u16 srcval;
4063
4064@@ -1669,7 +1734,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4065 DECODE_PRINTF("\n");
4066 TRACE_AND_STEP();
4067 *destreg = sbb_long(*destreg, srcval);
4068- } else {
4069+ }
4070+ else {
4071 u16 *destreg;
4072 u16 srcval;
4073
4074@@ -1682,9 +1748,9 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4075 *destreg = sbb_word(*destreg, srcval);
4076 }
4077 break;
4078- case 3: /* register to register */
4079+ case 3: /* register to register */
4080 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4081- u32 *destreg,*srcreg;
4082+ u32 *destreg, *srcreg;
4083
4084 destreg = DECODE_RM_LONG_REGISTER(rh);
4085 DECODE_PRINTF(",");
4086@@ -1692,8 +1758,9 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4087 DECODE_PRINTF("\n");
4088 TRACE_AND_STEP();
4089 *destreg = sbb_long(*destreg, *srcreg);
4090- } else {
4091- u16 *destreg,*srcreg;
4092+ }
4093+ else {
4094+ u16 *destreg, *srcreg;
4095
4096 destreg = DECODE_RM_WORD_REGISTER(rh);
4097 DECODE_PRINTF(",");
4098@@ -1712,7 +1779,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
4099 REMARKS:
4100 Handles opcode 0x1c
4101 ****************************************************************************/
4102-static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4103+static void
4104+x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4105 {
4106 u8 srcval;
4107
4108@@ -1730,7 +1798,8 @@ static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4109 REMARKS:
4110 Handles opcode 0x1d
4111 ****************************************************************************/
4112-static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4113+static void
4114+x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4115 {
4116 u32 srcval;
4117
4118@@ -1738,7 +1807,8 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4119 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4120 DECODE_PRINTF("SBB\tEAX,");
4121 srcval = fetch_long_imm();
4122- } else {
4123+ }
4124+ else {
4125 DECODE_PRINTF("SBB\tAX,");
4126 srcval = fetch_word_imm();
4127 }
4128@@ -1746,8 +1816,9 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4129 TRACE_AND_STEP();
4130 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4131 M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
4132- } else {
4133- M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
4134+ }
4135+ else {
4136+ M.x86.R_AX = sbb_word(M.x86.R_AX, (u16) srcval);
4137 }
4138 DECODE_CLEAR_SEGOVR();
4139 END_OF_INSTR();
4140@@ -1757,7 +1828,8 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4141 REMARKS:
4142 Handles opcode 0x1e
4143 ****************************************************************************/
4144-static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
4145+static void
4146+x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
4147 {
4148 START_OF_INSTR();
4149 DECODE_PRINTF("PUSH\tDS\n");
4150@@ -1771,7 +1843,8 @@ static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
4151 REMARKS:
4152 Handles opcode 0x1f
4153 ****************************************************************************/
4154-static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
4155+static void
4156+x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
4157 {
4158 START_OF_INSTR();
4159 DECODE_PRINTF("POP\tDS\n");
4160@@ -1785,7 +1858,8 @@ static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
4161 REMARKS:
4162 Handles opcode 0x20
4163 ****************************************************************************/
4164-static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
4165+static void
4166+x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
4167 {
4168 int mod, rl, rh;
4169 u8 *destreg, *srcreg;
4170@@ -1830,7 +1904,7 @@ static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
4171 store_data_byte(destoffset, destval);
4172 break;
4173
4174- case 3: /* register to register */
4175+ case 3: /* register to register */
4176 destreg = DECODE_RM_BYTE_REGISTER(rl);
4177 DECODE_PRINTF(",");
4178 srcreg = DECODE_RM_BYTE_REGISTER(rh);
4179@@ -1847,7 +1921,8 @@ static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
4180 REMARKS:
4181 Handles opcode 0x21
4182 ****************************************************************************/
4183-static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4184+static void
4185+x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4186 {
4187 int mod, rl, rh;
4188 uint destoffset;
4189@@ -1869,7 +1944,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4190 TRACE_AND_STEP();
4191 destval = and_long(destval, *srcreg);
4192 store_data_long(destoffset, destval);
4193- } else {
4194+ }
4195+ else {
4196 u16 destval;
4197 u16 *srcreg;
4198
4199@@ -1896,7 +1972,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4200 TRACE_AND_STEP();
4201 destval = and_long(destval, *srcreg);
4202 store_data_long(destoffset, destval);
4203- } else {
4204+ }
4205+ else {
4206 u16 destval;
4207 u16 *srcreg;
4208
4209@@ -1923,7 +2000,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4210 TRACE_AND_STEP();
4211 destval = and_long(destval, *srcreg);
4212 store_data_long(destoffset, destval);
4213- } else {
4214+ }
4215+ else {
4216 u16 destval;
4217 u16 *srcreg;
4218
4219@@ -1937,9 +2015,9 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4220 store_data_word(destoffset, destval);
4221 }
4222 break;
4223- case 3: /* register to register */
4224+ case 3: /* register to register */
4225 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4226- u32 *destreg,*srcreg;
4227+ u32 *destreg, *srcreg;
4228
4229 destreg = DECODE_RM_LONG_REGISTER(rl);
4230 DECODE_PRINTF(",");
4231@@ -1947,8 +2025,9 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4232 DECODE_PRINTF("\n");
4233 TRACE_AND_STEP();
4234 *destreg = and_long(*destreg, *srcreg);
4235- } else {
4236- u16 *destreg,*srcreg;
4237+ }
4238+ else {
4239+ u16 *destreg, *srcreg;
4240
4241 destreg = DECODE_RM_WORD_REGISTER(rl);
4242 DECODE_PRINTF(",");
4243@@ -1967,7 +2046,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
4244 REMARKS:
4245 Handles opcode 0x22
4246 ****************************************************************************/
4247-static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
4248+static void
4249+x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
4250 {
4251 int mod, rl, rh;
4252 u8 *destreg, *srcreg;
4253@@ -2005,7 +2085,7 @@ static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
4254 TRACE_AND_STEP();
4255 *destreg = and_byte(*destreg, srcval);
4256 break;
4257- case 3: /* register to register */
4258+ case 3: /* register to register */
4259 destreg = DECODE_RM_BYTE_REGISTER(rh);
4260 DECODE_PRINTF(",");
4261 srcreg = DECODE_RM_BYTE_REGISTER(rl);
4262@@ -2022,7 +2102,8 @@ static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
4263 REMARKS:
4264 Handles opcode 0x23
4265 ****************************************************************************/
4266-static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4267+static void
4268+x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4269 {
4270 int mod, rl, rh;
4271 uint srcoffset;
4272@@ -2043,7 +2124,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4273 DECODE_PRINTF("\n");
4274 TRACE_AND_STEP();
4275 *destreg = and_long(*destreg, srcval);
4276- } else {
4277+ }
4278+ else {
4279 u16 *destreg;
4280 u16 srcval;
4281
4282@@ -2069,7 +2151,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4283 TRACE_AND_STEP();
4284 *destreg = and_long(*destreg, srcval);
4285 break;
4286- } else {
4287+ }
4288+ else {
4289 u16 *destreg;
4290 u16 srcval;
4291
4292@@ -2094,7 +2177,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4293 DECODE_PRINTF("\n");
4294 TRACE_AND_STEP();
4295 *destreg = and_long(*destreg, srcval);
4296- } else {
4297+ }
4298+ else {
4299 u16 *destreg;
4300 u16 srcval;
4301
4302@@ -2107,9 +2191,9 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4303 *destreg = and_word(*destreg, srcval);
4304 }
4305 break;
4306- case 3: /* register to register */
4307+ case 3: /* register to register */
4308 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4309- u32 *destreg,*srcreg;
4310+ u32 *destreg, *srcreg;
4311
4312 destreg = DECODE_RM_LONG_REGISTER(rh);
4313 DECODE_PRINTF(",");
4314@@ -2117,8 +2201,9 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4315 DECODE_PRINTF("\n");
4316 TRACE_AND_STEP();
4317 *destreg = and_long(*destreg, *srcreg);
4318- } else {
4319- u16 *destreg,*srcreg;
4320+ }
4321+ else {
4322+ u16 *destreg, *srcreg;
4323
4324 destreg = DECODE_RM_WORD_REGISTER(rh);
4325 DECODE_PRINTF(",");
4326@@ -2137,7 +2222,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
4327 REMARKS:
4328 Handles opcode 0x24
4329 ****************************************************************************/
4330-static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4331+static void
4332+x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4333 {
4334 u8 srcval;
4335
4336@@ -2155,7 +2241,8 @@ static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4337 REMARKS:
4338 Handles opcode 0x25
4339 ****************************************************************************/
4340-static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4341+static void
4342+x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4343 {
4344 u32 srcval;
4345
4346@@ -2163,7 +2250,8 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4347 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4348 DECODE_PRINTF("AND\tEAX,");
4349 srcval = fetch_long_imm();
4350- } else {
4351+ }
4352+ else {
4353 DECODE_PRINTF("AND\tAX,");
4354 srcval = fetch_word_imm();
4355 }
4356@@ -2171,8 +2259,9 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4357 TRACE_AND_STEP();
4358 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4359 M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
4360- } else {
4361- M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
4362+ }
4363+ else {
4364+ M.x86.R_AX = and_word(M.x86.R_AX, (u16) srcval);
4365 }
4366 DECODE_CLEAR_SEGOVR();
4367 END_OF_INSTR();
4368@@ -2182,7 +2271,8 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4369 REMARKS:
4370 Handles opcode 0x26
4371 ****************************************************************************/
4372-static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
4373+static void
4374+x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
4375 {
4376 START_OF_INSTR();
4377 DECODE_PRINTF("ES:\n");
4378@@ -2199,7 +2289,8 @@ static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
4379 REMARKS:
4380 Handles opcode 0x27
4381 ****************************************************************************/
4382-static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
4383+static void
4384+x86emuOp_daa(u8 X86EMU_UNUSED(op1))
4385 {
4386 START_OF_INSTR();
4387 DECODE_PRINTF("DAA\n");
4388@@ -2213,7 +2304,8 @@ static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
4389 REMARKS:
4390 Handles opcode 0x28
4391 ****************************************************************************/
4392-static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
4393+static void
4394+x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
4395 {
4396 int mod, rl, rh;
4397 u8 *destreg, *srcreg;
4398@@ -2254,7 +2346,7 @@ static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
4399 destval = sub_byte(destval, *srcreg);
4400 store_data_byte(destoffset, destval);
4401 break;
4402- case 3: /* register to register */
4403+ case 3: /* register to register */
4404 destreg = DECODE_RM_BYTE_REGISTER(rl);
4405 DECODE_PRINTF(",");
4406 srcreg = DECODE_RM_BYTE_REGISTER(rh);
4407@@ -2271,7 +2363,8 @@ static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
4408 REMARKS:
4409 Handles opcode 0x29
4410 ****************************************************************************/
4411-static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4412+static void
4413+x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4414 {
4415 int mod, rl, rh;
4416 uint destoffset;
4417@@ -2293,7 +2386,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4418 TRACE_AND_STEP();
4419 destval = sub_long(destval, *srcreg);
4420 store_data_long(destoffset, destval);
4421- } else {
4422+ }
4423+ else {
4424 u16 destval;
4425 u16 *srcreg;
4426
4427@@ -2320,7 +2414,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4428 TRACE_AND_STEP();
4429 destval = sub_long(destval, *srcreg);
4430 store_data_long(destoffset, destval);
4431- } else {
4432+ }
4433+ else {
4434 u16 destval;
4435 u16 *srcreg;
4436
4437@@ -2347,7 +2442,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4438 TRACE_AND_STEP();
4439 destval = sub_long(destval, *srcreg);
4440 store_data_long(destoffset, destval);
4441- } else {
4442+ }
4443+ else {
4444 u16 destval;
4445 u16 *srcreg;
4446
4447@@ -2361,9 +2457,9 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4448 store_data_word(destoffset, destval);
4449 }
4450 break;
4451- case 3: /* register to register */
4452+ case 3: /* register to register */
4453 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4454- u32 *destreg,*srcreg;
4455+ u32 *destreg, *srcreg;
4456
4457 destreg = DECODE_RM_LONG_REGISTER(rl);
4458 DECODE_PRINTF(",");
4459@@ -2371,8 +2467,9 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4460 DECODE_PRINTF("\n");
4461 TRACE_AND_STEP();
4462 *destreg = sub_long(*destreg, *srcreg);
4463- } else {
4464- u16 *destreg,*srcreg;
4465+ }
4466+ else {
4467+ u16 *destreg, *srcreg;
4468
4469 destreg = DECODE_RM_WORD_REGISTER(rl);
4470 DECODE_PRINTF(",");
4471@@ -2391,7 +2488,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
4472 REMARKS:
4473 Handles opcode 0x2a
4474 ****************************************************************************/
4475-static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
4476+static void
4477+x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
4478 {
4479 int mod, rl, rh;
4480 u8 *destreg, *srcreg;
4481@@ -2429,7 +2527,7 @@ static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
4482 TRACE_AND_STEP();
4483 *destreg = sub_byte(*destreg, srcval);
4484 break;
4485- case 3: /* register to register */
4486+ case 3: /* register to register */
4487 destreg = DECODE_RM_BYTE_REGISTER(rh);
4488 DECODE_PRINTF(",");
4489 srcreg = DECODE_RM_BYTE_REGISTER(rl);
4490@@ -2446,7 +2544,8 @@ static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
4491 REMARKS:
4492 Handles opcode 0x2b
4493 ****************************************************************************/
4494-static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4495+static void
4496+x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4497 {
4498 int mod, rl, rh;
4499 uint srcoffset;
4500@@ -2467,7 +2566,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4501 DECODE_PRINTF("\n");
4502 TRACE_AND_STEP();
4503 *destreg = sub_long(*destreg, srcval);
4504- } else {
4505+ }
4506+ else {
4507 u16 *destreg;
4508 u16 srcval;
4509
4510@@ -2492,7 +2592,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4511 DECODE_PRINTF("\n");
4512 TRACE_AND_STEP();
4513 *destreg = sub_long(*destreg, srcval);
4514- } else {
4515+ }
4516+ else {
4517 u16 *destreg;
4518 u16 srcval;
4519
4520@@ -2517,7 +2618,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4521 DECODE_PRINTF("\n");
4522 TRACE_AND_STEP();
4523 *destreg = sub_long(*destreg, srcval);
4524- } else {
4525+ }
4526+ else {
4527 u16 *destreg;
4528 u16 srcval;
4529
4530@@ -2530,9 +2632,9 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4531 *destreg = sub_word(*destreg, srcval);
4532 }
4533 break;
4534- case 3: /* register to register */
4535+ case 3: /* register to register */
4536 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4537- u32 *destreg,*srcreg;
4538+ u32 *destreg, *srcreg;
4539
4540 destreg = DECODE_RM_LONG_REGISTER(rh);
4541 DECODE_PRINTF(",");
4542@@ -2540,8 +2642,9 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4543 DECODE_PRINTF("\n");
4544 TRACE_AND_STEP();
4545 *destreg = sub_long(*destreg, *srcreg);
4546- } else {
4547- u16 *destreg,*srcreg;
4548+ }
4549+ else {
4550+ u16 *destreg, *srcreg;
4551
4552 destreg = DECODE_RM_WORD_REGISTER(rh);
4553 DECODE_PRINTF(",");
4554@@ -2560,7 +2663,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
4555 REMARKS:
4556 Handles opcode 0x2c
4557 ****************************************************************************/
4558-static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4559+static void
4560+x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4561 {
4562 u8 srcval;
4563
4564@@ -2578,7 +2682,8 @@ static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4565 REMARKS:
4566 Handles opcode 0x2d
4567 ****************************************************************************/
4568-static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4569+static void
4570+x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4571 {
4572 u32 srcval;
4573
4574@@ -2586,7 +2691,8 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4575 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4576 DECODE_PRINTF("SUB\tEAX,");
4577 srcval = fetch_long_imm();
4578- } else {
4579+ }
4580+ else {
4581 DECODE_PRINTF("SUB\tAX,");
4582 srcval = fetch_word_imm();
4583 }
4584@@ -2594,8 +2700,9 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4585 TRACE_AND_STEP();
4586 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4587 M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
4588- } else {
4589- M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
4590+ }
4591+ else {
4592+ M.x86.R_AX = sub_word(M.x86.R_AX, (u16) srcval);
4593 }
4594 DECODE_CLEAR_SEGOVR();
4595 END_OF_INSTR();
4596@@ -2605,7 +2712,8 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4597 REMARKS:
4598 Handles opcode 0x2e
4599 ****************************************************************************/
4600-static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
4601+static void
4602+x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
4603 {
4604 START_OF_INSTR();
4605 DECODE_PRINTF("CS:\n");
4606@@ -2619,7 +2727,8 @@ static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
4607 REMARKS:
4608 Handles opcode 0x2f
4609 ****************************************************************************/
4610-static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
4611+static void
4612+x86emuOp_das(u8 X86EMU_UNUSED(op1))
4613 {
4614 START_OF_INSTR();
4615 DECODE_PRINTF("DAS\n");
4616@@ -2633,7 +2742,8 @@ static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
4617 REMARKS:
4618 Handles opcode 0x30
4619 ****************************************************************************/
4620-static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
4621+static void
4622+x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
4623 {
4624 int mod, rl, rh;
4625 u8 *destreg, *srcreg;
4626@@ -2674,7 +2784,7 @@ static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
4627 destval = xor_byte(destval, *srcreg);
4628 store_data_byte(destoffset, destval);
4629 break;
4630- case 3: /* register to register */
4631+ case 3: /* register to register */
4632 destreg = DECODE_RM_BYTE_REGISTER(rl);
4633 DECODE_PRINTF(",");
4634 srcreg = DECODE_RM_BYTE_REGISTER(rh);
4635@@ -2691,7 +2801,8 @@ static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
4636 REMARKS:
4637 Handles opcode 0x31
4638 ****************************************************************************/
4639-static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4640+static void
4641+x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4642 {
4643 int mod, rl, rh;
4644 uint destoffset;
4645@@ -2713,7 +2824,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4646 TRACE_AND_STEP();
4647 destval = xor_long(destval, *srcreg);
4648 store_data_long(destoffset, destval);
4649- } else {
4650+ }
4651+ else {
4652 u16 destval;
4653 u16 *srcreg;
4654
4655@@ -2740,7 +2852,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4656 TRACE_AND_STEP();
4657 destval = xor_long(destval, *srcreg);
4658 store_data_long(destoffset, destval);
4659- } else {
4660+ }
4661+ else {
4662 u16 destval;
4663 u16 *srcreg;
4664
4665@@ -2767,7 +2880,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4666 TRACE_AND_STEP();
4667 destval = xor_long(destval, *srcreg);
4668 store_data_long(destoffset, destval);
4669- } else {
4670+ }
4671+ else {
4672 u16 destval;
4673 u16 *srcreg;
4674
4675@@ -2781,9 +2895,9 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4676 store_data_word(destoffset, destval);
4677 }
4678 break;
4679- case 3: /* register to register */
4680+ case 3: /* register to register */
4681 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4682- u32 *destreg,*srcreg;
4683+ u32 *destreg, *srcreg;
4684
4685 destreg = DECODE_RM_LONG_REGISTER(rl);
4686 DECODE_PRINTF(",");
4687@@ -2791,8 +2905,9 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4688 DECODE_PRINTF("\n");
4689 TRACE_AND_STEP();
4690 *destreg = xor_long(*destreg, *srcreg);
4691- } else {
4692- u16 *destreg,*srcreg;
4693+ }
4694+ else {
4695+ u16 *destreg, *srcreg;
4696
4697 destreg = DECODE_RM_WORD_REGISTER(rl);
4698 DECODE_PRINTF(",");
4699@@ -2811,7 +2926,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
4700 REMARKS:
4701 Handles opcode 0x32
4702 ****************************************************************************/
4703-static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
4704+static void
4705+x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
4706 {
4707 int mod, rl, rh;
4708 u8 *destreg, *srcreg;
4709@@ -2849,7 +2965,7 @@ static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
4710 TRACE_AND_STEP();
4711 *destreg = xor_byte(*destreg, srcval);
4712 break;
4713- case 3: /* register to register */
4714+ case 3: /* register to register */
4715 destreg = DECODE_RM_BYTE_REGISTER(rh);
4716 DECODE_PRINTF(",");
4717 srcreg = DECODE_RM_BYTE_REGISTER(rl);
4718@@ -2866,7 +2982,8 @@ static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
4719 REMARKS:
4720 Handles opcode 0x33
4721 ****************************************************************************/
4722-static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4723+static void
4724+x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4725 {
4726 int mod, rl, rh;
4727 uint srcoffset;
4728@@ -2887,7 +3004,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4729 DECODE_PRINTF("\n");
4730 TRACE_AND_STEP();
4731 *destreg = xor_long(*destreg, srcval);
4732- } else {
4733+ }
4734+ else {
4735 u16 *destreg;
4736 u16 srcval;
4737
4738@@ -2912,7 +3030,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4739 DECODE_PRINTF("\n");
4740 TRACE_AND_STEP();
4741 *destreg = xor_long(*destreg, srcval);
4742- } else {
4743+ }
4744+ else {
4745 u16 *destreg;
4746 u16 srcval;
4747
4748@@ -2937,7 +3056,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4749 DECODE_PRINTF("\n");
4750 TRACE_AND_STEP();
4751 *destreg = xor_long(*destreg, srcval);
4752- } else {
4753+ }
4754+ else {
4755 u16 *destreg;
4756 u16 srcval;
4757
4758@@ -2950,9 +3070,9 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4759 *destreg = xor_word(*destreg, srcval);
4760 }
4761 break;
4762- case 3: /* register to register */
4763+ case 3: /* register to register */
4764 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4765- u32 *destreg,*srcreg;
4766+ u32 *destreg, *srcreg;
4767
4768 destreg = DECODE_RM_LONG_REGISTER(rh);
4769 DECODE_PRINTF(",");
4770@@ -2960,8 +3080,9 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4771 DECODE_PRINTF("\n");
4772 TRACE_AND_STEP();
4773 *destreg = xor_long(*destreg, *srcreg);
4774- } else {
4775- u16 *destreg,*srcreg;
4776+ }
4777+ else {
4778+ u16 *destreg, *srcreg;
4779
4780 destreg = DECODE_RM_WORD_REGISTER(rh);
4781 DECODE_PRINTF(",");
4782@@ -2980,7 +3101,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
4783 REMARKS:
4784 Handles opcode 0x34
4785 ****************************************************************************/
4786-static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4787+static void
4788+x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4789 {
4790 u8 srcval;
4791
4792@@ -2998,7 +3120,8 @@ static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
4793 REMARKS:
4794 Handles opcode 0x35
4795 ****************************************************************************/
4796-static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4797+static void
4798+x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4799 {
4800 u32 srcval;
4801
4802@@ -3006,7 +3129,8 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4803 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4804 DECODE_PRINTF("XOR\tEAX,");
4805 srcval = fetch_long_imm();
4806- } else {
4807+ }
4808+ else {
4809 DECODE_PRINTF("XOR\tAX,");
4810 srcval = fetch_word_imm();
4811 }
4812@@ -3014,8 +3138,9 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4813 TRACE_AND_STEP();
4814 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4815 M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
4816- } else {
4817- M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
4818+ }
4819+ else {
4820+ M.x86.R_AX = xor_word(M.x86.R_AX, (u16) srcval);
4821 }
4822 DECODE_CLEAR_SEGOVR();
4823 END_OF_INSTR();
4824@@ -3025,7 +3150,8 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
4825 REMARKS:
4826 Handles opcode 0x36
4827 ****************************************************************************/
4828-static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
4829+static void
4830+x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
4831 {
4832 START_OF_INSTR();
4833 DECODE_PRINTF("SS:\n");
4834@@ -3039,7 +3165,8 @@ static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
4835 REMARKS:
4836 Handles opcode 0x37
4837 ****************************************************************************/
4838-static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
4839+static void
4840+x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
4841 {
4842 START_OF_INSTR();
4843 DECODE_PRINTF("AAA\n");
4844@@ -3053,7 +3180,8 @@ static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
4845 REMARKS:
4846 Handles opcode 0x38
4847 ****************************************************************************/
4848-static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
4849+static void
4850+x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
4851 {
4852 int mod, rl, rh;
4853 uint destoffset;
4854@@ -3091,7 +3219,7 @@ static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
4855 TRACE_AND_STEP();
4856 cmp_byte(destval, *srcreg);
4857 break;
4858- case 3: /* register to register */
4859+ case 3: /* register to register */
4860 destreg = DECODE_RM_BYTE_REGISTER(rl);
4861 DECODE_PRINTF(",");
4862 srcreg = DECODE_RM_BYTE_REGISTER(rh);
4863@@ -3108,7 +3236,8 @@ static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
4864 REMARKS:
4865 Handles opcode 0x39
4866 ****************************************************************************/
4867-static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4868+static void
4869+x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4870 {
4871 int mod, rl, rh;
4872 uint destoffset;
4873@@ -3129,7 +3258,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4874 DECODE_PRINTF("\n");
4875 TRACE_AND_STEP();
4876 cmp_long(destval, *srcreg);
4877- } else {
4878+ }
4879+ else {
4880 u16 destval;
4881 u16 *srcreg;
4882
4883@@ -3154,7 +3284,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4884 DECODE_PRINTF("\n");
4885 TRACE_AND_STEP();
4886 cmp_long(destval, *srcreg);
4887- } else {
4888+ }
4889+ else {
4890 u16 destval;
4891 u16 *srcreg;
4892
4893@@ -3179,7 +3310,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4894 DECODE_PRINTF("\n");
4895 TRACE_AND_STEP();
4896 cmp_long(destval, *srcreg);
4897- } else {
4898+ }
4899+ else {
4900 u16 destval;
4901 u16 *srcreg;
4902
4903@@ -3192,9 +3324,9 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4904 cmp_word(destval, *srcreg);
4905 }
4906 break;
4907- case 3: /* register to register */
4908+ case 3: /* register to register */
4909 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4910- u32 *destreg,*srcreg;
4911+ u32 *destreg, *srcreg;
4912
4913 destreg = DECODE_RM_LONG_REGISTER(rl);
4914 DECODE_PRINTF(",");
4915@@ -3202,8 +3334,9 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4916 DECODE_PRINTF("\n");
4917 TRACE_AND_STEP();
4918 cmp_long(*destreg, *srcreg);
4919- } else {
4920- u16 *destreg,*srcreg;
4921+ }
4922+ else {
4923+ u16 *destreg, *srcreg;
4924
4925 destreg = DECODE_RM_WORD_REGISTER(rl);
4926 DECODE_PRINTF(",");
4927@@ -3222,7 +3355,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
4928 REMARKS:
4929 Handles opcode 0x3a
4930 ****************************************************************************/
4931-static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
4932+static void
4933+x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
4934 {
4935 int mod, rl, rh;
4936 u8 *destreg, *srcreg;
4937@@ -3260,7 +3394,7 @@ static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
4938 TRACE_AND_STEP();
4939 cmp_byte(*destreg, srcval);
4940 break;
4941- case 3: /* register to register */
4942+ case 3: /* register to register */
4943 destreg = DECODE_RM_BYTE_REGISTER(rh);
4944 DECODE_PRINTF(",");
4945 srcreg = DECODE_RM_BYTE_REGISTER(rl);
4946@@ -3277,7 +3411,8 @@ static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
4947 REMARKS:
4948 Handles opcode 0x3b
4949 ****************************************************************************/
4950-static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4951+static void
4952+x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4953 {
4954 int mod, rl, rh;
4955 uint srcoffset;
4956@@ -3298,7 +3433,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4957 DECODE_PRINTF("\n");
4958 TRACE_AND_STEP();
4959 cmp_long(*destreg, srcval);
4960- } else {
4961+ }
4962+ else {
4963 u16 *destreg;
4964 u16 srcval;
4965
4966@@ -3323,7 +3459,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4967 DECODE_PRINTF("\n");
4968 TRACE_AND_STEP();
4969 cmp_long(*destreg, srcval);
4970- } else {
4971+ }
4972+ else {
4973 u16 *destreg;
4974 u16 srcval;
4975
4976@@ -3348,7 +3485,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4977 DECODE_PRINTF("\n");
4978 TRACE_AND_STEP();
4979 cmp_long(*destreg, srcval);
4980- } else {
4981+ }
4982+ else {
4983 u16 *destreg;
4984 u16 srcval;
4985
4986@@ -3361,9 +3499,9 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4987 cmp_word(*destreg, srcval);
4988 }
4989 break;
4990- case 3: /* register to register */
4991+ case 3: /* register to register */
4992 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
4993- u32 *destreg,*srcreg;
4994+ u32 *destreg, *srcreg;
4995
4996 destreg = DECODE_RM_LONG_REGISTER(rh);
4997 DECODE_PRINTF(",");
4998@@ -3371,8 +3509,9 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
4999 DECODE_PRINTF("\n");
5000 TRACE_AND_STEP();
5001 cmp_long(*destreg, *srcreg);
5002- } else {
5003- u16 *destreg,*srcreg;
5004+ }
5005+ else {
5006+ u16 *destreg, *srcreg;
5007
5008 destreg = DECODE_RM_WORD_REGISTER(rh);
5009 DECODE_PRINTF(",");
5010@@ -3391,7 +3530,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
5011 REMARKS:
5012 Handles opcode 0x3c
5013 ****************************************************************************/
5014-static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
5015+static void
5016+x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
5017 {
5018 u8 srcval;
5019
5020@@ -3409,7 +3549,8 @@ static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
5021 REMARKS:
5022 Handles opcode 0x3d
5023 ****************************************************************************/
5024-static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
5025+static void
5026+x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
5027 {
5028 u32 srcval;
5029
5030@@ -3417,7 +3558,8 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
5031 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5032 DECODE_PRINTF("CMP\tEAX,");
5033 srcval = fetch_long_imm();
5034- } else {
5035+ }
5036+ else {
5037 DECODE_PRINTF("CMP\tAX,");
5038 srcval = fetch_word_imm();
5039 }
5040@@ -3425,8 +3567,9 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
5041 TRACE_AND_STEP();
5042 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5043 cmp_long(M.x86.R_EAX, srcval);
5044- } else {
5045- cmp_word(M.x86.R_AX, (u16)srcval);
5046+ }
5047+ else {
5048+ cmp_word(M.x86.R_AX, (u16) srcval);
5049 }
5050 DECODE_CLEAR_SEGOVR();
5051 END_OF_INSTR();
5052@@ -3436,7 +3579,8 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
5053 REMARKS:
5054 Handles opcode 0x3e
5055 ****************************************************************************/
5056-static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
5057+static void
5058+x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
5059 {
5060 START_OF_INSTR();
5061 DECODE_PRINTF("DS:\n");
5062@@ -3450,7 +3594,8 @@ static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
5063 REMARKS:
5064 Handles opcode 0x3f
5065 ****************************************************************************/
5066-static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
5067+static void
5068+x86emuOp_aas(u8 X86EMU_UNUSED(op1))
5069 {
5070 START_OF_INSTR();
5071 DECODE_PRINTF("AAS\n");
5072@@ -3464,18 +3609,21 @@ static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
5073 REMARKS:
5074 Handles opcode 0x40
5075 ****************************************************************************/
5076-static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
5077+static void
5078+x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
5079 {
5080 START_OF_INSTR();
5081 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5082 DECODE_PRINTF("INC\tEAX\n");
5083- } else {
5084+ }
5085+ else {
5086 DECODE_PRINTF("INC\tAX\n");
5087 }
5088 TRACE_AND_STEP();
5089 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5090 M.x86.R_EAX = inc_long(M.x86.R_EAX);
5091- } else {
5092+ }
5093+ else {
5094 M.x86.R_AX = inc_word(M.x86.R_AX);
5095 }
5096 DECODE_CLEAR_SEGOVR();
5097@@ -3486,18 +3634,21 @@ static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
5098 REMARKS:
5099 Handles opcode 0x41
5100 ****************************************************************************/
5101-static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
5102+static void
5103+x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
5104 {
5105 START_OF_INSTR();
5106 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5107 DECODE_PRINTF("INC\tECX\n");
5108- } else {
5109+ }
5110+ else {
5111 DECODE_PRINTF("INC\tCX\n");
5112 }
5113 TRACE_AND_STEP();
5114 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5115 M.x86.R_ECX = inc_long(M.x86.R_ECX);
5116- } else {
5117+ }
5118+ else {
5119 M.x86.R_CX = inc_word(M.x86.R_CX);
5120 }
5121 DECODE_CLEAR_SEGOVR();
5122@@ -3508,18 +3659,21 @@ static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
5123 REMARKS:
5124 Handles opcode 0x42
5125 ****************************************************************************/
5126-static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
5127+static void
5128+x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
5129 {
5130 START_OF_INSTR();
5131 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5132 DECODE_PRINTF("INC\tEDX\n");
5133- } else {
5134+ }
5135+ else {
5136 DECODE_PRINTF("INC\tDX\n");
5137 }
5138 TRACE_AND_STEP();
5139 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5140 M.x86.R_EDX = inc_long(M.x86.R_EDX);
5141- } else {
5142+ }
5143+ else {
5144 M.x86.R_DX = inc_word(M.x86.R_DX);
5145 }
5146 DECODE_CLEAR_SEGOVR();
5147@@ -3530,18 +3684,21 @@ static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
5148 REMARKS:
5149 Handles opcode 0x43
5150 ****************************************************************************/
5151-static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
5152+static void
5153+x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
5154 {
5155 START_OF_INSTR();
5156 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5157 DECODE_PRINTF("INC\tEBX\n");
5158- } else {
5159+ }
5160+ else {
5161 DECODE_PRINTF("INC\tBX\n");
5162 }
5163 TRACE_AND_STEP();
5164 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5165 M.x86.R_EBX = inc_long(M.x86.R_EBX);
5166- } else {
5167+ }
5168+ else {
5169 M.x86.R_BX = inc_word(M.x86.R_BX);
5170 }
5171 DECODE_CLEAR_SEGOVR();
5172@@ -3552,18 +3709,21 @@ static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
5173 REMARKS:
5174 Handles opcode 0x44
5175 ****************************************************************************/
5176-static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
5177+static void
5178+x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
5179 {
5180 START_OF_INSTR();
5181 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5182 DECODE_PRINTF("INC\tESP\n");
5183- } else {
5184+ }
5185+ else {
5186 DECODE_PRINTF("INC\tSP\n");
5187 }
5188 TRACE_AND_STEP();
5189 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5190 M.x86.R_ESP = inc_long(M.x86.R_ESP);
5191- } else {
5192+ }
5193+ else {
5194 M.x86.R_SP = inc_word(M.x86.R_SP);
5195 }
5196 DECODE_CLEAR_SEGOVR();
5197@@ -3574,18 +3734,21 @@ static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
5198 REMARKS:
5199 Handles opcode 0x45
5200 ****************************************************************************/
5201-static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
5202+static void
5203+x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
5204 {
5205 START_OF_INSTR();
5206 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5207 DECODE_PRINTF("INC\tEBP\n");
5208- } else {
5209+ }
5210+ else {
5211 DECODE_PRINTF("INC\tBP\n");
5212 }
5213 TRACE_AND_STEP();
5214 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5215 M.x86.R_EBP = inc_long(M.x86.R_EBP);
5216- } else {
5217+ }
5218+ else {
5219 M.x86.R_BP = inc_word(M.x86.R_BP);
5220 }
5221 DECODE_CLEAR_SEGOVR();
5222@@ -3596,18 +3759,21 @@ static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
5223 REMARKS:
5224 Handles opcode 0x46
5225 ****************************************************************************/
5226-static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
5227+static void
5228+x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
5229 {
5230 START_OF_INSTR();
5231 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5232 DECODE_PRINTF("INC\tESI\n");
5233- } else {
5234+ }
5235+ else {
5236 DECODE_PRINTF("INC\tSI\n");
5237 }
5238 TRACE_AND_STEP();
5239 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5240 M.x86.R_ESI = inc_long(M.x86.R_ESI);
5241- } else {
5242+ }
5243+ else {
5244 M.x86.R_SI = inc_word(M.x86.R_SI);
5245 }
5246 DECODE_CLEAR_SEGOVR();
5247@@ -3618,18 +3784,21 @@ static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
5248 REMARKS:
5249 Handles opcode 0x47
5250 ****************************************************************************/
5251-static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
5252+static void
5253+x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
5254 {
5255 START_OF_INSTR();
5256 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5257 DECODE_PRINTF("INC\tEDI\n");
5258- } else {
5259+ }
5260+ else {
5261 DECODE_PRINTF("INC\tDI\n");
5262 }
5263 TRACE_AND_STEP();
5264 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5265 M.x86.R_EDI = inc_long(M.x86.R_EDI);
5266- } else {
5267+ }
5268+ else {
5269 M.x86.R_DI = inc_word(M.x86.R_DI);
5270 }
5271 DECODE_CLEAR_SEGOVR();
5272@@ -3640,18 +3809,21 @@ static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
5273 REMARKS:
5274 Handles opcode 0x48
5275 ****************************************************************************/
5276-static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
5277+static void
5278+x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
5279 {
5280 START_OF_INSTR();
5281 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5282 DECODE_PRINTF("DEC\tEAX\n");
5283- } else {
5284+ }
5285+ else {
5286 DECODE_PRINTF("DEC\tAX\n");
5287 }
5288 TRACE_AND_STEP();
5289 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5290 M.x86.R_EAX = dec_long(M.x86.R_EAX);
5291- } else {
5292+ }
5293+ else {
5294 M.x86.R_AX = dec_word(M.x86.R_AX);
5295 }
5296 DECODE_CLEAR_SEGOVR();
5297@@ -3662,18 +3834,21 @@ static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
5298 REMARKS:
5299 Handles opcode 0x49
5300 ****************************************************************************/
5301-static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
5302+static void
5303+x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
5304 {
5305 START_OF_INSTR();
5306 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5307 DECODE_PRINTF("DEC\tECX\n");
5308- } else {
5309+ }
5310+ else {
5311 DECODE_PRINTF("DEC\tCX\n");
5312 }
5313 TRACE_AND_STEP();
5314 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5315 M.x86.R_ECX = dec_long(M.x86.R_ECX);
5316- } else {
5317+ }
5318+ else {
5319 M.x86.R_CX = dec_word(M.x86.R_CX);
5320 }
5321 DECODE_CLEAR_SEGOVR();
5322@@ -3684,18 +3859,21 @@ static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
5323 REMARKS:
5324 Handles opcode 0x4a
5325 ****************************************************************************/
5326-static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
5327+static void
5328+x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
5329 {
5330 START_OF_INSTR();
5331 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5332 DECODE_PRINTF("DEC\tEDX\n");
5333- } else {
5334+ }
5335+ else {
5336 DECODE_PRINTF("DEC\tDX\n");
5337 }
5338 TRACE_AND_STEP();
5339 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5340 M.x86.R_EDX = dec_long(M.x86.R_EDX);
5341- } else {
5342+ }
5343+ else {
5344 M.x86.R_DX = dec_word(M.x86.R_DX);
5345 }
5346 DECODE_CLEAR_SEGOVR();
5347@@ -3706,18 +3884,21 @@ static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
5348 REMARKS:
5349 Handles opcode 0x4b
5350 ****************************************************************************/
5351-static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
5352+static void
5353+x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
5354 {
5355 START_OF_INSTR();
5356 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5357 DECODE_PRINTF("DEC\tEBX\n");
5358- } else {
5359+ }
5360+ else {
5361 DECODE_PRINTF("DEC\tBX\n");
5362 }
5363 TRACE_AND_STEP();
5364 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5365 M.x86.R_EBX = dec_long(M.x86.R_EBX);
5366- } else {
5367+ }
5368+ else {
5369 M.x86.R_BX = dec_word(M.x86.R_BX);
5370 }
5371 DECODE_CLEAR_SEGOVR();
5372@@ -3728,18 +3909,21 @@ static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
5373 REMARKS:
5374 Handles opcode 0x4c
5375 ****************************************************************************/
5376-static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
5377+static void
5378+x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
5379 {
5380 START_OF_INSTR();
5381 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5382 DECODE_PRINTF("DEC\tESP\n");
5383- } else {
5384+ }
5385+ else {
5386 DECODE_PRINTF("DEC\tSP\n");
5387 }
5388 TRACE_AND_STEP();
5389 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5390 M.x86.R_ESP = dec_long(M.x86.R_ESP);
5391- } else {
5392+ }
5393+ else {
5394 M.x86.R_SP = dec_word(M.x86.R_SP);
5395 }
5396 DECODE_CLEAR_SEGOVR();
5397@@ -3750,18 +3934,21 @@ static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
5398 REMARKS:
5399 Handles opcode 0x4d
5400 ****************************************************************************/
5401-static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
5402+static void
5403+x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
5404 {
5405 START_OF_INSTR();
5406 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5407 DECODE_PRINTF("DEC\tEBP\n");
5408- } else {
5409+ }
5410+ else {
5411 DECODE_PRINTF("DEC\tBP\n");
5412 }
5413 TRACE_AND_STEP();
5414 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5415 M.x86.R_EBP = dec_long(M.x86.R_EBP);
5416- } else {
5417+ }
5418+ else {
5419 M.x86.R_BP = dec_word(M.x86.R_BP);
5420 }
5421 DECODE_CLEAR_SEGOVR();
5422@@ -3772,18 +3959,21 @@ static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
5423 REMARKS:
5424 Handles opcode 0x4e
5425 ****************************************************************************/
5426-static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
5427+static void
5428+x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
5429 {
5430 START_OF_INSTR();
5431 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5432 DECODE_PRINTF("DEC\tESI\n");
5433- } else {
5434+ }
5435+ else {
5436 DECODE_PRINTF("DEC\tSI\n");
5437 }
5438 TRACE_AND_STEP();
5439 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5440 M.x86.R_ESI = dec_long(M.x86.R_ESI);
5441- } else {
5442+ }
5443+ else {
5444 M.x86.R_SI = dec_word(M.x86.R_SI);
5445 }
5446 DECODE_CLEAR_SEGOVR();
5447@@ -3794,18 +3984,21 @@ static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
5448 REMARKS:
5449 Handles opcode 0x4f
5450 ****************************************************************************/
5451-static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
5452+static void
5453+x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
5454 {
5455 START_OF_INSTR();
5456 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5457 DECODE_PRINTF("DEC\tEDI\n");
5458- } else {
5459+ }
5460+ else {
5461 DECODE_PRINTF("DEC\tDI\n");
5462 }
5463 TRACE_AND_STEP();
5464 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5465 M.x86.R_EDI = dec_long(M.x86.R_EDI);
5466- } else {
5467+ }
5468+ else {
5469 M.x86.R_DI = dec_word(M.x86.R_DI);
5470 }
5471 DECODE_CLEAR_SEGOVR();
5472@@ -3816,18 +4009,21 @@ static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
5473 REMARKS:
5474 Handles opcode 0x50
5475 ****************************************************************************/
5476-static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
5477+static void
5478+x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
5479 {
5480 START_OF_INSTR();
5481 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5482 DECODE_PRINTF("PUSH\tEAX\n");
5483- } else {
5484+ }
5485+ else {
5486 DECODE_PRINTF("PUSH\tAX\n");
5487 }
5488 TRACE_AND_STEP();
5489 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5490 push_long(M.x86.R_EAX);
5491- } else {
5492+ }
5493+ else {
5494 push_word(M.x86.R_AX);
5495 }
5496 DECODE_CLEAR_SEGOVR();
5497@@ -3838,18 +4034,21 @@ static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
5498 REMARKS:
5499 Handles opcode 0x51
5500 ****************************************************************************/
5501-static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
5502+static void
5503+x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
5504 {
5505 START_OF_INSTR();
5506 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5507 DECODE_PRINTF("PUSH\tECX\n");
5508- } else {
5509+ }
5510+ else {
5511 DECODE_PRINTF("PUSH\tCX\n");
5512 }
5513 TRACE_AND_STEP();
5514 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5515 push_long(M.x86.R_ECX);
5516- } else {
5517+ }
5518+ else {
5519 push_word(M.x86.R_CX);
5520 }
5521 DECODE_CLEAR_SEGOVR();
5522@@ -3860,18 +4059,21 @@ static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
5523 REMARKS:
5524 Handles opcode 0x52
5525 ****************************************************************************/
5526-static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
5527+static void
5528+x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
5529 {
5530 START_OF_INSTR();
5531 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5532 DECODE_PRINTF("PUSH\tEDX\n");
5533- } else {
5534+ }
5535+ else {
5536 DECODE_PRINTF("PUSH\tDX\n");
5537 }
5538 TRACE_AND_STEP();
5539 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5540 push_long(M.x86.R_EDX);
5541- } else {
5542+ }
5543+ else {
5544 push_word(M.x86.R_DX);
5545 }
5546 DECODE_CLEAR_SEGOVR();
5547@@ -3882,18 +4084,21 @@ static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
5548 REMARKS:
5549 Handles opcode 0x53
5550 ****************************************************************************/
5551-static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
5552+static void
5553+x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
5554 {
5555 START_OF_INSTR();
5556 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5557 DECODE_PRINTF("PUSH\tEBX\n");
5558- } else {
5559+ }
5560+ else {
5561 DECODE_PRINTF("PUSH\tBX\n");
5562 }
5563 TRACE_AND_STEP();
5564 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5565 push_long(M.x86.R_EBX);
5566- } else {
5567+ }
5568+ else {
5569 push_word(M.x86.R_BX);
5570 }
5571 DECODE_CLEAR_SEGOVR();
5572@@ -3904,23 +4109,26 @@ static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
5573 REMARKS:
5574 Handles opcode 0x54
5575 ****************************************************************************/
5576-static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
5577+static void
5578+x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
5579 {
5580 START_OF_INSTR();
5581 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5582 DECODE_PRINTF("PUSH\tESP\n");
5583- } else {
5584+ }
5585+ else {
5586 DECODE_PRINTF("PUSH\tSP\n");
5587 }
5588 TRACE_AND_STEP();
5589- /* Always push (E)SP, since we are emulating an i386 and above
5590- * processor. This is necessary as some BIOS'es use this to check
5591- * what type of processor is in the system.
5592- */
5593- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5594- push_long(M.x86.R_ESP);
5595- } else {
5596- push_word((u16)(M.x86.R_SP));
5597+ /* Always push (E)SP, since we are emulating an i386 and above
5598+ * processor. This is necessary as some BIOS'es use this to check
5599+ * what type of processor is in the system.
5600+ */
5601+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5602+ push_long(M.x86.R_ESP);
5603+ }
5604+ else {
5605+ push_word((u16) (M.x86.R_SP));
5606 }
5607 DECODE_CLEAR_SEGOVR();
5608 END_OF_INSTR();
5609@@ -3930,18 +4138,21 @@ static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
5610 REMARKS:
5611 Handles opcode 0x55
5612 ****************************************************************************/
5613-static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
5614+static void
5615+x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
5616 {
5617 START_OF_INSTR();
5618 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5619 DECODE_PRINTF("PUSH\tEBP\n");
5620- } else {
5621+ }
5622+ else {
5623 DECODE_PRINTF("PUSH\tBP\n");
5624 }
5625 TRACE_AND_STEP();
5626 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5627 push_long(M.x86.R_EBP);
5628- } else {
5629+ }
5630+ else {
5631 push_word(M.x86.R_BP);
5632 }
5633 DECODE_CLEAR_SEGOVR();
5634@@ -3952,18 +4163,21 @@ static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
5635 REMARKS:
5636 Handles opcode 0x56
5637 ****************************************************************************/
5638-static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
5639+static void
5640+x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
5641 {
5642 START_OF_INSTR();
5643 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5644 DECODE_PRINTF("PUSH\tESI\n");
5645- } else {
5646+ }
5647+ else {
5648 DECODE_PRINTF("PUSH\tSI\n");
5649 }
5650 TRACE_AND_STEP();
5651 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5652 push_long(M.x86.R_ESI);
5653- } else {
5654+ }
5655+ else {
5656 push_word(M.x86.R_SI);
5657 }
5658 DECODE_CLEAR_SEGOVR();
5659@@ -3974,18 +4188,21 @@ static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
5660 REMARKS:
5661 Handles opcode 0x57
5662 ****************************************************************************/
5663-static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
5664+static void
5665+x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
5666 {
5667 START_OF_INSTR();
5668 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5669 DECODE_PRINTF("PUSH\tEDI\n");
5670- } else {
5671+ }
5672+ else {
5673 DECODE_PRINTF("PUSH\tDI\n");
5674 }
5675 TRACE_AND_STEP();
5676 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5677 push_long(M.x86.R_EDI);
5678- } else {
5679+ }
5680+ else {
5681 push_word(M.x86.R_DI);
5682 }
5683 DECODE_CLEAR_SEGOVR();
5684@@ -3996,18 +4213,21 @@ static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
5685 REMARKS:
5686 Handles opcode 0x58
5687 ****************************************************************************/
5688-static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
5689+static void
5690+x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
5691 {
5692 START_OF_INSTR();
5693 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5694 DECODE_PRINTF("POP\tEAX\n");
5695- } else {
5696+ }
5697+ else {
5698 DECODE_PRINTF("POP\tAX\n");
5699 }
5700 TRACE_AND_STEP();
5701 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5702 M.x86.R_EAX = pop_long();
5703- } else {
5704+ }
5705+ else {
5706 M.x86.R_AX = pop_word();
5707 }
5708 DECODE_CLEAR_SEGOVR();
5709@@ -4018,18 +4238,21 @@ static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
5710 REMARKS:
5711 Handles opcode 0x59
5712 ****************************************************************************/
5713-static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
5714+static void
5715+x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
5716 {
5717 START_OF_INSTR();
5718 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5719 DECODE_PRINTF("POP\tECX\n");
5720- } else {
5721+ }
5722+ else {
5723 DECODE_PRINTF("POP\tCX\n");
5724 }
5725 TRACE_AND_STEP();
5726 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5727 M.x86.R_ECX = pop_long();
5728- } else {
5729+ }
5730+ else {
5731 M.x86.R_CX = pop_word();
5732 }
5733 DECODE_CLEAR_SEGOVR();
5734@@ -4040,18 +4263,21 @@ static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
5735 REMARKS:
5736 Handles opcode 0x5a
5737 ****************************************************************************/
5738-static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
5739+static void
5740+x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
5741 {
5742 START_OF_INSTR();
5743 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5744 DECODE_PRINTF("POP\tEDX\n");
5745- } else {
5746+ }
5747+ else {
5748 DECODE_PRINTF("POP\tDX\n");
5749 }
5750 TRACE_AND_STEP();
5751 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5752 M.x86.R_EDX = pop_long();
5753- } else {
5754+ }
5755+ else {
5756 M.x86.R_DX = pop_word();
5757 }
5758 DECODE_CLEAR_SEGOVR();
5759@@ -4062,18 +4288,21 @@ static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
5760 REMARKS:
5761 Handles opcode 0x5b
5762 ****************************************************************************/
5763-static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
5764+static void
5765+x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
5766 {
5767 START_OF_INSTR();
5768 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5769 DECODE_PRINTF("POP\tEBX\n");
5770- } else {
5771+ }
5772+ else {
5773 DECODE_PRINTF("POP\tBX\n");
5774 }
5775 TRACE_AND_STEP();
5776 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5777 M.x86.R_EBX = pop_long();
5778- } else {
5779+ }
5780+ else {
5781 M.x86.R_BX = pop_word();
5782 }
5783 DECODE_CLEAR_SEGOVR();
5784@@ -4084,18 +4313,21 @@ static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
5785 REMARKS:
5786 Handles opcode 0x5c
5787 ****************************************************************************/
5788-static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
5789+static void
5790+x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
5791 {
5792 START_OF_INSTR();
5793 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5794 DECODE_PRINTF("POP\tESP\n");
5795- } else {
5796+ }
5797+ else {
5798 DECODE_PRINTF("POP\tSP\n");
5799 }
5800 TRACE_AND_STEP();
5801 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5802 M.x86.R_ESP = pop_long();
5803- } else {
5804+ }
5805+ else {
5806 M.x86.R_SP = pop_word();
5807 }
5808 DECODE_CLEAR_SEGOVR();
5809@@ -4106,18 +4338,21 @@ static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
5810 REMARKS:
5811 Handles opcode 0x5d
5812 ****************************************************************************/
5813-static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
5814+static void
5815+x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
5816 {
5817 START_OF_INSTR();
5818 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5819 DECODE_PRINTF("POP\tEBP\n");
5820- } else {
5821+ }
5822+ else {
5823 DECODE_PRINTF("POP\tBP\n");
5824 }
5825 TRACE_AND_STEP();
5826 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5827 M.x86.R_EBP = pop_long();
5828- } else {
5829+ }
5830+ else {
5831 M.x86.R_BP = pop_word();
5832 }
5833 DECODE_CLEAR_SEGOVR();
5834@@ -4128,18 +4363,21 @@ static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
5835 REMARKS:
5836 Handles opcode 0x5e
5837 ****************************************************************************/
5838-static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
5839+static void
5840+x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
5841 {
5842 START_OF_INSTR();
5843 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5844 DECODE_PRINTF("POP\tESI\n");
5845- } else {
5846+ }
5847+ else {
5848 DECODE_PRINTF("POP\tSI\n");
5849 }
5850 TRACE_AND_STEP();
5851 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5852 M.x86.R_ESI = pop_long();
5853- } else {
5854+ }
5855+ else {
5856 M.x86.R_SI = pop_word();
5857 }
5858 DECODE_CLEAR_SEGOVR();
5859@@ -4150,18 +4388,21 @@ static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
5860 REMARKS:
5861 Handles opcode 0x5f
5862 ****************************************************************************/
5863-static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
5864+static void
5865+x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
5866 {
5867 START_OF_INSTR();
5868 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5869 DECODE_PRINTF("POP\tEDI\n");
5870- } else {
5871+ }
5872+ else {
5873 DECODE_PRINTF("POP\tDI\n");
5874 }
5875 TRACE_AND_STEP();
5876 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5877 M.x86.R_EDI = pop_long();
5878- } else {
5879+ }
5880+ else {
5881 M.x86.R_DI = pop_word();
5882 }
5883 DECODE_CLEAR_SEGOVR();
5884@@ -4172,12 +4413,14 @@ static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
5885 REMARKS:
5886 Handles opcode 0x60
5887 ****************************************************************************/
5888-static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
5889+static void
5890+x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
5891 {
5892 START_OF_INSTR();
5893 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5894 DECODE_PRINTF("PUSHAD\n");
5895- } else {
5896+ }
5897+ else {
5898 DECODE_PRINTF("PUSHA\n");
5899 }
5900 TRACE_AND_STEP();
5901@@ -4192,7 +4435,8 @@ static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
5902 push_long(M.x86.R_EBP);
5903 push_long(M.x86.R_ESI);
5904 push_long(M.x86.R_EDI);
5905- } else {
5906+ }
5907+ else {
5908 u16 old_sp = M.x86.R_SP;
5909
5910 push_word(M.x86.R_AX);
5911@@ -4212,12 +4456,14 @@ static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
5912 REMARKS:
5913 Handles opcode 0x61
5914 ****************************************************************************/
5915-static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
5916+static void
5917+x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
5918 {
5919 START_OF_INSTR();
5920 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
5921 DECODE_PRINTF("POPAD\n");
5922- } else {
5923+ }
5924+ else {
5925 DECODE_PRINTF("POPA\n");
5926 }
5927 TRACE_AND_STEP();
5928@@ -4225,16 +4471,17 @@ static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
5929 M.x86.R_EDI = pop_long();
5930 M.x86.R_ESI = pop_long();
5931 M.x86.R_EBP = pop_long();
5932- M.x86.R_ESP += 4; /* skip ESP */
5933+ M.x86.R_ESP += 4; /* skip ESP */
5934 M.x86.R_EBX = pop_long();
5935 M.x86.R_EDX = pop_long();
5936 M.x86.R_ECX = pop_long();
5937 M.x86.R_EAX = pop_long();
5938- } else {
5939+ }
5940+ else {
5941 M.x86.R_DI = pop_word();
5942 M.x86.R_SI = pop_word();
5943 M.x86.R_BP = pop_word();
5944- M.x86.R_SP += 2; /* skip SP */
5945+ M.x86.R_SP += 2; /* skip SP */
5946 M.x86.R_BX = pop_word();
5947 M.x86.R_DX = pop_word();
5948 M.x86.R_CX = pop_word();
5949@@ -4251,7 +4498,8 @@ static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
5950 REMARKS:
5951 Handles opcode 0x64
5952 ****************************************************************************/
5953-static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
5954+static void
5955+x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
5956 {
5957 START_OF_INSTR();
5958 DECODE_PRINTF("FS:\n");
5959@@ -4268,7 +4516,8 @@ static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
5960 REMARKS:
5961 Handles opcode 0x65
5962 ****************************************************************************/
5963-static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
5964+static void
5965+x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
5966 {
5967 START_OF_INSTR();
5968 DECODE_PRINTF("GS:\n");
5969@@ -4285,7 +4534,8 @@ static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
5970 REMARKS:
5971 Handles opcode 0x66 - prefix for 32-bit register
5972 ****************************************************************************/
5973-static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
5974+static void
5975+x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
5976 {
5977 START_OF_INSTR();
5978 DECODE_PRINTF("DATA:\n");
5979@@ -4299,7 +4549,8 @@ static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
5980 REMARKS:
5981 Handles opcode 0x67 - prefix for 32-bit address
5982 ****************************************************************************/
5983-static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
5984+static void
5985+x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
5986 {
5987 START_OF_INSTR();
5988 DECODE_PRINTF("ADDR:\n");
5989@@ -4313,22 +4564,25 @@ static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
5990 REMARKS:
5991 Handles opcode 0x68
5992 ****************************************************************************/
5993-static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
5994+static void
5995+x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
5996 {
5997 u32 imm;
5998
5999 START_OF_INSTR();
6000 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6001 imm = fetch_long_imm();
6002- } else {
6003+ }
6004+ else {
6005 imm = fetch_word_imm();
6006 }
6007 DECODE_PRINTF2("PUSH\t%x\n", imm);
6008 TRACE_AND_STEP();
6009 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6010 push_long(imm);
6011- } else {
6012- push_word((u16)imm);
6013+ }
6014+ else {
6015+ push_word((u16) imm);
6016 }
6017 DECODE_CLEAR_SEGOVR();
6018 END_OF_INSTR();
6019@@ -4338,7 +4592,8 @@ static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
6020 REMARKS:
6021 Handles opcode 0x69
6022 ****************************************************************************/
6023-static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6024+static void
6025+x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6026 {
6027 int mod, rl, rh;
6028 uint srcoffset;
6029@@ -4351,7 +4606,7 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6030 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6031 u32 *destreg;
6032 u32 srcval;
6033- u32 res_lo,res_hi;
6034+ u32 res_lo, res_hi;
6035 s32 imm;
6036
6037 destreg = DECODE_RM_LONG_REGISTER(rh);
6038@@ -4359,18 +4614,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6039 srcoffset = decode_rm00_address(rl);
6040 srcval = fetch_data_long(srcoffset);
6041 imm = fetch_long_imm();
6042- DECODE_PRINTF2(",%d\n", (s32)imm);
6043+ DECODE_PRINTF2(",%d\n", (s32) imm);
6044 TRACE_AND_STEP();
6045- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6046+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6047 if (res_hi != 0) {
6048 SET_FLAG(F_CF);
6049 SET_FLAG(F_OF);
6050- } else {
6051+ }
6052+ else {
6053 CLEAR_FLAG(F_CF);
6054 CLEAR_FLAG(F_OF);
6055 }
6056- *destreg = (u32)res_lo;
6057- } else {
6058+ *destreg = (u32) res_lo;
6059+ }
6060+ else {
6061 u16 *destreg;
6062 u16 srcval;
6063 u32 res;
6064@@ -4381,24 +4638,26 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6065 srcoffset = decode_rm00_address(rl);
6066 srcval = fetch_data_word(srcoffset);
6067 imm = fetch_word_imm();
6068- DECODE_PRINTF2(",%d\n", (s32)imm);
6069+ DECODE_PRINTF2(",%d\n", (s32) imm);
6070 TRACE_AND_STEP();
6071- res = (s16)srcval * (s16)imm;
6072+ res = (s16) srcval *(s16) imm;
6073+
6074 if (res > 0xFFFF) {
6075 SET_FLAG(F_CF);
6076 SET_FLAG(F_OF);
6077- } else {
6078+ }
6079+ else {
6080 CLEAR_FLAG(F_CF);
6081 CLEAR_FLAG(F_OF);
6082 }
6083- *destreg = (u16)res;
6084+ *destreg = (u16) res;
6085 }
6086 break;
6087 case 1:
6088 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6089 u32 *destreg;
6090 u32 srcval;
6091- u32 res_lo,res_hi;
6092+ u32 res_lo, res_hi;
6093 s32 imm;
6094
6095 destreg = DECODE_RM_LONG_REGISTER(rh);
6096@@ -4406,18 +4665,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6097 srcoffset = decode_rm01_address(rl);
6098 srcval = fetch_data_long(srcoffset);
6099 imm = fetch_long_imm();
6100- DECODE_PRINTF2(",%d\n", (s32)imm);
6101+ DECODE_PRINTF2(",%d\n", (s32) imm);
6102 TRACE_AND_STEP();
6103- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6104+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6105 if (res_hi != 0) {
6106 SET_FLAG(F_CF);
6107 SET_FLAG(F_OF);
6108- } else {
6109+ }
6110+ else {
6111 CLEAR_FLAG(F_CF);
6112 CLEAR_FLAG(F_OF);
6113 }
6114- *destreg = (u32)res_lo;
6115- } else {
6116+ *destreg = (u32) res_lo;
6117+ }
6118+ else {
6119 u16 *destreg;
6120 u16 srcval;
6121 u32 res;
6122@@ -4428,24 +4689,26 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6123 srcoffset = decode_rm01_address(rl);
6124 srcval = fetch_data_word(srcoffset);
6125 imm = fetch_word_imm();
6126- DECODE_PRINTF2(",%d\n", (s32)imm);
6127+ DECODE_PRINTF2(",%d\n", (s32) imm);
6128 TRACE_AND_STEP();
6129- res = (s16)srcval * (s16)imm;
6130+ res = (s16) srcval *(s16) imm;
6131+
6132 if (res > 0xFFFF) {
6133 SET_FLAG(F_CF);
6134 SET_FLAG(F_OF);
6135- } else {
6136+ }
6137+ else {
6138 CLEAR_FLAG(F_CF);
6139 CLEAR_FLAG(F_OF);
6140 }
6141- *destreg = (u16)res;
6142+ *destreg = (u16) res;
6143 }
6144 break;
6145 case 2:
6146 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6147 u32 *destreg;
6148 u32 srcval;
6149- u32 res_lo,res_hi;
6150+ u32 res_lo, res_hi;
6151 s32 imm;
6152
6153 destreg = DECODE_RM_LONG_REGISTER(rh);
6154@@ -4453,18 +4716,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6155 srcoffset = decode_rm10_address(rl);
6156 srcval = fetch_data_long(srcoffset);
6157 imm = fetch_long_imm();
6158- DECODE_PRINTF2(",%d\n", (s32)imm);
6159+ DECODE_PRINTF2(",%d\n", (s32) imm);
6160 TRACE_AND_STEP();
6161- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6162+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6163 if (res_hi != 0) {
6164 SET_FLAG(F_CF);
6165 SET_FLAG(F_OF);
6166- } else {
6167+ }
6168+ else {
6169 CLEAR_FLAG(F_CF);
6170 CLEAR_FLAG(F_OF);
6171 }
6172- *destreg = (u32)res_lo;
6173- } else {
6174+ *destreg = (u32) res_lo;
6175+ }
6176+ else {
6177 u16 *destreg;
6178 u16 srcval;
6179 u32 res;
6180@@ -4475,42 +4740,46 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6181 srcoffset = decode_rm10_address(rl);
6182 srcval = fetch_data_word(srcoffset);
6183 imm = fetch_word_imm();
6184- DECODE_PRINTF2(",%d\n", (s32)imm);
6185+ DECODE_PRINTF2(",%d\n", (s32) imm);
6186 TRACE_AND_STEP();
6187- res = (s16)srcval * (s16)imm;
6188+ res = (s16) srcval *(s16) imm;
6189+
6190 if (res > 0xFFFF) {
6191 SET_FLAG(F_CF);
6192 SET_FLAG(F_OF);
6193- } else {
6194+ }
6195+ else {
6196 CLEAR_FLAG(F_CF);
6197 CLEAR_FLAG(F_OF);
6198 }
6199- *destreg = (u16)res;
6200+ *destreg = (u16) res;
6201 }
6202 break;
6203- case 3: /* register to register */
6204+ case 3: /* register to register */
6205 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6206- u32 *destreg,*srcreg;
6207- u32 res_lo,res_hi;
6208+ u32 *destreg, *srcreg;
6209+ u32 res_lo, res_hi;
6210 s32 imm;
6211
6212 destreg = DECODE_RM_LONG_REGISTER(rh);
6213 DECODE_PRINTF(",");
6214 srcreg = DECODE_RM_LONG_REGISTER(rl);
6215 imm = fetch_long_imm();
6216- DECODE_PRINTF2(",%d\n", (s32)imm);
6217+ DECODE_PRINTF2(",%d\n", (s32) imm);
6218 TRACE_AND_STEP();
6219- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
6220+ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
6221 if (res_hi != 0) {
6222 SET_FLAG(F_CF);
6223 SET_FLAG(F_OF);
6224- } else {
6225+ }
6226+ else {
6227 CLEAR_FLAG(F_CF);
6228 CLEAR_FLAG(F_OF);
6229 }
6230- *destreg = (u32)res_lo;
6231- } else {
6232- u16 *destreg,*srcreg;
6233+ *destreg = (u32) res_lo;
6234+ }
6235+ else {
6236+ u16 *destreg, *srcreg;
6237 u32 res;
6238 s16 imm;
6239
6240@@ -4518,16 +4787,17 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6241 DECODE_PRINTF(",");
6242 srcreg = DECODE_RM_WORD_REGISTER(rl);
6243 imm = fetch_word_imm();
6244- DECODE_PRINTF2(",%d\n", (s32)imm);
6245- res = (s16)*srcreg * (s16)imm;
6246+ DECODE_PRINTF2(",%d\n", (s32) imm);
6247+ res = (s16) * srcreg * (s16) imm;
6248 if (res > 0xFFFF) {
6249 SET_FLAG(F_CF);
6250 SET_FLAG(F_OF);
6251- } else {
6252+ }
6253+ else {
6254 CLEAR_FLAG(F_CF);
6255 CLEAR_FLAG(F_OF);
6256 }
6257- *destreg = (u16)res;
6258+ *destreg = (u16) res;
6259 }
6260 break;
6261 }
6262@@ -4539,18 +4809,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
6263 REMARKS:
6264 Handles opcode 0x6a
6265 ****************************************************************************/
6266-static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
6267+static void
6268+x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
6269 {
6270 s16 imm;
6271
6272 START_OF_INSTR();
6273- imm = (s8)fetch_byte_imm();
6274+ imm = (s8) fetch_byte_imm();
6275 DECODE_PRINTF2("PUSH\t%d\n", imm);
6276 TRACE_AND_STEP();
6277 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6278- push_long((s32)imm);
6279- } else {
6280- push_word(imm);
6281+ push_long((s32) imm);
6282+ }
6283+ else {
6284+ push_word(imm);
6285 }
6286 DECODE_CLEAR_SEGOVR();
6287 END_OF_INSTR();
6288@@ -4560,11 +4832,12 @@ static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
6289 REMARKS:
6290 Handles opcode 0x6b
6291 ****************************************************************************/
6292-static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6293+static void
6294+x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6295 {
6296 int mod, rl, rh;
6297 uint srcoffset;
6298- s8 imm;
6299+ s8 imm;
6300
6301 START_OF_INSTR();
6302 DECODE_PRINTF("IMUL\t");
6303@@ -4574,25 +4847,27 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6304 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6305 u32 *destreg;
6306 u32 srcval;
6307- u32 res_lo,res_hi;
6308+ u32 res_lo, res_hi;
6309
6310 destreg = DECODE_RM_LONG_REGISTER(rh);
6311 DECODE_PRINTF(",");
6312 srcoffset = decode_rm00_address(rl);
6313 srcval = fetch_data_long(srcoffset);
6314 imm = fetch_byte_imm();
6315- DECODE_PRINTF2(",%d\n", (s32)imm);
6316+ DECODE_PRINTF2(",%d\n", (s32) imm);
6317 TRACE_AND_STEP();
6318- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6319+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6320 if (res_hi != 0) {
6321 SET_FLAG(F_CF);
6322 SET_FLAG(F_OF);
6323- } else {
6324+ }
6325+ else {
6326 CLEAR_FLAG(F_CF);
6327 CLEAR_FLAG(F_OF);
6328 }
6329- *destreg = (u32)res_lo;
6330- } else {
6331+ *destreg = (u32) res_lo;
6332+ }
6333+ else {
6334 u16 *destreg;
6335 u16 srcval;
6336 u32 res;
6337@@ -4602,42 +4877,46 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6338 srcoffset = decode_rm00_address(rl);
6339 srcval = fetch_data_word(srcoffset);
6340 imm = fetch_byte_imm();
6341- DECODE_PRINTF2(",%d\n", (s32)imm);
6342+ DECODE_PRINTF2(",%d\n", (s32) imm);
6343 TRACE_AND_STEP();
6344- res = (s16)srcval * (s16)imm;
6345+ res = (s16) srcval *(s16) imm;
6346+
6347 if (res > 0xFFFF) {
6348 SET_FLAG(F_CF);
6349 SET_FLAG(F_OF);
6350- } else {
6351+ }
6352+ else {
6353 CLEAR_FLAG(F_CF);
6354 CLEAR_FLAG(F_OF);
6355 }
6356- *destreg = (u16)res;
6357+ *destreg = (u16) res;
6358 }
6359 break;
6360 case 1:
6361 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6362 u32 *destreg;
6363 u32 srcval;
6364- u32 res_lo,res_hi;
6365+ u32 res_lo, res_hi;
6366
6367 destreg = DECODE_RM_LONG_REGISTER(rh);
6368 DECODE_PRINTF(",");
6369 srcoffset = decode_rm01_address(rl);
6370 srcval = fetch_data_long(srcoffset);
6371 imm = fetch_byte_imm();
6372- DECODE_PRINTF2(",%d\n", (s32)imm);
6373+ DECODE_PRINTF2(",%d\n", (s32) imm);
6374 TRACE_AND_STEP();
6375- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6376+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6377 if (res_hi != 0) {
6378 SET_FLAG(F_CF);
6379 SET_FLAG(F_OF);
6380- } else {
6381+ }
6382+ else {
6383 CLEAR_FLAG(F_CF);
6384 CLEAR_FLAG(F_OF);
6385 }
6386- *destreg = (u32)res_lo;
6387- } else {
6388+ *destreg = (u32) res_lo;
6389+ }
6390+ else {
6391 u16 *destreg;
6392 u16 srcval;
6393 u32 res;
6394@@ -4647,42 +4926,46 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6395 srcoffset = decode_rm01_address(rl);
6396 srcval = fetch_data_word(srcoffset);
6397 imm = fetch_byte_imm();
6398- DECODE_PRINTF2(",%d\n", (s32)imm);
6399+ DECODE_PRINTF2(",%d\n", (s32) imm);
6400 TRACE_AND_STEP();
6401- res = (s16)srcval * (s16)imm;
6402+ res = (s16) srcval *(s16) imm;
6403+
6404 if (res > 0xFFFF) {
6405 SET_FLAG(F_CF);
6406 SET_FLAG(F_OF);
6407- } else {
6408+ }
6409+ else {
6410 CLEAR_FLAG(F_CF);
6411 CLEAR_FLAG(F_OF);
6412 }
6413- *destreg = (u16)res;
6414+ *destreg = (u16) res;
6415 }
6416 break;
6417 case 2:
6418 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6419 u32 *destreg;
6420 u32 srcval;
6421- u32 res_lo,res_hi;
6422+ u32 res_lo, res_hi;
6423
6424 destreg = DECODE_RM_LONG_REGISTER(rh);
6425 DECODE_PRINTF(",");
6426 srcoffset = decode_rm10_address(rl);
6427 srcval = fetch_data_long(srcoffset);
6428 imm = fetch_byte_imm();
6429- DECODE_PRINTF2(",%d\n", (s32)imm);
6430+ DECODE_PRINTF2(",%d\n", (s32) imm);
6431 TRACE_AND_STEP();
6432- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
6433+ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
6434 if (res_hi != 0) {
6435 SET_FLAG(F_CF);
6436 SET_FLAG(F_OF);
6437- } else {
6438+ }
6439+ else {
6440 CLEAR_FLAG(F_CF);
6441 CLEAR_FLAG(F_OF);
6442 }
6443- *destreg = (u32)res_lo;
6444- } else {
6445+ *destreg = (u32) res_lo;
6446+ }
6447+ else {
6448 u16 *destreg;
6449 u16 srcval;
6450 u32 res;
6451@@ -4692,57 +4975,62 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6452 srcoffset = decode_rm10_address(rl);
6453 srcval = fetch_data_word(srcoffset);
6454 imm = fetch_byte_imm();
6455- DECODE_PRINTF2(",%d\n", (s32)imm);
6456+ DECODE_PRINTF2(",%d\n", (s32) imm);
6457 TRACE_AND_STEP();
6458- res = (s16)srcval * (s16)imm;
6459+ res = (s16) srcval *(s16) imm;
6460+
6461 if (res > 0xFFFF) {
6462 SET_FLAG(F_CF);
6463 SET_FLAG(F_OF);
6464- } else {
6465+ }
6466+ else {
6467 CLEAR_FLAG(F_CF);
6468 CLEAR_FLAG(F_OF);
6469 }
6470- *destreg = (u16)res;
6471+ *destreg = (u16) res;
6472 }
6473 break;
6474- case 3: /* register to register */
6475+ case 3: /* register to register */
6476 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6477- u32 *destreg,*srcreg;
6478- u32 res_lo,res_hi;
6479+ u32 *destreg, *srcreg;
6480+ u32 res_lo, res_hi;
6481
6482 destreg = DECODE_RM_LONG_REGISTER(rh);
6483 DECODE_PRINTF(",");
6484 srcreg = DECODE_RM_LONG_REGISTER(rl);
6485 imm = fetch_byte_imm();
6486- DECODE_PRINTF2(",%d\n", (s32)imm);
6487+ DECODE_PRINTF2(",%d\n", (s32) imm);
6488 TRACE_AND_STEP();
6489- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
6490+ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
6491 if (res_hi != 0) {
6492 SET_FLAG(F_CF);
6493 SET_FLAG(F_OF);
6494- } else {
6495+ }
6496+ else {
6497 CLEAR_FLAG(F_CF);
6498 CLEAR_FLAG(F_OF);
6499 }
6500- *destreg = (u32)res_lo;
6501- } else {
6502- u16 *destreg,*srcreg;
6503+ *destreg = (u32) res_lo;
6504+ }
6505+ else {
6506+ u16 *destreg, *srcreg;
6507 u32 res;
6508
6509 destreg = DECODE_RM_WORD_REGISTER(rh);
6510 DECODE_PRINTF(",");
6511 srcreg = DECODE_RM_WORD_REGISTER(rl);
6512 imm = fetch_byte_imm();
6513- DECODE_PRINTF2(",%d\n", (s32)imm);
6514- res = (s16)*srcreg * (s16)imm;
6515+ DECODE_PRINTF2(",%d\n", (s32) imm);
6516+ res = (s16) * srcreg * (s16) imm;
6517 if (res > 0xFFFF) {
6518 SET_FLAG(F_CF);
6519 SET_FLAG(F_OF);
6520- } else {
6521+ }
6522+ else {
6523 CLEAR_FLAG(F_CF);
6524 CLEAR_FLAG(F_OF);
6525 }
6526- *destreg = (u16)res;
6527+ *destreg = (u16) res;
6528 }
6529 break;
6530 }
6531@@ -4754,7 +5042,8 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
6532 REMARKS:
6533 Handles opcode 0x6c
6534 ****************************************************************************/
6535-static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
6536+static void
6537+x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
6538 {
6539 START_OF_INSTR();
6540 DECODE_PRINTF("INSB\n");
6541@@ -4768,13 +5057,15 @@ static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
6542 REMARKS:
6543 Handles opcode 0x6d
6544 ****************************************************************************/
6545-static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
6546+static void
6547+x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
6548 {
6549 START_OF_INSTR();
6550 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6551 DECODE_PRINTF("INSD\n");
6552 ins(4);
6553- } else {
6554+ }
6555+ else {
6556 DECODE_PRINTF("INSW\n");
6557 ins(2);
6558 }
6559@@ -4787,7 +5078,8 @@ static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
6560 REMARKS:
6561 Handles opcode 0x6e
6562 ****************************************************************************/
6563-static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
6564+static void
6565+x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
6566 {
6567 START_OF_INSTR();
6568 DECODE_PRINTF("OUTSB\n");
6569@@ -4801,13 +5093,15 @@ static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
6570 REMARKS:
6571 Handles opcode 0x6f
6572 ****************************************************************************/
6573-static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
6574+static void
6575+x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
6576 {
6577 START_OF_INSTR();
6578 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
6579 DECODE_PRINTF("OUTSD\n");
6580 outs(4);
6581- } else {
6582+ }
6583+ else {
6584 DECODE_PRINTF("OUTSW\n");
6585 outs(2);
6586 }
6587@@ -4820,7 +5114,8 @@ static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
6588 REMARKS:
6589 Handles opcode 0x70
6590 ****************************************************************************/
6591-static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
6592+static void
6593+x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
6594 {
6595 s8 offset;
6596 u16 target;
6597@@ -4828,8 +5123,8 @@ static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
6598 /* jump to byte offset if overflow flag is set */
6599 START_OF_INSTR();
6600 DECODE_PRINTF("JO\t");
6601- offset = (s8)fetch_byte_imm();
6602- target = (u16)(M.x86.R_IP + (s16)offset);
6603+ offset = (s8) fetch_byte_imm();
6604+ target = (u16) (M.x86.R_IP + (s16) offset);
6605 DECODE_PRINTF2("%x\n", target);
6606 TRACE_AND_STEP();
6607 if (ACCESS_FLAG(F_OF))
6608@@ -4842,7 +5137,8 @@ static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
6609 REMARKS:
6610 Handles opcode 0x71
6611 ****************************************************************************/
6612-static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
6613+static void
6614+x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
6615 {
6616 s8 offset;
6617 u16 target;
6618@@ -4850,8 +5146,8 @@ static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
6619 /* jump to byte offset if overflow is not set */
6620 START_OF_INSTR();
6621 DECODE_PRINTF("JNO\t");
6622- offset = (s8)fetch_byte_imm();
6623- target = (u16)(M.x86.R_IP + (s16)offset);
6624+ offset = (s8) fetch_byte_imm();
6625+ target = (u16) (M.x86.R_IP + (s16) offset);
6626 DECODE_PRINTF2("%x\n", target);
6627 TRACE_AND_STEP();
6628 if (!ACCESS_FLAG(F_OF))
6629@@ -4864,7 +5160,8 @@ static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
6630 REMARKS:
6631 Handles opcode 0x72
6632 ****************************************************************************/
6633-static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
6634+static void
6635+x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
6636 {
6637 s8 offset;
6638 u16 target;
6639@@ -4872,8 +5169,8 @@ static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
6640 /* jump to byte offset if carry flag is set. */
6641 START_OF_INSTR();
6642 DECODE_PRINTF("JB\t");
6643- offset = (s8)fetch_byte_imm();
6644- target = (u16)(M.x86.R_IP + (s16)offset);
6645+ offset = (s8) fetch_byte_imm();
6646+ target = (u16) (M.x86.R_IP + (s16) offset);
6647 DECODE_PRINTF2("%x\n", target);
6648 TRACE_AND_STEP();
6649 if (ACCESS_FLAG(F_CF))
6650@@ -4886,7 +5183,8 @@ static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
6651 REMARKS:
6652 Handles opcode 0x73
6653 ****************************************************************************/
6654-static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
6655+static void
6656+x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
6657 {
6658 s8 offset;
6659 u16 target;
6660@@ -4894,8 +5192,8 @@ static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
6661 /* jump to byte offset if carry flag is clear. */
6662 START_OF_INSTR();
6663 DECODE_PRINTF("JNB\t");
6664- offset = (s8)fetch_byte_imm();
6665- target = (u16)(M.x86.R_IP + (s16)offset);
6666+ offset = (s8) fetch_byte_imm();
6667+ target = (u16) (M.x86.R_IP + (s16) offset);
6668 DECODE_PRINTF2("%x\n", target);
6669 TRACE_AND_STEP();
6670 if (!ACCESS_FLAG(F_CF))
6671@@ -4908,7 +5206,8 @@ static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
6672 REMARKS:
6673 Handles opcode 0x74
6674 ****************************************************************************/
6675-static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
6676+static void
6677+x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
6678 {
6679 s8 offset;
6680 u16 target;
6681@@ -4916,8 +5215,8 @@ static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
6682 /* jump to byte offset if zero flag is set. */
6683 START_OF_INSTR();
6684 DECODE_PRINTF("JZ\t");
6685- offset = (s8)fetch_byte_imm();
6686- target = (u16)(M.x86.R_IP + (s16)offset);
6687+ offset = (s8) fetch_byte_imm();
6688+ target = (u16) (M.x86.R_IP + (s16) offset);
6689 DECODE_PRINTF2("%x\n", target);
6690 TRACE_AND_STEP();
6691 if (ACCESS_FLAG(F_ZF))
6692@@ -4930,7 +5229,8 @@ static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
6693 REMARKS:
6694 Handles opcode 0x75
6695 ****************************************************************************/
6696-static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
6697+static void
6698+x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
6699 {
6700 s8 offset;
6701 u16 target;
6702@@ -4938,8 +5238,8 @@ static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
6703 /* jump to byte offset if zero flag is clear. */
6704 START_OF_INSTR();
6705 DECODE_PRINTF("JNZ\t");
6706- offset = (s8)fetch_byte_imm();
6707- target = (u16)(M.x86.R_IP + (s16)offset);
6708+ offset = (s8) fetch_byte_imm();
6709+ target = (u16) (M.x86.R_IP + (s16) offset);
6710 DECODE_PRINTF2("%x\n", target);
6711 TRACE_AND_STEP();
6712 if (!ACCESS_FLAG(F_ZF))
6713@@ -4952,7 +5252,8 @@ static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
6714 REMARKS:
6715 Handles opcode 0x76
6716 ****************************************************************************/
6717-static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
6718+static void
6719+x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
6720 {
6721 s8 offset;
6722 u16 target;
6723@@ -4961,8 +5262,8 @@ static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
6724 flag is set. */
6725 START_OF_INSTR();
6726 DECODE_PRINTF("JBE\t");
6727- offset = (s8)fetch_byte_imm();
6728- target = (u16)(M.x86.R_IP + (s16)offset);
6729+ offset = (s8) fetch_byte_imm();
6730+ target = (u16) (M.x86.R_IP + (s16) offset);
6731 DECODE_PRINTF2("%x\n", target);
6732 TRACE_AND_STEP();
6733 if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
6734@@ -4975,7 +5276,8 @@ static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
6735 REMARKS:
6736 Handles opcode 0x77
6737 ****************************************************************************/
6738-static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
6739+static void
6740+x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
6741 {
6742 s8 offset;
6743 u16 target;
6744@@ -4984,8 +5286,8 @@ static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
6745 flag is clear */
6746 START_OF_INSTR();
6747 DECODE_PRINTF("JNBE\t");
6748- offset = (s8)fetch_byte_imm();
6749- target = (u16)(M.x86.R_IP + (s16)offset);
6750+ offset = (s8) fetch_byte_imm();
6751+ target = (u16) (M.x86.R_IP + (s16) offset);
6752 DECODE_PRINTF2("%x\n", target);
6753 TRACE_AND_STEP();
6754 if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
6755@@ -4998,7 +5300,8 @@ static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
6756 REMARKS:
6757 Handles opcode 0x78
6758 ****************************************************************************/
6759-static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
6760+static void
6761+x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
6762 {
6763 s8 offset;
6764 u16 target;
6765@@ -5006,8 +5309,8 @@ static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
6766 /* jump to byte offset if sign flag is set */
6767 START_OF_INSTR();
6768 DECODE_PRINTF("JS\t");
6769- offset = (s8)fetch_byte_imm();
6770- target = (u16)(M.x86.R_IP + (s16)offset);
6771+ offset = (s8) fetch_byte_imm();
6772+ target = (u16) (M.x86.R_IP + (s16) offset);
6773 DECODE_PRINTF2("%x\n", target);
6774 TRACE_AND_STEP();
6775 if (ACCESS_FLAG(F_SF))
6776@@ -5020,7 +5323,8 @@ static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
6777 REMARKS:
6778 Handles opcode 0x79
6779 ****************************************************************************/
6780-static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
6781+static void
6782+x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
6783 {
6784 s8 offset;
6785 u16 target;
6786@@ -5028,8 +5332,8 @@ static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
6787 /* jump to byte offset if sign flag is clear */
6788 START_OF_INSTR();
6789 DECODE_PRINTF("JNS\t");
6790- offset = (s8)fetch_byte_imm();
6791- target = (u16)(M.x86.R_IP + (s16)offset);
6792+ offset = (s8) fetch_byte_imm();
6793+ target = (u16) (M.x86.R_IP + (s16) offset);
6794 DECODE_PRINTF2("%x\n", target);
6795 TRACE_AND_STEP();
6796 if (!ACCESS_FLAG(F_SF))
6797@@ -5042,7 +5346,8 @@ static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
6798 REMARKS:
6799 Handles opcode 0x7a
6800 ****************************************************************************/
6801-static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
6802+static void
6803+x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
6804 {
6805 s8 offset;
6806 u16 target;
6807@@ -5050,8 +5355,8 @@ static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
6808 /* jump to byte offset if parity flag is set (even parity) */
6809 START_OF_INSTR();
6810 DECODE_PRINTF("JP\t");
6811- offset = (s8)fetch_byte_imm();
6812- target = (u16)(M.x86.R_IP + (s16)offset);
6813+ offset = (s8) fetch_byte_imm();
6814+ target = (u16) (M.x86.R_IP + (s16) offset);
6815 DECODE_PRINTF2("%x\n", target);
6816 TRACE_AND_STEP();
6817 if (ACCESS_FLAG(F_PF))
6818@@ -5064,7 +5369,8 @@ static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
6819 REMARKS:
6820 Handles opcode 0x7b
6821 ****************************************************************************/
6822-static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
6823+static void
6824+x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
6825 {
6826 s8 offset;
6827 u16 target;
6828@@ -5072,8 +5378,8 @@ static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
6829 /* jump to byte offset if parity flag is clear (odd parity) */
6830 START_OF_INSTR();
6831 DECODE_PRINTF("JNP\t");
6832- offset = (s8)fetch_byte_imm();
6833- target = (u16)(M.x86.R_IP + (s16)offset);
6834+ offset = (s8) fetch_byte_imm();
6835+ target = (u16) (M.x86.R_IP + (s16) offset);
6836 DECODE_PRINTF2("%x\n", target);
6837 TRACE_AND_STEP();
6838 if (!ACCESS_FLAG(F_PF))
6839@@ -5086,7 +5392,8 @@ static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
6840 REMARKS:
6841 Handles opcode 0x7c
6842 ****************************************************************************/
6843-static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
6844+static void
6845+x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
6846 {
6847 s8 offset;
6848 u16 target;
6849@@ -5095,8 +5402,8 @@ static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
6850 /* jump to byte offset if sign flag not equal to overflow flag. */
6851 START_OF_INSTR();
6852 DECODE_PRINTF("JL\t");
6853- offset = (s8)fetch_byte_imm();
6854- target = (u16)(M.x86.R_IP + (s16)offset);
6855+ offset = (s8) fetch_byte_imm();
6856+ target = (u16) (M.x86.R_IP + (s16) offset);
6857 DECODE_PRINTF2("%x\n", target);
6858 TRACE_AND_STEP();
6859 sf = ACCESS_FLAG(F_SF) != 0;
6860@@ -5111,7 +5418,8 @@ static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
6861 REMARKS:
6862 Handles opcode 0x7d
6863 ****************************************************************************/
6864-static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
6865+static void
6866+x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
6867 {
6868 s8 offset;
6869 u16 target;
6870@@ -5120,8 +5428,8 @@ static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
6871 /* jump to byte offset if sign flag not equal to overflow flag. */
6872 START_OF_INSTR();
6873 DECODE_PRINTF("JNL\t");
6874- offset = (s8)fetch_byte_imm();
6875- target = (u16)(M.x86.R_IP + (s16)offset);
6876+ offset = (s8) fetch_byte_imm();
6877+ target = (u16) (M.x86.R_IP + (s16) offset);
6878 DECODE_PRINTF2("%x\n", target);
6879 TRACE_AND_STEP();
6880 sf = ACCESS_FLAG(F_SF) != 0;
6881@@ -5137,7 +5445,8 @@ static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
6882 REMARKS:
6883 Handles opcode 0x7e
6884 ****************************************************************************/
6885-static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
6886+static void
6887+x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
6888 {
6889 s8 offset;
6890 u16 target;
6891@@ -5147,8 +5456,8 @@ static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
6892 or the zero flag is set */
6893 START_OF_INSTR();
6894 DECODE_PRINTF("JLE\t");
6895- offset = (s8)fetch_byte_imm();
6896- target = (u16)(M.x86.R_IP + (s16)offset);
6897+ offset = (s8) fetch_byte_imm();
6898+ target = (u16) (M.x86.R_IP + (s16) offset);
6899 DECODE_PRINTF2("%x\n", target);
6900 TRACE_AND_STEP();
6901 sf = ACCESS_FLAG(F_SF) != 0;
6902@@ -5163,7 +5472,8 @@ static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
6903 REMARKS:
6904 Handles opcode 0x7f
6905 ****************************************************************************/
6906-static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
6907+static void
6908+x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
6909 {
6910 s8 offset;
6911 u16 target;
6912@@ -5173,8 +5483,8 @@ static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
6913 and the zero flag is clear */
6914 START_OF_INSTR();
6915 DECODE_PRINTF("JNLE\t");
6916- offset = (s8)fetch_byte_imm();
6917- target = (u16)(M.x86.R_IP + (s16)offset);
6918+ offset = (s8) fetch_byte_imm();
6919+ target = (u16) (M.x86.R_IP + (s16) offset);
6920 DECODE_PRINTF2("%x\n", target);
6921 TRACE_AND_STEP();
6922 sf = ACCESS_FLAG(F_SF) != 0;
6923@@ -5185,23 +5495,23 @@ static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
6924 END_OF_INSTR();
6925 }
6926
6927-static u8 (*opc80_byte_operation[])(u8 d, u8 s) =
6928-{
6929- add_byte, /* 00 */
6930- or_byte, /* 01 */
6931- adc_byte, /* 02 */
6932- sbb_byte, /* 03 */
6933- and_byte, /* 04 */
6934- sub_byte, /* 05 */
6935- xor_byte, /* 06 */
6936- cmp_byte, /* 07 */
6937+static u8(*opc80_byte_operation[]) (u8 d, u8 s) = {
6938+ add_byte, /* 00 */
6939+ or_byte, /* 01 */
6940+ adc_byte, /* 02 */
6941+ sbb_byte, /* 03 */
6942+ and_byte, /* 04 */
6943+ sub_byte, /* 05 */
6944+ xor_byte, /* 06 */
6945+ cmp_byte, /* 07 */
6946 };
6947
6948 /****************************************************************************
6949 REMARKS:
6950 Handles opcode 0x80
6951 ****************************************************************************/
6952-static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
6953+static void
6954+x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
6955 {
6956 int mod, rl, rh;
6957 u8 *destreg;
6958@@ -5290,7 +5600,7 @@ static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
6959 if (rh != 7)
6960 store_data_byte(destoffset, destval);
6961 break;
6962- case 3: /* register to register */
6963+ case 3: /* register to register */
6964 destreg = DECODE_RM_BYTE_REGISTER(rl);
6965 DECODE_PRINTF(",");
6966 imm = fetch_byte_imm();
6967@@ -5305,35 +5615,34 @@ static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
6968 END_OF_INSTR();
6969 }
6970
6971-static u16 (*opc81_word_operation[])(u16 d, u16 s) =
6972-{
6973- add_word, /*00 */
6974- or_word, /*01 */
6975- adc_word, /*02 */
6976- sbb_word, /*03 */
6977- and_word, /*04 */
6978- sub_word, /*05 */
6979- xor_word, /*06 */
6980- cmp_word, /*07 */
6981+static u16(*opc81_word_operation[]) (u16 d, u16 s) = {
6982+ add_word, /*00 */
6983+ or_word, /*01 */
6984+ adc_word, /*02 */
6985+ sbb_word, /*03 */
6986+ and_word, /*04 */
6987+ sub_word, /*05 */
6988+ xor_word, /*06 */
6989+ cmp_word, /*07 */
6990 };
6991
6992-static u32 (*opc81_long_operation[])(u32 d, u32 s) =
6993-{
6994- add_long, /*00 */
6995- or_long, /*01 */
6996- adc_long, /*02 */
6997- sbb_long, /*03 */
6998- and_long, /*04 */
6999- sub_long, /*05 */
7000- xor_long, /*06 */
7001- cmp_long, /*07 */
7002+static u32(*opc81_long_operation[]) (u32 d, u32 s) = {
7003+ add_long, /*00 */
7004+ or_long, /*01 */
7005+ adc_long, /*02 */
7006+ sbb_long, /*03 */
7007+ and_long, /*04 */
7008+ sub_long, /*05 */
7009+ xor_long, /*06 */
7010+ cmp_long, /*07 */
7011 };
7012
7013 /****************************************************************************
7014 REMARKS:
7015 Handles opcode 0x81
7016 ****************************************************************************/
7017-static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7018+static void
7019+x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7020 {
7021 int mod, rl, rh;
7022 uint destoffset;
7023@@ -5387,7 +5696,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7024 switch (mod) {
7025 case 0:
7026 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7027- u32 destval,imm;
7028+ u32 destval, imm;
7029
7030 DECODE_PRINTF("DWORD PTR ");
7031 destoffset = decode_rm00_address(rl);
7032@@ -5399,8 +5708,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7033 destval = (*opc81_long_operation[rh]) (destval, imm);
7034 if (rh != 7)
7035 store_data_long(destoffset, destval);
7036- } else {
7037- u16 destval,imm;
7038+ }
7039+ else {
7040+ u16 destval, imm;
7041
7042 DECODE_PRINTF("WORD PTR ");
7043 destoffset = decode_rm00_address(rl);
7044@@ -5416,7 +5726,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7045 break;
7046 case 1:
7047 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7048- u32 destval,imm;
7049+ u32 destval, imm;
7050
7051 DECODE_PRINTF("DWORD PTR ");
7052 destoffset = decode_rm01_address(rl);
7053@@ -5428,8 +5738,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7054 destval = (*opc81_long_operation[rh]) (destval, imm);
7055 if (rh != 7)
7056 store_data_long(destoffset, destval);
7057- } else {
7058- u16 destval,imm;
7059+ }
7060+ else {
7061+ u16 destval, imm;
7062
7063 DECODE_PRINTF("WORD PTR ");
7064 destoffset = decode_rm01_address(rl);
7065@@ -5445,7 +5756,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7066 break;
7067 case 2:
7068 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7069- u32 destval,imm;
7070+ u32 destval, imm;
7071
7072 DECODE_PRINTF("DWORD PTR ");
7073 destoffset = decode_rm10_address(rl);
7074@@ -5457,8 +5768,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7075 destval = (*opc81_long_operation[rh]) (destval, imm);
7076 if (rh != 7)
7077 store_data_long(destoffset, destval);
7078- } else {
7079- u16 destval,imm;
7080+ }
7081+ else {
7082+ u16 destval, imm;
7083
7084 DECODE_PRINTF("WORD PTR ");
7085 destoffset = decode_rm10_address(rl);
7086@@ -5472,10 +5784,10 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7087 store_data_word(destoffset, destval);
7088 }
7089 break;
7090- case 3: /* register to register */
7091+ case 3: /* register to register */
7092 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7093 u32 *destreg;
7094- u32 destval,imm;
7095+ u32 destval, imm;
7096
7097 destreg = DECODE_RM_LONG_REGISTER(rl);
7098 DECODE_PRINTF(",");
7099@@ -5485,9 +5797,10 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7100 destval = (*opc81_long_operation[rh]) (*destreg, imm);
7101 if (rh != 7)
7102 *destreg = destval;
7103- } else {
7104+ }
7105+ else {
7106 u16 *destreg;
7107- u16 destval,imm;
7108+ u16 destval, imm;
7109
7110 destreg = DECODE_RM_WORD_REGISTER(rl);
7111 DECODE_PRINTF(",");
7112@@ -5504,23 +5817,23 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7113 END_OF_INSTR();
7114 }
7115
7116-static u8 (*opc82_byte_operation[])(u8 s, u8 d) =
7117-{
7118- add_byte, /*00 */
7119- or_byte, /*01 *//*YYY UNUSED ???? */
7120- adc_byte, /*02 */
7121- sbb_byte, /*03 */
7122- and_byte, /*04 *//*YYY UNUSED ???? */
7123- sub_byte, /*05 */
7124- xor_byte, /*06 *//*YYY UNUSED ???? */
7125- cmp_byte, /*07 */
7126+static u8(*opc82_byte_operation[]) (u8 s, u8 d) = {
7127+ add_byte, /*00 */
7128+ or_byte, /*01 *//*YYY UNUSED ???? */
7129+ adc_byte, /*02 */
7130+ sbb_byte, /*03 */
7131+ and_byte, /*04 *//*YYY UNUSED ???? */
7132+ sub_byte, /*05 */
7133+ xor_byte, /*06 *//*YYY UNUSED ???? */
7134+ cmp_byte, /*07 */
7135 };
7136
7137 /****************************************************************************
7138 REMARKS:
7139 Handles opcode 0x82
7140 ****************************************************************************/
7141-static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
7142+static void
7143+x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
7144 {
7145 int mod, rl, rh;
7146 u8 *destreg;
7147@@ -5606,7 +5919,7 @@ static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
7148 if (rh != 7)
7149 store_data_byte(destoffset, destval);
7150 break;
7151- case 3: /* register to register */
7152+ case 3: /* register to register */
7153 destreg = DECODE_RM_BYTE_REGISTER(rl);
7154 imm = fetch_byte_imm();
7155 DECODE_PRINTF2(",%x\n", imm);
7156@@ -5620,35 +5933,34 @@ static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
7157 END_OF_INSTR();
7158 }
7159
7160-static u16 (*opc83_word_operation[])(u16 s, u16 d) =
7161-{
7162- add_word, /*00 */
7163- or_word, /*01 *//*YYY UNUSED ???? */
7164- adc_word, /*02 */
7165- sbb_word, /*03 */
7166- and_word, /*04 *//*YYY UNUSED ???? */
7167- sub_word, /*05 */
7168- xor_word, /*06 *//*YYY UNUSED ???? */
7169- cmp_word, /*07 */
7170+static u16(*opc83_word_operation[]) (u16 s, u16 d) = {
7171+ add_word, /*00 */
7172+ or_word, /*01 *//*YYY UNUSED ???? */
7173+ adc_word, /*02 */
7174+ sbb_word, /*03 */
7175+ and_word, /*04 *//*YYY UNUSED ???? */
7176+ sub_word, /*05 */
7177+ xor_word, /*06 *//*YYY UNUSED ???? */
7178+ cmp_word, /*07 */
7179 };
7180
7181-static u32 (*opc83_long_operation[])(u32 s, u32 d) =
7182-{
7183- add_long, /*00 */
7184- or_long, /*01 *//*YYY UNUSED ???? */
7185- adc_long, /*02 */
7186- sbb_long, /*03 */
7187- and_long, /*04 *//*YYY UNUSED ???? */
7188- sub_long, /*05 */
7189- xor_long, /*06 *//*YYY UNUSED ???? */
7190- cmp_long, /*07 */
7191+static u32(*opc83_long_operation[]) (u32 s, u32 d) = {
7192+ add_long, /*00 */
7193+ or_long, /*01 *//*YYY UNUSED ???? */
7194+ adc_long, /*02 */
7195+ sbb_long, /*03 */
7196+ and_long, /*04 *//*YYY UNUSED ???? */
7197+ sub_long, /*05 */
7198+ xor_long, /*06 *//*YYY UNUSED ???? */
7199+ cmp_long, /*07 */
7200 };
7201
7202 /****************************************************************************
7203 REMARKS:
7204 Handles opcode 0x83
7205 ****************************************************************************/
7206-static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7207+static void
7208+x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7209 {
7210 int mod, rl, rh;
7211 uint destoffset;
7212@@ -5667,7 +5979,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7213 general, so that it is important to leave the strings
7214 in the same format, even though the result is that the
7215 above test is done twice. */
7216- switch (rh) {
7217+ switch (rh) {
7218 case 0:
7219 DECODE_PRINTF("ADD\t");
7220 break;
7221@@ -5700,7 +6012,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7222 switch (mod) {
7223 case 0:
7224 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7225- u32 destval,imm;
7226+ u32 destval, imm;
7227
7228 DECODE_PRINTF("DWORD PTR ");
7229 destoffset = decode_rm00_address(rl);
7230@@ -5711,8 +6023,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7231 destval = (*opc83_long_operation[rh]) (destval, imm);
7232 if (rh != 7)
7233 store_data_long(destoffset, destval);
7234- } else {
7235- u16 destval,imm;
7236+ }
7237+ else {
7238+ u16 destval, imm;
7239
7240 DECODE_PRINTF("WORD PTR ");
7241 destoffset = decode_rm00_address(rl);
7242@@ -5727,7 +6040,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7243 break;
7244 case 1:
7245 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7246- u32 destval,imm;
7247+ u32 destval, imm;
7248
7249 DECODE_PRINTF("DWORD PTR ");
7250 destoffset = decode_rm01_address(rl);
7251@@ -5738,8 +6051,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7252 destval = (*opc83_long_operation[rh]) (destval, imm);
7253 if (rh != 7)
7254 store_data_long(destoffset, destval);
7255- } else {
7256- u16 destval,imm;
7257+ }
7258+ else {
7259+ u16 destval, imm;
7260
7261 DECODE_PRINTF("WORD PTR ");
7262 destoffset = decode_rm01_address(rl);
7263@@ -5754,7 +6068,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7264 break;
7265 case 2:
7266 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7267- u32 destval,imm;
7268+ u32 destval, imm;
7269
7270 DECODE_PRINTF("DWORD PTR ");
7271 destoffset = decode_rm10_address(rl);
7272@@ -5765,8 +6079,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7273 destval = (*opc83_long_operation[rh]) (destval, imm);
7274 if (rh != 7)
7275 store_data_long(destoffset, destval);
7276- } else {
7277- u16 destval,imm;
7278+ }
7279+ else {
7280+ u16 destval, imm;
7281
7282 DECODE_PRINTF("WORD PTR ");
7283 destoffset = decode_rm10_address(rl);
7284@@ -5779,10 +6094,10 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7285 store_data_word(destoffset, destval);
7286 }
7287 break;
7288- case 3: /* register to register */
7289+ case 3: /* register to register */
7290 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7291 u32 *destreg;
7292- u32 destval,imm;
7293+ u32 destval, imm;
7294
7295 destreg = DECODE_RM_LONG_REGISTER(rl);
7296 imm = (s8) fetch_byte_imm();
7297@@ -5791,9 +6106,10 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7298 destval = (*opc83_long_operation[rh]) (*destreg, imm);
7299 if (rh != 7)
7300 *destreg = destval;
7301- } else {
7302+ }
7303+ else {
7304 u16 *destreg;
7305- u16 destval,imm;
7306+ u16 destval, imm;
7307
7308 destreg = DECODE_RM_WORD_REGISTER(rl);
7309 imm = (s8) fetch_byte_imm();
7310@@ -5813,7 +6129,8 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
7311 REMARKS:
7312 Handles opcode 0x84
7313 ****************************************************************************/
7314-static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
7315+static void
7316+x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
7317 {
7318 int mod, rl, rh;
7319 u8 *destreg, *srcreg;
7320@@ -5851,7 +6168,7 @@ static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
7321 TRACE_AND_STEP();
7322 test_byte(destval, *srcreg);
7323 break;
7324- case 3: /* register to register */
7325+ case 3: /* register to register */
7326 destreg = DECODE_RM_BYTE_REGISTER(rl);
7327 DECODE_PRINTF(",");
7328 srcreg = DECODE_RM_BYTE_REGISTER(rh);
7329@@ -5868,7 +6185,8 @@ static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
7330 REMARKS:
7331 Handles opcode 0x85
7332 ****************************************************************************/
7333-static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7334+static void
7335+x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7336 {
7337 int mod, rl, rh;
7338 uint destoffset;
7339@@ -5889,7 +6207,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7340 DECODE_PRINTF("\n");
7341 TRACE_AND_STEP();
7342 test_long(destval, *srcreg);
7343- } else {
7344+ }
7345+ else {
7346 u16 destval;
7347 u16 *srcreg;
7348
7349@@ -5914,7 +6233,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7350 DECODE_PRINTF("\n");
7351 TRACE_AND_STEP();
7352 test_long(destval, *srcreg);
7353- } else {
7354+ }
7355+ else {
7356 u16 destval;
7357 u16 *srcreg;
7358
7359@@ -5939,7 +6259,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7360 DECODE_PRINTF("\n");
7361 TRACE_AND_STEP();
7362 test_long(destval, *srcreg);
7363- } else {
7364+ }
7365+ else {
7366 u16 destval;
7367 u16 *srcreg;
7368
7369@@ -5952,9 +6273,9 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7370 test_word(destval, *srcreg);
7371 }
7372 break;
7373- case 3: /* register to register */
7374+ case 3: /* register to register */
7375 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7376- u32 *destreg,*srcreg;
7377+ u32 *destreg, *srcreg;
7378
7379 destreg = DECODE_RM_LONG_REGISTER(rl);
7380 DECODE_PRINTF(",");
7381@@ -5962,8 +6283,9 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7382 DECODE_PRINTF("\n");
7383 TRACE_AND_STEP();
7384 test_long(*destreg, *srcreg);
7385- } else {
7386- u16 *destreg,*srcreg;
7387+ }
7388+ else {
7389+ u16 *destreg, *srcreg;
7390
7391 destreg = DECODE_RM_WORD_REGISTER(rl);
7392 DECODE_PRINTF(",");
7393@@ -5982,7 +6304,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
7394 REMARKS:
7395 Handles opcode 0x86
7396 ****************************************************************************/
7397-static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
7398+static void
7399+x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
7400 {
7401 int mod, rl, rh;
7402 u8 *destreg, *srcreg;
7403@@ -6030,7 +6353,7 @@ static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
7404 destval = tmp;
7405 store_data_byte(destoffset, destval);
7406 break;
7407- case 3: /* register to register */
7408+ case 3: /* register to register */
7409 destreg = DECODE_RM_BYTE_REGISTER(rl);
7410 DECODE_PRINTF(",");
7411 srcreg = DECODE_RM_BYTE_REGISTER(rh);
7412@@ -6049,7 +6372,8 @@ static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
7413 REMARKS:
7414 Handles opcode 0x87
7415 ****************************************************************************/
7416-static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7417+static void
7418+x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7419 {
7420 int mod, rl, rh;
7421 uint destoffset;
7422@@ -6061,7 +6385,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7423 case 0:
7424 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7425 u32 *srcreg;
7426- u32 destval,tmp;
7427+ u32 destval, tmp;
7428
7429 destoffset = decode_rm00_address(rl);
7430 DECODE_PRINTF(",");
7431@@ -6073,9 +6397,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7432 *srcreg = destval;
7433 destval = tmp;
7434 store_data_long(destoffset, destval);
7435- } else {
7436+ }
7437+ else {
7438 u16 *srcreg;
7439- u16 destval,tmp;
7440+ u16 destval, tmp;
7441
7442 destoffset = decode_rm00_address(rl);
7443 DECODE_PRINTF(",");
7444@@ -6092,7 +6417,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7445 case 1:
7446 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7447 u32 *srcreg;
7448- u32 destval,tmp;
7449+ u32 destval, tmp;
7450
7451 destoffset = decode_rm01_address(rl);
7452 DECODE_PRINTF(",");
7453@@ -6104,9 +6429,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7454 *srcreg = destval;
7455 destval = tmp;
7456 store_data_long(destoffset, destval);
7457- } else {
7458+ }
7459+ else {
7460 u16 *srcreg;
7461- u16 destval,tmp;
7462+ u16 destval, tmp;
7463
7464 destoffset = decode_rm01_address(rl);
7465 DECODE_PRINTF(",");
7466@@ -6123,7 +6449,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7467 case 2:
7468 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7469 u32 *srcreg;
7470- u32 destval,tmp;
7471+ u32 destval, tmp;
7472
7473 destoffset = decode_rm10_address(rl);
7474 DECODE_PRINTF(",");
7475@@ -6135,9 +6461,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7476 *srcreg = destval;
7477 destval = tmp;
7478 store_data_long(destoffset, destval);
7479- } else {
7480+ }
7481+ else {
7482 u16 *srcreg;
7483- u16 destval,tmp;
7484+ u16 destval, tmp;
7485
7486 destoffset = decode_rm10_address(rl);
7487 DECODE_PRINTF(",");
7488@@ -6151,9 +6478,9 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7489 store_data_word(destoffset, destval);
7490 }
7491 break;
7492- case 3: /* register to register */
7493+ case 3: /* register to register */
7494 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7495- u32 *destreg,*srcreg;
7496+ u32 *destreg, *srcreg;
7497 u32 tmp;
7498
7499 destreg = DECODE_RM_LONG_REGISTER(rl);
7500@@ -6164,8 +6491,9 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7501 tmp = *srcreg;
7502 *srcreg = *destreg;
7503 *destreg = tmp;
7504- } else {
7505- u16 *destreg,*srcreg;
7506+ }
7507+ else {
7508+ u16 *destreg, *srcreg;
7509 u16 tmp;
7510
7511 destreg = DECODE_RM_WORD_REGISTER(rl);
7512@@ -6187,7 +6515,8 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
7513 REMARKS:
7514 Handles opcode 0x88
7515 ****************************************************************************/
7516-static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
7517+static void
7518+x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
7519 {
7520 int mod, rl, rh;
7521 u8 *destreg, *srcreg;
7522@@ -6221,7 +6550,7 @@ static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
7523 TRACE_AND_STEP();
7524 store_data_byte(destoffset, *srcreg);
7525 break;
7526- case 3: /* register to register */
7527+ case 3: /* register to register */
7528 destreg = DECODE_RM_BYTE_REGISTER(rl);
7529 DECODE_PRINTF(",");
7530 srcreg = DECODE_RM_BYTE_REGISTER(rh);
7531@@ -6238,7 +6567,8 @@ static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
7532 REMARKS:
7533 Handles opcode 0x89
7534 ****************************************************************************/
7535-static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7536+static void
7537+x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7538 {
7539 int mod, rl, rh;
7540 u32 destoffset;
7541@@ -6257,7 +6587,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7542 DECODE_PRINTF("\n");
7543 TRACE_AND_STEP();
7544 store_data_long(destoffset, *srcreg);
7545- } else {
7546+ }
7547+ else {
7548 u16 *srcreg;
7549
7550 destoffset = decode_rm00_address(rl);
7551@@ -6278,7 +6609,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7552 DECODE_PRINTF("\n");
7553 TRACE_AND_STEP();
7554 store_data_long(destoffset, *srcreg);
7555- } else {
7556+ }
7557+ else {
7558 u16 *srcreg;
7559
7560 destoffset = decode_rm01_address(rl);
7561@@ -6299,7 +6631,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7562 DECODE_PRINTF("\n");
7563 TRACE_AND_STEP();
7564 store_data_long(destoffset, *srcreg);
7565- } else {
7566+ }
7567+ else {
7568 u16 *srcreg;
7569
7570 destoffset = decode_rm10_address(rl);
7571@@ -6310,9 +6643,9 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7572 store_data_word(destoffset, *srcreg);
7573 }
7574 break;
7575- case 3: /* register to register */
7576+ case 3: /* register to register */
7577 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7578- u32 *destreg,*srcreg;
7579+ u32 *destreg, *srcreg;
7580
7581 destreg = DECODE_RM_LONG_REGISTER(rl);
7582 DECODE_PRINTF(",");
7583@@ -6320,8 +6653,9 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7584 DECODE_PRINTF("\n");
7585 TRACE_AND_STEP();
7586 *destreg = *srcreg;
7587- } else {
7588- u16 *destreg,*srcreg;
7589+ }
7590+ else {
7591+ u16 *destreg, *srcreg;
7592
7593 destreg = DECODE_RM_WORD_REGISTER(rl);
7594 DECODE_PRINTF(",");
7595@@ -6340,7 +6674,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
7596 REMARKS:
7597 Handles opcode 0x8a
7598 ****************************************************************************/
7599-static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
7600+static void
7601+x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
7602 {
7603 int mod, rl, rh;
7604 u8 *destreg, *srcreg;
7605@@ -6378,7 +6713,7 @@ static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
7606 TRACE_AND_STEP();
7607 *destreg = srcval;
7608 break;
7609- case 3: /* register to register */
7610+ case 3: /* register to register */
7611 destreg = DECODE_RM_BYTE_REGISTER(rh);
7612 DECODE_PRINTF(",");
7613 srcreg = DECODE_RM_BYTE_REGISTER(rl);
7614@@ -6395,7 +6730,8 @@ static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
7615 REMARKS:
7616 Handles opcode 0x8b
7617 ****************************************************************************/
7618-static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7619+static void
7620+x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7621 {
7622 int mod, rl, rh;
7623 uint srcoffset;
7624@@ -6416,7 +6752,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7625 DECODE_PRINTF("\n");
7626 TRACE_AND_STEP();
7627 *destreg = srcval;
7628- } else {
7629+ }
7630+ else {
7631 u16 *destreg;
7632 u16 srcval;
7633
7634@@ -6441,7 +6778,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7635 DECODE_PRINTF("\n");
7636 TRACE_AND_STEP();
7637 *destreg = srcval;
7638- } else {
7639+ }
7640+ else {
7641 u16 *destreg;
7642 u16 srcval;
7643
7644@@ -6466,7 +6804,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7645 DECODE_PRINTF("\n");
7646 TRACE_AND_STEP();
7647 *destreg = srcval;
7648- } else {
7649+ }
7650+ else {
7651 u16 *destreg;
7652 u16 srcval;
7653
7654@@ -6479,7 +6818,7 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7655 *destreg = srcval;
7656 }
7657 break;
7658- case 3: /* register to register */
7659+ case 3: /* register to register */
7660 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7661 u32 *destreg, *srcreg;
7662
7663@@ -6489,7 +6828,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7664 DECODE_PRINTF("\n");
7665 TRACE_AND_STEP();
7666 *destreg = *srcreg;
7667- } else {
7668+ }
7669+ else {
7670 u16 *destreg, *srcreg;
7671
7672 destreg = DECODE_RM_WORD_REGISTER(rh);
7673@@ -6509,7 +6849,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
7674 REMARKS:
7675 Handles opcode 0x8c
7676 ****************************************************************************/
7677-static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
7678+static void
7679+x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
7680 {
7681 int mod, rl, rh;
7682 u16 *destreg, *srcreg;
7683@@ -6547,7 +6888,7 @@ static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
7684 destval = *srcreg;
7685 store_data_word(destoffset, destval);
7686 break;
7687- case 3: /* register to register */
7688+ case 3: /* register to register */
7689 destreg = DECODE_RM_WORD_REGISTER(rl);
7690 DECODE_PRINTF(",");
7691 srcreg = decode_rm_seg_register(rh);
7692@@ -6564,47 +6905,77 @@ static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
7693 REMARKS:
7694 Handles opcode 0x8d
7695 ****************************************************************************/
7696-static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
7697+static void
7698+x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
7699 {
7700 int mod, rl, rh;
7701- u16 *srcreg;
7702 uint destoffset;
7703
7704-/*
7705- * TODO: Need to handle address size prefix!
7706- *
7707- * lea eax,[eax+ebx*2] ??
7708- */
7709-
7710 START_OF_INSTR();
7711 DECODE_PRINTF("LEA\t");
7712 FETCH_DECODE_MODRM(mod, rh, rl);
7713 switch (mod) {
7714 case 0:
7715- srcreg = DECODE_RM_WORD_REGISTER(rh);
7716- DECODE_PRINTF(",");
7717- destoffset = decode_rm00_address(rl);
7718- DECODE_PRINTF("\n");
7719- TRACE_AND_STEP();
7720- *srcreg = (u16)destoffset;
7721+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
7722+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
7723+
7724+ DECODE_PRINTF(",");
7725+ destoffset = decode_rm00_address(rl);
7726+ DECODE_PRINTF("\n");
7727+ TRACE_AND_STEP();
7728+ *srcreg = (u32) destoffset;
7729+ }
7730+ else {
7731+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
7732+
7733+ DECODE_PRINTF(",");
7734+ destoffset = decode_rm00_address(rl);
7735+ DECODE_PRINTF("\n");
7736+ TRACE_AND_STEP();
7737+ *srcreg = (u16) destoffset;
7738+ }
7739 break;
7740 case 1:
7741- srcreg = DECODE_RM_WORD_REGISTER(rh);
7742- DECODE_PRINTF(",");
7743- destoffset = decode_rm01_address(rl);
7744- DECODE_PRINTF("\n");
7745- TRACE_AND_STEP();
7746- *srcreg = (u16)destoffset;
7747+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
7748+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
7749+
7750+ DECODE_PRINTF(",");
7751+ destoffset = decode_rm01_address(rl);
7752+ DECODE_PRINTF("\n");
7753+ TRACE_AND_STEP();
7754+ *srcreg = (u32) destoffset;
7755+ }
7756+ else {
7757+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
7758+
7759+ DECODE_PRINTF(",");
7760+ destoffset = decode_rm01_address(rl);
7761+ DECODE_PRINTF("\n");
7762+ TRACE_AND_STEP();
7763+ *srcreg = (u16) destoffset;
7764+ }
7765 break;
7766 case 2:
7767- srcreg = DECODE_RM_WORD_REGISTER(rh);
7768- DECODE_PRINTF(",");
7769- destoffset = decode_rm10_address(rl);
7770- DECODE_PRINTF("\n");
7771- TRACE_AND_STEP();
7772- *srcreg = (u16)destoffset;
7773+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
7774+ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
7775+
7776+ DECODE_PRINTF(",");
7777+ destoffset = decode_rm10_address(rl);
7778+ DECODE_PRINTF("\n");
7779+ TRACE_AND_STEP();
7780+ *srcreg = (u32) destoffset;
7781+ }
7782+ else {
7783+ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
7784+
7785+ DECODE_PRINTF(",");
7786+ destoffset = decode_rm10_address(rl);
7787+ DECODE_PRINTF("\n");
7788+ TRACE_AND_STEP();
7789+ *srcreg = (u16) destoffset;
7790+ }
7791 break;
7792- case 3: /* register to register */
7793+ case 3: /* register to register */
7794 /* undefined. Do nothing. */
7795 break;
7796 }
7797@@ -6616,7 +6987,8 @@ static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
7798 REMARKS:
7799 Handles opcode 0x8e
7800 ****************************************************************************/
7801-static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
7802+static void
7803+x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
7804 {
7805 int mod, rl, rh;
7806 u16 *destreg, *srcreg;
7807@@ -6654,7 +7026,7 @@ static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
7808 TRACE_AND_STEP();
7809 *destreg = srcval;
7810 break;
7811- case 3: /* register to register */
7812+ case 3: /* register to register */
7813 destreg = decode_rm_seg_register(rh);
7814 DECODE_PRINTF(",");
7815 srcreg = DECODE_RM_WORD_REGISTER(rl);
7816@@ -6677,7 +7049,8 @@ static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
7817 REMARKS:
7818 Handles opcode 0x8f
7819 ****************************************************************************/
7820-static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7821+static void
7822+x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7823 {
7824 int mod, rl, rh;
7825 uint destoffset;
7826@@ -6699,7 +7072,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7827 TRACE_AND_STEP();
7828 destval = pop_long();
7829 store_data_long(destoffset, destval);
7830- } else {
7831+ }
7832+ else {
7833 u16 destval;
7834
7835 destoffset = decode_rm00_address(rl);
7836@@ -6718,7 +7092,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7837 TRACE_AND_STEP();
7838 destval = pop_long();
7839 store_data_long(destoffset, destval);
7840- } else {
7841+ }
7842+ else {
7843 u16 destval;
7844
7845 destoffset = decode_rm01_address(rl);
7846@@ -6737,7 +7112,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7847 TRACE_AND_STEP();
7848 destval = pop_long();
7849 store_data_long(destoffset, destval);
7850- } else {
7851+ }
7852+ else {
7853 u16 destval;
7854
7855 destoffset = decode_rm10_address(rl);
7856@@ -6747,7 +7123,7 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7857 store_data_word(destoffset, destval);
7858 }
7859 break;
7860- case 3: /* register to register */
7861+ case 3: /* register to register */
7862 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7863 u32 *destreg;
7864
7865@@ -6755,7 +7131,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7866 DECODE_PRINTF("\n");
7867 TRACE_AND_STEP();
7868 *destreg = pop_long();
7869- } else {
7870+ }
7871+ else {
7872 u16 *destreg;
7873
7874 destreg = DECODE_RM_WORD_REGISTER(rl);
7875@@ -6773,7 +7150,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
7876 REMARKS:
7877 Handles opcode 0x90
7878 ****************************************************************************/
7879-static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
7880+static void
7881+x86emuOp_nop(u8 X86EMU_UNUSED(op1))
7882 {
7883 START_OF_INSTR();
7884 DECODE_PRINTF("NOP\n");
7885@@ -6786,14 +7164,16 @@ static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
7886 REMARKS:
7887 Handles opcode 0x91
7888 ****************************************************************************/
7889-static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
7890+static void
7891+x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
7892 {
7893 u32 tmp;
7894
7895 START_OF_INSTR();
7896 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7897 DECODE_PRINTF("XCHG\tEAX,ECX\n");
7898- } else {
7899+ }
7900+ else {
7901 DECODE_PRINTF("XCHG\tAX,CX\n");
7902 }
7903 TRACE_AND_STEP();
7904@@ -6801,10 +7181,11 @@ static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
7905 tmp = M.x86.R_EAX;
7906 M.x86.R_EAX = M.x86.R_ECX;
7907 M.x86.R_ECX = tmp;
7908- } else {
7909+ }
7910+ else {
7911 tmp = M.x86.R_AX;
7912 M.x86.R_AX = M.x86.R_CX;
7913- M.x86.R_CX = (u16)tmp;
7914+ M.x86.R_CX = (u16) tmp;
7915 }
7916 DECODE_CLEAR_SEGOVR();
7917 END_OF_INSTR();
7918@@ -6814,14 +7195,16 @@ static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
7919 REMARKS:
7920 Handles opcode 0x92
7921 ****************************************************************************/
7922-static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
7923+static void
7924+x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
7925 {
7926 u32 tmp;
7927
7928 START_OF_INSTR();
7929 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7930 DECODE_PRINTF("XCHG\tEAX,EDX\n");
7931- } else {
7932+ }
7933+ else {
7934 DECODE_PRINTF("XCHG\tAX,DX\n");
7935 }
7936 TRACE_AND_STEP();
7937@@ -6829,10 +7212,11 @@ static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
7938 tmp = M.x86.R_EAX;
7939 M.x86.R_EAX = M.x86.R_EDX;
7940 M.x86.R_EDX = tmp;
7941- } else {
7942+ }
7943+ else {
7944 tmp = M.x86.R_AX;
7945 M.x86.R_AX = M.x86.R_DX;
7946- M.x86.R_DX = (u16)tmp;
7947+ M.x86.R_DX = (u16) tmp;
7948 }
7949 DECODE_CLEAR_SEGOVR();
7950 END_OF_INSTR();
7951@@ -6842,14 +7226,16 @@ static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
7952 REMARKS:
7953 Handles opcode 0x93
7954 ****************************************************************************/
7955-static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
7956+static void
7957+x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
7958 {
7959 u32 tmp;
7960
7961 START_OF_INSTR();
7962 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7963 DECODE_PRINTF("XCHG\tEAX,EBX\n");
7964- } else {
7965+ }
7966+ else {
7967 DECODE_PRINTF("XCHG\tAX,BX\n");
7968 }
7969 TRACE_AND_STEP();
7970@@ -6857,10 +7243,11 @@ static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
7971 tmp = M.x86.R_EAX;
7972 M.x86.R_EAX = M.x86.R_EBX;
7973 M.x86.R_EBX = tmp;
7974- } else {
7975+ }
7976+ else {
7977 tmp = M.x86.R_AX;
7978 M.x86.R_AX = M.x86.R_BX;
7979- M.x86.R_BX = (u16)tmp;
7980+ M.x86.R_BX = (u16) tmp;
7981 }
7982 DECODE_CLEAR_SEGOVR();
7983 END_OF_INSTR();
7984@@ -6870,14 +7257,16 @@ static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
7985 REMARKS:
7986 Handles opcode 0x94
7987 ****************************************************************************/
7988-static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
7989+static void
7990+x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
7991 {
7992 u32 tmp;
7993
7994 START_OF_INSTR();
7995 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
7996 DECODE_PRINTF("XCHG\tEAX,ESP\n");
7997- } else {
7998+ }
7999+ else {
8000 DECODE_PRINTF("XCHG\tAX,SP\n");
8001 }
8002 TRACE_AND_STEP();
8003@@ -6885,10 +7274,11 @@ static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
8004 tmp = M.x86.R_EAX;
8005 M.x86.R_EAX = M.x86.R_ESP;
8006 M.x86.R_ESP = tmp;
8007- } else {
8008+ }
8009+ else {
8010 tmp = M.x86.R_AX;
8011 M.x86.R_AX = M.x86.R_SP;
8012- M.x86.R_SP = (u16)tmp;
8013+ M.x86.R_SP = (u16) tmp;
8014 }
8015 DECODE_CLEAR_SEGOVR();
8016 END_OF_INSTR();
8017@@ -6898,14 +7288,16 @@ static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
8018 REMARKS:
8019 Handles opcode 0x95
8020 ****************************************************************************/
8021-static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
8022+static void
8023+x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
8024 {
8025 u32 tmp;
8026
8027 START_OF_INSTR();
8028 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8029 DECODE_PRINTF("XCHG\tEAX,EBP\n");
8030- } else {
8031+ }
8032+ else {
8033 DECODE_PRINTF("XCHG\tAX,BP\n");
8034 }
8035 TRACE_AND_STEP();
8036@@ -6913,10 +7305,11 @@ static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
8037 tmp = M.x86.R_EAX;
8038 M.x86.R_EAX = M.x86.R_EBP;
8039 M.x86.R_EBP = tmp;
8040- } else {
8041+ }
8042+ else {
8043 tmp = M.x86.R_AX;
8044 M.x86.R_AX = M.x86.R_BP;
8045- M.x86.R_BP = (u16)tmp;
8046+ M.x86.R_BP = (u16) tmp;
8047 }
8048 DECODE_CLEAR_SEGOVR();
8049 END_OF_INSTR();
8050@@ -6926,14 +7319,16 @@ static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
8051 REMARKS:
8052 Handles opcode 0x96
8053 ****************************************************************************/
8054-static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
8055+static void
8056+x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
8057 {
8058 u32 tmp;
8059
8060 START_OF_INSTR();
8061 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8062 DECODE_PRINTF("XCHG\tEAX,ESI\n");
8063- } else {
8064+ }
8065+ else {
8066 DECODE_PRINTF("XCHG\tAX,SI\n");
8067 }
8068 TRACE_AND_STEP();
8069@@ -6941,10 +7336,11 @@ static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
8070 tmp = M.x86.R_EAX;
8071 M.x86.R_EAX = M.x86.R_ESI;
8072 M.x86.R_ESI = tmp;
8073- } else {
8074+ }
8075+ else {
8076 tmp = M.x86.R_AX;
8077 M.x86.R_AX = M.x86.R_SI;
8078- M.x86.R_SI = (u16)tmp;
8079+ M.x86.R_SI = (u16) tmp;
8080 }
8081 DECODE_CLEAR_SEGOVR();
8082 END_OF_INSTR();
8083@@ -6954,14 +7350,16 @@ static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
8084 REMARKS:
8085 Handles opcode 0x97
8086 ****************************************************************************/
8087-static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
8088+static void
8089+x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
8090 {
8091 u32 tmp;
8092
8093 START_OF_INSTR();
8094 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8095 DECODE_PRINTF("XCHG\tEAX,EDI\n");
8096- } else {
8097+ }
8098+ else {
8099 DECODE_PRINTF("XCHG\tAX,DI\n");
8100 }
8101 TRACE_AND_STEP();
8102@@ -6969,10 +7367,11 @@ static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
8103 tmp = M.x86.R_EAX;
8104 M.x86.R_EAX = M.x86.R_EDI;
8105 M.x86.R_EDI = tmp;
8106- } else {
8107+ }
8108+ else {
8109 tmp = M.x86.R_AX;
8110 M.x86.R_AX = M.x86.R_DI;
8111- M.x86.R_DI = (u16)tmp;
8112+ M.x86.R_DI = (u16) tmp;
8113 }
8114 DECODE_CLEAR_SEGOVR();
8115 END_OF_INSTR();
8116@@ -6982,25 +7381,30 @@ static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
8117 REMARKS:
8118 Handles opcode 0x98
8119 ****************************************************************************/
8120-static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
8121+static void
8122+x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
8123 {
8124 START_OF_INSTR();
8125 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8126 DECODE_PRINTF("CWDE\n");
8127- } else {
8128+ }
8129+ else {
8130 DECODE_PRINTF("CBW\n");
8131 }
8132 TRACE_AND_STEP();
8133 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8134 if (M.x86.R_AX & 0x8000) {
8135 M.x86.R_EAX |= 0xffff0000;
8136- } else {
8137+ }
8138+ else {
8139 M.x86.R_EAX &= 0x0000ffff;
8140 }
8141- } else {
8142+ }
8143+ else {
8144 if (M.x86.R_AL & 0x80) {
8145 M.x86.R_AH = 0xff;
8146- } else {
8147+ }
8148+ else {
8149 M.x86.R_AH = 0x0;
8150 }
8151 }
8152@@ -7012,12 +7416,14 @@ static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
8153 REMARKS:
8154 Handles opcode 0x99
8155 ****************************************************************************/
8156-static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
8157+static void
8158+x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
8159 {
8160 START_OF_INSTR();
8161 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8162 DECODE_PRINTF("CDQ\n");
8163- } else {
8164+ }
8165+ else {
8166 DECODE_PRINTF("CWD\n");
8167 }
8168 DECODE_PRINTF("CWD\n");
8169@@ -7025,13 +7431,16 @@ static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
8170 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8171 if (M.x86.R_EAX & 0x80000000) {
8172 M.x86.R_EDX = 0xffffffff;
8173- } else {
8174+ }
8175+ else {
8176 M.x86.R_EDX = 0x0;
8177 }
8178- } else {
8179+ }
8180+ else {
8181 if (M.x86.R_AX & 0x8000) {
8182 M.x86.R_DX = 0xffff;
8183- } else {
8184+ }
8185+ else {
8186 M.x86.R_DX = 0x0;
8187 }
8188 }
8189@@ -7043,17 +7452,24 @@ static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
8190 REMARKS:
8191 Handles opcode 0x9a
8192 ****************************************************************************/
8193-static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
8194+static void
8195+x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
8196 {
8197- u16 farseg, faroff;
8198+ u32 farseg, faroff;
8199
8200 START_OF_INSTR();
8201- DECODE_PRINTF("CALL\t");
8202- faroff = fetch_word_imm();
8203- farseg = fetch_word_imm();
8204- DECODE_PRINTF2("%04x:", farseg);
8205- DECODE_PRINTF2("%04x\n", faroff);
8206- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
8207+ DECODE_PRINTF("CALL\t");
8208+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8209+ faroff = fetch_long_imm();
8210+ farseg = fetch_word_imm();
8211+ }
8212+ else {
8213+ faroff = fetch_word_imm();
8214+ farseg = fetch_word_imm();
8215+ }
8216+ DECODE_PRINTF2("%04x:", farseg);
8217+ DECODE_PRINTF2("%04x\n", faroff);
8218+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
8219
8220 /* XXX
8221 *
8222@@ -7064,8 +7480,13 @@ static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
8223 TRACE_AND_STEP();
8224 push_word(M.x86.R_CS);
8225 M.x86.R_CS = farseg;
8226- push_word(M.x86.R_IP);
8227- M.x86.R_IP = faroff;
8228+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8229+ push_long(M.x86.R_EIP);
8230+ }
8231+ else {
8232+ push_word(M.x86.R_IP);
8233+ }
8234+ M.x86.R_EIP = faroff & 0xffff;
8235 DECODE_CLEAR_SEGOVR();
8236 END_OF_INSTR();
8237 }
8238@@ -7074,7 +7495,8 @@ static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
8239 REMARKS:
8240 Handles opcode 0x9b
8241 ****************************************************************************/
8242-static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
8243+static void
8244+x86emuOp_wait(u8 X86EMU_UNUSED(op1))
8245 {
8246 START_OF_INSTR();
8247 DECODE_PRINTF("WAIT");
8248@@ -7088,14 +7510,16 @@ static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
8249 REMARKS:
8250 Handles opcode 0x9c
8251 ****************************************************************************/
8252-static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
8253+static void
8254+x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
8255 {
8256 u32 flags;
8257
8258 START_OF_INSTR();
8259 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8260 DECODE_PRINTF("PUSHFD\n");
8261- } else {
8262+ }
8263+ else {
8264 DECODE_PRINTF("PUSHF\n");
8265 }
8266 TRACE_AND_STEP();
8267@@ -7104,8 +7528,9 @@ static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
8268 flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
8269 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8270 push_long(flags);
8271- } else {
8272- push_word((u16)flags);
8273+ }
8274+ else {
8275+ push_word((u16) flags);
8276 }
8277 DECODE_CLEAR_SEGOVR();
8278 END_OF_INSTR();
8279@@ -7115,18 +7540,21 @@ static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
8280 REMARKS:
8281 Handles opcode 0x9d
8282 ****************************************************************************/
8283-static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
8284+static void
8285+x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
8286 {
8287 START_OF_INSTR();
8288 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8289 DECODE_PRINTF("POPFD\n");
8290- } else {
8291+ }
8292+ else {
8293 DECODE_PRINTF("POPF\n");
8294 }
8295 TRACE_AND_STEP();
8296 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8297 M.x86.R_EFLG = pop_long();
8298- } else {
8299+ }
8300+ else {
8301 M.x86.R_FLG = pop_word();
8302 }
8303 DECODE_CLEAR_SEGOVR();
8304@@ -7137,7 +7565,8 @@ static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
8305 REMARKS:
8306 Handles opcode 0x9e
8307 ****************************************************************************/
8308-static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
8309+static void
8310+x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
8311 {
8312 START_OF_INSTR();
8313 DECODE_PRINTF("SAHF\n");
8314@@ -7154,12 +7583,13 @@ static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
8315 REMARKS:
8316 Handles opcode 0x9f
8317 ****************************************************************************/
8318-static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
8319+static void
8320+x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
8321 {
8322 START_OF_INSTR();
8323 DECODE_PRINTF("LAHF\n");
8324 TRACE_AND_STEP();
8325- M.x86.R_AH = (u8)(M.x86.R_FLG & 0xff);
8326+ M.x86.R_AH = (u8) (M.x86.R_FLG & 0xff);
8327 /*undocumented TC++ behavior??? Nope. It's documented, but
8328 you have too look real hard to notice it. */
8329 M.x86.R_AH |= 0x2;
8330@@ -7171,7 +7601,8 @@ static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
8331 REMARKS:
8332 Handles opcode 0xa0
8333 ****************************************************************************/
8334-static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
8335+static void
8336+x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
8337 {
8338 u16 offset;
8339
8340@@ -7189,7 +7620,8 @@ static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
8341 REMARKS:
8342 Handles opcode 0xa1
8343 ****************************************************************************/
8344-static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
8345+static void
8346+x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
8347 {
8348 u16 offset;
8349
8350@@ -7197,13 +7629,15 @@ static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
8351 offset = fetch_word_imm();
8352 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8353 DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
8354- } else {
8355+ }
8356+ else {
8357 DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
8358 }
8359 TRACE_AND_STEP();
8360 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8361 M.x86.R_EAX = fetch_data_long(offset);
8362- } else {
8363+ }
8364+ else {
8365 M.x86.R_AX = fetch_data_word(offset);
8366 }
8367 DECODE_CLEAR_SEGOVR();
8368@@ -7214,7 +7648,8 @@ static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
8369 REMARKS:
8370 Handles opcode 0xa2
8371 ****************************************************************************/
8372-static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
8373+static void
8374+x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
8375 {
8376 u16 offset;
8377
8378@@ -7232,7 +7667,8 @@ static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
8379 REMARKS:
8380 Handles opcode 0xa3
8381 ****************************************************************************/
8382-static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
8383+static void
8384+x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
8385 {
8386 u16 offset;
8387
8388@@ -7240,13 +7676,15 @@ static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
8389 offset = fetch_word_imm();
8390 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8391 DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
8392- } else {
8393+ }
8394+ else {
8395 DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
8396 }
8397 TRACE_AND_STEP();
8398 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8399 store_data_long(offset, M.x86.R_EAX);
8400- } else {
8401+ }
8402+ else {
8403 store_data_word(offset, M.x86.R_AX);
8404 }
8405 DECODE_CLEAR_SEGOVR();
8406@@ -7257,15 +7695,16 @@ static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
8407 REMARKS:
8408 Handles opcode 0xa4
8409 ****************************************************************************/
8410-static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
8411+static void
8412+x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
8413 {
8414- u8 val;
8415+ u8 val;
8416 u32 count;
8417 int inc;
8418
8419 START_OF_INSTR();
8420 DECODE_PRINTF("MOVS\tBYTE\n");
8421- if (ACCESS_FLAG(F_DF)) /* down */
8422+ if (ACCESS_FLAG(F_DF)) /* down */
8423 inc = -1;
8424 else
8425 inc = 1;
8426@@ -7292,7 +7731,8 @@ static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
8427 REMARKS:
8428 Handles opcode 0xa5
8429 ****************************************************************************/
8430-static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
8431+static void
8432+x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
8433 {
8434 u32 val;
8435 int inc;
8436@@ -7301,13 +7741,14 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
8437 START_OF_INSTR();
8438 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8439 DECODE_PRINTF("MOVS\tDWORD\n");
8440- if (ACCESS_FLAG(F_DF)) /* down */
8441+ if (ACCESS_FLAG(F_DF)) /* down */
8442 inc = -4;
8443 else
8444 inc = 4;
8445- } else {
8446+ }
8447+ else {
8448 DECODE_PRINTF("MOVS\tWORD\n");
8449- if (ACCESS_FLAG(F_DF)) /* down */
8450+ if (ACCESS_FLAG(F_DF)) /* down */
8451 inc = -2;
8452 else
8453 inc = 2;
8454@@ -7325,9 +7766,10 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
8455 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8456 val = fetch_data_long(M.x86.R_SI);
8457 store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
8458- } else {
8459+ }
8460+ else {
8461 val = fetch_data_word(M.x86.R_SI);
8462- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
8463+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16) val);
8464 }
8465 M.x86.R_SI += inc;
8466 M.x86.R_DI += inc;
8467@@ -7340,7 +7782,8 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
8468 REMARKS:
8469 Handles opcode 0xa6
8470 ****************************************************************************/
8471-static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8472+static void
8473+x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8474 {
8475 s8 val1, val2;
8476 int inc;
8477@@ -7348,7 +7791,7 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8478 START_OF_INSTR();
8479 DECODE_PRINTF("CMPS\tBYTE\n");
8480 TRACE_AND_STEP();
8481- if (ACCESS_FLAG(F_DF)) /* down */
8482+ if (ACCESS_FLAG(F_DF)) /* down */
8483 inc = -1;
8484 else
8485 inc = 1;
8486@@ -7359,7 +7802,7 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8487 while (M.x86.R_CX != 0) {
8488 val1 = fetch_data_byte(M.x86.R_SI);
8489 val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
8490- cmp_byte(val1, val2);
8491+ cmp_byte(val1, val2);
8492 M.x86.R_CX -= 1;
8493 M.x86.R_SI += inc;
8494 M.x86.R_DI += inc;
8495@@ -7367,7 +7810,8 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8496 break;
8497 }
8498 M.x86.mode &= ~SYSMODE_PREFIX_REPE;
8499- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8500+ }
8501+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8502 /* REPNE */
8503 /* move them until CX is ZERO. */
8504 while (M.x86.R_CX != 0) {
8505@@ -7381,7 +7825,8 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8506 break; /* zero flag set means equal */
8507 }
8508 M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
8509- } else {
8510+ }
8511+ else {
8512 val1 = fetch_data_byte(M.x86.R_SI);
8513 val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
8514 cmp_byte(val1, val2);
8515@@ -7396,21 +7841,23 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
8516 REMARKS:
8517 Handles opcode 0xa7
8518 ****************************************************************************/
8519-static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8520+static void
8521+x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8522 {
8523- u32 val1,val2;
8524+ u32 val1, val2;
8525 int inc;
8526
8527 START_OF_INSTR();
8528 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8529 DECODE_PRINTF("CMPS\tDWORD\n");
8530- if (ACCESS_FLAG(F_DF)) /* down */
8531+ if (ACCESS_FLAG(F_DF)) /* down */
8532 inc = -4;
8533 else
8534 inc = 4;
8535- } else {
8536+ }
8537+ else {
8538 DECODE_PRINTF("CMPS\tWORD\n");
8539- if (ACCESS_FLAG(F_DF)) /* down */
8540+ if (ACCESS_FLAG(F_DF)) /* down */
8541 inc = -2;
8542 else
8543 inc = 2;
8544@@ -7424,10 +7871,11 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8545 val1 = fetch_data_long(M.x86.R_SI);
8546 val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8547 cmp_long(val1, val2);
8548- } else {
8549+ }
8550+ else {
8551 val1 = fetch_data_word(M.x86.R_SI);
8552 val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8553- cmp_word((u16)val1, (u16)val2);
8554+ cmp_word((u16) val1, (u16) val2);
8555 }
8556 M.x86.R_CX -= 1;
8557 M.x86.R_SI += inc;
8558@@ -7436,7 +7884,8 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8559 break;
8560 }
8561 M.x86.mode &= ~SYSMODE_PREFIX_REPE;
8562- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8563+ }
8564+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8565 /* REPNE */
8566 /* move them until CX is ZERO. */
8567 while (M.x86.R_CX != 0) {
8568@@ -7444,10 +7893,11 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8569 val1 = fetch_data_long(M.x86.R_SI);
8570 val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8571 cmp_long(val1, val2);
8572- } else {
8573+ }
8574+ else {
8575 val1 = fetch_data_word(M.x86.R_SI);
8576 val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8577- cmp_word((u16)val1, (u16)val2);
8578+ cmp_word((u16) val1, (u16) val2);
8579 }
8580 M.x86.R_CX -= 1;
8581 M.x86.R_SI += inc;
8582@@ -7456,15 +7906,17 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8583 break; /* zero flag set means equal */
8584 }
8585 M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
8586- } else {
8587+ }
8588+ else {
8589 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8590 val1 = fetch_data_long(M.x86.R_SI);
8591 val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8592 cmp_long(val1, val2);
8593- } else {
8594+ }
8595+ else {
8596 val1 = fetch_data_word(M.x86.R_SI);
8597 val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8598- cmp_word((u16)val1, (u16)val2);
8599+ cmp_word((u16) val1, (u16) val2);
8600 }
8601 M.x86.R_SI += inc;
8602 M.x86.R_DI += inc;
8603@@ -7477,7 +7929,8 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
8604 REMARKS:
8605 Handles opcode 0xa8
8606 ****************************************************************************/
8607-static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
8608+static void
8609+x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
8610 {
8611 int imm;
8612
8613@@ -7486,7 +7939,7 @@ static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
8614 imm = fetch_byte_imm();
8615 DECODE_PRINTF2("%04x\n", imm);
8616 TRACE_AND_STEP();
8617- test_byte(M.x86.R_AL, (u8)imm);
8618+ test_byte(M.x86.R_AL, (u8) imm);
8619 DECODE_CLEAR_SEGOVR();
8620 END_OF_INSTR();
8621 }
8622@@ -7495,7 +7948,8 @@ static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
8623 REMARKS:
8624 Handles opcode 0xa9
8625 ****************************************************************************/
8626-static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
8627+static void
8628+x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
8629 {
8630 u32 srcval;
8631
8632@@ -7503,7 +7957,8 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
8633 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8634 DECODE_PRINTF("TEST\tEAX,");
8635 srcval = fetch_long_imm();
8636- } else {
8637+ }
8638+ else {
8639 DECODE_PRINTF("TEST\tAX,");
8640 srcval = fetch_word_imm();
8641 }
8642@@ -7511,8 +7966,9 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
8643 TRACE_AND_STEP();
8644 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8645 test_long(M.x86.R_EAX, srcval);
8646- } else {
8647- test_word(M.x86.R_AX, (u16)srcval);
8648+ }
8649+ else {
8650+ test_word(M.x86.R_AX, (u16) srcval);
8651 }
8652 DECODE_CLEAR_SEGOVR();
8653 END_OF_INSTR();
8654@@ -7522,13 +7978,14 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
8655 REMARKS:
8656 Handles opcode 0xaa
8657 ****************************************************************************/
8658-static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
8659+static void
8660+x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
8661 {
8662 int inc;
8663
8664 START_OF_INSTR();
8665 DECODE_PRINTF("STOS\tBYTE\n");
8666- if (ACCESS_FLAG(F_DF)) /* down */
8667+ if (ACCESS_FLAG(F_DF)) /* down */
8668 inc = -1;
8669 else
8670 inc = 1;
8671@@ -7542,7 +7999,8 @@ static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
8672 M.x86.R_DI += inc;
8673 }
8674 M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
8675- } else {
8676+ }
8677+ else {
8678 store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
8679 M.x86.R_DI += inc;
8680 }
8681@@ -7554,7 +8012,8 @@ static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
8682 REMARKS:
8683 Handles opcode 0xab
8684 ****************************************************************************/
8685-static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
8686+static void
8687+x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
8688 {
8689 int inc;
8690 u32 count;
8691@@ -7562,13 +8021,14 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
8692 START_OF_INSTR();
8693 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8694 DECODE_PRINTF("STOS\tDWORD\n");
8695- if (ACCESS_FLAG(F_DF)) /* down */
8696+ if (ACCESS_FLAG(F_DF)) /* down */
8697 inc = -4;
8698 else
8699 inc = 4;
8700- } else {
8701+ }
8702+ else {
8703 DECODE_PRINTF("STOS\tWORD\n");
8704- if (ACCESS_FLAG(F_DF)) /* down */
8705+ if (ACCESS_FLAG(F_DF)) /* down */
8706 inc = -2;
8707 else
8708 inc = 2;
8709@@ -7585,7 +8045,8 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
8710 while (count--) {
8711 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8712 store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
8713- } else {
8714+ }
8715+ else {
8716 store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
8717 }
8718 M.x86.R_DI += inc;
8719@@ -7598,14 +8059,15 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
8720 REMARKS:
8721 Handles opcode 0xac
8722 ****************************************************************************/
8723-static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
8724+static void
8725+x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
8726 {
8727 int inc;
8728
8729 START_OF_INSTR();
8730 DECODE_PRINTF("LODS\tBYTE\n");
8731 TRACE_AND_STEP();
8732- if (ACCESS_FLAG(F_DF)) /* down */
8733+ if (ACCESS_FLAG(F_DF)) /* down */
8734 inc = -1;
8735 else
8736 inc = 1;
8737@@ -7618,7 +8080,8 @@ static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
8738 M.x86.R_SI += inc;
8739 }
8740 M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
8741- } else {
8742+ }
8743+ else {
8744 M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
8745 M.x86.R_SI += inc;
8746 }
8747@@ -7630,7 +8093,8 @@ static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
8748 REMARKS:
8749 Handles opcode 0xad
8750 ****************************************************************************/
8751-static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
8752+static void
8753+x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
8754 {
8755 int inc;
8756 u32 count;
8757@@ -7638,13 +8102,14 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
8758 START_OF_INSTR();
8759 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8760 DECODE_PRINTF("LODS\tDWORD\n");
8761- if (ACCESS_FLAG(F_DF)) /* down */
8762+ if (ACCESS_FLAG(F_DF)) /* down */
8763 inc = -4;
8764 else
8765 inc = 4;
8766- } else {
8767+ }
8768+ else {
8769 DECODE_PRINTF("LODS\tWORD\n");
8770- if (ACCESS_FLAG(F_DF)) /* down */
8771+ if (ACCESS_FLAG(F_DF)) /* down */
8772 inc = -2;
8773 else
8774 inc = 2;
8775@@ -7661,7 +8126,8 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
8776 while (count--) {
8777 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8778 M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
8779- } else {
8780+ }
8781+ else {
8782 M.x86.R_AX = fetch_data_word(M.x86.R_SI);
8783 }
8784 M.x86.R_SI += inc;
8785@@ -7674,7 +8140,8 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
8786 REMARKS:
8787 Handles opcode 0xae
8788 ****************************************************************************/
8789-static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8790+static void
8791+x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8792 {
8793 s8 val2;
8794 int inc;
8795@@ -7682,7 +8149,7 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8796 START_OF_INSTR();
8797 DECODE_PRINTF("SCAS\tBYTE\n");
8798 TRACE_AND_STEP();
8799- if (ACCESS_FLAG(F_DF)) /* down */
8800+ if (ACCESS_FLAG(F_DF)) /* down */
8801 inc = -1;
8802 else
8803 inc = 1;
8804@@ -7698,7 +8165,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8805 break;
8806 }
8807 M.x86.mode &= ~SYSMODE_PREFIX_REPE;
8808- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8809+ }
8810+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8811 /* REPNE */
8812 /* move them until CX is ZERO. */
8813 while (M.x86.R_CX != 0) {
8814@@ -7710,7 +8178,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8815 break; /* zero flag set means equal */
8816 }
8817 M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
8818- } else {
8819+ }
8820+ else {
8821 val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
8822 cmp_byte(M.x86.R_AL, val2);
8823 M.x86.R_DI += inc;
8824@@ -7723,7 +8192,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
8825 REMARKS:
8826 Handles opcode 0xaf
8827 ****************************************************************************/
8828-static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8829+static void
8830+x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8831 {
8832 int inc;
8833 u32 val;
8834@@ -7731,13 +8201,14 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8835 START_OF_INSTR();
8836 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8837 DECODE_PRINTF("SCAS\tDWORD\n");
8838- if (ACCESS_FLAG(F_DF)) /* down */
8839+ if (ACCESS_FLAG(F_DF)) /* down */
8840 inc = -4;
8841 else
8842 inc = 4;
8843- } else {
8844+ }
8845+ else {
8846 DECODE_PRINTF("SCAS\tWORD\n");
8847- if (ACCESS_FLAG(F_DF)) /* down */
8848+ if (ACCESS_FLAG(F_DF)) /* down */
8849 inc = -2;
8850 else
8851 inc = 2;
8852@@ -7750,9 +8221,10 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8853 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8854 val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8855 cmp_long(M.x86.R_EAX, val);
8856- } else {
8857+ }
8858+ else {
8859 val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8860- cmp_word(M.x86.R_AX, (u16)val);
8861+ cmp_word(M.x86.R_AX, (u16) val);
8862 }
8863 M.x86.R_CX -= 1;
8864 M.x86.R_DI += inc;
8865@@ -7760,16 +8232,18 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8866 break;
8867 }
8868 M.x86.mode &= ~SYSMODE_PREFIX_REPE;
8869- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8870+ }
8871+ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
8872 /* REPNE */
8873 /* move them until CX is ZERO. */
8874 while (M.x86.R_CX != 0) {
8875 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8876 val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8877 cmp_long(M.x86.R_EAX, val);
8878- } else {
8879+ }
8880+ else {
8881 val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8882- cmp_word(M.x86.R_AX, (u16)val);
8883+ cmp_word(M.x86.R_AX, (u16) val);
8884 }
8885 M.x86.R_CX -= 1;
8886 M.x86.R_DI += inc;
8887@@ -7777,13 +8251,15 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8888 break; /* zero flag set means equal */
8889 }
8890 M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
8891- } else {
8892+ }
8893+ else {
8894 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8895 val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
8896 cmp_long(M.x86.R_EAX, val);
8897- } else {
8898+ }
8899+ else {
8900 val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
8901- cmp_word(M.x86.R_AX, (u16)val);
8902+ cmp_word(M.x86.R_AX, (u16) val);
8903 }
8904 M.x86.R_DI += inc;
8905 }
8906@@ -7795,7 +8271,8 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
8907 REMARKS:
8908 Handles opcode 0xb0
8909 ****************************************************************************/
8910-static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
8911+static void
8912+x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
8913 {
8914 u8 imm;
8915
8916@@ -7813,7 +8290,8 @@ static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
8917 REMARKS:
8918 Handles opcode 0xb1
8919 ****************************************************************************/
8920-static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
8921+static void
8922+x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
8923 {
8924 u8 imm;
8925
8926@@ -7831,7 +8309,8 @@ static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
8927 REMARKS:
8928 Handles opcode 0xb2
8929 ****************************************************************************/
8930-static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
8931+static void
8932+x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
8933 {
8934 u8 imm;
8935
8936@@ -7849,7 +8328,8 @@ static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
8937 REMARKS:
8938 Handles opcode 0xb3
8939 ****************************************************************************/
8940-static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
8941+static void
8942+x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
8943 {
8944 u8 imm;
8945
8946@@ -7867,7 +8347,8 @@ static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
8947 REMARKS:
8948 Handles opcode 0xb4
8949 ****************************************************************************/
8950-static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
8951+static void
8952+x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
8953 {
8954 u8 imm;
8955
8956@@ -7885,7 +8366,8 @@ static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
8957 REMARKS:
8958 Handles opcode 0xb5
8959 ****************************************************************************/
8960-static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
8961+static void
8962+x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
8963 {
8964 u8 imm;
8965
8966@@ -7903,7 +8385,8 @@ static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
8967 REMARKS:
8968 Handles opcode 0xb6
8969 ****************************************************************************/
8970-static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
8971+static void
8972+x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
8973 {
8974 u8 imm;
8975
8976@@ -7921,7 +8404,8 @@ static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
8977 REMARKS:
8978 Handles opcode 0xb7
8979 ****************************************************************************/
8980-static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
8981+static void
8982+x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
8983 {
8984 u8 imm;
8985
8986@@ -7939,7 +8423,8 @@ static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
8987 REMARKS:
8988 Handles opcode 0xb8
8989 ****************************************************************************/
8990-static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
8991+static void
8992+x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
8993 {
8994 u32 srcval;
8995
8996@@ -7947,7 +8432,8 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
8997 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
8998 DECODE_PRINTF("MOV\tEAX,");
8999 srcval = fetch_long_imm();
9000- } else {
9001+ }
9002+ else {
9003 DECODE_PRINTF("MOV\tAX,");
9004 srcval = fetch_word_imm();
9005 }
9006@@ -7955,8 +8441,9 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
9007 TRACE_AND_STEP();
9008 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9009 M.x86.R_EAX = srcval;
9010- } else {
9011- M.x86.R_AX = (u16)srcval;
9012+ }
9013+ else {
9014+ M.x86.R_AX = (u16) srcval;
9015 }
9016 DECODE_CLEAR_SEGOVR();
9017 END_OF_INSTR();
9018@@ -7966,7 +8453,8 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
9019 REMARKS:
9020 Handles opcode 0xb9
9021 ****************************************************************************/
9022-static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
9023+static void
9024+x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
9025 {
9026 u32 srcval;
9027
9028@@ -7974,7 +8462,8 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
9029 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9030 DECODE_PRINTF("MOV\tECX,");
9031 srcval = fetch_long_imm();
9032- } else {
9033+ }
9034+ else {
9035 DECODE_PRINTF("MOV\tCX,");
9036 srcval = fetch_word_imm();
9037 }
9038@@ -7982,8 +8471,9 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
9039 TRACE_AND_STEP();
9040 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9041 M.x86.R_ECX = srcval;
9042- } else {
9043- M.x86.R_CX = (u16)srcval;
9044+ }
9045+ else {
9046+ M.x86.R_CX = (u16) srcval;
9047 }
9048 DECODE_CLEAR_SEGOVR();
9049 END_OF_INSTR();
9050@@ -7993,7 +8483,8 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
9051 REMARKS:
9052 Handles opcode 0xba
9053 ****************************************************************************/
9054-static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
9055+static void
9056+x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
9057 {
9058 u32 srcval;
9059
9060@@ -8001,7 +8492,8 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
9061 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9062 DECODE_PRINTF("MOV\tEDX,");
9063 srcval = fetch_long_imm();
9064- } else {
9065+ }
9066+ else {
9067 DECODE_PRINTF("MOV\tDX,");
9068 srcval = fetch_word_imm();
9069 }
9070@@ -8009,8 +8501,9 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
9071 TRACE_AND_STEP();
9072 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9073 M.x86.R_EDX = srcval;
9074- } else {
9075- M.x86.R_DX = (u16)srcval;
9076+ }
9077+ else {
9078+ M.x86.R_DX = (u16) srcval;
9079 }
9080 DECODE_CLEAR_SEGOVR();
9081 END_OF_INSTR();
9082@@ -8020,7 +8513,8 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
9083 REMARKS:
9084 Handles opcode 0xbb
9085 ****************************************************************************/
9086-static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
9087+static void
9088+x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
9089 {
9090 u32 srcval;
9091
9092@@ -8028,7 +8522,8 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
9093 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9094 DECODE_PRINTF("MOV\tEBX,");
9095 srcval = fetch_long_imm();
9096- } else {
9097+ }
9098+ else {
9099 DECODE_PRINTF("MOV\tBX,");
9100 srcval = fetch_word_imm();
9101 }
9102@@ -8036,8 +8531,9 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
9103 TRACE_AND_STEP();
9104 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9105 M.x86.R_EBX = srcval;
9106- } else {
9107- M.x86.R_BX = (u16)srcval;
9108+ }
9109+ else {
9110+ M.x86.R_BX = (u16) srcval;
9111 }
9112 DECODE_CLEAR_SEGOVR();
9113 END_OF_INSTR();
9114@@ -8047,7 +8543,8 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
9115 REMARKS:
9116 Handles opcode 0xbc
9117 ****************************************************************************/
9118-static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
9119+static void
9120+x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
9121 {
9122 u32 srcval;
9123
9124@@ -8055,7 +8552,8 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
9125 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9126 DECODE_PRINTF("MOV\tESP,");
9127 srcval = fetch_long_imm();
9128- } else {
9129+ }
9130+ else {
9131 DECODE_PRINTF("MOV\tSP,");
9132 srcval = fetch_word_imm();
9133 }
9134@@ -8063,8 +8561,9 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
9135 TRACE_AND_STEP();
9136 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9137 M.x86.R_ESP = srcval;
9138- } else {
9139- M.x86.R_SP = (u16)srcval;
9140+ }
9141+ else {
9142+ M.x86.R_SP = (u16) srcval;
9143 }
9144 DECODE_CLEAR_SEGOVR();
9145 END_OF_INSTR();
9146@@ -8074,7 +8573,8 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
9147 REMARKS:
9148 Handles opcode 0xbd
9149 ****************************************************************************/
9150-static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
9151+static void
9152+x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
9153 {
9154 u32 srcval;
9155
9156@@ -8082,7 +8582,8 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
9157 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9158 DECODE_PRINTF("MOV\tEBP,");
9159 srcval = fetch_long_imm();
9160- } else {
9161+ }
9162+ else {
9163 DECODE_PRINTF("MOV\tBP,");
9164 srcval = fetch_word_imm();
9165 }
9166@@ -8090,8 +8591,9 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
9167 TRACE_AND_STEP();
9168 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9169 M.x86.R_EBP = srcval;
9170- } else {
9171- M.x86.R_BP = (u16)srcval;
9172+ }
9173+ else {
9174+ M.x86.R_BP = (u16) srcval;
9175 }
9176 DECODE_CLEAR_SEGOVR();
9177 END_OF_INSTR();
9178@@ -8101,7 +8603,8 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
9179 REMARKS:
9180 Handles opcode 0xbe
9181 ****************************************************************************/
9182-static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
9183+static void
9184+x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
9185 {
9186 u32 srcval;
9187
9188@@ -8109,7 +8612,8 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
9189 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9190 DECODE_PRINTF("MOV\tESI,");
9191 srcval = fetch_long_imm();
9192- } else {
9193+ }
9194+ else {
9195 DECODE_PRINTF("MOV\tSI,");
9196 srcval = fetch_word_imm();
9197 }
9198@@ -8117,8 +8621,9 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
9199 TRACE_AND_STEP();
9200 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9201 M.x86.R_ESI = srcval;
9202- } else {
9203- M.x86.R_SI = (u16)srcval;
9204+ }
9205+ else {
9206+ M.x86.R_SI = (u16) srcval;
9207 }
9208 DECODE_CLEAR_SEGOVR();
9209 END_OF_INSTR();
9210@@ -8128,7 +8633,8 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
9211 REMARKS:
9212 Handles opcode 0xbf
9213 ****************************************************************************/
9214-static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
9215+static void
9216+x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
9217 {
9218 u32 srcval;
9219
9220@@ -8136,7 +8642,8 @@ static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
9221 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9222 DECODE_PRINTF("MOV\tEDI,");
9223 srcval = fetch_long_imm();
9224- } else {
9225+ }
9226+ else {
9227 DECODE_PRINTF("MOV\tDI,");
9228 srcval = fetch_word_imm();
9229 }
9230@@ -8144,31 +8651,25 @@ static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
9231 TRACE_AND_STEP();
9232 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9233 M.x86.R_EDI = srcval;
9234- } else {
9235- M.x86.R_DI = (u16)srcval;
9236+ }
9237+ else {
9238+ M.x86.R_DI = (u16) srcval;
9239 }
9240 DECODE_CLEAR_SEGOVR();
9241 END_OF_INSTR();
9242 }
9243
9244 /* used by opcodes c0, d0, and d2. */
9245-static u8(*opcD0_byte_operation[])(u8 d, u8 s) =
9246-{
9247- rol_byte,
9248- ror_byte,
9249- rcl_byte,
9250- rcr_byte,
9251- shl_byte,
9252- shr_byte,
9253- shl_byte, /* sal_byte === shl_byte by definition */
9254- sar_byte,
9255-};
9256+static u8(*opcD0_byte_operation[]) (u8 d, u8 s) = {
9257+ rol_byte, ror_byte, rcl_byte, rcr_byte, shl_byte, shr_byte, shl_byte, /* sal_byte === shl_byte by definition */
9258+sar_byte,};
9259
9260 /****************************************************************************
9261 REMARKS:
9262 Handles opcode 0xc0
9263 ****************************************************************************/
9264-static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
9265+static void
9266+x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
9267 {
9268 int mod, rl, rh;
9269 u8 *destreg;
9270@@ -8251,7 +8752,7 @@ static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
9271 destval = (*opcD0_byte_operation[rh]) (destval, amt);
9272 store_data_byte(destoffset, destval);
9273 break;
9274- case 3: /* register to register */
9275+ case 3: /* register to register */
9276 destreg = DECODE_RM_BYTE_REGISTER(rl);
9277 amt = fetch_byte_imm();
9278 DECODE_PRINTF2(",%x\n", amt);
9279@@ -8265,36 +8766,21 @@ static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
9280 }
9281
9282 /* used by opcodes c1, d1, and d3. */
9283-static u16(*opcD1_word_operation[])(u16 s, u8 d) =
9284-{
9285- rol_word,
9286- ror_word,
9287- rcl_word,
9288- rcr_word,
9289- shl_word,
9290- shr_word,
9291- shl_word, /* sal_byte === shl_byte by definition */
9292- sar_word,
9293-};
9294+static u16(*opcD1_word_operation[]) (u16 s, u8 d) = {
9295+ rol_word, ror_word, rcl_word, rcr_word, shl_word, shr_word, shl_word, /* sal_byte === shl_byte by definition */
9296+sar_word,};
9297
9298 /* used by opcodes c1, d1, and d3. */
9299-static u32 (*opcD1_long_operation[])(u32 s, u8 d) =
9300-{
9301- rol_long,
9302- ror_long,
9303- rcl_long,
9304- rcr_long,
9305- shl_long,
9306- shr_long,
9307- shl_long, /* sal_byte === shl_byte by definition */
9308- sar_long,
9309-};
9310+static u32(*opcD1_long_operation[]) (u32 s, u8 d) = {
9311+ rol_long, ror_long, rcl_long, rcr_long, shl_long, shr_long, shl_long, /* sal_byte === shl_byte by definition */
9312+sar_long,};
9313
9314 /****************************************************************************
9315 REMARKS:
9316 Handles opcode 0xc1
9317 ****************************************************************************/
9318-static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9319+static void
9320+x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9321 {
9322 int mod, rl, rh;
9323 uint destoffset;
9324@@ -8357,7 +8843,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9325 TRACE_AND_STEP();
9326 destval = (*opcD1_long_operation[rh]) (destval, amt);
9327 store_data_long(destoffset, destval);
9328- } else {
9329+ }
9330+ else {
9331 u16 destval;
9332
9333 DECODE_PRINTF("WORD PTR ");
9334@@ -8382,7 +8869,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9335 TRACE_AND_STEP();
9336 destval = (*opcD1_long_operation[rh]) (destval, amt);
9337 store_data_long(destoffset, destval);
9338- } else {
9339+ }
9340+ else {
9341 u16 destval;
9342
9343 DECODE_PRINTF("WORD PTR ");
9344@@ -8407,7 +8895,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9345 TRACE_AND_STEP();
9346 destval = (*opcD1_long_operation[rh]) (destval, amt);
9347 store_data_long(destoffset, destval);
9348- } else {
9349+ }
9350+ else {
9351 u16 destval;
9352
9353 DECODE_PRINTF("WORD PTR ");
9354@@ -8420,7 +8909,7 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9355 store_data_word(destoffset, destval);
9356 }
9357 break;
9358- case 3: /* register to register */
9359+ case 3: /* register to register */
9360 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9361 u32 *destreg;
9362
9363@@ -8429,7 +8918,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9364 DECODE_PRINTF2(",%x\n", amt);
9365 TRACE_AND_STEP();
9366 *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
9367- } else {
9368+ }
9369+ else {
9370 u16 *destreg;
9371
9372 destreg = DECODE_RM_WORD_REGISTER(rl);
9373@@ -8448,7 +8938,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
9374 REMARKS:
9375 Handles opcode 0xc2
9376 ****************************************************************************/
9377-static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
9378+static void
9379+x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
9380 {
9381 u16 imm;
9382
9383@@ -8456,8 +8947,8 @@ static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
9384 DECODE_PRINTF("RET\t");
9385 imm = fetch_word_imm();
9386 DECODE_PRINTF2("%x\n", imm);
9387- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
9388- TRACE_AND_STEP();
9389+ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
9390+ TRACE_AND_STEP();
9391 M.x86.R_IP = pop_word();
9392 M.x86.R_SP += imm;
9393 DECODE_CLEAR_SEGOVR();
9394@@ -8468,12 +8959,13 @@ static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
9395 REMARKS:
9396 Handles opcode 0xc3
9397 ****************************************************************************/
9398-static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
9399+static void
9400+x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
9401 {
9402 START_OF_INSTR();
9403 DECODE_PRINTF("RET\n");
9404- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
9405- TRACE_AND_STEP();
9406+ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
9407+ TRACE_AND_STEP();
9408 M.x86.R_IP = pop_word();
9409 DECODE_CLEAR_SEGOVR();
9410 END_OF_INSTR();
9411@@ -8483,7 +8975,8 @@ static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
9412 REMARKS:
9413 Handles opcode 0xc4
9414 ****************************************************************************/
9415-static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
9416+static void
9417+x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
9418 {
9419 int mod, rh, rl;
9420 u16 *dstreg;
9421@@ -8520,7 +9013,7 @@ static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
9422 *dstreg = fetch_data_word(srcoffset);
9423 M.x86.R_ES = fetch_data_word(srcoffset + 2);
9424 break;
9425- case 3: /* register to register */
9426+ case 3: /* register to register */
9427 /* UNDEFINED! */
9428 TRACE_AND_STEP();
9429 }
9430@@ -8532,7 +9025,8 @@ static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
9431 REMARKS:
9432 Handles opcode 0xc5
9433 ****************************************************************************/
9434-static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
9435+static void
9436+x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
9437 {
9438 int mod, rh, rl;
9439 u16 *dstreg;
9440@@ -8569,7 +9063,7 @@ static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
9441 *dstreg = fetch_data_word(srcoffset);
9442 M.x86.R_DS = fetch_data_word(srcoffset + 2);
9443 break;
9444- case 3: /* register to register */
9445+ case 3: /* register to register */
9446 /* UNDEFINED! */
9447 TRACE_AND_STEP();
9448 }
9449@@ -8581,7 +9075,8 @@ static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
9450 REMARKS:
9451 Handles opcode 0xc6
9452 ****************************************************************************/
9453-static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
9454+static void
9455+x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
9456 {
9457 int mod, rl, rh;
9458 u8 *destreg;
9459@@ -8620,7 +9115,7 @@ static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
9460 TRACE_AND_STEP();
9461 store_data_byte(destoffset, imm);
9462 break;
9463- case 3: /* register to register */
9464+ case 3: /* register to register */
9465 destreg = DECODE_RM_BYTE_REGISTER(rl);
9466 imm = fetch_byte_imm();
9467 DECODE_PRINTF2(",%2x\n", imm);
9468@@ -8636,7 +9131,8 @@ static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
9469 REMARKS:
9470 Handles opcode 0xc7
9471 ****************************************************************************/
9472-static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9473+static void
9474+x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9475 {
9476 int mod, rl, rh;
9477 uint destoffset;
9478@@ -8659,7 +9155,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9479 DECODE_PRINTF2(",%x\n", imm);
9480 TRACE_AND_STEP();
9481 store_data_long(destoffset, imm);
9482- } else {
9483+ }
9484+ else {
9485 u16 imm;
9486
9487 DECODE_PRINTF("WORD PTR ");
9488@@ -8680,7 +9177,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9489 DECODE_PRINTF2(",%x\n", imm);
9490 TRACE_AND_STEP();
9491 store_data_long(destoffset, imm);
9492- } else {
9493+ }
9494+ else {
9495 u16 imm;
9496
9497 DECODE_PRINTF("WORD PTR ");
9498@@ -8701,7 +9199,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9499 DECODE_PRINTF2(",%x\n", imm);
9500 TRACE_AND_STEP();
9501 store_data_long(destoffset, imm);
9502- } else {
9503+ }
9504+ else {
9505 u16 imm;
9506
9507 DECODE_PRINTF("WORD PTR ");
9508@@ -8712,19 +9211,20 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9509 store_data_word(destoffset, imm);
9510 }
9511 break;
9512- case 3: /* register to register */
9513+ case 3: /* register to register */
9514 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9515- u32 *destreg;
9516- u32 imm;
9517+ u32 *destreg;
9518+ u32 imm;
9519
9520 destreg = DECODE_RM_LONG_REGISTER(rl);
9521 imm = fetch_long_imm();
9522 DECODE_PRINTF2(",%x\n", imm);
9523 TRACE_AND_STEP();
9524 *destreg = imm;
9525- } else {
9526- u16 *destreg;
9527- u16 imm;
9528+ }
9529+ else {
9530+ u16 *destreg;
9531+ u16 imm;
9532
9533 destreg = DECODE_RM_WORD_REGISTER(rl);
9534 imm = fetch_word_imm();
9535@@ -8742,10 +9242,11 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
9536 REMARKS:
9537 Handles opcode 0xc8
9538 ****************************************************************************/
9539-static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
9540+static void
9541+x86emuOp_enter(u8 X86EMU_UNUSED(op1))
9542 {
9543- u16 local,frame_pointer;
9544- u8 nesting;
9545+ u16 local, frame_pointer;
9546+ u8 nesting;
9547 int i;
9548
9549 START_OF_INSTR();
9550@@ -8760,11 +9261,11 @@ static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
9551 for (i = 1; i < nesting; i++) {
9552 M.x86.R_BP -= 2;
9553 push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
9554- }
9555- push_word(frame_pointer);
9556 }
9557+ push_word(frame_pointer);
9558+ }
9559 M.x86.R_BP = frame_pointer;
9560- M.x86.R_SP = (u16)(M.x86.R_SP - local);
9561+ M.x86.R_SP = (u16) (M.x86.R_SP - local);
9562 DECODE_CLEAR_SEGOVR();
9563 END_OF_INSTR();
9564 }
9565@@ -8773,7 +9274,8 @@ static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
9566 REMARKS:
9567 Handles opcode 0xc9
9568 ****************************************************************************/
9569-static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
9570+static void
9571+x86emuOp_leave(u8 X86EMU_UNUSED(op1))
9572 {
9573 START_OF_INSTR();
9574 DECODE_PRINTF("LEAVE\n");
9575@@ -8788,7 +9290,8 @@ static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
9576 REMARKS:
9577 Handles opcode 0xca
9578 ****************************************************************************/
9579-static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
9580+static void
9581+x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
9582 {
9583 u16 imm;
9584
9585@@ -8796,8 +9299,8 @@ static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
9586 DECODE_PRINTF("RETF\t");
9587 imm = fetch_word_imm();
9588 DECODE_PRINTF2("%x\n", imm);
9589- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
9590- TRACE_AND_STEP();
9591+ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
9592+ TRACE_AND_STEP();
9593 M.x86.R_IP = pop_word();
9594 M.x86.R_CS = pop_word();
9595 M.x86.R_SP += imm;
9596@@ -8809,12 +9312,13 @@ static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
9597 REMARKS:
9598 Handles opcode 0xcb
9599 ****************************************************************************/
9600-static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
9601+static void
9602+x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
9603 {
9604 START_OF_INSTR();
9605 DECODE_PRINTF("RETF\n");
9606- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
9607- TRACE_AND_STEP();
9608+ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
9609+ TRACE_AND_STEP();
9610 M.x86.R_IP = pop_word();
9611 M.x86.R_CS = pop_word();
9612 DECODE_CLEAR_SEGOVR();
9613@@ -8825,15 +9329,17 @@ static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
9614 REMARKS:
9615 Handles opcode 0xcc
9616 ****************************************************************************/
9617-static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
9618+static void
9619+x86emuOp_int3(u8 X86EMU_UNUSED(op1))
9620 {
9621 START_OF_INSTR();
9622 DECODE_PRINTF("INT 3\n");
9623 TRACE_AND_STEP();
9624 if (_X86EMU_intrTab[3]) {
9625- (*_X86EMU_intrTab[3])(3);
9626- } else {
9627- push_word((u16)M.x86.R_FLG);
9628+ (*_X86EMU_intrTab[3]) (3);
9629+ }
9630+ else {
9631+ push_word((u16) M.x86.R_FLG);
9632 CLEAR_FLAG(F_IF);
9633 CLEAR_FLAG(F_TF);
9634 push_word(M.x86.R_CS);
9635@@ -8849,7 +9355,8 @@ static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
9636 REMARKS:
9637 Handles opcode 0xcd
9638 ****************************************************************************/
9639-static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
9640+static void
9641+x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
9642 {
9643 u8 intnum;
9644
9645@@ -8859,9 +9366,10 @@ static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
9646 DECODE_PRINTF2("%x\n", intnum);
9647 TRACE_AND_STEP();
9648 if (_X86EMU_intrTab[intnum]) {
9649- (*_X86EMU_intrTab[intnum])(intnum);
9650- } else {
9651- push_word((u16)M.x86.R_FLG);
9652+ (*_X86EMU_intrTab[intnum]) (intnum);
9653+ }
9654+ else {
9655+ push_word((u16) M.x86.R_FLG);
9656 CLEAR_FLAG(F_IF);
9657 CLEAR_FLAG(F_TF);
9658 push_word(M.x86.R_CS);
9659@@ -8877,16 +9385,18 @@ static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
9660 REMARKS:
9661 Handles opcode 0xce
9662 ****************************************************************************/
9663-static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
9664+static void
9665+x86emuOp_into(u8 X86EMU_UNUSED(op1))
9666 {
9667 START_OF_INSTR();
9668 DECODE_PRINTF("INTO\n");
9669 TRACE_AND_STEP();
9670 if (ACCESS_FLAG(F_OF)) {
9671- if (_X86EMU_intrTab[4]) {
9672- (*_X86EMU_intrTab[4])(4);
9673- } else {
9674- push_word((u16)M.x86.R_FLG);
9675+ if (_X86EMU_intrTab[4]) {
9676+ (*_X86EMU_intrTab[4]) (4);
9677+ }
9678+ else {
9679+ push_word((u16) M.x86.R_FLG);
9680 CLEAR_FLAG(F_IF);
9681 CLEAR_FLAG(F_TF);
9682 push_word(M.x86.R_CS);
9683@@ -8903,7 +9413,8 @@ static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
9684 REMARKS:
9685 Handles opcode 0xcf
9686 ****************************************************************************/
9687-static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
9688+static void
9689+x86emuOp_iret(u8 X86EMU_UNUSED(op1))
9690 {
9691 START_OF_INSTR();
9692 DECODE_PRINTF("IRET\n");
9693@@ -8921,7 +9432,8 @@ static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
9694 REMARKS:
9695 Handles opcode 0xd0
9696 ****************************************************************************/
9697-static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
9698+static void
9699+x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
9700 {
9701 int mod, rl, rh;
9702 u8 *destreg;
9703@@ -8999,7 +9511,7 @@ static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
9704 destval = (*opcD0_byte_operation[rh]) (destval, 1);
9705 store_data_byte(destoffset, destval);
9706 break;
9707- case 3: /* register to register */
9708+ case 3: /* register to register */
9709 destreg = DECODE_RM_BYTE_REGISTER(rl);
9710 DECODE_PRINTF(",1\n");
9711 TRACE_AND_STEP();
9712@@ -9015,7 +9527,8 @@ static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
9713 REMARKS:
9714 Handles opcode 0xd1
9715 ****************************************************************************/
9716-static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9717+static void
9718+x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9719 {
9720 int mod, rl, rh;
9721 uint destoffset;
9722@@ -9075,7 +9588,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9723 TRACE_AND_STEP();
9724 destval = (*opcD1_long_operation[rh]) (destval, 1);
9725 store_data_long(destoffset, destval);
9726- } else {
9727+ }
9728+ else {
9729 u16 destval;
9730
9731 DECODE_PRINTF("WORD PTR ");
9732@@ -9098,7 +9612,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9733 TRACE_AND_STEP();
9734 destval = (*opcD1_long_operation[rh]) (destval, 1);
9735 store_data_long(destoffset, destval);
9736- } else {
9737+ }
9738+ else {
9739 u16 destval;
9740
9741 DECODE_PRINTF("WORD PTR ");
9742@@ -9121,7 +9636,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9743 TRACE_AND_STEP();
9744 destval = (*opcD1_long_operation[rh]) (destval, 1);
9745 store_data_long(destoffset, destval);
9746- } else {
9747+ }
9748+ else {
9749 u16 destval;
9750
9751 DECODE_PRINTF("BYTE PTR ");
9752@@ -9133,19 +9649,20 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9753 store_data_word(destoffset, destval);
9754 }
9755 break;
9756- case 3: /* register to register */
9757+ case 3: /* register to register */
9758 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9759- u32 destval;
9760- u32 *destreg;
9761+ u32 destval;
9762+ u32 *destreg;
9763
9764 destreg = DECODE_RM_LONG_REGISTER(rl);
9765 DECODE_PRINTF(",1\n");
9766 TRACE_AND_STEP();
9767 destval = (*opcD1_long_operation[rh]) (*destreg, 1);
9768 *destreg = destval;
9769- } else {
9770- u16 destval;
9771- u16 *destreg;
9772+ }
9773+ else {
9774+ u16 destval;
9775+ u16 *destreg;
9776
9777 destreg = DECODE_RM_WORD_REGISTER(rl);
9778 DECODE_PRINTF(",1\n");
9779@@ -9163,7 +9680,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
9780 REMARKS:
9781 Handles opcode 0xd2
9782 ****************************************************************************/
9783-static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
9784+static void
9785+x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
9786 {
9787 int mod, rl, rh;
9788 u8 *destreg;
9789@@ -9243,7 +9761,7 @@ static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
9790 destval = (*opcD0_byte_operation[rh]) (destval, amt);
9791 store_data_byte(destoffset, destval);
9792 break;
9793- case 3: /* register to register */
9794+ case 3: /* register to register */
9795 destreg = DECODE_RM_BYTE_REGISTER(rl);
9796 DECODE_PRINTF(",CL\n");
9797 TRACE_AND_STEP();
9798@@ -9259,7 +9777,8 @@ static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
9799 REMARKS:
9800 Handles opcode 0xd3
9801 ****************************************************************************/
9802-static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9803+static void
9804+x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9805 {
9806 int mod, rl, rh;
9807 uint destoffset;
9808@@ -9321,7 +9840,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9809 TRACE_AND_STEP();
9810 destval = (*opcD1_long_operation[rh]) (destval, amt);
9811 store_data_long(destoffset, destval);
9812- } else {
9813+ }
9814+ else {
9815 u16 destval;
9816
9817 DECODE_PRINTF("WORD PTR ");
9818@@ -9344,7 +9864,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9819 TRACE_AND_STEP();
9820 destval = (*opcD1_long_operation[rh]) (destval, amt);
9821 store_data_long(destoffset, destval);
9822- } else {
9823+ }
9824+ else {
9825 u16 destval;
9826
9827 DECODE_PRINTF("WORD PTR ");
9828@@ -9367,7 +9888,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9829 TRACE_AND_STEP();
9830 destval = (*opcD1_long_operation[rh]) (destval, amt);
9831 store_data_long(destoffset, destval);
9832- } else {
9833+ }
9834+ else {
9835 u16 destval;
9836
9837 DECODE_PRINTF("WORD PTR ");
9838@@ -9379,7 +9901,7 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9839 store_data_word(destoffset, destval);
9840 }
9841 break;
9842- case 3: /* register to register */
9843+ case 3: /* register to register */
9844 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
9845 u32 *destreg;
9846
9847@@ -9387,7 +9909,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9848 DECODE_PRINTF(",CL\n");
9849 TRACE_AND_STEP();
9850 *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
9851- } else {
9852+ }
9853+ else {
9854 u16 *destreg;
9855
9856 destreg = DECODE_RM_WORD_REGISTER(rl);
9857@@ -9405,16 +9928,17 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
9858 REMARKS:
9859 Handles opcode 0xd4
9860 ****************************************************************************/
9861-static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
9862+static void
9863+x86emuOp_aam(u8 X86EMU_UNUSED(op1))
9864 {
9865 u8 a;
9866
9867 START_OF_INSTR();
9868 DECODE_PRINTF("AAM\n");
9869- a = fetch_byte_imm(); /* this is a stupid encoding. */
9870+ a = fetch_byte_imm(); /* this is a stupid encoding. */
9871 if (a != 10) {
9872- /* fix: add base decoding
9873- aam_word(u8 val, int base a) */
9874+ /* fix: add base decoding
9875+ aam_word(u8 val, int base a) */
9876 DECODE_PRINTF("ERROR DECODING AAM\n");
9877 TRACE_REGS();
9878 HALT_SYS();
9879@@ -9430,7 +9954,8 @@ static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
9880 REMARKS:
9881 Handles opcode 0xd5
9882 ****************************************************************************/
9883-static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
9884+static void
9885+x86emuOp_aad(u8 X86EMU_UNUSED(op1))
9886 {
9887 u8 a;
9888
9889@@ -9438,8 +9963,8 @@ static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
9890 DECODE_PRINTF("AAD\n");
9891 a = fetch_byte_imm();
9892 if (a != 10) {
9893- /* fix: add base decoding
9894- aad_word(u16 val, int base a) */
9895+ /* fix: add base decoding
9896+ aad_word(u16 val, int base a) */
9897 DECODE_PRINTF("ERROR DECODING AAM\n");
9898 TRACE_REGS();
9899 HALT_SYS();
9900@@ -9456,14 +9981,15 @@ static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
9901 REMARKS:
9902 Handles opcode 0xd7
9903 ****************************************************************************/
9904-static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
9905+static void
9906+x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
9907 {
9908 u16 addr;
9909
9910 START_OF_INSTR();
9911 DECODE_PRINTF("XLAT\n");
9912 TRACE_AND_STEP();
9913- addr = (u16)(M.x86.R_BX + (u8)M.x86.R_AL);
9914+ addr = (u16) (M.x86.R_BX + (u8) M.x86.R_AL);
9915 M.x86.R_AL = fetch_data_byte(addr);
9916 DECODE_CLEAR_SEGOVR();
9917 END_OF_INSTR();
9918@@ -9475,7 +10001,8 @@ static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
9919 REMARKS:
9920 Handles opcode 0xe0
9921 ****************************************************************************/
9922-static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
9923+static void
9924+x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
9925 {
9926 s16 ip;
9927
9928@@ -9486,7 +10013,7 @@ static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
9929 DECODE_PRINTF2("%04x\n", ip);
9930 TRACE_AND_STEP();
9931 M.x86.R_CX -= 1;
9932- if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
9933+ if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
9934 M.x86.R_IP = ip;
9935 DECODE_CLEAR_SEGOVR();
9936 END_OF_INSTR();
9937@@ -9496,7 +10023,8 @@ static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
9938 REMARKS:
9939 Handles opcode 0xe1
9940 ****************************************************************************/
9941-static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
9942+static void
9943+x86emuOp_loope(u8 X86EMU_UNUSED(op1))
9944 {
9945 s16 ip;
9946
9947@@ -9507,7 +10035,7 @@ static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
9948 DECODE_PRINTF2("%04x\n", ip);
9949 TRACE_AND_STEP();
9950 M.x86.R_CX -= 1;
9951- if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
9952+ if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
9953 M.x86.R_IP = ip;
9954 DECODE_CLEAR_SEGOVR();
9955 END_OF_INSTR();
9956@@ -9517,7 +10045,8 @@ static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
9957 REMARKS:
9958 Handles opcode 0xe2
9959 ****************************************************************************/
9960-static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
9961+static void
9962+x86emuOp_loop(u8 X86EMU_UNUSED(op1))
9963 {
9964 s16 ip;
9965
9966@@ -9538,16 +10067,17 @@ static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
9967 REMARKS:
9968 Handles opcode 0xe3
9969 ****************************************************************************/
9970-static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
9971+static void
9972+x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
9973 {
9974 u16 target;
9975- s8 offset;
9976+ s8 offset;
9977
9978 /* jump to byte offset if overflow flag is set */
9979 START_OF_INSTR();
9980 DECODE_PRINTF("JCXZ\t");
9981- offset = (s8)fetch_byte_imm();
9982- target = (u16)(M.x86.R_IP + offset);
9983+ offset = (s8) fetch_byte_imm();
9984+ target = (u16) (M.x86.R_IP + offset);
9985 DECODE_PRINTF2("%x\n", target);
9986 TRACE_AND_STEP();
9987 if (M.x86.R_CX == 0)
9988@@ -9560,16 +10090,17 @@ static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
9989 REMARKS:
9990 Handles opcode 0xe4
9991 ****************************************************************************/
9992-static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
9993+static void
9994+x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
9995 {
9996 u8 port;
9997
9998 START_OF_INSTR();
9999 DECODE_PRINTF("IN\t");
10000- port = (u8) fetch_byte_imm();
10001+ port = (u8) fetch_byte_imm();
10002 DECODE_PRINTF2("%x,AL\n", port);
10003 TRACE_AND_STEP();
10004- M.x86.R_AL = (*sys_inb)(port);
10005+ M.x86.R_AL = (*sys_inb) (port);
10006 DECODE_CLEAR_SEGOVR();
10007 END_OF_INSTR();
10008 }
10009@@ -9578,23 +10109,26 @@ static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
10010 REMARKS:
10011 Handles opcode 0xe5
10012 ****************************************************************************/
10013-static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
10014+static void
10015+x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
10016 {
10017 u8 port;
10018
10019 START_OF_INSTR();
10020 DECODE_PRINTF("IN\t");
10021- port = (u8) fetch_byte_imm();
10022+ port = (u8) fetch_byte_imm();
10023 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10024 DECODE_PRINTF2("EAX,%x\n", port);
10025- } else {
10026+ }
10027+ else {
10028 DECODE_PRINTF2("AX,%x\n", port);
10029 }
10030 TRACE_AND_STEP();
10031 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10032- M.x86.R_EAX = (*sys_inl)(port);
10033- } else {
10034- M.x86.R_AX = (*sys_inw)(port);
10035+ M.x86.R_EAX = (*sys_inl) (port);
10036+ }
10037+ else {
10038+ M.x86.R_AX = (*sys_inw) (port);
10039 }
10040 DECODE_CLEAR_SEGOVR();
10041 END_OF_INSTR();
10042@@ -9604,16 +10138,17 @@ static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
10043 REMARKS:
10044 Handles opcode 0xe6
10045 ****************************************************************************/
10046-static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
10047+static void
10048+x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
10049 {
10050 u8 port;
10051
10052 START_OF_INSTR();
10053 DECODE_PRINTF("OUT\t");
10054- port = (u8) fetch_byte_imm();
10055+ port = (u8) fetch_byte_imm();
10056 DECODE_PRINTF2("%x,AL\n", port);
10057 TRACE_AND_STEP();
10058- (*sys_outb)(port, M.x86.R_AL);
10059+ (*sys_outb) (port, M.x86.R_AL);
10060 DECODE_CLEAR_SEGOVR();
10061 END_OF_INSTR();
10062 }
10063@@ -9622,23 +10157,26 @@ static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
10064 REMARKS:
10065 Handles opcode 0xe7
10066 ****************************************************************************/
10067-static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
10068+static void
10069+x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
10070 {
10071 u8 port;
10072
10073 START_OF_INSTR();
10074 DECODE_PRINTF("OUT\t");
10075- port = (u8) fetch_byte_imm();
10076+ port = (u8) fetch_byte_imm();
10077 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10078 DECODE_PRINTF2("%x,EAX\n", port);
10079- } else {
10080+ }
10081+ else {
10082 DECODE_PRINTF2("%x,AX\n", port);
10083 }
10084 TRACE_AND_STEP();
10085 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10086- (*sys_outl)(port, M.x86.R_EAX);
10087- } else {
10088- (*sys_outw)(port, M.x86.R_AX);
10089+ (*sys_outl) (port, M.x86.R_EAX);
10090+ }
10091+ else {
10092+ (*sys_outw) (port, M.x86.R_AX);
10093 }
10094 DECODE_CLEAR_SEGOVR();
10095 END_OF_INSTR();
10096@@ -9648,19 +10186,35 @@ static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
10097 REMARKS:
10098 Handles opcode 0xe8
10099 ****************************************************************************/
10100-static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
10101+static void
10102+x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
10103 {
10104- s16 ip;
10105+ s16 ip16;
10106+ s32 ip32;
10107
10108 START_OF_INSTR();
10109- DECODE_PRINTF("CALL\t");
10110- ip = (s16) fetch_word_imm();
10111- ip += (s16) M.x86.R_IP; /* CHECK SIGN */
10112- DECODE_PRINTF2("%04x\n", (u16)ip);
10113- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip, "");
10114+ DECODE_PRINTF("CALL\t");
10115+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10116+ ip32 = (s32) fetch_long_imm();
10117+ ip32 += (s16) M.x86.R_IP; /* CHECK SIGN */
10118+ DECODE_PRINTF2("%04x\n", (u16) ip32);
10119+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip32, "");
10120+ }
10121+ else {
10122+ ip16 = (s16) fetch_word_imm();
10123+ ip16 += (s16) M.x86.R_IP; /* CHECK SIGN */
10124+ DECODE_PRINTF2("%04x\n", (u16) ip16);
10125+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip16, "");
10126+ }
10127 TRACE_AND_STEP();
10128- push_word(M.x86.R_IP);
10129- M.x86.R_IP = ip;
10130+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10131+ push_long(M.x86.R_EIP);
10132+ M.x86.R_EIP = ip32 & 0xffff;
10133+ }
10134+ else {
10135+ push_word(M.x86.R_IP);
10136+ M.x86.R_EIP = ip16;
10137+ }
10138 DECODE_CLEAR_SEGOVR();
10139 END_OF_INSTR();
10140 }
10141@@ -9669,17 +10223,27 @@ static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
10142 REMARKS:
10143 Handles opcode 0xe9
10144 ****************************************************************************/
10145-static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
10146+static void
10147+x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
10148 {
10149- int ip;
10150+ u32 ip;
10151
10152 START_OF_INSTR();
10153 DECODE_PRINTF("JMP\t");
10154- ip = (s16)fetch_word_imm();
10155- ip += (s16)M.x86.R_IP;
10156- DECODE_PRINTF2("%04x\n", (u16)ip);
10157- TRACE_AND_STEP();
10158- M.x86.R_IP = (u16)ip;
10159+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10160+ ip = (u32) fetch_long_imm();
10161+ ip += (u32) M.x86.R_EIP;
10162+ DECODE_PRINTF2("%08x\n", (u32) ip);
10163+ TRACE_AND_STEP();
10164+ M.x86.R_EIP = (u32) ip;
10165+ }
10166+ else {
10167+ ip = (s16) fetch_word_imm();
10168+ ip += (s16) M.x86.R_IP;
10169+ DECODE_PRINTF2("%04x\n", (u16) ip);
10170+ TRACE_AND_STEP();
10171+ M.x86.R_IP = (u16) ip;
10172+ }
10173 DECODE_CLEAR_SEGOVR();
10174 END_OF_INSTR();
10175 }
10176@@ -9688,18 +10252,25 @@ static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
10177 REMARKS:
10178 Handles opcode 0xea
10179 ****************************************************************************/
10180-static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
10181+static void
10182+x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
10183 {
10184- u16 cs, ip;
10185+ u16 cs;
10186+ u32 ip;
10187
10188 START_OF_INSTR();
10189 DECODE_PRINTF("JMP\tFAR ");
10190- ip = fetch_word_imm();
10191+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10192+ ip = fetch_long_imm();
10193+ }
10194+ else {
10195+ ip = fetch_word_imm();
10196+ }
10197 cs = fetch_word_imm();
10198 DECODE_PRINTF2("%04x:", cs);
10199 DECODE_PRINTF2("%04x\n", ip);
10200 TRACE_AND_STEP();
10201- M.x86.R_IP = ip;
10202+ M.x86.R_EIP = ip & 0xffff;
10203 M.x86.R_CS = cs;
10204 DECODE_CLEAR_SEGOVR();
10205 END_OF_INSTR();
10206@@ -9709,15 +10280,16 @@ static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
10207 REMARKS:
10208 Handles opcode 0xeb
10209 ****************************************************************************/
10210-static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
10211+static void
10212+x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
10213 {
10214 u16 target;
10215 s8 offset;
10216
10217 START_OF_INSTR();
10218 DECODE_PRINTF("JMP\t");
10219- offset = (s8)fetch_byte_imm();
10220- target = (u16)(M.x86.R_IP + offset);
10221+ offset = (s8) fetch_byte_imm();
10222+ target = (u16) (M.x86.R_IP + offset);
10223 DECODE_PRINTF2("%x\n", target);
10224 TRACE_AND_STEP();
10225 M.x86.R_IP = target;
10226@@ -9729,12 +10301,13 @@ static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
10227 REMARKS:
10228 Handles opcode 0xec
10229 ****************************************************************************/
10230-static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
10231+static void
10232+x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
10233 {
10234 START_OF_INSTR();
10235 DECODE_PRINTF("IN\tAL,DX\n");
10236 TRACE_AND_STEP();
10237- M.x86.R_AL = (*sys_inb)(M.x86.R_DX);
10238+ M.x86.R_AL = (*sys_inb) (M.x86.R_DX);
10239 DECODE_CLEAR_SEGOVR();
10240 END_OF_INSTR();
10241 }
10242@@ -9743,19 +10316,22 @@ static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
10243 REMARKS:
10244 Handles opcode 0xed
10245 ****************************************************************************/
10246-static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
10247+static void
10248+x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
10249 {
10250 START_OF_INSTR();
10251 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10252 DECODE_PRINTF("IN\tEAX,DX\n");
10253- } else {
10254+ }
10255+ else {
10256 DECODE_PRINTF("IN\tAX,DX\n");
10257 }
10258 TRACE_AND_STEP();
10259 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10260- M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
10261- } else {
10262- M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
10263+ M.x86.R_EAX = (*sys_inl) (M.x86.R_DX);
10264+ }
10265+ else {
10266+ M.x86.R_AX = (*sys_inw) (M.x86.R_DX);
10267 }
10268 DECODE_CLEAR_SEGOVR();
10269 END_OF_INSTR();
10270@@ -9765,12 +10341,13 @@ static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
10271 REMARKS:
10272 Handles opcode 0xee
10273 ****************************************************************************/
10274-static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
10275+static void
10276+x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
10277 {
10278 START_OF_INSTR();
10279 DECODE_PRINTF("OUT\tDX,AL\n");
10280 TRACE_AND_STEP();
10281- (*sys_outb)(M.x86.R_DX, M.x86.R_AL);
10282+ (*sys_outb) (M.x86.R_DX, M.x86.R_AL);
10283 DECODE_CLEAR_SEGOVR();
10284 END_OF_INSTR();
10285 }
10286@@ -9779,19 +10356,22 @@ static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
10287 REMARKS:
10288 Handles opcode 0xef
10289 ****************************************************************************/
10290-static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
10291+static void
10292+x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
10293 {
10294 START_OF_INSTR();
10295 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10296 DECODE_PRINTF("OUT\tDX,EAX\n");
10297- } else {
10298+ }
10299+ else {
10300 DECODE_PRINTF("OUT\tDX,AX\n");
10301 }
10302 TRACE_AND_STEP();
10303 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10304- (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
10305- } else {
10306- (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
10307+ (*sys_outl) (M.x86.R_DX, M.x86.R_EAX);
10308+ }
10309+ else {
10310+ (*sys_outw) (M.x86.R_DX, M.x86.R_AX);
10311 }
10312 DECODE_CLEAR_SEGOVR();
10313 END_OF_INSTR();
10314@@ -9801,7 +10381,8 @@ static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
10315 REMARKS:
10316 Handles opcode 0xf0
10317 ****************************************************************************/
10318-static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
10319+static void
10320+x86emuOp_lock(u8 X86EMU_UNUSED(op1))
10321 {
10322 START_OF_INSTR();
10323 DECODE_PRINTF("LOCK:\n");
10324@@ -9816,7 +10397,8 @@ static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
10325 REMARKS:
10326 Handles opcode 0xf2
10327 ****************************************************************************/
10328-static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
10329+static void
10330+x86emuOp_repne(u8 X86EMU_UNUSED(op1))
10331 {
10332 START_OF_INSTR();
10333 DECODE_PRINTF("REPNE\n");
10334@@ -9830,7 +10412,8 @@ static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
10335 REMARKS:
10336 Handles opcode 0xf3
10337 ****************************************************************************/
10338-static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
10339+static void
10340+x86emuOp_repe(u8 X86EMU_UNUSED(op1))
10341 {
10342 START_OF_INSTR();
10343 DECODE_PRINTF("REPE\n");
10344@@ -9844,7 +10427,8 @@ static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
10345 REMARKS:
10346 Handles opcode 0xf4
10347 ****************************************************************************/
10348-static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
10349+static void
10350+x86emuOp_halt(u8 X86EMU_UNUSED(op1))
10351 {
10352 START_OF_INSTR();
10353 DECODE_PRINTF("HALT\n");
10354@@ -9858,7 +10442,8 @@ static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
10355 REMARKS:
10356 Handles opcode 0xf5
10357 ****************************************************************************/
10358-static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
10359+static void
10360+x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
10361 {
10362 /* complement the carry flag. */
10363 START_OF_INSTR();
10364@@ -9873,7 +10458,8 @@ static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
10365 REMARKS:
10366 Handles opcode 0xf6
10367 ****************************************************************************/
10368-static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10369+static void
10370+x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10371 {
10372 int mod, rl, rh;
10373 u8 *destreg;
10374@@ -9885,9 +10471,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10375 START_OF_INSTR();
10376 FETCH_DECODE_MODRM(mod, rh, rl);
10377 switch (mod) {
10378- case 0: /* mod=00 */
10379+ case 0: /* mod=00 */
10380 switch (rh) {
10381- case 0: /* test byte imm */
10382+ case 0: /* test byte imm */
10383 DECODE_PRINTF("TEST\tBYTE PTR ");
10384 destoffset = decode_rm00_address(rl);
10385 DECODE_PRINTF(",");
10386@@ -9953,9 +10539,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10387 break;
10388 }
10389 break; /* end mod==00 */
10390- case 1: /* mod=01 */
10391+ case 1: /* mod=01 */
10392 switch (rh) {
10393- case 0: /* test byte imm */
10394+ case 0: /* test byte imm */
10395 DECODE_PRINTF("TEST\tBYTE PTR ");
10396 destoffset = decode_rm01_address(rl);
10397 DECODE_PRINTF(",");
10398@@ -10021,9 +10607,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10399 break;
10400 }
10401 break; /* end mod==01 */
10402- case 2: /* mod=10 */
10403+ case 2: /* mod=10 */
10404 switch (rh) {
10405- case 0: /* test byte imm */
10406+ case 0: /* test byte imm */
10407 DECODE_PRINTF("TEST\tBYTE PTR ");
10408 destoffset = decode_rm10_address(rl);
10409 DECODE_PRINTF(",");
10410@@ -10089,9 +10675,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10411 break;
10412 }
10413 break; /* end mod==10 */
10414- case 3: /* mod=11 */
10415+ case 3: /* mod=11 */
10416 switch (rh) {
10417- case 0: /* test byte imm */
10418+ case 0: /* test byte imm */
10419 DECODE_PRINTF("TEST\t");
10420 destreg = DECODE_RM_BYTE_REGISTER(rl);
10421 DECODE_PRINTF(",");
10422@@ -10123,7 +10709,7 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10423 destreg = DECODE_RM_BYTE_REGISTER(rl);
10424 DECODE_PRINTF("\n");
10425 TRACE_AND_STEP();
10426- mul_byte(*destreg); /*!!! */
10427+ mul_byte(*destreg); /*!!! */
10428 break;
10429 case 5:
10430 DECODE_PRINTF("IMUL\t");
10431@@ -10157,7 +10743,8 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
10432 REMARKS:
10433 Handles opcode 0xf7
10434 ****************************************************************************/
10435-static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10436+static void
10437+x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10438 {
10439 int mod, rl, rh;
10440 uint destoffset;
10441@@ -10167,11 +10754,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10442 START_OF_INSTR();
10443 FETCH_DECODE_MODRM(mod, rh, rl);
10444 switch (mod) {
10445- case 0: /* mod=00 */
10446+ case 0: /* mod=00 */
10447 switch (rh) {
10448- case 0: /* test word imm */
10449+ case 0: /* test word imm */
10450 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10451- u32 destval,srcval;
10452+ u32 destval, srcval;
10453
10454 DECODE_PRINTF("TEST\tDWORD PTR ");
10455 destoffset = decode_rm00_address(rl);
10456@@ -10181,8 +10768,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10457 destval = fetch_data_long(destoffset);
10458 TRACE_AND_STEP();
10459 test_long(destval, srcval);
10460- } else {
10461- u16 destval,srcval;
10462+ }
10463+ else {
10464+ u16 destval, srcval;
10465
10466 DECODE_PRINTF("TEST\tWORD PTR ");
10467 destoffset = decode_rm00_address(rl);
10468@@ -10209,7 +10797,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10469 TRACE_AND_STEP();
10470 destval = not_long(destval);
10471 store_data_long(destoffset, destval);
10472- } else {
10473+ }
10474+ else {
10475 u16 destval;
10476
10477 DECODE_PRINTF("NOT\tWORD PTR ");
10478@@ -10232,7 +10821,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10479 TRACE_AND_STEP();
10480 destval = neg_long(destval);
10481 store_data_long(destoffset, destval);
10482- } else {
10483+ }
10484+ else {
10485 u16 destval;
10486
10487 DECODE_PRINTF("NEG\tWORD PTR ");
10488@@ -10254,7 +10844,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10489 destval = fetch_data_long(destoffset);
10490 TRACE_AND_STEP();
10491 mul_long(destval);
10492- } else {
10493+ }
10494+ else {
10495 u16 destval;
10496
10497 DECODE_PRINTF("MUL\tWORD PTR ");
10498@@ -10275,7 +10866,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10499 destval = fetch_data_long(destoffset);
10500 TRACE_AND_STEP();
10501 imul_long(destval);
10502- } else {
10503+ }
10504+ else {
10505 u16 destval;
10506
10507 DECODE_PRINTF("IMUL\tWORD PTR ");
10508@@ -10296,7 +10888,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10509 destval = fetch_data_long(destoffset);
10510 TRACE_AND_STEP();
10511 div_long(destval);
10512- } else {
10513+ }
10514+ else {
10515 u16 destval;
10516
10517 DECODE_PRINTF("DIV\tWORD PTR ");
10518@@ -10317,7 +10910,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10519 destval = fetch_data_long(destoffset);
10520 TRACE_AND_STEP();
10521 idiv_long(destval);
10522- } else {
10523+ }
10524+ else {
10525 u16 destval;
10526
10527 DECODE_PRINTF("IDIV\tWORD PTR ");
10528@@ -10330,11 +10924,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10529 break;
10530 }
10531 break; /* end mod==00 */
10532- case 1: /* mod=01 */
10533+ case 1: /* mod=01 */
10534 switch (rh) {
10535- case 0: /* test word imm */
10536+ case 0: /* test word imm */
10537 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10538- u32 destval,srcval;
10539+ u32 destval, srcval;
10540
10541 DECODE_PRINTF("TEST\tDWORD PTR ");
10542 destoffset = decode_rm01_address(rl);
10543@@ -10344,8 +10938,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10544 destval = fetch_data_long(destoffset);
10545 TRACE_AND_STEP();
10546 test_long(destval, srcval);
10547- } else {
10548- u16 destval,srcval;
10549+ }
10550+ else {
10551+ u16 destval, srcval;
10552
10553 DECODE_PRINTF("TEST\tWORD PTR ");
10554 destoffset = decode_rm01_address(rl);
10555@@ -10372,7 +10967,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10556 TRACE_AND_STEP();
10557 destval = not_long(destval);
10558 store_data_long(destoffset, destval);
10559- } else {
10560+ }
10561+ else {
10562 u16 destval;
10563
10564 DECODE_PRINTF("NOT\tWORD PTR ");
10565@@ -10395,7 +10991,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10566 TRACE_AND_STEP();
10567 destval = neg_long(destval);
10568 store_data_long(destoffset, destval);
10569- } else {
10570+ }
10571+ else {
10572 u16 destval;
10573
10574 DECODE_PRINTF("NEG\tWORD PTR ");
10575@@ -10417,7 +11014,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10576 destval = fetch_data_long(destoffset);
10577 TRACE_AND_STEP();
10578 mul_long(destval);
10579- } else {
10580+ }
10581+ else {
10582 u16 destval;
10583
10584 DECODE_PRINTF("MUL\tWORD PTR ");
10585@@ -10438,7 +11036,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10586 destval = fetch_data_long(destoffset);
10587 TRACE_AND_STEP();
10588 imul_long(destval);
10589- } else {
10590+ }
10591+ else {
10592 u16 destval;
10593
10594 DECODE_PRINTF("IMUL\tWORD PTR ");
10595@@ -10459,7 +11058,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10596 destval = fetch_data_long(destoffset);
10597 TRACE_AND_STEP();
10598 div_long(destval);
10599- } else {
10600+ }
10601+ else {
10602 u16 destval;
10603
10604 DECODE_PRINTF("DIV\tWORD PTR ");
10605@@ -10480,7 +11080,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10606 destval = fetch_data_long(destoffset);
10607 TRACE_AND_STEP();
10608 idiv_long(destval);
10609- } else {
10610+ }
10611+ else {
10612 u16 destval;
10613
10614 DECODE_PRINTF("IDIV\tWORD PTR ");
10615@@ -10493,11 +11094,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10616 break;
10617 }
10618 break; /* end mod==01 */
10619- case 2: /* mod=10 */
10620+ case 2: /* mod=10 */
10621 switch (rh) {
10622- case 0: /* test word imm */
10623+ case 0: /* test word imm */
10624 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10625- u32 destval,srcval;
10626+ u32 destval, srcval;
10627
10628 DECODE_PRINTF("TEST\tDWORD PTR ");
10629 destoffset = decode_rm10_address(rl);
10630@@ -10507,8 +11108,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10631 destval = fetch_data_long(destoffset);
10632 TRACE_AND_STEP();
10633 test_long(destval, srcval);
10634- } else {
10635- u16 destval,srcval;
10636+ }
10637+ else {
10638+ u16 destval, srcval;
10639
10640 DECODE_PRINTF("TEST\tWORD PTR ");
10641 destoffset = decode_rm10_address(rl);
10642@@ -10535,7 +11137,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10643 TRACE_AND_STEP();
10644 destval = not_long(destval);
10645 store_data_long(destoffset, destval);
10646- } else {
10647+ }
10648+ else {
10649 u16 destval;
10650
10651 DECODE_PRINTF("NOT\tWORD PTR ");
10652@@ -10558,7 +11161,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10653 TRACE_AND_STEP();
10654 destval = neg_long(destval);
10655 store_data_long(destoffset, destval);
10656- } else {
10657+ }
10658+ else {
10659 u16 destval;
10660
10661 DECODE_PRINTF("NEG\tWORD PTR ");
10662@@ -10580,7 +11184,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10663 destval = fetch_data_long(destoffset);
10664 TRACE_AND_STEP();
10665 mul_long(destval);
10666- } else {
10667+ }
10668+ else {
10669 u16 destval;
10670
10671 DECODE_PRINTF("MUL\tWORD PTR ");
10672@@ -10601,7 +11206,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10673 destval = fetch_data_long(destoffset);
10674 TRACE_AND_STEP();
10675 imul_long(destval);
10676- } else {
10677+ }
10678+ else {
10679 u16 destval;
10680
10681 DECODE_PRINTF("IMUL\tWORD PTR ");
10682@@ -10622,7 +11228,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10683 destval = fetch_data_long(destoffset);
10684 TRACE_AND_STEP();
10685 div_long(destval);
10686- } else {
10687+ }
10688+ else {
10689 u16 destval;
10690
10691 DECODE_PRINTF("DIV\tWORD PTR ");
10692@@ -10643,7 +11250,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10693 destval = fetch_data_long(destoffset);
10694 TRACE_AND_STEP();
10695 idiv_long(destval);
10696- } else {
10697+ }
10698+ else {
10699 u16 destval;
10700
10701 DECODE_PRINTF("IDIV\tWORD PTR ");
10702@@ -10656,9 +11264,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10703 break;
10704 }
10705 break; /* end mod==10 */
10706- case 3: /* mod=11 */
10707+ case 3: /* mod=11 */
10708 switch (rh) {
10709- case 0: /* test word imm */
10710+ case 0: /* test word imm */
10711 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10712 u32 *destreg;
10713 u32 srcval;
10714@@ -10670,7 +11278,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10715 DECODE_PRINTF2("%x\n", srcval);
10716 TRACE_AND_STEP();
10717 test_long(*destreg, srcval);
10718- } else {
10719+ }
10720+ else {
10721 u16 *destreg;
10722 u16 srcval;
10723
10724@@ -10696,7 +11305,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10725 DECODE_PRINTF("\n");
10726 TRACE_AND_STEP();
10727 *destreg = not_long(*destreg);
10728- } else {
10729+ }
10730+ else {
10731 u16 *destreg;
10732
10733 DECODE_PRINTF("NOT\t");
10734@@ -10715,7 +11325,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10735 DECODE_PRINTF("\n");
10736 TRACE_AND_STEP();
10737 *destreg = neg_long(*destreg);
10738- } else {
10739+ }
10740+ else {
10741 u16 *destreg;
10742
10743 DECODE_PRINTF("NEG\t");
10744@@ -10733,15 +11344,16 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10745 destreg = DECODE_RM_LONG_REGISTER(rl);
10746 DECODE_PRINTF("\n");
10747 TRACE_AND_STEP();
10748- mul_long(*destreg); /*!!! */
10749- } else {
10750+ mul_long(*destreg); /*!!! */
10751+ }
10752+ else {
10753 u16 *destreg;
10754
10755 DECODE_PRINTF("MUL\t");
10756 destreg = DECODE_RM_WORD_REGISTER(rl);
10757 DECODE_PRINTF("\n");
10758 TRACE_AND_STEP();
10759- mul_word(*destreg); /*!!! */
10760+ mul_word(*destreg); /*!!! */
10761 }
10762 break;
10763 case 5:
10764@@ -10753,7 +11365,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10765 DECODE_PRINTF("\n");
10766 TRACE_AND_STEP();
10767 imul_long(*destreg);
10768- } else {
10769+ }
10770+ else {
10771 u16 *destreg;
10772
10773 DECODE_PRINTF("IMUL\t");
10774@@ -10772,7 +11385,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10775 DECODE_PRINTF("\n");
10776 TRACE_AND_STEP();
10777 div_long(*destreg);
10778- } else {
10779+ }
10780+ else {
10781 u16 *destreg;
10782
10783 DECODE_PRINTF("DIV\t");
10784@@ -10791,7 +11405,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10785 DECODE_PRINTF("\n");
10786 TRACE_AND_STEP();
10787 idiv_long(*destreg);
10788- } else {
10789+ }
10790+ else {
10791 u16 *destreg;
10792
10793 DECODE_PRINTF("IDIV\t");
10794@@ -10812,7 +11427,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
10795 REMARKS:
10796 Handles opcode 0xf8
10797 ****************************************************************************/
10798-static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
10799+static void
10800+x86emuOp_clc(u8 X86EMU_UNUSED(op1))
10801 {
10802 /* clear the carry flag. */
10803 START_OF_INSTR();
10804@@ -10827,7 +11443,8 @@ static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
10805 REMARKS:
10806 Handles opcode 0xf9
10807 ****************************************************************************/
10808-static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
10809+static void
10810+x86emuOp_stc(u8 X86EMU_UNUSED(op1))
10811 {
10812 /* set the carry flag. */
10813 START_OF_INSTR();
10814@@ -10842,7 +11459,8 @@ static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
10815 REMARKS:
10816 Handles opcode 0xfa
10817 ****************************************************************************/
10818-static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
10819+static void
10820+x86emuOp_cli(u8 X86EMU_UNUSED(op1))
10821 {
10822 /* clear interrupts. */
10823 START_OF_INSTR();
10824@@ -10857,7 +11475,8 @@ static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
10825 REMARKS:
10826 Handles opcode 0xfb
10827 ****************************************************************************/
10828-static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
10829+static void
10830+x86emuOp_sti(u8 X86EMU_UNUSED(op1))
10831 {
10832 /* enable interrupts. */
10833 START_OF_INSTR();
10834@@ -10872,7 +11491,8 @@ static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
10835 REMARKS:
10836 Handles opcode 0xfc
10837 ****************************************************************************/
10838-static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
10839+static void
10840+x86emuOp_cld(u8 X86EMU_UNUSED(op1))
10841 {
10842 /* clear interrupts. */
10843 START_OF_INSTR();
10844@@ -10887,7 +11507,8 @@ static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
10845 REMARKS:
10846 Handles opcode 0xfd
10847 ****************************************************************************/
10848-static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
10849+static void
10850+x86emuOp_std(u8 X86EMU_UNUSED(op1))
10851 {
10852 /* clear interrupts. */
10853 START_OF_INSTR();
10854@@ -10902,7 +11523,8 @@ static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
10855 REMARKS:
10856 Handles opcode 0xfe
10857 ****************************************************************************/
10858-static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
10859+static void
10860+x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
10861 {
10862 int mod, rh, rl;
10863 u8 destval;
10864@@ -10944,13 +11566,13 @@ static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
10865 destoffset = decode_rm00_address(rl);
10866 DECODE_PRINTF("\n");
10867 switch (rh) {
10868- case 0: /* inc word ptr ... */
10869+ case 0: /* inc word ptr ... */
10870 destval = fetch_data_byte(destoffset);
10871 TRACE_AND_STEP();
10872 destval = inc_byte(destval);
10873 store_data_byte(destoffset, destval);
10874 break;
10875- case 1: /* dec word ptr ... */
10876+ case 1: /* dec word ptr ... */
10877 destval = fetch_data_byte(destoffset);
10878 TRACE_AND_STEP();
10879 destval = dec_byte(destval);
10880@@ -11019,12 +11641,13 @@ static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
10881 REMARKS:
10882 Handles opcode 0xff
10883 ****************************************************************************/
10884-static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10885+static void
10886+x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10887 {
10888 int mod, rh, rl;
10889 uint destoffset = 0;
10890- u16 *destreg;
10891- u16 destval,destval2;
10892+ u16 *destreg;
10893+ u16 destval, destval2;
10894
10895 /* Yet another special case instruction. */
10896 START_OF_INSTR();
10897@@ -11040,14 +11663,16 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10898 case 0:
10899 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10900 DECODE_PRINTF("INC\tDWORD PTR ");
10901- } else {
10902+ }
10903+ else {
10904 DECODE_PRINTF("INC\tWORD PTR ");
10905 }
10906 break;
10907 case 1:
10908 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10909 DECODE_PRINTF("DEC\tDWORD PTR ");
10910- } else {
10911+ }
10912+ else {
10913 DECODE_PRINTF("DEC\tWORD PTR ");
10914 }
10915 break;
10916@@ -11078,7 +11703,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10917 destoffset = decode_rm00_address(rl);
10918 DECODE_PRINTF("\n");
10919 switch (rh) {
10920- case 0: /* inc word ptr ... */
10921+ case 0: /* inc word ptr ... */
10922 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10923 u32 destval;
10924
10925@@ -11086,7 +11711,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10926 TRACE_AND_STEP();
10927 destval = inc_long(destval);
10928 store_data_long(destoffset, destval);
10929- } else {
10930+ }
10931+ else {
10932 u16 destval;
10933
10934 destval = fetch_data_word(destoffset);
10935@@ -11095,7 +11721,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10936 store_data_word(destoffset, destval);
10937 }
10938 break;
10939- case 1: /* dec word ptr ... */
10940+ case 1: /* dec word ptr ... */
10941 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10942 u32 destval;
10943
10944@@ -11103,7 +11729,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10945 TRACE_AND_STEP();
10946 destval = dec_long(destval);
10947 store_data_long(destoffset, destval);
10948- } else {
10949+ }
10950+ else {
10951 u16 destval;
10952
10953 destval = fetch_data_word(destoffset);
10954@@ -11112,13 +11739,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10955 store_data_word(destoffset, destval);
10956 }
10957 break;
10958- case 2: /* call word ptr ... */
10959+ case 2: /* call word ptr ... */
10960 destval = fetch_data_word(destoffset);
10961 TRACE_AND_STEP();
10962 push_word(M.x86.R_IP);
10963 M.x86.R_IP = destval;
10964 break;
10965- case 3: /* call far ptr ... */
10966+ case 3: /* call far ptr ... */
10967 destval = fetch_data_word(destoffset);
10968 destval2 = fetch_data_word(destoffset + 2);
10969 TRACE_AND_STEP();
10970@@ -11127,26 +11754,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
10971 push_word(M.x86.R_IP);
10972 M.x86.R_IP = destval;
10973 break;
10974- case 4: /* jmp word ptr ... */
10975+ case 4: /* jmp word ptr ... */
10976 destval = fetch_data_word(destoffset);
10977 TRACE_AND_STEP();
10978 M.x86.R_IP = destval;
10979 break;
10980- case 5: /* jmp far ptr ... */
10981+ case 5: /* jmp far ptr ... */
10982 destval = fetch_data_word(destoffset);
10983 destval2 = fetch_data_word(destoffset + 2);
10984 TRACE_AND_STEP();
10985 M.x86.R_IP = destval;
10986 M.x86.R_CS = destval2;
10987 break;
10988- case 6: /* push word ptr ... */
10989+ case 6: /* push word ptr ... */
10990 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
10991 u32 destval;
10992
10993 destval = fetch_data_long(destoffset);
10994 TRACE_AND_STEP();
10995 push_long(destval);
10996- } else {
10997+ }
10998+ else {
10999 u16 destval;
11000
11001 destval = fetch_data_word(destoffset);
11002@@ -11168,7 +11796,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11003 TRACE_AND_STEP();
11004 destval = inc_long(destval);
11005 store_data_long(destoffset, destval);
11006- } else {
11007+ }
11008+ else {
11009 u16 destval;
11010
11011 destval = fetch_data_word(destoffset);
11012@@ -11185,7 +11814,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11013 TRACE_AND_STEP();
11014 destval = dec_long(destval);
11015 store_data_long(destoffset, destval);
11016- } else {
11017+ }
11018+ else {
11019 u16 destval;
11020
11021 destval = fetch_data_word(destoffset);
11022@@ -11194,13 +11824,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11023 store_data_word(destoffset, destval);
11024 }
11025 break;
11026- case 2: /* call word ptr ... */
11027+ case 2: /* call word ptr ... */
11028 destval = fetch_data_word(destoffset);
11029 TRACE_AND_STEP();
11030 push_word(M.x86.R_IP);
11031 M.x86.R_IP = destval;
11032 break;
11033- case 3: /* call far ptr ... */
11034+ case 3: /* call far ptr ... */
11035 destval = fetch_data_word(destoffset);
11036 destval2 = fetch_data_word(destoffset + 2);
11037 TRACE_AND_STEP();
11038@@ -11209,26 +11839,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11039 push_word(M.x86.R_IP);
11040 M.x86.R_IP = destval;
11041 break;
11042- case 4: /* jmp word ptr ... */
11043+ case 4: /* jmp word ptr ... */
11044 destval = fetch_data_word(destoffset);
11045 TRACE_AND_STEP();
11046 M.x86.R_IP = destval;
11047 break;
11048- case 5: /* jmp far ptr ... */
11049+ case 5: /* jmp far ptr ... */
11050 destval = fetch_data_word(destoffset);
11051 destval2 = fetch_data_word(destoffset + 2);
11052 TRACE_AND_STEP();
11053 M.x86.R_IP = destval;
11054 M.x86.R_CS = destval2;
11055 break;
11056- case 6: /* push word ptr ... */
11057+ case 6: /* push word ptr ... */
11058 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
11059 u32 destval;
11060
11061 destval = fetch_data_long(destoffset);
11062 TRACE_AND_STEP();
11063 push_long(destval);
11064- } else {
11065+ }
11066+ else {
11067 u16 destval;
11068
11069 destval = fetch_data_word(destoffset);
11070@@ -11250,7 +11881,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11071 TRACE_AND_STEP();
11072 destval = inc_long(destval);
11073 store_data_long(destoffset, destval);
11074- } else {
11075+ }
11076+ else {
11077 u16 destval;
11078
11079 destval = fetch_data_word(destoffset);
11080@@ -11267,7 +11899,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11081 TRACE_AND_STEP();
11082 destval = dec_long(destval);
11083 store_data_long(destoffset, destval);
11084- } else {
11085+ }
11086+ else {
11087 u16 destval;
11088
11089 destval = fetch_data_word(destoffset);
11090@@ -11276,13 +11909,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11091 store_data_word(destoffset, destval);
11092 }
11093 break;
11094- case 2: /* call word ptr ... */
11095+ case 2: /* call word ptr ... */
11096 destval = fetch_data_word(destoffset);
11097 TRACE_AND_STEP();
11098 push_word(M.x86.R_IP);
11099 M.x86.R_IP = destval;
11100 break;
11101- case 3: /* call far ptr ... */
11102+ case 3: /* call far ptr ... */
11103 destval = fetch_data_word(destoffset);
11104 destval2 = fetch_data_word(destoffset + 2);
11105 TRACE_AND_STEP();
11106@@ -11291,26 +11924,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11107 push_word(M.x86.R_IP);
11108 M.x86.R_IP = destval;
11109 break;
11110- case 4: /* jmp word ptr ... */
11111+ case 4: /* jmp word ptr ... */
11112 destval = fetch_data_word(destoffset);
11113 TRACE_AND_STEP();
11114 M.x86.R_IP = destval;
11115 break;
11116- case 5: /* jmp far ptr ... */
11117+ case 5: /* jmp far ptr ... */
11118 destval = fetch_data_word(destoffset);
11119 destval2 = fetch_data_word(destoffset + 2);
11120 TRACE_AND_STEP();
11121 M.x86.R_IP = destval;
11122 M.x86.R_CS = destval2;
11123 break;
11124- case 6: /* push word ptr ... */
11125+ case 6: /* push word ptr ... */
11126 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
11127 u32 destval;
11128
11129 destval = fetch_data_long(destoffset);
11130 TRACE_AND_STEP();
11131 push_long(destval);
11132- } else {
11133+ }
11134+ else {
11135 u16 destval;
11136
11137 destval = fetch_data_word(destoffset);
11138@@ -11330,7 +11964,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11139 DECODE_PRINTF("\n");
11140 TRACE_AND_STEP();
11141 *destreg = inc_long(*destreg);
11142- } else {
11143+ }
11144+ else {
11145 u16 *destreg;
11146
11147 destreg = DECODE_RM_WORD_REGISTER(rl);
11148@@ -11347,7 +11982,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11149 DECODE_PRINTF("\n");
11150 TRACE_AND_STEP();
11151 *destreg = dec_long(*destreg);
11152- } else {
11153+ }
11154+ else {
11155 u16 *destreg;
11156
11157 destreg = DECODE_RM_WORD_REGISTER(rl);
11158@@ -11356,26 +11992,26 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11159 *destreg = dec_word(*destreg);
11160 }
11161 break;
11162- case 2: /* call word ptr ... */
11163+ case 2: /* call word ptr ... */
11164 destreg = DECODE_RM_WORD_REGISTER(rl);
11165 DECODE_PRINTF("\n");
11166 TRACE_AND_STEP();
11167 push_word(M.x86.R_IP);
11168 M.x86.R_IP = *destreg;
11169 break;
11170- case 3: /* jmp far ptr ... */
11171+ case 3: /* jmp far ptr ... */
11172 DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
11173 TRACE_AND_STEP();
11174 HALT_SYS();
11175 break;
11176
11177- case 4: /* jmp ... */
11178+ case 4: /* jmp ... */
11179 destreg = DECODE_RM_WORD_REGISTER(rl);
11180 DECODE_PRINTF("\n");
11181 TRACE_AND_STEP();
11182 M.x86.R_IP = (u16) (*destreg);
11183 break;
11184- case 5: /* jmp far ptr ... */
11185+ case 5: /* jmp far ptr ... */
11186 DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
11187 TRACE_AND_STEP();
11188 HALT_SYS();
11189@@ -11388,7 +12024,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11190 DECODE_PRINTF("\n");
11191 TRACE_AND_STEP();
11192 push_long(*destreg);
11193- } else {
11194+ }
11195+ else {
11196 u16 *destreg;
11197
11198 destreg = DECODE_RM_WORD_REGISTER(rl);
11199@@ -11407,8 +12044,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
11200 /***************************************************************************
11201 * Single byte operation code table:
11202 **************************************************************************/
11203-void (*x86emu_optab[256])(u8) =
11204-{
11205+void (*x86emu_optab[256]) (u8) = {
11206 /* 0x00 */ x86emuOp_add_byte_RM_R,
11207 /* 0x01 */ x86emuOp_add_word_RM_R,
11208 /* 0x02 */ x86emuOp_add_byte_R_RM,
11209@@ -11417,7 +12053,6 @@ void (*x86emu_optab[256])(u8) =
11210 /* 0x05 */ x86emuOp_add_word_AX_IMM,
11211 /* 0x06 */ x86emuOp_push_ES,
11212 /* 0x07 */ x86emuOp_pop_ES,
11213-
11214 /* 0x08 */ x86emuOp_or_byte_RM_R,
11215 /* 0x09 */ x86emuOp_or_word_RM_R,
11216 /* 0x0a */ x86emuOp_or_byte_R_RM,
11217@@ -11426,7 +12061,6 @@ void (*x86emu_optab[256])(u8) =
11218 /* 0x0d */ x86emuOp_or_word_AX_IMM,
11219 /* 0x0e */ x86emuOp_push_CS,
11220 /* 0x0f */ x86emuOp_two_byte,
11221-
11222 /* 0x10 */ x86emuOp_adc_byte_RM_R,
11223 /* 0x11 */ x86emuOp_adc_word_RM_R,
11224 /* 0x12 */ x86emuOp_adc_byte_R_RM,
11225@@ -11435,7 +12069,6 @@ void (*x86emu_optab[256])(u8) =
11226 /* 0x15 */ x86emuOp_adc_word_AX_IMM,
11227 /* 0x16 */ x86emuOp_push_SS,
11228 /* 0x17 */ x86emuOp_pop_SS,
11229-
11230 /* 0x18 */ x86emuOp_sbb_byte_RM_R,
11231 /* 0x19 */ x86emuOp_sbb_word_RM_R,
11232 /* 0x1a */ x86emuOp_sbb_byte_R_RM,
11233@@ -11444,7 +12077,6 @@ void (*x86emu_optab[256])(u8) =
11234 /* 0x1d */ x86emuOp_sbb_word_AX_IMM,
11235 /* 0x1e */ x86emuOp_push_DS,
11236 /* 0x1f */ x86emuOp_pop_DS,
11237-
11238 /* 0x20 */ x86emuOp_and_byte_RM_R,
11239 /* 0x21 */ x86emuOp_and_word_RM_R,
11240 /* 0x22 */ x86emuOp_and_byte_R_RM,
11241@@ -11453,7 +12085,6 @@ void (*x86emu_optab[256])(u8) =
11242 /* 0x25 */ x86emuOp_and_word_AX_IMM,
11243 /* 0x26 */ x86emuOp_segovr_ES,
11244 /* 0x27 */ x86emuOp_daa,
11245-
11246 /* 0x28 */ x86emuOp_sub_byte_RM_R,
11247 /* 0x29 */ x86emuOp_sub_word_RM_R,
11248 /* 0x2a */ x86emuOp_sub_byte_R_RM,
11249@@ -11462,7 +12093,6 @@ void (*x86emu_optab[256])(u8) =
11250 /* 0x2d */ x86emuOp_sub_word_AX_IMM,
11251 /* 0x2e */ x86emuOp_segovr_CS,
11252 /* 0x2f */ x86emuOp_das,
11253-
11254 /* 0x30 */ x86emuOp_xor_byte_RM_R,
11255 /* 0x31 */ x86emuOp_xor_word_RM_R,
11256 /* 0x32 */ x86emuOp_xor_byte_R_RM,
11257@@ -11471,7 +12101,6 @@ void (*x86emu_optab[256])(u8) =
11258 /* 0x35 */ x86emuOp_xor_word_AX_IMM,
11259 /* 0x36 */ x86emuOp_segovr_SS,
11260 /* 0x37 */ x86emuOp_aaa,
11261-
11262 /* 0x38 */ x86emuOp_cmp_byte_RM_R,
11263 /* 0x39 */ x86emuOp_cmp_word_RM_R,
11264 /* 0x3a */ x86emuOp_cmp_byte_R_RM,
11265@@ -11480,7 +12109,6 @@ void (*x86emu_optab[256])(u8) =
11266 /* 0x3d */ x86emuOp_cmp_word_AX_IMM,
11267 /* 0x3e */ x86emuOp_segovr_DS,
11268 /* 0x3f */ x86emuOp_aas,
11269-
11270 /* 0x40 */ x86emuOp_inc_AX,
11271 /* 0x41 */ x86emuOp_inc_CX,
11272 /* 0x42 */ x86emuOp_inc_DX,
11273@@ -11489,7 +12117,6 @@ void (*x86emu_optab[256])(u8) =
11274 /* 0x45 */ x86emuOp_inc_BP,
11275 /* 0x46 */ x86emuOp_inc_SI,
11276 /* 0x47 */ x86emuOp_inc_DI,
11277-
11278 /* 0x48 */ x86emuOp_dec_AX,
11279 /* 0x49 */ x86emuOp_dec_CX,
11280 /* 0x4a */ x86emuOp_dec_DX,
11281@@ -11498,7 +12125,6 @@ void (*x86emu_optab[256])(u8) =
11282 /* 0x4d */ x86emuOp_dec_BP,
11283 /* 0x4e */ x86emuOp_dec_SI,
11284 /* 0x4f */ x86emuOp_dec_DI,
11285-
11286 /* 0x50 */ x86emuOp_push_AX,
11287 /* 0x51 */ x86emuOp_push_CX,
11288 /* 0x52 */ x86emuOp_push_DX,
11289@@ -11507,7 +12133,6 @@ void (*x86emu_optab[256])(u8) =
11290 /* 0x55 */ x86emuOp_push_BP,
11291 /* 0x56 */ x86emuOp_push_SI,
11292 /* 0x57 */ x86emuOp_push_DI,
11293-
11294 /* 0x58 */ x86emuOp_pop_AX,
11295 /* 0x59 */ x86emuOp_pop_CX,
11296 /* 0x5a */ x86emuOp_pop_DX,
11297@@ -11516,16 +12141,16 @@ void (*x86emu_optab[256])(u8) =
11298 /* 0x5d */ x86emuOp_pop_BP,
11299 /* 0x5e */ x86emuOp_pop_SI,
11300 /* 0x5f */ x86emuOp_pop_DI,
11301-
11302 /* 0x60 */ x86emuOp_push_all,
11303 /* 0x61 */ x86emuOp_pop_all,
11304-/* 0x62 */ x86emuOp_illegal_op, /* bound */
11305-/* 0x63 */ x86emuOp_illegal_op, /* arpl */
11306+ /* 0x62 */ x86emuOp_illegal_op,
11307+ /* bound */
11308+ /* 0x63 */ x86emuOp_illegal_op,
11309+ /* arpl */
11310 /* 0x64 */ x86emuOp_segovr_FS,
11311 /* 0x65 */ x86emuOp_segovr_GS,
11312 /* 0x66 */ x86emuOp_prefix_data,
11313 /* 0x67 */ x86emuOp_prefix_addr,
11314-
11315 /* 0x68 */ x86emuOp_push_word_IMM,
11316 /* 0x69 */ x86emuOp_imul_word_IMM,
11317 /* 0x6a */ x86emuOp_push_byte_IMM,
11318@@ -11534,7 +12159,6 @@ void (*x86emu_optab[256])(u8) =
11319 /* 0x6d */ x86emuOp_ins_word,
11320 /* 0x6e */ x86emuOp_outs_byte,
11321 /* 0x6f */ x86emuOp_outs_word,
11322-
11323 /* 0x70 */ x86emuOp_jump_near_O,
11324 /* 0x71 */ x86emuOp_jump_near_NO,
11325 /* 0x72 */ x86emuOp_jump_near_B,
11326@@ -11543,7 +12167,6 @@ void (*x86emu_optab[256])(u8) =
11327 /* 0x75 */ x86emuOp_jump_near_NZ,
11328 /* 0x76 */ x86emuOp_jump_near_BE,
11329 /* 0x77 */ x86emuOp_jump_near_NBE,
11330-
11331 /* 0x78 */ x86emuOp_jump_near_S,
11332 /* 0x79 */ x86emuOp_jump_near_NS,
11333 /* 0x7a */ x86emuOp_jump_near_P,
11334@@ -11552,7 +12175,6 @@ void (*x86emu_optab[256])(u8) =
11335 /* 0x7d */ x86emuOp_jump_near_NL,
11336 /* 0x7e */ x86emuOp_jump_near_LE,
11337 /* 0x7f */ x86emuOp_jump_near_NLE,
11338-
11339 /* 0x80 */ x86emuOp_opc80_byte_RM_IMM,
11340 /* 0x81 */ x86emuOp_opc81_word_RM_IMM,
11341 /* 0x82 */ x86emuOp_opc82_byte_RM_IMM,
11342@@ -11561,7 +12183,6 @@ void (*x86emu_optab[256])(u8) =
11343 /* 0x85 */ x86emuOp_test_word_RM_R,
11344 /* 0x86 */ x86emuOp_xchg_byte_RM_R,
11345 /* 0x87 */ x86emuOp_xchg_word_RM_R,
11346-
11347 /* 0x88 */ x86emuOp_mov_byte_RM_R,
11348 /* 0x89 */ x86emuOp_mov_word_RM_R,
11349 /* 0x8a */ x86emuOp_mov_byte_R_RM,
11350@@ -11570,7 +12191,6 @@ void (*x86emu_optab[256])(u8) =
11351 /* 0x8d */ x86emuOp_lea_word_R_M,
11352 /* 0x8e */ x86emuOp_mov_word_SR_RM,
11353 /* 0x8f */ x86emuOp_pop_RM,
11354-
11355 /* 0x90 */ x86emuOp_nop,
11356 /* 0x91 */ x86emuOp_xchg_word_AX_CX,
11357 /* 0x92 */ x86emuOp_xchg_word_AX_DX,
11358@@ -11579,7 +12199,6 @@ void (*x86emu_optab[256])(u8) =
11359 /* 0x95 */ x86emuOp_xchg_word_AX_BP,
11360 /* 0x96 */ x86emuOp_xchg_word_AX_SI,
11361 /* 0x97 */ x86emuOp_xchg_word_AX_DI,
11362-
11363 /* 0x98 */ x86emuOp_cbw,
11364 /* 0x99 */ x86emuOp_cwd,
11365 /* 0x9a */ x86emuOp_call_far_IMM,
11366@@ -11588,7 +12207,6 @@ void (*x86emu_optab[256])(u8) =
11367 /* 0x9d */ x86emuOp_popf_word,
11368 /* 0x9e */ x86emuOp_sahf,
11369 /* 0x9f */ x86emuOp_lahf,
11370-
11371 /* 0xa0 */ x86emuOp_mov_AL_M_IMM,
11372 /* 0xa1 */ x86emuOp_mov_AX_M_IMM,
11373 /* 0xa2 */ x86emuOp_mov_M_AL_IMM,
11374@@ -11605,8 +12223,6 @@ void (*x86emu_optab[256])(u8) =
11375 /* 0xad */ x86emuOp_lods_word,
11376 /* 0xac */ x86emuOp_scas_byte,
11377 /* 0xad */ x86emuOp_scas_word,
11378-
11379-
11380 /* 0xb0 */ x86emuOp_mov_byte_AL_IMM,
11381 /* 0xb1 */ x86emuOp_mov_byte_CL_IMM,
11382 /* 0xb2 */ x86emuOp_mov_byte_DL_IMM,
11383@@ -11615,7 +12231,6 @@ void (*x86emu_optab[256])(u8) =
11384 /* 0xb5 */ x86emuOp_mov_byte_CH_IMM,
11385 /* 0xb6 */ x86emuOp_mov_byte_DH_IMM,
11386 /* 0xb7 */ x86emuOp_mov_byte_BH_IMM,
11387-
11388 /* 0xb8 */ x86emuOp_mov_word_AX_IMM,
11389 /* 0xb9 */ x86emuOp_mov_word_CX_IMM,
11390 /* 0xba */ x86emuOp_mov_word_DX_IMM,
11391@@ -11624,7 +12239,6 @@ void (*x86emu_optab[256])(u8) =
11392 /* 0xbd */ x86emuOp_mov_word_BP_IMM,
11393 /* 0xbe */ x86emuOp_mov_word_SI_IMM,
11394 /* 0xbf */ x86emuOp_mov_word_DI_IMM,
11395-
11396 /* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM,
11397 /* 0xc1 */ x86emuOp_opcC1_word_RM_MEM,
11398 /* 0xc2 */ x86emuOp_ret_near_IMM,
11399@@ -11641,14 +12255,14 @@ void (*x86emu_optab[256])(u8) =
11400 /* 0xcd */ x86emuOp_int_IMM,
11401 /* 0xce */ x86emuOp_into,
11402 /* 0xcf */ x86emuOp_iret,
11403-
11404 /* 0xd0 */ x86emuOp_opcD0_byte_RM_1,
11405 /* 0xd1 */ x86emuOp_opcD1_word_RM_1,
11406 /* 0xd2 */ x86emuOp_opcD2_byte_RM_CL,
11407 /* 0xd3 */ x86emuOp_opcD3_word_RM_CL,
11408 /* 0xd4 */ x86emuOp_aam,
11409 /* 0xd5 */ x86emuOp_aad,
11410-/* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */
11411+ /* 0xd6 */ x86emuOp_illegal_op,
11412+ /* Undocumented SETALC instruction */
11413 /* 0xd7 */ x86emuOp_xlat,
11414 /* 0xd8 */ x86emuOp_esc_coprocess_d8,
11415 /* 0xd9 */ x86emuOp_esc_coprocess_d9,
11416@@ -11658,7 +12272,6 @@ void (*x86emu_optab[256])(u8) =
11417 /* 0xdd */ x86emuOp_esc_coprocess_dd,
11418 /* 0xde */ x86emuOp_esc_coprocess_de,
11419 /* 0xdf */ x86emuOp_esc_coprocess_df,
11420-
11421 /* 0xe0 */ x86emuOp_loopne,
11422 /* 0xe1 */ x86emuOp_loope,
11423 /* 0xe2 */ x86emuOp_loop,
11424@@ -11667,7 +12280,6 @@ void (*x86emu_optab[256])(u8) =
11425 /* 0xe5 */ x86emuOp_in_word_AX_IMM,
11426 /* 0xe6 */ x86emuOp_out_byte_IMM_AL,
11427 /* 0xe7 */ x86emuOp_out_word_IMM_AX,
11428-
11429 /* 0xe8 */ x86emuOp_call_near_IMM,
11430 /* 0xe9 */ x86emuOp_jump_near_IMM,
11431 /* 0xea */ x86emuOp_jump_far_IMM,
11432@@ -11676,7 +12288,6 @@ void (*x86emu_optab[256])(u8) =
11433 /* 0xed */ x86emuOp_in_word_AX_DX,
11434 /* 0xee */ x86emuOp_out_byte_DX_AL,
11435 /* 0xef */ x86emuOp_out_word_DX_AX,
11436-
11437 /* 0xf0 */ x86emuOp_lock,
11438 /* 0xf1 */ x86emuOp_illegal_op,
11439 /* 0xf2 */ x86emuOp_repne,
11440@@ -11685,7 +12296,6 @@ void (*x86emu_optab[256])(u8) =
11441 /* 0xf5 */ x86emuOp_cmc,
11442 /* 0xf6 */ x86emuOp_opcF6_byte_RM,
11443 /* 0xf7 */ x86emuOp_opcF7_word_RM,
11444-
11445 /* 0xf8 */ x86emuOp_clc,
11446 /* 0xf9 */ x86emuOp_stc,
11447 /* 0xfa */ x86emuOp_cli,
11448diff --git a/libs/x86emu/ops2.c b/libs/x86emu/ops2.c
11449index 06b7f56..5ed2bf6 100644
11450--- a/libs/x86emu/ops2.c
11451+++ b/libs/x86emu/ops2.c
11452@@ -55,16 +55,14 @@ op1 - Instruction op code
11453 REMARKS:
11454 Handles illegal opcodes.
11455 ****************************************************************************/
11456-static void x86emuOp2_illegal_op(
11457- u8 op2)
11458+static void
11459+x86emuOp2_illegal_op(u8 op2)
11460 {
11461- int mod, rl, rh;
11462- START_OF_INSTR();
11463- FETCH_DECODE_MODRM(mod, rh, rl);
11464- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
11465- TRACE_REGS();
11466- printk("%04x:%04x: %02X /%d ILLEGAL EXTENDED X86 OPCODE! (mod=%d rl=%d)\n",
11467- M.x86.R_CS, M.x86.R_IP-2,op2, rh, mod, rl);
11468+ START_OF_INSTR();
11469+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
11470+ TRACE_REGS();
11471+ printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
11472+ M.x86.R_CS, M.x86.R_IP - 2, op2);
11473 HALT_SYS();
11474 END_OF_INSTR();
11475 }
11476@@ -73,55 +71,10 @@ static void x86emuOp2_illegal_op(
11477
11478 /****************************************************************************
11479 REMARKS:
11480-Handles opcode 0x0f,0x01
11481-****************************************************************************/
11482-static void x86emuOp2_group_g(u8 X86EMU_UNUSED(op2))
11483-{
11484- int mod, rl, rh;
11485- u16 *destreg;
11486- uint destoffset;
11487-
11488- START_OF_INSTR();
11489- FETCH_DECODE_MODRM(mod, rh, rl);
11490- switch (rh) {
11491- case 4: // SMSW (Store Machine Status Word)
11492- // Decode the mod byte to find the addressing
11493- // Always returns 0x10 (initial value as per intel manual volume 3, figure 8-1
11494- switch (mod) {
11495- case 0:
11496- destoffset = decode_rm00_address(rl);
11497- store_data_word(destoffset, 0x10);
11498- break;
11499- case 1:
11500- destoffset = decode_rm01_address(rl);
11501- store_data_word(destoffset, 0x10);
11502- break;
11503- case 2:
11504- destoffset = decode_rm10_address(rl);
11505- store_data_word(destoffset, 0x10);
11506- break;
11507- case 3:
11508- destreg = DECODE_RM_WORD_REGISTER(rl);
11509- *destreg = 0x10;
11510- break;
11511- }
11512- break;
11513- default:
11514- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE IN 0F 01\n");
11515- TRACE_REGS();
11516- printk("%04x:%04x: 0F %02X /%d ILLEGAL EXTENDED X86 OPCODE! (mod=%d rl=%d)\n",
11517- M.x86.R_CS, M.x86.R_IP-2,op2, rh, mod, rl);
11518- HALT_SYS();
11519- break;
11520- }
11521- END_OF_INSTR();
11522-}
11523-
11524-/****************************************************************************
11525-REMARKS:
11526 Handles opcode 0x0f,0x31
11527 ****************************************************************************/
11528-static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
11529+static void
11530+x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
11531 {
11532 #ifdef __HAS_LONG_LONG__
11533 static u64 counter = 0;
11534@@ -155,90 +108,91 @@ static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
11535 REMARKS:
11536 Handles opcode 0x0f,0x80-0x8F
11537 ****************************************************************************/
11538-static void x86emuOp2_long_jump(u8 op2)
11539+static void
11540+x86emuOp2_long_jump(u8 op2)
11541 {
11542 s32 target;
11543- char *name = 0;
11544+ const char *name = NULL;
11545 int cond = 0;
11546
11547 /* conditional jump to word offset. */
11548 START_OF_INSTR();
11549 switch (op2) {
11550- case 0x80:
11551+ case 0x80:
11552 name = "JO\t";
11553- cond = ACCESS_FLAG(F_OF);
11554+ cond = ACCESS_FLAG(F_OF);
11555 break;
11556- case 0x81:
11557+ case 0x81:
11558 name = "JNO\t";
11559 cond = !ACCESS_FLAG(F_OF);
11560 break;
11561- case 0x82:
11562+ case 0x82:
11563 name = "JB\t";
11564 cond = ACCESS_FLAG(F_CF);
11565 break;
11566- case 0x83:
11567+ case 0x83:
11568 name = "JNB\t";
11569 cond = !ACCESS_FLAG(F_CF);
11570 break;
11571- case 0x84:
11572+ case 0x84:
11573 name = "JZ\t";
11574 cond = ACCESS_FLAG(F_ZF);
11575 break;
11576- case 0x85:
11577+ case 0x85:
11578 name = "JNZ\t";
11579 cond = !ACCESS_FLAG(F_ZF);
11580 break;
11581- case 0x86:
11582+ case 0x86:
11583 name = "JBE\t";
11584 cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
11585 break;
11586- case 0x87:
11587+ case 0x87:
11588 name = "JNBE\t";
11589 cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
11590 break;
11591- case 0x88:
11592+ case 0x88:
11593 name = "JS\t";
11594 cond = ACCESS_FLAG(F_SF);
11595 break;
11596- case 0x89:
11597+ case 0x89:
11598 name = "JNS\t";
11599 cond = !ACCESS_FLAG(F_SF);
11600 break;
11601- case 0x8a:
11602+ case 0x8a:
11603 name = "JP\t";
11604 cond = ACCESS_FLAG(F_PF);
11605 break;
11606- case 0x8b:
11607+ case 0x8b:
11608 name = "JNP\t";
11609 cond = !ACCESS_FLAG(F_PF);
11610 break;
11611- case 0x8c:
11612+ case 0x8c:
11613 name = "JL\t";
11614 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
11615 break;
11616- case 0x8d:
11617+ case 0x8d:
11618 name = "JNL\t";
11619 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)));
11620 break;
11621- case 0x8e:
11622+ case 0x8e:
11623 name = "JLE\t";
11624 cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
11625 ACCESS_FLAG(F_ZF));
11626 break;
11627- case 0x8f:
11628+ case 0x8f:
11629 name = "JNLE\t";
11630 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
11631 ACCESS_FLAG(F_ZF));
11632 break;
11633 }
11634 DECODE_PRINTF(name);
11635- (void)name;
11636+ (void) name;
11637 target = (s16) fetch_word_imm();
11638 target += (s16) M.x86.R_IP;
11639 DECODE_PRINTF2("%04x\n", target);
11640 TRACE_AND_STEP();
11641 if (cond)
11642- M.x86.R_IP = (u16)target;
11643+ M.x86.R_IP = (u16) target;
11644 DECODE_CLEAR_SEGOVR();
11645 END_OF_INSTR();
11646 }
11647@@ -247,85 +201,86 @@ static void x86emuOp2_long_jump(u8 op2)
11648 REMARKS:
11649 Handles opcode 0x0f,0x90-0x9F
11650 ****************************************************************************/
11651-static void x86emuOp2_set_byte(u8 op2)
11652+static void
11653+x86emuOp2_set_byte(u8 op2)
11654 {
11655 int mod, rl, rh;
11656 uint destoffset;
11657- u8 *destreg;
11658- char *name = 0;
11659+ u8 *destreg;
11660+ const char *name = NULL;
11661 int cond = 0;
11662
11663 START_OF_INSTR();
11664 switch (op2) {
11665- case 0x90:
11666+ case 0x90:
11667 name = "SETO\t";
11668- cond = ACCESS_FLAG(F_OF);
11669+ cond = ACCESS_FLAG(F_OF);
11670 break;
11671- case 0x91:
11672+ case 0x91:
11673 name = "SETNO\t";
11674 cond = !ACCESS_FLAG(F_OF);
11675 break;
11676- case 0x92:
11677+ case 0x92:
11678 name = "SETB\t";
11679 cond = ACCESS_FLAG(F_CF);
11680 break;
11681- case 0x93:
11682+ case 0x93:
11683 name = "SETNB\t";
11684 cond = !ACCESS_FLAG(F_CF);
11685 break;
11686- case 0x94:
11687+ case 0x94:
11688 name = "SETZ\t";
11689 cond = ACCESS_FLAG(F_ZF);
11690 break;
11691- case 0x95:
11692+ case 0x95:
11693 name = "SETNZ\t";
11694 cond = !ACCESS_FLAG(F_ZF);
11695 break;
11696- case 0x96:
11697+ case 0x96:
11698 name = "SETBE\t";
11699 cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
11700 break;
11701- case 0x97:
11702+ case 0x97:
11703 name = "SETNBE\t";
11704 cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
11705 break;
11706- case 0x98:
11707+ case 0x98:
11708 name = "SETS\t";
11709 cond = ACCESS_FLAG(F_SF);
11710 break;
11711- case 0x99:
11712+ case 0x99:
11713 name = "SETNS\t";
11714 cond = !ACCESS_FLAG(F_SF);
11715 break;
11716- case 0x9a:
11717+ case 0x9a:
11718 name = "SETP\t";
11719 cond = ACCESS_FLAG(F_PF);
11720 break;
11721- case 0x9b:
11722+ case 0x9b:
11723 name = "SETNP\t";
11724 cond = !ACCESS_FLAG(F_PF);
11725 break;
11726- case 0x9c:
11727+ case 0x9c:
11728 name = "SETL\t";
11729 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
11730 break;
11731- case 0x9d:
11732+ case 0x9d:
11733 name = "SETNL\t";
11734 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
11735 break;
11736- case 0x9e:
11737+ case 0x9e:
11738 name = "SETLE\t";
11739 cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
11740 ACCESS_FLAG(F_ZF));
11741 break;
11742- case 0x9f:
11743+ case 0x9f:
11744 name = "SETNLE\t";
11745 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
11746 ACCESS_FLAG(F_ZF));
11747 break;
11748 }
11749 DECODE_PRINTF(name);
11750- (void)name;
11751+ (void) name;
11752 FETCH_DECODE_MODRM(mod, rh, rl);
11753 switch (mod) {
11754 case 0:
11755@@ -343,7 +298,7 @@ static void x86emuOp2_set_byte(u8 op2)
11756 TRACE_AND_STEP();
11757 store_data_byte(destoffset, cond ? 0x01 : 0x00);
11758 break;
11759- case 3: /* register to register */
11760+ case 3: /* register to register */
11761 destreg = DECODE_RM_BYTE_REGISTER(rl);
11762 TRACE_AND_STEP();
11763 *destreg = cond ? 0x01 : 0x00;
11764@@ -357,7 +312,8 @@ static void x86emuOp2_set_byte(u8 op2)
11765 REMARKS:
11766 Handles opcode 0x0f,0xa0
11767 ****************************************************************************/
11768-static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
11769+static void
11770+x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
11771 {
11772 START_OF_INSTR();
11773 DECODE_PRINTF("PUSH\tFS\n");
11774@@ -371,7 +327,8 @@ static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
11775 REMARKS:
11776 Handles opcode 0x0f,0xa1
11777 ****************************************************************************/
11778-static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
11779+static void
11780+x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
11781 {
11782 START_OF_INSTR();
11783 DECODE_PRINTF("POP\tFS\n");
11784@@ -385,7 +342,8 @@ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
11785 REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
11786 Handles opcode 0x0f,0xa2
11787 ****************************************************************************/
11788-static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
11789+static void
11790+x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
11791 {
11792 START_OF_INSTR();
11793 DECODE_PRINTF("CPUID\n");
11794@@ -399,11 +357,12 @@ static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
11795 REMARKS:
11796 Handles opcode 0x0f,0xa3
11797 ****************************************************************************/
11798-static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11799+static void
11800+x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11801 {
11802 int mod, rl, rh;
11803 uint srcoffset;
11804- int bit,disp;
11805+ int bit, disp;
11806
11807 START_OF_INSTR();
11808 DECODE_PRINTF("BT\t");
11809@@ -419,10 +378,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11810 shiftreg = DECODE_RM_LONG_REGISTER(rh);
11811 TRACE_AND_STEP();
11812 bit = *shiftreg & 0x1F;
11813- disp = (s16)*shiftreg >> 5;
11814- srcval = fetch_data_long(srcoffset+disp);
11815- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11816- } else {
11817+ disp = (s16) * shiftreg >> 5;
11818+ srcval = fetch_data_long(srcoffset + disp);
11819+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11820+ }
11821+ else {
11822 u16 srcval;
11823 u16 *shiftreg;
11824
11825@@ -431,9 +391,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11826 shiftreg = DECODE_RM_WORD_REGISTER(rh);
11827 TRACE_AND_STEP();
11828 bit = *shiftreg & 0xF;
11829- disp = (s16)*shiftreg >> 4;
11830- srcval = fetch_data_word(srcoffset+disp);
11831- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11832+ disp = (s16) * shiftreg >> 4;
11833+ srcval = fetch_data_word(srcoffset + disp);
11834+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11835 }
11836 break;
11837 case 1:
11838@@ -446,10 +406,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11839 shiftreg = DECODE_RM_LONG_REGISTER(rh);
11840 TRACE_AND_STEP();
11841 bit = *shiftreg & 0x1F;
11842- disp = (s16)*shiftreg >> 5;
11843- srcval = fetch_data_long(srcoffset+disp);
11844- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11845- } else {
11846+ disp = (s16) * shiftreg >> 5;
11847+ srcval = fetch_data_long(srcoffset + disp);
11848+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11849+ }
11850+ else {
11851 u16 srcval;
11852 u16 *shiftreg;
11853
11854@@ -458,9 +419,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11855 shiftreg = DECODE_RM_WORD_REGISTER(rh);
11856 TRACE_AND_STEP();
11857 bit = *shiftreg & 0xF;
11858- disp = (s16)*shiftreg >> 4;
11859- srcval = fetch_data_word(srcoffset+disp);
11860- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11861+ disp = (s16) * shiftreg >> 4;
11862+ srcval = fetch_data_word(srcoffset + disp);
11863+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11864 }
11865 break;
11866 case 2:
11867@@ -473,10 +434,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11868 shiftreg = DECODE_RM_LONG_REGISTER(rh);
11869 TRACE_AND_STEP();
11870 bit = *shiftreg & 0x1F;
11871- disp = (s16)*shiftreg >> 5;
11872- srcval = fetch_data_long(srcoffset+disp);
11873- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11874- } else {
11875+ disp = (s16) * shiftreg >> 5;
11876+ srcval = fetch_data_long(srcoffset + disp);
11877+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11878+ }
11879+ else {
11880 u16 srcval;
11881 u16 *shiftreg;
11882
11883@@ -485,30 +447,31 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11884 shiftreg = DECODE_RM_WORD_REGISTER(rh);
11885 TRACE_AND_STEP();
11886 bit = *shiftreg & 0xF;
11887- disp = (s16)*shiftreg >> 4;
11888- srcval = fetch_data_word(srcoffset+disp);
11889- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
11890+ disp = (s16) * shiftreg >> 4;
11891+ srcval = fetch_data_word(srcoffset + disp);
11892+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
11893 }
11894 break;
11895- case 3: /* register to register */
11896+ case 3: /* register to register */
11897 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
11898- u32 *srcreg,*shiftreg;
11899+ u32 *srcreg, *shiftreg;
11900
11901 srcreg = DECODE_RM_LONG_REGISTER(rl);
11902 DECODE_PRINTF(",");
11903 shiftreg = DECODE_RM_LONG_REGISTER(rh);
11904 TRACE_AND_STEP();
11905 bit = *shiftreg & 0x1F;
11906- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
11907- } else {
11908- u16 *srcreg,*shiftreg;
11909+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
11910+ }
11911+ else {
11912+ u16 *srcreg, *shiftreg;
11913
11914 srcreg = DECODE_RM_WORD_REGISTER(rl);
11915 DECODE_PRINTF(",");
11916 shiftreg = DECODE_RM_WORD_REGISTER(rh);
11917 TRACE_AND_STEP();
11918 bit = *shiftreg & 0xF;
11919- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
11920+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
11921 }
11922 break;
11923 }
11924@@ -520,11 +483,12 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
11925 REMARKS:
11926 Handles opcode 0x0f,0xa4
11927 ****************************************************************************/
11928-static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11929+static void
11930+x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11931 {
11932 int mod, rl, rh;
11933 uint destoffset;
11934- u8 shift;
11935+ u8 shift;
11936
11937 START_OF_INSTR();
11938 DECODE_PRINTF("SHLD\t");
11939@@ -543,9 +507,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11940 DECODE_PRINTF2("%d\n", shift);
11941 TRACE_AND_STEP();
11942 destval = fetch_data_long(destoffset);
11943- destval = shld_long(destval,*shiftreg,shift);
11944+ destval = shld_long(destval, *shiftreg, shift);
11945 store_data_long(destoffset, destval);
11946- } else {
11947+ }
11948+ else {
11949 u16 destval;
11950 u16 *shiftreg;
11951
11952@@ -557,7 +522,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11953 DECODE_PRINTF2("%d\n", shift);
11954 TRACE_AND_STEP();
11955 destval = fetch_data_word(destoffset);
11956- destval = shld_word(destval,*shiftreg,shift);
11957+ destval = shld_word(destval, *shiftreg, shift);
11958 store_data_word(destoffset, destval);
11959 }
11960 break;
11961@@ -574,9 +539,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11962 DECODE_PRINTF2("%d\n", shift);
11963 TRACE_AND_STEP();
11964 destval = fetch_data_long(destoffset);
11965- destval = shld_long(destval,*shiftreg,shift);
11966+ destval = shld_long(destval, *shiftreg, shift);
11967 store_data_long(destoffset, destval);
11968- } else {
11969+ }
11970+ else {
11971 u16 destval;
11972 u16 *shiftreg;
11973
11974@@ -588,7 +554,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11975 DECODE_PRINTF2("%d\n", shift);
11976 TRACE_AND_STEP();
11977 destval = fetch_data_word(destoffset);
11978- destval = shld_word(destval,*shiftreg,shift);
11979+ destval = shld_word(destval, *shiftreg, shift);
11980 store_data_word(destoffset, destval);
11981 }
11982 break;
11983@@ -605,9 +571,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11984 DECODE_PRINTF2("%d\n", shift);
11985 TRACE_AND_STEP();
11986 destval = fetch_data_long(destoffset);
11987- destval = shld_long(destval,*shiftreg,shift);
11988+ destval = shld_long(destval, *shiftreg, shift);
11989 store_data_long(destoffset, destval);
11990- } else {
11991+ }
11992+ else {
11993 u16 destval;
11994 u16 *shiftreg;
11995
11996@@ -619,13 +586,13 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
11997 DECODE_PRINTF2("%d\n", shift);
11998 TRACE_AND_STEP();
11999 destval = fetch_data_word(destoffset);
12000- destval = shld_word(destval,*shiftreg,shift);
12001+ destval = shld_word(destval, *shiftreg, shift);
12002 store_data_word(destoffset, destval);
12003 }
12004 break;
12005- case 3: /* register to register */
12006+ case 3: /* register to register */
12007 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12008- u32 *destreg,*shiftreg;
12009+ u32 *destreg, *shiftreg;
12010
12011 destreg = DECODE_RM_LONG_REGISTER(rl);
12012 DECODE_PRINTF(",");
12013@@ -634,9 +601,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
12014 shift = fetch_byte_imm();
12015 DECODE_PRINTF2("%d\n", shift);
12016 TRACE_AND_STEP();
12017- *destreg = shld_long(*destreg,*shiftreg,shift);
12018- } else {
12019- u16 *destreg,*shiftreg;
12020+ *destreg = shld_long(*destreg, *shiftreg, shift);
12021+ }
12022+ else {
12023+ u16 *destreg, *shiftreg;
12024
12025 destreg = DECODE_RM_WORD_REGISTER(rl);
12026 DECODE_PRINTF(",");
12027@@ -645,7 +613,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
12028 shift = fetch_byte_imm();
12029 DECODE_PRINTF2("%d\n", shift);
12030 TRACE_AND_STEP();
12031- *destreg = shld_word(*destreg,*shiftreg,shift);
12032+ *destreg = shld_word(*destreg, *shiftreg, shift);
12033 }
12034 break;
12035 }
12036@@ -657,7 +625,8 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
12037 REMARKS:
12038 Handles opcode 0x0f,0xa5
12039 ****************************************************************************/
12040-static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12041+static void
12042+x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12043 {
12044 int mod, rl, rh;
12045 uint destoffset;
12046@@ -677,9 +646,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12047 DECODE_PRINTF(",CL\n");
12048 TRACE_AND_STEP();
12049 destval = fetch_data_long(destoffset);
12050- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
12051+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
12052 store_data_long(destoffset, destval);
12053- } else {
12054+ }
12055+ else {
12056 u16 destval;
12057 u16 *shiftreg;
12058
12059@@ -689,7 +659,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12060 DECODE_PRINTF(",CL\n");
12061 TRACE_AND_STEP();
12062 destval = fetch_data_word(destoffset);
12063- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
12064+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
12065 store_data_word(destoffset, destval);
12066 }
12067 break;
12068@@ -704,9 +674,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12069 DECODE_PRINTF(",CL\n");
12070 TRACE_AND_STEP();
12071 destval = fetch_data_long(destoffset);
12072- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
12073+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
12074 store_data_long(destoffset, destval);
12075- } else {
12076+ }
12077+ else {
12078 u16 destval;
12079 u16 *shiftreg;
12080
12081@@ -716,7 +687,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12082 DECODE_PRINTF(",CL\n");
12083 TRACE_AND_STEP();
12084 destval = fetch_data_word(destoffset);
12085- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
12086+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
12087 store_data_word(destoffset, destval);
12088 }
12089 break;
12090@@ -731,9 +702,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12091 DECODE_PRINTF(",CL\n");
12092 TRACE_AND_STEP();
12093 destval = fetch_data_long(destoffset);
12094- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
12095+ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
12096 store_data_long(destoffset, destval);
12097- } else {
12098+ }
12099+ else {
12100 u16 destval;
12101 u16 *shiftreg;
12102
12103@@ -743,29 +715,30 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12104 DECODE_PRINTF(",CL\n");
12105 TRACE_AND_STEP();
12106 destval = fetch_data_word(destoffset);
12107- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
12108+ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
12109 store_data_word(destoffset, destval);
12110 }
12111 break;
12112- case 3: /* register to register */
12113+ case 3: /* register to register */
12114 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12115- u32 *destreg,*shiftreg;
12116+ u32 *destreg, *shiftreg;
12117
12118 destreg = DECODE_RM_LONG_REGISTER(rl);
12119 DECODE_PRINTF(",");
12120 shiftreg = DECODE_RM_LONG_REGISTER(rh);
12121 DECODE_PRINTF(",CL\n");
12122 TRACE_AND_STEP();
12123- *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
12124- } else {
12125- u16 *destreg,*shiftreg;
12126+ *destreg = shld_long(*destreg, *shiftreg, M.x86.R_CL);
12127+ }
12128+ else {
12129+ u16 *destreg, *shiftreg;
12130
12131 destreg = DECODE_RM_WORD_REGISTER(rl);
12132 DECODE_PRINTF(",");
12133 shiftreg = DECODE_RM_WORD_REGISTER(rh);
12134 DECODE_PRINTF(",CL\n");
12135 TRACE_AND_STEP();
12136- *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
12137+ *destreg = shld_word(*destreg, *shiftreg, M.x86.R_CL);
12138 }
12139 break;
12140 }
12141@@ -777,7 +750,8 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
12142 REMARKS:
12143 Handles opcode 0x0f,0xa8
12144 ****************************************************************************/
12145-static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
12146+static void
12147+x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
12148 {
12149 START_OF_INSTR();
12150 DECODE_PRINTF("PUSH\tGS\n");
12151@@ -791,7 +765,8 @@ static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
12152 REMARKS:
12153 Handles opcode 0x0f,0xa9
12154 ****************************************************************************/
12155-static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
12156+static void
12157+x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
12158 {
12159 START_OF_INSTR();
12160 DECODE_PRINTF("POP\tGS\n");
12161@@ -805,11 +780,12 @@ static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
12162 REMARKS:
12163 Handles opcode 0x0f,0xab
12164 ****************************************************************************/
12165-static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12166+static void
12167+x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12168 {
12169 int mod, rl, rh;
12170 uint srcoffset;
12171- int bit,disp;
12172+ int bit, disp;
12173
12174 START_OF_INSTR();
12175 DECODE_PRINTF("BTS\t");
12176@@ -817,7 +793,7 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12177 switch (mod) {
12178 case 0:
12179 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12180- u32 srcval,mask;
12181+ u32 srcval, mask;
12182 u32 *shiftreg;
12183
12184 srcoffset = decode_rm00_address(rl);
12185@@ -825,13 +801,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12186 shiftreg = DECODE_RM_LONG_REGISTER(rh);
12187 TRACE_AND_STEP();
12188 bit = *shiftreg & 0x1F;
12189- disp = (s16)*shiftreg >> 5;
12190- srcval = fetch_data_long(srcoffset+disp);
12191+ disp = (s16) * shiftreg >> 5;
12192+ srcval = fetch_data_long(srcoffset + disp);
12193 mask = (0x1 << bit);
12194- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12195- store_data_long(srcoffset+disp, srcval | mask);
12196- } else {
12197- u16 srcval,mask;
12198+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12199+ store_data_long(srcoffset + disp, srcval | mask);
12200+ }
12201+ else {
12202+ u16 srcval, mask;
12203 u16 *shiftreg;
12204
12205 srcoffset = decode_rm00_address(rl);
12206@@ -839,16 +816,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12207 shiftreg = DECODE_RM_WORD_REGISTER(rh);
12208 TRACE_AND_STEP();
12209 bit = *shiftreg & 0xF;
12210- disp = (s16)*shiftreg >> 4;
12211- srcval = fetch_data_word(srcoffset+disp);
12212- mask = (u16)(0x1 << bit);
12213- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12214- store_data_word(srcoffset+disp, srcval | mask);
12215+ disp = (s16) * shiftreg >> 4;
12216+ srcval = fetch_data_word(srcoffset + disp);
12217+ mask = (u16) (0x1 << bit);
12218+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12219+ store_data_word(srcoffset + disp, srcval | mask);
12220 }
12221 break;
12222 case 1:
12223 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12224- u32 srcval,mask;
12225+ u32 srcval, mask;
12226 u32 *shiftreg;
12227
12228 srcoffset = decode_rm01_address(rl);
12229@@ -856,13 +833,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12230 shiftreg = DECODE_RM_LONG_REGISTER(rh);
12231 TRACE_AND_STEP();
12232 bit = *shiftreg & 0x1F;
12233- disp = (s16)*shiftreg >> 5;
12234- srcval = fetch_data_long(srcoffset+disp);
12235+ disp = (s16) * shiftreg >> 5;
12236+ srcval = fetch_data_long(srcoffset + disp);
12237 mask = (0x1 << bit);
12238- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12239- store_data_long(srcoffset+disp, srcval | mask);
12240- } else {
12241- u16 srcval,mask;
12242+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12243+ store_data_long(srcoffset + disp, srcval | mask);
12244+ }
12245+ else {
12246+ u16 srcval, mask;
12247 u16 *shiftreg;
12248
12249 srcoffset = decode_rm01_address(rl);
12250@@ -870,16 +848,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12251 shiftreg = DECODE_RM_WORD_REGISTER(rh);
12252 TRACE_AND_STEP();
12253 bit = *shiftreg & 0xF;
12254- disp = (s16)*shiftreg >> 4;
12255- srcval = fetch_data_word(srcoffset+disp);
12256- mask = (u16)(0x1 << bit);
12257- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12258- store_data_word(srcoffset+disp, srcval | mask);
12259+ disp = (s16) * shiftreg >> 4;
12260+ srcval = fetch_data_word(srcoffset + disp);
12261+ mask = (u16) (0x1 << bit);
12262+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12263+ store_data_word(srcoffset + disp, srcval | mask);
12264 }
12265 break;
12266 case 2:
12267 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12268- u32 srcval,mask;
12269+ u32 srcval, mask;
12270 u32 *shiftreg;
12271
12272 srcoffset = decode_rm10_address(rl);
12273@@ -887,51 +865,53 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12274 shiftreg = DECODE_RM_LONG_REGISTER(rh);
12275 TRACE_AND_STEP();
12276 bit = *shiftreg & 0x1F;
12277- disp = (s16)*shiftreg >> 5;
12278- srcval = fetch_data_long(srcoffset+disp);
12279+ disp = (s16) * shiftreg >> 5;
12280+ srcval = fetch_data_long(srcoffset + disp);
12281 mask = (0x1 << bit);
12282- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12283- store_data_long(srcoffset+disp, srcval | mask);
12284- } else {
12285- u16 srcval,mask;
12286+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12287+ store_data_long(srcoffset + disp, srcval | mask);
12288+ }
12289+ else {
12290+ u16 srcval, mask;
12291 u16 *shiftreg;
12292
12293- srcoffset = decode_rm10_address(rl);
12294- DECODE_PRINTF(",");
12295- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12296- TRACE_AND_STEP();
12297- bit = *shiftreg & 0xF;
12298- disp = (s16)*shiftreg >> 4;
12299- srcval = fetch_data_word(srcoffset+disp);
12300- mask = (u16)(0x1 << bit);
12301- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12302- store_data_word(srcoffset+disp, srcval | mask);
12303- }
12304- break;
12305- case 3: /* register to register */
12306- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12307- u32 *srcreg,*shiftreg;
12308- u32 mask;
12309-
12310- srcreg = DECODE_RM_LONG_REGISTER(rl);
12311- DECODE_PRINTF(",");
12312- shiftreg = DECODE_RM_LONG_REGISTER(rh);
12313- TRACE_AND_STEP();
12314- bit = *shiftreg & 0x1F;
12315- mask = (0x1 << bit);
12316- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
12317- *srcreg |= mask;
12318- } else {
12319- u16 *srcreg,*shiftreg;
12320- u16 mask;
12321-
12322- srcreg = DECODE_RM_WORD_REGISTER(rl);
12323- DECODE_PRINTF(",");
12324- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12325- TRACE_AND_STEP();
12326- bit = *shiftreg & 0xF;
12327- mask = (u16)(0x1 << bit);
12328- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
12329+ srcoffset = decode_rm10_address(rl);
12330+ DECODE_PRINTF(",");
12331+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
12332+ TRACE_AND_STEP();
12333+ bit = *shiftreg & 0xF;
12334+ disp = (s16) * shiftreg >> 4;
12335+ srcval = fetch_data_word(srcoffset + disp);
12336+ mask = (u16) (0x1 << bit);
12337+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12338+ store_data_word(srcoffset + disp, srcval | mask);
12339+ }
12340+ break;
12341+ case 3: /* register to register */
12342+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12343+ u32 *srcreg, *shiftreg;
12344+ u32 mask;
12345+
12346+ srcreg = DECODE_RM_LONG_REGISTER(rl);
12347+ DECODE_PRINTF(",");
12348+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
12349+ TRACE_AND_STEP();
12350+ bit = *shiftreg & 0x1F;
12351+ mask = (0x1 << bit);
12352+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
12353+ *srcreg |= mask;
12354+ }
12355+ else {
12356+ u16 *srcreg, *shiftreg;
12357+ u16 mask;
12358+
12359+ srcreg = DECODE_RM_WORD_REGISTER(rl);
12360+ DECODE_PRINTF(",");
12361+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
12362+ TRACE_AND_STEP();
12363+ bit = *shiftreg & 0xF;
12364+ mask = (u16) (0x1 << bit);
12365+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
12366 *srcreg |= mask;
12367 }
12368 break;
12369@@ -944,11 +924,12 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
12370 REMARKS:
12371 Handles opcode 0x0f,0xac
12372 ****************************************************************************/
12373-static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12374+static void
12375+x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12376 {
12377 int mod, rl, rh;
12378 uint destoffset;
12379- u8 shift;
12380+ u8 shift;
12381
12382 START_OF_INSTR();
12383 DECODE_PRINTF("SHLD\t");
12384@@ -967,9 +948,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12385 DECODE_PRINTF2("%d\n", shift);
12386 TRACE_AND_STEP();
12387 destval = fetch_data_long(destoffset);
12388- destval = shrd_long(destval,*shiftreg,shift);
12389+ destval = shrd_long(destval, *shiftreg, shift);
12390 store_data_long(destoffset, destval);
12391- } else {
12392+ }
12393+ else {
12394 u16 destval;
12395 u16 *shiftreg;
12396
12397@@ -981,7 +963,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12398 DECODE_PRINTF2("%d\n", shift);
12399 TRACE_AND_STEP();
12400 destval = fetch_data_word(destoffset);
12401- destval = shrd_word(destval,*shiftreg,shift);
12402+ destval = shrd_word(destval, *shiftreg, shift);
12403 store_data_word(destoffset, destval);
12404 }
12405 break;
12406@@ -998,9 +980,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12407 DECODE_PRINTF2("%d\n", shift);
12408 TRACE_AND_STEP();
12409 destval = fetch_data_long(destoffset);
12410- destval = shrd_long(destval,*shiftreg,shift);
12411+ destval = shrd_long(destval, *shiftreg, shift);
12412 store_data_long(destoffset, destval);
12413- } else {
12414+ }
12415+ else {
12416 u16 destval;
12417 u16 *shiftreg;
12418
12419@@ -1012,7 +995,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12420 DECODE_PRINTF2("%d\n", shift);
12421 TRACE_AND_STEP();
12422 destval = fetch_data_word(destoffset);
12423- destval = shrd_word(destval,*shiftreg,shift);
12424+ destval = shrd_word(destval, *shiftreg, shift);
12425 store_data_word(destoffset, destval);
12426 }
12427 break;
12428@@ -1029,9 +1012,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12429 DECODE_PRINTF2("%d\n", shift);
12430 TRACE_AND_STEP();
12431 destval = fetch_data_long(destoffset);
12432- destval = shrd_long(destval,*shiftreg,shift);
12433+ destval = shrd_long(destval, *shiftreg, shift);
12434 store_data_long(destoffset, destval);
12435- } else {
12436+ }
12437+ else {
12438 u16 destval;
12439 u16 *shiftreg;
12440
12441@@ -1043,13 +1027,13 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12442 DECODE_PRINTF2("%d\n", shift);
12443 TRACE_AND_STEP();
12444 destval = fetch_data_word(destoffset);
12445- destval = shrd_word(destval,*shiftreg,shift);
12446+ destval = shrd_word(destval, *shiftreg, shift);
12447 store_data_word(destoffset, destval);
12448 }
12449 break;
12450- case 3: /* register to register */
12451+ case 3: /* register to register */
12452 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12453- u32 *destreg,*shiftreg;
12454+ u32 *destreg, *shiftreg;
12455
12456 destreg = DECODE_RM_LONG_REGISTER(rl);
12457 DECODE_PRINTF(",");
12458@@ -1058,9 +1042,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12459 shift = fetch_byte_imm();
12460 DECODE_PRINTF2("%d\n", shift);
12461 TRACE_AND_STEP();
12462- *destreg = shrd_long(*destreg,*shiftreg,shift);
12463- } else {
12464- u16 *destreg,*shiftreg;
12465+ *destreg = shrd_long(*destreg, *shiftreg, shift);
12466+ }
12467+ else {
12468+ u16 *destreg, *shiftreg;
12469
12470 destreg = DECODE_RM_WORD_REGISTER(rl);
12471 DECODE_PRINTF(",");
12472@@ -1069,7 +1054,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12473 shift = fetch_byte_imm();
12474 DECODE_PRINTF2("%d\n", shift);
12475 TRACE_AND_STEP();
12476- *destreg = shrd_word(*destreg,*shiftreg,shift);
12477+ *destreg = shrd_word(*destreg, *shiftreg, shift);
12478 }
12479 break;
12480 }
12481@@ -1081,7 +1066,8 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
12482 REMARKS:
12483 Handles opcode 0x0f,0xad
12484 ****************************************************************************/
12485-static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12486+static void
12487+x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12488 {
12489 int mod, rl, rh;
12490 uint destoffset;
12491@@ -1101,9 +1087,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12492 DECODE_PRINTF(",CL\n");
12493 TRACE_AND_STEP();
12494 destval = fetch_data_long(destoffset);
12495- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
12496+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
12497 store_data_long(destoffset, destval);
12498- } else {
12499+ }
12500+ else {
12501 u16 destval;
12502 u16 *shiftreg;
12503
12504@@ -1113,7 +1100,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12505 DECODE_PRINTF(",CL\n");
12506 TRACE_AND_STEP();
12507 destval = fetch_data_word(destoffset);
12508- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
12509+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
12510 store_data_word(destoffset, destval);
12511 }
12512 break;
12513@@ -1128,9 +1115,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12514 DECODE_PRINTF(",CL\n");
12515 TRACE_AND_STEP();
12516 destval = fetch_data_long(destoffset);
12517- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
12518+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
12519 store_data_long(destoffset, destval);
12520- } else {
12521+ }
12522+ else {
12523 u16 destval;
12524 u16 *shiftreg;
12525
12526@@ -1140,7 +1128,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12527 DECODE_PRINTF(",CL\n");
12528 TRACE_AND_STEP();
12529 destval = fetch_data_word(destoffset);
12530- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
12531+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
12532 store_data_word(destoffset, destval);
12533 }
12534 break;
12535@@ -1155,9 +1143,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12536 DECODE_PRINTF(",CL\n");
12537 TRACE_AND_STEP();
12538 destval = fetch_data_long(destoffset);
12539- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
12540+ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
12541 store_data_long(destoffset, destval);
12542- } else {
12543+ }
12544+ else {
12545 u16 destval;
12546 u16 *shiftreg;
12547
12548@@ -1167,29 +1156,30 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12549 DECODE_PRINTF(",CL\n");
12550 TRACE_AND_STEP();
12551 destval = fetch_data_word(destoffset);
12552- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
12553+ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
12554 store_data_word(destoffset, destval);
12555 }
12556 break;
12557- case 3: /* register to register */
12558+ case 3: /* register to register */
12559 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12560- u32 *destreg,*shiftreg;
12561+ u32 *destreg, *shiftreg;
12562
12563 destreg = DECODE_RM_LONG_REGISTER(rl);
12564 DECODE_PRINTF(",");
12565 shiftreg = DECODE_RM_LONG_REGISTER(rh);
12566 DECODE_PRINTF(",CL\n");
12567 TRACE_AND_STEP();
12568- *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
12569- } else {
12570- u16 *destreg,*shiftreg;
12571+ *destreg = shrd_long(*destreg, *shiftreg, M.x86.R_CL);
12572+ }
12573+ else {
12574+ u16 *destreg, *shiftreg;
12575
12576 destreg = DECODE_RM_WORD_REGISTER(rl);
12577 DECODE_PRINTF(",");
12578 shiftreg = DECODE_RM_WORD_REGISTER(rh);
12579 DECODE_PRINTF(",CL\n");
12580 TRACE_AND_STEP();
12581- *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
12582+ *destreg = shrd_word(*destreg, *shiftreg, M.x86.R_CL);
12583 }
12584 break;
12585 }
12586@@ -1201,7 +1191,8 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
12587 REMARKS:
12588 Handles opcode 0x0f,0xaf
12589 ****************************************************************************/
12590-static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12591+static void
12592+x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12593 {
12594 int mod, rl, rh;
12595 uint srcoffset;
12596@@ -1214,23 +1205,25 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12597 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12598 u32 *destreg;
12599 u32 srcval;
12600- u32 res_lo,res_hi;
12601+ u32 res_lo, res_hi;
12602
12603 destreg = DECODE_RM_LONG_REGISTER(rh);
12604 DECODE_PRINTF(",");
12605 srcoffset = decode_rm00_address(rl);
12606 srcval = fetch_data_long(srcoffset);
12607 TRACE_AND_STEP();
12608- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
12609+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
12610 if (res_hi != 0) {
12611 SET_FLAG(F_CF);
12612 SET_FLAG(F_OF);
12613- } else {
12614+ }
12615+ else {
12616 CLEAR_FLAG(F_CF);
12617 CLEAR_FLAG(F_OF);
12618 }
12619- *destreg = (u32)res_lo;
12620- } else {
12621+ *destreg = (u32) res_lo;
12622+ }
12623+ else {
12624 u16 *destreg;
12625 u16 srcval;
12626 u32 res;
12627@@ -1240,38 +1233,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12628 srcoffset = decode_rm00_address(rl);
12629 srcval = fetch_data_word(srcoffset);
12630 TRACE_AND_STEP();
12631- res = (s16)*destreg * (s16)srcval;
12632+ res = (s16) * destreg * (s16) srcval;
12633 if (res > 0xFFFF) {
12634 SET_FLAG(F_CF);
12635 SET_FLAG(F_OF);
12636- } else {
12637+ }
12638+ else {
12639 CLEAR_FLAG(F_CF);
12640 CLEAR_FLAG(F_OF);
12641 }
12642- *destreg = (u16)res;
12643+ *destreg = (u16) res;
12644 }
12645 break;
12646 case 1:
12647 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12648 u32 *destreg;
12649 u32 srcval;
12650- u32 res_lo,res_hi;
12651+ u32 res_lo, res_hi;
12652
12653 destreg = DECODE_RM_LONG_REGISTER(rh);
12654 DECODE_PRINTF(",");
12655 srcoffset = decode_rm01_address(rl);
12656 srcval = fetch_data_long(srcoffset);
12657 TRACE_AND_STEP();
12658- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
12659+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
12660 if (res_hi != 0) {
12661 SET_FLAG(F_CF);
12662 SET_FLAG(F_OF);
12663- } else {
12664+ }
12665+ else {
12666 CLEAR_FLAG(F_CF);
12667 CLEAR_FLAG(F_OF);
12668 }
12669- *destreg = (u32)res_lo;
12670- } else {
12671+ *destreg = (u32) res_lo;
12672+ }
12673+ else {
12674 u16 *destreg;
12675 u16 srcval;
12676 u32 res;
12677@@ -1281,38 +1277,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12678 srcoffset = decode_rm01_address(rl);
12679 srcval = fetch_data_word(srcoffset);
12680 TRACE_AND_STEP();
12681- res = (s16)*destreg * (s16)srcval;
12682+ res = (s16) * destreg * (s16) srcval;
12683 if (res > 0xFFFF) {
12684 SET_FLAG(F_CF);
12685 SET_FLAG(F_OF);
12686- } else {
12687+ }
12688+ else {
12689 CLEAR_FLAG(F_CF);
12690 CLEAR_FLAG(F_OF);
12691 }
12692- *destreg = (u16)res;
12693+ *destreg = (u16) res;
12694 }
12695 break;
12696 case 2:
12697 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12698 u32 *destreg;
12699 u32 srcval;
12700- u32 res_lo,res_hi;
12701+ u32 res_lo, res_hi;
12702
12703 destreg = DECODE_RM_LONG_REGISTER(rh);
12704 DECODE_PRINTF(",");
12705 srcoffset = decode_rm10_address(rl);
12706 srcval = fetch_data_long(srcoffset);
12707 TRACE_AND_STEP();
12708- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
12709+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
12710 if (res_hi != 0) {
12711 SET_FLAG(F_CF);
12712 SET_FLAG(F_OF);
12713- } else {
12714+ }
12715+ else {
12716 CLEAR_FLAG(F_CF);
12717 CLEAR_FLAG(F_OF);
12718 }
12719- *destreg = (u32)res_lo;
12720- } else {
12721+ *destreg = (u32) res_lo;
12722+ }
12723+ else {
12724 u16 *destreg;
12725 u16 srcval;
12726 u32 res;
12727@@ -1322,51 +1321,55 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12728 srcoffset = decode_rm10_address(rl);
12729 srcval = fetch_data_word(srcoffset);
12730 TRACE_AND_STEP();
12731- res = (s16)*destreg * (s16)srcval;
12732+ res = (s16) * destreg * (s16) srcval;
12733 if (res > 0xFFFF) {
12734 SET_FLAG(F_CF);
12735 SET_FLAG(F_OF);
12736- } else {
12737+ }
12738+ else {
12739 CLEAR_FLAG(F_CF);
12740 CLEAR_FLAG(F_OF);
12741 }
12742- *destreg = (u16)res;
12743+ *destreg = (u16) res;
12744 }
12745 break;
12746- case 3: /* register to register */
12747+ case 3: /* register to register */
12748 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12749- u32 *destreg,*srcreg;
12750- u32 res_lo,res_hi;
12751+ u32 *destreg, *srcreg;
12752+ u32 res_lo, res_hi;
12753
12754 destreg = DECODE_RM_LONG_REGISTER(rh);
12755 DECODE_PRINTF(",");
12756 srcreg = DECODE_RM_LONG_REGISTER(rl);
12757 TRACE_AND_STEP();
12758- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
12759+ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) * srcreg);
12760 if (res_hi != 0) {
12761 SET_FLAG(F_CF);
12762 SET_FLAG(F_OF);
12763- } else {
12764+ }
12765+ else {
12766 CLEAR_FLAG(F_CF);
12767 CLEAR_FLAG(F_OF);
12768 }
12769- *destreg = (u32)res_lo;
12770- } else {
12771- u16 *destreg,*srcreg;
12772+ *destreg = (u32) res_lo;
12773+ }
12774+ else {
12775+ u16 *destreg, *srcreg;
12776 u32 res;
12777
12778 destreg = DECODE_RM_WORD_REGISTER(rh);
12779 DECODE_PRINTF(",");
12780 srcreg = DECODE_RM_WORD_REGISTER(rl);
12781- res = (s16)*destreg * (s16)*srcreg;
12782+ res = (s16) * destreg * (s16) * srcreg;
12783 if (res > 0xFFFF) {
12784 SET_FLAG(F_CF);
12785 SET_FLAG(F_OF);
12786- } else {
12787+ }
12788+ else {
12789 CLEAR_FLAG(F_CF);
12790 CLEAR_FLAG(F_OF);
12791 }
12792- *destreg = (u16)res;
12793+ *destreg = (u16) res;
12794 }
12795 break;
12796 }
12797@@ -1378,9 +1381,10 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
12798 REMARKS:
12799 Handles opcode 0x0f,0xb2
12800 ****************************************************************************/
12801-static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
12802+static void
12803+x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
12804 {
12805- int mod, rh, rl;
12806+ int mod, rh, rl;
12807 u16 *dstreg;
12808 uint srcoffset;
12809
12810@@ -1415,7 +1419,7 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
12811 *dstreg = fetch_data_word(srcoffset);
12812 M.x86.R_SS = fetch_data_word(srcoffset + 2);
12813 break;
12814- case 3: /* register to register */
12815+ case 3: /* register to register */
12816 /* UNDEFINED! */
12817 TRACE_AND_STEP();
12818 }
12819@@ -1427,148 +1431,154 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
12820 REMARKS:
12821 Handles opcode 0x0f,0xb3
12822 ****************************************************************************/
12823-static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
12824+static void
12825+x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
12826 {
12827- int mod, rl, rh;
12828- uint srcoffset;
12829- int bit,disp;
12830-
12831- START_OF_INSTR();
12832- DECODE_PRINTF("BTR\t");
12833- FETCH_DECODE_MODRM(mod, rh, rl);
12834- switch (mod) {
12835- case 0:
12836- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12837- u32 srcval,mask;
12838- u32 *shiftreg;
12839-
12840- srcoffset = decode_rm00_address(rl);
12841- DECODE_PRINTF(",");
12842- shiftreg = DECODE_RM_LONG_REGISTER(rh);
12843- TRACE_AND_STEP();
12844- bit = *shiftreg & 0x1F;
12845- disp = (s16)*shiftreg >> 5;
12846- srcval = fetch_data_long(srcoffset+disp);
12847- mask = (0x1 << bit);
12848- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12849- store_data_long(srcoffset+disp, srcval & ~mask);
12850- } else {
12851- u16 srcval,mask;
12852- u16 *shiftreg;
12853-
12854- srcoffset = decode_rm00_address(rl);
12855- DECODE_PRINTF(",");
12856- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12857- TRACE_AND_STEP();
12858- bit = *shiftreg & 0xF;
12859- disp = (s16)*shiftreg >> 4;
12860- srcval = fetch_data_word(srcoffset+disp);
12861- mask = (u16)(0x1 << bit);
12862- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12863- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
12864- }
12865- break;
12866- case 1:
12867- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12868- u32 srcval,mask;
12869- u32 *shiftreg;
12870-
12871- srcoffset = decode_rm01_address(rl);
12872- DECODE_PRINTF(",");
12873- shiftreg = DECODE_RM_LONG_REGISTER(rh);
12874- TRACE_AND_STEP();
12875- bit = *shiftreg & 0x1F;
12876- disp = (s16)*shiftreg >> 5;
12877- srcval = fetch_data_long(srcoffset+disp);
12878- mask = (0x1 << bit);
12879- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12880- store_data_long(srcoffset+disp, srcval & ~mask);
12881- } else {
12882- u16 srcval,mask;
12883- u16 *shiftreg;
12884-
12885- srcoffset = decode_rm01_address(rl);
12886- DECODE_PRINTF(",");
12887- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12888- TRACE_AND_STEP();
12889- bit = *shiftreg & 0xF;
12890- disp = (s16)*shiftreg >> 4;
12891- srcval = fetch_data_word(srcoffset+disp);
12892- mask = (u16)(0x1 << bit);
12893- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12894- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
12895- }
12896- break;
12897- case 2:
12898- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12899- u32 srcval,mask;
12900- u32 *shiftreg;
12901-
12902- srcoffset = decode_rm10_address(rl);
12903- DECODE_PRINTF(",");
12904- shiftreg = DECODE_RM_LONG_REGISTER(rh);
12905- TRACE_AND_STEP();
12906- bit = *shiftreg & 0x1F;
12907- disp = (s16)*shiftreg >> 5;
12908- srcval = fetch_data_long(srcoffset+disp);
12909- mask = (0x1 << bit);
12910- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12911- store_data_long(srcoffset+disp, srcval & ~mask);
12912- } else {
12913- u16 srcval,mask;
12914- u16 *shiftreg;
12915-
12916- srcoffset = decode_rm10_address(rl);
12917- DECODE_PRINTF(",");
12918- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12919- TRACE_AND_STEP();
12920- bit = *shiftreg & 0xF;
12921- disp = (s16)*shiftreg >> 4;
12922- srcval = fetch_data_word(srcoffset+disp);
12923- mask = (u16)(0x1 << bit);
12924- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
12925- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
12926- }
12927- break;
12928- case 3: /* register to register */
12929- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12930- u32 *srcreg,*shiftreg;
12931- u32 mask;
12932-
12933- srcreg = DECODE_RM_LONG_REGISTER(rl);
12934- DECODE_PRINTF(",");
12935- shiftreg = DECODE_RM_LONG_REGISTER(rh);
12936- TRACE_AND_STEP();
12937- bit = *shiftreg & 0x1F;
12938- mask = (0x1 << bit);
12939- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
12940- *srcreg &= ~mask;
12941- } else {
12942- u16 *srcreg,*shiftreg;
12943- u16 mask;
12944-
12945- srcreg = DECODE_RM_WORD_REGISTER(rl);
12946- DECODE_PRINTF(",");
12947- shiftreg = DECODE_RM_WORD_REGISTER(rh);
12948- TRACE_AND_STEP();
12949- bit = *shiftreg & 0xF;
12950- mask = (u16)(0x1 << bit);
12951- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
12952- *srcreg &= ~mask;
12953- }
12954- break;
12955- }
12956- DECODE_CLEAR_SEGOVR();
12957- END_OF_INSTR();
12958+ int mod, rl, rh;
12959+ uint srcoffset;
12960+ int bit, disp;
12961+
12962+ START_OF_INSTR();
12963+ DECODE_PRINTF("BTR\t");
12964+ FETCH_DECODE_MODRM(mod, rh, rl);
12965+ switch (mod) {
12966+ case 0:
12967+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
12968+ u32 srcval, mask;
12969+ u32 *shiftreg;
12970+
12971+ srcoffset = decode_rm00_address(rl);
12972+ DECODE_PRINTF(",");
12973+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
12974+ TRACE_AND_STEP();
12975+ bit = *shiftreg & 0x1F;
12976+ disp = (s16) * shiftreg >> 5;
12977+ srcval = fetch_data_long(srcoffset + disp);
12978+ mask = (0x1 << bit);
12979+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12980+ store_data_long(srcoffset + disp, srcval & ~mask);
12981+ }
12982+ else {
12983+ u16 srcval, mask;
12984+ u16 *shiftreg;
12985+
12986+ srcoffset = decode_rm00_address(rl);
12987+ DECODE_PRINTF(",");
12988+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
12989+ TRACE_AND_STEP();
12990+ bit = *shiftreg & 0xF;
12991+ disp = (s16) * shiftreg >> 4;
12992+ srcval = fetch_data_word(srcoffset + disp);
12993+ mask = (u16) (0x1 << bit);
12994+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
12995+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
12996+ }
12997+ break;
12998+ case 1:
12999+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13000+ u32 srcval, mask;
13001+ u32 *shiftreg;
13002+
13003+ srcoffset = decode_rm01_address(rl);
13004+ DECODE_PRINTF(",");
13005+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
13006+ TRACE_AND_STEP();
13007+ bit = *shiftreg & 0x1F;
13008+ disp = (s16) * shiftreg >> 5;
13009+ srcval = fetch_data_long(srcoffset + disp);
13010+ mask = (0x1 << bit);
13011+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13012+ store_data_long(srcoffset + disp, srcval & ~mask);
13013+ }
13014+ else {
13015+ u16 srcval, mask;
13016+ u16 *shiftreg;
13017+
13018+ srcoffset = decode_rm01_address(rl);
13019+ DECODE_PRINTF(",");
13020+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
13021+ TRACE_AND_STEP();
13022+ bit = *shiftreg & 0xF;
13023+ disp = (s16) * shiftreg >> 4;
13024+ srcval = fetch_data_word(srcoffset + disp);
13025+ mask = (u16) (0x1 << bit);
13026+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13027+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
13028+ }
13029+ break;
13030+ case 2:
13031+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13032+ u32 srcval, mask;
13033+ u32 *shiftreg;
13034+
13035+ srcoffset = decode_rm10_address(rl);
13036+ DECODE_PRINTF(",");
13037+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
13038+ TRACE_AND_STEP();
13039+ bit = *shiftreg & 0x1F;
13040+ disp = (s16) * shiftreg >> 5;
13041+ srcval = fetch_data_long(srcoffset + disp);
13042+ mask = (0x1 << bit);
13043+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13044+ store_data_long(srcoffset + disp, srcval & ~mask);
13045+ }
13046+ else {
13047+ u16 srcval, mask;
13048+ u16 *shiftreg;
13049+
13050+ srcoffset = decode_rm10_address(rl);
13051+ DECODE_PRINTF(",");
13052+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
13053+ TRACE_AND_STEP();
13054+ bit = *shiftreg & 0xF;
13055+ disp = (s16) * shiftreg >> 4;
13056+ srcval = fetch_data_word(srcoffset + disp);
13057+ mask = (u16) (0x1 << bit);
13058+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13059+ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
13060+ }
13061+ break;
13062+ case 3: /* register to register */
13063+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13064+ u32 *srcreg, *shiftreg;
13065+ u32 mask;
13066+
13067+ srcreg = DECODE_RM_LONG_REGISTER(rl);
13068+ DECODE_PRINTF(",");
13069+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
13070+ TRACE_AND_STEP();
13071+ bit = *shiftreg & 0x1F;
13072+ mask = (0x1 << bit);
13073+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13074+ *srcreg &= ~mask;
13075+ }
13076+ else {
13077+ u16 *srcreg, *shiftreg;
13078+ u16 mask;
13079+
13080+ srcreg = DECODE_RM_WORD_REGISTER(rl);
13081+ DECODE_PRINTF(",");
13082+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
13083+ TRACE_AND_STEP();
13084+ bit = *shiftreg & 0xF;
13085+ mask = (u16) (0x1 << bit);
13086+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13087+ *srcreg &= ~mask;
13088+ }
13089+ break;
13090+ }
13091+ DECODE_CLEAR_SEGOVR();
13092+ END_OF_INSTR();
13093 }
13094
13095 /****************************************************************************
13096 REMARKS:
13097 Handles opcode 0x0f,0xb4
13098 ****************************************************************************/
13099-static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
13100+static void
13101+x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
13102 {
13103- int mod, rh, rl;
13104+ int mod, rh, rl;
13105 u16 *dstreg;
13106 uint srcoffset;
13107
13108@@ -1603,7 +1613,7 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
13109 *dstreg = fetch_data_word(srcoffset);
13110 M.x86.R_FS = fetch_data_word(srcoffset + 2);
13111 break;
13112- case 3: /* register to register */
13113+ case 3: /* register to register */
13114 /* UNDEFINED! */
13115 TRACE_AND_STEP();
13116 }
13117@@ -1615,9 +1625,10 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
13118 REMARKS:
13119 Handles opcode 0x0f,0xb5
13120 ****************************************************************************/
13121-static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
13122+static void
13123+x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
13124 {
13125- int mod, rh, rl;
13126+ int mod, rh, rl;
13127 u16 *dstreg;
13128 uint srcoffset;
13129
13130@@ -1652,7 +1663,7 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
13131 *dstreg = fetch_data_word(srcoffset);
13132 M.x86.R_GS = fetch_data_word(srcoffset + 2);
13133 break;
13134- case 3: /* register to register */
13135+ case 3: /* register to register */
13136 /* UNDEFINED! */
13137 TRACE_AND_STEP();
13138 }
13139@@ -1664,7 +1675,8 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
13140 REMARKS:
13141 Handles opcode 0x0f,0xb6
13142 ****************************************************************************/
13143-static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13144+static void
13145+x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13146 {
13147 int mod, rl, rh;
13148 uint srcoffset;
13149@@ -1685,7 +1697,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13150 DECODE_PRINTF("\n");
13151 TRACE_AND_STEP();
13152 *destreg = srcval;
13153- } else {
13154+ }
13155+ else {
13156 u16 *destreg;
13157 u16 srcval;
13158
13159@@ -1710,7 +1723,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13160 DECODE_PRINTF("\n");
13161 TRACE_AND_STEP();
13162 *destreg = srcval;
13163- } else {
13164+ }
13165+ else {
13166 u16 *destreg;
13167 u16 srcval;
13168
13169@@ -1735,7 +1749,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13170 DECODE_PRINTF("\n");
13171 TRACE_AND_STEP();
13172 *destreg = srcval;
13173- } else {
13174+ }
13175+ else {
13176 u16 *destreg;
13177 u16 srcval;
13178
13179@@ -1748,10 +1763,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13180 *destreg = srcval;
13181 }
13182 break;
13183- case 3: /* register to register */
13184+ case 3: /* register to register */
13185 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13186 u32 *destreg;
13187- u8 *srcreg;
13188+ u8 *srcreg;
13189
13190 destreg = DECODE_RM_LONG_REGISTER(rh);
13191 DECODE_PRINTF(",");
13192@@ -1759,9 +1774,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13193 DECODE_PRINTF("\n");
13194 TRACE_AND_STEP();
13195 *destreg = *srcreg;
13196- } else {
13197+ }
13198+ else {
13199 u16 *destreg;
13200- u8 *srcreg;
13201+ u8 *srcreg;
13202
13203 destreg = DECODE_RM_WORD_REGISTER(rh);
13204 DECODE_PRINTF(",");
13205@@ -1780,7 +1796,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
13206 REMARKS:
13207 Handles opcode 0x0f,0xb7
13208 ****************************************************************************/
13209-static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
13210+static void
13211+x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
13212 {
13213 int mod, rl, rh;
13214 uint srcoffset;
13215@@ -1819,7 +1836,7 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
13216 TRACE_AND_STEP();
13217 *destreg = srcval;
13218 break;
13219- case 3: /* register to register */
13220+ case 3: /* register to register */
13221 destreg = DECODE_RM_LONG_REGISTER(rh);
13222 DECODE_PRINTF(",");
13223 srcreg = DECODE_RM_WORD_REGISTER(rl);
13224@@ -1836,7 +1853,8 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
13225 REMARKS:
13226 Handles opcode 0x0f,0xba
13227 ****************************************************************************/
13228-static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13229+static void
13230+x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13231 {
13232 int mod, rl, rh;
13233 uint srcoffset;
13234@@ -1846,23 +1864,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13235 FETCH_DECODE_MODRM(mod, rh, rl);
13236 switch (rh) {
13237 case 4:
13238- DECODE_PRINTF("BT\t");
13239- break;
13240+ DECODE_PRINTF("BT\t");
13241+ break;
13242 case 5:
13243- DECODE_PRINTF("BTS\t");
13244- break;
13245+ DECODE_PRINTF("BTS\t");
13246+ break;
13247 case 6:
13248- DECODE_PRINTF("BTR\t");
13249- break;
13250+ DECODE_PRINTF("BTR\t");
13251+ break;
13252 case 7:
13253- DECODE_PRINTF("BTC\t");
13254- break;
13255+ DECODE_PRINTF("BTC\t");
13256+ break;
13257 default:
13258- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
13259- TRACE_REGS();
13260- printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
13261- M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
13262- HALT_SYS();
13263+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
13264+ TRACE_REGS();
13265+ printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
13266+ M.x86.R_CS, M.x86.R_IP - 3, op2, (mod << 6) | (rh << 3) | rl);
13267+ HALT_SYS();
13268 }
13269 switch (mod) {
13270 case 0:
13271@@ -1876,22 +1894,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13272 TRACE_AND_STEP();
13273 bit = shift & 0x1F;
13274 srcval = fetch_data_long(srcoffset);
13275- mask = (0x1 << bit);
13276- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13277- switch (rh) {
13278- case 5:
13279- store_data_long(srcoffset, srcval | mask);
13280- break;
13281- case 6:
13282- store_data_long(srcoffset, srcval & ~mask);
13283- break;
13284- case 7:
13285- store_data_long(srcoffset, srcval ^ mask);
13286- break;
13287- default:
13288- break;
13289- }
13290- } else {
13291+ mask = (0x1 << bit);
13292+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13293+ switch (rh) {
13294+ case 5:
13295+ store_data_long(srcoffset, srcval | mask);
13296+ break;
13297+ case 6:
13298+ store_data_long(srcoffset, srcval & ~mask);
13299+ break;
13300+ case 7:
13301+ store_data_long(srcoffset, srcval ^ mask);
13302+ break;
13303+ default:
13304+ break;
13305+ }
13306+ }
13307+ else {
13308 u16 srcval, mask;
13309 u8 shift;
13310
13311@@ -1901,21 +1920,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13312 TRACE_AND_STEP();
13313 bit = shift & 0xF;
13314 srcval = fetch_data_word(srcoffset);
13315- mask = (0x1 << bit);
13316- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13317- switch (rh) {
13318- case 5:
13319- store_data_word(srcoffset, srcval | mask);
13320- break;
13321- case 6:
13322- store_data_word(srcoffset, srcval & ~mask);
13323- break;
13324- case 7:
13325- store_data_word(srcoffset, srcval ^ mask);
13326- break;
13327- default:
13328- break;
13329- }
13330+ mask = (0x1 << bit);
13331+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13332+ switch (rh) {
13333+ case 5:
13334+ store_data_word(srcoffset, srcval | mask);
13335+ break;
13336+ case 6:
13337+ store_data_word(srcoffset, srcval & ~mask);
13338+ break;
13339+ case 7:
13340+ store_data_word(srcoffset, srcval ^ mask);
13341+ break;
13342+ default:
13343+ break;
13344+ }
13345 }
13346 break;
13347 case 1:
13348@@ -1929,22 +1948,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13349 TRACE_AND_STEP();
13350 bit = shift & 0x1F;
13351 srcval = fetch_data_long(srcoffset);
13352- mask = (0x1 << bit);
13353- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13354- switch (rh) {
13355- case 5:
13356- store_data_long(srcoffset, srcval | mask);
13357- break;
13358- case 6:
13359- store_data_long(srcoffset, srcval & ~mask);
13360- break;
13361- case 7:
13362- store_data_long(srcoffset, srcval ^ mask);
13363- break;
13364- default:
13365- break;
13366- }
13367- } else {
13368+ mask = (0x1 << bit);
13369+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13370+ switch (rh) {
13371+ case 5:
13372+ store_data_long(srcoffset, srcval | mask);
13373+ break;
13374+ case 6:
13375+ store_data_long(srcoffset, srcval & ~mask);
13376+ break;
13377+ case 7:
13378+ store_data_long(srcoffset, srcval ^ mask);
13379+ break;
13380+ default:
13381+ break;
13382+ }
13383+ }
13384+ else {
13385 u16 srcval, mask;
13386 u8 shift;
13387
13388@@ -1954,21 +1974,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13389 TRACE_AND_STEP();
13390 bit = shift & 0xF;
13391 srcval = fetch_data_word(srcoffset);
13392- mask = (0x1 << bit);
13393- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13394- switch (rh) {
13395- case 5:
13396- store_data_word(srcoffset, srcval | mask);
13397- break;
13398- case 6:
13399- store_data_word(srcoffset, srcval & ~mask);
13400- break;
13401- case 7:
13402- store_data_word(srcoffset, srcval ^ mask);
13403- break;
13404- default:
13405- break;
13406- }
13407+ mask = (0x1 << bit);
13408+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13409+ switch (rh) {
13410+ case 5:
13411+ store_data_word(srcoffset, srcval | mask);
13412+ break;
13413+ case 6:
13414+ store_data_word(srcoffset, srcval & ~mask);
13415+ break;
13416+ case 7:
13417+ store_data_word(srcoffset, srcval ^ mask);
13418+ break;
13419+ default:
13420+ break;
13421+ }
13422 }
13423 break;
13424 case 2:
13425@@ -1982,22 +2002,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13426 TRACE_AND_STEP();
13427 bit = shift & 0x1F;
13428 srcval = fetch_data_long(srcoffset);
13429- mask = (0x1 << bit);
13430- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13431- switch (rh) {
13432- case 5:
13433- store_data_long(srcoffset, srcval | mask);
13434- break;
13435- case 6:
13436- store_data_long(srcoffset, srcval & ~mask);
13437- break;
13438- case 7:
13439- store_data_long(srcoffset, srcval ^ mask);
13440- break;
13441- default:
13442- break;
13443- }
13444- } else {
13445+ mask = (0x1 << bit);
13446+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13447+ switch (rh) {
13448+ case 5:
13449+ store_data_long(srcoffset, srcval | mask);
13450+ break;
13451+ case 6:
13452+ store_data_long(srcoffset, srcval & ~mask);
13453+ break;
13454+ case 7:
13455+ store_data_long(srcoffset, srcval ^ mask);
13456+ break;
13457+ default:
13458+ break;
13459+ }
13460+ }
13461+ else {
13462 u16 srcval, mask;
13463 u8 shift;
13464
13465@@ -2007,74 +2028,75 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13466 TRACE_AND_STEP();
13467 bit = shift & 0xF;
13468 srcval = fetch_data_word(srcoffset);
13469- mask = (0x1 << bit);
13470- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13471- switch (rh) {
13472- case 5:
13473- store_data_word(srcoffset, srcval | mask);
13474- break;
13475- case 6:
13476- store_data_word(srcoffset, srcval & ~mask);
13477- break;
13478- case 7:
13479- store_data_word(srcoffset, srcval ^ mask);
13480- break;
13481- default:
13482- break;
13483- }
13484- }
13485- break;
13486- case 3: /* register to register */
13487+ mask = (0x1 << bit);
13488+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13489+ switch (rh) {
13490+ case 5:
13491+ store_data_word(srcoffset, srcval | mask);
13492+ break;
13493+ case 6:
13494+ store_data_word(srcoffset, srcval & ~mask);
13495+ break;
13496+ case 7:
13497+ store_data_word(srcoffset, srcval ^ mask);
13498+ break;
13499+ default:
13500+ break;
13501+ }
13502+ }
13503+ break;
13504+ case 3: /* register to register */
13505 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13506 u32 *srcreg;
13507- u32 mask;
13508- u8 shift;
13509+ u32 mask;
13510+ u8 shift;
13511
13512 srcreg = DECODE_RM_LONG_REGISTER(rl);
13513 DECODE_PRINTF(",");
13514 shift = fetch_byte_imm();
13515 TRACE_AND_STEP();
13516 bit = shift & 0x1F;
13517- mask = (0x1 << bit);
13518- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
13519- switch (rh) {
13520- case 5:
13521- *srcreg |= mask;
13522- break;
13523- case 6:
13524- *srcreg &= ~mask;
13525- break;
13526- case 7:
13527- *srcreg ^= mask;
13528- break;
13529- default:
13530- break;
13531- }
13532- } else {
13533+ mask = (0x1 << bit);
13534+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13535+ switch (rh) {
13536+ case 5:
13537+ *srcreg |= mask;
13538+ break;
13539+ case 6:
13540+ *srcreg &= ~mask;
13541+ break;
13542+ case 7:
13543+ *srcreg ^= mask;
13544+ break;
13545+ default:
13546+ break;
13547+ }
13548+ }
13549+ else {
13550 u16 *srcreg;
13551- u16 mask;
13552- u8 shift;
13553+ u16 mask;
13554+ u8 shift;
13555
13556 srcreg = DECODE_RM_WORD_REGISTER(rl);
13557 DECODE_PRINTF(",");
13558 shift = fetch_byte_imm();
13559 TRACE_AND_STEP();
13560 bit = shift & 0xF;
13561- mask = (0x1 << bit);
13562- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
13563- switch (rh) {
13564- case 5:
13565- *srcreg |= mask;
13566- break;
13567- case 6:
13568- *srcreg &= ~mask;
13569- break;
13570- case 7:
13571- *srcreg ^= mask;
13572- break;
13573- default:
13574- break;
13575- }
13576+ mask = (0x1 << bit);
13577+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13578+ switch (rh) {
13579+ case 5:
13580+ *srcreg |= mask;
13581+ break;
13582+ case 6:
13583+ *srcreg &= ~mask;
13584+ break;
13585+ case 7:
13586+ *srcreg ^= mask;
13587+ break;
13588+ default:
13589+ break;
13590+ }
13591 }
13592 break;
13593 }
13594@@ -2086,11 +2108,12 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
13595 REMARKS:
13596 Handles opcode 0x0f,0xbb
13597 ****************************************************************************/
13598-static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13599+static void
13600+x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13601 {
13602 int mod, rl, rh;
13603 uint srcoffset;
13604- int bit,disp;
13605+ int bit, disp;
13606
13607 START_OF_INSTR();
13608 DECODE_PRINTF("BTC\t");
13609@@ -2098,7 +2121,7 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13610 switch (mod) {
13611 case 0:
13612 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13613- u32 srcval,mask;
13614+ u32 srcval, mask;
13615 u32 *shiftreg;
13616
13617 srcoffset = decode_rm00_address(rl);
13618@@ -2106,13 +2129,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13619 shiftreg = DECODE_RM_LONG_REGISTER(rh);
13620 TRACE_AND_STEP();
13621 bit = *shiftreg & 0x1F;
13622- disp = (s16)*shiftreg >> 5;
13623- srcval = fetch_data_long(srcoffset+disp);
13624+ disp = (s16) * shiftreg >> 5;
13625+ srcval = fetch_data_long(srcoffset + disp);
13626 mask = (0x1 << bit);
13627- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13628- store_data_long(srcoffset+disp, srcval ^ mask);
13629- } else {
13630- u16 srcval,mask;
13631+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13632+ store_data_long(srcoffset + disp, srcval ^ mask);
13633+ }
13634+ else {
13635+ u16 srcval, mask;
13636 u16 *shiftreg;
13637
13638 srcoffset = decode_rm00_address(rl);
13639@@ -2120,16 +2144,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13640 shiftreg = DECODE_RM_WORD_REGISTER(rh);
13641 TRACE_AND_STEP();
13642 bit = *shiftreg & 0xF;
13643- disp = (s16)*shiftreg >> 4;
13644- srcval = fetch_data_word(srcoffset+disp);
13645- mask = (u16)(0x1 << bit);
13646- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13647- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
13648+ disp = (s16) * shiftreg >> 4;
13649+ srcval = fetch_data_word(srcoffset + disp);
13650+ mask = (u16) (0x1 << bit);
13651+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13652+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
13653 }
13654 break;
13655 case 1:
13656 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13657- u32 srcval,mask;
13658+ u32 srcval, mask;
13659 u32 *shiftreg;
13660
13661 srcoffset = decode_rm01_address(rl);
13662@@ -2137,13 +2161,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13663 shiftreg = DECODE_RM_LONG_REGISTER(rh);
13664 TRACE_AND_STEP();
13665 bit = *shiftreg & 0x1F;
13666- disp = (s16)*shiftreg >> 5;
13667- srcval = fetch_data_long(srcoffset+disp);
13668+ disp = (s16) * shiftreg >> 5;
13669+ srcval = fetch_data_long(srcoffset + disp);
13670 mask = (0x1 << bit);
13671- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13672- store_data_long(srcoffset+disp, srcval ^ mask);
13673- } else {
13674- u16 srcval,mask;
13675+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13676+ store_data_long(srcoffset + disp, srcval ^ mask);
13677+ }
13678+ else {
13679+ u16 srcval, mask;
13680 u16 *shiftreg;
13681
13682 srcoffset = decode_rm01_address(rl);
13683@@ -2151,16 +2176,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13684 shiftreg = DECODE_RM_WORD_REGISTER(rh);
13685 TRACE_AND_STEP();
13686 bit = *shiftreg & 0xF;
13687- disp = (s16)*shiftreg >> 4;
13688- srcval = fetch_data_word(srcoffset+disp);
13689- mask = (u16)(0x1 << bit);
13690- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13691- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
13692+ disp = (s16) * shiftreg >> 4;
13693+ srcval = fetch_data_word(srcoffset + disp);
13694+ mask = (u16) (0x1 << bit);
13695+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13696+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
13697 }
13698 break;
13699 case 2:
13700 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13701- u32 srcval,mask;
13702+ u32 srcval, mask;
13703 u32 *shiftreg;
13704
13705 srcoffset = decode_rm10_address(rl);
13706@@ -2168,13 +2193,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13707 shiftreg = DECODE_RM_LONG_REGISTER(rh);
13708 TRACE_AND_STEP();
13709 bit = *shiftreg & 0x1F;
13710- disp = (s16)*shiftreg >> 5;
13711- srcval = fetch_data_long(srcoffset+disp);
13712+ disp = (s16) * shiftreg >> 5;
13713+ srcval = fetch_data_long(srcoffset + disp);
13714 mask = (0x1 << bit);
13715- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13716- store_data_long(srcoffset+disp, srcval ^ mask);
13717- } else {
13718- u16 srcval,mask;
13719+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13720+ store_data_long(srcoffset + disp, srcval ^ mask);
13721+ }
13722+ else {
13723+ u16 srcval, mask;
13724 u16 *shiftreg;
13725
13726 srcoffset = decode_rm10_address(rl);
13727@@ -2182,16 +2208,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13728 shiftreg = DECODE_RM_WORD_REGISTER(rh);
13729 TRACE_AND_STEP();
13730 bit = *shiftreg & 0xF;
13731- disp = (s16)*shiftreg >> 4;
13732- srcval = fetch_data_word(srcoffset+disp);
13733- mask = (u16)(0x1 << bit);
13734- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
13735- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
13736+ disp = (s16) * shiftreg >> 4;
13737+ srcval = fetch_data_word(srcoffset + disp);
13738+ mask = (u16) (0x1 << bit);
13739+ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
13740+ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
13741 }
13742 break;
13743- case 3: /* register to register */
13744+ case 3: /* register to register */
13745 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13746- u32 *srcreg,*shiftreg;
13747+ u32 *srcreg, *shiftreg;
13748 u32 mask;
13749
13750 srcreg = DECODE_RM_LONG_REGISTER(rl);
13751@@ -2200,19 +2226,20 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13752 TRACE_AND_STEP();
13753 bit = *shiftreg & 0x1F;
13754 mask = (0x1 << bit);
13755- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
13756- *srcreg ^= mask;
13757- } else {
13758- u16 *srcreg,*shiftreg;
13759- u16 mask;
13760-
13761- srcreg = DECODE_RM_WORD_REGISTER(rl);
13762- DECODE_PRINTF(",");
13763- shiftreg = DECODE_RM_WORD_REGISTER(rh);
13764- TRACE_AND_STEP();
13765- bit = *shiftreg & 0xF;
13766- mask = (u16)(0x1 << bit);
13767- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
13768+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13769+ *srcreg ^= mask;
13770+ }
13771+ else {
13772+ u16 *srcreg, *shiftreg;
13773+ u16 mask;
13774+
13775+ srcreg = DECODE_RM_WORD_REGISTER(rl);
13776+ DECODE_PRINTF(",");
13777+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
13778+ TRACE_AND_STEP();
13779+ bit = *shiftreg & 0xF;
13780+ mask = (u16) (0x1 << bit);
13781+ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
13782 *srcreg ^= mask;
13783 }
13784 break;
13785@@ -2225,7 +2252,8 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
13786 REMARKS:
13787 Handles opcode 0x0f,0xbc
13788 ****************************************************************************/
13789-static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
13790+static void
13791+x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
13792 {
13793 int mod, rl, rh;
13794 uint srcoffset;
13795@@ -2233,105 +2261,117 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
13796 START_OF_INSTR();
13797 DECODE_PRINTF("BSF\t");
13798 FETCH_DECODE_MODRM(mod, rh, rl);
13799- switch(mod) {
13800+ switch (mod) {
13801 case 0:
13802- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13803- u32 srcval, *dstreg;
13804-
13805- srcoffset = decode_rm00_address(rl);
13806- DECODE_PRINTF(",");
13807- dstreg = DECODE_RM_LONG_REGISTER(rh);
13808- TRACE_AND_STEP();
13809- srcval = fetch_data_long(srcoffset);
13810- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13811- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
13812- if ((srcval >> *dstreg) & 1) break;
13813- } else {
13814- u16 srcval, *dstreg;
13815-
13816- srcoffset = decode_rm00_address(rl);
13817- DECODE_PRINTF(",");
13818- dstreg = DECODE_RM_WORD_REGISTER(rh);
13819- TRACE_AND_STEP();
13820- srcval = fetch_data_word(srcoffset);
13821- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13822- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
13823- if ((srcval >> *dstreg) & 1) break;
13824- }
13825- break;
13826+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13827+ u32 srcval, *dstreg;
13828+
13829+ srcoffset = decode_rm00_address(rl);
13830+ DECODE_PRINTF(",");
13831+ dstreg = DECODE_RM_LONG_REGISTER(rh);
13832+ TRACE_AND_STEP();
13833+ srcval = fetch_data_long(srcoffset);
13834+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13835+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
13836+ if ((srcval >> *dstreg) & 1)
13837+ break;
13838+ }
13839+ else {
13840+ u16 srcval, *dstreg;
13841+
13842+ srcoffset = decode_rm00_address(rl);
13843+ DECODE_PRINTF(",");
13844+ dstreg = DECODE_RM_WORD_REGISTER(rh);
13845+ TRACE_AND_STEP();
13846+ srcval = fetch_data_word(srcoffset);
13847+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13848+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
13849+ if ((srcval >> *dstreg) & 1)
13850+ break;
13851+ }
13852+ break;
13853 case 1:
13854- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13855- u32 srcval, *dstreg;
13856-
13857- srcoffset = decode_rm01_address(rl);
13858- DECODE_PRINTF(",");
13859- dstreg = DECODE_RM_LONG_REGISTER(rh);
13860- TRACE_AND_STEP();
13861- srcval = fetch_data_long(srcoffset);
13862- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13863- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
13864- if ((srcval >> *dstreg) & 1) break;
13865- } else {
13866- u16 srcval, *dstreg;
13867-
13868- srcoffset = decode_rm01_address(rl);
13869- DECODE_PRINTF(",");
13870- dstreg = DECODE_RM_WORD_REGISTER(rh);
13871- TRACE_AND_STEP();
13872- srcval = fetch_data_word(srcoffset);
13873- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13874- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
13875- if ((srcval >> *dstreg) & 1) break;
13876- }
13877- break;
13878+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13879+ u32 srcval, *dstreg;
13880+
13881+ srcoffset = decode_rm01_address(rl);
13882+ DECODE_PRINTF(",");
13883+ dstreg = DECODE_RM_LONG_REGISTER(rh);
13884+ TRACE_AND_STEP();
13885+ srcval = fetch_data_long(srcoffset);
13886+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13887+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
13888+ if ((srcval >> *dstreg) & 1)
13889+ break;
13890+ }
13891+ else {
13892+ u16 srcval, *dstreg;
13893+
13894+ srcoffset = decode_rm01_address(rl);
13895+ DECODE_PRINTF(",");
13896+ dstreg = DECODE_RM_WORD_REGISTER(rh);
13897+ TRACE_AND_STEP();
13898+ srcval = fetch_data_word(srcoffset);
13899+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13900+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
13901+ if ((srcval >> *dstreg) & 1)
13902+ break;
13903+ }
13904+ break;
13905 case 2:
13906- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13907- u32 srcval, *dstreg;
13908-
13909- srcoffset = decode_rm10_address(rl);
13910- DECODE_PRINTF(",");
13911- dstreg = DECODE_RM_LONG_REGISTER(rh);
13912- TRACE_AND_STEP();
13913- srcval = fetch_data_long(srcoffset);
13914- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13915- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
13916- if ((srcval >> *dstreg) & 1) break;
13917- } else {
13918- u16 srcval, *dstreg;
13919-
13920- srcoffset = decode_rm10_address(rl);
13921- DECODE_PRINTF(",");
13922- dstreg = DECODE_RM_WORD_REGISTER(rh);
13923- TRACE_AND_STEP();
13924- srcval = fetch_data_word(srcoffset);
13925- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13926- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
13927- if ((srcval >> *dstreg) & 1) break;
13928- }
13929- break;
13930- case 3: /* register to register */
13931- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13932- u32 srcval, *dstreg;
13933-
13934- srcval = *DECODE_RM_LONG_REGISTER(rl);
13935- DECODE_PRINTF(",");
13936- dstreg = DECODE_RM_LONG_REGISTER(rh);
13937- TRACE_AND_STEP();
13938- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13939- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
13940- if ((srcval >> *dstreg) & 1) break;
13941- } else {
13942- u16 srcval, *dstreg;
13943-
13944- srcval = *DECODE_RM_WORD_REGISTER(rl);
13945- DECODE_PRINTF(",");
13946- dstreg = DECODE_RM_WORD_REGISTER(rh);
13947- TRACE_AND_STEP();
13948- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13949- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
13950- if ((srcval >> *dstreg) & 1) break;
13951- }
13952- break;
13953+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13954+ u32 srcval, *dstreg;
13955+
13956+ srcoffset = decode_rm10_address(rl);
13957+ DECODE_PRINTF(",");
13958+ dstreg = DECODE_RM_LONG_REGISTER(rh);
13959+ TRACE_AND_STEP();
13960+ srcval = fetch_data_long(srcoffset);
13961+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13962+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
13963+ if ((srcval >> *dstreg) & 1)
13964+ break;
13965+ }
13966+ else {
13967+ u16 srcval, *dstreg;
13968+
13969+ srcoffset = decode_rm10_address(rl);
13970+ DECODE_PRINTF(",");
13971+ dstreg = DECODE_RM_WORD_REGISTER(rh);
13972+ TRACE_AND_STEP();
13973+ srcval = fetch_data_word(srcoffset);
13974+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13975+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
13976+ if ((srcval >> *dstreg) & 1)
13977+ break;
13978+ }
13979+ break;
13980+ case 3: /* register to register */
13981+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
13982+ u32 srcval, *dstreg;
13983+
13984+ srcval = *DECODE_RM_LONG_REGISTER(rl);
13985+ DECODE_PRINTF(",");
13986+ dstreg = DECODE_RM_LONG_REGISTER(rh);
13987+ TRACE_AND_STEP();
13988+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
13989+ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
13990+ if ((srcval >> *dstreg) & 1)
13991+ break;
13992+ }
13993+ else {
13994+ u16 srcval, *dstreg;
13995+
13996+ srcval = *DECODE_RM_WORD_REGISTER(rl);
13997+ DECODE_PRINTF(",");
13998+ dstreg = DECODE_RM_WORD_REGISTER(rh);
13999+ TRACE_AND_STEP();
14000+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14001+ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
14002+ if ((srcval >> *dstreg) & 1)
14003+ break;
14004+ }
14005+ break;
14006 }
14007 DECODE_CLEAR_SEGOVR();
14008 END_OF_INSTR();
14009@@ -2341,7 +2381,8 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
14010 REMARKS:
14011 Handles opcode 0x0f,0xbd
14012 ****************************************************************************/
14013-static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
14014+static void
14015+x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
14016 {
14017 int mod, rl, rh;
14018 uint srcoffset;
14019@@ -2349,105 +2390,117 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
14020 START_OF_INSTR();
14021 DECODE_PRINTF("BSR\t");
14022 FETCH_DECODE_MODRM(mod, rh, rl);
14023- switch(mod) {
14024+ switch (mod) {
14025 case 0:
14026- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14027- u32 srcval, *dstreg;
14028-
14029- srcoffset = decode_rm00_address(rl);
14030- DECODE_PRINTF(",");
14031- dstreg = DECODE_RM_LONG_REGISTER(rh);
14032- TRACE_AND_STEP();
14033- srcval = fetch_data_long(srcoffset);
14034- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14035- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
14036- if ((srcval >> *dstreg) & 1) break;
14037- } else {
14038- u16 srcval, *dstreg;
14039-
14040- srcoffset = decode_rm00_address(rl);
14041- DECODE_PRINTF(",");
14042- dstreg = DECODE_RM_WORD_REGISTER(rh);
14043- TRACE_AND_STEP();
14044- srcval = fetch_data_word(srcoffset);
14045- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14046- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
14047- if ((srcval >> *dstreg) & 1) break;
14048- }
14049- break;
14050+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14051+ u32 srcval, *dstreg;
14052+
14053+ srcoffset = decode_rm00_address(rl);
14054+ DECODE_PRINTF(",");
14055+ dstreg = DECODE_RM_LONG_REGISTER(rh);
14056+ TRACE_AND_STEP();
14057+ srcval = fetch_data_long(srcoffset);
14058+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14059+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
14060+ if ((srcval >> *dstreg) & 1)
14061+ break;
14062+ }
14063+ else {
14064+ u16 srcval, *dstreg;
14065+
14066+ srcoffset = decode_rm00_address(rl);
14067+ DECODE_PRINTF(",");
14068+ dstreg = DECODE_RM_WORD_REGISTER(rh);
14069+ TRACE_AND_STEP();
14070+ srcval = fetch_data_word(srcoffset);
14071+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14072+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
14073+ if ((srcval >> *dstreg) & 1)
14074+ break;
14075+ }
14076+ break;
14077 case 1:
14078- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14079- u32 srcval, *dstreg;
14080-
14081- srcoffset = decode_rm01_address(rl);
14082- DECODE_PRINTF(",");
14083- dstreg = DECODE_RM_LONG_REGISTER(rh);
14084- TRACE_AND_STEP();
14085- srcval = fetch_data_long(srcoffset);
14086- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14087- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
14088- if ((srcval >> *dstreg) & 1) break;
14089- } else {
14090- u16 srcval, *dstreg;
14091-
14092- srcoffset = decode_rm01_address(rl);
14093- DECODE_PRINTF(",");
14094- dstreg = DECODE_RM_WORD_REGISTER(rh);
14095- TRACE_AND_STEP();
14096- srcval = fetch_data_word(srcoffset);
14097- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14098- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
14099- if ((srcval >> *dstreg) & 1) break;
14100- }
14101- break;
14102+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14103+ u32 srcval, *dstreg;
14104+
14105+ srcoffset = decode_rm01_address(rl);
14106+ DECODE_PRINTF(",");
14107+ dstreg = DECODE_RM_LONG_REGISTER(rh);
14108+ TRACE_AND_STEP();
14109+ srcval = fetch_data_long(srcoffset);
14110+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14111+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
14112+ if ((srcval >> *dstreg) & 1)
14113+ break;
14114+ }
14115+ else {
14116+ u16 srcval, *dstreg;
14117+
14118+ srcoffset = decode_rm01_address(rl);
14119+ DECODE_PRINTF(",");
14120+ dstreg = DECODE_RM_WORD_REGISTER(rh);
14121+ TRACE_AND_STEP();
14122+ srcval = fetch_data_word(srcoffset);
14123+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14124+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
14125+ if ((srcval >> *dstreg) & 1)
14126+ break;
14127+ }
14128+ break;
14129 case 2:
14130- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14131- u32 srcval, *dstreg;
14132-
14133- srcoffset = decode_rm10_address(rl);
14134- DECODE_PRINTF(",");
14135- dstreg = DECODE_RM_LONG_REGISTER(rh);
14136- TRACE_AND_STEP();
14137- srcval = fetch_data_long(srcoffset);
14138- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14139- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
14140- if ((srcval >> *dstreg) & 1) break;
14141- } else {
14142- u16 srcval, *dstreg;
14143-
14144- srcoffset = decode_rm10_address(rl);
14145- DECODE_PRINTF(",");
14146- dstreg = DECODE_RM_WORD_REGISTER(rh);
14147- TRACE_AND_STEP();
14148- srcval = fetch_data_word(srcoffset);
14149- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14150- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
14151- if ((srcval >> *dstreg) & 1) break;
14152- }
14153- break;
14154- case 3: /* register to register */
14155- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14156- u32 srcval, *dstreg;
14157-
14158- srcval = *DECODE_RM_LONG_REGISTER(rl);
14159- DECODE_PRINTF(",");
14160- dstreg = DECODE_RM_LONG_REGISTER(rh);
14161- TRACE_AND_STEP();
14162- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14163- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
14164- if ((srcval >> *dstreg) & 1) break;
14165- } else {
14166- u16 srcval, *dstreg;
14167-
14168- srcval = *DECODE_RM_WORD_REGISTER(rl);
14169- DECODE_PRINTF(",");
14170- dstreg = DECODE_RM_WORD_REGISTER(rh);
14171- TRACE_AND_STEP();
14172- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14173- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
14174- if ((srcval >> *dstreg) & 1) break;
14175- }
14176- break;
14177+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14178+ u32 srcval, *dstreg;
14179+
14180+ srcoffset = decode_rm10_address(rl);
14181+ DECODE_PRINTF(",");
14182+ dstreg = DECODE_RM_LONG_REGISTER(rh);
14183+ TRACE_AND_STEP();
14184+ srcval = fetch_data_long(srcoffset);
14185+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14186+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
14187+ if ((srcval >> *dstreg) & 1)
14188+ break;
14189+ }
14190+ else {
14191+ u16 srcval, *dstreg;
14192+
14193+ srcoffset = decode_rm10_address(rl);
14194+ DECODE_PRINTF(",");
14195+ dstreg = DECODE_RM_WORD_REGISTER(rh);
14196+ TRACE_AND_STEP();
14197+ srcval = fetch_data_word(srcoffset);
14198+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14199+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
14200+ if ((srcval >> *dstreg) & 1)
14201+ break;
14202+ }
14203+ break;
14204+ case 3: /* register to register */
14205+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14206+ u32 srcval, *dstreg;
14207+
14208+ srcval = *DECODE_RM_LONG_REGISTER(rl);
14209+ DECODE_PRINTF(",");
14210+ dstreg = DECODE_RM_LONG_REGISTER(rh);
14211+ TRACE_AND_STEP();
14212+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14213+ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
14214+ if ((srcval >> *dstreg) & 1)
14215+ break;
14216+ }
14217+ else {
14218+ u16 srcval, *dstreg;
14219+
14220+ srcval = *DECODE_RM_WORD_REGISTER(rl);
14221+ DECODE_PRINTF(",");
14222+ dstreg = DECODE_RM_WORD_REGISTER(rh);
14223+ TRACE_AND_STEP();
14224+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
14225+ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
14226+ if ((srcval >> *dstreg) & 1)
14227+ break;
14228+ }
14229+ break;
14230 }
14231 DECODE_CLEAR_SEGOVR();
14232 END_OF_INSTR();
14233@@ -2457,7 +2510,8 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
14234 REMARKS:
14235 Handles opcode 0x0f,0xbe
14236 ****************************************************************************/
14237-static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14238+static void
14239+x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14240 {
14241 int mod, rl, rh;
14242 uint srcoffset;
14243@@ -2474,18 +2528,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14244 destreg = DECODE_RM_LONG_REGISTER(rh);
14245 DECODE_PRINTF(",");
14246 srcoffset = decode_rm00_address(rl);
14247- srcval = (s32)((s8)fetch_data_byte(srcoffset));
14248+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
14249 DECODE_PRINTF("\n");
14250 TRACE_AND_STEP();
14251 *destreg = srcval;
14252- } else {
14253+ }
14254+ else {
14255 u16 *destreg;
14256 u16 srcval;
14257
14258 destreg = DECODE_RM_WORD_REGISTER(rh);
14259 DECODE_PRINTF(",");
14260 srcoffset = decode_rm00_address(rl);
14261- srcval = (s16)((s8)fetch_data_byte(srcoffset));
14262+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
14263 DECODE_PRINTF("\n");
14264 TRACE_AND_STEP();
14265 *destreg = srcval;
14266@@ -2499,18 +2554,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14267 destreg = DECODE_RM_LONG_REGISTER(rh);
14268 DECODE_PRINTF(",");
14269 srcoffset = decode_rm01_address(rl);
14270- srcval = (s32)((s8)fetch_data_byte(srcoffset));
14271+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
14272 DECODE_PRINTF("\n");
14273 TRACE_AND_STEP();
14274 *destreg = srcval;
14275- } else {
14276+ }
14277+ else {
14278 u16 *destreg;
14279 u16 srcval;
14280
14281 destreg = DECODE_RM_WORD_REGISTER(rh);
14282 DECODE_PRINTF(",");
14283 srcoffset = decode_rm01_address(rl);
14284- srcval = (s16)((s8)fetch_data_byte(srcoffset));
14285+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
14286 DECODE_PRINTF("\n");
14287 TRACE_AND_STEP();
14288 *destreg = srcval;
14289@@ -2524,44 +2580,46 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14290 destreg = DECODE_RM_LONG_REGISTER(rh);
14291 DECODE_PRINTF(",");
14292 srcoffset = decode_rm10_address(rl);
14293- srcval = (s32)((s8)fetch_data_byte(srcoffset));
14294+ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
14295 DECODE_PRINTF("\n");
14296 TRACE_AND_STEP();
14297 *destreg = srcval;
14298- } else {
14299+ }
14300+ else {
14301 u16 *destreg;
14302 u16 srcval;
14303
14304 destreg = DECODE_RM_WORD_REGISTER(rh);
14305 DECODE_PRINTF(",");
14306 srcoffset = decode_rm10_address(rl);
14307- srcval = (s16)((s8)fetch_data_byte(srcoffset));
14308+ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
14309 DECODE_PRINTF("\n");
14310 TRACE_AND_STEP();
14311 *destreg = srcval;
14312 }
14313 break;
14314- case 3: /* register to register */
14315+ case 3: /* register to register */
14316 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
14317 u32 *destreg;
14318- u8 *srcreg;
14319+ u8 *srcreg;
14320
14321 destreg = DECODE_RM_LONG_REGISTER(rh);
14322 DECODE_PRINTF(",");
14323 srcreg = DECODE_RM_BYTE_REGISTER(rl);
14324 DECODE_PRINTF("\n");
14325 TRACE_AND_STEP();
14326- *destreg = (s32)((s8)*srcreg);
14327- } else {
14328+ *destreg = (s32) ((s8) * srcreg);
14329+ }
14330+ else {
14331 u16 *destreg;
14332- u8 *srcreg;
14333+ u8 *srcreg;
14334
14335 destreg = DECODE_RM_WORD_REGISTER(rh);
14336 DECODE_PRINTF(",");
14337 srcreg = DECODE_RM_BYTE_REGISTER(rl);
14338 DECODE_PRINTF("\n");
14339 TRACE_AND_STEP();
14340- *destreg = (s16)((s8)*srcreg);
14341+ *destreg = (s16) ((s8) * srcreg);
14342 }
14343 break;
14344 }
14345@@ -2573,7 +2631,8 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
14346 REMARKS:
14347 Handles opcode 0x0f,0xbf
14348 ****************************************************************************/
14349-static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14350+static void
14351+x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14352 {
14353 int mod, rl, rh;
14354 uint srcoffset;
14355@@ -2589,7 +2648,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14356 destreg = DECODE_RM_LONG_REGISTER(rh);
14357 DECODE_PRINTF(",");
14358 srcoffset = decode_rm00_address(rl);
14359- srcval = (s32)((s16)fetch_data_word(srcoffset));
14360+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
14361 DECODE_PRINTF("\n");
14362 TRACE_AND_STEP();
14363 *destreg = srcval;
14364@@ -2598,7 +2657,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14365 destreg = DECODE_RM_LONG_REGISTER(rh);
14366 DECODE_PRINTF(",");
14367 srcoffset = decode_rm01_address(rl);
14368- srcval = (s32)((s16)fetch_data_word(srcoffset));
14369+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
14370 DECODE_PRINTF("\n");
14371 TRACE_AND_STEP();
14372 *destreg = srcval;
14373@@ -2607,18 +2666,18 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14374 destreg = DECODE_RM_LONG_REGISTER(rh);
14375 DECODE_PRINTF(",");
14376 srcoffset = decode_rm10_address(rl);
14377- srcval = (s32)((s16)fetch_data_word(srcoffset));
14378+ srcval = (s32) ((s16) fetch_data_word(srcoffset));
14379 DECODE_PRINTF("\n");
14380 TRACE_AND_STEP();
14381 *destreg = srcval;
14382 break;
14383- case 3: /* register to register */
14384+ case 3: /* register to register */
14385 destreg = DECODE_RM_LONG_REGISTER(rh);
14386 DECODE_PRINTF(",");
14387 srcreg = DECODE_RM_WORD_REGISTER(rl);
14388 DECODE_PRINTF("\n");
14389 TRACE_AND_STEP();
14390- *destreg = (s32)((s16)*srcreg);
14391+ *destreg = (s32) ((s16) * srcreg);
14392 break;
14393 }
14394 DECODE_CLEAR_SEGOVR();
14395@@ -2626,40 +2685,41 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
14396 }
14397
14398 /* Handles opcodes 0xc8-0xcf */
14399-static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
14400+static void
14401+x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
14402 {
14403 START_OF_INSTR();
14404 DECODE_PRINTF("BSWAP\n");
14405 TRACE_AND_STEP();
14406
14407 switch (op2) {
14408- case 0xc8:
14409- M.x86.R_EAX = bswap_32(M.x86.R_EAX);
14410- break;
14411- case 0xc9:
14412- M.x86.R_ECX = bswap_32(M.x86.R_ECX);
14413- break;
14414- case 0xca:
14415- M.x86.R_EDX = bswap_32(M.x86.R_EDX);
14416- break;
14417- case 0xcb:
14418- M.x86.R_EBX = bswap_32(M.x86.R_EBX);
14419- break;
14420- case 0xcc:
14421- M.x86.R_ESP = bswap_32(M.x86.R_ESP);
14422- break;
14423- case 0xcd:
14424- M.x86.R_EBP = bswap_32(M.x86.R_EBP);
14425- break;
14426- case 0xce:
14427- M.x86.R_ESI = bswap_32(M.x86.R_ESI);
14428- break;
14429- case 0xcf:
14430- M.x86.R_EDI = bswap_32(M.x86.R_EDI);
14431- break;
14432- default:
14433- /* can't happen */
14434- break;
14435+ case 0xc8:
14436+ M.x86.R_EAX = bswap_32(M.x86.R_EAX);
14437+ break;
14438+ case 0xc9:
14439+ M.x86.R_ECX = bswap_32(M.x86.R_ECX);
14440+ break;
14441+ case 0xca:
14442+ M.x86.R_EDX = bswap_32(M.x86.R_EDX);
14443+ break;
14444+ case 0xcb:
14445+ M.x86.R_EBX = bswap_32(M.x86.R_EBX);
14446+ break;
14447+ case 0xcc:
14448+ M.x86.R_ESP = bswap_32(M.x86.R_ESP);
14449+ break;
14450+ case 0xcd:
14451+ M.x86.R_EBP = bswap_32(M.x86.R_EBP);
14452+ break;
14453+ case 0xce:
14454+ M.x86.R_ESI = bswap_32(M.x86.R_ESI);
14455+ break;
14456+ case 0xcf:
14457+ M.x86.R_EDI = bswap_32(M.x86.R_EDI);
14458+ break;
14459+ default:
14460+ /* can't happen */
14461+ break;
14462 }
14463
14464 DECODE_CLEAR_SEGOVR();
14465@@ -2669,25 +2729,32 @@ static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
14466 /***************************************************************************
14467 * Double byte operation code table:
14468 **************************************************************************/
14469-void (*x86emu_optab2[256])(u8) =
14470-{
14471-/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
14472-/* 0x01 */ x86emuOp2_group_g, /* Group G (ring 0 PM) */
14473-/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
14474-/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
14475+void (*x86emu_optab2[256]) (u8) = {
14476+ /* 0x00 */ x86emuOp2_illegal_op,
14477+ /* Group F (ring 0 PM) */
14478+ /* 0x01 */ x86emuOp2_illegal_op,
14479+ /* Group G (ring 0 PM) */
14480+ /* 0x02 */ x86emuOp2_illegal_op,
14481+ /* lar (ring 0 PM) */
14482+ /* 0x03 */ x86emuOp2_illegal_op,
14483+ /* lsl (ring 0 PM) */
14484 /* 0x04 */ x86emuOp2_illegal_op,
14485-/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
14486-/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
14487-/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
14488-/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
14489-/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
14490+ /* 0x05 */ x86emuOp2_illegal_op,
14491+ /* loadall (undocumented) */
14492+ /* 0x06 */ x86emuOp2_illegal_op,
14493+ /* clts (ring 0 PM) */
14494+ /* 0x07 */ x86emuOp2_illegal_op,
14495+ /* loadall (undocumented) */
14496+ /* 0x08 */ x86emuOp2_illegal_op,
14497+ /* invd (ring 0 PM) */
14498+ /* 0x09 */ x86emuOp2_illegal_op,
14499+ /* wbinvd (ring 0 PM) */
14500 /* 0x0a */ x86emuOp2_illegal_op,
14501 /* 0x0b */ x86emuOp2_illegal_op,
14502 /* 0x0c */ x86emuOp2_illegal_op,
14503 /* 0x0d */ x86emuOp2_illegal_op,
14504 /* 0x0e */ x86emuOp2_illegal_op,
14505 /* 0x0f */ x86emuOp2_illegal_op,
14506-
14507 /* 0x10 */ x86emuOp2_illegal_op,
14508 /* 0x11 */ x86emuOp2_illegal_op,
14509 /* 0x12 */ x86emuOp2_illegal_op,
14510@@ -2704,14 +2771,19 @@ void (*x86emu_optab2[256])(u8) =
14511 /* 0x1d */ x86emuOp2_illegal_op,
14512 /* 0x1e */ x86emuOp2_illegal_op,
14513 /* 0x1f */ x86emuOp2_illegal_op,
14514-
14515-/* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
14516-/* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
14517-/* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
14518-/* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
14519-/* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
14520+ /* 0x20 */ x86emuOp2_illegal_op,
14521+ /* mov reg32,creg (ring 0 PM) */
14522+ /* 0x21 */ x86emuOp2_illegal_op,
14523+ /* mov reg32,dreg (ring 0 PM) */
14524+ /* 0x22 */ x86emuOp2_illegal_op,
14525+ /* mov creg,reg32 (ring 0 PM) */
14526+ /* 0x23 */ x86emuOp2_illegal_op,
14527+ /* mov dreg,reg32 (ring 0 PM) */
14528+ /* 0x24 */ x86emuOp2_illegal_op,
14529+ /* mov reg32,treg (ring 0 PM) */
14530 /* 0x25 */ x86emuOp2_illegal_op,
14531-/* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
14532+ /* 0x26 */ x86emuOp2_illegal_op,
14533+ /* mov treg,reg32 (ring 0 PM) */
14534 /* 0x27 */ x86emuOp2_illegal_op,
14535 /* 0x28 */ x86emuOp2_illegal_op,
14536 /* 0x29 */ x86emuOp2_illegal_op,
14537@@ -2721,7 +2793,6 @@ void (*x86emu_optab2[256])(u8) =
14538 /* 0x2d */ x86emuOp2_illegal_op,
14539 /* 0x2e */ x86emuOp2_illegal_op,
14540 /* 0x2f */ x86emuOp2_illegal_op,
14541-
14542 /* 0x30 */ x86emuOp2_illegal_op,
14543 /* 0x31 */ x86emuOp2_rdtsc,
14544 /* 0x32 */ x86emuOp2_illegal_op,
14545@@ -2738,7 +2809,6 @@ void (*x86emu_optab2[256])(u8) =
14546 /* 0x3d */ x86emuOp2_illegal_op,
14547 /* 0x3e */ x86emuOp2_illegal_op,
14548 /* 0x3f */ x86emuOp2_illegal_op,
14549-
14550 /* 0x40 */ x86emuOp2_illegal_op,
14551 /* 0x41 */ x86emuOp2_illegal_op,
14552 /* 0x42 */ x86emuOp2_illegal_op,
14553@@ -2755,7 +2825,6 @@ void (*x86emu_optab2[256])(u8) =
14554 /* 0x4d */ x86emuOp2_illegal_op,
14555 /* 0x4e */ x86emuOp2_illegal_op,
14556 /* 0x4f */ x86emuOp2_illegal_op,
14557-
14558 /* 0x50 */ x86emuOp2_illegal_op,
14559 /* 0x51 */ x86emuOp2_illegal_op,
14560 /* 0x52 */ x86emuOp2_illegal_op,
14561@@ -2772,7 +2841,6 @@ void (*x86emu_optab2[256])(u8) =
14562 /* 0x5d */ x86emuOp2_illegal_op,
14563 /* 0x5e */ x86emuOp2_illegal_op,
14564 /* 0x5f */ x86emuOp2_illegal_op,
14565-
14566 /* 0x60 */ x86emuOp2_illegal_op,
14567 /* 0x61 */ x86emuOp2_illegal_op,
14568 /* 0x62 */ x86emuOp2_illegal_op,
14569@@ -2789,7 +2857,6 @@ void (*x86emu_optab2[256])(u8) =
14570 /* 0x6d */ x86emuOp2_illegal_op,
14571 /* 0x6e */ x86emuOp2_illegal_op,
14572 /* 0x6f */ x86emuOp2_illegal_op,
14573-
14574 /* 0x70 */ x86emuOp2_illegal_op,
14575 /* 0x71 */ x86emuOp2_illegal_op,
14576 /* 0x72 */ x86emuOp2_illegal_op,
14577@@ -2806,7 +2873,6 @@ void (*x86emu_optab2[256])(u8) =
14578 /* 0x7d */ x86emuOp2_illegal_op,
14579 /* 0x7e */ x86emuOp2_illegal_op,
14580 /* 0x7f */ x86emuOp2_illegal_op,
14581-
14582 /* 0x80 */ x86emuOp2_long_jump,
14583 /* 0x81 */ x86emuOp2_long_jump,
14584 /* 0x82 */ x86emuOp2_long_jump,
14585@@ -2823,7 +2889,6 @@ void (*x86emu_optab2[256])(u8) =
14586 /* 0x8d */ x86emuOp2_long_jump,
14587 /* 0x8e */ x86emuOp2_long_jump,
14588 /* 0x8f */ x86emuOp2_long_jump,
14589-
14590 /* 0x90 */ x86emuOp2_set_byte,
14591 /* 0x91 */ x86emuOp2_set_byte,
14592 /* 0x92 */ x86emuOp2_set_byte,
14593@@ -2840,7 +2905,6 @@ void (*x86emu_optab2[256])(u8) =
14594 /* 0x9d */ x86emuOp2_set_byte,
14595 /* 0x9e */ x86emuOp2_set_byte,
14596 /* 0x9f */ x86emuOp2_set_byte,
14597-
14598 /* 0xa0 */ x86emuOp2_push_FS,
14599 /* 0xa1 */ x86emuOp2_pop_FS,
14600 /* 0xa2 */ x86emuOp2_cpuid,
14601@@ -2857,9 +2921,10 @@ void (*x86emu_optab2[256])(u8) =
14602 /* 0xad */ x86emuOp2_shrd_CL,
14603 /* 0xae */ x86emuOp2_illegal_op,
14604 /* 0xaf */ x86emuOp2_imul_R_RM,
14605-
14606-/* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
14607-/* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
14608+ /* 0xb0 */ x86emuOp2_illegal_op,
14609+ /* TODO: cmpxchg */
14610+ /* 0xb1 */ x86emuOp2_illegal_op,
14611+ /* TODO: cmpxchg */
14612 /* 0xb2 */ x86emuOp2_lss_R_IMM,
14613 /* 0xb3 */ x86emuOp2_btr_R,
14614 /* 0xb4 */ x86emuOp2_lfs_R_IMM,
14615@@ -2874,9 +2939,10 @@ void (*x86emu_optab2[256])(u8) =
14616 /* 0xbd */ x86emuOp2_bsr,
14617 /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
14618 /* 0xbf */ x86emuOp2_movsx_word_R_RM,
14619-
14620-/* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
14621-/* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
14622+ /* 0xc0 */ x86emuOp2_illegal_op,
14623+ /* TODO: xadd */
14624+ /* 0xc1 */ x86emuOp2_illegal_op,
14625+ /* TODO: xadd */
14626 /* 0xc2 */ x86emuOp2_illegal_op,
14627 /* 0xc3 */ x86emuOp2_illegal_op,
14628 /* 0xc4 */ x86emuOp2_illegal_op,
14629@@ -2891,7 +2957,6 @@ void (*x86emu_optab2[256])(u8) =
14630 /* 0xcd */ x86emuOp2_bswap,
14631 /* 0xce */ x86emuOp2_bswap,
14632 /* 0xcf */ x86emuOp2_bswap,
14633-
14634 /* 0xd0 */ x86emuOp2_illegal_op,
14635 /* 0xd1 */ x86emuOp2_illegal_op,
14636 /* 0xd2 */ x86emuOp2_illegal_op,
14637@@ -2908,7 +2973,6 @@ void (*x86emu_optab2[256])(u8) =
14638 /* 0xdd */ x86emuOp2_illegal_op,
14639 /* 0xde */ x86emuOp2_illegal_op,
14640 /* 0xdf */ x86emuOp2_illegal_op,
14641-
14642 /* 0xe0 */ x86emuOp2_illegal_op,
14643 /* 0xe1 */ x86emuOp2_illegal_op,
14644 /* 0xe2 */ x86emuOp2_illegal_op,
14645@@ -2925,7 +2989,6 @@ void (*x86emu_optab2[256])(u8) =
14646 /* 0xed */ x86emuOp2_illegal_op,
14647 /* 0xee */ x86emuOp2_illegal_op,
14648 /* 0xef */ x86emuOp2_illegal_op,
14649-
14650 /* 0xf0 */ x86emuOp2_illegal_op,
14651 /* 0xf1 */ x86emuOp2_illegal_op,
14652 /* 0xf2 */ x86emuOp2_illegal_op,
14653diff --git a/libs/x86emu/prim_ops.c b/libs/x86emu/prim_ops.c
14654index ff17c3f..24f76b4 100644
14655--- a/libs/x86emu/prim_ops.c
14656+++ b/libs/x86emu/prim_ops.c
14657@@ -102,18 +102,23 @@
14658 #define PRIM_OPS_NO_REDEFINE_ASM
14659 #include "x86emu/x86emui.h"
14660
14661+#if defined(__GNUC__)
14662+#if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)
14663+#include "x86emu/prim_x86_gcc.h"
14664+#endif
14665+#endif
14666+
14667 /*------------------------- Global Variables ------------------------------*/
14668
14669-static u32 x86emu_parity_tab[8] =
14670-{
14671- 0x96696996,
14672- 0x69969669,
14673- 0x69969669,
14674- 0x96696996,
14675- 0x69969669,
14676- 0x96696996,
14677- 0x96696996,
14678- 0x69969669,
14679+static u32 x86emu_parity_tab[8] = {
14680+ 0x96696996,
14681+ 0x69969669,
14682+ 0x69969669,
14683+ 0x96696996,
14684+ 0x69969669,
14685+ 0x96696996,
14686+ 0x96696996,
14687+ 0x69969669,
14688 };
14689
14690 #define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
14691@@ -125,88 +130,96 @@ static u32 x86emu_parity_tab[8] =
14692 REMARKS:
14693 Implements the AAA instruction and side effects.
14694 ****************************************************************************/
14695-u16 aaa_word(u16 d)
14696+u16
14697+aaa_word(u16 d)
14698 {
14699- u16 res;
14700- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
14701- d += 0x6;
14702- d += 0x100;
14703- SET_FLAG(F_AF);
14704- SET_FLAG(F_CF);
14705- } else {
14706- CLEAR_FLAG(F_CF);
14707- CLEAR_FLAG(F_AF);
14708- }
14709- res = (u16)(d & 0xFF0F);
14710- CLEAR_FLAG(F_SF);
14711- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
14712- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14713- return res;
14714+ u16 res;
14715+
14716+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
14717+ d += 0x6;
14718+ d += 0x100;
14719+ SET_FLAG(F_AF);
14720+ SET_FLAG(F_CF);
14721+ }
14722+ else {
14723+ CLEAR_FLAG(F_CF);
14724+ CLEAR_FLAG(F_AF);
14725+ }
14726+ res = (u16) (d & 0xFF0F);
14727+ CLEAR_FLAG(F_SF);
14728+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
14729+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14730+ return res;
14731 }
14732
14733 /****************************************************************************
14734 REMARKS:
14735 Implements the AAA instruction and side effects.
14736 ****************************************************************************/
14737-u16 aas_word(u16 d)
14738+u16
14739+aas_word(u16 d)
14740 {
14741- u16 res;
14742- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
14743- d -= 0x6;
14744- d -= 0x100;
14745- SET_FLAG(F_AF);
14746- SET_FLAG(F_CF);
14747- } else {
14748- CLEAR_FLAG(F_CF);
14749- CLEAR_FLAG(F_AF);
14750- }
14751- res = (u16)(d & 0xFF0F);
14752- CLEAR_FLAG(F_SF);
14753- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
14754- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14755- return res;
14756+ u16 res;
14757+
14758+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
14759+ d -= 0x6;
14760+ d -= 0x100;
14761+ SET_FLAG(F_AF);
14762+ SET_FLAG(F_CF);
14763+ }
14764+ else {
14765+ CLEAR_FLAG(F_CF);
14766+ CLEAR_FLAG(F_AF);
14767+ }
14768+ res = (u16) (d & 0xFF0F);
14769+ CLEAR_FLAG(F_SF);
14770+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
14771+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14772+ return res;
14773 }
14774
14775 /****************************************************************************
14776 REMARKS:
14777 Implements the AAD instruction and side effects.
14778 ****************************************************************************/
14779-u16 aad_word(u16 d)
14780+u16
14781+aad_word(u16 d)
14782 {
14783- u16 l;
14784- u8 hb, lb;
14785+ u16 l;
14786+ u8 hb, lb;
14787
14788- hb = (u8)((d >> 8) & 0xff);
14789- lb = (u8)((d & 0xff));
14790- l = (u16)((lb + 10 * hb) & 0xFF);
14791+ hb = (u8) ((d >> 8) & 0xff);
14792+ lb = (u8) ((d & 0xff));
14793+ l = (u16) ((lb + 10 * hb) & 0xFF);
14794
14795- CLEAR_FLAG(F_CF);
14796- CLEAR_FLAG(F_AF);
14797- CLEAR_FLAG(F_OF);
14798- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
14799- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
14800- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
14801- return l;
14802+ CLEAR_FLAG(F_CF);
14803+ CLEAR_FLAG(F_AF);
14804+ CLEAR_FLAG(F_OF);
14805+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
14806+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
14807+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
14808+ return l;
14809 }
14810
14811 /****************************************************************************
14812 REMARKS:
14813 Implements the AAM instruction and side effects.
14814 ****************************************************************************/
14815-u16 aam_word(u8 d)
14816+u16
14817+aam_word(u8 d)
14818 {
14819 u16 h, l;
14820
14821- h = (u16)(d / 10);
14822- l = (u16)(d % 10);
14823- l |= (u16)(h << 8);
14824+ h = (u16) (d / 10);
14825+ l = (u16) (d % 10);
14826+ l |= (u16) (h << 8);
14827
14828- CLEAR_FLAG(F_CF);
14829- CLEAR_FLAG(F_AF);
14830- CLEAR_FLAG(F_OF);
14831- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
14832- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
14833- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
14834+ CLEAR_FLAG(F_CF);
14835+ CLEAR_FLAG(F_AF);
14836+ CLEAR_FLAG(F_OF);
14837+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
14838+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
14839+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
14840 return l;
14841 }
14842
14843@@ -214,155 +227,161 @@ u16 aam_word(u8 d)
14844 REMARKS:
14845 Implements the ADC instruction and side effects.
14846 ****************************************************************************/
14847-u8 adc_byte(u8 d, u8 s)
14848+u8
14849+adc_byte(u8 d, u8 s)
14850 {
14851- register u32 res; /* all operands in native machine order */
14852- register u32 cc;
14853+ register u32 res; /* all operands in native machine order */
14854+ register u32 cc;
14855
14856- if (ACCESS_FLAG(F_CF))
14857- res = 1 + d + s;
14858- else
14859- res = d + s;
14860+ if (ACCESS_FLAG(F_CF))
14861+ res = 1 + d + s;
14862+ else
14863+ res = d + s;
14864
14865- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
14866- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
14867- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
14868- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14869+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
14870+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
14871+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
14872+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14873
14874- /* calculate the carry chain SEE NOTE AT TOP. */
14875- cc = (s & d) | ((~res) & (s | d));
14876- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
14877- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14878- return (u8)res;
14879+ /* calculate the carry chain SEE NOTE AT TOP. */
14880+ cc = (s & d) | ((~res) & (s | d));
14881+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
14882+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14883+ return (u8) res;
14884 }
14885
14886 /****************************************************************************
14887 REMARKS:
14888 Implements the ADC instruction and side effects.
14889 ****************************************************************************/
14890-u16 adc_word(u16 d, u16 s)
14891+u16
14892+adc_word(u16 d, u16 s)
14893 {
14894- register u32 res; /* all operands in native machine order */
14895- register u32 cc;
14896+ register u32 res; /* all operands in native machine order */
14897+ register u32 cc;
14898
14899- if (ACCESS_FLAG(F_CF))
14900- res = 1 + d + s;
14901- else
14902- res = d + s;
14903+ if (ACCESS_FLAG(F_CF))
14904+ res = 1 + d + s;
14905+ else
14906+ res = d + s;
14907
14908- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
14909- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
14910- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
14911- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14912+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
14913+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
14914+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
14915+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14916
14917- /* calculate the carry chain SEE NOTE AT TOP. */
14918- cc = (s & d) | ((~res) & (s | d));
14919- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
14920- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14921- return (u16)res;
14922+ /* calculate the carry chain SEE NOTE AT TOP. */
14923+ cc = (s & d) | ((~res) & (s | d));
14924+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
14925+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14926+ return (u16) res;
14927 }
14928
14929 /****************************************************************************
14930 REMARKS:
14931 Implements the ADC instruction and side effects.
14932 ****************************************************************************/
14933-u32 adc_long(u32 d, u32 s)
14934+u32
14935+adc_long(u32 d, u32 s)
14936 {
14937- register u32 lo; /* all operands in native machine order */
14938- register u32 hi;
14939- register u32 res;
14940- register u32 cc;
14941+ register u32 lo; /* all operands in native machine order */
14942+ register u32 hi;
14943+ register u32 res;
14944+ register u32 cc;
14945
14946- if (ACCESS_FLAG(F_CF)) {
14947- lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
14948- res = 1 + d + s;
14949- }
14950- else {
14951- lo = (d & 0xFFFF) + (s & 0xFFFF);
14952- res = d + s;
14953- }
14954- hi = (lo >> 16) + (d >> 16) + (s >> 16);
14955+ if (ACCESS_FLAG(F_CF)) {
14956+ lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
14957+ res = 1 + d + s;
14958+ }
14959+ else {
14960+ lo = (d & 0xFFFF) + (s & 0xFFFF);
14961+ res = d + s;
14962+ }
14963+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
14964
14965- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
14966- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
14967- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
14968- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14969+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
14970+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
14971+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
14972+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
14973
14974- /* calculate the carry chain SEE NOTE AT TOP. */
14975- cc = (s & d) | ((~res) & (s | d));
14976- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
14977- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14978- return res;
14979+ /* calculate the carry chain SEE NOTE AT TOP. */
14980+ cc = (s & d) | ((~res) & (s | d));
14981+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
14982+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
14983+ return res;
14984 }
14985
14986 /****************************************************************************
14987 REMARKS:
14988 Implements the ADD instruction and side effects.
14989 ****************************************************************************/
14990-u8 add_byte(u8 d, u8 s)
14991+u8
14992+add_byte(u8 d, u8 s)
14993 {
14994- register u32 res; /* all operands in native machine order */
14995- register u32 cc;
14996+ register u32 res; /* all operands in native machine order */
14997+ register u32 cc;
14998
14999- res = d + s;
15000- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
15001- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15002- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15003- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15004+ res = d + s;
15005+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
15006+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15007+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15008+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15009
15010- /* calculate the carry chain SEE NOTE AT TOP. */
15011- cc = (s & d) | ((~res) & (s | d));
15012- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
15013- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15014- return (u8)res;
15015+ /* calculate the carry chain SEE NOTE AT TOP. */
15016+ cc = (s & d) | ((~res) & (s | d));
15017+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
15018+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15019+ return (u8) res;
15020 }
15021
15022 /****************************************************************************
15023 REMARKS:
15024 Implements the ADD instruction and side effects.
15025 ****************************************************************************/
15026-u16 add_word(u16 d, u16 s)
15027+u16
15028+add_word(u16 d, u16 s)
15029 {
15030- register u32 res; /* all operands in native machine order */
15031- register u32 cc;
15032+ register u32 res; /* all operands in native machine order */
15033+ register u32 cc;
15034
15035- res = d + s;
15036- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
15037- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15038- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15039- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15040+ res = d + s;
15041+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
15042+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15043+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15044+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15045
15046- /* calculate the carry chain SEE NOTE AT TOP. */
15047- cc = (s & d) | ((~res) & (s | d));
15048- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
15049- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15050- return (u16)res;
15051+ /* calculate the carry chain SEE NOTE AT TOP. */
15052+ cc = (s & d) | ((~res) & (s | d));
15053+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
15054+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15055+ return (u16) res;
15056 }
15057
15058 /****************************************************************************
15059 REMARKS:
15060 Implements the ADD instruction and side effects.
15061 ****************************************************************************/
15062-u32 add_long(u32 d, u32 s)
15063+u32
15064+add_long(u32 d, u32 s)
15065 {
15066- register u32 lo; /* all operands in native machine order */
15067- register u32 hi;
15068- register u32 res;
15069- register u32 cc;
15070+ register u32 lo; /* all operands in native machine order */
15071+ register u32 hi;
15072+ register u32 res;
15073+ register u32 cc;
15074
15075- lo = (d & 0xFFFF) + (s & 0xFFFF);
15076- res = d + s;
15077- hi = (lo >> 16) + (d >> 16) + (s >> 16);
15078+ lo = (d & 0xFFFF) + (s & 0xFFFF);
15079+ res = d + s;
15080+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
15081
15082- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
15083- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15084- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15085- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15086+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
15087+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15088+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15089+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15090
15091 /* calculate the carry chain SEE NOTE AT TOP. */
15092 cc = (s & d) | ((~res) & (s | d));
15093- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
15094- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15095+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
15096+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15097
15098 return res;
15099 }
15100@@ -371,39 +390,41 @@ u32 add_long(u32 d, u32 s)
15101 REMARKS:
15102 Implements the AND instruction and side effects.
15103 ****************************************************************************/
15104-u8 and_byte(u8 d, u8 s)
15105+u8
15106+and_byte(u8 d, u8 s)
15107 {
15108- register u8 res; /* all operands in native machine order */
15109+ register u8 res; /* all operands in native machine order */
15110
15111- res = d & s;
15112+ res = d & s;
15113
15114- /* set the flags */
15115- CLEAR_FLAG(F_OF);
15116- CLEAR_FLAG(F_CF);
15117- CLEAR_FLAG(F_AF);
15118- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15119- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15120- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15121- return res;
15122+ /* set the flags */
15123+ CLEAR_FLAG(F_OF);
15124+ CLEAR_FLAG(F_CF);
15125+ CLEAR_FLAG(F_AF);
15126+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15127+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15128+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15129+ return res;
15130 }
15131
15132 /****************************************************************************
15133 REMARKS:
15134 Implements the AND instruction and side effects.
15135 ****************************************************************************/
15136-u16 and_word(u16 d, u16 s)
15137+u16
15138+and_word(u16 d, u16 s)
15139 {
15140- register u16 res; /* all operands in native machine order */
15141+ register u16 res; /* all operands in native machine order */
15142
15143 res = d & s;
15144
15145 /* set the flags */
15146- CLEAR_FLAG(F_OF);
15147- CLEAR_FLAG(F_CF);
15148- CLEAR_FLAG(F_AF);
15149- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15150- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15151- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15152+ CLEAR_FLAG(F_OF);
15153+ CLEAR_FLAG(F_CF);
15154+ CLEAR_FLAG(F_AF);
15155+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15156+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15157+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15158 return res;
15159 }
15160
15161@@ -411,433 +432,456 @@ u16 and_word(u16 d, u16 s)
15162 REMARKS:
15163 Implements the AND instruction and side effects.
15164 ****************************************************************************/
15165-u32 and_long(u32 d, u32 s)
15166+u32
15167+and_long(u32 d, u32 s)
15168 {
15169- register u32 res; /* all operands in native machine order */
15170+ register u32 res; /* all operands in native machine order */
15171
15172- res = d & s;
15173+ res = d & s;
15174
15175- /* set the flags */
15176- CLEAR_FLAG(F_OF);
15177- CLEAR_FLAG(F_CF);
15178- CLEAR_FLAG(F_AF);
15179- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15180- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15181- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15182- return res;
15183+ /* set the flags */
15184+ CLEAR_FLAG(F_OF);
15185+ CLEAR_FLAG(F_CF);
15186+ CLEAR_FLAG(F_AF);
15187+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15188+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15189+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15190+ return res;
15191 }
15192
15193 /****************************************************************************
15194 REMARKS:
15195 Implements the CMP instruction and side effects.
15196 ****************************************************************************/
15197-u8 cmp_byte(u8 d, u8 s)
15198+u8
15199+cmp_byte(u8 d, u8 s)
15200 {
15201- register u32 res; /* all operands in native machine order */
15202- register u32 bc;
15203+ register u32 res; /* all operands in native machine order */
15204+ register u32 bc;
15205
15206- res = d - s;
15207- CLEAR_FLAG(F_CF);
15208- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15209- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15210- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15211+ res = d - s;
15212+ CLEAR_FLAG(F_CF);
15213+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15214+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15215+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15216
15217- /* calculate the borrow chain. See note at top */
15218- bc = (res & (~d | s)) | (~d & s);
15219- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
15220- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15221- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15222- return d;
15223+ /* calculate the borrow chain. See note at top */
15224+ bc = (res & (~d | s)) | (~d & s);
15225+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
15226+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15227+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15228+ return d;
15229 }
15230
15231 /****************************************************************************
15232 REMARKS:
15233 Implements the CMP instruction and side effects.
15234 ****************************************************************************/
15235-u16 cmp_word(u16 d, u16 s)
15236+u16
15237+cmp_word(u16 d, u16 s)
15238 {
15239- register u32 res; /* all operands in native machine order */
15240- register u32 bc;
15241+ register u32 res; /* all operands in native machine order */
15242+ register u32 bc;
15243
15244- res = d - s;
15245- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15246- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15247- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15248+ res = d - s;
15249+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15250+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15251+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15252
15253- /* calculate the borrow chain. See note at top */
15254+ /* calculate the borrow chain. See note at top */
15255 bc = (res & (~d | s)) | (~d & s);
15256- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
15257- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15258- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15259- return d;
15260+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
15261+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15262+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15263+ return d;
15264 }
15265
15266 /****************************************************************************
15267 REMARKS:
15268 Implements the CMP instruction and side effects.
15269 ****************************************************************************/
15270-u32 cmp_long(u32 d, u32 s)
15271+u32
15272+cmp_long(u32 d, u32 s)
15273 {
15274- register u32 res; /* all operands in native machine order */
15275- register u32 bc;
15276+ register u32 res; /* all operands in native machine order */
15277+ register u32 bc;
15278
15279- res = d - s;
15280- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15281- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15282- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15283+ res = d - s;
15284+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15285+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15286+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15287
15288- /* calculate the borrow chain. See note at top */
15289- bc = (res & (~d | s)) | (~d & s);
15290- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
15291- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15292- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15293- return d;
15294+ /* calculate the borrow chain. See note at top */
15295+ bc = (res & (~d | s)) | (~d & s);
15296+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
15297+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15298+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15299+ return d;
15300 }
15301
15302 /****************************************************************************
15303 REMARKS:
15304 Implements the DAA instruction and side effects.
15305 ****************************************************************************/
15306-u8 daa_byte(u8 d)
15307+u8
15308+daa_byte(u8 d)
15309 {
15310- u32 res = d;
15311- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
15312- res += 6;
15313- SET_FLAG(F_AF);
15314- }
15315- if (res > 0x9F || ACCESS_FLAG(F_CF)) {
15316- res += 0x60;
15317- SET_FLAG(F_CF);
15318- }
15319- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15320- CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
15321- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15322- return (u8)res;
15323+ u32 res = d;
15324+
15325+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
15326+ res += 6;
15327+ SET_FLAG(F_AF);
15328+ }
15329+ if (res > 0x9F || ACCESS_FLAG(F_CF)) {
15330+ res += 0x60;
15331+ SET_FLAG(F_CF);
15332+ }
15333+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15334+ CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
15335+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15336+ return (u8) res;
15337 }
15338
15339 /****************************************************************************
15340 REMARKS:
15341 Implements the DAS instruction and side effects.
15342 ****************************************************************************/
15343-u8 das_byte(u8 d)
15344+u8
15345+das_byte(u8 d)
15346 {
15347- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
15348- d -= 6;
15349- SET_FLAG(F_AF);
15350- }
15351- if (d > 0x9F || ACCESS_FLAG(F_CF)) {
15352- d -= 0x60;
15353- SET_FLAG(F_CF);
15354- }
15355- CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
15356- CONDITIONAL_SET_FLAG(d == 0, F_ZF);
15357- CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
15358- return d;
15359+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
15360+ d -= 6;
15361+ SET_FLAG(F_AF);
15362+ }
15363+ if (d > 0x9F || ACCESS_FLAG(F_CF)) {
15364+ d -= 0x60;
15365+ SET_FLAG(F_CF);
15366+ }
15367+ CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
15368+ CONDITIONAL_SET_FLAG(d == 0, F_ZF);
15369+ CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
15370+ return d;
15371 }
15372
15373 /****************************************************************************
15374 REMARKS:
15375 Implements the DEC instruction and side effects.
15376 ****************************************************************************/
15377-u8 dec_byte(u8 d)
15378+u8
15379+dec_byte(u8 d)
15380 {
15381- register u32 res; /* all operands in native machine order */
15382+ register u32 res; /* all operands in native machine order */
15383 register u32 bc;
15384
15385 res = d - 1;
15386- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15387- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15388- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15389+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15390+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15391+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15392
15393- /* calculate the borrow chain. See note at top */
15394- /* based on sub_byte, uses s==1. */
15395- bc = (res & (~d | 1)) | (~d & 1);
15396- /* carry flag unchanged */
15397- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15398- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15399- return (u8)res;
15400+ /* calculate the borrow chain. See note at top */
15401+ /* based on sub_byte, uses s==1. */
15402+ bc = (res & (~d | 1)) | (~d & 1);
15403+ /* carry flag unchanged */
15404+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15405+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15406+ return (u8) res;
15407 }
15408
15409 /****************************************************************************
15410 REMARKS:
15411 Implements the DEC instruction and side effects.
15412 ****************************************************************************/
15413-u16 dec_word(u16 d)
15414+u16
15415+dec_word(u16 d)
15416 {
15417- register u32 res; /* all operands in native machine order */
15418+ register u32 res; /* all operands in native machine order */
15419 register u32 bc;
15420
15421 res = d - 1;
15422- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15423- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15424- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15425+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15426+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15427+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15428
15429 /* calculate the borrow chain. See note at top */
15430 /* based on the sub_byte routine, with s==1 */
15431 bc = (res & (~d | 1)) | (~d & 1);
15432 /* carry flag unchanged */
15433- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15434- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15435- return (u16)res;
15436+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15437+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15438+ return (u16) res;
15439 }
15440
15441 /****************************************************************************
15442 REMARKS:
15443 Implements the DEC instruction and side effects.
15444 ****************************************************************************/
15445-u32 dec_long(u32 d)
15446+u32
15447+dec_long(u32 d)
15448 {
15449- register u32 res; /* all operands in native machine order */
15450+ register u32 res; /* all operands in native machine order */
15451 register u32 bc;
15452
15453 res = d - 1;
15454
15455- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15456- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15457- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15458+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15459+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15460+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15461
15462 /* calculate the borrow chain. See note at top */
15463- bc = (res & (~d | 1)) | (~d & 1);
15464- /* carry flag unchanged */
15465- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15466- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15467- return res;
15468+ bc = (res & (~d | 1)) | (~d & 1);
15469+ /* carry flag unchanged */
15470+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15471+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15472+ return res;
15473 }
15474
15475 /****************************************************************************
15476 REMARKS:
15477 Implements the INC instruction and side effects.
15478 ****************************************************************************/
15479-u8 inc_byte(u8 d)
15480+u8
15481+inc_byte(u8 d)
15482 {
15483- register u32 res; /* all operands in native machine order */
15484- register u32 cc;
15485+ register u32 res; /* all operands in native machine order */
15486+ register u32 cc;
15487
15488- res = d + 1;
15489- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15490- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15491- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15492+ res = d + 1;
15493+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15494+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15495+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15496
15497- /* calculate the carry chain SEE NOTE AT TOP. */
15498- cc = ((1 & d) | (~res)) & (1 | d);
15499- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
15500- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15501- return (u8)res;
15502+ /* calculate the carry chain SEE NOTE AT TOP. */
15503+ cc = ((1 & d) | (~res)) & (1 | d);
15504+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
15505+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15506+ return (u8) res;
15507 }
15508
15509 /****************************************************************************
15510 REMARKS:
15511 Implements the INC instruction and side effects.
15512 ****************************************************************************/
15513-u16 inc_word(u16 d)
15514+u16
15515+inc_word(u16 d)
15516 {
15517- register u32 res; /* all operands in native machine order */
15518- register u32 cc;
15519+ register u32 res; /* all operands in native machine order */
15520+ register u32 cc;
15521
15522- res = d + 1;
15523- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15524- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15525- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15526+ res = d + 1;
15527+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15528+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15529+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15530
15531- /* calculate the carry chain SEE NOTE AT TOP. */
15532- cc = (1 & d) | ((~res) & (1 | d));
15533- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
15534- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15535- return (u16)res;
15536+ /* calculate the carry chain SEE NOTE AT TOP. */
15537+ cc = (1 & d) | ((~res) & (1 | d));
15538+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
15539+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15540+ return (u16) res;
15541 }
15542
15543 /****************************************************************************
15544 REMARKS:
15545 Implements the INC instruction and side effects.
15546 ****************************************************************************/
15547-u32 inc_long(u32 d)
15548+u32
15549+inc_long(u32 d)
15550 {
15551- register u32 res; /* all operands in native machine order */
15552- register u32 cc;
15553+ register u32 res; /* all operands in native machine order */
15554+ register u32 cc;
15555
15556- res = d + 1;
15557- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15558- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15559- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15560+ res = d + 1;
15561+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15562+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15563+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15564
15565- /* calculate the carry chain SEE NOTE AT TOP. */
15566- cc = (1 & d) | ((~res) & (1 | d));
15567- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
15568- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15569- return res;
15570+ /* calculate the carry chain SEE NOTE AT TOP. */
15571+ cc = (1 & d) | ((~res) & (1 | d));
15572+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
15573+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
15574+ return res;
15575 }
15576
15577 /****************************************************************************
15578 REMARKS:
15579 Implements the OR instruction and side effects.
15580 ****************************************************************************/
15581-u8 or_byte(u8 d, u8 s)
15582+u8
15583+or_byte(u8 d, u8 s)
15584 {
15585- register u8 res; /* all operands in native machine order */
15586+ register u8 res; /* all operands in native machine order */
15587
15588- res = d | s;
15589- CLEAR_FLAG(F_OF);
15590- CLEAR_FLAG(F_CF);
15591- CLEAR_FLAG(F_AF);
15592- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15593- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15594- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15595- return res;
15596+ res = d | s;
15597+ CLEAR_FLAG(F_OF);
15598+ CLEAR_FLAG(F_CF);
15599+ CLEAR_FLAG(F_AF);
15600+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15601+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15602+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15603+ return res;
15604 }
15605
15606 /****************************************************************************
15607 REMARKS:
15608 Implements the OR instruction and side effects.
15609 ****************************************************************************/
15610-u16 or_word(u16 d, u16 s)
15611+u16
15612+or_word(u16 d, u16 s)
15613 {
15614- register u16 res; /* all operands in native machine order */
15615+ register u16 res; /* all operands in native machine order */
15616
15617- res = d | s;
15618- /* set the carry flag to be bit 8 */
15619- CLEAR_FLAG(F_OF);
15620- CLEAR_FLAG(F_CF);
15621- CLEAR_FLAG(F_AF);
15622- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15623- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15624- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15625- return res;
15626+ res = d | s;
15627+ /* set the carry flag to be bit 8 */
15628+ CLEAR_FLAG(F_OF);
15629+ CLEAR_FLAG(F_CF);
15630+ CLEAR_FLAG(F_AF);
15631+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15632+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15633+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15634+ return res;
15635 }
15636
15637 /****************************************************************************
15638 REMARKS:
15639 Implements the OR instruction and side effects.
15640 ****************************************************************************/
15641-u32 or_long(u32 d, u32 s)
15642+u32
15643+or_long(u32 d, u32 s)
15644 {
15645- register u32 res; /* all operands in native machine order */
15646+ register u32 res; /* all operands in native machine order */
15647
15648- res = d | s;
15649+ res = d | s;
15650
15651- /* set the carry flag to be bit 8 */
15652- CLEAR_FLAG(F_OF);
15653- CLEAR_FLAG(F_CF);
15654- CLEAR_FLAG(F_AF);
15655- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15656- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15657- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15658- return res;
15659+ /* set the carry flag to be bit 8 */
15660+ CLEAR_FLAG(F_OF);
15661+ CLEAR_FLAG(F_CF);
15662+ CLEAR_FLAG(F_AF);
15663+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15664+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
15665+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15666+ return res;
15667 }
15668
15669 /****************************************************************************
15670 REMARKS:
15671 Implements the OR instruction and side effects.
15672 ****************************************************************************/
15673-u8 neg_byte(u8 s)
15674+u8
15675+neg_byte(u8 s)
15676 {
15677 register u8 res;
15678 register u8 bc;
15679
15680- CONDITIONAL_SET_FLAG(s != 0, F_CF);
15681- res = (u8)-s;
15682- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15683- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15684- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15685- /* calculate the borrow chain --- modified such that d=0.
15686- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15687- (the one used for sub) and simplifying, since ~d=0xff...,
15688- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15689- ~d&s == s. So the simplified result is: */
15690- bc = res | s;
15691- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15692- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15693- return res;
15694+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
15695+ res = (u8) - s;
15696+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
15697+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
15698+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
15699+ /* calculate the borrow chain --- modified such that d=0.
15700+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15701+ (the one used for sub) and simplifying, since ~d=0xff...,
15702+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15703+ ~d&s == s. So the simplified result is: */
15704+ bc = res | s;
15705+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
15706+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15707+ return res;
15708 }
15709
15710 /****************************************************************************
15711 REMARKS:
15712 Implements the OR instruction and side effects.
15713 ****************************************************************************/
15714-u16 neg_word(u16 s)
15715-{
15716- register u16 res;
15717- register u16 bc;
15718-
15719- CONDITIONAL_SET_FLAG(s != 0, F_CF);
15720- res = (u16)-s;
15721- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15722- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15723- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15724-
15725- /* calculate the borrow chain --- modified such that d=0.
15726- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15727- (the one used for sub) and simplifying, since ~d=0xff...,
15728- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15729- ~d&s == s. So the simplified result is: */
15730- bc = res | s;
15731- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15732- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15733- return res;
15734+u16
15735+neg_word(u16 s)
15736+{
15737+ register u16 res;
15738+ register u16 bc;
15739+
15740+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
15741+ res = (u16) - s;
15742+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
15743+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
15744+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15745+
15746+ /* calculate the borrow chain --- modified such that d=0.
15747+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15748+ (the one used for sub) and simplifying, since ~d=0xff...,
15749+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15750+ ~d&s == s. So the simplified result is: */
15751+ bc = res | s;
15752+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
15753+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15754+ return res;
15755 }
15756
15757 /****************************************************************************
15758 REMARKS:
15759 Implements the OR instruction and side effects.
15760 ****************************************************************************/
15761-u32 neg_long(u32 s)
15762+u32
15763+neg_long(u32 s)
15764 {
15765- register u32 res;
15766- register u32 bc;
15767-
15768- CONDITIONAL_SET_FLAG(s != 0, F_CF);
15769- res = (u32)-s;
15770- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15771- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15772- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15773+ register u32 res;
15774+ register u32 bc;
15775
15776- /* calculate the borrow chain --- modified such that d=0.
15777- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15778- (the one used for sub) and simplifying, since ~d=0xff...,
15779- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15780- ~d&s == s. So the simplified result is: */
15781- bc = res | s;
15782- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15783- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15784- return res;
15785+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
15786+ res = (u32) - s;
15787+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
15788+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
15789+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
15790+
15791+ /* calculate the borrow chain --- modified such that d=0.
15792+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
15793+ (the one used for sub) and simplifying, since ~d=0xff...,
15794+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
15795+ ~d&s == s. So the simplified result is: */
15796+ bc = res | s;
15797+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
15798+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
15799+ return res;
15800 }
15801
15802 /****************************************************************************
15803 REMARKS:
15804 Implements the NOT instruction and side effects.
15805 ****************************************************************************/
15806-u8 not_byte(u8 s)
15807+u8
15808+not_byte(u8 s)
15809 {
15810- return ~s;
15811+ return ~s;
15812 }
15813
15814 /****************************************************************************
15815 REMARKS:
15816 Implements the NOT instruction and side effects.
15817 ****************************************************************************/
15818-u16 not_word(u16 s)
15819+u16
15820+not_word(u16 s)
15821 {
15822- return ~s;
15823+ return ~s;
15824 }
15825
15826 /****************************************************************************
15827 REMARKS:
15828 Implements the NOT instruction and side effects.
15829 ****************************************************************************/
15830-u32 not_long(u32 s)
15831+u32
15832+not_long(u32 s)
15833 {
15834- return ~s;
15835+ return ~s;
15836 }
15837
15838 /****************************************************************************
15839 REMARKS:
15840 Implements the RCL instruction and side effects.
15841 ****************************************************************************/
15842-u8 rcl_byte(u8 d, u8 s)
15843+u8
15844+rcl_byte(u8 d, u8 s)
15845 {
15846 register unsigned int res, cnt, mask, cf;
15847
15848 /* s is the rotate distance. It varies from 0 - 8. */
15849- /* have
15850+ /* have
15851
15852 CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
15853
15854@@ -861,9 +905,9 @@ u8 rcl_byte(u8 d, u8 s)
15855 2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0
15856 3) B_(n-1) <- cf
15857 4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1))
15858- */
15859- res = d;
15860- if ((cnt = s % 9) != 0) {
15861+ */
15862+ res = d;
15863+ if ((cnt = s % 9) != 0) {
15864 /* extract the new CARRY FLAG. */
15865 /* CF <- b_(8-n) */
15866 cf = (d >> (8 - cnt)) & 0x1;
15867@@ -872,7 +916,7 @@ u8 rcl_byte(u8 d, u8 s)
15868 into the range B_7 .. B_cnt */
15869 /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
15870 /* note that the right hand side done by the mask */
15871- res = (d << cnt) & 0xff;
15872+ res = (d << cnt) & 0xff;
15873
15874 /* now the high stuff which rotated around
15875 into the positions B_cnt-2 .. B_0 */
15876@@ -884,81 +928,81 @@ u8 rcl_byte(u8 d, u8 s)
15877 res |= (d >> (9 - cnt)) & mask;
15878
15879 /* if the carry flag was set, or it in. */
15880- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
15881+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
15882 /* B_(n-1) <- cf */
15883 res |= 1 << (cnt - 1);
15884 }
15885 /* set the new carry flag, based on the variable "cf" */
15886- CONDITIONAL_SET_FLAG(cf, F_CF);
15887+ CONDITIONAL_SET_FLAG(cf, F_CF);
15888 /* OVERFLOW is set *IFF* cnt==1, then it is the
15889 xor of CF and the most significant bit. Blecck. */
15890 /* parenthesized this expression since it appears to
15891 be causing OF to be misset */
15892- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
15893- F_OF);
15894+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), F_OF);
15895
15896 }
15897- return (u8)res;
15898+ return (u8) res;
15899 }
15900
15901 /****************************************************************************
15902 REMARKS:
15903 Implements the RCL instruction and side effects.
15904 ****************************************************************************/
15905-u16 rcl_word(u16 d, u8 s)
15906+u16
15907+rcl_word(u16 d, u8 s)
15908 {
15909- register unsigned int res, cnt, mask, cf;
15910+ register unsigned int res, cnt, mask, cf;
15911
15912- res = d;
15913- if ((cnt = s % 17) != 0) {
15914- cf = (d >> (16 - cnt)) & 0x1;
15915- res = (d << cnt) & 0xffff;
15916- mask = (1 << (cnt - 1)) - 1;
15917- res |= (d >> (17 - cnt)) & mask;
15918- if (ACCESS_FLAG(F_CF)) {
15919- res |= 1 << (cnt - 1);
15920- }
15921- CONDITIONAL_SET_FLAG(cf, F_CF);
15922- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)),
15923- F_OF);
15924- }
15925- return (u16)res;
15926+ res = d;
15927+ if ((cnt = s % 17) != 0) {
15928+ cf = (d >> (16 - cnt)) & 0x1;
15929+ res = (d << cnt) & 0xffff;
15930+ mask = (1 << (cnt - 1)) - 1;
15931+ res |= (d >> (17 - cnt)) & mask;
15932+ if (ACCESS_FLAG(F_CF)) {
15933+ res |= 1 << (cnt - 1);
15934+ }
15935+ CONDITIONAL_SET_FLAG(cf, F_CF);
15936+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), F_OF);
15937+ }
15938+ return (u16) res;
15939 }
15940
15941 /****************************************************************************
15942 REMARKS:
15943 Implements the RCL instruction and side effects.
15944 ****************************************************************************/
15945-u32 rcl_long(u32 d, u8 s)
15946+u32
15947+rcl_long(u32 d, u8 s)
15948 {
15949- register u32 res, cnt, mask, cf;
15950+ register u32 res, cnt, mask, cf;
15951
15952- res = d;
15953- if ((cnt = s % 33) != 0) {
15954- cf = (d >> (32 - cnt)) & 0x1;
15955- res = (d << cnt) & 0xffffffff;
15956- mask = (1 << (cnt - 1)) - 1;
15957- res |= (d >> (33 - cnt)) & mask;
15958- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
15959- res |= 1 << (cnt - 1);
15960- }
15961- CONDITIONAL_SET_FLAG(cf, F_CF);
15962- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)),
15963- F_OF);
15964- }
15965- return res;
15966+ res = d;
15967+ if ((cnt = s % 33) != 0) {
15968+ cf = (d >> (32 - cnt)) & 0x1;
15969+ res = (d << cnt) & 0xffffffff;
15970+ mask = (1 << (cnt - 1)) - 1;
15971+ res |= (d >> (33 - cnt)) & mask;
15972+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
15973+ res |= 1 << (cnt - 1);
15974+ }
15975+ CONDITIONAL_SET_FLAG(cf, F_CF);
15976+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), F_OF);
15977+ }
15978+ return res;
15979 }
15980
15981 /****************************************************************************
15982 REMARKS:
15983 Implements the RCR instruction and side effects.
15984 ****************************************************************************/
15985-u8 rcr_byte(u8 d, u8 s)
15986+u8
15987+rcr_byte(u8 d, u8 s)
15988 {
15989- u32 res, cnt;
15990- u32 mask, cf, ocf = 0;
15991+ u32 res, cnt;
15992+ u32 mask, cf, ocf = 0;
15993
15994- /* rotate right through carry */
15995+ /* rotate right through carry */
15996 /*
15997 s is the rotate distance. It varies from 0 - 8.
15998 d is the byte object rotated.
15999@@ -979,9 +1023,9 @@ u8 rcr_byte(u8 d, u8 s)
16000 2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
16001 3) B_(8-n) <- cf
16002 4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0)
16003- */
16004- res = d;
16005- if ((cnt = s % 9) != 0) {
16006+ */
16007+ res = d;
16008+ if ((cnt = s % 9) != 0) {
16009 /* extract the new CARRY FLAG. */
16010 /* CF <- b_(n-1) */
16011 if (cnt == 1) {
16012@@ -990,11 +1034,12 @@ u8 rcr_byte(u8 d, u8 s)
16013 0 if flag not set
16014 non-zero if flag is set.
16015 doing access_flag(..) != 0 casts that into either
16016- 0..1 in any representation of the flags register
16017+ 0..1 in any representation of the flags register
16018 (i.e. packed bit array or unpacked.)
16019 */
16020- ocf = ACCESS_FLAG(F_CF) != 0;
16021- } else
16022+ ocf = ACCESS_FLAG(F_CF) != 0;
16023+ }
16024+ else
16025 cf = (d >> (cnt - 1)) & 0x1;
16026
16027 /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
16028@@ -1016,93 +1061,95 @@ u8 rcr_byte(u8 d, u8 s)
16029 res |= (d << (9 - cnt));
16030
16031 /* if the carry flag was set, or it in. */
16032- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
16033+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
16034 /* B_(8-n) <- cf */
16035 res |= 1 << (8 - cnt);
16036 }
16037 /* set the new carry flag, based on the variable "cf" */
16038- CONDITIONAL_SET_FLAG(cf, F_CF);
16039+ CONDITIONAL_SET_FLAG(cf, F_CF);
16040 /* OVERFLOW is set *IFF* cnt==1, then it is the
16041 xor of CF and the most significant bit. Blecck. */
16042 /* parenthesized... */
16043- if (cnt == 1) {
16044- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)),
16045- F_OF);
16046- }
16047- }
16048- return (u8)res;
16049+ if (cnt == 1) {
16050+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)), F_OF);
16051+ }
16052+ }
16053+ return (u8) res;
16054 }
16055
16056 /****************************************************************************
16057 REMARKS:
16058 Implements the RCR instruction and side effects.
16059 ****************************************************************************/
16060-u16 rcr_word(u16 d, u8 s)
16061+u16
16062+rcr_word(u16 d, u8 s)
16063 {
16064- u32 res, cnt;
16065- u32 mask, cf, ocf = 0;
16066+ u32 res, cnt;
16067+ u32 mask, cf, ocf = 0;
16068
16069- /* rotate right through carry */
16070- res = d;
16071- if ((cnt = s % 17) != 0) {
16072- if (cnt == 1) {
16073- cf = d & 0x1;
16074- ocf = ACCESS_FLAG(F_CF) != 0;
16075- } else
16076- cf = (d >> (cnt - 1)) & 0x1;
16077- mask = (1 << (16 - cnt)) - 1;
16078- res = (d >> cnt) & mask;
16079- res |= (d << (17 - cnt));
16080- if (ACCESS_FLAG(F_CF)) {
16081- res |= 1 << (16 - cnt);
16082- }
16083- CONDITIONAL_SET_FLAG(cf, F_CF);
16084- if (cnt == 1) {
16085- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)),
16086- F_OF);
16087- }
16088- }
16089- return (u16)res;
16090+ /* rotate right through carry */
16091+ res = d;
16092+ if ((cnt = s % 17) != 0) {
16093+ if (cnt == 1) {
16094+ cf = d & 0x1;
16095+ ocf = ACCESS_FLAG(F_CF) != 0;
16096+ }
16097+ else
16098+ cf = (d >> (cnt - 1)) & 0x1;
16099+ mask = (1 << (16 - cnt)) - 1;
16100+ res = (d >> cnt) & mask;
16101+ res |= (d << (17 - cnt));
16102+ if (ACCESS_FLAG(F_CF)) {
16103+ res |= 1 << (16 - cnt);
16104+ }
16105+ CONDITIONAL_SET_FLAG(cf, F_CF);
16106+ if (cnt == 1) {
16107+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)), F_OF);
16108+ }
16109+ }
16110+ return (u16) res;
16111 }
16112
16113 /****************************************************************************
16114 REMARKS:
16115 Implements the RCR instruction and side effects.
16116 ****************************************************************************/
16117-u32 rcr_long(u32 d, u8 s)
16118-{
16119- u32 res, cnt;
16120- u32 mask, cf, ocf = 0;
16121-
16122- /* rotate right through carry */
16123- res = d;
16124- if ((cnt = s % 33) != 0) {
16125- if (cnt == 1) {
16126- cf = d & 0x1;
16127- ocf = ACCESS_FLAG(F_CF) != 0;
16128- } else
16129- cf = (d >> (cnt - 1)) & 0x1;
16130- mask = (1 << (32 - cnt)) - 1;
16131- res = (d >> cnt) & mask;
16132- if (cnt != 1)
16133- res |= (d << (33 - cnt));
16134- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
16135- res |= 1 << (32 - cnt);
16136- }
16137- CONDITIONAL_SET_FLAG(cf, F_CF);
16138- if (cnt == 1) {
16139- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)),
16140- F_OF);
16141- }
16142- }
16143- return res;
16144+u32
16145+rcr_long(u32 d, u8 s)
16146+{
16147+ u32 res, cnt;
16148+ u32 mask, cf, ocf = 0;
16149+
16150+ /* rotate right through carry */
16151+ res = d;
16152+ if ((cnt = s % 33) != 0) {
16153+ if (cnt == 1) {
16154+ cf = d & 0x1;
16155+ ocf = ACCESS_FLAG(F_CF) != 0;
16156+ }
16157+ else
16158+ cf = (d >> (cnt - 1)) & 0x1;
16159+ mask = (1 << (32 - cnt)) - 1;
16160+ res = (d >> cnt) & mask;
16161+ if (cnt != 1)
16162+ res |= (d << (33 - cnt));
16163+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
16164+ res |= 1 << (32 - cnt);
16165+ }
16166+ CONDITIONAL_SET_FLAG(cf, F_CF);
16167+ if (cnt == 1) {
16168+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)), F_OF);
16169+ }
16170+ }
16171+ return res;
16172 }
16173
16174 /****************************************************************************
16175 REMARKS:
16176 Implements the ROL instruction and side effects.
16177 ****************************************************************************/
16178-u8 rol_byte(u8 d, u8 s)
16179+u8
16180+rol_byte(u8 d, u8 s)
16181 {
16182 register unsigned int res, cnt, mask;
16183
16184@@ -1121,87 +1168,90 @@ u8 rol_byte(u8 d, u8 s)
16185 IF n > 0
16186 1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0)
16187 2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n)
16188- */
16189+ */
16190 res = d;
16191- if ((cnt = s % 8) != 0) {
16192- /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
16193- res = (d << cnt);
16194+ if ((cnt = s % 8) != 0) {
16195+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
16196+ res = (d << cnt);
16197
16198- /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
16199- mask = (1 << cnt) - 1;
16200- res |= (d >> (8 - cnt)) & mask;
16201+ /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
16202+ mask = (1 << cnt) - 1;
16203+ res |= (d >> (8 - cnt)) & mask;
16204
16205- /* set the new carry flag, Note that it is the low order
16206- bit of the result!!! */
16207- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16208- /* OVERFLOW is set *IFF* s==1, then it is the
16209- xor of CF and the most significant bit. Blecck. */
16210- CONDITIONAL_SET_FLAG(s == 1 &&
16211- XOR2((res & 0x1) + ((res >> 6) & 0x2)),
16212- F_OF);
16213- } if (s != 0) {
16214- /* set the new carry flag, Note that it is the low order
16215- bit of the result!!! */
16216- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16217- }
16218- return (u8)res;
16219+ /* set the new carry flag, Note that it is the low order
16220+ bit of the result!!! */
16221+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16222+ /* OVERFLOW is set *IFF* s==1, then it is the
16223+ xor of CF and the most significant bit. Blecck. */
16224+ CONDITIONAL_SET_FLAG(s == 1 &&
16225+ XOR2((res & 0x1) + ((res >> 6) & 0x2)), F_OF);
16226+ }
16227+ if (s != 0) {
16228+ /* set the new carry flag, Note that it is the low order
16229+ bit of the result!!! */
16230+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16231+ }
16232+ return (u8) res;
16233 }
16234
16235 /****************************************************************************
16236 REMARKS:
16237 Implements the ROL instruction and side effects.
16238 ****************************************************************************/
16239-u16 rol_word(u16 d, u8 s)
16240+u16
16241+rol_word(u16 d, u8 s)
16242 {
16243 register unsigned int res, cnt, mask;
16244
16245- res = d;
16246- if ((cnt = s % 16) != 0) {
16247- res = (d << cnt);
16248- mask = (1 << cnt) - 1;
16249- res |= (d >> (16 - cnt)) & mask;
16250- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16251- CONDITIONAL_SET_FLAG(s == 1 &&
16252- XOR2((res & 0x1) + ((res >> 14) & 0x2)),
16253- F_OF);
16254- } if (s != 0) {
16255- /* set the new carry flag, Note that it is the low order
16256- bit of the result!!! */
16257- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16258- }
16259- return (u16)res;
16260+ res = d;
16261+ if ((cnt = s % 16) != 0) {
16262+ res = (d << cnt);
16263+ mask = (1 << cnt) - 1;
16264+ res |= (d >> (16 - cnt)) & mask;
16265+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16266+ CONDITIONAL_SET_FLAG(s == 1 &&
16267+ XOR2((res & 0x1) + ((res >> 14) & 0x2)), F_OF);
16268+ }
16269+ if (s != 0) {
16270+ /* set the new carry flag, Note that it is the low order
16271+ bit of the result!!! */
16272+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16273+ }
16274+ return (u16) res;
16275 }
16276
16277 /****************************************************************************
16278 REMARKS:
16279 Implements the ROL instruction and side effects.
16280 ****************************************************************************/
16281-u32 rol_long(u32 d, u8 s)
16282+u32
16283+rol_long(u32 d, u8 s)
16284 {
16285 register u32 res, cnt, mask;
16286
16287- res = d;
16288- if ((cnt = s % 32) != 0) {
16289- res = (d << cnt);
16290- mask = (1 << cnt) - 1;
16291- res |= (d >> (32 - cnt)) & mask;
16292- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16293- CONDITIONAL_SET_FLAG(s == 1 &&
16294- XOR2((res & 0x1) + ((res >> 30) & 0x2)),
16295- F_OF);
16296- } if (s != 0) {
16297- /* set the new carry flag, Note that it is the low order
16298- bit of the result!!! */
16299- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16300- }
16301- return res;
16302+ res = d;
16303+ if ((cnt = s % 32) != 0) {
16304+ res = (d << cnt);
16305+ mask = (1 << cnt) - 1;
16306+ res |= (d >> (32 - cnt)) & mask;
16307+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16308+ CONDITIONAL_SET_FLAG(s == 1 &&
16309+ XOR2((res & 0x1) + ((res >> 30) & 0x2)), F_OF);
16310+ }
16311+ if (s != 0) {
16312+ /* set the new carry flag, Note that it is the low order
16313+ bit of the result!!! */
16314+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
16315+ }
16316+ return res;
16317 }
16318
16319 /****************************************************************************
16320 REMARKS:
16321 Implements the ROR instruction and side effects.
16322 ****************************************************************************/
16323-u8 ror_byte(u8 d, u8 s)
16324+u8
16325+ror_byte(u8 d, u8 s)
16326 {
16327 register unsigned int res, cnt, mask;
16328
16329@@ -1219,9 +1269,9 @@ u8 ror_byte(u8 d, u8 s)
16330 IF n > 0
16331 1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
16332 2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0)
16333- */
16334- res = d;
16335- if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
16336+ */
16337+ res = d;
16338+ if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
16339 /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
16340 res = (d << (8 - cnt));
16341
16342@@ -1231,291 +1281,317 @@ u8 ror_byte(u8 d, u8 s)
16343
16344 /* set the new carry flag, Note that it is the low order
16345 bit of the result!!! */
16346- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
16347- /* OVERFLOW is set *IFF* s==1, then it is the
16348+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
16349+ /* OVERFLOW is set *IFF* s==1, then it is the
16350 xor of the two most significant bits. Blecck. */
16351- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
16352- } else if (s != 0) {
16353- /* set the new carry flag, Note that it is the low order
16354- bit of the result!!! */
16355- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
16356- }
16357- return (u8)res;
16358+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
16359+ }
16360+ else if (s != 0) {
16361+ /* set the new carry flag, Note that it is the low order
16362+ bit of the result!!! */
16363+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
16364+ }
16365+ return (u8) res;
16366 }
16367
16368 /****************************************************************************
16369 REMARKS:
16370 Implements the ROR instruction and side effects.
16371 ****************************************************************************/
16372-u16 ror_word(u16 d, u8 s)
16373+u16
16374+ror_word(u16 d, u8 s)
16375 {
16376 register unsigned int res, cnt, mask;
16377
16378- res = d;
16379- if ((cnt = s % 16) != 0) {
16380- res = (d << (16 - cnt));
16381- mask = (1 << (16 - cnt)) - 1;
16382- res |= (d >> (cnt)) & mask;
16383- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
16384- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
16385- } else if (s != 0) {
16386- /* set the new carry flag, Note that it is the low order
16387- bit of the result!!! */
16388- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
16389- }
16390- return (u16)res;
16391+ res = d;
16392+ if ((cnt = s % 16) != 0) {
16393+ res = (d << (16 - cnt));
16394+ mask = (1 << (16 - cnt)) - 1;
16395+ res |= (d >> (cnt)) & mask;
16396+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
16397+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
16398+ }
16399+ else if (s != 0) {
16400+ /* set the new carry flag, Note that it is the low order
16401+ bit of the result!!! */
16402+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
16403+ }
16404+ return (u16) res;
16405 }
16406
16407 /****************************************************************************
16408 REMARKS:
16409 Implements the ROR instruction and side effects.
16410 ****************************************************************************/
16411-u32 ror_long(u32 d, u8 s)
16412+u32
16413+ror_long(u32 d, u8 s)
16414 {
16415- register u32 res, cnt, mask;
16416+ register u32 res, cnt, mask;
16417
16418- res = d;
16419- if ((cnt = s % 32) != 0) {
16420- res = (d << (32 - cnt));
16421- mask = (1 << (32 - cnt)) - 1;
16422- res |= (d >> (cnt)) & mask;
16423- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
16424- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
16425- } else if (s != 0) {
16426- /* set the new carry flag, Note that it is the low order
16427- bit of the result!!! */
16428- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
16429- }
16430- return res;
16431+ res = d;
16432+ if ((cnt = s % 32) != 0) {
16433+ res = (d << (32 - cnt));
16434+ mask = (1 << (32 - cnt)) - 1;
16435+ res |= (d >> (cnt)) & mask;
16436+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
16437+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
16438+ }
16439+ else if (s != 0) {
16440+ /* set the new carry flag, Note that it is the low order
16441+ bit of the result!!! */
16442+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
16443+ }
16444+ return res;
16445 }
16446
16447 /****************************************************************************
16448 REMARKS:
16449 Implements the SHL instruction and side effects.
16450 ****************************************************************************/
16451-u8 shl_byte(u8 d, u8 s)
16452+u8
16453+shl_byte(u8 d, u8 s)
16454 {
16455- unsigned int cnt, res, cf;
16456-
16457- if (s < 8) {
16458- cnt = s % 8;
16459+ unsigned int cnt, res, cf;
16460
16461- /* last bit shifted out goes into carry flag */
16462- if (cnt > 0) {
16463- res = d << cnt;
16464- cf = d & (1 << (8 - cnt));
16465- CONDITIONAL_SET_FLAG(cf, F_CF);
16466- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16467- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16468- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16469- } else {
16470- res = (u8) d;
16471- }
16472+ if (s < 8) {
16473+ cnt = s % 8;
16474+
16475+ /* last bit shifted out goes into carry flag */
16476+ if (cnt > 0) {
16477+ res = d << cnt;
16478+ cf = d & (1 << (8 - cnt));
16479+ CONDITIONAL_SET_FLAG(cf, F_CF);
16480+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16481+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16482+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16483+ }
16484+ else {
16485+ res = (u8) d;
16486+ }
16487
16488- if (cnt == 1) {
16489- /* Needs simplification. */
16490- CONDITIONAL_SET_FLAG(
16491- (((res & 0x80) == 0x80) ^
16492- (ACCESS_FLAG(F_CF) != 0)),
16493- /* was (M.x86.R_FLG&F_CF)==F_CF)), */
16494- F_OF);
16495- } else {
16496- CLEAR_FLAG(F_OF);
16497- }
16498- } else {
16499- res = 0;
16500- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80, F_CF);
16501- CLEAR_FLAG(F_OF);
16502- CLEAR_FLAG(F_SF);
16503- SET_FLAG(F_PF);
16504- SET_FLAG(F_ZF);
16505+ if (cnt == 1) {
16506+ /* Needs simplification. */
16507+ CONDITIONAL_SET_FLAG((((res & 0x80) == 0x80) ^
16508+ (ACCESS_FLAG(F_CF) != 0)),
16509+ /* was (M.x86.R_FLG&F_CF)==F_CF)), */
16510+ F_OF);
16511+ }
16512+ else {
16513+ CLEAR_FLAG(F_OF);
16514+ }
16515 }
16516- return (u8)res;
16517+ else {
16518+ res = 0;
16519+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80, F_CF);
16520+ CLEAR_FLAG(F_OF);
16521+ CLEAR_FLAG(F_SF);
16522+ SET_FLAG(F_PF);
16523+ SET_FLAG(F_ZF);
16524+ }
16525+ return (u8) res;
16526 }
16527
16528 /****************************************************************************
16529 REMARKS:
16530 Implements the SHL instruction and side effects.
16531 ****************************************************************************/
16532-u16 shl_word(u16 d, u8 s)
16533+u16
16534+shl_word(u16 d, u8 s)
16535 {
16536 unsigned int cnt, res, cf;
16537
16538- if (s < 16) {
16539- cnt = s % 16;
16540- if (cnt > 0) {
16541- res = d << cnt;
16542- cf = d & (1 << (16 - cnt));
16543- CONDITIONAL_SET_FLAG(cf, F_CF);
16544- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16545- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16546- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16547- } else {
16548- res = (u16) d;
16549- }
16550-
16551- if (cnt == 1) {
16552- CONDITIONAL_SET_FLAG(
16553- (((res & 0x8000) == 0x8000) ^
16554- (ACCESS_FLAG(F_CF) != 0)),
16555- F_OF);
16556- } else {
16557- CLEAR_FLAG(F_OF);
16558- }
16559- } else {
16560- res = 0;
16561- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
16562- CLEAR_FLAG(F_OF);
16563- CLEAR_FLAG(F_SF);
16564- SET_FLAG(F_PF);
16565- SET_FLAG(F_ZF);
16566- }
16567- return (u16)res;
16568+ if (s < 16) {
16569+ cnt = s % 16;
16570+ if (cnt > 0) {
16571+ res = d << cnt;
16572+ cf = d & (1 << (16 - cnt));
16573+ CONDITIONAL_SET_FLAG(cf, F_CF);
16574+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16575+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16576+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16577+ }
16578+ else {
16579+ res = (u16) d;
16580+ }
16581+
16582+ if (cnt == 1) {
16583+ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
16584+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
16585+ }
16586+ else {
16587+ CLEAR_FLAG(F_OF);
16588+ }
16589+ }
16590+ else {
16591+ res = 0;
16592+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
16593+ CLEAR_FLAG(F_OF);
16594+ CLEAR_FLAG(F_SF);
16595+ SET_FLAG(F_PF);
16596+ SET_FLAG(F_ZF);
16597+ }
16598+ return (u16) res;
16599 }
16600
16601 /****************************************************************************
16602 REMARKS:
16603 Implements the SHL instruction and side effects.
16604 ****************************************************************************/
16605-u32 shl_long(u32 d, u8 s)
16606-{
16607- unsigned int cnt, res, cf;
16608-
16609- if (s < 32) {
16610- cnt = s % 32;
16611- if (cnt > 0) {
16612- res = d << cnt;
16613- cf = d & (1 << (32 - cnt));
16614- CONDITIONAL_SET_FLAG(cf, F_CF);
16615- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
16616- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
16617- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16618- } else {
16619- res = d;
16620- }
16621- if (cnt == 1) {
16622- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
16623- (ACCESS_FLAG(F_CF) != 0)), F_OF);
16624- } else {
16625- CLEAR_FLAG(F_OF);
16626- }
16627- } else {
16628- res = 0;
16629- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
16630- CLEAR_FLAG(F_OF);
16631- CLEAR_FLAG(F_SF);
16632- SET_FLAG(F_PF);
16633- SET_FLAG(F_ZF);
16634- }
16635- return res;
16636+u32
16637+shl_long(u32 d, u8 s)
16638+{
16639+ unsigned int cnt, res, cf;
16640+
16641+ if (s < 32) {
16642+ cnt = s % 32;
16643+ if (cnt > 0) {
16644+ res = d << cnt;
16645+ cf = d & (1 << (32 - cnt));
16646+ CONDITIONAL_SET_FLAG(cf, F_CF);
16647+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
16648+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
16649+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16650+ }
16651+ else {
16652+ res = d;
16653+ }
16654+ if (cnt == 1) {
16655+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
16656+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
16657+ }
16658+ else {
16659+ CLEAR_FLAG(F_OF);
16660+ }
16661+ }
16662+ else {
16663+ res = 0;
16664+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
16665+ CLEAR_FLAG(F_OF);
16666+ CLEAR_FLAG(F_SF);
16667+ SET_FLAG(F_PF);
16668+ SET_FLAG(F_ZF);
16669+ }
16670+ return res;
16671 }
16672
16673 /****************************************************************************
16674 REMARKS:
16675 Implements the SHR instruction and side effects.
16676 ****************************************************************************/
16677-u8 shr_byte(u8 d, u8 s)
16678-{
16679- unsigned int cnt, res, cf;
16680-
16681- if (s < 8) {
16682- cnt = s % 8;
16683- if (cnt > 0) {
16684- cf = d & (1 << (cnt - 1));
16685- res = d >> cnt;
16686- CONDITIONAL_SET_FLAG(cf, F_CF);
16687- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16688- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16689- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16690- } else {
16691- res = (u8) d;
16692- }
16693-
16694- if (cnt == 1) {
16695- CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
16696- } else {
16697- CLEAR_FLAG(F_OF);
16698- }
16699- } else {
16700- res = 0;
16701- CONDITIONAL_SET_FLAG((d >> (s-1)) & 0x1, F_CF);
16702- CLEAR_FLAG(F_OF);
16703- CLEAR_FLAG(F_SF);
16704- SET_FLAG(F_PF);
16705- SET_FLAG(F_ZF);
16706- }
16707- return (u8)res;
16708+u8
16709+shr_byte(u8 d, u8 s)
16710+{
16711+ unsigned int cnt, res, cf;
16712+
16713+ if (s < 8) {
16714+ cnt = s % 8;
16715+ if (cnt > 0) {
16716+ cf = d & (1 << (cnt - 1));
16717+ res = d >> cnt;
16718+ CONDITIONAL_SET_FLAG(cf, F_CF);
16719+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16720+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16721+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16722+ }
16723+ else {
16724+ res = (u8) d;
16725+ }
16726+
16727+ if (cnt == 1) {
16728+ CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
16729+ }
16730+ else {
16731+ CLEAR_FLAG(F_OF);
16732+ }
16733+ }
16734+ else {
16735+ res = 0;
16736+ CONDITIONAL_SET_FLAG((d >> (s - 1)) & 0x1, F_CF);
16737+ CLEAR_FLAG(F_OF);
16738+ CLEAR_FLAG(F_SF);
16739+ SET_FLAG(F_PF);
16740+ SET_FLAG(F_ZF);
16741+ }
16742+ return (u8) res;
16743 }
16744
16745 /****************************************************************************
16746 REMARKS:
16747 Implements the SHR instruction and side effects.
16748 ****************************************************************************/
16749-u16 shr_word(u16 d, u8 s)
16750+u16
16751+shr_word(u16 d, u8 s)
16752 {
16753- unsigned int cnt, res, cf;
16754+ unsigned int cnt, res, cf;
16755
16756- if (s < 16) {
16757- cnt = s % 16;
16758- if (cnt > 0) {
16759- cf = d & (1 << (cnt - 1));
16760- res = d >> cnt;
16761- CONDITIONAL_SET_FLAG(cf, F_CF);
16762- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16763- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16764- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16765- } else {
16766- res = d;
16767- }
16768+ if (s < 16) {
16769+ cnt = s % 16;
16770+ if (cnt > 0) {
16771+ cf = d & (1 << (cnt - 1));
16772+ res = d >> cnt;
16773+ CONDITIONAL_SET_FLAG(cf, F_CF);
16774+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16775+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16776+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16777+ }
16778+ else {
16779+ res = d;
16780+ }
16781
16782- if (cnt == 1) {
16783- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
16784- } else {
16785- CLEAR_FLAG(F_OF);
16786+ if (cnt == 1) {
16787+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
16788 }
16789- } else {
16790- res = 0;
16791- CLEAR_FLAG(F_CF);
16792- CLEAR_FLAG(F_OF);
16793- SET_FLAG(F_ZF);
16794- CLEAR_FLAG(F_SF);
16795- CLEAR_FLAG(F_PF);
16796+ else {
16797+ CLEAR_FLAG(F_OF);
16798+ }
16799+ }
16800+ else {
16801+ res = 0;
16802+ CLEAR_FLAG(F_CF);
16803+ CLEAR_FLAG(F_OF);
16804+ SET_FLAG(F_ZF);
16805+ CLEAR_FLAG(F_SF);
16806+ CLEAR_FLAG(F_PF);
16807 }
16808- return (u16)res;
16809+ return (u16) res;
16810 }
16811
16812 /****************************************************************************
16813 REMARKS:
16814 Implements the SHR instruction and side effects.
16815 ****************************************************************************/
16816-u32 shr_long(u32 d, u8 s)
16817+u32
16818+shr_long(u32 d, u8 s)
16819 {
16820- unsigned int cnt, res, cf;
16821+ unsigned int cnt, res, cf;
16822
16823- if (s < 32) {
16824- cnt = s % 32;
16825- if (cnt > 0) {
16826- cf = d & (1 << (cnt - 1));
16827- res = d >> cnt;
16828- CONDITIONAL_SET_FLAG(cf, F_CF);
16829- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
16830- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
16831- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16832- } else {
16833+ if (s < 32) {
16834+ cnt = s % 32;
16835+ if (cnt > 0) {
16836+ cf = d & (1 << (cnt - 1));
16837+ res = d >> cnt;
16838+ CONDITIONAL_SET_FLAG(cf, F_CF);
16839+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
16840+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
16841+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16842+ }
16843+ else {
16844 res = d;
16845 }
16846 if (cnt == 1) {
16847- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
16848- } else {
16849- CLEAR_FLAG(F_OF);
16850+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
16851+ }
16852+ else {
16853+ CLEAR_FLAG(F_OF);
16854 }
16855- } else {
16856+ }
16857+ else {
16858 res = 0;
16859- CLEAR_FLAG(F_CF);
16860- CLEAR_FLAG(F_OF);
16861- SET_FLAG(F_ZF);
16862- CLEAR_FLAG(F_SF);
16863- CLEAR_FLAG(F_PF);
16864+ CLEAR_FLAG(F_CF);
16865+ CLEAR_FLAG(F_OF);
16866+ SET_FLAG(F_ZF);
16867+ CLEAR_FLAG(F_SF);
16868+ CLEAR_FLAG(F_PF);
16869 }
16870 return res;
16871 }
16872@@ -1524,592 +1600,634 @@ u32 shr_long(u32 d, u8 s)
16873 REMARKS:
16874 Implements the SAR instruction and side effects.
16875 ****************************************************************************/
16876-u8 sar_byte(u8 d, u8 s)
16877+u8
16878+sar_byte(u8 d, u8 s)
16879 {
16880- unsigned int cnt, res, cf, mask, sf;
16881+ unsigned int cnt, res, cf, mask, sf;
16882
16883- res = d;
16884- sf = d & 0x80;
16885+ res = d;
16886+ sf = d & 0x80;
16887 cnt = s % 8;
16888- if (cnt > 0 && cnt < 8) {
16889- mask = (1 << (8 - cnt)) - 1;
16890- cf = d & (1 << (cnt - 1));
16891- res = (d >> cnt) & mask;
16892- CONDITIONAL_SET_FLAG(cf, F_CF);
16893- if (sf) {
16894- res |= ~mask;
16895- }
16896- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16897- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16898- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16899- } else if (cnt >= 8) {
16900+ if (cnt > 0 && cnt < 8) {
16901+ mask = (1 << (8 - cnt)) - 1;
16902+ cf = d & (1 << (cnt - 1));
16903+ res = (d >> cnt) & mask;
16904+ CONDITIONAL_SET_FLAG(cf, F_CF);
16905+ if (sf) {
16906+ res |= ~mask;
16907+ }
16908+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
16909+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16910+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
16911+ }
16912+ else if (cnt >= 8) {
16913 if (sf) {
16914 res = 0xff;
16915- SET_FLAG(F_CF);
16916- CLEAR_FLAG(F_ZF);
16917- SET_FLAG(F_SF);
16918- SET_FLAG(F_PF);
16919- } else {
16920- res = 0;
16921- CLEAR_FLAG(F_CF);
16922- SET_FLAG(F_ZF);
16923- CLEAR_FLAG(F_SF);
16924- CLEAR_FLAG(F_PF);
16925- }
16926- }
16927- return (u8)res;
16928+ SET_FLAG(F_CF);
16929+ CLEAR_FLAG(F_ZF);
16930+ SET_FLAG(F_SF);
16931+ SET_FLAG(F_PF);
16932+ }
16933+ else {
16934+ res = 0;
16935+ CLEAR_FLAG(F_CF);
16936+ SET_FLAG(F_ZF);
16937+ CLEAR_FLAG(F_SF);
16938+ CLEAR_FLAG(F_PF);
16939+ }
16940+ }
16941+ return (u8) res;
16942 }
16943
16944 /****************************************************************************
16945 REMARKS:
16946 Implements the SAR instruction and side effects.
16947 ****************************************************************************/
16948-u16 sar_word(u16 d, u8 s)
16949+u16
16950+sar_word(u16 d, u8 s)
16951 {
16952 unsigned int cnt, res, cf, mask, sf;
16953
16954 sf = d & 0x8000;
16955 cnt = s % 16;
16956- res = d;
16957- if (cnt > 0 && cnt < 16) {
16958+ res = d;
16959+ if (cnt > 0 && cnt < 16) {
16960 mask = (1 << (16 - cnt)) - 1;
16961 cf = d & (1 << (cnt - 1));
16962 res = (d >> cnt) & mask;
16963- CONDITIONAL_SET_FLAG(cf, F_CF);
16964+ CONDITIONAL_SET_FLAG(cf, F_CF);
16965 if (sf) {
16966 res |= ~mask;
16967 }
16968- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16969- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16970- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16971- } else if (cnt >= 16) {
16972+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
16973+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
16974+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
16975+ }
16976+ else if (cnt >= 16) {
16977 if (sf) {
16978 res = 0xffff;
16979- SET_FLAG(F_CF);
16980- CLEAR_FLAG(F_ZF);
16981- SET_FLAG(F_SF);
16982- SET_FLAG(F_PF);
16983- } else {
16984+ SET_FLAG(F_CF);
16985+ CLEAR_FLAG(F_ZF);
16986+ SET_FLAG(F_SF);
16987+ SET_FLAG(F_PF);
16988+ }
16989+ else {
16990 res = 0;
16991- CLEAR_FLAG(F_CF);
16992- SET_FLAG(F_ZF);
16993- CLEAR_FLAG(F_SF);
16994- CLEAR_FLAG(F_PF);
16995+ CLEAR_FLAG(F_CF);
16996+ SET_FLAG(F_ZF);
16997+ CLEAR_FLAG(F_SF);
16998+ CLEAR_FLAG(F_PF);
16999 }
17000 }
17001- return (u16)res;
17002+ return (u16) res;
17003 }
17004
17005 /****************************************************************************
17006 REMARKS:
17007 Implements the SAR instruction and side effects.
17008 ****************************************************************************/
17009-u32 sar_long(u32 d, u8 s)
17010+u32
17011+sar_long(u32 d, u8 s)
17012 {
17013 u32 cnt, res, cf, mask, sf;
17014
17015 sf = d & 0x80000000;
17016 cnt = s % 32;
17017- res = d;
17018- if (cnt > 0 && cnt < 32) {
17019+ res = d;
17020+ if (cnt > 0 && cnt < 32) {
17021 mask = (1 << (32 - cnt)) - 1;
17022- cf = d & (1 << (cnt - 1));
17023+ cf = d & (1 << (cnt - 1));
17024 res = (d >> cnt) & mask;
17025- CONDITIONAL_SET_FLAG(cf, F_CF);
17026+ CONDITIONAL_SET_FLAG(cf, F_CF);
17027 if (sf) {
17028 res |= ~mask;
17029 }
17030- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17031- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17032- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17033- } else if (cnt >= 32) {
17034+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17035+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17036+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17037+ }
17038+ else if (cnt >= 32) {
17039 if (sf) {
17040 res = 0xffffffff;
17041- SET_FLAG(F_CF);
17042- CLEAR_FLAG(F_ZF);
17043- SET_FLAG(F_SF);
17044- SET_FLAG(F_PF);
17045- } else {
17046- res = 0;
17047- CLEAR_FLAG(F_CF);
17048- SET_FLAG(F_ZF);
17049- CLEAR_FLAG(F_SF);
17050- CLEAR_FLAG(F_PF);
17051- }
17052- }
17053- return res;
17054+ SET_FLAG(F_CF);
17055+ CLEAR_FLAG(F_ZF);
17056+ SET_FLAG(F_SF);
17057+ SET_FLAG(F_PF);
17058+ }
17059+ else {
17060+ res = 0;
17061+ CLEAR_FLAG(F_CF);
17062+ SET_FLAG(F_ZF);
17063+ CLEAR_FLAG(F_SF);
17064+ CLEAR_FLAG(F_PF);
17065+ }
17066+ }
17067+ return res;
17068 }
17069
17070 /****************************************************************************
17071 REMARKS:
17072 Implements the SHLD instruction and side effects.
17073 ****************************************************************************/
17074-u16 shld_word (u16 d, u16 fill, u8 s)
17075-{
17076- unsigned int cnt, res, cf;
17077-
17078- if (s < 16) {
17079- cnt = s % 16;
17080- if (cnt > 0) {
17081- res = (d << cnt) | (fill >> (16-cnt));
17082- cf = d & (1 << (16 - cnt));
17083- CONDITIONAL_SET_FLAG(cf, F_CF);
17084- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17085- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17086- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17087- } else {
17088- res = d;
17089- }
17090- if (cnt == 1) {
17091- CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
17092- (ACCESS_FLAG(F_CF) != 0)), F_OF);
17093- } else {
17094- CLEAR_FLAG(F_OF);
17095- }
17096- } else {
17097- res = 0;
17098- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
17099- CLEAR_FLAG(F_OF);
17100- CLEAR_FLAG(F_SF);
17101- SET_FLAG(F_PF);
17102- SET_FLAG(F_ZF);
17103- }
17104- return (u16)res;
17105+u16
17106+shld_word(u16 d, u16 fill, u8 s)
17107+{
17108+ unsigned int cnt, res, cf;
17109+
17110+ if (s < 16) {
17111+ cnt = s % 16;
17112+ if (cnt > 0) {
17113+ res = (d << cnt) | (fill >> (16 - cnt));
17114+ cf = d & (1 << (16 - cnt));
17115+ CONDITIONAL_SET_FLAG(cf, F_CF);
17116+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17117+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17118+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17119+ }
17120+ else {
17121+ res = d;
17122+ }
17123+ if (cnt == 1) {
17124+ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
17125+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
17126+ }
17127+ else {
17128+ CLEAR_FLAG(F_OF);
17129+ }
17130+ }
17131+ else {
17132+ res = 0;
17133+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
17134+ CLEAR_FLAG(F_OF);
17135+ CLEAR_FLAG(F_SF);
17136+ SET_FLAG(F_PF);
17137+ SET_FLAG(F_ZF);
17138+ }
17139+ return (u16) res;
17140 }
17141
17142 /****************************************************************************
17143 REMARKS:
17144 Implements the SHLD instruction and side effects.
17145 ****************************************************************************/
17146-u32 shld_long (u32 d, u32 fill, u8 s)
17147-{
17148- unsigned int cnt, res, cf;
17149-
17150- if (s < 32) {
17151- cnt = s % 32;
17152- if (cnt > 0) {
17153- res = (d << cnt) | (fill >> (32-cnt));
17154- cf = d & (1 << (32 - cnt));
17155- CONDITIONAL_SET_FLAG(cf, F_CF);
17156- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17157- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17158- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17159- } else {
17160- res = d;
17161- }
17162- if (cnt == 1) {
17163- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
17164- (ACCESS_FLAG(F_CF) != 0)), F_OF);
17165- } else {
17166- CLEAR_FLAG(F_OF);
17167- }
17168- } else {
17169- res = 0;
17170- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
17171- CLEAR_FLAG(F_OF);
17172- CLEAR_FLAG(F_SF);
17173- SET_FLAG(F_PF);
17174- SET_FLAG(F_ZF);
17175- }
17176- return res;
17177+u32
17178+shld_long(u32 d, u32 fill, u8 s)
17179+{
17180+ unsigned int cnt, res, cf;
17181+
17182+ if (s < 32) {
17183+ cnt = s % 32;
17184+ if (cnt > 0) {
17185+ res = (d << cnt) | (fill >> (32 - cnt));
17186+ cf = d & (1 << (32 - cnt));
17187+ CONDITIONAL_SET_FLAG(cf, F_CF);
17188+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17189+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17190+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17191+ }
17192+ else {
17193+ res = d;
17194+ }
17195+ if (cnt == 1) {
17196+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
17197+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
17198+ }
17199+ else {
17200+ CLEAR_FLAG(F_OF);
17201+ }
17202+ }
17203+ else {
17204+ res = 0;
17205+ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
17206+ CLEAR_FLAG(F_OF);
17207+ CLEAR_FLAG(F_SF);
17208+ SET_FLAG(F_PF);
17209+ SET_FLAG(F_ZF);
17210+ }
17211+ return res;
17212 }
17213
17214 /****************************************************************************
17215 REMARKS:
17216 Implements the SHRD instruction and side effects.
17217 ****************************************************************************/
17218-u16 shrd_word (u16 d, u16 fill, u8 s)
17219+u16
17220+shrd_word(u16 d, u16 fill, u8 s)
17221 {
17222- unsigned int cnt, res, cf;
17223+ unsigned int cnt, res, cf;
17224
17225- if (s < 16) {
17226- cnt = s % 16;
17227- if (cnt > 0) {
17228- cf = d & (1 << (cnt - 1));
17229- res = (d >> cnt) | (fill << (16 - cnt));
17230- CONDITIONAL_SET_FLAG(cf, F_CF);
17231- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17232- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17233- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17234- } else {
17235- res = d;
17236- }
17237+ if (s < 16) {
17238+ cnt = s % 16;
17239+ if (cnt > 0) {
17240+ cf = d & (1 << (cnt - 1));
17241+ res = (d >> cnt) | (fill << (16 - cnt));
17242+ CONDITIONAL_SET_FLAG(cf, F_CF);
17243+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17244+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17245+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17246+ }
17247+ else {
17248+ res = d;
17249+ }
17250
17251- if (cnt == 1) {
17252- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
17253- } else {
17254- CLEAR_FLAG(F_OF);
17255+ if (cnt == 1) {
17256+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
17257+ }
17258+ else {
17259+ CLEAR_FLAG(F_OF);
17260 }
17261- } else {
17262- res = 0;
17263- CLEAR_FLAG(F_CF);
17264- CLEAR_FLAG(F_OF);
17265- SET_FLAG(F_ZF);
17266- CLEAR_FLAG(F_SF);
17267- CLEAR_FLAG(F_PF);
17268 }
17269- return (u16)res;
17270+ else {
17271+ res = 0;
17272+ CLEAR_FLAG(F_CF);
17273+ CLEAR_FLAG(F_OF);
17274+ SET_FLAG(F_ZF);
17275+ CLEAR_FLAG(F_SF);
17276+ CLEAR_FLAG(F_PF);
17277+ }
17278+ return (u16) res;
17279 }
17280
17281 /****************************************************************************
17282 REMARKS:
17283 Implements the SHRD instruction and side effects.
17284 ****************************************************************************/
17285-u32 shrd_long (u32 d, u32 fill, u8 s)
17286+u32
17287+shrd_long(u32 d, u32 fill, u8 s)
17288 {
17289- unsigned int cnt, res, cf;
17290+ unsigned int cnt, res, cf;
17291
17292- if (s < 32) {
17293- cnt = s % 32;
17294- if (cnt > 0) {
17295- cf = d & (1 << (cnt - 1));
17296- res = (d >> cnt) | (fill << (32 - cnt));
17297- CONDITIONAL_SET_FLAG(cf, F_CF);
17298- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17299- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17300- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17301- } else {
17302- res = d;
17303- }
17304- if (cnt == 1) {
17305- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
17306- } else {
17307- CLEAR_FLAG(F_OF);
17308+ if (s < 32) {
17309+ cnt = s % 32;
17310+ if (cnt > 0) {
17311+ cf = d & (1 << (cnt - 1));
17312+ res = (d >> cnt) | (fill << (32 - cnt));
17313+ CONDITIONAL_SET_FLAG(cf, F_CF);
17314+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17315+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17316+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17317+ }
17318+ else {
17319+ res = d;
17320+ }
17321+ if (cnt == 1) {
17322+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
17323+ }
17324+ else {
17325+ CLEAR_FLAG(F_OF);
17326 }
17327- } else {
17328- res = 0;
17329- CLEAR_FLAG(F_CF);
17330- CLEAR_FLAG(F_OF);
17331- SET_FLAG(F_ZF);
17332- CLEAR_FLAG(F_SF);
17333- CLEAR_FLAG(F_PF);
17334 }
17335- return res;
17336+ else {
17337+ res = 0;
17338+ CLEAR_FLAG(F_CF);
17339+ CLEAR_FLAG(F_OF);
17340+ SET_FLAG(F_ZF);
17341+ CLEAR_FLAG(F_SF);
17342+ CLEAR_FLAG(F_PF);
17343+ }
17344+ return res;
17345 }
17346
17347 /****************************************************************************
17348 REMARKS:
17349 Implements the SBB instruction and side effects.
17350 ****************************************************************************/
17351-u8 sbb_byte(u8 d, u8 s)
17352+u8
17353+sbb_byte(u8 d, u8 s)
17354 {
17355- register u32 res; /* all operands in native machine order */
17356+ register u32 res; /* all operands in native machine order */
17357 register u32 bc;
17358
17359- if (ACCESS_FLAG(F_CF))
17360- res = d - s - 1;
17361- else
17362- res = d - s;
17363- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17364- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
17365- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17366+ if (ACCESS_FLAG(F_CF))
17367+ res = d - s - 1;
17368+ else
17369+ res = d - s;
17370+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17371+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
17372+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17373
17374- /* calculate the borrow chain. See note at top */
17375- bc = (res & (~d | s)) | (~d & s);
17376- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
17377- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
17378- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17379- return (u8)res;
17380+ /* calculate the borrow chain. See note at top */
17381+ bc = (res & (~d | s)) | (~d & s);
17382+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
17383+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
17384+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17385+ return (u8) res;
17386 }
17387
17388 /****************************************************************************
17389 REMARKS:
17390 Implements the SBB instruction and side effects.
17391 ****************************************************************************/
17392-u16 sbb_word(u16 d, u16 s)
17393+u16
17394+sbb_word(u16 d, u16 s)
17395 {
17396- register u32 res; /* all operands in native machine order */
17397+ register u32 res; /* all operands in native machine order */
17398 register u32 bc;
17399
17400- if (ACCESS_FLAG(F_CF))
17401+ if (ACCESS_FLAG(F_CF))
17402 res = d - s - 1;
17403 else
17404 res = d - s;
17405- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17406- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17407- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17408+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17409+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17410+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17411
17412- /* calculate the borrow chain. See note at top */
17413- bc = (res & (~d | s)) | (~d & s);
17414- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
17415- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
17416- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17417- return (u16)res;
17418+ /* calculate the borrow chain. See note at top */
17419+ bc = (res & (~d | s)) | (~d & s);
17420+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
17421+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
17422+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17423+ return (u16) res;
17424 }
17425
17426 /****************************************************************************
17427 REMARKS:
17428 Implements the SBB instruction and side effects.
17429 ****************************************************************************/
17430-u32 sbb_long(u32 d, u32 s)
17431+u32
17432+sbb_long(u32 d, u32 s)
17433 {
17434- register u32 res; /* all operands in native machine order */
17435- register u32 bc;
17436+ register u32 res; /* all operands in native machine order */
17437+ register u32 bc;
17438
17439- if (ACCESS_FLAG(F_CF))
17440+ if (ACCESS_FLAG(F_CF))
17441 res = d - s - 1;
17442 else
17443 res = d - s;
17444- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17445- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17446- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17447+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17448+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17449+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17450
17451- /* calculate the borrow chain. See note at top */
17452- bc = (res & (~d | s)) | (~d & s);
17453- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
17454- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
17455- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17456- return res;
17457+ /* calculate the borrow chain. See note at top */
17458+ bc = (res & (~d | s)) | (~d & s);
17459+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
17460+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
17461+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17462+ return res;
17463 }
17464
17465 /****************************************************************************
17466 REMARKS:
17467 Implements the SUB instruction and side effects.
17468 ****************************************************************************/
17469-u8 sub_byte(u8 d, u8 s)
17470+u8
17471+sub_byte(u8 d, u8 s)
17472 {
17473- register u32 res; /* all operands in native machine order */
17474- register u32 bc;
17475+ register u32 res; /* all operands in native machine order */
17476+ register u32 bc;
17477
17478- res = d - s;
17479- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17480- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
17481- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17482+ res = d - s;
17483+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17484+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
17485+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17486
17487- /* calculate the borrow chain. See note at top */
17488- bc = (res & (~d | s)) | (~d & s);
17489- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
17490- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
17491- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17492- return (u8)res;
17493+ /* calculate the borrow chain. See note at top */
17494+ bc = (res & (~d | s)) | (~d & s);
17495+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
17496+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
17497+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17498+ return (u8) res;
17499 }
17500
17501 /****************************************************************************
17502 REMARKS:
17503 Implements the SUB instruction and side effects.
17504 ****************************************************************************/
17505-u16 sub_word(u16 d, u16 s)
17506+u16
17507+sub_word(u16 d, u16 s)
17508 {
17509- register u32 res; /* all operands in native machine order */
17510+ register u32 res; /* all operands in native machine order */
17511 register u32 bc;
17512
17513 res = d - s;
17514- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17515- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17516- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17517+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17518+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
17519+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17520
17521- /* calculate the borrow chain. See note at top */
17522- bc = (res & (~d | s)) | (~d & s);
17523- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
17524- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
17525- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17526- return (u16)res;
17527+ /* calculate the borrow chain. See note at top */
17528+ bc = (res & (~d | s)) | (~d & s);
17529+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
17530+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
17531+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17532+ return (u16) res;
17533 }
17534
17535 /****************************************************************************
17536 REMARKS:
17537 Implements the SUB instruction and side effects.
17538 ****************************************************************************/
17539-u32 sub_long(u32 d, u32 s)
17540+u32
17541+sub_long(u32 d, u32 s)
17542 {
17543- register u32 res; /* all operands in native machine order */
17544- register u32 bc;
17545+ register u32 res; /* all operands in native machine order */
17546+ register u32 bc;
17547
17548- res = d - s;
17549- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17550- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17551- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17552+ res = d - s;
17553+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17554+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
17555+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17556
17557- /* calculate the borrow chain. See note at top */
17558- bc = (res & (~d | s)) | (~d & s);
17559- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
17560- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
17561- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17562- return res;
17563+ /* calculate the borrow chain. See note at top */
17564+ bc = (res & (~d | s)) | (~d & s);
17565+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
17566+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
17567+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
17568+ return res;
17569 }
17570
17571 /****************************************************************************
17572 REMARKS:
17573 Implements the TEST instruction and side effects.
17574 ****************************************************************************/
17575-void test_byte(u8 d, u8 s)
17576+void
17577+test_byte(u8 d, u8 s)
17578 {
17579- register u32 res; /* all operands in native machine order */
17580+ register u32 res; /* all operands in native machine order */
17581
17582 res = d & s;
17583
17584- CLEAR_FLAG(F_OF);
17585- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17586- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17587- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17588+ CLEAR_FLAG(F_OF);
17589+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17590+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17591+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17592 /* AF == dont care */
17593- CLEAR_FLAG(F_CF);
17594+ CLEAR_FLAG(F_CF);
17595 }
17596
17597 /****************************************************************************
17598 REMARKS:
17599 Implements the TEST instruction and side effects.
17600 ****************************************************************************/
17601-void test_word(u16 d, u16 s)
17602+void
17603+test_word(u16 d, u16 s)
17604 {
17605- register u32 res; /* all operands in native machine order */
17606+ register u32 res; /* all operands in native machine order */
17607
17608- res = d & s;
17609+ res = d & s;
17610
17611- CLEAR_FLAG(F_OF);
17612- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17613- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17614- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17615- /* AF == dont care */
17616- CLEAR_FLAG(F_CF);
17617+ CLEAR_FLAG(F_OF);
17618+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17619+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17620+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17621+ /* AF == dont care */
17622+ CLEAR_FLAG(F_CF);
17623 }
17624
17625 /****************************************************************************
17626 REMARKS:
17627 Implements the TEST instruction and side effects.
17628 ****************************************************************************/
17629-void test_long(u32 d, u32 s)
17630+void
17631+test_long(u32 d, u32 s)
17632 {
17633- register u32 res; /* all operands in native machine order */
17634+ register u32 res; /* all operands in native machine order */
17635
17636- res = d & s;
17637+ res = d & s;
17638
17639- CLEAR_FLAG(F_OF);
17640- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17641- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17642- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17643- /* AF == dont care */
17644- CLEAR_FLAG(F_CF);
17645+ CLEAR_FLAG(F_OF);
17646+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17647+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17648+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17649+ /* AF == dont care */
17650+ CLEAR_FLAG(F_CF);
17651 }
17652
17653 /****************************************************************************
17654 REMARKS:
17655 Implements the XOR instruction and side effects.
17656 ****************************************************************************/
17657-u8 xor_byte(u8 d, u8 s)
17658+u8
17659+xor_byte(u8 d, u8 s)
17660 {
17661- register u8 res; /* all operands in native machine order */
17662+ register u8 res; /* all operands in native machine order */
17663
17664- res = d ^ s;
17665- CLEAR_FLAG(F_OF);
17666- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17667- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17668- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
17669- CLEAR_FLAG(F_CF);
17670- CLEAR_FLAG(F_AF);
17671- return res;
17672+ res = d ^ s;
17673+ CLEAR_FLAG(F_OF);
17674+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
17675+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17676+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
17677+ CLEAR_FLAG(F_CF);
17678+ CLEAR_FLAG(F_AF);
17679+ return res;
17680 }
17681
17682 /****************************************************************************
17683 REMARKS:
17684 Implements the XOR instruction and side effects.
17685 ****************************************************************************/
17686-u16 xor_word(u16 d, u16 s)
17687+u16
17688+xor_word(u16 d, u16 s)
17689 {
17690- register u16 res; /* all operands in native machine order */
17691+ register u16 res; /* all operands in native machine order */
17692
17693- res = d ^ s;
17694- CLEAR_FLAG(F_OF);
17695- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17696- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17697- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17698- CLEAR_FLAG(F_CF);
17699- CLEAR_FLAG(F_AF);
17700- return res;
17701+ res = d ^ s;
17702+ CLEAR_FLAG(F_OF);
17703+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
17704+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17705+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17706+ CLEAR_FLAG(F_CF);
17707+ CLEAR_FLAG(F_AF);
17708+ return res;
17709 }
17710
17711 /****************************************************************************
17712 REMARKS:
17713 Implements the XOR instruction and side effects.
17714 ****************************************************************************/
17715-u32 xor_long(u32 d, u32 s)
17716+u32
17717+xor_long(u32 d, u32 s)
17718 {
17719- register u32 res; /* all operands in native machine order */
17720+ register u32 res; /* all operands in native machine order */
17721
17722- res = d ^ s;
17723- CLEAR_FLAG(F_OF);
17724- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17725- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17726- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17727- CLEAR_FLAG(F_CF);
17728- CLEAR_FLAG(F_AF);
17729- return res;
17730+ res = d ^ s;
17731+ CLEAR_FLAG(F_OF);
17732+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
17733+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
17734+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
17735+ CLEAR_FLAG(F_CF);
17736+ CLEAR_FLAG(F_AF);
17737+ return res;
17738 }
17739
17740 /****************************************************************************
17741 REMARKS:
17742 Implements the IMUL instruction and side effects.
17743 ****************************************************************************/
17744-void imul_byte(u8 s)
17745+void
17746+imul_byte(u8 s)
17747 {
17748- s16 res = (s16)((s8)M.x86.R_AL * (s8)s);
17749+ s16 res = (s16) ((s8) M.x86.R_AL * (s8) s);
17750
17751- M.x86.R_AX = res;
17752- if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
17753- ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
17754- CLEAR_FLAG(F_CF);
17755- CLEAR_FLAG(F_OF);
17756- } else {
17757- SET_FLAG(F_CF);
17758- SET_FLAG(F_OF);
17759- }
17760+ M.x86.R_AX = res;
17761+ if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
17762+ ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
17763+ CLEAR_FLAG(F_CF);
17764+ CLEAR_FLAG(F_OF);
17765+ }
17766+ else {
17767+ SET_FLAG(F_CF);
17768+ SET_FLAG(F_OF);
17769+ }
17770 }
17771
17772 /****************************************************************************
17773 REMARKS:
17774 Implements the IMUL instruction and side effects.
17775 ****************************************************************************/
17776-void imul_word(u16 s)
17777+void
17778+imul_word(u16 s)
17779 {
17780- s32 res = (s16)M.x86.R_AX * (s16)s;
17781+ s32 res = (s16) M.x86.R_AX * (s16) s;
17782
17783- M.x86.R_AX = (u16)res;
17784- M.x86.R_DX = (u16)(res >> 16);
17785- if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
17786- ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
17787- CLEAR_FLAG(F_CF);
17788- CLEAR_FLAG(F_OF);
17789- } else {
17790- SET_FLAG(F_CF);
17791- SET_FLAG(F_OF);
17792- }
17793+ M.x86.R_AX = (u16) res;
17794+ M.x86.R_DX = (u16) (res >> 16);
17795+ if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
17796+ ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
17797+ CLEAR_FLAG(F_CF);
17798+ CLEAR_FLAG(F_OF);
17799+ }
17800+ else {
17801+ SET_FLAG(F_CF);
17802+ SET_FLAG(F_OF);
17803+ }
17804 }
17805
17806 /****************************************************************************
17807 REMARKS:
17808 Implements the IMUL instruction and side effects.
17809 ****************************************************************************/
17810-void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
17811+void
17812+imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s)
17813 {
17814 #ifdef __HAS_LONG_LONG__
17815- s64 res = (s32)d * (s32)s;
17816+ s64 res = (s64) (s32) d * (s32) s;
17817
17818- *res_lo = (u32)res;
17819- *res_hi = (u32)(res >> 32);
17820+ *res_lo = (u32) res;
17821+ *res_hi = (u32) (res >> 32);
17822 #else
17823- u32 d_lo,d_hi,d_sign;
17824- u32 s_lo,s_hi,s_sign;
17825- u32 rlo_lo,rlo_hi,rhi_lo;
17826-
17827- if ((d_sign = d & 0x80000000) != 0)
17828- d = -d;
17829- d_lo = d & 0xFFFF;
17830- d_hi = d >> 16;
17831- if ((s_sign = s & 0x80000000) != 0)
17832- s = -s;
17833- s_lo = s & 0xFFFF;
17834- s_hi = s >> 16;
17835- rlo_lo = d_lo * s_lo;
17836- rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
17837- rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
17838- *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
17839- *res_hi = rhi_lo;
17840- if (d_sign != s_sign) {
17841- d = ~*res_lo;
17842- s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
17843- *res_lo = ~*res_lo+1;
17844- *res_hi = ~*res_hi+(s >> 16);
17845- }
17846+ u32 d_lo, d_hi, d_sign;
17847+ u32 s_lo, s_hi, s_sign;
17848+ u32 rlo_lo, rlo_hi, rhi_lo;
17849+
17850+ if ((d_sign = d & 0x80000000) != 0)
17851+ d = -d;
17852+ d_lo = d & 0xFFFF;
17853+ d_hi = d >> 16;
17854+ if ((s_sign = s & 0x80000000) != 0)
17855+ s = -s;
17856+ s_lo = s & 0xFFFF;
17857+ s_hi = s >> 16;
17858+ rlo_lo = d_lo * s_lo;
17859+ rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
17860+ rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
17861+ *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
17862+ *res_hi = rhi_lo;
17863+ if (d_sign != s_sign) {
17864+ d = ~*res_lo;
17865+ s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
17866+ *res_lo = ~*res_lo + 1;
17867+ *res_hi = ~*res_hi + (s >> 16);
17868+ }
17869 #endif
17870 }
17871
17872@@ -2117,53 +2235,59 @@ void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
17873 REMARKS:
17874 Implements the IMUL instruction and side effects.
17875 ****************************************************************************/
17876-void imul_long(u32 s)
17877+void
17878+imul_long(u32 s)
17879 {
17880- imul_long_direct(&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s);
17881- if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
17882- ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
17883- CLEAR_FLAG(F_CF);
17884- CLEAR_FLAG(F_OF);
17885- } else {
17886- SET_FLAG(F_CF);
17887- SET_FLAG(F_OF);
17888- }
17889+ imul_long_direct(&M.x86.R_EAX, &M.x86.R_EDX, M.x86.R_EAX, s);
17890+ if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
17891+ ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
17892+ CLEAR_FLAG(F_CF);
17893+ CLEAR_FLAG(F_OF);
17894+ }
17895+ else {
17896+ SET_FLAG(F_CF);
17897+ SET_FLAG(F_OF);
17898+ }
17899 }
17900
17901 /****************************************************************************
17902 REMARKS:
17903 Implements the MUL instruction and side effects.
17904 ****************************************************************************/
17905-void mul_byte(u8 s)
17906+void
17907+mul_byte(u8 s)
17908 {
17909- u16 res = (u16)(M.x86.R_AL * s);
17910+ u16 res = (u16) (M.x86.R_AL * s);
17911
17912- M.x86.R_AX = res;
17913- if (M.x86.R_AH == 0) {
17914- CLEAR_FLAG(F_CF);
17915- CLEAR_FLAG(F_OF);
17916- } else {
17917- SET_FLAG(F_CF);
17918- SET_FLAG(F_OF);
17919- }
17920+ M.x86.R_AX = res;
17921+ if (M.x86.R_AH == 0) {
17922+ CLEAR_FLAG(F_CF);
17923+ CLEAR_FLAG(F_OF);
17924+ }
17925+ else {
17926+ SET_FLAG(F_CF);
17927+ SET_FLAG(F_OF);
17928+ }
17929 }
17930
17931 /****************************************************************************
17932 REMARKS:
17933 Implements the MUL instruction and side effects.
17934 ****************************************************************************/
17935-void mul_word(u16 s)
17936+void
17937+mul_word(u16 s)
17938 {
17939- u32 res = M.x86.R_AX * s;
17940+ u32 res = M.x86.R_AX * s;
17941
17942- M.x86.R_AX = (u16)res;
17943- M.x86.R_DX = (u16)(res >> 16);
17944- if (M.x86.R_DX == 0) {
17945- CLEAR_FLAG(F_CF);
17946- CLEAR_FLAG(F_OF);
17947- } else {
17948- SET_FLAG(F_CF);
17949- SET_FLAG(F_OF);
17950+ M.x86.R_AX = (u16) res;
17951+ M.x86.R_DX = (u16) (res >> 16);
17952+ if (M.x86.R_DX == 0) {
17953+ CLEAR_FLAG(F_CF);
17954+ CLEAR_FLAG(F_OF);
17955+ }
17956+ else {
17957+ SET_FLAG(F_CF);
17958+ SET_FLAG(F_OF);
17959 }
17960 }
17961
17962@@ -2171,36 +2295,38 @@ void mul_word(u16 s)
17963 REMARKS:
17964 Implements the MUL instruction and side effects.
17965 ****************************************************************************/
17966-void mul_long(u32 s)
17967+void
17968+mul_long(u32 s)
17969 {
17970 #ifdef __HAS_LONG_LONG__
17971- u64 res = (u32)M.x86.R_EAX * (u32)s;
17972+ u64 res = (u64) M.x86.R_EAX * s;
17973
17974- M.x86.R_EAX = (u32)res;
17975- M.x86.R_EDX = (u32)(res >> 32);
17976+ M.x86.R_EAX = (u32) res;
17977+ M.x86.R_EDX = (u32) (res >> 32);
17978 #else
17979- u32 a,a_lo,a_hi;
17980- u32 s_lo,s_hi;
17981- u32 rlo_lo,rlo_hi,rhi_lo;
17982-
17983- a = M.x86.R_EAX;
17984- a_lo = a & 0xFFFF;
17985- a_hi = a >> 16;
17986- s_lo = s & 0xFFFF;
17987- s_hi = s >> 16;
17988- rlo_lo = a_lo * s_lo;
17989- rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
17990- rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
17991- M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
17992- M.x86.R_EDX = rhi_lo;
17993+ u32 a, a_lo, a_hi;
17994+ u32 s_lo, s_hi;
17995+ u32 rlo_lo, rlo_hi, rhi_lo;
17996+
17997+ a = M.x86.R_EAX;
17998+ a_lo = a & 0xFFFF;
17999+ a_hi = a >> 16;
18000+ s_lo = s & 0xFFFF;
18001+ s_hi = s >> 16;
18002+ rlo_lo = a_lo * s_lo;
18003+ rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
18004+ rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
18005+ M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
18006+ M.x86.R_EDX = rhi_lo;
18007 #endif
18008
18009- if (M.x86.R_EDX == 0) {
18010- CLEAR_FLAG(F_CF);
18011- CLEAR_FLAG(F_OF);
18012- } else {
18013- SET_FLAG(F_CF);
18014- SET_FLAG(F_OF);
18015+ if (M.x86.R_EDX == 0) {
18016+ CLEAR_FLAG(F_CF);
18017+ CLEAR_FLAG(F_OF);
18018+ }
18019+ else {
18020+ SET_FLAG(F_CF);
18021+ SET_FLAG(F_OF);
18022 }
18023 }
18024
18025@@ -2208,309 +2334,319 @@ void mul_long(u32 s)
18026 REMARKS:
18027 Implements the IDIV instruction and side effects.
18028 ****************************************************************************/
18029-void idiv_byte(u8 s)
18030+void
18031+idiv_byte(u8 s)
18032 {
18033 s32 dvd, div, mod;
18034
18035- dvd = (s16)M.x86.R_AX;
18036- if (s == 0) {
18037- x86emu_intr_raise(0);
18038+ dvd = (s16) M.x86.R_AX;
18039+ if (s == 0) {
18040+ x86emu_intr_raise(0);
18041+ return;
18042+ }
18043+ div = dvd / (s8) s;
18044+ mod = dvd % (s8) s;
18045+ if (abs(div) > 0x7f) {
18046+ x86emu_intr_raise(0);
18047 return;
18048- }
18049- div = dvd / (s8)s;
18050- mod = dvd % (s8)s;
18051- if (abs(div) > 0x7f) {
18052- x86emu_intr_raise(0);
18053- return;
18054- }
18055- M.x86.R_AL = (s8) div;
18056- M.x86.R_AH = (s8) mod;
18057+ }
18058+ M.x86.R_AL = (s8) div;
18059+ M.x86.R_AH = (s8) mod;
18060 }
18061
18062 /****************************************************************************
18063 REMARKS:
18064 Implements the IDIV instruction and side effects.
18065 ****************************************************************************/
18066-void idiv_word(u16 s)
18067+void
18068+idiv_word(u16 s)
18069 {
18070- s32 dvd, div, mod;
18071+ s32 dvd, div, mod;
18072
18073- dvd = (((s32)M.x86.R_DX) << 16) | M.x86.R_AX;
18074- if (s == 0) {
18075- x86emu_intr_raise(0);
18076- return;
18077- }
18078- div = dvd / (s16)s;
18079- mod = dvd % (s16)s;
18080- if (abs(div) > 0x7fff) {
18081- x86emu_intr_raise(0);
18082- return;
18083- }
18084- CLEAR_FLAG(F_CF);
18085- CLEAR_FLAG(F_SF);
18086- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
18087- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18088+ dvd = (((s32) M.x86.R_DX) << 16) | M.x86.R_AX;
18089+ if (s == 0) {
18090+ x86emu_intr_raise(0);
18091+ return;
18092+ }
18093+ div = dvd / (s16) s;
18094+ mod = dvd % (s16) s;
18095+ if (abs(div) > 0x7fff) {
18096+ x86emu_intr_raise(0);
18097+ return;
18098+ }
18099+ CLEAR_FLAG(F_CF);
18100+ CLEAR_FLAG(F_SF);
18101+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
18102+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18103
18104- M.x86.R_AX = (u16)div;
18105- M.x86.R_DX = (u16)mod;
18106+ M.x86.R_AX = (u16) div;
18107+ M.x86.R_DX = (u16) mod;
18108 }
18109
18110 /****************************************************************************
18111 REMARKS:
18112 Implements the IDIV instruction and side effects.
18113 ****************************************************************************/
18114-void idiv_long(u32 s)
18115+void
18116+idiv_long(u32 s)
18117 {
18118 #ifdef __HAS_LONG_LONG__
18119- s64 dvd, div, mod;
18120-
18121- dvd = (((s64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
18122- if (s == 0) {
18123- x86emu_intr_raise(0);
18124- return;
18125- }
18126- div = dvd / (s32)s;
18127- mod = dvd % (s32)s;
18128- if (abs(div) > 0x7fffffff) {
18129- x86emu_intr_raise(0);
18130- return;
18131- }
18132+ s64 dvd, div, mod;
18133+
18134+ dvd = (((s64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
18135+ if (s == 0) {
18136+ x86emu_intr_raise(0);
18137+ return;
18138+ }
18139+ div = dvd / (s32) s;
18140+ mod = dvd % (s32) s;
18141+ if (abs(div) > 0x7fffffff) {
18142+ x86emu_intr_raise(0);
18143+ return;
18144+ }
18145 #else
18146- s32 div = 0, mod;
18147- s32 h_dvd = M.x86.R_EDX;
18148- u32 l_dvd = M.x86.R_EAX;
18149- u32 abs_s = s & 0x7FFFFFFF;
18150- u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
18151- u32 h_s = abs_s >> 1;
18152- u32 l_s = abs_s << 31;
18153- int counter = 31;
18154- int carry;
18155-
18156- if (s == 0) {
18157- x86emu_intr_raise(0);
18158- return;
18159- }
18160- do {
18161- div <<= 1;
18162- carry = (l_dvd >= l_s) ? 0 : 1;
18163-
18164- if (abs_h_dvd < (h_s + carry)) {
18165- h_s >>= 1;
18166- l_s = abs_s << (--counter);
18167- continue;
18168- } else {
18169- abs_h_dvd -= (h_s + carry);
18170- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
18171- : (l_dvd - l_s);
18172- h_s >>= 1;
18173- l_s = abs_s << (--counter);
18174- div |= 1;
18175- continue;
18176- }
18177-
18178- } while (counter > -1);
18179- /* overflow */
18180- if (abs_h_dvd || (l_dvd > abs_s)) {
18181- x86emu_intr_raise(0);
18182- return;
18183- }
18184- /* sign */
18185- div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
18186- mod = l_dvd;
18187+ s32 div = 0, mod;
18188+ s32 h_dvd = M.x86.R_EDX;
18189+ u32 l_dvd = M.x86.R_EAX;
18190+ u32 abs_s = s & 0x7FFFFFFF;
18191+ u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
18192+ u32 h_s = abs_s >> 1;
18193+ u32 l_s = abs_s << 31;
18194+ int counter = 31;
18195+ int carry;
18196+
18197+ if (s == 0) {
18198+ x86emu_intr_raise(0);
18199+ return;
18200+ }
18201+ do {
18202+ div <<= 1;
18203+ carry = (l_dvd >= l_s) ? 0 : 1;
18204+
18205+ if (abs_h_dvd < (h_s + carry)) {
18206+ h_s >>= 1;
18207+ l_s = abs_s << (--counter);
18208+ continue;
18209+ }
18210+ else {
18211+ abs_h_dvd -= (h_s + carry);
18212+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
18213+ : (l_dvd - l_s);
18214+ h_s >>= 1;
18215+ l_s = abs_s << (--counter);
18216+ div |= 1;
18217+ continue;
18218+ }
18219+
18220+ } while (counter > -1);
18221+ /* overflow */
18222+ if (abs_h_dvd || (l_dvd > abs_s)) {
18223+ x86emu_intr_raise(0);
18224+ return;
18225+ }
18226+ /* sign */
18227+ div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
18228+ mod = l_dvd;
18229
18230 #endif
18231- CLEAR_FLAG(F_CF);
18232- CLEAR_FLAG(F_AF);
18233- CLEAR_FLAG(F_SF);
18234- SET_FLAG(F_ZF);
18235- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18236+ CLEAR_FLAG(F_CF);
18237+ CLEAR_FLAG(F_AF);
18238+ CLEAR_FLAG(F_SF);
18239+ SET_FLAG(F_ZF);
18240+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18241
18242- M.x86.R_EAX = (u32)div;
18243- M.x86.R_EDX = (u32)mod;
18244+ M.x86.R_EAX = (u32) div;
18245+ M.x86.R_EDX = (u32) mod;
18246 }
18247
18248 /****************************************************************************
18249 REMARKS:
18250 Implements the DIV instruction and side effects.
18251 ****************************************************************************/
18252-void div_byte(u8 s)
18253+void
18254+div_byte(u8 s)
18255 {
18256- u32 dvd, div, mod;
18257+ u32 dvd, div, mod;
18258
18259- dvd = M.x86.R_AX;
18260+ dvd = M.x86.R_AX;
18261 if (s == 0) {
18262- x86emu_intr_raise(0);
18263+ x86emu_intr_raise(0);
18264 return;
18265 }
18266- div = dvd / (u8)s;
18267- mod = dvd % (u8)s;
18268- if (abs(div) > 0xff) {
18269- x86emu_intr_raise(0);
18270+ div = dvd / (u8) s;
18271+ mod = dvd % (u8) s;
18272+ if (abs(div) > 0xff) {
18273+ x86emu_intr_raise(0);
18274 return;
18275- }
18276- M.x86.R_AL = (u8)div;
18277- M.x86.R_AH = (u8)mod;
18278+ }
18279+ M.x86.R_AL = (u8) div;
18280+ M.x86.R_AH = (u8) mod;
18281 }
18282
18283 /****************************************************************************
18284 REMARKS:
18285 Implements the DIV instruction and side effects.
18286 ****************************************************************************/
18287-void div_word(u16 s)
18288+void
18289+div_word(u16 s)
18290 {
18291- u32 dvd, div, mod;
18292+ u32 dvd, div, mod;
18293
18294- dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX;
18295- if (s == 0) {
18296- x86emu_intr_raise(0);
18297+ dvd = (((u32) M.x86.R_DX) << 16) | M.x86.R_AX;
18298+ if (s == 0) {
18299+ x86emu_intr_raise(0);
18300+ return;
18301+ }
18302+ div = dvd / (u16) s;
18303+ mod = dvd % (u16) s;
18304+ if (abs(div) > 0xffff) {
18305+ x86emu_intr_raise(0);
18306 return;
18307 }
18308- div = dvd / (u16)s;
18309- mod = dvd % (u16)s;
18310- if (abs(div) > 0xffff) {
18311- x86emu_intr_raise(0);
18312- return;
18313- }
18314- CLEAR_FLAG(F_CF);
18315- CLEAR_FLAG(F_SF);
18316- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
18317- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18318+ CLEAR_FLAG(F_CF);
18319+ CLEAR_FLAG(F_SF);
18320+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
18321+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18322
18323- M.x86.R_AX = (u16)div;
18324- M.x86.R_DX = (u16)mod;
18325+ M.x86.R_AX = (u16) div;
18326+ M.x86.R_DX = (u16) mod;
18327 }
18328
18329 /****************************************************************************
18330 REMARKS:
18331 Implements the DIV instruction and side effects.
18332 ****************************************************************************/
18333-void div_long(u32 s)
18334+void
18335+div_long(u32 s)
18336 {
18337 #ifdef __HAS_LONG_LONG__
18338- u64 dvd, div, mod;
18339-
18340- dvd = (((u64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
18341- if (s == 0) {
18342- x86emu_intr_raise(0);
18343- return;
18344- }
18345- div = dvd / (u32)s;
18346- mod = dvd % (u32)s;
18347- if (abs(div) > 0xffffffff) {
18348- x86emu_intr_raise(0);
18349- return;
18350- }
18351+ u64 dvd, div, mod;
18352+
18353+ dvd = (((u64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
18354+ if (s == 0) {
18355+ x86emu_intr_raise(0);
18356+ return;
18357+ }
18358+ div = dvd / (u32) s;
18359+ mod = dvd % (u32) s;
18360+ if (abs(div) > 0xffffffff) {
18361+ x86emu_intr_raise(0);
18362+ return;
18363+ }
18364 #else
18365- s32 div = 0, mod;
18366- s32 h_dvd = M.x86.R_EDX;
18367- u32 l_dvd = M.x86.R_EAX;
18368-
18369- u32 h_s = s;
18370- u32 l_s = 0;
18371- int counter = 32;
18372- int carry;
18373-
18374- if (s == 0) {
18375- x86emu_intr_raise(0);
18376- return;
18377- }
18378- do {
18379- div <<= 1;
18380- carry = (l_dvd >= l_s) ? 0 : 1;
18381-
18382- if (h_dvd < (h_s + carry)) {
18383- h_s >>= 1;
18384- l_s = s << (--counter);
18385- continue;
18386- } else {
18387- h_dvd -= (h_s + carry);
18388- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
18389- : (l_dvd - l_s);
18390- h_s >>= 1;
18391- l_s = s << (--counter);
18392- div |= 1;
18393- continue;
18394- }
18395-
18396- } while (counter > -1);
18397- /* overflow */
18398- if (h_dvd || (l_dvd > s)) {
18399- x86emu_intr_raise(0);
18400- return;
18401- }
18402- mod = l_dvd;
18403+ s32 div = 0, mod;
18404+ s32 h_dvd = M.x86.R_EDX;
18405+ u32 l_dvd = M.x86.R_EAX;
18406+
18407+ u32 h_s = s;
18408+ u32 l_s = 0;
18409+ int counter = 32;
18410+ int carry;
18411+
18412+ if (s == 0) {
18413+ x86emu_intr_raise(0);
18414+ return;
18415+ }
18416+ do {
18417+ div <<= 1;
18418+ carry = (l_dvd >= l_s) ? 0 : 1;
18419+
18420+ if (h_dvd < (h_s + carry)) {
18421+ h_s >>= 1;
18422+ l_s = s << (--counter);
18423+ continue;
18424+ }
18425+ else {
18426+ h_dvd -= (h_s + carry);
18427+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
18428+ : (l_dvd - l_s);
18429+ h_s >>= 1;
18430+ l_s = s << (--counter);
18431+ div |= 1;
18432+ continue;
18433+ }
18434+
18435+ } while (counter > -1);
18436+ /* overflow */
18437+ if (h_dvd || (l_dvd > s)) {
18438+ x86emu_intr_raise(0);
18439+ return;
18440+ }
18441+ mod = l_dvd;
18442 #endif
18443- CLEAR_FLAG(F_CF);
18444- CLEAR_FLAG(F_AF);
18445- CLEAR_FLAG(F_SF);
18446- SET_FLAG(F_ZF);
18447- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18448+ CLEAR_FLAG(F_CF);
18449+ CLEAR_FLAG(F_AF);
18450+ CLEAR_FLAG(F_SF);
18451+ SET_FLAG(F_ZF);
18452+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
18453
18454- M.x86.R_EAX = (u32)div;
18455- M.x86.R_EDX = (u32)mod;
18456+ M.x86.R_EAX = (u32) div;
18457+ M.x86.R_EDX = (u32) mod;
18458 }
18459
18460 /****************************************************************************
18461 REMARKS:
18462 Implements the IN string instruction and side effects.
18463 ****************************************************************************/
18464-void ins(int size)
18465+void
18466+ins(int size)
18467 {
18468- int inc = size;
18469+ int inc = size;
18470
18471- if (ACCESS_FLAG(F_DF)) {
18472- inc = -size;
18473- }
18474- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
18475+ if (ACCESS_FLAG(F_DF)) {
18476+ inc = -size;
18477+ }
18478+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
18479 /* dont care whether REPE or REPNE */
18480 /* in until CX is ZERO. */
18481- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
18482- M.x86.R_ECX : M.x86.R_CX);
18483+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
18484+ M.x86.R_ECX : M.x86.R_CX);
18485 switch (size) {
18486- case 1:
18487+ case 1:
18488 while (count--) {
18489- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
18490- (*sys_inb)(M.x86.R_DX));
18491- M.x86.R_DI += inc;
18492+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
18493+ (*sys_inb) (M.x86.R_DX));
18494+ M.x86.R_DI += inc;
18495 }
18496 break;
18497
18498- case 2:
18499+ case 2:
18500 while (count--) {
18501- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
18502- (*sys_inw)(M.x86.R_DX));
18503- M.x86.R_DI += inc;
18504+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
18505+ (*sys_inw) (M.x86.R_DX));
18506+ M.x86.R_DI += inc;
18507 }
18508 break;
18509- case 4:
18510+ case 4:
18511 while (count--) {
18512- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
18513- (*sys_inl)(M.x86.R_DX));
18514- M.x86.R_DI += inc;
18515+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
18516+ (*sys_inl) (M.x86.R_DX));
18517+ M.x86.R_DI += inc;
18518+ break;
18519 }
18520- break;
18521 }
18522- M.x86.R_CX = 0;
18523- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
18524- M.x86.R_ECX = 0;
18525+ M.x86.R_CX = 0;
18526+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
18527+ M.x86.R_ECX = 0;
18528 }
18529- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
18530- } else {
18531+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
18532+ }
18533+ else {
18534 switch (size) {
18535- case 1:
18536- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
18537- (*sys_inb)(M.x86.R_DX));
18538+ case 1:
18539+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
18540+ (*sys_inb) (M.x86.R_DX));
18541 break;
18542- case 2:
18543- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
18544- (*sys_inw)(M.x86.R_DX));
18545+ case 2:
18546+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
18547+ (*sys_inw) (M.x86.R_DX));
18548 break;
18549- case 4:
18550- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
18551- (*sys_inl)(M.x86.R_DX));
18552+ case 4:
18553+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
18554+ (*sys_inl) (M.x86.R_DX));
18555 break;
18556 }
18557- M.x86.R_DI += inc;
18558+ M.x86.R_DI += inc;
18559 }
18560 }
18561
18562@@ -2518,63 +2654,65 @@ void ins(int size)
18563 REMARKS:
18564 Implements the OUT string instruction and side effects.
18565 ****************************************************************************/
18566-void outs(int size)
18567+void
18568+outs(int size)
18569 {
18570 int inc = size;
18571
18572- if (ACCESS_FLAG(F_DF)) {
18573+ if (ACCESS_FLAG(F_DF)) {
18574 inc = -size;
18575 }
18576- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
18577+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
18578 /* dont care whether REPE or REPNE */
18579 /* out until CX is ZERO. */
18580- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
18581- M.x86.R_ECX : M.x86.R_CX);
18582+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
18583+ M.x86.R_ECX : M.x86.R_CX);
18584 switch (size) {
18585- case 1:
18586+ case 1:
18587 while (count--) {
18588- (*sys_outb)(M.x86.R_DX,
18589- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
18590- M.x86.R_SI += inc;
18591+ (*sys_outb) (M.x86.R_DX,
18592+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
18593+ M.x86.R_SI += inc;
18594 }
18595 break;
18596
18597- case 2:
18598+ case 2:
18599 while (count--) {
18600- (*sys_outw)(M.x86.R_DX,
18601- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
18602- M.x86.R_SI += inc;
18603+ (*sys_outw) (M.x86.R_DX,
18604+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
18605+ M.x86.R_SI += inc;
18606 }
18607 break;
18608- case 4:
18609+ case 4:
18610 while (count--) {
18611- (*sys_outl)(M.x86.R_DX,
18612- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
18613- M.x86.R_SI += inc;
18614+ (*sys_outl) (M.x86.R_DX,
18615+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
18616+ M.x86.R_SI += inc;
18617+ break;
18618 }
18619- break;
18620 }
18621- M.x86.R_CX = 0;
18622- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
18623- M.x86.R_ECX = 0;
18624+ M.x86.R_CX = 0;
18625+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
18626+ M.x86.R_ECX = 0;
18627 }
18628- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
18629- } else {
18630+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
18631+ }
18632+ else {
18633 switch (size) {
18634- case 1:
18635- (*sys_outb)(M.x86.R_DX,
18636- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
18637+ case 1:
18638+ (*sys_outb) (M.x86.R_DX,
18639+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
18640 break;
18641- case 2:
18642- (*sys_outw)(M.x86.R_DX,
18643- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
18644+ case 2:
18645+ (*sys_outw) (M.x86.R_DX,
18646+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
18647 break;
18648- case 4:
18649- (*sys_outl)(M.x86.R_DX,
18650- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
18651+ case 4:
18652+ (*sys_outl) (M.x86.R_DX,
18653+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
18654 break;
18655 }
18656- M.x86.R_SI += inc;
18657+ M.x86.R_SI += inc;
18658 }
18659 }
18660
18661@@ -2585,11 +2723,12 @@ addr - Address to fetch word from
18662 REMARKS:
18663 Fetches a word from emulator memory using an absolute address.
18664 ****************************************************************************/
18665-u16 mem_access_word(int addr)
18666+u16
18667+mem_access_word(int addr)
18668 {
18669-DB( if (CHECK_MEM_ACCESS())
18670- x86emu_check_mem_access(addr);)
18671- return (*sys_rdw)(addr);
18672+ DB(if (CHECK_MEM_ACCESS())
18673+ x86emu_check_mem_access(addr);)
18674+ return (*sys_rdw) (addr);
18675 }
18676
18677 /****************************************************************************
18678@@ -2598,12 +2737,13 @@ Pushes a word onto the stack.
18679
18680 NOTE: Do not inline this, as (*sys_wrX) is already inline!
18681 ****************************************************************************/
18682-void push_word(u16 w)
18683+void
18684+push_word(u16 w)
18685 {
18686-DB( if (CHECK_SP_ACCESS())
18687- x86emu_check_sp_access();)
18688- M.x86.R_SP -= 2;
18689- (*sys_wrw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
18690+ DB(if (CHECK_SP_ACCESS())
18691+ x86emu_check_sp_access();)
18692+ M.x86.R_SP -= 2;
18693+ (*sys_wrw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
18694 }
18695
18696 /****************************************************************************
18697@@ -2612,12 +2752,13 @@ Pushes a long onto the stack.
18698
18699 NOTE: Do not inline this, as (*sys_wrX) is already inline!
18700 ****************************************************************************/
18701-void push_long(u32 w)
18702+void
18703+push_long(u32 w)
18704 {
18705-DB( if (CHECK_SP_ACCESS())
18706- x86emu_check_sp_access();)
18707- M.x86.R_SP -= 4;
18708- (*sys_wrl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
18709+ DB(if (CHECK_SP_ACCESS())
18710+ x86emu_check_sp_access();)
18711+ M.x86.R_SP -= 4;
18712+ (*sys_wrl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
18713 }
18714
18715 /****************************************************************************
18716@@ -2626,15 +2767,16 @@ Pops a word from the stack.
18717
18718 NOTE: Do not inline this, as (*sys_rdX) is already inline!
18719 ****************************************************************************/
18720-u16 pop_word(void)
18721+u16
18722+pop_word(void)
18723 {
18724- register u16 res;
18725+ register u16 res;
18726
18727-DB( if (CHECK_SP_ACCESS())
18728- x86emu_check_sp_access();)
18729- res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
18730- M.x86.R_SP += 2;
18731- return res;
18732+ DB(if (CHECK_SP_ACCESS())
18733+ x86emu_check_sp_access();)
18734+ res = (*sys_rdw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
18735+ M.x86.R_SP += 2;
18736+ return res;
18737 }
18738
18739 /****************************************************************************
18740@@ -2643,14 +2785,15 @@ Pops a long from the stack.
18741
18742 NOTE: Do not inline this, as (*sys_rdX) is already inline!
18743 ****************************************************************************/
18744-u32 pop_long(void)
18745+u32
18746+pop_long(void)
18747 {
18748 register u32 res;
18749
18750-DB( if (CHECK_SP_ACCESS())
18751- x86emu_check_sp_access();)
18752- res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
18753- M.x86.R_SP += 4;
18754+ DB(if (CHECK_SP_ACCESS())
18755+ x86emu_check_sp_access();)
18756+ res = (*sys_rdl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
18757+ M.x86.R_SP += 4;
18758 return res;
18759 }
18760
18761@@ -2658,45 +2801,59 @@ DB( if (CHECK_SP_ACCESS())
18762 REMARKS:
18763 CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
18764 ****************************************************************************/
18765-void cpuid (void)
18766-{
18767- u32 feature = M.x86.R_EAX;
18768-
18769- switch (feature) {
18770- case 0:
18771- /* Regardless if we have real data from the hardware, the emulator
18772- * will only support upto feature 1, which we set in register EAX.
18773- * Registers EBX:EDX:ECX contain a string identifying the CPU.
18774- */
18775- M.x86.R_EAX = 1;
18776- /* EBX:EDX:ECX = "GenuineIntel" */
18777- M.x86.R_EBX = 0x756e6547;
18778- M.x86.R_EDX = 0x49656e69;
18779- M.x86.R_ECX = 0x6c65746e;
18780- break;
18781- case 1:
18782- /* If we don't have x86 compatible hardware, we return values from an
18783- * Intel 486dx4; which was one of the first processors to have CPUID.
18784- */
18785- M.x86.R_EAX = 0x00000480;
18786- M.x86.R_EBX = 0x00000000;
18787- M.x86.R_ECX = 0x00000000;
18788- M.x86.R_EDX = 0x00000002; /* VME */
18789- /* In the case that we have hardware CPUID instruction, we make sure
18790- * that the features reported are limited to TSC and VME.
18791- */
18792- M.x86.R_EDX &= 0x00000012;
18793- break;
18794- default:
18795- /* Finally, we don't support any additional features. Most CPUs
18796- * return all zeros when queried for invalid or unsupported feature
18797- * numbers.
18798- */
18799- M.x86.R_EAX = 0;
18800- M.x86.R_EBX = 0;
18801- M.x86.R_ECX = 0;
18802- M.x86.R_EDX = 0;
18803- break;
18804- }
18805-}
18806+void
18807+cpuid(void)
18808+{
18809+ u32 feature = M.x86.R_EAX;
18810
18811+#ifdef X86EMU_HAS_HW_CPUID
18812+ /* If the platform allows it, we will base our values on the real
18813+ * results from the CPUID instruction. We limit support to the
18814+ * first two features, and the results of those are sanitized.
18815+ */
18816+ if (feature <= 1)
18817+ hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX);
18818+#endif
18819+
18820+ switch (feature) {
18821+ case 0:
18822+ /* Regardless if we have real data from the hardware, the emulator
18823+ * will only support upto feature 1, which we set in register EAX.
18824+ * Registers EBX:EDX:ECX contain a string identifying the CPU.
18825+ */
18826+ M.x86.R_EAX = 1;
18827+#ifndef X86EMU_HAS_HW_CPUID
18828+ /* EBX:EDX:ECX = "GenuineIntel" */
18829+ M.x86.R_EBX = 0x756e6547;
18830+ M.x86.R_EDX = 0x49656e69;
18831+ M.x86.R_ECX = 0x6c65746e;
18832+#endif
18833+ break;
18834+ case 1:
18835+#ifndef X86EMU_HAS_HW_CPUID
18836+ /* If we don't have x86 compatible hardware, we return values from an
18837+ * Intel 486dx4; which was one of the first processors to have CPUID.
18838+ */
18839+ M.x86.R_EAX = 0x00000480;
18840+ M.x86.R_EBX = 0x00000000;
18841+ M.x86.R_ECX = 0x00000000;
18842+ M.x86.R_EDX = 0x00000002; /* VME */
18843+#else
18844+ /* In the case that we have hardware CPUID instruction, we make sure
18845+ * that the features reported are limited to TSC and VME.
18846+ */
18847+ M.x86.R_EDX &= 0x00000012;
18848+#endif
18849+ break;
18850+ default:
18851+ /* Finally, we don't support any additional features. Most CPUs
18852+ * return all zeros when queried for invalid or unsupported feature
18853+ * numbers.
18854+ */
18855+ M.x86.R_EAX = 0;
18856+ M.x86.R_EBX = 0;
18857+ M.x86.R_ECX = 0;
18858+ M.x86.R_EDX = 0;
18859+ break;
18860+ }
18861+}
18862diff --git a/libs/x86emu/sys.c b/libs/x86emu/sys.c
18863index 4d90ea3..c514dde 100644
18864--- a/libs/x86emu/sys.c
18865+++ b/libs/x86emu/sys.c
18866@@ -47,223 +47,133 @@
18867 #include "x86emu/prim_ops.h"
18868 #ifndef NO_SYS_HEADERS
18869 #include <string.h>
18870-#endif
18871-/*------------------------- Global Variables ------------------------------*/
18872+#endif
18873
18874-X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
18875-X86EMU_intrFuncs _X86EMU_intrTab[256];
18876+#ifdef __GNUC__
18877
18878-/*----------------------------- Implementation ----------------------------*/
18879-#if defined(__alpha__) || defined(__alpha)
18880-/* to cope with broken egcs-1.1.2 :-(((( */
18881-
18882-#define ALPHA_UALOADS
18883-/*
18884- * inline functions to do unaligned accesses
18885- * from linux/include/asm-alpha/unaligned.h
18886- */
18887-
18888-/*
18889- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
18890- * packed structures to talk about such things with.
18891- */
18892-
18893-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
18894-struct __una_u64 { unsigned long x __attribute__((packed)); };
18895-struct __una_u32 { unsigned int x __attribute__((packed)); };
18896-struct __una_u16 { unsigned short x __attribute__((packed)); };
18897-#endif
18898+/* Define some packed structures to use with unaligned accesses */
18899+
18900+struct __una_u64 {
18901+ u64 x __attribute__ ((packed));
18902+};
18903+struct __una_u32 {
18904+ u32 x __attribute__ ((packed));
18905+};
18906+struct __una_u16 {
18907+ u16 x __attribute__ ((packed));
18908+};
18909+
18910+/* Elemental unaligned loads */
18911
18912-static __inline__ unsigned long ldq_u(unsigned long * r11)
18913+static __inline__ u64
18914+ldq_u(u64 * p)
18915 {
18916-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
18917- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
18918- return ptr->x;
18919-#else
18920- unsigned long r1,r2;
18921- __asm__("ldq_u %0,%3\n\t"
18922- "ldq_u %1,%4\n\t"
18923- "extql %0,%2,%0\n\t"
18924- "extqh %1,%2,%1"
18925- :"=&r" (r1), "=&r" (r2)
18926- :"r" (r11),
18927- "m" (*r11),
18928- "m" (*(const unsigned long *)(7+(char *) r11)));
18929- return r1 | r2;
18930-#endif
18931+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
18932+
18933+ return ptr->x;
18934 }
18935
18936-static __inline__ unsigned long ldl_u(unsigned int * r11)
18937+static __inline__ u32
18938+ldl_u(u32 * p)
18939 {
18940-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
18941- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
18942- return ptr->x;
18943-#else
18944- unsigned long r1,r2;
18945- __asm__("ldq_u %0,%3\n\t"
18946- "ldq_u %1,%4\n\t"
18947- "extll %0,%2,%0\n\t"
18948- "extlh %1,%2,%1"
18949- :"=&r" (r1), "=&r" (r2)
18950- :"r" (r11),
18951- "m" (*r11),
18952- "m" (*(const unsigned long *)(3+(char *) r11)));
18953- return r1 | r2;
18954-#endif
18955+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
18956+
18957+ return ptr->x;
18958 }
18959
18960-static __inline__ unsigned long ldw_u(unsigned short * r11)
18961+static __inline__ u16
18962+ldw_u(u16 * p)
18963 {
18964-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
18965- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
18966- return ptr->x;
18967-#else
18968- unsigned long r1,r2;
18969- __asm__("ldq_u %0,%3\n\t"
18970- "ldq_u %1,%4\n\t"
18971- "extwl %0,%2,%0\n\t"
18972- "extwh %1,%2,%1"
18973- :"=&r" (r1), "=&r" (r2)
18974- :"r" (r11),
18975- "m" (*r11),
18976- "m" (*(const unsigned long *)(1+(char *) r11)));
18977- return r1 | r2;
18978-#endif
18979+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
18980+
18981+ return ptr->x;
18982 }
18983
18984-/*
18985- * Elemental unaligned stores
18986- */
18987+/* Elemental unaligned stores */
18988
18989-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
18990+static __inline__ void
18991+stq_u(u64 val, u64 * p)
18992 {
18993-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
18994- struct __una_u64 *ptr = (struct __una_u64 *) r11;
18995- ptr->x = r5;
18996-#else
18997- unsigned long r1,r2,r3,r4;
18998-
18999- __asm__("ldq_u %3,%1\n\t"
19000- "ldq_u %2,%0\n\t"
19001- "insqh %6,%7,%5\n\t"
19002- "insql %6,%7,%4\n\t"
19003- "mskqh %3,%7,%3\n\t"
19004- "mskql %2,%7,%2\n\t"
19005- "bis %3,%5,%3\n\t"
19006- "bis %2,%4,%2\n\t"
19007- "stq_u %3,%1\n\t"
19008- "stq_u %2,%0"
19009- :"=m" (*r11),
19010- "=m" (*(unsigned long *)(7+(char *) r11)),
19011- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
19012- :"r" (r5), "r" (r11));
19013-#endif
19014+ struct __una_u64 *ptr = (struct __una_u64 *) p;
19015+
19016+ ptr->x = val;
19017 }
19018
19019-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
19020+static __inline__ void
19021+stl_u(u32 val, u32 * p)
19022 {
19023-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
19024- struct __una_u32 *ptr = (struct __una_u32 *) r11;
19025- ptr->x = r5;
19026-#else
19027- unsigned long r1,r2,r3,r4;
19028-
19029- __asm__("ldq_u %3,%1\n\t"
19030- "ldq_u %2,%0\n\t"
19031- "inslh %6,%7,%5\n\t"
19032- "insll %6,%7,%4\n\t"
19033- "msklh %3,%7,%3\n\t"
19034- "mskll %2,%7,%2\n\t"
19035- "bis %3,%5,%3\n\t"
19036- "bis %2,%4,%2\n\t"
19037- "stq_u %3,%1\n\t"
19038- "stq_u %2,%0"
19039- :"=m" (*r11),
19040- "=m" (*(unsigned long *)(3+(char *) r11)),
19041- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
19042- :"r" (r5), "r" (r11));
19043-#endif
19044+ struct __una_u32 *ptr = (struct __una_u32 *) p;
19045+
19046+ ptr->x = val;
19047 }
19048
19049-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
19050+static __inline__ void
19051+stw_u(u16 val, u16 * p)
19052 {
19053-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
19054- struct __una_u16 *ptr = (struct __una_u16 *) r11;
19055- ptr->x = r5;
19056-#else
19057- unsigned long r1,r2,r3,r4;
19058-
19059- __asm__("ldq_u %3,%1\n\t"
19060- "ldq_u %2,%0\n\t"
19061- "inswh %6,%7,%5\n\t"
19062- "inswl %6,%7,%4\n\t"
19063- "mskwh %3,%7,%3\n\t"
19064- "mskwl %2,%7,%2\n\t"
19065- "bis %3,%5,%3\n\t"
19066- "bis %2,%4,%2\n\t"
19067- "stq_u %3,%1\n\t"
19068- "stq_u %2,%0"
19069- :"=m" (*r11),
19070- "=m" (*(unsigned long *)(1+(char *) r11)),
19071- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
19072- :"r" (r5), "r" (r11));
19073-#endif
19074+ struct __una_u16 *ptr = (struct __una_u16 *) p;
19075+
19076+ ptr->x = val;
19077 }
19078+#else /* !__GNUC__ */
19079
19080-#elif defined(__GNUC__) && ((__GNUC__ < 3)) && \
19081- (defined (__ia64__) || defined (ia64__))
19082-#define IA64_UALOADS
19083-/*
19084- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
19085- * packed structures to talk about such things with.
19086- */
19087-struct __una_u64 { unsigned long x __attribute__((packed)); };
19088-struct __una_u32 { unsigned int x __attribute__((packed)); };
19089-struct __una_u16 { unsigned short x __attribute__((packed)); };
19090-
19091-static __inline__ unsigned long
19092-__uldq (const unsigned long * r11)
19093+static __inline__ u64
19094+ldq_u(u64 * p)
19095 {
19096- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
19097- return ptr->x;
19098+ u64 ret;
19099+
19100+ memmove(&ret, p, sizeof(*p));
19101+ return ret;
19102 }
19103
19104-static __inline__ unsigned long
19105-uldl (const unsigned int * r11)
19106+static __inline__ u32
19107+ldl_u(u32 * p)
19108 {
19109- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
19110- return ptr->x;
19111+ u32 ret;
19112+
19113+ memmove(&ret, p, sizeof(*p));
19114+ return ret;
19115 }
19116
19117-static __inline__ unsigned long
19118-uldw (const unsigned short * r11)
19119+static __inline__ u16
19120+ldw_u(u16 * p)
19121 {
19122- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
19123- return ptr->x;
19124+ u16 ret;
19125+
19126+ memmove(&ret, p, sizeof(*p));
19127+ return ret;
19128 }
19129
19130 static __inline__ void
19131-ustq (unsigned long r5, unsigned long * r11)
19132+stq_u(u64 val, u64 * p)
19133 {
19134- struct __una_u64 *ptr = (struct __una_u64 *) r11;
19135- ptr->x = r5;
19136+ u64 tmp = val;
19137+
19138+ memmove(p, &tmp, sizeof(*p));
19139 }
19140
19141 static __inline__ void
19142-ustl (unsigned long r5, unsigned int * r11)
19143+stl_u(u32 val, u32 * p)
19144 {
19145- struct __una_u32 *ptr = (struct __una_u32 *) r11;
19146- ptr->x = r5;
19147+ u32 tmp = val;
19148+
19149+ memmove(p, &tmp, sizeof(*p));
19150 }
19151
19152 static __inline__ void
19153-ustw (unsigned long r5, unsigned short * r11)
19154+stw_u(u16 val, u16 * p)
19155 {
19156- struct __una_u16 *ptr = (struct __una_u16 *) r11;
19157- ptr->x = r5;
19158+ u16 tmp = val;
19159+
19160+ memmove(p, &tmp, sizeof(*p));
19161 }
19162
19163-#endif
19164+#endif /* __GNUC__ */
19165+/*------------------------- Global Variables ------------------------------*/
19166+
19167+X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
19168+X86EMU_intrFuncs _X86EMU_intrTab[256];
19169+
19170+/*----------------------------- Implementation ----------------------------*/
19171
19172 /****************************************************************************
19173 PARAMETERS:
19174@@ -275,19 +185,20 @@ Byte value read from emulator memory.
19175 REMARKS:
19176 Reads a byte value from the emulator memory.
19177 ****************************************************************************/
19178-u8 X86API rdb(
19179- u32 addr)
19180+u8 X86API
19181+rdb(u32 addr)
19182 {
19183- u8 val;
19184-
19185- if (addr > M.mem_size - 1) {
19186- DB(printk("mem_read: address %#lx out of range!\n", addr);)
19187- HALT_SYS();
19188- }
19189- val = *(u8*)(M.mem_base + addr);
19190-DB( if (DEBUG_MEM_TRACE())
19191- printk("%#08x 1 -> %#x\n", addr, val);)
19192- return val;
19193+ u8 val;
19194+
19195+ if (addr > M.mem_size - 1) {
19196+ DB(printk("mem_read: address %#lx out of range!\n", addr);
19197+ )
19198+ HALT_SYS();
19199+ }
19200+ val = *(u8 *) (M.mem_base + addr);
19201+ DB(if (DEBUG_MEM_TRACE())
19202+ printk("%#08x 1 -> %#x\n", addr, val);)
19203+ return val;
19204 }
19205
19206 /****************************************************************************
19207@@ -300,32 +211,27 @@ Word value read from emulator memory.
19208 REMARKS:
19209 Reads a word value from the emulator memory.
19210 ****************************************************************************/
19211-u16 X86API rdw(
19212- u32 addr)
19213+u16 X86API
19214+rdw(u32 addr)
19215 {
19216- u16 val = 0;
19217+ u16 val = 0;
19218
19219- if (addr > M.mem_size - 2) {
19220- DB(printk("mem_read: address %#lx out of range!\n", addr);)
19221- HALT_SYS();
19222- }
19223+ if (addr > M.mem_size - 2) {
19224+ DB(printk("mem_read: address %#lx out of range!\n", addr);
19225+ )
19226+ HALT_SYS();
19227+ }
19228 #ifdef __BIG_ENDIAN__
19229- if (addr & 0x1) {
19230- val = (*(u8*)(M.mem_base + addr) |
19231- (*(u8*)(M.mem_base + addr + 1) << 8));
19232- }
19233- else
19234-#endif
19235-#if defined(ALPHA_UALOADS)
19236- val = ldw_u((u16*)(M.mem_base + addr));
19237-#elif defined(IA64_UALOADS)
19238- val = uldw((u16*)(M.mem_base + addr));
19239-#else
19240- val = *(u16*)(M.mem_base + addr);
19241+ if (addr & 0x1) {
19242+ val = (*(u8 *) (M.mem_base + addr) |
19243+ (*(u8 *) (M.mem_base + addr + 1) << 8));
19244+ }
19245+ else
19246 #endif
19247- DB( if (DEBUG_MEM_TRACE())
19248- printk("%#08x 2 -> %#x\n", addr, val);)
19249- return val;
19250+ val = ldw_u((u16 *) (M.mem_base + addr));
19251+ DB(if (DEBUG_MEM_TRACE())
19252+ printk("%#08x 2 -> %#x\n", addr, val);)
19253+ return val;
19254 }
19255
19256 /****************************************************************************
19257@@ -337,34 +243,29 @@ Long value read from emulator memory.
19258 REMARKS:
19259 Reads a long value from the emulator memory.
19260 ****************************************************************************/
19261-u32 X86API rdl(
19262- u32 addr)
19263+u32 X86API
19264+rdl(u32 addr)
19265 {
19266- u32 val = 0;
19267+ u32 val = 0;
19268
19269- if (addr > M.mem_size - 4) {
19270- DB(printk("mem_read: address %#lx out of range!\n", addr);)
19271- HALT_SYS();
19272- }
19273+ if (addr > M.mem_size - 4) {
19274+ DB(printk("mem_read: address %#lx out of range!\n", addr);
19275+ )
19276+ HALT_SYS();
19277+ }
19278 #ifdef __BIG_ENDIAN__
19279- if (addr & 0x3) {
19280- val = (*(u8*)(M.mem_base + addr + 0) |
19281- (*(u8*)(M.mem_base + addr + 1) << 8) |
19282- (*(u8*)(M.mem_base + addr + 2) << 16) |
19283- (*(u8*)(M.mem_base + addr + 3) << 24));
19284- }
19285- else
19286-#endif
19287-#if defined(ALPHA_UALOADS)
19288- val = ldl_u((u32*)(M.mem_base + addr));
19289-#elif defined(IA64_UALOADS)
19290- val = uldl((u32*)(M.mem_base + addr));
19291-#else
19292- val = *(u32*)(M.mem_base + addr);
19293+ if (addr & 0x3) {
19294+ val = (*(u8 *) (M.mem_base + addr + 0) |
19295+ (*(u8 *) (M.mem_base + addr + 1) << 8) |
19296+ (*(u8 *) (M.mem_base + addr + 2) << 16) |
19297+ (*(u8 *) (M.mem_base + addr + 3) << 24));
19298+ }
19299+ else
19300 #endif
19301-DB( if (DEBUG_MEM_TRACE())
19302- printk("%#08x 4 -> %#x\n", addr, val);)
19303- return val;
19304+ val = ldl_u((u32 *) (M.mem_base + addr));
19305+ DB(if (DEBUG_MEM_TRACE())
19306+ printk("%#08x 4 -> %#x\n", addr, val);)
19307+ return val;
19308 }
19309
19310 /****************************************************************************
19311@@ -375,17 +276,17 @@ val - Value to store
19312 REMARKS:
19313 Writes a byte value to emulator memory.
19314 ****************************************************************************/
19315-void X86API wrb(
19316- u32 addr,
19317- u8 val)
19318+void X86API
19319+wrb(u32 addr, u8 val)
19320 {
19321-DB( if (DEBUG_MEM_TRACE())
19322- printk("%#08x 1 <- %#x\n", addr, val);)
19323- if (addr > M.mem_size - 1) {
19324- DB(printk("mem_write: address %#lx out of range!\n", addr);)
19325- HALT_SYS();
19326- }
19327- *(u8*)(M.mem_base + addr) = val;
19328+ DB(if (DEBUG_MEM_TRACE())
19329+ printk("%#08x 1 <- %#x\n", addr, val);)
19330+ if (addr > M.mem_size - 1) {
19331+ DB(printk("mem_write: address %#lx out of range!\n", addr);
19332+ )
19333+ HALT_SYS();
19334+ }
19335+ *(u8 *) (M.mem_base + addr) = val;
19336 }
19337
19338 /****************************************************************************
19339@@ -396,30 +297,24 @@ val - Value to store
19340 REMARKS:
19341 Writes a word value to emulator memory.
19342 ****************************************************************************/
19343-void X86API wrw(
19344- u32 addr,
19345- u16 val)
19346+void X86API
19347+wrw(u32 addr, u16 val)
19348 {
19349-DB( if (DEBUG_MEM_TRACE())
19350- printk("%#08x 2 <- %#x\n", addr, val);)
19351- if (addr > M.mem_size - 2) {
19352- DB(printk("mem_write: address %#lx out of range!\n", addr);)
19353- HALT_SYS();
19354- }
19355+ DB(if (DEBUG_MEM_TRACE())
19356+ printk("%#08x 2 <- %#x\n", addr, val);)
19357+ if (addr > M.mem_size - 2) {
19358+ DB(printk("mem_write: address %#lx out of range!\n", addr);
19359+ )
19360+ HALT_SYS();
19361+ }
19362 #ifdef __BIG_ENDIAN__
19363- if (addr & 0x1) {
19364- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
19365- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
19366- }
19367- else
19368-#endif
19369-#if defined(ALPHA_UALOADS)
19370- stw_u(val,(u16*)(M.mem_base + addr));
19371-#elif defined(IA64_UALOADS)
19372- ustw(val,(u16*)(M.mem_base + addr));
19373-#else
19374- *(u16*)(M.mem_base + addr) = val;
19375+ if (addr & 0x1) {
19376+ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
19377+ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
19378+ }
19379+ else
19380 #endif
19381+ stw_u(val, (u16 *) (M.mem_base + addr));
19382 }
19383
19384 /****************************************************************************
19385@@ -430,32 +325,26 @@ val - Value to store
19386 REMARKS:
19387 Writes a long value to emulator memory.
19388 ****************************************************************************/
19389-void X86API wrl(
19390- u32 addr,
19391- u32 val)
19392+void X86API
19393+wrl(u32 addr, u32 val)
19394 {
19395-DB( if (DEBUG_MEM_TRACE())
19396- printk("%#08x 4 <- %#x\n", addr, val);)
19397- if (addr > M.mem_size - 4) {
19398- DB(printk("mem_write: address %#lx out of range!\n", addr);)
19399- HALT_SYS();
19400- }
19401+ DB(if (DEBUG_MEM_TRACE())
19402+ printk("%#08x 4 <- %#x\n", addr, val);)
19403+ if (addr > M.mem_size - 4) {
19404+ DB(printk("mem_write: address %#lx out of range!\n", addr);
19405+ )
19406+ HALT_SYS();
19407+ }
19408 #ifdef __BIG_ENDIAN__
19409- if (addr & 0x1) {
19410- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
19411- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
19412- *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
19413- *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
19414- }
19415- else
19416-#endif
19417-#if defined(ALPHA_UALOADS)
19418- stl_u(val,(u32*)(M.mem_base + addr));
19419-#elif defined(IA64_UALOADS)
19420- ustl(val,(u32*)(M.mem_base + addr));
19421-#else
19422- *(u32*)(M.mem_base + addr) = val;
19423+ if (addr & 0x1) {
19424+ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
19425+ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
19426+ *(u8 *) (M.mem_base + addr + 2) = (val >> 16) & 0xff;
19427+ *(u8 *) (M.mem_base + addr + 3) = (val >> 24) & 0xff;
19428+ }
19429+ else
19430 #endif
19431+ stl_u(val, (u32 *) (M.mem_base + addr));
19432 }
19433
19434 /****************************************************************************
19435@@ -466,12 +355,12 @@ RETURN:
19436 REMARKS:
19437 Default PIO byte read function. Doesn't perform real inb.
19438 ****************************************************************************/
19439-static u8 X86API p_inb(
19440- X86EMU_pioAddr addr)
19441+static u8 X86API
19442+p_inb(X86EMU_pioAddr addr)
19443 {
19444-DB( if (DEBUG_IO_TRACE())
19445- printk("inb %#04x \n", addr);)
19446- return 0;
19447+ DB(if (DEBUG_IO_TRACE())
19448+ printk("inb %#04x \n", addr);)
19449+ return 0;
19450 }
19451
19452 /****************************************************************************
19453@@ -482,12 +371,12 @@ RETURN:
19454 REMARKS:
19455 Default PIO word read function. Doesn't perform real inw.
19456 ****************************************************************************/
19457-static u16 X86API p_inw(
19458- X86EMU_pioAddr addr)
19459+static u16 X86API
19460+p_inw(X86EMU_pioAddr addr)
19461 {
19462-DB( if (DEBUG_IO_TRACE())
19463- printk("inw %#04x \n", addr);)
19464- return 0;
19465+ DB(if (DEBUG_IO_TRACE())
19466+ printk("inw %#04x \n", addr);)
19467+ return 0;
19468 }
19469
19470 /****************************************************************************
19471@@ -498,12 +387,12 @@ RETURN:
19472 REMARKS:
19473 Default PIO long read function. Doesn't perform real inl.
19474 ****************************************************************************/
19475-static u32 X86API p_inl(
19476- X86EMU_pioAddr addr)
19477+static u32 X86API
19478+p_inl(X86EMU_pioAddr addr)
19479 {
19480-DB( if (DEBUG_IO_TRACE())
19481- printk("inl %#04x \n", addr);)
19482- return 0;
19483+ DB(if (DEBUG_IO_TRACE())
19484+ printk("inl %#04x \n", addr);)
19485+ return 0;
19486 }
19487
19488 /****************************************************************************
19489@@ -513,13 +402,12 @@ val - Value to store
19490 REMARKS:
19491 Default PIO byte write function. Doesn't perform real outb.
19492 ****************************************************************************/
19493-static void X86API p_outb(
19494- X86EMU_pioAddr addr,
19495- u8 val)
19496+static void X86API
19497+p_outb(X86EMU_pioAddr addr, u8 val)
19498 {
19499-DB( if (DEBUG_IO_TRACE())
19500- printk("outb %#02x -> %#04x \n", val, addr);)
19501- return;
19502+ DB(if (DEBUG_IO_TRACE())
19503+ printk("outb %#02x -> %#04x \n", val, addr);)
19504+ return;
19505 }
19506
19507 /****************************************************************************
19508@@ -529,13 +417,12 @@ val - Value to store
19509 REMARKS:
19510 Default PIO word write function. Doesn't perform real outw.
19511 ****************************************************************************/
19512-static void X86API p_outw(
19513- X86EMU_pioAddr addr,
19514- u16 val)
19515+static void X86API
19516+p_outw(X86EMU_pioAddr addr, u16 val)
19517 {
19518-DB( if (DEBUG_IO_TRACE())
19519- printk("outw %#04x -> %#04x \n", val, addr);)
19520- return;
19521+ DB(if (DEBUG_IO_TRACE())
19522+ printk("outw %#04x -> %#04x \n", val, addr);)
19523+ return;
19524 }
19525
19526 /****************************************************************************
19527@@ -545,29 +432,29 @@ val - Value to store
19528 REMARKS:
19529 Default PIO ;ong write function. Doesn't perform real outl.
19530 ****************************************************************************/
19531-static void X86API p_outl(
19532- X86EMU_pioAddr addr,
19533- u32 val)
19534+static void X86API
19535+p_outl(X86EMU_pioAddr addr, u32 val)
19536 {
19537-DB( if (DEBUG_IO_TRACE())
19538- printk("outl %#08x -> %#04x \n", val, addr);)
19539- return;
19540+ DB(if (DEBUG_IO_TRACE())
19541+ printk("outl %#08x -> %#04x \n", val, addr);)
19542+ return;
19543 }
19544
19545 /*------------------------- Global Variables ------------------------------*/
19546
19547-u8 (X86APIP sys_rdb)(u32 addr) = rdb;
19548-u16 (X86APIP sys_rdw)(u32 addr) = rdw;
19549-u32 (X86APIP sys_rdl)(u32 addr) = rdl;
19550-void (X86APIP sys_wrb)(u32 addr,u8 val) = wrb;
19551-void (X86APIP sys_wrw)(u32 addr,u16 val) = wrw;
19552-void (X86APIP sys_wrl)(u32 addr,u32 val) = wrl;
19553-u8 (X86APIP sys_inb)(X86EMU_pioAddr addr) = p_inb;
19554-u16 (X86APIP sys_inw)(X86EMU_pioAddr addr) = p_inw;
19555-u32 (X86APIP sys_inl)(X86EMU_pioAddr addr) = p_inl;
19556-void (X86APIP sys_outb)(X86EMU_pioAddr addr, u8 val) = p_outb;
19557-void (X86APIP sys_outw)(X86EMU_pioAddr addr, u16 val) = p_outw;
19558-void (X86APIP sys_outl)(X86EMU_pioAddr addr, u32 val) = p_outl;
19559+u8(X86APIP sys_rdb) (u32 addr) = rdb;
19560+u16(X86APIP sys_rdw) (u32 addr) = rdw;
19561+u32(X86APIP sys_rdl) (u32 addr) = rdl;
19562+void (X86APIP sys_wrb) (u32 addr, u8 val) = wrb;
19563+void (X86APIP sys_wrw) (u32 addr, u16 val) = wrw;
19564+void (X86APIP sys_wrl) (u32 addr, u32 val) = wrl;
19565+
19566+u8(X86APIP sys_inb) (X86EMU_pioAddr addr) = p_inb;
19567+u16(X86APIP sys_inw) (X86EMU_pioAddr addr) = p_inw;
19568+u32(X86APIP sys_inl) (X86EMU_pioAddr addr) = p_inl;
19569+void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val) = p_outb;
19570+void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val) = p_outw;
19571+void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val) = p_outl;
19572
19573 /*----------------------------- Setup -------------------------------------*/
19574
19575@@ -580,8 +467,8 @@ This function is used to set the pointers to functions which access
19576 memory space, allowing the user application to override these functions
19577 and hook them out as necessary for their application.
19578 ****************************************************************************/
19579-void X86EMU_setupMemFuncs(
19580- X86EMU_memFuncs *funcs)
19581+void
19582+X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs)
19583 {
19584 sys_rdb = funcs->rdb;
19585 sys_rdw = funcs->rdw;
19586@@ -600,8 +487,8 @@ This function is used to set the pointers to functions which access
19587 I/O space, allowing the user application to override these functions
19588 and hook them out as necessary for their application.
19589 ****************************************************************************/
19590-void X86EMU_setupPioFuncs(
19591- X86EMU_pioFuncs *funcs)
19592+void
19593+X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs)
19594 {
19595 sys_inb = funcs->inb;
19596 sys_inw = funcs->inw;
19597@@ -624,17 +511,17 @@ in the emulator via the interrupt vector table. This allows the application
19598 to get control when the code being emulated executes specific software
19599 interrupts.
19600 ****************************************************************************/
19601-void X86EMU_setupIntrFuncs(
19602- X86EMU_intrFuncs funcs[])
19603+void
19604+X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[])
19605 {
19606 int i;
19607-
19608- for (i=0; i < 256; i++)
19609- _X86EMU_intrTab[i] = NULL;
19610- if (funcs) {
19611- for (i = 0; i < 256; i++)
19612- _X86EMU_intrTab[i] = funcs[i];
19613- }
19614+
19615+ for (i = 0; i < 256; i++)
19616+ _X86EMU_intrTab[i] = NULL;
19617+ if (funcs) {
19618+ for (i = 0; i < 256; i++)
19619+ _X86EMU_intrTab[i] = funcs[i];
19620+ }
19621 }
19622
19623 /****************************************************************************
19624@@ -649,15 +536,15 @@ so that the code in the emulator will continue processing the software
19625 interrupt as per normal. This essentially allows system code to actively
19626 hook and handle certain software interrupts as necessary.
19627 ****************************************************************************/
19628-void X86EMU_prepareForInt(
19629- int num)
19630+void
19631+X86EMU_prepareForInt(int num)
19632 {
19633- push_word((u16)M.x86.R_FLG);
19634+ push_word((u16) M.x86.R_FLG);
19635 CLEAR_FLAG(F_IF);
19636 CLEAR_FLAG(F_TF);
19637 push_word(M.x86.R_CS);
19638 M.x86.R_CS = mem_access_word(num * 4 + 2);
19639 push_word(M.x86.R_IP);
19640 M.x86.R_IP = mem_access_word(num * 4);
19641- M.x86.intr = 0;
19642+ M.x86.intr = 0;
19643 }
19644diff --git a/libs/x86emu/validate.c b/libs/x86emu/validate.c
19645index 239f6c1..4c36e1d 100644
19646--- a/libs/x86emu/validate.c
19647+++ b/libs/x86emu/validate.c
19648@@ -591,58 +591,62 @@
19649 printk("passed\n"); \
19650 }
19651
19652-void printk(const char *fmt, ...)
19653+void
19654+printk(const char *fmt, ...)
19655 {
19656 va_list argptr;
19657+
19658 va_start(argptr, fmt);
19659 vfprintf(stdout, fmt, argptr);
19660 fflush(stdout);
19661 va_end(argptr);
19662 }
19663
19664-char * print_flags(char *buf,ulong flags)
19665+char *
19666+print_flags(char *buf, ulong flags)
19667 {
19668 char *separator = "";
19669
19670 buf[0] = 0;
19671 if (flags & F_CF) {
19672- strcat(buf,separator);
19673- strcat(buf,"CF");
19674+ strcat(buf, separator);
19675+ strcat(buf, "CF");
19676 separator = ",";
19677- }
19678+ }
19679 if (flags & F_PF) {
19680- strcat(buf,separator);
19681- strcat(buf,"PF");
19682+ strcat(buf, separator);
19683+ strcat(buf, "PF");
19684 separator = ",";
19685- }
19686+ }
19687 if (flags & F_AF) {
19688- strcat(buf,separator);
19689- strcat(buf,"AF");
19690+ strcat(buf, separator);
19691+ strcat(buf, "AF");
19692 separator = ",";
19693- }
19694+ }
19695 if (flags & F_ZF) {
19696- strcat(buf,separator);
19697- strcat(buf,"ZF");
19698+ strcat(buf, separator);
19699+ strcat(buf, "ZF");
19700 separator = ",";
19701- }
19702+ }
19703 if (flags & F_SF) {
19704- strcat(buf,separator);
19705- strcat(buf,"SF");
19706+ strcat(buf, separator);
19707+ strcat(buf, "SF");
19708 separator = ",";
19709- }
19710+ }
19711 if (flags & F_OF) {
19712- strcat(buf,separator);
19713- strcat(buf,"OF");
19714+ strcat(buf, separator);
19715+ strcat(buf, "OF");
19716 separator = ",";
19717- }
19718+ }
19719 if (separator[0] == 0)
19720- strcpy(buf,"None");
19721+ strcpy(buf, "None");
19722 return buf;
19723 }
19724
19725-int main(int argc)
19726+int
19727+main(int argc)
19728 {
19729- ulong def_flags;
19730+ ulong def_flags;
19731 int trace = false;
19732
19733 if (argc > 1)
19734@@ -673,7 +677,7 @@ int main(int argc)
19735 VAL_LONG_LONG_BINARY(cmp_long);
19736
19737 VAL_BYTE_UNARY(daa_byte);
19738- VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
19739+ VAL_BYTE_UNARY(das_byte); /* Fails for 0x9A (out of range anyway) */
19740
19741 VAL_BYTE_UNARY(dec_byte);
19742 VAL_WORD_UNARY(dec_word);
19743diff --git a/libs/x86emu/x86emu.h b/libs/x86emu/x86emu.h
19744index 795e2d6..501dd91 100644
19745--- a/libs/x86emu/x86emu.h
19746+++ b/libs/x86emu/x86emu.h
19747@@ -56,7 +56,7 @@ typedef int X86EMU_pioAddr;
19748 /*---------------------- Macros and type definitions ----------------------*/
19749
19750 #ifdef PACK
19751-# pragma PACK /* Don't pack structs with function pointers! */
19752+#pragma PACK /* Don't pack structs with function pointers! */
19753 #endif
19754
19755 /****************************************************************************
19756@@ -81,13 +81,13 @@ outw - Function to write a word to an I/O port
19757 outl - Function to write a dword to an I/O port
19758 ****************************************************************************/
19759 typedef struct {
19760- u8 (X86APIP inb)(X86EMU_pioAddr addr);
19761- u16 (X86APIP inw)(X86EMU_pioAddr addr);
19762- u32 (X86APIP inl)(X86EMU_pioAddr addr);
19763- void (X86APIP outb)(X86EMU_pioAddr addr, u8 val);
19764- void (X86APIP outw)(X86EMU_pioAddr addr, u16 val);
19765- void (X86APIP outl)(X86EMU_pioAddr addr, u32 val);
19766- } X86EMU_pioFuncs;
19767+ u8(X86APIP inb) (X86EMU_pioAddr addr);
19768+ u16(X86APIP inw) (X86EMU_pioAddr addr);
19769+ u32(X86APIP inl) (X86EMU_pioAddr addr);
19770+ void (X86APIP outb) (X86EMU_pioAddr addr, u8 val);
19771+ void (X86APIP outw) (X86EMU_pioAddr addr, u16 val);
19772+ void (X86APIP outl) (X86EMU_pioAddr addr, u32 val);
19773+} X86EMU_pioFuncs;
19774
19775 /****************************************************************************
19776 REMARKS:
19777@@ -112,13 +112,13 @@ wrw - Function to write a word to an address
19778 wrl - Function to write a dword to an address
19779 ****************************************************************************/
19780 typedef struct {
19781- u8 (X86APIP rdb)(u32 addr);
19782- u16 (X86APIP rdw)(u32 addr);
19783- u32 (X86APIP rdl)(u32 addr);
19784- void (X86APIP wrb)(u32 addr, u8 val);
19785- void (X86APIP wrw)(u32 addr, u16 val);
19786- void (X86APIP wrl)(u32 addr, u32 val);
19787- } X86EMU_memFuncs;
19788+ u8(X86APIP rdb) (u32 addr);
19789+ u16(X86APIP rdw) (u32 addr);
19790+ u32(X86APIP rdl) (u32 addr);
19791+ void (X86APIP wrb) (u32 addr, u8 val);
19792+ void (X86APIP wrw) (u32 addr, u16 val);
19793+ void (X86APIP wrl) (u32 addr, u32 val);
19794+} X86EMU_memFuncs;
19795
19796 /****************************************************************************
19797 Here are the default memory read and write
19798@@ -132,29 +132,29 @@ extern void X86API wrw(u32 addr, u16 val);
19799 extern void X86API wrl(u32 addr, u32 val);
19800
19801 #ifdef END_PACK
19802-# pragma END_PACK
19803+#pragma END_PACK
19804 #endif
19805
19806 /*--------------------- type definitions -----------------------------------*/
19807
19808-typedef void (X86APIP X86EMU_intrFuncs)(int num);
19809+typedef void (X86APIP X86EMU_intrFuncs) (int num);
19810 extern X86EMU_intrFuncs _X86EMU_intrTab[256];
19811
19812 /*-------------------------- Function Prototypes --------------------------*/
19813
19814 #ifdef __cplusplus
19815-extern "C" { /* Use "C" linkage when in C++ mode */
19816+extern "C" { /* Use "C" linkage when in C++ mode */
19817 #endif
19818
19819-void X86EMU_setupMemFuncs(X86EMU_memFuncs *funcs);
19820-void X86EMU_setupPioFuncs(X86EMU_pioFuncs *funcs);
19821-void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
19822-void X86EMU_prepareForInt(int num);
19823+ void X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs);
19824+ void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs);
19825+ void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
19826+ void X86EMU_prepareForInt(int num);
19827
19828 /* decode.c */
19829
19830-void X86EMU_exec(void);
19831-void X86EMU_halt_sys(void);
19832+ void X86EMU_exec(void);
19833+ void X86EMU_halt_sys(void);
19834
19835 #ifdef DEBUG
19836 #define HALT_SYS() \
19837@@ -166,8 +166,8 @@ void X86EMU_halt_sys(void);
19838
19839 /* Debug options */
19840
19841-#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
19842-#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
19843+#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
19844+#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
19845 #define DEBUG_STEP_F 0x000004
19846 #define DEBUG_DISASSEMBLE_F 0x000008
19847 #define DEBUG_BREAK_F 0x000010
19848@@ -175,24 +175,23 @@ void X86EMU_halt_sys(void);
19849 #define DEBUG_SAVE_IP_CS_F 0x000040
19850 #define DEBUG_FS_F 0x000080
19851 #define DEBUG_PROC_F 0x000100
19852-#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
19853+#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
19854 #define DEBUG_TRACECALL_F 0x000400
19855 #define DEBUG_INSTRUMENT_F 0x000800
19856-#define DEBUG_MEM_TRACE_F 0x001000
19857-#define DEBUG_IO_TRACE_F 0x002000
19858+#define DEBUG_MEM_TRACE_F 0x001000
19859+#define DEBUG_IO_TRACE_F 0x002000
19860 #define DEBUG_TRACECALL_REGS_F 0x004000
19861-#define DEBUG_DECODE_NOPRINT_F 0x008000
19862+#define DEBUG_DECODE_NOPRINT_F 0x008000
19863 #define DEBUG_EXIT 0x010000
19864 #define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
19865
19866-void X86EMU_trace_regs(void);
19867-void X86EMU_trace_xregs(void);
19868-void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
19869-int X86EMU_trace_on(void);
19870-int X86EMU_trace_off(void);
19871+ void X86EMU_trace_regs(void);
19872+ void X86EMU_trace_xregs(void);
19873+ void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
19874+ int X86EMU_trace_on(void);
19875+ int X86EMU_trace_off(void);
19876
19877 #ifdef __cplusplus
19878-} /* End of "C" linkage for C++ */
19879+} /* End of "C" linkage for C++ */
19880 #endif
19881-
19882-#endif /* __X86EMU_X86EMU_H */
19883+#endif /* __X86EMU_X86EMU_H */
19884diff --git a/libs/x86emu/x86emu/debug.h b/libs/x86emu/x86emu/debug.h
19885index 47aacb6..385b804 100644
19886--- a/libs/x86emu/x86emu/debug.h
19887+++ b/libs/x86emu/x86emu/debug.h
19888@@ -45,65 +45,65 @@
19889
19890 #define CHECK_IP_FETCH_F 0x1
19891 #define CHECK_SP_ACCESS_F 0x2
19892-#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
19893-#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
19894+#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
19895+#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset */
19896
19897 #ifdef DEBUG
19898-# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
19899-# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
19900-# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
19901-# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
19902+#define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
19903+#define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
19904+#define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
19905+#define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
19906 #else
19907-# define CHECK_IP_FETCH()
19908-# define CHECK_SP_ACCESS()
19909-# define CHECK_MEM_ACCESS()
19910-# define CHECK_DATA_ACCESS()
19911+#define CHECK_IP_FETCH()
19912+#define CHECK_SP_ACCESS()
19913+#define CHECK_MEM_ACCESS()
19914+#define CHECK_DATA_ACCESS()
19915 #endif
19916
19917 #ifdef DEBUG
19918-# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
19919-# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
19920-# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
19921-# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
19922-# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
19923-# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
19924-# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
19925-# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
19926-
19927-# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
19928-# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
19929-# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
19930-# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
19931-# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
19932-# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
19933-# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
19934-# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
19935-# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
19936+#define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
19937+#define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
19938+#define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
19939+#define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
19940+#define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
19941+#define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
19942+#define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
19943+#define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
19944+
19945+#define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
19946+#define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
19947+#define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
19948+#define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
19949+#define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
19950+#define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
19951+#define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
19952+#define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
19953+#define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
19954 #else
19955-# define DEBUG_INSTRUMENT() 0
19956-# define DEBUG_DECODE() 0
19957-# define DEBUG_TRACE() 0
19958-# define DEBUG_STEP() 0
19959-# define DEBUG_DISASSEMBLE() 0
19960-# define DEBUG_BREAK() 0
19961-# define DEBUG_SVC() 0
19962-# define DEBUG_SAVE_IP_CS() 0
19963-# define DEBUG_FS() 0
19964-# define DEBUG_PROC() 0
19965-# define DEBUG_SYSINT() 0
19966-# define DEBUG_TRACECALL() 0
19967-# define DEBUG_TRACECALLREGS() 0
19968-# define DEBUG_SYS() 0
19969-# define DEBUG_MEM_TRACE() 0
19970-# define DEBUG_IO_TRACE() 0
19971-# define DEBUG_DECODE_NOPRINT() 0
19972+#define DEBUG_INSTRUMENT() 0
19973+#define DEBUG_DECODE() 0
19974+#define DEBUG_TRACE() 0
19975+#define DEBUG_STEP() 0
19976+#define DEBUG_DISASSEMBLE() 0
19977+#define DEBUG_BREAK() 0
19978+#define DEBUG_SVC() 0
19979+#define DEBUG_SAVE_IP_CS() 0
19980+#define DEBUG_FS() 0
19981+#define DEBUG_PROC() 0
19982+#define DEBUG_SYSINT() 0
19983+#define DEBUG_TRACECALL() 0
19984+#define DEBUG_TRACECALLREGS() 0
19985+#define DEBUG_SYS() 0
19986+#define DEBUG_MEM_TRACE() 0
19987+#define DEBUG_IO_TRACE() 0
19988+#define DEBUG_DECODE_NOPRINT() 0
19989 #endif
19990
19991 #ifdef DEBUG
19992
19993-# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
19994+#define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
19995 x86emu_decode_printf(x)
19996-# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
19997+#define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
19998 x86emu_decode_printf2(x,y)
19999
20000 /*
20001@@ -123,10 +123,10 @@
20002 M.x86.saved_ip = y; \
20003 }
20004 #else
20005-# define INC_DECODED_INST_LEN(x)
20006-# define DECODE_PRINTF(x)
20007-# define DECODE_PRINTF2(x,y)
20008-# define SAVE_IP_CS(x,y)
20009+#define INC_DECODED_INST_LEN(x)
20010+#define DECODE_PRINTF(x)
20011+#define DECODE_PRINTF2(x,y)
20012+#define SAVE_IP_CS(x,y)
20013 #endif
20014
20015 #ifdef DEBUG
20016@@ -137,13 +137,13 @@
20017 } \
20018 if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
20019 #else
20020-# define TRACE_REGS()
20021+#define TRACE_REGS()
20022 #endif
20023
20024 #ifdef DEBUG
20025-# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
20026+#define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
20027 #else
20028-# define SINGLE_STEP()
20029+#define SINGLE_STEP()
20030 #endif
20031
20032 #define TRACE_AND_STEP() \
20033@@ -151,29 +151,29 @@
20034 SINGLE_STEP()
20035
20036 #ifdef DEBUG
20037-# define START_OF_INSTR()
20038-# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
20039-# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
20040+#define START_OF_INSTR()
20041+#define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
20042+#define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
20043 #else
20044-# define START_OF_INSTR()
20045-# define END_OF_INSTR()
20046-# define END_OF_INSTR_NO_TRACE()
20047+#define START_OF_INSTR()
20048+#define END_OF_INSTR()
20049+#define END_OF_INSTR_NO_TRACE()
20050 #endif
20051
20052 #ifdef DEBUG
20053-# define CALL_TRACE(u,v,w,x,s) \
20054+#define CALL_TRACE(u,v,w,x,s) \
20055 if (DEBUG_TRACECALLREGS()) \
20056 x86emu_dump_regs(); \
20057 if (DEBUG_TRACECALL()) \
20058 printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
20059-# define RETURN_TRACE(n,u,v) \
20060+#define RETURN_TRACE(n,u,v) \
20061 if (DEBUG_TRACECALLREGS()) \
20062 x86emu_dump_regs(); \
20063 if (DEBUG_TRACECALL()) \
20064 printk("%04x:%04x: %s\n",u,v,n);
20065 #else
20066-# define CALL_TRACE(u,v,w,x,s)
20067-# define RETURN_TRACE(n,u,v)
20068+#define CALL_TRACE(u,v,w,x,s)
20069+#define RETURN_TRACE(n,u,v)
20070 #endif
20071
20072 #ifdef DEBUG
20073@@ -185,26 +185,25 @@
20074 /*-------------------------- Function Prototypes --------------------------*/
20075
20076 #ifdef __cplusplus
20077-extern "C" { /* Use "C" linkage when in C++ mode */
20078+extern "C" { /* Use "C" linkage when in C++ mode */
20079 #endif
20080
20081-extern void x86emu_inc_decoded_inst_len (int x);
20082-extern void x86emu_decode_printf (char *x);
20083-extern void x86emu_decode_printf2 (char *x, int y);
20084-extern void x86emu_just_disassemble (void);
20085-extern void x86emu_single_step (void);
20086-extern void x86emu_end_instr (void);
20087-extern void x86emu_dump_regs (void);
20088-extern void x86emu_dump_xregs (void);
20089-extern void x86emu_print_int_vect (u16 iv);
20090-extern void x86emu_instrument_instruction (void);
20091-extern void x86emu_check_ip_access (void);
20092-extern void x86emu_check_sp_access (void);
20093-extern void x86emu_check_mem_access (u32 p);
20094-extern void x86emu_check_data_access (uint s, uint o);
20095+ extern void x86emu_inc_decoded_inst_len(int x);
20096+ extern void x86emu_decode_printf(const char *x);
20097+ extern void x86emu_decode_printf2(const char *x, int y);
20098+ extern void x86emu_just_disassemble(void);
20099+ extern void x86emu_single_step(void);
20100+ extern void x86emu_end_instr(void);
20101+ extern void x86emu_dump_regs(void);
20102+ extern void x86emu_dump_xregs(void);
20103+ extern void x86emu_print_int_vect(u16 iv);
20104+ extern void x86emu_instrument_instruction(void);
20105+ extern void x86emu_check_ip_access(void);
20106+ extern void x86emu_check_sp_access(void);
20107+ extern void x86emu_check_mem_access(u32 p);
20108+ extern void x86emu_check_data_access(uint s, uint o);
20109
20110 #ifdef __cplusplus
20111-} /* End of "C" linkage for C++ */
20112+} /* End of "C" linkage for C++ */
20113 #endif
20114-
20115-#endif /* __X86EMU_DEBUG_H */
20116+#endif /* __X86EMU_DEBUG_H */
20117diff --git a/libs/x86emu/x86emu/decode.h b/libs/x86emu/x86emu/decode.h
20118index 61cd4dc..49a1f7b 100644
20119--- a/libs/x86emu/x86emu/decode.h
20120+++ b/libs/x86emu/x86emu/decode.h
20121@@ -52,37 +52,36 @@
20122 /*-------------------------- Function Prototypes --------------------------*/
20123
20124 #ifdef __cplusplus
20125-extern "C" { /* Use "C" linkage when in C++ mode */
20126+extern "C" { /* Use "C" linkage when in C++ mode */
20127 #endif
20128
20129-void x86emu_intr_raise (u8 type);
20130-void fetch_decode_modrm (int *mod,int *regh,int *regl);
20131-u8 fetch_byte_imm (void);
20132-u16 fetch_word_imm (void);
20133-u32 fetch_long_imm (void);
20134-u8 fetch_data_byte (uint offset);
20135-u8 fetch_data_byte_abs (uint segment, uint offset);
20136-u16 fetch_data_word (uint offset);
20137-u16 fetch_data_word_abs (uint segment, uint offset);
20138-u32 fetch_data_long (uint offset);
20139-u32 fetch_data_long_abs (uint segment, uint offset);
20140-void store_data_byte (uint offset, u8 val);
20141-void store_data_byte_abs (uint segment, uint offset, u8 val);
20142-void store_data_word (uint offset, u16 val);
20143-void store_data_word_abs (uint segment, uint offset, u16 val);
20144-void store_data_long (uint offset, u32 val);
20145-void store_data_long_abs (uint segment, uint offset, u32 val);
20146-u8* decode_rm_byte_register(int reg);
20147-u16* decode_rm_word_register(int reg);
20148-u32* decode_rm_long_register(int reg);
20149-u16* decode_rm_seg_register(int reg);
20150-u32 decode_rm00_address(int rm);
20151-u32 decode_rm01_address(int rm);
20152-u32 decode_rm10_address(int rm);
20153-u32 decode_sib_address(int sib, int mod);
20154+ void x86emu_intr_raise(u8 type);
20155+ void fetch_decode_modrm(int *mod, int *regh, int *regl);
20156+ u8 fetch_byte_imm(void);
20157+ u16 fetch_word_imm(void);
20158+ u32 fetch_long_imm(void);
20159+ u8 fetch_data_byte(uint offset);
20160+ u8 fetch_data_byte_abs(uint segment, uint offset);
20161+ u16 fetch_data_word(uint offset);
20162+ u16 fetch_data_word_abs(uint segment, uint offset);
20163+ u32 fetch_data_long(uint offset);
20164+ u32 fetch_data_long_abs(uint segment, uint offset);
20165+ void store_data_byte(uint offset, u8 val);
20166+ void store_data_byte_abs(uint segment, uint offset, u8 val);
20167+ void store_data_word(uint offset, u16 val);
20168+ void store_data_word_abs(uint segment, uint offset, u16 val);
20169+ void store_data_long(uint offset, u32 val);
20170+ void store_data_long_abs(uint segment, uint offset, u32 val);
20171+ u8 *decode_rm_byte_register(int reg);
20172+ u16 *decode_rm_word_register(int reg);
20173+ u32 *decode_rm_long_register(int reg);
20174+ u16 *decode_rm_seg_register(int reg);
20175+ u32 decode_rm00_address(int rm);
20176+ u32 decode_rm01_address(int rm);
20177+ u32 decode_rm10_address(int rm);
20178+ u32 decode_sib_address(int sib, int mod);
20179
20180 #ifdef __cplusplus
20181-} /* End of "C" linkage for C++ */
20182+} /* End of "C" linkage for C++ */
20183 #endif
20184-
20185-#endif /* __X86EMU_DECODE_H */
20186+#endif /* __X86EMU_DECODE_H */
20187diff --git a/libs/x86emu/x86emu/fpu.h b/libs/x86emu/x86emu/fpu.h
20188index 5fb2714..1c11498 100644
20189--- a/libs/x86emu/x86emu/fpu.h
20190+++ b/libs/x86emu/x86emu/fpu.h
20191@@ -40,22 +40,21 @@
20192 #define __X86EMU_FPU_H
20193
20194 #ifdef __cplusplus
20195-extern "C" { /* Use "C" linkage when in C++ mode */
20196+extern "C" { /* Use "C" linkage when in C++ mode */
20197 #endif
20198
20199 /* these have to be defined, whether 8087 support compiled in or not. */
20200
20201-extern void x86emuOp_esc_coprocess_d8 (u8 op1);
20202-extern void x86emuOp_esc_coprocess_d9 (u8 op1);
20203-extern void x86emuOp_esc_coprocess_da (u8 op1);
20204-extern void x86emuOp_esc_coprocess_db (u8 op1);
20205-extern void x86emuOp_esc_coprocess_dc (u8 op1);
20206-extern void x86emuOp_esc_coprocess_dd (u8 op1);
20207-extern void x86emuOp_esc_coprocess_de (u8 op1);
20208-extern void x86emuOp_esc_coprocess_df (u8 op1);
20209+ extern void x86emuOp_esc_coprocess_d8(u8 op1);
20210+ extern void x86emuOp_esc_coprocess_d9(u8 op1);
20211+ extern void x86emuOp_esc_coprocess_da(u8 op1);
20212+ extern void x86emuOp_esc_coprocess_db(u8 op1);
20213+ extern void x86emuOp_esc_coprocess_dc(u8 op1);
20214+ extern void x86emuOp_esc_coprocess_dd(u8 op1);
20215+ extern void x86emuOp_esc_coprocess_de(u8 op1);
20216+ extern void x86emuOp_esc_coprocess_df(u8 op1);
20217
20218 #ifdef __cplusplus
20219-} /* End of "C" linkage for C++ */
20220+} /* End of "C" linkage for C++ */
20221 #endif
20222-
20223-#endif /* __X86EMU_FPU_H */
20224+#endif /* __X86EMU_FPU_H */
20225diff --git a/libs/x86emu/x86emu/fpu_regs.h b/libs/x86emu/x86emu/fpu_regs.h
20226index e59b807..5a780e6 100644
20227--- a/libs/x86emu/x86emu/fpu_regs.h
20228+++ b/libs/x86emu/x86emu/fpu_regs.h
20229@@ -42,23 +42,23 @@
20230 #ifdef X86_FPU_SUPPORT
20231
20232 #ifdef PACK
20233-# pragma PACK
20234+#pragma PACK
20235 #endif
20236
20237 /* Basic 8087 register can hold any of the following values: */
20238
20239 union x86_fpu_reg_u {
20240- s8 tenbytes[10];
20241- double dval;
20242- float fval;
20243- s16 sval;
20244- s32 lval;
20245- };
20246+ s8 tenbytes[10];
20247+ double dval;
20248+ float fval;
20249+ s16 sval;
20250+ s32 lval;
20251+};
20252
20253 struct x86_fpu_reg {
20254- union x86_fpu_reg_u reg;
20255- char tag;
20256- };
20257+ union x86_fpu_reg_u reg;
20258+ char tag;
20259+};
20260
20261 /*
20262 * Since we are not going to worry about the problems of aliasing
20263@@ -83,14 +83,14 @@ struct x86_fpu_reg {
20264 #define X86_FPU_STKTOP 0
20265
20266 struct x86_fpu_registers {
20267- struct x86_fpu_reg x86_fpu_stack[8];
20268- int x86_fpu_flags;
20269- int x86_fpu_config; /* rounding modes, etc. */
20270- short x86_fpu_tos, x86_fpu_bos;
20271- };
20272+ struct x86_fpu_reg x86_fpu_stack[8];
20273+ int x86_fpu_flags;
20274+ int x86_fpu_config; /* rounding modes, etc. */
20275+ short x86_fpu_tos, x86_fpu_bos;
20276+};
20277
20278 #ifdef END_PACK
20279-# pragma END_PACK
20280+#pragma END_PACK
20281 #endif
20282
20283 /*
20284@@ -104,16 +104,16 @@ struct x86_fpu_registers {
20285 * instructions.
20286 */
20287
20288-#endif /* X86_FPU_SUPPORT */
20289+#endif /* X86_FPU_SUPPORT */
20290
20291 #ifdef DEBUG
20292-# define DECODE_PRINTINSTR32(t,mod,rh,rl) \
20293+#define DECODE_PRINTINSTR32(t,mod,rh,rl) \
20294 DECODE_PRINTF(t[(mod<<3)+(rh)]);
20295-# define DECODE_PRINTINSTR256(t,mod,rh,rl) \
20296+#define DECODE_PRINTINSTR256(t,mod,rh,rl) \
20297 DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
20298 #else
20299-# define DECODE_PRINTINSTR32(t,mod,rh,rl)
20300-# define DECODE_PRINTINSTR256(t,mod,rh,rl)
20301+#define DECODE_PRINTINSTR32(t,mod,rh,rl)
20302+#define DECODE_PRINTINSTR256(t,mod,rh,rl)
20303 #endif
20304
20305-#endif /* __X86EMU_FPU_REGS_H */
20306+#endif /* __X86EMU_FPU_REGS_H */
20307diff --git a/libs/x86emu/x86emu/ops.h b/libs/x86emu/x86emu/ops.h
20308index 65ea676..1bc07a4 100644
20309--- a/libs/x86emu/x86emu/ops.h
20310+++ b/libs/x86emu/x86emu/ops.h
20311@@ -39,7 +39,7 @@
20312 #ifndef __X86EMU_OPS_H
20313 #define __X86EMU_OPS_H
20314
20315-extern void (*x86emu_optab[0x100])(u8 op1);
20316-extern void (*x86emu_optab2[0x100])(u8 op2);
20317+extern void (*x86emu_optab[0x100]) (u8 op1);
20318+extern void (*x86emu_optab2[0x100]) (u8 op2);
20319
20320-#endif /* __X86EMU_OPS_H */
20321+#endif /* __X86EMU_OPS_H */
20322diff --git a/libs/x86emu/x86emu/prim_asm.h b/libs/x86emu/x86emu/prim_asm.h
20323index e023cf8..aca132b 100644
20324--- a/libs/x86emu/x86emu/prim_asm.h
20325+++ b/libs/x86emu/x86emu/prim_asm.h
20326@@ -49,14 +49,16 @@
20327 #define __HAVE_INLINE_ASSEMBLER__
20328 #endif
20329
20330-u32 get_flags_asm(void);
20331+u32 get_flags_asm(void);
20332+
20333 #pragma aux get_flags_asm = \
20334 "pushf" \
20335 "pop eax" \
20336 value [eax] \
20337 modify exact [eax];
20338
20339-u16 aaa_word_asm(u32 *flags,u16 d);
20340+u16 aaa_word_asm(u32 * flags, u16 d);
20341+
20342 #pragma aux aaa_word_asm = \
20343 "push [edi]" \
20344 "popf" \
20345@@ -67,7 +69,8 @@ u16 aaa_word_asm(u32 *flags,u16 d);
20346 value [ax] \
20347 modify exact [ax];
20348
20349-u16 aas_word_asm(u32 *flags,u16 d);
20350+u16 aas_word_asm(u32 * flags, u16 d);
20351+
20352 #pragma aux aas_word_asm = \
20353 "push [edi]" \
20354 "popf" \
20355@@ -78,7 +81,8 @@ u16 aas_word_asm(u32 *flags,u16 d);
20356 value [ax] \
20357 modify exact [ax];
20358
20359-u16 aad_word_asm(u32 *flags,u16 d);
20360+u16 aad_word_asm(u32 * flags, u16 d);
20361+
20362 #pragma aux aad_word_asm = \
20363 "push [edi]" \
20364 "popf" \
20365@@ -89,7 +93,8 @@ u16 aad_word_asm(u32 *flags,u16 d);
20366 value [ax] \
20367 modify exact [ax];
20368
20369-u16 aam_word_asm(u32 *flags,u8 d);
20370+u16 aam_word_asm(u32 * flags, u8 d);
20371+
20372 #pragma aux aam_word_asm = \
20373 "push [edi]" \
20374 "popf" \
20375@@ -100,7 +105,8 @@ u16 aam_word_asm(u32 *flags,u8 d);
20376 value [ax] \
20377 modify exact [ax];
20378
20379-u8 adc_byte_asm(u32 *flags,u8 d, u8 s);
20380+u8 adc_byte_asm(u32 * flags, u8 d, u8 s);
20381+
20382 #pragma aux adc_byte_asm = \
20383 "push [edi]" \
20384 "popf" \
20385@@ -111,7 +117,8 @@ u8 adc_byte_asm(u32 *flags,u8 d, u8 s);
20386 value [al] \
20387 modify exact [al bl];
20388
20389-u16 adc_word_asm(u32 *flags,u16 d, u16 s);
20390+u16 adc_word_asm(u32 * flags, u16 d, u16 s);
20391+
20392 #pragma aux adc_word_asm = \
20393 "push [edi]" \
20394 "popf" \
20395@@ -122,7 +129,8 @@ u16 adc_word_asm(u32 *flags,u16 d, u16 s);
20396 value [ax] \
20397 modify exact [ax bx];
20398
20399-u32 adc_long_asm(u32 *flags,u32 d, u32 s);
20400+u32 adc_long_asm(u32 * flags, u32 d, u32 s);
20401+
20402 #pragma aux adc_long_asm = \
20403 "push [edi]" \
20404 "popf" \
20405@@ -133,7 +141,8 @@ u32 adc_long_asm(u32 *flags,u32 d, u32 s);
20406 value [eax] \
20407 modify exact [eax ebx];
20408
20409-u8 add_byte_asm(u32 *flags,u8 d, u8 s);
20410+u8 add_byte_asm(u32 * flags, u8 d, u8 s);
20411+
20412 #pragma aux add_byte_asm = \
20413 "push [edi]" \
20414 "popf" \
20415@@ -144,7 +153,8 @@ u8 add_byte_asm(u32 *flags,u8 d, u8 s);
20416 value [al] \
20417 modify exact [al bl];
20418
20419-u16 add_word_asm(u32 *flags,u16 d, u16 s);
20420+u16 add_word_asm(u32 * flags, u16 d, u16 s);
20421+
20422 #pragma aux add_word_asm = \
20423 "push [edi]" \
20424 "popf" \
20425@@ -155,7 +165,8 @@ u16 add_word_asm(u32 *flags,u16 d, u16 s);
20426 value [ax] \
20427 modify exact [ax bx];
20428
20429-u32 add_long_asm(u32 *flags,u32 d, u32 s);
20430+u32 add_long_asm(u32 * flags, u32 d, u32 s);
20431+
20432 #pragma aux add_long_asm = \
20433 "push [edi]" \
20434 "popf" \
20435@@ -166,7 +177,8 @@ u32 add_long_asm(u32 *flags,u32 d, u32 s);
20436 value [eax] \
20437 modify exact [eax ebx];
20438
20439-u8 and_byte_asm(u32 *flags,u8 d, u8 s);
20440+u8 and_byte_asm(u32 * flags, u8 d, u8 s);
20441+
20442 #pragma aux and_byte_asm = \
20443 "push [edi]" \
20444 "popf" \
20445@@ -177,7 +189,8 @@ u8 and_byte_asm(u32 *flags,u8 d, u8 s);
20446 value [al] \
20447 modify exact [al bl];
20448
20449-u16 and_word_asm(u32 *flags,u16 d, u16 s);
20450+u16 and_word_asm(u32 * flags, u16 d, u16 s);
20451+
20452 #pragma aux and_word_asm = \
20453 "push [edi]" \
20454 "popf" \
20455@@ -188,7 +201,8 @@ u16 and_word_asm(u32 *flags,u16 d, u16 s);
20456 value [ax] \
20457 modify exact [ax bx];
20458
20459-u32 and_long_asm(u32 *flags,u32 d, u32 s);
20460+u32 and_long_asm(u32 * flags, u32 d, u32 s);
20461+
20462 #pragma aux and_long_asm = \
20463 "push [edi]" \
20464 "popf" \
20465@@ -199,7 +213,8 @@ u32 and_long_asm(u32 *flags,u32 d, u32 s);
20466 value [eax] \
20467 modify exact [eax ebx];
20468
20469-u8 cmp_byte_asm(u32 *flags,u8 d, u8 s);
20470+u8 cmp_byte_asm(u32 * flags, u8 d, u8 s);
20471+
20472 #pragma aux cmp_byte_asm = \
20473 "push [edi]" \
20474 "popf" \
20475@@ -210,7 +225,8 @@ u8 cmp_byte_asm(u32 *flags,u8 d, u8 s);
20476 value [al] \
20477 modify exact [al bl];
20478
20479-u16 cmp_word_asm(u32 *flags,u16 d, u16 s);
20480+u16 cmp_word_asm(u32 * flags, u16 d, u16 s);
20481+
20482 #pragma aux cmp_word_asm = \
20483 "push [edi]" \
20484 "popf" \
20485@@ -221,7 +237,8 @@ u16 cmp_word_asm(u32 *flags,u16 d, u16 s);
20486 value [ax] \
20487 modify exact [ax bx];
20488
20489-u32 cmp_long_asm(u32 *flags,u32 d, u32 s);
20490+u32 cmp_long_asm(u32 * flags, u32 d, u32 s);
20491+
20492 #pragma aux cmp_long_asm = \
20493 "push [edi]" \
20494 "popf" \
20495@@ -232,7 +249,8 @@ u32 cmp_long_asm(u32 *flags,u32 d, u32 s);
20496 value [eax] \
20497 modify exact [eax ebx];
20498
20499-u8 daa_byte_asm(u32 *flags,u8 d);
20500+u8 daa_byte_asm(u32 * flags, u8 d);
20501+
20502 #pragma aux daa_byte_asm = \
20503 "push [edi]" \
20504 "popf" \
20505@@ -243,7 +261,8 @@ u8 daa_byte_asm(u32 *flags,u8 d);
20506 value [al] \
20507 modify exact [al];
20508
20509-u8 das_byte_asm(u32 *flags,u8 d);
20510+u8 das_byte_asm(u32 * flags, u8 d);
20511+
20512 #pragma aux das_byte_asm = \
20513 "push [edi]" \
20514 "popf" \
20515@@ -254,7 +273,8 @@ u8 das_byte_asm(u32 *flags,u8 d);
20516 value [al] \
20517 modify exact [al];
20518
20519-u8 dec_byte_asm(u32 *flags,u8 d);
20520+u8 dec_byte_asm(u32 * flags, u8 d);
20521+
20522 #pragma aux dec_byte_asm = \
20523 "push [edi]" \
20524 "popf" \
20525@@ -265,7 +285,8 @@ u8 dec_byte_asm(u32 *flags,u8 d);
20526 value [al] \
20527 modify exact [al];
20528
20529-u16 dec_word_asm(u32 *flags,u16 d);
20530+u16 dec_word_asm(u32 * flags, u16 d);
20531+
20532 #pragma aux dec_word_asm = \
20533 "push [edi]" \
20534 "popf" \
20535@@ -276,7 +297,8 @@ u16 dec_word_asm(u32 *flags,u16 d);
20536 value [ax] \
20537 modify exact [ax];
20538
20539-u32 dec_long_asm(u32 *flags,u32 d);
20540+u32 dec_long_asm(u32 * flags, u32 d);
20541+
20542 #pragma aux dec_long_asm = \
20543 "push [edi]" \
20544 "popf" \
20545@@ -287,7 +309,8 @@ u32 dec_long_asm(u32 *flags,u32 d);
20546 value [eax] \
20547 modify exact [eax];
20548
20549-u8 inc_byte_asm(u32 *flags,u8 d);
20550+u8 inc_byte_asm(u32 * flags, u8 d);
20551+
20552 #pragma aux inc_byte_asm = \
20553 "push [edi]" \
20554 "popf" \
20555@@ -298,7 +321,8 @@ u8 inc_byte_asm(u32 *flags,u8 d);
20556 value [al] \
20557 modify exact [al];
20558
20559-u16 inc_word_asm(u32 *flags,u16 d);
20560+u16 inc_word_asm(u32 * flags, u16 d);
20561+
20562 #pragma aux inc_word_asm = \
20563 "push [edi]" \
20564 "popf" \
20565@@ -309,7 +333,8 @@ u16 inc_word_asm(u32 *flags,u16 d);
20566 value [ax] \
20567 modify exact [ax];
20568
20569-u32 inc_long_asm(u32 *flags,u32 d);
20570+u32 inc_long_asm(u32 * flags, u32 d);
20571+
20572 #pragma aux inc_long_asm = \
20573 "push [edi]" \
20574 "popf" \
20575@@ -320,7 +345,8 @@ u32 inc_long_asm(u32 *flags,u32 d);
20576 value [eax] \
20577 modify exact [eax];
20578
20579-u8 or_byte_asm(u32 *flags,u8 d, u8 s);
20580+u8 or_byte_asm(u32 * flags, u8 d, u8 s);
20581+
20582 #pragma aux or_byte_asm = \
20583 "push [edi]" \
20584 "popf" \
20585@@ -331,7 +357,8 @@ u8 or_byte_asm(u32 *flags,u8 d, u8 s);
20586 value [al] \
20587 modify exact [al bl];
20588
20589-u16 or_word_asm(u32 *flags,u16 d, u16 s);
20590+u16 or_word_asm(u32 * flags, u16 d, u16 s);
20591+
20592 #pragma aux or_word_asm = \
20593 "push [edi]" \
20594 "popf" \
20595@@ -342,7 +369,8 @@ u16 or_word_asm(u32 *flags,u16 d, u16 s);
20596 value [ax] \
20597 modify exact [ax bx];
20598
20599-u32 or_long_asm(u32 *flags,u32 d, u32 s);
20600+u32 or_long_asm(u32 * flags, u32 d, u32 s);
20601+
20602 #pragma aux or_long_asm = \
20603 "push [edi]" \
20604 "popf" \
20605@@ -353,7 +381,8 @@ u32 or_long_asm(u32 *flags,u32 d, u32 s);
20606 value [eax] \
20607 modify exact [eax ebx];
20608
20609-u8 neg_byte_asm(u32 *flags,u8 d);
20610+u8 neg_byte_asm(u32 * flags, u8 d);
20611+
20612 #pragma aux neg_byte_asm = \
20613 "push [edi]" \
20614 "popf" \
20615@@ -364,7 +393,8 @@ u8 neg_byte_asm(u32 *flags,u8 d);
20616 value [al] \
20617 modify exact [al];
20618
20619-u16 neg_word_asm(u32 *flags,u16 d);
20620+u16 neg_word_asm(u32 * flags, u16 d);
20621+
20622 #pragma aux neg_word_asm = \
20623 "push [edi]" \
20624 "popf" \
20625@@ -375,7 +405,8 @@ u16 neg_word_asm(u32 *flags,u16 d);
20626 value [ax] \
20627 modify exact [ax];
20628
20629-u32 neg_long_asm(u32 *flags,u32 d);
20630+u32 neg_long_asm(u32 * flags, u32 d);
20631+
20632 #pragma aux neg_long_asm = \
20633 "push [edi]" \
20634 "popf" \
20635@@ -386,7 +417,8 @@ u32 neg_long_asm(u32 *flags,u32 d);
20636 value [eax] \
20637 modify exact [eax];
20638
20639-u8 not_byte_asm(u32 *flags,u8 d);
20640+u8 not_byte_asm(u32 * flags, u8 d);
20641+
20642 #pragma aux not_byte_asm = \
20643 "push [edi]" \
20644 "popf" \
20645@@ -397,7 +429,8 @@ u8 not_byte_asm(u32 *flags,u8 d);
20646 value [al] \
20647 modify exact [al];
20648
20649-u16 not_word_asm(u32 *flags,u16 d);
20650+u16 not_word_asm(u32 * flags, u16 d);
20651+
20652 #pragma aux not_word_asm = \
20653 "push [edi]" \
20654 "popf" \
20655@@ -408,7 +441,8 @@ u16 not_word_asm(u32 *flags,u16 d);
20656 value [ax] \
20657 modify exact [ax];
20658
20659-u32 not_long_asm(u32 *flags,u32 d);
20660+u32 not_long_asm(u32 * flags, u32 d);
20661+
20662 #pragma aux not_long_asm = \
20663 "push [edi]" \
20664 "popf" \
20665@@ -419,7 +453,8 @@ u32 not_long_asm(u32 *flags,u32 d);
20666 value [eax] \
20667 modify exact [eax];
20668
20669-u8 rcl_byte_asm(u32 *flags,u8 d, u8 s);
20670+u8 rcl_byte_asm(u32 * flags, u8 d, u8 s);
20671+
20672 #pragma aux rcl_byte_asm = \
20673 "push [edi]" \
20674 "popf" \
20675@@ -430,7 +465,8 @@ u8 rcl_byte_asm(u32 *flags,u8 d, u8 s);
20676 value [al] \
20677 modify exact [al cl];
20678
20679-u16 rcl_word_asm(u32 *flags,u16 d, u8 s);
20680+u16 rcl_word_asm(u32 * flags, u16 d, u8 s);
20681+
20682 #pragma aux rcl_word_asm = \
20683 "push [edi]" \
20684 "popf" \
20685@@ -441,7 +477,8 @@ u16 rcl_word_asm(u32 *flags,u16 d, u8 s);
20686 value [ax] \
20687 modify exact [ax cl];
20688
20689-u32 rcl_long_asm(u32 *flags,u32 d, u8 s);
20690+u32 rcl_long_asm(u32 * flags, u32 d, u8 s);
20691+
20692 #pragma aux rcl_long_asm = \
20693 "push [edi]" \
20694 "popf" \
20695@@ -452,7 +489,8 @@ u32 rcl_long_asm(u32 *flags,u32 d, u8 s);
20696 value [eax] \
20697 modify exact [eax cl];
20698
20699-u8 rcr_byte_asm(u32 *flags,u8 d, u8 s);
20700+u8 rcr_byte_asm(u32 * flags, u8 d, u8 s);
20701+
20702 #pragma aux rcr_byte_asm = \
20703 "push [edi]" \
20704 "popf" \
20705@@ -463,7 +501,8 @@ u8 rcr_byte_asm(u32 *flags,u8 d, u8 s);
20706 value [al] \
20707 modify exact [al cl];
20708
20709-u16 rcr_word_asm(u32 *flags,u16 d, u8 s);
20710+u16 rcr_word_asm(u32 * flags, u16 d, u8 s);
20711+
20712 #pragma aux rcr_word_asm = \
20713 "push [edi]" \
20714 "popf" \
20715@@ -474,7 +513,8 @@ u16 rcr_word_asm(u32 *flags,u16 d, u8 s);
20716 value [ax] \
20717 modify exact [ax cl];
20718
20719-u32 rcr_long_asm(u32 *flags,u32 d, u8 s);
20720+u32 rcr_long_asm(u32 * flags, u32 d, u8 s);
20721+
20722 #pragma aux rcr_long_asm = \
20723 "push [edi]" \
20724 "popf" \
20725@@ -485,7 +525,8 @@ u32 rcr_long_asm(u32 *flags,u32 d, u8 s);
20726 value [eax] \
20727 modify exact [eax cl];
20728
20729-u8 rol_byte_asm(u32 *flags,u8 d, u8 s);
20730+u8 rol_byte_asm(u32 * flags, u8 d, u8 s);
20731+
20732 #pragma aux rol_byte_asm = \
20733 "push [edi]" \
20734 "popf" \
20735@@ -496,7 +537,8 @@ u8 rol_byte_asm(u32 *flags,u8 d, u8 s);
20736 value [al] \
20737 modify exact [al cl];
20738
20739-u16 rol_word_asm(u32 *flags,u16 d, u8 s);
20740+u16 rol_word_asm(u32 * flags, u16 d, u8 s);
20741+
20742 #pragma aux rol_word_asm = \
20743 "push [edi]" \
20744 "popf" \
20745@@ -507,7 +549,8 @@ u16 rol_word_asm(u32 *flags,u16 d, u8 s);
20746 value [ax] \
20747 modify exact [ax cl];
20748
20749-u32 rol_long_asm(u32 *flags,u32 d, u8 s);
20750+u32 rol_long_asm(u32 * flags, u32 d, u8 s);
20751+
20752 #pragma aux rol_long_asm = \
20753 "push [edi]" \
20754 "popf" \
20755@@ -518,7 +561,8 @@ u32 rol_long_asm(u32 *flags,u32 d, u8 s);
20756 value [eax] \
20757 modify exact [eax cl];
20758
20759-u8 ror_byte_asm(u32 *flags,u8 d, u8 s);
20760+u8 ror_byte_asm(u32 * flags, u8 d, u8 s);
20761+
20762 #pragma aux ror_byte_asm = \
20763 "push [edi]" \
20764 "popf" \
20765@@ -529,7 +573,8 @@ u8 ror_byte_asm(u32 *flags,u8 d, u8 s);
20766 value [al] \
20767 modify exact [al cl];
20768
20769-u16 ror_word_asm(u32 *flags,u16 d, u8 s);
20770+u16 ror_word_asm(u32 * flags, u16 d, u8 s);
20771+
20772 #pragma aux ror_word_asm = \
20773 "push [edi]" \
20774 "popf" \
20775@@ -540,7 +585,8 @@ u16 ror_word_asm(u32 *flags,u16 d, u8 s);
20776 value [ax] \
20777 modify exact [ax cl];
20778
20779-u32 ror_long_asm(u32 *flags,u32 d, u8 s);
20780+u32 ror_long_asm(u32 * flags, u32 d, u8 s);
20781+
20782 #pragma aux ror_long_asm = \
20783 "push [edi]" \
20784 "popf" \
20785@@ -551,7 +597,8 @@ u32 ror_long_asm(u32 *flags,u32 d, u8 s);
20786 value [eax] \
20787 modify exact [eax cl];
20788
20789-u8 shl_byte_asm(u32 *flags,u8 d, u8 s);
20790+u8 shl_byte_asm(u32 * flags, u8 d, u8 s);
20791+
20792 #pragma aux shl_byte_asm = \
20793 "push [edi]" \
20794 "popf" \
20795@@ -562,7 +609,8 @@ u8 shl_byte_asm(u32 *flags,u8 d, u8 s);
20796 value [al] \
20797 modify exact [al cl];
20798
20799-u16 shl_word_asm(u32 *flags,u16 d, u8 s);
20800+u16 shl_word_asm(u32 * flags, u16 d, u8 s);
20801+
20802 #pragma aux shl_word_asm = \
20803 "push [edi]" \
20804 "popf" \
20805@@ -573,7 +621,8 @@ u16 shl_word_asm(u32 *flags,u16 d, u8 s);
20806 value [ax] \
20807 modify exact [ax cl];
20808
20809-u32 shl_long_asm(u32 *flags,u32 d, u8 s);
20810+u32 shl_long_asm(u32 * flags, u32 d, u8 s);
20811+
20812 #pragma aux shl_long_asm = \
20813 "push [edi]" \
20814 "popf" \
20815@@ -584,7 +633,8 @@ u32 shl_long_asm(u32 *flags,u32 d, u8 s);
20816 value [eax] \
20817 modify exact [eax cl];
20818
20819-u8 shr_byte_asm(u32 *flags,u8 d, u8 s);
20820+u8 shr_byte_asm(u32 * flags, u8 d, u8 s);
20821+
20822 #pragma aux shr_byte_asm = \
20823 "push [edi]" \
20824 "popf" \
20825@@ -595,7 +645,8 @@ u8 shr_byte_asm(u32 *flags,u8 d, u8 s);
20826 value [al] \
20827 modify exact [al cl];
20828
20829-u16 shr_word_asm(u32 *flags,u16 d, u8 s);
20830+u16 shr_word_asm(u32 * flags, u16 d, u8 s);
20831+
20832 #pragma aux shr_word_asm = \
20833 "push [edi]" \
20834 "popf" \
20835@@ -606,7 +657,8 @@ u16 shr_word_asm(u32 *flags,u16 d, u8 s);
20836 value [ax] \
20837 modify exact [ax cl];
20838
20839-u32 shr_long_asm(u32 *flags,u32 d, u8 s);
20840+u32 shr_long_asm(u32 * flags, u32 d, u8 s);
20841+
20842 #pragma aux shr_long_asm = \
20843 "push [edi]" \
20844 "popf" \
20845@@ -617,7 +669,8 @@ u32 shr_long_asm(u32 *flags,u32 d, u8 s);
20846 value [eax] \
20847 modify exact [eax cl];
20848
20849-u8 sar_byte_asm(u32 *flags,u8 d, u8 s);
20850+u8 sar_byte_asm(u32 * flags, u8 d, u8 s);
20851+
20852 #pragma aux sar_byte_asm = \
20853 "push [edi]" \
20854 "popf" \
20855@@ -628,7 +681,8 @@ u8 sar_byte_asm(u32 *flags,u8 d, u8 s);
20856 value [al] \
20857 modify exact [al cl];
20858
20859-u16 sar_word_asm(u32 *flags,u16 d, u8 s);
20860+u16 sar_word_asm(u32 * flags, u16 d, u8 s);
20861+
20862 #pragma aux sar_word_asm = \
20863 "push [edi]" \
20864 "popf" \
20865@@ -639,7 +693,8 @@ u16 sar_word_asm(u32 *flags,u16 d, u8 s);
20866 value [ax] \
20867 modify exact [ax cl];
20868
20869-u32 sar_long_asm(u32 *flags,u32 d, u8 s);
20870+u32 sar_long_asm(u32 * flags, u32 d, u8 s);
20871+
20872 #pragma aux sar_long_asm = \
20873 "push [edi]" \
20874 "popf" \
20875@@ -650,7 +705,8 @@ u32 sar_long_asm(u32 *flags,u32 d, u8 s);
20876 value [eax] \
20877 modify exact [eax cl];
20878
20879-u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
20880+u16 shld_word_asm(u32 * flags, u16 d, u16 fill, u8 s);
20881+
20882 #pragma aux shld_word_asm = \
20883 "push [edi]" \
20884 "popf" \
20885@@ -661,7 +717,8 @@ u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
20886 value [ax] \
20887 modify exact [ax dx cl];
20888
20889-u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
20890+u32 shld_long_asm(u32 * flags, u32 d, u32 fill, u8 s);
20891+
20892 #pragma aux shld_long_asm = \
20893 "push [edi]" \
20894 "popf" \
20895@@ -672,7 +729,8 @@ u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
20896 value [eax] \
20897 modify exact [eax edx cl];
20898
20899-u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
20900+u16 shrd_word_asm(u32 * flags, u16 d, u16 fill, u8 s);
20901+
20902 #pragma aux shrd_word_asm = \
20903 "push [edi]" \
20904 "popf" \
20905@@ -683,7 +741,8 @@ u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
20906 value [ax] \
20907 modify exact [ax dx cl];
20908
20909-u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
20910+u32 shrd_long_asm(u32 * flags, u32 d, u32 fill, u8 s);
20911+
20912 #pragma aux shrd_long_asm = \
20913 "push [edi]" \
20914 "popf" \
20915@@ -694,7 +753,8 @@ u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
20916 value [eax] \
20917 modify exact [eax edx cl];
20918
20919-u8 sbb_byte_asm(u32 *flags,u8 d, u8 s);
20920+u8 sbb_byte_asm(u32 * flags, u8 d, u8 s);
20921+
20922 #pragma aux sbb_byte_asm = \
20923 "push [edi]" \
20924 "popf" \
20925@@ -705,7 +765,8 @@ u8 sbb_byte_asm(u32 *flags,u8 d, u8 s);
20926 value [al] \
20927 modify exact [al bl];
20928
20929-u16 sbb_word_asm(u32 *flags,u16 d, u16 s);
20930+u16 sbb_word_asm(u32 * flags, u16 d, u16 s);
20931+
20932 #pragma aux sbb_word_asm = \
20933 "push [edi]" \
20934 "popf" \
20935@@ -716,7 +777,8 @@ u16 sbb_word_asm(u32 *flags,u16 d, u16 s);
20936 value [ax] \
20937 modify exact [ax bx];
20938
20939-u32 sbb_long_asm(u32 *flags,u32 d, u32 s);
20940+u32 sbb_long_asm(u32 * flags, u32 d, u32 s);
20941+
20942 #pragma aux sbb_long_asm = \
20943 "push [edi]" \
20944 "popf" \
20945@@ -727,7 +789,8 @@ u32 sbb_long_asm(u32 *flags,u32 d, u32 s);
20946 value [eax] \
20947 modify exact [eax ebx];
20948
20949-u8 sub_byte_asm(u32 *flags,u8 d, u8 s);
20950+u8 sub_byte_asm(u32 * flags, u8 d, u8 s);
20951+
20952 #pragma aux sub_byte_asm = \
20953 "push [edi]" \
20954 "popf" \
20955@@ -738,7 +801,8 @@ u8 sub_byte_asm(u32 *flags,u8 d, u8 s);
20956 value [al] \
20957 modify exact [al bl];
20958
20959-u16 sub_word_asm(u32 *flags,u16 d, u16 s);
20960+u16 sub_word_asm(u32 * flags, u16 d, u16 s);
20961+
20962 #pragma aux sub_word_asm = \
20963 "push [edi]" \
20964 "popf" \
20965@@ -749,7 +813,8 @@ u16 sub_word_asm(u32 *flags,u16 d, u16 s);
20966 value [ax] \
20967 modify exact [ax bx];
20968
20969-u32 sub_long_asm(u32 *flags,u32 d, u32 s);
20970+u32 sub_long_asm(u32 * flags, u32 d, u32 s);
20971+
20972 #pragma aux sub_long_asm = \
20973 "push [edi]" \
20974 "popf" \
20975@@ -760,7 +825,8 @@ u32 sub_long_asm(u32 *flags,u32 d, u32 s);
20976 value [eax] \
20977 modify exact [eax ebx];
20978
20979-void test_byte_asm(u32 *flags,u8 d, u8 s);
20980+void test_byte_asm(u32 * flags, u8 d, u8 s);
20981+
20982 #pragma aux test_byte_asm = \
20983 "push [edi]" \
20984 "popf" \
20985@@ -770,7 +836,8 @@ void test_byte_asm(u32 *flags,u8 d, u8 s);
20986 parm [edi] [al] [bl] \
20987 modify exact [al bl];
20988
20989-void test_word_asm(u32 *flags,u16 d, u16 s);
20990+void test_word_asm(u32 * flags, u16 d, u16 s);
20991+
20992 #pragma aux test_word_asm = \
20993 "push [edi]" \
20994 "popf" \
20995@@ -780,7 +847,8 @@ void test_word_asm(u32 *flags,u16 d, u16 s);
20996 parm [edi] [ax] [bx] \
20997 modify exact [ax bx];
20998
20999-void test_long_asm(u32 *flags,u32 d, u32 s);
21000+void test_long_asm(u32 * flags, u32 d, u32 s);
21001+
21002 #pragma aux test_long_asm = \
21003 "push [edi]" \
21004 "popf" \
21005@@ -790,7 +858,8 @@ void test_long_asm(u32 *flags,u32 d, u32 s);
21006 parm [edi] [eax] [ebx] \
21007 modify exact [eax ebx];
21008
21009-u8 xor_byte_asm(u32 *flags,u8 d, u8 s);
21010+u8 xor_byte_asm(u32 * flags, u8 d, u8 s);
21011+
21012 #pragma aux xor_byte_asm = \
21013 "push [edi]" \
21014 "popf" \
21015@@ -801,7 +870,8 @@ u8 xor_byte_asm(u32 *flags,u8 d, u8 s);
21016 value [al] \
21017 modify exact [al bl];
21018
21019-u16 xor_word_asm(u32 *flags,u16 d, u16 s);
21020+u16 xor_word_asm(u32 * flags, u16 d, u16 s);
21021+
21022 #pragma aux xor_word_asm = \
21023 "push [edi]" \
21024 "popf" \
21025@@ -812,7 +882,8 @@ u16 xor_word_asm(u32 *flags,u16 d, u16 s);
21026 value [ax] \
21027 modify exact [ax bx];
21028
21029-u32 xor_long_asm(u32 *flags,u32 d, u32 s);
21030+u32 xor_long_asm(u32 * flags, u32 d, u32 s);
21031+
21032 #pragma aux xor_long_asm = \
21033 "push [edi]" \
21034 "popf" \
21035@@ -823,7 +894,8 @@ u32 xor_long_asm(u32 *flags,u32 d, u32 s);
21036 value [eax] \
21037 modify exact [eax ebx];
21038
21039-void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
21040+void imul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s);
21041+
21042 #pragma aux imul_byte_asm = \
21043 "push [edi]" \
21044 "popf" \
21045@@ -834,7 +906,8 @@ void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
21046 parm [edi] [esi] [al] [bl] \
21047 modify exact [esi ax bl];
21048
21049-void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
21050+void imul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s);
21051+
21052 #pragma aux imul_word_asm = \
21053 "push [edi]" \
21054 "popf" \
21055@@ -846,7 +919,8 @@ void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
21056 parm [edi] [esi] [ecx] [ax] [bx]\
21057 modify exact [esi edi ax bx dx];
21058
21059-void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
21060+void imul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s);
21061+
21062 #pragma aux imul_long_asm = \
21063 "push [edi]" \
21064 "popf" \
21065@@ -858,7 +932,8 @@ void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
21066 parm [edi] [esi] [ecx] [eax] [ebx] \
21067 modify exact [esi edi eax ebx edx];
21068
21069-void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
21070+void mul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s);
21071+
21072 #pragma aux mul_byte_asm = \
21073 "push [edi]" \
21074 "popf" \
21075@@ -869,7 +944,8 @@ void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
21076 parm [edi] [esi] [al] [bl] \
21077 modify exact [esi ax bl];
21078
21079-void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
21080+void mul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s);
21081+
21082 #pragma aux mul_word_asm = \
21083 "push [edi]" \
21084 "popf" \
21085@@ -881,7 +957,8 @@ void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
21086 parm [edi] [esi] [ecx] [ax] [bx]\
21087 modify exact [esi edi ax bx dx];
21088
21089-void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
21090+void mul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s);
21091+
21092 #pragma aux mul_long_asm = \
21093 "push [edi]" \
21094 "popf" \
21095@@ -893,7 +970,8 @@ void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
21096 parm [edi] [esi] [ecx] [eax] [ebx] \
21097 modify exact [esi edi eax ebx edx];
21098
21099-void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
21100+void idiv_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s);
21101+
21102 #pragma aux idiv_byte_asm = \
21103 "push [edi]" \
21104 "popf" \
21105@@ -905,7 +983,8 @@ void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
21106 parm [edi] [esi] [ecx] [ax] [bl]\
21107 modify exact [esi edi ax bl];
21108
21109-void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
21110+void idiv_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s);
21111+
21112 #pragma aux idiv_word_asm = \
21113 "push [edi]" \
21114 "popf" \
21115@@ -917,7 +996,8 @@ void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
21116 parm [edi] [esi] [ecx] [ax] [dx] [bx]\
21117 modify exact [esi edi ax dx bx];
21118
21119-void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
21120+void idiv_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s);
21121+
21122 #pragma aux idiv_long_asm = \
21123 "push [edi]" \
21124 "popf" \
21125@@ -929,7 +1009,8 @@ void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
21126 parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
21127 modify exact [esi edi eax edx ebx];
21128
21129-void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
21130+void div_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s);
21131+
21132 #pragma aux div_byte_asm = \
21133 "push [edi]" \
21134 "popf" \
21135@@ -941,7 +1022,8 @@ void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
21136 parm [edi] [esi] [ecx] [ax] [bl]\
21137 modify exact [esi edi ax bl];
21138
21139-void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
21140+void div_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s);
21141+
21142 #pragma aux div_word_asm = \
21143 "push [edi]" \
21144 "popf" \
21145@@ -953,7 +1035,8 @@ void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
21146 parm [edi] [esi] [ecx] [ax] [dx] [bx]\
21147 modify exact [esi edi ax dx bx];
21148
21149-void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
21150+void div_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s);
21151+
21152 #pragma aux div_long_asm = \
21153 "push [edi]" \
21154 "popf" \
21155@@ -967,4 +1050,4 @@ void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
21156
21157 #endif
21158
21159-#endif /* __X86EMU_PRIM_ASM_H */
21160+#endif /* __X86EMU_PRIM_ASM_H */
21161diff --git a/libs/x86emu/x86emu/prim_ops.h b/libs/x86emu/x86emu/prim_ops.h
21162index bea8357..0f0e78d 100644
21163--- a/libs/x86emu/x86emu/prim_ops.h
21164+++ b/libs/x86emu/x86emu/prim_ops.h
21165@@ -40,102 +40,102 @@
21166 #define __X86EMU_PRIM_OPS_H
21167
21168 #ifdef __cplusplus
21169-extern "C" { /* Use "C" linkage when in C++ mode */
21170+extern "C" { /* Use "C" linkage when in C++ mode */
21171 #endif
21172
21173-u16 aaa_word (u16 d);
21174-u16 aas_word (u16 d);
21175-u16 aad_word (u16 d);
21176-u16 aam_word (u8 d);
21177-u8 adc_byte (u8 d, u8 s);
21178-u16 adc_word (u16 d, u16 s);
21179-u32 adc_long (u32 d, u32 s);
21180-u8 add_byte (u8 d, u8 s);
21181-u16 add_word (u16 d, u16 s);
21182-u32 add_long (u32 d, u32 s);
21183-u8 and_byte (u8 d, u8 s);
21184-u16 and_word (u16 d, u16 s);
21185-u32 and_long (u32 d, u32 s);
21186-u8 cmp_byte (u8 d, u8 s);
21187-u16 cmp_word (u16 d, u16 s);
21188-u32 cmp_long (u32 d, u32 s);
21189-u8 daa_byte (u8 d);
21190-u8 das_byte (u8 d);
21191-u8 dec_byte (u8 d);
21192-u16 dec_word (u16 d);
21193-u32 dec_long (u32 d);
21194-u8 inc_byte (u8 d);
21195-u16 inc_word (u16 d);
21196-u32 inc_long (u32 d);
21197-u8 or_byte (u8 d, u8 s);
21198-u16 or_word (u16 d, u16 s);
21199-u32 or_long (u32 d, u32 s);
21200-u8 neg_byte (u8 s);
21201-u16 neg_word (u16 s);
21202-u32 neg_long (u32 s);
21203-u8 not_byte (u8 s);
21204-u16 not_word (u16 s);
21205-u32 not_long (u32 s);
21206-u8 rcl_byte (u8 d, u8 s);
21207-u16 rcl_word (u16 d, u8 s);
21208-u32 rcl_long (u32 d, u8 s);
21209-u8 rcr_byte (u8 d, u8 s);
21210-u16 rcr_word (u16 d, u8 s);
21211-u32 rcr_long (u32 d, u8 s);
21212-u8 rol_byte (u8 d, u8 s);
21213-u16 rol_word (u16 d, u8 s);
21214-u32 rol_long (u32 d, u8 s);
21215-u8 ror_byte (u8 d, u8 s);
21216-u16 ror_word (u16 d, u8 s);
21217-u32 ror_long (u32 d, u8 s);
21218-u8 shl_byte (u8 d, u8 s);
21219-u16 shl_word (u16 d, u8 s);
21220-u32 shl_long (u32 d, u8 s);
21221-u8 shr_byte (u8 d, u8 s);
21222-u16 shr_word (u16 d, u8 s);
21223-u32 shr_long (u32 d, u8 s);
21224-u8 sar_byte (u8 d, u8 s);
21225-u16 sar_word (u16 d, u8 s);
21226-u32 sar_long (u32 d, u8 s);
21227-u16 shld_word (u16 d, u16 fill, u8 s);
21228-u32 shld_long (u32 d, u32 fill, u8 s);
21229-u16 shrd_word (u16 d, u16 fill, u8 s);
21230-u32 shrd_long (u32 d, u32 fill, u8 s);
21231-u8 sbb_byte (u8 d, u8 s);
21232-u16 sbb_word (u16 d, u16 s);
21233-u32 sbb_long (u32 d, u32 s);
21234-u8 sub_byte (u8 d, u8 s);
21235-u16 sub_word (u16 d, u16 s);
21236-u32 sub_long (u32 d, u32 s);
21237-void test_byte (u8 d, u8 s);
21238-void test_word (u16 d, u16 s);
21239-void test_long (u32 d, u32 s);
21240-u8 xor_byte (u8 d, u8 s);
21241-u16 xor_word (u16 d, u16 s);
21242-u32 xor_long (u32 d, u32 s);
21243-void imul_byte (u8 s);
21244-void imul_word (u16 s);
21245-void imul_long (u32 s);
21246-void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s);
21247-void mul_byte (u8 s);
21248-void mul_word (u16 s);
21249-void mul_long (u32 s);
21250-void idiv_byte (u8 s);
21251-void idiv_word (u16 s);
21252-void idiv_long (u32 s);
21253-void div_byte (u8 s);
21254-void div_word (u16 s);
21255-void div_long (u32 s);
21256-void ins (int size);
21257-void outs (int size);
21258-u16 mem_access_word (int addr);
21259-void push_word (u16 w);
21260-void push_long (u32 w);
21261-u16 pop_word (void);
21262-u32 pop_long (void);
21263+ u16 aaa_word(u16 d);
21264+ u16 aas_word(u16 d);
21265+ u16 aad_word(u16 d);
21266+ u16 aam_word(u8 d);
21267+ u8 adc_byte(u8 d, u8 s);
21268+ u16 adc_word(u16 d, u16 s);
21269+ u32 adc_long(u32 d, u32 s);
21270+ u8 add_byte(u8 d, u8 s);
21271+ u16 add_word(u16 d, u16 s);
21272+ u32 add_long(u32 d, u32 s);
21273+ u8 and_byte(u8 d, u8 s);
21274+ u16 and_word(u16 d, u16 s);
21275+ u32 and_long(u32 d, u32 s);
21276+ u8 cmp_byte(u8 d, u8 s);
21277+ u16 cmp_word(u16 d, u16 s);
21278+ u32 cmp_long(u32 d, u32 s);
21279+ u8 daa_byte(u8 d);
21280+ u8 das_byte(u8 d);
21281+ u8 dec_byte(u8 d);
21282+ u16 dec_word(u16 d);
21283+ u32 dec_long(u32 d);
21284+ u8 inc_byte(u8 d);
21285+ u16 inc_word(u16 d);
21286+ u32 inc_long(u32 d);
21287+ u8 or_byte(u8 d, u8 s);
21288+ u16 or_word(u16 d, u16 s);
21289+ u32 or_long(u32 d, u32 s);
21290+ u8 neg_byte(u8 s);
21291+ u16 neg_word(u16 s);
21292+ u32 neg_long(u32 s);
21293+ u8 not_byte(u8 s);
21294+ u16 not_word(u16 s);
21295+ u32 not_long(u32 s);
21296+ u8 rcl_byte(u8 d, u8 s);
21297+ u16 rcl_word(u16 d, u8 s);
21298+ u32 rcl_long(u32 d, u8 s);
21299+ u8 rcr_byte(u8 d, u8 s);
21300+ u16 rcr_word(u16 d, u8 s);
21301+ u32 rcr_long(u32 d, u8 s);
21302+ u8 rol_byte(u8 d, u8 s);
21303+ u16 rol_word(u16 d, u8 s);
21304+ u32 rol_long(u32 d, u8 s);
21305+ u8 ror_byte(u8 d, u8 s);
21306+ u16 ror_word(u16 d, u8 s);
21307+ u32 ror_long(u32 d, u8 s);
21308+ u8 shl_byte(u8 d, u8 s);
21309+ u16 shl_word(u16 d, u8 s);
21310+ u32 shl_long(u32 d, u8 s);
21311+ u8 shr_byte(u8 d, u8 s);
21312+ u16 shr_word(u16 d, u8 s);
21313+ u32 shr_long(u32 d, u8 s);
21314+ u8 sar_byte(u8 d, u8 s);
21315+ u16 sar_word(u16 d, u8 s);
21316+ u32 sar_long(u32 d, u8 s);
21317+ u16 shld_word(u16 d, u16 fill, u8 s);
21318+ u32 shld_long(u32 d, u32 fill, u8 s);
21319+ u16 shrd_word(u16 d, u16 fill, u8 s);
21320+ u32 shrd_long(u32 d, u32 fill, u8 s);
21321+ u8 sbb_byte(u8 d, u8 s);
21322+ u16 sbb_word(u16 d, u16 s);
21323+ u32 sbb_long(u32 d, u32 s);
21324+ u8 sub_byte(u8 d, u8 s);
21325+ u16 sub_word(u16 d, u16 s);
21326+ u32 sub_long(u32 d, u32 s);
21327+ void test_byte(u8 d, u8 s);
21328+ void test_word(u16 d, u16 s);
21329+ void test_long(u32 d, u32 s);
21330+ u8 xor_byte(u8 d, u8 s);
21331+ u16 xor_word(u16 d, u16 s);
21332+ u32 xor_long(u32 d, u32 s);
21333+ void imul_byte(u8 s);
21334+ void imul_word(u16 s);
21335+ void imul_long(u32 s);
21336+ void imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s);
21337+ void mul_byte(u8 s);
21338+ void mul_word(u16 s);
21339+ void mul_long(u32 s);
21340+ void idiv_byte(u8 s);
21341+ void idiv_word(u16 s);
21342+ void idiv_long(u32 s);
21343+ void div_byte(u8 s);
21344+ void div_word(u16 s);
21345+ void div_long(u32 s);
21346+ void ins(int size);
21347+ void outs(int size);
21348+ u16 mem_access_word(int addr);
21349+ void push_word(u16 w);
21350+ void push_long(u32 w);
21351+ u16 pop_word(void);
21352+ u32 pop_long(void);
21353+ void cpuid(void);
21354
21355 #ifdef __cplusplus
21356-} /* End of "C" linkage for C++ */
21357+} /* End of "C" linkage for C++ */
21358 #endif
21359-
21360-#endif /* __X86EMU_PRIM_OPS_H */
21361+#endif /* __X86EMU_PRIM_OPS_H */
21362diff --git a/libs/x86emu/x86emu/prim_x86_gcc.h b/libs/x86emu/x86emu/prim_x86_gcc.h
21363new file mode 100644
21364index 0000000..646ec9d
21365--- /dev/null
21366+++ b/libs/x86emu/x86emu/prim_x86_gcc.h
21367@@ -0,0 +1,77 @@
21368+/****************************************************************************
21369+*
21370+* Inline helpers for x86emu
21371+*
21372+* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC
21373+*
21374+* ========================================================================
21375+*
21376+* Permission to use, copy, modify, distribute, and sell this software and
21377+* its documentation for any purpose is hereby granted without fee,
21378+* provided that the above copyright notice appear in all copies and that
21379+* both that copyright notice and this permission notice appear in
21380+* supporting documentation, and that the name of the authors not be used
21381+* in advertising or publicity pertaining to distribution of the software
21382+* without specific, written prior permission. The authors makes no
21383+* representations about the suitability of this software for any purpose.
21384+* It is provided "as is" without express or implied warranty.
21385+*
21386+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21387+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
21388+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21389+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
21390+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21391+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21392+* PERFORMANCE OF THIS SOFTWARE.
21393+*
21394+* ========================================================================
21395+*
21396+* Language: GNU C
21397+* Environment: GCC on i386 or x86-64
21398+* Developer: Bart Trojanowski
21399+*
21400+* Description: This file defines a few x86 macros that can be used by the
21401+* emulator to execute native instructions.
21402+*
21403+* For PIC vs non-PIC code refer to:
21404+* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
21405+*
21406+****************************************************************************/
21407+#ifndef __X86EMU_PRIM_X86_GCC_H
21408+#define __X86EMU_PRIM_X86_GCC_H
21409+
21410+#include "x86emu/types.h"
21411+
21412+#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__))
21413+#error This file is intended to be used by gcc on i386 or x86-64 system
21414+#endif
21415+
21416+#if defined(__PIC__) && defined(__i386__)
21417+
21418+#define X86EMU_HAS_HW_CPUID 1
21419+static inline void
21420+hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
21421+{
21422+ __asm__ __volatile__("pushl %%ebx \n\t"
21423+ "cpuid \n\t"
21424+ "movl %%ebx, %1 \n\t"
21425+ "popl %%ebx \n\t":"=a"(*a), "=r"(*b),
21426+ "=c"(*c), "=d"(*d)
21427+ :"a"(*a), "c"(*c)
21428+ :"cc");
21429+}
21430+
21431+#else /* ! (__PIC__ && __i386__) */
21432+
21433+#define x86EMU_HAS_HW_CPUID 1
21434+static inline void
21435+hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
21436+{
21437+ __asm__ __volatile__("cpuid":"=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d)
21438+ :"a"(*a), "c"(*c)
21439+ :"cc");
21440+}
21441+
21442+#endif /* __PIC__ && __i386__ */
21443+
21444+#endif /* __X86EMU_PRIM_X86_GCC_H */
21445diff --git a/libs/x86emu/x86emu/regs.h b/libs/x86emu/x86emu/regs.h
21446index 52cf8e4..6bd0611 100644
21447--- a/libs/x86emu/x86emu/regs.h
21448+++ b/libs/x86emu/x86emu/regs.h
21449@@ -42,7 +42,7 @@
21450 /*---------------------- Macros and type definitions ----------------------*/
21451
21452 #ifdef PACK
21453-# pragma PACK
21454+#pragma PACK
21455 #endif
21456
21457 /*
21458@@ -64,48 +64,48 @@
21459
21460 typedef struct {
21461 u32 e_reg;
21462- } I32_reg_t;
21463+} I32_reg_t;
21464
21465 typedef struct {
21466- u16 filler0, x_reg;
21467- } I16_reg_t;
21468+ u16 filler0, x_reg;
21469+} I16_reg_t;
21470
21471 typedef struct {
21472- u8 filler0, filler1, h_reg, l_reg;
21473- } I8_reg_t;
21474+ u8 filler0, filler1, h_reg, l_reg;
21475+} I8_reg_t;
21476
21477-#else /* !__BIG_ENDIAN__ */
21478+#else /* !__BIG_ENDIAN__ */
21479
21480 typedef struct {
21481 u32 e_reg;
21482- } I32_reg_t;
21483+} I32_reg_t;
21484
21485 typedef struct {
21486- u16 x_reg;
21487- } I16_reg_t;
21488+ u16 x_reg;
21489+} I16_reg_t;
21490
21491 typedef struct {
21492- u8 l_reg, h_reg;
21493- } I8_reg_t;
21494+ u8 l_reg, h_reg;
21495+} I8_reg_t;
21496
21497-#endif /* BIG_ENDIAN */
21498+#endif /* BIG_ENDIAN */
21499
21500 typedef union {
21501- I32_reg_t I32_reg;
21502- I16_reg_t I16_reg;
21503- I8_reg_t I8_reg;
21504- } i386_general_register;
21505+ I32_reg_t I32_reg;
21506+ I16_reg_t I16_reg;
21507+ I8_reg_t I8_reg;
21508+} i386_general_register;
21509
21510 struct i386_general_regs {
21511- i386_general_register A, B, C, D;
21512- };
21513+ i386_general_register A, B, C, D;
21514+};
21515
21516 typedef struct i386_general_regs Gen_reg_t;
21517
21518 struct i386_special_regs {
21519- i386_general_register SP, BP, SI, DI, IP;
21520- u32 FLAGS;
21521- };
21522+ i386_general_register SP, BP, SI, DI, IP;
21523+ u32 FLAGS;
21524+};
21525
21526 /*
21527 * Segment registers here represent the 16 bit quantities
21528@@ -114,7 +114,7 @@ struct i386_special_regs {
21529
21530 struct i386_segment_regs {
21531 u16 CS, DS, SS, ES, FS, GS;
21532- };
21533+};
21534
21535 /* 8 bit registers */
21536 #define R_AH gen.A.I8_reg.h_reg
21537@@ -258,9 +258,9 @@ struct i386_segment_regs {
21538 #define INTR_HALTED 0x4
21539
21540 typedef struct {
21541- struct i386_general_regs gen;
21542- struct i386_special_regs spc;
21543- struct i386_segment_regs seg;
21544+ struct i386_general_regs gen;
21545+ struct i386_special_regs spc;
21546+ struct i386_segment_regs seg;
21547 /*
21548 * MODE contains information on:
21549 * REPE prefix 2 bits repe,repne
21550@@ -273,21 +273,21 @@ typedef struct {
21551 * Extern interrupt 1 bits
21552 * Halted 1 bits
21553 */
21554- u32 mode;
21555- volatile int intr; /* mask of pending interrupts */
21556- int debug;
21557+ u32 mode;
21558+ volatile int intr; /* mask of pending interrupts */
21559+ int debug;
21560 #ifdef DEBUG
21561- int check;
21562- u16 saved_ip;
21563- u16 saved_cs;
21564- int enc_pos;
21565- int enc_str_pos;
21566- char decode_buf[32]; /* encoded byte stream */
21567- char decoded_buf[256]; /* disassembled strings */
21568+ int check;
21569+ u16 saved_ip;
21570+ u16 saved_cs;
21571+ int enc_pos;
21572+ int enc_str_pos;
21573+ char decode_buf[32]; /* encoded byte stream */
21574+ char decoded_buf[256]; /* disassembled strings */
21575 #endif
21576- u8 intno;
21577- u8 __pad[3];
21578- } X86EMU_regs;
21579+ u8 intno;
21580+ u8 __pad[3];
21581+} X86EMU_regs;
21582
21583 /****************************************************************************
21584 REMARKS:
21585@@ -300,20 +300,20 @@ private - private data pointer
21586 x86 - X86 registers
21587 ****************************************************************************/
21588 typedef struct {
21589- unsigned long mem_base;
21590- unsigned long mem_size;
21591- void* private;
21592- X86EMU_regs x86;
21593- } X86EMU_sysEnv;
21594+ unsigned long mem_base;
21595+ unsigned long mem_size;
21596+ void *private;
21597+ X86EMU_regs x86;
21598+} X86EMU_sysEnv;
21599
21600 #ifdef END_PACK
21601-# pragma END_PACK
21602+#pragma END_PACK
21603 #endif
21604
21605 /*----------------------------- Global Variables --------------------------*/
21606
21607 #ifdef __cplusplus
21608-extern "C" { /* Use "C" linkage when in C++ mode */
21609+extern "C" { /* Use "C" linkage when in C++ mode */
21610 #endif
21611
21612 /* Global emulator machine state.
21613@@ -321,17 +321,16 @@ extern "C" { /* Use "C" linkage when in C++ mode */
21614 * We keep it global to avoid pointer dereferences in the code for speed.
21615 */
21616
21617-extern X86EMU_sysEnv _X86EMU_env;
21618+ extern X86EMU_sysEnv _X86EMU_env;
21619 #define M _X86EMU_env
21620
21621 /*-------------------------- Function Prototypes --------------------------*/
21622
21623 /* Function to log information at runtime */
21624
21625-void printk(const char *fmt, ...);
21626+ void printk(const char *fmt, ...);
21627
21628 #ifdef __cplusplus
21629-} /* End of "C" linkage for C++ */
21630+} /* End of "C" linkage for C++ */
21631 #endif
21632-
21633-#endif /* __X86EMU_REGS_H */
21634+#endif /* __X86EMU_REGS_H */
21635diff --git a/libs/x86emu/x86emu/types.h b/libs/x86emu/x86emu/types.h
21636index c0c09c1..5a6ef01 100644
21637--- a/libs/x86emu/x86emu/types.h
21638+++ b/libs/x86emu/x86emu/types.h
21639@@ -36,7 +36,6 @@
21640 *
21641 ****************************************************************************/
21642
21643-
21644 #ifndef __X86EMU_TYPES_H
21645 #define __X86EMU_TYPES_H
21646
21647@@ -61,46 +60,21 @@
21648
21649 /*---------------------- Macros and type definitions ----------------------*/
21650
21651-/* Currently only for Linux/32bit */
21652-#undef __HAS_LONG_LONG__
21653-#if defined(__GNUC__) && !defined(NO_LONG_LONG)
21654-#define __HAS_LONG_LONG__
21655-#endif
21656+#include <stdint.h>
21657
21658-/* Taken from Xmd.h */
21659-#undef NUM32
21660-#if defined (_LP64) || \
21661- defined(__alpha) || defined(__alpha__) || \
21662- defined(__ia64__) || defined(ia64) || \
21663- defined(__sparc64__) || \
21664- defined(__s390x__) || \
21665- (defined(__hppa__) && defined(__LP64)) || \
21666- defined(__amd64__) || defined(amd64) || \
21667- (defined(__sgi) && (_MIPS_SZLONG == 64))
21668-#define NUM32 int
21669-#else
21670-#define NUM32 long
21671-#endif
21672+typedef uint8_t u8;
21673+typedef uint16_t u16;
21674+typedef uint32_t u32;
21675+typedef uint64_t u64;
21676
21677-typedef unsigned char u8;
21678-typedef unsigned short u16;
21679-typedef unsigned NUM32 u32;
21680-#ifdef __HAS_LONG_LONG__
21681-typedef unsigned long long u64;
21682-#endif
21683+typedef int8_t s8;
21684+typedef int16_t s16;
21685+typedef int32_t s32;
21686+typedef int64_t s64;
21687
21688-typedef char s8;
21689-typedef short s16;
21690-typedef NUM32 s32;
21691-#ifdef __HAS_LONG_LONG__
21692-typedef long long s64;
21693-#endif
21694-
21695-typedef unsigned int uint;
21696-typedef int sint;
21697+typedef unsigned int uint;
21698+typedef int sint;
21699
21700 typedef u16 X86EMU_pioAddr;
21701
21702-#undef NUM32
21703-
21704-#endif /* __X86EMU_TYPES_H */
21705+#endif /* __X86EMU_TYPES_H */
21706diff --git a/libs/x86emu/x86emu/x86emui.h b/libs/x86emu/x86emu/x86emui.h
21707index 112ee36..f11dc10 100644
21708--- a/libs/x86emu/x86emu/x86emui.h
21709+++ b/libs/x86emu/x86emu/x86emui.h
21710@@ -38,7 +38,6 @@
21711 *
21712 ****************************************************************************/
21713
21714-
21715 #ifndef __X86EMU_X86EMUI_H
21716 #define __X86EMU_X86EMUI_H
21717
21718@@ -74,29 +73,28 @@
21719 #include <stdio.h>
21720 #include <stdlib.h>
21721 #include <string.h>
21722-#endif
21723+#endif
21724 /*--------------------------- Inline Functions ----------------------------*/
21725
21726 #ifdef __cplusplus
21727-extern "C" { /* Use "C" linkage when in C++ mode */
21728+extern "C" { /* Use "C" linkage when in C++ mode */
21729 #endif
21730
21731-extern u8 (X86APIP sys_rdb)(u32 addr);
21732-extern u16 (X86APIP sys_rdw)(u32 addr);
21733-extern u32 (X86APIP sys_rdl)(u32 addr);
21734-extern void (X86APIP sys_wrb)(u32 addr,u8 val);
21735-extern void (X86APIP sys_wrw)(u32 addr,u16 val);
21736-extern void (X86APIP sys_wrl)(u32 addr,u32 val);
21737+ extern u8(X86APIP sys_rdb) (u32 addr);
21738+ extern u16(X86APIP sys_rdw) (u32 addr);
21739+ extern u32(X86APIP sys_rdl) (u32 addr);
21740+ extern void (X86APIP sys_wrb) (u32 addr, u8 val);
21741+ extern void (X86APIP sys_wrw) (u32 addr, u16 val);
21742+ extern void (X86APIP sys_wrl) (u32 addr, u32 val);
21743
21744-extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
21745-extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
21746-extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
21747-extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val);
21748-extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val);
21749-extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val);
21750+ extern u8(X86APIP sys_inb) (X86EMU_pioAddr addr);
21751+ extern u16(X86APIP sys_inw) (X86EMU_pioAddr addr);
21752+ extern u32(X86APIP sys_inl) (X86EMU_pioAddr addr);
21753+ extern void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val);
21754+ extern void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val);
21755+ extern void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val);
21756
21757 #ifdef __cplusplus
21758-} /* End of "C" linkage for C++ */
21759+} /* End of "C" linkage for C++ */
21760 #endif
21761-
21762-#endif /* __X86EMU_X86EMUI_H */
21763+#endif /* __X86EMU_X86EMUI_H */
21764--
217651.9.1
21766
diff --git a/meta/recipes-bsp/v86d/v86d/ar-from-env.patch b/meta/recipes-bsp/v86d/v86d/ar-from-env.patch
new file mode 100644
index 0000000000..1dcbc71dcc
--- /dev/null
+++ b/meta/recipes-bsp/v86d/v86d/ar-from-env.patch
@@ -0,0 +1,33 @@
1Fix cross link using host-cross ar
2
3If building on 32bit host and creating 64bit libraries, the target
4package builds should not invoke the 32bit hosts's ar. Specifically
5you will get an error message like:
6
7x86_64-linux-gcc -m64 --sysroot=/opt/qemux86-64/tmp/sysroots/qemux86-64 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Llibs/x86emu v86_x86emu.o v86_mem.o v86_common.o v86.o -lx86emu -o v86d
8libs/x86emu/libx86emu.a: could not read symbols: Archive has no index; run ranlib to add one
9collect2: error: ld returned 1 exit status
10
11Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
12
13Upstream-Status: Pending
14
15---
16 libs/x86emu/Makefile | 6 +++++-
17 1 file changed, 5 insertions(+), 1 deletion(-)
18
19--- a/libs/x86emu/Makefile
20+++ b/libs/x86emu/Makefile
21@@ -1,7 +1,11 @@
22 OBJS = decode.o fpu.o ops.o ops2.o prim_ops.o sys.o
23
24+ifeq ($(AR),)
25+ AR = ar
26+endif
27+
28 libx86emu.a: $(OBJS)
29- ar rv $@ $+
30+ $(AR) rv $@ $+
31
32 %.o: %.c
33 $(CC) -c $(CFLAGS) -o $@ $<
diff --git a/meta/recipes-bsp/v86d/v86d/fbsetup b/meta/recipes-bsp/v86d/v86d/fbsetup
new file mode 100755
index 0000000000..2a409cc529
--- /dev/null
+++ b/meta/recipes-bsp/v86d/v86d/fbsetup
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3/sbin/modprobe uvesafb
diff --git a/meta/recipes-bsp/v86d/v86d/uvesafb.conf b/meta/recipes-bsp/v86d/v86d/uvesafb.conf
new file mode 100644
index 0000000000..43789755d3
--- /dev/null
+++ b/meta/recipes-bsp/v86d/v86d/uvesafb.conf
@@ -0,0 +1,2 @@
1# Load uvesafb.ko at boot
2uvesafb
diff --git a/meta/recipes-bsp/v86d/v86d_0.1.10.bb b/meta/recipes-bsp/v86d/v86d_0.1.10.bb
new file mode 100644
index 0000000000..f50207212f
--- /dev/null
+++ b/meta/recipes-bsp/v86d/v86d_0.1.10.bb
@@ -0,0 +1,69 @@
1SUMMARY = "User support binary for the uvesafb kernel module"
2HOMEPAGE = "http://dev.gentoo.org/~spock/projects/uvesafb/"
3
4# the copyright info is at the bottom of README, expect break
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://README;md5=94ac1971e4f2309dc322d598e7b1f7dd"
7
8DEPENDS = "virtual/kernel"
9RRECOMMENDS_${PN} = "kernel-module-uvesafb"
10PR = "r2"
11
12SRC_URI = "http://distfiles.gentoo.org/distfiles/${BP}.tar.bz2 \
13 file://Update-x86emu-from-X.org.patch \
14 file://fbsetup \
15 file://uvesafb.conf \
16 file://ar-from-env.patch"
17
18SRC_URI[md5sum] = "51c792ba7b874ad8c43f0d3da4cfabe0"
19SRC_URI[sha256sum] = "634964ae18ef68c8493add2ce150e3b4502badeb0d9194b4bd81241d25e6735c"
20
21PACKAGE_ARCH = "${MACHINE_ARCH}"
22COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
23
24INITSCRIPT_NAME = "fbsetup"
25INITSCRIPT_PARAMS = "start 0 S ."
26
27do_configure () {
28 ./configure --with-x86emu
29}
30
31do_compile () {
32 KDIR="${STAGING_DIR_HOST}/usr" make
33}
34
35do_install () {
36 install -d ${D}${base_sbindir}
37 install v86d ${D}${base_sbindir}/
38
39 # Only install fbsetup script if 'sysvinit' is in DISTRO_FEATURES
40 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
41 install -d ${D}${sysconfdir}/init.d/
42 install -m 0755 ${WORKDIR}/fbsetup ${D}${sysconfdir}/init.d/fbsetup
43 fi
44
45 # Install systemd related configuration file
46 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
47 install -d ${D}${sysconfdir}/modules-load.d
48 install -m 0644 ${WORKDIR}/uvesafb.conf ${D}${sysconfdir}/modules-load.d
49 fi
50}
51
52# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
53# manually to avoid unnecessary postinst/preinst generated.
54python __anonymous() {
55 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
56 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
57}
58
59inherit update-rc.d
60
61DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
62pkg_postinst_${PN} () {
63 if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
64 if [ -n "$D" ]; then
65 OPTS="--root=$D"
66 fi
67 systemctl $OPTS mask fbsetup.service
68 fi
69}