summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-bsp
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-bsp')
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid.inc30
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/0001-Fix-out-of-source-build.patch46
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/acpid.service10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/init31
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid_2.0.26.bb9
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state.bb67
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init39
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.conf1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.state1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd.service7
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy91
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy.conf16
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/default8
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/init51
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/legacy.patch133
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/libtool.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/linkage.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/unlinux.patch25
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/wexitcode.patch26
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb84
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb39
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs8
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch22
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch60
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/config50
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/machconfig0
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarm/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips64/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuppc/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig10
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86/machconfig10
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/formfactor/formfactor_0.0.bb21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gcc46-compatibility.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gnu-efi-Make-setjmp.S-portable-to-ARM.patch50
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/lib-Makefile-fix-parallel-issue.patch38
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch48
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.3.bb46
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch81
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch30
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg2
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch33
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch44
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch27
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch24
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch131
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch19
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch48
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch104
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch101
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch74
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch31
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch40
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb69
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch46
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch56
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch34
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc69
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb35
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb16
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb52
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/0001-console-Fix-C-syntax-errors-for-function-declaration.patch74
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch45
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot_git.bb37
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/files/COPYING.patch346
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap-fw-load.patch22
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf193
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream191
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.modalias28
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-conf_1.0.bb23
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/0001-Define-_u32-__s32-__u16-__s16-__u8-in-terms-of-c99-t.patch36
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch27
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils.inc28
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb5
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/GPLv2.patch347
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/keymaps/files/keymap.sh16
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/keymaps/keymaps_1.0.bb50
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/ldflags.patch41
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch47
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/makefile-fix.patch47
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch23
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/libacpi/libacpi_0.2.bb32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch19
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch21884
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch49
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch22
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb48
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/configure.patch104
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch37
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/makefile.patch26
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils_3.4.1.bb60
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch101
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_race.patch43
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils.inc32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb13
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb25
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/COPYING2
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/pointercal0
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercalbin0 -> 36 bytes
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal1
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal_0.0.bb22
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/add_stdlib.patch18
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/ldflags.patch24
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial_2.17.bb29
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb49
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2016.03.bb32
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot.inc289
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot_2016.03.bb10
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit.bb21
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL339
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/usb-gether23
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch28
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/iconv.patch41
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch30
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils_008.bb25
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch21766
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/ar-from-env.patch33
-rwxr-xr-ximport-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/fbsetup3
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/uvesafb.conf2
-rw-r--r--import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d_0.1.10.bb69
139 files changed, 49769 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid.inc b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid.inc
new file mode 100644
index 000000000..12ec19bbb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid.inc
@@ -0,0 +1,30 @@
+SUMMARY = "A daemon for delivering ACPI events"
+HOMEPAGE = "http://sourceforge.net/projects/acpid2"
+BUGTRACKER = "http://sourceforge.net/p/acpid2/tickets/?source=navbar"
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/acpid2/acpid-${PV}.tar.xz \
+ file://init \
+ file://acpid.service \
+ "
+
+inherit autotools update-rc.d systemd
+
+INITSCRIPT_NAME = "acpid"
+INITSCRIPT_PARAMS = "defaults"
+
+SYSTEMD_SERVICE_${PN} = "acpid.service"
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/init.d
+ sed -e 's,/usr/sbin,${sbindir},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/acpid
+ chmod 755 ${D}${sysconfdir}/init.d/acpid
+
+ install -d ${D}${sysconfdir}/acpi
+ install -d ${D}${sysconfdir}/acpi/events
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/acpid.service ${D}${systemd_unitdir}/system
+ sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/acpid.service
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/0001-Fix-out-of-source-build.patch b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/0001-Fix-out-of-source-build.patch
new file mode 100644
index 000000000..d1aa3aa17
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/0001-Fix-out-of-source-build.patch
@@ -0,0 +1,46 @@
+From 5d32b65af750e2007730f3d55a552a186aed81a6 Mon Sep 17 00:00:00 2001
+From: "Maxin B. John" <maxin.john@intel.com>
+Date: Wed, 20 Jan 2016 14:08:29 +0200
+Subject: [PATCH] Fix out of source build
+
+Since the source directory contains another config.h, the build
+directory should be searched first.
+
+Upstream-Status: Submitted
+[https://sourceforge.net/p/acpid2/tickets/10/]
+
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+ sock.c | 2 +-
+ ud_socket.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sock.c b/sock.c
+index 644d460..9e04501 100644
+--- a/sock.c
++++ b/sock.c
+@@ -21,7 +21,7 @@
+ */
+
+ #ifdef HAVE_CONFIG_H
+-#include "config.h"
++#include <config.h>
+ #endif
+
+ #include <unistd.h>
+diff --git a/ud_socket.c b/ud_socket.c
+index 1790917..83b2aa9 100644
+--- a/ud_socket.c
++++ b/ud_socket.c
+@@ -4,7 +4,7 @@
+ */
+
+ #ifdef HAVE_CONFIG_H
+-#include "config.h"
++#include <config.h>
+ #endif
+
+ #include <stdio.h>
+--
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/acpid.service b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/acpid.service
new file mode 100644
index 000000000..f70e74096
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/acpid.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ACPI Event Daemon
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/acpid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/init b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/init
new file mode 100755
index 000000000..40ff385c1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid/init
@@ -0,0 +1,31 @@
+#! /bin/sh -e
+
+test -x /usr/sbin/acpid || exit 0
+test -d /proc/acpi || exit 0
+mkdir -p /etc/acpi/events
+
+case "$1" in
+ start)
+ echo -n "Starting Advanced Configuration and Power Interface daemon: "
+ if [ ! -d /etc/acpi/events ]; then
+ echo "There is not any rule configuration file."
+ else
+ start-stop-daemon -o -S -x /usr/sbin/acpid -- -c /etc/acpi/events
+ echo "acpid."
+ fi
+ ;;
+ stop)
+ echo -n "Stopping Advanced Configuration and Power Interface daemon: "
+ start-stop-daemon -o -K -x /usr/sbin/acpid
+ echo "acpid."
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/acpid {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid_2.0.26.bb b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid_2.0.26.bb
new file mode 100644
index 000000000..c3bd51f7d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/acpid/acpid_2.0.26.bb
@@ -0,0 +1,9 @@
+require acpid.inc
+
+SRC_URI += "file://0001-Fix-out-of-source-build.patch"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
+ file://acpid.h;endline=24;md5=324a9cf225ae69ddaad1bf9d942115b5"
+
+SRC_URI[md5sum] = "f6d772e35ed907f1cc14ad1a546fd473"
+SRC_URI[sha256sum] = "8384f37e4f260f50183e2e20039823d8f06aed9db56924fe92097b7e0b2e0343"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state.bb b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state.bb
new file mode 100644
index 000000000..d0f7bb330
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state.bb
@@ -0,0 +1,67 @@
+# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
+# License: MIT (see http://www.opensource.org/licenses/mit-license.php
+# for a copy of the license)
+#
+# Filename: alsa-state.bb
+
+SUMMARY = "Alsa scenario files to enable alsa state restoration"
+DESCRIPTION = "Alsa Scenario Files - an init script and state files to restore \
+sound state at system boot and save it at system shut down."
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+PV = "0.2.0"
+PR = "r5"
+
+SRC_URI = "\
+ file://asound.conf \
+ file://asound.state \
+ file://alsa-state-init \
+"
+
+S = "${WORKDIR}"
+
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
+# manually to avoid unnecessary postinst/preinst generated.
+python __anonymous() {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "alsa-state"
+INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ."
+
+do_install() {
+ # Only install the init script when 'sysvinit' is in DISTRO_FEATURES.
+ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ sed -i -e "s:#STATEDIR#:${localstatedir}/lib/alsa:g" ${WORKDIR}/alsa-state-init
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/alsa-state-init ${D}${sysconfdir}/init.d/alsa-state
+ fi
+
+ install -d ${D}/${localstatedir}/lib/alsa
+ install -d ${D}${sysconfdir}
+ install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir}
+ install -m 0644 ${WORKDIR}/*.state ${D}${localstatedir}/lib/alsa
+}
+
+PACKAGES += "alsa-states"
+
+RRECOMMENDS_alsa-state = "alsa-states"
+
+RDEPENDS_${PN} = "alsa-utils-alsactl"
+FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf"
+CONFFILES_${PN} = "${sysconfdir}/asound.conf"
+
+FILES_alsa-states = "${localstatedir}/lib/alsa/*.state"
+
+pkg_postinst_${PN}() {
+ if test -z "$D"
+ then
+ if test -x ${sbindir}/alsactl
+ then
+ ${sbindir}/alsactl -f ${localstatedir}/lib/alsa/asound.state restore
+ fi
+ fi
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init
new file mode 100755
index 000000000..eee59cb32
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/alsa-state-init
@@ -0,0 +1,39 @@
+#! /bin/sh
+#
+# Copyright Matthias Hentges <devel@hentges.net> (c) 2007
+# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
+#
+# Filename: alsa-state
+# Date: 20070308 (YMD)
+
+# source function library
+. /etc/init.d/functions
+
+asound_restore(){
+ echo "ALSA: Restoring mixer settings..."
+ if test -x /usr/sbin/alsactl -a -e #STATEDIR#/asound.state
+ then
+ /usr/sbin/alsactl -f #STATEDIR#/asound.state restore &
+ fi
+}
+
+asound_store(){
+ echo "ALSA: Storing mixer settings..."
+ if test -x /usr/sbin/alsactl
+ then
+ /usr/sbin/alsactl -f #STATEDIR#/asound.state store
+ fi
+}
+
+case "$1" in
+start) asound_restore ;;
+stop) asound_store ;;
+ status)
+ status /usr/sbin/alsactl;
+ exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/alsa-state {start|stop|status}"
+ exit 1
+ ;;
+esac
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.conf b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.conf
new file mode 100644
index 000000000..03653cfb2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.conf
@@ -0,0 +1 @@
+# Global alsa-lib configuration
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.state b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.state
new file mode 100644
index 000000000..ddd1cce85
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/alsa-state/alsa-state/asound.state
@@ -0,0 +1 @@
+# Dummy file, do not delete
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd.service b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd.service
new file mode 100644
index 000000000..ffab82334
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Advanced Power Management daemon
+After=remote-fs.target
+
+[Service]
+EnvironmentFile=-@SYSCONFDIR@/default/apmd
+ExecStart=@SBINDIR@/apmd -P @SYSCONFDIR@/apm/apmd_proxy $APMD
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy
new file mode 100644
index 000000000..c48ee4e5d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# apmd_proxy - program dispatcher for APM daemon
+#
+# Written by Craig Markwardt (craigm@lheamail.gsfc.nasa.gov) 21 May 1999
+# Modified for Debian by Avery Pennarun
+#
+# This shell script is called by the APM daemon (apmd) when a power
+# management event occurs. Its first and second arguments describe the
+# event. For example, apmd will call "apmd_proxy suspend system" just
+# before the system is suspended.
+#
+# Here are the possible arguments:
+#
+# start - APM daemon has started
+# stop - APM daemon is shutting down
+# suspend critical - APM system indicates critical suspend (++)
+# suspend system - APM system has requested suspend mode
+# suspend user - User has requested suspend mode
+# standby system - APM system has requested standby mode
+# standby user - User has requested standby mode
+# resume suspend - System has resumed from suspend mode
+# resume standby - System has resumed from standby mode
+# resume critical - System has resumed from critical suspend
+# change battery - APM system reported low battery
+# change power - APM system reported AC/battery change
+# change time - APM system reported time change (*)
+# change capability - APM system reported config. change (+)
+#
+# (*) - APM daemon may be configured to not call these sequences
+# (+) - Available if APM kernel supports it.
+# (++) - "suspend critical" is never passed to apmd from the kernel,
+# so we will never see it here. Scripts that process "resume
+# critical" events need to take this into account.
+#
+# It is the proxy script's responsibility to examine the APM status
+# (via /proc/apm) or other status and to take appropriate actions.
+# For example, the script might unmount network drives before the
+# machine is suspended.
+#
+# In Debian, the usual way of adding functionality to the proxy is to
+# add a script to /etc/apm/event.d. This script will be called by
+# apmd_proxy (via run-parts) with the same arguments.
+#
+# If it is important that a certain set of script be run in a certain
+# order on suspend and in a different order on resume, then put all
+# the scripts in /etc/apm/scripts.d instead of /etc/apm/event.d and
+# symlink to these from /etc/apm/suspend.d, /etc/apm/resume.d and
+# /etc/apm/other.d using names whose lexicographical order is the same
+# as the desired order of execution.
+#
+# If the kernel's APM driver supports it, apmd_proxy can return a non-zero
+# exit status on suspend and standby events, indicating that the suspend
+# or standby event should be rejected.
+#
+# *******************************************************************
+
+set -e
+
+# The following doesn't yet work, because current kernels (up to at least
+# 2.4.20) do not support rejection of APM events. Supporting this would
+# require substantial modifications to the APM driver. We will re-enable
+# this feature if the driver is ever modified. -- cph@debian.org
+#
+#SUSPEND_ON_AC=false
+#[ -r /etc/apm/apmd_proxy.conf ] && . /etc/apm/apmd_proxy.conf
+#
+#if [ "${SUSPEND_ON_AC}" = "false" -a "${2}" = "system" ] \
+# && on_ac_power >/dev/null; then
+# # Reject system suspends and standbys if we are on AC power
+# exit 1 # Reject (NOTE kernel support must be enabled)
+#fi
+
+if [ "${1}" = "suspend" -o "${1}" = "standby" ]; then
+ run-parts -a "${1}" -a "${2}" /etc/apm/event.d
+ if [ -d /etc/apm/suspend.d ]; then
+ run-parts -a "${1}" -a "${2}" /etc/apm/suspend.d
+ fi
+elif [ "${1}" = "resume" ]; then
+ if [ -d /etc/apm/resume.d ]; then
+ run-parts -a "${1}" -a "${2}" /etc/apm/resume.d
+ fi
+ run-parts -a "${1}" -a "${2}" /etc/apm/event.d
+else
+ run-parts -a "${1}" -a "${2}" /etc/apm/event.d
+ if [ -d /etc/apm/other.d ]; then
+ run-parts -a "${1}" -a "${2}" /etc/apm/other.d
+ fi
+fi
+
+exit 0
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy.conf b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy.conf
new file mode 100644
index 000000000..751145c52
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/apmd_proxy.conf
@@ -0,0 +1,16 @@
+# /etc/apm/apmd_proxy.conf: configuration file for apmd.
+#
+# This file is managed by debconf when installing or reconfiguring the
+# package. It is generated by merging the answers gathered by debconf
+# into the template file "/usr/share/apmd/apmd_proxy.conf".
+
+# The following doesn't yet work, because current kernels (up to at least
+# 2.4.20) do not support rejection of APM events. Supporting this would
+# require substantial modifications to the APM driver. We will re-enable
+# this feature if the driver is ever modified. -- cph@debian.org
+#
+# Set the following to "false" if you want to reject system suspend or
+# system standby requests when the computer is running on AC power.
+# Otherwise set this to "true". Such requests are never rejected when
+# the computer is running on battery power.
+#SUSPEND_ON_AC=true
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/default b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/default
new file mode 100644
index 000000000..4b7965abf
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/default
@@ -0,0 +1,8 @@
+#
+# Default for /etc/init.d/apmd
+#
+
+# As apmd can be called with arguments, we use the following variable
+# to store them, e.g., APMD="-w 5 -p 2".
+# See the manual page apmd(8) for details.
+APMD="--proxy-timeout 30"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/init b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/init
new file mode 100755
index 000000000..c0b41aa9d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/init
@@ -0,0 +1,51 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: apmd
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Advanced Power Management daemon
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+[ -f /etc/default/apmd ] && . /etc/default/apmd
+
+case "$1" in
+ start)
+ echo -n "Starting advanced power management daemon: "
+ start-stop-daemon -S -x /usr/sbin/apmd -- \
+ -P /etc/apm/apmd_proxy $APMD
+ if [ $? = 0 ]; then
+ echo "apmd."
+ else
+ echo "(failed.)"
+ fi
+ ;;
+ stop)
+ echo -n "Stopping advanced power management daemon: "
+ start-stop-daemon -K \
+ -x /usr/sbin/apmd
+ echo "apmd."
+ ;;
+ status)
+ status /usr/sbin/apmd;
+ exit $?
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit
+ ;;
+ *)
+ echo "Usage: /etc/init.d/apmd {start|stop|status|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/legacy.patch b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/legacy.patch
new file mode 100644
index 000000000..5db895e8f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/legacy.patch
@@ -0,0 +1,133 @@
+From 3595933d221f0ba836917debc0776b8723972ec9 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Tue, 11 Aug 2015 17:40:50 +0300
+Subject: [PATCH 1/3] Patch with fixes provided by Debian.
+
+This patch is taken from
+ftp://ftp.debian.org/debian/pool/main/a/apmd/apmd_3.2.2-15.debian.tar.xz
+
+Upstream-Status: Inappropriate [upstream is dead]
+Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
+
+---
+ Makefile | 2 +-
+ apm.c | 3 ++-
+ apm.h | 9 +++++++++
+ apmd.c | 15 ++++++++-------
+ 4 files changed, 20 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index bf346d9..92fc0fd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -43,7 +43,7 @@ DESTDIR=
+
+ CC=gcc
+ CFLAGS=-O -g
+-XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include \
++XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include -I/usr/X11R6/include \
+ -I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \
+ -DVERSION=\"$(VERSION)\" \
+ -DDEFAULT_PROXY_NAME=\"$(PROXY_DIR)/apmd_proxy\"
+diff --git a/apm.c b/apm.c
+index b21c057..0359b1c 100644
+--- a/apm.c
++++ b/apm.c
+@@ -219,12 +219,13 @@ int main(int argc, char **argv)
+ }
+ }
+
+-
++#if 0
+ if (!(i.apm_flags & APM_32_BIT_SUPPORT))
+ {
+ fprintf(stderr, "32-bit APM interface not supported\n");
+ exit(1);
+ }
++#endif
+
+ if (verbose && (i.apm_flags & 0x10))
+ printf("APM BIOS Power Management is currently disabled\n");
+diff --git a/apm.h b/apm.h
+index fb24dfd..824cc06 100644
+--- a/apm.h
++++ b/apm.h
+@@ -20,6 +20,13 @@
+ * $Id: apm.h,v 1.7 1999/07/05 22:31:11 apenwarr Exp $
+ *
+ */
++#ifndef _APM_H
++#define _APM_H 1
++
++#ifndef __KERNEL_STRICT_NAMES
++#define __KERNEL_STRICT_NAMES
++#endif
++
+ #include <linux/apm_bios.h>
+ #include <sys/types.h>
+
+@@ -93,3 +100,5 @@ extern int apm_reject(int fd);
+ #else
+ #define apm_reject(fd) (-EINVAL)
+ #endif
++
++#endif
+diff --git a/apmd.c b/apmd.c
+index 49ed3a1..560f536 100644
+--- a/apmd.c
++++ b/apmd.c
+@@ -343,7 +343,7 @@ static int call_proxy(apm_event_t event)
+ /* parent */
+ int status, retval;
+ ssize_t len;
+- time_t time_limit;
++ time_t countdown;
+
+ if (pid < 0) {
+ /* Couldn't fork */
+@@ -356,8 +356,9 @@ static int call_proxy(apm_event_t event)
+ /* Capture the child's output, if any, but only until it terminates */
+ close(fds[1]);
+ fcntl(fds[0], F_SETFL, O_RDONLY|O_NONBLOCK);
+- time_limit = time(0) + proxy_timeout;
++ countdown = proxy_timeout;
+ do {
++ countdown -= 1;
+ while ((len = read(fds[0], line, sizeof(line)-1)) > 0) {
+ line[len] = 0;
+ APMD_SYSLOG(LOG_INFO, "+ %s", line);
+@@ -372,16 +373,16 @@ static int call_proxy(apm_event_t event)
+ goto proxy_done;
+ }
+
+- sleep(1);
++ while (sleep(1) > 0) ;
+ } while (
+- (time(0) < time_limit)
++ (countdown >= 0)
+ || (proxy_timeout < 0)
+ );
+
+ APMD_SYSLOG(LOG_NOTICE, "Proxy has been running more than %d seconds; killing it", proxy_timeout);
+
+ kill(pid, SIGTERM);
+- time_limit = time(0) + 5;
++ countdown = 5;
+ do {
+ retval = waitpid(pid, &status, WNOHANG);
+ if (retval == pid)
+@@ -392,9 +393,9 @@ static int call_proxy(apm_event_t event)
+ goto proxy_done;
+ }
+
+- sleep(1);
++ while (sleep(1) > 0) ;
+
+- } while (time(0) < time_limit);
++ } while (countdown >= 0);
+
+ kill(pid, SIGKILL);
+ status = __W_EXITCODE(0, SIGKILL);
+--
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/libtool.patch b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/libtool.patch
new file mode 100644
index 000000000..834ee080a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/libtool.patch
@@ -0,0 +1,33 @@
+Add by RP to address "unable to infer tagged configuration" error:
+ commit 35de05e61b88c0808a5e885bb0efdf420555d5ad
+ Author: Richard Purdie <rpurdie@rpsys.net>
+ Date: Sun Jun 1 16:13:38 2008 +0000
+
+ apmd: Use libtool --tag options to avoid problems with libtool 2.2.4 (from poky)
+
+However I didn't see same issue with current libtool-2.2.10. Also per my understanding,
+the default tag, if not specified, falls back to CC. So disable it from patching, but
+keep it here. If we encounter similar issue in the future, we could then push upstream
+
+Comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-16
+
+Upstream-Status: Pending
+
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+
+Index: apmd-3.2.2.orig/Makefile
+===================================================================
+--- apmd-3.2.2.orig.orig/Makefile 2004-01-04 08:13:18.000000000 +0000
++++ apmd-3.2.2.orig/Makefile 2008-04-21 17:10:03.000000000 +0100
+@@ -58,9 +57,8 @@
+ #CFLAGS=-O3 -m486 -fomit-frame-pointer
+ #LDFLAGS=-s
+
+-LIBTOOL=libtool --quiet
+-LT_COMPILE = $(LIBTOOL) --mode=compile $(CC)
+-LT_LINK = $(LIBTOOL) --mode=link $(CC)
++LT_COMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC)
++LT_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC)
+ LT_INSTALL = $(LIBTOOL) --mode=install install
+ LT_CLEAN = $(LIBTOOL) --mode=clean rm
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/linkage.patch b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/linkage.patch
new file mode 100644
index 000000000..3d32c49cd
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/linkage.patch
@@ -0,0 +1,53 @@
+When building use the libtool intermediate .lo files instead of explicitly using
+the .o files. Under libtool foo.lo is the libtool intermediate wrapper, foo.o is
+a static build, and .libs/foo.o is a shared build.
+
+If static libraries have been disabled globally then libtool won't generate them
+and explicit references to foo.o won't be satisfied.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/Makefile b/Makefile
+index bb695c6..5f60146 100644
+--- a/Makefile
++++ b/Makefile
+@@ -28,7 +28,7 @@ endif
+
+ .SUFFIXES:
+
+-OBJS=apmlib.o
++OBJS=apmlib.lo
+ EXES=apm apmd xapm apmsleep
+ HEADERS=apm.h
+
+@@ -66,22 +66,22 @@ all: $(EXES)
+
+ $(OBJS): $(HEADERS)
+
+-%.o: %.c
++%.lo: %.c
+ $(LT_COMPILE) -c $(CPPFLAGS) $(CFLAGS) $(XTRACFLAGS) $<
+
+-%: %.o $(LIBAPM)
++%: %.lo $(LIBAPM)
+ $(LT_LINK) -o $@ $< $(LDFLAGS) $(LIBAPM)
+
+-xapm.o: xapm.c
++xapm.lo: xapm.c
+ $(LT_COMPILE) -c $(CPPFLAGS) $(CFLAGS) $(XTRACFLAGS) -DNARROWPROTO $<
+
+-apmd: apmd.o
++apmd: apmd.lo
+
+-apmsleep: apmsleep.o
++apmsleep: apmsleep.lo
+
+-apmexists: apmexists.o
++apmexists: apmexists.lo
+
+-xapm: xapm.o $(LIBAPM)
++xapm: xapm.lo $(LIBAPM)
+ $(LT_LINK) -o $@ $< $(LDFLAGS) $(LIBAPM) $(XLDFLAGS) $(XLIBS)
+
+ $(LIBAPM): apmlib.lo
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/unlinux.patch b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/unlinux.patch
new file mode 100644
index 000000000..ec8206cf1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/unlinux.patch
@@ -0,0 +1,25 @@
+copy OE commit message here:
+ commit 9456cdc1cf43e3ba9e6d88c63560c1b6fdee4359
+ Author: Michael Krelin <hacker@klever.net>
+ Date: Tue May 29 12:27:45 2007 +0000
+
+ apmd: prevent build from interferring with host kernel headers. Closes #1257
+
+comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-13
+
+Upstream-Status: Pending
+
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+
+--- apmd-3.2.2.orig/Makefile
++++ apmd-3.2.2/Makefile
+@@ -43,8 +43,7 @@
+
+ CC=gcc
+ CFLAGS=-O -g
+-XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include -I/usr/X11R6/include \
+- -I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \
++XTRACFLAGS=-Wall -pipe -I. \
+ -DVERSION=\"$(VERSION)\" \
+ -DDEFAULT_PROXY_NAME=\"$(PROXY_DIR)/apmd_proxy\"
+ LDFLAGS=
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/wexitcode.patch b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/wexitcode.patch
new file mode 100644
index 000000000..c5faa85fa
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd/wexitcode.patch
@@ -0,0 +1,26 @@
+Define non-posix W* funcitons
+
+C libraries like musl dont define them
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: apmd-3.2.2.orig/apmd.c
+===================================================================
+--- apmd-3.2.2.orig.orig/apmd.c
++++ apmd-3.2.2.orig/apmd.c
+@@ -55,6 +55,14 @@
+ #define MINIMUM_RATE_CALC_TIME 120
+ #endif
+
++#ifndef _POSIX_SOURCE
++
++#define __WCOREFLAG 0200
++#define __WCOREDUMP(x) (_W_INT(x) & __WCOREFLAG)
++#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
++
++#endif
++
+ /*
+ * For the verbosity level feature to be useful,
+ * we rely on the fact that syslog.h assigns adjacent
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb
new file mode 100644
index 000000000..4ff6ad087
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/apmd/apmd_3.2.2-15.bb
@@ -0,0 +1,84 @@
+SUMMARY = "Utilities for Advanced Power Management"
+DESCRIPTION = "The Advanced Power Management (APM) support provides \
+access to battery status information and a set of tools for managing \
+notebook power consumption."
+HOMEPAGE = "http://apenwarr.ca/apmd/"
+SECTION = "base"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+ file://apm.h;beginline=6;endline=18;md5=7d4acc1250910a89f84ce3cc6557c4c2"
+DEPENDS = "libtool-cross"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_3.2.2.orig.tar.gz;name=tarball \
+ file://legacy.patch \
+ file://libtool.patch \
+ file://unlinux.patch \
+ file://wexitcode.patch \
+ file://linkage.patch \
+ file://init \
+ file://default \
+ file://apmd_proxy \
+ file://apmd_proxy.conf \
+ file://apmd.service"
+
+SRC_URI[tarball.md5sum] = "b1e6309e8331e0f4e6efd311c2d97fa8"
+SRC_URI[tarball.sha256sum] = "7f7d9f60b7766b852881d40b8ff91d8e39fccb0d1d913102a5c75a2dbb52332d"
+
+# for this package we're mostly interested in tracking debian patches,
+# and not in the upstream version where all development has effectively stopped
+UPSTREAM_CHECK_REGEX = "(?P<pver>((\d+\.*)+)-((\d+\.*)+))\.(diff|debian\.tar)\.(gz|xz)"
+
+S = "${WORKDIR}/apmd-3.2.2.orig"
+
+inherit update-rc.d systemd
+
+INITSCRIPT_NAME = "apmd"
+INITSCRIPT_PARAMS = "defaults"
+
+SYSTEMD_SERVICE_${PN} = "apmd.service"
+SYSTEMD_AUTO_ENABLE = "disable"
+
+EXTRA_OEMAKE = "-e MAKEFLAGS="
+
+do_compile() {
+ # apmd doesn't use whole autotools. Just libtool for installation
+ oe_runmake "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool" apm apmd
+}
+
+do_install() {
+ install -d ${D}${sysconfdir}
+ install -d ${D}${sysconfdir}/apm
+ install -d ${D}${sysconfdir}/apm/event.d
+ install -d ${D}${sysconfdir}/apm/other.d
+ install -d ${D}${sysconfdir}/apm/suspend.d
+ install -d ${D}${sysconfdir}/apm/resume.d
+ install -d ${D}${sysconfdir}/apm/scripts.d
+ install -d ${D}${sysconfdir}/default
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sbindir}
+ install -d ${D}${bindir}
+ install -d ${D}${libdir}
+ install -d ${D}${datadir}/apmd
+ install -d ${D}${includedir}
+
+ install -m 4755 ${S}/.libs/apm ${D}${bindir}/apm
+ install -m 0755 ${S}/.libs/apmd ${D}${sbindir}/apmd
+ install -m 0755 ${WORKDIR}/apmd_proxy ${D}${sysconfdir}/apm/
+ install -m 0644 ${WORKDIR}/apmd_proxy.conf ${D}${datadir}/apmd/
+ install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/apmd
+ oe_libinstall -so libapm ${D}${libdir}
+ install -m 0644 apm.h ${D}${includedir}
+
+ sed -e 's,/usr/sbin,${sbindir},g; s,/etc,${sysconfdir},g;' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/apmd
+ chmod 755 ${D}${sysconfdir}/init.d/apmd
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/apmd.service ${D}${systemd_unitdir}/system/
+ sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+ -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apmd.service
+}
+
+PACKAGES =+ "libapm apm"
+
+FILES_libapm = "${libdir}/libapm${SOLIBS}"
+FILES_apm = "${bindir}/apm*"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb
new file mode 100644
index 000000000..c2a02aadb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/eee-acpi-scripts_git.bb
@@ -0,0 +1,39 @@
+SUMMARY = "eeePC specific ACPI scripts"
+HOMEPAGE = "http://alioth.debian.org/projects/debian-eeepc/"
+SECTION = "base"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=77ef83ab5f4af938a93edb61f7b74f2c"
+
+SRCREV = "9d4cdedca25b396405f8587f9c4fbf8229e041c2"
+PV = "1.1.12+git${SRCPV}"
+
+SRC_URI = "git://git.debian.org/git/debian-eeepc/eeepc-acpi-scripts.git \
+ file://remove-doc-check.patch \
+ file://powerbtn.patch \
+ file://policy-funcs "
+
+S = "${WORKDIR}/git"
+
+FILES_${PN} = "${datadir}/acpi-support/ \
+ ${datadir}/eeepc-acpi-scripts \
+ ${sysconfdir}/default/ \
+ ${sysconfdir}/acpi/"
+
+do_install () {
+ install -d ${D}${sysconfdir}/default/
+ install -d ${D}${sysconfdir}/acpi/actions/
+ install -d ${D}${sysconfdir}/acpi/events/
+ install -d ${D}${sysconfdir}/acpi/lib/udev/rules.d
+ install -d ${D}${datadir}/eeepc-acpi-scripts/
+ install -d ${D}${datadir}/acpi-support/
+ install -m 644 ${S}/events/* ${D}${sysconfdir}/acpi/events/
+ install -m 644 ${S}/lib/udev/rules.d/* ${D}${sysconfdir}/acpi/lib/udev/rules.d/
+ install ${S}/actions/* ${D}${sysconfdir}/acpi/actions/
+ install -m 0644 ${S}/acpilib/functions.sh ${D}${datadir}/eeepc-acpi-scripts/
+ install -m 0644 ${WORKDIR}/policy-funcs ${D}${datadir}/acpi-support/
+ install -m 0644 ${S}/debian/eeepc-acpi-scripts.default* ${D}${sysconfdir}/default/
+}
+
+RDEPENDS_${PN} = "pm-utils"
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs
new file mode 100644
index 000000000..fd099df0d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/policy-funcs
@@ -0,0 +1,8 @@
+CheckPolicy() {
+ if pidof gnome-power-manager kpowersave > /dev/null ||
+ (pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop kded kded loadedModules | grep -q klaptopdaemon) ; then
+ echo 0;
+ else
+ echo 1;
+ fi
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch
new file mode 100644
index 000000000..403e5569b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/powerbtn.patch
@@ -0,0 +1,22 @@
+---
+ actions/power.sh | 3 +++
+ events/powerbtn | 2 ++
+ 2 files changed, 5 insertions(+)
+
+Upstream-Status: Inappropriate [enable feature]
+
+Index: git/events/powerbtn
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/events/powerbtn 2008-10-08 17:43:35.000000000 +0200
+@@ -0,0 +1,2 @@
++event=button/power PWRF
++action=/etc/acpi/actions/power.sh
+Index: git/actions/power.sh
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ git/actions/power.sh 2008-10-08 17:45:26.000000000 +0200
+@@ -0,0 +1,3 @@
++#!/bin/sh
++
++/sbin/shutdown -h now "Power button pressed"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch
new file mode 100644
index 000000000..efb3dca7a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/eee-acpi-scripts/files/remove-doc-check.patch
@@ -0,0 +1,60 @@
+---
+ actions/hotkey.sh | 3 ---
+ actions/suspend.sh | 3 ---
+ actions/vga-toggle.sh | 3 ---
+ actions/volume.sh | 3 ---
+ 4 files changed, 12 deletions(-)
+
+Upstream-Status: Inappropriate [configuration]
+
+Index: git/eeepc-acpi-scripts/volume.sh
+===================================================================
+--- git.orig/eeepc-acpi-scripts/volume.sh 2011-11-29 19:21:55.000000000 +0800
++++ git/eeepc-acpi-scripts/volume.sh 2011-11-29 19:41:36.000000000 +0800
+@@ -3,12 +3,10 @@
+ [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
+ # Volume controls
+
+-# do nothing if package is removed
+ PKG=eeepc-acpi-scripts
+ PKG_DIR=/usr/share/acpi-support/$PKG
+ FUNC_LIB=$PKG_DIR/lib/functions.sh
+ DEFAULT=/etc/default/$PKG
+-[ -e "$FUNC_LIB" ] || exit 0
+
+ . $FUNC_LIB
+ . $PKG_DIR/lib/sound.sh
+Index: git/eeepc-acpi-scripts/hotkey.sh
+===================================================================
+--- git.orig/eeepc-acpi-scripts/hotkey.sh 2011-11-29 19:21:55.000000000 +0800
++++ git/eeepc-acpi-scripts/hotkey.sh 2011-11-29 19:39:51.000000000 +0800
+@@ -1,12 +1,10 @@
+ #!/bin/sh
+
+ [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
+-# do nothing if package is removed
+ PKG=eeepc-acpi-scripts
+ PKG_DIR=/usr/share/acpi-support/$PKG
+ FUNC_LIB=$PKG_DIR/lib/functions.sh
+ DEFAULT=/etc/default/$PKG
+-[ -e "$FUNC_LIB" ] || exit 0
+
+ case $(runlevel) in
+ *0|*6)
+Index: git/eeepc-acpi-scripts/vga-toggle.sh
+===================================================================
+--- git.orig/eeepc-acpi-scripts/vga-toggle.sh 2011-11-29 19:21:55.000000000 +0800
++++ git/eeepc-acpi-scripts/vga-toggle.sh 2011-11-29 19:40:24.000000000 +0800
+@@ -1,12 +1,10 @@
+ #!/bin/sh
+
+ [ -d /sys/devices/platform/eeepc ] || [ -d /sys/devices/platform/eeepc-wmi ] || exit 0
+-# do nothing if package is removed
+ PKG=eeepc-acpi-scripts
+ PKG_DIR=/usr/share/acpi-support/$PKG
+ FUNC_LIB=$PKG_DIR/lib/functions.sh
+ DEFAULT=/etc/default/$PKG
+-[ -e "$FUNC_LIB" ] || exit 0
+
+ if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
+ . $FUNC_LIB
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/config b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/config
new file mode 100755
index 000000000..ecfdf26e2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/config
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+if [ -e /etc/formfactor/machconfig ]; then
+ . /etc/formfactor/machconfig
+fi
+
+if [ -z "$HAVE_TOUCHSCREEN" ]; then
+ HAVE_TOUCHSCREEN=0
+fi
+
+if [ -z "$HAVE_KEYBOARD" ]; then
+ HAVE_KEYBOARD=1
+fi
+
+if [ -z "$HAVE_KEYBOARD_PORTRAIT" ]; then
+ HAVE_KEYBOARD_PORTRAIT=0
+fi
+
+if [ -z "$HAVE_KEYBOARD_LANDSCAPE" ]; then
+ HAVE_KEYBOARD_LANDSCAPE=0
+fi
+
+if [ -z "$DISPLAY_CAN_ROTATE" ]; then
+ DISPLAY_CAN_ROTATE=0
+fi
+
+if [ -z "$DISPLAY_ORIENTATION" ]; then
+ DISPLAY_ORIENTATION=0
+fi
+
+if [ -e "/dev/fb" ]; then
+ if [ -z "$DISPLAY_WIDTH_PIXELS" ]; then
+ DISPLAY_WIDTH_PIXELS=`/usr/sbin/fbset | grep geometry | awk '{ print $2 }'`
+ fi
+
+ if [ -z "$DISPLAY_HEIGHT_PIXELS" ]; then
+ DISPLAY_HEIGHT_PIXELS=`/usr/sbin/fbset | grep geometry | awk '{ print $3 }'`
+ fi
+
+ if [ -z "$DISPLAY_BPP" ]; then
+ DISPLAY_BPP=`/usr/sbin/fbset | grep geometry | awk '{ print $6 }'`
+ fi
+fi
+
+#
+# No way to guess these or have any defaults
+#
+#DISPLAY_WIDTH_MM
+#DISPLAY_HEIGHT_MM
+#DISPLAY_SUBPIXEL_ORDER=
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/machconfig
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/machconfig
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarm/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarm/machconfig
new file mode 100755
index 000000000..56a2ae2e3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarm/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+#DISPLAY_WIDTH_PIXELS=640
+#DISPLAY_HEIGHT_PIXELS=480
+#DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig
new file mode 100755
index 000000000..56a2ae2e3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv6/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+#DISPLAY_WIDTH_PIXELS=640
+#DISPLAY_HEIGHT_PIXELS=480
+#DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig
new file mode 100755
index 000000000..56a2ae2e3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuarmv7/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+#DISPLAY_WIDTH_PIXELS=640
+#DISPLAY_HEIGHT_PIXELS=480
+#DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips/machconfig
new file mode 100755
index 000000000..56777b6e2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+DISPLAY_WIDTH_PIXELS=640
+DISPLAY_HEIGHT_PIXELS=480
+DISPLAY_BPP=16
+DISPLAY_DPI=150
+#DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips64/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips64/machconfig
new file mode 100755
index 000000000..56777b6e2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemumips64/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+DISPLAY_WIDTH_PIXELS=640
+DISPLAY_HEIGHT_PIXELS=480
+DISPLAY_BPP=16
+DISPLAY_DPI=150
+#DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuppc/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuppc/machconfig
new file mode 100755
index 000000000..5ea2270cd
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemuppc/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+DISPLAY_WIDTH_PIXELS=800
+DISPLAY_HEIGHT_PIXELS=600
+DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig
new file mode 100755
index 000000000..56a2ae2e3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86-64/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+#DISPLAY_WIDTH_PIXELS=640
+#DISPLAY_HEIGHT_PIXELS=480
+#DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86/machconfig b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86/machconfig
new file mode 100755
index 000000000..56a2ae2e3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/files/qemux86/machconfig
@@ -0,0 +1,10 @@
+HAVE_TOUCHSCREEN=1
+HAVE_KEYBOARD=1
+
+DISPLAY_CAN_ROTATE=0
+DISPLAY_ORIENTATION=0
+#DISPLAY_WIDTH_PIXELS=640
+#DISPLAY_HEIGHT_PIXELS=480
+#DISPLAY_BPP=16
+DISPLAY_DPI=150
+DISPLAY_SUBPIXEL_ORDER=vrgb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/formfactor/formfactor_0.0.bb b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/formfactor_0.0.bb
new file mode 100644
index 000000000..5c30bd510
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/formfactor/formfactor_0.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Device formfactor information"
+SECTION = "base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
+ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+PR = "r45"
+
+SRC_URI = "file://config file://machconfig"
+S = "${WORKDIR}"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_install() {
+ # Install file only if it has contents
+ install -d ${D}${sysconfdir}/formfactor/
+ install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/
+ if [ -s "${S}/machconfig" ]; then
+ install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/
+ fi
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gcc46-compatibility.patch b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gcc46-compatibility.patch
new file mode 100644
index 000000000..0ce6d7b0c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gcc46-compatibility.patch
@@ -0,0 +1,21 @@
+don't break with old compilers and -DGNU_EFI_USE_MS_ABI
+It's entirely legitimate to request GNU_EFI_USE_MS_ABI even if the current
+compiler doesn't support it, and gnu-efi should transparently fall back to
+using legacy techniques to set the calling convention. We don't get type
+checking, but at least it will still compile.
+
+Author: Steve Langasek <steve.langasek@ubuntu.com>
+Upstream-Status: Pending
+Index: gnu-efi-3.0.3/inc/x86_64/efibind.h
+===================================================================
+--- gnu-efi-3.0.3.orig/inc/x86_64/efibind.h
++++ gnu-efi-3.0.3/inc/x86_64/efibind.h
+@@ -25,8 +25,6 @@ Revision History
+ #if defined(GNU_EFI_USE_MS_ABI)
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+ #define HAVE_USE_MS_ABI 1
+- #else
+- #error Compiler is too old for GNU_EFI_USE_MS_ABI
+ #endif
+ #endif
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gnu-efi-Make-setjmp.S-portable-to-ARM.patch b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gnu-efi-Make-setjmp.S-portable-to-ARM.patch
new file mode 100644
index 000000000..ced128a31
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/gnu-efi-Make-setjmp.S-portable-to-ARM.patch
@@ -0,0 +1,50 @@
+From 8a356d4b6a242ce63b73920d3ed33f88f9e12fe3 Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <wenzong.fan@windriver.com>
+Date: Sun, 6 Sep 2015 05:20:43 -0400
+Subject: [PATCH] gnu-efi: Make setjmp.S portable to ARM
+
+This patch fixes the following error:
+
+ .../lib/arm/setjmp.S:18: Error: unrecognized symbol type ""
+ .../lib/arm/setjmp.S:26: Error: unrecognized symbol type ""
+
+The problem is the assembly syntax that is used is not portable to ARM,
+where the '@' symbol is a comment:
+
+ > Note on targets where the @ character is the start of a comment
+ > (eg ARM) then another character is used instead. For example the
+ > ARM port uses the % character.
+
+(From https://sourceware.org/binutils/docs-2.25/as/Section.html#Section)
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
+---
+ lib/arm/setjmp.S | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/arm/setjmp.S b/lib/arm/setjmp.S
+index 6e3fbf0..85c8705 100644
+--- a/lib/arm/setjmp.S
++++ b/lib/arm/setjmp.S
+@@ -15,7 +15,7 @@ BASIS,
+ .text
+ .arm
+ .globl setjmp
+- .type setjmp, @function
++ .type setjmp, %function
+ setjmp:
+ mov r3, r13
+ stmia r0, {r3-r12,r14}
+@@ -23,6 +23,6 @@ setjmp:
+ bx lr
+
+ .globl longjmp
+- .type longjmp, @function
++ .type longjmp, %function
+ longjmp:
+ ldmia r0, {r3-r12,r14}
+--
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/lib-Makefile-fix-parallel-issue.patch b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/lib-Makefile-fix-parallel-issue.patch
new file mode 100644
index 000000000..1b2ae1ef0
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/lib-Makefile-fix-parallel-issue.patch
@@ -0,0 +1,38 @@
+From 0daa354a16aa3cade56ed423d0f8a04cf1c22f9d Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Thu, 23 Apr 2015 01:49:31 -0700
+Subject: [PATCH] lib/Makefile: fix parallel issue
+
+Fixed:
+Assembler messages:
+Fatal error: can't create runtime/rtlock.o: No such file or directory
+Assembler messages:
+Fatal error: can't create runtime/rtdata.o: No such file or directory
+Assembler messages:
+Fatal error: can't create runtime/vm.o: No such file or directory
+Assembler messages:
+Fatal error: can't create runtime/efirtlib.o: No such file or directory
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ lib/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/Makefile b/lib/Makefile
+index dc4b94a..f64d1ed 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -73,6 +73,8 @@ all: libsubdirs libefi.a
+ libsubdirs:
+ for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
+
++$(OBJS): libsubdirs
++
+ libefi.a: $(OBJS)
+ $(AR) rv $@ $(OBJS)
+
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
new file mode 100644
index 000000000..e5b47c197
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
@@ -0,0 +1,48 @@
+Fix parallel make failure for archives
+
+Upstream-Status: Pending
+
+The lib and gnuefi makefiles were using the lib.a() form which compiles
+and ar's as a pair instead of compiling all and then ar'ing which can
+parallelize better. This was resulting in build failures on larger values
+of -j.
+
+See http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
+for details.
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+---
+---
+ gnuefi/Makefile | 3 ++-
+ lib/Makefile | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+Index: gnu-efi-3.0/lib/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/lib/Makefile
++++ gnu-efi-3.0/lib/Makefile
+@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
+ libsubdirs:
+ for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
+
+-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
++libefi.a: $(OBJS)
++ $(AR) rv $@ $(OBJS)
+
+ clean:
+ rm -f libefi.a *~ $(OBJS) */*.o
+Index: gnu-efi-3.0/gnuefi/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/gnuefi/Makefile
++++ gnu-efi-3.0/gnuefi/Makefile
+@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
+
+ all: $(TARGETS)
+
+-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
++libgnuefi.a: $(OBJS)
++ $(AR) rv $@ $(OBJS)
+
+ clean:
+ rm -f $(TARGETS) *~ *.o $(OBJS)
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.3.bb b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.3.bb
new file mode 100644
index 000000000..eca34599c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gnu-efi/gnu-efi_3.0.3.bb
@@ -0,0 +1,46 @@
+SUMMARY = "Libraries for producing EFI binaries"
+HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
+SECTION = "devel"
+LICENSE = "GPLv2+ | BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://gnuefi/crt0-efi-arm.S;beginline=4;endline=9;md5=2240d7bbdf0928294c2f4a68b14d6591 \
+ file://gnuefi/crt0-efi-aarch64.S;beginline=4;endline=16;md5=e582764a4776e60c95bf9ab617343d36 \
+ file://inc/efishellintf.h;beginline=13;endline=20;md5=202766b79d708eff3cc70fce15fb80c7 \
+ file://inc/efishellparm.h;beginline=4;endline=11;md5=468b1231b05bbc84bae3a0d5774e3bb5 \
+ file://lib/arm/div64.S;beginline=6;endline=12;md5=a96c84f5ad12b4f011f98b5d039242f2 \
+ file://lib/arm/math.c;beginline=4;endline=10;md5=64dd1987cee1dcf59d11aa572cfa644e \
+ file://lib/arm/initplat.c;beginline=4;endline=10;md5=64dd1987cee1dcf59d11aa572cfa644e \
+ file://lib/arm/lib1funcs.S;beginline=9;endline=33;md5=f56d5ebbc87136bc66cfe24db82bcf01 \
+ file://lib/aarch64/math.c;beginline=9;endline=33;md5=cfade4c560e033a7bb02dab282872c7d \
+ file://lib/aarch64/initplat.c;beginline=9;endline=33;md5=900cb1ffbe3e1ded344102be921830f1 \
+ "
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2 \
+ file://parallel-make-archives.patch \
+ file://lib-Makefile-fix-parallel-issue.patch \
+ file://gnu-efi-Make-setjmp.S-portable-to-ARM.patch \
+ file://gcc46-compatibility.patch \
+ "
+
+SRC_URI[md5sum] = "15a4bcbc18a9a5e8110ed955970622e6"
+SRC_URI[sha256sum] = "c530f21a15fd9c214dd92d29a6caa20fac989289267512020b6da1f5e6f5b4cb"
+
+COMPATIBLE_HOST = "(x86_64.*|i.86.*|aarch64.*|arm.*)-linux"
+
+def gnu_efi_arch(d):
+ import re
+ tarch = d.getVar("TARGET_ARCH", True)
+ if re.match("i[3456789]86", tarch):
+ return "ia32"
+ return tarch
+
+EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
+ 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}' 'LIBDIR=${libdir}' \
+ "
+
+do_install() {
+ oe_runmake install INSTALLROOT="${D}"
+}
+
+FILES_${PN} += "${libdir}/*.lds"
+
+BBCLASSEXTEND = "native"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch
new file mode 100644
index 000000000..65ddcaf12
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch
@@ -0,0 +1,53 @@
+Upstream-Status: Accepted
+CVE: CVE-2015-8370
+Signed-off-by: Awais Belal <awais_belal@mentor.com>
+
+From 451d80e52d851432e109771bb8febafca7a5f1f2 Mon Sep 17 00:00:00 2001
+From: Hector Marco-Gisbert <hecmargi@upv.es>
+Date: Wed, 16 Dec 2015 04:57:18 +0000
+Subject: Fix security issue when reading username and password
+
+This patch fixes two integer underflows at:
+ * grub-core/lib/crypto.c
+ * grub-core/normal/auth.c
+
+CVE-2015-8370
+
+Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
+Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
+Also-By: Andrey Borzenkov <arvidjaar@gmail.com>
+---
+diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
+index 010e550..683a8aa 100644
+--- a/grub-core/lib/crypto.c
++++ b/grub-core/lib/crypto.c
+@@ -470,7 +470,8 @@ grub_password_get (char buf[], unsigned buf_size)
+
+ if (key == '\b')
+ {
+- cur_len--;
++ if (cur_len)
++ cur_len--;
+ continue;
+ }
+
+diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
+index c6bd96e..8615c48 100644
+--- a/grub-core/normal/auth.c
++++ b/grub-core/normal/auth.c
+@@ -174,8 +174,11 @@ grub_username_get (char buf[], unsigned buf_size)
+
+ if (key == '\b')
+ {
+- cur_len--;
+- grub_printf ("\b");
++ if (cur_len)
++ {
++ cur_len--;
++ grub_printf ("\b");
++ }
+ continue;
+ }
+
+--
+cgit v0.9.0.2
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
new file mode 100644
index 000000000..9eabce977
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch
@@ -0,0 +1,81 @@
+From 3bac4caa2bc64db313aaee54fffb90383e118517 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Thu, 22 Jan 2015 19:54:36 +0100
+Subject: [PATCH] Remove direct _llseek code and require long filesystem libc.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Backport
+ configure.ac | 8 ++++++++
+ grub-core/osdep/unix/hostdisk.c | 24 ------------------------
+ 4 files changed, 13 insertions(+), 24 deletions(-)
+
+Index: grub-2.00/configure.ac
+===================================================================
+--- grub-2.00.orig/configure.ac
++++ grub-2.00/configure.ac
+@@ -306,6 +306,14 @@ if test x$grub_cv_apple_cc = xyes ; then
+ HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
+ fi
+
++case "$host_os" in
++ cygwin | windows* | mingw32* | aros*)
++ ;;
++ *)
++ AC_CHECK_SIZEOF(off_t)
++ test x"$ac_cv_sizeof_off_t" = x8 || AC_MSG_ERROR([Large file support is required]);;
++esac
++
+ if test x$USE_NLS = xno; then
+ HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
+ fi
+Index: grub-2.00/grub-core/kern/emu/hostdisk.c
+===================================================================
+--- grub-2.00.orig/grub-core/kern/emu/hostdisk.c
++++ grub-2.00/grub-core/kern/emu/hostdisk.c
+@@ -44,11 +44,6 @@
+ #ifdef __linux__
+ # include <sys/ioctl.h> /* ioctl */
+ # include <sys/mount.h>
+-# if !defined(__GLIBC__) || \
+- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+-/* Maybe libc doesn't have large file support. */
+-# include <linux/unistd.h> /* _llseek */
+-# endif /* (GLIBC < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR < 1)) */
+ # ifndef BLKFLSBUF
+ # define BLKFLSBUF _IO (0x12,97) /* flush buffer cache */
+ # endif /* ! BLKFLSBUF */
+@@ -761,25 +756,6 @@ linux_find_partition (char *dev, grub_di
+ }
+ #endif /* __linux__ */
+
+-#if defined(__linux__) && (!defined(__GLIBC__) || \
+- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
+- /* Maybe libc doesn't have large file support. */
+-grub_err_t
+-grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+-{
+- loff_t offset, result;
+- static int _llseek (uint filedes, ulong hi, ulong lo,
+- loff_t *res, uint wh);
+- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
+- loff_t *, res, uint, wh);
+-
+- offset = (loff_t) off;
+- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
+- return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
+- name, strerror (errno));
+- return GRUB_ERR_NONE;
+-}
+-#else
+ grub_err_t
+ grub_util_fd_seek (int fd, const char *name, grub_uint64_t off)
+ {
+@@ -790,7 +766,6 @@ grub_util_fd_seek (int fd, const char *n
+ name, strerror (errno));
+ return 0;
+ }
+-#endif
+
+ static void
+ flush_initial_buffer (const char *os_dev __attribute__ ((unused)))
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch
new file mode 100644
index 000000000..67dc11549
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-Unset-need_charset_alias-when-building-for-musl.patch
@@ -0,0 +1,30 @@
+From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Apr 2015 17:02:13 -0700
+Subject: [PATCH] Unset need_charset_alias when building for musl
+
+localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4
+which actually shoudl be fixed in gnulib and then all downstream
+projects will get it eventually. For now we apply the fix to
+coreutils
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/gnulib.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: grub-2.00/grub-core/gnulib/Makefile.am
+===================================================================
+--- grub-2.00.orig/grub-core/gnulib/Makefile.am
++++ grub-2.00/grub-core/gnulib/Makefile.am
+@@ -410,7 +410,7 @@ install-exec-localcharset: all-local
+ case '$(host_os)' in \
+ darwin[56]*) \
+ need_charset_alias=true ;; \
+- darwin* | cygwin* | mingw* | pw32* | cegcc*) \
++ darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \
+ need_charset_alias=false ;; \
+ *) \
+ need_charset_alias=true ;; \
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch
new file mode 100644
index 000000000..255e3eb7d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch
@@ -0,0 +1,33 @@
+Upstream-Status: Backport
+
+Original commit: http://git.savannah.gnu.org/cgit/grub.git/commit/grub-core/net/bootp.c?id=f06c2172c0b32052f22e37523445cf8e7affaea3
+
+From 149d2a14f4723778ced23f439487201ccbf1a2c9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 23 Apr 2015 07:03:34 +0000
+Subject: [PATCH] parse_dhcp_vendor: Add missing const qualifiers.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ grub-core/net/bootp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
+index bc07d53..44131ed 100644
+--- a/grub-core/net/bootp.c
++++ b/grub-core/net/bootp.c
+@@ -52,9 +52,9 @@ set_env_limn_ro (const char *intername, const char *suffix,
+ }
+
+ static void
+-parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
++parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
+ {
+- grub_uint8_t *ptr, *ptr0;
++ const grub_uint8_t *ptr, *ptr0;
+
+ ptr = ptr0 = vend;
+
+--
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg
new file mode 100644
index 000000000..8ca53d24d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/cfg
@@ -0,0 +1,2 @@
+search.file ($cmdpath)/EFI/BOOT/grub.cfg root
+set prefix=($root)/EFI/BOOT
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
new file mode 100644
index 000000000..0eece082f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/check-if-liblzma-is-disabled.patch
@@ -0,0 +1,33 @@
+Disable liblzma if --enable-liblzma=no
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -1029,10 +1029,20 @@ fi
+
+ AC_SUBST([LIBGEOM])
+
+-AC_CHECK_LIB([lzma], [lzma_code],
+- [LIBLZMA="-llzma"
+- AC_DEFINE([HAVE_LIBLZMA], [1],
+- [Define to 1 if you have the LZMA library.])],)
++AC_ARG_ENABLE([liblzma],
++ [AS_HELP_STRING([--enable-liblzma],
++ [enable liblzma integration (default=guessed)])])
++if test x"$enable_liblzma" = xno ; then
++ liblzma_excuse="explicitly disabled"
++fi
++
++if test x"$liblzma_excuse" = x ; then
++ AC_CHECK_LIB([lzma], [lzma_code],
++ [LIBLZMA="-llzma"
++ AC_DEFINE([HAVE_LIBLZMA], [1],
++ [Define to 1 if you have the LZMA library.])],)
++fi
++
+ AC_SUBST([LIBLZMA])
+
+ AC_ARG_ENABLE([libzfs],
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch
new file mode 100644
index 000000000..079992afb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-endianness-problem.patch
@@ -0,0 +1,44 @@
+grub-core/net/tftp.c: fix endianness problem.
+
+ * grub-core/net/tftp.c (ack): Fix endianness problem.
+ (tftp_receive): Likewise.
+ Reported by: Michael Davidsaver.
+
+Upstream-Status: Backport
+
+diff --git a/ChangeLog b/ChangeLog
+index 81bdae9..c2f42d5 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
++
++ * grub-core/net/tftp.c (ack): Fix endianness problem.
++ (tftp_receive): Likewise.
++ Reported by: Michael Davidsaver.
++
+ 2012-06-27 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * configure.ac: Bump version to 2.00.
+diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
+index 9c70efb..d0f39ea 100644
+--- a/grub-core/net/tftp.c
++++ b/grub-core/net/tftp.c
+@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block)
+
+ tftph_ack = (struct tftphdr *) nb_ack.data;
+ tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
+- tftph_ack->u.ack.block = block;
++ tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
+
+ err = grub_net_send_udp_packet (data->sock, &nb_ack);
+ if (err)
+@@ -225,7 +225,7 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
+ grub_priority_queue_pop (data->pq);
+
+ if (file->device->net->packs.count < 50)
+- err = ack (data, tftph->u.data.block);
++ err = ack (data, data->block + 1);
+ else
+ {
+ file->device->net->stall = 1;
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
new file mode 100644
index 000000000..61ae2f537
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-issue-with-flex-2.5.37.patch
@@ -0,0 +1,21 @@
+Upstream-Status: Backport
+
+This fixes compilation issues when using flex-2.5.37. It was taken from upstream.
+
+Original author is: Vladimir Serbinenko <phcoder@gmail.com>
+
+Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
+
+Index: grub-2.00/grub-core/script/yylex.l
+===================================================================
+--- grub-2.00.orig/grub-core/script/yylex.l 2012-06-08 23:24:15.000000000 +0300
++++ grub-2.00/grub-core/script/yylex.l 2013-07-31 14:34:40.708100982 +0300
+@@ -29,6 +29,8 @@
+ #pragma GCC diagnostic ignored "-Wmissing-prototypes"
+ #pragma GCC diagnostic ignored "-Wmissing-declarations"
+ #pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
++#pragma GCC diagnostic ignored "-Wunused-function"
++#pragma GCC diagnostic ignored "-Wsign-compare"
+
+ #define yyfree grub_lexer_yyfree
+ #define yyalloc grub_lexer_yyalloc
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch
new file mode 100644
index 000000000..b911d7370
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/fix-texinfo.patch
@@ -0,0 +1,32 @@
+The tarball has a texi file that doesn't parse with current texinfo, so if it's
+being re-generated the build will fail. Take a patch from upstream to fix the
+texi.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From d4c4b8e1a085f92afcec36f6e590c6dfc51d0a1c Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Mon, 08 Apr 2013 13:23:07 +0000
+Subject: * docs/grub-dev.texi: Move @itemize after @subsection to satisfy
+
+ texinfo-5.1.
+---
+(limited to 'docs/grub-dev.texi')
+
+diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
+index a4a3820..f74c966 100644
+--- a/docs/grub-dev.texi
++++ b/docs/grub-dev.texi
+@@ -1394,8 +1394,8 @@ grub_video_blit_glyph (&glyph, color, 0, 0);
+
+ @node Bitmap API
+ @section Bitmap API
+-@itemize
+ @subsection grub_video_bitmap_create
++@itemize
+ @item Prototype:
+ @example
+ grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format)
+--
+cgit v0.9.0.2
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
new file mode 100644
index 000000000..eb8916cb7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-add-oe-kernel.patch
@@ -0,0 +1,53 @@
+From 7ab576a7c61406b7e63739d1b11017ae336b9008 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Mon, 3 Mar 2014 03:34:48 -0500
+Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
+
+Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
+that the grub-mkconfig and grub-install can work correctly.
+
+We only need add the bzImage to util/grub.d/10_linux.in, but also add it
+to util/grub.d/20_linux_xen.in to keep compatibility.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ util/grub.d/10_linux.in | 4 ++--
+ util/grub.d/20_linux_xen.in | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 14402e8..c58f417 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -153,11 +153,11 @@ EOF
+ machine=`uname -m`
+ case "x$machine" in
+ xi?86 | xx86_64)
+- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
++ list=`for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ *)
+- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
++ list=`for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ esac
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index 1d94502..b2decf3 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -138,7 +138,7 @@ EOF
+ EOF
+ }
+
+-linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
++linux_list=`for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+ if grub_file_is_not_garbage "$i"; then
+ basename=$(basename $i)
+ version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+--
+1.7.10.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
new file mode 100644
index 000000000..09ef4dbff
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fix-enable_execute_stack-check.patch
@@ -0,0 +1,27 @@
+Upstream-Status: Pending
+
+
+This patch avoids this configure failure
+
+configure: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()'
+configure: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
+conftest.c:308:6: error: no previous prototype for 'g' [-Werror=missing-prototypes]
+cc1: all warnings being treated as errors
+configure:20323: $? = 1
+configure: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
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/04/13
+
+Index: grub-2.00/acinclude.m4
+===================================================================
+--- grub-2.00.orig/acinclude.m4
++++ grub-2.00/acinclude.m4
+@@ -317,6 +317,7 @@ dnl Check if the C compiler generates ca
+ AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
+ AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
+ AC_LANG_CONFTEST([AC_LANG_SOURCE([[
++void g (int);
+ void f (int (*p) (void));
+ void g (int i)
+ {
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
new file mode 100644
index 000000000..c557f13e2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-2.00-fpmath-sse-387-fix.patch
@@ -0,0 +1,24 @@
+Upstream-Status: pending
+
+This patch fixes this configure issue for grub when -mfpmath=sse is in the gcc parameters.
+
+configure: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
+conftest.c:1:0: error: SSE instruction set disabled, using 387 arithmetics [-Werror]
+cc1: all warnings being treated as errors
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/04/13
+
+Index: grub-1.99/configure.ac
+===================================================================
+--- grub-1.99.orig/configure.ac
++++ grub-1.99/configure.ac
+@@ -378,7 +378,7 @@ if test "x$target_cpu" = xi386; then
+
+ # Some toolchains enable these features by default, but they need
+ # registers that aren't set up properly in GRUB.
+- TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
++ TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -mfpmath=387"
+ fi
+
+ # By default, GCC 4.4 generates .eh_frame sections containing unwind
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
new file mode 100644
index 000000000..4588fca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-mcmodel-large.patch
@@ -0,0 +1,131 @@
+Allow a compilation without -mcmodel=large
+
+It's provided by Vladimir Serbinenko, and he will commit
+it upstream so it should be backport patch.
+
+Upstream-Status: Backport
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+
+--
+diff --git a/configure.ac b/configure.ac
+index 9f8fb8a..2c5e6ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -723,9 +723,7 @@ if test "$target_cpu" = x86_64; then
+ [grub_cv_cc_mcmodel=yes],
+ [grub_cv_cc_mcmodel=no])
+ ])
+- if test "x$grub_cv_cc_mcmodel" = xno; then
+- AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
+- else
++ if test "x$grub_cv_cc_mcmodel" = xyes; then
+ TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
+ fi
+ fi
+diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
+index 1409b5d..6e9dace 100644
+--- a/grub-core/kern/efi/mm.c
++++ b/grub-core/kern/efi/mm.c
+@@ -32,6 +32,12 @@
+ #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
+ #define PAGES_TO_BYTES(pages) ((pages) << 12)
+
++#if defined (__code_model_large__) || !defined (__x86_64__)
++#define MAX_USABLE_ADDRESS 0xffffffff
++#else
++#define MAX_USABLE_ADDRESS 0x7fffffff
++#endif
++
+ /* The size of a memory map obtained from the firmware. This must be
+ a multiplier of 4KB. */
+ #define MEMORY_MAP_SIZE 0x3000
+@@ -58,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+
+ #if 1
+ /* Limit the memory access to less than 4GB for 32-bit platforms. */
+- if (address > 0xffffffff)
++ if (address > MAX_USABLE_ADDRESS)
+ return 0;
+ #endif
+
+@@ -66,7 +72,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+ if (address == 0)
+ {
+ type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
+- address = 0xffffffff;
++ address = MAX_USABLE_ADDRESS;
+ }
+ else
+ type = GRUB_EFI_ALLOCATE_ADDRESS;
+@@ -86,7 +92,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
+ {
+ /* Uggh, the address 0 was allocated... This is too annoying,
+ so reallocate another one. */
+- address = 0xffffffff;
++ address = MAX_USABLE_ADDRESS;
+ status = efi_call_4 (b->allocate_pages, type, GRUB_EFI_LOADER_DATA, pages, &address);
+ grub_efi_free_pages (0, pages);
+ if (status != GRUB_EFI_SUCCESS)
+@@ -319,7 +325,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ {
+ if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
+ #if 1
+- && desc->physical_start <= 0xffffffff
++ && desc->physical_start <= MAX_USABLE_ADDRESS
+ #endif
+ && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
+ && desc->num_pages != 0)
+@@ -337,9 +343,9 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
+ #if 1
+ if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ + filtered_desc->num_pages
+- > BYTES_TO_PAGES (0x100000000LL))
++ > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL))
+ filtered_desc->num_pages
+- = (BYTES_TO_PAGES (0x100000000LL)
++ = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)
+ - BYTES_TO_PAGES (filtered_desc->physical_start));
+ #endif
+
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 65f09ef..17c1215 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -100,14 +100,32 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
+ break;
+
+ case R_X86_64_PC32:
+- *addr32 += rel->r_addend + sym->st_value -
+- (Elf64_Xword) seg->addr - rel->r_offset;
++ {
++ grub_int64_t value;
++ value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
++ (Elf64_Xword) seg->addr - rel->r_offset;
++ if (value != (grub_int32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
+ break;
+
+ case R_X86_64_32:
++ {
++ grub_uint64_t value = *addr32 + rel->r_addend + sym->st_value;
++ if (value != (grub_uint32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
++ break;
+ case R_X86_64_32S:
+- *addr32 += rel->r_addend + sym->st_value;
+- break;
++ {
++ grub_int64_t value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value;
++ if (value != (grub_int32_t) value)
++ return grub_error (GRUB_ERR_BAD_MODULE, "relocation out of range");
++ *addr32 = value;
++ }
++ break;
+
+ default:
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
new file mode 100644
index 000000000..4f12628a4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-efi-fix-with-glibc-2.20.patch
@@ -0,0 +1,32 @@
+From eb6368e65f6988eebad26cebdec057f797bceb40 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Tue, 9 Sep 2014 00:02:30 -0700
+Subject: [PATCH] Fix build with glibc 2.20
+
+* grub-core/kern/emu/hostfs.c: squahes below warning
+ warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
+
+Upstream-Status: Submitted
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ grub-core/kern/emu/hostfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
+index 3cb089c..a51ee32 100644
+--- a/grub-core/kern/emu/hostfs.c
++++ b/grub-core/kern/emu/hostfs.c
+@@ -16,7 +16,7 @@
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+-#define _BSD_SOURCE
++#define _DEFAULT_SOURCE
+ #include <grub/fs.h>
+ #include <grub/file.h>
+ #include <grub/disk.h>
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch
new file mode 100644
index 000000000..326951df4
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-install.in.patch
@@ -0,0 +1,20 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+Our use of grub-install doesn't require the -x option, so we should be
+be able make use of grep versions that don't support it.
+
+Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
+
+Index: grub-1.99/util/grub-install.in
+===================================================================
+--- grub-1.99.orig/util/grub-install.in 2011-09-09 22:37:20.093906679 -0500
++++ grub-1.99/util/grub-install.in 2011-09-09 22:37:30.854737882 -0500
+@@ -510,7 +510,7 @@
+
+ if [ "x${devabstraction_module}" = "x" ] ; then
+ if [ x"${install_device}" != x ]; then
+- if echo "${install_device}" | grep -qx "(.*)" ; then
++ if echo "${install_device}" | grep -q "(.*)" ; then
+ install_drive="${install_device}"
+ else
+ install_drive="`"$grub_probe" --device-map="${device_map}" --target=drive --device "${install_device}"`" || exit 1
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
new file mode 100644
index 000000000..4cbd0838d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub-no-unused-result.patch
@@ -0,0 +1,19 @@
+Signed-off-by: Radu Moisan <radu.moisan@intel.com>
+Upstream-Status: Pending
+
+I had an error because of an unused return value for read().
+I added -Wno-unused-result.
+
+Index: grub-2.00/configure.ac
+===================================================================
+--- grub-2.00.orig/configure.ac 2012-08-13 16:32:33.000000000 +0300
++++ grub-2.00/configure.ac 2012-08-13 16:38:22.000000000 +0300
+@@ -394,7 +394,7 @@
+ LIBS=""
+
+ # debug flags.
+-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"
++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"
+ HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
+ TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
+ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch
new file mode 100644
index 000000000..d114f4847
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-fix-initrd-size-bug.patch
@@ -0,0 +1,48 @@
+From 8fbb150a56966edde4dc07b8d01be5eb149b65ab Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@ubuntu.com>
+Date: Sun, 20 Jan 2013 23:03:35 +0000
+Subject: [PATCH 1/1] * grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't
+ add the initrd size to addr_min, since the initrd will be allocated after
+ this address.
+
+commit 6a0debbd9167e8f79cdef5497a73d23e580c0cd4 upstream
+
+Upstream-Status: Backport
+
+Signed-off-by: Shan Hai <shan.hai@windriver.com>
+---
+ ChangeLog | 6 ++++++
+ grub-core/loader/i386/linux.c | 3 +--
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index c2f42d5..40cb508 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,9 @@
++2013-01-20 Colin Watson <cjwatson@ubuntu.com>
++
++ * grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't add the
++ initrd size to addr_min, since the initrd will be allocated after
++ this address.
++
+ 2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/net/tftp.c (ack): Fix endianness problem.
+diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
+index 62087cf..e2425c8 100644
+--- a/grub-core/loader/i386/linux.c
++++ b/grub-core/loader/i386/linux.c
+@@ -1098,8 +1098,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
+ worse than that of Linux 2.3.xx, so avoid the last 64kb. */
+ addr_max -= 0x10000;
+
+- addr_min = (grub_addr_t) prot_mode_target + prot_init_space
+- + page_align (size);
++ addr_min = (grub_addr_t) prot_mode_target + prot_init_space;
+
+ /* Put the initrd as high as possible, 4KiB aligned. */
+ addr = (addr_max - size) & ~0xFFF;
+--
+1.8.5.2.233.g932f7e4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch
new file mode 100644
index 000000000..6259a1abe
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/grub2-remove-sparc64-setup-from-x86-builds.patch
@@ -0,0 +1,104 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+remove the grub-sparc64-setup files from the x86 builds.
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+
+--- a/Makefile.util.am 2014-08-15 11:41:02.441011278 -0700
++++ b/Makefile.util.am 2014-08-15 11:44:26.245021142 -0700
+@@ -4692,9 +4692,9 @@
+ endif
+
+ if COND_emu
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4715,9 +4715,9 @@
+ endif
+
+ if COND_i386_pc
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4738,9 +4738,9 @@
+ endif
+
+ if COND_i386_efi
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4761,9 +4761,9 @@
+ endif
+
+ if COND_i386_qemu
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4784,9 +4784,9 @@
+ endif
+
+ if COND_i386_coreboot
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4807,9 +4807,9 @@
+ endif
+
+ if COND_i386_multiboot
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4830,9 +4830,9 @@
+ endif
+
+ if COND_i386_ieee1275
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
+@@ -4853,9 +4853,9 @@
+ endif
+
+ if COND_x86_64_efi
+-sbin_PROGRAMS += grub-sparc64-setup
++sbin_PROGRAMS +=
+ if COND_MAN_PAGES
+-man_MANS += grub-sparc64-setup.8
++man_MANS +=
+
+ grub-sparc64-setup.8: grub-sparc64-setup
+ chmod a+x grub-sparc64-setup
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch
new file mode 100644
index 000000000..463f7847a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/files/remove-gets.patch
@@ -0,0 +1,20 @@
+ISO C11 removes the specification of gets() from the C language, eglibc 2.16+ removed it
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: grub-1.99/grub-core/gnulib/stdio.in.h
+===================================================================
+--- grub-1.99.orig/grub-core/gnulib/stdio.in.h 2010-12-01 06:45:43.000000000 -0800
++++ grub-1.99/grub-core/gnulib/stdio.in.h 2012-07-04 12:25:02.057099107 -0700
+@@ -140,8 +140,10 @@
+ /* It is very rare that the developer ever has full control of stdin,
+ so any use of gets warrants an unconditional warning. Assume it is
+ always declared, since it is required by C89. */
++#if defined gets
+ #undef gets
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
++#endif
+
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch
new file mode 100644
index 000000000..d66207ae6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/autohell.patch
@@ -0,0 +1,21 @@
+Upstream-Status: Inappropriate [configuration]
+
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: grub-0.97/configure.ac
+===================================================================
+--- grub-0.97.orig/configure.ac 2008-09-12 17:39:52.000000000 +0200
++++ grub-0.97/configure.ac 2008-09-12 17:40:21.000000000 +0200
+@@ -60,8 +60,8 @@ AC_PROG_CC
+ _AM_DEPENDENCIES(CC)
+
+ dnl Because recent automake complains about AS, set it here.
+-CCAS="$CC"
+-AC_SUBST(CCAS)
++AM_PROG_AS
++AC_SUBST(AS)
+
+ AC_ARG_WITH(binutils,
+ [ --with-binutils=DIR search the directory DIR to find binutils])
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
new file mode 100644
index 000000000..d225d13dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub-support-256byte-inode.patch
@@ -0,0 +1,101 @@
+Upstream-Status: Inappropriate [No Longer Maintained]
+
+diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
+--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
++++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
+@@ -79,7 +79,52 @@
+ __u32 s_rev_level; /* Revision level */
+ __u16 s_def_resuid; /* Default uid for reserved blocks */
+ __u16 s_def_resgid; /* Default gid for reserved blocks */
+- __u32 s_reserved[235]; /* Padding to the end of the block */
++ /*
++ * These fields are for EXT2_DYNAMIC_REV superblocks only.
++ *
++ * Note: the difference between the compatible feature set and
++ * the incompatible feature set is that if there is a bit set
++ * in the incompatible feature set that the kernel doesn't
++ * know about, it should refuse to mount the filesystem.
++ *
++ * e2fsck's requirements are more strict; if it doesn't know
++ * about a feature in either the compatible or incompatible
++ * feature set, it must abort and not try to meddle with
++ * things it doesn't understand...
++ */
++ __u32 s_first_ino; /* First non-reserved inode */
++ __u16 s_inode_size; /* size of inode structure */
++ __u16 s_block_group_nr; /* block group # of this superblock */
++ __u32 s_feature_compat; /* compatible feature set */
++ __u32 s_feature_incompat; /* incompatible feature set */
++ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
++ __u8 s_uuid[16]; /* 128-bit uuid for volume */
++ char s_volume_name[16]; /* volume name */
++ char s_last_mounted[64]; /* directory where last mounted */
++ __u32 s_algorithm_usage_bitmap; /* For compression */
++ /*
++ * Performance hints. Directory preallocation should only
++ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
++ */
++ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
++ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
++ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
++ /*
++ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
++ */
++ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
++ __u32 s_journal_inum; /* inode number of journal file */
++ __u32 s_journal_dev; /* device number of journal file */
++ __u32 s_last_orphan; /* start of list of inodes to delete */
++ __u32 s_hash_seed[4]; /* HTREE hash seed */
++ __u8 s_def_hash_version; /* Default hash version to use */
++ __u8 s_jnl_backup_type; /* Default type of journal backup */
++ __u16 s_reserved_word_pad;
++ __u32 s_default_mount_opts;
++ __u32 s_first_meta_bg; /* First metablock group */
++ __u32 s_mkfs_time; /* When the filesystem was created */
++ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
++ __u32 s_reserved[172]; /* Padding to the end of the block */
+ };
+
+ struct ext2_group_desc
+@@ -218,6 +263,14 @@
+ #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
+ #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
+
++#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
++#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
++#define EXT2_GOOD_OLD_INODE_SIZE 128
++#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
++ EXT2_GOOD_OLD_INODE_SIZE : \
++ (s)->s_inode_size)
++#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
++
+ /* linux/ext2_fs.h */
+ #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
+ /* kind of from ext2/super.c */
+@@ -553,7 +606,7 @@
+ gdp = GROUP_DESC;
+ ino_blk = gdp[desc].bg_inode_table +
+ (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
+- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
++ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
+ #ifdef E2DEBUG
+ printf ("inode table fsblock=%d\n", ino_blk);
+ #endif /* E2DEBUG */
+@@ -565,13 +618,12 @@
+ /* reset indirect blocks! */
+ mapblock2 = mapblock1 = -1;
+
+- raw_inode = INODE +
+- ((current_ino - 1)
+- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
++ raw_inode = (struct ext2_inode *)((char *)INODE +
++ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
++ EXT2_INODE_SIZE (SUPERBLOCK));
+ #ifdef E2DEBUG
+ printf ("ipb=%d, sizeof(inode)=%d\n",
+- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
+- sizeof (struct ext2_inode));
++ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
+ printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
+ printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
+ for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
new file mode 100644
index 000000000..0cf7dc96d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/grub_fix_for_automake-1.12.patch
@@ -0,0 +1,74 @@
+Upstream-Status: Inappropriate
+
+Subject: [PATCH] grub: fix for automake-1.12
+
+automake 1.12 has depricated automatic de-ANSI-fication support
+
+this patch avoids these kinds of errors:
+
+| stage1/Makefile.am:2: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| stage2/Makefile.am:35: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| stage2/Makefile.am:46: error: 'pkglibdir' is not a legitimate directory for 'DATA'
+| autoreconf: automake failed with exit status: 1
+| ERROR: autoreconf execution failed.
+
+The upstream status is marked as 'Inappropriate' because this problem is not uncommon,
+it has been there for a long time and no change in upstream.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+Index: grub-0.97/stage1/Makefile.am
+===================================================================
+--- a/stage1/Makefile.am
++++ b/stage1/Makefile.am
+@@ -1,7 +1,7 @@
+-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
+-nodist_pkglib_DATA = stage1
++pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
++nodist_pkgdata_DATA = stage1
+
+-CLEANFILES = $(nodist_pkglib_DATA)
++CLEANFILES = $(nodist_pkgdata_DATA)
+
+ # We can't use builtins or standard includes.
+ AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
+Index: grub-0.97/stage2/Makefile.am
+===================================================================
+--- a/stage2/Makefile.am
++++ b/stage2/Makefile.am
+@@ -27,12 +27,12 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
+ -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
+
+ # Stage 2 and Stage 1.5's.
+-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
++pkgdatadir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
+
+ EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
+
+ if DISKLESS_SUPPORT
+-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
++pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+ reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
+ nbgrub pxegrub
+@@ -43,7 +43,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+ xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
+ else
+-pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
++pkgdata_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+ reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
+ noinst_DATA = pre_stage2 start start_eltorito
+@@ -105,7 +105,7 @@ else
+ BUILT_SOURCES = stage2_size.h
+ endif
+
+-CLEANFILES = $(pkglib_DATA) $(noinst_DATA) $(BUILT_SOURCES)
++CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES)
+
+ stage2_size.h: pre_stage2
+ -rm -f stage2_size.h
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
new file mode 100644
index 000000000..70037e47c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/no-reorder-functions.patch
@@ -0,0 +1,31 @@
+Upstream-Status: Inappropriate [disable feature]
+
+After the commit "tcmode-default: switch to gcc 4.6.0 for x86, x86-64 & arm",
+we got bug 1099 (http://bugzilla.yoctoproject.org/show_bug.cgi?id=1099):
+
+Running "install --stage2=/ssd/boot/grub/stage2 /boot/grub/stage1(hd0)
+ /boot/grub/stage2 p /boot/grub/menu list" failed
+Error 6: Mismatched or corrupt version of stage1/stage2
+
+This turned out to be a gcc's bug. See
+https://bugs.gentoo.org/show_bug.cgi?id=360513
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
+
+Upstream gcc seems uninterested in the bug, so at present we can disable the
+option as a workaround. Thanks Ryan Hill for the investigation and the
+workaround patch.
+
+Dexuan Cui <dexuan.cui@intel.com>
+Wed Jun 29 20:21:39 CST 2011
+
+--- grub-0.97/stage2/Makefile.am.orig
++++ grub-0.97/stage2/Makefile.am
+@@ -79,7 +79,7 @@
+ HERCULES_FLAGS =
+ endif
+
+-STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
++STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-reorder-functions -fno-builtin -nostdinc \
+ $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
+
+ STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
new file mode 100644
index 000000000..bd8e0a89f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-0.97/objcopy-absolute.patch
@@ -0,0 +1,40 @@
+
+This patch is from ubuntu:
+ * objcopy-absolute.diff (update): Remove .note, .comment, and
+ .note.gnu.build-id sections from images (LP: #444703).
+
+Upstream-Status: Inappropriate [no longer maintained]
+
+Index: b/acinclude.m4
+===================================================================
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -61,7 +61,7 @@
+ else
+ AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
+ fi
+- if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
++ if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
+ else
+ AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
+ fi
+Index: b/stage1/Makefile.am
+===================================================================
+--- a/stage1/Makefile.am
++++ b/stage1/Makefile.am
+@@ -12,4 +12,4 @@
+
+ SUFFIXES = .exec
+ .exec:
+- $(OBJCOPY) -O binary $< $@
++ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
+Index: b/stage2/Makefile.am
+===================================================================
+--- a/stage2/Makefile.am
++++ b/stage2/Makefile.am
+@@ -293,4 +293,4 @@
+ # General rule for making a raw binary.
+ SUFFIXES = .exec
+ .exec:
+- $(OBJCOPY) -O binary $< $@
++ $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb
new file mode 100644
index 000000000..5a0dc954a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-efi_2.00.bb
@@ -0,0 +1,69 @@
+require grub2.inc
+
+DEPENDS_class-target = "grub-efi-native"
+RDEPENDS_${PN}_class-target = "diffutils freetype"
+PR = "r3"
+
+SRC_URI += " \
+ file://cfg \
+ "
+
+S = "${WORKDIR}/grub-${PV}"
+
+# Determine the target arch for the grub modules
+python __anonymous () {
+ import re
+ target = d.getVar('TARGET_ARCH', True)
+ if target == "x86_64":
+ grubtarget = 'x86_64'
+ grubimage = "bootx64.efi"
+ elif re.match('i.86', target):
+ grubtarget = 'i386'
+ grubimage = "bootia32.efi"
+ else:
+ raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target)
+ d.setVar("GRUB_TARGET", grubtarget)
+ d.setVar("GRUB_IMAGE", grubimage)
+}
+
+inherit deploy
+
+CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
+EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
+ --enable-efiemu=no --program-prefix='' \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+# ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines]
+# and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo)
+CFLAGS_append_class-native = " -Wno-error=trampolines"
+
+do_install_class-native() {
+ install -d ${D}${bindir}
+ install -m 755 grub-mkimage ${D}${bindir}
+}
+
+GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search"
+
+do_deploy() {
+ # Search for the grub.cfg on the local boot media by using the
+ # built in cfg file provided via this recipe
+ grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
+ ${GRUB_BUILDIN}
+ install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
+}
+
+do_deploy_class-native() {
+ :
+}
+
+addtask deploy after do_install before do_build
+
+FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
+ ${datadir}/grub \
+ "
+
+BBCLASSEXTEND = "native"
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
new file mode 100644
index 000000000..87ec29e32
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch
@@ -0,0 +1,46 @@
+From fb7b827a56b1f92f882d0f5ef130acc968b23293 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:17:31 +0000
+Subject: [PATCH] Disable -mfpmath=sse as well when SSE is disabled
+
+Fixes
+
+configure: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
+conftest.c:1:0: error: SSE instruction set disabled, using 387
+arithmetics [-Werror]
+cc1: all warnings being treated as errors
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 26d2f33..9ce56de 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -783,7 +783,7 @@ fi
+ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
+ # Some toolchains enable these features by default, but they need
+ # registers that aren't set up properly in GRUB.
+- TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
++ TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mfpmath=387"
+ fi
+
+ # GRUB doesn't use float or doubles at all. Yet some toolchains may decide
+--
+2.7.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
new file mode 100644
index 000000000..d5bfaa177
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub-git/0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch
@@ -0,0 +1,56 @@
+From b512c77222a8b133d7dd71a0dcef081a921d97d4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jan 2016 19:28:00 +0000
+Subject: [PATCH] grub.d/10_linux.in: add oe's kernel name
+
+Our kernel's name is bzImage, we need add it to grub.d/10_linux.in so
+that the grub-mkconfig and grub-install can work correctly.
+
+We only need add the bzImage to util/grub.d/10_linux.in, but also add it
+to util/grub.d/20_linux_xen.in to keep compatibility.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate [OE specific]
+
+ util/grub.d/10_linux.in | 6 +++---
+ util/grub.d/20_linux_xen.in | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 859b608..946be5d 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -148,12 +148,12 @@ machine=`uname -m`
+ case "x$machine" in
+ xi?86 | xx86_64)
+ list=
+- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
++ for i in /boot/bzImage-* /bzImage-* /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ done ;;
+- *)
++ *)
+ list=
+- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
++ for i in /boot/bzImage-* /boot/vmlinuz-* /boot/vmlinux-* /bzImage-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
+ done ;;
+ esac
+diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
+index f532fb9..1994244 100644
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -138,7 +138,7 @@ EOF
+ }
+
+ linux_list=
+-for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
++for i in /boot/bzImage[xz]-* /bzImage[xz]-* /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+ if grub_file_is_not_garbage "$i"; then
+ basename=$(basename $i)
+ version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+--
+2.7.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
new file mode 100644
index 000000000..fc5aa4e31
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub/autogen.sh-exclude-pc.patch
@@ -0,0 +1,34 @@
+From ff8f68cc48fd3c30d55e1d570d51f2e0952c968e Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sat, 25 Jan 2014 23:49:44 -0500
+Subject: [PATCH] autogen.sh: exclude .pc from po/POTFILES.in
+
+Exclude the .pc from po/POTFILES.in since quilt uses "patch --backup",
+which will create the backup file under .pc, this may cause unexpected
+errors, for example, on CentOS 5.x, if the backup file is null
+(newfile), it's mode will be 000, then we will get errors when xgettext
+try to read it.
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ autogen.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/autogen.sh b/autogen.sh
+index 7424428..843619e 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -5,7 +5,7 @@ set -e
+ export LC_COLLATE=C
+ unset LC_ALL
+
+-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
++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
+ find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
+
+ echo "Importing unicode..."
+--
+1.7.10.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc
new file mode 100644
index 000000000..146dde60c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub2.inc
@@ -0,0 +1,69 @@
+SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
+
+DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
+intended to unify bootloading across x86 operating systems. In \
+addition to loading the Linux kernel, it implements the Multiboot \
+standard, which allows for flexible loading of multiple boot images."
+
+HOMEPAGE = "http://www.gnu.org/software/grub/"
+SECTION = "bootloaders"
+
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
+ file://grub-2.00-fpmath-sse-387-fix.patch \
+ file://check-if-liblzma-is-disabled.patch \
+ file://fix-issue-with-flex-2.5.37.patch \
+ file://grub-2.00-add-oe-kernel.patch \
+ file://grub-install.in.patch \
+ file://remove-gets.patch \
+ file://fix-endianness-problem.patch \
+ file://grub2-remove-sparc64-setup-from-x86-builds.patch \
+ file://grub-2.00-fix-enable_execute_stack-check.patch \
+ file://grub-no-unused-result.patch \
+ file://grub-efi-allow-a-compilation-without-mcmodel-large.patch \
+ file://grub-efi-fix-with-glibc-2.20.patch \
+ file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
+ file://0001-parse_dhcp_vendor-Add-missing-const-qualifiers.patch \
+ file://grub2-fix-initrd-size-bug.patch \
+ file://0001-Fix-CVE-2015-8370-Grub2-user-pass-vulnerability.patch \
+ file://0001-Remove-direct-_llseek-code-and-require-long-filesyst.patch \
+ file://fix-texinfo.patch \
+ "
+
+DEPENDS = "flex-native bison-native"
+
+SRC_URI[md5sum] = "e927540b6eda8b024fb0391eeaa4091c"
+SRC_URI[sha256sum] = "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6caf1cd0fd3b3cc11e3"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
+
+inherit autotools gettext texinfo
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[grub-mount] = "--enable-grub-mount,--disable-grub-mount,fuse"
+PACKAGECONFIG[device-mapper] = "--enable-device-mapper,--disable-device-mapper,lvm2"
+
+# grub2 creates its own set of -nostdinc / -isystem / -ffreestanding CFLAGS and
+# OE's default BUILD_CFLAGS (assigned to CFLAGS for native builds) etc, conflict
+# with that. Note that since BUILD_CFLAGS etc are not used by grub2 target
+# builds, it's safe to clear them unconditionally for both target and native.
+BUILD_CPPFLAGS = ""
+BUILD_CFLAGS = ""
+BUILD_CXXFLAGS = ""
+BUILD_LDFLAGS = ""
+
+do_configure_prepend() {
+ # The grub2 configure script uses variables such as TARGET_CFLAGS etc
+ # for its own purposes. Remove the OE versions from the environment to
+ # avoid conflicts.
+ unset TARGET_CPPFLAGS TARGET_CFLAGS TARGET_CXXFLAGS TARGET_LDFLAGS
+}
+
+# grub and grub-efi's sysroot/${datadir}/grub/grub-mkconfig_lib are
+# conflicted, remove it since no one uses it.
+SYSROOT_PREPROCESS_FUNCS_class-target += "remove_sysroot_mkconfig_lib"
+remove_sysroot_mkconfig_lib() {
+ rm -r "${SYSROOT_DESTDIR}${datadir}/grub/grub-mkconfig_lib"
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb
new file mode 100644
index 000000000..997a045b2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_0.97.bb
@@ -0,0 +1,35 @@
+SUMMARY = "GRUB is the GRand Unified Bootloader"
+DESCRIPTION = "GRUB is a GPLed bootloader intended to unify bootloading across x86 \
+operating systems. In addition to loading the Linux kernel, it implements the Multiboot \
+standard, which allows for flexible loading of multiple boot images."
+HOMEPAGE = "http://www.gnu.org/software/grub/"
+SECTION = "bootloaders"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b \
+ file://grub/main.c;beginline=3;endline=9;md5=22a5f28d2130fff9f2a17ed54be90ed6"
+
+RDEPENDS_${PN} = "diffutils"
+PR = "r6"
+
+SRC_URI = "ftp://alpha.gnu.org/gnu/grub/grub-${PV}.tar.gz; \
+ file://no-reorder-functions.patch \
+ file://autohell.patch \
+ file://grub_fix_for_automake-1.12.patch \
+ file://objcopy-absolute.patch \
+ file://grub-support-256byte-inode.patch \
+"
+
+SRC_URI[md5sum] = "cd3f3eb54446be6003156158d51f4884"
+SRC_URI[sha256sum] = "4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b"
+
+inherit autotools texinfo
+
+COMPATIBLE_HOST = "i.86.*-linux"
+
+EXTRA_OECONF = "--without-curses"
+
+do_install_append_vmware() {
+ mkdir -p ${D}/boot/
+ ln -sf ../usr/lib/grub/{$TARGET_ARCH}{$TARGET_VENDOR}/ ${D}/boot/grub
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb
new file mode 100644
index 000000000..778074a38
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_2.00.bb
@@ -0,0 +1,16 @@
+require grub2.inc
+
+RDEPENDS_${PN} = "diffutils freetype"
+PR = "r1"
+
+EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --program-prefix="" \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/grub.d
+}
+
+INSANE_SKIP_${PN} = "arch"
+INSANE_SKIP_${PN}-dbg = "arch"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb
new file mode 100644
index 000000000..6919c9a35
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/grub/grub_git.bb
@@ -0,0 +1,52 @@
+require grub2.inc
+
+DEPENDS += "autogen-native"
+
+DEFAULT_PREFERENCE = "-1"
+DEFAULT_PREFERENCE_arm = "1"
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/grub-git:"
+
+PV = "2.00+${SRCPV}"
+SRCREV = "b95e92678882f56056c64ae29092bc9cf129905f"
+SRC_URI = "git://git.savannah.gnu.org/grub.git \
+ file://0001-Disable-mfpmath-sse-as-well-when-SSE-is-disabled.patch \
+ file://autogen.sh-exclude-pc.patch \
+ file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
+
+inherit autotools gettext texinfo
+
+# configure.ac has code to set this automagically from the target tuple
+# but the OE freeform one (core2-foo-bar-linux) don't work with that.
+
+GRUBPLATFORM_arm = "uboot"
+GRUBPLATFORM_aarch64 = "efi"
+GRUBPLATFORM ??= "pc"
+
+EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont --program-prefix="" \
+ --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
+
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}"
+
+do_configure_prepend() {
+ ( cd ${S}
+ ${S}/autogen.sh )
+}
+
+do_install_append () {
+ install -d ${D}${sysconfdir}/grub.d
+ rm -rf ${D}${libdir}/charset.alias
+}
+
+# debugedit chokes on bare metal binaries
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+RDEPENDS_${PN} = "diffutils freetype"
+
+INSANE_SKIP_${PN} = "arch"
+INSANE_SKIP_${PN}-dbg = "arch"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/0001-console-Fix-C-syntax-errors-for-function-declaration.patch b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/0001-console-Fix-C-syntax-errors-for-function-declaration.patch
new file mode 100644
index 000000000..fa50bc4a6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/0001-console-Fix-C-syntax-errors-for-function-declaration.patch
@@ -0,0 +1,74 @@
+From 55957faf1272c8f5f304909faeebf647a78e3701 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 9 Sep 2015 07:19:45 +0000
+Subject: [PATCH] console: Fix C syntax errors for function declaration
+
+To address this, the semicolons after the function parameters should be
+replaced by commas, and the last one should be omitted
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/efi/console.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/efi/console.c b/src/efi/console.c
+index 6206c80..66aa88f 100644
+--- a/src/efi/console.c
++++ b/src/efi/console.c
+@@ -27,8 +27,8 @@
+ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
+
+ typedef EFI_STATUS (EFIAPI *EFI_INPUT_RESET_EX)(
+- struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This;
+- BOOLEAN ExtendedVerification;
++ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
++ BOOLEAN ExtendedVerification
+ );
+
+ typedef UINT8 EFI_KEY_TOGGLE_STATE;
+@@ -44,29 +44,29 @@ typedef struct {
+ } EFI_KEY_DATA;
+
+ typedef EFI_STATUS (EFIAPI *EFI_INPUT_READ_KEY_EX)(
+- struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This;
+- EFI_KEY_DATA *KeyData;
++ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
++ EFI_KEY_DATA *KeyData
+ );
+
+ typedef EFI_STATUS (EFIAPI *EFI_SET_STATE)(
+- struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This;
+- EFI_KEY_TOGGLE_STATE *KeyToggleState;
++ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
++ EFI_KEY_TOGGLE_STATE *KeyToggleState
+ );
+
+ typedef EFI_STATUS (EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(
+- EFI_KEY_DATA *KeyData;
++ EFI_KEY_DATA *KeyData
+ );
+
+ typedef EFI_STATUS (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(
+- struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This;
+- EFI_KEY_DATA KeyData;
+- EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction;
+- VOID **NotifyHandle;
++ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
++ EFI_KEY_DATA KeyData,
++ EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
++ VOID **NotifyHandle
+ );
+
+ typedef EFI_STATUS (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(
+- struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This;
+- VOID *NotificationHandle;
++ struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
++ VOID *NotificationHandle
+ );
+
+ typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
+--
+2.5.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch
new file mode 100644
index 000000000..49f55930d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot/fix-objcopy.patch
@@ -0,0 +1,45 @@
+From 0f7f9e3bb1d0e1b93f3ad8a1d5d7bdd3fbf27494 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Thu, 27 Mar 2014 07:20:33 +0000
+Subject: [PATCH] Makefile.am: use objcopy from the env
+
+It uses the "objcopy" directly, which is not suitable for cross compile.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ Makefile.am | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+Index: git/Makefile.am
+===================================================================
+--- git.orig/Makefile.am
++++ git/Makefile.am
+@@ -19,6 +19,8 @@
+ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+ AM_MAKEFLAGS = --no-print-directory
+
++OBJCOPY ?= objcopy
++
+ gummibootlibdir = $(prefix)/lib/gummiboot
+
+ AM_CPPFLAGS = -include config.h
+@@ -148,7 +150,7 @@ $(gummiboot_solib): $(gummiboot_objects)
+ .DELETE_ON_ERROR: $(gummboot_solib)
+
+ $(gummiboot): $(gummiboot_solib)
+- $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
++ $(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .reloc \
+ --target=efi-app-$(ARCH) $< $@
+
+@@ -183,7 +185,7 @@ $(stub_solib): $(stub_objects)
+ .DELETE_ON_ERROR: $(gummboot_solib)
+
+ $(stub): $(stub_solib)
+- $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
++ $(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
+ -j .dynsym -j .rel -j .rela -j .reloc \
+ --target=efi-app-$(ARCH) $< $@
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot_git.bb b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot_git.bb
new file mode 100644
index 000000000..376ab542d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/gummiboot/gummiboot_git.bb
@@ -0,0 +1,37 @@
+SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images."
+HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
+
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
+
+DEPENDS = "gnu-efi util-linux"
+
+inherit autotools pkgconfig
+inherit deploy
+
+PV = "48+git${SRCPV}"
+SRCREV = "2bcd919c681c952eb867ef1bdb458f1bc49c2d55"
+SRC_URI = "git://anongit.freedesktop.org/gummiboot \
+ file://fix-objcopy.patch \
+ file://0001-console-Fix-C-syntax-errors-for-function-declaration.patch \
+ "
+
+# Note: Add COMPATIBLE_HOST here is only because it depends on gnu-efi
+# which has set the COMPATIBLE_HOST, the gummiboot itself may work on
+# more hosts.
+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = "--disable-manpages --with-efi-includedir=${STAGING_INCDIR} \
+ --with-efi-ldsdir=${STAGING_LIBDIR} \
+ --with-efi-libdir=${STAGING_LIBDIR}"
+
+EXTRA_OEMAKE += "gummibootlibdir=${libdir}/gummiboot"
+
+TUNE_CCARGS_remove = "-mfpmath=sse"
+
+do_deploy () {
+ install ${B}/gummiboot*.efi ${DEPLOYDIR}
+}
+addtask deploy before do_build after do_compile
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/COPYING.patch b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/COPYING.patch
new file mode 100644
index 000000000..05c70c92e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/COPYING.patch
@@ -0,0 +1,346 @@
+Upstream-Status: Inappropriate [other]
+
+diff -ruN hostap-conf-1.0-orig/COPYING hostap-conf-1.0/COPYING
+--- hostap-conf-1.0-orig/COPYING 1970-01-01 08:00:00.000000000 +0800
++++ hostap-conf-1.0/COPYING 2010-12-09 16:36:48.000000000 +0800
+@@ -0,0 +1,340 @@
++ GNU GENERAL PUBLIC LICENSE
++ Version 2, June 1991
++
++ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
++ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++ Preamble
++
++ The licenses for most software are designed to take away your
++freedom to share and change it. By contrast, the GNU General Public
++License is intended to guarantee your freedom to share and change free
++software--to make sure the software is free for all its users. This
++General Public License applies to most of the Free Software
++Foundation's software and to any other program whose authors commit to
++using it. (Some other Free Software Foundation software is covered by
++the GNU Library General Public License instead.) You can apply it to
++your programs, too.
++
++ When we speak of free software, we are referring to freedom, not
++price. Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++this service if you wish), that you receive source code or can get it
++if you want it, that you can change the software or use pieces of it
++in new free programs; and that you know you can do these things.
++
++ To protect your rights, we need to make restrictions that forbid
++anyone to deny you these rights or to ask you to surrender the rights.
++These restrictions translate to certain responsibilities for you if you
++distribute copies of the software, or if you modify it.
++
++ For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must give the recipients all the rights that
++you have. You must make sure that they, too, receive or can get the
++source code. And you must show them these terms so they know their
++rights.
++
++ We protect your rights with two steps: (1) copyright the software, and
++(2) offer you this license which gives you legal permission to copy,
++distribute and/or modify the software.
++
++ Also, for each author's protection and ours, we want to make certain
++that everyone understands that there is no warranty for this free
++software. If the software is modified by someone else and passed on, we
++want its recipients to know that what they have is not the original, so
++that any problems introduced by others will not reflect on the original
++authors' reputations.
++
++ Finally, any free program is threatened constantly by software
++patents. We wish to avoid the danger that redistributors of a free
++program will individually obtain patent licenses, in effect making the
++program proprietary. To prevent this, we have made it clear that any
++patent must be licensed for everyone's free use or not licensed at all.
++
++ The precise terms and conditions for copying, distribution and
++modification follow.
++
++ GNU GENERAL PUBLIC LICENSE
++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
++
++ 0. This License applies to any program or other work which contains
++a notice placed by the copyright holder saying it may be distributed
++under the terms of this General Public License. The "Program", below,
++refers to any such program or work, and a "work based on the Program"
++means either the Program or any derivative work under copyright law:
++that is to say, a work containing the Program or a portion of it,
++either verbatim or with modifications and/or translated into another
++language. (Hereinafter, translation is included without limitation in
++the term "modification".) Each licensee is addressed as "you".
++
++Activities other than copying, distribution and modification are not
++covered by this License; they are outside its scope. The act of
++running the Program is not restricted, and the output from the Program
++is covered only if its contents constitute a work based on the
++Program (independent of having been made by running the Program).
++Whether that is true depends on what the Program does.
++
++ 1. You may copy and distribute verbatim copies of the Program's
++source code as you receive it, in any medium, provided that you
++conspicuously and appropriately publish on each copy an appropriate
++copyright notice and disclaimer of warranty; keep intact all the
++notices that refer to this License and to the absence of any warranty;
++and give any other recipients of the Program a copy of this License
++along with the Program.
++
++You may charge a fee for the physical act of transferring a copy, and
++you may at your option offer warranty protection in exchange for a fee.
++
++ 2. You may modify your copy or copies of the Program or any portion
++of it, thus forming a work based on the Program, and copy and
++distribute such modifications or work under the terms of Section 1
++above, provided that you also meet all of these conditions:
++
++ a) You must cause the modified files to carry prominent notices
++ stating that you changed the files and the date of any change.
++
++ b) You must cause any work that you distribute or publish, that in
++ whole or in part contains or is derived from the Program or any
++ part thereof, to be licensed as a whole at no charge to all third
++ parties under the terms of this License.
++
++ c) If the modified program normally reads commands interactively
++ when run, you must cause it, when started running for such
++ interactive use in the most ordinary way, to print or display an
++ announcement including an appropriate copyright notice and a
++ notice that there is no warranty (or else, saying that you provide
++ a warranty) and that users may redistribute the program under
++ these conditions, and telling the user how to view a copy of this
++ License. (Exception: if the Program itself is interactive but
++ does not normally print such an announcement, your work based on
++ the Program is not required to print an announcement.)
++
++These requirements apply to the modified work as a whole. If
++identifiable sections of that work are not derived from the Program,
++and can be reasonably considered independent and separate works in
++themselves, then this License, and its terms, do not apply to those
++sections when you distribute them as separate works. But when you
++distribute the same sections as part of a whole which is a work based
++on the Program, the distribution of the whole must be on the terms of
++this License, whose permissions for other licensees extend to the
++entire whole, and thus to each and every part regardless of who wrote it.
++
++Thus, it is not the intent of this section to claim rights or contest
++your rights to work written entirely by you; rather, the intent is to
++exercise the right to control the distribution of derivative or
++collective works based on the Program.
++
++In addition, mere aggregation of another work not based on the Program
++with the Program (or with a work based on the Program) on a volume of
++a storage or distribution medium does not bring the other work under
++the scope of this License.
++
++ 3. You may copy and distribute the Program (or a work based on it,
++under Section 2) in object code or executable form under the terms of
++Sections 1 and 2 above provided that you also do one of the following:
++
++ a) Accompany it with the complete corresponding machine-readable
++ source code, which must be distributed under the terms of Sections
++ 1 and 2 above on a medium customarily used for software interchange; or,
++
++ b) Accompany it with a written offer, valid for at least three
++ years, to give any third party, for a charge no more than your
++ cost of physically performing source distribution, a complete
++ machine-readable copy of the corresponding source code, to be
++ distributed under the terms of Sections 1 and 2 above on a medium
++ customarily used for software interchange; or,
++
++ c) Accompany it with the information you received as to the offer
++ to distribute corresponding source code. (This alternative is
++ allowed only for noncommercial distribution and only if you
++ received the program in object code or executable form with such
++ an offer, in accord with Subsection b above.)
++
++The source code for a work means the preferred form of the work for
++making modifications to it. For an executable work, complete source
++code means all the source code for all modules it contains, plus any
++associated interface definition files, plus the scripts used to
++control compilation and installation of the executable. However, as a
++special exception, the source code distributed need not include
++anything that is normally distributed (in either source or binary
++form) with the major components (compiler, kernel, and so on) of the
++operating system on which the executable runs, unless that component
++itself accompanies the executable.
++
++If distribution of executable or object code is made by offering
++access to copy from a designated place, then offering equivalent
++access to copy the source code from the same place counts as
++distribution of the source code, even though third parties are not
++compelled to copy the source along with the object code.
++
++ 4. You may not copy, modify, sublicense, or distribute the Program
++except as expressly provided under this License. Any attempt
++otherwise to copy, modify, sublicense or distribute the Program is
++void, and will automatically terminate your rights under this License.
++However, parties who have received copies, or rights, from you under
++this License will not have their licenses terminated so long as such
++parties remain in full compliance.
++
++ 5. You are not required to accept this License, since you have not
++signed it. However, nothing else grants you permission to modify or
++distribute the Program or its derivative works. These actions are
++prohibited by law if you do not accept this License. Therefore, by
++modifying or distributing the Program (or any work based on the
++Program), you indicate your acceptance of this License to do so, and
++all its terms and conditions for copying, distributing or modifying
++the Program or works based on it.
++
++ 6. Each time you redistribute the Program (or any work based on the
++Program), the recipient automatically receives a license from the
++original licensor to copy, distribute or modify the Program subject to
++these terms and conditions. You may not impose any further
++restrictions on the recipients' exercise of the rights granted herein.
++You are not responsible for enforcing compliance by third parties to
++this License.
++
++ 7. If, as a consequence of a court judgment or allegation of patent
++infringement or for any other reason (not limited to patent issues),
++conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License. If you cannot
++distribute so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you
++may not distribute the Program at all. For example, if a patent
++license would not permit royalty-free redistribution of the Program by
++all those who receive copies directly or indirectly through you, then
++the only way you could satisfy both it and this License would be to
++refrain entirely from distribution of the Program.
++
++If any portion of this section is held invalid or unenforceable under
++any particular circumstance, the balance of the section is intended to
++apply and the section as a whole is intended to apply in other
++circumstances.
++
++It is not the purpose of this section to induce you to infringe any
++patents or other property right claims or to contest validity of any
++such claims; this section has the sole purpose of protecting the
++integrity of the free software distribution system, which is
++implemented by public license practices. Many people have made
++generous contributions to the wide range of software distributed
++through that system in reliance on consistent application of that
++system; it is up to the author/donor to decide if he or she is willing
++to distribute software through any other system and a licensee cannot
++impose that choice.
++
++This section is intended to make thoroughly clear what is believed to
++be a consequence of the rest of this License.
++
++ 8. If the distribution and/or use of the Program is restricted in
++certain countries either by patents or by copyrighted interfaces, the
++original copyright holder who places the Program under this License
++may add an explicit geographical distribution limitation excluding
++those countries, so that distribution is permitted only in or among
++countries not thus excluded. In such case, this License incorporates
++the limitation as if written in the body of this License.
++
++ 9. The Free Software Foundation may publish revised and/or new versions
++of the General Public License from time to time. Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++Each version is given a distinguishing version number. If the Program
++specifies a version number of this License which applies to it and "any
++later version", you have the option of following the terms and conditions
++either of that version or of any later version published by the Free
++Software Foundation. If the Program does not specify a version number of
++this License, you may choose any version ever published by the Free Software
++Foundation.
++
++ 10. If you wish to incorporate parts of the Program into other free
++programs whose distribution conditions are different, write to the author
++to ask for permission. For software which is copyrighted by the Free
++Software Foundation, write to the Free Software Foundation; we sometimes
++make exceptions for this. Our decision will be guided by the two goals
++of preserving the free status of all derivatives of our free software and
++of promoting the sharing and reuse of software generally.
++
++ NO WARRANTY
++
++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
++REPAIR OR CORRECTION.
++
++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
++POSSIBILITY OF SUCH DAMAGES.
++
++ END OF TERMS AND CONDITIONS
++
++ How to Apply These Terms to Your New Programs
++
++ If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++ To do so, attach the following notices to the program. It is safest
++to attach them to the start of each source file to most effectively
++convey the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++ <one line to give the program's name and a brief idea of what it does.>
++ Copyright (C) <year> <name of author>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++
++
++Also add information on how to contact you by electronic and paper mail.
++
++If the program is interactive, make it output a short notice like this
++when it starts in an interactive mode:
++
++ Gnomovision version 69, Copyright (C) year name of author
++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++ This is free software, and you are welcome to redistribute it
++ under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License. Of course, the commands you use may
++be called something other than `show w' and `show c'; they could even be
++mouse-clicks or menu items--whatever suits your program.
++
++You should also get your employer (if you work as a programmer) or your
++school, if any, to sign a "copyright disclaimer" for the program, if
++necessary. Here is a sample; alter the names:
++
++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
++ `Gnomovision' (which makes passes at compilers) written by James Hacker.
++
++ <signature of Ty Coon>, 1 April 1989
++ Ty Coon, President of Vice
++
++This General Public License does not permit incorporating your program into
++proprietary programs. If your program is a subroutine library, you may
++consider it more useful to permit linking proprietary applications with the
++library. If this is what you want to do, use the GNU Library General
++Public License instead of this License.
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap-fw-load.patch b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap-fw-load.patch
new file mode 100644
index 000000000..050bdc113
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap-fw-load.patch
@@ -0,0 +1,22 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+Upstream-Status: Inappropriate [configuration]
+
+--- hostap-utils-0.2.4/hostap_fw_load~hostap-fw-load
++++ hostap-utils-0.2.4/hostap_fw_load
+@@ -6,9 +6,9 @@
+ # Firmware images for the card
+ # TODO: could try to select correct firmware type automatically
+
+-PRI=/etc/pcmcia/PM010102.HEX
+-STA=/etc/pcmcia/RF010802.HEX
+-PRISM2_SREC=/usr/local/bin/prism2_srec
++PRI=/etc/pcmcia/pm010102.hex
++STA=/etc/pcmcia/rf010804.hex
++PRISM2_SREC=/usr/sbin/prism2_srec
+
+ set -e
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf
new file mode 100644
index 000000000..8dda82aad
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf
@@ -0,0 +1,193 @@
+module "hostap_cs" opts "channel=3 iw_mode=2 essid=any ignore_cis_vcc=1"
+
+card "Actiontec 802CI2"
+ manfid 0x1668, 0x0101
+ bind "hostap_cs"
+
+card "AirWay 802.11 Adapter (PCMCIA)"
+ #version "AirWay", "802.11 Adapter (PCMCIA)"
+ manfid 0x0261, 0x0002
+ bind "hostap_cs"
+
+card "Asus SpaceLink WL110"
+ manfid 0x02aa,0x0002
+ bind "hostap_cs"
+
+## handhelds.org bug 964
+card "Belkin F5D6060 Ethernet"
+ #version "PCMCIA", "11M WLAN Card v2.5", "ISL37300P", "RevA"
+ manfid 0x0274, 0x1612
+ bind "hostap_cs"
+
+card "Compaq 11Mbps Wireless PC Card"
+ manfid 0x028a, 0x0002
+ bind "hostap_cs"
+
+card "Compaq WL100 11 Mbps Wireless Adapter"
+ manfid 0x0138, 0x0002
+ bind "hostap_cs"
+
+card "Compaq HNW-100 11 Mbps Wireless Adapter"
+ manfid 0x028a, 0x0002
+ bind "hostap_cs"
+
+card "D-Link DWL-650"
+ version "D", "Link DWL-650 11Mbps WLAN Card"
+ bind "hostap_cs"
+
+card "D-Link DRC-650"
+ version "D", "Link DRC-650 11Mbps WLAN Card"
+ bind "hostap_cs"
+
+card "D-Link DCF660"
+ manfid 0xd601, 0x0005
+ bind "hostap_cs"
+
+card "Farallon SkyLINE"
+ version "INTERSIL", "HFA384x/IEEE"
+ bind "hostap_cs"
+
+card "HyperLink Wireless PC Card 11Mbps"
+ version "HyperLink", "Wireless PC Card 11Mbps"
+ bind "hostap_cs"
+
+# card "Intersil PRISM2 11 Mbps Wireless Adapter"
+# manfid 0x0156, 0x0002
+# bind "hostap_cs"
+
+card "LA4111 Spectrum24 Wireless LAN PC Card"
+ version "Symbol Technologies"
+ bind "hostap_cs"
+
+card "Linksys WPC11 11Mbps 802.11b WLAN Card"
+ version "Instant Wireless ", " Network PC CARD", "Version 01.02"
+ bind "hostap_cs"
+
+card "Linksys WCF11 11Mbps 802.11b WLAN Card"
+ manfid 0x0274, 0x3301
+ bind "hostap_cs"
+
+## handhelds.org bug #790
+card "Linksys Wireless CompactFlash Card WCF12"
+ manfid 0x028a, 0x0673
+ bind "hostap_cs"
+
+card "Linksys WLAN CF Card"
+ manfid 0x0274, 0x3301
+ bind "hostap_cs"
+
+card "NETGEAR MA701 Wireless CF Card"
+ manfid 0xd601, 0x0002
+ bind "hostap_cs"
+
+card "Nortel Networks eMobility 802.11 Wireless Adapter"
+ manfid 0x01eb, 0x080a
+ bind "hostap_cs"
+
+card "PLANEX GeoWave GW-CF110"
+ version "PLANEX", "GeoWave/GW-CF110"
+ bind "hostap_cs"
+
+card "PROXIM LAN PC CARD HARMONY 80211B"
+ version "PROXIM", "LAN PC CARD HARMONY 80211B"
+ bind "hostap_cs"
+
+card "Proxim RangeLAN/DS"
+ version "PROXIM","RangeLAN-DS/LAN PC CARD"
+ manfid 0x0126, 0x8000
+ bind "hostap_cs"
+
+card "Safeway 802.11b Wireless Adapter"
+ manfid 0xd601, 0x0002
+ bind "hostap_cs"
+
+card "SAMSUNG 11Mbps WLAN Card"
+ version "SAMSUNG", "11Mbps WLAN Card"
+ bind "hostap_cs"
+
+# needs firmware upload via hostap_fw_load
+card "SanDisk ConnectPlus OEM (0MB)"
+ manfid 0xd601, 0x0010
+ bind "hostap_cs"
+
+# needs special activation (>=hostap 0.3.2 only) plus firmware upload
+card "SanDisk ConnectPlus w/ Memory"
+ version "SanDisk", "ConnectPlus"
+ manfid 0xd601, 0x0101
+ bind "hostap_cs" to 0
+# bind "ide-cs" to 1
+
+card "Senao/Origo 80211b WLAN Card"
+ manfid 0x000b,0x7100
+ bind "hostap_cs"
+
+card "Sitecom WL-007 WLAN CF Card"
+ manfid 0xd601, 0x0004
+ bind "hostap_cs"
+
+card "SMC2632 802.11 (prism2) Card"
+ version "SMC", "SMC2632W", "Version 01.02", ""
+ bind "hostap_cs"
+
+card "SpeedStream SS1021 Wireless Adapter"
+ #version "Siemens", "SpeedStream Wireless PCMCIA"
+ manfid 0x02ac, 0x0002
+ bind "hostap_cs"
+
+card "ZCOMAX AirRunner/XI-300"
+ #version "ZCOMAX", "AirRunner/XI-300"
+ manfid 0xd601, 0x0002
+ bind "hostap_cs"
+
+card "Zonet ZCF1100"
+ manfid 0x000b, 0x7100
+ bind "hostap_cs"
+
+card "Wireless LAN Adapter Version 01.02"
+ version "Wireless", "LAN Adapter", "Version 01.02"
+# manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Ambicom WL1100C 11Mbs Card 802.11b"
+ version "AmbiCom", "WL1100C 802.11b CF-Card", "2.2"
+ manfid 0xd601,0x0002
+ bind "hostap_cs"
+
+card "Ambicom WL1100C 11Mbs Card 802.11b"
+ manfid 0xd601,0x0002
+ bind "hostap_cs"
+
+card "Sandisk Connect SDWCFB-000"
+ manfid 0xd601,0x0005
+ bind "hostap_cs"
+
+# Cards with Intersil firmware (Prism chipset)
+
+card "Linksys WPC11 11Mbps 802.11b WLAN Card"
+ version "The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", "RevA"
+ bind "hostap_cs"
+
+card "Linksys CompactFlash Wireless Card"
+ version "Linksys", "Wireless CompactFlash Card"
+ bind "hostap_cs"
+
+card "ACTIONTEC PRISM Wireless LAN PC Card"
+ version "ACTIONTEC", "PRISM Wireless LAN PC Card"
+ bind "hostap_cs"
+
+card "Linksys WPC11 Version 3"
+ manfid 0x0274,0x1613
+ bind "hostap_cs"
+
+card "BENQ AWL100"
+ version "BENQ", "AWL100 PCMCIA ADAPTER"
+ bind "hostap_cs"
+
+card "Pretec WLAN"
+ version "Pretec", "CompactWLAN Card 802.11b", "2.5"
+ manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "TrendNet TEW PC16"
+ manfid 0x0274, 0x1601
+ bind "hostap_cs"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream
new file mode 100644
index 000000000..5b7385a7c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.conf-upstream
@@ -0,0 +1,191 @@
+device "hostap_cs"
+ class "network" module "hostap", "hostap_cs"
+
+card "Intersil PRISM2 Reference Design 11Mb/s WLAN Card"
+ version "INTERSIL", "HFA384x/IEEE"
+ bind "hostap_cs"
+
+card "Compaq WL100 11Mb/s WLAN Card"
+ manfid 0x0138, 0x0002
+ bind "hostap_cs"
+
+card "Compaq WL200"
+ version "Compaq", "WL200_11Mbps_Wireless_PCI_Card"
+ bind "hostap_cs"
+
+card "EMTAC A2424i 11Mbps WLAN Card"
+ manfid 0xc250, 0x0002
+# cis "cis/Emtac.dat"
+ bind "hostap_cs"
+
+card "Linksys WPC11 11Mbps WLAN Card"
+ version "Instant Wireless ", " Network PC CARD", "Version 01.02"
+ bind "hostap_cs"
+
+card "Linksys WPC11 Ver 2.5 11Mbps WLAN Card"
+ manfid 0x0274, 0x1612
+ bind "hostap_cs"
+
+card "Linksys WPC11 Ver 3 11Mbps WLAN Card"
+ manfid 0x0274, 0x1613
+ bind "hostap_cs"
+
+card "Linksys WCF12 Wireless CompactFlash Card"
+ version "Linksys", "Wireless CompactFlash Card"
+ bind "hostap_cs"
+
+card "D-Link DWL-650 11Mbps WLAN Card"
+ version "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02"
+ bind "hostap_cs"
+
+card "D-Link DRC-650 11Mbps WLAN Card"
+# version "D", "Link DRC-650 11Mbps WLAN Card", "Version 01.02"
+ manfid 0x028a, 0x0002
+ bind "hostap_cs"
+
+card "ZoomAir 4100 11Mb/s WLAN Card"
+ version "ZoomAir 11Mbps High", "Rate wireless Networking"
+ bind "hostap_cs"
+
+card "Addtron AWP-100 11Mbps WLAN Card"
+ version "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02"
+ bind "hostap_cs"
+
+card "Samsung SWL2000-N 11Mb/s WLAN Card"
+ manfid 0x0250, 0x0002
+ bind "hostap_cs"
+
+card "SMC 2632W 11Mbps WLAN Card"
+ version "SMC", "SMC2632W", "Version 01.02"
+ bind "hostap_cs"
+
+card "BroMax Freeport 11Mbps WLAN Card"
+ version "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA"
+ bind "hostap_cs"
+
+card "Z-Com XI300 11Mb/s WLAN Card"
+ manfid 0xd601, 0x0002
+ bind "hostap_cs"
+
+card "Zcomax XI-325H 200mW"
+# version " ", "IEEE 802.11 Wireless LAN/PC Card"
+ manfid 0xd601, 0x0005
+ bind "hostap_cs"
+
+card "3Com AirConnect PCI 777A"
+ manfid 0x0101, 0x0777
+ bind "hostap_cs"
+
+card "U.S. Robotics IEEE 802.11b PC-CARD"
+ version "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02"
+# manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Longshine LCR-8531 11Mbps WLAN PCMCIA CARD"
+ version "OEM", "PRISM2 IEEE 802.11 PC-Card", "Version 01.02"
+# manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Philips 802.11b WLAN PCMCIA"
+ manfid 0x000b, 0x7300
+ bind "hostap_cs"
+
+card "Proxim RangeLAN"
+# version "PROXIM", "RangeLAN-DS/LAN PC CARD"
+ manfid 0x0126, 0x8000
+ bind "hostap_cs"
+
+card "Buffalo WLI-CF-S11G"
+ version "BUFFALO", "WLI-CF-S11G"
+# manfid 0x026f, 0x030b
+ bind "hostap_cs"
+
+card "Level-One WPC-0100"
+ version "Digital Data Communications", "WPC-0100", "Version 00.00"
+ manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Belkin 802.11b WLAN PCMCIA"
+ version "Belkin", "11Mbps Wireless Notebook Network Adapter", "Version 01.02"
+ manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Senao SL-2011CD/SL-2011CDPLUS"
+ version "INTERSIL", "HFA384x/IEEE", "Version 01.02"
+ manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "Fulbond Airbond XI-300B"
+ version " ", "IEEE 802.11 Wireless LAN/PC Card"
+ manfid 0xd601, 0x0002
+ bind "hostap_cs"
+
+card "Netgear MA401"
+ version "NETGEAR MA401 Wireless PC", "Card", "Version 01.00"
+# manfid 0x0156, 0x0002
+ bind "hostap_cs"
+
+card "D-Link DWL-650 Rev. P1"
+ version "D-Link", "DWL-650 Wireless PC Card RevP", "ISL37101P-10", "A3"
+# manfid 0x000b, 0x7110
+ bind "hostap_cs"
+
+card "SonicWALL Long Range Wireless Card"
+ version "SonicWALL", "Long Range Wireless Card", "ISL37100P", "1.0"
+ manfid 0x000b, 0x7100
+ bind "hostap_cs"
+
+card "Senao NL-2011CD PLUS Ext2 Mercury"
+ version "WLAN", "11Mbps_PC-Card_3.0", "ISL37100P", "Eval-RevA"
+ manfid 0x000b, 0x7100
+ bind "hostap_cs"
+
+card "Airvast WL100"
+ version "AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863"
+ manfid 0x50c2, 0x0001
+ bind "hostap_cs"
+
+card "Microsoft Wireless Notebook Adapter MN-520 1.0.3"
+ version "Microsoft", "Wireless Notebook Adapter MN-520", "", "1.0.3"
+ manfid 0x02d2, 0x0001
+ bind "hostap_cs"
+
+card "NETGEAR MA401RA"
+ version "NETGEAR MA401RA Wireless PC", "Card", "ISL37300P", "Eval-RevA"
+ manfid 0x000b, 0x7300
+ bind "hostap_cs"
+
+card "Allied Telesyn AT-WCL452"
+ version "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", "Ver. 1.00"
+ manfid 0xc00f, 0x0000
+ bind "hostap_cs"
+
+card "corega WL PCCL-11"
+ version "corega", "WL PCCL-11", "ISL37300P", "RevA"
+ manfid 0xc00f, 0x0000
+ bind "hostap_cs"
+
+card "SanDisk ConnectPlus"
+ version "SanDisk", "ConnectPlus"
+ manfid 0xd601, 0x0101
+ bind "hostap_cs" to 0
+ bind "ide-cs" to 1
+
+card "ASUS WL-100 8011b WLAN PC Card"
+ version "ASUS", "802_11b_PC_CARD_25", "Version 01.00"
+ manfid 0x02aa, 0x0002
+ bind "hostap_cs"
+
+card "ZyXel Zyair B-101 802.11b WLAN card"
+ version " ", "IEEE 802.11 Wireless LAN/PC Card"
+ manfid 0xd601, 0x0010
+ bind "hostap_cs"
+
+card "WLAN PRISM PCMCIA CARD 37300P RevB6"
+ version "WLAN", "PRISM PCMCIA CARD", "37300P", "Revision B6"
+ manfid 0x50c2, 0x7300
+ bind "hostap_cs"
+
+
+# Optional configuration parameters for hostap_cs.o
+# module "hostap_cs" opts "channel=3 iw_mode=3 essid=test ignore_cis_vcc=0"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.modalias b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.modalias
new file mode 100644
index 000000000..284835151
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/files/hostap_cs.modalias
@@ -0,0 +1,28 @@
+# product info: "Pretec", "CompactWLAN Card 802.11b", "2.5"
+alias pcmcia:m0156c0002f06fn00pfn00pa1CADD3E5pbE697636Cpc7A5BFCF1pd00000000 hostap_cs
+
+# manufacturer ID which exist in orinoco_cs AND in hostap_cs
+alias pcmcia:m000Bc7100f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m000Bc7300f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m0126c8000f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m0138c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m0250c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m0274c1612f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m0274c1613f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m028Ac0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m02AAc0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:m50C2c7300f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:mD601c0002f06fn00pfn00pa*pb*pc*pd* hostap_cs
+alias pcmcia:mD601c0005f06fn00pfn00pa*pb*pc*pd* hostap_cs
+
+# product info: "Linksys", "Wireless CompactFlash Card", "", ""
+alias pcmcia:m028Ac0673f06fn00pfn00pa0733CC81pb0C52F395pc00000000pd00000000 hostap_cs
+
+# product info:"PLANEX COMMUNICATION INC","PLANEX GW-CF11X Wireless CF Card", "", ""
+alias pcmcia:mD601c0010f06fn00pfn00pa4703CF68pbFAD7318Dpc00000000pd00000000 hostap_cs
+
+# 0x0156, 0x0002 and "Version 01.02" only appear for Prism based cards.
+alias pcmcia:m0156c0002f06fn00pfn00pa*pb*pc4B74BAA0pd00000000 hostap_cs
+
+# "BUFFALO", "WLI-CF-S11G", "", ""
+alias pcmcia:m026Fc030Bf06fn00pfn00pa2DECECE3pb82067C18pc00000000pd00000000 hostap_cs
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-conf_1.0.bb b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-conf_1.0.bb
new file mode 100644
index 000000000..e1d4c5477
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-conf_1.0.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Configuration files for HostAP (wifi) driver"
+DESCRIPTION = "PCMCIA-cs configuration files for wireless LAN cards based on Intersil's Prism2/2.5/3 chipset."
+SECTION = "kernel/modules"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+PR = "r15"
+
+SRC_URI = "file://hostap_cs.modalias \
+ file://COPYING.patch"
+
+inherit allarch
+
+S = "${WORKDIR}"
+
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${sysconfdir}/modprobe.d
+
+ install -m 0644 ${WORKDIR}/hostap_cs.modalias ${D}${sysconfdir}/modprobe.d/hostap_cs.conf
+}
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/0001-Define-_u32-__s32-__u16-__s16-__u8-in-terms-of-c99-t.patch b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/0001-Define-_u32-__s32-__u16-__s16-__u8-in-terms-of-c99-t.patch
new file mode 100644
index 000000000..b44dca3ec
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/0001-Define-_u32-__s32-__u16-__s16-__u8-in-terms-of-c99-t.patch
@@ -0,0 +1,36 @@
+From 742fb110d9841a04b3ced256b0bf80ff304dcaff Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 31 Aug 2015 05:45:08 +0000
+Subject: [PATCH] Define _u32/__s32/__u16/__s16/__u8 in terms of c99 types
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ wireless_copy.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/wireless_copy.h b/wireless_copy.h
+index 8208258..1171a35 100644
+--- a/wireless_copy.h
++++ b/wireless_copy.h
+@@ -86,11 +86,11 @@
+ #else
+ #include <sys/types.h>
+ #include <net/if.h>
+-typedef __uint32_t __u32;
+-typedef __int32_t __s32;
+-typedef __uint16_t __u16;
+-typedef __int16_t __s16;
+-typedef __uint8_t __u8;
++typedef u_int32_t __u32;
++typedef int32_t __s32;
++typedef u_int16_t __u16;
++typedef int16_t __s16;
++typedef u_int8_t __u8;
+ #ifndef __user
+ #define __user
+ #endif /* __user */
+--
+2.5.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch
new file mode 100644
index 000000000..3e99d0d92
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils-0.4.7/ldflags.patch
@@ -0,0 +1,27 @@
+Obey LDFLAGS
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+Upstream-Status: Pending
+
+--- hostap-utils-0.4.7.orig/Makefile
++++ hostap-utils-0.4.7/Makefile
+@@ -14,17 +14,17 @@ prism2_srec.o: prism2_srec.c util.h
+ hostap_crypt_conf: hostap_crypt_conf.c
+
+ hostap_diag: hostap_diag.o util.o
+- $(CC) -o hostap_diag $(CFLAGS) hostap_diag.o util.o
++ $(CC) -o hostap_diag $(CFLAGS) $(LDFLAGS) hostap_diag.o util.o
+
+ hostap_diag.o: hostap_diag.c util.h
+
+ util.o: util.c util.h
+
+ hostap_io_debug: hostap_io_debug.c
+- $(CC) -o hostap_io_debug $(CFLAGS) hostap_io_debug.c
++ $(CC) -o hostap_io_debug $(CFLAGS) $(LDFLAGS) hostap_io_debug.c
+
+ hostap_rid: hostap_rid.o util.o
+- $(CC) -o hostap_rid $(CFLAGS) hostap_rid.o util.o
++ $(CC) -o hostap_rid $(CFLAGS) $(LDFLAGS) hostap_rid.o util.o
+
+ hostap_rid.o: hostap_rid.c util.h
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils.inc b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils.inc
new file mode 100644
index 000000000..140321d0c
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils.inc
@@ -0,0 +1,28 @@
+SUMMARY = "User mode helpers for the hostap driver"
+DESCRIPTION = "The hostap driver supports Host AP mode, it allows for IEEE 802.11 \
+management functions on the host computer and allows the system to act as an access point."
+HOMEPAGE = "http://hostap.epitest.fi"
+BUGTRACKER = "http://hostap.epitest.fi/bugz/"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
+ file://util.c;beginline=1;endline=9;md5=d3b9280851302e5ba34e5fb717489b6d"
+SECTION = "kernel/userland"
+PR = "r4"
+
+SRC_URI = "http://hostap.epitest.fi/releases/hostap-utils-${PV}.tar.gz \
+ file://hostap-fw-load.patch \
+ file://0001-Define-_u32-__s32-__u16-__s16-__u8-in-terms-of-c99-t.patch \
+"
+S = "${WORKDIR}/hostap-utils-${PV}"
+
+BINARIES = "hostap_crypt_conf hostap_diag hostap_fw_load hostap_io_debug \
+ hostap_rid prism2_param prism2_srec split_combined_hex"
+
+do_install() {
+ install -d ${D}${sbindir}/
+ for f in ${BINARIES}
+ do
+ install -m 0755 $f ${D}${sbindir}/
+ done
+}
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb
new file mode 100644
index 000000000..be5481f6f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/hostap/hostap-utils_0.4.7.bb
@@ -0,0 +1,5 @@
+require hostap-utils.inc
+
+SRC_URI += "file://ldflags.patch"
+SRC_URI[md5sum] = "afe041581b8f01666e353bec20917c85"
+SRC_URI[sha256sum] = "c6f598d8e356c1620fa009eca0a700bf1105e16817eefd77d891994261009355"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/GPLv2.patch b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/GPLv2.patch
new file mode 100644
index 000000000..1ee8181f1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/GPLv2.patch
@@ -0,0 +1,347 @@
+Upstream-Status: Inappropriate [licensing]
+
+diff --git a/COPYING b/COPYING
+new file mode 100644
+index 0000000..d511905
+--- /dev/null
++++ b/COPYING
+@@ -0,0 +1,339 @@
++ GNU GENERAL PUBLIC LICENSE
++ Version 2, June 1991
++
++ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++ Preamble
++
++ The licenses for most software are designed to take away your
++freedom to share and change it. By contrast, the GNU General Public
++License is intended to guarantee your freedom to share and change free
++software--to make sure the software is free for all its users. This
++General Public License applies to most of the Free Software
++Foundation's software and to any other program whose authors commit to
++using it. (Some other Free Software Foundation software is covered by
++the GNU Lesser General Public License instead.) You can apply it to
++your programs, too.
++
++ When we speak of free software, we are referring to freedom, not
++price. Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++this service if you wish), that you receive source code or can get it
++if you want it, that you can change the software or use pieces of it
++in new free programs; and that you know you can do these things.
++
++ To protect your rights, we need to make restrictions that forbid
++anyone to deny you these rights or to ask you to surrender the rights.
++These restrictions translate to certain responsibilities for you if you
++distribute copies of the software, or if you modify it.
++
++ For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must give the recipients all the rights that
++you have. You must make sure that they, too, receive or can get the
++source code. And you must show them these terms so they know their
++rights.
++
++ We protect your rights with two steps: (1) copyright the software, and
++(2) offer you this license which gives you legal permission to copy,
++distribute and/or modify the software.
++
++ Also, for each author's protection and ours, we want to make certain
++that everyone understands that there is no warranty for this free
++software. If the software is modified by someone else and passed on, we
++want its recipients to know that what they have is not the original, so
++that any problems introduced by others will not reflect on the original
++authors' reputations.
++
++ Finally, any free program is threatened constantly by software
++patents. We wish to avoid the danger that redistributors of a free
++program will individually obtain patent licenses, in effect making the
++program proprietary. To prevent this, we have made it clear that any
++patent must be licensed for everyone's free use or not licensed at all.
++
++ The precise terms and conditions for copying, distribution and
++modification follow.
++
++ GNU GENERAL PUBLIC LICENSE
++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
++
++ 0. This License applies to any program or other work which contains
++a notice placed by the copyright holder saying it may be distributed
++under the terms of this General Public License. The "Program", below,
++refers to any such program or work, and a "work based on the Program"
++means either the Program or any derivative work under copyright law:
++that is to say, a work containing the Program or a portion of it,
++either verbatim or with modifications and/or translated into another
++language. (Hereinafter, translation is included without limitation in
++the term "modification".) Each licensee is addressed as "you".
++
++Activities other than copying, distribution and modification are not
++covered by this License; they are outside its scope. The act of
++running the Program is not restricted, and the output from the Program
++is covered only if its contents constitute a work based on the
++Program (independent of having been made by running the Program).
++Whether that is true depends on what the Program does.
++
++ 1. You may copy and distribute verbatim copies of the Program's
++source code as you receive it, in any medium, provided that you
++conspicuously and appropriately publish on each copy an appropriate
++copyright notice and disclaimer of warranty; keep intact all the
++notices that refer to this License and to the absence of any warranty;
++and give any other recipients of the Program a copy of this License
++along with the Program.
++
++You may charge a fee for the physical act of transferring a copy, and
++you may at your option offer warranty protection in exchange for a fee.
++
++ 2. You may modify your copy or copies of the Program or any portion
++of it, thus forming a work based on the Program, and copy and
++distribute such modifications or work under the terms of Section 1
++above, provided that you also meet all of these conditions:
++
++ a) You must cause the modified files to carry prominent notices
++ stating that you changed the files and the date of any change.
++
++ b) You must cause any work that you distribute or publish, that in
++ whole or in part contains or is derived from the Program or any
++ part thereof, to be licensed as a whole at no charge to all third
++ parties under the terms of this License.
++
++ c) If the modified program normally reads commands interactively
++ when run, you must cause it, when started running for such
++ interactive use in the most ordinary way, to print or display an
++ announcement including an appropriate copyright notice and a
++ notice that there is no warranty (or else, saying that you provide
++ a warranty) and that users may redistribute the program under
++ these conditions, and telling the user how to view a copy of this
++ License. (Exception: if the Program itself is interactive but
++ does not normally print such an announcement, your work based on
++ the Program is not required to print an announcement.)
++
++These requirements apply to the modified work as a whole. If
++identifiable sections of that work are not derived from the Program,
++and can be reasonably considered independent and separate works in
++themselves, then this License, and its terms, do not apply to those
++sections when you distribute them as separate works. But when you
++distribute the same sections as part of a whole which is a work based
++on the Program, the distribution of the whole must be on the terms of
++this License, whose permissions for other licensees extend to the
++entire whole, and thus to each and every part regardless of who wrote it.
++
++Thus, it is not the intent of this section to claim rights or contest
++your rights to work written entirely by you; rather, the intent is to
++exercise the right to control the distribution of derivative or
++collective works based on the Program.
++
++In addition, mere aggregation of another work not based on the Program
++with the Program (or with a work based on the Program) on a volume of
++a storage or distribution medium does not bring the other work under
++the scope of this License.
++
++ 3. You may copy and distribute the Program (or a work based on it,
++under Section 2) in object code or executable form under the terms of
++Sections 1 and 2 above provided that you also do one of the following:
++
++ a) Accompany it with the complete corresponding machine-readable
++ source code, which must be distributed under the terms of Sections
++ 1 and 2 above on a medium customarily used for software interchange; or,
++
++ b) Accompany it with a written offer, valid for at least three
++ years, to give any third party, for a charge no more than your
++ cost of physically performing source distribution, a complete
++ machine-readable copy of the corresponding source code, to be
++ distributed under the terms of Sections 1 and 2 above on a medium
++ customarily used for software interchange; or,
++
++ c) Accompany it with the information you received as to the offer
++ to distribute corresponding source code. (This alternative is
++ allowed only for noncommercial distribution and only if you
++ received the program in object code or executable form with such
++ an offer, in accord with Subsection b above.)
++
++The source code for a work means the preferred form of the work for
++making modifications to it. For an executable work, complete source
++code means all the source code for all modules it contains, plus any
++associated interface definition files, plus the scripts used to
++control compilation and installation of the executable. However, as a
++special exception, the source code distributed need not include
++anything that is normally distributed (in either source or binary
++form) with the major components (compiler, kernel, and so on) of the
++operating system on which the executable runs, unless that component
++itself accompanies the executable.
++
++If distribution of executable or object code is made by offering
++access to copy from a designated place, then offering equivalent
++access to copy the source code from the same place counts as
++distribution of the source code, even though third parties are not
++compelled to copy the source along with the object code.
++
++ 4. You may not copy, modify, sublicense, or distribute the Program
++except as expressly provided under this License. Any attempt
++otherwise to copy, modify, sublicense or distribute the Program is
++void, and will automatically terminate your rights under this License.
++However, parties who have received copies, or rights, from you under
++this License will not have their licenses terminated so long as such
++parties remain in full compliance.
++
++ 5. You are not required to accept this License, since you have not
++signed it. However, nothing else grants you permission to modify or
++distribute the Program or its derivative works. These actions are
++prohibited by law if you do not accept this License. Therefore, by
++modifying or distributing the Program (or any work based on the
++Program), you indicate your acceptance of this License to do so, and
++all its terms and conditions for copying, distributing or modifying
++the Program or works based on it.
++
++ 6. Each time you redistribute the Program (or any work based on the
++Program), the recipient automatically receives a license from the
++original licensor to copy, distribute or modify the Program subject to
++these terms and conditions. You may not impose any further
++restrictions on the recipients' exercise of the rights granted herein.
++You are not responsible for enforcing compliance by third parties to
++this License.
++
++ 7. If, as a consequence of a court judgment or allegation of patent
++infringement or for any other reason (not limited to patent issues),
++conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License. If you cannot
++distribute so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you
++may not distribute the Program at all. For example, if a patent
++license would not permit royalty-free redistribution of the Program by
++all those who receive copies directly or indirectly through you, then
++the only way you could satisfy both it and this License would be to
++refrain entirely from distribution of the Program.
++
++If any portion of this section is held invalid or unenforceable under
++any particular circumstance, the balance of the section is intended to
++apply and the section as a whole is intended to apply in other
++circumstances.
++
++It is not the purpose of this section to induce you to infringe any
++patents or other property right claims or to contest validity of any
++such claims; this section has the sole purpose of protecting the
++integrity of the free software distribution system, which is
++implemented by public license practices. Many people have made
++generous contributions to the wide range of software distributed
++through that system in reliance on consistent application of that
++system; it is up to the author/donor to decide if he or she is willing
++to distribute software through any other system and a licensee cannot
++impose that choice.
++
++This section is intended to make thoroughly clear what is believed to
++be a consequence of the rest of this License.
++
++ 8. If the distribution and/or use of the Program is restricted in
++certain countries either by patents or by copyrighted interfaces, the
++original copyright holder who places the Program under this License
++may add an explicit geographical distribution limitation excluding
++those countries, so that distribution is permitted only in or among
++countries not thus excluded. In such case, this License incorporates
++the limitation as if written in the body of this License.
++
++ 9. The Free Software Foundation may publish revised and/or new versions
++of the General Public License from time to time. Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++Each version is given a distinguishing version number. If the Program
++specifies a version number of this License which applies to it and "any
++later version", you have the option of following the terms and conditions
++either of that version or of any later version published by the Free
++Software Foundation. If the Program does not specify a version number of
++this License, you may choose any version ever published by the Free Software
++Foundation.
++
++ 10. If you wish to incorporate parts of the Program into other free
++programs whose distribution conditions are different, write to the author
++to ask for permission. For software which is copyrighted by the Free
++Software Foundation, write to the Free Software Foundation; we sometimes
++make exceptions for this. Our decision will be guided by the two goals
++of preserving the free status of all derivatives of our free software and
++of promoting the sharing and reuse of software generally.
++
++ NO WARRANTY
++
++ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
++REPAIR OR CORRECTION.
++
++ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
++POSSIBILITY OF SUCH DAMAGES.
++
++ END OF TERMS AND CONDITIONS
++
++ How to Apply These Terms to Your New Programs
++
++ If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++ To do so, attach the following notices to the program. It is safest
++to attach them to the start of each source file to most effectively
++convey the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++ <one line to give the program's name and a brief idea of what it does.>
++ Copyright (C) <year> <name of author>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++
++Also add information on how to contact you by electronic and paper mail.
++
++If the program is interactive, make it output a short notice like this
++when it starts in an interactive mode:
++
++ Gnomovision version 69, Copyright (C) year name of author
++ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++ This is free software, and you are welcome to redistribute it
++ under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License. Of course, the commands you use may
++be called something other than `show w' and `show c'; they could even be
++mouse-clicks or menu items--whatever suits your program.
++
++You should also get your employer (if you work as a programmer) or your
++school, if any, to sign a "copyright disclaimer" for the program, if
++necessary. Here is a sample; alter the names:
++
++ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
++ `Gnomovision' (which makes passes at compilers) written by James Hacker.
++
++ <signature of Ty Coon>, 1 April 1989
++ Ty Coon, President of Vice
++
++This General Public License does not permit incorporating your program into
++proprietary programs. If your program is a subroutine library, you may
++consider it more useful to permit linking proprietary applications with the
++library. If this is what you want to do, use the GNU Lesser General
++Public License instead of this License.
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/keymap.sh b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/keymap.sh
new file mode 100755
index 000000000..6ebc63426
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/files/keymap.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# load keymap, if existing
+
+KERNEL_MAJMIN=`uname -r | cut -d '.' -f 1,2`
+if [ -e /etc/keymap-$KERNEL_MAJMIN.map ]; then
+ loadkeys /etc/keymap-$KERNEL_MAJMIN.map
+fi
+
+if ( ls "/etc" | grep -q "keymap-extension-${KERNEL_MAJMIN}" )
+then
+ for extension in `ls -1 /etc/keymap-extension-$KERNEL_MAJMIN*`
+ do
+ loadkeys "$extension"
+ done
+fi
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/keymaps/keymaps_1.0.bb b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/keymaps_1.0.bb
new file mode 100644
index 000000000..5793a7652
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/keymaps/keymaps_1.0.bb
@@ -0,0 +1,50 @@
+SUMMARY = "Keyboard maps"
+DESCRIPTION = "Keymaps and initscript to set the keymap on bootup."
+SECTION = "base"
+
+RDEPENDS_${PN} = "kbd"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+PR = "r31"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
+# manually to avoid unnecessary postinst/preinst generated.
+python __anonymous() {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
+inherit update-rc.d
+
+SRC_URI = "file://keymap.sh \
+ file://GPLv2.patch"
+
+INITSCRIPT_NAME = "keymap.sh"
+INITSCRIPT_PARAMS = "start 01 S ."
+
+S = "${WORKDIR}"
+
+do_install () {
+ # Only install the script if 'sysvinit' is in DISTRO_FEATURES
+ # THe ulitity this script provides could be achieved by systemd-vconsole-setup.service
+ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ install -d ${D}${sysconfdir}/init.d/
+ install -m 0755 ${WORKDIR}/keymap.sh ${D}${sysconfdir}/init.d/
+ fi
+}
+
+DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+pkg_postinst_${PN} () {
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
+ if [ -n "$D" ]; then
+ OPTS="--root=$D"
+ fi
+ systemctl $OPTS mask keymap.service
+ fi
+}
+
+ALLOW_EMPTY_${PN} = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/ldflags.patch b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/ldflags.patch
new file mode 100644
index 000000000..a7424c39d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/ldflags.patch
@@ -0,0 +1,41 @@
+libacpi: Remove QA warning: No GNU_HASH in the elf binary
+
+Upstream-Status: Inappropriate [other]
+ Useful within bitbake environment only.
+
+Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
+
+---
+ Makefile | 3 ++-
+ config.mk | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+--- libacpi-0.2.orig/Makefile
++++ libacpi-0.2/Makefile
+@@ -19,6 +19,7 @@ options:
+ @echo "CFLAGS = ${CFLAGS}"
+ @echo "CC = ${CC}"
+ @echo "SOFLAGS = ${SOFLAGS}"
++ @echo "LDFLAGS = ${LDFLAGS}"
+ @echo "LD = ${LD}"
+
+ .c.o:
+@@ -34,7 +35,7 @@ libacpi.a: ${OBJ}
+
+ libacpi.so: ${OBJ}
+ @echo LD $@
+- @${CC} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
++ @${CC} ${SOFLAGS} ${LDFLAGS} -o $@.${SOVERSION} ${OBJ}
+
+ test-libacpi: ${OBJ_test}
+ @echo LD $@
+--- libacpi-0.2.orig/config.mk
++++ libacpi-0.2/config.mk
+@@ -10,6 +10,7 @@ MANPREFIX = ${PREFIX}/share/man
+ SOFLAGS = -shared -Wl,-soname,${SONAME}
+ CFLAGS += -fPIC -g --pedantic -Wall -Wextra
+ ARFLAGS = cr
++LDFLAGS =
+
+ # Compiler and linker
+ CC = cc
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch
new file mode 100644
index 000000000..2fed344ba
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/libacpi_fix_for_x32.patch
@@ -0,0 +1,47 @@
+Upstream-Status: Pending
+
+Fix libacpi for x32
+
+ libacpi doesn't use base_libdir for install. This patch adds
+ base_libdir support so that x32 libraries are installed properly.
+
+Patch Received from: H.J. Lu <hjl.tools@gmail.com>
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/05
+
+Index: libacpi-0.2/Makefile
+===================================================================
+--- libacpi-0.2.orig/Makefile
++++ libacpi-0.2/Makefile
+@@ -8,6 +8,10 @@ SRC_test = test-libacpi.c libacpi.c list
+ OBJ = ${SRC:.c=.o}
+ OBJ_test = ${SRC_test:.c=.o}
+
++ifndef base_libdir
++base_libdir=/lib
++endif
++
+ all: options libacpi.a libacpi.so test-libacpi
+
+ options:
+@@ -42,13 +46,13 @@ install: all
+ @mkdir -p ${DESTDIR}${PREFIX}/include
+ @cp -f libacpi.h ${DESTDIR}${PREFIX}/include
+ @chmod 644 ${DESTDIR}${PREFIX}/include/libacpi.h
+- @echo installing library to ${DESTDIR}${PREFIX}/lib
+- @mkdir -p ${DESTDIR}${PREFIX}/lib
+- @cp -f libacpi.a ${DESTDIR}${PREFIX}/lib
+- @chmod 644 ${DESTDIR}${PREFIX}/lib/libacpi.a
+- @cp -f ${SONAME} ${DESTDIR}${PREFIX}/lib/
+- @chmod 644 ${DESTDIR}${PREFIX}/lib/${SONAME}
+- @ln -s ${SONAME} ${DESTDIR}${PREFIX}/lib/libacpi.so
++ @echo installing library to ${DESTDIR}${PREFIX}${base_libdir}
++ @mkdir -p ${DESTDIR}${PREFIX}${base_libdir}
++ @cp -f libacpi.a ${DESTDIR}${PREFIX}${base_libdir}
++ @chmod 644 ${DESTDIR}${PREFIX}${base_libdir}/libacpi.a
++ @cp -f ${SONAME} ${DESTDIR}${PREFIX}${base_libdir}/
++ @chmod 644 ${DESTDIR}${PREFIX}${base_libdir}/${SONAME}
++ @ln -s ${SONAME} ${DESTDIR}${PREFIX}${base_libdir}/libacpi.so
+ @echo installing test-libacpi to ${DESTDIR}${PREFIX}/bin
+ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ @cp -f test-libacpi ${DESTDIR}${PREFIX}/bin
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/makefile-fix.patch b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/makefile-fix.patch
new file mode 100644
index 000000000..c34ef34e0
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/makefile-fix.patch
@@ -0,0 +1,47 @@
+Upstream-Status: Pending
+
+---
+ Makefile | 6 +++---
+ config.mk | 3 ++-
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+Index: libacpi-0.2/Makefile
+===================================================================
+--- libacpi-0.2.orig/Makefile 2007-07-29 14:09:34.000000000 +0200
++++ libacpi-0.2/Makefile 2008-09-26 10:34:53.000000000 +0200
+@@ -25,16 +25,16 @@ ${OBJ}: config.mk libacpi.h
+
+ libacpi.a: ${OBJ}
+ @echo AR $@
+- @${AR} $@ ${OBJ}
++ ${AR} ${ARFLAGS} $@ ${OBJ}
+ @${RANLIB} $@
+
+ libacpi.so: ${OBJ}
+ @echo LD $@
+- @${LD} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
++ @${CC} ${SOFLAGS} -o $@.${SOVERSION} ${OBJ}
+
+ test-libacpi: ${OBJ_test}
+ @echo LD $@
+- @${LD} -o $@ ${OBJ_test} ${LDFLAGS}
++ @${CC} -o $@ ${OBJ_test} ${LDFLAGS}
+ @strip $@
+
+ install: all
+Index: libacpi-0.2/config.mk
+===================================================================
+--- libacpi-0.2.orig/config.mk 2007-07-29 14:09:34.000000000 +0200
++++ libacpi-0.2/config.mk 2008-09-26 10:34:33.000000000 +0200
+@@ -9,9 +9,10 @@ MANPREFIX = ${PREFIX}/share/man
+ # flags
+ SOFLAGS = -shared -Wl,-soname,${SONAME}
+ CFLAGS += -fPIC -g --pedantic -Wall -Wextra
++ARFLAGS = cr
+
+ # Compiler and linker
+ CC = cc
+ LD = ${CC}
+-AR = ar cr
++AR = ar
+ RANLIB = ranlib
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch
new file mode 100644
index 000000000..bca75fb47
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/files/use_correct_strip_in_cross_environment.patch
@@ -0,0 +1,23 @@
+Upstream-Status: Pending
+
+Used the cross strip instead of host strip to avoid this build error:
+
+| strip: Unable to recognise the format of the input file `test-libacpi'
+| make: *** [test-libacpi] Error 1
+| ERROR: oe_runmake failed
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/07
+
+Index: libacpi-0.2/Makefile
+===================================================================
+--- libacpi-0.2.orig/Makefile
++++ libacpi-0.2/Makefile
+@@ -39,7 +39,7 @@ libacpi.so: ${OBJ}
+ test-libacpi: ${OBJ_test}
+ @echo LD $@
+ @${CC} -o $@ ${OBJ_test} ${LDFLAGS}
+- @strip $@
++ @${STRIP} $@
+
+ install: all
+ @echo installing header to ${DESTDIR}${PREFIX}/include
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/libacpi/libacpi_0.2.bb b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/libacpi_0.2.bb
new file mode 100644
index 000000000..6dc66ea25
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/libacpi/libacpi_0.2.bb
@@ -0,0 +1,32 @@
+SUMMARY = "ACPI data gathering library"
+DESCRIPTION = "General purpose shared library for programs gathering ACPI data on Linux. \
+Thermal zones, battery infomration, fan information and AC states are implemented."
+SECTION = "base"
+HOMEPAGE = "http://www.ngolde.de/libacpi.html"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=fec17f82f16630adf2dfb7d2a46f21c5"
+PR = "r6"
+
+SRC_URI = "http://www.ngolde.de/download/libacpi-${PV}.tar.gz \
+ file://makefile-fix.patch \
+ file://libacpi_fix_for_x32.patch \
+ file://use_correct_strip_in_cross_environment.patch \
+ file://ldflags.patch "
+
+SRC_URI[md5sum] = "05b53dd7bead66dda35fec502b91066c"
+SRC_URI[sha256sum] = "13086e31d428b9c125954d48ac497b754bbbce2ef34ea29ecd903e82e25bad29"
+
+UPSTREAM_CHECK_URI = "http://www.ngolde.de/libacpi.html"
+
+inherit lib_package
+
+COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)'
+
+CFLAGS += "-fPIC"
+EXTRA_OEMAKE = '-e MAKEFLAGS= STRIP="echo"'
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+do_install() {
+ oe_runmake install DESTDIR=${D} PREFIX=${exec_prefix}
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch
new file mode 100644
index 000000000..682cf416e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/acdefine.patch
@@ -0,0 +1,19 @@
+Add a description to the AC_DEFINE for LOCALEDIR so that it appears in config.h
+and silences a fatal warning.
+
+Upstream-Status:Pending
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/configure.in b/configure.in
+index c10460c..aa20263 100644
+--- a/configure.in
++++ b/configure.in
+@@ -258,7 +258,7 @@ AC_SUBST(LIBS)
+
+ AM_GNU_GETTEXT
+
+-AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
++AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME",[locale directory])
+
+ AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile m4/Makefile \
+ man/Makefile po/Makefile.in src/Makefile debian/rules Specfile systype \
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch
new file mode 100644
index 000000000..394519855
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/autotools.patch
@@ -0,0 +1,39 @@
+Upstream-Status: Inappropriate [configuration]
+
+--- lrzsz-0.12.20/acinclude.m4~autotools 1998-12-27 17:08:59.000000000 -0500
++++ lrzsz-0.12.20/acinclude.m4 2004-05-09 22:26:19.000000000 -0400
+@@ -1,12 +1,11 @@
+ dnl AC_REPLACE_GNU_GETOPT
+-AC_DEFUN(AC_REPLACE_GNU_GETOPT,
+-[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
+-AC_SUBST(LIBOBJS)dnl
+-])
++AC_DEFUN([AC_REPLACE_GNU_GETOPT],
++[AC_CHECK_FUNC(getopt_long, , [AC_LIBOBJ([getopt1])
++AC_LIBOBJ([getopt])dnl])])
+
+ dnl
+ dnl taken from taylor uucp
+-AC_DEFUN(LRZSZ_ERRNO_DECL,[
++AC_DEFUN([LRZSZ_ERRNO_DECL],[
+ AC_MSG_CHECKING(for errno declaration)
+ AC_CACHE_VAL(lrzsz_cv_decl_errno,
+ [AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
+@@ -23,7 +21,7 @@
+ ])
+
+ dnl LRZSZ_TYPE_SPEED_T
+-AC_DEFUN(LRZSZ_TYPE_SPEED_T,[
++AC_DEFUN([LRZSZ_TYPE_SPEED_T],[
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([LRZSZ_HEADERS_TERM_IO])dnl
+ AC_MSG_CHECKING(for speed_t)
+@@ -61,7 +59,7 @@
+ fi
+ ])
+
+-AC_DEFUN(lrzsz_HEADER_SYS_SELECT,
++AC_DEFUN([lrzsz_HEADER_SYS_SELECT],
+ [AC_CACHE_CHECK([whether sys/time.h and sys/select.h may both be included],
+ lrzsz_cv_header_sys_select,
+ [AC_TRY_COMPILE([#include <sys/types.h>
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch
new file mode 100644
index 000000000..1a24a1f05
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/gettext.patch
@@ -0,0 +1,21884 @@
+Upstream-Status: Inappropriate [configuration]
+
+--- lrzsz-0.12.20.safe/ABOUT-NLS 1998-04-26 09:22:30.000000000 -0400
++++ lrzsz-0.12.20/ABOUT-NLS 2004-09-12 14:40:34.323752952 -0400
+@@ -1,14 +1,14 @@
+ Notes on the Free Translation Project
+ *************************************
+
+- Free software is going international! The Free Translation Project
+-is a way to get maintainers of free software, translators, and users all
++Free software is going international! The Free Translation Project is
++a way to get maintainers of free software, translators, and users all
+ together, so that will gradually become able to speak many languages.
+ A few packages already provide translations for their messages.
+
+ If you found this `ABOUT-NLS' file inside a distribution, you may
+ assume that the distributed package does use GNU `gettext' internally,
+-itself available at your nearest GNU archive site. But you do *not*
++itself available at your nearest GNU archive site. But you do _not_
+ need to install GNU `gettext' prior to configuring, installing or using
+ this package with messages translated.
+
+@@ -22,10 +22,10 @@
+ `gettext' which is used. The information can be found in the
+ `intl/VERSION' file, in internationalized packages.
+
+-One advise in advance
+-=====================
++Quick configuration advice
++==========================
+
+- If you want to exploit the full power of internationalization, you
++If you want to exploit the full power of internationalization, you
+ should configure it using
+
+ ./configure --with-included-gettext
+@@ -34,42 +34,40 @@
+ package, despite the existence of internationalizing capabilities in the
+ operating system where this package is being installed. So far, only
+ the `gettext' implementation in the GNU C library version 2 provides as
+-many features (such as locale alias or message inheritance) as the
+-implementation here. It is also not possible to offer this additional
+-functionality on top of a `catgets' implementation. Future versions of
+-GNU `gettext' will very likely convey even more functionality. So it
+-might be a good idea to change to GNU `gettext' as soon as possible.
++many features (such as locale alias, message inheritance, automatic
++charset conversion or plural form handling) as the implementation here.
++It is also not possible to offer this additional functionality on top
++of a `catgets' implementation. Future versions of GNU `gettext' will
++very likely convey even more functionality. So it might be a good idea
++to change to GNU `gettext' as soon as possible.
+
+- So you need not provide this option if you are using GNU libc 2 or
++ So you need _not_ provide this option if you are using GNU libc 2 or
+ you have installed a recent copy of the GNU gettext package with the
+ included `libintl'.
+
+ INSTALL Matters
+ ===============
+
+- Some packages are "localizable" when properly installed; the
+-programs they contain can be made to speak your own native language.
+-Most such packages use GNU `gettext'. Other packages have their own
+-ways to internationalization, predating GNU `gettext'.
++Some packages are "localizable" when properly installed; the programs
++they contain can be made to speak your own native language. Most such
++packages use GNU `gettext'. Other packages have their own ways to
++internationalization, predating GNU `gettext'.
+
+ By default, this package will be installed to allow translation of
+-messages. It will automatically detect whether the system provides
+-usable `catgets' (if using this is selected by the installer) or
+-`gettext' functions. If neither is available, the GNU `gettext' own
++messages. It will automatically detect whether the system already
++provides the GNU `gettext' functions. If not, the GNU `gettext' own
+ library will be used. This library is wholly contained within this
+ package, usually in the `intl/' subdirectory, so prior installation of
+-the GNU `gettext' package is *not* required. Installers may use
++the GNU `gettext' package is _not_ required. Installers may use
+ special options at configuration time for changing the default
+ behaviour. The commands:
+
+ ./configure --with-included-gettext
+- ./configure --with-catgets
+ ./configure --disable-nls
+
+-will respectively bypass any pre-existing `catgets' or `gettext' to use
+-the internationalizing routines provided within this package, enable
+-the use of the `catgets' functions (if found on the locale system), or
+-else, *totally* disable translation of messages.
++will respectively bypass any pre-existing `gettext' to use the
++internationalizing routines provided within this package, or else,
++_totally_ disable translation of messages.
+
+ When you already have GNU `gettext' installed on your system and run
+ configure without an option for your new package, `configure' will
+@@ -83,18 +81,10 @@
+
+ to prevent auto-detection.
+
+- By default the configuration process will not test for the `catgets'
+-function and therefore they will not be used. The reasons are already
+-given above: the emulation on top of `catgets' cannot provide all the
+-extensions provided by the GNU `gettext' library. If you nevertheless
+-want to use the `catgets' functions use
+-
+- ./configure --with-catgets
+-
+-to enable the test for `catgets' (this causes no harm if `catgets' is
+-not available on your system). If you really select this option we
+-would like to hear about the reasons because we cannot think of any
+-good one ourself.
++ The configuration process will not test for the `catgets' function
++and therefore it will not be used. The reason is that even an
++emulation of `gettext' on top of `catgets' could not provide all the
++extensions of the GNU `gettext' library.
+
+ Internationalized packages have usually many `po/LL.po' files, where
+ LL gives an ISO 639 two-letter code identifying the language. Unless
+@@ -108,57 +98,73 @@
+ Using This Package
+ ==================
+
+- As a user, if your language has been installed for this package, you
++As a user, if your language has been installed for this package, you
+ only have to set the `LANG' environment variable to the appropriate
+-ISO 639 `LL' two-letter code prior to using the programs in the
+-package. For example, let's suppose that you speak German. At the
+-shell prompt, merely execute `setenv LANG de' (in `csh'),
+-`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
+-can be done from your `.login' or `.profile' file, once and for all.
++`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
++and `CC' is an ISO 3166 two-letter country code. For example, let's
++suppose that you speak German and live in Germany. At the shell
++prompt, merely execute `setenv LANG de_DE' (in `csh'),
++`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
++This can be done from your `.login' or `.profile' file, once and for
++all.
+
+- An operating system might already offer message localization for
+-many of its programs, while other programs have been installed locally
+-with the full capabilities of GNU `gettext'. Just using `gettext'
+-extended syntax for `LANG' would break proper localization of already
+-available operating system programs. In this case, users should set
+-both `LANGUAGE' and `LANG' variables in their environment, as programs
+-using GNU `gettext' give preference to `LANGUAGE'. For example, some
+-Swedish users would rather read translations in German than English for
+-when Swedish is not available. This is easily accomplished by setting
+-`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
++ You might think that the country code specification is redundant.
++But in fact, some languages have dialects in different countries. For
++example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
++country code serves to distinguish the dialects.
++
++ The locale naming convention of `LL_CC', with `LL' denoting the
++language and `CC' denoting the country, is the one use on systems based
++on GNU libc. On other systems, some variations of this scheme are
++used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
++locales supported by your system for your country by running the command
++`locale -a | grep '^LL''.
++
++ Not all programs have translations for all languages. By default, an
++English message is shown in place of a nonexistent translation. If you
++understand other languages, you can set up a priority list of languages.
++This is done through a different environment variable, called
++`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
++for the purpose of message handling, but you still need to have `LANG'
++set to the primary language; this is required by other parts of the
++system libraries. For example, some Swedish users who would rather
++read translations in German than English for when Swedish is not
++available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
++
++ Special advice for Norwegian users: The language code for Norwegian
++bokma*l changed from `no' to `nb' recently (in 2003). During the
++transition period, while some message catalogs for this language are
++installed under `nb' and some older ones under `no', it's recommended
++for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
++older translations are used.
++
++ In the `LANGUAGE' environment variable, but not in the `LANG'
++environment variable, `LL_CC' combinations can be abbreviated as `LL'
++to denote the language's main dialect. For example, `de' is equivalent
++to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
++(Portuguese as spoken in Portugal) in this context.
+
+ Translating Teams
+ =================
+
+- For the Free Translation Project to be a success, we need interested
++For the Free Translation Project to be a success, we need interested
+ people who like their own language and write it well, and who are also
+ able to synergize with other translators speaking the same language.
+-Each translation team has its own mailing list, courtesy of Linux
+-International. You may reach your translation team at the address
+-`LL@li.org', replacing LL by the two-letter ISO 639 code for your
+-language. Language codes are *not* the same as the country codes given
+-in ISO 3166. The following translation teams exist, as of August 1997:
+-
+- Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
+- Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
+- `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
+- Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
+- `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
+- Swedish `sv', and Turkish `tr'.
+-
+-For example, you may reach the Chinese translation team by writing to
+-`zh@li.org'.
++Each translation team has its own mailing list. The up-to-date list of
++teams can be found at the Free Translation Project's homepage,
++`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
++area.
+
+- If you'd like to volunteer to *work* at translating messages, you
++ If you'd like to volunteer to _work_ at translating messages, you
+ should become a member of the translating team for your own language.
+-The subscribing address is *not* the same as the list itself, it has
++The subscribing address is _not_ the same as the list itself, it has
+ `-request' appended. For example, speakers of Swedish can send a
+ message to `sv-request@li.org', having this message body:
+
+ subscribe
+
+ Keep in mind that team members are expected to participate
+-*actively* in translations, or at solving translational difficulties,
++_actively_ in translations, or at solving translational difficulties,
+ rather than merely lurking around. If your team does not exist yet and
+ you want to start one, or if you are unsure about what to do or how to
+ get started, please write to `translation@iro.umontreal.ca' to reach the
+@@ -171,43 +177,559 @@
+ Available Packages
+ ==================
+
+- Languages are not equally supported in all packages. The following
+-matrix shows the current state of internationalization, as of August
+-1997. The matrix shows, in regard of each package, for which languages
+-PO files have been submitted to translation coordination.
++Languages are not equally supported in all packages. The following
++matrix shows the current state of internationalization, as of January
++2004. The matrix shows, in regard of each package, for which languages
++PO files have been submitted to translation coordination, with a
++translation percentage of at least 50%.
+
+- Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv
+- .-------------------------------------------------.
+- bash | [] [] [] | 3
+- bison | [] [] [] | 3
+- clisp | [] [] [] [] | 4
+- cpio | [] [] [] [] [] | 5
+- diffutils | [] [] [] [] [] | 5
+- enscript | [] [] [] [] [] [] | 6
+- fileutils | [] [] [] [] [] [] [] [] [] [] | 10
+- findutils | [] [] [] [] [] [] [] [] | 8
+- flex | [] [] [] [] | 4
+- gcal | [] [] [] [] [] | 5
+- gettext | [] [] [] [] [] [] [] [] [] [] | 11
+- grep | [] [] [] [] [] [] [] [] [] | 9
+- hello | [] [] [] [] [] [] [] [] [] [] | 10
+- id-utils | [] [] [] | 3
+- indent | [] [] [] [] | 4
+- libc | [] [] [] [] [] [] [] | 7
+- m4 | [] [] [] [] [] | 5
+- make | [] [] [] [] [] [] | 6
+- music | [] [] | 2
+- ptx | [] [] [] [] [] [] [] [] | 8
+- recode | [] [] [] [] [] [] [] [] [] | 9
+- sh-utils | [] [] [] [] [] [] [] | 7
+- sharutils | [] [] [] [] [] | 5
+- tar | [] [] [] [] [] [] [] [] [] [] | 10
+- texinfo | [] | 1
+- textutils | [] [] [] [] [] [] [] [] [] | 9
+- wdiff | [] [] [] [] [] [] [] [] | 8
+- `-------------------------------------------------'
+- 16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv
+- 27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167
++ Ready PO files af am ar az be bg bs ca cs da de el en en_GB eo es
++ +----------------------------------------------------+
++ a2ps | [] [] [] [] |
++ aegis | () |
++ ant-phone | () |
++ anubis | |
++ ap-utils | |
++ aspell | [] |
++ bash | [] [] [] [] |
++ batchelor | |
++ bfd | [] [] |
++ binutils | [] [] |
++ bison | [] [] [] |
++ bluez-pin | [] [] [] |
++ clisp | |
++ clisp | [] [] [] |
++ console-tools | [] [] |
++ coreutils | [] [] [] [] |
++ cpio | [] [] [] |
++ darkstat | [] () [] |
++ diffutils | [] [] [] [] [] [] [] |
++ e2fsprogs | [] [] [] |
++ enscript | [] [] [] [] |
++ error | [] [] [] [] [] |
++ fetchmail | [] () [] [] [] [] |
++ fileutils | [] [] [] |
++ findutils | [] [] [] [] [] [] [] |
++ flex | [] [] [] [] |
++ fslint | |
++ gas | [] |
++ gawk | [] [] [] [] |
++ gbiff | [] |
++ gcal | [] |
++ gcc | [] [] |
++ gettext | [] [] [] [] [] |
++ gettext-examples | [] [] [] [] |
++ gettext-runtime | [] [] [] [] [] |
++ gettext-tools | [] [] [] |
++ gimp-print | [] [] [] [] [] |
++ gliv | |
++ glunarclock | [] [] |
++ gnubiff | [] |
++ gnucash | [] () [] [] |
++ gnucash-glossary | [] () [] |
++ gnupg | [] () [] [] [] [] |
++ gpe-aerial | [] |
++ gpe-beam | [] [] |
++ gpe-calendar | [] [] |
++ gpe-clock | [] [] |
++ gpe-conf | [] [] |
++ gpe-contacts | [] [] |
++ gpe-edit | [] |
++ gpe-go | [] |
++ gpe-login | [] [] |
++ gpe-ownerinfo | [] [] |
++ gpe-sketchbook | [] [] |
++ gpe-su | [] [] |
++ gpe-taskmanager | [] [] |
++ gpe-timesheet | [] |
++ gpe-today | [] [] |
++ gpe-todo | [] [] |
++ gphoto2 | [] [] [] [] |
++ gprof | [] [] [] |
++ gpsdrive | () () () |
++ gramadoir | [] |
++ grep | [] [] [] [] [] [] |
++ gretl | [] |
++ gtick | [] () |
++ hello | [] [] [] [] [] [] |
++ id-utils | [] [] |
++ indent | [] [] [] [] |
++ iso_3166 | [] [] [] [] [] [] [] [] [] [] |
++ iso_3166_1 | [] [] [] [] [] [] |
++ iso_3166_2 | |
++ iso_3166_3 | [] |
++ iso_4217 | [] [] [] [] |
++ iso_639 | |
++ jpilot | [] [] [] |
++ jtag | |
++ jwhois | [] |
++ kbd | [] [] [] [] [] |
++ latrine | () |
++ ld | [] [] |
++ libc | [] [] [] [] [] [] |
++ libgpewidget | [] [] |
++ libiconv | [] [] [] [] [] |
++ lifelines | [] () |
++ lilypond | [] |
++ lingoteach | |
++ lingoteach_lessons | () () |
++ lynx | [] [] [] [] |
++ m4 | [] [] [] [] |
++ mailutils | [] [] |
++ make | [] [] [] |
++ man-db | [] () [] [] () |
++ minicom | [] [] [] |
++ mysecretdiary | [] [] [] |
++ nano | [] () [] [] [] |
++ nano_1_0 | [] () [] [] [] |
++ opcodes | [] |
++ parted | [] [] [] [] [] |
++ ptx | [] [] [] [] [] |
++ python | |
++ radius | [] |
++ recode | [] [] [] [] [] [] [] |
++ rpm | [] [] |
++ screem | |
++ scrollkeeper | [] [] [] [] [] [] |
++ sed | [] [] [] [] [] [] |
++ sh-utils | [] [] [] |
++ shared-mime-info | |
++ sharutils | [] [] [] [] [] [] |
++ silky | () |
++ skencil | [] () [] |
++ sketch | [] () [] |
++ soundtracker | [] [] [] |
++ sp | [] |
++ tar | [] [] [] [] |
++ texinfo | [] [] [] |
++ textutils | [] [] [] [] |
++ tin | () () |
++ tp-robot | |
++ tuxpaint | [] [] [] [] [] [] [] |
++ unicode-han-tra... | |
++ unicode-transla... | |
++ util-linux | [] [] [] [] [] |
++ vorbis-tools | [] [] [] [] |
++ wastesedge | () |
++ wdiff | [] [] [] [] |
++ wget | [] [] [] [] [] [] |
++ xchat | [] [] [] [] |
++ xfree86_xkb_xml | [] [] |
++ xpad | [] |
++ +----------------------------------------------------+
++ af am ar az be bg bs ca cs da de el en en_GB eo es
++ 4 0 0 1 9 4 1 40 41 60 78 17 1 5 13 68
++
++ et eu fa fi fr ga gl he hr hu id is it ja ko lg
++ +-------------------------------------------------+
++ a2ps | [] [] [] () () |
++ aegis | |
++ ant-phone | [] |
++ anubis | [] |
++ ap-utils | [] |
++ aspell | [] [] |
++ bash | [] [] |
++ batchelor | [] [] |
++ bfd | [] |
++ binutils | [] [] |
++ bison | [] [] [] [] |
++ bluez-pin | [] [] [] [] [] |
++ clisp | |
++ clisp | [] |
++ console-tools | |
++ coreutils | [] [] [] [] [] [] |
++ cpio | [] [] [] [] |
++ darkstat | () [] [] [] |
++ diffutils | [] [] [] [] [] [] [] |
++ e2fsprogs | |
++ enscript | [] [] |
++ error | [] [] [] [] |
++ fetchmail | [] |
++ fileutils | [] [] [] [] [] [] |
++ findutils | [] [] [] [] [] [] [] [] [] [] [] |
++ flex | [] [] [] |
++ fslint | [] |
++ gas | [] |
++ gawk | [] [] [] |
++ gbiff | [] |
++ gcal | [] |
++ gcc | [] |
++ gettext | [] [] [] |
++ gettext-examples | [] [] |
++ gettext-runtime | [] [] [] [] [] |
++ gettext-tools | [] [] [] |
++ gimp-print | [] [] |
++ gliv | () |
++ glunarclock | [] [] [] [] |
++ gnubiff | [] |
++ gnucash | () [] |
++ gnucash-glossary | [] |
++ gnupg | [] [] [] [] [] [] [] |
++ gpe-aerial | [] |
++ gpe-beam | [] |
++ gpe-calendar | [] [] [] |
++ gpe-clock | [] |
++ gpe-conf | [] |
++ gpe-contacts | [] [] |
++ gpe-edit | [] [] |
++ gpe-go | [] |
++ gpe-login | [] [] |
++ gpe-ownerinfo | [] [] [] |
++ gpe-sketchbook | [] |
++ gpe-su | [] |
++ gpe-taskmanager | [] |
++ gpe-timesheet | [] [] [] |
++ gpe-today | [] [] |
++ gpe-todo | [] [] |
++ gphoto2 | [] [] [] |
++ gprof | [] [] |
++ gpsdrive | () () () |
++ gramadoir | [] [] |
++ grep | [] [] [] [] [] [] [] [] [] [] [] |
++ gretl | [] [] |
++ gtick | [] [] [] |
++ hello | [] [] [] [] [] [] [] [] [] [] [] [] [] |
++ id-utils | [] [] [] [] |
++ indent | [] [] [] [] [] [] [] [] [] |
++ iso_3166 | [] [] [] [] [] [] [] |
++ iso_3166_1 | [] [] [] [] [] |
++ iso_3166_2 | |
++ iso_3166_3 | |
++ iso_4217 | [] [] [] [] [] [] |
++ iso_639 | |
++ jpilot | [] () |
++ jtag | [] |
++ jwhois | [] [] [] [] |
++ kbd | [] |
++ latrine | [] |
++ ld | [] |
++ libc | [] [] [] [] [] [] |
++ libgpewidget | [] [] [] [] |
++ libiconv | [] [] [] [] [] [] [] [] [] |
++ lifelines | () |
++ lilypond | [] |
++ lingoteach | [] [] |
++ lingoteach_lessons | |
++ lynx | [] [] [] [] |
++ m4 | [] [] [] [] |
++ mailutils | |
++ make | [] [] [] [] [] [] |
++ man-db | () () |
++ minicom | [] [] [] [] |
++ mysecretdiary | [] [] |
++ nano | [] [] [] [] |
++ nano_1_0 | [] [] [] [] |
++ opcodes | [] |
++ parted | [] [] [] |
++ ptx | [] [] [] [] [] [] [] |
++ python | |
++ radius | [] |
++ recode | [] [] [] [] [] [] |
++ rpm | [] [] |
++ screem | |
++ scrollkeeper | [] |
++ sed | [] [] [] [] [] [] [] [] [] |
++ sh-utils | [] [] [] [] [] [] [] |
++ shared-mime-info | [] [] [] |
++ sharutils | [] [] [] [] [] |
++ silky | () [] () () |
++ skencil | [] |
++ sketch | [] |
++ soundtracker | [] [] |
++ sp | [] () |
++ tar | [] [] [] [] [] [] [] [] [] |
++ texinfo | [] [] [] [] |
++ textutils | [] [] [] [] [] [] |
++ tin | [] () |
++ tp-robot | [] |
++ tuxpaint | [] [] [] [] [] [] [] [] [] |
++ unicode-han-tra... | |
++ unicode-transla... | [] [] |
++ util-linux | [] [] [] [] () [] |
++ vorbis-tools | [] |
++ wastesedge | () |
++ wdiff | [] [] [] [] [] [] |
++ wget | [] [] [] [] [] [] [] |
++ xchat | [] [] [] |
++ xfree86_xkb_xml | [] [] |
++ xpad | [] [] |
++ +-------------------------------------------------+
++ et eu fa fi fr ga gl he hr hu id is it ja ko lg
++ 22 2 1 26 106 28 24 8 10 41 33 1 26 33 12 0
++
++ lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru
++ +-----------------------------------------------------+
++ a2ps | [] [] () () [] [] [] |
++ aegis | () () () |
++ ant-phone | [] [] |
++ anubis | [] [] [] [] [] [] |
++ ap-utils | [] () [] |
++ aspell | [] |
++ bash | [] [] [] |
++ batchelor | [] |
++ bfd | [] |
++ binutils | [] |
++ bison | [] [] [] [] [] |
++ bluez-pin | [] [] [] |
++ clisp | |
++ clisp | [] |
++ console-tools | [] |
++ coreutils | [] [] |
++ cpio | [] [] [] [] [] |
++ darkstat | [] [] [] [] |
++ diffutils | [] [] [] [] [] [] |
++ e2fsprogs | [] |
++ enscript | [] [] [] [] |
++ error | [] [] [] |
++ fetchmail | [] [] () [] |
++ fileutils | [] [] [] |
++ findutils | [] [] [] [] [] |
++ flex | [] [] [] [] |
++ fslint | [] [] |
++ gas | |
++ gawk | [] [] [] |
++ gbiff | [] [] |
++ gcal | |
++ gcc | |
++ gettext | [] [] [] |
++ gettext-examples | [] [] [] |
++ gettext-runtime | [] [] [] [] |
++ gettext-tools | [] [] |
++ gimp-print | [] |
++ gliv | [] [] [] |
++ glunarclock | [] [] [] [] |
++ gnubiff | [] |
++ gnucash | [] [] () [] |
++ gnucash-glossary | [] [] |
++ gnupg | [] |
++ gpe-aerial | [] [] [] [] |
++ gpe-beam | [] [] [] [] |
++ gpe-calendar | [] [] [] [] |
++ gpe-clock | [] [] [] [] |
++ gpe-conf | [] [] [] [] |
++ gpe-contacts | [] [] [] [] |
++ gpe-edit | [] [] [] [] |
++ gpe-go | [] [] [] |
++ gpe-login | [] [] [] [] |
++ gpe-ownerinfo | [] [] [] [] |
++ gpe-sketchbook | [] [] [] [] |
++ gpe-su | [] [] [] [] |
++ gpe-taskmanager | [] [] [] [] |
++ gpe-timesheet | [] [] [] [] |
++ gpe-today | [] [] [] [] |
++ gpe-todo | [] [] [] [] |
++ gphoto2 | [] |
++ gprof | [] [] |
++ gpsdrive | () () [] |
++ gramadoir | () [] |
++ grep | [] [] [] [] [] |
++ gretl | |
++ gtick | [] [] [] |
++ hello | [] [] [] [] [] [] [] [] [] [] |
++ id-utils | [] [] [] [] |
++ indent | [] [] [] [] |
++ iso_3166 | [] [] [] |
++ iso_3166_1 | [] [] |
++ iso_3166_2 | |
++ iso_3166_3 | [] |
++ iso_4217 | [] [] [] [] [] [] [] [] |
++ iso_639 | [] |
++ jpilot | () () |
++ jtag | |
++ jwhois | [] [] [] [] () |
++ kbd | [] [] [] |
++ latrine | [] |
++ ld | |
++ libc | [] [] [] [] |
++ libgpewidget | [] [] [] |
++ libiconv | [] [] [] [] [] |
++ lifelines | |
++ lilypond | |
++ lingoteach | |
++ lingoteach_lessons | |
++ lynx | [] [] [] |
++ m4 | [] [] [] [] [] |
++ mailutils | [] [] [] |
++ make | [] [] [] [] |
++ man-db | [] |
++ minicom | [] [] [] [] |
++ mysecretdiary | [] [] [] |
++ nano | [] [] [] [] [] |
++ nano_1_0 | [] [] [] [] [] [] |
++ opcodes | [] [] |
++ parted | [] [] [] [] |
++ ptx | [] [] [] [] [] [] [] [] |
++ python | |
++ radius | [] [] |
++ recode | [] [] [] [] |
++ rpm | [] [] [] |
++ screem | |
++ scrollkeeper | [] [] [] [] [] |
++ sed | [] [] [] |
++ sh-utils | [] [] |
++ shared-mime-info | [] [] |
++ sharutils | [] [] |
++ silky | () |
++ skencil | [] [] |
++ sketch | [] [] |
++ soundtracker | |
++ sp | |
++ tar | [] [] [] [] [] [] |
++ texinfo | [] [] [] [] |
++ textutils | [] [] |
++ tin | |
++ tp-robot | [] |
++ tuxpaint | [] [] [] [] [] [] [] [] |
++ unicode-han-tra... | |
++ unicode-transla... | |
++ util-linux | [] [] [] |
++ vorbis-tools | [] [] [] |
++ wastesedge | |
++ wdiff | [] [] [] [] [] |
++ wget | [] [] [] |
++ xchat | [] [] [] |
++ xfree86_xkb_xml | [] [] |
++ xpad | [] [] |
++ +-----------------------------------------------------+
++ lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru
++ 1 2 0 3 12 0 10 69 6 7 1 40 26 36 76 63
++
++ sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu
++ +-----------------------------------------------------+
++ a2ps | [] [] [] [] | 16
++ aegis | | 0
++ ant-phone | | 3
++ anubis | [] [] | 9
++ ap-utils | () | 3
++ aspell | | 4
++ bash | | 9
++ batchelor | | 3
++ bfd | [] [] | 6
++ binutils | [] [] [] | 8
++ bison | [] [] | 14
++ bluez-pin | [] [] [] | 14
++ clisp | | 0
++ clisp | | 5
++ console-tools | | 3
++ coreutils | [] [] [] [] | 16
++ cpio | [] [] | 14
++ darkstat | [] [] [] () () | 12
++ diffutils | [] [] [] | 23
++ e2fsprogs | [] [] | 6
++ enscript | [] [] | 12
++ error | [] [] [] | 15
++ fetchmail | [] [] | 11
++ fileutils | [] [] [] [] [] | 17
++ findutils | [] [] [] [] [] [] | 29
++ flex | [] [] | 13
++ fslint | | 3
++ gas | [] | 3
++ gawk | [] [] | 12
++ gbiff | | 4
++ gcal | [] [] | 4
++ gcc | [] | 4
++ gettext | [] [] [] [] [] | 16
++ gettext-examples | [] [] [] [] [] | 14
++ gettext-runtime | [] [] [] [] [] [] [] [] | 22
++ gettext-tools | [] [] [] [] [] [] | 14
++ gimp-print | [] [] | 10
++ gliv | | 3
++ glunarclock | [] [] [] | 13
++ gnubiff | | 3
++ gnucash | [] [] | 9
++ gnucash-glossary | [] [] [] | 8
++ gnupg | [] [] [] [] | 17
++ gpe-aerial | [] | 7
++ gpe-beam | [] | 8
++ gpe-calendar | [] [] [] [] | 13
++ gpe-clock | [] [] [] | 10
++ gpe-conf | [] [] | 9
++ gpe-contacts | [] [] [] | 11
++ gpe-edit | [] [] [] [] [] | 12
++ gpe-go | | 5
++ gpe-login | [] [] [] [] [] | 13
++ gpe-ownerinfo | [] [] [] [] | 13
++ gpe-sketchbook | [] [] | 9
++ gpe-su | [] [] [] | 10
++ gpe-taskmanager | [] [] [] | 10
++ gpe-timesheet | [] [] [] [] | 12
++ gpe-today | [] [] [] [] [] | 13
++ gpe-todo | [] [] [] [] | 12
++ gphoto2 | [] [] [] | 11
++ gprof | [] [] | 9
++ gpsdrive | [] [] | 3
++ gramadoir | [] | 5
++ grep | [] [] [] [] | 26
++ gretl | | 3
++ gtick | | 7
++ hello | [] [] [] [] [] | 34
++ id-utils | [] [] | 12
++ indent | [] [] [] [] | 21
++ iso_3166 | [] [] [] [] [] [] [] | 27
++ iso_3166_1 | [] [] [] | 16
++ iso_3166_2 | | 0
++ iso_3166_3 | | 2
++ iso_4217 | [] [] [] [] [] [] | 24
++ iso_639 | | 1
++ jpilot | [] [] [] [] [] | 9
++ jtag | [] | 2
++ jwhois | () [] [] | 11
++ kbd | [] [] | 11
++ latrine | | 2
++ ld | [] [] | 5
++ libc | [] [] [] [] | 20
++ libgpewidget | [] [] [] [] | 13
++ libiconv | [] [] [] [] [] [] [] [] | 27
++ lifelines | [] | 2
++ lilypond | [] | 3
++ lingoteach | | 2
++ lingoteach_lessons | () | 0
++ lynx | [] [] [] | 14
++ m4 | [] [] | 15
++ mailutils | | 5
++ make | [] [] [] | 16
++ man-db | [] | 5
++ minicom | | 11
++ mysecretdiary | [] [] | 10
++ nano | [] [] [] [] | 17
++ nano_1_0 | [] [] [] | 17
++ opcodes | [] [] | 6
++ parted | [] [] [] | 15
++ ptx | [] [] | 22
++ python | | 0
++ radius | | 4
++ recode | [] [] [] | 20
++ rpm | [] [] | 9
++ screem | [] [] | 2
++ scrollkeeper | [] [] [] | 15
++ sed | [] [] [] [] [] [] | 24
++ sh-utils | [] [] | 14
++ shared-mime-info | [] [] | 7
++ sharutils | [] [] [] [] | 17
++ silky | () | 3
++ skencil | [] | 6
++ sketch | [] | 6
++ soundtracker | [] [] | 7
++ sp | [] | 3
++ tar | [] [] [] [] [] | 24
++ texinfo | [] [] [] | 14
++ textutils | [] [] [] [] | 16
++ tin | | 1
++ tp-robot | | 2
++ tuxpaint | [] [] [] [] [] | 29
++ unicode-han-tra... | | 0
++ unicode-transla... | | 2
++ util-linux | [] [] | 15
++ vorbis-tools | | 8
++ wastesedge | | 0
++ wdiff | [] [] [] | 18
++ wget | [] [] [] [] [] [] [] [] | 24
++ xchat | [] [] [] [] [] | 15
++ xfree86_xkb_xml | [] [] [] [] [] | 11
++ xpad | | 5
++ +-----------------------------------------------------+
++ 63 teams sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu
++ 131 domains 47 19 28 83 0 0 59 13 1 1 11 0 22 22 0 1373
+
+ Some counters in the preceding matrix are higher than the number of
+ visible blocks let us expect. This is because a few extra PO files are
+@@ -220,6 +742,27 @@
+ lag between the mere existence a PO file and its wide availability in a
+ distribution.
+
+- If August 1997 seems to be old, you may fetch a more recent copy of
+-this `ABOUT-NLS' file on most GNU archive sites.
++ If January 2004 seems to be old, you may fetch a more recent copy of
++this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
++matrix with full percentage details can be found at
++`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
++
++Using `gettext' in new packages
++===============================
++
++If you are writing a freely available program and want to
++internationalize it you are welcome to use GNU `gettext' in your
++package. Of course you have to respect the GNU Library General Public
++License which covers the use of the GNU `gettext' library. This means
++in particular that even non-free programs can use `libintl' as a shared
++library, whereas only free software can use `libintl' as a static
++library or use modified versions of `libintl'.
++
++ Once the sources are changed appropriately and the setup can handle
++the use of `gettext' the only thing missing are the translations. The
++Free Translation Project is also available for packages which are not
++developed inside the GNU project. Therefore the information given above
++applies also for every other Free Software Project. Contact
++`translation@iro.umontreal.ca' to make the `.pot' files available to
++the translation teams.
+
+--- lrzsz-0.12.20.safe/ChangeLog 1998-12-29 17:49:56.000000000 -0500
++++ lrzsz-0.12.20/ChangeLog 2004-09-12 14:40:35.846521456 -0400
+@@ -1,3 +1,11 @@
++2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
++
++ * Makefile.am (ACLOCAL_AMFLAGS): New variable.
++ (EXTRA_DIST): Add config.rpath.
++ * configure.in (AC_OUTPUT): Add m4/Makefile.
++ (AC_OUTPUT): Remove command that created po/Makefile.
++ (AC_LINK_FILES): Remove invocation.
++
+ 1998-12-29 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c: removed stpcpy call.
+--- lrzsz-0.12.20.safe/config.rpath 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/config.rpath 2004-09-12 14:40:34.329752040 -0400
+@@ -0,0 +1,548 @@
++#! /bin/sh
++# Output a system dependent set of variables, describing how to set the
++# run time search path of shared libraries in an executable.
++#
++# Copyright 1996-2003 Free Software Foundation, Inc.
++# Taken from GNU libtool, 2001
++# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful, but
++# WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++#
++# As a special exception to the GNU General Public License, if you
++# distribute this file as part of a program that contains a
++# configuration script generated by Autoconf, you may include it under
++# the same distribution terms that you use for the rest of that program.
++#
++# The first argument passed to this file is the canonical host specification,
++# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
++# or
++# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
++# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
++# should be set by the caller.
++#
++# The set of defined variables is at the end of this script.
++
++# Known limitations:
++# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
++# than 256 bytes, otherwise the compiler driver will dump core. The only
++# known workaround is to choose shorter directory names for the build
++# directory and/or the installation directory.
++
++# All known linkers require a `.a' archive for static linking (except M$VC,
++# which needs '.lib').
++libext=a
++shrext=.so
++
++host="$1"
++host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
++host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
++host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
++
++# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
++
++wl=
++if test "$GCC" = yes; then
++ wl='-Wl,'
++else
++ case "$host_os" in
++ aix*)
++ wl='-Wl,'
++ ;;
++ mingw* | pw32* | os2*)
++ ;;
++ hpux9* | hpux10* | hpux11*)
++ wl='-Wl,'
++ ;;
++ irix5* | irix6* | nonstopux*)
++ wl='-Wl,'
++ ;;
++ newsos6)
++ ;;
++ linux*)
++ case $CC in
++ icc|ecc)
++ wl='-Wl,'
++ ;;
++ ccc)
++ wl='-Wl,'
++ ;;
++ esac
++ ;;
++ osf3* | osf4* | osf5*)
++ wl='-Wl,'
++ ;;
++ sco3.2v5*)
++ ;;
++ solaris*)
++ wl='-Wl,'
++ ;;
++ sunos4*)
++ wl='-Qoption ld '
++ ;;
++ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
++ wl='-Wl,'
++ ;;
++ sysv4*MP*)
++ ;;
++ uts4*)
++ ;;
++ esac
++fi
++
++# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
++
++hardcode_libdir_flag_spec=
++hardcode_libdir_separator=
++hardcode_direct=no
++hardcode_minus_L=no
++
++case "$host_os" in
++ cygwin* | mingw* | pw32*)
++ # FIXME: the MSVC++ port hasn't been tested in a loooong time
++ # When not using gcc, we currently assume that we are using
++ # Microsoft Visual C++.
++ if test "$GCC" != yes; then
++ with_gnu_ld=no
++ fi
++ ;;
++ openbsd*)
++ with_gnu_ld=no
++ ;;
++esac
++
++ld_shlibs=yes
++if test "$with_gnu_ld" = yes; then
++ case "$host_os" in
++ aix3* | aix4* | aix5*)
++ # On AIX/PPC, the GNU linker is very broken
++ if test "$host_cpu" != ia64; then
++ ld_shlibs=no
++ fi
++ ;;
++ amigaos*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_minus_L=yes
++ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
++ # that the semantics of dynamic libraries on AmigaOS, at least up
++ # to version 4, is to share data among multiple programs linked
++ # with the same dynamic library. Since this doesn't match the
++ # behavior of shared libraries on other platforms, we can use
++ # them.
++ ld_shlibs=no
++ ;;
++ beos*)
++ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
++ :
++ else
++ ld_shlibs=no
++ fi
++ ;;
++ cygwin* | mingw* | pw32*)
++ # hardcode_libdir_flag_spec is actually meaningless, as there is
++ # no search path for DLLs.
++ hardcode_libdir_flag_spec='-L$libdir'
++ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
++ :
++ else
++ ld_shlibs=no
++ fi
++ ;;
++ netbsd*)
++ ;;
++ solaris* | sysv5*)
++ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
++ ld_shlibs=no
++ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
++ :
++ else
++ ld_shlibs=no
++ fi
++ ;;
++ sunos4*)
++ hardcode_direct=yes
++ ;;
++ *)
++ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
++ :
++ else
++ ld_shlibs=no
++ fi
++ ;;
++ esac
++ if test "$ld_shlibs" = yes; then
++ # Unlike libtool, we use -rpath here, not --rpath, since the documented
++ # option of GNU ld is called -rpath, not --rpath.
++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++ fi
++else
++ case "$host_os" in
++ aix3*)
++ # Note: this linker hardcodes the directories in LIBPATH if there
++ # are no directories specified by -L.
++ hardcode_minus_L=yes
++ if test "$GCC" = yes; then
++ # Neither direct hardcoding nor static linking is supported with a
++ # broken collect2.
++ hardcode_direct=unsupported
++ fi
++ ;;
++ aix4* | aix5*)
++ if test "$host_cpu" = ia64; then
++ # On IA64, the linker does run time linking by default, so we don't
++ # have to do anything special.
++ aix_use_runtimelinking=no
++ else
++ aix_use_runtimelinking=no
++ # Test if we are trying to use run time linking or normal
++ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
++ # need to do runtime linking.
++ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
++ for ld_flag in $LDFLAGS; do
++ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
++ aix_use_runtimelinking=yes
++ break
++ fi
++ done
++ esac
++ fi
++ hardcode_direct=yes
++ hardcode_libdir_separator=':'
++ if test "$GCC" = yes; then
++ case $host_os in aix4.[012]|aix4.[012].*)
++ collect2name=`${CC} -print-prog-name=collect2`
++ if test -f "$collect2name" && \
++ strings "$collect2name" | grep resolve_lib_name >/dev/null
++ then
++ # We have reworked collect2
++ hardcode_direct=yes
++ else
++ # We have old collect2
++ hardcode_direct=unsupported
++ hardcode_minus_L=yes
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_libdir_separator=
++ fi
++ esac
++ fi
++ # Begin _LT_AC_SYS_LIBPATH_AIX.
++ echo 'int main () { return 0; }' > conftest.c
++ ${CC} ${LDFLAGS} conftest.c -o conftest
++ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
++}'`
++ if test -z "$aix_libpath"; then
++ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
++}'`
++ fi
++ if test -z "$aix_libpath"; then
++ aix_libpath="/usr/lib:/lib"
++ fi
++ rm -f conftest.c conftest
++ # End _LT_AC_SYS_LIBPATH_AIX.
++ if test "$aix_use_runtimelinking" = yes; then
++ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
++ else
++ if test "$host_cpu" = ia64; then
++ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
++ else
++ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
++ fi
++ fi
++ ;;
++ amigaos*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_minus_L=yes
++ # see comment about different semantics on the GNU ld section
++ ld_shlibs=no
++ ;;
++ bsdi4*)
++ ;;
++ cygwin* | mingw* | pw32*)
++ # When not using gcc, we currently assume that we are using
++ # Microsoft Visual C++.
++ # hardcode_libdir_flag_spec is actually meaningless, as there is
++ # no search path for DLLs.
++ hardcode_libdir_flag_spec=' '
++ libext=lib
++ ;;
++ darwin* | rhapsody*)
++ if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
++ hardcode_direct=no
++ fi
++ ;;
++ dgux*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ ;;
++ freebsd1*)
++ ld_shlibs=no
++ ;;
++ freebsd2.2*)
++ hardcode_libdir_flag_spec='-R$libdir'
++ hardcode_direct=yes
++ ;;
++ freebsd2*)
++ hardcode_direct=yes
++ hardcode_minus_L=yes
++ ;;
++ freebsd*)
++ hardcode_libdir_flag_spec='-R$libdir'
++ hardcode_direct=yes
++ ;;
++ hpux9*)
++ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
++ hardcode_libdir_separator=:
++ hardcode_direct=yes
++ # hardcode_minus_L: Not really in the search PATH,
++ # but as the default location of the library.
++ hardcode_minus_L=yes
++ ;;
++ hpux10* | hpux11*)
++ if test "$with_gnu_ld" = no; then
++ case "$host_cpu" in
++ hppa*64*)
++ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
++ hardcode_libdir_separator=:
++ hardcode_direct=no
++ ;;
++ ia64*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_direct=no
++ # hardcode_minus_L: Not really in the search PATH,
++ # but as the default location of the library.
++ hardcode_minus_L=yes
++ ;;
++ *)
++ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
++ hardcode_libdir_separator=:
++ hardcode_direct=yes
++ # hardcode_minus_L: Not really in the search PATH,
++ # but as the default location of the library.
++ hardcode_minus_L=yes
++ ;;
++ esac
++ fi
++ ;;
++ irix5* | irix6* | nonstopux*)
++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++ hardcode_libdir_separator=:
++ ;;
++ netbsd*)
++ hardcode_libdir_flag_spec='-R$libdir'
++ hardcode_direct=yes
++ ;;
++ newsos6)
++ hardcode_direct=yes
++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++ hardcode_libdir_separator=:
++ ;;
++ openbsd*)
++ hardcode_direct=yes
++ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
++ else
++ case "$host_os" in
++ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
++ hardcode_libdir_flag_spec='-R$libdir'
++ ;;
++ *)
++ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
++ ;;
++ esac
++ fi
++ ;;
++ os2*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_minus_L=yes
++ ;;
++ osf3*)
++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++ hardcode_libdir_separator=:
++ ;;
++ osf4* | osf5*)
++ if test "$GCC" = yes; then
++ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
++ else
++ # Both cc and cxx compiler support -rpath directly
++ hardcode_libdir_flag_spec='-rpath $libdir'
++ fi
++ hardcode_libdir_separator=:
++ ;;
++ sco3.2v5*)
++ ;;
++ solaris*)
++ hardcode_libdir_flag_spec='-R$libdir'
++ ;;
++ sunos4*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ hardcode_direct=yes
++ hardcode_minus_L=yes
++ ;;
++ sysv4)
++ case $host_vendor in
++ sni)
++ hardcode_direct=yes # is this really true???
++ ;;
++ siemens)
++ hardcode_direct=no
++ ;;
++ motorola)
++ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
++ ;;
++ esac
++ ;;
++ sysv4.3*)
++ ;;
++ sysv4*MP*)
++ if test -d /usr/nec; then
++ ld_shlibs=yes
++ fi
++ ;;
++ sysv4.2uw2*)
++ hardcode_direct=yes
++ hardcode_minus_L=no
++ ;;
++ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
++ ;;
++ sysv5*)
++ hardcode_libdir_flag_spec=
++ ;;
++ uts4*)
++ hardcode_libdir_flag_spec='-L$libdir'
++ ;;
++ *)
++ ld_shlibs=no
++ ;;
++ esac
++fi
++
++# Check dynamic linker characteristics
++# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
++libname_spec='lib$name'
++case "$host_os" in
++ aix3*)
++ ;;
++ aix4* | aix5*)
++ ;;
++ amigaos*)
++ ;;
++ beos*)
++ ;;
++ bsdi4*)
++ ;;
++ cygwin* | mingw* | pw32*)
++ shrext=.dll
++ ;;
++ darwin* | rhapsody*)
++ shrext=.dylib
++ ;;
++ dgux*)
++ ;;
++ freebsd1*)
++ ;;
++ freebsd*)
++ ;;
++ gnu*)
++ ;;
++ hpux9* | hpux10* | hpux11*)
++ case "$host_cpu" in
++ ia64*)
++ shrext=.so
++ ;;
++ hppa*64*)
++ shrext=.sl
++ ;;
++ *)
++ shrext=.sl
++ ;;
++ esac
++ ;;
++ irix5* | irix6* | nonstopux*)
++ case "$host_os" in
++ irix5* | nonstopux*)
++ libsuff= shlibsuff=
++ ;;
++ *)
++ case $LD in
++ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
++ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
++ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
++ *) libsuff= shlibsuff= ;;
++ esac
++ ;;
++ esac
++ ;;
++ linux*oldld* | linux*aout* | linux*coff*)
++ ;;
++ linux*)
++ ;;
++ netbsd*)
++ ;;
++ newsos6)
++ ;;
++ nto-qnx)
++ ;;
++ openbsd*)
++ ;;
++ os2*)
++ libname_spec='$name'
++ shrext=.dll
++ ;;
++ osf3* | osf4* | osf5*)
++ ;;
++ sco3.2v5*)
++ ;;
++ solaris*)
++ ;;
++ sunos4*)
++ ;;
++ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
++ ;;
++ sysv4*MP*)
++ ;;
++ uts4*)
++ ;;
++esac
++
++sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
++escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
++shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
++escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
++
++sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
++
++# How to pass a linker flag through the compiler.
++wl="$escaped_wl"
++
++# Static library suffix (normally "a").
++libext="$libext"
++
++# Shared library suffix (normally "so").
++shlibext="$shlibext"
++
++# Flag to hardcode \$libdir into a binary during linking.
++# This must work even if \$libdir does not exist.
++hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
++
++# Whether we need a single -rpath flag with a separated argument.
++hardcode_libdir_separator="$hardcode_libdir_separator"
++
++# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
++# resulting binary.
++hardcode_direct="$hardcode_direct"
++
++# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
++# resulting binary.
++hardcode_minus_L="$hardcode_minus_L"
++
++EOF
+--- lrzsz-0.12.20.safe/configure.in 2004-09-12 14:39:55.161706488 -0400
++++ lrzsz-0.12.20/configure.in 2004-09-12 14:40:35.816526016 -0400
+@@ -260,11 +260,10 @@
+ AM_GNU_GETTEXT
+
+ AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
+-AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+
+-AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile \
++AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile m4/Makefile \
+ man/Makefile po/Makefile.in src/Makefile debian/rules Specfile systype \
+ src/lrzszbug],
+-[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile;
++[
+ chmod +x debian/rules;
+ test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
+--- lrzsz-0.12.20.safe/intl/bindtextdom.c 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/bindtextdom.c 2004-09-12 14:40:34.343749912 -0400
+@@ -1,59 +1,75 @@
+ /* Implementation of the bindtextdomain(3) function
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++ Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#else
+-# ifdef HAVE_MALLOC_H
+-# include <malloc.h>
+-# else
+-void free ();
+-# endif
+-#endif
++#include <stddef.h>
++#include <stdlib.h>
++#include <string.h>
+
+-#if defined HAVE_STRING_H || defined _LIBC
+-# include <string.h>
++#ifdef _LIBC
++# include <libintl.h>
+ #else
+-# include <strings.h>
+-# ifndef memcpy
+-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+-# endif
++# include "libgnuintl.h"
+ #endif
++#include "gettextP.h"
+
+ #ifdef _LIBC
+-# include <libintl.h>
++/* We have to handle multi-threaded applications. */
++# include <bits/libc-lock.h>
+ #else
+-# include "libgettext.h"
++/* Provide dummy implementation if this is outside glibc. */
++# define __libc_rwlock_define(CLASS, NAME)
++# define __libc_rwlock_wrlock(NAME)
++# define __libc_rwlock_unlock(NAME)
++#endif
++
++/* The internal variables in the standalone libintl.a must have different
++ names than the internal variables in GNU libc, otherwise programs
++ using libintl.a cannot be linked statically. */
++#if !defined _LIBC
++# define _nl_default_dirname libintl_nl_default_dirname
++# define _nl_domain_bindings libintl_nl_domain_bindings
++#endif
++
++/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
++#ifndef offsetof
++# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
+ #endif
+-#include "gettext.h"
+-#include "gettextP.h"
+
+ /* @@ end of prolog @@ */
+
+ /* Contains the default location of the message catalogs. */
+ extern const char _nl_default_dirname[];
++#ifdef _LIBC
++extern const char _nl_default_dirname_internal[] attribute_hidden;
++#else
++# define INTUSE(name) name
++#endif
+
+ /* List with bindings of specific domains. */
+ extern struct binding *_nl_domain_bindings;
+
++/* Lock variable to protect the global data in the gettext implementation. */
++__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
++
+
+ /* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+@@ -61,23 +77,41 @@
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define BINDTEXTDOMAIN __bindtextdomain
+-# define strdup(str) __strdup (str)
++# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset
++# ifndef strdup
++# define strdup(str) __strdup (str)
++# endif
+ #else
+-# define BINDTEXTDOMAIN bindtextdomain__
++# define BINDTEXTDOMAIN libintl_bindtextdomain
++# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
+ #endif
+
+-/* Specify that the DOMAINNAME message catalog will be found
+- in DIRNAME rather than in the system locale data base. */
+-char *
+-BINDTEXTDOMAIN (domainname, dirname)
+- const char *domainname;
+- const char *dirname;
++/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
++ to be used for the DOMAINNAME message catalog.
++ If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not
++ modified, only the current value is returned.
++ If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither
++ modified nor returned. */
++static void
++set_binding_values (const char *domainname,
++ const char **dirnamep, const char **codesetp)
+ {
+ struct binding *binding;
++ int modified;
+
+ /* Some sanity checks. */
+ if (domainname == NULL || domainname[0] == '\0')
+- return NULL;
++ {
++ if (dirnamep)
++ *dirnamep = NULL;
++ if (codesetp)
++ *codesetp = NULL;
++ return;
++ }
++
++ __libc_rwlock_wrlock (_nl_state_lock);
++
++ modified = 0;
+
+ for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+ {
+@@ -93,81 +127,173 @@
+ }
+ }
+
+- if (dirname == NULL)
+- /* The current binding has be to returned. */
+- return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
+-
+ if (binding != NULL)
+ {
+- /* The domain is already bound. If the new value and the old
+- one are equal we simply do nothing. Otherwise replace the
+- old binding. */
+- if (strcmp (dirname, binding->dirname) != 0)
++ if (dirnamep)
+ {
+- char *new_dirname;
++ const char *dirname = *dirnamep;
+
+- if (strcmp (dirname, _nl_default_dirname) == 0)
+- new_dirname = (char *) _nl_default_dirname;
++ if (dirname == NULL)
++ /* The current binding has be to returned. */
++ *dirnamep = binding->dirname;
+ else
+ {
++ /* The domain is already bound. If the new value and the old
++ one are equal we simply do nothing. Otherwise replace the
++ old binding. */
++ char *result = binding->dirname;
++ if (strcmp (dirname, result) != 0)
++ {
++ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
++ result = (char *) INTUSE(_nl_default_dirname);
++ else
++ {
+ #if defined _LIBC || defined HAVE_STRDUP
+- new_dirname = strdup (dirname);
+- if (new_dirname == NULL)
+- return NULL;
++ result = strdup (dirname);
+ #else
+- size_t len = strlen (dirname) + 1;
+- new_dirname = (char *) malloc (len);
+- if (new_dirname == NULL)
+- return NULL;
+-
+- memcpy (new_dirname, dirname, len);
++ size_t len = strlen (dirname) + 1;
++ result = (char *) malloc (len);
++ if (__builtin_expect (result != NULL, 1))
++ memcpy (result, dirname, len);
+ #endif
++ }
++
++ if (__builtin_expect (result != NULL, 1))
++ {
++ if (binding->dirname != INTUSE(_nl_default_dirname))
++ free (binding->dirname);
++
++ binding->dirname = result;
++ modified = 1;
++ }
++ }
++ *dirnamep = result;
+ }
++ }
+
+- if (binding->dirname != _nl_default_dirname)
+- free (binding->dirname);
++ if (codesetp)
++ {
++ const char *codeset = *codesetp;
+
+- binding->dirname = new_dirname;
++ if (codeset == NULL)
++ /* The current binding has be to returned. */
++ *codesetp = binding->codeset;
++ else
++ {
++ /* The domain is already bound. If the new value and the old
++ one are equal we simply do nothing. Otherwise replace the
++ old binding. */
++ char *result = binding->codeset;
++ if (result == NULL || strcmp (codeset, result) != 0)
++ {
++#if defined _LIBC || defined HAVE_STRDUP
++ result = strdup (codeset);
++#else
++ size_t len = strlen (codeset) + 1;
++ result = (char *) malloc (len);
++ if (__builtin_expect (result != NULL, 1))
++ memcpy (result, codeset, len);
++#endif
++
++ if (__builtin_expect (result != NULL, 1))
++ {
++ if (binding->codeset != NULL)
++ free (binding->codeset);
++
++ binding->codeset = result;
++ binding->codeset_cntr++;
++ modified = 1;
++ }
++ }
++ *codesetp = result;
++ }
+ }
+ }
++ else if ((dirnamep == NULL || *dirnamep == NULL)
++ && (codesetp == NULL || *codesetp == NULL))
++ {
++ /* Simply return the default values. */
++ if (dirnamep)
++ *dirnamep = INTUSE(_nl_default_dirname);
++ if (codesetp)
++ *codesetp = NULL;
++ }
+ else
+ {
+ /* We have to create a new binding. */
+- size_t len;
++ size_t len = strlen (domainname) + 1;
+ struct binding *new_binding =
+- (struct binding *) malloc (sizeof (*new_binding));
++ (struct binding *) malloc (offsetof (struct binding, domainname) + len);
+
+- if (new_binding == NULL)
+- return NULL;
++ if (__builtin_expect (new_binding == NULL, 0))
++ goto failed;
+
++ memcpy (new_binding->domainname, domainname, len);
++
++ if (dirnamep)
++ {
++ const char *dirname = *dirnamep;
++
++ if (dirname == NULL)
++ /* The default value. */
++ dirname = INTUSE(_nl_default_dirname);
++ else
++ {
++ if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0)
++ dirname = INTUSE(_nl_default_dirname);
++ else
++ {
++ char *result;
+ #if defined _LIBC || defined HAVE_STRDUP
+- new_binding->domainname = strdup (domainname);
+- if (new_binding->domainname == NULL)
+- return NULL;
++ result = strdup (dirname);
++ if (__builtin_expect (result == NULL, 0))
++ goto failed_dirname;
+ #else
+- len = strlen (domainname) + 1;
+- new_binding->domainname = (char *) malloc (len);
+- if (new_binding->domainname == NULL)
+- return NULL;
+- memcpy (new_binding->domainname, domainname, len);
++ size_t len = strlen (dirname) + 1;
++ result = (char *) malloc (len);
++ if (__builtin_expect (result == NULL, 0))
++ goto failed_dirname;
++ memcpy (result, dirname, len);
+ #endif
+-
+- if (strcmp (dirname, _nl_default_dirname) == 0)
+- new_binding->dirname = (char *) _nl_default_dirname;
++ dirname = result;
++ }
++ }
++ *dirnamep = dirname;
++ new_binding->dirname = (char *) dirname;
++ }
+ else
++ /* The default value. */
++ new_binding->dirname = (char *) INTUSE(_nl_default_dirname);
++
++ new_binding->codeset_cntr = 0;
++
++ if (codesetp)
+ {
++ const char *codeset = *codesetp;
++
++ if (codeset != NULL)
++ {
++ char *result;
++
+ #if defined _LIBC || defined HAVE_STRDUP
+- new_binding->dirname = strdup (dirname);
+- if (new_binding->dirname == NULL)
+- return NULL;
++ result = strdup (codeset);
++ if (__builtin_expect (result == NULL, 0))
++ goto failed_codeset;
+ #else
+- len = strlen (dirname) + 1;
+- new_binding->dirname = (char *) malloc (len);
+- if (new_binding->dirname == NULL)
+- return NULL;
+- memcpy (new_binding->dirname, dirname, len);
++ size_t len = strlen (codeset) + 1;
++ result = (char *) malloc (len);
++ if (__builtin_expect (result == NULL, 0))
++ goto failed_codeset;
++ memcpy (result, codeset, len);
+ #endif
++ codeset = result;
++ new_binding->codeset_cntr++;
++ }
++ *codesetp = codeset;
++ new_binding->codeset = (char *) codeset;
+ }
++ else
++ new_binding->codeset = NULL;
+
+ /* Now enqueue it. */
+ if (_nl_domain_bindings == NULL
+@@ -187,13 +313,51 @@
+ binding->next = new_binding;
+ }
+
+- binding = new_binding;
++ modified = 1;
++
++ /* Here we deal with memory allocation failures. */
++ if (0)
++ {
++ failed_codeset:
++ if (new_binding->dirname != INTUSE(_nl_default_dirname))
++ free (new_binding->dirname);
++ failed_dirname:
++ free (new_binding);
++ failed:
++ if (dirnamep)
++ *dirnamep = NULL;
++ if (codesetp)
++ *codesetp = NULL;
++ }
+ }
+
+- return binding->dirname;
++ /* If we modified any binding, we flush the caches. */
++ if (modified)
++ ++_nl_msg_cat_cntr;
++
++ __libc_rwlock_unlock (_nl_state_lock);
++}
++
++/* Specify that the DOMAINNAME message catalog will be found
++ in DIRNAME rather than in the system locale data base. */
++char *
++BINDTEXTDOMAIN (const char *domainname, const char *dirname)
++{
++ set_binding_values (domainname, &dirname, NULL);
++ return (char *) dirname;
++}
++
++/* Specify the character encoding in which the messages from the
++ DOMAINNAME message catalog will be returned. */
++char *
++BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset)
++{
++ set_binding_values (domainname, NULL, &codeset);
++ return (char *) codeset;
+ }
+
+ #ifdef _LIBC
+-/* Alias for function name in GNU C Library. */
++/* Aliases for function names in GNU C Library. */
+ weak_alias (__bindtextdomain, bindtextdomain);
++weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset);
+ #endif
+--- lrzsz-0.12.20.safe/intl/cat-compat.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/cat-compat.c 1969-12-31 19:00:00.000000000 -0500
+@@ -1,262 +0,0 @@
+-/* Compatibility code for gettext-using-catgets interface.
+- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+-
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
+- any later version.
+-
+- This program is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
+-
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+-
+-#ifdef HAVE_CONFIG_H
+-# include <config.h>
+-#endif
+-
+-#include <stdio.h>
+-
+-#ifdef STDC_HEADERS
+-# include <stdlib.h>
+-# include <string.h>
+-#else
+-char *getenv ();
+-# ifdef HAVE_MALLOC_H
+-# include <malloc.h>
+-# endif
+-#endif
+-
+-#ifdef HAVE_NL_TYPES_H
+-# include <nl_types.h>
+-#endif
+-
+-#include "libgettext.h"
+-
+-/* @@ end of prolog @@ */
+-
+-/* XPG3 defines the result of `setlocale (category, NULL)' as:
+- ``Directs `setlocale()' to query `category' and return the current
+- setting of `local'.''
+- However it does not specify the exact format. And even worse: POSIX
+- defines this not at all. So we can use this feature only on selected
+- system (e.g. those using GNU C Library). */
+-#ifdef _LIBC
+-# define HAVE_LOCALE_NULL
+-#endif
+-
+-/* The catalog descriptor. */
+-static nl_catd catalog = (nl_catd) -1;
+-
+-/* Name of the default catalog. */
+-static const char default_catalog_name[] = "messages";
+-
+-/* Name of currently used catalog. */
+-static const char *catalog_name = default_catalog_name;
+-
+-/* Get ID for given string. If not found return -1. */
+-static int msg_to_cat_id PARAMS ((const char *msg));
+-
+-/* Substitution for systems lacking this function in their C library. */
+-#if !_LIBC && !HAVE_STPCPY
+-static char *stpcpy PARAMS ((char *dest, const char *src));
+-#endif
+-
+-
+-/* Set currently used domain/catalog. */
+-char *
+-textdomain (domainname)
+- const char *domainname;
+-{
+- nl_catd new_catalog;
+- char *new_name;
+- size_t new_name_len;
+- char *lang;
+-
+-#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \
+- && defined HAVE_LOCALE_NULL
+- lang = setlocale (LC_MESSAGES, NULL);
+-#else
+- lang = getenv ("LC_ALL");
+- if (lang == NULL || lang[0] == '\0')
+- {
+- lang = getenv ("LC_MESSAGES");
+- if (lang == NULL || lang[0] == '\0')
+- lang = getenv ("LANG");
+- }
+-#endif
+- if (lang == NULL || lang[0] == '\0')
+- lang = "C";
+-
+- /* See whether name of currently used domain is asked. */
+- if (domainname == NULL)
+- return (char *) catalog_name;
+-
+- if (domainname[0] == '\0')
+- domainname = default_catalog_name;
+-
+- /* Compute length of added path element. */
+- new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang)
+- + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1
+- + sizeof (".cat");
+-
+- new_name = (char *) malloc (new_name_len);
+- if (new_name == NULL)
+- return NULL;
+-
+- strcpy (new_name, PACKAGE);
+- new_catalog = catopen (new_name, 0);
+-
+- if (new_catalog == (nl_catd) -1)
+- {
+- /* NLSPATH search didn't work, try absolute path */
+- sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang,
+- PACKAGE);
+- new_catalog = catopen (new_name, 0);
+-
+- if (new_catalog == (nl_catd) -1)
+- {
+- free (new_name);
+- return (char *) catalog_name;
+- }
+- }
+-
+- /* Close old catalog. */
+- if (catalog != (nl_catd) -1)
+- catclose (catalog);
+- if (catalog_name != default_catalog_name)
+- free ((char *) catalog_name);
+-
+- catalog = new_catalog;
+- catalog_name = new_name;
+-
+- return (char *) catalog_name;
+-}
+-
+-char *
+-bindtextdomain (domainname, dirname)
+- const char *domainname;
+- const char *dirname;
+-{
+-#if HAVE_SETENV || HAVE_PUTENV
+- char *old_val, *new_val, *cp;
+- size_t new_val_len;
+-
+- /* This does not make much sense here but to be compatible do it. */
+- if (domainname == NULL)
+- return NULL;
+-
+- /* Compute length of added path element. If we use setenv we don't need
+- the first byts for NLSPATH=, but why complicate the code for this
+- peanuts. */
+- new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname)
+- + sizeof ("/%L/LC_MESSAGES/%N.cat");
+-
+- old_val = getenv ("NLSPATH");
+- if (old_val == NULL || old_val[0] == '\0')
+- {
+- old_val = NULL;
+- new_val_len += 1 + sizeof (LOCALEDIR) - 1
+- + sizeof ("/%L/LC_MESSAGES/%N.cat");
+- }
+- else
+- new_val_len += strlen (old_val);
+-
+- new_val = (char *) malloc (new_val_len);
+- if (new_val == NULL)
+- return NULL;
+-
+-# if HAVE_SETENV
+- cp = new_val;
+-# else
+- cp = stpcpy (new_val, "NLSPATH=");
+-# endif
+-
+- cp = stpcpy (cp, dirname);
+- cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:");
+-
+- if (old_val == NULL)
+- {
+-# if __STDC__
+- stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat");
+-# else
+-
+- cp = stpcpy (cp, LOCALEDIR);
+- stpcpy (cp, "/%L/LC_MESSAGES/%N.cat");
+-# endif
+- }
+- else
+- stpcpy (cp, old_val);
+-
+-# if HAVE_SETENV
+- setenv ("NLSPATH", new_val, 1);
+- free (new_val);
+-# else
+- putenv (new_val);
+- /* Do *not* free the environment entry we just entered. It is used
+- from now on. */
+-# endif
+-
+-#endif
+-
+- return (char *) domainname;
+-}
+-
+-#undef gettext
+-char *
+-gettext (msg)
+- const char *msg;
+-{
+- int msgid;
+-
+- if (msg == NULL || catalog == (nl_catd) -1)
+- return (char *) msg;
+-
+- /* Get the message from the catalog. We always use set number 1.
+- The message ID is computed by the function `msg_to_cat_id'
+- which works on the table generated by `po-to-tbl'. */
+- msgid = msg_to_cat_id (msg);
+- if (msgid == -1)
+- return (char *) msg;
+-
+- return catgets (catalog, 1, msgid, (char *) msg);
+-}
+-
+-/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries
+- for the one equal to msg. If it is found return the ID. In case when
+- the string is not found return -1. */
+-static int
+-msg_to_cat_id (msg)
+- const char *msg;
+-{
+- int cnt;
+-
+- for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
+- if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
+- return _msg_tbl[cnt]._msg_number;
+-
+- return -1;
+-}
+-
+-
+-/* @@ begin of epilog @@ */
+-
+-/* We don't want libintl.a to depend on any other library. So we
+- avoid the non-standard function stpcpy. In GNU C Library this
+- function is available, though. Also allow the symbol HAVE_STPCPY
+- to be defined. */
+-#if !_LIBC && !HAVE_STPCPY
+-static char *
+-stpcpy (dest, src)
+- char *dest;
+- const char *src;
+-{
+- while ((*dest++ = *src++) != '\0')
+- /* Do nothing. */ ;
+- return dest - 1;
+-}
+-#endif
+--- lrzsz-0.12.20.safe/intl/ChangeLog 1998-04-26 09:22:35.000000000 -0400
++++ lrzsz-0.12.20/intl/ChangeLog 2004-09-12 14:40:34.349749000 -0400
+@@ -1,1022 +1,4 @@
+-1997-09-06 02:10 Ulrich Drepper <drepper@cygnus.com>
+-
+- * intlh.inst.in: Reformat copyright.
+-
+-1997-08-19 15:22 Ulrich Drepper <drepper@cygnus.com>
+-
+- * dcgettext.c (DCGETTEXT): Remove wrong comment.
+-
+-1997-08-16 00:13 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (install-data): Don't change directory to install.
+-
+-1997-08-01 14:30 Ulrich Drepper <drepper@cygnus.com>
+-
+- * cat-compat.c: Fix copyright.
+-
+- * localealias.c: Don't define strchr unless !HAVE_STRCHR.
+-
+- * loadmsgcat.c: Update copyright. Fix typos.
+-
+- * l10nflist.c: Don't define strchr unless !HAVE_STRCHR.
+- (_nl_make_l10nflist): Handle sponsor and revision correctly.
+-
+- * gettext.c: Update copyright.
+- * gettext.h: Likewise.
+- * hash-string.h: Likewise.
+-
+- * finddomain.c: Remoave dead code. Define strchr only if
+- !HAVE_STRCHR.
+-
+- * explodename.c: Include <sys/types.h>.
+-
+- * explodename.c: Reformat copyright text.
+- (_nl_explode_name): Fix typo.
+-
+- * dcgettext.c: Define and use __set_errno.
+- (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is
+- not defined.
+-
+- * bindtextdom.c: Pretty printing.
+-
+-1997-05-01 02:25 Ulrich Drepper <drepper@cygnus.com>
+-
+- * dcgettext.c (guess_category_value): Don't depend on
+- HAVE_LC_MESSAGES. We don't need the macro here.
+- Patch by Bruno Haible <haible@ilog.fr>.
+-
+- * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL
+- macro. Instead use HAVE_LOCALE_NULL and define it when using
+- glibc, as in dcgettext.c.
+- Patch by Bruno Haible <haible@ilog.fr>.
+-
+- * Makefile.in (CPPFLAGS): New variable. Reported by Franc,ois
+- Pinard.
+-
+-Mon Mar 10 06:51:17 1997 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in: Implement handling of libtool.
+-
+- * gettextP.h: Change data structures for use of generic lowlevel
+- i18n file handling.
+-
+-Wed Dec 4 20:21:18 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * textdomain.c: Put parentheses around arguments of memcpy macro
+- definition.
+- * localealias.c: Likewise.
+- * l10nflist.c: Likewise.
+- * finddomain.c: Likewise.
+- * bindtextdom.c: Likewise.
+- Reported by Thomas Esken.
+-
+-Mon Nov 25 22:57:51 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * textdomain.c: Move definition of `memcpy` macro to right
+- position.
+-
+-Fri Nov 22 04:01:58 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using
+- bcopy if not already defined. Reported by Thomas Esken.
+- * bindtextdom.c: Likewise.
+- * l10nflist.c: Likewise.
+- * localealias.c: Likewise.
+- * textdomain.c: Likewise.
+-
+-Tue Oct 29 11:10:27 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (libdir): Change to use exec_prefix instead of
+- prefix. Reported by Knut-HĺvardAksnes <etokna@eto.ericsson.se>.
+-
+-Sat Aug 31 03:07:09 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * l10nflist.c (_nl_normalize_codeset): We convert to lower case,
+- so don't prepend uppercase `ISO' for only numeric arg.
+-
+-Fri Jul 19 00:15:46 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after
+- definition of _GNU_SOURCE. Patch by Roland McGrath.
+-
+- * Makefile.in (uninstall): Fix another bug with `for' loop and
+- empty arguments. Patch by Jim Meyering. Correct name os
+- uninstalled files: no intl- prefix anymore.
+-
+- * Makefile.in (install-data): Again work around shells which
+- cannot handle mpty for list. Reported by Jim Meyering.
+-
+-Sat Jul 13 18:11:35 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (install): Split goal. Now depend on install-exec
+- and install-data.
+- (install-exec, install-data): New goals. Created from former
+- install goal.
+- Reported by Karl Berry.
+-
+-Sat Jun 22 04:58:14 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (MKINSTALLDIRS): New variable. Path to
+- mkinstalldirs script.
+- (install): use MKINSTALLDIRS variable or if the script is not present
+- try to find it in the $top_scrdir).
+-
+-Wed Jun 19 02:56:56 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * l10nflist.c: Linux libc *partly* includes the argz_* functions.
+- Grr. Work around by renaming the static version and use macros
+- for renaming.
+-
+-Tue Jun 18 20:11:17 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * l10nflist.c: Correct presence test macros of __argz_* functions.
+-
+- * l10nflist.c: Include <argz.h> based on test of it instead when
+- __argz_* functions are available.
+- Reported by Andreas Schwab.
+-
+-Thu Jun 13 15:17:44 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * explodename.c, l10nflist.c: Define NULL for dumb systems.
+-
+-Tue Jun 11 17:05:13 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * intlh.inst.in, libgettext.h (dcgettext): Rename local variable
+- result to __result to prevent name clash.
+-
+- * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to
+- get prototype for stpcpy and strcasecmp.
+-
+- * intlh.inst.in, libgettext.h: Move declaration of
+- `_nl_msg_cat_cntr' outside __extension__ block to prevent warning
+- from gcc's -Wnested-extern option.
+-
+-Fri Jun 7 01:58:00 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (install): Remove comment.
+-
+-Thu Jun 6 17:28:17 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (install): Work around for another Buglix stupidity.
+- Always use an `else' close for `if's. Reported by Nelson Beebe.
+-
+- * Makefile.in (intlh.inst): Correct typo in phony rule.
+- Reported by Nelson Beebe.
+-
+-Thu Jun 6 01:49:52 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * dcgettext.c (read_alias_file): Rename variable alloca_list to
+- block_list as the macro calls assume.
+- Patch by Eric Backus.
+-
+- * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using
+- malloc.
+- (read_alias_file): Rename varriabe alloca_list to block_list as the
+- macro calls assume.
+- Patch by Eric Backus.
+-
+- * l10nflist.c: Correct conditional for <argz.h> inclusion.
+- Reported by Roland McGrath.
+-
+- * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not
+- all-@USE_NLS@.
+-
+- * Makefile.in (install): intlh.inst comes from local dir, not
+- $(srcdir).
+-
+- * Makefile.in (intlh.inst): Special handling of this goal. If
+- used in gettext, this is really a rul to construct this file. If
+- used in any other package it is defined as a .PHONY rule with
+- empty body.
+-
+- * finddomain.c: Extract locale file information handling into
+- l10nfile.c. Rename local stpcpy__ function to stpcpy.
+-
+- * dcgettext.c (stpcpy): Add local definition.
+-
+- * l10nflist.c: Solve some portability problems. Patches partly by
+- Thomas Esken. Add local definition of stpcpy.
+-
+-Tue Jun 4 02:47:49 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * intlh.inst.in: Don't depend including <locale.h> on
+- HAVE_LOCALE_H. Instead configure must rewrite this fiile
+- depending on the result of the configure run.
+-
+- * Makefile.in (install): libintl.inst is now called intlh.inst.
+- Add rules for updating intlh.inst from intlh.inst.in.
+-
+- * libintl.inst: Renamed to intlh.inst.in.
+-
+- * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1
+- because gcc has __buitlin_alloca.
+- Reported by Roland McGrath.
+-
+-Mon Jun 3 00:32:16 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * Makefile.in (installcheck): New goal to fulfill needs of
+- automake's distcheck.
+-
+- * Makefile.in (install): Reorder commands so that VERSION is
+- found.
+-
+- * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in
+- @datadir@/gettext.
+- (COMSRCS): Add l10nfile.c.
+- (OBJECTS): Add l10nfile.o.
+- (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common).
+- (DISTFILE.gettext): Remove $(DISTFILES.common).
+- (all-gettext): Remove goal.
+- (install): If $(PACKAGE) = gettext install, otherwose do nothing. No
+- package but gettext itself should install libintl.h + headers.
+- (dist): Extend goal to work for gettext, too.
+- (dist-gettext): Remove goal.
+-
+- * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc.
+-
+-Sun Jun 2 17:33:06 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * loadmsgcat.c (_nl_load_domain): Parameter is now comes from
+- find_l10nfile.
+-
+-Sat Jun 1 02:23:03 1996 Ulrich Drepper <drepper@cygnus.com>
+-
+- * l10nflist.c (__argz_next): Add definition.
+-
+- * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca
+- code. Use new l10nfile handling.
+-
+- * localealias.c [!HAVE_ALLOCA]: Add code for handling missing
+- alloca code.
+-
+- * l10nflist.c: Initial revision.
+-
+-Tue Apr 2 18:51:18 1996 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (all-gettext): New goal. Same as all-yes.
+-
+-Thu Mar 28 23:01:22 1996 Karl Eichwalder <ke@ke.central.de>
+-
+- * Makefile.in (gettextsrcdir): Define using @datadir@.
+-
+-Tue Mar 26 12:39:14 1996 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c: Include <ctype.h>. Reported by Roland McGrath.
+-
+-Sat Mar 23 02:00:35 1996 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing
+- with external declaration.
+-
+-Sat Mar 2 00:47:09 1996 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (all-no): Rename from all_no.
+-
+-Sat Feb 17 00:25:59 1996 Ulrich Drepper <drepper@myware>
+-
+- * gettextP.h [loaded_domain]: Array `successor' must now contain up
+- to 63 elements (because of codeset name normalization).
+-
+- * finddomain.c: Implement codeset name normalization.
+-
+-Thu Feb 15 04:39:09 1996 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (all): Define to `all-@USE_NLS@'.
+- (all-yes, all_no): New goals. `all-no' is noop, `all-yes'
+- is former all.
+-
+-Mon Jan 15 21:46:01 1996 Howard Gayle <howard@hal.com>
+-
+- * localealias.c (alias_compare): Increment string pointers in loop
+- of strcasecmp replacement.
+-
+-Fri Dec 29 21:16:34 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (install-src): Who commented this goal out ? :-)
+-
+-Fri Dec 29 15:08:16 1995 Ulrich Drepper <drepper@myware>
+-
+- * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls
+- should not effect it because a missing catalog is no error.
+- Reported by Harald K<o:>nig <koenig@tat.physik.uni-tuebingen.de>.
+-
+-Tue Dec 19 22:09:13 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (Makefile): Explicitly use $(SHELL) for running
+- shell scripts.
+-
+-Fri Dec 15 17:34:59 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+-
+- * Makefile.in (install-src): Only install library and header when
+- we use the own implementation. Don't do it when using the
+- system's gettext or catgets functions.
+-
+- * dcgettext.c (find_msg): Must not swap domain->hash_size here.
+-
+-Sat Dec 9 16:24:37 1995 Ulrich Drepper <drepper@myware>
+-
+- * localealias.c, libintl.inst, libgettext.h, hash-string.h,
+- gettextP.h, finddomain.c, dcgettext.c, cat-compat.c:
+- Use PARAMS instead of __P. Suggested by Roland McGrath.
+-
+-Tue Dec 5 11:39:14 1995 Larry Schwimmer <rosebud@cyclone.stanford.edu>
+-
+- * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if
+- !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty.
+-
+-Mon Dec 4 15:42:07 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (install-src):
+- Install libintl.inst instead of libintl.h.install.
+-
+-Sat Dec 2 22:51:38 1995 Marcus Daniels <marcus@sysc.pdx.edu>
+-
+- * cat-compat.c (textdomain):
+- Reverse order in which files are tried you load. First
+- try local file, when this failed absolute path.
+-
+-Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
+-
+- * cat-compat.c (bindtextdomain): Add missing { }.
+-
+-Sun Nov 26 18:21:41 1995 Ulrich Drepper <drepper@myware>
+-
+- * libintl.inst: Add missing __P definition. Reported by Nelson Beebe.
+-
+- * Makefile.in:
+- Add dummy `all' and `dvi' goals. Reported by Tom Tromey.
+-
+-Sat Nov 25 16:12:01 1995 Franc,ois Pinard <pinard@iro.umontreal.ca>
+-
+- * hash-string.h: Capitalize arguments of macros.
+-
+-Sat Nov 25 12:01:36 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (DISTFILES): Prevent files names longer than 13
+- characters. libintl.h.glibc->libintl.glibc,
+- libintl.h.install->libintl.inst. Reported by Joshua R. Poulson.
+-
+-Sat Nov 25 11:31:12 1995 Eric Backus <ericb@lsid.hp.com>
+-
+- * dcgettext.c: Fix bug in preprocessor conditionals.
+-
+-Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
+-
+- * libgettext.h: Solaris cc does not understand
+- #if !SYMBOL1 && !SYMBOL2. Sad but true.
+-
+-Thu Nov 23 16:22:14 1995 Ulrich Drepper <drepper@myware>
+-
+- * hash-string.h (hash_string):
+- Fix for machine with >32 bit `unsigned long's.
+-
+- * dcgettext.c (DCGETTEXT):
+- Fix horrible bug in loop for alternative translation.
+-
+-Thu Nov 23 01:45:29 1995 Ulrich Drepper <drepper@myware>
+-
+- * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed:
+- Some further simplifications in message number generation.
+-
+-Mon Nov 20 21:08:43 1995 Ulrich Drepper <drepper@myware>
+-
+- * libintl.h.glibc: Use __const instead of const in prototypes.
+-
+- * Makefile.in (install-src):
+- Install libintl.h.install instead of libintl.h. This
+- is a stripped-down version. Suggested by Peter Miller.
+-
+- * libintl.h.install, libintl.h.glibc: Initial revision.
+-
+- * localealias.c (_nl_expand_alias, read_alias_file):
+- Protect prototypes in type casts by __P.
+-
+-Tue Nov 14 16:43:58 1995 Ulrich Drepper <drepper@myware>
+-
+- * hash-string.h: Correct prototype for hash_string.
+-
+-Sun Nov 12 12:42:30 1995 Ulrich Drepper <drepper@myware>
+-
+- * hash-string.h (hash_string): Add prototype.
+-
+- * gettextP.h: Fix copyright.
+- (SWAP): Add prototype.
+-
+-Wed Nov 8 22:56:33 1995 Ulrich Drepper <drepper@myware>
+-
+- * localealias.c (read_alias_file): Forgot sizeof.
+- Avoid calling *printf function. This introduces a big overhead.
+- Patch by Roland McGrath.
+-
+-Tue Nov 7 14:21:08 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy.
+-
+- * finddomain.c (stpcpy):
+- Define substitution function local. The macro was to flaky.
+-
+- * cat-compat.c: Fix typo.
+-
+- * xopen-msg.sed, linux-msg.sed:
+- While bringing message number to right place only accept digits.
+-
+- * linux-msg.sed, xopen-msg.sed: Now that the counter does not have
+- leading 0s we don't need to remove them. Reported by Marcus
+- Daniels.
+-
+- * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in
+- dependency. Reported by Marcus Daniels.
+-
+- * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement.
+- Generally cleanup using #if instead of #ifndef.
+-
+- * Makefile.in: Correct typos in comment. By Franc,ois Pinard.
+-
+-Mon Nov 6 00:27:02 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (install-src): Don't install libintl.h and libintl.a
+- if we use an available gettext implementation.
+-
+-Sun Nov 5 22:02:08 1995 Ulrich Drepper <drepper@myware>
+-
+- * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported
+- by Franc,ois Pinard.
+-
+- * libgettext.h: Use #if instead of #ifdef/#ifndef.
+-
+- * finddomain.c:
+- Comments describing what has to be done should start with FIXME.
+-
+-Sun Nov 5 19:38:01 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning.
+- DISTFILES.common names the files common to both dist goals.
+- DISTFILES.gettext are the files only distributed in GNU gettext.
+-
+-Sun Nov 5 17:32:54 1995 Ulrich Drepper <drepper@myware>
+-
+- * dcgettext.c (DCGETTEXT): Correct searching in derived locales.
+- This was necessary since a change in _nl_find_msg several weeks
+- ago. I really don't know this is still not fixed.
+-
+-Sun Nov 5 12:43:12 1995 Ulrich Drepper <drepper@myware>
+-
+- * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This
+- might mark a special condition.
+-
+- * finddomain.c (make_entry_rec): Don't make illegal entry as decided.
+-
+- * Makefile.in (dist): Suppress error message when ln failed.
+- Get files from $(srcdir) explicitly.
+-
+- * libgettext.h (gettext_const): Rename to gettext_noop.
+-
+-Fri Nov 3 07:36:50 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (make_entry_rec):
+- Protect against wrong locale names by testing mask.
+-
+- * libgettext.h (gettext_const): Add macro definition.
+- Capitalize macro arguments.
+-
+-Thu Nov 2 23:15:51 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (_nl_find_domain):
+- Test for pointer != NULL before accessing value.
+- Reported by Tom Tromey.
+-
+- * gettext.c (NULL):
+- Define as (void*)0 instad of 0. Reported by Franc,ois Pinard.
+-
+-Mon Oct 30 21:28:52 1995 Ulrich Drepper <drepper@myware>
+-
+- * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering.
+-
+-Sat Oct 28 23:20:47 1995 Ulrich Drepper <drepper@myware>
+-
+- * libgettext.h: Disable dcgettext optimization for Solaris 2.3.
+-
+- * localealias.c (alias_compare):
+- Peter Miller reported that tolower in some systems is
+- even dumber than I thought. Protect call by `isupper'.
+-
+-Fri Oct 27 22:22:51 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (libdir, includedir): New variables.
+- (install-src): Install libintl.a and libintl.h in correct dirs.
+-
+-Fri Oct 27 22:07:29 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c.
+-
+- * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques.
+-
+- * localealias.c:
+- Fix typo and superflous test. Reported by Christian von Roques.
+-
+-Fri Oct 6 11:52:05 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (_nl_find_domain):
+- Correct some remainder from the pre-CEN syntax. Now
+- we don't have a constant number of successors anymore.
+-
+-Wed Sep 27 21:41:13 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (DISTFILES): Add libintl.h.glibc.
+-
+- * Makefile.in (dist-libc): Add goal for packing sources for glibc.
+- (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc.
+-
+- * loadmsgcat.c: Forget to continue #if line.
+-
+- * localealias.c:
+- [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name
+- space clean.
+-
+- * dcgettext.c, finddomain.c: Better comment to last change.
+-
+- * loadmsgcat.c:
+- [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to
+- __fstat, __open, __close, __read, __mmap, and __munmap resp
+- to keep ANSI C name space clean.
+-
+- * finddomain.c:
+- [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean.
+-
+- * dcgettext.c:
+- [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to
+- keep ANSI C name space clean.
+-
+- * libgettext.h:
+- Include sys/types.h for those old SysV systems out there.
+- Reported by Francesco Potorti`.
+-
+- * loadmsgcat.c (use_mmap): Define if compiled for glibc.
+-
+- * bindtextdom.c: Include all those standard headers
+- unconditionally if _LIBC is defined.
+-
+- * finddomain.c: Fix 2 times defiend -> defined.
+-
+- * textdomain.c: Include libintl.h instead of libgettext.h when
+- compiling for glibc. Include all those standard headers
+- unconditionally if _LIBC is defined.
+-
+- * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc.
+-
+- * gettext.c:
+- Include libintl.h instead of libgettext.h when compiling for glibc.
+- Get NULL from stddef.h if we compile for glibc.
+-
+- * finddomain.c: Include libintl.h instead of libgettext.h when
+- compiling for glibc. Include all those standard headers
+- unconditionally if _LIBC is defined.
+-
+- * dcgettext.c: Include all those standard headers unconditionally
+- if _LIBC is defined.
+-
+- * dgettext.c: If compiled in glibc include libintl.h instead of
+- libgettext.h.
+- (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc.
+-
+- * dcgettext.c: If compiled in glibc include libintl.h instead of
+- libgettext.h.
+- (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc.
+-
+- * bindtextdom.c:
+- If compiled in glibc include libintl.h instead of libgettext.h.
+-
+-Mon Sep 25 22:23:06 1995 Ulrich Drepper <drepper@myware>
+-
+- * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0.
+- Reported by Marcus Daniels.
+-
+- * cat-compat.c (bindtextdomain):
+- String used in putenv must not be recycled.
+- Reported by Marcus Daniels.
+-
+- * libgettext.h (__USE_GNU_GETTEXT):
+- Additional symbol to signal that we use GNU gettext
+- library.
+-
+- * cat-compat.c (bindtextdomain):
+- Fix bug with the strange stpcpy replacement.
+- Reported by Nelson Beebe.
+-
+-Sat Sep 23 08:23:51 1995 Ulrich Drepper <drepper@myware>
+-
+- * cat-compat.c: Include <string.h> for stpcpy prototype.
+-
+- * localealias.c (read_alias_file):
+- While expand strdup code temporary variable `cp' hided
+- higher level variable with same name. Rename to `tp'.
+-
+- * textdomain.c (textdomain):
+- Avoid warning by using temporary variable in strdup code.
+-
+- * finddomain.c (_nl_find_domain): Remove unused variable `application'.
+-
+-Thu Sep 21 15:51:44 1995 Ulrich Drepper <drepper@myware>
+-
+- * localealias.c (alias_compare):
+- Use strcasecmp() only if available. Else use
+- implementation in place.
+-
+- * intl-compat.c:
+- Wrapper functions now call *__ functions instead of __*.
+-
+- * libgettext.h: Declare prototypes for *__ functions instead for __*.
+-
+- * cat-compat.c, loadmsgcat.c:
+- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+- of the standard libc and so prevent libintl.a from being used
+- standalone.
+-
+- * bindtextdom.c:
+- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+- of the standard libc and so prevent libintl.a from being used
+- standalone.
+- Rename to bindtextdomain__ if not used in GNU C Library.
+-
+- * dgettext.c:
+- Rename function to dgettext__ if not used in GNU C Library.
+-
+- * gettext.c:
+- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+- of the standard libc and so prevent libintl.a from being used
+- standalone.
+- Functions now called gettext__ if not used in GNU C Library.
+-
+- * dcgettext.c, localealias.c, textdomain.c, finddomain.c:
+- Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+- of the standard libc and so prevent libintl.a from being used
+- standalone.
+-
+-Sun Sep 17 23:14:49 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c: Correct some bugs in handling of CEN standard
+- locale definitions.
+-
+-Thu Sep 7 01:49:28 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c: Implement CEN syntax.
+-
+- * gettextP.h (loaded_domain): Extend number of successors to 31.
+-
+-Sat Aug 19 19:25:29 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (aliaspath): Remove path to X11 locale dir.
+-
+- * Makefile.in: Make install-src depend on install. This helps
+- gettext to install the sources and other packages can use the
+- install goal.
+-
+-Sat Aug 19 15:19:33 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (uninstall): Remove stuff installed by install-src.
+-
+-Tue Aug 15 13:13:53 1995 Ulrich Drepper <drepper@myware>
+-
+- * VERSION.in: Initial revision.
+-
+- * Makefile.in (DISTFILES):
+- Add VERSION file. This is not necessary for gettext, but
+- for other packages using this library.
+-
+-Tue Aug 15 06:16:44 1995 Ulrich Drepper <drepper@myware>
+-
+- * gettextP.h (_nl_find_domain):
+- New prototype after changing search strategy.
+-
+- * finddomain.c (_nl_find_domain):
+- We now try only to find a specified catalog. Fall back to other
+- catalogs listed in the locale list is now done in __dcgettext.
+-
+- * dcgettext.c (__dcgettext):
+- Now we provide message fall back even to different languages.
+- I.e. if a message is not available in one language all the other
+- in the locale list a tried. Formerly fall back was only possible
+- within one language. Implemented by moving one loop from
+- _nl_find_domain to here.
+-
+-Mon Aug 14 23:45:50 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (gettextsrcdir):
+- Directory where source of GNU gettext library are made
+- available.
+- (INSTALL, INSTALL_DATA): Programs used for installing sources.
+- (gettext-src): New. Rule to install GNU gettext sources for use in
+- gettextize shell script.
+-
+-Sun Aug 13 14:40:48 1995 Ulrich Drepper <drepper@myware>
+-
+- * loadmsgcat.c (_nl_load_domain):
+- Use mmap for loading only when munmap function is
+- also available.
+-
+- * Makefile.in (install): Depend on `all' goal.
+-
+-Wed Aug 9 11:04:33 1995 Ulrich Drepper <drepper@myware>
+-
+- * localealias.c (read_alias_file):
+- Do not overwrite '\n' when terminating alias value string.
+-
+- * localealias.c (read_alias_file):
+- Handle long lines. Ignore the rest not fitting in
+- the buffer after the initial `fgets' call.
+-
+-Wed Aug 9 00:54:29 1995 Ulrich Drepper <drepper@myware>
+-
+- * gettextP.h (_nl_load_domain):
+- Add prototype, replacing prototype for _nl_load_msg_cat.
+-
+- * finddomain.c (_nl_find_domain):
+- Remove unneeded variable filename and filename_len.
+- (expand_alias): Remove prototype because functions does not
+- exist anymore.
+-
+- * localealias.c (read_alias_file):
+- Change type of fname_len parameter to int.
+- (xmalloc): Add prototype.
+-
+- * loadmsgcat.c: Better prototypes for xmalloc.
+-
+-Tue Aug 8 22:30:39 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (_nl_find_domain):
+- Allow alias name to be constructed from the four components.
+-
+- * Makefile.in (aliaspath): New variable. Set to preliminary value.
+- (SOURCES): Add localealias.c.
+- (OBJECTS): Add localealias.o.
+-
+- * gettextP.h: Add prototype for _nl_expand_alias.
+-
+- * finddomain.c: Aliasing handled in intl/localealias.c.
+-
+- * localealias.c: Aliasing for locale names.
+-
+- * bindtextdom.c: Better prototypes for xmalloc and xstrdup.
+-
+-Mon Aug 7 23:47:42 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (DISTFILES): gettext.perl is now found in misc/.
+-
+- * cat-compat.c (bindtextdomain):
+- Correct implementation. dirname parameter was not used.
+- Reported by Marcus Daniels.
+-
+- * gettextP.h (loaded_domain):
+- New fields `successor' and `decided' for oo, lazy
+- message handling implementation.
+-
+- * dcgettext.c:
+- Adopt for oo, lazy message handliing.
+- Now we can inherit translations from less specific locales.
+- (find_msg): New function.
+-
+- * loadmsgcat.c, finddomain.c:
+- Complete rewrite. Implement oo, lazy message handling :-).
+- We now have an additional environment variable `LANGUAGE' with
+- a higher priority than LC_ALL for the LC_MESSAGE locale.
+- Here we can set a colon separated list of specifications each
+- of the form `language[_territory[.codeset]][@modifier]'.
+-
+-Sat Aug 5 09:55:42 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (unistd.h):
+- Include to get _PC_PATH_MAX defined on system having it.
+-
+-Fri Aug 4 22:42:00 1995 Ulrich Drepper <drepper@myware>
+-
+- * finddomain.c (stpcpy): Include prototype.
+-
+- * Makefile.in (dist): Remove `copying instead' message.
+-
+-Wed Aug 2 18:52:03 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (ID, TAGS): Do not use $^.
+-
+-Tue Aug 1 20:07:11 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (TAGS, ID): Use $^ as command argument.
+- (TAGS): Give etags -o option t write to current directory,
+- not $(srcdir).
+- (ID): Use $(srcdir) instead os $(top_srcdir)/src.
+- (distclean): Remove ID.
+-
+-Sun Jul 30 11:51:46 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (gnulocaledir):
+- New variable, always using share/ for data directory.
+- (DEFS): Add GNULOCALEDIR, used in finddomain.c.
+-
+- * finddomain.c (_nl_default_dirname):
+- Set to GNULOCALEDIR, because it always has to point
+- to the directory where GNU gettext Library writes it to.
+-
+- * intl-compat.c (textdomain, bindtextdomain):
+- Undefine macros before function definition.
+-
+-Sat Jul 22 01:10:02 1995 Ulrich Drepper <drepper@myware>
+-
+- * libgettext.h (_LIBINTL_H):
+- Protect definition in case where this file is included as
+- libgettext.h on Solaris machines. Add comment about this.
+-
+-Wed Jul 19 02:36:42 1995 Ulrich Drepper <drepper@myware>
+-
+- * intl-compat.c (textdomain): Correct typo.
+-
+-Wed Jul 19 01:51:35 1995 Ulrich Drepper <drepper@myware>
+-
+- * dcgettext.c (dcgettext): Function now called __dcgettext.
+-
+- * dgettext.c (dgettext): Now called __dgettext and calls
+- __dcgettext.
+-
+- * gettext.c (gettext):
+- Function now called __gettext and calls __dgettext.
+-
+- * textdomain.c (textdomain): Function now called __textdomain.
+-
+- * bindtextdom.c (bindtextdomain): Function now called
+- __bindtextdomain.
+-
+- * intl-compat.c: Initial revision.
+-
+- * Makefile.in (SOURCES): Add intl-compat.c.
+- (OBJECTS): We always compile the GNU gettext library functions.
+- OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o,
+- and intl-compat.o.
+- (GETTOBJS): Contains now only intl-compat.o.
+-
+- * libgettext.h:
+- Re-include protection matches dualistic character of libgettext.h.
+- For all functions in GNU gettext library define __ counter part.
+-
+- * finddomain.c (strchr): Define as index if not found in C library.
+- (_nl_find_domain): For relative paths paste / in between.
+-
+-Tue Jul 18 16:37:45 1995 Ulrich Drepper <drepper@myware>
+-
+- * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h.
+-
+- * xopen-msg.sed: Fix bug with `msgstr ""' lines.
+- A little bit better comments.
+-
+-Tue Jul 18 01:18:27 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in:
+- po-mode.el, makelinks, combine-sh are now found in ../misc.
+-
+- * po-mode.el, makelinks, combine-sh, elisp-comp:
+- Moved to ../misc/.
+-
+- * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__.
+-
+-Sun Jul 16 22:33:02 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (INSTALL, INSTALL_DATA): New variables.
+- (install-data, uninstall): Install/uninstall .elc file.
+-
+- * po-mode.el (Installation comment):
+- Add .pox as possible extension of .po files.
+-
+-Sun Jul 16 13:23:27 1995 Ulrich Drepper <drepper@myware>
+-
+- * elisp-comp: Complete new version by Franc,ois: This does not
+- fail when not compiling in the source directory.
+-
+-Sun Jul 16 00:12:17 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (../po/cat-id-tbl.o):
+- Use $(MAKE) instead of make for recursive make.
+-
+- * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh.
+- (install-exec): Add missing dummy goal.
+- (install-data, uninstall): @ in multi-line shell command at
+- beginning, not in front of echo. Reported by Eric Backus.
+-
+-Sat Jul 15 00:21:28 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (DISTFILES):
+- Rename libgettext.perl to gettext.perl to fit in 14 chars
+- file systems.
+-
+- * gettext.perl:
+- Rename to gettext.perl to fit in 14 chars file systems.
+-
+-Thu Jul 13 23:17:20 1995 Ulrich Drepper <drepper@myware>
+-
+- * cat-compat.c: If !STDC_HEADERS try to include malloc.h.
+-
+-Thu Jul 13 20:55:02 1995 Ulrich Drepper <drepper@myware>
+-
+- * po2tbl.sed.in: Pretty printing.
+-
+- * linux-msg.sed, xopen-msg.sed:
+- Correct bugs with handling substitute flags in branches.
+-
+- * hash-string.h (hash_string):
+- Old K&R compilers don't under stand `unsigned char'.
+-
+- * gettext.h (nls_uint32):
+- Some old K&R compilers (eg HP) don't understand `unsigned int'.
+-
+- * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes.
+-
+-Thu Jul 13 01:34:33 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (ELCFILES): New variable.
+- (DISTFILES): Add elisp-comp.
+- Add implicit rule for .el -> .elc compilation.
+- (install-data): install $ELCFILES
+- (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp.
+-
+- * elisp-comp: Initial revision
+-
+-Wed Jul 12 16:14:52 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in:
+- cat-id-tbl.c is now found in po/. This enables us to use an identical
+- intl/ directory in all packages.
+-
+- * dcgettext.c (dcgettext): hashing does not work for table size <= 2.
+-
+- * textdomain.c: fix typo (#if def -> #if defined)
+-
+-Tue Jul 11 18:44:43 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in (stamp-cat-id): use top_srcdir to address source files
+- (DISTFILES,distclean): move tupdate.perl to src/
+-
+- * po-to-tbl.sed.in:
+- add additional jump to clear change flag to recognize multiline strings
+-
+-Tue Jul 11 01:32:50 1995 Ulrich Drepper <drepper@myware>
+-
+- * textdomain.c: Protect inclusion of stdlib.h and string.h.
+-
+- * loadmsgcat.c: Protect inclusion of stdlib.h.
+-
+- * libgettext.h: Protect inclusion of locale.h.
+- Allow use in C++ programs.
+- Define NULL is not happened already.
+-
+- * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of
+- po-to-tbl.sed.
+- (distclean): remove po-to-tbl.sed and tupdate.perl.
+-
+- * tupdate.perl.in: Substitute Perl path even in exec line.
+- Don't include entries without translation from old .po file.
+-
+-Tue Jul 4 00:41:51 1995 Ulrich Drepper <drepper@myware>
+-
+- * tupdate.perl.in: use "Updated: " in msgid "".
+-
+- * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR).
+- Define getenv if !__STDC__.
+-
+- * bindtextdom.c: Protect stdlib.h and string.h inclusion.
+- Define free if !__STDC__.
+-
+- * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+- Define free if !__STDC__.
+-
+- * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+-
+-Mon Jul 3 23:56:30 1995 Ulrich Drepper <drepper@myware>
+-
+- * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR.
+- Remove unneeded $(srcdir) from Makefile.in dependency.
+-
+- * makelinks: Add copyright and short description.
+-
+- * po-mode.el: Last version for 0.7.
+-
+- * tupdate.perl.in: Fix die message.
+-
+- * dcgettext.c: Protect include of string.h.
+-
+- * gettext.c: Protect include of stdlib.h and further tries to get NULL.
+-
+- * finddomain.c: Some corrections in includes.
+-
+- * Makefile.in (INCLUDES): Prune list correct path to Makefile.in.
+-
+- * po-to-tbl.sed: Adopt for new .po file format.
+-
+- * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format.
+-
+-Sun Jul 2 23:55:03 1995 Ulrich Drepper <drepper@myware>
+-
+- * tupdate.perl.in: Complete rewrite for new .po file format.
++2004-01-29 GNU <bug-gnu-gettext@gnu.org>
+
+-Sun Jul 2 02:06:50 1995 Ulrich Drepper <drepper@myware>
++ * Version 0.14.1 released.
+
+- * First official release. This directory contains all the code
+- needed to internationalize own packages. It provides functions
+- which allow to use the X/Open catgets function with an interface
+- like the Uniforum gettext function. For system which does not
+- have neither of those a complete implementation is provided.
+--- lrzsz-0.12.20.safe/intl/config.charset 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/config.charset 2004-09-12 14:40:34.354748240 -0400
+@@ -0,0 +1,608 @@
++#! /bin/sh
++# Output a system dependent table of character encoding aliases.
++#
++# Copyright (C) 2000-2004 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Library General Public License as published
++# by the Free Software Foundation; either version 2, or (at your option)
++# any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# Library General Public License for more details.
++#
++# You should have received a copy of the GNU Library General Public
++# License along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
++#
++# The table consists of lines of the form
++# ALIAS CANONICAL
++#
++# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)".
++# ALIAS is compared in a case sensitive way.
++#
++# CANONICAL is the GNU canonical name for this character encoding.
++# It must be an encoding supported by libiconv. Support by GNU libc is
++# also desirable. CANONICAL is case insensitive. Usually an upper case
++# MIME charset name is preferred.
++# The current list of GNU canonical charset names is as follows.
++#
++# name MIME? used by which systems
++# ASCII, ANSI_X3.4-1968 glibc solaris freebsd darwin
++# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd darwin
++# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd darwin
++# ISO-8859-3 Y glibc solaris
++# ISO-8859-4 Y osf solaris freebsd darwin
++# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd darwin
++# ISO-8859-6 Y glibc aix hpux solaris
++# ISO-8859-7 Y glibc aix hpux irix osf solaris
++# ISO-8859-8 Y glibc aix hpux osf solaris
++# ISO-8859-9 Y glibc aix hpux irix osf solaris
++# ISO-8859-13 glibc
++# ISO-8859-14 glibc
++# ISO-8859-15 glibc aix osf solaris freebsd
++# KOI8-R Y glibc solaris freebsd darwin
++# KOI8-U Y glibc freebsd darwin
++# KOI8-T glibc
++# CP437 dos
++# CP775 dos
++# CP850 aix osf dos
++# CP852 dos
++# CP855 dos
++# CP856 aix
++# CP857 dos
++# CP861 dos
++# CP862 dos
++# CP864 dos
++# CP865 dos
++# CP866 freebsd darwin dos
++# CP869 dos
++# CP874 woe32 dos
++# CP922 aix
++# CP932 aix woe32 dos
++# CP943 aix
++# CP949 osf woe32 dos
++# CP950 woe32 dos
++# CP1046 aix
++# CP1124 aix
++# CP1125 dos
++# CP1129 aix
++# CP1250 woe32
++# CP1251 glibc solaris darwin woe32
++# CP1252 aix woe32
++# CP1253 woe32
++# CP1254 woe32
++# CP1255 glibc woe32
++# CP1256 woe32
++# CP1257 woe32
++# GB2312 Y glibc aix hpux irix solaris freebsd darwin
++# EUC-JP Y glibc aix hpux irix osf solaris freebsd darwin
++# EUC-KR Y glibc aix hpux irix osf solaris freebsd darwin
++# EUC-TW glibc aix hpux irix osf solaris
++# BIG5 Y glibc aix hpux osf solaris freebsd darwin
++# BIG5-HKSCS glibc solaris
++# GBK glibc aix osf solaris woe32 dos
++# GB18030 glibc solaris
++# SHIFT_JIS Y hpux osf solaris freebsd darwin
++# JOHAB glibc solaris woe32
++# TIS-620 glibc aix hpux osf solaris
++# VISCII Y glibc
++# TCVN5712-1 glibc
++# GEORGIAN-PS glibc
++# HP-ROMAN8 hpux
++# HP-ARABIC8 hpux
++# HP-GREEK8 hpux
++# HP-HEBREW8 hpux
++# HP-TURKISH8 hpux
++# HP-KANA8 hpux
++# DEC-KANJI osf
++# DEC-HANYU osf
++# UTF-8 Y glibc aix hpux osf solaris
++#
++# Note: Names which are not marked as being a MIME name should not be used in
++# Internet protocols for information interchange (mail, news, etc.).
++#
++# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
++# must understand both names and treat them as equivalent.
++#
++# The first argument passed to this file is the canonical host specification,
++# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
++# or
++# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
++
++host="$1"
++os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'`
++echo "# This file contains a table of character encoding aliases,"
++echo "# suitable for operating system '${os}'."
++echo "# It was automatically generated from config.charset."
++# List of references, updated during installation:
++echo "# Packages using this file: "
++case "$os" in
++ linux-gnulibc1*)
++ # Linux libc5 doesn't have nl_langinfo(CODESET); therefore
++ # localcharset.c falls back to using the full locale name
++ # from the environment variables.
++ echo "C ASCII"
++ echo "POSIX ASCII"
++ for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \
++ en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \
++ en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \
++ es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \
++ et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \
++ fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \
++ it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \
++ sv_FI sv_SE; do
++ echo "$l ISO-8859-1"
++ echo "$l.iso-8859-1 ISO-8859-1"
++ echo "$l.iso-8859-15 ISO-8859-15"
++ echo "$l.iso-8859-15@euro ISO-8859-15"
++ echo "$l@euro ISO-8859-15"
++ echo "$l.cp-437 CP437"
++ echo "$l.cp-850 CP850"
++ echo "$l.cp-1252 CP1252"
++ echo "$l.cp-1252@euro CP1252"
++ #echo "$l.atari-st ATARI-ST" # not a commonly used encoding
++ echo "$l.utf-8 UTF-8"
++ echo "$l.utf-8@euro UTF-8"
++ done
++ for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \
++ sl_SI sr sr_CS sr_YU; do
++ echo "$l ISO-8859-2"
++ echo "$l.iso-8859-2 ISO-8859-2"
++ echo "$l.cp-852 CP852"
++ echo "$l.cp-1250 CP1250"
++ echo "$l.utf-8 UTF-8"
++ done
++ for l in mk mk_MK ru ru_RU; do
++ echo "$l ISO-8859-5"
++ echo "$l.iso-8859-5 ISO-8859-5"
++ echo "$l.koi8-r KOI8-R"
++ echo "$l.cp-866 CP866"
++ echo "$l.cp-1251 CP1251"
++ echo "$l.utf-8 UTF-8"
++ done
++ for l in ar ar_SA; do
++ echo "$l ISO-8859-6"
++ echo "$l.iso-8859-6 ISO-8859-6"
++ echo "$l.cp-864 CP864"
++ #echo "$l.cp-868 CP868" # not a commonly used encoding
++ echo "$l.cp-1256 CP1256"
++ echo "$l.utf-8 UTF-8"
++ done
++ for l in el el_GR gr gr_GR; do
++ echo "$l ISO-8859-7"
++ echo "$l.iso-8859-7 ISO-8859-7"
++ echo "$l.cp-869 CP869"
++ echo "$l.cp-1253 CP1253"
++ echo "$l.cp-1253@euro CP1253"
++ echo "$l.utf-8 UTF-8"
++ echo "$l.utf-8@euro UTF-8"
++ done
++ for l in he he_IL iw iw_IL; do
++ echo "$l ISO-8859-8"
++ echo "$l.iso-8859-8 ISO-8859-8"
++ echo "$l.cp-862 CP862"
++ echo "$l.cp-1255 CP1255"
++ echo "$l.utf-8 UTF-8"
++ done
++ for l in tr tr_TR; do
++ echo "$l ISO-8859-9"
++ echo "$l.iso-8859-9 ISO-8859-9"
++ echo "$l.cp-857 CP857"
++ echo "$l.cp-1254 CP1254"
++ echo "$l.utf-8 UTF-8"
++ done
++ for l in lt lt_LT lv lv_LV; do
++ #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name
++ echo "$l ISO-8859-13"
++ done
++ for l in ru_UA uk uk_UA; do
++ echo "$l KOI8-U"
++ done
++ for l in zh zh_CN; do
++ #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name
++ echo "$l GB2312"
++ done
++ for l in ja ja_JP ja_JP.EUC; do
++ echo "$l EUC-JP"
++ done
++ for l in ko ko_KR; do
++ echo "$l EUC-KR"
++ done
++ for l in th th_TH; do
++ echo "$l TIS-620"
++ done
++ for l in fa fa_IR; do
++ #echo "$l ISIRI-3342" # a broken encoding
++ echo "$l.utf-8 UTF-8"
++ done
++ ;;
++ linux* | *-gnu*)
++ # With glibc-2.1 or newer, we don't need any canonicalization,
++ # because glibc has iconv and both glibc and libiconv support all
++ # GNU canonical names directly. Therefore, the Makefile does not
++ # need to install the alias file at all.
++ # The following applies only to glibc-2.0.x and older libcs.
++ echo "ISO_646.IRV:1983 ASCII"
++ ;;
++ aix*)
++ echo "ISO8859-1 ISO-8859-1"
++ echo "ISO8859-2 ISO-8859-2"
++ echo "ISO8859-5 ISO-8859-5"
++ echo "ISO8859-6 ISO-8859-6"
++ echo "ISO8859-7 ISO-8859-7"
++ echo "ISO8859-8 ISO-8859-8"
++ echo "ISO8859-9 ISO-8859-9"
++ echo "ISO8859-15 ISO-8859-15"
++ echo "IBM-850 CP850"
++ echo "IBM-856 CP856"
++ echo "IBM-921 ISO-8859-13"
++ echo "IBM-922 CP922"
++ echo "IBM-932 CP932"
++ echo "IBM-943 CP943"
++ echo "IBM-1046 CP1046"
++ echo "IBM-1124 CP1124"
++ echo "IBM-1129 CP1129"
++ echo "IBM-1252 CP1252"
++ echo "IBM-eucCN GB2312"
++ echo "IBM-eucJP EUC-JP"
++ echo "IBM-eucKR EUC-KR"
++ echo "IBM-eucTW EUC-TW"
++ echo "big5 BIG5"
++ echo "GBK GBK"
++ echo "TIS-620 TIS-620"
++ echo "UTF-8 UTF-8"
++ ;;
++ hpux*)
++ echo "iso88591 ISO-8859-1"
++ echo "iso88592 ISO-8859-2"
++ echo "iso88595 ISO-8859-5"
++ echo "iso88596 ISO-8859-6"
++ echo "iso88597 ISO-8859-7"
++ echo "iso88598 ISO-8859-8"
++ echo "iso88599 ISO-8859-9"
++ echo "iso885915 ISO-8859-15"
++ echo "roman8 HP-ROMAN8"
++ echo "arabic8 HP-ARABIC8"
++ echo "greek8 HP-GREEK8"
++ echo "hebrew8 HP-HEBREW8"
++ echo "turkish8 HP-TURKISH8"
++ echo "kana8 HP-KANA8"
++ echo "tis620 TIS-620"
++ echo "big5 BIG5"
++ echo "eucJP EUC-JP"
++ echo "eucKR EUC-KR"
++ echo "eucTW EUC-TW"
++ echo "hp15CN GB2312"
++ #echo "ccdc ?" # what is this?
++ echo "SJIS SHIFT_JIS"
++ echo "utf8 UTF-8"
++ ;;
++ irix*)
++ echo "ISO8859-1 ISO-8859-1"
++ echo "ISO8859-2 ISO-8859-2"
++ echo "ISO8859-5 ISO-8859-5"
++ echo "ISO8859-7 ISO-8859-7"
++ echo "ISO8859-9 ISO-8859-9"
++ echo "eucCN GB2312"
++ echo "eucJP EUC-JP"
++ echo "eucKR EUC-KR"
++ echo "eucTW EUC-TW"
++ ;;
++ osf*)
++ echo "ISO8859-1 ISO-8859-1"
++ echo "ISO8859-2 ISO-8859-2"
++ echo "ISO8859-4 ISO-8859-4"
++ echo "ISO8859-5 ISO-8859-5"
++ echo "ISO8859-7 ISO-8859-7"
++ echo "ISO8859-8 ISO-8859-8"
++ echo "ISO8859-9 ISO-8859-9"
++ echo "ISO8859-15 ISO-8859-15"
++ echo "cp850 CP850"
++ echo "big5 BIG5"
++ echo "dechanyu DEC-HANYU"
++ echo "dechanzi GB2312"
++ echo "deckanji DEC-KANJI"
++ echo "deckorean EUC-KR"
++ echo "eucJP EUC-JP"
++ echo "eucKR EUC-KR"
++ echo "eucTW EUC-TW"
++ echo "GBK GBK"
++ echo "KSC5601 CP949"
++ echo "sdeckanji EUC-JP"
++ echo "SJIS SHIFT_JIS"
++ echo "TACTIS TIS-620"
++ echo "UTF-8 UTF-8"
++ ;;
++ solaris*)
++ echo "646 ASCII"
++ echo "ISO8859-1 ISO-8859-1"
++ echo "ISO8859-2 ISO-8859-2"
++ echo "ISO8859-3 ISO-8859-3"
++ echo "ISO8859-4 ISO-8859-4"
++ echo "ISO8859-5 ISO-8859-5"
++ echo "ISO8859-6 ISO-8859-6"
++ echo "ISO8859-7 ISO-8859-7"
++ echo "ISO8859-8 ISO-8859-8"
++ echo "ISO8859-9 ISO-8859-9"
++ echo "ISO8859-15 ISO-8859-15"
++ echo "koi8-r KOI8-R"
++ echo "ansi-1251 CP1251"
++ echo "BIG5 BIG5"
++ echo "Big5-HKSCS BIG5-HKSCS"
++ echo "gb2312 GB2312"
++ echo "GBK GBK"
++ echo "GB18030 GB18030"
++ echo "cns11643 EUC-TW"
++ echo "5601 EUC-KR"
++ echo "ko_KR.johap92 JOHAB"
++ echo "eucJP EUC-JP"
++ echo "PCK SHIFT_JIS"
++ echo "TIS620.2533 TIS-620"
++ #echo "sun_eu_greek ?" # what is this?
++ echo "UTF-8 UTF-8"
++ ;;
++ freebsd* | os2*)
++ # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
++ # localcharset.c falls back to using the full locale name
++ # from the environment variables.
++ # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
++ # reuse FreeBSD's locale data for OS/2.
++ echo "C ASCII"
++ echo "US-ASCII ASCII"
++ for l in la_LN lt_LN; do
++ echo "$l.ASCII ASCII"
++ done
++ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
++ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
++ lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
++ echo "$l.ISO_8859-1 ISO-8859-1"
++ echo "$l.DIS_8859-15 ISO-8859-15"
++ done
++ for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do
++ echo "$l.ISO_8859-2 ISO-8859-2"
++ done
++ for l in la_LN lt_LT; do
++ echo "$l.ISO_8859-4 ISO-8859-4"
++ done
++ for l in ru_RU ru_SU; do
++ echo "$l.KOI8-R KOI8-R"
++ echo "$l.ISO_8859-5 ISO-8859-5"
++ echo "$l.CP866 CP866"
++ done
++ echo "uk_UA.KOI8-U KOI8-U"
++ echo "zh_TW.BIG5 BIG5"
++ echo "zh_TW.Big5 BIG5"
++ echo "zh_CN.EUC GB2312"
++ echo "ja_JP.EUC EUC-JP"
++ echo "ja_JP.SJIS SHIFT_JIS"
++ echo "ja_JP.Shift_JIS SHIFT_JIS"
++ echo "ko_KR.EUC EUC-KR"
++ ;;
++ netbsd*)
++ echo "646 ASCII"
++ echo "ISO8859-1 ISO-8859-1"
++ echo "ISO8859-2 ISO-8859-2"
++ echo "ISO8859-4 ISO-8859-4"
++ echo "ISO8859-5 ISO-8859-5"
++ echo "ISO8859-15 ISO-8859-15"
++ echo "eucCN GB2312"
++ echo "eucJP EUC-JP"
++ echo "eucKR EUC-KR"
++ echo "eucTW EUC-TW"
++ echo "BIG5 BIG5"
++ echo "SJIS SHIFT_JIS"
++ ;;
++ darwin*)
++ # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore
++ # localcharset.c falls back to using the full locale name
++ # from the environment variables.
++ echo "C ASCII"
++ for l in en_AU en_CA en_GB en_US la_LN; do
++ echo "$l.US-ASCII ASCII"
++ done
++ for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
++ fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE \
++ nl_NL no_NO pt_PT sv_SE; do
++ echo "$l ISO-8859-1"
++ echo "$l.ISO8859-1 ISO-8859-1"
++ echo "$l.ISO8859-15 ISO-8859-15"
++ done
++ for l in la_LN; do
++ echo "$l.ISO8859-1 ISO-8859-1"
++ echo "$l.ISO8859-15 ISO-8859-15"
++ done
++ for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do
++ echo "$l.ISO8859-2 ISO-8859-2"
++ done
++ for l in la_LN lt_LT; do
++ echo "$l.ISO8859-4 ISO-8859-4"
++ done
++ for l in ru_RU; do
++ echo "$l.KOI8-R KOI8-R"
++ echo "$l.ISO8859-5 ISO-8859-5"
++ echo "$l.CP866 CP866"
++ done
++ for l in bg_BG; do
++ echo "$l.CP1251 CP1251"
++ done
++ echo "uk_UA.KOI8-U KOI8-U"
++ echo "zh_TW.BIG5 BIG5"
++ echo "zh_TW.Big5 BIG5"
++ echo "zh_CN.EUC GB2312"
++ echo "ja_JP.EUC EUC-JP"
++ echo "ja_JP.SJIS SHIFT_JIS"
++ echo "ko_KR.EUC EUC-KR"
++ ;;
++ beos*)
++ # BeOS has a single locale, and it has UTF-8 encoding.
++ echo "* UTF-8"
++ ;;
++ msdosdjgpp*)
++ # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
++ # localcharset.c falls back to using the full locale name
++ # from the environment variables.
++ echo "#"
++ echo "# The encodings given here may not all be correct."
++ echo "# If you find that the encoding given for your language and"
++ echo "# country is not the one your DOS machine actually uses, just"
++ echo "# correct it in this file, and send a mail to"
++ echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
++ echo "# and Bruno Haible <bruno@clisp.org>."
++ echo "#"
++ echo "C ASCII"
++ # ISO-8859-1 languages
++ echo "ca CP850"
++ echo "ca_ES CP850"
++ echo "da CP865" # not CP850 ??
++ echo "da_DK CP865" # not CP850 ??
++ echo "de CP850"
++ echo "de_AT CP850"
++ echo "de_CH CP850"
++ echo "de_DE CP850"
++ echo "en CP850"
++ echo "en_AU CP850" # not CP437 ??
++ echo "en_CA CP850"
++ echo "en_GB CP850"
++ echo "en_NZ CP437"
++ echo "en_US CP437"
++ echo "en_ZA CP850" # not CP437 ??
++ echo "es CP850"
++ echo "es_AR CP850"
++ echo "es_BO CP850"
++ echo "es_CL CP850"
++ echo "es_CO CP850"
++ echo "es_CR CP850"
++ echo "es_CU CP850"
++ echo "es_DO CP850"
++ echo "es_EC CP850"
++ echo "es_ES CP850"
++ echo "es_GT CP850"
++ echo "es_HN CP850"
++ echo "es_MX CP850"
++ echo "es_NI CP850"
++ echo "es_PA CP850"
++ echo "es_PY CP850"
++ echo "es_PE CP850"
++ echo "es_SV CP850"
++ echo "es_UY CP850"
++ echo "es_VE CP850"
++ echo "et CP850"
++ echo "et_EE CP850"
++ echo "eu CP850"
++ echo "eu_ES CP850"
++ echo "fi CP850"
++ echo "fi_FI CP850"
++ echo "fr CP850"
++ echo "fr_BE CP850"
++ echo "fr_CA CP850"
++ echo "fr_CH CP850"
++ echo "fr_FR CP850"
++ echo "ga CP850"
++ echo "ga_IE CP850"
++ echo "gd CP850"
++ echo "gd_GB CP850"
++ echo "gl CP850"
++ echo "gl_ES CP850"
++ echo "id CP850" # not CP437 ??
++ echo "id_ID CP850" # not CP437 ??
++ echo "is CP861" # not CP850 ??
++ echo "is_IS CP861" # not CP850 ??
++ echo "it CP850"
++ echo "it_CH CP850"
++ echo "it_IT CP850"
++ echo "lt CP775"
++ echo "lt_LT CP775"
++ echo "lv CP775"
++ echo "lv_LV CP775"
++ echo "nb CP865" # not CP850 ??
++ echo "nb_NO CP865" # not CP850 ??
++ echo "nl CP850"
++ echo "nl_BE CP850"
++ echo "nl_NL CP850"
++ echo "nn CP865" # not CP850 ??
++ echo "nn_NO CP865" # not CP850 ??
++ echo "no CP865" # not CP850 ??
++ echo "no_NO CP865" # not CP850 ??
++ echo "pt CP850"
++ echo "pt_BR CP850"
++ echo "pt_PT CP850"
++ echo "sv CP850"
++ echo "sv_SE CP850"
++ # ISO-8859-2 languages
++ echo "cs CP852"
++ echo "cs_CZ CP852"
++ echo "hr CP852"
++ echo "hr_HR CP852"
++ echo "hu CP852"
++ echo "hu_HU CP852"
++ echo "pl CP852"
++ echo "pl_PL CP852"
++ echo "ro CP852"
++ echo "ro_RO CP852"
++ echo "sk CP852"
++ echo "sk_SK CP852"
++ echo "sl CP852"
++ echo "sl_SI CP852"
++ echo "sq CP852"
++ echo "sq_AL CP852"
++ echo "sr CP852" # CP852 or CP866 or CP855 ??
++ echo "sr_CS CP852" # CP852 or CP866 or CP855 ??
++ echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
++ # ISO-8859-3 languages
++ echo "mt CP850"
++ echo "mt_MT CP850"
++ # ISO-8859-5 languages
++ echo "be CP866"
++ echo "be_BE CP866"
++ echo "bg CP866" # not CP855 ??
++ echo "bg_BG CP866" # not CP855 ??
++ echo "mk CP866" # not CP855 ??
++ echo "mk_MK CP866" # not CP855 ??
++ echo "ru CP866"
++ echo "ru_RU CP866"
++ echo "uk CP1125"
++ echo "uk_UA CP1125"
++ # ISO-8859-6 languages
++ echo "ar CP864"
++ echo "ar_AE CP864"
++ echo "ar_DZ CP864"
++ echo "ar_EG CP864"
++ echo "ar_IQ CP864"
++ echo "ar_IR CP864"
++ echo "ar_JO CP864"
++ echo "ar_KW CP864"
++ echo "ar_MA CP864"
++ echo "ar_OM CP864"
++ echo "ar_QA CP864"
++ echo "ar_SA CP864"
++ echo "ar_SY CP864"
++ # ISO-8859-7 languages
++ echo "el CP869"
++ echo "el_GR CP869"
++ # ISO-8859-8 languages
++ echo "he CP862"
++ echo "he_IL CP862"
++ # ISO-8859-9 languages
++ echo "tr CP857"
++ echo "tr_TR CP857"
++ # Japanese
++ echo "ja CP932"
++ echo "ja_JP CP932"
++ # Chinese
++ echo "zh_CN GBK"
++ echo "zh_TW CP950" # not CP938 ??
++ # Korean
++ echo "kr CP949" # not CP934 ??
++ echo "kr_KR CP949" # not CP934 ??
++ # Thai
++ echo "th CP874"
++ echo "th_TH CP874"
++ # Other
++ echo "eo CP850"
++ echo "eo_EO CP850"
++ ;;
++esac
+--- lrzsz-0.12.20.safe/intl/dcgettext.c 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/dcgettext.c 2004-09-12 14:40:34.359747480 -0400
+@@ -1,593 +1,56 @@
+-/* Implementation of the dcgettext(3) function
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++/* Implementation of the dcgettext(3) function.
++ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#include <sys/types.h>
+-
+-#ifdef __GNUC__
+-# define alloca __builtin_alloca
+-# define HAVE_ALLOCA 1
+-#else
+-# if defined HAVE_ALLOCA_H || defined _LIBC
+-# include <alloca.h>
+-# else
+-# ifdef _AIX
+- #pragma alloca
+-# else
+-# ifndef alloca
+-char *alloca ();
+-# endif
+-# endif
+-# endif
+-#endif
+-
+-#include <errno.h>
+-#ifndef errno
+-extern int errno;
+-#endif
+-#ifndef __set_errno
+-# define __set_errno(val) errno = (val)
+-#endif
+-
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#else
+-char *getenv ();
+-# ifdef HAVE_MALLOC_H
+-# include <malloc.h>
+-# else
+-void free ();
+-# endif
+-#endif
+-
+-#if defined HAVE_STRING_H || defined _LIBC
+-# ifndef _GNU_SOURCE
+-# define _GNU_SOURCE 1
+-# endif
+-# include <string.h>
+-#else
+-# include <strings.h>
+-#endif
+-#if !HAVE_STRCHR && !defined _LIBC
+-# ifndef strchr
+-# define strchr index
+-# endif
+-#endif
+-
+-#if defined HAVE_UNISTD_H || defined _LIBC
+-# include <unistd.h>
+-#endif
+-
+-#include "gettext.h"
+ #include "gettextP.h"
+ #ifdef _LIBC
+ # include <libintl.h>
+ #else
+-# include "libgettext.h"
++# include "libgnuintl.h"
+ #endif
+-#include "hash-string.h"
+
+ /* @@ end of prolog @@ */
+
+-#ifdef _LIBC
+-/* Rename the non ANSI C functions. This is required by the standard
+- because some ANSI C functions will require linking with this object
+- file and the name space must not be polluted. */
+-# define getcwd __getcwd
+-# define stpcpy __stpcpy
+-#else
+-# if !defined HAVE_GETCWD
+-char *getwd ();
+-# define getcwd(buf, max) getwd (buf)
+-# else
+-char *getcwd ();
+-# endif
+-# ifndef HAVE_STPCPY
+-static char *stpcpy PARAMS ((char *dest, const char *src));
+-# endif
+-#endif
+-
+-/* Amount to increase buffer size by in each try. */
+-#define PATH_INCR 32
+-
+-/* The following is from pathmax.h. */
+-/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
+- PATH_MAX but might cause redefinition warnings when sys/param.h is
+- later included (as on MORE/BSD 4.3). */
+-#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
+-# include <limits.h>
+-#endif
+-
+-#ifndef _POSIX_PATH_MAX
+-# define _POSIX_PATH_MAX 255
+-#endif
+-
+-#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
+-# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
+-#endif
+-
+-/* Don't include sys/param.h if it already has been. */
+-#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
+-# include <sys/param.h>
+-#endif
+-
+-#if !defined(PATH_MAX) && defined(MAXPATHLEN)
+-# define PATH_MAX MAXPATHLEN
+-#endif
+-
+-#ifndef PATH_MAX
+-# define PATH_MAX _POSIX_PATH_MAX
+-#endif
+-
+-/* XPG3 defines the result of `setlocale (category, NULL)' as:
+- ``Directs `setlocale()' to query `category' and return the current
+- setting of `local'.''
+- However it does not specify the exact format. And even worse: POSIX
+- defines this not at all. So we can use this feature only on selected
+- system (e.g. those using GNU C Library). */
+-#ifdef _LIBC
+-# define HAVE_LOCALE_NULL
+-#endif
+-
+-/* Name of the default domain used for gettext(3) prior any call to
+- textdomain(3). The default value for this is "messages". */
+-const char _nl_default_default_domain[] = "messages";
+-
+-/* Value used as the default domain for gettext(3). */
+-const char *_nl_current_default_domain = _nl_default_default_domain;
+-
+-/* Contains the default location of the message catalogs. */
+-const char _nl_default_dirname[] = GNULOCALEDIR;
+-
+-/* List with bindings of specific domains created by bindtextdomain()
+- calls. */
+-struct binding *_nl_domain_bindings;
+-
+-/* Prototypes for local functions. */
+-static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
+- const char *msgid));
+-static const char *category_to_name PARAMS ((int category));
+-static const char *guess_category_value PARAMS ((int category,
+- const char *categoryname));
+-
+-
+-/* For those loosing systems which don't have `alloca' we have to add
+- some additional code emulating it. */
+-#ifdef HAVE_ALLOCA
+-/* Nothing has to be done. */
+-# define ADD_BLOCK(list, address) /* nothing */
+-# define FREE_BLOCKS(list) /* nothing */
+-#else
+-struct block_list
+-{
+- void *address;
+- struct block_list *next;
+-};
+-# define ADD_BLOCK(list, addr) \
+- do { \
+- struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+- /* If we cannot get a free block we cannot add the new element to \
+- the list. */ \
+- if (newp != NULL) { \
+- newp->address = (addr); \
+- newp->next = (list); \
+- (list) = newp; \
+- } \
+- } while (0)
+-# define FREE_BLOCKS(list) \
+- do { \
+- while (list != NULL) { \
+- struct block_list *old = list; \
+- list = list->next; \
+- free (old); \
+- } \
+- } while (0)
+-# undef alloca
+-# define alloca(size) (malloc (size))
+-#endif /* have alloca */
+-
+-
+ /* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define DCGETTEXT __dcgettext
++# define DCIGETTEXT __dcigettext
+ #else
+-# define DCGETTEXT dcgettext__
++# define DCGETTEXT libintl_dcgettext
++# define DCIGETTEXT libintl_dcigettext
+ #endif
+
+ /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+ locale. */
+ char *
+-DCGETTEXT (domainname, msgid, category)
+- const char *domainname;
+- const char *msgid;
+- int category;
++DCGETTEXT (const char *domainname, const char *msgid, int category)
+ {
+-#ifndef HAVE_ALLOCA
+- struct block_list *block_list = NULL;
+-#endif
+- struct loaded_l10nfile *domain;
+- struct binding *binding;
+- const char *categoryname;
+- const char *categoryvalue;
+- char *dirname, *xdomainname;
+- char *single_locale;
+- char *retval;
+- int saved_errno = errno;
+-
+- /* If no real MSGID is given return NULL. */
+- if (msgid == NULL)
+- return NULL;
+-
+- /* If DOMAINNAME is NULL, we are interested in the default domain. If
+- CATEGORY is not LC_MESSAGES this might not make much sense but the
+- defintion left this undefined. */
+- if (domainname == NULL)
+- domainname = _nl_current_default_domain;
+-
+- /* First find matching binding. */
+- for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+- {
+- int compare = strcmp (domainname, binding->domainname);
+- if (compare == 0)
+- /* We found it! */
+- break;
+- if (compare < 0)
+- {
+- /* It is not in the list. */
+- binding = NULL;
+- break;
+- }
+- }
+-
+- if (binding == NULL)
+- dirname = (char *) _nl_default_dirname;
+- else if (binding->dirname[0] == '/')
+- dirname = binding->dirname;
+- else
+- {
+- /* We have a relative path. Make it absolute now. */
+- size_t dirname_len = strlen (binding->dirname) + 1;
+- size_t path_max;
+- char *ret;
+-
+- path_max = (unsigned) PATH_MAX;
+- path_max += 2; /* The getcwd docs say to do this. */
+-
+- dirname = (char *) alloca (path_max + dirname_len);
+- ADD_BLOCK (block_list, dirname);
+-
+- __set_errno (0);
+- while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
+- {
+- path_max += PATH_INCR;
+- dirname = (char *) alloca (path_max + dirname_len);
+- ADD_BLOCK (block_list, dirname);
+- __set_errno (0);
+- }
+-
+- if (ret == NULL)
+- {
+- /* We cannot get the current working directory. Don't signal an
+- error but simply return the default string. */
+- FREE_BLOCKS (block_list);
+- __set_errno (saved_errno);
+- return (char *) msgid;
+- }
+-
+- stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
+- }
+-
+- /* Now determine the symbolic name of CATEGORY and its value. */
+- categoryname = category_to_name (category);
+- categoryvalue = guess_category_value (category, categoryname);
+-
+- xdomainname = (char *) alloca (strlen (categoryname)
+- + strlen (domainname) + 5);
+- ADD_BLOCK (block_list, xdomainname);
+-
+- stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
+- domainname),
+- ".mo");
+-
+- /* Creating working area. */
+- single_locale = (char *) alloca (strlen (categoryvalue) + 1);
+- ADD_BLOCK (block_list, single_locale);
+-
+-
+- /* Search for the given string. This is a loop because we perhaps
+- got an ordered list of languages to consider for th translation. */
+- while (1)
+- {
+- /* Make CATEGORYVALUE point to the next element of the list. */
+- while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
+- ++categoryvalue;
+- if (categoryvalue[0] == '\0')
+- {
+- /* The whole contents of CATEGORYVALUE has been searched but
+- no valid entry has been found. We solve this situation
+- by implicitly appending a "C" entry, i.e. no translation
+- will take place. */
+- single_locale[0] = 'C';
+- single_locale[1] = '\0';
+- }
+- else
+- {
+- char *cp = single_locale;
+- while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
+- *cp++ = *categoryvalue++;
+- *cp = '\0';
+- }
+-
+- /* If the current locale value is C (or POSIX) we don't load a
+- domain. Return the MSGID. */
+- if (strcmp (single_locale, "C") == 0
+- || strcmp (single_locale, "POSIX") == 0)
+- {
+- FREE_BLOCKS (block_list);
+- __set_errno (saved_errno);
+- return (char *) msgid;
+- }
+-
+-
+- /* Find structure describing the message catalog matching the
+- DOMAINNAME and CATEGORY. */
+- domain = _nl_find_domain (dirname, single_locale, xdomainname);
+-
+- if (domain != NULL)
+- {
+- retval = find_msg (domain, msgid);
+-
+- if (retval == NULL)
+- {
+- int cnt;
+-
+- for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
+- {
+- retval = find_msg (domain->successor[cnt], msgid);
+-
+- if (retval != NULL)
+- break;
+- }
+- }
+-
+- if (retval != NULL)
+- {
+- FREE_BLOCKS (block_list);
+- __set_errno (saved_errno);
+- return retval;
+- }
+- }
+- }
+- /* NOTREACHED */
++ return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category);
+ }
+
+ #ifdef _LIBC
+ /* Alias for function name in GNU C Library. */
++INTDEF(__dcgettext)
+ weak_alias (__dcgettext, dcgettext);
+ #endif
+-
+-
+-static char *
+-find_msg (domain_file, msgid)
+- struct loaded_l10nfile *domain_file;
+- const char *msgid;
+-{
+- size_t top, act, bottom;
+- struct loaded_domain *domain;
+-
+- if (domain_file->decided == 0)
+- _nl_load_domain (domain_file);
+-
+- if (domain_file->data == NULL)
+- return NULL;
+-
+- domain = (struct loaded_domain *) domain_file->data;
+-
+- /* Locate the MSGID and its translation. */
+- if (domain->hash_size > 2 && domain->hash_tab != NULL)
+- {
+- /* Use the hashing table. */
+- nls_uint32 len = strlen (msgid);
+- nls_uint32 hash_val = hash_string (msgid);
+- nls_uint32 idx = hash_val % domain->hash_size;
+- nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
+- nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
+-
+- if (nstr == 0)
+- /* Hash table entry is empty. */
+- return NULL;
+-
+- if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+- && strcmp (msgid,
+- domain->data + W (domain->must_swap,
+- domain->orig_tab[nstr - 1].offset)) == 0)
+- return (char *) domain->data + W (domain->must_swap,
+- domain->trans_tab[nstr - 1].offset);
+-
+- while (1)
+- {
+- if (idx >= domain->hash_size - incr)
+- idx -= domain->hash_size - incr;
+- else
+- idx += incr;
+-
+- nstr = W (domain->must_swap, domain->hash_tab[idx]);
+- if (nstr == 0)
+- /* Hash table entry is empty. */
+- return NULL;
+-
+- if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+- && strcmp (msgid,
+- domain->data + W (domain->must_swap,
+- domain->orig_tab[nstr - 1].offset))
+- == 0)
+- return (char *) domain->data
+- + W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
+- }
+- /* NOTREACHED */
+- }
+-
+- /* Now we try the default method: binary search in the sorted
+- array of messages. */
+- bottom = 0;
+- top = domain->nstrings;
+- while (bottom < top)
+- {
+- int cmp_val;
+-
+- act = (bottom + top) / 2;
+- cmp_val = strcmp (msgid, domain->data
+- + W (domain->must_swap,
+- domain->orig_tab[act].offset));
+- if (cmp_val < 0)
+- top = act;
+- else if (cmp_val > 0)
+- bottom = act + 1;
+- else
+- break;
+- }
+-
+- /* If an translation is found return this. */
+- return bottom >= top ? NULL : (char *) domain->data
+- + W (domain->must_swap,
+- domain->trans_tab[act].offset);
+-}
+-
+-
+-/* Return string representation of locale CATEGORY. */
+-static const char *
+-category_to_name (category)
+- int category;
+-{
+- const char *retval;
+-
+- switch (category)
+- {
+-#ifdef LC_COLLATE
+- case LC_COLLATE:
+- retval = "LC_COLLATE";
+- break;
+-#endif
+-#ifdef LC_CTYPE
+- case LC_CTYPE:
+- retval = "LC_CTYPE";
+- break;
+-#endif
+-#ifdef LC_MONETARY
+- case LC_MONETARY:
+- retval = "LC_MONETARY";
+- break;
+-#endif
+-#ifdef LC_NUMERIC
+- case LC_NUMERIC:
+- retval = "LC_NUMERIC";
+- break;
+-#endif
+-#ifdef LC_TIME
+- case LC_TIME:
+- retval = "LC_TIME";
+- break;
+-#endif
+-#ifdef LC_MESSAGES
+- case LC_MESSAGES:
+- retval = "LC_MESSAGES";
+- break;
+-#endif
+-#ifdef LC_RESPONSE
+- case LC_RESPONSE:
+- retval = "LC_RESPONSE";
+- break;
+-#endif
+-#ifdef LC_ALL
+- case LC_ALL:
+- /* This might not make sense but is perhaps better than any other
+- value. */
+- retval = "LC_ALL";
+- break;
+-#endif
+- default:
+- /* If you have a better idea for a default value let me know. */
+- retval = "LC_XXX";
+- }
+-
+- return retval;
+-}
+-
+-/* Guess value of current locale from value of the environment variables. */
+-static const char *
+-guess_category_value (category, categoryname)
+- int category;
+- const char *categoryname;
+-{
+- const char *retval;
+-
+- /* The highest priority value is the `LANGUAGE' environment
+- variable. This is a GNU extension. */
+- retval = getenv ("LANGUAGE");
+- if (retval != NULL && retval[0] != '\0')
+- return retval;
+-
+- /* `LANGUAGE' is not set. So we have to proceed with the POSIX
+- methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
+- systems this can be done by the `setlocale' function itself. */
+-#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
+- return setlocale (category, NULL);
+-#else
+- /* Setting of LC_ALL overwrites all other. */
+- retval = getenv ("LC_ALL");
+- if (retval != NULL && retval[0] != '\0')
+- return retval;
+-
+- /* Next comes the name of the desired category. */
+- retval = getenv (categoryname);
+- if (retval != NULL && retval[0] != '\0')
+- return retval;
+-
+- /* Last possibility is the LANG environment variable. */
+- retval = getenv ("LANG");
+- if (retval != NULL && retval[0] != '\0')
+- return retval;
+-
+- /* We use C as the default domain. POSIX says this is implementation
+- defined. */
+- return "C";
+-#endif
+-}
+-
+-/* @@ begin of epilog @@ */
+-
+-/* We don't want libintl.a to depend on any other library. So we
+- avoid the non-standard function stpcpy. In GNU C Library this
+- function is available, though. Also allow the symbol HAVE_STPCPY
+- to be defined. */
+-#if !_LIBC && !HAVE_STPCPY
+-static char *
+-stpcpy (dest, src)
+- char *dest;
+- const char *src;
+-{
+- while ((*dest++ = *src++) != '\0')
+- /* Do nothing. */ ;
+- return dest - 1;
+-}
+-#endif
+--- lrzsz-0.12.20.safe/intl/dcigettext.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/dcigettext.c 2004-09-12 14:40:34.369745960 -0400
+@@ -0,0 +1,1219 @@
++/* Implementation of the internal dcigettext function.
++ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Tell glibc's <string.h> to provide a prototype for mempcpy().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <sys/types.h>
++
++#ifdef __GNUC__
++# define alloca __builtin_alloca
++# define HAVE_ALLOCA 1
++#else
++# ifdef _MSC_VER
++# include <malloc.h>
++# define alloca _alloca
++# else
++# if defined HAVE_ALLOCA_H || defined _LIBC
++# include <alloca.h>
++# else
++# ifdef _AIX
++ #pragma alloca
++# else
++# ifndef alloca
++char *alloca ();
++# endif
++# endif
++# endif
++# endif
++#endif
++
++#include <errno.h>
++#ifndef errno
++extern int errno;
++#endif
++#ifndef __set_errno
++# define __set_errno(val) errno = (val)
++#endif
++
++#include <stddef.h>
++#include <stdlib.h>
++#include <string.h>
++
++#if defined HAVE_UNISTD_H || defined _LIBC
++# include <unistd.h>
++#endif
++
++#include <locale.h>
++
++#ifdef _LIBC
++ /* Guess whether integer division by zero raises signal SIGFPE.
++ Set to 1 only if you know for sure. In case of doubt, set to 0. */
++# if defined __alpha__ || defined __arm__ || defined __i386__ \
++ || defined __m68k__ || defined __s390__
++# define INTDIV0_RAISES_SIGFPE 1
++# else
++# define INTDIV0_RAISES_SIGFPE 0
++# endif
++#endif
++#if !INTDIV0_RAISES_SIGFPE
++# include <signal.h>
++#endif
++
++#if defined HAVE_SYS_PARAM_H || defined _LIBC
++# include <sys/param.h>
++#endif
++
++#include "gettextP.h"
++#include "plural-exp.h"
++#ifdef _LIBC
++# include <libintl.h>
++#else
++# include "libgnuintl.h"
++#endif
++#include "hash-string.h"
++
++/* Thread safetyness. */
++#ifdef _LIBC
++# include <bits/libc-lock.h>
++#else
++/* Provide dummy implementation if this is outside glibc. */
++# define __libc_lock_define_initialized(CLASS, NAME)
++# define __libc_lock_lock(NAME)
++# define __libc_lock_unlock(NAME)
++# define __libc_rwlock_define_initialized(CLASS, NAME)
++# define __libc_rwlock_rdlock(NAME)
++# define __libc_rwlock_unlock(NAME)
++#endif
++
++/* Alignment of types. */
++#if defined __GNUC__ && __GNUC__ >= 2
++# define alignof(TYPE) __alignof__ (TYPE)
++#else
++# define alignof(TYPE) \
++ ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
++#endif
++
++/* The internal variables in the standalone libintl.a must have different
++ names than the internal variables in GNU libc, otherwise programs
++ using libintl.a cannot be linked statically. */
++#if !defined _LIBC
++# define _nl_default_default_domain libintl_nl_default_default_domain
++# define _nl_current_default_domain libintl_nl_current_default_domain
++# define _nl_default_dirname libintl_nl_default_dirname
++# define _nl_domain_bindings libintl_nl_domain_bindings
++#endif
++
++/* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>. */
++#ifndef offsetof
++# define offsetof(type,ident) ((size_t)&(((type*)0)->ident))
++#endif
++
++/* @@ end of prolog @@ */
++
++#ifdef _LIBC
++/* Rename the non ANSI C functions. This is required by the standard
++ because some ANSI C functions will require linking with this object
++ file and the name space must not be polluted. */
++# define getcwd __getcwd
++# ifndef stpcpy
++# define stpcpy __stpcpy
++# endif
++# define tfind __tfind
++#else
++# if !defined HAVE_GETCWD
++char *getwd ();
++# define getcwd(buf, max) getwd (buf)
++# else
++# if VMS
++# define getcwd(buf, max) (getcwd) (buf, max, 0)
++# else
++char *getcwd ();
++# endif
++# endif
++# ifndef HAVE_STPCPY
++static char *stpcpy (char *dest, const char *src);
++# endif
++# ifndef HAVE_MEMPCPY
++static void *mempcpy (void *dest, const void *src, size_t n);
++# endif
++#endif
++
++/* Amount to increase buffer size by in each try. */
++#define PATH_INCR 32
++
++/* The following is from pathmax.h. */
++/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
++ PATH_MAX but might cause redefinition warnings when sys/param.h is
++ later included (as on MORE/BSD 4.3). */
++#if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__)
++# include <limits.h>
++#endif
++
++#ifndef _POSIX_PATH_MAX
++# define _POSIX_PATH_MAX 255
++#endif
++
++#if !defined PATH_MAX && defined _PC_PATH_MAX
++# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
++#endif
++
++/* Don't include sys/param.h if it already has been. */
++#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
++# include <sys/param.h>
++#endif
++
++#if !defined PATH_MAX && defined MAXPATHLEN
++# define PATH_MAX MAXPATHLEN
++#endif
++
++#ifndef PATH_MAX
++# define PATH_MAX _POSIX_PATH_MAX
++#endif
++
++/* Pathname support.
++ ISSLASH(C) tests whether C is a directory separator character.
++ IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
++ it may be concatenated to a directory pathname.
++ IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
++ */
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS */
++# define ISSLASH(C) ((C) == '/' || (C) == '\\')
++# define HAS_DEVICE(P) \
++ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
++ && (P)[1] == ':')
++# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
++# define IS_PATH_WITH_DIR(P) \
++ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
++#else
++ /* Unix */
++# define ISSLASH(C) ((C) == '/')
++# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
++# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
++#endif
++
++/* This is the type used for the search tree where known translations
++ are stored. */
++struct known_translation_t
++{
++ /* Domain in which to search. */
++ char *domainname;
++
++ /* The category. */
++ int category;
++
++ /* State of the catalog counter at the point the string was found. */
++ int counter;
++
++ /* Catalog where the string was found. */
++ struct loaded_l10nfile *domain;
++
++ /* And finally the translation. */
++ const char *translation;
++ size_t translation_length;
++
++ /* Pointer to the string in question. */
++ char msgid[ZERO];
++};
++
++/* Root of the search tree with known translations. We can use this
++ only if the system provides the `tsearch' function family. */
++#if defined HAVE_TSEARCH || defined _LIBC
++# include <search.h>
++
++static void *root;
++
++# ifdef _LIBC
++# define tsearch __tsearch
++# endif
++
++/* Function to compare two entries in the table of known translations. */
++static int
++transcmp (const void *p1, const void *p2)
++{
++ const struct known_translation_t *s1;
++ const struct known_translation_t *s2;
++ int result;
++
++ s1 = (const struct known_translation_t *) p1;
++ s2 = (const struct known_translation_t *) p2;
++
++ result = strcmp (s1->msgid, s2->msgid);
++ if (result == 0)
++ {
++ result = strcmp (s1->domainname, s2->domainname);
++ if (result == 0)
++ /* We compare the category last (though this is the cheapest
++ operation) since it is hopefully always the same (namely
++ LC_MESSAGES). */
++ result = s1->category - s2->category;
++ }
++
++ return result;
++}
++#endif
++
++#ifndef INTVARDEF
++# define INTVARDEF(name)
++#endif
++#ifndef INTUSE
++# define INTUSE(name) name
++#endif
++
++/* Name of the default domain used for gettext(3) prior any call to
++ textdomain(3). The default value for this is "messages". */
++const char _nl_default_default_domain[] attribute_hidden = "messages";
++
++/* Value used as the default domain for gettext(3). */
++const char *_nl_current_default_domain attribute_hidden
++ = _nl_default_default_domain;
++
++/* Contains the default location of the message catalogs. */
++#if defined __EMX__
++extern const char _nl_default_dirname[];
++#else
++const char _nl_default_dirname[] = LOCALEDIR;
++INTVARDEF (_nl_default_dirname)
++#endif
++
++/* List with bindings of specific domains created by bindtextdomain()
++ calls. */
++struct binding *_nl_domain_bindings;
++
++/* Prototypes for local functions. */
++static char *plural_lookup (struct loaded_l10nfile *domain,
++ unsigned long int n,
++ const char *translation, size_t translation_len)
++ internal_function;
++static const char *guess_category_value (int category,
++ const char *categoryname)
++ internal_function;
++#ifdef _LIBC
++# include "../locale/localeinfo.h"
++# define category_to_name(category) _nl_category_names[category]
++#else
++static const char *category_to_name (int category) internal_function;
++#endif
++
++
++/* For those loosing systems which don't have `alloca' we have to add
++ some additional code emulating it. */
++#ifdef HAVE_ALLOCA
++/* Nothing has to be done. */
++# define freea(p) /* nothing */
++# define ADD_BLOCK(list, address) /* nothing */
++# define FREE_BLOCKS(list) /* nothing */
++#else
++struct block_list
++{
++ void *address;
++ struct block_list *next;
++};
++# define ADD_BLOCK(list, addr) \
++ do { \
++ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
++ /* If we cannot get a free block we cannot add the new element to \
++ the list. */ \
++ if (newp != NULL) { \
++ newp->address = (addr); \
++ newp->next = (list); \
++ (list) = newp; \
++ } \
++ } while (0)
++# define FREE_BLOCKS(list) \
++ do { \
++ while (list != NULL) { \
++ struct block_list *old = list; \
++ list = list->next; \
++ free (old->address); \
++ free (old); \
++ } \
++ } while (0)
++# undef alloca
++# define alloca(size) (malloc (size))
++# define freea(p) free (p)
++#endif /* have alloca */
++
++
++#ifdef _LIBC
++/* List of blocks allocated for translations. */
++typedef struct transmem_list
++{
++ struct transmem_list *next;
++ char data[ZERO];
++} transmem_block_t;
++static struct transmem_list *transmem_list;
++#else
++typedef unsigned char transmem_block_t;
++#endif
++
++
++/* Names for the libintl functions are a problem. They must not clash
++ with existing names and they should follow ANSI C. But this source
++ code is also used in GNU C Library where the names have a __
++ prefix. So we have to make a difference here. */
++#ifdef _LIBC
++# define DCIGETTEXT __dcigettext
++#else
++# define DCIGETTEXT libintl_dcigettext
++#endif
++
++/* Lock variable to protect the global data in the gettext implementation. */
++#ifdef _LIBC
++__libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden)
++#endif
++
++/* Checking whether the binaries runs SUID must be done and glibc provides
++ easier methods therefore we make a difference here. */
++#ifdef _LIBC
++# define ENABLE_SECURE __libc_enable_secure
++# define DETERMINE_SECURE
++#else
++# ifndef HAVE_GETUID
++# define getuid() 0
++# endif
++# ifndef HAVE_GETGID
++# define getgid() 0
++# endif
++# ifndef HAVE_GETEUID
++# define geteuid() getuid()
++# endif
++# ifndef HAVE_GETEGID
++# define getegid() getgid()
++# endif
++static int enable_secure;
++# define ENABLE_SECURE (enable_secure == 1)
++# define DETERMINE_SECURE \
++ if (enable_secure == 0) \
++ { \
++ if (getuid () != geteuid () || getgid () != getegid ()) \
++ enable_secure = 1; \
++ else \
++ enable_secure = -1; \
++ }
++#endif
++
++/* Get the function to evaluate the plural expression. */
++#include "eval-plural.h"
++
++/* Look up MSGID in the DOMAINNAME message catalog for the current
++ CATEGORY locale and, if PLURAL is nonzero, search over string
++ depending on the plural form determined by N. */
++char *
++DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
++ int plural, unsigned long int n, int category)
++{
++#ifndef HAVE_ALLOCA
++ struct block_list *block_list = NULL;
++#endif
++ struct loaded_l10nfile *domain;
++ struct binding *binding;
++ const char *categoryname;
++ const char *categoryvalue;
++ char *dirname, *xdomainname;
++ char *single_locale;
++ char *retval;
++ size_t retlen;
++ int saved_errno;
++#if defined HAVE_TSEARCH || defined _LIBC
++ struct known_translation_t *search;
++ struct known_translation_t **foundp = NULL;
++ size_t msgid_len;
++#endif
++ size_t domainname_len;
++
++ /* If no real MSGID is given return NULL. */
++ if (msgid1 == NULL)
++ return NULL;
++
++#ifdef _LIBC
++ if (category < 0 || category >= __LC_LAST || category == LC_ALL)
++ /* Bogus. */
++ return (plural == 0
++ ? (char *) msgid1
++ /* Use the Germanic plural rule. */
++ : n == 1 ? (char *) msgid1 : (char *) msgid2);
++#endif
++
++ __libc_rwlock_rdlock (_nl_state_lock);
++
++ /* If DOMAINNAME is NULL, we are interested in the default domain. If
++ CATEGORY is not LC_MESSAGES this might not make much sense but the
++ definition left this undefined. */
++ if (domainname == NULL)
++ domainname = _nl_current_default_domain;
++
++ /* OS/2 specific: backward compatibility with older libintl versions */
++#ifdef LC_MESSAGES_COMPAT
++ if (category == LC_MESSAGES_COMPAT)
++ category = LC_MESSAGES;
++#endif
++
++#if defined HAVE_TSEARCH || defined _LIBC
++ msgid_len = strlen (msgid1) + 1;
++
++ /* Try to find the translation among those which we found at
++ some time. */
++ search = (struct known_translation_t *)
++ alloca (offsetof (struct known_translation_t, msgid) + msgid_len);
++ memcpy (search->msgid, msgid1, msgid_len);
++ search->domainname = (char *) domainname;
++ search->category = category;
++
++ foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
++ freea (search);
++ if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
++ {
++ /* Now deal with plural. */
++ if (plural)
++ retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation,
++ (*foundp)->translation_length);
++ else
++ retval = (char *) (*foundp)->translation;
++
++ __libc_rwlock_unlock (_nl_state_lock);
++ return retval;
++ }
++#endif
++
++ /* Preserve the `errno' value. */
++ saved_errno = errno;
++
++ /* See whether this is a SUID binary or not. */
++ DETERMINE_SECURE;
++
++ /* First find matching binding. */
++ for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
++ {
++ int compare = strcmp (domainname, binding->domainname);
++ if (compare == 0)
++ /* We found it! */
++ break;
++ if (compare < 0)
++ {
++ /* It is not in the list. */
++ binding = NULL;
++ break;
++ }
++ }
++
++ if (binding == NULL)
++ dirname = (char *) INTUSE(_nl_default_dirname);
++ else if (IS_ABSOLUTE_PATH (binding->dirname))
++ dirname = binding->dirname;
++ else
++ {
++ /* We have a relative path. Make it absolute now. */
++ size_t dirname_len = strlen (binding->dirname) + 1;
++ size_t path_max;
++ char *ret;
++
++ path_max = (unsigned int) PATH_MAX;
++ path_max += 2; /* The getcwd docs say to do this. */
++
++ for (;;)
++ {
++ dirname = (char *) alloca (path_max + dirname_len);
++ ADD_BLOCK (block_list, dirname);
++
++ __set_errno (0);
++ ret = getcwd (dirname, path_max);
++ if (ret != NULL || errno != ERANGE)
++ break;
++
++ path_max += path_max / 2;
++ path_max += PATH_INCR;
++ }
++
++ if (ret == NULL)
++ /* We cannot get the current working directory. Don't signal an
++ error but simply return the default string. */
++ goto return_untranslated;
++
++ stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
++ }
++
++ /* Now determine the symbolic name of CATEGORY and its value. */
++ categoryname = category_to_name (category);
++ categoryvalue = guess_category_value (category, categoryname);
++
++ domainname_len = strlen (domainname);
++ xdomainname = (char *) alloca (strlen (categoryname)
++ + domainname_len + 5);
++ ADD_BLOCK (block_list, xdomainname);
++
++ stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
++ domainname, domainname_len),
++ ".mo");
++
++ /* Creating working area. */
++ single_locale = (char *) alloca (strlen (categoryvalue) + 1);
++ ADD_BLOCK (block_list, single_locale);
++
++
++ /* Search for the given string. This is a loop because we perhaps
++ got an ordered list of languages to consider for the translation. */
++ while (1)
++ {
++ /* Make CATEGORYVALUE point to the next element of the list. */
++ while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
++ ++categoryvalue;
++ if (categoryvalue[0] == '\0')
++ {
++ /* The whole contents of CATEGORYVALUE has been searched but
++ no valid entry has been found. We solve this situation
++ by implicitly appending a "C" entry, i.e. no translation
++ will take place. */
++ single_locale[0] = 'C';
++ single_locale[1] = '\0';
++ }
++ else
++ {
++ char *cp = single_locale;
++ while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
++ *cp++ = *categoryvalue++;
++ *cp = '\0';
++
++ /* When this is a SUID binary we must not allow accessing files
++ outside the dedicated directories. */
++ if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale))
++ /* Ingore this entry. */
++ continue;
++ }
++
++ /* If the current locale value is C (or POSIX) we don't load a
++ domain. Return the MSGID. */
++ if (strcmp (single_locale, "C") == 0
++ || strcmp (single_locale, "POSIX") == 0)
++ break;
++
++ /* Find structure describing the message catalog matching the
++ DOMAINNAME and CATEGORY. */
++ domain = _nl_find_domain (dirname, single_locale, xdomainname, binding);
++
++ if (domain != NULL)
++ {
++ retval = _nl_find_msg (domain, binding, msgid1, &retlen);
++
++ if (retval == NULL)
++ {
++ int cnt;
++
++ for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
++ {
++ retval = _nl_find_msg (domain->successor[cnt], binding,
++ msgid1, &retlen);
++
++ if (retval != NULL)
++ {
++ domain = domain->successor[cnt];
++ break;
++ }
++ }
++ }
++
++ if (retval != NULL)
++ {
++ /* Found the translation of MSGID1 in domain DOMAIN:
++ starting at RETVAL, RETLEN bytes. */
++ FREE_BLOCKS (block_list);
++#if defined HAVE_TSEARCH || defined _LIBC
++ if (foundp == NULL)
++ {
++ /* Create a new entry and add it to the search tree. */
++ struct known_translation_t *newp;
++
++ newp = (struct known_translation_t *)
++ malloc (offsetof (struct known_translation_t, msgid)
++ + msgid_len + domainname_len + 1);
++ if (newp != NULL)
++ {
++ newp->domainname =
++ mempcpy (newp->msgid, msgid1, msgid_len);
++ memcpy (newp->domainname, domainname, domainname_len + 1);
++ newp->category = category;
++ newp->counter = _nl_msg_cat_cntr;
++ newp->domain = domain;
++ newp->translation = retval;
++ newp->translation_length = retlen;
++
++ /* Insert the entry in the search tree. */
++ foundp = (struct known_translation_t **)
++ tsearch (newp, &root, transcmp);
++ if (foundp == NULL
++ || __builtin_expect (*foundp != newp, 0))
++ /* The insert failed. */
++ free (newp);
++ }
++ }
++ else
++ {
++ /* We can update the existing entry. */
++ (*foundp)->counter = _nl_msg_cat_cntr;
++ (*foundp)->domain = domain;
++ (*foundp)->translation = retval;
++ (*foundp)->translation_length = retlen;
++ }
++#endif
++ __set_errno (saved_errno);
++
++ /* Now deal with plural. */
++ if (plural)
++ retval = plural_lookup (domain, n, retval, retlen);
++
++ __libc_rwlock_unlock (_nl_state_lock);
++ return retval;
++ }
++ }
++ }
++
++ return_untranslated:
++ /* Return the untranslated MSGID. */
++ FREE_BLOCKS (block_list);
++ __libc_rwlock_unlock (_nl_state_lock);
++#ifndef _LIBC
++ if (!ENABLE_SECURE)
++ {
++ extern void _nl_log_untranslated (const char *logfilename,
++ const char *domainname,
++ const char *msgid1, const char *msgid2,
++ int plural);
++ const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED");
++
++ if (logfilename != NULL && logfilename[0] != '\0')
++ _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural);
++ }
++#endif
++ __set_errno (saved_errno);
++ return (plural == 0
++ ? (char *) msgid1
++ /* Use the Germanic plural rule. */
++ : n == 1 ? (char *) msgid1 : (char *) msgid2);
++}
++
++
++char *
++internal_function
++_nl_find_msg (struct loaded_l10nfile *domain_file,
++ struct binding *domainbinding, const char *msgid,
++ size_t *lengthp)
++{
++ struct loaded_domain *domain;
++ nls_uint32 nstrings;
++ size_t act;
++ char *result;
++ size_t resultlen;
++
++ if (domain_file->decided == 0)
++ _nl_load_domain (domain_file, domainbinding);
++
++ if (domain_file->data == NULL)
++ return NULL;
++
++ domain = (struct loaded_domain *) domain_file->data;
++
++ nstrings = domain->nstrings;
++
++ /* Locate the MSGID and its translation. */
++ if (domain->hash_tab != NULL)
++ {
++ /* Use the hashing table. */
++ nls_uint32 len = strlen (msgid);
++ nls_uint32 hash_val = hash_string (msgid);
++ nls_uint32 idx = hash_val % domain->hash_size;
++ nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
++
++ while (1)
++ {
++ nls_uint32 nstr =
++ W (domain->must_swap_hash_tab, domain->hash_tab[idx]);
++
++ if (nstr == 0)
++ /* Hash table entry is empty. */
++ return NULL;
++
++ nstr--;
++
++ /* Compare msgid with the original string at index nstr.
++ We compare the lengths with >=, not ==, because plural entries
++ are represented by strings with an embedded NUL. */
++ if (nstr < nstrings
++ ? W (domain->must_swap, domain->orig_tab[nstr].length) >= len
++ && (strcmp (msgid,
++ domain->data + W (domain->must_swap,
++ domain->orig_tab[nstr].offset))
++ == 0)
++ : domain->orig_sysdep_tab[nstr - nstrings].length > len
++ && (strcmp (msgid,
++ domain->orig_sysdep_tab[nstr - nstrings].pointer)
++ == 0))
++ {
++ act = nstr;
++ goto found;
++ }
++
++ if (idx >= domain->hash_size - incr)
++ idx -= domain->hash_size - incr;
++ else
++ idx += incr;
++ }
++ /* NOTREACHED */
++ }
++ else
++ {
++ /* Try the default method: binary search in the sorted array of
++ messages. */
++ size_t top, bottom;
++
++ bottom = 0;
++ top = nstrings;
++ while (bottom < top)
++ {
++ int cmp_val;
++
++ act = (bottom + top) / 2;
++ cmp_val = strcmp (msgid, (domain->data
++ + W (domain->must_swap,
++ domain->orig_tab[act].offset)));
++ if (cmp_val < 0)
++ top = act;
++ else if (cmp_val > 0)
++ bottom = act + 1;
++ else
++ goto found;
++ }
++ /* No translation was found. */
++ return NULL;
++ }
++
++ found:
++ /* The translation was found at index ACT. If we have to convert the
++ string to use a different character set, this is the time. */
++ if (act < nstrings)
++ {
++ result = (char *)
++ (domain->data + W (domain->must_swap, domain->trans_tab[act].offset));
++ resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1;
++ }
++ else
++ {
++ result = (char *) domain->trans_sysdep_tab[act - nstrings].pointer;
++ resultlen = domain->trans_sysdep_tab[act - nstrings].length;
++ }
++
++#if defined _LIBC || HAVE_ICONV
++ if (domain->codeset_cntr
++ != (domainbinding != NULL ? domainbinding->codeset_cntr : 0))
++ {
++ /* The domain's codeset has changed through bind_textdomain_codeset()
++ since the message catalog was initialized or last accessed. We
++ have to reinitialize the converter. */
++ _nl_free_domain_conv (domain);
++ _nl_init_domain_conv (domain_file, domain, domainbinding);
++ }
++
++ if (
++# ifdef _LIBC
++ domain->conv != (__gconv_t) -1
++# else
++# if HAVE_ICONV
++ domain->conv != (iconv_t) -1
++# endif
++# endif
++ )
++ {
++ /* We are supposed to do a conversion. First allocate an
++ appropriate table with the same structure as the table
++ of translations in the file, where we can put the pointers
++ to the converted strings in.
++ There is a slight complication with plural entries. They
++ are represented by consecutive NUL terminated strings. We
++ handle this case by converting RESULTLEN bytes, including
++ NULs. */
++
++ if (domain->conv_tab == NULL
++ && ((domain->conv_tab =
++ (char **) calloc (nstrings + domain->n_sysdep_strings,
++ sizeof (char *)))
++ == NULL))
++ /* Mark that we didn't succeed allocating a table. */
++ domain->conv_tab = (char **) -1;
++
++ if (__builtin_expect (domain->conv_tab == (char **) -1, 0))
++ /* Nothing we can do, no more memory. */
++ goto converted;
++
++ if (domain->conv_tab[act] == NULL)
++ {
++ /* We haven't used this string so far, so it is not
++ translated yet. Do this now. */
++ /* We use a bit more efficient memory handling.
++ We allocate always larger blocks which get used over
++ time. This is faster than many small allocations. */
++ __libc_lock_define_initialized (static, lock)
++# define INITIAL_BLOCK_SIZE 4080
++ static unsigned char *freemem;
++ static size_t freemem_size;
++
++ const unsigned char *inbuf;
++ unsigned char *outbuf;
++ int malloc_count;
++# ifndef _LIBC
++ transmem_block_t *transmem_list = NULL;
++# endif
++
++ __libc_lock_lock (lock);
++
++ inbuf = (const unsigned char *) result;
++ outbuf = freemem + sizeof (size_t);
++
++ malloc_count = 0;
++ while (1)
++ {
++ transmem_block_t *newmem;
++# ifdef _LIBC
++ size_t non_reversible;
++ int res;
++
++ if (freemem_size < sizeof (size_t))
++ goto resize_freemem;
++
++ res = __gconv (domain->conv,
++ &inbuf, inbuf + resultlen,
++ &outbuf,
++ outbuf + freemem_size - sizeof (size_t),
++ &non_reversible);
++
++ if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT)
++ break;
++
++ if (res != __GCONV_FULL_OUTPUT)
++ {
++ __libc_lock_unlock (lock);
++ goto converted;
++ }
++
++ inbuf = result;
++# else
++# if HAVE_ICONV
++ const char *inptr = (const char *) inbuf;
++ size_t inleft = resultlen;
++ char *outptr = (char *) outbuf;
++ size_t outleft;
++
++ if (freemem_size < sizeof (size_t))
++ goto resize_freemem;
++
++ outleft = freemem_size - sizeof (size_t);
++ if (iconv (domain->conv,
++ (ICONV_CONST char **) &inptr, &inleft,
++ &outptr, &outleft)
++ != (size_t) (-1))
++ {
++ outbuf = (unsigned char *) outptr;
++ break;
++ }
++ if (errno != E2BIG)
++ {
++ __libc_lock_unlock (lock);
++ goto converted;
++ }
++# endif
++# endif
++
++ resize_freemem:
++ /* We must allocate a new buffer or resize the old one. */
++ if (malloc_count > 0)
++ {
++ ++malloc_count;
++ freemem_size = malloc_count * INITIAL_BLOCK_SIZE;
++ newmem = (transmem_block_t *) realloc (transmem_list,
++ freemem_size);
++# ifdef _LIBC
++ if (newmem != NULL)
++ transmem_list = transmem_list->next;
++ else
++ {
++ struct transmem_list *old = transmem_list;
++
++ transmem_list = transmem_list->next;
++ free (old);
++ }
++# endif
++ }
++ else
++ {
++ malloc_count = 1;
++ freemem_size = INITIAL_BLOCK_SIZE;
++ newmem = (transmem_block_t *) malloc (freemem_size);
++ }
++ if (__builtin_expect (newmem == NULL, 0))
++ {
++ freemem = NULL;
++ freemem_size = 0;
++ __libc_lock_unlock (lock);
++ goto converted;
++ }
++
++# ifdef _LIBC
++ /* Add the block to the list of blocks we have to free
++ at some point. */
++ newmem->next = transmem_list;
++ transmem_list = newmem;
++
++ freemem = newmem->data;
++ freemem_size -= offsetof (struct transmem_list, data);
++# else
++ transmem_list = newmem;
++ freemem = newmem;
++# endif
++
++ outbuf = freemem + sizeof (size_t);
++ }
++
++ /* We have now in our buffer a converted string. Put this
++ into the table of conversions. */
++ *(size_t *) freemem = outbuf - freemem - sizeof (size_t);
++ domain->conv_tab[act] = (char *) freemem;
++ /* Shrink freemem, but keep it aligned. */
++ freemem_size -= outbuf - freemem;
++ freemem = outbuf;
++ freemem += freemem_size & (alignof (size_t) - 1);
++ freemem_size = freemem_size & ~ (alignof (size_t) - 1);
++
++ __libc_lock_unlock (lock);
++ }
++
++ /* Now domain->conv_tab[act] contains the translation of all
++ the plural variants. */
++ result = domain->conv_tab[act] + sizeof (size_t);
++ resultlen = *(size_t *) domain->conv_tab[act];
++ }
++
++ converted:
++ /* The result string is converted. */
++
++#endif /* _LIBC || HAVE_ICONV */
++
++ *lengthp = resultlen;
++ return result;
++}
++
++
++/* Look up a plural variant. */
++static char *
++internal_function
++plural_lookup (struct loaded_l10nfile *domain, unsigned long int n,
++ const char *translation, size_t translation_len)
++{
++ struct loaded_domain *domaindata = (struct loaded_domain *) domain->data;
++ unsigned long int index;
++ const char *p;
++
++ index = plural_eval (domaindata->plural, n);
++ if (index >= domaindata->nplurals)
++ /* This should never happen. It means the plural expression and the
++ given maximum value do not match. */
++ index = 0;
++
++ /* Skip INDEX strings at TRANSLATION. */
++ p = translation;
++ while (index-- > 0)
++ {
++#ifdef _LIBC
++ p = __rawmemchr (p, '\0');
++#else
++ p = strchr (p, '\0');
++#endif
++ /* And skip over the NUL byte. */
++ p++;
++
++ if (p >= translation + translation_len)
++ /* This should never happen. It means the plural expression
++ evaluated to a value larger than the number of variants
++ available for MSGID1. */
++ return (char *) translation;
++ }
++ return (char *) p;
++}
++
++#ifndef _LIBC
++/* Return string representation of locale CATEGORY. */
++static const char *
++internal_function
++category_to_name (int category)
++{
++ const char *retval;
++
++ switch (category)
++ {
++#ifdef LC_COLLATE
++ case LC_COLLATE:
++ retval = "LC_COLLATE";
++ break;
++#endif
++#ifdef LC_CTYPE
++ case LC_CTYPE:
++ retval = "LC_CTYPE";
++ break;
++#endif
++#ifdef LC_MONETARY
++ case LC_MONETARY:
++ retval = "LC_MONETARY";
++ break;
++#endif
++#ifdef LC_NUMERIC
++ case LC_NUMERIC:
++ retval = "LC_NUMERIC";
++ break;
++#endif
++#ifdef LC_TIME
++ case LC_TIME:
++ retval = "LC_TIME";
++ break;
++#endif
++#ifdef LC_MESSAGES
++ case LC_MESSAGES:
++ retval = "LC_MESSAGES";
++ break;
++#endif
++#ifdef LC_RESPONSE
++ case LC_RESPONSE:
++ retval = "LC_RESPONSE";
++ break;
++#endif
++#ifdef LC_ALL
++ case LC_ALL:
++ /* This might not make sense but is perhaps better than any other
++ value. */
++ retval = "LC_ALL";
++ break;
++#endif
++ default:
++ /* If you have a better idea for a default value let me know. */
++ retval = "LC_XXX";
++ }
++
++ return retval;
++}
++#endif
++
++/* Guess value of current locale from value of the environment variables. */
++static const char *
++internal_function
++guess_category_value (int category, const char *categoryname)
++{
++ const char *language;
++ const char *retval;
++
++ /* The highest priority value is the `LANGUAGE' environment
++ variable. But we don't use the value if the currently selected
++ locale is the C locale. This is a GNU extension. */
++ language = getenv ("LANGUAGE");
++ if (language != NULL && language[0] == '\0')
++ language = NULL;
++
++ /* We have to proceed with the POSIX methods of looking to `LC_ALL',
++ `LC_xxx', and `LANG'. On some systems this can be done by the
++ `setlocale' function itself. */
++#ifdef _LIBC
++ retval = __current_locale_name (category);
++#else
++ retval = _nl_locale_name (category, categoryname);
++#endif
++
++ /* Ignore LANGUAGE if the locale is set to "C" because
++ 1. "C" locale usually uses the ASCII encoding, and most international
++ messages use non-ASCII characters. These characters get displayed
++ as question marks (if using glibc's iconv()) or as invalid 8-bit
++ characters (because other iconv()s refuse to convert most non-ASCII
++ characters to ASCII). In any case, the output is ugly.
++ 2. The precise output of some programs in the "C" locale is specified
++ by POSIX and should not depend on environment variables like
++ "LANGUAGE". We allow such programs to use gettext(). */
++ return language != NULL && strcmp (retval, "C") != 0 ? language : retval;
++}
++
++/* @@ begin of epilog @@ */
++
++/* We don't want libintl.a to depend on any other library. So we
++ avoid the non-standard function stpcpy. In GNU C Library this
++ function is available, though. Also allow the symbol HAVE_STPCPY
++ to be defined. */
++#if !_LIBC && !HAVE_STPCPY
++static char *
++stpcpy (char *dest, const char *src)
++{
++ while ((*dest++ = *src++) != '\0')
++ /* Do nothing. */ ;
++ return dest - 1;
++}
++#endif
++
++#if !_LIBC && !HAVE_MEMPCPY
++static void *
++mempcpy (void *dest, const void *src, size_t n)
++{
++ return (void *) ((char *) memcpy (dest, src, n) + n);
++}
++#endif
++
++
++#ifdef _LIBC
++/* If we want to free all resources we have to do some work at
++ program's end. */
++libc_freeres_fn (free_mem)
++{
++ void *old;
++
++ while (_nl_domain_bindings != NULL)
++ {
++ struct binding *oldp = _nl_domain_bindings;
++ _nl_domain_bindings = _nl_domain_bindings->next;
++ if (oldp->dirname != INTUSE(_nl_default_dirname))
++ /* Yes, this is a pointer comparison. */
++ free (oldp->dirname);
++ free (oldp->codeset);
++ free (oldp);
++ }
++
++ if (_nl_current_default_domain != _nl_default_default_domain)
++ /* Yes, again a pointer comparison. */
++ free ((char *) _nl_current_default_domain);
++
++ /* Remove the search tree with the known translations. */
++ __tdestroy (root, free);
++ root = NULL;
++
++ while (transmem_list != NULL)
++ {
++ old = transmem_list;
++ transmem_list = transmem_list->next;
++ free (old);
++ }
++}
++#endif
+--- lrzsz-0.12.20.safe/intl/dcngettext.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/dcngettext.c 2004-09-12 14:40:34.375745048 -0400
+@@ -0,0 +1,57 @@
++/* Implementation of the dcngettext(3) function.
++ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include "gettextP.h"
++#ifdef _LIBC
++# include <libintl.h>
++#else
++# include "libgnuintl.h"
++#endif
++
++/* @@ end of prolog @@ */
++
++/* Names for the libintl functions are a problem. They must not clash
++ with existing names and they should follow ANSI C. But this source
++ code is also used in GNU C Library where the names have a __
++ prefix. So we have to make a difference here. */
++#ifdef _LIBC
++# define DCNGETTEXT __dcngettext
++# define DCIGETTEXT __dcigettext
++#else
++# define DCNGETTEXT libintl_dcngettext
++# define DCIGETTEXT libintl_dcigettext
++#endif
++
++/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
++ locale. */
++char *
++DCNGETTEXT (const char *domainname,
++ const char *msgid1, const char *msgid2, unsigned long int n,
++ int category)
++{
++ return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category);
++}
++
++#ifdef _LIBC
++/* Alias for function name in GNU C Library. */
++weak_alias (__dcngettext, dcngettext);
++#endif
+--- lrzsz-0.12.20.safe/intl/dgettext.c 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/dgettext.c 2004-09-12 14:40:34.380744288 -0400
+@@ -1,32 +1,33 @@
+-/* dgettext.c -- implementation of the dgettext(3) function
+- Copyright (C) 1995 Software Foundation, Inc.
++/* Implementation of the dgettext(3) function.
++ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
+
+-This program is free software; you can redistribute it and/or modify
+-it under the terms of the GNU General Public License as published by
+-the Free Software Foundation; either version 2, or (at your option)
+-any later version.
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
+
+-This program is distributed in the hope that it will be useful,
+-but WITHOUT ANY WARRANTY; without even the implied warranty of
+-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-GNU General Public License for more details.
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+-You should have received a copy of the GNU General Public License
+-along with this program; if not, write to the Free Software
+-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#if defined HAVE_LOCALE_H || defined _LIBC
+-# include <locale.h>
+-#endif
++#include "gettextP.h"
++
++#include <locale.h>
+
+ #ifdef _LIBC
+ # include <libintl.h>
+ #else
+-# include "libgettext.h"
++# include "libgnuintl.h"
+ #endif
+
+ /* @@ end of prolog @@ */
+@@ -37,18 +38,16 @@
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define DGETTEXT __dgettext
+-# define DCGETTEXT __dcgettext
++# define DCGETTEXT INTUSE(__dcgettext)
+ #else
+-# define DGETTEXT dgettext__
+-# define DCGETTEXT dcgettext__
++# define DGETTEXT libintl_dgettext
++# define DCGETTEXT libintl_dcgettext
+ #endif
+
+ /* Look up MSGID in the DOMAINNAME message catalog of the current
+ LC_MESSAGES locale. */
+ char *
+-DGETTEXT (domainname, msgid)
+- const char *domainname;
+- const char *msgid;
++DGETTEXT (const char *domainname, const char *msgid)
+ {
+ return DCGETTEXT (domainname, msgid, LC_MESSAGES);
+ }
+--- lrzsz-0.12.20.safe/intl/dngettext.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/dngettext.c 2004-09-12 14:40:34.385743528 -0400
+@@ -0,0 +1,59 @@
++/* Implementation of the dngettext(3) function.
++ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include "gettextP.h"
++
++#include <locale.h>
++
++#ifdef _LIBC
++# include <libintl.h>
++#else
++# include "libgnuintl.h"
++#endif
++
++/* @@ end of prolog @@ */
++
++/* Names for the libintl functions are a problem. They must not clash
++ with existing names and they should follow ANSI C. But this source
++ code is also used in GNU C Library where the names have a __
++ prefix. So we have to make a difference here. */
++#ifdef _LIBC
++# define DNGETTEXT __dngettext
++# define DCNGETTEXT __dcngettext
++#else
++# define DNGETTEXT libintl_dngettext
++# define DCNGETTEXT libintl_dcngettext
++#endif
++
++/* Look up MSGID in the DOMAINNAME message catalog of the current
++ LC_MESSAGES locale and skip message according to the plural form. */
++char *
++DNGETTEXT (const char *domainname,
++ const char *msgid1, const char *msgid2, unsigned long int n)
++{
++ return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES);
++}
++
++#ifdef _LIBC
++/* Alias for function name in GNU C Library. */
++weak_alias (__dngettext, dngettext);
++#endif
+--- lrzsz-0.12.20.safe/intl/eval-plural.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/eval-plural.h 2004-09-12 14:40:34.390742768 -0400
+@@ -0,0 +1,108 @@
++/* Plural expression evaluation.
++ Copyright (C) 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef STATIC
++#define STATIC static
++#endif
++
++/* Evaluate the plural expression and return an index value. */
++STATIC
++unsigned long int
++internal_function
++plural_eval (struct expression *pexp, unsigned long int n)
++{
++ switch (pexp->nargs)
++ {
++ case 0:
++ switch (pexp->operation)
++ {
++ case var:
++ return n;
++ case num:
++ return pexp->val.num;
++ default:
++ break;
++ }
++ /* NOTREACHED */
++ break;
++ case 1:
++ {
++ /* pexp->operation must be lnot. */
++ unsigned long int arg = plural_eval (pexp->val.args[0], n);
++ return ! arg;
++ }
++ case 2:
++ {
++ unsigned long int leftarg = plural_eval (pexp->val.args[0], n);
++ if (pexp->operation == lor)
++ return leftarg || plural_eval (pexp->val.args[1], n);
++ else if (pexp->operation == land)
++ return leftarg && plural_eval (pexp->val.args[1], n);
++ else
++ {
++ unsigned long int rightarg = plural_eval (pexp->val.args[1], n);
++
++ switch (pexp->operation)
++ {
++ case mult:
++ return leftarg * rightarg;
++ case divide:
++#if !INTDIV0_RAISES_SIGFPE
++ if (rightarg == 0)
++ raise (SIGFPE);
++#endif
++ return leftarg / rightarg;
++ case module:
++#if !INTDIV0_RAISES_SIGFPE
++ if (rightarg == 0)
++ raise (SIGFPE);
++#endif
++ return leftarg % rightarg;
++ case plus:
++ return leftarg + rightarg;
++ case minus:
++ return leftarg - rightarg;
++ case less_than:
++ return leftarg < rightarg;
++ case greater_than:
++ return leftarg > rightarg;
++ case less_or_equal:
++ return leftarg <= rightarg;
++ case greater_or_equal:
++ return leftarg >= rightarg;
++ case equal:
++ return leftarg == rightarg;
++ case not_equal:
++ return leftarg != rightarg;
++ default:
++ break;
++ }
++ }
++ /* NOTREACHED */
++ break;
++ }
++ case 3:
++ {
++ /* pexp->operation must be qmop. */
++ unsigned long int boolarg = plural_eval (pexp->val.args[0], n);
++ return plural_eval (pexp->val.args[boolarg ? 1 : 2], n);
++ }
++ }
++ /* NOTREACHED */
++ return 0;
++}
+--- lrzsz-0.12.20.safe/intl/explodename.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/explodename.c 2004-09-12 14:40:34.395742008 -0400
+@@ -1,19 +1,20 @@
+-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++/* Copyright (C) 1995-1998, 2000-2001, 2003 Free Software Foundation, Inc.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+@@ -36,18 +37,23 @@
+
+ /* @@ end of prolog @@ */
+
++char *
++_nl_find_language (const char *name)
++{
++ while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
++ && name[0] != '+' && name[0] != ',')
++ ++name;
++
++ return (char *) name;
++}
++
++
+ int
+-_nl_explode_name (name, language, modifier, territory, codeset,
+- normalized_codeset, special, sponsor, revision)
+- char *name;
+- const char **language;
+- const char **modifier;
+- const char **territory;
+- const char **codeset;
+- const char **normalized_codeset;
+- const char **special;
+- const char **sponsor;
+- const char **revision;
++_nl_explode_name (char *name,
++ const char **language, const char **modifier,
++ const char **territory, const char **codeset,
++ const char **normalized_codeset, const char **special,
++ const char **sponsor, const char **revision)
+ {
+ enum { undecided, xpg, cen } syntax;
+ char *cp;
+@@ -67,9 +73,7 @@
+ mask = 0;
+ syntax = undecided;
+ *language = cp = name;
+- while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@'
+- && cp[0] != '+' && cp[0] != ',')
+- ++cp;
++ cp = _nl_find_language (*language);
+
+ if (*language == cp)
+ /* This does not make sense: language has to be specified. Use
+--- lrzsz-0.12.20.safe/intl/finddomain.c 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/finddomain.c 2004-09-12 14:40:34.415738968 -0400
+@@ -1,64 +1,40 @@
+ /* Handle list of needed message catalogs
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
++ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@gnu.org>, 1995.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#include <ctype.h>
+-#include <errno.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+-
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#else
+-# ifdef HAVE_MALLOC_H
+-# include <malloc.h>
+-# else
+-void free ();
+-# endif
+-#endif
+-
+-#if defined HAVE_STRING_H || defined _LIBC
+-# include <string.h>
+-#else
+-# include <strings.h>
+-# ifndef memcpy
+-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+-# endif
+-#endif
+-#if !HAVE_STRCHR && !defined _LIBC
+-# ifndef strchr
+-# define strchr index
+-# endif
+-#endif
++#include <stdlib.h>
++#include <string.h>
+
+ #if defined HAVE_UNISTD_H || defined _LIBC
+ # include <unistd.h>
+ #endif
+
+-#include "gettext.h"
+ #include "gettextP.h"
+ #ifdef _LIBC
+ # include <libintl.h>
+ #else
+-# include "libgettext.h"
++# include "libgnuintl.h"
+ #endif
+
+ /* @@ end of prolog @@ */
+@@ -70,10 +46,9 @@
+ the DOMAINNAME and CATEGORY parameters with respect to the currently
+ established bindings. */
+ struct loaded_l10nfile *
+-_nl_find_domain (dirname, locale, domainname)
+- const char *dirname;
+- char *locale;
+- const char *domainname;
++internal_function
++_nl_find_domain (const char *dirname, char *locale,
++ const char *domainname, struct binding *domainbinding)
+ {
+ struct loaded_l10nfile *retval;
+ const char *language;
+@@ -95,9 +70,9 @@
+
+ language[_territory][+audience][+special][,[sponsor][_revision]]
+
+- Beside the first all of them are allowed to be missing. If the
+- full specified locale is not found, the less specific one are
+- looked for. The various part will be stripped of according to
++ Beside the first part all of them are allowed to be missing. If
++ the full specified locale is not found, the less specific one are
++ looked for. The various parts will be stripped off according to
+ the following order:
+ (1) revision
+ (2) sponsor
+@@ -119,7 +94,7 @@
+ int cnt;
+
+ if (retval->decided == 0)
+- _nl_load_domain (retval);
++ _nl_load_domain (retval, domainbinding);
+
+ if (retval->data != NULL)
+ return retval;
+@@ -127,7 +102,7 @@
+ for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+ {
+ if (retval->successor[cnt]->decided == 0)
+- _nl_load_domain (retval->successor[cnt]);
++ _nl_load_domain (retval->successor[cnt], domainbinding);
+
+ if (retval->successor[cnt]->data != NULL)
+ break;
+@@ -142,12 +117,18 @@
+ alias_value = _nl_expand_alias (locale);
+ if (alias_value != NULL)
+ {
++#if defined _LIBC || defined HAVE_STRDUP
++ locale = strdup (alias_value);
++ if (locale == NULL)
++ return NULL;
++#else
+ size_t len = strlen (alias_value) + 1;
+ locale = (char *) malloc (len);
+ if (locale == NULL)
+ return NULL;
+
+ memcpy (locale, alias_value, len);
++#endif
+ }
+
+ /* Now we determine the single parts of the locale name. First
+@@ -168,14 +149,14 @@
+ return NULL;
+
+ if (retval->decided == 0)
+- _nl_load_domain (retval);
++ _nl_load_domain (retval, domainbinding);
+ if (retval->data == NULL)
+ {
+ int cnt;
+ for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+ {
+ if (retval->successor[cnt]->decided == 0)
+- _nl_load_domain (retval->successor[cnt]);
++ _nl_load_domain (retval->successor[cnt], domainbinding);
+ if (retval->successor[cnt]->data != NULL)
+ break;
+ }
+@@ -185,5 +166,27 @@
+ if (alias_value != NULL)
+ free (locale);
+
++ /* The space for normalized_codeset is dynamically allocated. Free it. */
++ if (mask & XPG_NORM_CODESET)
++ free ((void *) normalized_codeset);
++
+ return retval;
+ }
++
++
++#ifdef _LIBC
++libc_freeres_fn (free_mem)
++{
++ struct loaded_l10nfile *runp = _nl_loaded_domains;
++
++ while (runp != NULL)
++ {
++ struct loaded_l10nfile *here = runp;
++ if (runp->data != NULL)
++ _nl_unload_domain ((struct loaded_domain *) runp->data);
++ runp = runp->next;
++ free ((char *) here->filename);
++ free (here);
++ }
++}
++#endif
+--- lrzsz-0.12.20.safe/intl/gettext.c 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/gettext.c 2004-09-12 14:40:34.420738208 -0400
+@@ -1,19 +1,20 @@
+-/* Implementation of gettext(3) function
+- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
++/* Implementation of gettext(3) function.
++ Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+@@ -23,21 +24,14 @@
+ # define __need_NULL
+ # include <stddef.h>
+ #else
+-# ifdef STDC_HEADERS
+-# include <stdlib.h> /* Just for NULL. */
+-# else
+-# ifdef HAVE_STRING_H
+-# include <string.h>
+-# else
+-# define NULL ((void *) 0)
+-# endif
+-# endif
++# include <stdlib.h> /* Just for NULL. */
+ #endif
+
++#include "gettextP.h"
+ #ifdef _LIBC
+ # include <libintl.h>
+ #else
+-# include "libgettext.h"
++# include "libgnuintl.h"
+ #endif
+
+ /* @@ end of prolog @@ */
+@@ -48,20 +42,19 @@
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define GETTEXT __gettext
+-# define DGETTEXT __dgettext
++# define DCGETTEXT INTUSE(__dcgettext)
+ #else
+-# define GETTEXT gettext__
+-# define DGETTEXT dgettext__
++# define GETTEXT libintl_gettext
++# define DCGETTEXT libintl_dcgettext
+ #endif
+
+ /* Look up MSGID in the current default message catalog for the current
+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
+ text). */
+ char *
+-GETTEXT (msgid)
+- const char *msgid;
++GETTEXT (const char *msgid)
+ {
+- return DGETTEXT (NULL, msgid);
++ return DCGETTEXT (NULL, msgid, LC_MESSAGES);
+ }
+
+ #ifdef _LIBC
+--- lrzsz-0.12.20.safe/intl/gettext.h 1998-04-26 09:22:35.000000000 -0400
++++ lrzsz-0.12.20/intl/gettext.h 1969-12-31 19:00:00.000000000 -0500
+@@ -1,105 +0,0 @@
+-/* Internal header for GNU gettext internationalization functions
+- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+-
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
+- any later version.
+-
+- This program is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
+-
+- You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-#ifndef _GETTEXT_H
+-#define _GETTEXT_H 1
+-
+-#include <stdio.h>
+-
+-#if HAVE_LIMITS_H || _LIBC
+-# include <limits.h>
+-#endif
+-
+-/* @@ end of prolog @@ */
+-
+-/* The magic number of the GNU message catalog format. */
+-#define _MAGIC 0x950412de
+-#define _MAGIC_SWAPPED 0xde120495
+-
+-/* Revision number of the currently used .mo (binary) file format. */
+-#define MO_REVISION_NUMBER 0
+-
+-/* The following contortions are an attempt to use the C preprocessor
+- to determine an unsigned integral type that is 32 bits wide. An
+- alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+- doing that would require that the configure script compile and *run*
+- the resulting executable. Locally running cross-compiled executables
+- is usually not possible. */
+-
+-#if __STDC__
+-# define UINT_MAX_32_BITS 4294967295U
+-#else
+-# define UINT_MAX_32_BITS 0xFFFFFFFF
+-#endif
+-
+-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+- This should be valid for all systems GNU cares about because
+- that doesn't include 16-bit systems, and only modern systems
+- (that certainly have <limits.h>) have 64+-bit integral types. */
+-
+-#ifndef UINT_MAX
+-# define UINT_MAX UINT_MAX_32_BITS
+-#endif
+-
+-#if UINT_MAX == UINT_MAX_32_BITS
+-typedef unsigned nls_uint32;
+-#else
+-# if USHRT_MAX == UINT_MAX_32_BITS
+-typedef unsigned short nls_uint32;
+-# else
+-# if ULONG_MAX == UINT_MAX_32_BITS
+-typedef unsigned long nls_uint32;
+-# else
+- /* The following line is intended to throw an error. Using #error is
+- not portable enough. */
+- "Cannot determine unsigned 32-bit data type."
+-# endif
+-# endif
+-#endif
+-
+-
+-/* Header for binary .mo file format. */
+-struct mo_file_header
+-{
+- /* The magic number. */
+- nls_uint32 magic;
+- /* The revision number of the file format. */
+- nls_uint32 revision;
+- /* The number of strings pairs. */
+- nls_uint32 nstrings;
+- /* Offset of table with start offsets of original strings. */
+- nls_uint32 orig_tab_offset;
+- /* Offset of table with start offsets of translation strings. */
+- nls_uint32 trans_tab_offset;
+- /* Size of hashing table. */
+- nls_uint32 hash_tab_size;
+- /* Offset of first hashing entry. */
+- nls_uint32 hash_tab_offset;
+-};
+-
+-struct string_desc
+-{
+- /* Length of addressed string. */
+- nls_uint32 length;
+- /* Offset of string in file. */
+- nls_uint32 offset;
+-};
+-
+-/* @@ begin of epilog @@ */
+-
+-#endif /* gettext.h */
+--- lrzsz-0.12.20.safe/intl/gettextP.h 1998-04-26 09:22:35.000000000 -0400
++++ lrzsz-0.12.20/intl/gettextP.h 2004-09-12 14:40:34.426737296 -0400
+@@ -1,33 +1,53 @@
+-/* Header describing internals of gettext library
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++/* Header describing internals of libintl library.
++ Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifndef _GETTEXTP_H
+ #define _GETTEXTP_H
+
++#include <stddef.h> /* Get size_t. */
++
++#ifdef _LIBC
++# include "../iconv/gconv_int.h"
++#else
++# if HAVE_ICONV
++# include <iconv.h>
++# endif
++#endif
++
+ #include "loadinfo.h"
+
++#include "gmo.h" /* Get nls_uint32. */
++
+ /* @@ end of prolog @@ */
+
+-#ifndef PARAMS
+-# if __STDC__
+-# define PARAMS(args) args
+-# else
+-# define PARAMS(args) ()
+-# endif
++#ifndef internal_function
++# define internal_function
++#endif
++
++#ifndef attribute_hidden
++# define attribute_hidden
++#endif
++
++/* Tell the compiler when a conditional or integer expression is
++ almost always true or almost always false. */
++#ifndef HAVE_BUILTIN_EXPECT
++# define __builtin_expect(expr, val) (expr)
+ #endif
+
+ #ifndef W
+@@ -35,38 +55,160 @@
+ #endif
+
+
+-static nls_uint32 SWAP PARAMS ((nls_uint32 i));
+-
++#ifdef _LIBC
++# include <byteswap.h>
++# define SWAP(i) bswap_32 (i)
++#else
+ static inline nls_uint32
+ SWAP (i)
+ nls_uint32 i;
+ {
+ return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
+ }
++#endif
++
+
++/* In-memory representation of system dependent string. */
++struct sysdep_string_desc
++{
++ /* Length of addressed string, including the trailing NUL. */
++ size_t length;
++ /* Pointer to addressed string. */
++ const char *pointer;
++};
+
++/* The representation of an opened message catalog. */
+ struct loaded_domain
+ {
++ /* Pointer to memory containing the .mo file. */
+ const char *data;
++ /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
++ int use_mmap;
++ /* Size of mmap()ed memory. */
++ size_t mmap_size;
++ /* 1 if the .mo file uses a different endianness than this machine. */
+ int must_swap;
++ /* Pointer to additional malloc()ed memory. */
++ void *malloced;
++
++ /* Number of static strings pairs. */
+ nls_uint32 nstrings;
+- struct string_desc *orig_tab;
+- struct string_desc *trans_tab;
++ /* Pointer to descriptors of original strings in the file. */
++ const struct string_desc *orig_tab;
++ /* Pointer to descriptors of translated strings in the file. */
++ const struct string_desc *trans_tab;
++
++ /* Number of system dependent strings pairs. */
++ nls_uint32 n_sysdep_strings;
++ /* Pointer to descriptors of original sysdep strings. */
++ const struct sysdep_string_desc *orig_sysdep_tab;
++ /* Pointer to descriptors of translated sysdep strings. */
++ const struct sysdep_string_desc *trans_sysdep_tab;
++
++ /* Size of hash table. */
+ nls_uint32 hash_size;
+- nls_uint32 *hash_tab;
++ /* Pointer to hash table. */
++ const nls_uint32 *hash_tab;
++ /* 1 if the hash table uses a different endianness than this machine. */
++ int must_swap_hash_tab;
++
++ int codeset_cntr;
++#ifdef _LIBC
++ __gconv_t conv;
++#else
++# if HAVE_ICONV
++ iconv_t conv;
++# endif
++#endif
++ char **conv_tab;
++
++ struct expression *plural;
++ unsigned long int nplurals;
+ };
+
++/* We want to allocate a string at the end of the struct. But ISO C
++ doesn't allow zero sized arrays. */
++#ifdef __GNUC__
++# define ZERO 0
++#else
++# define ZERO 1
++#endif
++
++/* A set of settings bound to a message domain. Used to store settings
++ from bindtextdomain() and bind_textdomain_codeset(). */
+ struct binding
+ {
+ struct binding *next;
+- char *domainname;
+ char *dirname;
++ int codeset_cntr; /* Incremented each time codeset changes. */
++ char *codeset;
++ char domainname[ZERO];
+ };
+
+-struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
+- char *__locale,
+- const char *__domainname));
+-void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
++/* A counter which is incremented each time some previous translations
++ become invalid.
++ This variable is part of the external ABI of the GNU libintl. */
++extern int _nl_msg_cat_cntr;
++
++#ifndef _LIBC
++const char *_nl_locale_name (int category, const char *categoryname);
++#endif
++
++struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
++ const char *__domainname,
++ struct binding *__domainbinding)
++ internal_function;
++void _nl_load_domain (struct loaded_l10nfile *__domain,
++ struct binding *__domainbinding)
++ internal_function;
++void _nl_unload_domain (struct loaded_domain *__domain)
++ internal_function;
++const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
++ struct loaded_domain *__domain,
++ struct binding *__domainbinding)
++ internal_function;
++void _nl_free_domain_conv (struct loaded_domain *__domain)
++ internal_function;
++
++char *_nl_find_msg (struct loaded_l10nfile *domain_file,
++ struct binding *domainbinding, const char *msgid,
++ size_t *lengthp)
++ internal_function;
++
++#ifdef _LIBC
++extern char *__gettext (const char *__msgid);
++extern char *__dgettext (const char *__domainname, const char *__msgid);
++extern char *__dcgettext (const char *__domainname, const char *__msgid,
++ int __category);
++extern char *__ngettext (const char *__msgid1, const char *__msgid2,
++ unsigned long int __n);
++extern char *__dngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int n);
++extern char *__dcngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int __n, int __category);
++extern char *__dcigettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ int __plural, unsigned long int __n,
++ int __category);
++extern char *__textdomain (const char *__domainname);
++extern char *__bindtextdomain (const char *__domainname,
++ const char *__dirname);
++extern char *__bind_textdomain_codeset (const char *__domainname,
++ const char *__codeset);
++#else
++/* Declare the exported libintl_* functions, in a way that allows us to
++ call them under their real name. */
++# undef _INTL_REDIRECT_INLINE
++# undef _INTL_REDIRECT_MACROS
++# define _INTL_REDIRECT_MACROS
++# include "libgnuintl.h"
++extern char *libintl_dcigettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ int __plural, unsigned long int __n,
++ int __category);
++#endif
+
+ /* @@ begin of epilog @@ */
+
+--- lrzsz-0.12.20.safe/intl/gmo.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/gmo.h 2004-09-12 14:40:34.431736536 -0400
+@@ -0,0 +1,149 @@
++/* Description of GNU message catalog format: general file layout.
++ Copyright (C) 1995, 1997, 2000-2002, 2004 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _GETTEXT_H
++#define _GETTEXT_H 1
++
++#include <limits.h>
++
++/* @@ end of prolog @@ */
++
++/* The magic number of the GNU message catalog format. */
++#define _MAGIC 0x950412de
++#define _MAGIC_SWAPPED 0xde120495
++
++/* Revision number of the currently used .mo (binary) file format. */
++#define MO_REVISION_NUMBER 0
++#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
++
++/* The following contortions are an attempt to use the C preprocessor
++ to determine an unsigned integral type that is 32 bits wide. An
++ alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
++ as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
++ when cross-compiling. */
++
++#if __STDC__
++# define UINT_MAX_32_BITS 4294967295U
++#else
++# define UINT_MAX_32_BITS 0xFFFFFFFF
++#endif
++
++/* If UINT_MAX isn't defined, assume it's a 32-bit type.
++ This should be valid for all systems GNU cares about because
++ that doesn't include 16-bit systems, and only modern systems
++ (that certainly have <limits.h>) have 64+-bit integral types. */
++
++#ifndef UINT_MAX
++# define UINT_MAX UINT_MAX_32_BITS
++#endif
++
++#if UINT_MAX == UINT_MAX_32_BITS
++typedef unsigned nls_uint32;
++#else
++# if USHRT_MAX == UINT_MAX_32_BITS
++typedef unsigned short nls_uint32;
++# else
++# if ULONG_MAX == UINT_MAX_32_BITS
++typedef unsigned long nls_uint32;
++# else
++ /* The following line is intended to throw an error. Using #error is
++ not portable enough. */
++ "Cannot determine unsigned 32-bit data type."
++# endif
++# endif
++#endif
++
++
++/* Header for binary .mo file format. */
++struct mo_file_header
++{
++ /* The magic number. */
++ nls_uint32 magic;
++ /* The revision number of the file format. */
++ nls_uint32 revision;
++
++ /* The following are only used in .mo files with major revision 0 or 1. */
++
++ /* The number of strings pairs. */
++ nls_uint32 nstrings;
++ /* Offset of table with start offsets of original strings. */
++ nls_uint32 orig_tab_offset;
++ /* Offset of table with start offsets of translated strings. */
++ nls_uint32 trans_tab_offset;
++ /* Size of hash table. */
++ nls_uint32 hash_tab_size;
++ /* Offset of first hash table entry. */
++ nls_uint32 hash_tab_offset;
++
++ /* The following are only used in .mo files with minor revision >= 1. */
++
++ /* The number of system dependent segments. */
++ nls_uint32 n_sysdep_segments;
++ /* Offset of table describing system dependent segments. */
++ nls_uint32 sysdep_segments_offset;
++ /* The number of system dependent strings pairs. */
++ nls_uint32 n_sysdep_strings;
++ /* Offset of table with start offsets of original sysdep strings. */
++ nls_uint32 orig_sysdep_tab_offset;
++ /* Offset of table with start offsets of translated sysdep strings. */
++ nls_uint32 trans_sysdep_tab_offset;
++};
++
++/* Descriptor for static string contained in the binary .mo file. */
++struct string_desc
++{
++ /* Length of addressed string, not including the trailing NUL. */
++ nls_uint32 length;
++ /* Offset of string in file. */
++ nls_uint32 offset;
++};
++
++/* The following are only used in .mo files with minor revision >= 1. */
++
++/* Descriptor for system dependent string segment. */
++struct sysdep_segment
++{
++ /* Length of addressed string, including the trailing NUL. */
++ nls_uint32 length;
++ /* Offset of string in file. */
++ nls_uint32 offset;
++};
++
++/* Descriptor for system dependent string. */
++struct sysdep_string
++{
++ /* Offset of static string segments in file. */
++ nls_uint32 offset;
++ /* Alternating sequence of static and system dependent segments.
++ The last segment is a static segment, including the trailing NUL. */
++ struct segment_pair
++ {
++ /* Size of static segment. */
++ nls_uint32 segsize;
++ /* Reference to system dependent string segment, or ~0 at the end. */
++ nls_uint32 sysdepref;
++ } segments[1];
++};
++
++/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
++ regardless whether 'int' is 16 bit, 32 bit, or 64 bit. */
++#define SEGMENTS_END ((nls_uint32) ~0)
++
++/* @@ begin of epilog @@ */
++
++#endif /* gettext.h */
+--- lrzsz-0.12.20.safe/intl/hash-string.h 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/hash-string.h 2004-09-12 14:40:34.436735776 -0400
+@@ -1,35 +1,23 @@
+-/* Implements a string hashing function.
+- Copyright (C) 1995, 1997 Free Software Foundation, Inc.
++/* Description of GNU message catalog format: string hashing function.
++ Copyright (C) 1995, 1997-1998, 2000-2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+- License along with the GNU C Library; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-#ifdef HAVE_VALUES_H
+-# include <values.h>
+-#endif
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ /* @@ end of prolog @@ */
+
+-#ifndef PARAMS
+-# if __STDC__
+-# define PARAMS(Args) Args
+-# else
+-# define PARAMS(Args) ()
+-# endif
+-#endif
+-
+ /* We assume to have `unsigned long int' value with at least 32 bits. */
+ #define HASHWORDBITS 32
+
+@@ -37,11 +25,8 @@
+ /* Defines the so called `hashpjw' function by P.J. Weinberger
+ [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+ 1986, 1987 Bell Telephone Laboratories, Inc.] */
+-static unsigned long hash_string PARAMS ((const char *__str_param));
+-
+-static inline unsigned long
+-hash_string (str_param)
+- const char *str_param;
++static inline unsigned long int
++hash_string (const char *str_param)
+ {
+ unsigned long int hval, g;
+ const char *str = str_param;
+@@ -51,8 +36,8 @@
+ while (*str != '\0')
+ {
+ hval <<= 4;
+- hval += (unsigned long) *str++;
+- g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
++ hval += (unsigned char) *str++;
++ g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
+ if (g != 0)
+ {
+ hval ^= g >> (HASHWORDBITS - 8);
+--- lrzsz-0.12.20.safe/intl/intl-compat.c 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/intl-compat.c 2004-09-12 14:40:34.441735016 -0400
+@@ -1,76 +1,131 @@
+ /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
+ Library.
+- Copyright (C) 1995 Software Foundation, Inc.
++ Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
+
+-This program is free software; you can redistribute it and/or modify
+-it under the terms of the GNU General Public License as published by
+-the Free Software Foundation; either version 2, or (at your option)
+-any later version.
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
+
+-This program is distributed in the hope that it will be useful,
+-but WITHOUT ANY WARRANTY; without even the implied warranty of
+-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-GNU General Public License for more details.
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+-You should have received a copy of the GNU General Public License
+-along with this program; if not, write to the Free Software
+-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#include "libgettext.h"
++#include "gettextP.h"
+
+ /* @@ end of prolog @@ */
+
++/* This file redirects the gettext functions (without prefix) to those
++ defined in the included GNU libintl library (with "libintl_" prefix).
++ It is compiled into libintl in order to make the AM_GNU_GETTEXT test
++ of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
++ has the redirections primarily in the <libintl.h> include file.
++ It is also compiled into libgnuintl so that libgnuintl.so can be used
++ as LD_PRELOADable library on glibc systems, to provide the extra
++ features that the functions in the libc don't have (namely, logging). */
++
+
+ #undef gettext
+ #undef dgettext
+ #undef dcgettext
++#undef ngettext
++#undef dngettext
++#undef dcngettext
+ #undef textdomain
+ #undef bindtextdomain
++#undef bind_textdomain_codeset
++
++
++/* When building a DLL, we must export some functions. Note that because
++ the functions are only defined for binary backward compatibility, we
++ don't need to use __declspec(dllimport) in any case. */
++#if defined _MSC_VER && BUILDING_DLL
++# define DLL_EXPORTED __declspec(dllexport)
++#else
++# define DLL_EXPORTED
++#endif
+
+
++DLL_EXPORTED
+ char *
+-bindtextdomain (domainname, dirname)
+- const char *domainname;
+- const char *dirname;
++gettext (const char *msgid)
+ {
+- return bindtextdomain__ (domainname, dirname);
++ return libintl_gettext (msgid);
+ }
+
+
++DLL_EXPORTED
+ char *
+-dcgettext (domainname, msgid, category)
+- const char *domainname;
+- const char *msgid;
+- int category;
++dgettext (const char *domainname, const char *msgid)
+ {
+- return dcgettext__ (domainname, msgid, category);
++ return libintl_dgettext (domainname, msgid);
+ }
+
+
++DLL_EXPORTED
+ char *
+-dgettext (domainname, msgid)
+- const char *domainname;
+- const char *msgid;
++dcgettext (const char *domainname, const char *msgid, int category)
+ {
+- return dgettext__ (domainname, msgid);
++ return libintl_dcgettext (domainname, msgid, category);
+ }
+
+
++DLL_EXPORTED
+ char *
+-gettext (msgid)
+- const char *msgid;
++ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
+ {
+- return gettext__ (msgid);
++ return libintl_ngettext (msgid1, msgid2, n);
+ }
+
+
++DLL_EXPORTED
+ char *
+-textdomain (domainname)
+- const char *domainname;
++dngettext (const char *domainname,
++ const char *msgid1, const char *msgid2, unsigned long int n)
+ {
+- return textdomain__ (domainname);
++ return libintl_dngettext (domainname, msgid1, msgid2, n);
++}
++
++
++DLL_EXPORTED
++char *
++dcngettext (const char *domainname,
++ const char *msgid1, const char *msgid2, unsigned long int n,
++ int category)
++{
++ return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
++}
++
++
++DLL_EXPORTED
++char *
++textdomain (const char *domainname)
++{
++ return libintl_textdomain (domainname);
++}
++
++
++DLL_EXPORTED
++char *
++bindtextdomain (const char *domainname, const char *dirname)
++{
++ return libintl_bindtextdomain (domainname, dirname);
++}
++
++
++DLL_EXPORTED
++char *
++bind_textdomain_codeset (const char *domainname, const char *codeset)
++{
++ return libintl_bind_textdomain_codeset (domainname, codeset);
+ }
+--- lrzsz-0.12.20.safe/intl/l10nflist.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/l10nflist.c 2004-09-12 14:40:34.457732584 -0400
+@@ -1,52 +1,40 @@
+-/* Handle list of needed message catalogs
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
++/* Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
++ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Tell glibc's <string.h> to provide a prototype for stpcpy().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-
+-#if defined HAVE_STRING_H || defined _LIBC
+-# ifndef _GNU_SOURCE
+-# define _GNU_SOURCE 1
+-# endif
+-# include <string.h>
+-#else
+-# include <strings.h>
+-# ifndef memcpy
+-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+-# endif
+-#endif
+-#if !HAVE_STRCHR && !defined _LIBC
+-# ifndef strchr
+-# define strchr index
+-# endif
+-#endif
++#include <string.h>
+
+ #if defined _LIBC || defined HAVE_ARGZ_H
+ # include <argz.h>
+ #endif
+ #include <ctype.h>
+ #include <sys/types.h>
+-
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#endif
++#include <stdlib.h>
+
+ #include "loadinfo.h"
+
+@@ -65,23 +53,39 @@
+ /* Rename the non ANSI C functions. This is required by the standard
+ because some ANSI C functions will require linking with this object
+ file and the name space must not be polluted. */
+-# define stpcpy(dest, src) __stpcpy(dest, src)
++# ifndef stpcpy
++# define stpcpy(dest, src) __stpcpy(dest, src)
++# endif
+ #else
+ # ifndef HAVE_STPCPY
+-static char *stpcpy PARAMS ((char *dest, const char *src));
++static char *stpcpy (char *dest, const char *src);
+ # endif
+ #endif
+
++/* Pathname support.
++ ISSLASH(C) tests whether C is a directory separator character.
++ IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
++ it may be concatenated to a directory pathname.
++ */
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS */
++# define ISSLASH(C) ((C) == '/' || (C) == '\\')
++# define HAS_DEVICE(P) \
++ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
++ && (P)[1] == ':')
++# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
++#else
++ /* Unix */
++# define ISSLASH(C) ((C) == '/')
++# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
++#endif
++
+ /* Define function which are usually not available. */
+
+ #if !defined _LIBC && !defined HAVE___ARGZ_COUNT
+ /* Returns the number of strings in ARGZ. */
+-static size_t argz_count__ PARAMS ((const char *argz, size_t len));
+-
+ static size_t
+-argz_count__ (argz, len)
+- const char *argz;
+- size_t len;
++argz_count__ (const char *argz, size_t len)
+ {
+ size_t count = 0;
+ while (len > 0)
+@@ -95,18 +99,17 @@
+ }
+ # undef __argz_count
+ # define __argz_count(argz, len) argz_count__ (argz, len)
++#else
++# ifdef _LIBC
++# define __argz_count(argz, len) INTUSE(__argz_count) (argz, len)
++# endif
+ #endif /* !_LIBC && !HAVE___ARGZ_COUNT */
+
+ #if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
+ /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
+ except the last into the character SEP. */
+-static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
+-
+ static void
+-argz_stringify__ (argz, len, sep)
+- char *argz;
+- size_t len;
+- int sep;
++argz_stringify__ (char *argz, size_t len, int sep)
+ {
+ while (len > 0)
+ {
+@@ -119,17 +122,16 @@
+ }
+ # undef __argz_stringify
+ # define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
++#else
++# ifdef _LIBC
++# define __argz_stringify(argz, len, sep) \
++ INTUSE(__argz_stringify) (argz, len, sep)
++# endif
+ #endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
+
+ #if !defined _LIBC && !defined HAVE___ARGZ_NEXT
+-static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
+- const char *entry));
+-
+ static char *
+-argz_next__ (argz, argz_len, entry)
+- char *argz;
+- size_t argz_len;
+- const char *entry;
++argz_next__ (char *argz, size_t argz_len, const char *entry)
+ {
+ if (entry)
+ {
+@@ -150,11 +152,8 @@
+
+
+ /* Return number of bits set in X. */
+-static int pop PARAMS ((int x));
+-
+ static inline int
+-pop (x)
+- int x;
++pop (int x)
+ {
+ /* We assume that no more than 16 bits are used. */
+ x = ((x & ~0x5555) >> 1) + (x & 0x5555);
+@@ -167,31 +166,27 @@
+
+
+ struct loaded_l10nfile *
+-_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
+- territory, codeset, normalized_codeset, modifier, special,
+- sponsor, revision, filename, do_allocate)
+- struct loaded_l10nfile **l10nfile_list;
+- const char *dirlist;
+- size_t dirlist_len;
+- int mask;
+- const char *language;
+- const char *territory;
+- const char *codeset;
+- const char *normalized_codeset;
+- const char *modifier;
+- const char *special;
+- const char *sponsor;
+- const char *revision;
+- const char *filename;
+- int do_allocate;
++_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
++ const char *dirlist, size_t dirlist_len,
++ int mask, const char *language, const char *territory,
++ const char *codeset, const char *normalized_codeset,
++ const char *modifier, const char *special,
++ const char *sponsor, const char *revision,
++ const char *filename, int do_allocate)
+ {
+ char *abs_filename;
+- struct loaded_l10nfile *last = NULL;
++ struct loaded_l10nfile **lastp;
+ struct loaded_l10nfile *retval;
+ char *cp;
++ size_t dirlist_count;
+ size_t entries;
+ int cnt;
+
++ /* If LANGUAGE contains an absolute directory specification, we ignore
++ DIRLIST. */
++ if (IS_ABSOLUTE_PATH (language))
++ dirlist_len = 0;
++
+ /* Allocate room for the full file name. */
+ abs_filename = (char *) malloc (dirlist_len
+ + strlen (language)
+@@ -209,7 +204,7 @@
+ + (((mask & CEN_SPONSOR) != 0
+ || (mask & CEN_REVISION) != 0)
+ ? (1 + ((mask & CEN_SPONSOR) != 0
+- ? strlen (sponsor) + 1 : 0)
++ ? strlen (sponsor) : 0)
+ + ((mask & CEN_REVISION) != 0
+ ? strlen (revision) + 1 : 0)) : 0)
+ + 1 + strlen (filename) + 1);
+@@ -217,14 +212,16 @@
+ if (abs_filename == NULL)
+ return NULL;
+
+- retval = NULL;
+- last = NULL;
+-
+ /* Construct file name. */
+- memcpy (abs_filename, dirlist, dirlist_len);
+- __argz_stringify (abs_filename, dirlist_len, ':');
+- cp = abs_filename + (dirlist_len - 1);
+- *cp++ = '/';
++ cp = abs_filename;
++ if (dirlist_len > 0)
++ {
++ memcpy (cp, dirlist, dirlist_len);
++ __argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
++ cp += dirlist_len;
++ cp[-1] = '/';
++ }
++
+ cp = stpcpy (cp, language);
+
+ if ((mask & TERRITORY) != 0)
+@@ -271,7 +268,7 @@
+
+ /* Look in list of already loaded domains whether it is already
+ available. */
+- last = NULL;
++ lastp = l10nfile_list;
+ for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
+ if (retval->filename != NULL)
+ {
+@@ -286,7 +283,7 @@
+ break;
+ }
+
+- last = retval;
++ lastp = &retval->next;
+ }
+
+ if (retval != NULL || do_allocate == 0)
+@@ -295,48 +292,66 @@
+ return retval;
+ }
+
+- retval = (struct loaded_l10nfile *)
+- malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
+- * (1 << pop (mask))
+- * sizeof (struct loaded_l10nfile *)));
++ dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
++
++ /* Allocate a new loaded_l10nfile. */
++ retval =
++ (struct loaded_l10nfile *)
++ malloc (sizeof (*retval)
++ + (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
++ * sizeof (struct loaded_l10nfile *)));
+ if (retval == NULL)
+ return NULL;
+
+ retval->filename = abs_filename;
+- retval->decided = (__argz_count (dirlist, dirlist_len) != 1
++
++ /* We set retval->data to NULL here; it is filled in later.
++ Setting retval->decided to 1 here means that retval does not
++ correspond to a real file (dirlist_count > 1) or is not worth
++ looking up (if an unnormalized codeset was specified). */
++ retval->decided = (dirlist_count > 1
+ || ((mask & XPG_CODESET) != 0
+ && (mask & XPG_NORM_CODESET) != 0));
+ retval->data = NULL;
+
+- if (last == NULL)
+- {
+- retval->next = *l10nfile_list;
+- *l10nfile_list = retval;
+- }
+- else
+- {
+- retval->next = last->next;
+- last->next = retval;
+- }
++ retval->next = *lastp;
++ *lastp = retval;
+
+ entries = 0;
+- /* If the DIRLIST is a real list the RETVAL entry corresponds not to
+- a real file. So we have to use the DIRLIST separation mechanism
+- of the inner loop. */
+- cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
+- for (; cnt >= 0; --cnt)
++ /* Recurse to fill the inheritance list of RETVAL.
++ If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
++ entry does not correspond to a real file; retval->filename contains
++ colons. In this case we loop across all elements of DIRLIST and
++ across all bit patterns dominated by MASK.
++ If the DIRLIST is a single directory or entirely redundant (i.e.
++ DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
++ MASK, excluding MASK itself.
++ In either case, we loop down from MASK to 0. This has the effect
++ that the extra bits in the locale name are dropped in this order:
++ first the modifier, then the territory, then the codeset, then the
++ normalized_codeset. */
++ for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
+ if ((cnt & ~mask) == 0
+ && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
+ && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
+ {
+- /* Iterate over all elements of the DIRLIST. */
+- char *dir = NULL;
++ if (dirlist_count > 1)
++ {
++ /* Iterate over all elements of the DIRLIST. */
++ char *dir = NULL;
+
+- while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
+- != NULL)
++ while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
++ != NULL)
++ retval->successor[entries++]
++ = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
++ cnt, language, territory, codeset,
++ normalized_codeset, modifier, special,
++ sponsor, revision, filename, 1);
++ }
++ else
+ retval->successor[entries++]
+- = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
+- language, territory, codeset,
++ = _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
++ cnt, language, territory, codeset,
+ normalized_codeset, modifier, special,
+ sponsor, revision, filename, 1);
+ }
+@@ -347,11 +362,10 @@
+
+ /* Normalize codeset name. There is no standard for the codeset
+ names. Normalization allows the user to use any of the common
+- names. */
++ names. The return value is dynamically allocated and has to be
++ freed by the caller. */
+ const char *
+-_nl_normalize_codeset (codeset, name_len)
+- const char *codeset;
+- size_t name_len;
++_nl_normalize_codeset (const char *codeset, size_t name_len)
+ {
+ int len = 0;
+ int only_digit = 1;
+@@ -360,11 +374,11 @@
+ size_t cnt;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+- if (isalnum (codeset[cnt]))
++ if (isalnum ((unsigned char) codeset[cnt]))
+ {
+ ++len;
+
+- if (isalpha (codeset[cnt]))
++ if (isalpha ((unsigned char) codeset[cnt]))
+ only_digit = 0;
+ }
+
+@@ -378,9 +392,9 @@
+ wp = retval;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+- if (isalpha (codeset[cnt]))
+- *wp++ = tolower (codeset[cnt]);
+- else if (isdigit (codeset[cnt]))
++ if (isalpha ((unsigned char) codeset[cnt]))
++ *wp++ = tolower ((unsigned char) codeset[cnt]);
++ else if (isdigit ((unsigned char) codeset[cnt]))
+ *wp++ = codeset[cnt];
+
+ *wp = '\0';
+@@ -398,9 +412,7 @@
+ to be defined. */
+ #if !_LIBC && !HAVE_STPCPY
+ static char *
+-stpcpy (dest, src)
+- char *dest;
+- const char *src;
++stpcpy (char *dest, const char *src)
+ {
+ while ((*dest++ = *src++) != '\0')
+ /* Do nothing. */ ;
+--- lrzsz-0.12.20.safe/intl/libgettext.h 1998-04-26 09:22:36.000000000 -0400
++++ lrzsz-0.12.20/intl/libgettext.h 1969-12-31 19:00:00.000000000 -0500
+@@ -1,182 +0,0 @@
+-/* Message catalogs for internationalization.
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+-
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
+- any later version.
+-
+- This program is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
+-
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+-
+-/* Because on some systems (e.g. Solaris) we sometimes have to include
+- the systems libintl.h as well as this file we have more complex
+- include protection above. But the systems header might perhaps also
+- define _LIBINTL_H and therefore we have to protect the definition here. */
+-
+-#if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
+-#if !defined (_LIBINTL_H)
+-# define _LIBINTL_H 1
+-#endif
+-#define _LIBGETTEXT_H 1
+-
+-/* We define an additional symbol to signal that we use the GNU
+- implementation of gettext. */
+-#define __USE_GNU_GETTEXT 1
+-
+-#include <sys/types.h>
+-
+-#if HAVE_LOCALE_H
+-# include <locale.h>
+-#endif
+-
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-/* @@ end of prolog @@ */
+-
+-#ifndef PARAMS
+-# if __STDC__
+-# define PARAMS(args) args
+-# else
+-# define PARAMS(args) ()
+-# endif
+-#endif
+-
+-#ifndef NULL
+-# if !defined __cplusplus || defined __GNUC__
+-# define NULL ((void *) 0)
+-# else
+-# define NULL (0)
+-# endif
+-#endif
+-
+-#if !HAVE_LC_MESSAGES
+-/* This value determines the behaviour of the gettext() and dgettext()
+- function. But some system does not have this defined. Define it
+- to a default value. */
+-# define LC_MESSAGES (-1)
+-#endif
+-
+-
+-/* Declarations for gettext-using-catgets interface. Derived from
+- Jim Meyering's libintl.h. */
+-struct _msg_ent
+-{
+- const char *_msg;
+- int _msg_number;
+-};
+-
+-
+-#if HAVE_CATGETS
+-/* These two variables are defined in the automatically by po-to-tbl.sed
+- generated file `cat-id-tbl.c'. */
+-extern const struct _msg_ent _msg_tbl[];
+-extern int _msg_tbl_length;
+-#endif
+-
+-
+-/* For automatical extraction of messages sometimes no real
+- translation is needed. Instead the string itself is the result. */
+-#define gettext_noop(Str) (Str)
+-
+-/* Look up MSGID in the current default message catalog for the current
+- LC_MESSAGES locale. If not found, returns MSGID itself (the default
+- text). */
+-extern char *gettext PARAMS ((const char *__msgid));
+-extern char *gettext__ PARAMS ((const char *__msgid));
+-
+-/* Look up MSGID in the DOMAINNAME message catalog for the current
+- LC_MESSAGES locale. */
+-extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
+-extern char *dgettext__ PARAMS ((const char *__domainname,
+- const char *__msgid));
+-
+-/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+- locale. */
+-extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
+- int __category));
+-extern char *dcgettext__ PARAMS ((const char *__domainname,
+- const char *__msgid, int __category));
+-
+-
+-/* Set the current default message catalog to DOMAINNAME.
+- If DOMAINNAME is null, return the current default.
+- If DOMAINNAME is "", reset to the default of "messages". */
+-extern char *textdomain PARAMS ((const char *__domainname));
+-extern char *textdomain__ PARAMS ((const char *__domainname));
+-
+-/* Specify that the DOMAINNAME message catalog will be found
+- in DIRNAME rather than in the system locale data base. */
+-extern char *bindtextdomain PARAMS ((const char *__domainname,
+- const char *__dirname));
+-extern char *bindtextdomain__ PARAMS ((const char *__domainname,
+- const char *__dirname));
+-
+-#if ENABLE_NLS
+-
+-/* Solaris 2.3 has the gettext function but dcgettext is missing.
+- So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
+- has dcgettext. */
+-# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
+-
+-# define gettext(Msgid) \
+- dgettext (NULL, Msgid)
+-
+-# define dgettext(Domainname, Msgid) \
+- dcgettext (Domainname, Msgid, LC_MESSAGES)
+-
+-# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+-/* This global variable is defined in loadmsgcat.c. We need a sign,
+- whether a new catalog was loaded, which can be associated with all
+- translations. */
+-extern int _nl_msg_cat_cntr;
+-
+-# define dcgettext(Domainname, Msgid, Category) \
+- (__extension__ \
+- ({ \
+- char *__result; \
+- if (__builtin_constant_p (Msgid)) \
+- { \
+- static char *__translation__; \
+- static int __catalog_counter__; \
+- if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
+- { \
+- __translation__ = \
+- dcgettext__ (Domainname, Msgid, Category); \
+- __catalog_counter__ = _nl_msg_cat_cntr; \
+- } \
+- __result = __translation__; \
+- } \
+- else \
+- __result = dcgettext__ (Domainname, Msgid, Category); \
+- __result; \
+- }))
+-# endif
+-# endif
+-
+-#else
+-
+-# define gettext(Msgid) (Msgid)
+-# define dgettext(Domainname, Msgid) (Msgid)
+-# define dcgettext(Domainname, Msgid, Category) (Msgid)
+-# define textdomain(Domainname) while (0) /* nothing */
+-# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
+-
+-#endif
+-
+-/* @@ begin of epilog @@ */
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif
+--- lrzsz-0.12.20.safe/intl/libgnuintl.h.in 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/libgnuintl.h.in 2004-09-12 14:40:34.462731824 -0400
+@@ -0,0 +1,383 @@
++/* Message catalogs for internationalization.
++ Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _LIBINTL_H
++#define _LIBINTL_H 1
++
++#include <locale.h>
++
++/* The LC_MESSAGES locale category is the category used by the functions
++ gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
++ On systems that don't define it, use an arbitrary value instead.
++ On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
++ then includes <libintl.h> (i.e. this file!) and then only defines
++ LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
++ in this case. */
++#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
++# define LC_MESSAGES 1729
++#endif
++
++/* We define an additional symbol to signal that we use the GNU
++ implementation of gettext. */
++#define __USE_GNU_GETTEXT 1
++
++/* Provide information about the supported file formats. Returns the
++ maximum minor revision number supported for a given major revision. */
++#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
++ ((major) == 0 ? 1 : -1)
++
++/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
++ precedence over _conio_gettext. */
++#ifdef __DJGPP__
++# undef gettext
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++/* We redirect the functions to those prefixed with "libintl_". This is
++ necessary, because some systems define gettext/textdomain/... in the C
++ library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
++ If we used the unprefixed names, there would be cases where the
++ definition in the C library would override the one in the libintl.so
++ shared library. Recall that on ELF systems, the symbols are looked
++ up in the following order:
++ 1. in the executable,
++ 2. in the shared libraries specified on the link command line, in order,
++ 3. in the dependencies of the shared libraries specified on the link
++ command line,
++ 4. in the dlopen()ed shared libraries, in the order in which they were
++ dlopen()ed.
++ The definition in the C library would override the one in libintl.so if
++ either
++ * -lc is given on the link command line and -lintl isn't, or
++ * -lc is given on the link command line before -lintl, or
++ * libintl.so is a dependency of a dlopen()ed shared library but not
++ linked to the executable at link time.
++ Since Solaris gettext() behaves differently than GNU gettext(), this
++ would be unacceptable.
++
++ The redirection happens by default through macros in C, so that &gettext
++ is independent of the compilation unit, but through inline functions in
++ C++, in order not to interfere with the name mangling of class fields or
++ class methods called 'gettext'. */
++
++/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
++ If he doesn't, we choose the method. A third possible method is
++ _INTL_REDIRECT_ASM, supported only by GCC. */
++#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
++# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
++# define _INTL_REDIRECT_ASM
++# else
++# ifdef __cplusplus
++# define _INTL_REDIRECT_INLINE
++# else
++# define _INTL_REDIRECT_MACROS
++# endif
++# endif
++#endif
++/* Auxiliary macros. */
++#ifdef _INTL_REDIRECT_ASM
++# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
++# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
++# define _INTL_STRINGIFY(prefix) #prefix
++#else
++# define _INTL_ASM(cname)
++#endif
++
++/* Look up MSGID in the current default message catalog for the current
++ LC_MESSAGES locale. If not found, returns MSGID itself (the default
++ text). */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_gettext (const char *__msgid);
++static inline char *gettext (const char *__msgid)
++{
++ return libintl_gettext (__msgid);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define gettext libintl_gettext
++#endif
++extern char *gettext (const char *__msgid)
++ _INTL_ASM (libintl_gettext);
++#endif
++
++/* Look up MSGID in the DOMAINNAME message catalog for the current
++ LC_MESSAGES locale. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
++static inline char *dgettext (const char *__domainname, const char *__msgid)
++{
++ return libintl_dgettext (__domainname, __msgid);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define dgettext libintl_dgettext
++#endif
++extern char *dgettext (const char *__domainname, const char *__msgid)
++ _INTL_ASM (libintl_dgettext);
++#endif
++
++/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
++ locale. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
++ int __category);
++static inline char *dcgettext (const char *__domainname, const char *__msgid,
++ int __category)
++{
++ return libintl_dcgettext (__domainname, __msgid, __category);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define dcgettext libintl_dcgettext
++#endif
++extern char *dcgettext (const char *__domainname, const char *__msgid,
++ int __category)
++ _INTL_ASM (libintl_dcgettext);
++#endif
++
++
++/* Similar to `gettext' but select the plural form corresponding to the
++ number N. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
++ unsigned long int __n);
++static inline char *ngettext (const char *__msgid1, const char *__msgid2,
++ unsigned long int __n)
++{
++ return libintl_ngettext (__msgid1, __msgid2, __n);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define ngettext libintl_ngettext
++#endif
++extern char *ngettext (const char *__msgid1, const char *__msgid2,
++ unsigned long int __n)
++ _INTL_ASM (libintl_ngettext);
++#endif
++
++/* Similar to `dgettext' but select the plural form corresponding to the
++ number N. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
++ const char *__msgid2, unsigned long int __n);
++static inline char *dngettext (const char *__domainname, const char *__msgid1,
++ const char *__msgid2, unsigned long int __n)
++{
++ return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define dngettext libintl_dngettext
++#endif
++extern char *dngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int __n)
++ _INTL_ASM (libintl_dngettext);
++#endif
++
++/* Similar to `dcgettext' but select the plural form corresponding to the
++ number N. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_dcngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int __n, int __category);
++static inline char *dcngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int __n, int __category)
++{
++ return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define dcngettext libintl_dcngettext
++#endif
++extern char *dcngettext (const char *__domainname,
++ const char *__msgid1, const char *__msgid2,
++ unsigned long int __n, int __category)
++ _INTL_ASM (libintl_dcngettext);
++#endif
++
++
++/* Set the current default message catalog to DOMAINNAME.
++ If DOMAINNAME is null, return the current default.
++ If DOMAINNAME is "", reset to the default of "messages". */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_textdomain (const char *__domainname);
++static inline char *textdomain (const char *__domainname)
++{
++ return libintl_textdomain (__domainname);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define textdomain libintl_textdomain
++#endif
++extern char *textdomain (const char *__domainname)
++ _INTL_ASM (libintl_textdomain);
++#endif
++
++/* Specify that the DOMAINNAME message catalog will be found
++ in DIRNAME rather than in the system locale data base. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_bindtextdomain (const char *__domainname,
++ const char *__dirname);
++static inline char *bindtextdomain (const char *__domainname,
++ const char *__dirname)
++{
++ return libintl_bindtextdomain (__domainname, __dirname);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define bindtextdomain libintl_bindtextdomain
++#endif
++extern char *bindtextdomain (const char *__domainname, const char *__dirname)
++ _INTL_ASM (libintl_bindtextdomain);
++#endif
++
++/* Specify the character encoding in which the messages from the
++ DOMAINNAME message catalog will be returned. */
++#ifdef _INTL_REDIRECT_INLINE
++extern char *libintl_bind_textdomain_codeset (const char *__domainname,
++ const char *__codeset);
++static inline char *bind_textdomain_codeset (const char *__domainname,
++ const char *__codeset)
++{
++ return libintl_bind_textdomain_codeset (__domainname, __codeset);
++}
++#else
++#ifdef _INTL_REDIRECT_MACROS
++# define bind_textdomain_codeset libintl_bind_textdomain_codeset
++#endif
++extern char *bind_textdomain_codeset (const char *__domainname,
++ const char *__codeset)
++ _INTL_ASM (libintl_bind_textdomain_codeset);
++#endif
++
++
++/* Support for format strings with positions in *printf(), following the
++ POSIX/XSI specification.
++ Note: These replacements for the *printf() functions are visible only
++ in source files that #include <libintl.h> or #include "gettext.h".
++ Packages that use *printf() in source files that don't refer to _()
++ or gettext() but for which the format string could be the return value
++ of _() or gettext() need to add this #include. Oh well. */
++
++#if !@HAVE_POSIX_PRINTF@
++
++#include <stdio.h>
++#include <stddef.h>
++
++/* Get va_list. */
++#if __STDC__ || defined __cplusplus || defined _MSC_VER
++# include <stdarg.h>
++#else
++# include <varargs.h>
++#endif
++
++#undef fprintf
++#define fprintf libintl_fprintf
++extern int fprintf (FILE *, const char *, ...);
++#undef vfprintf
++#define vfprintf libintl_vfprintf
++extern int vfprintf (FILE *, const char *, va_list);
++
++#undef printf
++#define printf libintl_printf
++extern int printf (const char *, ...);
++#undef vprintf
++#define vprintf libintl_vprintf
++extern int vprintf (const char *, va_list);
++
++#undef sprintf
++#define sprintf libintl_sprintf
++extern int sprintf (char *, const char *, ...);
++#undef vsprintf
++#define vsprintf libintl_vsprintf
++extern int vsprintf (char *, const char *, va_list);
++
++#if @HAVE_SNPRINTF@
++
++#undef snprintf
++#define snprintf libintl_snprintf
++extern int snprintf (char *, size_t, const char *, ...);
++#undef vsnprintf
++#define vsnprintf libintl_vsnprintf
++extern int vsnprintf (char *, size_t, const char *, va_list);
++
++#endif
++
++#if @HAVE_ASPRINTF@
++
++#undef asprintf
++#define asprintf libintl_asprintf
++extern int asprintf (char **, const char *, ...);
++#undef vasprintf
++#define vasprintf libintl_vasprintf
++extern int vasprintf (char **, const char *, va_list);
++
++#endif
++
++#if @HAVE_WPRINTF@
++
++#undef fwprintf
++#define fwprintf libintl_fwprintf
++extern int fwprintf (FILE *, const wchar_t *, ...);
++#undef vfwprintf
++#define vfwprintf libintl_vfwprintf
++extern int vfwprintf (FILE *, const wchar_t *, va_list);
++
++#undef wprintf
++#define wprintf libintl_wprintf
++extern int wprintf (const wchar_t *, ...);
++#undef vwprintf
++#define vwprintf libintl_vwprintf
++extern int vwprintf (const wchar_t *, va_list);
++
++#undef swprintf
++#define swprintf libintl_swprintf
++extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
++#undef vswprintf
++#define vswprintf libintl_vswprintf
++extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
++
++#endif
++
++#endif
++
++
++/* Support for relocatable packages. */
++
++/* Sets the original and the current installation prefix of the package.
++ Relocation simply replaces a pathname starting with the original prefix
++ by the corresponding pathname with the current prefix instead. Both
++ prefixes should be directory names without trailing slash (i.e. use ""
++ instead of "/"). */
++#define libintl_set_relocation_prefix libintl_set_relocation_prefix
++extern void
++ libintl_set_relocation_prefix (const char *orig_prefix,
++ const char *curr_prefix);
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* libintl.h */
+--- lrzsz-0.12.20.safe/intl/linux-msg.sed 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/linux-msg.sed 1969-12-31 19:00:00.000000000 -0500
+@@ -1,100 +0,0 @@
+-# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
+-# Copyright (C) 1995 Free Software Foundation, Inc.
+-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+-#
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2, or (at your option)
+-# any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-#
+-#
+-# The first directive in the .msg should be the definition of the
+-# message set number. We use always set number 1.
+-#
+-1 {
+- i\
+-$set 1 # Automatically created by po2msg.sed
+- h
+- s/.*/0/
+- x
+-}
+-#
+-# Mitch's old catalog format does not allow comments.
+-#
+-# We copy the original message as a comment into the .msg file.
+-#
+-/^msgid/ {
+- s/msgid[ ]*"//
+-#
+-# This does not work now with the new format.
+-# /"$/! {
+-# s/\\$//
+-# s/$/ ... (more lines following)"/
+-# }
+- x
+-# The following nice solution is by
+-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+- td
+-# Increment a decimal number in pattern space.
+-# First hide trailing `9' digits.
+- :d
+- s/9\(_*\)$/_\1/
+- td
+-# Assure at least one digit is available.
+- s/^\(_*\)$/0\1/
+-# Increment the last digit.
+- s/8\(_*\)$/9\1/
+- s/7\(_*\)$/8\1/
+- s/6\(_*\)$/7\1/
+- s/5\(_*\)$/6\1/
+- s/4\(_*\)$/5\1/
+- s/3\(_*\)$/4\1/
+- s/2\(_*\)$/3\1/
+- s/1\(_*\)$/2\1/
+- s/0\(_*\)$/1\1/
+-# Convert the hidden `9' digits to `0's.
+- s/_/0/g
+- x
+- G
+- s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
+-}
+-#
+-# The .msg file contains, other then the .po file, only the translations
+-# but each given a unique ID. Starting from 1 and incrementing by 1 for
+-# each message we assign them to the messages.
+-# It is important that the .po file used to generate the cat-id-tbl.c file
+-# (with po-to-tbl) is the same as the one used here. (At least the order
+-# of declarations must not be changed.)
+-#
+-/^msgstr/ {
+- s/msgstr[ ]*"\(.*\)"/# \1/
+-# Clear substitution flag.
+- tb
+-# Append the next line.
+- :b
+- N
+-# Look whether second part is continuation line.
+- s/\(.*\n\)"\(.*\)"/\1\2/
+-# Yes, then branch.
+- ta
+- P
+- D
+-# Note that D includes a jump to the start!!
+-# We found a continuation line. But before printing insert '\'.
+- :a
+- s/\(.*\)\(\n.*\)/\1\\\2/
+- P
+-# We cannot use D here.
+- s/.*\n\(.*\)/\1/
+- tb
+-}
+-d
+--- lrzsz-0.12.20.safe/intl/loadinfo.h 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/loadinfo.h 2004-09-12 14:40:34.468730912 -0400
+@@ -1,9 +1,54 @@
+-#ifndef PARAMS
+-# if __STDC__
+-# define PARAMS(args) args
+-# else
+-# define PARAMS(args) ()
+-# endif
++/* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _LOADINFO_H
++#define _LOADINFO_H 1
++
++/* Declarations of locale dependent catalog lookup functions.
++ Implemented in
++
++ localealias.c Possibly replace a locale name by another.
++ explodename.c Split a locale name into its various fields.
++ l10nflist.c Generate a list of filenames of possible message catalogs.
++ finddomain.c Find and open the relevant message catalogs.
++
++ The main function _nl_find_domain() in finddomain.c is declared
++ in gettextP.h.
++ */
++
++#ifndef internal_function
++# define internal_function
++#endif
++
++/* Tell the compiler when a conditional or integer expression is
++ almost always true or almost always false. */
++#ifndef HAVE_BUILTIN_EXPECT
++# define __builtin_expect(expr, val) (expr)
++#endif
++
++/* Separator in PATH like lists of pathnames. */
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS */
++# define PATH_SEPARATOR ';'
++#else
++ /* Unix */
++# define PATH_SEPARATOR ':'
+ #endif
+
+ /* Encoding of locale name parts. */
+@@ -32,27 +77,69 @@
+ };
+
+
+-extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
+- size_t name_len));
++/* Normalize codeset name. There is no standard for the codeset
++ names. Normalization allows the user to use any of the common
++ names. The return value is dynamically allocated and has to be
++ freed by the caller. */
++extern const char *_nl_normalize_codeset (const char *codeset,
++ size_t name_len);
+
++/* Lookup a locale dependent file.
++ *L10NFILE_LIST denotes a pool of lookup results of locale dependent
++ files of the same kind, sorted in decreasing order of ->filename.
++ DIRLIST and DIRLIST_LEN are an argz list of directories in which to
++ look, containing at least one directory (i.e. DIRLIST_LEN > 0).
++ MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
++ SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
++ produced by _nl_explode_name(). FILENAME is the filename suffix.
++ The return value is the lookup result, either found in *L10NFILE_LIST,
++ or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
++ If the return value is non-NULL, it is added to *L10NFILE_LIST, and
++ its ->next field denotes the chaining inside *L10NFILE_LIST, and
++ furthermore its ->successor[] field contains a list of other lookup
++ results from which this lookup result inherits. */
+ extern struct loaded_l10nfile *
+-_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
+- const char *dirlist, size_t dirlist_len, int mask,
+- const char *language, const char *territory,
+- const char *codeset,
+- const char *normalized_codeset,
+- const char *modifier, const char *special,
+- const char *sponsor, const char *revision,
+- const char *filename, int do_allocate));
++_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
++ const char *dirlist, size_t dirlist_len, int mask,
++ const char *language, const char *territory,
++ const char *codeset, const char *normalized_codeset,
++ const char *modifier, const char *special,
++ const char *sponsor, const char *revision,
++ const char *filename, int do_allocate);
+
++/* Lookup the real locale name for a locale alias NAME, or NULL if
++ NAME is not a locale alias (but possibly a real locale name).
++ The return value is statically allocated and must not be freed. */
++extern const char *_nl_expand_alias (const char *name);
+
+-extern const char *_nl_expand_alias PARAMS ((const char *name));
++/* Split a locale name NAME into its pieces: language, modifier,
++ territory, codeset, special, sponsor, revision.
++ NAME gets destructively modified: NUL bytes are inserted here and
++ there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
++ *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
++ pointer into the old NAME string, or NULL. *NORMALIZED_CODESET
++ gets assigned the expanded *CODESET, if it is different from *CODESET;
++ this one is dynamically allocated and has to be freed by the caller.
++ The return value is a bitmask, where each bit corresponds to one
++ filled-in value:
++ XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER,
++ TERRITORY for *TERRITORY,
++ XPG_CODESET for *CODESET,
++ XPG_NORM_CODESET for *NORMALIZED_CODESET,
++ CEN_SPECIAL for *SPECIAL,
++ CEN_SPONSOR for *SPONSOR,
++ CEN_REVISION for *REVISION.
++ */
++extern int _nl_explode_name (char *name, const char **language,
++ const char **modifier, const char **territory,
++ const char **codeset,
++ const char **normalized_codeset,
++ const char **special, const char **sponsor,
++ const char **revision);
+
+-extern int _nl_explode_name PARAMS ((char *name, const char **language,
+- const char **modifier,
+- const char **territory,
+- const char **codeset,
+- const char **normalized_codeset,
+- const char **special,
+- const char **sponsor,
+- const char **revision));
++/* Split a locale name NAME into a leading language part and all the
++ rest. Return a pointer to the first character after the language,
++ i.e. to the first byte of the rest. */
++extern char *_nl_find_language (const char *name);
++
++#endif /* loadinfo.h */
+--- lrzsz-0.12.20.safe/intl/loadmsgcat.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/loadmsgcat.c 2004-09-12 14:40:34.473730152 -0400
+@@ -1,42 +1,455 @@
+-/* Load needed message catalogs
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++/* Load needed message catalogs.
++ Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Tell glibc's <string.h> to provide a prototype for mempcpy().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
++#include <ctype.h>
++#include <errno.h>
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
++#ifdef __GNUC__
++# undef alloca
++# define alloca __builtin_alloca
++# define HAVE_ALLOCA 1
++#else
++# ifdef _MSC_VER
++# include <malloc.h>
++# define alloca _alloca
++# else
++# if defined HAVE_ALLOCA_H || defined _LIBC
++# include <alloca.h>
++# else
++# ifdef _AIX
++ #pragma alloca
++# else
++# ifndef alloca
++char *alloca ();
++# endif
++# endif
++# endif
++# endif
+ #endif
+
++#include <stdlib.h>
++#include <string.h>
++
+ #if defined HAVE_UNISTD_H || defined _LIBC
+ # include <unistd.h>
+ #endif
+
+-#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
++#ifdef _LIBC
++# include <langinfo.h>
++# include <locale.h>
++#endif
++
++#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
++ || (defined _LIBC && defined _POSIX_MAPPED_FILES)
+ # include <sys/mman.h>
++# undef HAVE_MMAP
++# define HAVE_MMAP 1
++#else
++# undef HAVE_MMAP
+ #endif
+
+-#include "gettext.h"
++#if defined HAVE_STDINT_H_WITH_UINTMAX || defined _LIBC
++# include <stdint.h>
++#endif
++#if defined HAVE_INTTYPES_H || defined _LIBC
++# include <inttypes.h>
++#endif
++
++#include "gmo.h"
+ #include "gettextP.h"
++#include "hash-string.h"
++#include "plural-exp.h"
++
++#ifdef _LIBC
++# include "../locale/localeinfo.h"
++#endif
++
++/* Provide fallback values for macros that ought to be defined in <inttypes.h>.
++ Note that our fallback values need not be literal strings, because we don't
++ use them with preprocessor string concatenation. */
++#if !defined PRId8 || PRI_MACROS_BROKEN
++# undef PRId8
++# define PRId8 "d"
++#endif
++#if !defined PRIi8 || PRI_MACROS_BROKEN
++# undef PRIi8
++# define PRIi8 "i"
++#endif
++#if !defined PRIo8 || PRI_MACROS_BROKEN
++# undef PRIo8
++# define PRIo8 "o"
++#endif
++#if !defined PRIu8 || PRI_MACROS_BROKEN
++# undef PRIu8
++# define PRIu8 "u"
++#endif
++#if !defined PRIx8 || PRI_MACROS_BROKEN
++# undef PRIx8
++# define PRIx8 "x"
++#endif
++#if !defined PRIX8 || PRI_MACROS_BROKEN
++# undef PRIX8
++# define PRIX8 "X"
++#endif
++#if !defined PRId16 || PRI_MACROS_BROKEN
++# undef PRId16
++# define PRId16 "d"
++#endif
++#if !defined PRIi16 || PRI_MACROS_BROKEN
++# undef PRIi16
++# define PRIi16 "i"
++#endif
++#if !defined PRIo16 || PRI_MACROS_BROKEN
++# undef PRIo16
++# define PRIo16 "o"
++#endif
++#if !defined PRIu16 || PRI_MACROS_BROKEN
++# undef PRIu16
++# define PRIu16 "u"
++#endif
++#if !defined PRIx16 || PRI_MACROS_BROKEN
++# undef PRIx16
++# define PRIx16 "x"
++#endif
++#if !defined PRIX16 || PRI_MACROS_BROKEN
++# undef PRIX16
++# define PRIX16 "X"
++#endif
++#if !defined PRId32 || PRI_MACROS_BROKEN
++# undef PRId32
++# define PRId32 "d"
++#endif
++#if !defined PRIi32 || PRI_MACROS_BROKEN
++# undef PRIi32
++# define PRIi32 "i"
++#endif
++#if !defined PRIo32 || PRI_MACROS_BROKEN
++# undef PRIo32
++# define PRIo32 "o"
++#endif
++#if !defined PRIu32 || PRI_MACROS_BROKEN
++# undef PRIu32
++# define PRIu32 "u"
++#endif
++#if !defined PRIx32 || PRI_MACROS_BROKEN
++# undef PRIx32
++# define PRIx32 "x"
++#endif
++#if !defined PRIX32 || PRI_MACROS_BROKEN
++# undef PRIX32
++# define PRIX32 "X"
++#endif
++#if !defined PRId64 || PRI_MACROS_BROKEN
++# undef PRId64
++# define PRId64 (sizeof (long) == 8 ? "ld" : "lld")
++#endif
++#if !defined PRIi64 || PRI_MACROS_BROKEN
++# undef PRIi64
++# define PRIi64 (sizeof (long) == 8 ? "li" : "lli")
++#endif
++#if !defined PRIo64 || PRI_MACROS_BROKEN
++# undef PRIo64
++# define PRIo64 (sizeof (long) == 8 ? "lo" : "llo")
++#endif
++#if !defined PRIu64 || PRI_MACROS_BROKEN
++# undef PRIu64
++# define PRIu64 (sizeof (long) == 8 ? "lu" : "llu")
++#endif
++#if !defined PRIx64 || PRI_MACROS_BROKEN
++# undef PRIx64
++# define PRIx64 (sizeof (long) == 8 ? "lx" : "llx")
++#endif
++#if !defined PRIX64 || PRI_MACROS_BROKEN
++# undef PRIX64
++# define PRIX64 (sizeof (long) == 8 ? "lX" : "llX")
++#endif
++#if !defined PRIdLEAST8 || PRI_MACROS_BROKEN
++# undef PRIdLEAST8
++# define PRIdLEAST8 "d"
++#endif
++#if !defined PRIiLEAST8 || PRI_MACROS_BROKEN
++# undef PRIiLEAST8
++# define PRIiLEAST8 "i"
++#endif
++#if !defined PRIoLEAST8 || PRI_MACROS_BROKEN
++# undef PRIoLEAST8
++# define PRIoLEAST8 "o"
++#endif
++#if !defined PRIuLEAST8 || PRI_MACROS_BROKEN
++# undef PRIuLEAST8
++# define PRIuLEAST8 "u"
++#endif
++#if !defined PRIxLEAST8 || PRI_MACROS_BROKEN
++# undef PRIxLEAST8
++# define PRIxLEAST8 "x"
++#endif
++#if !defined PRIXLEAST8 || PRI_MACROS_BROKEN
++# undef PRIXLEAST8
++# define PRIXLEAST8 "X"
++#endif
++#if !defined PRIdLEAST16 || PRI_MACROS_BROKEN
++# undef PRIdLEAST16
++# define PRIdLEAST16 "d"
++#endif
++#if !defined PRIiLEAST16 || PRI_MACROS_BROKEN
++# undef PRIiLEAST16
++# define PRIiLEAST16 "i"
++#endif
++#if !defined PRIoLEAST16 || PRI_MACROS_BROKEN
++# undef PRIoLEAST16
++# define PRIoLEAST16 "o"
++#endif
++#if !defined PRIuLEAST16 || PRI_MACROS_BROKEN
++# undef PRIuLEAST16
++# define PRIuLEAST16 "u"
++#endif
++#if !defined PRIxLEAST16 || PRI_MACROS_BROKEN
++# undef PRIxLEAST16
++# define PRIxLEAST16 "x"
++#endif
++#if !defined PRIXLEAST16 || PRI_MACROS_BROKEN
++# undef PRIXLEAST16
++# define PRIXLEAST16 "X"
++#endif
++#if !defined PRIdLEAST32 || PRI_MACROS_BROKEN
++# undef PRIdLEAST32
++# define PRIdLEAST32 "d"
++#endif
++#if !defined PRIiLEAST32 || PRI_MACROS_BROKEN
++# undef PRIiLEAST32
++# define PRIiLEAST32 "i"
++#endif
++#if !defined PRIoLEAST32 || PRI_MACROS_BROKEN
++# undef PRIoLEAST32
++# define PRIoLEAST32 "o"
++#endif
++#if !defined PRIuLEAST32 || PRI_MACROS_BROKEN
++# undef PRIuLEAST32
++# define PRIuLEAST32 "u"
++#endif
++#if !defined PRIxLEAST32 || PRI_MACROS_BROKEN
++# undef PRIxLEAST32
++# define PRIxLEAST32 "x"
++#endif
++#if !defined PRIXLEAST32 || PRI_MACROS_BROKEN
++# undef PRIXLEAST32
++# define PRIXLEAST32 "X"
++#endif
++#if !defined PRIdLEAST64 || PRI_MACROS_BROKEN
++# undef PRIdLEAST64
++# define PRIdLEAST64 PRId64
++#endif
++#if !defined PRIiLEAST64 || PRI_MACROS_BROKEN
++# undef PRIiLEAST64
++# define PRIiLEAST64 PRIi64
++#endif
++#if !defined PRIoLEAST64 || PRI_MACROS_BROKEN
++# undef PRIoLEAST64
++# define PRIoLEAST64 PRIo64
++#endif
++#if !defined PRIuLEAST64 || PRI_MACROS_BROKEN
++# undef PRIuLEAST64
++# define PRIuLEAST64 PRIu64
++#endif
++#if !defined PRIxLEAST64 || PRI_MACROS_BROKEN
++# undef PRIxLEAST64
++# define PRIxLEAST64 PRIx64
++#endif
++#if !defined PRIXLEAST64 || PRI_MACROS_BROKEN
++# undef PRIXLEAST64
++# define PRIXLEAST64 PRIX64
++#endif
++#if !defined PRIdFAST8 || PRI_MACROS_BROKEN
++# undef PRIdFAST8
++# define PRIdFAST8 "d"
++#endif
++#if !defined PRIiFAST8 || PRI_MACROS_BROKEN
++# undef PRIiFAST8
++# define PRIiFAST8 "i"
++#endif
++#if !defined PRIoFAST8 || PRI_MACROS_BROKEN
++# undef PRIoFAST8
++# define PRIoFAST8 "o"
++#endif
++#if !defined PRIuFAST8 || PRI_MACROS_BROKEN
++# undef PRIuFAST8
++# define PRIuFAST8 "u"
++#endif
++#if !defined PRIxFAST8 || PRI_MACROS_BROKEN
++# undef PRIxFAST8
++# define PRIxFAST8 "x"
++#endif
++#if !defined PRIXFAST8 || PRI_MACROS_BROKEN
++# undef PRIXFAST8
++# define PRIXFAST8 "X"
++#endif
++#if !defined PRIdFAST16 || PRI_MACROS_BROKEN
++# undef PRIdFAST16
++# define PRIdFAST16 "d"
++#endif
++#if !defined PRIiFAST16 || PRI_MACROS_BROKEN
++# undef PRIiFAST16
++# define PRIiFAST16 "i"
++#endif
++#if !defined PRIoFAST16 || PRI_MACROS_BROKEN
++# undef PRIoFAST16
++# define PRIoFAST16 "o"
++#endif
++#if !defined PRIuFAST16 || PRI_MACROS_BROKEN
++# undef PRIuFAST16
++# define PRIuFAST16 "u"
++#endif
++#if !defined PRIxFAST16 || PRI_MACROS_BROKEN
++# undef PRIxFAST16
++# define PRIxFAST16 "x"
++#endif
++#if !defined PRIXFAST16 || PRI_MACROS_BROKEN
++# undef PRIXFAST16
++# define PRIXFAST16 "X"
++#endif
++#if !defined PRIdFAST32 || PRI_MACROS_BROKEN
++# undef PRIdFAST32
++# define PRIdFAST32 "d"
++#endif
++#if !defined PRIiFAST32 || PRI_MACROS_BROKEN
++# undef PRIiFAST32
++# define PRIiFAST32 "i"
++#endif
++#if !defined PRIoFAST32 || PRI_MACROS_BROKEN
++# undef PRIoFAST32
++# define PRIoFAST32 "o"
++#endif
++#if !defined PRIuFAST32 || PRI_MACROS_BROKEN
++# undef PRIuFAST32
++# define PRIuFAST32 "u"
++#endif
++#if !defined PRIxFAST32 || PRI_MACROS_BROKEN
++# undef PRIxFAST32
++# define PRIxFAST32 "x"
++#endif
++#if !defined PRIXFAST32 || PRI_MACROS_BROKEN
++# undef PRIXFAST32
++# define PRIXFAST32 "X"
++#endif
++#if !defined PRIdFAST64 || PRI_MACROS_BROKEN
++# undef PRIdFAST64
++# define PRIdFAST64 PRId64
++#endif
++#if !defined PRIiFAST64 || PRI_MACROS_BROKEN
++# undef PRIiFAST64
++# define PRIiFAST64 PRIi64
++#endif
++#if !defined PRIoFAST64 || PRI_MACROS_BROKEN
++# undef PRIoFAST64
++# define PRIoFAST64 PRIo64
++#endif
++#if !defined PRIuFAST64 || PRI_MACROS_BROKEN
++# undef PRIuFAST64
++# define PRIuFAST64 PRIu64
++#endif
++#if !defined PRIxFAST64 || PRI_MACROS_BROKEN
++# undef PRIxFAST64
++# define PRIxFAST64 PRIx64
++#endif
++#if !defined PRIXFAST64 || PRI_MACROS_BROKEN
++# undef PRIXFAST64
++# define PRIXFAST64 PRIX64
++#endif
++#if !defined PRIdMAX || PRI_MACROS_BROKEN
++# undef PRIdMAX
++# define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld")
++#endif
++#if !defined PRIiMAX || PRI_MACROS_BROKEN
++# undef PRIiMAX
++# define PRIiMAX (sizeof (uintmax_t) == sizeof (long) ? "li" : "lli")
++#endif
++#if !defined PRIoMAX || PRI_MACROS_BROKEN
++# undef PRIoMAX
++# define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo")
++#endif
++#if !defined PRIuMAX || PRI_MACROS_BROKEN
++# undef PRIuMAX
++# define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu")
++#endif
++#if !defined PRIxMAX || PRI_MACROS_BROKEN
++# undef PRIxMAX
++# define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx")
++#endif
++#if !defined PRIXMAX || PRI_MACROS_BROKEN
++# undef PRIXMAX
++# define PRIXMAX (sizeof (uintmax_t) == sizeof (long) ? "lX" : "llX")
++#endif
++#if !defined PRIdPTR || PRI_MACROS_BROKEN
++# undef PRIdPTR
++# define PRIdPTR \
++ (sizeof (void *) == sizeof (long) ? "ld" : \
++ sizeof (void *) == sizeof (int) ? "d" : \
++ "lld")
++#endif
++#if !defined PRIiPTR || PRI_MACROS_BROKEN
++# undef PRIiPTR
++# define PRIiPTR \
++ (sizeof (void *) == sizeof (long) ? "li" : \
++ sizeof (void *) == sizeof (int) ? "i" : \
++ "lli")
++#endif
++#if !defined PRIoPTR || PRI_MACROS_BROKEN
++# undef PRIoPTR
++# define PRIoPTR \
++ (sizeof (void *) == sizeof (long) ? "lo" : \
++ sizeof (void *) == sizeof (int) ? "o" : \
++ "llo")
++#endif
++#if !defined PRIuPTR || PRI_MACROS_BROKEN
++# undef PRIuPTR
++# define PRIuPTR \
++ (sizeof (void *) == sizeof (long) ? "lu" : \
++ sizeof (void *) == sizeof (int) ? "u" : \
++ "llu")
++#endif
++#if !defined PRIxPTR || PRI_MACROS_BROKEN
++# undef PRIxPTR
++# define PRIxPTR \
++ (sizeof (void *) == sizeof (long) ? "lx" : \
++ sizeof (void *) == sizeof (int) ? "x" : \
++ "llx")
++#endif
++#if !defined PRIXPTR || PRI_MACROS_BROKEN
++# undef PRIXPTR
++# define PRIXPTR \
++ (sizeof (void *) == sizeof (long) ? "lX" : \
++ sizeof (void *) == sizeof (int) ? "X" : \
++ "llX")
++#endif
+
+ /* @@ end of prolog @@ */
+
+@@ -44,7 +457,6 @@
+ /* Rename the non ISO C functions. This is required by the standard
+ because some ISO C functions will require linking with this object
+ file and the name space must not be polluted. */
+-# define fstat __fstat
+ # define open __open
+ # define close __close
+ # define read __read
+@@ -52,30 +464,471 @@
+ # define munmap __munmap
+ #endif
+
++/* For those losing systems which don't have `alloca' we have to add
++ some additional code emulating it. */
++#ifdef HAVE_ALLOCA
++# define freea(p) /* nothing */
++#else
++# define alloca(n) malloc (n)
++# define freea(p) free (p)
++#endif
++
++/* For systems that distinguish between text and binary I/O.
++ O_BINARY is usually declared in <fcntl.h>. */
++#if !defined O_BINARY && defined _O_BINARY
++ /* For MSC-compatible compilers. */
++# define O_BINARY _O_BINARY
++# define O_TEXT _O_TEXT
++#endif
++#ifdef __BEOS__
++ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
++# undef O_BINARY
++# undef O_TEXT
++#endif
++/* On reasonable systems, binary I/O is the default. */
++#ifndef O_BINARY
++# define O_BINARY 0
++#endif
++
++
+ /* We need a sign, whether a new catalog was loaded, which can be associated
+ with all translations. This is important if the translations are
+ cached by one of GCC's features. */
+-int _nl_msg_cat_cntr = 0;
++int _nl_msg_cat_cntr;
+
+
++/* Expand a system dependent string segment. Return NULL if unsupported. */
++static const char *
++get_sysdep_segment_value (const char *name)
++{
++ /* Test for an ISO C 99 section 7.8.1 format string directive.
++ Syntax:
++ P R I { d | i | o | u | x | X }
++ { { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR } */
++ /* We don't use a table of 14 times 6 'const char *' strings here, because
++ data relocations cost startup time. */
++ if (name[0] == 'P' && name[1] == 'R' && name[2] == 'I')
++ {
++ if (name[3] == 'd' || name[3] == 'i' || name[3] == 'o' || name[3] == 'u'
++ || name[3] == 'x' || name[3] == 'X')
++ {
++ if (name[4] == '8' && name[5] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRId8;
++ if (name[3] == 'i')
++ return PRIi8;
++ if (name[3] == 'o')
++ return PRIo8;
++ if (name[3] == 'u')
++ return PRIu8;
++ if (name[3] == 'x')
++ return PRIx8;
++ if (name[3] == 'X')
++ return PRIX8;
++ abort ();
++ }
++ if (name[4] == '1' && name[5] == '6' && name[6] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRId16;
++ if (name[3] == 'i')
++ return PRIi16;
++ if (name[3] == 'o')
++ return PRIo16;
++ if (name[3] == 'u')
++ return PRIu16;
++ if (name[3] == 'x')
++ return PRIx16;
++ if (name[3] == 'X')
++ return PRIX16;
++ abort ();
++ }
++ if (name[4] == '3' && name[5] == '2' && name[6] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRId32;
++ if (name[3] == 'i')
++ return PRIi32;
++ if (name[3] == 'o')
++ return PRIo32;
++ if (name[3] == 'u')
++ return PRIu32;
++ if (name[3] == 'x')
++ return PRIx32;
++ if (name[3] == 'X')
++ return PRIX32;
++ abort ();
++ }
++ if (name[4] == '6' && name[5] == '4' && name[6] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRId64;
++ if (name[3] == 'i')
++ return PRIi64;
++ if (name[3] == 'o')
++ return PRIo64;
++ if (name[3] == 'u')
++ return PRIu64;
++ if (name[3] == 'x')
++ return PRIx64;
++ if (name[3] == 'X')
++ return PRIX64;
++ abort ();
++ }
++ if (name[4] == 'L' && name[5] == 'E' && name[6] == 'A'
++ && name[7] == 'S' && name[8] == 'T')
++ {
++ if (name[9] == '8' && name[10] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdLEAST8;
++ if (name[3] == 'i')
++ return PRIiLEAST8;
++ if (name[3] == 'o')
++ return PRIoLEAST8;
++ if (name[3] == 'u')
++ return PRIuLEAST8;
++ if (name[3] == 'x')
++ return PRIxLEAST8;
++ if (name[3] == 'X')
++ return PRIXLEAST8;
++ abort ();
++ }
++ if (name[9] == '1' && name[10] == '6' && name[11] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdLEAST16;
++ if (name[3] == 'i')
++ return PRIiLEAST16;
++ if (name[3] == 'o')
++ return PRIoLEAST16;
++ if (name[3] == 'u')
++ return PRIuLEAST16;
++ if (name[3] == 'x')
++ return PRIxLEAST16;
++ if (name[3] == 'X')
++ return PRIXLEAST16;
++ abort ();
++ }
++ if (name[9] == '3' && name[10] == '2' && name[11] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdLEAST32;
++ if (name[3] == 'i')
++ return PRIiLEAST32;
++ if (name[3] == 'o')
++ return PRIoLEAST32;
++ if (name[3] == 'u')
++ return PRIuLEAST32;
++ if (name[3] == 'x')
++ return PRIxLEAST32;
++ if (name[3] == 'X')
++ return PRIXLEAST32;
++ abort ();
++ }
++ if (name[9] == '6' && name[10] == '4' && name[11] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdLEAST64;
++ if (name[3] == 'i')
++ return PRIiLEAST64;
++ if (name[3] == 'o')
++ return PRIoLEAST64;
++ if (name[3] == 'u')
++ return PRIuLEAST64;
++ if (name[3] == 'x')
++ return PRIxLEAST64;
++ if (name[3] == 'X')
++ return PRIXLEAST64;
++ abort ();
++ }
++ }
++ if (name[4] == 'F' && name[5] == 'A' && name[6] == 'S'
++ && name[7] == 'T')
++ {
++ if (name[8] == '8' && name[9] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdFAST8;
++ if (name[3] == 'i')
++ return PRIiFAST8;
++ if (name[3] == 'o')
++ return PRIoFAST8;
++ if (name[3] == 'u')
++ return PRIuFAST8;
++ if (name[3] == 'x')
++ return PRIxFAST8;
++ if (name[3] == 'X')
++ return PRIXFAST8;
++ abort ();
++ }
++ if (name[8] == '1' && name[9] == '6' && name[10] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdFAST16;
++ if (name[3] == 'i')
++ return PRIiFAST16;
++ if (name[3] == 'o')
++ return PRIoFAST16;
++ if (name[3] == 'u')
++ return PRIuFAST16;
++ if (name[3] == 'x')
++ return PRIxFAST16;
++ if (name[3] == 'X')
++ return PRIXFAST16;
++ abort ();
++ }
++ if (name[8] == '3' && name[9] == '2' && name[10] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdFAST32;
++ if (name[3] == 'i')
++ return PRIiFAST32;
++ if (name[3] == 'o')
++ return PRIoFAST32;
++ if (name[3] == 'u')
++ return PRIuFAST32;
++ if (name[3] == 'x')
++ return PRIxFAST32;
++ if (name[3] == 'X')
++ return PRIXFAST32;
++ abort ();
++ }
++ if (name[8] == '6' && name[9] == '4' && name[10] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdFAST64;
++ if (name[3] == 'i')
++ return PRIiFAST64;
++ if (name[3] == 'o')
++ return PRIoFAST64;
++ if (name[3] == 'u')
++ return PRIuFAST64;
++ if (name[3] == 'x')
++ return PRIxFAST64;
++ if (name[3] == 'X')
++ return PRIXFAST64;
++ abort ();
++ }
++ }
++ if (name[4] == 'M' && name[5] == 'A' && name[6] == 'X'
++ && name[7] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdMAX;
++ if (name[3] == 'i')
++ return PRIiMAX;
++ if (name[3] == 'o')
++ return PRIoMAX;
++ if (name[3] == 'u')
++ return PRIuMAX;
++ if (name[3] == 'x')
++ return PRIxMAX;
++ if (name[3] == 'X')
++ return PRIXMAX;
++ abort ();
++ }
++ if (name[4] == 'P' && name[5] == 'T' && name[6] == 'R'
++ && name[7] == '\0')
++ {
++ if (name[3] == 'd')
++ return PRIdPTR;
++ if (name[3] == 'i')
++ return PRIiPTR;
++ if (name[3] == 'o')
++ return PRIoPTR;
++ if (name[3] == 'u')
++ return PRIuPTR;
++ if (name[3] == 'x')
++ return PRIxPTR;
++ if (name[3] == 'X')
++ return PRIXPTR;
++ abort ();
++ }
++ }
++ }
++ /* Test for a glibc specific printf() format directive flag. */
++ if (name[0] == 'I' && name[1] == '\0')
++ {
++#if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
++ /* The 'I' flag, in numeric format directives, replaces ASCII digits
++ with the 'outdigits' defined in the LC_CTYPE locale facet. This is
++ used for Farsi (Persian) and maybe Arabic. */
++ return "I";
++#else
++ return "";
++#endif
++ }
++ /* Other system dependent strings are not valid. */
++ return NULL;
++}
++
++/* Initialize the codeset dependent parts of an opened message catalog.
++ Return the header entry. */
++const char *
++internal_function
++_nl_init_domain_conv (struct loaded_l10nfile *domain_file,
++ struct loaded_domain *domain,
++ struct binding *domainbinding)
++{
++ /* Find out about the character set the file is encoded with.
++ This can be found (in textual form) in the entry "". If this
++ entry does not exist or if this does not contain the `charset='
++ information, we will assume the charset matches the one the
++ current locale and we don't have to perform any conversion. */
++ char *nullentry;
++ size_t nullentrylen;
++
++ /* Preinitialize fields, to avoid recursion during _nl_find_msg. */
++ domain->codeset_cntr =
++ (domainbinding != NULL ? domainbinding->codeset_cntr : 0);
++#ifdef _LIBC
++ domain->conv = (__gconv_t) -1;
++#else
++# if HAVE_ICONV
++ domain->conv = (iconv_t) -1;
++# endif
++#endif
++ domain->conv_tab = NULL;
++
++ /* Get the header entry. */
++ nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
++
++ if (nullentry != NULL)
++ {
++#if defined _LIBC || HAVE_ICONV
++ const char *charsetstr;
++
++ charsetstr = strstr (nullentry, "charset=");
++ if (charsetstr != NULL)
++ {
++ size_t len;
++ char *charset;
++ const char *outcharset;
++
++ charsetstr += strlen ("charset=");
++ len = strcspn (charsetstr, " \t\n");
++
++ charset = (char *) alloca (len + 1);
++# if defined _LIBC || HAVE_MEMPCPY
++ *((char *) mempcpy (charset, charsetstr, len)) = '\0';
++# else
++ memcpy (charset, charsetstr, len);
++ charset[len] = '\0';
++# endif
++
++ /* The output charset should normally be determined by the
++ locale. But sometimes the locale is not used or not correctly
++ set up, so we provide a possibility for the user to override
++ this. Moreover, the value specified through
++ bind_textdomain_codeset overrides both. */
++ if (domainbinding != NULL && domainbinding->codeset != NULL)
++ outcharset = domainbinding->codeset;
++ else
++ {
++ outcharset = getenv ("OUTPUT_CHARSET");
++ if (outcharset == NULL || outcharset[0] == '\0')
++ {
++# ifdef _LIBC
++ outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
++# else
++# if HAVE_ICONV
++ extern const char *locale_charset (void);
++ outcharset = locale_charset ();
++# endif
++# endif
++ }
++ }
++
++# ifdef _LIBC
++ /* We always want to use transliteration. */
++ outcharset = norm_add_slashes (outcharset, "TRANSLIT");
++ charset = norm_add_slashes (charset, NULL);
++ if (__gconv_open (outcharset, charset, &domain->conv,
++ GCONV_AVOID_NOCONV)
++ != __GCONV_OK)
++ domain->conv = (__gconv_t) -1;
++# else
++# if HAVE_ICONV
++ /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
++ we want to use transliteration. */
++# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
++ || _LIBICONV_VERSION >= 0x0105
++ if (strchr (outcharset, '/') == NULL)
++ {
++ char *tmp;
++
++ len = strlen (outcharset);
++ tmp = (char *) alloca (len + 10 + 1);
++ memcpy (tmp, outcharset, len);
++ memcpy (tmp + len, "//TRANSLIT", 10 + 1);
++ outcharset = tmp;
++
++ domain->conv = iconv_open (outcharset, charset);
++
++ freea (outcharset);
++ }
++ else
++# endif
++ domain->conv = iconv_open (outcharset, charset);
++# endif
++# endif
++
++ freea (charset);
++ }
++#endif /* _LIBC || HAVE_ICONV */
++ }
++
++ return nullentry;
++}
++
++/* Frees the codeset dependent parts of an opened message catalog. */
++void
++internal_function
++_nl_free_domain_conv (struct loaded_domain *domain)
++{
++ if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
++ free (domain->conv_tab);
++
++#ifdef _LIBC
++ if (domain->conv != (__gconv_t) -1)
++ __gconv_close (domain->conv);
++#else
++# if HAVE_ICONV
++ if (domain->conv != (iconv_t) -1)
++ iconv_close (domain->conv);
++# endif
++#endif
++}
++
+ /* Load the message catalogs specified by FILENAME. If it is no valid
+ message catalog do nothing. */
+ void
+-_nl_load_domain (domain_file)
+- struct loaded_l10nfile *domain_file;
++internal_function
++_nl_load_domain (struct loaded_l10nfile *domain_file,
++ struct binding *domainbinding)
+ {
+ int fd;
++ size_t size;
++#ifdef _LIBC
++ struct stat64 st;
++#else
+ struct stat st;
++#endif
+ struct mo_file_header *data = (struct mo_file_header *) -1;
+-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+- || defined _LIBC
+ int use_mmap = 0;
+-#endif
+ struct loaded_domain *domain;
++ int revision;
++ const char *nullentry;
+
+ domain_file->decided = 1;
+ domain_file->data = NULL;
+
++ /* Note that it would be useless to store domainbinding in domain_file
++ because domainbinding might be == NULL now but != NULL later (after
++ a call to bind_textdomain_codeset). */
++
+ /* If the record does not represent a valid locale the FILENAME
+ might be NULL. This can happen when according to the given
+ specification the locale file name is different for XPG and CEN
+@@ -84,27 +937,32 @@
+ return;
+
+ /* Try to open the addressed file. */
+- fd = open (domain_file->filename, O_RDONLY);
++ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+ if (fd == -1)
+ return;
+
+ /* We must know about the size of the file. */
+- if (fstat (fd, &st) != 0
+- && st.st_size < (off_t) sizeof (struct mo_file_header))
++ if (
++#ifdef _LIBC
++ __builtin_expect (fstat64 (fd, &st) != 0, 0)
++#else
++ __builtin_expect (fstat (fd, &st) != 0, 0)
++#endif
++ || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
++ || __builtin_expect (size < sizeof (struct mo_file_header), 0))
+ {
+ /* Something went wrong. */
+ close (fd);
+ return;
+ }
+
+-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+- || defined _LIBC
++#ifdef HAVE_MMAP
+ /* Now we are ready to load the file. If mmap() is available we try
+ this first. If not available or it failed we try to load it. */
+- data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
++ data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
+ MAP_PRIVATE, fd, 0);
+
+- if (data != (struct mo_file_header *) -1)
++ if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
+ {
+ /* mmap() call was successful. */
+ close (fd);
+@@ -116,24 +974,27 @@
+ it manually. */
+ if (data == (struct mo_file_header *) -1)
+ {
+- off_t to_read;
++ size_t to_read;
+ char *read_ptr;
+
+- data = (struct mo_file_header *) malloc (st.st_size);
++ data = (struct mo_file_header *) malloc (size);
+ if (data == NULL)
+ return;
+
+- to_read = st.st_size;
++ to_read = size;
+ read_ptr = (char *) data;
+ do
+ {
+ long int nb = (long int) read (fd, read_ptr, to_read);
+- if (nb == -1)
++ if (nb <= 0)
+ {
++#ifdef EINTR
++ if (nb == -1 && errno == EINTR)
++ continue;
++#endif
+ close (fd);
+ return;
+ }
+-
+ read_ptr += nb;
+ to_read -= nb;
+ }
+@@ -144,47 +1005,378 @@
+
+ /* Using the magic number we can test whether it really is a message
+ catalog file. */
+- if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
++ if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
++ 0))
+ {
+ /* The magic number is wrong: not a message catalog file. */
+-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+- || defined _LIBC
++#ifdef HAVE_MMAP
+ if (use_mmap)
+- munmap ((caddr_t) data, st.st_size);
++ munmap ((caddr_t) data, size);
+ else
+ #endif
+ free (data);
+ return;
+ }
+
+- domain_file->data
+- = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
+- if (domain_file->data == NULL)
++ domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
++ if (domain == NULL)
+ return;
++ domain_file->data = domain;
+
+- domain = (struct loaded_domain *) domain_file->data;
+ domain->data = (char *) data;
++ domain->use_mmap = use_mmap;
++ domain->mmap_size = size;
+ domain->must_swap = data->magic != _MAGIC;
++ domain->malloced = NULL;
+
+ /* Fill in the information about the available tables. */
+- switch (W (domain->must_swap, data->revision))
++ revision = W (domain->must_swap, data->revision);
++ /* We support only the major revisions 0 and 1. */
++ switch (revision >> 16)
+ {
+ case 0:
++ case 1:
+ domain->nstrings = W (domain->must_swap, data->nstrings);
+- domain->orig_tab = (struct string_desc *)
++ domain->orig_tab = (const struct string_desc *)
+ ((char *) data + W (domain->must_swap, data->orig_tab_offset));
+- domain->trans_tab = (struct string_desc *)
++ domain->trans_tab = (const struct string_desc *)
+ ((char *) data + W (domain->must_swap, data->trans_tab_offset));
+ domain->hash_size = W (domain->must_swap, data->hash_tab_size);
+- domain->hash_tab = (nls_uint32 *)
+- ((char *) data + W (domain->must_swap, data->hash_tab_offset));
++ domain->hash_tab =
++ (domain->hash_size > 2
++ ? (const nls_uint32 *)
++ ((char *) data + W (domain->must_swap, data->hash_tab_offset))
++ : NULL);
++ domain->must_swap_hash_tab = domain->must_swap;
++
++ /* Now dispatch on the minor revision. */
++ switch (revision & 0xffff)
++ {
++ case 0:
++ domain->n_sysdep_strings = 0;
++ domain->orig_sysdep_tab = NULL;
++ domain->trans_sysdep_tab = NULL;
++ break;
++ case 1:
++ default:
++ {
++ nls_uint32 n_sysdep_strings;
++
++ if (domain->hash_tab == NULL)
++ /* This is invalid. These minor revisions need a hash table. */
++ goto invalid;
++
++ n_sysdep_strings =
++ W (domain->must_swap, data->n_sysdep_strings);
++ if (n_sysdep_strings > 0)
++ {
++ nls_uint32 n_sysdep_segments;
++ const struct sysdep_segment *sysdep_segments;
++ const char **sysdep_segment_values;
++ const nls_uint32 *orig_sysdep_tab;
++ const nls_uint32 *trans_sysdep_tab;
++ nls_uint32 n_inmem_sysdep_strings;
++ size_t memneed;
++ char *mem;
++ struct sysdep_string_desc *inmem_orig_sysdep_tab;
++ struct sysdep_string_desc *inmem_trans_sysdep_tab;
++ nls_uint32 *inmem_hash_tab;
++ unsigned int i, j;
++
++ /* Get the values of the system dependent segments. */
++ n_sysdep_segments =
++ W (domain->must_swap, data->n_sysdep_segments);
++ sysdep_segments = (const struct sysdep_segment *)
++ ((char *) data
++ + W (domain->must_swap, data->sysdep_segments_offset));
++ sysdep_segment_values =
++ alloca (n_sysdep_segments * sizeof (const char *));
++ for (i = 0; i < n_sysdep_segments; i++)
++ {
++ const char *name =
++ (char *) data
++ + W (domain->must_swap, sysdep_segments[i].offset);
++ nls_uint32 namelen =
++ W (domain->must_swap, sysdep_segments[i].length);
++
++ if (!(namelen > 0 && name[namelen - 1] == '\0'))
++ {
++ freea (sysdep_segment_values);
++ goto invalid;
++ }
++
++ sysdep_segment_values[i] = get_sysdep_segment_value (name);
++ }
++
++ orig_sysdep_tab = (const nls_uint32 *)
++ ((char *) data
++ + W (domain->must_swap, data->orig_sysdep_tab_offset));
++ trans_sysdep_tab = (const nls_uint32 *)
++ ((char *) data
++ + W (domain->must_swap, data->trans_sysdep_tab_offset));
++
++ /* Compute the amount of additional memory needed for the
++ system dependent strings and the augmented hash table.
++ At the same time, also drop string pairs which refer to
++ an undefined system dependent segment. */
++ n_inmem_sysdep_strings = 0;
++ memneed = domain->hash_size * sizeof (nls_uint32);
++ for (i = 0; i < n_sysdep_strings; i++)
++ {
++ int valid = 1;
++ size_t needs[2];
++
++ for (j = 0; j < 2; j++)
++ {
++ const struct sysdep_string *sysdep_string =
++ (const struct sysdep_string *)
++ ((char *) data
++ + W (domain->must_swap,
++ j == 0
++ ? orig_sysdep_tab[i]
++ : trans_sysdep_tab[i]));
++ size_t need = 0;
++ const struct segment_pair *p = sysdep_string->segments;
++
++ if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END)
++ for (p = sysdep_string->segments;; p++)
++ {
++ nls_uint32 sysdepref;
++
++ need += W (domain->must_swap, p->segsize);
++
++ sysdepref = W (domain->must_swap, p->sysdepref);
++ if (sysdepref == SEGMENTS_END)
++ break;
++
++ if (sysdepref >= n_sysdep_segments)
++ {
++ /* Invalid. */
++ freea (sysdep_segment_values);
++ goto invalid;
++ }
++
++ if (sysdep_segment_values[sysdepref] == NULL)
++ {
++ /* This particular string pair is invalid. */
++ valid = 0;
++ break;
++ }
++
++ need += strlen (sysdep_segment_values[sysdepref]);
++ }
++
++ needs[j] = need;
++ if (!valid)
++ break;
++ }
++
++ if (valid)
++ {
++ n_inmem_sysdep_strings++;
++ memneed += needs[0] + needs[1];
++ }
++ }
++ memneed += 2 * n_inmem_sysdep_strings
++ * sizeof (struct sysdep_string_desc);
++
++ if (n_inmem_sysdep_strings > 0)
++ {
++ unsigned int k;
++
++ /* Allocate additional memory. */
++ mem = (char *) malloc (memneed);
++ if (mem == NULL)
++ goto invalid;
++
++ domain->malloced = mem;
++ inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem;
++ mem += n_inmem_sysdep_strings
++ * sizeof (struct sysdep_string_desc);
++ inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem;
++ mem += n_inmem_sysdep_strings
++ * sizeof (struct sysdep_string_desc);
++ inmem_hash_tab = (nls_uint32 *) mem;
++ mem += domain->hash_size * sizeof (nls_uint32);
++
++ /* Compute the system dependent strings. */
++ k = 0;
++ for (i = 0; i < n_sysdep_strings; i++)
++ {
++ int valid = 1;
++
++ for (j = 0; j < 2; j++)
++ {
++ const struct sysdep_string *sysdep_string =
++ (const struct sysdep_string *)
++ ((char *) data
++ + W (domain->must_swap,
++ j == 0
++ ? orig_sysdep_tab[i]
++ : trans_sysdep_tab[i]));
++ const struct segment_pair *p =
++ sysdep_string->segments;
++
++ if (W (domain->must_swap, p->sysdepref)
++ != SEGMENTS_END)
++ for (p = sysdep_string->segments;; p++)
++ {
++ nls_uint32 sysdepref;
++
++ sysdepref =
++ W (domain->must_swap, p->sysdepref);
++ if (sysdepref == SEGMENTS_END)
++ break;
++
++ if (sysdep_segment_values[sysdepref] == NULL)
++ {
++ /* This particular string pair is
++ invalid. */
++ valid = 0;
++ break;
++ }
++ }
++
++ if (!valid)
++ break;
++ }
++
++ if (valid)
++ {
++ for (j = 0; j < 2; j++)
++ {
++ const struct sysdep_string *sysdep_string =
++ (const struct sysdep_string *)
++ ((char *) data
++ + W (domain->must_swap,
++ j == 0
++ ? orig_sysdep_tab[i]
++ : trans_sysdep_tab[i]));
++ const char *static_segments =
++ (char *) data
++ + W (domain->must_swap, sysdep_string->offset);
++ const struct segment_pair *p =
++ sysdep_string->segments;
++
++ /* Concatenate the segments, and fill
++ inmem_orig_sysdep_tab[k] (for j == 0) and
++ inmem_trans_sysdep_tab[k] (for j == 1). */
++
++ struct sysdep_string_desc *inmem_tab_entry =
++ (j == 0
++ ? inmem_orig_sysdep_tab
++ : inmem_trans_sysdep_tab)
++ + k;
++
++ if (W (domain->must_swap, p->sysdepref)
++ == SEGMENTS_END)
++ {
++ /* Only one static segment. */
++ inmem_tab_entry->length =
++ W (domain->must_swap, p->segsize);
++ inmem_tab_entry->pointer = static_segments;
++ }
++ else
++ {
++ inmem_tab_entry->pointer = mem;
++
++ for (p = sysdep_string->segments;; p++)
++ {
++ nls_uint32 segsize =
++ W (domain->must_swap, p->segsize);
++ nls_uint32 sysdepref =
++ W (domain->must_swap, p->sysdepref);
++ size_t n;
++
++ if (segsize > 0)
++ {
++ memcpy (mem, static_segments, segsize);
++ mem += segsize;
++ static_segments += segsize;
++ }
++
++ if (sysdepref == SEGMENTS_END)
++ break;
++
++ n = strlen (sysdep_segment_values[sysdepref]);
++ memcpy (mem, sysdep_segment_values[sysdepref], n);
++ mem += n;
++ }
++
++ inmem_tab_entry->length =
++ mem - inmem_tab_entry->pointer;
++ }
++ }
++
++ k++;
++ }
++ }
++ if (k != n_inmem_sysdep_strings)
++ abort ();
++
++ /* Compute the augmented hash table. */
++ for (i = 0; i < domain->hash_size; i++)
++ inmem_hash_tab[i] =
++ W (domain->must_swap_hash_tab, domain->hash_tab[i]);
++ for (i = 0; i < n_inmem_sysdep_strings; i++)
++ {
++ const char *msgid = inmem_orig_sysdep_tab[i].pointer;
++ nls_uint32 hash_val = hash_string (msgid);
++ nls_uint32 idx = hash_val % domain->hash_size;
++ nls_uint32 incr =
++ 1 + (hash_val % (domain->hash_size - 2));
++
++ for (;;)
++ {
++ if (inmem_hash_tab[idx] == 0)
++ {
++ /* Hash table entry is empty. Use it. */
++ inmem_hash_tab[idx] = 1 + domain->nstrings + i;
++ break;
++ }
++
++ if (idx >= domain->hash_size - incr)
++ idx -= domain->hash_size - incr;
++ else
++ idx += incr;
++ }
++ }
++
++ domain->n_sysdep_strings = n_inmem_sysdep_strings;
++ domain->orig_sysdep_tab = inmem_orig_sysdep_tab;
++ domain->trans_sysdep_tab = inmem_trans_sysdep_tab;
++
++ domain->hash_tab = inmem_hash_tab;
++ domain->must_swap_hash_tab = 0;
++ }
++ else
++ {
++ domain->n_sysdep_strings = 0;
++ domain->orig_sysdep_tab = NULL;
++ domain->trans_sysdep_tab = NULL;
++ }
++
++ freea (sysdep_segment_values);
++ }
++ else
++ {
++ domain->n_sysdep_strings = 0;
++ domain->orig_sysdep_tab = NULL;
++ domain->trans_sysdep_tab = NULL;
++ }
++ }
++ break;
++ }
+ break;
+ default:
+- /* This is an illegal revision. */
+-#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+- || defined _LIBC
++ /* This is an invalid revision. */
++ invalid:
++ /* This is an invalid .mo file. */
++ if (domain->malloced)
++ free (domain->malloced);
++#ifdef HAVE_MMAP
+ if (use_mmap)
+- munmap ((caddr_t) data, st.st_size);
++ munmap ((caddr_t) data, size);
+ else
+ #endif
+ free (data);
+@@ -193,7 +1385,36 @@
+ return;
+ }
+
+- /* Show that one domain is changed. This might make some cached
+- translations invalid. */
+- ++_nl_msg_cat_cntr;
++ /* Now initialize the character set converter from the character set
++ the file is encoded with (found in the header entry) to the domain's
++ specified character set or the locale's character set. */
++ nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
++
++ /* Also look for a plural specification. */
++ EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
+ }
++
++
++#ifdef _LIBC
++void
++internal_function
++_nl_unload_domain (struct loaded_domain *domain)
++{
++ if (domain->plural != &__gettext_germanic_plural)
++ __gettext_free_exp (domain->plural);
++
++ _nl_free_domain_conv (domain);
++
++ if (domain->malloced)
++ free (domain->malloced);
++
++# ifdef _POSIX_MAPPED_FILES
++ if (domain->use_mmap)
++ munmap ((caddr_t) domain->data, domain->mmap_size);
++ else
++# endif /* _POSIX_MAPPED_FILES */
++ free ((void *) domain->data);
++
++ free (domain);
++}
++#endif
+--- lrzsz-0.12.20.safe/intl/localcharset.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/localcharset.c 2004-09-12 14:40:34.478729392 -0400
+@@ -0,0 +1,398 @@
++/* Determine a canonical name for the current locale's character encoding.
++
++ Copyright (C) 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Written by Bruno Haible <bruno@clisp.org>. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++/* Specification. */
++#include "localcharset.h"
++
++#if HAVE_STDDEF_H
++# include <stddef.h>
++#endif
++
++#include <stdio.h>
++#if HAVE_STRING_H
++# include <string.h>
++#else
++# include <strings.h>
++#endif
++#if HAVE_STDLIB_H
++# include <stdlib.h>
++#endif
++
++#if defined _WIN32 || defined __WIN32__
++# undef WIN32 /* avoid warning on mingw32 */
++# define WIN32
++#endif
++
++#if defined __EMX__
++/* Assume EMX program runs on OS/2, even if compiled under DOS. */
++# define OS2
++#endif
++
++#if !defined WIN32
++# if HAVE_LANGINFO_CODESET
++# include <langinfo.h>
++# else
++# if HAVE_SETLOCALE
++# include <locale.h>
++# endif
++# endif
++#elif defined WIN32
++# define WIN32_LEAN_AND_MEAN
++# include <windows.h>
++#endif
++#if defined OS2
++# define INCL_DOS
++# include <os2.h>
++#endif
++
++#if ENABLE_RELOCATABLE
++# include "relocatable.h"
++#else
++# define relocate(pathname) (pathname)
++#endif
++
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS */
++# define ISSLASH(C) ((C) == '/' || (C) == '\\')
++#endif
++
++#ifndef DIRECTORY_SEPARATOR
++# define DIRECTORY_SEPARATOR '/'
++#endif
++
++#ifndef ISSLASH
++# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
++#endif
++
++#if HAVE_DECL_GETC_UNLOCKED
++# undef getc
++# define getc getc_unlocked
++#endif
++
++/* The following static variable is declared 'volatile' to avoid a
++ possible multithread problem in the function get_charset_aliases. If we
++ are running in a threaded environment, and if two threads initialize
++ 'charset_aliases' simultaneously, both will produce the same value,
++ and everything will be ok if the two assignments to 'charset_aliases'
++ are atomic. But I don't know what will happen if the two assignments mix. */
++#if __STDC__ != 1
++# define volatile /* empty */
++#endif
++/* Pointer to the contents of the charset.alias file, if it has already been
++ read, else NULL. Its format is:
++ ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */
++static const char * volatile charset_aliases;
++
++/* Return a pointer to the contents of the charset.alias file. */
++static const char *
++get_charset_aliases ()
++{
++ const char *cp;
++
++ cp = charset_aliases;
++ if (cp == NULL)
++ {
++#if !(defined VMS || defined WIN32)
++ FILE *fp;
++ const char *dir = relocate (LIBDIR);
++ const char *base = "charset.alias";
++ char *file_name;
++
++ /* Concatenate dir and base into freshly allocated file_name. */
++ {
++ size_t dir_len = strlen (dir);
++ size_t base_len = strlen (base);
++ int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1]));
++ file_name = (char *) malloc (dir_len + add_slash + base_len + 1);
++ if (file_name != NULL)
++ {
++ memcpy (file_name, dir, dir_len);
++ if (add_slash)
++ file_name[dir_len] = DIRECTORY_SEPARATOR;
++ memcpy (file_name + dir_len + add_slash, base, base_len + 1);
++ }
++ }
++
++ if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
++ /* Out of memory or file not found, treat it as empty. */
++ cp = "";
++ else
++ {
++ /* Parse the file's contents. */
++ int c;
++ char buf1[50+1];
++ char buf2[50+1];
++ char *res_ptr = NULL;
++ size_t res_size = 0;
++ size_t l1, l2;
++
++ for (;;)
++ {
++ c = getc (fp);
++ if (c == EOF)
++ break;
++ if (c == '\n' || c == ' ' || c == '\t')
++ continue;
++ if (c == '#')
++ {
++ /* Skip comment, to end of line. */
++ do
++ c = getc (fp);
++ while (!(c == EOF || c == '\n'));
++ if (c == EOF)
++ break;
++ continue;
++ }
++ ungetc (c, fp);
++ if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
++ break;
++ l1 = strlen (buf1);
++ l2 = strlen (buf2);
++ if (res_size == 0)
++ {
++ res_size = l1 + 1 + l2 + 1;
++ res_ptr = (char *) malloc (res_size + 1);
++ }
++ else
++ {
++ res_size += l1 + 1 + l2 + 1;
++ res_ptr = (char *) realloc (res_ptr, res_size + 1);
++ }
++ if (res_ptr == NULL)
++ {
++ /* Out of memory. */
++ res_size = 0;
++ break;
++ }
++ strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
++ strcpy (res_ptr + res_size - (l2 + 1), buf2);
++ }
++ fclose (fp);
++ if (res_size == 0)
++ cp = "";
++ else
++ {
++ *(res_ptr + res_size) = '\0';
++ cp = res_ptr;
++ }
++ }
++
++ if (file_name != NULL)
++ free (file_name);
++
++#else
++
++# if defined VMS
++ /* To avoid the troubles of an extra file charset.alias_vms in the
++ sources of many GNU packages, simply inline the aliases here. */
++ /* The list of encodings is taken from the OpenVMS 7.3-1 documentation
++ "Compaq C Run-Time Library Reference Manual for OpenVMS systems"
++ section 10.7 "Handling Different Character Sets". */
++ cp = "ISO8859-1" "\0" "ISO-8859-1" "\0"
++ "ISO8859-2" "\0" "ISO-8859-2" "\0"
++ "ISO8859-5" "\0" "ISO-8859-5" "\0"
++ "ISO8859-7" "\0" "ISO-8859-7" "\0"
++ "ISO8859-8" "\0" "ISO-8859-8" "\0"
++ "ISO8859-9" "\0" "ISO-8859-9" "\0"
++ /* Japanese */
++ "eucJP" "\0" "EUC-JP" "\0"
++ "SJIS" "\0" "SHIFT_JIS" "\0"
++ "DECKANJI" "\0" "DEC-KANJI" "\0"
++ "SDECKANJI" "\0" "EUC-JP" "\0"
++ /* Chinese */
++ "eucTW" "\0" "EUC-TW" "\0"
++ "DECHANYU" "\0" "DEC-HANYU" "\0"
++ "DECHANZI" "\0" "GB2312" "\0"
++ /* Korean */
++ "DECKOREAN" "\0" "EUC-KR" "\0";
++# endif
++
++# if defined WIN32
++ /* To avoid the troubles of installing a separate file in the same
++ directory as the DLL and of retrieving the DLL's directory at
++ runtime, simply inline the aliases here. */
++
++ cp = "CP936" "\0" "GBK" "\0"
++ "CP1361" "\0" "JOHAB" "\0"
++ "CP20127" "\0" "ASCII" "\0"
++ "CP20866" "\0" "KOI8-R" "\0"
++ "CP21866" "\0" "KOI8-RU" "\0"
++ "CP28591" "\0" "ISO-8859-1" "\0"
++ "CP28592" "\0" "ISO-8859-2" "\0"
++ "CP28593" "\0" "ISO-8859-3" "\0"
++ "CP28594" "\0" "ISO-8859-4" "\0"
++ "CP28595" "\0" "ISO-8859-5" "\0"
++ "CP28596" "\0" "ISO-8859-6" "\0"
++ "CP28597" "\0" "ISO-8859-7" "\0"
++ "CP28598" "\0" "ISO-8859-8" "\0"
++ "CP28599" "\0" "ISO-8859-9" "\0"
++ "CP28605" "\0" "ISO-8859-15" "\0";
++# endif
++#endif
++
++ charset_aliases = cp;
++ }
++
++ return cp;
++}
++
++/* Determine the current locale's character encoding, and canonicalize it
++ into one of the canonical names listed in config.charset.
++ The result must not be freed; it is statically allocated.
++ If the canonical name cannot be determined, the result is a non-canonical
++ name. */
++
++#ifdef STATIC
++STATIC
++#endif
++const char *
++locale_charset ()
++{
++ const char *codeset;
++ const char *aliases;
++
++#if !(defined WIN32 || defined OS2)
++
++# if HAVE_LANGINFO_CODESET
++
++ /* Most systems support nl_langinfo (CODESET) nowadays. */
++ codeset = nl_langinfo (CODESET);
++
++# else
++
++ /* On old systems which lack it, use setlocale or getenv. */
++ const char *locale = NULL;
++
++ /* But most old systems don't have a complete set of locales. Some
++ (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
++ use setlocale here; it would return "C" when it doesn't support the
++ locale name the user has set. */
++# if HAVE_SETLOCALE && 0
++ locale = setlocale (LC_CTYPE, NULL);
++# endif
++ if (locale == NULL || locale[0] == '\0')
++ {
++ locale = getenv ("LC_ALL");
++ if (locale == NULL || locale[0] == '\0')
++ {
++ locale = getenv ("LC_CTYPE");
++ if (locale == NULL || locale[0] == '\0')
++ locale = getenv ("LANG");
++ }
++ }
++
++ /* On some old systems, one used to set locale = "iso8859_1". On others,
++ you set it to "language_COUNTRY.charset". In any case, we resolve it
++ through the charset.alias file. */
++ codeset = locale;
++
++# endif
++
++#elif defined WIN32
++
++ static char buf[2 + 10 + 1];
++
++ /* Woe32 has a function returning the locale's codepage as a number. */
++ sprintf (buf, "CP%u", GetACP ());
++ codeset = buf;
++
++#elif defined OS2
++
++ const char *locale;
++ static char buf[2 + 10 + 1];
++ ULONG cp[3];
++ ULONG cplen;
++
++ /* Allow user to override the codeset, as set in the operating system,
++ with standard language environment variables. */
++ locale = getenv ("LC_ALL");
++ if (locale == NULL || locale[0] == '\0')
++ {
++ locale = getenv ("LC_CTYPE");
++ if (locale == NULL || locale[0] == '\0')
++ locale = getenv ("LANG");
++ }
++ if (locale != NULL && locale[0] != '\0')
++ {
++ /* If the locale name contains an encoding after the dot, return it. */
++ const char *dot = strchr (locale, '.');
++
++ if (dot != NULL)
++ {
++ const char *modifier;
++
++ dot++;
++ /* Look for the possible @... trailer and remove it, if any. */
++ modifier = strchr (dot, '@');
++ if (modifier == NULL)
++ return dot;
++ if (modifier - dot < sizeof (buf))
++ {
++ memcpy (buf, dot, modifier - dot);
++ buf [modifier - dot] = '\0';
++ return buf;
++ }
++ }
++
++ /* Resolve through the charset.alias file. */
++ codeset = locale;
++ }
++ else
++ {
++ /* OS/2 has a function returning the locale's codepage as a number. */
++ if (DosQueryCp (sizeof (cp), cp, &cplen))
++ codeset = "";
++ else
++ {
++ sprintf (buf, "CP%u", cp[0]);
++ codeset = buf;
++ }
++ }
++
++#endif
++
++ if (codeset == NULL)
++ /* The canonical name cannot be determined. */
++ codeset = "";
++
++ /* Resolve alias. */
++ for (aliases = get_charset_aliases ();
++ *aliases != '\0';
++ aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
++ if (strcmp (codeset, aliases) == 0
++ || (aliases[0] == '*' && aliases[1] == '\0'))
++ {
++ codeset = aliases + strlen (aliases) + 1;
++ break;
++ }
++
++ /* Don't return an empty string. GNU libc and GNU libiconv interpret
++ the empty string as denoting "the locale's character encoding",
++ thus GNU libiconv would call this function a second time. */
++ if (codeset[0] == '\0')
++ codeset = "ASCII";
++
++ return codeset;
++}
+--- lrzsz-0.12.20.safe/intl/localcharset.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/localcharset.h 2004-09-12 14:40:34.483728632 -0400
+@@ -0,0 +1,42 @@
++/* Determine a canonical name for the current locale's character encoding.
++ Copyright (C) 2000-2003 Free Software Foundation, Inc.
++ This file is part of the GNU CHARSET Library.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _LOCALCHARSET_H
++#define _LOCALCHARSET_H
++
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++/* Determine the current locale's character encoding, and canonicalize it
++ into one of the canonical names listed in config.charset.
++ The result must not be freed; it is statically allocated.
++ If the canonical name cannot be determined, the result is a non-canonical
++ name. */
++extern const char * locale_charset (void);
++
++
++#ifdef __cplusplus
++}
++#endif
++
++
++#endif /* _LOCALCHARSET_H */
+--- lrzsz-0.12.20.safe/intl/locale.alias 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/locale.alias 2004-09-12 14:40:34.499726200 -0400
+@@ -0,0 +1,78 @@
++# Locale name alias data base.
++# Copyright (C) 1996-2001,2003 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Library General Public License as published
++# by the Free Software Foundation; either version 2, or (at your option)
++# any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# Library General Public License for more details.
++#
++# You should have received a copy of the GNU Library General Public
++# License along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
++
++# The format of this file is the same as for the corresponding file of
++# the X Window System, which normally can be found in
++# /usr/lib/X11/locale/locale.alias
++# A single line contains two fields: an alias and a substitution value.
++# All entries are case independent.
++
++# Note: This file is far from being complete. If you have a value for
++# your own site which you think might be useful for others too, share
++# it with the rest of us. Send it using the `glibcbug' script to
++# bugs@gnu.org.
++
++# Packages using this file:
++
++bokmal nb_NO.ISO-8859-1
++bokmĺl nb_NO.ISO-8859-1
++catalan ca_ES.ISO-8859-1
++croatian hr_HR.ISO-8859-2
++czech cs_CZ.ISO-8859-2
++danish da_DK.ISO-8859-1
++dansk da_DK.ISO-8859-1
++deutsch de_DE.ISO-8859-1
++dutch nl_NL.ISO-8859-1
++eesti et_EE.ISO-8859-1
++estonian et_EE.ISO-8859-1
++finnish fi_FI.ISO-8859-1
++français fr_FR.ISO-8859-1
++french fr_FR.ISO-8859-1
++galego gl_ES.ISO-8859-1
++galician gl_ES.ISO-8859-1
++german de_DE.ISO-8859-1
++greek el_GR.ISO-8859-7
++hebrew he_IL.ISO-8859-8
++hrvatski hr_HR.ISO-8859-2
++hungarian hu_HU.ISO-8859-2
++icelandic is_IS.ISO-8859-1
++italian it_IT.ISO-8859-1
++japanese ja_JP.eucJP
++japanese.euc ja_JP.eucJP
++ja_JP ja_JP.eucJP
++ja_JP.ujis ja_JP.eucJP
++japanese.sjis ja_JP.SJIS
++korean ko_KR.eucKR
++korean.euc ko_KR.eucKR
++ko_KR ko_KR.eucKR
++lithuanian lt_LT.ISO-8859-13
++no_NO nb_NO.ISO-8859-1
++no_NO.ISO-8859-1 nb_NO.ISO-8859-1
++norwegian nb_NO.ISO-8859-1
++nynorsk nn_NO.ISO-8859-1
++polish pl_PL.ISO-8859-2
++portuguese pt_PT.ISO-8859-1
++romanian ro_RO.ISO-8859-2
++russian ru_RU.ISO-8859-5
++slovak sk_SK.ISO-8859-2
++slovene sl_SI.ISO-8859-2
++slovenian sl_SI.ISO-8859-2
++spanish es_ES.ISO-8859-1
++swedish sv_SE.ISO-8859-1
++thai th_TH.TIS-620
++turkish tr_TR.ISO-8859-9
+--- lrzsz-0.12.20.safe/intl/localealias.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/localealias.c 2004-09-12 14:40:34.505725288 -0400
+@@ -1,20 +1,27 @@
+-/* Handle aliases for locale names
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
++/* Handle aliases for locale names.
++ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Tell glibc's <string.h> to provide a prototype for mempcpy().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+@@ -22,56 +29,45 @@
+
+ #include <ctype.h>
+ #include <stdio.h>
++#if defined _LIBC || defined HAVE___FSETLOCKING
++# include <stdio_ext.h>
++#endif
+ #include <sys/types.h>
+
+ #ifdef __GNUC__
++# undef alloca
+ # define alloca __builtin_alloca
+ # define HAVE_ALLOCA 1
+ #else
+-# if defined HAVE_ALLOCA_H || defined _LIBC
+-# include <alloca.h>
++# ifdef _MSC_VER
++# include <malloc.h>
++# define alloca _alloca
+ # else
+-# ifdef _AIX
+- #pragma alloca
++# if defined HAVE_ALLOCA_H || defined _LIBC
++# include <alloca.h>
+ # else
+-# ifndef alloca
++# ifdef _AIX
++ #pragma alloca
++# else
++# ifndef alloca
+ char *alloca ();
++# endif
+ # endif
+ # endif
+ # endif
+ #endif
+
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#else
+-char *getenv ();
+-# ifdef HAVE_MALLOC_H
+-# include <malloc.h>
+-# else
+-void free ();
+-# endif
+-#endif
++#include <stdlib.h>
++#include <string.h>
+
+-#if defined HAVE_STRING_H || defined _LIBC
+-# ifndef _GNU_SOURCE
+-# define _GNU_SOURCE 1
+-# endif
+-# include <string.h>
++#include "gettextP.h"
++
++#if ENABLE_RELOCATABLE
++# include "relocatable.h"
+ #else
+-# include <strings.h>
+-# ifndef memcpy
+-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+-# endif
+-#endif
+-#if !HAVE_STRCHR && !defined _LIBC
+-# ifndef strchr
+-# define strchr index
+-# endif
++# define relocate(pathname) (pathname)
+ #endif
+
+-#include "gettext.h"
+-#include "gettextP.h"
+-
+ /* @@ end of prolog @@ */
+
+ #ifdef _LIBC
+@@ -79,43 +75,49 @@
+ because some ANSI C functions will require linking with this object
+ file and the name space must not be polluted. */
+ # define strcasecmp __strcasecmp
++
++# ifndef mempcpy
++# define mempcpy __mempcpy
++# endif
++# define HAVE_MEMPCPY 1
++# define HAVE___FSETLOCKING 1
++
++/* We need locking here since we can be called from different places. */
++# include <bits/libc-lock.h>
++
++__libc_lock_define_initialized (static, lock);
++#endif
++
++#ifndef internal_function
++# define internal_function
+ #endif
+
++/* Some optimizations for glibc. */
++#ifdef _LIBC
++# define FEOF(fp) feof_unlocked (fp)
++# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp)
++#else
++# define FEOF(fp) feof (fp)
++# define FGETS(buf, n, fp) fgets (buf, n, fp)
++#endif
+
+-/* For those loosing systems which don't have `alloca' we have to add
++/* For those losing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+ #ifdef HAVE_ALLOCA
+-/* Nothing has to be done. */
+-# define ADD_BLOCK(list, address) /* nothing */
+-# define FREE_BLOCKS(list) /* nothing */
++# define freea(p) /* nothing */
+ #else
+-struct block_list
+-{
+- void *address;
+- struct block_list *next;
+-};
+-# define ADD_BLOCK(list, addr) \
+- do { \
+- struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+- /* If we cannot get a free block we cannot add the new element to \
+- the list. */ \
+- if (newp != NULL) { \
+- newp->address = (addr); \
+- newp->next = (list); \
+- (list) = newp; \
+- } \
+- } while (0)
+-# define FREE_BLOCKS(list) \
+- do { \
+- while (list != NULL) { \
+- struct block_list *old = list; \
+- list = list->next; \
+- free (old); \
+- } \
+- } while (0)
+-# undef alloca
+-# define alloca(size) (malloc (size))
+-#endif /* have alloca */
++# define alloca(n) malloc (n)
++# define freea(p) free (p)
++#endif
++
++#if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED
++# undef fgets
++# define fgets(buf, len, s) fgets_unlocked (buf, len, s)
++#endif
++#if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED
++# undef feof
++# define feof(s) feof_unlocked (s)
++#endif
+
+
+ struct alias_map
+@@ -125,26 +127,41 @@
+ };
+
+
+-static struct alias_map *map;
+-static size_t nmap = 0;
+-static size_t maxmap = 0;
++#ifndef _LIBC
++# define libc_freeres_ptr(decl) decl
++#endif
++
++libc_freeres_ptr (static char *string_space);
++static size_t string_space_act;
++static size_t string_space_max;
++libc_freeres_ptr (static struct alias_map *map);
++static size_t nmap;
++static size_t maxmap;
+
+
+ /* Prototypes for local functions. */
+-static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
+-static void extend_alias_table PARAMS ((void));
+-static int alias_compare PARAMS ((const struct alias_map *map1,
+- const struct alias_map *map2));
++static size_t read_alias_file (const char *fname, int fname_len)
++ internal_function;
++static int extend_alias_table (void);
++static int alias_compare (const struct alias_map *map1,
++ const struct alias_map *map2);
+
+
+ const char *
+-_nl_expand_alias (name)
+- const char *name;
++_nl_expand_alias (const char *name)
+ {
+- static const char *locale_alias_path = LOCALE_ALIAS_PATH;
++ static const char *locale_alias_path;
+ struct alias_map *retval;
++ const char *result = NULL;
+ size_t added;
+
++#ifdef _LIBC
++ __libc_lock_lock (lock);
++#endif
++
++ if (locale_alias_path == NULL)
++ locale_alias_path = LOCALE_ALIAS_PATH;
++
+ do
+ {
+ struct alias_map item;
+@@ -154,15 +171,18 @@
+ if (nmap > 0)
+ retval = (struct alias_map *) bsearch (&item, map, nmap,
+ sizeof (struct alias_map),
+- (int (*) PARAMS ((const void *,
+- const void *))
++ (int (*) (const void *,
++ const void *)
+ ) alias_compare);
+ else
+ retval = NULL;
+
+ /* We really found an alias. Return the value. */
+ if (retval != NULL)
+- return retval->value;
++ {
++ result = retval->value;
++ break;
++ }
+
+ /* Perhaps we can find another alias file. */
+ added = 0;
+@@ -170,11 +190,12 @@
+ {
+ const char *start;
+
+- while (locale_alias_path[0] == ':')
++ while (locale_alias_path[0] == PATH_SEPARATOR)
+ ++locale_alias_path;
+ start = locale_alias_path;
+
+- while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
++ while (locale_alias_path[0] != '\0'
++ && locale_alias_path[0] != PATH_SEPARATOR)
+ ++locale_alias_path;
+
+ if (start < locale_alias_path)
+@@ -183,78 +204,87 @@
+ }
+ while (added != 0);
+
+- return NULL;
++#ifdef _LIBC
++ __libc_lock_unlock (lock);
++#endif
++
++ return result;
+ }
+
+
+ static size_t
+-read_alias_file (fname, fname_len)
+- const char *fname;
+- int fname_len;
++internal_function
++read_alias_file (const char *fname, int fname_len)
+ {
+-#ifndef HAVE_ALLOCA
+- struct block_list *block_list = NULL;
+-#endif
+ FILE *fp;
+ char *full_fname;
+ size_t added;
+ static const char aliasfile[] = "/locale.alias";
+
+ full_fname = (char *) alloca (fname_len + sizeof aliasfile);
+- ADD_BLOCK (block_list, full_fname);
++#ifdef HAVE_MEMPCPY
++ mempcpy (mempcpy (full_fname, fname, fname_len),
++ aliasfile, sizeof aliasfile);
++#else
+ memcpy (full_fname, fname, fname_len);
+ memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
++#endif
+
+- fp = fopen (full_fname, "r");
++ fp = fopen (relocate (full_fname), "r");
++ freea (full_fname);
+ if (fp == NULL)
+- {
+- FREE_BLOCKS (block_list);
+- return 0;
+- }
++ return 0;
++
++#ifdef HAVE___FSETLOCKING
++ /* No threads present. */
++ __fsetlocking (fp, FSETLOCKING_BYCALLER);
++#endif
+
+ added = 0;
+- while (!feof (fp))
++ while (!FEOF (fp))
+ {
+ /* It is a reasonable approach to use a fix buffer here because
+ a) we are only interested in the first two fields
+ b) these fields must be usable as file names and so must not
+ be that long
+- */
+- char buf[BUFSIZ];
++ We avoid a multi-kilobyte buffer here since this would use up
++ stack space which we might not have if the program ran out of
++ memory. */
++ char buf[400];
+ char *alias;
+ char *value;
+ char *cp;
+
+- if (fgets (buf, BUFSIZ, fp) == NULL)
++ if (FGETS (buf, sizeof buf, fp) == NULL)
+ /* EOF reached. */
+ break;
+
+ cp = buf;
+ /* Ignore leading white space. */
+- while (isspace (cp[0]))
++ while (isspace ((unsigned char) cp[0]))
+ ++cp;
+
+ /* A leading '#' signals a comment line. */
+ if (cp[0] != '\0' && cp[0] != '#')
+ {
+ alias = cp++;
+- while (cp[0] != '\0' && !isspace (cp[0]))
++ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
+ ++cp;
+ /* Terminate alias name. */
+ if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ /* Now look for the beginning of the value. */
+- while (isspace (cp[0]))
++ while (isspace ((unsigned char) cp[0]))
+ ++cp;
+
+ if (cp[0] != '\0')
+ {
+- char *tp;
+- size_t len;
++ size_t alias_len;
++ size_t value_len;
+
+ value = cp++;
+- while (cp[0] != '\0' && !isspace (cp[0]))
++ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
+ ++cp;
+ /* Terminate value. */
+ if (cp[0] == '\n')
+@@ -269,28 +299,44 @@
+ *cp++ = '\0';
+
+ if (nmap >= maxmap)
+- extend_alias_table ();
+-
+- /* We cannot depend on strdup available in the libc. Sigh! */
+- len = strlen (alias) + 1;
+- tp = (char *) malloc (len);
+- if (tp == NULL)
+- {
+- FREE_BLOCKS (block_list);
++ if (__builtin_expect (extend_alias_table (), 0))
+ return added;
+- }
+- memcpy (tp, alias, len);
+- map[nmap].alias = tp;
+
+- len = strlen (value) + 1;
+- tp = (char *) malloc (len);
+- if (tp == NULL)
++ alias_len = strlen (alias) + 1;
++ value_len = strlen (value) + 1;
++
++ if (string_space_act + alias_len + value_len > string_space_max)
+ {
+- FREE_BLOCKS (block_list);
+- return added;
++ /* Increase size of memory pool. */
++ size_t new_size = (string_space_max
++ + (alias_len + value_len > 1024
++ ? alias_len + value_len : 1024));
++ char *new_pool = (char *) realloc (string_space, new_size);
++ if (new_pool == NULL)
++ return added;
++
++ if (__builtin_expect (string_space != new_pool, 0))
++ {
++ size_t i;
++
++ for (i = 0; i < nmap; i++)
++ {
++ map[i].alias += new_pool - string_space;
++ map[i].value += new_pool - string_space;
++ }
++ }
++
++ string_space = new_pool;
++ string_space_max = new_size;
+ }
+- memcpy (tp, value, len);
+- map[nmap].value = tp;
++
++ map[nmap].alias = memcpy (&string_space[string_space_act],
++ alias, alias_len);
++ string_space_act += alias_len;
++
++ map[nmap].value = memcpy (&string_space[string_space_act],
++ value, value_len);
++ string_space_act += value_len;
+
+ ++nmap;
+ ++added;
+@@ -299,14 +345,11 @@
+
+ /* Possibly not the whole line fits into the buffer. Ignore
+ the rest of the line. */
+- while (strchr (cp, '\n') == NULL)
+- {
+- cp = buf;
+- if (fgets (buf, BUFSIZ, fp) == NULL)
+- /* Make sure the inner loop will be left. The outer loop
+- will exit at the `feof' test. */
+- *cp = '\n';
+- }
++ while (strchr (buf, '\n') == NULL)
++ if (FGETS (buf, sizeof buf, fp) == NULL)
++ /* Make sure the inner loop will be left. The outer loop
++ will exit at the `feof' test. */
++ break;
+ }
+
+ /* Should we test for ferror()? I think we have to silently ignore
+@@ -315,40 +358,33 @@
+
+ if (added > 0)
+ qsort (map, nmap, sizeof (struct alias_map),
+- (int (*) PARAMS ((const void *, const void *))) alias_compare);
++ (int (*) (const void *, const void *)) alias_compare);
+
+- FREE_BLOCKS (block_list);
+ return added;
+ }
+
+
+-static void
++static int
+ extend_alias_table ()
+ {
+ size_t new_size;
+ struct alias_map *new_map;
+
+ new_size = maxmap == 0 ? 100 : 2 * maxmap;
+- new_map = (struct alias_map *) malloc (new_size
+- * sizeof (struct alias_map));
++ new_map = (struct alias_map *) realloc (map, (new_size
++ * sizeof (struct alias_map)));
+ if (new_map == NULL)
+ /* Simply don't extend: we don't have any more core. */
+- return;
+-
+- memcpy (new_map, map, nmap * sizeof (struct alias_map));
+-
+- if (maxmap != 0)
+- free (map);
++ return -1;
+
+ map = new_map;
+ maxmap = new_size;
++ return 0;
+ }
+
+
+ static int
+-alias_compare (map1, map2)
+- const struct alias_map *map1;
+- const struct alias_map *map2;
++alias_compare (const struct alias_map *map1, const struct alias_map *map2)
+ {
+ #if defined _LIBC || defined HAVE_STRCASECMP
+ return strcasecmp (map1->alias, map2->alias);
+--- lrzsz-0.12.20.safe/intl/localename.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/localename.c 2004-09-12 14:40:34.510724528 -0400
+@@ -0,0 +1,1142 @@
++/* Determine the current selected locale.
++ Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */
++/* Win32 code written by Tor Lillqvist <tml@iki.fi>. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <stdlib.h>
++#include <locale.h>
++
++#if defined _WIN32 || defined __WIN32__
++# undef WIN32 /* avoid warning on mingw32 */
++# define WIN32
++#endif
++
++#ifdef WIN32
++# define WIN32_LEAN_AND_MEAN
++# include <windows.h>
++/* List of language codes, sorted by value:
++ 0x01 LANG_ARABIC
++ 0x02 LANG_BULGARIAN
++ 0x03 LANG_CATALAN
++ 0x04 LANG_CHINESE
++ 0x05 LANG_CZECH
++ 0x06 LANG_DANISH
++ 0x07 LANG_GERMAN
++ 0x08 LANG_GREEK
++ 0x09 LANG_ENGLISH
++ 0x0a LANG_SPANISH
++ 0x0b LANG_FINNISH
++ 0x0c LANG_FRENCH
++ 0x0d LANG_HEBREW
++ 0x0e LANG_HUNGARIAN
++ 0x0f LANG_ICELANDIC
++ 0x10 LANG_ITALIAN
++ 0x11 LANG_JAPANESE
++ 0x12 LANG_KOREAN
++ 0x13 LANG_DUTCH
++ 0x14 LANG_NORWEGIAN
++ 0x15 LANG_POLISH
++ 0x16 LANG_PORTUGUESE
++ 0x17 LANG_RHAETO_ROMANCE
++ 0x18 LANG_ROMANIAN
++ 0x19 LANG_RUSSIAN
++ 0x1a LANG_CROATIAN == LANG_SERBIAN
++ 0x1b LANG_SLOVAK
++ 0x1c LANG_ALBANIAN
++ 0x1d LANG_SWEDISH
++ 0x1e LANG_THAI
++ 0x1f LANG_TURKISH
++ 0x20 LANG_URDU
++ 0x21 LANG_INDONESIAN
++ 0x22 LANG_UKRAINIAN
++ 0x23 LANG_BELARUSIAN
++ 0x24 LANG_SLOVENIAN
++ 0x25 LANG_ESTONIAN
++ 0x26 LANG_LATVIAN
++ 0x27 LANG_LITHUANIAN
++ 0x28 LANG_TAJIK
++ 0x29 LANG_FARSI
++ 0x2a LANG_VIETNAMESE
++ 0x2b LANG_ARMENIAN
++ 0x2c LANG_AZERI
++ 0x2d LANG_BASQUE
++ 0x2e LANG_SORBIAN
++ 0x2f LANG_MACEDONIAN
++ 0x30 LANG_SUTU
++ 0x31 LANG_TSONGA
++ 0x32 LANG_TSWANA
++ 0x33 LANG_VENDA
++ 0x34 LANG_XHOSA
++ 0x35 LANG_ZULU
++ 0x36 LANG_AFRIKAANS
++ 0x37 LANG_GEORGIAN
++ 0x38 LANG_FAEROESE
++ 0x39 LANG_HINDI
++ 0x3a LANG_MALTESE
++ 0x3b LANG_SAAMI
++ 0x3c LANG_GAELIC
++ 0x3d LANG_YIDDISH
++ 0x3e LANG_MALAY
++ 0x3f LANG_KAZAK
++ 0x40 LANG_KYRGYZ
++ 0x41 LANG_SWAHILI
++ 0x42 LANG_TURKMEN
++ 0x43 LANG_UZBEK
++ 0x44 LANG_TATAR
++ 0x45 LANG_BENGALI
++ 0x46 LANG_PUNJABI
++ 0x47 LANG_GUJARATI
++ 0x48 LANG_ORIYA
++ 0x49 LANG_TAMIL
++ 0x4a LANG_TELUGU
++ 0x4b LANG_KANNADA
++ 0x4c LANG_MALAYALAM
++ 0x4d LANG_ASSAMESE
++ 0x4e LANG_MARATHI
++ 0x4f LANG_SANSKRIT
++ 0x50 LANG_MONGOLIAN
++ 0x51 LANG_TIBETAN
++ 0x52 LANG_WELSH
++ 0x53 LANG_CAMBODIAN
++ 0x54 LANG_LAO
++ 0x55 LANG_BURMESE
++ 0x56 LANG_GALICIAN
++ 0x57 LANG_KONKANI
++ 0x58 LANG_MANIPURI
++ 0x59 LANG_SINDHI
++ 0x5a LANG_SYRIAC
++ 0x5b LANG_SINHALESE
++ 0x5c LANG_CHEROKEE
++ 0x5d LANG_INUKTITUT
++ 0x5e LANG_AMHARIC
++ 0x5f LANG_TAMAZIGHT
++ 0x60 LANG_KASHMIRI
++ 0x61 LANG_NEPALI
++ 0x62 LANG_FRISIAN
++ 0x63 LANG_PASHTO
++ 0x64 LANG_TAGALOG
++ 0x65 LANG_DIVEHI
++ 0x66 LANG_EDO
++ 0x67 LANG_FULFULDE
++ 0x68 LANG_HAUSA
++ 0x69 LANG_IBIBIO
++ 0x6a LANG_YORUBA
++ 0x70 LANG_IGBO
++ 0x71 LANG_KANURI
++ 0x72 LANG_OROMO
++ 0x73 LANG_TIGRINYA
++ 0x74 LANG_GUARANI
++ 0x75 LANG_HAWAIIAN
++ 0x76 LANG_LATIN
++ 0x77 LANG_SOMALI
++ 0x78 LANG_YI
++ 0x79 LANG_PAPIAMENTU
++*/
++/* Mingw headers don't have latest language and sublanguage codes. */
++# ifndef LANG_AFRIKAANS
++# define LANG_AFRIKAANS 0x36
++# endif
++# ifndef LANG_ALBANIAN
++# define LANG_ALBANIAN 0x1c
++# endif
++# ifndef LANG_AMHARIC
++# define LANG_AMHARIC 0x5e
++# endif
++# ifndef LANG_ARABIC
++# define LANG_ARABIC 0x01
++# endif
++# ifndef LANG_ARMENIAN
++# define LANG_ARMENIAN 0x2b
++# endif
++# ifndef LANG_ASSAMESE
++# define LANG_ASSAMESE 0x4d
++# endif
++# ifndef LANG_AZERI
++# define LANG_AZERI 0x2c
++# endif
++# ifndef LANG_BASQUE
++# define LANG_BASQUE 0x2d
++# endif
++# ifndef LANG_BELARUSIAN
++# define LANG_BELARUSIAN 0x23
++# endif
++# ifndef LANG_BENGALI
++# define LANG_BENGALI 0x45
++# endif
++# ifndef LANG_BURMESE
++# define LANG_BURMESE 0x55
++# endif
++# ifndef LANG_CAMBODIAN
++# define LANG_CAMBODIAN 0x53
++# endif
++# ifndef LANG_CATALAN
++# define LANG_CATALAN 0x03
++# endif
++# ifndef LANG_CHEROKEE
++# define LANG_CHEROKEE 0x5c
++# endif
++# ifndef LANG_DIVEHI
++# define LANG_DIVEHI 0x65
++# endif
++# ifndef LANG_EDO
++# define LANG_EDO 0x66
++# endif
++# ifndef LANG_ESTONIAN
++# define LANG_ESTONIAN 0x25
++# endif
++# ifndef LANG_FAEROESE
++# define LANG_FAEROESE 0x38
++# endif
++# ifndef LANG_FARSI
++# define LANG_FARSI 0x29
++# endif
++# ifndef LANG_FRISIAN
++# define LANG_FRISIAN 0x62
++# endif
++# ifndef LANG_FULFULDE
++# define LANG_FULFULDE 0x67
++# endif
++# ifndef LANG_GAELIC
++# define LANG_GAELIC 0x3c
++# endif
++# ifndef LANG_GALICIAN
++# define LANG_GALICIAN 0x56
++# endif
++# ifndef LANG_GEORGIAN
++# define LANG_GEORGIAN 0x37
++# endif
++# ifndef LANG_GUARANI
++# define LANG_GUARANI 0x74
++# endif
++# ifndef LANG_GUJARATI
++# define LANG_GUJARATI 0x47
++# endif
++# ifndef LANG_HAUSA
++# define LANG_HAUSA 0x68
++# endif
++# ifndef LANG_HAWAIIAN
++# define LANG_HAWAIIAN 0x75
++# endif
++# ifndef LANG_HEBREW
++# define LANG_HEBREW 0x0d
++# endif
++# ifndef LANG_HINDI
++# define LANG_HINDI 0x39
++# endif
++# ifndef LANG_IBIBIO
++# define LANG_IBIBIO 0x69
++# endif
++# ifndef LANG_IGBO
++# define LANG_IGBO 0x70
++# endif
++# ifndef LANG_INDONESIAN
++# define LANG_INDONESIAN 0x21
++# endif
++# ifndef LANG_INUKTITUT
++# define LANG_INUKTITUT 0x5d
++# endif
++# ifndef LANG_KANNADA
++# define LANG_KANNADA 0x4b
++# endif
++# ifndef LANG_KANURI
++# define LANG_KANURI 0x71
++# endif
++# ifndef LANG_KASHMIRI
++# define LANG_KASHMIRI 0x60
++# endif
++# ifndef LANG_KAZAK
++# define LANG_KAZAK 0x3f
++# endif
++# ifndef LANG_KONKANI
++# define LANG_KONKANI 0x57
++# endif
++# ifndef LANG_KYRGYZ
++# define LANG_KYRGYZ 0x40
++# endif
++# ifndef LANG_LAO
++# define LANG_LAO 0x54
++# endif
++# ifndef LANG_LATIN
++# define LANG_LATIN 0x76
++# endif
++# ifndef LANG_LATVIAN
++# define LANG_LATVIAN 0x26
++# endif
++# ifndef LANG_LITHUANIAN
++# define LANG_LITHUANIAN 0x27
++# endif
++# ifndef LANG_MACEDONIAN
++# define LANG_MACEDONIAN 0x2f
++# endif
++# ifndef LANG_MALAY
++# define LANG_MALAY 0x3e
++# endif
++# ifndef LANG_MALAYALAM
++# define LANG_MALAYALAM 0x4c
++# endif
++# ifndef LANG_MALTESE
++# define LANG_MALTESE 0x3a
++# endif
++# ifndef LANG_MANIPURI
++# define LANG_MANIPURI 0x58
++# endif
++# ifndef LANG_MARATHI
++# define LANG_MARATHI 0x4e
++# endif
++# ifndef LANG_MONGOLIAN
++# define LANG_MONGOLIAN 0x50
++# endif
++# ifndef LANG_NEPALI
++# define LANG_NEPALI 0x61
++# endif
++# ifndef LANG_ORIYA
++# define LANG_ORIYA 0x48
++# endif
++# ifndef LANG_OROMO
++# define LANG_OROMO 0x72
++# endif
++# ifndef LANG_PAPIAMENTU
++# define LANG_PAPIAMENTU 0x79
++# endif
++# ifndef LANG_PASHTO
++# define LANG_PASHTO 0x63
++# endif
++# ifndef LANG_PUNJABI
++# define LANG_PUNJABI 0x46
++# endif
++# ifndef LANG_RHAETO_ROMANCE
++# define LANG_RHAETO_ROMANCE 0x17
++# endif
++# ifndef LANG_SAAMI
++# define LANG_SAAMI 0x3b
++# endif
++# ifndef LANG_SANSKRIT
++# define LANG_SANSKRIT 0x4f
++# endif
++# ifndef LANG_SERBIAN
++# define LANG_SERBIAN 0x1a
++# endif
++# ifndef LANG_SINDHI
++# define LANG_SINDHI 0x59
++# endif
++# ifndef LANG_SINHALESE
++# define LANG_SINHALESE 0x5b
++# endif
++# ifndef LANG_SLOVAK
++# define LANG_SLOVAK 0x1b
++# endif
++# ifndef LANG_SOMALI
++# define LANG_SOMALI 0x77
++# endif
++# ifndef LANG_SORBIAN
++# define LANG_SORBIAN 0x2e
++# endif
++# ifndef LANG_SUTU
++# define LANG_SUTU 0x30
++# endif
++# ifndef LANG_SWAHILI
++# define LANG_SWAHILI 0x41
++# endif
++# ifndef LANG_SYRIAC
++# define LANG_SYRIAC 0x5a
++# endif
++# ifndef LANG_TAGALOG
++# define LANG_TAGALOG 0x64
++# endif
++# ifndef LANG_TAJIK
++# define LANG_TAJIK 0x28
++# endif
++# ifndef LANG_TAMAZIGHT
++# define LANG_TAMAZIGHT 0x5f
++# endif
++# ifndef LANG_TAMIL
++# define LANG_TAMIL 0x49
++# endif
++# ifndef LANG_TATAR
++# define LANG_TATAR 0x44
++# endif
++# ifndef LANG_TELUGU
++# define LANG_TELUGU 0x4a
++# endif
++# ifndef LANG_THAI
++# define LANG_THAI 0x1e
++# endif
++# ifndef LANG_TIBETAN
++# define LANG_TIBETAN 0x51
++# endif
++# ifndef LANG_TIGRINYA
++# define LANG_TIGRINYA 0x73
++# endif
++# ifndef LANG_TSONGA
++# define LANG_TSONGA 0x31
++# endif
++# ifndef LANG_TSWANA
++# define LANG_TSWANA 0x32
++# endif
++# ifndef LANG_TURKMEN
++# define LANG_TURKMEN 0x42
++# endif
++# ifndef LANG_UKRAINIAN
++# define LANG_UKRAINIAN 0x22
++# endif
++# ifndef LANG_URDU
++# define LANG_URDU 0x20
++# endif
++# ifndef LANG_UZBEK
++# define LANG_UZBEK 0x43
++# endif
++# ifndef LANG_VENDA
++# define LANG_VENDA 0x33
++# endif
++# ifndef LANG_VIETNAMESE
++# define LANG_VIETNAMESE 0x2a
++# endif
++# ifndef LANG_WELSH
++# define LANG_WELSH 0x52
++# endif
++# ifndef LANG_XHOSA
++# define LANG_XHOSA 0x34
++# endif
++# ifndef LANG_YI
++# define LANG_YI 0x78
++# endif
++# ifndef LANG_YIDDISH
++# define LANG_YIDDISH 0x3d
++# endif
++# ifndef LANG_YORUBA
++# define LANG_YORUBA 0x6a
++# endif
++# ifndef LANG_ZULU
++# define LANG_ZULU 0x35
++# endif
++# ifndef SUBLANG_ARABIC_SAUDI_ARABIA
++# define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
++# endif
++# ifndef SUBLANG_ARABIC_IRAQ
++# define SUBLANG_ARABIC_IRAQ 0x02
++# endif
++# ifndef SUBLANG_ARABIC_EGYPT
++# define SUBLANG_ARABIC_EGYPT 0x03
++# endif
++# ifndef SUBLANG_ARABIC_LIBYA
++# define SUBLANG_ARABIC_LIBYA 0x04
++# endif
++# ifndef SUBLANG_ARABIC_ALGERIA
++# define SUBLANG_ARABIC_ALGERIA 0x05
++# endif
++# ifndef SUBLANG_ARABIC_MOROCCO
++# define SUBLANG_ARABIC_MOROCCO 0x06
++# endif
++# ifndef SUBLANG_ARABIC_TUNISIA
++# define SUBLANG_ARABIC_TUNISIA 0x07
++# endif
++# ifndef SUBLANG_ARABIC_OMAN
++# define SUBLANG_ARABIC_OMAN 0x08
++# endif
++# ifndef SUBLANG_ARABIC_YEMEN
++# define SUBLANG_ARABIC_YEMEN 0x09
++# endif
++# ifndef SUBLANG_ARABIC_SYRIA
++# define SUBLANG_ARABIC_SYRIA 0x0a
++# endif
++# ifndef SUBLANG_ARABIC_JORDAN
++# define SUBLANG_ARABIC_JORDAN 0x0b
++# endif
++# ifndef SUBLANG_ARABIC_LEBANON
++# define SUBLANG_ARABIC_LEBANON 0x0c
++# endif
++# ifndef SUBLANG_ARABIC_KUWAIT
++# define SUBLANG_ARABIC_KUWAIT 0x0d
++# endif
++# ifndef SUBLANG_ARABIC_UAE
++# define SUBLANG_ARABIC_UAE 0x0e
++# endif
++# ifndef SUBLANG_ARABIC_BAHRAIN
++# define SUBLANG_ARABIC_BAHRAIN 0x0f
++# endif
++# ifndef SUBLANG_ARABIC_QATAR
++# define SUBLANG_ARABIC_QATAR 0x10
++# endif
++# ifndef SUBLANG_AZERI_LATIN
++# define SUBLANG_AZERI_LATIN 0x01
++# endif
++# ifndef SUBLANG_AZERI_CYRILLIC
++# define SUBLANG_AZERI_CYRILLIC 0x02
++# endif
++# ifndef SUBLANG_BENGALI_INDIA
++# define SUBLANG_BENGALI_INDIA 0x00
++# endif
++# ifndef SUBLANG_BENGALI_BANGLADESH
++# define SUBLANG_BENGALI_BANGLADESH 0x01
++# endif
++# ifndef SUBLANG_CHINESE_MACAU
++# define SUBLANG_CHINESE_MACAU 0x05
++# endif
++# ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
++# define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
++# endif
++# ifndef SUBLANG_ENGLISH_JAMAICA
++# define SUBLANG_ENGLISH_JAMAICA 0x08
++# endif
++# ifndef SUBLANG_ENGLISH_CARIBBEAN
++# define SUBLANG_ENGLISH_CARIBBEAN 0x09
++# endif
++# ifndef SUBLANG_ENGLISH_BELIZE
++# define SUBLANG_ENGLISH_BELIZE 0x0a
++# endif
++# ifndef SUBLANG_ENGLISH_TRINIDAD
++# define SUBLANG_ENGLISH_TRINIDAD 0x0b
++# endif
++# ifndef SUBLANG_ENGLISH_ZIMBABWE
++# define SUBLANG_ENGLISH_ZIMBABWE 0x0c
++# endif
++# ifndef SUBLANG_ENGLISH_PHILIPPINES
++# define SUBLANG_ENGLISH_PHILIPPINES 0x0d
++# endif
++# ifndef SUBLANG_ENGLISH_INDONESIA
++# define SUBLANG_ENGLISH_INDONESIA 0x0e
++# endif
++# ifndef SUBLANG_ENGLISH_HONGKONG
++# define SUBLANG_ENGLISH_HONGKONG 0x0f
++# endif
++# ifndef SUBLANG_ENGLISH_INDIA
++# define SUBLANG_ENGLISH_INDIA 0x10
++# endif
++# ifndef SUBLANG_ENGLISH_MALAYSIA
++# define SUBLANG_ENGLISH_MALAYSIA 0x11
++# endif
++# ifndef SUBLANG_ENGLISH_SINGAPORE
++# define SUBLANG_ENGLISH_SINGAPORE 0x12
++# endif
++# ifndef SUBLANG_FRENCH_LUXEMBOURG
++# define SUBLANG_FRENCH_LUXEMBOURG 0x05
++# endif
++# ifndef SUBLANG_FRENCH_MONACO
++# define SUBLANG_FRENCH_MONACO 0x06
++# endif
++# ifndef SUBLANG_FRENCH_WESTINDIES
++# define SUBLANG_FRENCH_WESTINDIES 0x07
++# endif
++# ifndef SUBLANG_FRENCH_REUNION
++# define SUBLANG_FRENCH_REUNION 0x08
++# endif
++# ifndef SUBLANG_FRENCH_CONGO
++# define SUBLANG_FRENCH_CONGO 0x09
++# endif
++# ifndef SUBLANG_FRENCH_SENEGAL
++# define SUBLANG_FRENCH_SENEGAL 0x0a
++# endif
++# ifndef SUBLANG_FRENCH_CAMEROON
++# define SUBLANG_FRENCH_CAMEROON 0x0b
++# endif
++# ifndef SUBLANG_FRENCH_COTEDIVOIRE
++# define SUBLANG_FRENCH_COTEDIVOIRE 0x0c
++# endif
++# ifndef SUBLANG_FRENCH_MALI
++# define SUBLANG_FRENCH_MALI 0x0d
++# endif
++# ifndef SUBLANG_FRENCH_MOROCCO
++# define SUBLANG_FRENCH_MOROCCO 0x0e
++# endif
++# ifndef SUBLANG_FRENCH_HAITI
++# define SUBLANG_FRENCH_HAITI 0x0f
++# endif
++# ifndef SUBLANG_GERMAN_LUXEMBOURG
++# define SUBLANG_GERMAN_LUXEMBOURG 0x04
++# endif
++# ifndef SUBLANG_GERMAN_LIECHTENSTEIN
++# define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
++# endif
++# ifndef SUBLANG_KASHMIRI_INDIA
++# define SUBLANG_KASHMIRI_INDIA 0x02
++# endif
++# ifndef SUBLANG_MALAY_MALAYSIA
++# define SUBLANG_MALAY_MALAYSIA 0x01
++# endif
++# ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
++# define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
++# endif
++# ifndef SUBLANG_NEPALI_INDIA
++# define SUBLANG_NEPALI_INDIA 0x02
++# endif
++# ifndef SUBLANG_PUNJABI_INDIA
++# define SUBLANG_PUNJABI_INDIA 0x00
++# endif
++# ifndef SUBLANG_PUNJABI_PAKISTAN
++# define SUBLANG_PUNJABI_PAKISTAN 0x01
++# endif
++# ifndef SUBLANG_ROMANIAN_ROMANIA
++# define SUBLANG_ROMANIAN_ROMANIA 0x00
++# endif
++# ifndef SUBLANG_ROMANIAN_MOLDOVA
++# define SUBLANG_ROMANIAN_MOLDOVA 0x01
++# endif
++# ifndef SUBLANG_SERBIAN_LATIN
++# define SUBLANG_SERBIAN_LATIN 0x02
++# endif
++# ifndef SUBLANG_SERBIAN_CYRILLIC
++# define SUBLANG_SERBIAN_CYRILLIC 0x03
++# endif
++# ifndef SUBLANG_SINDHI_INDIA
++# define SUBLANG_SINDHI_INDIA 0x00
++# endif
++# ifndef SUBLANG_SINDHI_PAKISTAN
++# define SUBLANG_SINDHI_PAKISTAN 0x01
++# endif
++# ifndef SUBLANG_SPANISH_GUATEMALA
++# define SUBLANG_SPANISH_GUATEMALA 0x04
++# endif
++# ifndef SUBLANG_SPANISH_COSTA_RICA
++# define SUBLANG_SPANISH_COSTA_RICA 0x05
++# endif
++# ifndef SUBLANG_SPANISH_PANAMA
++# define SUBLANG_SPANISH_PANAMA 0x06
++# endif
++# ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
++# define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
++# endif
++# ifndef SUBLANG_SPANISH_VENEZUELA
++# define SUBLANG_SPANISH_VENEZUELA 0x08
++# endif
++# ifndef SUBLANG_SPANISH_COLOMBIA
++# define SUBLANG_SPANISH_COLOMBIA 0x09
++# endif
++# ifndef SUBLANG_SPANISH_PERU
++# define SUBLANG_SPANISH_PERU 0x0a
++# endif
++# ifndef SUBLANG_SPANISH_ARGENTINA
++# define SUBLANG_SPANISH_ARGENTINA 0x0b
++# endif
++# ifndef SUBLANG_SPANISH_ECUADOR
++# define SUBLANG_SPANISH_ECUADOR 0x0c
++# endif
++# ifndef SUBLANG_SPANISH_CHILE
++# define SUBLANG_SPANISH_CHILE 0x0d
++# endif
++# ifndef SUBLANG_SPANISH_URUGUAY
++# define SUBLANG_SPANISH_URUGUAY 0x0e
++# endif
++# ifndef SUBLANG_SPANISH_PARAGUAY
++# define SUBLANG_SPANISH_PARAGUAY 0x0f
++# endif
++# ifndef SUBLANG_SPANISH_BOLIVIA
++# define SUBLANG_SPANISH_BOLIVIA 0x10
++# endif
++# ifndef SUBLANG_SPANISH_EL_SALVADOR
++# define SUBLANG_SPANISH_EL_SALVADOR 0x11
++# endif
++# ifndef SUBLANG_SPANISH_HONDURAS
++# define SUBLANG_SPANISH_HONDURAS 0x12
++# endif
++# ifndef SUBLANG_SPANISH_NICARAGUA
++# define SUBLANG_SPANISH_NICARAGUA 0x13
++# endif
++# ifndef SUBLANG_SPANISH_PUERTO_RICO
++# define SUBLANG_SPANISH_PUERTO_RICO 0x14
++# endif
++# ifndef SUBLANG_SWEDISH_FINLAND
++# define SUBLANG_SWEDISH_FINLAND 0x02
++# endif
++# ifndef SUBLANG_TAMAZIGHT_ARABIC
++# define SUBLANG_TAMAZIGHT_ARABIC 0x01
++# endif
++# ifndef SUBLANG_TAMAZIGHT_LATIN
++# define SUBLANG_TAMAZIGHT_LATIN 0x02
++# endif
++# ifndef SUBLANG_TIGRINYA_ETHIOPIA
++# define SUBLANG_TIGRINYA_ETHIOPIA 0x00
++# endif
++# ifndef SUBLANG_TIGRINYA_ERITREA
++# define SUBLANG_TIGRINYA_ERITREA 0x01
++# endif
++# ifndef SUBLANG_URDU_PAKISTAN
++# define SUBLANG_URDU_PAKISTAN 0x01
++# endif
++# ifndef SUBLANG_URDU_INDIA
++# define SUBLANG_URDU_INDIA 0x02
++# endif
++# ifndef SUBLANG_UZBEK_LATIN
++# define SUBLANG_UZBEK_LATIN 0x01
++# endif
++# ifndef SUBLANG_UZBEK_CYRILLIC
++# define SUBLANG_UZBEK_CYRILLIC 0x02
++# endif
++#endif
++
++/* XPG3 defines the result of 'setlocale (category, NULL)' as:
++ "Directs 'setlocale()' to query 'category' and return the current
++ setting of 'local'."
++ However it does not specify the exact format. Neither do SUSV2 and
++ ISO C 99. So we can use this feature only on selected systems (e.g.
++ those using GNU C Library). */
++#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
++# define HAVE_LOCALE_NULL
++#endif
++
++/* Determine the current locale's name, and canonicalize it into XPG syntax
++ language[_territory[.codeset]][@modifier]
++ The codeset part in the result is not reliable; the locale_charset()
++ should be used for codeset information instead.
++ The result must not be freed; it is statically allocated. */
++
++const char *
++_nl_locale_name (int category, const char *categoryname)
++{
++ const char *retval;
++
++#ifndef WIN32
++
++ /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
++ On some systems this can be done by the 'setlocale' function itself. */
++# if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
++ retval = setlocale (category, NULL);
++# else
++ /* Setting of LC_ALL overwrites all other. */
++ retval = getenv ("LC_ALL");
++ if (retval == NULL || retval[0] == '\0')
++ {
++ /* Next comes the name of the desired category. */
++ retval = getenv (categoryname);
++ if (retval == NULL || retval[0] == '\0')
++ {
++ /* Last possibility is the LANG environment variable. */
++ retval = getenv ("LANG");
++ if (retval == NULL || retval[0] == '\0')
++ /* We use C as the default domain. POSIX says this is
++ implementation defined. */
++ retval = "C";
++ }
++ }
++# endif
++
++ return retval;
++
++#else /* WIN32 */
++
++ /* Return an XPG style locale name language[_territory][@modifier].
++ Don't even bother determining the codeset; it's not useful in this
++ context, because message catalogs are not specific to a single
++ codeset. */
++
++ LCID lcid;
++ LANGID langid;
++ int primary, sub;
++
++ /* Let the user override the system settings through environment
++ variables, as on POSIX systems. */
++ retval = getenv ("LC_ALL");
++ if (retval != NULL && retval[0] != '\0')
++ return retval;
++ retval = getenv (categoryname);
++ if (retval != NULL && retval[0] != '\0')
++ return retval;
++ retval = getenv ("LANG");
++ if (retval != NULL && retval[0] != '\0')
++ return retval;
++
++ /* Use native Win32 API locale ID. */
++ lcid = GetThreadLocale ();
++
++ /* Strip off the sorting rules, keep only the language part. */
++ langid = LANGIDFROMLCID (lcid);
++
++ /* Split into language and territory part. */
++ primary = PRIMARYLANGID (langid);
++ sub = SUBLANGID (langid);
++
++ /* Dispatch on language.
++ See also http://www.unicode.org/unicode/onlinedat/languages.html .
++ For details about languages, see http://www.ethnologue.com/ . */
++ switch (primary)
++ {
++ case LANG_AFRIKAANS: return "af_ZA";
++ case LANG_ALBANIAN: return "sq_AL";
++ case LANG_AMHARIC: return "am_ET";
++ case LANG_ARABIC:
++ switch (sub)
++ {
++ case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
++ case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
++ case SUBLANG_ARABIC_EGYPT: return "ar_EG";
++ case SUBLANG_ARABIC_LIBYA: return "ar_LY";
++ case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
++ case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
++ case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
++ case SUBLANG_ARABIC_OMAN: return "ar_OM";
++ case SUBLANG_ARABIC_YEMEN: return "ar_YE";
++ case SUBLANG_ARABIC_SYRIA: return "ar_SY";
++ case SUBLANG_ARABIC_JORDAN: return "ar_JO";
++ case SUBLANG_ARABIC_LEBANON: return "ar_LB";
++ case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
++ case SUBLANG_ARABIC_UAE: return "ar_AE";
++ case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
++ case SUBLANG_ARABIC_QATAR: return "ar_QA";
++ }
++ return "ar";
++ case LANG_ARMENIAN: return "hy_AM";
++ case LANG_ASSAMESE: return "as_IN";
++ case LANG_AZERI:
++ switch (sub)
++ {
++ /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
++ case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
++ case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
++ }
++ return "az";
++ case LANG_BASQUE:
++ return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */
++ case LANG_BELARUSIAN: return "be_BY";
++ case LANG_BENGALI:
++ switch (sub)
++ {
++ case SUBLANG_BENGALI_INDIA: return "bn_IN";
++ case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
++ }
++ return "bn";
++ case LANG_BULGARIAN: return "bg_BG";
++ case LANG_BURMESE: return "my_MM";
++ case LANG_CAMBODIAN: return "km_KH";
++ case LANG_CATALAN: return "ca_ES";
++ case LANG_CHEROKEE: return "chr_US";
++ case LANG_CHINESE:
++ switch (sub)
++ {
++ case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
++ case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
++ case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
++ case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
++ case SUBLANG_CHINESE_MACAU: return "zh_MO";
++ }
++ return "zh";
++ case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN
++ * What used to be called Serbo-Croatian
++ * should really now be two separate
++ * languages because of political reasons.
++ * (Says tml, who knows nothing about Serbian
++ * or Croatian.)
++ * (I can feel those flames coming already.)
++ */
++ switch (sub)
++ {
++ case SUBLANG_DEFAULT: return "hr_HR";
++ case SUBLANG_SERBIAN_LATIN: return "sr_CS";
++ case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic";
++ }
++ return "hr";
++ case LANG_CZECH: return "cs_CZ";
++ case LANG_DANISH: return "da_DK";
++ case LANG_DIVEHI: return "dv_MV";
++ case LANG_DUTCH:
++ switch (sub)
++ {
++ case SUBLANG_DUTCH: return "nl_NL";
++ case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
++ }
++ return "nl";
++ case LANG_EDO: return "bin_NG";
++ case LANG_ENGLISH:
++ switch (sub)
++ {
++ /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
++ * English was the language spoken in England.
++ * Oh well.
++ */
++ case SUBLANG_ENGLISH_US: return "en_US";
++ case SUBLANG_ENGLISH_UK: return "en_GB";
++ case SUBLANG_ENGLISH_AUS: return "en_AU";
++ case SUBLANG_ENGLISH_CAN: return "en_CA";
++ case SUBLANG_ENGLISH_NZ: return "en_NZ";
++ case SUBLANG_ENGLISH_EIRE: return "en_IE";
++ case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
++ case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
++ case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
++ case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
++ case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
++ case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
++ case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
++ case SUBLANG_ENGLISH_INDONESIA: return "en_ID";
++ case SUBLANG_ENGLISH_HONGKONG: return "en_HK";
++ case SUBLANG_ENGLISH_INDIA: return "en_IN";
++ case SUBLANG_ENGLISH_MALAYSIA: return "en_MY";
++ case SUBLANG_ENGLISH_SINGAPORE: return "en_SG";
++ }
++ return "en";
++ case LANG_ESTONIAN: return "et_EE";
++ case LANG_FAEROESE: return "fo_FO";
++ case LANG_FARSI: return "fa_IR";
++ case LANG_FINNISH: return "fi_FI";
++ case LANG_FRENCH:
++ switch (sub)
++ {
++ case SUBLANG_FRENCH: return "fr_FR";
++ case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
++ case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
++ case SUBLANG_FRENCH_SWISS: return "fr_CH";
++ case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
++ case SUBLANG_FRENCH_MONACO: return "fr_MC";
++ case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */
++ case SUBLANG_FRENCH_REUNION: return "fr_RE";
++ case SUBLANG_FRENCH_CONGO: return "fr_CG";
++ case SUBLANG_FRENCH_SENEGAL: return "fr_SN";
++ case SUBLANG_FRENCH_CAMEROON: return "fr_CM";
++ case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI";
++ case SUBLANG_FRENCH_MALI: return "fr_ML";
++ case SUBLANG_FRENCH_MOROCCO: return "fr_MA";
++ case SUBLANG_FRENCH_HAITI: return "fr_HT";
++ }
++ return "fr";
++ case LANG_FRISIAN: return "fy_NL";
++ case LANG_FULFULDE:
++ /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */
++ return "ff_NG";
++ case LANG_GAELIC:
++ switch (sub)
++ {
++ case 0x01: /* SCOTTISH */ return "gd_GB";
++ case 0x02: /* IRISH */ return "ga_IE";
++ }
++ return "C";
++ case LANG_GALICIAN: return "gl_ES";
++ case LANG_GEORGIAN: return "ka_GE";
++ case LANG_GERMAN:
++ switch (sub)
++ {
++ case SUBLANG_GERMAN: return "de_DE";
++ case SUBLANG_GERMAN_SWISS: return "de_CH";
++ case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
++ case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
++ case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
++ }
++ return "de";
++ case LANG_GREEK: return "el_GR";
++ case LANG_GUARANI: return "gn_PY";
++ case LANG_GUJARATI: return "gu_IN";
++ case LANG_HAUSA: return "ha_NG";
++ case LANG_HAWAIIAN:
++ /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
++ or Hawaii Creole English ("cpe_US", 600000 speakers)? */
++ return "cpe_US";
++ case LANG_HEBREW: return "he_IL";
++ case LANG_HINDI: return "hi_IN";
++ case LANG_HUNGARIAN: return "hu_HU";
++ case LANG_IBIBIO: return "nic_NG";
++ case LANG_ICELANDIC: return "is_IS";
++ case LANG_IGBO: return "ig_NG";
++ case LANG_INDONESIAN: return "id_ID";
++ case LANG_INUKTITUT: return "iu_CA";
++ case LANG_ITALIAN:
++ switch (sub)
++ {
++ case SUBLANG_ITALIAN: return "it_IT";
++ case SUBLANG_ITALIAN_SWISS: return "it_CH";
++ }
++ return "it";
++ case LANG_JAPANESE: return "ja_JP";
++ case LANG_KANNADA: return "kn_IN";
++ case LANG_KANURI: return "kr_NG";
++ case LANG_KASHMIRI:
++ switch (sub)
++ {
++ case SUBLANG_DEFAULT: return "ks_PK";
++ case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
++ }
++ return "ks";
++ case LANG_KAZAK: return "kk_KZ";
++ case LANG_KONKANI:
++ /* FIXME: Adjust this when such locales appear on Unix. */
++ return "kok_IN";
++ case LANG_KOREAN: return "ko_KR";
++ case LANG_KYRGYZ: return "ky_KG";
++ case LANG_LAO: return "lo_LA";
++ case LANG_LATIN: return "la_VA";
++ case LANG_LATVIAN: return "lv_LV";
++ case LANG_LITHUANIAN: return "lt_LT";
++ case LANG_MACEDONIAN: return "mk_MK";
++ case LANG_MALAY:
++ switch (sub)
++ {
++ case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
++ case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
++ }
++ return "ms";
++ case LANG_MALAYALAM: return "ml_IN";
++ case LANG_MALTESE: return "mt_MT";
++ case LANG_MANIPURI:
++ /* FIXME: Adjust this when such locales appear on Unix. */
++ return "mni_IN";
++ case LANG_MARATHI: return "mr_IN";
++ case LANG_MONGOLIAN:
++ return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */
++ case LANG_NEPALI:
++ switch (sub)
++ {
++ case SUBLANG_DEFAULT: return "ne_NP";
++ case SUBLANG_NEPALI_INDIA: return "ne_IN";
++ }
++ return "ne";
++ case LANG_NORWEGIAN:
++ switch (sub)
++ {
++ case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
++ case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
++ }
++ return "no";
++ case LANG_ORIYA: return "or_IN";
++ case LANG_OROMO: return "om_ET";
++ case LANG_PAPIAMENTU: return "pap_AN";
++ case LANG_PASHTO:
++ return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */
++ case LANG_POLISH: return "pl_PL";
++ case LANG_PORTUGUESE:
++ switch (sub)
++ {
++ case SUBLANG_PORTUGUESE: return "pt_PT";
++ /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
++ Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
++ case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
++ }
++ return "pt";
++ case LANG_PUNJABI:
++ switch (sub)
++ {
++ case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */
++ case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */
++ }
++ return "pa";
++ case LANG_RHAETO_ROMANCE: return "rm_CH";
++ case LANG_ROMANIAN:
++ switch (sub)
++ {
++ case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO";
++ case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD";
++ }
++ return "ro";
++ case LANG_RUSSIAN:
++ return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */
++ case LANG_SAAMI: /* actually Northern Sami */ return "se_NO";
++ case LANG_SANSKRIT: return "sa_IN";
++ case LANG_SINDHI:
++ switch (sub)
++ {
++ case SUBLANG_SINDHI_INDIA: return "sd_IN";
++ case SUBLANG_SINDHI_PAKISTAN: return "sd_PK";
++ }
++ return "sd";
++ case LANG_SINHALESE: return "si_LK";
++ case LANG_SLOVAK: return "sk_SK";
++ case LANG_SLOVENIAN: return "sl_SI";
++ case LANG_SOMALI: return "so_SO";
++ case LANG_SORBIAN:
++ /* FIXME: Adjust this when such locales appear on Unix. */
++ return "wen_DE";
++ case LANG_SPANISH:
++ switch (sub)
++ {
++ case SUBLANG_SPANISH: return "es_ES";
++ case SUBLANG_SPANISH_MEXICAN: return "es_MX";
++ case SUBLANG_SPANISH_MODERN:
++ return "es_ES@modern"; /* not seen on Unix */
++ case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
++ case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
++ case SUBLANG_SPANISH_PANAMA: return "es_PA";
++ case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
++ case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
++ case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
++ case SUBLANG_SPANISH_PERU: return "es_PE";
++ case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
++ case SUBLANG_SPANISH_ECUADOR: return "es_EC";
++ case SUBLANG_SPANISH_CHILE: return "es_CL";
++ case SUBLANG_SPANISH_URUGUAY: return "es_UY";
++ case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
++ case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
++ case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
++ case SUBLANG_SPANISH_HONDURAS: return "es_HN";
++ case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
++ case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
++ }
++ return "es";
++ case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */
++ case LANG_SWAHILI: return "sw_KE";
++ case LANG_SWEDISH:
++ switch (sub)
++ {
++ case SUBLANG_DEFAULT: return "sv_SE";
++ case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
++ }
++ return "sv";
++ case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */
++ case LANG_TAGALOG: return "tl_PH";
++ case LANG_TAJIK: return "tg_TJ";
++ case LANG_TAMAZIGHT:
++ switch (sub)
++ {
++ /* FIXME: Adjust this when Tamazight locales appear on Unix. */
++ case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic";
++ case SUBLANG_TAMAZIGHT_LATIN: return "ber_MA@latin";
++ }
++ return "ber_MA";
++ case LANG_TAMIL:
++ return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */
++ case LANG_TATAR: return "tt_RU";
++ case LANG_TELUGU: return "te_IN";
++ case LANG_THAI: return "th_TH";
++ case LANG_TIBETAN: return "bo_CN";
++ case LANG_TIGRINYA:
++ switch (sub)
++ {
++ case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET";
++ case SUBLANG_TIGRINYA_ERITREA: return "ti_ER";
++ }
++ return "ti";
++ case LANG_TSONGA: return "ts_ZA";
++ case LANG_TSWANA: return "tn_BW";
++ case LANG_TURKISH: return "tr_TR";
++ case LANG_TURKMEN: return "tk_TM";
++ case LANG_UKRAINIAN: return "uk_UA";
++ case LANG_URDU:
++ switch (sub)
++ {
++ case SUBLANG_URDU_PAKISTAN: return "ur_PK";
++ case SUBLANG_URDU_INDIA: return "ur_IN";
++ }
++ return "ur";
++ case LANG_UZBEK:
++ switch (sub)
++ {
++ case SUBLANG_UZBEK_LATIN: return "uz_UZ";
++ case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
++ }
++ return "uz";
++ case LANG_VENDA: return "ve_ZA";
++ case LANG_VIETNAMESE: return "vi_VN";
++ case LANG_WELSH: return "cy_GB";
++ case LANG_XHOSA: return "xh_ZA";
++ case LANG_YI: return "sit_CN";
++ case LANG_YIDDISH: return "yi_IL";
++ case LANG_YORUBA: return "yo_NG";
++ case LANG_ZULU: return "zu_ZA";
++ default: return "C";
++ }
++
++#endif
++}
+--- lrzsz-0.12.20.safe/intl/log.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/log.c 2004-09-12 14:40:34.515723768 -0400
+@@ -0,0 +1,98 @@
++/* Log file output.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Written by Bruno Haible <bruno@clisp.org>. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++/* Print an ASCII string with quotes and escape sequences where needed. */
++static void
++print_escaped (FILE *stream, const char *str)
++{
++ putc ('"', stream);
++ for (; *str != '\0'; str++)
++ if (*str == '\n')
++ {
++ fputs ("\\n\"", stream);
++ if (str[1] == '\0')
++ return;
++ fputs ("\n\"", stream);
++ }
++ else
++ {
++ if (*str == '"' || *str == '\\')
++ putc ('\\', stream);
++ putc (*str, stream);
++ }
++ putc ('"', stream);
++}
++
++/* Add to the log file an entry denoting a failed translation. */
++void
++_nl_log_untranslated (const char *logfilename, const char *domainname,
++ const char *msgid1, const char *msgid2, int plural)
++{
++ static char *last_logfilename = NULL;
++ static FILE *last_logfile = NULL;
++ FILE *logfile;
++
++ /* Can we reuse the last opened logfile? */
++ if (last_logfilename == NULL || strcmp (logfilename, last_logfilename) != 0)
++ {
++ /* Close the last used logfile. */
++ if (last_logfilename != NULL)
++ {
++ if (last_logfile != NULL)
++ {
++ fclose (last_logfile);
++ last_logfile = NULL;
++ }
++ free (last_logfilename);
++ last_logfilename = NULL;
++ }
++ /* Open the logfile. */
++ last_logfilename = (char *) malloc (strlen (logfilename) + 1);
++ if (last_logfilename == NULL)
++ return;
++ strcpy (last_logfilename, logfilename);
++ last_logfile = fopen (logfilename, "a");
++ if (last_logfile == NULL)
++ return;
++ }
++ logfile = last_logfile;
++
++ fprintf (logfile, "domain ");
++ print_escaped (logfile, domainname);
++ fprintf (logfile, "\nmsgid ");
++ print_escaped (logfile, msgid1);
++ if (plural)
++ {
++ fprintf (logfile, "\nmsgid_plural ");
++ print_escaped (logfile, msgid2);
++ fprintf (logfile, "\nmsgstr[0] \"\"\n");
++ }
++ else
++ fprintf (logfile, "\nmsgstr \"\"\n");
++ putc ('\n', logfile);
++}
+--- lrzsz-0.12.20.safe/intl/Makefile.in 1998-04-26 09:22:35.000000000 -0400
++++ lrzsz-0.12.20/intl/Makefile.in 2004-09-12 14:40:34.521722856 -0400
+@@ -1,19 +1,20 @@
+-# Makefile for directory with message catalog handling in GNU NLS Utilities.
+-# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
++# Makefile for directory with message catalog handling library of GNU gettext
++# Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
+ #
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2, or (at your option)
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Library General Public License as published
++# by the Free Software Foundation; either version 2, or (at your option)
+ # any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-# GNU General Public License for more details.
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# Library General Public License for more details.
+ #
+-# You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++# You should have received a copy of the GNU Library General Public
++# License along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
+
+ PACKAGE = @PACKAGE@
+ VERSION = @VERSION@
+@@ -23,118 +24,341 @@
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+ top_builddir = ..
+-VPATH = @srcdir@
++#VPATH = $(srcdir)
+
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+ transform = @program_transform_name@
+-libdir = $(exec_prefix)/lib
+-includedir = $(prefix)/include
+-datadir = $(prefix)/@DATADIRNAME@
++libdir = @libdir@
++includedir = @includedir@
++datadir = @datadir@
+ localedir = $(datadir)/locale
+-gnulocaledir = $(prefix)/share/locale
+-gettextsrcdir = @datadir@/gettext/intl
+-aliaspath = $(localedir):.
++gettextsrcdir = $(datadir)/gettext/intl
++aliaspath = $(localedir)
+ subdir = intl
+
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ MKINSTALLDIRS = @MKINSTALLDIRS@
++mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+
+-l = @l@
++l = @INTL_LIBTOOL_SUFFIX_PREFIX@
+
+ AR = ar
+ CC = @CC@
+ LIBTOOL = @LIBTOOL@
+ RANLIB = @RANLIB@
++YACC = @INTLBISON@ -y -d
++YFLAGS = --name-prefix=__gettext
+
+-DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
+--DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
++DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
++-DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \
++-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
++-Dset_relocation_prefix=libintl_set_relocation_prefix \
++-Drelocate=libintl_relocate \
++-DDEPENDS_ON_LIBICONV=1 @DEFS@
+ CPPFLAGS = @CPPFLAGS@
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
++LIBS = @LIBS@
+
+ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+-HEADERS = $(COMHDRS) libgettext.h loadinfo.h
+-COMHDRS = gettext.h gettextP.h hash-string.h
+-SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
+-COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
+-finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
+-explodename.c
+-OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
+-finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
+-explodename.$lo
+-CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
+-GETTOBJS = intl-compat.$lo
+-DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
+-xopen-msg.sed $(HEADERS) $(SOURCES)
++HEADERS = \
++ gmo.h \
++ gettextP.h \
++ hash-string.h \
++ loadinfo.h \
++ plural-exp.h \
++ eval-plural.h \
++ localcharset.h \
++ relocatable.h \
++ xsize.h \
++ printf-args.h printf-args.c \
++ printf-parse.h wprintf-parse.h printf-parse.c \
++ vasnprintf.h vasnwprintf.h vasnprintf.c \
++ os2compat.h \
++ libgnuintl.h.in
++SOURCES = \
++ bindtextdom.c \
++ dcgettext.c \
++ dgettext.c \
++ gettext.c \
++ finddomain.c \
++ loadmsgcat.c \
++ localealias.c \
++ textdomain.c \
++ l10nflist.c \
++ explodename.c \
++ dcigettext.c \
++ dcngettext.c \
++ dngettext.c \
++ ngettext.c \
++ plural.y \
++ plural-exp.c \
++ localcharset.c \
++ relocatable.c \
++ localename.c \
++ log.c \
++ printf.c \
++ osdep.c \
++ os2compat.c \
++ intl-compat.c
++OBJECTS = \
++ bindtextdom.$lo \
++ dcgettext.$lo \
++ dgettext.$lo \
++ gettext.$lo \
++ finddomain.$lo \
++ loadmsgcat.$lo \
++ localealias.$lo \
++ textdomain.$lo \
++ l10nflist.$lo \
++ explodename.$lo \
++ dcigettext.$lo \
++ dcngettext.$lo \
++ dngettext.$lo \
++ ngettext.$lo \
++ plural.$lo \
++ plural-exp.$lo \
++ localcharset.$lo \
++ relocatable.$lo \
++ localename.$lo \
++ log.$lo \
++ printf.$lo \
++ osdep.$lo \
++ intl-compat.$lo
++DISTFILES.common = Makefile.in \
++config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
++DISTFILES.generated = plural.c
+ DISTFILES.normal = VERSION
+-DISTFILES.gettext = libintl.glibc intlh.inst.in
++DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
++libgnuintl.h_vms Makefile.vms \
++libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc
++DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
++COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h
++
++all: all-@USE_INCLUDED_LIBINTL@
++all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
++all-no: all-no-@BUILD_INCLUDED_LIBINTL@
++all-no-yes: libgnuintl.$la
++all-no-no:
++
++libintl.a libgnuintl.a: $(OBJECTS)
++ rm -f $@
++ $(AR) cru $@ $(OBJECTS)
++ $(RANLIB) $@
++
++libintl.la libgnuintl.la: $(OBJECTS)
++ $(LIBTOOL) --mode=link \
++ $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
++ $(OBJECTS) @LTLIBICONV@ $(LIBS) -lc \
++ -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
++ -rpath $(libdir) \
++ -no-undefined
++
++# Libtool's library version information for libintl.
++# Before making a gettext release, the gettext maintainer must change this
++# according to the libtool documentation, section "Library interface versions".
++# Maintainers of other packages that include the intl directory must *not*
++# change these values.
++LTV_CURRENT=7
++LTV_REVISION=0
++LTV_AGE=4
+
+ .SUFFIXES:
+-.SUFFIXES: .c .o .lo
++.SUFFIXES: .c .y .o .lo .sin .sed
++
+ .c.o:
+ $(COMPILE) $<
+-.c.lo:
+- $(LIBTOOL) --mode=compile $(COMPILE) $<
+
+-INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
++.y.c:
++ $(YACC) $(YFLAGS) --output $@ $<
++ rm -f $*.h
+
+-all: all-@USE_INCLUDED_LIBINTL@
++bindtextdom.lo: $(srcdir)/bindtextdom.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
++dcgettext.lo: $(srcdir)/dcgettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcgettext.c
++dgettext.lo: $(srcdir)/dgettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dgettext.c
++gettext.lo: $(srcdir)/gettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
++finddomain.lo: $(srcdir)/finddomain.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
++loadmsgcat.lo: $(srcdir)/loadmsgcat.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
++localealias.lo: $(srcdir)/localealias.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localealias.c
++textdomain.lo: $(srcdir)/textdomain.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/textdomain.c
++l10nflist.lo: $(srcdir)/l10nflist.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/l10nflist.c
++explodename.lo: $(srcdir)/explodename.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/explodename.c
++dcigettext.lo: $(srcdir)/dcigettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcigettext.c
++dcngettext.lo: $(srcdir)/dcngettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcngettext.c
++dngettext.lo: $(srcdir)/dngettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dngettext.c
++ngettext.lo: $(srcdir)/ngettext.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/ngettext.c
++plural.lo: $(srcdir)/plural.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural.c
++plural-exp.lo: $(srcdir)/plural-exp.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
++localcharset.lo: $(srcdir)/localcharset.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
++relocatable.lo: $(srcdir)/relocatable.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
++localename.lo: $(srcdir)/localename.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c
++log.lo: $(srcdir)/log.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c
++printf.lo: $(srcdir)/printf.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c
++osdep.lo: $(srcdir)/osdep.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c
++intl-compat.lo: $(srcdir)/intl-compat.c
++ $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/intl-compat.c
+
+-all-yes: libintl.$la intlh.inst
+-all-no:
++ref-add.sed: $(srcdir)/ref-add.sin
++ sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed
++ mv t-ref-add.sed ref-add.sed
++ref-del.sed: $(srcdir)/ref-del.sin
++ sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed
++ mv t-ref-del.sed ref-del.sed
+
+-libintl.a: $(OBJECTS)
+- rm -f $@
+- $(AR) cru $@ $(OBJECTS)
+- $(RANLIB) $@
++INCLUDES = -I. -I$(srcdir) -I..
+
+-libintl.la: $(OBJECTS)
+- $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
+- -version-info 1:0 -rpath $(libdir)
++libgnuintl.h: $(srcdir)/libgnuintl.h.in
++ sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
++ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
++ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
++ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
++ < $(srcdir)/libgnuintl.h.in > libgnuintl.h
+
+-../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
+- cd ../po && $(MAKE) cat-id-tbl.$lo
++libintl.h: libgnuintl.h
++ cp libgnuintl.h libintl.h
+
+-check: all
++charset.alias: $(srcdir)/config.charset
++ $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
++ mv t-$@ $@
+
+-# This installation goal is only used in GNU gettext. Packages which
+-# only use the library should use install instead.
++check: all
+
+ # We must not install the libintl.h/libintl.a files if we are on a
+-# system which has the gettext() function in its C library or in a
+-# separate library or use the catgets interface. A special case is
+-# where configure found a previously installed GNU gettext library.
++# system which has the GNU gettext() function in its C library or in a
++# separate library.
+ # If you want to use the one which comes with this version of the
+ # package, you have to use `configure --with-included-gettext'.
+ install: install-exec install-data
+ install-exec: all
+- if test "$(PACKAGE)" = "gettext" \
+- && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
+- if test -r $(MKINSTALLDIRS); then \
+- $(MKINSTALLDIRS) $(libdir) $(includedir); \
+- else \
+- $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
++ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
++ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
++ $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
++ $(LIBTOOL) --mode=install \
++ $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
++ if test "@RELOCATABLE@" = yes; then \
++ dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \
++ if test -n "$$dependencies"; then \
++ rm -f $(DESTDIR)$(libdir)/libintl.la; \
++ fi; \
+ fi; \
+- $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
+- $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
+ else \
+ : ; \
+ fi
+-install-data: all
+- if test "$(PACKAGE)" = "gettext"; then \
+- if test -r $(MKINSTALLDIRS); then \
+- $(MKINSTALLDIRS) $(gettextsrcdir); \
++ if test "$(PACKAGE)" = "gettext-tools" \
++ && test '@USE_INCLUDED_LIBINTL@' = no; then \
++ $(mkinstalldirs) $(DESTDIR)$(libdir); \
++ $(LIBTOOL) --mode=install \
++ $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
++ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
++ $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \
++ $(LIBTOOL) --mode=uninstall \
++ rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \
++ else \
++ : ; \
++ fi
++ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
++ temp=$(DESTDIR)$(libdir)/t-charset.alias; \
++ dest=$(DESTDIR)$(libdir)/charset.alias; \
++ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
++ orig=$(DESTDIR)$(libdir)/charset.alias; \
++ sed -f ref-add.sed $$orig > $$temp; \
++ $(INSTALL_DATA) $$temp $$dest; \
++ rm -f $$temp; \
+ else \
+- $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
++ if test @GLIBC21@ = no; then \
++ orig=charset.alias; \
++ sed -f ref-add.sed $$orig > $$temp; \
++ $(INSTALL_DATA) $$temp $$dest; \
++ rm -f $$temp; \
++ fi; \
+ fi; \
+- $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
+- dists="$(DISTFILES.common)"; \
++ $(mkinstalldirs) $(DESTDIR)$(localedir); \
++ test -f $(DESTDIR)$(localedir)/locale.alias \
++ && orig=$(DESTDIR)$(localedir)/locale.alias \
++ || orig=$(srcdir)/locale.alias; \
++ temp=$(DESTDIR)$(localedir)/t-locale.alias; \
++ dest=$(DESTDIR)$(localedir)/locale.alias; \
++ sed -f ref-add.sed $$orig > $$temp; \
++ $(INSTALL_DATA) $$temp $$dest; \
++ rm -f $$temp; \
++ else \
++ : ; \
++ fi
++install-data: all
++ if test "$(PACKAGE)" = "gettext-tools"; then \
++ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
++ $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
++ $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
++ dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
+ for file in $$dists; do \
+- $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
++ $(INSTALL_DATA) $(srcdir)/$$file \
++ $(DESTDIR)$(gettextsrcdir)/$$file; \
+ done; \
++ chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
++ dists="$(DISTFILES.generated)"; \
++ for file in $$dists; do \
++ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
++ $(INSTALL_DATA) $$dir/$$file \
++ $(DESTDIR)$(gettextsrcdir)/$$file; \
++ done; \
++ dists="$(DISTFILES.obsolete)"; \
++ for file in $$dists; do \
++ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
++ done; \
++ else \
++ : ; \
++ fi
++
++install-strip: install
++
++installdirs:
++ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
++ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
++ else \
++ : ; \
++ fi
++ if test "$(PACKAGE)" = "gettext-tools" \
++ && test '@USE_INCLUDED_LIBINTL@' = no; then \
++ $(mkinstalldirs) $(DESTDIR)$(libdir); \
++ else \
++ : ; \
++ fi
++ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
++ $(mkinstalldirs) $(DESTDIR)$(localedir); \
++ else \
++ : ; \
++ fi
++ if test "$(PACKAGE)" = "gettext-tools"; then \
++ $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+ else \
+ : ; \
+ fi
+@@ -143,22 +367,76 @@
+ installcheck:
+
+ uninstall:
+- dists="$(DISTFILES.common)"; \
+- for file in $$dists; do \
+- rm -f $(gettextsrcdir)/$$file; \
+- done
++ if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
++ && test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ rm -f $(DESTDIR)$(includedir)/libintl.h; \
++ $(LIBTOOL) --mode=uninstall \
++ rm -f $(DESTDIR)$(libdir)/libintl.$la; \
++ else \
++ : ; \
++ fi
++ if test "$(PACKAGE)" = "gettext-tools" \
++ && test '@USE_INCLUDED_LIBINTL@' = no; then \
++ rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
++ else \
++ : ; \
++ fi
++ if test '@USE_INCLUDED_LIBINTL@' = yes; then \
++ if test -f $(DESTDIR)$(libdir)/charset.alias; then \
++ temp=$(DESTDIR)$(libdir)/t-charset.alias; \
++ dest=$(DESTDIR)$(libdir)/charset.alias; \
++ sed -f ref-del.sed $$dest > $$temp; \
++ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
++ rm -f $$dest; \
++ else \
++ $(INSTALL_DATA) $$temp $$dest; \
++ fi; \
++ rm -f $$temp; \
++ fi; \
++ if test -f $(DESTDIR)$(localedir)/locale.alias; then \
++ temp=$(DESTDIR)$(localedir)/t-locale.alias; \
++ dest=$(DESTDIR)$(localedir)/locale.alias; \
++ sed -f ref-del.sed $$dest > $$temp; \
++ if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
++ rm -f $$dest; \
++ else \
++ $(INSTALL_DATA) $$temp $$dest; \
++ fi; \
++ rm -f $$temp; \
++ fi; \
++ else \
++ : ; \
++ fi
++ if test "$(PACKAGE)" = "gettext-tools"; then \
++ for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
++ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
++ done; \
++ else \
++ : ; \
++ fi
+
+-info dvi:
++info dvi ps pdf html:
+
+-$(OBJECTS): ../config.h libgettext.h
+-bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
+-dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
++$(OBJECTS): ../config.h libgnuintl.h
++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
++dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
++explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
++dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
++dcigettext.$lo: $(srcdir)/eval-plural.h
++localcharset.$lo: $(srcdir)/localcharset.h
++localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
++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
+
+ tags: TAGS
+
+ TAGS: $(HEADERS) $(SOURCES)
+ here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
+
++ctags: CTAGS
++
++CTAGS: $(HEADERS) $(SOURCES)
++ here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
++
+ id: ID
+
+ ID: $(HEADERS) $(SOURCES)
+@@ -166,12 +444,19 @@
+
+
+ mostlyclean:
+- rm -f *.a *.o *.lo core core.*
++ rm -f *.a *.la *.o *.obj *.lo core core.*
++ rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
++ rm -f -r .libs _libs
+
+ clean: mostlyclean
+
+ distclean: clean
+- rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h
++ rm -f Makefile ID TAGS
++ if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \
++ rm -f ChangeLog.inst $(DISTFILES.normal); \
++ else \
++ : ; \
++ fi
+
+ maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+@@ -181,33 +466,27 @@
+ # GNU gettext needs not contain the file `VERSION' but contains some
+ # other files which should not be distributed in other packages.
+ distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+-dist distdir: Makefile $(DISTFILES)
+- if test "$(PACKAGE)" = gettext; then \
+- additional="$(DISTFILES.gettext)"; \
++dist distdir: Makefile
++ if test "$(PACKAGE)" = "gettext-tools"; then \
++ : ; \
+ else \
+- additional="$(DISTFILES.normal)"; \
+- fi; \
+- for file in $(DISTFILES.common) $$additional; do \
+- ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+- || cp -p $(srcdir)/$$file $(distdir); \
+- done
+-
+-dist-libc:
+- tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
+-
+-Makefile: Makefile.in ../config.status
+- cd .. \
+- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
++ if test "$(PACKAGE)" = "gettext-runtime"; then \
++ additional="$(DISTFILES.gettext)"; \
++ else \
++ additional="$(DISTFILES.normal)"; \
++ fi; \
++ $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
++ for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
++ if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
++ cp -p $$dir/$$file $(distdir); \
++ done; \
++ fi
+
+-# The dependency for intlh.inst is different in gettext and all other
+-# packages. Because we cannot you GNU make features we have to solve
+-# the problem while rewriting Makefile.in.
+-@GT_YES@intlh.inst: intlh.inst.in ../config.status
+-@GT_YES@ cd .. \
+-@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
+-@GT_YES@ $(SHELL) ./config.status
+-@GT_NO@.PHONY: intlh.inst
+-@GT_NO@intlh.inst:
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++ cd $(top_builddir) && $(SHELL) ./config.status
++# This would be more efficient, but doesn't work any more with autoconf-2.57,
++# when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
++# cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+ # Tell versions [3.59,3.63) of GNU make not to export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+--- lrzsz-0.12.20.safe/intl/ngettext.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/ngettext.c 2004-09-12 14:40:34.533721032 -0400
+@@ -0,0 +1,65 @@
++/* Implementation of ngettext(3) function.
++ Copyright (C) 1995, 1997, 2000-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#ifdef _LIBC
++# define __need_NULL
++# include <stddef.h>
++#else
++# include <stdlib.h> /* Just for NULL. */
++#endif
++
++#include "gettextP.h"
++#ifdef _LIBC
++# include <libintl.h>
++#else
++# include "libgnuintl.h"
++#endif
++
++#include <locale.h>
++
++/* @@ end of prolog @@ */
++
++/* Names for the libintl functions are a problem. They must not clash
++ with existing names and they should follow ANSI C. But this source
++ code is also used in GNU C Library where the names have a __
++ prefix. So we have to make a difference here. */
++#ifdef _LIBC
++# define NGETTEXT __ngettext
++# define DCNGETTEXT __dcngettext
++#else
++# define NGETTEXT libintl_ngettext
++# define DCNGETTEXT libintl_dcngettext
++#endif
++
++/* Look up MSGID in the current default message catalog for the current
++ LC_MESSAGES locale. If not found, returns MSGID itself (the default
++ text). */
++char *
++NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n)
++{
++ return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES);
++}
++
++#ifdef _LIBC
++/* Alias for function name in GNU C Library. */
++weak_alias (__ngettext, ngettext);
++#endif
+--- lrzsz-0.12.20.safe/intl/os2compat.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/os2compat.c 2004-09-12 14:40:34.539720120 -0400
+@@ -0,0 +1,98 @@
++/* OS/2 compatibility functions.
++ Copyright (C) 2001-2002 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#define OS2_AWARE
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <stdlib.h>
++#include <string.h>
++#include <sys/param.h>
++
++/* A version of getenv() that works from DLLs */
++extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue);
++
++char *
++_nl_getenv (const char *name)
++{
++ unsigned char *value;
++ if (DosScanEnv (name, &value))
++ return NULL;
++ else
++ return value;
++}
++
++/* A fixed size buffer. */
++char libintl_nl_default_dirname[MAXPATHLEN+1];
++
++char *_nlos2_libdir = NULL;
++char *_nlos2_localealiaspath = NULL;
++char *_nlos2_localedir = NULL;
++
++static __attribute__((constructor)) void
++nlos2_initialize ()
++{
++ char *root = getenv ("UNIXROOT");
++ char *gnulocaledir = getenv ("GNULOCALEDIR");
++
++ _nlos2_libdir = gnulocaledir;
++ if (!_nlos2_libdir)
++ {
++ if (root)
++ {
++ size_t sl = strlen (root);
++ _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1);
++ memcpy (_nlos2_libdir, root, sl);
++ memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1);
++ }
++ else
++ _nlos2_libdir = LIBDIR;
++ }
++
++ _nlos2_localealiaspath = gnulocaledir;
++ if (!_nlos2_localealiaspath)
++ {
++ if (root)
++ {
++ size_t sl = strlen (root);
++ _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1);
++ memcpy (_nlos2_localealiaspath, root, sl);
++ memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1);
++ }
++ else
++ _nlos2_localealiaspath = LOCALE_ALIAS_PATH;
++ }
++
++ _nlos2_localedir = gnulocaledir;
++ if (!_nlos2_localedir)
++ {
++ if (root)
++ {
++ size_t sl = strlen (root);
++ _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1);
++ memcpy (_nlos2_localedir, root, sl);
++ memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1);
++ }
++ else
++ _nlos2_localedir = LOCALEDIR;
++ }
++
++ if (strlen (_nlos2_localedir) <= MAXPATHLEN)
++ strcpy (libintl_nl_default_dirname, _nlos2_localedir);
++}
+--- lrzsz-0.12.20.safe/intl/os2compat.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/os2compat.h 2004-09-12 14:40:34.544719360 -0400
+@@ -0,0 +1,46 @@
++/* OS/2 compatibility defines.
++ This file is intended to be included from config.h
++ Copyright (C) 2001-2002 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* When included from os2compat.h we need all the original definitions */
++#ifndef OS2_AWARE
++
++#undef LIBDIR
++#define LIBDIR _nlos2_libdir
++extern char *_nlos2_libdir;
++
++#undef LOCALEDIR
++#define LOCALEDIR _nlos2_localedir
++extern char *_nlos2_localedir;
++
++#undef LOCALE_ALIAS_PATH
++#define LOCALE_ALIAS_PATH _nlos2_localealiaspath
++extern char *_nlos2_localealiaspath;
++
++#endif
++
++#undef HAVE_STRCASECMP
++#define HAVE_STRCASECMP 1
++#define strcasecmp stricmp
++#define strncasecmp strnicmp
++
++/* We have our own getenv() which works even if library is compiled as DLL */
++#define getenv _nl_getenv
++
++/* Older versions of gettext used -1 as the value of LC_MESSAGES */
++#define LC_MESSAGES_COMPAT (-1)
+--- lrzsz-0.12.20.safe/intl/osdep.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/osdep.c 2004-09-12 14:40:34.550718448 -0400
+@@ -0,0 +1,24 @@
++/* OS dependent parts of libintl.
++ Copyright (C) 2001-2002 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#if defined __EMX__
++# include "os2compat.c"
++#else
++/* Avoid AIX compiler warning. */
++typedef int dummy;
++#endif
+--- lrzsz-0.12.20.safe/intl/plural.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/plural.c 2004-09-12 14:40:36.571411256 -0400
+@@ -0,0 +1,1490 @@
++/* A Bison parser, made from plural.y
++ by GNU bison 1.35. */
++
++#define YYBISON 1 /* Identify Bison output. */
++
++#define yyparse __gettextparse
++#define yylex __gettextlex
++#define yyerror __gettexterror
++#define yylval __gettextlval
++#define yychar __gettextchar
++#define yydebug __gettextdebug
++#define yynerrs __gettextnerrs
++# define EQUOP2 257
++# define CMPOP2 258
++# define ADDOP2 259
++# define MULOP2 260
++# define NUMBER 261
++
++#line 1 "plural.y"
++
++/* Expression parsing for plural form selection.
++ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* The bison generated parser uses alloca. AIX 3 forces us to put this
++ declaration at the beginning of the file. The declaration in bison's
++ skeleton file comes too late. This must come before <config.h>
++ because <config.h> may include arbitrary system headers. */
++#if defined _AIX && !defined __GNUC__
++ #pragma alloca
++#endif
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <stddef.h>
++#include <stdlib.h>
++#include "plural-exp.h"
++
++/* The main function generated by the parser is called __gettextparse,
++ but we want it to be called PLURAL_PARSE. */
++#ifndef _LIBC
++# define __gettextparse PLURAL_PARSE
++#endif
++
++#define YYLEX_PARAM &((struct parse_args *) arg)->cp
++#define YYPARSE_PARAM arg
++
++#line 49 "plural.y"
++#ifndef YYSTYPE
++typedef union {
++ unsigned long int num;
++ enum operator op;
++ struct expression *exp;
++} yystype;
++# define YYSTYPE yystype
++# define YYSTYPE_IS_TRIVIAL 1
++#endif
++#line 55 "plural.y"
++
++/* Prototypes for local functions. */
++static int yylex (YYSTYPE *lval, const char **pexp);
++static void yyerror (const char *str);
++
++/* Allocation of expressions. */
++
++static struct expression *
++new_exp (int nargs, enum operator op, struct expression * const *args)
++{
++ int i;
++ struct expression *newp;
++
++ /* If any of the argument could not be malloc'ed, just return NULL. */
++ for (i = nargs - 1; i >= 0; i--)
++ if (args[i] == NULL)
++ goto fail;
++
++ /* Allocate a new expression. */
++ newp = (struct expression *) malloc (sizeof (*newp));
++ if (newp != NULL)
++ {
++ newp->nargs = nargs;
++ newp->operation = op;
++ for (i = nargs - 1; i >= 0; i--)
++ newp->val.args[i] = args[i];
++ return newp;
++ }
++
++ fail:
++ for (i = nargs - 1; i >= 0; i--)
++ FREE_EXPRESSION (args[i]);
++
++ return NULL;
++}
++
++static inline struct expression *
++new_exp_0 (enum operator op)
++{
++ return new_exp (0, op, NULL);
++}
++
++static inline struct expression *
++new_exp_1 (enum operator op, struct expression *right)
++{
++ struct expression *args[1];
++
++ args[0] = right;
++ return new_exp (1, op, args);
++}
++
++static struct expression *
++new_exp_2 (enum operator op, struct expression *left, struct expression *right)
++{
++ struct expression *args[2];
++
++ args[0] = left;
++ args[1] = right;
++ return new_exp (2, op, args);
++}
++
++static inline struct expression *
++new_exp_3 (enum operator op, struct expression *bexp,
++ struct expression *tbranch, struct expression *fbranch)
++{
++ struct expression *args[3];
++
++ args[0] = bexp;
++ args[1] = tbranch;
++ args[2] = fbranch;
++ return new_exp (3, op, args);
++}
++
++#ifndef YYDEBUG
++# define YYDEBUG 0
++#endif
++
++
++
++#define YYFINAL 27
++#define YYFLAG -32768
++#define YYNTBASE 16
++
++/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
++#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
++
++/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
++static const char yytranslate[] =
++{
++ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 10, 2, 2, 2, 2, 5, 2,
++ 14, 15, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 12, 2,
++ 2, 2, 2, 3, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 13, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 4, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
++ 2, 2, 2, 2, 2, 2, 1, 6, 7, 8,
++ 9, 11
++};
++
++#if YYDEBUG
++static const short yyprhs[] =
++{
++ 0, 0, 2, 8, 12, 16, 20, 24, 28, 32,
++ 35, 37, 39
++};
++static const short yyrhs[] =
++{
++ 17, 0, 17, 3, 17, 12, 17, 0, 17, 4,
++ 17, 0, 17, 5, 17, 0, 17, 6, 17, 0,
++ 17, 7, 17, 0, 17, 8, 17, 0, 17, 9,
++ 17, 0, 10, 17, 0, 13, 0, 11, 0, 14,
++ 17, 15, 0
++};
++
++#endif
++
++#if YYDEBUG
++/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
++static const short yyrline[] =
++{
++ 0, 150, 158, 162, 166, 170, 174, 178, 182, 186,
++ 190, 194, 199
++};
++#endif
++
++
++#if (YYDEBUG) || defined YYERROR_VERBOSE
++
++/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
++static const char *const yytname[] =
++{
++ "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2",
++ "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'",
++ "start", "exp", 0
++};
++#endif
++
++/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
++static const short yyr1[] =
++{
++ 0, 16, 17, 17, 17, 17, 17, 17, 17, 17,
++ 17, 17, 17
++};
++
++/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
++static const short yyr2[] =
++{
++ 0, 1, 5, 3, 3, 3, 3, 3, 3, 2,
++ 1, 1, 3
++};
++
++/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
++ doesn't specify something else to do. Zero means the default is an
++ error. */
++static const short yydefact[] =
++{
++ 0, 0, 11, 10, 0, 1, 9, 0, 0, 0,
++ 0, 0, 0, 0, 0, 12, 0, 3, 4, 5,
++ 6, 7, 8, 0, 2, 0, 0, 0
++};
++
++static const short yydefgoto[] =
++{
++ 25, 5
++};
++
++static const short yypact[] =
++{
++ -9, -9,-32768,-32768, -9, 34,-32768, 11, -9, -9,
++ -9, -9, -9, -9, -9,-32768, 24, 39, 43, 16,
++ 26, -3,-32768, -9, 34, 21, 53,-32768
++};
++
++static const short yypgoto[] =
++{
++ -32768, -1
++};
++
++
++#define YYLAST 53
++
++
++static const short yytable[] =
++{
++ 6, 1, 2, 7, 3, 4, 14, 16, 17, 18,
++ 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
++ 14, 26, 24, 12, 13, 14, 15, 8, 9, 10,
++ 11, 12, 13, 14, 13, 14, 23, 8, 9, 10,
++ 11, 12, 13, 14, 10, 11, 12, 13, 14, 11,
++ 12, 13, 14, 27
++};
++
++static const short yycheck[] =
++{
++ 1, 10, 11, 4, 13, 14, 9, 8, 9, 10,
++ 11, 12, 13, 14, 3, 4, 5, 6, 7, 8,
++ 9, 0, 23, 7, 8, 9, 15, 3, 4, 5,
++ 6, 7, 8, 9, 8, 9, 12, 3, 4, 5,
++ 6, 7, 8, 9, 5, 6, 7, 8, 9, 6,
++ 7, 8, 9, 0
++};
++#define YYPURE 1
++
++/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
++#line 3 "/usr/local/share/bison/bison.simple"
++
++/* Skeleton output parser for bison,
++
++ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
++ Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++/* As a special exception, when this file is copied by Bison into a
++ Bison output file, you may use that output file without restriction.
++ This special exception was added by the Free Software Foundation
++ in version 1.24 of Bison. */
++
++/* This is the parser code that is written into each bison parser when
++ the %semantic_parser declaration is not specified in the grammar.
++ It was written by Richard Stallman by simplifying the hairy parser
++ used when %semantic_parser is specified. */
++
++/* All symbols defined below should begin with yy or YY, to avoid
++ infringing on user name space. This should be done even for local
++ variables, as they might otherwise be expanded by user macros.
++ There are some unavoidable exceptions within include files to
++ define necessary library symbols; they are noted "INFRINGES ON
++ USER NAME SPACE" below. */
++
++#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
++
++/* The parser invokes alloca or malloc; define the necessary symbols. */
++
++# if YYSTACK_USE_ALLOCA
++# define YYSTACK_ALLOC alloca
++# else
++# ifndef YYSTACK_USE_ALLOCA
++# if defined (alloca) || defined (_ALLOCA_H)
++# define YYSTACK_ALLOC alloca
++# else
++# ifdef __GNUC__
++# define YYSTACK_ALLOC __builtin_alloca
++# endif
++# endif
++# endif
++# endif
++
++# ifdef YYSTACK_ALLOC
++ /* Pacify GCC's `empty if-body' warning. */
++# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
++# else
++# if defined (__STDC__) || defined (__cplusplus)
++# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
++# define YYSIZE_T size_t
++# endif
++# define YYSTACK_ALLOC malloc
++# define YYSTACK_FREE free
++# endif
++#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
++
++
++#if (! defined (yyoverflow) \
++ && (! defined (__cplusplus) \
++ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
++
++/* A type that is properly aligned for any stack member. */
++union yyalloc
++{
++ short yyss;
++ YYSTYPE yyvs;
++# if YYLSP_NEEDED
++ YYLTYPE yyls;
++# endif
++};
++
++/* The size of the maximum gap between one aligned stack and the next. */
++# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
++
++/* The size of an array large to enough to hold all stacks, each with
++ N elements. */
++# if YYLSP_NEEDED
++# define YYSTACK_BYTES(N) \
++ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
++ + 2 * YYSTACK_GAP_MAX)
++# else
++# define YYSTACK_BYTES(N) \
++ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
++ + YYSTACK_GAP_MAX)
++# endif
++
++/* Copy COUNT objects from FROM to TO. The source and destination do
++ not overlap. */
++# ifndef YYCOPY
++# if 1 < __GNUC__
++# define YYCOPY(To, From, Count) \
++ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
++# else
++# define YYCOPY(To, From, Count) \
++ do \
++ { \
++ register YYSIZE_T yyi; \
++ for (yyi = 0; yyi < (Count); yyi++) \
++ (To)[yyi] = (From)[yyi]; \
++ } \
++ while (0)
++# endif
++# endif
++
++/* Relocate STACK from its old location to the new one. The
++ local variables YYSIZE and YYSTACKSIZE give the old and new number of
++ elements in the stack, and YYPTR gives the new location of the
++ stack. Advance YYPTR to a properly aligned location for the next
++ stack. */
++# define YYSTACK_RELOCATE(Stack) \
++ do \
++ { \
++ YYSIZE_T yynewbytes; \
++ YYCOPY (&yyptr->Stack, Stack, yysize); \
++ Stack = &yyptr->Stack; \
++ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
++ yyptr += yynewbytes / sizeof (*yyptr); \
++ } \
++ while (0)
++
++#endif
++
++
++#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
++# define YYSIZE_T __SIZE_TYPE__
++#endif
++#if ! defined (YYSIZE_T) && defined (size_t)
++# define YYSIZE_T size_t
++#endif
++#if ! defined (YYSIZE_T)
++# if defined (__STDC__) || defined (__cplusplus)
++# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
++# define YYSIZE_T size_t
++# endif
++#endif
++#if ! defined (YYSIZE_T)
++# define YYSIZE_T unsigned int
++#endif
++
++#define yyerrok (yyerrstatus = 0)
++#define yyclearin (yychar = YYEMPTY)
++#define YYEMPTY -2
++#define YYEOF 0
++#define YYACCEPT goto yyacceptlab
++#define YYABORT goto yyabortlab
++#define YYERROR goto yyerrlab1
++/* Like YYERROR except do call yyerror. This remains here temporarily
++ to ease the transition to the new meaning of YYERROR, for GCC.
++ Once GCC version 2 has supplanted version 1, this can go. */
++#define YYFAIL goto yyerrlab
++#define YYRECOVERING() (!!yyerrstatus)
++#define YYBACKUP(Token, Value) \
++do \
++ if (yychar == YYEMPTY && yylen == 1) \
++ { \
++ yychar = (Token); \
++ yylval = (Value); \
++ yychar1 = YYTRANSLATE (yychar); \
++ YYPOPSTACK; \
++ goto yybackup; \
++ } \
++ else \
++ { \
++ yyerror ("syntax error: cannot back up"); \
++ YYERROR; \
++ } \
++while (0)
++
++#define YYTERROR 1
++#define YYERRCODE 256
++
++
++/* YYLLOC_DEFAULT -- Compute the default location (before the actions
++ are run).
++
++ When YYLLOC_DEFAULT is run, CURRENT is set the location of the
++ first token. By default, to implement support for ranges, extend
++ its range to the last symbol. */
++
++#ifndef YYLLOC_DEFAULT
++# define YYLLOC_DEFAULT(Current, Rhs, N) \
++ Current.last_line = Rhs[N].last_line; \
++ Current.last_column = Rhs[N].last_column;
++#endif
++
++
++/* YYLEX -- calling `yylex' with the right arguments. */
++
++#if YYPURE
++# if YYLSP_NEEDED
++# ifdef YYLEX_PARAM
++# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
++# else
++# define YYLEX yylex (&yylval, &yylloc)
++# endif
++# else /* !YYLSP_NEEDED */
++# ifdef YYLEX_PARAM
++# define YYLEX yylex (&yylval, YYLEX_PARAM)
++# else
++# define YYLEX yylex (&yylval)
++# endif
++# endif /* !YYLSP_NEEDED */
++#else /* !YYPURE */
++# define YYLEX yylex ()
++#endif /* !YYPURE */
++
++
++/* Enable debugging if requested. */
++#if YYDEBUG
++
++# ifndef YYFPRINTF
++# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
++# define YYFPRINTF fprintf
++# endif
++
++# define YYDPRINTF(Args) \
++do { \
++ if (yydebug) \
++ YYFPRINTF Args; \
++} while (0)
++/* Nonzero means print parse trace. It is left uninitialized so that
++ multiple parsers can coexist. */
++int yydebug;
++#else /* !YYDEBUG */
++# define YYDPRINTF(Args)
++#endif /* !YYDEBUG */
++
++/* YYINITDEPTH -- initial size of the parser's stacks. */
++#ifndef YYINITDEPTH
++# define YYINITDEPTH 200
++#endif
++
++/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
++ if the built-in stack extension method is used).
++
++ Do not make this value too large; the results are undefined if
++ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
++ evaluated with infinite-precision integer arithmetic. */
++
++#if YYMAXDEPTH == 0
++# undef YYMAXDEPTH
++#endif
++
++#ifndef YYMAXDEPTH
++# define YYMAXDEPTH 10000
++#endif
++
++#ifdef YYERROR_VERBOSE
++
++# ifndef yystrlen
++# if defined (__GLIBC__) && defined (_STRING_H)
++# define yystrlen strlen
++# else
++/* Return the length of YYSTR. */
++static YYSIZE_T
++# if defined (__STDC__) || defined (__cplusplus)
++yystrlen (const char *yystr)
++# else
++yystrlen (yystr)
++ const char *yystr;
++# endif
++{
++ register const char *yys = yystr;
++
++ while (*yys++ != '\0')
++ continue;
++
++ return yys - yystr - 1;
++}
++# endif
++# endif
++
++# ifndef yystpcpy
++# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
++# define yystpcpy stpcpy
++# else
++/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
++ YYDEST. */
++static char *
++# if defined (__STDC__) || defined (__cplusplus)
++yystpcpy (char *yydest, const char *yysrc)
++# else
++yystpcpy (yydest, yysrc)
++ char *yydest;
++ const char *yysrc;
++# endif
++{
++ register char *yyd = yydest;
++ register const char *yys = yysrc;
++
++ while ((*yyd++ = *yys++) != '\0')
++ continue;
++
++ return yyd - 1;
++}
++# endif
++# endif
++#endif
++
++#line 315 "/usr/local/share/bison/bison.simple"
++
++
++/* The user can define YYPARSE_PARAM as the name of an argument to be passed
++ into yyparse. The argument should have type void *.
++ It should actually point to an object.
++ Grammar actions can access the variable by casting it
++ to the proper pointer type. */
++
++#ifdef YYPARSE_PARAM
++# if defined (__STDC__) || defined (__cplusplus)
++# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
++# define YYPARSE_PARAM_DECL
++# else
++# define YYPARSE_PARAM_ARG YYPARSE_PARAM
++# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
++# endif
++#else /* !YYPARSE_PARAM */
++# define YYPARSE_PARAM_ARG
++# define YYPARSE_PARAM_DECL
++#endif /* !YYPARSE_PARAM */
++
++/* Prevent warning if -Wstrict-prototypes. */
++#ifdef __GNUC__
++# ifdef YYPARSE_PARAM
++int yyparse (void *);
++# else
++int yyparse (void);
++# endif
++#endif
++
++/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
++ variables are global, or local to YYPARSE. */
++
++#define YY_DECL_NON_LSP_VARIABLES \
++/* The lookahead symbol. */ \
++int yychar; \
++ \
++/* The semantic value of the lookahead symbol. */ \
++YYSTYPE yylval; \
++ \
++/* Number of parse errors so far. */ \
++int yynerrs;
++
++#if YYLSP_NEEDED
++# define YY_DECL_VARIABLES \
++YY_DECL_NON_LSP_VARIABLES \
++ \
++/* Location data for the lookahead symbol. */ \
++YYLTYPE yylloc;
++#else
++# define YY_DECL_VARIABLES \
++YY_DECL_NON_LSP_VARIABLES
++#endif
++
++
++/* If nonreentrant, generate the variables here. */
++
++#if !YYPURE
++YY_DECL_VARIABLES
++#endif /* !YYPURE */
++
++int
++yyparse (YYPARSE_PARAM_ARG)
++ YYPARSE_PARAM_DECL
++{
++ /* If reentrant, generate the variables here. */
++#if YYPURE
++ YY_DECL_VARIABLES
++#endif /* !YYPURE */
++
++ register int yystate;
++ register int yyn;
++ int yyresult;
++ /* Number of tokens to shift before error messages enabled. */
++ int yyerrstatus;
++ /* Lookahead token as an internal (translated) token number. */
++ int yychar1 = 0;
++
++ /* Three stacks and their tools:
++ `yyss': related to states,
++ `yyvs': related to semantic values,
++ `yyls': related to locations.
++
++ Refer to the stacks thru separate pointers, to allow yyoverflow
++ to reallocate them elsewhere. */
++
++ /* The state stack. */
++ short yyssa[YYINITDEPTH];
++ short *yyss = yyssa;
++ register short *yyssp;
++
++ /* The semantic value stack. */
++ YYSTYPE yyvsa[YYINITDEPTH];
++ YYSTYPE *yyvs = yyvsa;
++ register YYSTYPE *yyvsp;
++
++#if YYLSP_NEEDED
++ /* The location stack. */
++ YYLTYPE yylsa[YYINITDEPTH];
++ YYLTYPE *yyls = yylsa;
++ YYLTYPE *yylsp;
++#endif
++
++#if YYLSP_NEEDED
++# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
++#else
++# define YYPOPSTACK (yyvsp--, yyssp--)
++#endif
++
++ YYSIZE_T yystacksize = YYINITDEPTH;
++
++
++ /* The variables used to return semantic value and location from the
++ action routines. */
++ YYSTYPE yyval;
++#if YYLSP_NEEDED
++ YYLTYPE yyloc;
++#endif
++
++ /* When reducing, the number of symbols on the RHS of the reduced
++ rule. */
++ int yylen;
++
++ YYDPRINTF ((stderr, "Starting parse\n"));
++
++ yystate = 0;
++ yyerrstatus = 0;
++ yynerrs = 0;
++ yychar = YYEMPTY; /* Cause a token to be read. */
++
++ /* Initialize stack pointers.
++ Waste one element of value and location stack
++ so that they stay on the same level as the state stack.
++ The wasted elements are never initialized. */
++
++ yyssp = yyss;
++ yyvsp = yyvs;
++#if YYLSP_NEEDED
++ yylsp = yyls;
++#endif
++ goto yysetstate;
++
++/*------------------------------------------------------------.
++| yynewstate -- Push a new state, which is found in yystate. |
++`------------------------------------------------------------*/
++ yynewstate:
++ /* In all cases, when you get here, the value and location stacks
++ have just been pushed. so pushing a state here evens the stacks.
++ */
++ yyssp++;
++
++ yysetstate:
++ *yyssp = yystate;
++
++ if (yyssp >= yyss + yystacksize - 1)
++ {
++ /* Get the current used size of the three stacks, in elements. */
++ YYSIZE_T yysize = yyssp - yyss + 1;
++
++#ifdef yyoverflow
++ {
++ /* Give user a chance to reallocate the stack. Use copies of
++ these so that the &'s don't force the real ones into
++ memory. */
++ YYSTYPE *yyvs1 = yyvs;
++ short *yyss1 = yyss;
++
++ /* Each stack pointer address is followed by the size of the
++ data in use in that stack, in bytes. */
++# if YYLSP_NEEDED
++ YYLTYPE *yyls1 = yyls;
++ /* This used to be a conditional around just the two extra args,
++ but that might be undefined if yyoverflow is a macro. */
++ yyoverflow ("parser stack overflow",
++ &yyss1, yysize * sizeof (*yyssp),
++ &yyvs1, yysize * sizeof (*yyvsp),
++ &yyls1, yysize * sizeof (*yylsp),
++ &yystacksize);
++ yyls = yyls1;
++# else
++ yyoverflow ("parser stack overflow",
++ &yyss1, yysize * sizeof (*yyssp),
++ &yyvs1, yysize * sizeof (*yyvsp),
++ &yystacksize);
++# endif
++ yyss = yyss1;
++ yyvs = yyvs1;
++ }
++#else /* no yyoverflow */
++# ifndef YYSTACK_RELOCATE
++ goto yyoverflowlab;
++# else
++ /* Extend the stack our own way. */
++ if (yystacksize >= YYMAXDEPTH)
++ goto yyoverflowlab;
++ yystacksize *= 2;
++ if (yystacksize > YYMAXDEPTH)
++ yystacksize = YYMAXDEPTH;
++
++ {
++ short *yyss1 = yyss;
++ union yyalloc *yyptr =
++ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
++ if (! yyptr)
++ goto yyoverflowlab;
++ YYSTACK_RELOCATE (yyss);
++ YYSTACK_RELOCATE (yyvs);
++# if YYLSP_NEEDED
++ YYSTACK_RELOCATE (yyls);
++# endif
++# undef YYSTACK_RELOCATE
++ if (yyss1 != yyssa)
++ YYSTACK_FREE (yyss1);
++ }
++# endif
++#endif /* no yyoverflow */
++
++ yyssp = yyss + yysize - 1;
++ yyvsp = yyvs + yysize - 1;
++#if YYLSP_NEEDED
++ yylsp = yyls + yysize - 1;
++#endif
++
++ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
++ (unsigned long int) yystacksize));
++
++ if (yyssp >= yyss + yystacksize - 1)
++ YYABORT;
++ }
++
++ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
++
++ goto yybackup;
++
++
++/*-----------.
++| yybackup. |
++`-----------*/
++yybackup:
++
++/* Do appropriate processing given the current state. */
++/* Read a lookahead token if we need one and don't already have one. */
++/* yyresume: */
++
++ /* First try to decide what to do without reference to lookahead token. */
++
++ yyn = yypact[yystate];
++ if (yyn == YYFLAG)
++ goto yydefault;
++
++ /* Not known => get a lookahead token if don't already have one. */
++
++ /* yychar is either YYEMPTY or YYEOF
++ or a valid token in external form. */
++
++ if (yychar == YYEMPTY)
++ {
++ YYDPRINTF ((stderr, "Reading a token: "));
++ yychar = YYLEX;
++ }
++
++ /* Convert token to internal form (in yychar1) for indexing tables with */
++
++ if (yychar <= 0) /* This means end of input. */
++ {
++ yychar1 = 0;
++ yychar = YYEOF; /* Don't call YYLEX any more */
++
++ YYDPRINTF ((stderr, "Now at end of input.\n"));
++ }
++ else
++ {
++ yychar1 = YYTRANSLATE (yychar);
++
++#if YYDEBUG
++ /* We have to keep this `#if YYDEBUG', since we use variables
++ which are defined only if `YYDEBUG' is set. */
++ if (yydebug)
++ {
++ YYFPRINTF (stderr, "Next token is %d (%s",
++ yychar, yytname[yychar1]);
++ /* Give the individual parser a way to print the precise
++ meaning of a token, for further debugging info. */
++# ifdef YYPRINT
++ YYPRINT (stderr, yychar, yylval);
++# endif
++ YYFPRINTF (stderr, ")\n");
++ }
++#endif
++ }
++
++ yyn += yychar1;
++ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
++ goto yydefault;
++
++ yyn = yytable[yyn];
++
++ /* yyn is what to do for this token type in this state.
++ Negative => reduce, -yyn is rule number.
++ Positive => shift, yyn is new state.
++ New state is final state => don't bother to shift,
++ just return success.
++ 0, or most negative number => error. */
++
++ if (yyn < 0)
++ {
++ if (yyn == YYFLAG)
++ goto yyerrlab;
++ yyn = -yyn;
++ goto yyreduce;
++ }
++ else if (yyn == 0)
++ goto yyerrlab;
++
++ if (yyn == YYFINAL)
++ YYACCEPT;
++
++ /* Shift the lookahead token. */
++ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
++ yychar, yytname[yychar1]));
++
++ /* Discard the token being shifted unless it is eof. */
++ if (yychar != YYEOF)
++ yychar = YYEMPTY;
++
++ *++yyvsp = yylval;
++#if YYLSP_NEEDED
++ *++yylsp = yylloc;
++#endif
++
++ /* Count tokens shifted since error; after three, turn off error
++ status. */
++ if (yyerrstatus)
++ yyerrstatus--;
++
++ yystate = yyn;
++ goto yynewstate;
++
++
++/*-----------------------------------------------------------.
++| yydefault -- do the default action for the current state. |
++`-----------------------------------------------------------*/
++yydefault:
++ yyn = yydefact[yystate];
++ if (yyn == 0)
++ goto yyerrlab;
++ goto yyreduce;
++
++
++/*-----------------------------.
++| yyreduce -- Do a reduction. |
++`-----------------------------*/
++yyreduce:
++ /* yyn is the number of a rule to reduce with. */
++ yylen = yyr2[yyn];
++
++ /* If YYLEN is nonzero, implement the default value of the action:
++ `$$ = $1'.
++
++ Otherwise, the following line sets YYVAL to the semantic value of
++ the lookahead token. This behavior is undocumented and Bison
++ users should not rely upon it. Assigning to YYVAL
++ unconditionally makes the parser a bit smaller, and it avoids a
++ GCC warning that YYVAL may be used uninitialized. */
++ yyval = yyvsp[1-yylen];
++
++#if YYLSP_NEEDED
++ /* Similarly for the default location. Let the user run additional
++ commands if for instance locations are ranges. */
++ yyloc = yylsp[1-yylen];
++ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
++#endif
++
++#if YYDEBUG
++ /* We have to keep this `#if YYDEBUG', since we use variables which
++ are defined only if `YYDEBUG' is set. */
++ if (yydebug)
++ {
++ int yyi;
++
++ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
++ yyn, yyrline[yyn]);
++
++ /* Print the symbols being reduced, and their result. */
++ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
++ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
++ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
++ }
++#endif
++
++ switch (yyn) {
++
++case 1:
++#line 151 "plural.y"
++{
++ if (yyvsp[0].exp == NULL)
++ YYABORT;
++ ((struct parse_args *) arg)->res = yyvsp[0].exp;
++ }
++ break;
++case 2:
++#line 159 "plural.y"
++{
++ yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 3:
++#line 163 "plural.y"
++{
++ yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 4:
++#line 167 "plural.y"
++{
++ yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 5:
++#line 171 "plural.y"
++{
++ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 6:
++#line 175 "plural.y"
++{
++ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 7:
++#line 179 "plural.y"
++{
++ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 8:
++#line 183 "plural.y"
++{
++ yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
++ }
++ break;
++case 9:
++#line 187 "plural.y"
++{
++ yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
++ }
++ break;
++case 10:
++#line 191 "plural.y"
++{
++ yyval.exp = new_exp_0 (var);
++ }
++ break;
++case 11:
++#line 195 "plural.y"
++{
++ if ((yyval.exp = new_exp_0 (num)) != NULL)
++ yyval.exp->val.num = yyvsp[0].num;
++ }
++ break;
++case 12:
++#line 200 "plural.y"
++{
++ yyval.exp = yyvsp[-1].exp;
++ }
++ break;
++}
++
++#line 705 "/usr/local/share/bison/bison.simple"
++
++
++ yyvsp -= yylen;
++ yyssp -= yylen;
++#if YYLSP_NEEDED
++ yylsp -= yylen;
++#endif
++
++#if YYDEBUG
++ if (yydebug)
++ {
++ short *yyssp1 = yyss - 1;
++ YYFPRINTF (stderr, "state stack now");
++ while (yyssp1 != yyssp)
++ YYFPRINTF (stderr, " %d", *++yyssp1);
++ YYFPRINTF (stderr, "\n");
++ }
++#endif
++
++ *++yyvsp = yyval;
++#if YYLSP_NEEDED
++ *++yylsp = yyloc;
++#endif
++
++ /* Now `shift' the result of the reduction. Determine what state
++ that goes to, based on the state we popped back to and the rule
++ number reduced by. */
++
++ yyn = yyr1[yyn];
++
++ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
++ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
++ yystate = yytable[yystate];
++ else
++ yystate = yydefgoto[yyn - YYNTBASE];
++
++ goto yynewstate;
++
++
++/*------------------------------------.
++| yyerrlab -- here on detecting error |
++`------------------------------------*/
++yyerrlab:
++ /* If not already recovering from an error, report this error. */
++ if (!yyerrstatus)
++ {
++ ++yynerrs;
++
++#ifdef YYERROR_VERBOSE
++ yyn = yypact[yystate];
++
++ if (yyn > YYFLAG && yyn < YYLAST)
++ {
++ YYSIZE_T yysize = 0;
++ char *yymsg;
++ int yyx, yycount;
++
++ yycount = 0;
++ /* Start YYX at -YYN if negative to avoid negative indexes in
++ YYCHECK. */
++ for (yyx = yyn < 0 ? -yyn : 0;
++ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
++ if (yycheck[yyx + yyn] == yyx)
++ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
++ yysize += yystrlen ("parse error, unexpected ") + 1;
++ yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
++ yymsg = (char *) YYSTACK_ALLOC (yysize);
++ if (yymsg != 0)
++ {
++ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
++ yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
++
++ if (yycount < 5)
++ {
++ yycount = 0;
++ for (yyx = yyn < 0 ? -yyn : 0;
++ yyx < (int) (sizeof (yytname) / sizeof (char *));
++ yyx++)
++ if (yycheck[yyx + yyn] == yyx)
++ {
++ const char *yyq = ! yycount ? ", expecting " : " or ";
++ yyp = yystpcpy (yyp, yyq);
++ yyp = yystpcpy (yyp, yytname[yyx]);
++ yycount++;
++ }
++ }
++ yyerror (yymsg);
++ YYSTACK_FREE (yymsg);
++ }
++ else
++ yyerror ("parse error; also virtual memory exhausted");
++ }
++ else
++#endif /* defined (YYERROR_VERBOSE) */
++ yyerror ("parse error");
++ }
++ goto yyerrlab1;
++
++
++/*--------------------------------------------------.
++| yyerrlab1 -- error raised explicitly by an action |
++`--------------------------------------------------*/
++yyerrlab1:
++ if (yyerrstatus == 3)
++ {
++ /* If just tried and failed to reuse lookahead token after an
++ error, discard it. */
++
++ /* return failure if at end of input */
++ if (yychar == YYEOF)
++ YYABORT;
++ YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
++ yychar, yytname[yychar1]));
++ yychar = YYEMPTY;
++ }
++
++ /* Else will try to reuse lookahead token after shifting the error
++ token. */
++
++ yyerrstatus = 3; /* Each real token shifted decrements this */
++
++ goto yyerrhandle;
++
++
++/*-------------------------------------------------------------------.
++| yyerrdefault -- current state does not do anything special for the |
++| error token. |
++`-------------------------------------------------------------------*/
++yyerrdefault:
++#if 0
++ /* This is wrong; only states that explicitly want error tokens
++ should shift them. */
++
++ /* If its default is to accept any token, ok. Otherwise pop it. */
++ yyn = yydefact[yystate];
++ if (yyn)
++ goto yydefault;
++#endif
++
++
++/*---------------------------------------------------------------.
++| yyerrpop -- pop the current state because it cannot handle the |
++| error token |
++`---------------------------------------------------------------*/
++yyerrpop:
++ if (yyssp == yyss)
++ YYABORT;
++ yyvsp--;
++ yystate = *--yyssp;
++#if YYLSP_NEEDED
++ yylsp--;
++#endif
++
++#if YYDEBUG
++ if (yydebug)
++ {
++ short *yyssp1 = yyss - 1;
++ YYFPRINTF (stderr, "Error: state stack now");
++ while (yyssp1 != yyssp)
++ YYFPRINTF (stderr, " %d", *++yyssp1);
++ YYFPRINTF (stderr, "\n");
++ }
++#endif
++
++/*--------------.
++| yyerrhandle. |
++`--------------*/
++yyerrhandle:
++ yyn = yypact[yystate];
++ if (yyn == YYFLAG)
++ goto yyerrdefault;
++
++ yyn += YYTERROR;
++ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
++ goto yyerrdefault;
++
++ yyn = yytable[yyn];
++ if (yyn < 0)
++ {
++ if (yyn == YYFLAG)
++ goto yyerrpop;
++ yyn = -yyn;
++ goto yyreduce;
++ }
++ else if (yyn == 0)
++ goto yyerrpop;
++
++ if (yyn == YYFINAL)
++ YYACCEPT;
++
++ YYDPRINTF ((stderr, "Shifting error token, "));
++
++ *++yyvsp = yylval;
++#if YYLSP_NEEDED
++ *++yylsp = yylloc;
++#endif
++
++ yystate = yyn;
++ goto yynewstate;
++
++
++/*-------------------------------------.
++| yyacceptlab -- YYACCEPT comes here. |
++`-------------------------------------*/
++yyacceptlab:
++ yyresult = 0;
++ goto yyreturn;
++
++/*-----------------------------------.
++| yyabortlab -- YYABORT comes here. |
++`-----------------------------------*/
++yyabortlab:
++ yyresult = 1;
++ goto yyreturn;
++
++/*---------------------------------------------.
++| yyoverflowab -- parser overflow comes here. |
++`---------------------------------------------*/
++yyoverflowlab:
++ yyerror ("parser stack overflow");
++ yyresult = 2;
++ /* Fall through. */
++
++yyreturn:
++#ifndef yyoverflow
++ if (yyss != yyssa)
++ YYSTACK_FREE (yyss);
++#endif
++ return yyresult;
++}
++#line 205 "plural.y"
++
++
++void
++internal_function
++FREE_EXPRESSION (struct expression *exp)
++{
++ if (exp == NULL)
++ return;
++
++ /* Handle the recursive case. */
++ switch (exp->nargs)
++ {
++ case 3:
++ FREE_EXPRESSION (exp->val.args[2]);
++ /* FALLTHROUGH */
++ case 2:
++ FREE_EXPRESSION (exp->val.args[1]);
++ /* FALLTHROUGH */
++ case 1:
++ FREE_EXPRESSION (exp->val.args[0]);
++ /* FALLTHROUGH */
++ default:
++ break;
++ }
++
++ free (exp);
++}
++
++
++static int
++yylex (YYSTYPE *lval, const char **pexp)
++{
++ const char *exp = *pexp;
++ int result;
++
++ while (1)
++ {
++ if (exp[0] == '\0')
++ {
++ *pexp = exp;
++ return YYEOF;
++ }
++
++ if (exp[0] != ' ' && exp[0] != '\t')
++ break;
++
++ ++exp;
++ }
++
++ result = *exp++;
++ switch (result)
++ {
++ case '0': case '1': case '2': case '3': case '4':
++ case '5': case '6': case '7': case '8': case '9':
++ {
++ unsigned long int n = result - '0';
++ while (exp[0] >= '0' && exp[0] <= '9')
++ {
++ n *= 10;
++ n += exp[0] - '0';
++ ++exp;
++ }
++ lval->num = n;
++ result = NUMBER;
++ }
++ break;
++
++ case '=':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = equal;
++ result = EQUOP2;
++ }
++ else
++ result = YYERRCODE;
++ break;
++
++ case '!':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = not_equal;
++ result = EQUOP2;
++ }
++ break;
++
++ case '&':
++ case '|':
++ if (exp[0] == result)
++ ++exp;
++ else
++ result = YYERRCODE;
++ break;
++
++ case '<':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = less_or_equal;
++ }
++ else
++ lval->op = less_than;
++ result = CMPOP2;
++ break;
++
++ case '>':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = greater_or_equal;
++ }
++ else
++ lval->op = greater_than;
++ result = CMPOP2;
++ break;
++
++ case '*':
++ lval->op = mult;
++ result = MULOP2;
++ break;
++
++ case '/':
++ lval->op = divide;
++ result = MULOP2;
++ break;
++
++ case '%':
++ lval->op = module;
++ result = MULOP2;
++ break;
++
++ case '+':
++ lval->op = plus;
++ result = ADDOP2;
++ break;
++
++ case '-':
++ lval->op = minus;
++ result = ADDOP2;
++ break;
++
++ case 'n':
++ case '?':
++ case ':':
++ case '(':
++ case ')':
++ /* Nothing, just return the character. */
++ break;
++
++ case ';':
++ case '\n':
++ case '\0':
++ /* Be safe and let the user call this function again. */
++ --exp;
++ result = YYEOF;
++ break;
++
++ default:
++ result = YYERRCODE;
++#if YYDEBUG != 0
++ --exp;
++#endif
++ break;
++ }
++
++ *pexp = exp;
++
++ return result;
++}
++
++
++static void
++yyerror (const char *str)
++{
++ /* Do nothing. We don't print error messages here. */
++}
+--- lrzsz-0.12.20.safe/intl/plural-exp.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/plural-exp.c 2004-09-12 14:40:34.578714192 -0400
+@@ -0,0 +1,154 @@
++/* Expression parsing for plural form selection.
++ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <ctype.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include "plural-exp.h"
++
++#if (defined __GNUC__ && !defined __APPLE_CC__) \
++ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
++
++/* These structs are the constant expression for the germanic plural
++ form determination. It represents the expression "n != 1". */
++static const struct expression plvar =
++{
++ .nargs = 0,
++ .operation = var,
++};
++static const struct expression plone =
++{
++ .nargs = 0,
++ .operation = num,
++ .val =
++ {
++ .num = 1
++ }
++};
++struct expression GERMANIC_PLURAL =
++{
++ .nargs = 2,
++ .operation = not_equal,
++ .val =
++ {
++ .args =
++ {
++ [0] = (struct expression *) &plvar,
++ [1] = (struct expression *) &plone
++ }
++ }
++};
++
++# define INIT_GERMANIC_PLURAL()
++
++#else
++
++/* For compilers without support for ISO C 99 struct/union initializers:
++ Initialization at run-time. */
++
++static struct expression plvar;
++static struct expression plone;
++struct expression GERMANIC_PLURAL;
++
++static void
++init_germanic_plural ()
++{
++ if (plone.val.num == 0)
++ {
++ plvar.nargs = 0;
++ plvar.operation = var;
++
++ plone.nargs = 0;
++ plone.operation = num;
++ plone.val.num = 1;
++
++ GERMANIC_PLURAL.nargs = 2;
++ GERMANIC_PLURAL.operation = not_equal;
++ GERMANIC_PLURAL.val.args[0] = &plvar;
++ GERMANIC_PLURAL.val.args[1] = &plone;
++ }
++}
++
++# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
++
++#endif
++
++void
++internal_function
++EXTRACT_PLURAL_EXPRESSION (const char *nullentry, struct expression **pluralp,
++ unsigned long int *npluralsp)
++{
++ if (nullentry != NULL)
++ {
++ const char *plural;
++ const char *nplurals;
++
++ plural = strstr (nullentry, "plural=");
++ nplurals = strstr (nullentry, "nplurals=");
++ if (plural == NULL || nplurals == NULL)
++ goto no_plural;
++ else
++ {
++ char *endp;
++ unsigned long int n;
++ struct parse_args args;
++
++ /* First get the number. */
++ nplurals += 9;
++ while (*nplurals != '\0' && isspace ((unsigned char) *nplurals))
++ ++nplurals;
++ if (!(*nplurals >= '0' && *nplurals <= '9'))
++ goto no_plural;
++#if defined HAVE_STRTOUL || defined _LIBC
++ n = strtoul (nplurals, &endp, 10);
++#else
++ for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
++ n = n * 10 + (*endp - '0');
++#endif
++ if (nplurals == endp)
++ goto no_plural;
++ *npluralsp = n;
++
++ /* Due to the restrictions bison imposes onto the interface of the
++ scanner function we have to put the input string and the result
++ passed up from the parser into the same structure which address
++ is passed down to the parser. */
++ plural += 7;
++ args.cp = plural;
++ if (PLURAL_PARSE (&args) != 0)
++ goto no_plural;
++ *pluralp = args.res;
++ }
++ }
++ else
++ {
++ /* By default we are using the Germanic form: singular form only
++ for `one', the plural form otherwise. Yes, this is also what
++ English is using since English is a Germanic language. */
++ no_plural:
++ INIT_GERMANIC_PLURAL ();
++ *pluralp = &GERMANIC_PLURAL;
++ *npluralsp = 2;
++ }
++}
+--- lrzsz-0.12.20.safe/intl/plural-exp.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/plural-exp.h 2004-09-12 14:40:34.584713280 -0400
+@@ -0,0 +1,118 @@
++/* Expression parsing and evaluation for plural form selection.
++ Copyright (C) 2000-2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _PLURAL_EXP_H
++#define _PLURAL_EXP_H
++
++#ifndef internal_function
++# define internal_function
++#endif
++
++#ifndef attribute_hidden
++# define attribute_hidden
++#endif
++
++
++/* This is the representation of the expressions to determine the
++ plural form. */
++struct expression
++{
++ int nargs; /* Number of arguments. */
++ enum operator
++ {
++ /* Without arguments: */
++ var, /* The variable "n". */
++ num, /* Decimal number. */
++ /* Unary operators: */
++ lnot, /* Logical NOT. */
++ /* Binary operators: */
++ mult, /* Multiplication. */
++ divide, /* Division. */
++ module, /* Modulo operation. */
++ plus, /* Addition. */
++ minus, /* Subtraction. */
++ less_than, /* Comparison. */
++ greater_than, /* Comparison. */
++ less_or_equal, /* Comparison. */
++ greater_or_equal, /* Comparison. */
++ equal, /* Comparison for equality. */
++ not_equal, /* Comparison for inequality. */
++ land, /* Logical AND. */
++ lor, /* Logical OR. */
++ /* Ternary operators: */
++ qmop /* Question mark operator. */
++ } operation;
++ union
++ {
++ unsigned long int num; /* Number value for `num'. */
++ struct expression *args[3]; /* Up to three arguments. */
++ } val;
++};
++
++/* This is the data structure to pass information to the parser and get
++ the result in a thread-safe way. */
++struct parse_args
++{
++ const char *cp;
++ struct expression *res;
++};
++
++
++/* Names for the libintl functions are a problem. This source code is used
++ 1. in the GNU C Library library,
++ 2. in the GNU libintl library,
++ 3. in the GNU gettext tools.
++ The function names in each situation must be different, to allow for
++ binary incompatible changes in 'struct expression'. Furthermore,
++ 1. in the GNU C Library library, the names have a __ prefix,
++ 2.+3. in the GNU libintl library and in the GNU gettext tools, the names
++ must follow ANSI C and not start with __.
++ So we have to distinguish the three cases. */
++#ifdef _LIBC
++# define FREE_EXPRESSION __gettext_free_exp
++# define PLURAL_PARSE __gettextparse
++# define GERMANIC_PLURAL __gettext_germanic_plural
++# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
++#elif defined (IN_LIBINTL)
++# define FREE_EXPRESSION libintl_gettext_free_exp
++# define PLURAL_PARSE libintl_gettextparse
++# define GERMANIC_PLURAL libintl_gettext_germanic_plural
++# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
++#else
++# define FREE_EXPRESSION free_plural_expression
++# define PLURAL_PARSE parse_plural_expression
++# define GERMANIC_PLURAL germanic_plural
++# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
++#endif
++
++extern void FREE_EXPRESSION (struct expression *exp)
++ internal_function;
++extern int PLURAL_PARSE (void *arg);
++extern struct expression GERMANIC_PLURAL attribute_hidden;
++extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
++ struct expression **pluralp,
++ unsigned long int *npluralsp)
++ internal_function;
++
++#if !defined (_LIBC) && !defined (IN_LIBINTL)
++extern unsigned long int plural_eval (struct expression *pexp,
++ unsigned long int n);
++#endif
++
++#endif /* _PLURAL_EXP_H */
+--- lrzsz-0.12.20.safe/intl/plural.y 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/plural.y 2004-09-12 14:40:34.589712520 -0400
+@@ -0,0 +1,381 @@
++%{
++/* Expression parsing for plural form selection.
++ Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc.
++ Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* The bison generated parser uses alloca. AIX 3 forces us to put this
++ declaration at the beginning of the file. The declaration in bison's
++ skeleton file comes too late. This must come before <config.h>
++ because <config.h> may include arbitrary system headers. */
++#if defined _AIX && !defined __GNUC__
++ #pragma alloca
++#endif
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <stddef.h>
++#include <stdlib.h>
++#include "plural-exp.h"
++
++/* The main function generated by the parser is called __gettextparse,
++ but we want it to be called PLURAL_PARSE. */
++#ifndef _LIBC
++# define __gettextparse PLURAL_PARSE
++#endif
++
++#define YYLEX_PARAM &((struct parse_args *) arg)->cp
++#define YYPARSE_PARAM arg
++%}
++%pure_parser
++%expect 7
++
++%union {
++ unsigned long int num;
++ enum operator op;
++ struct expression *exp;
++}
++
++%{
++/* Prototypes for local functions. */
++static int yylex (YYSTYPE *lval, const char **pexp);
++static void yyerror (const char *str);
++
++/* Allocation of expressions. */
++
++static struct expression *
++new_exp (int nargs, enum operator op, struct expression * const *args)
++{
++ int i;
++ struct expression *newp;
++
++ /* If any of the argument could not be malloc'ed, just return NULL. */
++ for (i = nargs - 1; i >= 0; i--)
++ if (args[i] == NULL)
++ goto fail;
++
++ /* Allocate a new expression. */
++ newp = (struct expression *) malloc (sizeof (*newp));
++ if (newp != NULL)
++ {
++ newp->nargs = nargs;
++ newp->operation = op;
++ for (i = nargs - 1; i >= 0; i--)
++ newp->val.args[i] = args[i];
++ return newp;
++ }
++
++ fail:
++ for (i = nargs - 1; i >= 0; i--)
++ FREE_EXPRESSION (args[i]);
++
++ return NULL;
++}
++
++static inline struct expression *
++new_exp_0 (enum operator op)
++{
++ return new_exp (0, op, NULL);
++}
++
++static inline struct expression *
++new_exp_1 (enum operator op, struct expression *right)
++{
++ struct expression *args[1];
++
++ args[0] = right;
++ return new_exp (1, op, args);
++}
++
++static struct expression *
++new_exp_2 (enum operator op, struct expression *left, struct expression *right)
++{
++ struct expression *args[2];
++
++ args[0] = left;
++ args[1] = right;
++ return new_exp (2, op, args);
++}
++
++static inline struct expression *
++new_exp_3 (enum operator op, struct expression *bexp,
++ struct expression *tbranch, struct expression *fbranch)
++{
++ struct expression *args[3];
++
++ args[0] = bexp;
++ args[1] = tbranch;
++ args[2] = fbranch;
++ return new_exp (3, op, args);
++}
++
++%}
++
++/* This declares that all operators have the same associativity and the
++ precedence order as in C. See [Harbison, Steele: C, A Reference Manual].
++ There is no unary minus and no bitwise operators.
++ Operators with the same syntactic behaviour have been merged into a single
++ token, to save space in the array generated by bison. */
++%right '?' /* ? */
++%left '|' /* || */
++%left '&' /* && */
++%left EQUOP2 /* == != */
++%left CMPOP2 /* < > <= >= */
++%left ADDOP2 /* + - */
++%left MULOP2 /* * / % */
++%right '!' /* ! */
++
++%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2
++%token <num> NUMBER
++%type <exp> exp
++
++%%
++
++start: exp
++ {
++ if ($1 == NULL)
++ YYABORT;
++ ((struct parse_args *) arg)->res = $1;
++ }
++ ;
++
++exp: exp '?' exp ':' exp
++ {
++ $$ = new_exp_3 (qmop, $1, $3, $5);
++ }
++ | exp '|' exp
++ {
++ $$ = new_exp_2 (lor, $1, $3);
++ }
++ | exp '&' exp
++ {
++ $$ = new_exp_2 (land, $1, $3);
++ }
++ | exp EQUOP2 exp
++ {
++ $$ = new_exp_2 ($2, $1, $3);
++ }
++ | exp CMPOP2 exp
++ {
++ $$ = new_exp_2 ($2, $1, $3);
++ }
++ | exp ADDOP2 exp
++ {
++ $$ = new_exp_2 ($2, $1, $3);
++ }
++ | exp MULOP2 exp
++ {
++ $$ = new_exp_2 ($2, $1, $3);
++ }
++ | '!' exp
++ {
++ $$ = new_exp_1 (lnot, $2);
++ }
++ | 'n'
++ {
++ $$ = new_exp_0 (var);
++ }
++ | NUMBER
++ {
++ if (($$ = new_exp_0 (num)) != NULL)
++ $$->val.num = $1;
++ }
++ | '(' exp ')'
++ {
++ $$ = $2;
++ }
++ ;
++
++%%
++
++void
++internal_function
++FREE_EXPRESSION (struct expression *exp)
++{
++ if (exp == NULL)
++ return;
++
++ /* Handle the recursive case. */
++ switch (exp->nargs)
++ {
++ case 3:
++ FREE_EXPRESSION (exp->val.args[2]);
++ /* FALLTHROUGH */
++ case 2:
++ FREE_EXPRESSION (exp->val.args[1]);
++ /* FALLTHROUGH */
++ case 1:
++ FREE_EXPRESSION (exp->val.args[0]);
++ /* FALLTHROUGH */
++ default:
++ break;
++ }
++
++ free (exp);
++}
++
++
++static int
++yylex (YYSTYPE *lval, const char **pexp)
++{
++ const char *exp = *pexp;
++ int result;
++
++ while (1)
++ {
++ if (exp[0] == '\0')
++ {
++ *pexp = exp;
++ return YYEOF;
++ }
++
++ if (exp[0] != ' ' && exp[0] != '\t')
++ break;
++
++ ++exp;
++ }
++
++ result = *exp++;
++ switch (result)
++ {
++ case '0': case '1': case '2': case '3': case '4':
++ case '5': case '6': case '7': case '8': case '9':
++ {
++ unsigned long int n = result - '0';
++ while (exp[0] >= '0' && exp[0] <= '9')
++ {
++ n *= 10;
++ n += exp[0] - '0';
++ ++exp;
++ }
++ lval->num = n;
++ result = NUMBER;
++ }
++ break;
++
++ case '=':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = equal;
++ result = EQUOP2;
++ }
++ else
++ result = YYERRCODE;
++ break;
++
++ case '!':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = not_equal;
++ result = EQUOP2;
++ }
++ break;
++
++ case '&':
++ case '|':
++ if (exp[0] == result)
++ ++exp;
++ else
++ result = YYERRCODE;
++ break;
++
++ case '<':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = less_or_equal;
++ }
++ else
++ lval->op = less_than;
++ result = CMPOP2;
++ break;
++
++ case '>':
++ if (exp[0] == '=')
++ {
++ ++exp;
++ lval->op = greater_or_equal;
++ }
++ else
++ lval->op = greater_than;
++ result = CMPOP2;
++ break;
++
++ case '*':
++ lval->op = mult;
++ result = MULOP2;
++ break;
++
++ case '/':
++ lval->op = divide;
++ result = MULOP2;
++ break;
++
++ case '%':
++ lval->op = module;
++ result = MULOP2;
++ break;
++
++ case '+':
++ lval->op = plus;
++ result = ADDOP2;
++ break;
++
++ case '-':
++ lval->op = minus;
++ result = ADDOP2;
++ break;
++
++ case 'n':
++ case '?':
++ case ':':
++ case '(':
++ case ')':
++ /* Nothing, just return the character. */
++ break;
++
++ case ';':
++ case '\n':
++ case '\0':
++ /* Be safe and let the user call this function again. */
++ --exp;
++ result = YYEOF;
++ break;
++
++ default:
++ result = YYERRCODE;
++#if YYDEBUG != 0
++ --exp;
++#endif
++ break;
++ }
++
++ *pexp = exp;
++
++ return result;
++}
++
++
++static void
++yyerror (const char *str)
++{
++ /* Do nothing. We don't print error messages here. */
++}
+--- lrzsz-0.12.20.safe/intl/po2tbl.sed.in 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/po2tbl.sed.in 1969-12-31 19:00:00.000000000 -0500
+@@ -1,102 +0,0 @@
+-# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
+-# Copyright (C) 1995 Free Software Foundation, Inc.
+-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+-#
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2, or (at your option)
+-# any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-#
+-1 {
+- i\
+-/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
+-\
+-#if HAVE_CONFIG_H\
+-# include <config.h>\
+-#endif\
+-\
+-#include "libgettext.h"\
+-\
+-const struct _msg_ent _msg_tbl[] = {
+- h
+- s/.*/0/
+- x
+-}
+-#
+-# Write msgid entries in C array form.
+-#
+-/^msgid/ {
+- s/msgid[ ]*\(".*"\)/ {\1/
+- tb
+-# Append the next line
+- :b
+- N
+-# Look whether second part is continuation line.
+- s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
+-# Yes, then branch.
+- ta
+-# Because we assume that the input file correctly formed the line
+-# just read cannot be again be a msgid line. So it's safe to ignore
+-# it.
+- s/\(.*\)\n.*/\1/
+- bc
+-# We found a continuation line. But before printing insert '\'.
+- :a
+- s/\(.*\)\(\n.*\)/\1\\\2/
+- P
+-# We cannot use D here.
+- s/.*\n\(.*\)/\1/
+-# Some buggy seds do not clear the `successful substitution since last ``t'''
+-# flag on `N', so we do a `t' here to clear it.
+- tb
+-# Not reached
+- :c
+- x
+-# The following nice solution is by
+-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+- td
+-# Increment a decimal number in pattern space.
+-# First hide trailing `9' digits.
+- :d
+- s/9\(_*\)$/_\1/
+- td
+-# Assure at least one digit is available.
+- s/^\(_*\)$/0\1/
+-# Increment the last digit.
+- s/8\(_*\)$/9\1/
+- s/7\(_*\)$/8\1/
+- s/6\(_*\)$/7\1/
+- s/5\(_*\)$/6\1/
+- s/4\(_*\)$/5\1/
+- s/3\(_*\)$/4\1/
+- s/2\(_*\)$/3\1/
+- s/1\(_*\)$/2\1/
+- s/0\(_*\)$/1\1/
+-# Convert the hidden `9' digits to `0's.
+- s/_/0/g
+- x
+- G
+- s/\(.*\)\n\([0-9]*\)/\1, \2},/
+- s/\(.*\)"$/\1/
+- p
+-}
+-#
+-# Last line.
+-#
+-$ {
+- i\
+-};\
+-
+- g
+- s/0*\(.*\)/int _msg_tbl_length = \1;/p
+-}
+-d
+--- lrzsz-0.12.20.safe/intl/printf-args.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/printf-args.c 2004-09-12 14:40:34.595711608 -0400
+@@ -0,0 +1,119 @@
++/* Decomposed printf argument list.
++ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++/* Specification. */
++#include "printf-args.h"
++
++#ifdef STATIC
++STATIC
++#endif
++int
++printf_fetchargs (va_list args, arguments *a)
++{
++ size_t i;
++ argument *ap;
++
++ for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
++ switch (ap->type)
++ {
++ case TYPE_SCHAR:
++ ap->a.a_schar = va_arg (args, /*signed char*/ int);
++ break;
++ case TYPE_UCHAR:
++ ap->a.a_uchar = va_arg (args, /*unsigned char*/ int);
++ break;
++ case TYPE_SHORT:
++ ap->a.a_short = va_arg (args, /*short*/ int);
++ break;
++ case TYPE_USHORT:
++ ap->a.a_ushort = va_arg (args, /*unsigned short*/ int);
++ break;
++ case TYPE_INT:
++ ap->a.a_int = va_arg (args, int);
++ break;
++ case TYPE_UINT:
++ ap->a.a_uint = va_arg (args, unsigned int);
++ break;
++ case TYPE_LONGINT:
++ ap->a.a_longint = va_arg (args, long int);
++ break;
++ case TYPE_ULONGINT:
++ ap->a.a_ulongint = va_arg (args, unsigned long int);
++ break;
++#ifdef HAVE_LONG_LONG
++ case TYPE_LONGLONGINT:
++ ap->a.a_longlongint = va_arg (args, long long int);
++ break;
++ case TYPE_ULONGLONGINT:
++ ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
++ break;
++#endif
++ case TYPE_DOUBLE:
++ ap->a.a_double = va_arg (args, double);
++ break;
++#ifdef HAVE_LONG_DOUBLE
++ case TYPE_LONGDOUBLE:
++ ap->a.a_longdouble = va_arg (args, long double);
++ break;
++#endif
++ case TYPE_CHAR:
++ ap->a.a_char = va_arg (args, int);
++ break;
++#ifdef HAVE_WINT_T
++ case TYPE_WIDE_CHAR:
++ ap->a.a_wide_char = va_arg (args, wint_t);
++ break;
++#endif
++ case TYPE_STRING:
++ ap->a.a_string = va_arg (args, const char *);
++ break;
++#ifdef HAVE_WCHAR_T
++ case TYPE_WIDE_STRING:
++ ap->a.a_wide_string = va_arg (args, const wchar_t *);
++ break;
++#endif
++ case TYPE_POINTER:
++ ap->a.a_pointer = va_arg (args, void *);
++ break;
++ case TYPE_COUNT_SCHAR_POINTER:
++ ap->a.a_count_schar_pointer = va_arg (args, signed char *);
++ break;
++ case TYPE_COUNT_SHORT_POINTER:
++ ap->a.a_count_short_pointer = va_arg (args, short *);
++ break;
++ case TYPE_COUNT_INT_POINTER:
++ ap->a.a_count_int_pointer = va_arg (args, int *);
++ break;
++ case TYPE_COUNT_LONGINT_POINTER:
++ ap->a.a_count_longint_pointer = va_arg (args, long int *);
++ break;
++#ifdef HAVE_LONG_LONG
++ case TYPE_COUNT_LONGLONGINT_POINTER:
++ ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
++ break;
++#endif
++ default:
++ /* Unknown type. */
++ return -1;
++ }
++ return 0;
++}
+--- lrzsz-0.12.20.safe/intl/printf-args.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/printf-args.h 2004-09-12 14:40:34.601710696 -0400
+@@ -0,0 +1,137 @@
++/* Decomposed printf argument list.
++ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _PRINTF_ARGS_H
++#define _PRINTF_ARGS_H
++
++/* Get size_t. */
++#include <stddef.h>
++
++/* Get wchar_t. */
++#ifdef HAVE_WCHAR_T
++# include <stddef.h>
++#endif
++
++/* Get wint_t. */
++#ifdef HAVE_WINT_T
++# include <wchar.h>
++#endif
++
++/* Get va_list. */
++#include <stdarg.h>
++
++
++/* Argument types */
++typedef enum
++{
++ TYPE_NONE,
++ TYPE_SCHAR,
++ TYPE_UCHAR,
++ TYPE_SHORT,
++ TYPE_USHORT,
++ TYPE_INT,
++ TYPE_UINT,
++ TYPE_LONGINT,
++ TYPE_ULONGINT,
++#ifdef HAVE_LONG_LONG
++ TYPE_LONGLONGINT,
++ TYPE_ULONGLONGINT,
++#endif
++ TYPE_DOUBLE,
++#ifdef HAVE_LONG_DOUBLE
++ TYPE_LONGDOUBLE,
++#endif
++ TYPE_CHAR,
++#ifdef HAVE_WINT_T
++ TYPE_WIDE_CHAR,
++#endif
++ TYPE_STRING,
++#ifdef HAVE_WCHAR_T
++ TYPE_WIDE_STRING,
++#endif
++ TYPE_POINTER,
++ TYPE_COUNT_SCHAR_POINTER,
++ TYPE_COUNT_SHORT_POINTER,
++ TYPE_COUNT_INT_POINTER,
++ TYPE_COUNT_LONGINT_POINTER
++#ifdef HAVE_LONG_LONG
++, TYPE_COUNT_LONGLONGINT_POINTER
++#endif
++} arg_type;
++
++/* Polymorphic argument */
++typedef struct
++{
++ arg_type type;
++ union
++ {
++ signed char a_schar;
++ unsigned char a_uchar;
++ short a_short;
++ unsigned short a_ushort;
++ int a_int;
++ unsigned int a_uint;
++ long int a_longint;
++ unsigned long int a_ulongint;
++#ifdef HAVE_LONG_LONG
++ long long int a_longlongint;
++ unsigned long long int a_ulonglongint;
++#endif
++ float a_float;
++ double a_double;
++#ifdef HAVE_LONG_DOUBLE
++ long double a_longdouble;
++#endif
++ int a_char;
++#ifdef HAVE_WINT_T
++ wint_t a_wide_char;
++#endif
++ const char* a_string;
++#ifdef HAVE_WCHAR_T
++ const wchar_t* a_wide_string;
++#endif
++ void* a_pointer;
++ signed char * a_count_schar_pointer;
++ short * a_count_short_pointer;
++ int * a_count_int_pointer;
++ long int * a_count_longint_pointer;
++#ifdef HAVE_LONG_LONG
++ long long int * a_count_longlongint_pointer;
++#endif
++ }
++ a;
++}
++argument;
++
++typedef struct
++{
++ size_t count;
++ argument *arg;
++}
++arguments;
++
++
++/* Fetch the arguments, putting them into a. */
++#ifdef STATIC
++STATIC
++#else
++extern
++#endif
++int printf_fetchargs (va_list args, arguments *a);
++
++#endif /* _PRINTF_ARGS_H */
+--- lrzsz-0.12.20.safe/intl/printf.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/printf.c 2004-09-12 14:40:34.607709784 -0400
+@@ -0,0 +1,371 @@
++/* Formatted output to strings, using POSIX/XSI format strings with positions.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ Written by Bruno Haible <bruno@clisp.org>, 2003.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#ifdef __GNUC__
++# define alloca __builtin_alloca
++# define HAVE_ALLOCA 1
++#else
++# ifdef _MSC_VER
++# include <malloc.h>
++# define alloca _alloca
++# else
++# if defined HAVE_ALLOCA_H || defined _LIBC
++# include <alloca.h>
++# else
++# ifdef _AIX
++ #pragma alloca
++# else
++# ifndef alloca
++char *alloca ();
++# endif
++# endif
++# endif
++# endif
++#endif
++
++#include <stdio.h>
++
++#if !HAVE_POSIX_PRINTF
++
++#include <stdlib.h>
++#include <string.h>
++
++/* When building a DLL, we must export some functions. Note that because
++ the functions are only defined for binary backward compatibility, we
++ don't need to use __declspec(dllimport) in any case. */
++#if defined _MSC_VER && BUILDING_DLL
++# define DLL_EXPORTED __declspec(dllexport)
++#else
++# define DLL_EXPORTED
++#endif
++
++#define STATIC static
++
++/* Define auxiliary functions declared in "printf-args.h". */
++#include "printf-args.c"
++
++/* Define auxiliary functions declared in "printf-parse.h". */
++#include "printf-parse.c"
++
++/* Define functions declared in "vasnprintf.h". */
++#define vasnprintf libintl_vasnprintf
++#include "vasnprintf.c"
++#if 0 /* not needed */
++#define asnprintf libintl_asnprintf
++#include "asnprintf.c"
++#endif
++
++DLL_EXPORTED
++int
++libintl_vfprintf (FILE *stream, const char *format, va_list args)
++{
++ if (strchr (format, '$') == NULL)
++ return vfprintf (stream, format, args);
++ else
++ {
++ size_t length;
++ char *result = libintl_vasnprintf (NULL, &length, format, args);
++ int retval = -1;
++ if (result != NULL)
++ {
++ if (fwrite (result, 1, length, stream) == length)
++ retval = length;
++ free (result);
++ }
++ return retval;
++ }
++}
++
++DLL_EXPORTED
++int
++libintl_fprintf (FILE *stream, const char *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vfprintf (stream, format, args);
++ va_end (args);
++ return retval;
++}
++
++DLL_EXPORTED
++int
++libintl_vprintf (const char *format, va_list args)
++{
++ return libintl_vfprintf (stdout, format, args);
++}
++
++DLL_EXPORTED
++int
++libintl_printf (const char *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vprintf (format, args);
++ va_end (args);
++ return retval;
++}
++
++DLL_EXPORTED
++int
++libintl_vsprintf (char *resultbuf, const char *format, va_list args)
++{
++ if (strchr (format, '$') == NULL)
++ return vsprintf (resultbuf, format, args);
++ else
++ {
++ size_t length = (size_t) ~0 / (4 * sizeof (char));
++ char *result = libintl_vasnprintf (resultbuf, &length, format, args);
++ if (result != resultbuf)
++ {
++ free (result);
++ return -1;
++ }
++ else
++ return length;
++ }
++}
++
++DLL_EXPORTED
++int
++libintl_sprintf (char *resultbuf, const char *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vsprintf (resultbuf, format, args);
++ va_end (args);
++ return retval;
++}
++
++#if HAVE_SNPRINTF
++
++# if HAVE_DECL__SNPRINTF
++ /* Windows. */
++# define system_vsnprintf _vsnprintf
++# else
++ /* Unix. */
++# define system_vsnprintf vsnprintf
++# endif
++
++DLL_EXPORTED
++int
++libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list args)
++{
++ if (strchr (format, '$') == NULL)
++ return system_vsnprintf (resultbuf, length, format, args);
++ else
++ {
++ size_t maxlength = length;
++ char *result = libintl_vasnprintf (resultbuf, &length, format, args);
++ if (result != resultbuf)
++ {
++ if (maxlength > 0)
++ {
++ if (length < maxlength)
++ abort ();
++ memcpy (resultbuf, result, maxlength - 1);
++ resultbuf[maxlength - 1] = '\0';
++ }
++ free (result);
++ return -1;
++ }
++ else
++ return length;
++ }
++}
++
++DLL_EXPORTED
++int
++libintl_snprintf (char *resultbuf, size_t length, const char *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vsnprintf (resultbuf, length, format, args);
++ va_end (args);
++ return retval;
++}
++
++#endif
++
++#if HAVE_ASPRINTF
++
++DLL_EXPORTED
++int
++libintl_vasprintf (char **resultp, const char *format, va_list args)
++{
++ size_t length;
++ char *result = libintl_vasnprintf (NULL, &length, format, args);
++ if (result == NULL)
++ return -1;
++ *resultp = result;
++ return length;
++}
++
++DLL_EXPORTED
++int
++libintl_asprintf (char **resultp, const char *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vasprintf (resultp, format, args);
++ va_end (args);
++ return retval;
++}
++
++#endif
++
++#if HAVE_FWPRINTF
++
++#include <wchar.h>
++
++#define WIDE_CHAR_VERSION 1
++
++/* Define auxiliary functions declared in "wprintf-parse.h". */
++#include "printf-parse.c"
++
++/* Define functions declared in "vasnprintf.h". */
++#define vasnwprintf libintl_vasnwprintf
++#include "vasnprintf.c"
++#if 0 /* not needed */
++#define asnwprintf libintl_asnwprintf
++#include "asnprintf.c"
++#endif
++
++# if HAVE_DECL__SNWPRINTF
++ /* Windows. */
++# define system_vswprintf _vsnwprintf
++# else
++ /* Unix. */
++# define system_vswprintf vswprintf
++# endif
++
++DLL_EXPORTED
++int
++libintl_vfwprintf (FILE *stream, const wchar_t *format, va_list args)
++{
++ if (wcschr (format, '$') == NULL)
++ return vfwprintf (stream, format, args);
++ else
++ {
++ size_t length;
++ wchar_t *result = libintl_vasnwprintf (NULL, &length, format, args);
++ int retval = -1;
++ if (result != NULL)
++ {
++ size_t i;
++ for (i = 0; i < length; i++)
++ if (fputwc (result[i], stream) == WEOF)
++ break;
++ if (i == length)
++ retval = length;
++ free (result);
++ }
++ return retval;
++ }
++}
++
++DLL_EXPORTED
++int
++libintl_fwprintf (FILE *stream, const wchar_t *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vfwprintf (stream, format, args);
++ va_end (args);
++ return retval;
++}
++
++DLL_EXPORTED
++int
++libintl_vwprintf (const wchar_t *format, va_list args)
++{
++ return libintl_vfwprintf (stdout, format, args);
++}
++
++DLL_EXPORTED
++int
++libintl_wprintf (const wchar_t *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vwprintf (format, args);
++ va_end (args);
++ return retval;
++}
++
++DLL_EXPORTED
++int
++libintl_vswprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, va_list args)
++{
++ if (wcschr (format, '$') == NULL)
++ return system_vswprintf (resultbuf, length, format, args);
++ else
++ {
++ size_t maxlength = length;
++ wchar_t *result = libintl_vasnwprintf (resultbuf, &length, format, args);
++ if (result != resultbuf)
++ {
++ if (maxlength > 0)
++ {
++ if (length < maxlength)
++ abort ();
++ memcpy (resultbuf, result, (maxlength - 1) * sizeof (wchar_t));
++ resultbuf[maxlength - 1] = 0;
++ }
++ free (result);
++ return -1;
++ }
++ else
++ return length;
++ }
++}
++
++DLL_EXPORTED
++int
++libintl_swprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, ...)
++{
++ va_list args;
++ int retval;
++
++ va_start (args, format);
++ retval = libintl_vswprintf (resultbuf, length, format, args);
++ va_end (args);
++ return retval;
++}
++
++#endif
++
++#endif
+--- lrzsz-0.12.20.safe/intl/printf-parse.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/printf-parse.c 2004-09-12 14:40:34.622707504 -0400
+@@ -0,0 +1,537 @@
++/* Formatted output to strings.
++ Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++/* Specification. */
++#if WIDE_CHAR_VERSION
++# include "wprintf-parse.h"
++#else
++# include "printf-parse.h"
++#endif
++
++/* Get size_t, NULL. */
++#include <stddef.h>
++
++/* Get intmax_t. */
++#if HAVE_STDINT_H_WITH_UINTMAX
++# include <stdint.h>
++#endif
++#if HAVE_INTTYPES_H_WITH_UINTMAX
++# include <inttypes.h>
++#endif
++
++/* malloc(), realloc(), free(). */
++#include <stdlib.h>
++
++/* Checked size_t computations. */
++#include "xsize.h"
++
++#if WIDE_CHAR_VERSION
++# define PRINTF_PARSE wprintf_parse
++# define CHAR_T wchar_t
++# define DIRECTIVE wchar_t_directive
++# define DIRECTIVES wchar_t_directives
++#else
++# define PRINTF_PARSE printf_parse
++# define CHAR_T char
++# define DIRECTIVE char_directive
++# define DIRECTIVES char_directives
++#endif
++
++#ifdef STATIC
++STATIC
++#endif
++int
++PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
++{
++ const CHAR_T *cp = format; /* pointer into format */
++ size_t arg_posn = 0; /* number of regular arguments consumed */
++ size_t d_allocated; /* allocated elements of d->dir */
++ size_t a_allocated; /* allocated elements of a->arg */
++ size_t max_width_length = 0;
++ size_t max_precision_length = 0;
++
++ d->count = 0;
++ d_allocated = 1;
++ d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
++ if (d->dir == NULL)
++ /* Out of memory. */
++ return -1;
++
++ a->count = 0;
++ a_allocated = 0;
++ a->arg = NULL;
++
++#define REGISTER_ARG(_index_,_type_) \
++ { \
++ size_t n = (_index_); \
++ if (n >= a_allocated) \
++ { \
++ size_t memory_size; \
++ argument *memory; \
++ \
++ a_allocated = xtimes (a_allocated, 2); \
++ if (a_allocated <= n) \
++ a_allocated = xsum (n, 1); \
++ memory_size = xtimes (a_allocated, sizeof (argument)); \
++ if (size_overflow_p (memory_size)) \
++ /* Overflow, would lead to out of memory. */ \
++ goto error; \
++ memory = (a->arg \
++ ? realloc (a->arg, memory_size) \
++ : malloc (memory_size)); \
++ if (memory == NULL) \
++ /* Out of memory. */ \
++ goto error; \
++ a->arg = memory; \
++ } \
++ while (a->count <= n) \
++ a->arg[a->count++].type = TYPE_NONE; \
++ if (a->arg[n].type == TYPE_NONE) \
++ a->arg[n].type = (_type_); \
++ else if (a->arg[n].type != (_type_)) \
++ /* Ambiguous type for positional argument. */ \
++ goto error; \
++ }
++
++ while (*cp != '\0')
++ {
++ CHAR_T c = *cp++;
++ if (c == '%')
++ {
++ size_t arg_index = ARG_NONE;
++ DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
++
++ /* Initialize the next directive. */
++ dp->dir_start = cp - 1;
++ dp->flags = 0;
++ dp->width_start = NULL;
++ dp->width_end = NULL;
++ dp->width_arg_index = ARG_NONE;
++ dp->precision_start = NULL;
++ dp->precision_end = NULL;
++ dp->precision_arg_index = ARG_NONE;
++ dp->arg_index = ARG_NONE;
++
++ /* Test for positional argument. */
++ if (*cp >= '0' && *cp <= '9')
++ {
++ const CHAR_T *np;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ ;
++ if (*np == '$')
++ {
++ size_t n = 0;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ n = xsum (xtimes (n, 10), *np - '0');
++ if (n == 0)
++ /* Positional argument 0. */
++ goto error;
++ if (size_overflow_p (n))
++ /* n too large, would lead to out of memory later. */
++ goto error;
++ arg_index = n - 1;
++ cp = np + 1;
++ }
++ }
++
++ /* Read the flags. */
++ for (;;)
++ {
++ if (*cp == '\'')
++ {
++ dp->flags |= FLAG_GROUP;
++ cp++;
++ }
++ else if (*cp == '-')
++ {
++ dp->flags |= FLAG_LEFT;
++ cp++;
++ }
++ else if (*cp == '+')
++ {
++ dp->flags |= FLAG_SHOWSIGN;
++ cp++;
++ }
++ else if (*cp == ' ')
++ {
++ dp->flags |= FLAG_SPACE;
++ cp++;
++ }
++ else if (*cp == '#')
++ {
++ dp->flags |= FLAG_ALT;
++ cp++;
++ }
++ else if (*cp == '0')
++ {
++ dp->flags |= FLAG_ZERO;
++ cp++;
++ }
++ else
++ break;
++ }
++
++ /* Parse the field width. */
++ if (*cp == '*')
++ {
++ dp->width_start = cp;
++ cp++;
++ dp->width_end = cp;
++ if (max_width_length < 1)
++ max_width_length = 1;
++
++ /* Test for positional argument. */
++ if (*cp >= '0' && *cp <= '9')
++ {
++ const CHAR_T *np;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ ;
++ if (*np == '$')
++ {
++ size_t n = 0;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ n = xsum (xtimes (n, 10), *np - '0');
++ if (n == 0)
++ /* Positional argument 0. */
++ goto error;
++ if (size_overflow_p (n))
++ /* n too large, would lead to out of memory later. */
++ goto error;
++ dp->width_arg_index = n - 1;
++ cp = np + 1;
++ }
++ }
++ if (dp->width_arg_index == ARG_NONE)
++ {
++ dp->width_arg_index = arg_posn++;
++ if (dp->width_arg_index == ARG_NONE)
++ /* arg_posn wrapped around. */
++ goto error;
++ }
++ REGISTER_ARG (dp->width_arg_index, TYPE_INT);
++ }
++ else if (*cp >= '0' && *cp <= '9')
++ {
++ size_t width_length;
++
++ dp->width_start = cp;
++ for (; *cp >= '0' && *cp <= '9'; cp++)
++ ;
++ dp->width_end = cp;
++ width_length = dp->width_end - dp->width_start;
++ if (max_width_length < width_length)
++ max_width_length = width_length;
++ }
++
++ /* Parse the precision. */
++ if (*cp == '.')
++ {
++ cp++;
++ if (*cp == '*')
++ {
++ dp->precision_start = cp - 1;
++ cp++;
++ dp->precision_end = cp;
++ if (max_precision_length < 2)
++ max_precision_length = 2;
++
++ /* Test for positional argument. */
++ if (*cp >= '0' && *cp <= '9')
++ {
++ const CHAR_T *np;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ ;
++ if (*np == '$')
++ {
++ size_t n = 0;
++
++ for (np = cp; *np >= '0' && *np <= '9'; np++)
++ n = xsum (xtimes (n, 10), *np - '0');
++ if (n == 0)
++ /* Positional argument 0. */
++ goto error;
++ if (size_overflow_p (n))
++ /* n too large, would lead to out of memory
++ later. */
++ goto error;
++ dp->precision_arg_index = n - 1;
++ cp = np + 1;
++ }
++ }
++ if (dp->precision_arg_index == ARG_NONE)
++ {
++ dp->precision_arg_index = arg_posn++;
++ if (dp->precision_arg_index == ARG_NONE)
++ /* arg_posn wrapped around. */
++ goto error;
++ }
++ REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
++ }
++ else
++ {
++ size_t precision_length;
++
++ dp->precision_start = cp - 1;
++ for (; *cp >= '0' && *cp <= '9'; cp++)
++ ;
++ dp->precision_end = cp;
++ precision_length = dp->precision_end - dp->precision_start;
++ if (max_precision_length < precision_length)
++ max_precision_length = precision_length;
++ }
++ }
++
++ {
++ arg_type type;
++
++ /* Parse argument type/size specifiers. */
++ {
++ int flags = 0;
++
++ for (;;)
++ {
++ if (*cp == 'h')
++ {
++ flags |= (1 << (flags & 1));
++ cp++;
++ }
++ else if (*cp == 'L')
++ {
++ flags |= 4;
++ cp++;
++ }
++ else if (*cp == 'l')
++ {
++ flags += 8;
++ cp++;
++ }
++#ifdef HAVE_INTMAX_T
++ else if (*cp == 'j')
++ {
++ if (sizeof (intmax_t) > sizeof (long))
++ {
++ /* intmax_t = long long */
++ flags += 16;
++ }
++ else if (sizeof (intmax_t) > sizeof (int))
++ {
++ /* intmax_t = long */
++ flags += 8;
++ }
++ cp++;
++ }
++#endif
++ else if (*cp == 'z' || *cp == 'Z')
++ {
++ /* 'z' is standardized in ISO C 99, but glibc uses 'Z'
++ because the warning facility in gcc-2.95.2 understands
++ only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
++ if (sizeof (size_t) > sizeof (long))
++ {
++ /* size_t = long long */
++ flags += 16;
++ }
++ else if (sizeof (size_t) > sizeof (int))
++ {
++ /* size_t = long */
++ flags += 8;
++ }
++ cp++;
++ }
++ else if (*cp == 't')
++ {
++ if (sizeof (ptrdiff_t) > sizeof (long))
++ {
++ /* ptrdiff_t = long long */
++ flags += 16;
++ }
++ else if (sizeof (ptrdiff_t) > sizeof (int))
++ {
++ /* ptrdiff_t = long */
++ flags += 8;
++ }
++ cp++;
++ }
++ else
++ break;
++ }
++
++ /* Read the conversion character. */
++ c = *cp++;
++ switch (c)
++ {
++ case 'd': case 'i':
++#ifdef HAVE_LONG_LONG
++ if (flags >= 16 || (flags & 4))
++ type = TYPE_LONGLONGINT;
++ else
++#endif
++ if (flags >= 8)
++ type = TYPE_LONGINT;
++ else if (flags & 2)
++ type = TYPE_SCHAR;
++ else if (flags & 1)
++ type = TYPE_SHORT;
++ else
++ type = TYPE_INT;
++ break;
++ case 'o': case 'u': case 'x': case 'X':
++#ifdef HAVE_LONG_LONG
++ if (flags >= 16 || (flags & 4))
++ type = TYPE_ULONGLONGINT;
++ else
++#endif
++ if (flags >= 8)
++ type = TYPE_ULONGINT;
++ else if (flags & 2)
++ type = TYPE_UCHAR;
++ else if (flags & 1)
++ type = TYPE_USHORT;
++ else
++ type = TYPE_UINT;
++ break;
++ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
++ case 'a': case 'A':
++#ifdef HAVE_LONG_DOUBLE
++ if (flags >= 16 || (flags & 4))
++ type = TYPE_LONGDOUBLE;
++ else
++#endif
++ type = TYPE_DOUBLE;
++ break;
++ case 'c':
++ if (flags >= 8)
++#ifdef HAVE_WINT_T
++ type = TYPE_WIDE_CHAR;
++#else
++ goto error;
++#endif
++ else
++ type = TYPE_CHAR;
++ break;
++#ifdef HAVE_WINT_T
++ case 'C':
++ type = TYPE_WIDE_CHAR;
++ c = 'c';
++ break;
++#endif
++ case 's':
++ if (flags >= 8)
++#ifdef HAVE_WCHAR_T
++ type = TYPE_WIDE_STRING;
++#else
++ goto error;
++#endif
++ else
++ type = TYPE_STRING;
++ break;
++#ifdef HAVE_WCHAR_T
++ case 'S':
++ type = TYPE_WIDE_STRING;
++ c = 's';
++ break;
++#endif
++ case 'p':
++ type = TYPE_POINTER;
++ break;
++ case 'n':
++#ifdef HAVE_LONG_LONG
++ if (flags >= 16 || (flags & 4))
++ type = TYPE_COUNT_LONGLONGINT_POINTER;
++ else
++#endif
++ if (flags >= 8)
++ type = TYPE_COUNT_LONGINT_POINTER;
++ else if (flags & 2)
++ type = TYPE_COUNT_SCHAR_POINTER;
++ else if (flags & 1)
++ type = TYPE_COUNT_SHORT_POINTER;
++ else
++ type = TYPE_COUNT_INT_POINTER;
++ break;
++ case '%':
++ type = TYPE_NONE;
++ break;
++ default:
++ /* Unknown conversion character. */
++ goto error;
++ }
++ }
++
++ if (type != TYPE_NONE)
++ {
++ dp->arg_index = arg_index;
++ if (dp->arg_index == ARG_NONE)
++ {
++ dp->arg_index = arg_posn++;
++ if (dp->arg_index == ARG_NONE)
++ /* arg_posn wrapped around. */
++ goto error;
++ }
++ REGISTER_ARG (dp->arg_index, type);
++ }
++ dp->conversion = c;
++ dp->dir_end = cp;
++ }
++
++ d->count++;
++ if (d->count >= d_allocated)
++ {
++ size_t memory_size;
++ DIRECTIVE *memory;
++
++ d_allocated = xtimes (d_allocated, 2);
++ memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
++ if (size_overflow_p (memory_size))
++ /* Overflow, would lead to out of memory. */
++ goto error;
++ memory = realloc (d->dir, memory_size);
++ if (memory == NULL)
++ /* Out of memory. */
++ goto error;
++ d->dir = memory;
++ }
++ }
++ }
++ d->dir[d->count].dir_start = cp;
++
++ d->max_width_length = max_width_length;
++ d->max_precision_length = max_precision_length;
++ return 0;
++
++error:
++ if (a->arg)
++ free (a->arg);
++ if (d->dir)
++ free (d->dir);
++ return -1;
++}
++
++#undef DIRECTIVES
++#undef DIRECTIVE
++#undef CHAR_T
++#undef PRINTF_PARSE
+--- lrzsz-0.12.20.safe/intl/printf-parse.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/printf-parse.h 2004-09-12 14:40:34.628706592 -0400
+@@ -0,0 +1,75 @@
++/* Parse printf format string.
++ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _PRINTF_PARSE_H
++#define _PRINTF_PARSE_H
++
++#include "printf-args.h"
++
++
++/* Flags */
++#define FLAG_GROUP 1 /* ' flag */
++#define FLAG_LEFT 2 /* - flag */
++#define FLAG_SHOWSIGN 4 /* + flag */
++#define FLAG_SPACE 8 /* space flag */
++#define FLAG_ALT 16 /* # flag */
++#define FLAG_ZERO 32
++
++/* arg_index value indicating that no argument is consumed. */
++#define ARG_NONE (~(size_t)0)
++
++/* A parsed directive. */
++typedef struct
++{
++ const char* dir_start;
++ const char* dir_end;
++ int flags;
++ const char* width_start;
++ const char* width_end;
++ size_t width_arg_index;
++ const char* precision_start;
++ const char* precision_end;
++ size_t precision_arg_index;
++ char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
++ size_t arg_index;
++}
++char_directive;
++
++/* A parsed format string. */
++typedef struct
++{
++ size_t count;
++ char_directive *dir;
++ size_t max_width_length;
++ size_t max_precision_length;
++}
++char_directives;
++
++
++/* Parses the format string. Fills in the number N of directives, and fills
++ in directives[0], ..., directives[N-1], and sets directives[N].dir_start
++ to the end of the format string. Also fills in the arg_type fields of the
++ arguments and the needed count of arguments. */
++#ifdef STATIC
++STATIC
++#else
++extern
++#endif
++int printf_parse (const char *format, char_directives *d, arguments *a);
++
++#endif /* _PRINTF_PARSE_H */
+--- lrzsz-0.12.20.safe/intl/ref-add.sin 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/ref-add.sin 2004-09-12 14:40:34.633705832 -0400
+@@ -0,0 +1,31 @@
++# Add this package to a list of references stored in a text file.
++#
++# Copyright (C) 2000 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Library General Public License as published
++# by the Free Software Foundation; either version 2, or (at your option)
++# any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# Library General Public License for more details.
++#
++# You should have received a copy of the GNU Library General Public
++# License along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
++#
++# Written by Bruno Haible <haible@clisp.cons.org>.
++#
++/^# Packages using this file: / {
++ s/# Packages using this file://
++ ta
++ :a
++ s/ @PACKAGE@ / @PACKAGE@ /
++ tb
++ s/ $/ @PACKAGE@ /
++ :b
++ s/^/# Packages using this file:/
++}
+--- lrzsz-0.12.20.safe/intl/ref-del.sin 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/ref-del.sin 2004-09-12 14:40:34.638705072 -0400
+@@ -0,0 +1,26 @@
++# Remove this package from a list of references stored in a text file.
++#
++# Copyright (C) 2000 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Library General Public License as published
++# by the Free Software Foundation; either version 2, or (at your option)
++# any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++# Library General Public License for more details.
++#
++# You should have received a copy of the GNU Library General Public
++# License along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++# USA.
++#
++# Written by Bruno Haible <haible@clisp.cons.org>.
++#
++/^# Packages using this file: / {
++ s/# Packages using this file://
++ s/ @PACKAGE@ / /
++ s/^/# Packages using this file:/
++}
+--- lrzsz-0.12.20.safe/intl/relocatable.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/relocatable.c 2004-09-12 14:40:34.644704160 -0400
+@@ -0,0 +1,449 @@
++/* Provide relocatable packages.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ Written by Bruno Haible <bruno@clisp.org>, 2003.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++
++/* Tell glibc's <stdio.h> to provide a prototype for getline().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
++/* Specification. */
++#include "relocatable.h"
++
++#if ENABLE_RELOCATABLE
++
++#include <stddef.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#ifdef NO_XMALLOC
++# define xmalloc malloc
++#else
++# include "xalloc.h"
++#endif
++
++#if defined _WIN32 || defined __WIN32__
++# define WIN32_LEAN_AND_MEAN
++# include <windows.h>
++#endif
++
++#if DEPENDS_ON_LIBCHARSET
++# include <libcharset.h>
++#endif
++#if DEPENDS_ON_LIBICONV && HAVE_ICONV
++# include <iconv.h>
++#endif
++#if DEPENDS_ON_LIBINTL && ENABLE_NLS
++# include <libintl.h>
++#endif
++
++/* Faked cheap 'bool'. */
++#undef bool
++#undef false
++#undef true
++#define bool int
++#define false 0
++#define true 1
++
++/* Pathname support.
++ ISSLASH(C) tests whether C is a directory separator character.
++ IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
++ */
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS */
++# define ISSLASH(C) ((C) == '/' || (C) == '\\')
++# define HAS_DEVICE(P) \
++ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
++ && (P)[1] == ':')
++# define IS_PATH_WITH_DIR(P) \
++ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
++# define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
++#else
++ /* Unix */
++# define ISSLASH(C) ((C) == '/')
++# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
++# define FILESYSTEM_PREFIX_LEN(P) 0
++#endif
++
++/* Original installation prefix. */
++static char *orig_prefix;
++static size_t orig_prefix_len;
++/* Current installation prefix. */
++static char *curr_prefix;
++static size_t curr_prefix_len;
++/* These prefixes do not end in a slash. Anything that will be concatenated
++ to them must start with a slash. */
++
++/* Sets the original and the current installation prefix of this module.
++ Relocation simply replaces a pathname starting with the original prefix
++ by the corresponding pathname with the current prefix instead. Both
++ prefixes should be directory names without trailing slash (i.e. use ""
++ instead of "/"). */
++static void
++set_this_relocation_prefix (const char *orig_prefix_arg,
++ const char *curr_prefix_arg)
++{
++ if (orig_prefix_arg != NULL && curr_prefix_arg != NULL
++ /* Optimization: if orig_prefix and curr_prefix are equal, the
++ relocation is a nop. */
++ && strcmp (orig_prefix_arg, curr_prefix_arg) != 0)
++ {
++ /* Duplicate the argument strings. */
++ char *memory;
++
++ orig_prefix_len = strlen (orig_prefix_arg);
++ curr_prefix_len = strlen (curr_prefix_arg);
++ memory = (char *) xmalloc (orig_prefix_len + 1 + curr_prefix_len + 1);
++#ifdef NO_XMALLOC
++ if (memory != NULL)
++#endif
++ {
++ memcpy (memory, orig_prefix_arg, orig_prefix_len + 1);
++ orig_prefix = memory;
++ memory += orig_prefix_len + 1;
++ memcpy (memory, curr_prefix_arg, curr_prefix_len + 1);
++ curr_prefix = memory;
++ return;
++ }
++ }
++ orig_prefix = NULL;
++ curr_prefix = NULL;
++ /* Don't worry about wasted memory here - this function is usually only
++ called once. */
++}
++
++/* Sets the original and the current installation prefix of the package.
++ Relocation simply replaces a pathname starting with the original prefix
++ by the corresponding pathname with the current prefix instead. Both
++ prefixes should be directory names without trailing slash (i.e. use ""
++ instead of "/"). */
++void
++set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg)
++{
++ set_this_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
++
++ /* Now notify all dependent libraries. */
++#if DEPENDS_ON_LIBCHARSET
++ libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
++#endif
++#if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109
++ libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
++#endif
++#if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix
++ libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
++#endif
++}
++
++#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
++
++/* Convenience function:
++ Computes the current installation prefix, based on the original
++ installation prefix, the original installation directory of a particular
++ file, and the current pathname of this file. Returns NULL upon failure. */
++#ifdef IN_LIBRARY
++#define compute_curr_prefix local_compute_curr_prefix
++static
++#endif
++const char *
++compute_curr_prefix (const char *orig_installprefix,
++ const char *orig_installdir,
++ const char *curr_pathname)
++{
++ const char *curr_installdir;
++ const char *rel_installdir;
++
++ if (curr_pathname == NULL)
++ return NULL;
++
++ /* Determine the relative installation directory, relative to the prefix.
++ This is simply the difference between orig_installprefix and
++ orig_installdir. */
++ if (strncmp (orig_installprefix, orig_installdir, strlen (orig_installprefix))
++ != 0)
++ /* Shouldn't happen - nothing should be installed outside $(prefix). */
++ return NULL;
++ rel_installdir = orig_installdir + strlen (orig_installprefix);
++
++ /* Determine the current installation directory. */
++ {
++ const char *p_base = curr_pathname + FILESYSTEM_PREFIX_LEN (curr_pathname);
++ const char *p = curr_pathname + strlen (curr_pathname);
++ char *q;
++
++ while (p > p_base)
++ {
++ p--;
++ if (ISSLASH (*p))
++ break;
++ }
++
++ q = (char *) xmalloc (p - curr_pathname + 1);
++#ifdef NO_XMALLOC
++ if (q == NULL)
++ return NULL;
++#endif
++ memcpy (q, curr_pathname, p - curr_pathname);
++ q[p - curr_pathname] = '\0';
++ curr_installdir = q;
++ }
++
++ /* Compute the current installation prefix by removing the trailing
++ rel_installdir from it. */
++ {
++ const char *rp = rel_installdir + strlen (rel_installdir);
++ const char *cp = curr_installdir + strlen (curr_installdir);
++ const char *cp_base =
++ curr_installdir + FILESYSTEM_PREFIX_LEN (curr_installdir);
++
++ while (rp > rel_installdir && cp > cp_base)
++ {
++ bool same = false;
++ const char *rpi = rp;
++ const char *cpi = cp;
++
++ while (rpi > rel_installdir && cpi > cp_base)
++ {
++ rpi--;
++ cpi--;
++ if (ISSLASH (*rpi) || ISSLASH (*cpi))
++ {
++ if (ISSLASH (*rpi) && ISSLASH (*cpi))
++ same = true;
++ break;
++ }
++#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
++ /* Win32, OS/2, DOS - case insignificant filesystem */
++ if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi)
++ != (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi))
++ break;
++#else
++ if (*rpi != *cpi)
++ break;
++#endif
++ }
++ if (!same)
++ break;
++ /* The last pathname component was the same. opi and cpi now point
++ to the slash before it. */
++ rp = rpi;
++ cp = cpi;
++ }
++
++ if (rp > rel_installdir)
++ /* Unexpected: The curr_installdir does not end with rel_installdir. */
++ return NULL;
++
++ {
++ size_t curr_prefix_len = cp - curr_installdir;
++ char *curr_prefix;
++
++ curr_prefix = (char *) xmalloc (curr_prefix_len + 1);
++#ifdef NO_XMALLOC
++ if (curr_prefix == NULL)
++ return NULL;
++#endif
++ memcpy (curr_prefix, curr_installdir, curr_prefix_len);
++ curr_prefix[curr_prefix_len] = '\0';
++
++ return curr_prefix;
++ }
++ }
++}
++
++#endif /* !IN_LIBRARY || PIC */
++
++#if defined PIC && defined INSTALLDIR
++
++/* Full pathname of shared library, or NULL. */
++static char *shared_library_fullname;
++
++#if defined _WIN32 || defined __WIN32__
++
++/* Determine the full pathname of the shared library when it is loaded. */
++
++BOOL WINAPI
++DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
++{
++ (void) reserved;
++
++ if (event == DLL_PROCESS_ATTACH)
++ {
++ /* The DLL is being loaded into an application's address range. */
++ static char location[MAX_PATH];
++
++ if (!GetModuleFileName (module_handle, location, sizeof (location)))
++ /* Shouldn't happen. */
++ return FALSE;
++
++ if (!IS_PATH_WITH_DIR (location))
++ /* Shouldn't happen. */
++ return FALSE;
++
++ shared_library_fullname = strdup (location);
++ }
++
++ return TRUE;
++}
++
++#else /* Unix */
++
++static void
++find_shared_library_fullname ()
++{
++#if defined __linux__ && __GLIBC__ >= 2
++ /* Linux has /proc/self/maps. glibc 2 has the getline() function. */
++ FILE *fp;
++
++ /* Open the current process' maps file. It describes one VMA per line. */
++ fp = fopen ("/proc/self/maps", "r");
++ if (fp)
++ {
++ unsigned long address = (unsigned long) &find_shared_library_fullname;
++ for (;;)
++ {
++ unsigned long start, end;
++ int c;
++
++ if (fscanf (fp, "%lx-%lx", &start, &end) != 2)
++ break;
++ if (address >= start && address <= end - 1)
++ {
++ /* Found it. Now see if this line contains a filename. */
++ while (c = getc (fp), c != EOF && c != '\n' && c != '/')
++ continue;
++ if (c == '/')
++ {
++ size_t size;
++ int len;
++
++ ungetc (c, fp);
++ shared_library_fullname = NULL; size = 0;
++ len = getline (&shared_library_fullname, &size, fp);
++ if (len >= 0)
++ {
++ /* Success: filled shared_library_fullname. */
++ if (len > 0 && shared_library_fullname[len - 1] == '\n')
++ shared_library_fullname[len - 1] = '\0';
++ }
++ }
++ break;
++ }
++ while (c = getc (fp), c != EOF && c != '\n')
++ continue;
++ }
++ fclose (fp);
++ }
++#endif
++}
++
++#endif /* WIN32 / Unix */
++
++/* Return the full pathname of the current shared library.
++ Return NULL if unknown.
++ Guaranteed to work only on Linux and Woe32. */
++static char *
++get_shared_library_fullname ()
++{
++#if !(defined _WIN32 || defined __WIN32__)
++ static bool tried_find_shared_library_fullname;
++ if (!tried_find_shared_library_fullname)
++ {
++ find_shared_library_fullname ();
++ tried_find_shared_library_fullname = true;
++ }
++#endif
++ return shared_library_fullname;
++}
++
++#endif /* PIC */
++
++/* Returns the pathname, relocated according to the current installation
++ directory. */
++const char *
++relocate (const char *pathname)
++{
++#if defined PIC && defined INSTALLDIR
++ static int initialized;
++
++ /* Initialization code for a shared library. */
++ if (!initialized)
++ {
++ /* At this point, orig_prefix and curr_prefix likely have already been
++ set through the main program's set_program_name_and_installdir
++ function. This is sufficient in the case that the library has
++ initially been installed in the same orig_prefix. But we can do
++ better, to also cover the cases that 1. it has been installed
++ in a different prefix before being moved to orig_prefix and (later)
++ to curr_prefix, 2. unlike the program, it has not moved away from
++ orig_prefix. */
++ const char *orig_installprefix = INSTALLPREFIX;
++ const char *orig_installdir = INSTALLDIR;
++ const char *curr_prefix_better;
++
++ curr_prefix_better =
++ compute_curr_prefix (orig_installprefix, orig_installdir,
++ get_shared_library_fullname ());
++ if (curr_prefix_better == NULL)
++ curr_prefix_better = curr_prefix;
++
++ set_relocation_prefix (orig_installprefix, curr_prefix_better);
++
++ initialized = 1;
++ }
++#endif
++
++ /* Note: It is not necessary to perform case insensitive comparison here,
++ even for DOS-like filesystems, because the pathname argument was
++ typically created from the same Makefile variable as orig_prefix came
++ from. */
++ if (orig_prefix != NULL && curr_prefix != NULL
++ && strncmp (pathname, orig_prefix, orig_prefix_len) == 0)
++ {
++ if (pathname[orig_prefix_len] == '\0')
++ /* pathname equals orig_prefix. */
++ return curr_prefix;
++ if (ISSLASH (pathname[orig_prefix_len]))
++ {
++ /* pathname starts with orig_prefix. */
++ const char *pathname_tail = &pathname[orig_prefix_len];
++ char *result =
++ (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
++
++#ifdef NO_XMALLOC
++ if (result != NULL)
++#endif
++ {
++ memcpy (result, curr_prefix, curr_prefix_len);
++ strcpy (result + curr_prefix_len, pathname_tail);
++ return result;
++ }
++ }
++ }
++ /* Nothing to relocate. */
++ return pathname;
++}
++
++#endif
+--- lrzsz-0.12.20.safe/intl/relocatable.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/relocatable.h 2004-09-12 14:40:34.651703096 -0400
+@@ -0,0 +1,77 @@
++/* Provide relocatable packages.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ Written by Bruno Haible <bruno@clisp.org>, 2003.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _RELOCATABLE_H
++#define _RELOCATABLE_H
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++/* This can be enabled through the configure --enable-relocatable option. */
++#if ENABLE_RELOCATABLE
++
++/* When building a DLL, we must export some functions. Note that because
++ this is a private .h file, we don't need to use __declspec(dllimport)
++ in any case. */
++#if defined _MSC_VER && BUILDING_DLL
++# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
++#else
++# define RELOCATABLE_DLL_EXPORTED
++#endif
++
++/* Sets the original and the current installation prefix of the package.
++ Relocation simply replaces a pathname starting with the original prefix
++ by the corresponding pathname with the current prefix instead. Both
++ prefixes should be directory names without trailing slash (i.e. use ""
++ instead of "/"). */
++extern RELOCATABLE_DLL_EXPORTED void
++ set_relocation_prefix (const char *orig_prefix,
++ const char *curr_prefix);
++
++/* Returns the pathname, relocated according to the current installation
++ directory. */
++extern const char * relocate (const char *pathname);
++
++/* Memory management: relocate() leaks memory, because it has to construct
++ a fresh pathname. If this is a problem because your program calls
++ relocate() frequently, think about caching the result. */
++
++/* Convenience function:
++ Computes the current installation prefix, based on the original
++ installation prefix, the original installation directory of a particular
++ file, and the current pathname of this file. Returns NULL upon failure. */
++extern const char * compute_curr_prefix (const char *orig_installprefix,
++ const char *orig_installdir,
++ const char *curr_pathname);
++
++#else
++
++/* By default, we use the hardwired pathnames. */
++#define relocate(pathname) (pathname)
++
++#endif
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _RELOCATABLE_H */
+--- lrzsz-0.12.20.safe/intl/textdomain.c 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/textdomain.c 2004-09-12 14:40:34.656702336 -0400
+@@ -1,51 +1,60 @@
+-/* Implementation of the textdomain(3) function
+- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+- Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
++/* Implementation of the textdomain(3) function.
++ Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
+
+- This program is free software; you can redistribute it and/or modify
+- it under the terms of the GNU General Public License as published by
+- the Free Software Foundation; either version 2, or (at your option)
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- GNU General Public License for more details.
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software Foundation,
+- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+-#if defined STDC_HEADERS || defined _LIBC
+-# include <stdlib.h>
+-#endif
++#include <stdlib.h>
++#include <string.h>
+
+-#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
+-# include <string.h>
++#ifdef _LIBC
++# include <libintl.h>
+ #else
+-# include <strings.h>
+-# ifndef memcpy
+-# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+-# endif
++# include "libgnuintl.h"
+ #endif
++#include "gettextP.h"
+
+ #ifdef _LIBC
+-# include <libintl.h>
++/* We have to handle multi-threaded applications. */
++# include <bits/libc-lock.h>
+ #else
+-# include "libgettext.h"
++/* Provide dummy implementation if this is outside glibc. */
++# define __libc_rwlock_define(CLASS, NAME)
++# define __libc_rwlock_wrlock(NAME)
++# define __libc_rwlock_unlock(NAME)
++#endif
++
++/* The internal variables in the standalone libintl.a must have different
++ names than the internal variables in GNU libc, otherwise programs
++ using libintl.a cannot be linked statically. */
++#if !defined _LIBC
++# define _nl_default_default_domain libintl_nl_default_default_domain
++# define _nl_current_default_domain libintl_nl_current_default_domain
+ #endif
+
+ /* @@ end of prolog @@ */
+
+ /* Name of the default text domain. */
+-extern const char _nl_default_default_domain[];
++extern const char _nl_default_default_domain[] attribute_hidden;
+
+ /* Default text domain in which entries for gettext(3) are to be found. */
+-extern const char *_nl_current_default_domain;
++extern const char *_nl_current_default_domain attribute_hidden;
+
+
+ /* Names for the libintl functions are a problem. They must not clash
+@@ -54,50 +63,76 @@
+ prefix. So we have to make a difference here. */
+ #ifdef _LIBC
+ # define TEXTDOMAIN __textdomain
+-# define strdup(str) __strdup (str)
++# ifndef strdup
++# define strdup(str) __strdup (str)
++# endif
+ #else
+-# define TEXTDOMAIN textdomain__
++# define TEXTDOMAIN libintl_textdomain
+ #endif
+
++/* Lock variable to protect the global data in the gettext implementation. */
++__libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
++
+ /* Set the current default message catalog to DOMAINNAME.
+ If DOMAINNAME is null, return the current default.
+ If DOMAINNAME is "", reset to the default of "messages". */
+ char *
+-TEXTDOMAIN (domainname)
+- const char *domainname;
++TEXTDOMAIN (const char *domainname)
+ {
+- char *old;
++ char *new_domain;
++ char *old_domain;
+
+ /* A NULL pointer requests the current setting. */
+ if (domainname == NULL)
+ return (char *) _nl_current_default_domain;
+
+- old = (char *) _nl_current_default_domain;
++ __libc_rwlock_wrlock (_nl_state_lock);
++
++ old_domain = (char *) _nl_current_default_domain;
+
+ /* If domain name is the null string set to default domain "messages". */
+ if (domainname[0] == '\0'
+ || strcmp (domainname, _nl_default_default_domain) == 0)
+- _nl_current_default_domain = _nl_default_default_domain;
++ {
++ _nl_current_default_domain = _nl_default_default_domain;
++ new_domain = (char *) _nl_current_default_domain;
++ }
++ else if (strcmp (domainname, old_domain) == 0)
++ /* This can happen and people will use it to signal that some
++ environment variable changed. */
++ new_domain = old_domain;
+ else
+ {
+ /* If the following malloc fails `_nl_current_default_domain'
+ will be NULL. This value will be returned and so signals we
+ are out of core. */
+ #if defined _LIBC || defined HAVE_STRDUP
+- _nl_current_default_domain = strdup (domainname);
++ new_domain = strdup (domainname);
+ #else
+ size_t len = strlen (domainname) + 1;
+- char *cp = (char *) malloc (len);
+- if (cp != NULL)
+- memcpy (cp, domainname, len);
+- _nl_current_default_domain = cp;
++ new_domain = (char *) malloc (len);
++ if (new_domain != NULL)
++ memcpy (new_domain, domainname, len);
+ #endif
++
++ if (new_domain != NULL)
++ _nl_current_default_domain = new_domain;
+ }
+
+- if (old != _nl_default_default_domain)
+- free (old);
++ /* We use this possibility to signal a change of the loaded catalogs
++ since this is most likely the case and there is no other easy we
++ to do it. Do it only when the call was successful. */
++ if (new_domain != NULL)
++ {
++ ++_nl_msg_cat_cntr;
+
+- return (char *) _nl_current_default_domain;
++ if (old_domain != new_domain && old_domain != _nl_default_default_domain)
++ free (old_domain);
++ }
++
++ __libc_rwlock_unlock (_nl_state_lock);
++
++ return new_domain;
+ }
+
+ #ifdef _LIBC
+--- lrzsz-0.12.20.safe/intl/vasnprintf.c 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/vasnprintf.c 2004-09-12 14:40:34.662701424 -0400
+@@ -0,0 +1,887 @@
++/* vsprintf with automatic memory allocation.
++ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
++ This must come before <config.h> because <config.h> may include
++ <features.h>, and once <features.h> has been included, it's too late. */
++#ifndef _GNU_SOURCE
++# define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++#ifndef IN_LIBINTL
++# include <alloca.h>
++#endif
++
++/* Specification. */
++#if WIDE_CHAR_VERSION
++# include "vasnwprintf.h"
++#else
++# include "vasnprintf.h"
++#endif
++
++#include <stdio.h> /* snprintf(), sprintf() */
++#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
++#include <string.h> /* memcpy(), strlen() */
++#include <errno.h> /* errno */
++#include <limits.h> /* CHAR_BIT */
++#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
++#if WIDE_CHAR_VERSION
++# include "wprintf-parse.h"
++#else
++# include "printf-parse.h"
++#endif
++
++/* Checked size_t computations. */
++#include "xsize.h"
++
++#ifdef HAVE_WCHAR_T
++# ifdef HAVE_WCSLEN
++# define local_wcslen wcslen
++# else
++ /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
++ a dependency towards this library, here is a local substitute.
++ Define this substitute only once, even if this file is included
++ twice in the same compilation unit. */
++# ifndef local_wcslen_defined
++# define local_wcslen_defined 1
++static size_t
++local_wcslen (const wchar_t *s)
++{
++ const wchar_t *ptr;
++
++ for (ptr = s; *ptr != (wchar_t) 0; ptr++)
++ ;
++ return ptr - s;
++}
++# endif
++# endif
++#endif
++
++#if WIDE_CHAR_VERSION
++# define VASNPRINTF vasnwprintf
++# define CHAR_T wchar_t
++# define DIRECTIVE wchar_t_directive
++# define DIRECTIVES wchar_t_directives
++# define PRINTF_PARSE wprintf_parse
++# define USE_SNPRINTF 1
++# if HAVE_DECL__SNWPRINTF
++ /* On Windows, the function swprintf() has a different signature than
++ on Unix; we use the _snwprintf() function instead. */
++# define SNPRINTF _snwprintf
++# else
++ /* Unix. */
++# define SNPRINTF swprintf
++# endif
++#else
++# define VASNPRINTF vasnprintf
++# define CHAR_T char
++# define DIRECTIVE char_directive
++# define DIRECTIVES char_directives
++# define PRINTF_PARSE printf_parse
++# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF)
++# if HAVE_DECL__SNPRINTF
++ /* Windows. */
++# define SNPRINTF _snprintf
++# else
++ /* Unix. */
++# define SNPRINTF snprintf
++# endif
++#endif
++
++CHAR_T *
++VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args)
++{
++ DIRECTIVES d;
++ arguments a;
++
++ if (PRINTF_PARSE (format, &d, &a) < 0)
++ {
++ errno = EINVAL;
++ return NULL;
++ }
++
++#define CLEANUP() \
++ free (d.dir); \
++ if (a.arg) \
++ free (a.arg);
++
++ if (printf_fetchargs (args, &a) < 0)
++ {
++ CLEANUP ();
++ errno = EINVAL;
++ return NULL;
++ }
++
++ {
++ size_t buf_neededlength;
++ CHAR_T *buf;
++ CHAR_T *buf_malloced;
++ const CHAR_T *cp;
++ size_t i;
++ DIRECTIVE *dp;
++ /* Output string accumulator. */
++ CHAR_T *result;
++ size_t allocated;
++ size_t length;
++
++ /* Allocate a small buffer that will hold a directive passed to
++ sprintf or snprintf. */
++ buf_neededlength =
++ xsum4 (7, d.max_width_length, d.max_precision_length, 6);
++#if HAVE_ALLOCA
++ if (buf_neededlength < 4000 / sizeof (CHAR_T))
++ {
++ buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T));
++ buf_malloced = NULL;
++ }
++ else
++#endif
++ {
++ size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T));
++ if (size_overflow_p (buf_memsize))
++ goto out_of_memory_1;
++ buf = (CHAR_T *) malloc (buf_memsize);
++ if (buf == NULL)
++ goto out_of_memory_1;
++ buf_malloced = buf;
++ }
++
++ if (resultbuf != NULL)
++ {
++ result = resultbuf;
++ allocated = *lengthp;
++ }
++ else
++ {
++ result = NULL;
++ allocated = 0;
++ }
++ length = 0;
++ /* Invariants:
++ result is either == resultbuf or == NULL or malloc-allocated.
++ If length > 0, then result != NULL. */
++
++ /* Ensures that allocated >= needed. Aborts through a jump to
++ out_of_memory if needed is SIZE_MAX or otherwise too big. */
++#define ENSURE_ALLOCATION(needed) \
++ if ((needed) > allocated) \
++ { \
++ size_t memory_size; \
++ CHAR_T *memory; \
++ \
++ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \
++ if ((needed) > allocated) \
++ allocated = (needed); \
++ memory_size = xtimes (allocated, sizeof (CHAR_T)); \
++ if (size_overflow_p (memory_size)) \
++ goto out_of_memory; \
++ if (result == resultbuf || result == NULL) \
++ memory = (CHAR_T *) malloc (memory_size); \
++ else \
++ memory = (CHAR_T *) realloc (result, memory_size); \
++ if (memory == NULL) \
++ goto out_of_memory; \
++ if (result == resultbuf && length > 0) \
++ memcpy (memory, result, length * sizeof (CHAR_T)); \
++ result = memory; \
++ }
++
++ for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
++ {
++ if (cp != dp->dir_start)
++ {
++ size_t n = dp->dir_start - cp;
++ size_t augmented_length = xsum (length, n);
++
++ ENSURE_ALLOCATION (augmented_length);
++ memcpy (result + length, cp, n * sizeof (CHAR_T));
++ length = augmented_length;
++ }
++ if (i == d.count)
++ break;
++
++ /* Execute a single directive. */
++ if (dp->conversion == '%')
++ {
++ size_t augmented_length;
++
++ if (!(dp->arg_index == ARG_NONE))
++ abort ();
++ augmented_length = xsum (length, 1);
++ ENSURE_ALLOCATION (augmented_length);
++ result[length] = '%';
++ length = augmented_length;
++ }
++ else
++ {
++ if (!(dp->arg_index != ARG_NONE))
++ abort ();
++
++ if (dp->conversion == 'n')
++ {
++ switch (a.arg[dp->arg_index].type)
++ {
++ case TYPE_COUNT_SCHAR_POINTER:
++ *a.arg[dp->arg_index].a.a_count_schar_pointer = length;
++ break;
++ case TYPE_COUNT_SHORT_POINTER:
++ *a.arg[dp->arg_index].a.a_count_short_pointer = length;
++ break;
++ case TYPE_COUNT_INT_POINTER:
++ *a.arg[dp->arg_index].a.a_count_int_pointer = length;
++ break;
++ case TYPE_COUNT_LONGINT_POINTER:
++ *a.arg[dp->arg_index].a.a_count_longint_pointer = length;
++ break;
++#ifdef HAVE_LONG_LONG
++ case TYPE_COUNT_LONGLONGINT_POINTER:
++ *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
++ break;
++#endif
++ default:
++ abort ();
++ }
++ }
++ else
++ {
++ arg_type type = a.arg[dp->arg_index].type;
++ CHAR_T *p;
++ unsigned int prefix_count;
++ int prefixes[2];
++#if !USE_SNPRINTF
++ size_t tmp_length;
++ CHAR_T tmpbuf[700];
++ CHAR_T *tmp;
++
++ /* Allocate a temporary buffer of sufficient size for calling
++ sprintf. */
++ {
++ size_t width;
++ size_t precision;
++
++ width = 0;
++ if (dp->width_start != dp->width_end)
++ {
++ if (dp->width_arg_index != ARG_NONE)
++ {
++ int arg;
++
++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
++ abort ();
++ arg = a.arg[dp->width_arg_index].a.a_int;
++ width = (arg < 0 ? (unsigned int) (-arg) : arg);
++ }
++ else
++ {
++ const CHAR_T *digitp = dp->width_start;
++
++ do
++ width = xsum (xtimes (width, 10), *digitp++ - '0');
++ while (digitp != dp->width_end);
++ }
++ }
++
++ precision = 6;
++ if (dp->precision_start != dp->precision_end)
++ {
++ if (dp->precision_arg_index != ARG_NONE)
++ {
++ int arg;
++
++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
++ abort ();
++ arg = a.arg[dp->precision_arg_index].a.a_int;
++ precision = (arg < 0 ? 0 : arg);
++ }
++ else
++ {
++ const CHAR_T *digitp = dp->precision_start + 1;
++
++ precision = 0;
++ do
++ precision = xsum (xtimes (precision, 10), *digitp++ - '0');
++ while (digitp != dp->precision_end);
++ }
++ }
++
++ switch (dp->conversion)
++ {
++
++ case 'd': case 'i': case 'u':
++# ifdef HAVE_LONG_LONG
++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
++ * 0.30103 /* binary -> decimal */
++ * 2 /* estimate for FLAG_GROUP */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ else
++# endif
++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
++ * 0.30103 /* binary -> decimal */
++ * 2 /* estimate for FLAG_GROUP */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ else
++ tmp_length =
++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
++ * 0.30103 /* binary -> decimal */
++ * 2 /* estimate for FLAG_GROUP */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ break;
++
++ case 'o':
++# ifdef HAVE_LONG_LONG
++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
++ * 0.333334 /* binary -> octal */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ else
++# endif
++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
++ * 0.333334 /* binary -> octal */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ else
++ tmp_length =
++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
++ * 0.333334 /* binary -> octal */
++ )
++ + 1 /* turn floor into ceil */
++ + 1; /* account for leading sign */
++ break;
++
++ case 'x': case 'X':
++# ifdef HAVE_LONG_LONG
++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
++ * 0.25 /* binary -> hexadecimal */
++ )
++ + 1 /* turn floor into ceil */
++ + 2; /* account for leading sign or alternate form */
++ else
++# endif
++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
++ tmp_length =
++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT
++ * 0.25 /* binary -> hexadecimal */
++ )
++ + 1 /* turn floor into ceil */
++ + 2; /* account for leading sign or alternate form */
++ else
++ tmp_length =
++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT
++ * 0.25 /* binary -> hexadecimal */
++ )
++ + 1 /* turn floor into ceil */
++ + 2; /* account for leading sign or alternate form */
++ break;
++
++ case 'f': case 'F':
++# ifdef HAVE_LONG_DOUBLE
++ if (type == TYPE_LONGDOUBLE)
++ tmp_length =
++ (unsigned int) (LDBL_MAX_EXP
++ * 0.30103 /* binary -> decimal */
++ * 2 /* estimate for FLAG_GROUP */
++ )
++ + 1 /* turn floor into ceil */
++ + 10; /* sign, decimal point etc. */
++ else
++# endif
++ tmp_length =
++ (unsigned int) (DBL_MAX_EXP
++ * 0.30103 /* binary -> decimal */
++ * 2 /* estimate for FLAG_GROUP */
++ )
++ + 1 /* turn floor into ceil */
++ + 10; /* sign, decimal point etc. */
++ tmp_length = xsum (tmp_length, precision);
++ break;
++
++ case 'e': case 'E': case 'g': case 'G':
++ case 'a': case 'A':
++ tmp_length =
++ 12; /* sign, decimal point, exponent etc. */
++ tmp_length = xsum (tmp_length, precision);
++ break;
++
++ case 'c':
++# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION
++ if (type == TYPE_WIDE_CHAR)
++ tmp_length = MB_CUR_MAX;
++ else
++# endif
++ tmp_length = 1;
++ break;
++
++ case 's':
++# ifdef HAVE_WCHAR_T
++ if (type == TYPE_WIDE_STRING)
++ {
++ tmp_length =
++ local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
++
++# if !WIDE_CHAR_VERSION
++ tmp_length = xtimes (tmp_length, MB_CUR_MAX);
++# endif
++ }
++ else
++# endif
++ tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
++ break;
++
++ case 'p':
++ tmp_length =
++ (unsigned int) (sizeof (void *) * CHAR_BIT
++ * 0.25 /* binary -> hexadecimal */
++ )
++ + 1 /* turn floor into ceil */
++ + 2; /* account for leading 0x */
++ break;
++
++ default:
++ abort ();
++ }
++
++ if (tmp_length < width)
++ tmp_length = width;
++
++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
++ }
++
++ if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T))
++ tmp = tmpbuf;
++ else
++ {
++ size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T));
++
++ if (size_overflow_p (tmp_memsize))
++ /* Overflow, would lead to out of memory. */
++ goto out_of_memory;
++ tmp = (CHAR_T *) malloc (tmp_memsize);
++ if (tmp == NULL)
++ /* Out of memory. */
++ goto out_of_memory;
++ }
++#endif
++
++ /* Construct the format string for calling snprintf or
++ sprintf. */
++ p = buf;
++ *p++ = '%';
++ if (dp->flags & FLAG_GROUP)
++ *p++ = '\'';
++ if (dp->flags & FLAG_LEFT)
++ *p++ = '-';
++ if (dp->flags & FLAG_SHOWSIGN)
++ *p++ = '+';
++ if (dp->flags & FLAG_SPACE)
++ *p++ = ' ';
++ if (dp->flags & FLAG_ALT)
++ *p++ = '#';
++ if (dp->flags & FLAG_ZERO)
++ *p++ = '0';
++ if (dp->width_start != dp->width_end)
++ {
++ size_t n = dp->width_end - dp->width_start;
++ memcpy (p, dp->width_start, n * sizeof (CHAR_T));
++ p += n;
++ }
++ if (dp->precision_start != dp->precision_end)
++ {
++ size_t n = dp->precision_end - dp->precision_start;
++ memcpy (p, dp->precision_start, n * sizeof (CHAR_T));
++ p += n;
++ }
++
++ switch (type)
++ {
++#ifdef HAVE_LONG_LONG
++ case TYPE_LONGLONGINT:
++ case TYPE_ULONGLONGINT:
++ *p++ = 'l';
++ /*FALLTHROUGH*/
++#endif
++ case TYPE_LONGINT:
++ case TYPE_ULONGINT:
++#ifdef HAVE_WINT_T
++ case TYPE_WIDE_CHAR:
++#endif
++#ifdef HAVE_WCHAR_T
++ case TYPE_WIDE_STRING:
++#endif
++ *p++ = 'l';
++ break;
++#ifdef HAVE_LONG_DOUBLE
++ case TYPE_LONGDOUBLE:
++ *p++ = 'L';
++ break;
++#endif
++ default:
++ break;
++ }
++ *p = dp->conversion;
++#if USE_SNPRINTF
++ p[1] = '%';
++ p[2] = 'n';
++ p[3] = '\0';
++#else
++ p[1] = '\0';
++#endif
++
++ /* Construct the arguments for calling snprintf or sprintf. */
++ prefix_count = 0;
++ if (dp->width_arg_index != ARG_NONE)
++ {
++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
++ abort ();
++ prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
++ }
++ if (dp->precision_arg_index != ARG_NONE)
++ {
++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
++ abort ();
++ prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
++ }
++
++#if USE_SNPRINTF
++ /* Prepare checking whether snprintf returns the count
++ via %n. */
++ ENSURE_ALLOCATION (xsum (length, 1));
++ result[length] = '\0';
++#endif
++
++ for (;;)
++ {
++ size_t maxlen;
++ int count;
++ int retcount;
++
++ maxlen = allocated - length;
++ count = -1;
++ retcount = 0;
++
++#if USE_SNPRINTF
++# define SNPRINTF_BUF(arg) \
++ switch (prefix_count) \
++ { \
++ case 0: \
++ retcount = SNPRINTF (result + length, maxlen, buf, \
++ arg, &count); \
++ break; \
++ case 1: \
++ retcount = SNPRINTF (result + length, maxlen, buf, \
++ prefixes[0], arg, &count); \
++ break; \
++ case 2: \
++ retcount = SNPRINTF (result + length, maxlen, buf, \
++ prefixes[0], prefixes[1], arg, \
++ &count); \
++ break; \
++ default: \
++ abort (); \
++ }
++#else
++# define SNPRINTF_BUF(arg) \
++ switch (prefix_count) \
++ { \
++ case 0: \
++ count = sprintf (tmp, buf, arg); \
++ break; \
++ case 1: \
++ count = sprintf (tmp, buf, prefixes[0], arg); \
++ break; \
++ case 2: \
++ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
++ arg); \
++ break; \
++ default: \
++ abort (); \
++ }
++#endif
++
++ switch (type)
++ {
++ case TYPE_SCHAR:
++ {
++ int arg = a.arg[dp->arg_index].a.a_schar;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_UCHAR:
++ {
++ unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_SHORT:
++ {
++ int arg = a.arg[dp->arg_index].a.a_short;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_USHORT:
++ {
++ unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_INT:
++ {
++ int arg = a.arg[dp->arg_index].a.a_int;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_UINT:
++ {
++ unsigned int arg = a.arg[dp->arg_index].a.a_uint;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_LONGINT:
++ {
++ long int arg = a.arg[dp->arg_index].a.a_longint;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_ULONGINT:
++ {
++ unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#ifdef HAVE_LONG_LONG
++ case TYPE_LONGLONGINT:
++ {
++ long long int arg = a.arg[dp->arg_index].a.a_longlongint;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ case TYPE_ULONGLONGINT:
++ {
++ unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#endif
++ case TYPE_DOUBLE:
++ {
++ double arg = a.arg[dp->arg_index].a.a_double;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#ifdef HAVE_LONG_DOUBLE
++ case TYPE_LONGDOUBLE:
++ {
++ long double arg = a.arg[dp->arg_index].a.a_longdouble;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#endif
++ case TYPE_CHAR:
++ {
++ int arg = a.arg[dp->arg_index].a.a_char;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#ifdef HAVE_WINT_T
++ case TYPE_WIDE_CHAR:
++ {
++ wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#endif
++ case TYPE_STRING:
++ {
++ const char *arg = a.arg[dp->arg_index].a.a_string;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#ifdef HAVE_WCHAR_T
++ case TYPE_WIDE_STRING:
++ {
++ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++#endif
++ case TYPE_POINTER:
++ {
++ void *arg = a.arg[dp->arg_index].a.a_pointer;
++ SNPRINTF_BUF (arg);
++ }
++ break;
++ default:
++ abort ();
++ }
++
++#if USE_SNPRINTF
++ /* Portability: Not all implementations of snprintf()
++ are ISO C 99 compliant. Determine the number of
++ bytes that snprintf() has produced or would have
++ produced. */
++ if (count >= 0)
++ {
++ /* Verify that snprintf() has NUL-terminated its
++ result. */
++ if (count < maxlen && result[length + count] != '\0')
++ abort ();
++ /* Portability hack. */
++ if (retcount > count)
++ count = retcount;
++ }
++ else
++ {
++ /* snprintf() doesn't understand the '%n'
++ directive. */
++ if (p[1] != '\0')
++ {
++ /* Don't use the '%n' directive; instead, look
++ at the snprintf() return value. */
++ p[1] = '\0';
++ continue;
++ }
++ else
++ {
++ /* Look at the snprintf() return value. */
++ if (retcount < 0)
++ {
++ /* HP-UX 10.20 snprintf() is doubly deficient:
++ It doesn't understand the '%n' directive,
++ *and* it returns -1 (rather than the length
++ that would have been required) when the
++ buffer is too small. */
++ size_t bigger_need =
++ xsum (xtimes (allocated, 2), 12);
++ ENSURE_ALLOCATION (bigger_need);
++ continue;
++ }
++ else
++ count = retcount;
++ }
++ }
++#endif
++
++ /* Attempt to handle failure. */
++ if (count < 0)
++ {
++ if (!(result == resultbuf || result == NULL))
++ free (result);
++ if (buf_malloced != NULL)
++ free (buf_malloced);
++ CLEANUP ();
++ errno = EINVAL;
++ return NULL;
++ }
++
++#if !USE_SNPRINTF
++ if (count >= tmp_length)
++ /* tmp_length was incorrectly calculated - fix the
++ code above! */
++ abort ();
++#endif
++
++ /* Make room for the result. */
++ if (count >= maxlen)
++ {
++ /* Need at least count bytes. But allocate
++ proportionally, to avoid looping eternally if
++ snprintf() reports a too small count. */
++ size_t n =
++ xmax (xsum (length, count), xtimes (allocated, 2));
++
++ ENSURE_ALLOCATION (n);
++#if USE_SNPRINTF
++ continue;
++#endif
++ }
++
++#if USE_SNPRINTF
++ /* The snprintf() result did fit. */
++#else
++ /* Append the sprintf() result. */
++ memcpy (result + length, tmp, count * sizeof (CHAR_T));
++ if (tmp != tmpbuf)
++ free (tmp);
++#endif
++
++ length += count;
++ break;
++ }
++ }
++ }
++ }
++
++ /* Add the final NUL. */
++ ENSURE_ALLOCATION (xsum (length, 1));
++ result[length] = '\0';
++
++ if (result != resultbuf && length + 1 < allocated)
++ {
++ /* Shrink the allocated memory if possible. */
++ CHAR_T *memory;
++
++ memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T));
++ if (memory != NULL)
++ result = memory;
++ }
++
++ if (buf_malloced != NULL)
++ free (buf_malloced);
++ CLEANUP ();
++ *lengthp = length;
++ return result;
++
++ out_of_memory:
++ if (!(result == resultbuf || result == NULL))
++ free (result);
++ if (buf_malloced != NULL)
++ free (buf_malloced);
++ out_of_memory_1:
++ CLEANUP ();
++ errno = ENOMEM;
++ return NULL;
++ }
++}
++
++#undef SNPRINTF
++#undef USE_SNPRINTF
++#undef PRINTF_PARSE
++#undef DIRECTIVES
++#undef DIRECTIVE
++#undef CHAR_T
++#undef VASNPRINTF
+--- lrzsz-0.12.20.safe/intl/vasnprintf.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/vasnprintf.h 2004-09-12 14:40:34.667700664 -0400
+@@ -0,0 +1,61 @@
++/* vsprintf with automatic memory allocation.
++ Copyright (C) 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _VASNPRINTF_H
++#define _VASNPRINTF_H
++
++/* Get va_list. */
++#include <stdarg.h>
++
++/* Get size_t. */
++#include <stddef.h>
++
++#ifndef __attribute__
++/* This feature is available in gcc versions 2.5 and later. */
++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
++# define __attribute__(Spec) /* empty */
++# endif
++/* The __-protected variants of `format' and `printf' attributes
++ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
++# define __format__ format
++# define __printf__ printf
++# endif
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/* Write formatted output to a string dynamically allocated with malloc().
++ You can pass a preallocated buffer for the result in RESULTBUF and its
++ size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
++ If successful, return the address of the string (this may be = RESULTBUF
++ if no dynamic memory allocation was necessary) and set *LENGTHP to the
++ number of resulting bytes, excluding the trailing NUL. Upon error, set
++ errno and return NULL. */
++extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
++ __attribute__ ((__format__ (__printf__, 3, 4)));
++extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
++ __attribute__ ((__format__ (__printf__, 3, 0)));
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _VASNPRINTF_H */
+--- lrzsz-0.12.20.safe/intl/vasnwprintf.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/vasnwprintf.h 2004-09-12 14:40:34.673699752 -0400
+@@ -0,0 +1,46 @@
++/* vswprintf with automatic memory allocation.
++ Copyright (C) 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _VASNWPRINTF_H
++#define _VASNWPRINTF_H
++
++/* Get va_list. */
++#include <stdarg.h>
++
++/* Get wchar_t, size_t. */
++#include <stddef.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/* Write formatted output to a string dynamically allocated with malloc().
++ You can pass a preallocated buffer for the result in RESULTBUF and its
++ size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
++ If successful, return the address of the string (this may be = RESULTBUF
++ if no dynamic memory allocation was necessary) and set *LENGTHP to the
++ number of resulting bytes, excluding the trailing NUL. Upon error, set
++ errno and return NULL. */
++extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...);
++extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _VASNWPRINTF_H */
+--- lrzsz-0.12.20.safe/intl/VERSION 1998-04-26 09:22:37.000000000 -0400
++++ lrzsz-0.12.20/intl/VERSION 2004-09-12 14:40:34.679698840 -0400
+@@ -1 +1 @@
+-GNU gettext library from gettext-0.10.32
++GNU gettext library from gettext-0.14.1
+--- lrzsz-0.12.20.safe/intl/wprintf-parse.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/wprintf-parse.h 2004-09-12 14:40:34.695696408 -0400
+@@ -0,0 +1,75 @@
++/* Parse printf format string.
++ Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _WPRINTF_PARSE_H
++#define _WPRINTF_PARSE_H
++
++#include "printf-args.h"
++
++
++/* Flags */
++#define FLAG_GROUP 1 /* ' flag */
++#define FLAG_LEFT 2 /* - flag */
++#define FLAG_SHOWSIGN 4 /* + flag */
++#define FLAG_SPACE 8 /* space flag */
++#define FLAG_ALT 16 /* # flag */
++#define FLAG_ZERO 32
++
++/* arg_index value indicating that no argument is consumed. */
++#define ARG_NONE (~(size_t)0)
++
++/* A parsed directive. */
++typedef struct
++{
++ const wchar_t* dir_start;
++ const wchar_t* dir_end;
++ int flags;
++ const wchar_t* width_start;
++ const wchar_t* width_end;
++ size_t width_arg_index;
++ const wchar_t* precision_start;
++ const wchar_t* precision_end;
++ size_t precision_arg_index;
++ wchar_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */
++ size_t arg_index;
++}
++wchar_t_directive;
++
++/* A parsed format string. */
++typedef struct
++{
++ size_t count;
++ wchar_t_directive *dir;
++ size_t max_width_length;
++ size_t max_precision_length;
++}
++wchar_t_directives;
++
++
++/* Parses the format string. Fills in the number N of directives, and fills
++ in directives[0], ..., directives[N-1], and sets directives[N].dir_start
++ to the end of the format string. Also fills in the arg_type fields of the
++ arguments and the needed count of arguments. */
++#ifdef STATIC
++STATIC
++#else
++extern
++#endif
++int wprintf_parse (const wchar_t *format, wchar_t_directives *d, arguments *a);
++
++#endif /* _WPRINTF_PARSE_H */
+--- lrzsz-0.12.20.safe/intl/xopen-msg.sed 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/intl/xopen-msg.sed 1969-12-31 19:00:00.000000000 -0500
+@@ -1,104 +0,0 @@
+-# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
+-# Copyright (C) 1995 Free Software Foundation, Inc.
+-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+-#
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2, or (at your option)
+-# any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-#
+-#
+-# The first directive in the .msg should be the definition of the
+-# message set number. We use always set number 1.
+-#
+-1 {
+- i\
+-$set 1 # Automatically created by po2msg.sed
+- h
+- s/.*/0/
+- x
+-}
+-#
+-# We copy all comments into the .msg file. Perhaps they can help.
+-#
+-/^#/ s/^#[ ]*/$ /p
+-#
+-# We copy the original message as a comment into the .msg file.
+-#
+-/^msgid/ {
+-# Does not work now
+-# /"$/! {
+-# s/\\$//
+-# s/$/ ... (more lines following)"/
+-# }
+- s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
+- p
+-}
+-#
+-# The .msg file contains, other then the .po file, only the translations
+-# but each given a unique ID. Starting from 1 and incrementing by 1 for
+-# each message we assign them to the messages.
+-# It is important that the .po file used to generate the cat-id-tbl.c file
+-# (with po-to-tbl) is the same as the one used here. (At least the order
+-# of declarations must not be changed.)
+-#
+-/^msgstr/ {
+- s/msgstr[ ]*"\(.*\)"/\1/
+- x
+-# The following nice solution is by
+-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+- td
+-# Increment a decimal number in pattern space.
+-# First hide trailing `9' digits.
+- :d
+- s/9\(_*\)$/_\1/
+- td
+-# Assure at least one digit is available.
+- s/^\(_*\)$/0\1/
+-# Increment the last digit.
+- s/8\(_*\)$/9\1/
+- s/7\(_*\)$/8\1/
+- s/6\(_*\)$/7\1/
+- s/5\(_*\)$/6\1/
+- s/4\(_*\)$/5\1/
+- s/3\(_*\)$/4\1/
+- s/2\(_*\)$/3\1/
+- s/1\(_*\)$/2\1/
+- s/0\(_*\)$/1\1/
+-# Convert the hidden `9' digits to `0's.
+- s/_/0/g
+- x
+-# Bring the line in the format `<number> <message>'
+- G
+- s/^[^\n]*$/& /
+- s/\(.*\)\n\([0-9]*\)/\2 \1/
+-# Clear flag from last substitution.
+- tb
+-# Append the next line.
+- :b
+- N
+-# Look whether second part is a continuation line.
+- s/\(.*\n\)"\(.*\)"/\1\2/
+-# Yes, then branch.
+- ta
+- P
+- D
+-# Note that `D' includes a jump to the start!!
+-# We found a continuation line. But before printing insert '\'.
+- :a
+- s/\(.*\)\(\n.*\)/\1\\\2/
+- P
+-# We cannot use the sed command `D' here
+- s/.*\n\(.*\)/\1/
+- tb
+-}
+-d
+--- lrzsz-0.12.20.safe/intl/xsize.h 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/intl/xsize.h 2004-09-12 14:40:34.700695648 -0400
+@@ -0,0 +1,109 @@
++/* xsize.h -- Checked size_t computations.
++
++ Copyright (C) 2003 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Library General Public License as published
++ by the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public
++ License along with this program; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++#ifndef _XSIZE_H
++#define _XSIZE_H
++
++/* Get size_t. */
++#include <stddef.h>
++
++/* Get SIZE_MAX. */
++#include <limits.h>
++#if HAVE_STDINT_H
++# include <stdint.h>
++#endif
++
++/* The size of memory objects is often computed through expressions of
++ type size_t. Example:
++ void* p = malloc (header_size + n * element_size).
++ These computations can lead to overflow. When this happens, malloc()
++ returns a piece of memory that is way too small, and the program then
++ crashes while attempting to fill the memory.
++ To avoid this, the functions and macros in this file check for overflow.
++ The convention is that SIZE_MAX represents overflow.
++ malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc
++ implementation that uses mmap --, it's recommended to use size_overflow_p()
++ or size_in_bounds_p() before invoking malloc().
++ The example thus becomes:
++ size_t size = xsum (header_size, xtimes (n, element_size));
++ void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
++*/
++
++/* Convert an arbitrary value >= 0 to type size_t. */
++#define xcast_size_t(N) \
++ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
++
++/* Sum of two sizes, with overflow check. */
++static inline size_t
++#if __GNUC__ >= 3
++__attribute__ ((__pure__))
++#endif
++xsum (size_t size1, size_t size2)
++{
++ size_t sum = size1 + size2;
++ return (sum >= size1 ? sum : SIZE_MAX);
++}
++
++/* Sum of three sizes, with overflow check. */
++static inline size_t
++#if __GNUC__ >= 3
++__attribute__ ((__pure__))
++#endif
++xsum3 (size_t size1, size_t size2, size_t size3)
++{
++ return xsum (xsum (size1, size2), size3);
++}
++
++/* Sum of four sizes, with overflow check. */
++static inline size_t
++#if __GNUC__ >= 3
++__attribute__ ((__pure__))
++#endif
++xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
++{
++ return xsum (xsum (xsum (size1, size2), size3), size4);
++}
++
++/* Maximum of two sizes, with overflow check. */
++static inline size_t
++#if __GNUC__ >= 3
++__attribute__ ((__pure__))
++#endif
++xmax (size_t size1, size_t size2)
++{
++ /* No explicit check is needed here, because for any n:
++ max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */
++ return (size1 >= size2 ? size1 : size2);
++}
++
++/* Multiplication of a count with an element size, with overflow check.
++ The count must be >= 0 and the element size must be > 0.
++ This is a macro, not an inline function, so that it works correctly even
++ when N is of a wider tupe and N > SIZE_MAX. */
++#define xtimes(N, ELSIZE) \
++ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
++
++/* Check for overflow. */
++#define size_overflow_p(SIZE) \
++ ((SIZE) == SIZE_MAX)
++/* Check against overflow. */
++#define size_in_bounds_p(SIZE) \
++ ((SIZE) != SIZE_MAX)
++
++#endif /* _XSIZE_H */
+--- lrzsz-0.12.20.safe/m4/ChangeLog 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/ChangeLog 2004-09-12 14:40:35.054641840 -0400
+@@ -0,0 +1,32 @@
++2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
++
++ * codeset.m4: New file, from gettext-0.14.1.
++ * gettext.m4: New file, from gettext-0.14.1.
++ * glibc21.m4: New file, from gettext-0.14.1.
++ * iconv.m4: New file, from gettext-0.14.1.
++ * intdiv0.m4: New file, from gettext-0.14.1.
++ * intmax.m4: New file, from gettext-0.14.1.
++ * inttypes.m4: New file, from gettext-0.14.1.
++ * inttypes_h.m4: New file, from gettext-0.14.1.
++ * inttypes-pri.m4: New file, from gettext-0.14.1.
++ * isc-posix.m4: New file, from gettext-0.14.1.
++ * lcmessage.m4: New file, from gettext-0.14.1.
++ * lib-ld.m4: New file, from gettext-0.14.1.
++ * lib-link.m4: New file, from gettext-0.14.1.
++ * lib-prefix.m4: New file, from gettext-0.14.1.
++ * longdouble.m4: New file, from gettext-0.14.1.
++ * longlong.m4: New file, from gettext-0.14.1.
++ * nls.m4: New file, from gettext-0.14.1.
++ * po.m4: New file, from gettext-0.14.1.
++ * printf-posix.m4: New file, from gettext-0.14.1.
++ * progtest.m4: New file, from gettext-0.14.1.
++ * signed.m4: New file, from gettext-0.14.1.
++ * size_max.m4: New file, from gettext-0.14.1.
++ * stdint_h.m4: New file, from gettext-0.14.1.
++ * uintmax_t.m4: New file, from gettext-0.14.1.
++ * ulonglong.m4: New file, from gettext-0.14.1.
++ * wchar_t.m4: New file, from gettext-0.14.1.
++ * wint_t.m4: New file, from gettext-0.14.1.
++ * xsize.m4: New file, from gettext-0.14.1.
++ * Makefile.am: New file.
++
+--- lrzsz-0.12.20.safe/m4/codeset.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/codeset.m4 2004-09-12 14:40:34.820677408 -0400
+@@ -0,0 +1,23 @@
++# codeset.m4 serial AM1 (gettext-0.10.40)
++dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++AC_DEFUN([AM_LANGINFO_CODESET],
++[
++ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
++ [AC_TRY_LINK([#include <langinfo.h>],
++ [char* cs = nl_langinfo(CODESET);],
++ am_cv_langinfo_codeset=yes,
++ am_cv_langinfo_codeset=no)
++ ])
++ if test $am_cv_langinfo_codeset = yes; then
++ AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
++ [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/gettext.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/gettext.m4 2004-09-12 14:40:34.826676496 -0400
+@@ -0,0 +1,487 @@
++# gettext.m4 serial 28 (gettext-0.13)
++dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++dnl
++dnl This file can can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Library General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Library General Public License, and the rest of the GNU
++dnl gettext package package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Authors:
++dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
++dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
++
++dnl Macro to add for using GNU gettext.
++
++dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
++dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
++dnl default (if it is not specified or empty) is 'no-libtool'.
++dnl INTLSYMBOL should be 'external' for packages with no intl directory,
++dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
++dnl If INTLSYMBOL is 'use-libtool', then a libtool library
++dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
++dnl depending on --{enable,disable}-{shared,static} and on the presence of
++dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
++dnl $(top_builddir)/intl/libintl.a will be created.
++dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
++dnl implementations (in libc or libintl) without the ngettext() function
++dnl will be ignored. If NEEDSYMBOL is specified and is
++dnl 'need-formatstring-macros', then GNU gettext implementations that don't
++dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
++dnl INTLDIR is used to find the intl libraries. If empty,
++dnl the value `$(top_builddir)/intl/' is used.
++dnl
++dnl The result of the configuration is one of three cases:
++dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
++dnl and used.
++dnl Catalog format: GNU --> install in $(datadir)
++dnl Catalog extension: .mo after installation, .gmo in source tree
++dnl 2) GNU gettext has been found in the system's C library.
++dnl Catalog format: GNU --> install in $(datadir)
++dnl Catalog extension: .mo after installation, .gmo in source tree
++dnl 3) No internationalization, always use English msgid.
++dnl Catalog format: none
++dnl Catalog extension: none
++dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
++dnl The use of .gmo is historical (it was needed to avoid overwriting the
++dnl GNU format catalogs when building on a platform with an X/Open gettext),
++dnl but we keep it in order not to force irrelevant filename changes on the
++dnl maintainers.
++dnl
++AC_DEFUN([AM_GNU_GETTEXT],
++[
++ dnl Argument checking.
++ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
++ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
++])])])])])
++ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
++ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
++])])])])
++ define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
++ define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
++
++ AC_REQUIRE([AM_PO_SUBDIRS])dnl
++ ifelse(gt_included_intl, yes, [
++ AC_REQUIRE([AM_INTL_SUBDIR])dnl
++ ])
++
++ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
++ AC_REQUIRE([AC_LIB_RPATH])
++
++ dnl Sometimes libintl requires libiconv, so first search for libiconv.
++ dnl Ideally we would do this search only after the
++ dnl if test "$USE_NLS" = "yes"; then
++ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
++ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
++ dnl the configure script would need to contain the same shell code
++ dnl again, outside any 'if'. There are two solutions:
++ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
++ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
++ dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
++ dnl documented, we avoid it.
++ ifelse(gt_included_intl, yes, , [
++ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
++ ])
++
++ dnl Set USE_NLS.
++ AM_NLS
++
++ ifelse(gt_included_intl, yes, [
++ BUILD_INCLUDED_LIBINTL=no
++ USE_INCLUDED_LIBINTL=no
++ ])
++ LIBINTL=
++ LTLIBINTL=
++ POSUB=
++
++ dnl If we use NLS figure out what method
++ if test "$USE_NLS" = "yes"; then
++ gt_use_preinstalled_gnugettext=no
++ ifelse(gt_included_intl, yes, [
++ AC_MSG_CHECKING([whether included gettext is requested])
++ AC_ARG_WITH(included-gettext,
++ [ --with-included-gettext use the GNU gettext library included here],
++ nls_cv_force_use_gnu_gettext=$withval,
++ nls_cv_force_use_gnu_gettext=no)
++ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
++
++ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
++ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
++ ])
++ dnl User does not insist on using GNU NLS library. Figure out what
++ dnl to use. If GNU gettext is available we use this. Else we have
++ dnl to fall back to GNU NLS library.
++
++ dnl Add a version number to the cache macros.
++ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
++ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
++ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
++
++ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
++ [AC_TRY_LINK([#include <libintl.h>
++]ifelse([$2], [need-formatstring-macros],
++[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
++#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
++#endif
++changequote(,)dnl
++typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
++changequote([,])dnl
++], [])[extern int _nl_msg_cat_cntr;
++extern int *_nl_domain_bindings;],
++ [bindtextdomain ("", "");
++return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
++ gt_cv_func_gnugettext_libc=yes,
++ gt_cv_func_gnugettext_libc=no)])
++
++ if test "$gt_cv_func_gnugettext_libc" != "yes"; then
++ dnl Sometimes libintl requires libiconv, so first search for libiconv.
++ ifelse(gt_included_intl, yes, , [
++ AM_ICONV_LINK
++ ])
++ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
++ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
++ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
++ dnl even if libiconv doesn't exist.
++ AC_LIB_LINKFLAGS_BODY([intl])
++ AC_CACHE_CHECK([for GNU gettext in libintl],
++ gt_cv_func_gnugettext_libintl,
++ [gt_save_CPPFLAGS="$CPPFLAGS"
++ CPPFLAGS="$CPPFLAGS $INCINTL"
++ gt_save_LIBS="$LIBS"
++ LIBS="$LIBS $LIBINTL"
++ dnl Now see whether libintl exists and does not depend on libiconv.
++ AC_TRY_LINK([#include <libintl.h>
++]ifelse([$2], [need-formatstring-macros],
++[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
++#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
++#endif
++changequote(,)dnl
++typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
++changequote([,])dnl
++], [])[extern int _nl_msg_cat_cntr;
++extern
++#ifdef __cplusplus
++"C"
++#endif
++const char *_nl_expand_alias ();],
++ [bindtextdomain ("", "");
++return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
++ gt_cv_func_gnugettext_libintl=yes,
++ gt_cv_func_gnugettext_libintl=no)
++ dnl Now see whether libintl exists and depends on libiconv.
++ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
++ LIBS="$LIBS $LIBICONV"
++ AC_TRY_LINK([#include <libintl.h>
++]ifelse([$2], [need-formatstring-macros],
++[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
++#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
++#endif
++changequote(,)dnl
++typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
++changequote([,])dnl
++], [])[extern int _nl_msg_cat_cntr;
++extern
++#ifdef __cplusplus
++"C"
++#endif
++const char *_nl_expand_alias ();],
++ [bindtextdomain ("", "");
++return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
++ [LIBINTL="$LIBINTL $LIBICONV"
++ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
++ gt_cv_func_gnugettext_libintl=yes
++ ])
++ fi
++ CPPFLAGS="$gt_save_CPPFLAGS"
++ LIBS="$gt_save_LIBS"])
++ fi
++
++ dnl If an already present or preinstalled GNU gettext() is found,
++ dnl use it. But if this macro is used in GNU gettext, and GNU
++ dnl gettext is already preinstalled in libintl, we update this
++ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
++ if test "$gt_cv_func_gnugettext_libc" = "yes" \
++ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
++ && test "$PACKAGE" != gettext-runtime \
++ && test "$PACKAGE" != gettext-tools; }; then
++ gt_use_preinstalled_gnugettext=yes
++ else
++ dnl Reset the values set by searching for libintl.
++ LIBINTL=
++ LTLIBINTL=
++ INCINTL=
++ fi
++
++ ifelse(gt_included_intl, yes, [
++ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
++ dnl GNU gettext is not found in the C library.
++ dnl Fall back on included GNU gettext library.
++ nls_cv_use_gnu_gettext=yes
++ fi
++ fi
++
++ if test "$nls_cv_use_gnu_gettext" = "yes"; then
++ dnl Mark actions used to generate GNU NLS library.
++ BUILD_INCLUDED_LIBINTL=yes
++ USE_INCLUDED_LIBINTL=yes
++ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
++ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
++ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
++ fi
++
++ if test "$gt_use_preinstalled_gnugettext" = "yes" \
++ || test "$nls_cv_use_gnu_gettext" = "yes"; then
++ dnl Mark actions to use GNU gettext tools.
++ CATOBJEXT=.gmo
++ fi
++ ])
++
++ if test "$gt_use_preinstalled_gnugettext" = "yes" \
++ || test "$nls_cv_use_gnu_gettext" = "yes"; then
++ AC_DEFINE(ENABLE_NLS, 1,
++ [Define to 1 if translation of program messages to the user's native language
++ is requested.])
++ else
++ USE_NLS=no
++ fi
++ fi
++
++ AC_MSG_CHECKING([whether to use NLS])
++ AC_MSG_RESULT([$USE_NLS])
++ if test "$USE_NLS" = "yes"; then
++ AC_MSG_CHECKING([where the gettext function comes from])
++ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
++ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
++ gt_source="external libintl"
++ else
++ gt_source="libc"
++ fi
++ else
++ gt_source="included intl directory"
++ fi
++ AC_MSG_RESULT([$gt_source])
++ fi
++
++ if test "$USE_NLS" = "yes"; then
++
++ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
++ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
++ AC_MSG_CHECKING([how to link with libintl])
++ AC_MSG_RESULT([$LIBINTL])
++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
++ fi
++
++ dnl For backward compatibility. Some packages may be using this.
++ AC_DEFINE(HAVE_GETTEXT, 1,
++ [Define if the GNU gettext() function is already present or preinstalled.])
++ AC_DEFINE(HAVE_DCGETTEXT, 1,
++ [Define if the GNU dcgettext() function is already present or preinstalled.])
++ fi
++
++ dnl We need to process the po/ directory.
++ POSUB=po
++ fi
++
++ ifelse(gt_included_intl, yes, [
++ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
++ dnl to 'yes' because some of the testsuite requires it.
++ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
++ BUILD_INCLUDED_LIBINTL=yes
++ fi
++
++ dnl Make all variables we use known to autoconf.
++ AC_SUBST(BUILD_INCLUDED_LIBINTL)
++ AC_SUBST(USE_INCLUDED_LIBINTL)
++ AC_SUBST(CATOBJEXT)
++
++ dnl For backward compatibility. Some configure.ins may be using this.
++ nls_cv_header_intl=
++ nls_cv_header_libgt=
++
++ dnl For backward compatibility. Some Makefiles may be using this.
++ DATADIRNAME=share
++ AC_SUBST(DATADIRNAME)
++
++ dnl For backward compatibility. Some Makefiles may be using this.
++ INSTOBJEXT=.mo
++ AC_SUBST(INSTOBJEXT)
++
++ dnl For backward compatibility. Some Makefiles may be using this.
++ GENCAT=gencat
++ AC_SUBST(GENCAT)
++
++ dnl For backward compatibility. Some Makefiles may be using this.
++ if test "$USE_INCLUDED_LIBINTL" = yes; then
++ INTLOBJS="\$(GETTOBJS)"
++ fi
++ AC_SUBST(INTLOBJS)
++
++ dnl Enable libtool support if the surrounding package wishes it.
++ INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
++ AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
++ ])
++
++ dnl For backward compatibility. Some Makefiles may be using this.
++ INTLLIBS="$LIBINTL"
++ AC_SUBST(INTLLIBS)
++
++ dnl Make all documented variables known to autoconf.
++ AC_SUBST(LIBINTL)
++ AC_SUBST(LTLIBINTL)
++ AC_SUBST(POSUB)
++])
++
++
++dnl Checks for all prerequisites of the intl subdirectory,
++dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
++dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
++AC_DEFUN([AM_INTL_SUBDIR],
++[
++ AC_REQUIRE([AC_PROG_INSTALL])dnl
++ AC_REQUIRE([AM_MKINSTALLDIRS])dnl
++ AC_REQUIRE([AC_PROG_CC])dnl
++ AC_REQUIRE([AC_CANONICAL_HOST])dnl
++ AC_REQUIRE([AC_PROG_RANLIB])dnl
++ AC_REQUIRE([AC_ISC_POSIX])dnl
++ AC_REQUIRE([AC_HEADER_STDC])dnl
++ AC_REQUIRE([AC_C_CONST])dnl
++ AC_REQUIRE([bh_C_SIGNED])dnl
++ AC_REQUIRE([AC_C_INLINE])dnl
++ AC_REQUIRE([AC_TYPE_OFF_T])dnl
++ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
++ AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl
++ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
++ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
++ AC_REQUIRE([gt_TYPE_WINT_T])dnl
++ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
++ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
++ AC_REQUIRE([gt_TYPE_INTMAX_T])
++ AC_REQUIRE([gt_PRINTF_POSIX])
++ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
++ AC_REQUIRE([AC_FUNC_MMAP])dnl
++ AC_REQUIRE([jm_GLIBC21])dnl
++ AC_REQUIRE([gt_INTDIV0])dnl
++ AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
++ AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
++ AC_REQUIRE([gt_INTTYPES_PRI])dnl
++ AC_REQUIRE([gl_XSIZE])dnl
++
++ AC_CHECK_TYPE([ptrdiff_t], ,
++ [AC_DEFINE([ptrdiff_t], [long],
++ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
++ ])
++ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
++stdlib.h string.h unistd.h sys/param.h])
++ AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
++mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
++strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
++__fsetlocking])
++
++ dnl Use the _snprintf function only if it is declared (because on NetBSD it
++ dnl is defined as a weak alias of snprintf; we prefer to use the latter).
++ gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
++ gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
++
++ dnl Use the *_unlocked functions only if they are declared.
++ dnl (because some of them were defined without being declared in Solaris
++ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
++ dnl on Solaris 2.5.1 to run on Solaris 2.6).
++ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
++ gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
++ gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
++ gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
++
++ case $gt_cv_func_printf_posix in
++ *yes) HAVE_POSIX_PRINTF=1 ;;
++ *) HAVE_POSIX_PRINTF=0 ;;
++ esac
++ AC_SUBST([HAVE_POSIX_PRINTF])
++ if test "$ac_cv_func_asprintf" = yes; then
++ HAVE_ASPRINTF=1
++ else
++ HAVE_ASPRINTF=0
++ fi
++ AC_SUBST([HAVE_ASPRINTF])
++ if test "$ac_cv_func_snprintf" = yes; then
++ HAVE_SNPRINTF=1
++ else
++ HAVE_SNPRINTF=0
++ fi
++ AC_SUBST([HAVE_SNPRINTF])
++ if test "$ac_cv_func_wprintf" = yes; then
++ HAVE_WPRINTF=1
++ else
++ HAVE_WPRINTF=0
++ fi
++ AC_SUBST([HAVE_WPRINTF])
++
++ AM_ICONV
++ AM_LANGINFO_CODESET
++ if test $ac_cv_header_locale_h = yes; then
++ AM_LC_MESSAGES
++ fi
++
++ dnl intl/plural.c is generated from intl/plural.y. It requires bison,
++ dnl because plural.y uses bison specific features. It requires at least
++ dnl bison-1.26 because earlier versions generate a plural.c that doesn't
++ dnl compile.
++ dnl bison is only needed for the maintainer (who touches plural.y). But in
++ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
++ dnl the rule in general Makefile. Now, some people carelessly touch the
++ dnl files or have a broken "make" program, hence the plural.c rule will
++ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
++ dnl present or too old.
++ AC_CHECK_PROGS([INTLBISON], [bison])
++ if test -z "$INTLBISON"; then
++ ac_verc_fail=yes
++ else
++ dnl Found it, now check the version.
++ AC_MSG_CHECKING([version of bison])
++changequote(<<,>>)dnl
++ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
++ case $ac_prog_version in
++ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
++ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
++changequote([,])dnl
++ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
++ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
++ esac
++ AC_MSG_RESULT([$ac_prog_version])
++ fi
++ if test $ac_verc_fail = yes; then
++ INTLBISON=:
++ fi
++])
++
++
++dnl gt_CHECK_DECL(FUNC, INCLUDES)
++dnl Check whether a function is declared.
++AC_DEFUN([gt_CHECK_DECL],
++[
++ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
++ [AC_TRY_COMPILE([$2], [
++#ifndef $1
++ char *p = (char *) $1;
++#endif
++], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
++ if test $ac_cv_have_decl_$1 = yes; then
++ gt_value=1
++ else
++ gt_value=0
++ fi
++ AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
++ [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
++])
++
++
++dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
++AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
+--- lrzsz-0.12.20.safe/m4/glibc21.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/glibc21.m4 2004-09-12 14:40:34.833675432 -0400
+@@ -0,0 +1,32 @@
++# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
++dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++# Test for the GNU C Library, version 2.1 or newer.
++# From Bruno Haible.
++
++AC_DEFUN([jm_GLIBC21],
++ [
++ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
++ ac_cv_gnu_library_2_1,
++ [AC_EGREP_CPP([Lucky GNU user],
++ [
++#include <features.h>
++#ifdef __GNU_LIBRARY__
++ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
++ Lucky GNU user
++ #endif
++#endif
++ ],
++ ac_cv_gnu_library_2_1=yes,
++ ac_cv_gnu_library_2_1=no)
++ ]
++ )
++ AC_SUBST(GLIBC21)
++ GLIBC21="$ac_cv_gnu_library_2_1"
++ ]
++)
+--- lrzsz-0.12.20.safe/m4/iconv.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/iconv.m4 2004-09-12 14:40:34.839674520 -0400
+@@ -0,0 +1,103 @@
++# iconv.m4 serial AM4 (gettext-0.11.3)
++dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
++[
++ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
++ AC_REQUIRE([AC_LIB_RPATH])
++
++ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
++ dnl accordingly.
++ AC_LIB_LINKFLAGS_BODY([iconv])
++])
++
++AC_DEFUN([AM_ICONV_LINK],
++[
++ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
++ dnl those with the standalone portable GNU libiconv installed).
++
++ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
++ dnl accordingly.
++ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
++
++ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
++ dnl because if the user has installed libiconv and not disabled its use
++ dnl via --without-libiconv-prefix, he wants to use it. The first
++ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
++ am_save_CPPFLAGS="$CPPFLAGS"
++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
++
++ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
++ am_cv_func_iconv="no, consider installing GNU libiconv"
++ am_cv_lib_iconv=no
++ AC_TRY_LINK([#include <stdlib.h>
++#include <iconv.h>],
++ [iconv_t cd = iconv_open("","");
++ iconv(cd,NULL,NULL,NULL,NULL);
++ iconv_close(cd);],
++ am_cv_func_iconv=yes)
++ if test "$am_cv_func_iconv" != yes; then
++ am_save_LIBS="$LIBS"
++ LIBS="$LIBS $LIBICONV"
++ AC_TRY_LINK([#include <stdlib.h>
++#include <iconv.h>],
++ [iconv_t cd = iconv_open("","");
++ iconv(cd,NULL,NULL,NULL,NULL);
++ iconv_close(cd);],
++ am_cv_lib_iconv=yes
++ am_cv_func_iconv=yes)
++ LIBS="$am_save_LIBS"
++ fi
++ ])
++ if test "$am_cv_func_iconv" = yes; then
++ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
++ fi
++ if test "$am_cv_lib_iconv" = yes; then
++ AC_MSG_CHECKING([how to link with libiconv])
++ AC_MSG_RESULT([$LIBICONV])
++ else
++ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
++ dnl either.
++ CPPFLAGS="$am_save_CPPFLAGS"
++ LIBICONV=
++ LTLIBICONV=
++ fi
++ AC_SUBST(LIBICONV)
++ AC_SUBST(LTLIBICONV)
++])
++
++AC_DEFUN([AM_ICONV],
++[
++ AM_ICONV_LINK
++ if test "$am_cv_func_iconv" = yes; then
++ AC_MSG_CHECKING([for iconv declaration])
++ AC_CACHE_VAL(am_cv_proto_iconv, [
++ AC_TRY_COMPILE([
++#include <stdlib.h>
++#include <iconv.h>
++extern
++#ifdef __cplusplus
++"C"
++#endif
++#if defined(__STDC__) || defined(__cplusplus)
++size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
++#else
++size_t iconv();
++#endif
++], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
++ 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);"])
++ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
++ AC_MSG_RESULT([$]{ac_t:-
++ }[$]am_cv_proto_iconv)
++ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
++ [Define as const if the declaration of iconv() needs const.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/intdiv0.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/intdiv0.m4 2004-09-12 14:40:34.845673608 -0400
+@@ -0,0 +1,72 @@
++# intdiv0.m4 serial 1 (gettext-0.11.3)
++dnl Copyright (C) 2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++AC_DEFUN([gt_INTDIV0],
++[
++ AC_REQUIRE([AC_PROG_CC])dnl
++ AC_REQUIRE([AC_CANONICAL_HOST])dnl
++
++ AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
++ gt_cv_int_divbyzero_sigfpe,
++ [
++ AC_TRY_RUN([
++#include <stdlib.h>
++#include <signal.h>
++
++static void
++#ifdef __cplusplus
++sigfpe_handler (int sig)
++#else
++sigfpe_handler (sig) int sig;
++#endif
++{
++ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
++ exit (sig != SIGFPE);
++}
++
++int x = 1;
++int y = 0;
++int z;
++int nan;
++
++int main ()
++{
++ signal (SIGFPE, sigfpe_handler);
++/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
++#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
++ signal (SIGTRAP, sigfpe_handler);
++#endif
++/* Linux/SPARC yields signal SIGILL. */
++#if defined (__sparc__) && defined (__linux__)
++ signal (SIGILL, sigfpe_handler);
++#endif
++
++ z = x / y;
++ nan = y / y;
++ exit (1);
++}
++], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
++ [
++ # Guess based on the CPU.
++ case "$host_cpu" in
++ alpha* | i[34567]86 | m68k | s390*)
++ gt_cv_int_divbyzero_sigfpe="guessing yes";;
++ *)
++ gt_cv_int_divbyzero_sigfpe="guessing no";;
++ esac
++ ])
++ ])
++ case "$gt_cv_int_divbyzero_sigfpe" in
++ *yes) value=1;;
++ *) value=0;;
++ esac
++ AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
++ [Define if integer division by zero raises signal SIGFPE.])
++])
+--- lrzsz-0.12.20.safe/m4/intmax.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/intmax.m4 2004-09-12 14:40:34.855672088 -0400
+@@ -0,0 +1,32 @@
++# intmax.m4 serial 1 (gettext-0.12)
++dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++dnl Test whether the system has the 'intmax_t' type, but don't attempt to
++dnl find a replacement if it is lacking.
++
++AC_DEFUN([gt_TYPE_INTMAX_T],
++[
++ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
++ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
++ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
++ [AC_TRY_COMPILE([
++#include <stddef.h>
++#include <stdlib.h>
++#if HAVE_STDINT_H_WITH_UINTMAX
++#include <stdint.h>
++#endif
++#if HAVE_INTTYPES_H_WITH_UINTMAX
++#include <inttypes.h>
++#endif
++], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
++ if test $gt_cv_c_intmax_t = yes; then
++ AC_DEFINE(HAVE_INTMAX_T, 1,
++ [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/inttypes_h.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/inttypes_h.m4 2004-09-12 14:40:34.868670112 -0400
+@@ -0,0 +1,28 @@
++# inttypes_h.m4 serial 5 (gettext-0.12)
++dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
++# doesn't clash with <sys/types.h>, and declares uintmax_t.
++
++AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
++[
++ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
++ [AC_TRY_COMPILE(
++ [#include <sys/types.h>
++#include <inttypes.h>],
++ [uintmax_t i = (uintmax_t) -1;],
++ jm_ac_cv_header_inttypes_h=yes,
++ jm_ac_cv_header_inttypes_h=no)])
++ if test $jm_ac_cv_header_inttypes_h = yes; then
++ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
++ [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
++ and declares uintmax_t. ])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/inttypes.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/inttypes.m4 2004-09-12 14:40:34.861671176 -0400
+@@ -0,0 +1,27 @@
++# inttypes.m4 serial 1 (gettext-0.11.4)
++dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
++# <sys/types.h>.
++
++AC_DEFUN([gt_HEADER_INTTYPES_H],
++[
++ AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
++ [
++ AC_TRY_COMPILE(
++ [#include <sys/types.h>
++#include <inttypes.h>],
++ [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
++ ])
++ if test $gt_cv_header_inttypes_h = yes; then
++ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
++ [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/inttypes-pri.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/inttypes-pri.m4 2004-09-12 14:40:34.874669200 -0400
+@@ -0,0 +1,32 @@
++# inttypes-pri.m4 serial 1 (gettext-0.11.4)
++dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
++# macros to non-string values. This is the case on AIX 4.3.3.
++
++AC_DEFUN([gt_INTTYPES_PRI],
++[
++ AC_REQUIRE([gt_HEADER_INTTYPES_H])
++ if test $gt_cv_header_inttypes_h = yes; then
++ AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
++ gt_cv_inttypes_pri_broken,
++ [
++ AC_TRY_COMPILE([#include <inttypes.h>
++#ifdef PRId32
++char *p = PRId32;
++#endif
++], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
++ ])
++ fi
++ if test "$gt_cv_inttypes_pri_broken" = yes; then
++ AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
++ [Define if <inttypes.h> exists and defines unusable PRI* macros.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/isc-posix.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/isc-posix.m4 2004-09-12 14:40:34.885667528 -0400
+@@ -0,0 +1,26 @@
++# isc-posix.m4 serial 2 (gettext-0.11.2)
++dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
++
++# This test replaces the one in autoconf.
++# Currently this macro should have the same name as the autoconf macro
++# because gettext's gettext.m4 (distributed in the automake package)
++# still uses it. Otherwise, the use in gettext.m4 makes autoheader
++# give these diagnostics:
++# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
++# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
++
++undefine([AC_ISC_POSIX])
++
++AC_DEFUN([AC_ISC_POSIX],
++ [
++ dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
++ AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
++ ]
++)
+--- lrzsz-0.12.20.safe/m4/lcmessage.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/lcmessage.m4 2004-09-12 14:40:34.902664944 -0400
+@@ -0,0 +1,32 @@
++# lcmessage.m4 serial 3 (gettext-0.11.3)
++dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++dnl
++dnl This file can can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Library General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Library General Public License, and the rest of the GNU
++dnl gettext package package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Authors:
++dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
++
++# Check whether LC_MESSAGES is available in <locale.h>.
++
++AC_DEFUN([AM_LC_MESSAGES],
++[
++ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
++ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
++ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
++ if test $am_cv_val_LC_MESSAGES = yes; then
++ AC_DEFINE(HAVE_LC_MESSAGES, 1,
++ [Define if your <locale.h> file defines LC_MESSAGES.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/lib-ld.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/lib-ld.m4 2004-09-12 14:40:34.908664032 -0400
+@@ -0,0 +1,112 @@
++# lib-ld.m4 serial 3 (gettext-0.13)
++dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl Subroutines of libtool.m4,
++dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
++dnl with libtool.m4.
++
++dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
++AC_DEFUN([AC_LIB_PROG_LD_GNU],
++[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
++[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
++case `$LD -v 2>&1 </dev/null` in
++*GNU* | *'with BFD'*)
++ acl_cv_prog_gnu_ld=yes ;;
++*)
++ acl_cv_prog_gnu_ld=no ;;
++esac])
++with_gnu_ld=$acl_cv_prog_gnu_ld
++])
++
++dnl From libtool-1.4. Sets the variable LD.
++AC_DEFUN([AC_LIB_PROG_LD],
++[AC_ARG_WITH(gnu-ld,
++[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
++test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
++AC_REQUIRE([AC_PROG_CC])dnl
++AC_REQUIRE([AC_CANONICAL_HOST])dnl
++# Prepare PATH_SEPARATOR.
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++ echo "#! /bin/sh" >conf$$.sh
++ echo "exit 0" >>conf$$.sh
++ chmod +x conf$$.sh
++ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
++ PATH_SEPARATOR=';'
++ else
++ PATH_SEPARATOR=:
++ fi
++ rm -f conf$$.sh
++fi
++ac_prog=ld
++if test "$GCC" = yes; then
++ # Check if gcc -print-prog-name=ld gives a path.
++ AC_MSG_CHECKING([for ld used by GCC])
++ case $host in
++ *-*-mingw*)
++ # gcc leaves a trailing carriage return which upsets mingw
++ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
++ *)
++ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
++ esac
++ case $ac_prog in
++ # Accept absolute paths.
++ [[\\/]* | [A-Za-z]:[\\/]*)]
++ [re_direlt='/[^/][^/]*/\.\./']
++ # Canonicalize the path of ld
++ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
++ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
++ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
++ done
++ test -z "$LD" && LD="$ac_prog"
++ ;;
++ "")
++ # If it fails, then pretend we aren't using GCC.
++ ac_prog=ld
++ ;;
++ *)
++ # If it is relative, then search for the first ld in PATH.
++ with_gnu_ld=unknown
++ ;;
++ esac
++elif test "$with_gnu_ld" = yes; then
++ AC_MSG_CHECKING([for GNU ld])
++else
++ AC_MSG_CHECKING([for non-GNU ld])
++fi
++AC_CACHE_VAL(acl_cv_path_LD,
++[if test -z "$LD"; then
++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
++ for ac_dir in $PATH; do
++ test -z "$ac_dir" && ac_dir=.
++ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
++ acl_cv_path_LD="$ac_dir/$ac_prog"
++ # Check to see if the program is GNU ld. I'd rather use --version,
++ # but apparently some GNU ld's only accept -v.
++ # Break only if it was the GNU/non-GNU ld that we prefer.
++ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
++ *GNU* | *'with BFD'*)
++ test "$with_gnu_ld" != no && break ;;
++ *)
++ test "$with_gnu_ld" != yes && break ;;
++ esac
++ fi
++ done
++ IFS="$ac_save_ifs"
++else
++ acl_cv_path_LD="$LD" # Let the user override the test with a path.
++fi])
++LD="$acl_cv_path_LD"
++if test -n "$LD"; then
++ AC_MSG_RESULT($LD)
++else
++ AC_MSG_RESULT(no)
++fi
++test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
++AC_LIB_PROG_LD_GNU
++])
+--- lrzsz-0.12.20.safe/m4/lib-link.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/lib-link.m4 2004-09-12 14:40:34.914663120 -0400
+@@ -0,0 +1,551 @@
++# lib-link.m4 serial 4 (gettext-0.12)
++dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
++dnl the libraries corresponding to explicit and implicit dependencies.
++dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
++dnl augments the CPPFLAGS variable.
++AC_DEFUN([AC_LIB_LINKFLAGS],
++[
++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
++ AC_REQUIRE([AC_LIB_RPATH])
++ define([Name],[translit([$1],[./-], [___])])
++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
++ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
++ AC_LIB_LINKFLAGS_BODY([$1], [$2])
++ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
++ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
++ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
++ ])
++ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
++ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
++ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
++ AC_SUBST([LIB]NAME)
++ AC_SUBST([LTLIB]NAME)
++ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
++ dnl results of this search when this library appears as a dependency.
++ HAVE_LIB[]NAME=yes
++ undefine([Name])
++ undefine([NAME])
++])
++
++dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
++dnl searches for libname and the libraries corresponding to explicit and
++dnl implicit dependencies, together with the specified include files and
++dnl the ability to compile and link the specified testcode. If found, it
++dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
++dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
++dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
++dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
++AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
++[
++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
++ AC_REQUIRE([AC_LIB_RPATH])
++ define([Name],[translit([$1],[./-], [___])])
++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
++
++ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
++ dnl accordingly.
++ AC_LIB_LINKFLAGS_BODY([$1], [$2])
++
++ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
++ dnl because if the user has installed lib[]Name and not disabled its use
++ dnl via --without-lib[]Name-prefix, he wants to use it.
++ ac_save_CPPFLAGS="$CPPFLAGS"
++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
++
++ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
++ ac_save_LIBS="$LIBS"
++ LIBS="$LIBS $LIB[]NAME"
++ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
++ LIBS="$ac_save_LIBS"
++ ])
++ if test "$ac_cv_lib[]Name" = yes; then
++ HAVE_LIB[]NAME=yes
++ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
++ AC_MSG_CHECKING([how to link with lib[]$1])
++ AC_MSG_RESULT([$LIB[]NAME])
++ else
++ HAVE_LIB[]NAME=no
++ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
++ dnl $INC[]NAME either.
++ CPPFLAGS="$ac_save_CPPFLAGS"
++ LIB[]NAME=
++ LTLIB[]NAME=
++ fi
++ AC_SUBST([HAVE_LIB]NAME)
++ AC_SUBST([LIB]NAME)
++ AC_SUBST([LTLIB]NAME)
++ undefine([Name])
++ undefine([NAME])
++])
++
++dnl Determine the platform dependent parameters needed to use rpath:
++dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
++dnl hardcode_direct, hardcode_minus_L.
++AC_DEFUN([AC_LIB_RPATH],
++[
++ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
++ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
++ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
++ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
++ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
++ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
++ . ./conftest.sh
++ rm -f ./conftest.sh
++ acl_cv_rpath=done
++ ])
++ wl="$acl_cv_wl"
++ libext="$acl_cv_libext"
++ shlibext="$acl_cv_shlibext"
++ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
++ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
++ hardcode_direct="$acl_cv_hardcode_direct"
++ hardcode_minus_L="$acl_cv_hardcode_minus_L"
++ dnl Determine whether the user wants rpath handling at all.
++ AC_ARG_ENABLE(rpath,
++ [ --disable-rpath do not hardcode runtime library paths],
++ :, enable_rpath=yes)
++])
++
++dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
++dnl the libraries corresponding to explicit and implicit dependencies.
++dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
++AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
++[
++ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
++ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
++ dnl By default, look in $includedir and $libdir.
++ use_additional=yes
++ AC_LIB_WITH_FINAL_PREFIX([
++ eval additional_includedir=\"$includedir\"
++ eval additional_libdir=\"$libdir\"
++ ])
++ AC_LIB_ARG_WITH([lib$1-prefix],
++[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
++ --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
++[
++ if test "X$withval" = "Xno"; then
++ use_additional=no
++ else
++ if test "X$withval" = "X"; then
++ AC_LIB_WITH_FINAL_PREFIX([
++ eval additional_includedir=\"$includedir\"
++ eval additional_libdir=\"$libdir\"
++ ])
++ else
++ additional_includedir="$withval/include"
++ additional_libdir="$withval/lib"
++ fi
++ fi
++])
++ dnl Search the library and its dependencies in $additional_libdir and
++ dnl $LDFLAGS. Using breadth-first-seach.
++ LIB[]NAME=
++ LTLIB[]NAME=
++ INC[]NAME=
++ rpathdirs=
++ ltrpathdirs=
++ names_already_handled=
++ names_next_round='$1 $2'
++ while test -n "$names_next_round"; do
++ names_this_round="$names_next_round"
++ names_next_round=
++ for name in $names_this_round; do
++ already_handled=
++ for n in $names_already_handled; do
++ if test "$n" = "$name"; then
++ already_handled=yes
++ break
++ fi
++ done
++ if test -z "$already_handled"; then
++ names_already_handled="$names_already_handled $name"
++ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
++ dnl or AC_LIB_HAVE_LINKFLAGS call.
++ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
++ eval value=\"\$HAVE_LIB$uppername\"
++ if test -n "$value"; then
++ if test "$value" = yes; then
++ eval value=\"\$LIB$uppername\"
++ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
++ eval value=\"\$LTLIB$uppername\"
++ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
++ else
++ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
++ dnl that this library doesn't exist. So just drop it.
++ :
++ fi
++ else
++ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
++ dnl and the already constructed $LIBNAME/$LTLIBNAME.
++ found_dir=
++ found_la=
++ found_so=
++ found_a=
++ if test $use_additional = yes; then
++ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
++ found_dir="$additional_libdir"
++ found_so="$additional_libdir/lib$name.$shlibext"
++ if test -f "$additional_libdir/lib$name.la"; then
++ found_la="$additional_libdir/lib$name.la"
++ fi
++ else
++ if test -f "$additional_libdir/lib$name.$libext"; then
++ found_dir="$additional_libdir"
++ found_a="$additional_libdir/lib$name.$libext"
++ if test -f "$additional_libdir/lib$name.la"; then
++ found_la="$additional_libdir/lib$name.la"
++ fi
++ fi
++ fi
++ fi
++ if test "X$found_dir" = "X"; then
++ for x in $LDFLAGS $LTLIB[]NAME; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ case "$x" in
++ -L*)
++ dir=`echo "X$x" | sed -e 's/^X-L//'`
++ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
++ found_dir="$dir"
++ found_so="$dir/lib$name.$shlibext"
++ if test -f "$dir/lib$name.la"; then
++ found_la="$dir/lib$name.la"
++ fi
++ else
++ if test -f "$dir/lib$name.$libext"; then
++ found_dir="$dir"
++ found_a="$dir/lib$name.$libext"
++ if test -f "$dir/lib$name.la"; then
++ found_la="$dir/lib$name.la"
++ fi
++ fi
++ fi
++ ;;
++ esac
++ if test "X$found_dir" != "X"; then
++ break
++ fi
++ done
++ fi
++ if test "X$found_dir" != "X"; then
++ dnl Found the library.
++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
++ if test "X$found_so" != "X"; then
++ dnl Linking with a shared library. We attempt to hardcode its
++ dnl directory into the executable's runpath, unless it's the
++ dnl standard /usr/lib.
++ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
++ dnl No hardcoding is needed.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
++ else
++ dnl Use an explicit option to hardcode DIR into the resulting
++ dnl binary.
++ dnl Potentially add DIR to ltrpathdirs.
++ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
++ haveit=
++ for x in $ltrpathdirs; do
++ if test "X$x" = "X$found_dir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ ltrpathdirs="$ltrpathdirs $found_dir"
++ fi
++ dnl The hardcoding into $LIBNAME is system dependent.
++ if test "$hardcode_direct" = yes; then
++ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
++ dnl resulting binary.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
++ else
++ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
++ dnl Use an explicit option to hardcode DIR into the resulting
++ dnl binary.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
++ dnl Potentially add DIR to rpathdirs.
++ dnl The rpathdirs will be appended to $LIBNAME at the end.
++ haveit=
++ for x in $rpathdirs; do
++ if test "X$x" = "X$found_dir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ rpathdirs="$rpathdirs $found_dir"
++ fi
++ else
++ dnl Rely on "-L$found_dir".
++ dnl But don't add it if it's already contained in the LDFLAGS
++ dnl or the already constructed $LIBNAME
++ haveit=
++ for x in $LDFLAGS $LIB[]NAME; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-L$found_dir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
++ fi
++ if test "$hardcode_minus_L" != no; then
++ dnl FIXME: Not sure whether we should use
++ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
++ dnl here.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
++ else
++ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
++ dnl here, because this doesn't fit in flags passed to the
++ dnl compiler. So give up. No hardcoding. This affects only
++ dnl very old systems.
++ dnl FIXME: Not sure whether we should use
++ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
++ dnl here.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
++ fi
++ fi
++ fi
++ fi
++ else
++ if test "X$found_a" != "X"; then
++ dnl Linking with a static library.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
++ else
++ dnl We shouldn't come here, but anyway it's good to have a
++ dnl fallback.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
++ fi
++ fi
++ dnl Assume the include files are nearby.
++ additional_includedir=
++ case "$found_dir" in
++ */lib | */lib/)
++ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
++ additional_includedir="$basedir/include"
++ ;;
++ esac
++ if test "X$additional_includedir" != "X"; then
++ dnl Potentially add $additional_includedir to $INCNAME.
++ dnl But don't add it
++ dnl 1. if it's the standard /usr/include,
++ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
++ dnl 3. if it's already present in $CPPFLAGS or the already
++ dnl constructed $INCNAME,
++ dnl 4. if it doesn't exist as a directory.
++ if test "X$additional_includedir" != "X/usr/include"; then
++ haveit=
++ if test "X$additional_includedir" = "X/usr/local/include"; then
++ if test -n "$GCC"; then
++ case $host_os in
++ linux*) haveit=yes;;
++ esac
++ fi
++ fi
++ if test -z "$haveit"; then
++ for x in $CPPFLAGS $INC[]NAME; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-I$additional_includedir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ if test -d "$additional_includedir"; then
++ dnl Really add $additional_includedir to $INCNAME.
++ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
++ fi
++ fi
++ fi
++ fi
++ fi
++ dnl Look for dependencies.
++ if test -n "$found_la"; then
++ dnl Read the .la file. It defines the variables
++ dnl dlname, library_names, old_library, dependency_libs, current,
++ dnl age, revision, installed, dlopen, dlpreopen, libdir.
++ save_libdir="$libdir"
++ case "$found_la" in
++ */* | *\\*) . "$found_la" ;;
++ *) . "./$found_la" ;;
++ esac
++ libdir="$save_libdir"
++ dnl We use only dependency_libs.
++ for dep in $dependency_libs; do
++ case "$dep" in
++ -L*)
++ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
++ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
++ dnl But don't add it
++ dnl 1. if it's the standard /usr/lib,
++ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
++ dnl 3. if it's already present in $LDFLAGS or the already
++ dnl constructed $LIBNAME,
++ dnl 4. if it doesn't exist as a directory.
++ if test "X$additional_libdir" != "X/usr/lib"; then
++ haveit=
++ if test "X$additional_libdir" = "X/usr/local/lib"; then
++ if test -n "$GCC"; then
++ case $host_os in
++ linux*) haveit=yes;;
++ esac
++ fi
++ fi
++ if test -z "$haveit"; then
++ haveit=
++ for x in $LDFLAGS $LIB[]NAME; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-L$additional_libdir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ if test -d "$additional_libdir"; then
++ dnl Really add $additional_libdir to $LIBNAME.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
++ fi
++ fi
++ haveit=
++ for x in $LDFLAGS $LTLIB[]NAME; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-L$additional_libdir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ if test -d "$additional_libdir"; then
++ dnl Really add $additional_libdir to $LTLIBNAME.
++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
++ fi
++ fi
++ fi
++ fi
++ ;;
++ -R*)
++ dir=`echo "X$dep" | sed -e 's/^X-R//'`
++ if test "$enable_rpath" != no; then
++ dnl Potentially add DIR to rpathdirs.
++ dnl The rpathdirs will be appended to $LIBNAME at the end.
++ haveit=
++ for x in $rpathdirs; do
++ if test "X$x" = "X$dir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ rpathdirs="$rpathdirs $dir"
++ fi
++ dnl Potentially add DIR to ltrpathdirs.
++ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
++ haveit=
++ for x in $ltrpathdirs; do
++ if test "X$x" = "X$dir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ ltrpathdirs="$ltrpathdirs $dir"
++ fi
++ fi
++ ;;
++ -l*)
++ dnl Handle this in the next round.
++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
++ ;;
++ *.la)
++ dnl Handle this in the next round. Throw away the .la's
++ dnl directory; it is already contained in a preceding -L
++ dnl option.
++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
++ ;;
++ *)
++ dnl Most likely an immediate library name.
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
++ ;;
++ esac
++ done
++ fi
++ else
++ dnl Didn't find the library; assume it is in the system directories
++ dnl known to the linker and runtime loader. (All the system
++ dnl directories known to the linker should also be known to the
++ dnl runtime loader, otherwise the system is severely misconfigured.)
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
++ fi
++ fi
++ fi
++ done
++ done
++ if test "X$rpathdirs" != "X"; then
++ if test -n "$hardcode_libdir_separator"; then
++ dnl Weird platform: only the last -rpath option counts, the user must
++ dnl pass all path elements in one option. We can arrange that for a
++ dnl single library, but not when more than one $LIBNAMEs are used.
++ alldirs=
++ for found_dir in $rpathdirs; do
++ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
++ done
++ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
++ acl_save_libdir="$libdir"
++ libdir="$alldirs"
++ eval flag=\"$hardcode_libdir_flag_spec\"
++ libdir="$acl_save_libdir"
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
++ else
++ dnl The -rpath options are cumulative.
++ for found_dir in $rpathdirs; do
++ acl_save_libdir="$libdir"
++ libdir="$found_dir"
++ eval flag=\"$hardcode_libdir_flag_spec\"
++ libdir="$acl_save_libdir"
++ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
++ done
++ fi
++ fi
++ if test "X$ltrpathdirs" != "X"; then
++ dnl When using libtool, the option that works for both libraries and
++ dnl executables is -R. The -R options are cumulative.
++ for found_dir in $ltrpathdirs; do
++ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
++ done
++ fi
++])
++
++dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
++dnl unless already present in VAR.
++dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
++dnl contains two or three consecutive elements that belong together.
++AC_DEFUN([AC_LIB_APPENDTOVAR],
++[
++ for element in [$2]; do
++ haveit=
++ for x in $[$1]; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X$element"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ [$1]="${[$1]}${[$1]:+ }$element"
++ fi
++ done
++])
+--- lrzsz-0.12.20.safe/m4/lib-prefix.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/lib-prefix.m4 2004-09-12 14:40:34.921662056 -0400
+@@ -0,0 +1,155 @@
++# lib-prefix.m4 serial 3 (gettext-0.13)
++dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
++dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
++dnl require excessive bracketing.
++ifdef([AC_HELP_STRING],
++[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
++[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
++
++dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
++dnl to access previously installed libraries. The basic assumption is that
++dnl a user will want packages to use other packages he previously installed
++dnl with the same --prefix option.
++dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
++dnl libraries, but is otherwise very convenient.
++AC_DEFUN([AC_LIB_PREFIX],
++[
++ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
++ AC_REQUIRE([AC_PROG_CC])
++ AC_REQUIRE([AC_CANONICAL_HOST])
++ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
++ dnl By default, look in $includedir and $libdir.
++ use_additional=yes
++ AC_LIB_WITH_FINAL_PREFIX([
++ eval additional_includedir=\"$includedir\"
++ eval additional_libdir=\"$libdir\"
++ ])
++ AC_LIB_ARG_WITH([lib-prefix],
++[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
++ --without-lib-prefix don't search for libraries in includedir and libdir],
++[
++ if test "X$withval" = "Xno"; then
++ use_additional=no
++ else
++ if test "X$withval" = "X"; then
++ AC_LIB_WITH_FINAL_PREFIX([
++ eval additional_includedir=\"$includedir\"
++ eval additional_libdir=\"$libdir\"
++ ])
++ else
++ additional_includedir="$withval/include"
++ additional_libdir="$withval/lib"
++ fi
++ fi
++])
++ if test $use_additional = yes; then
++ dnl Potentially add $additional_includedir to $CPPFLAGS.
++ dnl But don't add it
++ dnl 1. if it's the standard /usr/include,
++ dnl 2. if it's already present in $CPPFLAGS,
++ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
++ dnl 4. if it doesn't exist as a directory.
++ if test "X$additional_includedir" != "X/usr/include"; then
++ haveit=
++ for x in $CPPFLAGS; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-I$additional_includedir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ if test "X$additional_includedir" = "X/usr/local/include"; then
++ if test -n "$GCC"; then
++ case $host_os in
++ linux*) haveit=yes;;
++ esac
++ fi
++ fi
++ if test -z "$haveit"; then
++ if test -d "$additional_includedir"; then
++ dnl Really add $additional_includedir to $CPPFLAGS.
++ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
++ fi
++ fi
++ fi
++ fi
++ dnl Potentially add $additional_libdir to $LDFLAGS.
++ dnl But don't add it
++ dnl 1. if it's the standard /usr/lib,
++ dnl 2. if it's already present in $LDFLAGS,
++ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
++ dnl 4. if it doesn't exist as a directory.
++ if test "X$additional_libdir" != "X/usr/lib"; then
++ haveit=
++ for x in $LDFLAGS; do
++ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
++ if test "X$x" = "X-L$additional_libdir"; then
++ haveit=yes
++ break
++ fi
++ done
++ if test -z "$haveit"; then
++ if test "X$additional_libdir" = "X/usr/local/lib"; then
++ if test -n "$GCC"; then
++ case $host_os in
++ linux*) haveit=yes;;
++ esac
++ fi
++ fi
++ if test -z "$haveit"; then
++ if test -d "$additional_libdir"; then
++ dnl Really add $additional_libdir to $LDFLAGS.
++ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
++ fi
++ fi
++ fi
++ fi
++ fi
++])
++
++dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
++dnl acl_final_exec_prefix, containing the values to which $prefix and
++dnl $exec_prefix will expand at the end of the configure script.
++AC_DEFUN([AC_LIB_PREPARE_PREFIX],
++[
++ dnl Unfortunately, prefix and exec_prefix get only finally determined
++ dnl at the end of configure.
++ if test "X$prefix" = "XNONE"; then
++ acl_final_prefix="$ac_default_prefix"
++ else
++ acl_final_prefix="$prefix"
++ fi
++ if test "X$exec_prefix" = "XNONE"; then
++ acl_final_exec_prefix='${prefix}'
++ else
++ acl_final_exec_prefix="$exec_prefix"
++ fi
++ acl_save_prefix="$prefix"
++ prefix="$acl_final_prefix"
++ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
++ prefix="$acl_save_prefix"
++])
++
++dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
++dnl variables prefix and exec_prefix bound to the values they will have
++dnl at the end of the configure script.
++AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
++[
++ acl_save_prefix="$prefix"
++ prefix="$acl_final_prefix"
++ acl_save_exec_prefix="$exec_prefix"
++ exec_prefix="$acl_final_exec_prefix"
++ $1
++ exec_prefix="$acl_save_exec_prefix"
++ prefix="$acl_save_prefix"
++])
+--- lrzsz-0.12.20.safe/m4/longdouble.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/longdouble.m4 2004-09-12 14:40:34.942658864 -0400
+@@ -0,0 +1,30 @@
++# longdouble.m4 serial 1 (gettext-0.12)
++dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++dnl Test whether the compiler supports the 'long double' type.
++dnl Prerequisite: AC_PROG_CC
++
++AC_DEFUN([gt_TYPE_LONGDOUBLE],
++[
++ AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
++ [if test "$GCC" = yes; then
++ gt_cv_c_long_double=yes
++ else
++ AC_TRY_COMPILE([
++ /* The Stardent Vistra knows sizeof(long double), but does not support it. */
++ long double foo = 0.0;
++ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
++ int array [2*(sizeof(long double) >= sizeof(double)) - 1];
++ ], ,
++ gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
++ fi])
++ if test $gt_cv_c_long_double = yes; then
++ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/longlong.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/longlong.m4 2004-09-12 14:40:34.949657800 -0400
+@@ -0,0 +1,25 @@
++# longlong.m4 serial 4
++dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++# Define HAVE_LONG_LONG if 'long long' works.
++
++AC_DEFUN([jm_AC_TYPE_LONG_LONG],
++[
++ AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
++ [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
++ [long long llmax = (long long) -1;
++ return ll << i | ll >> i | llmax / ll | llmax % ll;],
++ ac_cv_type_long_long=yes,
++ ac_cv_type_long_long=no)])
++ if test $ac_cv_type_long_long = yes; then
++ AC_DEFINE(HAVE_LONG_LONG, 1,
++ [Define if you have the 'long long' type.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/Makefile.am 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/Makefile.am 2004-09-12 14:40:35.048642752 -0400
+@@ -0,0 +1 @@
++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
+--- lrzsz-0.12.20.safe/m4/nls.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/nls.m4 2004-09-12 14:40:34.955656888 -0400
+@@ -0,0 +1,49 @@
++# nls.m4 serial 1 (gettext-0.12)
++dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++dnl
++dnl This file can can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Library General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Library General Public License, and the rest of the GNU
++dnl gettext package package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Authors:
++dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
++dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
++
++AC_DEFUN([AM_NLS],
++[
++ AC_MSG_CHECKING([whether NLS is requested])
++ dnl Default is enabled NLS
++ AC_ARG_ENABLE(nls,
++ [ --disable-nls do not use Native Language Support],
++ USE_NLS=$enableval, USE_NLS=yes)
++ AC_MSG_RESULT($USE_NLS)
++ AC_SUBST(USE_NLS)
++])
++
++AC_DEFUN([AM_MKINSTALLDIRS],
++[
++ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
++ dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
++ dnl Try to locate it.
++ MKINSTALLDIRS=
++ if test -n "$ac_aux_dir"; then
++ case "$ac_aux_dir" in
++ /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
++ *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
++ esac
++ fi
++ if test -z "$MKINSTALLDIRS"; then
++ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
++ fi
++ AC_SUBST(MKINSTALLDIRS)
++])
+--- lrzsz-0.12.20.safe/m4/po.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/po.m4 2004-09-12 14:40:34.961655976 -0400
+@@ -0,0 +1,426 @@
++# po.m4 serial 3 (gettext-0.14)
++dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++dnl
++dnl This file can can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Library General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Library General Public License, and the rest of the GNU
++dnl gettext package package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Authors:
++dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
++dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
++
++dnl Checks for all prerequisites of the po subdirectory.
++AC_DEFUN([AM_PO_SUBDIRS],
++[
++ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
++ AC_REQUIRE([AC_PROG_INSTALL])dnl
++ AC_REQUIRE([AM_MKINSTALLDIRS])dnl
++ AC_REQUIRE([AM_NLS])dnl
++
++ dnl Perform the following tests also if --disable-nls has been given,
++ dnl because they are needed for "make dist" to work.
++
++ dnl Search for GNU msgfmt in the PATH.
++ dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
++ dnl The second test excludes FreeBSD msgfmt.
++ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
++ [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
++ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
++ :)
++ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
++
++ dnl Search for GNU xgettext 0.12 or newer in the PATH.
++ dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
++ dnl The second test excludes FreeBSD xgettext.
++ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
++ [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
++ (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)],
++ :)
++ dnl Remove leftover from FreeBSD xgettext call.
++ rm -f messages.po
++
++ dnl Search for GNU msgmerge 0.11 or newer in the PATH.
++ AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
++ [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
++
++ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
++ dnl Test whether we really found GNU msgfmt.
++ if test "$GMSGFMT" != ":"; then
++ dnl If it is no GNU msgfmt we define it as : so that the
++ dnl Makefiles still can work.
++ if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
++ (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
++ : ;
++ else
++ GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
++ AC_MSG_RESULT(
++ [found $GMSGFMT program is not GNU msgfmt; ignore it])
++ GMSGFMT=":"
++ fi
++ fi
++
++ dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
++ dnl Test whether we really found GNU xgettext.
++ if test "$XGETTEXT" != ":"; then
++ dnl If it is no GNU xgettext we define it as : so that the
++ dnl Makefiles still can work.
++ if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
++ (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
++ : ;
++ else
++ AC_MSG_RESULT(
++ [found xgettext program is not GNU xgettext; ignore it])
++ XGETTEXT=":"
++ fi
++ dnl Remove leftover from FreeBSD xgettext call.
++ rm -f messages.po
++ fi
++
++ AC_OUTPUT_COMMANDS([
++ for ac_file in $CONFIG_FILES; do
++ # Support "outfile[:infile[:infile...]]"
++ case "$ac_file" in
++ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
++ esac
++ # PO directories have a Makefile.in generated from Makefile.in.in.
++ case "$ac_file" in */Makefile.in)
++ # Adjust a relative srcdir.
++ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
++ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
++ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
++ # In autoconf-2.13 it is called $ac_given_srcdir.
++ # In autoconf-2.50 it is called $srcdir.
++ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
++ case "$ac_given_srcdir" in
++ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
++ /*) top_srcdir="$ac_given_srcdir" ;;
++ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
++ esac
++ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
++ rm -f "$ac_dir/POTFILES"
++ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
++ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
++ POMAKEFILEDEPS="POTFILES.in"
++ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
++ # on $ac_dir but don't depend on user-specified configuration
++ # parameters.
++ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
++ # The LINGUAS file contains the set of available languages.
++ if test -n "$OBSOLETE_ALL_LINGUAS"; then
++ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
++ fi
++ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
++ # Hide the ALL_LINGUAS assigment from automake.
++ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
++ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
++ else
++ # The set of available languages was given in configure.in.
++ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
++ fi
++ # Compute POFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
++ # Compute UPDATEPOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
++ # Compute DUMMYPOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
++ # Compute GMOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
++ case "$ac_given_srcdir" in
++ .) srcdirpre= ;;
++ *) srcdirpre='$(srcdir)/' ;;
++ esac
++ POFILES=
++ UPDATEPOFILES=
++ DUMMYPOFILES=
++ GMOFILES=
++ for lang in $ALL_LINGUAS; do
++ POFILES="$POFILES $srcdirpre$lang.po"
++ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
++ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
++ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
++ done
++ # CATALOGS depends on both $ac_dir and the user's LINGUAS
++ # environment variable.
++ INST_LINGUAS=
++ if test -n "$ALL_LINGUAS"; then
++ for presentlang in $ALL_LINGUAS; do
++ useit=no
++ if test "%UNSET%" != "$LINGUAS"; then
++ desiredlanguages="$LINGUAS"
++ else
++ desiredlanguages="$ALL_LINGUAS"
++ fi
++ for desiredlang in $desiredlanguages; do
++ # Use the presentlang catalog if desiredlang is
++ # a. equal to presentlang, or
++ # b. a variant of presentlang (because in this case,
++ # presentlang can be used as a fallback for messages
++ # which are not translated in the desiredlang catalog).
++ case "$desiredlang" in
++ "$presentlang"*) useit=yes;;
++ esac
++ done
++ if test $useit = yes; then
++ INST_LINGUAS="$INST_LINGUAS $presentlang"
++ fi
++ done
++ fi
++ CATALOGS=
++ if test -n "$INST_LINGUAS"; then
++ for lang in $INST_LINGUAS; do
++ CATALOGS="$CATALOGS $lang.gmo"
++ done
++ fi
++ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
++ 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"
++ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
++ if test -f "$f"; then
++ case "$f" in
++ *.orig | *.bak | *~) ;;
++ *) cat "$f" >> "$ac_dir/Makefile" ;;
++ esac
++ fi
++ done
++ fi
++ ;;
++ esac
++ done],
++ [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
++ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
++ # from automake.
++ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
++ # Capture the value of LINGUAS because we need it to compute CATALOGS.
++ LINGUAS="${LINGUAS-%UNSET%}"
++ ])
++])
++
++dnl Postprocesses a Makefile in a directory containing PO files.
++AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
++[
++ # When this code is run, in config.status, two variables have already been
++ # set:
++ # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
++ # - LINGUAS is the value of the environment variable LINGUAS at configure
++ # time.
++
++changequote(,)dnl
++ # Adjust a relative srcdir.
++ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
++ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
++ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
++ # In autoconf-2.13 it is called $ac_given_srcdir.
++ # In autoconf-2.50 it is called $srcdir.
++ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
++ case "$ac_given_srcdir" in
++ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
++ /*) top_srcdir="$ac_given_srcdir" ;;
++ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
++ esac
++
++ # Find a way to echo strings without interpreting backslash.
++ if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
++ gt_echo='echo'
++ else
++ if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
++ gt_echo='printf %s\n'
++ else
++ echo_func () {
++ cat <<EOT
++$*
++EOT
++ }
++ gt_echo='echo_func'
++ fi
++ fi
++
++ # A sed script that extracts the value of VARIABLE from a Makefile.
++ sed_x_variable='
++# Test if the hold space is empty.
++x
++s/P/P/
++x
++ta
++# Yes it was empty. Look if we have the expected variable definition.
++/^[ ]*VARIABLE[ ]*=/{
++ # Seen the first line of the variable definition.
++ s/^[ ]*VARIABLE[ ]*=//
++ ba
++}
++bd
++:a
++# Here we are processing a line from the variable definition.
++# Remove comment, more precisely replace it with a space.
++s/#.*$/ /
++# See if the line ends in a backslash.
++tb
++:b
++s/\\$//
++# Print the line, without the trailing backslash.
++p
++tc
++# There was no trailing backslash. The end of the variable definition is
++# reached. Clear the hold space.
++s/^.*$//
++x
++bd
++:c
++# A trailing backslash means that the variable definition continues in the
++# next line. Put a nonempty string into the hold space to indicate this.
++s/^.*$/P/
++x
++:d
++'
++changequote([,])dnl
++
++ # Set POTFILES to the value of the Makefile variable POTFILES.
++ sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
++ POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
++ # Compute POTFILES_DEPS as
++ # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
++ POTFILES_DEPS=
++ for file in $POTFILES; do
++ POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
++ done
++ POMAKEFILEDEPS=""
++
++ if test -n "$OBSOLETE_ALL_LINGUAS"; then
++ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
++ fi
++ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
++ # The LINGUAS file contains the set of available languages.
++ ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
++ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
++ else
++ # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
++ sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
++ ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
++ fi
++ # Hide the ALL_LINGUAS assigment from automake.
++ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
++ # Compute POFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
++ # Compute UPDATEPOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
++ # Compute DUMMYPOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
++ # Compute GMOFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
++ # Compute PROPERTIESFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
++ # Compute CLASSFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
++ # Compute QMFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
++ # Compute MSGFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
++ # Compute RESOURCESDLLFILES
++ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
++ case "$ac_given_srcdir" in
++ .) srcdirpre= ;;
++ *) srcdirpre='$(srcdir)/' ;;
++ esac
++ POFILES=
++ UPDATEPOFILES=
++ DUMMYPOFILES=
++ GMOFILES=
++ PROPERTIESFILES=
++ CLASSFILES=
++ QMFILES=
++ MSGFILES=
++ RESOURCESDLLFILES=
++ for lang in $ALL_LINGUAS; do
++ POFILES="$POFILES $srcdirpre$lang.po"
++ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
++ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
++ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
++ PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
++ CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
++ QMFILES="$QMFILES $srcdirpre$lang.qm"
++ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
++ MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
++ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
++ RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
++ done
++ # CATALOGS depends on both $ac_dir and the user's LINGUAS
++ # environment variable.
++ INST_LINGUAS=
++ if test -n "$ALL_LINGUAS"; then
++ for presentlang in $ALL_LINGUAS; do
++ useit=no
++ if test "%UNSET%" != "$LINGUAS"; then
++ desiredlanguages="$LINGUAS"
++ else
++ desiredlanguages="$ALL_LINGUAS"
++ fi
++ for desiredlang in $desiredlanguages; do
++ # Use the presentlang catalog if desiredlang is
++ # a. equal to presentlang, or
++ # b. a variant of presentlang (because in this case,
++ # presentlang can be used as a fallback for messages
++ # which are not translated in the desiredlang catalog).
++ case "$desiredlang" in
++ "$presentlang"*) useit=yes;;
++ esac
++ done
++ if test $useit = yes; then
++ INST_LINGUAS="$INST_LINGUAS $presentlang"
++ fi
++ done
++ fi
++ CATALOGS=
++ JAVACATALOGS=
++ QTCATALOGS=
++ TCLCATALOGS=
++ CSHARPCATALOGS=
++ if test -n "$INST_LINGUAS"; then
++ for lang in $INST_LINGUAS; do
++ CATALOGS="$CATALOGS $lang.gmo"
++ JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
++ QTCATALOGS="$QTCATALOGS $lang.qm"
++ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
++ TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
++ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
++ CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
++ done
++ fi
++
++ 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"
++ if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
++ # Add dependencies that cannot be formulated as a simple suffix rule.
++ for lang in $ALL_LINGUAS; do
++ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
++ cat >> "$ac_file.tmp" <<EOF
++$frobbedlang.msg: $lang.po
++ @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
++ \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
++EOF
++ done
++ fi
++ if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
++ # Add dependencies that cannot be formulated as a simple suffix rule.
++ for lang in $ALL_LINGUAS; do
++ frobbedlang=`echo $lang | sed -e 's/_/-/g'`
++ cat >> "$ac_file.tmp" <<EOF
++$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
++ @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
++ \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
++EOF
++ done
++ fi
++ if test -n "$POMAKEFILEDEPS"; then
++ cat >> "$ac_file.tmp" <<EOF
++Makefile: $POMAKEFILEDEPS
++EOF
++ fi
++ mv "$ac_file.tmp" "$ac_file"
++])
+--- lrzsz-0.12.20.safe/m4/printf-posix.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/printf-posix.m4 2004-09-12 14:40:34.974654000 -0400
+@@ -0,0 +1,46 @@
++# printf-posix.m4 serial 2 (gettext-0.13.1)
++dnl Copyright (C) 2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++dnl Test whether the printf() function supports POSIX/XSI format strings with
++dnl positions.
++
++AC_DEFUN([gt_PRINTF_POSIX],
++[
++ AC_REQUIRE([AC_PROG_CC])
++ AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
++ gt_cv_func_printf_posix,
++ [
++ AC_TRY_RUN([
++#include <stdio.h>
++#include <string.h>
++/* The string "%2$d %1$d", with dollar characters protected from the shell's
++ dollar expansion (possibly an autoconf bug). */
++static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
++static char buf[100];
++int main ()
++{
++ sprintf (buf, format, 33, 55);
++ return (strcmp (buf, "55 33") != 0);
++}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
++ [
++ AC_EGREP_CPP(notposix, [
++#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
++ notposix
++#endif
++ ], gt_cv_func_printf_posix="guessing no",
++ gt_cv_func_printf_posix="guessing yes")
++ ])
++ ])
++ case $gt_cv_func_printf_posix in
++ *yes)
++ AC_DEFINE(HAVE_POSIX_PRINTF, 1,
++ [Define if your printf() function supports format strings with positions.])
++ ;;
++ esac
++])
+--- lrzsz-0.12.20.safe/m4/progtest.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/progtest.m4 2004-09-12 14:40:34.990651568 -0400
+@@ -0,0 +1,91 @@
++# progtest.m4 serial 3 (gettext-0.12)
++dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++dnl
++dnl This file can can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Library General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Library General Public License, and the rest of the GNU
++dnl gettext package package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Authors:
++dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
++
++# Search path for a program which passes the given test.
++
++dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
++dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
++AC_DEFUN([AM_PATH_PROG_WITH_TEST],
++[
++# Prepare PATH_SEPARATOR.
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++ echo "#! /bin/sh" >conf$$.sh
++ echo "exit 0" >>conf$$.sh
++ chmod +x conf$$.sh
++ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
++ PATH_SEPARATOR=';'
++ else
++ PATH_SEPARATOR=:
++ fi
++ rm -f conf$$.sh
++fi
++
++# Find out how to test for executable files. Don't use a zero-byte file,
++# as systems may use methods other than mode bits to determine executability.
++cat >conf$$.file <<_ASEOF
++#! /bin/sh
++exit 0
++_ASEOF
++chmod +x conf$$.file
++if test -x conf$$.file >/dev/null 2>&1; then
++ ac_executable_p="test -x"
++else
++ ac_executable_p="test -f"
++fi
++rm -f conf$$.file
++
++# Extract the first word of "$2", so it can be a program name with args.
++set dummy $2; ac_word=[$]2
++AC_MSG_CHECKING([for $ac_word])
++AC_CACHE_VAL(ac_cv_path_$1,
++[case "[$]$1" in
++ [[\\/]]* | ?:[[\\/]]*)
++ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
++ ;;
++ *)
++ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
++ for ac_dir in ifelse([$5], , $PATH, [$5]); do
++ IFS="$ac_save_IFS"
++ test -z "$ac_dir" && ac_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
++ if [$3]; then
++ ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
++ break 2
++ fi
++ fi
++ done
++ done
++ IFS="$ac_save_IFS"
++dnl If no 4th arg is given, leave the cache variable unset,
++dnl so AC_PATH_PROGS will keep looking.
++ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
++])dnl
++ ;;
++esac])dnl
++$1="$ac_cv_path_$1"
++if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
++ AC_MSG_RESULT([$]$1)
++else
++ AC_MSG_RESULT(no)
++fi
++AC_SUBST($1)dnl
++])
+--- lrzsz-0.12.20.safe/m4/signed.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/signed.m4 2004-09-12 14:40:34.996650656 -0400
+@@ -0,0 +1,19 @@
++# signed.m4 serial 1 (gettext-0.10.40)
++dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++AC_DEFUN([bh_C_SIGNED],
++[
++ AC_CACHE_CHECK([for signed], bh_cv_c_signed,
++ [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
++ if test $bh_cv_c_signed = no; then
++ AC_DEFINE(signed, ,
++ [Define to empty if the C compiler doesn't support this keyword.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/size_max.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/size_max.m4 2004-09-12 14:40:35.003649592 -0400
+@@ -0,0 +1,61 @@
++# size_max.m4 serial 2
++dnl Copyright (C) 2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++
++AC_DEFUN([gl_SIZE_MAX],
++[
++ AC_CHECK_HEADERS(stdint.h)
++ dnl First test whether the system already has SIZE_MAX.
++ AC_MSG_CHECKING([for SIZE_MAX])
++ result=
++ AC_EGREP_CPP([Found it], [
++#include <limits.h>
++#if HAVE_STDINT_H
++#include <stdint.h>
++#endif
++#ifdef SIZE_MAX
++Found it
++#endif
++], result=yes)
++ if test -z "$result"; then
++ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
++ dnl than the type 'unsigned long'.
++ dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
++ dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
++ _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
++ [#include <stddef.h>], result=?)
++ _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
++ [#include <stddef.h>], result=?)
++ _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
++ [#include <stddef.h>], result=?)
++ if test "$fits_in_uint" = 1; then
++ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
++ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
++ AC_TRY_COMPILE([#include <stddef.h>
++ extern size_t foo;
++ extern unsigned long foo;
++ ], [], fits_in_uint=0)
++ fi
++ if test -z "$result"; then
++ if test "$fits_in_uint" = 1; then
++ result="$res_hi$res_lo"U
++ else
++ result="$res_hi$res_lo"UL
++ fi
++ else
++ dnl Shouldn't happen, but who knows...
++ result='~(size_t)0'
++ fi
++ fi
++ AC_MSG_RESULT([$result])
++ if test "$result" != yes; then
++ AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
++ [Define as the maximum value of type 'size_t', if the system doesn't define it.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/stdint_h.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/stdint_h.m4 2004-09-12 14:40:35.009648680 -0400
+@@ -0,0 +1,28 @@
++# stdint_h.m4 serial 3 (gettext-0.12)
++dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
++# doesn't clash with <sys/types.h>, and declares uintmax_t.
++
++AC_DEFUN([jm_AC_HEADER_STDINT_H],
++[
++ AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
++ [AC_TRY_COMPILE(
++ [#include <sys/types.h>
++#include <stdint.h>],
++ [uintmax_t i = (uintmax_t) -1;],
++ jm_ac_cv_header_stdint_h=yes,
++ jm_ac_cv_header_stdint_h=no)])
++ if test $jm_ac_cv_header_stdint_h = yes; then
++ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
++ [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
++ and declares uintmax_t. ])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/uintmax_t.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/uintmax_t.m4 2004-09-12 14:40:35.021646856 -0400
+@@ -0,0 +1,32 @@
++# uintmax_t.m4 serial 7 (gettext-0.12)
++dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++AC_PREREQ(2.13)
++
++# Define uintmax_t to 'unsigned long' or 'unsigned long long'
++# if it is not already defined in <stdint.h> or <inttypes.h>.
++
++AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
++[
++ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
++ AC_REQUIRE([jm_AC_HEADER_STDINT_H])
++ if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
++ AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
++ test $ac_cv_type_unsigned_long_long = yes \
++ && ac_type='unsigned long long' \
++ || ac_type='unsigned long'
++ AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
++ [Define to unsigned long or unsigned long long
++ if <stdint.h> and <inttypes.h> don't define.])
++ else
++ AC_DEFINE(HAVE_UINTMAX_T, 1,
++ [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/ulonglong.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/ulonglong.m4 2004-09-12 14:40:35.028645792 -0400
+@@ -0,0 +1,25 @@
++# ulonglong.m4 serial 3
++dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Paul Eggert.
++
++# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
++
++AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
++[
++ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
++ [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
++ [unsigned long long ullmax = (unsigned long long) -1;
++ return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
++ ac_cv_type_unsigned_long_long=yes,
++ ac_cv_type_unsigned_long_long=no)])
++ if test $ac_cv_type_unsigned_long_long = yes; then
++ AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
++ [Define if you have the 'unsigned long long' type.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/wchar_t.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/wchar_t.m4 2004-09-12 14:40:35.034644880 -0400
+@@ -0,0 +1,22 @@
++# wchar_t.m4 serial 1 (gettext-0.12)
++dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++dnl Test whether <stddef.h> has the 'wchar_t' type.
++dnl Prerequisite: AC_PROG_CC
++
++AC_DEFUN([gt_TYPE_WCHAR_T],
++[
++ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
++ [AC_TRY_COMPILE([#include <stddef.h>
++ wchar_t foo = (wchar_t)'\0';], ,
++ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
++ if test $gt_cv_c_wchar_t = yes; then
++ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/wint_t.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/wint_t.m4 2004-09-12 14:40:35.040643968 -0400
+@@ -0,0 +1,22 @@
++# wint_t.m4 serial 1 (gettext-0.12)
++dnl Copyright (C) 2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++dnl From Bruno Haible.
++dnl Test whether <wchar.h> has the 'wint_t' type.
++dnl Prerequisite: AC_PROG_CC
++
++AC_DEFUN([gt_TYPE_WINT_T],
++[
++ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
++ [AC_TRY_COMPILE([#include <wchar.h>
++ wint_t foo = (wchar_t)'\0';], ,
++ gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
++ if test $gt_cv_c_wint_t = yes; then
++ AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
++ fi
++])
+--- lrzsz-0.12.20.safe/m4/xsize.m4 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/m4/xsize.m4 2004-09-12 14:40:35.047642904 -0400
+@@ -0,0 +1,14 @@
++# xsize.m4 serial 2
++dnl Copyright (C) 2003 Free Software Foundation, Inc.
++dnl This file is free software, distributed under the terms of the GNU
++dnl General Public License. As a special exception to the GNU General
++dnl Public License, this file may be distributed as part of a program
++dnl that contains a configuration script generated by Autoconf, under
++dnl the same distribution terms as the rest of that program.
++
++AC_DEFUN([gl_XSIZE],
++[
++ dnl Prerequisites of lib/xsize.h.
++ AC_REQUIRE([gl_SIZE_MAX])
++ AC_CHECK_HEADERS(stdint.h)
++])
+--- lrzsz-0.12.20.safe/Makefile.am 1998-12-30 06:19:40.000000000 -0500
++++ lrzsz-0.12.20/Makefile.am 2004-09-12 14:40:35.121631656 -0400
+@@ -1,5 +1,5 @@
+ SUBDIRS = lib intl src po man testsuite
+-EXTRA_DIST = check.lrzsz COMPATABILITY README.cvs README.isdn4linux \
++EXTRA_DIST = config.rpath check.lrzsz COMPATABILITY README.cvs README.isdn4linux \
+ README.gettext rpmrc buildrpm systype.in fastcheck.sh README.tests \
+ beos-runpiped.c fastcheck.beos
+ noinst_SCRIPTS=systype
+@@ -83,3 +83,5 @@
+ rpm: $(PR).tar.gz Specfile
+ $(srcdir)/buildrpm $(srcdir)
+
++
++ACLOCAL_AMFLAGS = -I m4
+--- lrzsz-0.12.20.safe/Makefile.in 1998-12-30 11:31:40.000000000 -0500
++++ lrzsz-0.12.20/Makefile.in 2004-09-12 14:40:35.109633480 -0400
+@@ -125,7 +125,7 @@
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+ $(ACLOCAL_M4): configure.in acinclude.m4
+- cd $(srcdir) && $(ACLOCAL)
++ cd $(srcdir) && $(ACLOCAL) -I m4
+
+ config.status: $(srcdir)/configure
+ $(SHELL) ./config.status --recheck
+--- lrzsz-0.12.20.safe/mkinstalldirs 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/mkinstalldirs 2004-09-12 14:40:34.337750824 -0400
+@@ -1,34 +1,150 @@
+ #! /bin/sh
+ # mkinstalldirs --- make directory hierarchy
+-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
++
++scriptversion=2004-02-15.20
++
++# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
+ # Created: 1993-05-16
+-# Last modified: 1995-03-05
+-# Public domain
++# Public domain.
++#
++# This file is maintained in Automake, please report
++# bugs to <bug-automake@gnu.org> or send patches to
++# <automake-patches@gnu.org>.
+
+ errstatus=0
++dirmode=""
+
+-for file in ${1+"$@"} ; do
+- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+- shift
++usage="\
++Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+- pathcomp=
+- for d in ${1+"$@"} ; do
+- pathcomp="$pathcomp$d"
+- case "$pathcomp" in
+- -* ) pathcomp=./$pathcomp ;;
+- esac
++Create each directory DIR (with mode MODE, if specified), including all
++leading file name components.
+
+- if test ! -d "$pathcomp"; then
+- echo "mkdir $pathcomp" 1>&2
+- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
+- fi
++Report bugs to <bug-automake@gnu.org>."
+
+- if test ! -d "$pathcomp"; then
++# process command line arguments
++while test $# -gt 0 ; do
++ case $1 in
++ -h | --help | --h*) # -h for help
++ echo "$usage"
++ exit 0
++ ;;
++ -m) # -m PERM arg
++ shift
++ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
++ dirmode=$1
++ shift
++ ;;
++ --version)
++ echo "$0 $scriptversion"
++ exit 0
++ ;;
++ --) # stop option processing
++ shift
++ break
++ ;;
++ -*) # unknown option
++ echo "$usage" 1>&2
++ exit 1
++ ;;
++ *) # first non-opt arg
++ break
++ ;;
++ esac
++done
++
++for file
++do
++ if test -d "$file"; then
++ shift
++ else
++ break
++ fi
++done
++
++case $# in
++ 0) exit 0 ;;
++esac
++
++# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
++# mkdir -p a/c at the same time, both will detect that a is missing,
++# one will create a, then the other will try to create a and die with
++# a "File exists" error. This is a problem when calling mkinstalldirs
++# from a parallel make. We use --version in the probe to restrict
++# ourselves to GNU mkdir, which is thread-safe.
++case $dirmode in
++ '')
++ if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
++ echo "mkdir -p -- $*"
++ exec mkdir -p -- "$@"
++ else
++ # On NextStep and OpenStep, the `mkdir' command does not
++ # recognize any option. It will interpret all options as
++ # directories to create, and then abort because `.' already
++ # exists.
++ test -d ./-p && rmdir ./-p
++ test -d ./--version && rmdir ./--version
++ fi
++ ;;
++ *)
++ if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
++ test ! -d ./--version; then
++ echo "mkdir -m $dirmode -p -- $*"
++ exec mkdir -m "$dirmode" -p -- "$@"
++ else
++ # Clean up after NextStep and OpenStep mkdir.
++ for d in ./-m ./-p ./--version "./$dirmode";
++ do
++ test -d $d && rmdir $d
++ done
++ fi
++ ;;
++esac
++
++for file
++do
++ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
++ shift
++
++ pathcomp=
++ for d
++ do
++ pathcomp="$pathcomp$d"
++ case $pathcomp in
++ -*) pathcomp=./$pathcomp ;;
++ esac
++
++ if test ! -d "$pathcomp"; then
++ echo "mkdir $pathcomp"
++
++ mkdir "$pathcomp" || lasterr=$?
++
++ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+- fi
++ else
++ if test ! -z "$dirmode"; then
++ echo "chmod $dirmode $pathcomp"
++ lasterr=""
++ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+- pathcomp="$pathcomp/"
+- done
++ if test ! -z "$lasterr"; then
++ errstatus=$lasterr
++ fi
++ fi
++ fi
++ fi
++
++ pathcomp="$pathcomp/"
++ done
+ done
+
+ exit $errstatus
++
++# Local Variables:
++# mode: shell-script
++# sh-indentation: 2
++# eval: (add-hook 'write-file-hooks 'time-stamp)
++# time-stamp-start: "scriptversion="
++# time-stamp-format: "%:y-%02m-%02d.%02H"
++# time-stamp-end: "$"
++# End:
+--- lrzsz-0.12.20.safe/po/boldquot.sed 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/boldquot.sed 2004-09-12 14:40:34.723692152 -0400
+@@ -0,0 +1,10 @@
++s/"\([^"]*\)"/“\1”/g
++s/`\([^`']*\)'/â€\1’/g
++s/ '\([^`']*\)' / â€\1’ /g
++s/ '\([^`']*\)'$/ â€\1’/g
++s/^'\([^`']*\)' /â€\1’ /g
++s/“”/""/g
++s/“/“/g
++s/”/”/g
++s/â€/â€/g
++s/’/’/g
+--- lrzsz-0.12.20.safe/po/cat-id-tbl.c 1998-12-29 04:24:24.000000000 -0500
++++ lrzsz-0.12.20/po/cat-id-tbl.c 1969-12-31 19:00:00.000000000 -0500
+@@ -1,234 +0,0 @@
+-/* Automatically generated by po2tbl.sed from lrzsz.pot. */
+-
+-#if HAVE_CONFIG_H
+-# include <config.h>
+-#endif
+-
+-#include "libgettext.h"
+-
+-const struct _msg_ent _msg_tbl[] = {
+- {"", 1},
+- {"io_mode(,2) in rbsb.c not implemented\n", 2},
+- {"caught signal %d; exiting", 3},
+- {"command tries", 4},
+- {"packetlength", 5},
+- {"packetlength out of range 24..%ld", 6},
+- {"framelength", 7},
+- {"framelength out of range 32..%ld", 8},
+- {"min_bps", 9},
+- {"min_bps must be >= 0", 10},
+- {"min_bps_time", 11},
+- {"min_bps_time must be > 1", 12},
+- {"hour to large (0..23)", 13},
+- {"unparsable stop time\n", 14},
+- {"minute to large (0..59)", 15},
+- {"stop time to small", 16},
+- {"stop-at", 17},
+- {"timeout", 18},
+- {"timeout out of range 10..1000", 19},
+- {"security violation: can't do that under restricted shell\n", 20},
+- {"window size", 21},
+- {"cannot turnoff syslog", 22},
+- {"startup delay", 23},
+- {"out of memory", 24},
+- {"this program was never intended to be used setuid\n", 25},
+- {"need at least one file to send", 26},
+- {"Can't send command in restricted mode\n", 27},
+- {"hostname too long\n", 28},
+- {"illegal server address\n", 29},
+- {"can read only one file from stdin", 30},
+- {"Transfer incomplete\n", 31},
+- {"Transfer complete\n", 32},
+- {"send_pseudo %s: cannot open tmpfile %s: %s", 33},
+- {"send_pseudo %s: cannot lstat tmpfile %s: %s", 34},
+- {"send_pseudo %s: avoiding symlink trap", 35},
+- {"send_pseudo %s: cannot write to tmpfile %s: %s", 36},
+- {"send_pseudo %s: failed", 37},
+- {"send_pseudo %s: ok", 38},
+- {"tcp protocol init failed\n", 39},
+- {"Answering TIMESYNC at %s", 40},
+- {"timezone", 41},
+- {"timezone unknown", 42},
+- {"Can't open any requested files.", 43},
+- {"security violation: not allowed to upload from %s", 44},
+- {"cannot open %s", 45},
+- {"is not a file: %s", 46},
+- {"%s/%s: error occured", 47},
+- {"skipped: %s", 48},
+- {"%s/%s: skipped", 49},
+- {"Bytes Sent:%7ld BPS:%-8ld \n", 50},
+- {"Sending %s, %ld blocks: ", 51},
+- {"Give your local XMODEM receive command now.", 52},
+- {"Sending: %s\n", 53},
+- {"Timeout on pathname", 54},
+- {"Receiver Cancelled", 55},
+- {"No ACK on EOT", 56},
+- {"Xmodem sectors/kbytes sent: %3d/%2dk", 57},
+- {"Ymodem sectors/kbytes sent: %3d/%2dk", 58},
+- {"Cancelled", 59},
+- {"Timeout on sector ACK", 60},
+- {"NAK on sector", 61},
+- {"Got burst for sector ACK", 62},
+- {"Got %02x for sector ACK", 63},
+- {"Retry Count Exceeded", 64},
+- {"Try `%s --help' for more information.\n", 65},
+- {"%s version %s\n", 66},
+- {"Usage: %s [options] file ...\n", 67},
+- {" or: %s [options] -{c|i} COMMAND\n", 68},
+- {"Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n", 69},
+- {"\
+- (X) = option applies to XMODEM only\n\
+- (Y) = option applies to YMODEM only\n\
+- (Z) = option applies to ZMODEM only\n", 70},
+- {"\
+- -+, --append append to existing destination file (Z)\n\
+- -2, --twostop use 2 stop bits\n\
+- -4, --try-4k go up to 4K blocksize\n\
+- --start-4k start with 4K blocksize (doesn't try 8)\n\
+- -8, --try-8k go up to 8K blocksize\n\
+- --start-8k start with 8K blocksize\n\
+- -a, --ascii ASCII transfer (change CR/LF to LF)\n\
+- -b, --binary binary transfer\n\
+- -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
+- -c, --command COMMAND execute remote command COMMAND (Z)\n\
+- -C, --command-tries N try N times to execute a command (Z)\n\
+- -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n\
+- --delay-startup N sleep N seconds before doing anything\n\
+- -e, --escape escape all control characters (Z)\n\
+- -E, --rename force receiver to rename files it already has\n\
+- -f, --full-path send full pathname (Y/Z)\n\
+- -i, --immediate-command CMD send remote CMD, return immediately (Z)\n\
+- -h, --help print this usage message\n\
+- -k, --1k send 1024 byte packets (X)\n\
+- -L, --packetlen N limit subpacket length to N bytes (Z)\n\
+- -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n\
+- -m, --min-bps N stop transmission if BPS below N\n\
+- -M, --min-bps-time N for at least N seconds (default: 120)\n", 71},
+- {"\
+- -n, --newer send file if source newer (Z)\n\
+- -N, --newer-or-longer send file if source newer or longer (Z)\n\
+- -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n\
+- -O, --disable-timeouts disable timeout code, wait forever\n\
+- -p, --protect protect existing destination file (Z)\n\
+- -r, --resume resume interrupted file transfer (Z)\n\
+- -R, --restricted restricted, more secure mode\n\
+- -q, --quiet quiet (no progress reports)\n\
+- -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
+- --tcp build a TCP connection to transmit files\n\
+- --tcp-server open socket, wait for connection\n\
+- -u, --unlink unlink file after transmission\n\
+- -U, --unrestrict turn off restricted mode (if allowed to)\n\
+- -v, --verbose be verbose, provide debugging information\n\
+- -w, --windowsize N Window is N bytes (Z)\n\
+- -X, --xmodem use XMODEM protocol\n\
+- -y, --overwrite overwrite existing files\n\
+- -Y, --overwrite-or-skip overwrite existing files, else skip\n\
+- --ymodem use YMODEM protocol\n\
+- -Z, --zmodem use ZMODEM protocol\n\
+-\n\
+-short options use the same arguments as the long ones\n", 72},
+- {"got ZRQINIT", 73},
+- {"got ZCAN", 74},
+- {"blklen now %d\n", 75},
+- {"zsendfdata: bps rate %ld below min %ld", 76},
+- {"zsendfdata: reached stop time", 77},
+- {"Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d ", 78},
+- {"calc_blklen: reduced to %d due to error\n", 79},
+- {"calc_blklen: returned old value %d due to low bpe diff\n", 80},
+- {"calc_blklen: old %ld, new %ld, d %ld\n", 81},
+- {"calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n", 82},
+- {"calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n", 83},
+- {"calc_blklen: returned %d as best\n", 84},
+- {"\
+-\n\
+-countem: Total %d %ld\n", 85},
+- {"Bad escape sequence %x", 86},
+- {"Sender Canceled", 87},
+- {"TIMEOUT", 88},
+- {"Bad data subpacket", 89},
+- {"Data subpacket too long", 90},
+- {"Garbage count exceeded", 91},
+- {"Got %s", 92},
+- {"Retry %d: ", 93},
+- {"don't have settimeofday, will not set time\n", 94},
+- {"not running as root (this is good!), can not set time\n", 95},
+- {"bytes_per_error", 96},
+- {"bytes-per-error should be >100", 97},
+- {"O_SYNC not supported by the kernel", 98},
+- {"garbage on commandline", 99},
+- {"Usage: %s [options] [filename.if.xmodem]\n", 100},
+- {"Receive files with ZMODEM/YMODEM/XMODEM protocol\n", 101},
+- {"\
+- -+, --append append to existing files\n\
+- -a, --ascii ASCII transfer (change CR/LF to LF)\n\
+- -b, --binary binary transfer\n\
+- -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
+- -c, --with-crc Use 16 bit CRC (X)\n\
+- -C, --allow-remote-commands allow execution of remote commands (Z)\n\
+- -D, --null write all received data to /dev/null\n\
+- --delay-startup N sleep N seconds before doing anything\n\
+- -e, --escape Escape control characters (Z)\n\
+- -E, --rename rename any files already existing\n\
+- --errors N generate CRC error every N bytes (debugging)\n\
+- -h, --help Help, print this usage message\n\
+- -m, --min-bps N stop transmission if BPS below N\n\
+- -M, --min-bps-time N for at least N seconds (default: 120)\n\
+- -O, --disable-timeouts disable timeout code, wait forever for data\n\
+- --o-sync open output file(s) in synchronous write mode\n\
+- -p, --protect protect existing files\n\
+- -q, --quiet quiet, no progress reports\n\
+- -r, --resume try to resume interrupted file transfer (Z)\n\
+- -R, --restricted restricted, more secure mode\n\
+- -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
+- -S, --timesync request remote time (twice: set local time)\n\
+- --syslog[=off] turn syslog on or off, if possible\n\
+- -t, --timeout N set timeout to N tenths of a second\n\
+- -u, --keep-uppercase keep upper case filenames\n\
+- -U, --unrestrict disable restricted mode (if allowed to)\n\
+- -v, --verbose be verbose, provide debugging information\n\
+- -w, --windowsize N Window is N bytes (Z)\n\
+- -X --xmodem use XMODEM protocol\n\
+- -y, --overwrite Yes, clobber existing file if any\n\
+- --ymodem use YMODEM protocol\n\
+- -Z, --zmodem use ZMODEM protocol\n\
+-\n\
+-short options use the same arguments as the long ones\n", 102},
+- {"%s waiting to receive.", 103},
+- {"\rBytes received: %7ld/%7ld BPS:%-6ld \r\n", 104},
+- {"%s: ready to receive %s", 105},
+- {"\rBytes received: %7ld BPS:%-6ld \r\n", 106},
+- {"\
+-\r\n\
+-%s: %s removed.\r\n", 107},
+- {"Pathname fetch returned EOT", 108},
+- {"Received dup Sector", 109},
+- {"Sync Error", 110},
+- {"CRC", 111},
+- {"Checksum", 112},
+- {"Sector number garbled", 113},
+- {"Sender Cancelled", 114},
+- {"Got 0%o sector header", 115},
+- {"file name ends with a /, skipped: %s\n", 116},
+- {"zmanag=%d, Lzmanag=%d\n", 117},
+- {"zconv=%d\n", 118},
+- {"file exists, skipped: %s\n", 119},
+- {"TIMESYNC: here %ld, remote %ld, diff %ld seconds\n", 120},
+- {"TIMESYNC: cannot set time: %s\n", 121},
+- {"cannot tmpfile() for tcp protocol synchronization", 122},
+- {"Topipe", 123},
+- {"Receiving: %s\n", 124},
+- {"Blocks received: %d", 125},
+- {"%s: %s exists\n", 126},
+- {"%s:\tSecurity Violation", 127},
+- {"remote command execution requested", 128},
+- {"not executed", 129},
+- {"got ZRINIT", 130},
+- {"Skipped", 131},
+- {"rzfile: bps rate %ld below min %ld", 132},
+- {"rzfile: reached stop time", 133},
+- {"\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d ", 134},
+- {"fgets for tcp protocol synchronization failed: ", 135},
+- {"file close error", 136},
+-};
+-
+-int _msg_tbl_length = 136;
+--- lrzsz-0.12.20.safe/po/ChangeLog 1998-04-26 09:20:52.000000000 -0400
++++ lrzsz-0.12.20/po/ChangeLog 2004-09-12 14:40:34.793681512 -0400
+@@ -1,3 +1,15 @@
++2004-09-12 gettextize <bug-gnu-gettext@gnu.org>
++
++ * boldquot.sed: New file, from gettext-0.14.1.
++ * en@boldquot.header: New file, from gettext-0.14.1.
++ * en@quot.header: New file, from gettext-0.14.1.
++ * insert-header.sin: New file, from gettext-0.14.1.
++ * quot.sed: New file, from gettext-0.14.1.
++ * remove-potcdate.sin: New file, from gettext-0.14.1.
++ * Rules-quot: New file, from gettext-0.14.1.
++ * cat-id-tbl.c: Remove file.
++ * stamp-cat-id: Remove file.
++
+ /* Automatically generated by po2tbl.sed from lrzsz.pot. */
+
+ #if HAVE_CONFIG_H
+--- lrzsz-0.12.20.safe/po/en@boldquot.header 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/en@boldquot.header 2004-09-12 14:40:34.731690936 -0400
+@@ -0,0 +1,25 @@
++# All this catalog "translates" are quotation characters.
++# The msgids must be ASCII and therefore cannot contain real quotation
++# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
++# and double quote (0x22). These substitutes look strange; see
++# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
++#
++# This catalog translates grave accent (0x60) and apostrophe (0x27) to
++# left single quotation mark (U+2018) and right single quotation mark (U+2019).
++# It also translates pairs of apostrophe (0x27) to
++# left single quotation mark (U+2018) and right single quotation mark (U+2019)
++# and pairs of quotation mark (0x22) to
++# left double quotation mark (U+201C) and right double quotation mark (U+201D).
++#
++# When output to an UTF-8 terminal, the quotation characters appear perfectly.
++# When output to an ISO-8859-1 terminal, the single quotation marks are
++# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
++# grave/acute accent (by libiconv), and the double quotation marks are
++# transliterated to 0x22.
++# When output to an ASCII terminal, the single quotation marks are
++# transliterated to apostrophes, and the double quotation marks are
++# transliterated to 0x22.
++#
++# This catalog furthermore displays the text between the quotation marks in
++# bold face, assuming the VT100/XTerm escape sequences.
++#
+--- lrzsz-0.12.20.safe/po/en@quot.header 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/en@quot.header 2004-09-12 14:40:34.737690024 -0400
+@@ -0,0 +1,22 @@
++# All this catalog "translates" are quotation characters.
++# The msgids must be ASCII and therefore cannot contain real quotation
++# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
++# and double quote (0x22). These substitutes look strange; see
++# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
++#
++# This catalog translates grave accent (0x60) and apostrophe (0x27) to
++# left single quotation mark (U+2018) and right single quotation mark (U+2019).
++# It also translates pairs of apostrophe (0x27) to
++# left single quotation mark (U+2018) and right single quotation mark (U+2019)
++# and pairs of quotation mark (0x22) to
++# left double quotation mark (U+201C) and right double quotation mark (U+201D).
++#
++# When output to an UTF-8 terminal, the quotation characters appear perfectly.
++# When output to an ISO-8859-1 terminal, the single quotation marks are
++# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
++# grave/acute accent (by libiconv), and the double quotation marks are
++# transliterated to 0x22.
++# When output to an ASCII terminal, the single quotation marks are
++# transliterated to apostrophes, and the double quotation marks are
++# transliterated to 0x22.
++#
+--- lrzsz-0.12.20.safe/po/insert-header.sin 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/insert-header.sin 2004-09-12 14:40:34.743689112 -0400
+@@ -0,0 +1,23 @@
++# Sed script that inserts the file called HEADER before the header entry.
++#
++# At each occurrence of a line starting with "msgid ", we execute the following
++# commands. At the first occurrence, insert the file. At the following
++# occurrences, do nothing. The distinction between the first and the following
++# occurrences is achieved by looking at the hold space.
++/^msgid /{
++x
++# Test if the hold space is empty.
++s/m/m/
++ta
++# Yes it was empty. First occurrence. Read the file.
++r HEADER
++# Output the file's contents by reading the next line. But don't lose the
++# current line while doing this.
++g
++N
++bb
++:a
++# The hold space was nonempty. Following occurrences. Do nothing.
++x
++:b
++}
+--- lrzsz-0.12.20.safe/po/Makevars 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/Makevars 2004-09-12 14:40:34.748688352 -0400
+@@ -0,0 +1,41 @@
++# Makefile variables for PO directory in any package using GNU gettext.
++
++# Usually the message domain is the same as the package name.
++DOMAIN = $(PACKAGE)
++
++# These two variables depend on the location of this directory.
++subdir = po
++top_builddir = ..
++
++# These options get passed to xgettext.
++XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
++
++# This is the copyright holder that gets inserted into the header of the
++# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
++# package. (Note that the msgstr strings, extracted from the package's
++# sources, belong to the copyright holder of the package.) Translators are
++# expected to transfer the copyright for their translations to this person
++# or entity, or to disclaim their copyright. The empty string stands for
++# the public domain; in this case the translators are expected to disclaim
++# their copyright.
++COPYRIGHT_HOLDER = Free Software Foundation, Inc.
++
++# This is the email address or URL to which the translators shall report
++# bugs in the untranslated strings:
++# - Strings which are not entire sentences, see the maintainer guidelines
++# in the GNU gettext documentation, section 'Preparing Strings'.
++# - Strings which use unclear terms or require additional context to be
++# understood.
++# - Strings which make invalid assumptions about notation of date, time or
++# money.
++# - Pluralisation problems.
++# - Incorrect English spelling.
++# - Incorrect formatting.
++# It can be your email address, or a mailing list address where translators
++# can write to without being subscribed, or the URL of a web page through
++# which the translators can contact you.
++MSGID_BUGS_ADDRESS =
++
++# This is the list of locale categories, beyond LC_MESSAGES, for which the
++# message catalogs shall be used. It is usually empty.
++EXTRA_LOCALE_CATEGORIES =
+--- lrzsz-0.12.20.safe/po/quot.sed 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/quot.sed 2004-09-12 14:40:34.754687440 -0400
+@@ -0,0 +1,6 @@
++s/"\([^"]*\)"/“\1”/g
++s/`\([^`']*\)'/â€\1’/g
++s/ '\([^`']*\)' / â€\1’ /g
++s/ '\([^`']*\)'$/ â€\1’/g
++s/^'\([^`']*\)' /â€\1’ /g
++s/“”/""/g
+--- lrzsz-0.12.20.safe/po/remove-potcdate.sin 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/remove-potcdate.sin 2004-09-12 14:40:34.762686224 -0400
+@@ -0,0 +1,19 @@
++# Sed script that remove the POT-Creation-Date line in the header entry
++# from a POT file.
++#
++# The distinction between the first and the following occurrences of the
++# pattern is achieved by looking at the hold space.
++/^"POT-Creation-Date: .*"$/{
++x
++# Test if the hold space is empty.
++s/P/P/
++ta
++# Yes it was empty. First occurrence. Remove the line.
++g
++d
++bb
++:a
++# The hold space was nonempty. Following occurrences. Do nothing.
++x
++:b
++}
+--- lrzsz-0.12.20.safe/po/Rules-quot 1969-12-31 19:00:00.000000000 -0500
++++ lrzsz-0.12.20/po/Rules-quot 2004-09-12 14:40:34.778683792 -0400
+@@ -0,0 +1,47 @@
++# Special Makefile rules for English message catalogs with quotation marks.
++
++DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
++
++.SUFFIXES: .insert-header .po-update-en
++
++en@quot.po-create:
++ $(MAKE) en@quot.po-update
++en@boldquot.po-create:
++ $(MAKE) en@boldquot.po-update
++
++en@quot.po-update: en@quot.po-update-en
++en@boldquot.po-update: en@boldquot.po-update-en
++
++.insert-header.po-update-en:
++ @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
++ if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
++ tmpdir=`pwd`; \
++ echo "$$lang:"; \
++ ll=`echo $$lang | sed -e 's/@.*//'`; \
++ LC_ALL=C; export LC_ALL; \
++ cd $(srcdir); \
++ 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 \
++ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
++ rm -f $$tmpdir/$$lang.new.po; \
++ else \
++ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
++ :; \
++ else \
++ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
++ exit 1; \
++ fi; \
++ fi; \
++ else \
++ echo "creation of $$lang.po failed!" 1>&2; \
++ rm -f $$tmpdir/$$lang.new.po; \
++ fi
++
++en@quot.insert-header: insert-header.sin
++ sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
++
++en@boldquot.insert-header: insert-header.sin
++ sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
++
++mostlyclean: mostlyclean-quot
++mostlyclean-quot:
++ rm -f *.insert-header
+--- lrzsz-0.12.20.safe/po/stamp-cat-id 1998-12-30 02:50:01.000000000 -0500
++++ lrzsz-0.12.20/po/stamp-cat-id 1969-12-31 19:00:00.000000000 -0500
+@@ -1 +0,0 @@
+-timestamp
+--- lrzsz-0.12.20.safe/src/Makefile.am 1998-12-28 03:38:47.000000000 -0500
++++ lrzsz-0.12.20/src/Makefile.am 2004-09-12 14:40:53.665812512 -0400
+@@ -2,12 +2,12 @@
+ lrz_SOURCES=lrz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+ lsz_SOURCES=lsz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+ noinst_HEADERS = timing.h zglobal.h zmodem.h
+-datadir = $(prefix)/@DATADIRNAME@
++datadir = $(prefix)/share
+ localedir = $(datadir)/locale
+ CFLAGS=@CFLAGS@
+ DISTCLEAN_FILES=lrzszbug
+
+-LDADD = ../lib/libzmodem.a @INTLLIBS@
++LDADD = ../lib/libzmodem.a @LIBINTL@
+ AUTOMAKE_OPTIONS=ansi2knr
+ EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
+ INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch
new file mode 100644
index 000000000..9e46dfa07
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz-check-locale.h.patch
@@ -0,0 +1,32 @@
+From 28b473c3c96682a820e292cc1be006e19aee11bc Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Fri, 24 May 2013 01:07:24 -0400
+Subject: [PATCH] lrzsz check locale.h
+
+fix the build failure when using -O0 in a debug build:
+lrz.c:284:13: error: 'LC_ALL' undeclared (first use in this function)
+
+Upstream-Status: Submitted [uwe@ohse.de]
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+---
+ configure.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.in b/configure.in
+index 6e2064c..c10460c 100644
+--- a/configure.in
++++ b/configure.in
+@@ -130,7 +130,7 @@ AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/times.h)
+ LRZSZ_HEADERS_TERM_IO
+ AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)
+ AC_CHECK_HEADERS(sys/mman.h utime.h syslog.h sys/syslog.h sys/param.h)
+-AC_CHECK_HEADERS(sys/select.h strings.h arpa/inet.h)
++AC_CHECK_HEADERS(sys/select.h strings.h locale.h arpa/inet.h)
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_TYPE_SIZE_T
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch
new file mode 100644
index 000000000..b4529f4c7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/lrzsz_fix_for_automake-1.12.patch
@@ -0,0 +1,49 @@
+Upstream-Status: Pending
+
+This patch fixes following issue with automake 1.12
+
+| configure.in:95: error: automatic de-ANSI-fication support has been removed
+...
+| lib/Makefile.am:3: error: automatic de-ANSI-fication support has been removed
+| lib/Makefile.am: installing './depcomp'
+| src/Makefile.am:11: error: automatic de-ANSI-fication support has been removed
+
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
+2012/05/03
+
+Index: lrzsz-0.12.20/configure.in
+===================================================================
+--- lrzsz-0.12.20.orig/configure.in
++++ lrzsz-0.12.20/configure.in
+@@ -92,7 +92,6 @@ AC_PROG_RANLIB
+ AC_ISC_POSIX
+ AC_AIX
+ AC_MINIX
+-AM_C_PROTOTYPES
+ AC_C_CONST
+ AC_C_INLINE
+
+Index: lrzsz-0.12.20/lib/Makefile.am
+===================================================================
+--- lrzsz-0.12.20.orig/lib/Makefile.am
++++ lrzsz-0.12.20/lib/Makefile.am
+@@ -1,6 +1,5 @@
+ noinst_LIBRARIES=libzmodem.a
+ CFLAGS=@CFLAGS@
+-AUTOMAKE_OPTIONS=ansi2knr
+
+ EXTRA_DIST = alloca.c ansi2knr.1 ansi2knr.c \
+ getopt.c getopt1.c mkdir.c mktime.c \
+Index: lrzsz-0.12.20/src/Makefile.am
+===================================================================
+--- lrzsz-0.12.20.orig/src/Makefile.am
++++ lrzsz-0.12.20/src/Makefile.am
+@@ -8,7 +8,6 @@ CFLAGS=@CFLAGS@
+ DISTCLEAN_FILES=lrzszbug
+
+ LDADD = ../lib/libzmodem.a @LIBINTL@
+-AUTOMAKE_OPTIONS=ansi2knr
+ EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
+ INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
+ #DEFS = -DLOCALEDIR=\"$(localedir)\" -DOS=\"@host_os@\" -DCPU=\"@host_cpu@\"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch
new file mode 100644
index 000000000..ace592c8f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz-0.12.20/makefile.patch
@@ -0,0 +1,22 @@
+Upstream-Status: Inappropriate [configuration]
+
+diff -ruN lrzsz-0.12.20_org/src/Makefile.in lrzsz-0.12.20_patch/src/Makefile.in
+--- lrzsz-0.12.20_org/src/Makefile.in 1998-12-30 17:31:46.000000000 +0100
++++ lrzsz-0.12.20_patch/src/Makefile.in 2004-04-29 13:57:33.434909656 +0200
+@@ -372,13 +372,13 @@
+ rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
+- rm -f $(bindir)/`echo lsx | sed -e '$(transform)'`
++ rm -f $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
+- rm -f $(bindir)/`echo lrb | sed -e '$(transform)'`
++ rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
+- rm -f $(bindir)/`echo lrx | sed -e '$(transform)'`
++ rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
+ # rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'`
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb
new file mode 100644
index 000000000..4b349be32
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb
@@ -0,0 +1,48 @@
+SUMMARY = "Tools for zmodem/xmodem/ymodem file transfer"
+DESCRIPTION = "Lrzsz is a cosmetically modified zmodem/ymodem/xmodem package built from \
+the public-domain version of Chuck Forsberg's rzsz package. \
+These programs use error correcting protocols ({z,x,y}modem) to send (sz, sx, sb) and \
+receive (rz, rx, rb) files over a dial-in serial port from a variety of programs \
+running under various operating systems. "
+HOMEPAGE = "http://www.ohse.de/uwe/software/lrzsz.html"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
+ file://src/lrz.c;beginline=1;endline=10;md5=5276956373ff7d8758837f6399a1045f"
+SECTION = "console/network"
+DEPENDS = ""
+PR = "r6"
+
+SRC_URI = "http://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \
+ file://autotools.patch \
+ file://makefile.patch \
+ file://gettext.patch \
+ file://acdefine.patch \
+ file://lrzsz_fix_for_automake-1.12.patch \
+ file://lrzsz-check-locale.h.patch \
+ "
+
+SRC_URI[md5sum] = "b5ce6a74abc9b9eb2af94dffdfd372a4"
+SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
+
+UPSTREAM_CHECK_URI = "http://ohse.de/uwe/software/lrzsz.html"
+
+inherit autotools gettext
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 src/lrz src/lsz ${D}${bindir}/
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN} = "rz rx rb sz sx sb"
+
+ALTERNATIVE_TARGET[rz] = "${bindir}/lrz"
+ALTERNATIVE_TARGET[rx] = "${bindir}/lrz"
+ALTERNATIVE_TARGET[rb] = "${bindir}/lrz"
+
+ALTERNATIVE_TARGET[sz] = "${bindir}/lsz"
+ALTERNATIVE_TARGET[sx] = "${bindir}/lsz"
+ALTERNATIVE_TARGET[sb] = "${bindir}/lsz"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/configure.patch b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/configure.patch
new file mode 100644
index 000000000..66c9f9163
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/configure.patch
@@ -0,0 +1,104 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+---
+
+7/30/2010 - rebased to 3.1.5 by Qing He <qing.he@intel.com>
+1/22/2012 - rebased to 3.1.9 by Shane Wang <shane.wang@intel.com>
+
+diff -r af2b10cc3c14 Makefile
+--- a/Makefile Sun Jan 22 18:36:34 2012 +0800
++++ b/Makefile Sun Jan 22 18:38:54 2012 +0800
+@@ -37,7 +37,6 @@
+ # Commands
+ INSTALL=install
+ DIRINSTALL=install -d
+-STRIP=-s
+ CC=$(CROSS_COMPILE)gcc
+ AR=$(CROSS_COMPILE)ar
+ RANLIB=$(CROSS_COMPILE)ranlib
+@@ -86,7 +85,7 @@
+ example.o: example.c $(PCIINC)
+
+ %: %.o
+- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
++ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@
+
+ %.8 %.7: %.man
+ 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)#"
+@@ -101,7 +100,7 @@
+ install: all
+ # -c is ignored on Linux, but required on FreeBSD
+ $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
+- $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
++ $(INSTALL) -c -m 755 lspci setpci $(DESTDIR)$(SBINDIR)
+ $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
+ $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
+ $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
+diff -r af2b10cc3c14 lib/configure
+--- a/lib/configure Sun Jan 22 18:36:34 2012 +0800
++++ b/lib/configure Sun Jan 22 18:38:54 2012 +0800
+@@ -14,6 +14,10 @@
+ fi
+ }
+
++VERSION=$1
++IDSDIR=$2
++DNS=yes
++
+ if [ -z "$VERSION" -o -z "$IDSDIR" ] ; then
+ echo >&2 "Please run the configure script from the top-level Makefile"
+ exit 1
+@@ -21,8 +25,8 @@
+
+ echo_n "Configuring libpci for your system..."
+ if [ -z "$HOST" ] ; then
+- sys=`uname -s`
+- rel=`uname -r`
++ sys=${3:-`uname -s`}
++ rel=
+ realsys="$sys"
+ if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
+ then
+@@ -30,7 +34,7 @@
+ proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
+ cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
+ else
+- cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
++ cpu=${4:-`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`}
+ fi
+ if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
+ then
+@@ -40,7 +44,7 @@
+ then
+ sys=cygwin
+ fi
+- HOST=${3:-$cpu-$sys}
++ HOST=$cpu-$sys
+ fi
+ [ -n "$RELEASE" ] && rel="${RELEASE}"
+ # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
+@@ -49,6 +53,21 @@
+ sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ echo " $host $rel $cpu $sys"
+
++if [ "$host" = "linux--gnueabi" ]
++then
++ sys=linux
++fi
++
++if [ "$host" = "linux--uclibc" ]
++then
++ sys=linux
++fi
++
++if [ "$host" = "linux--uclibceabi" ]
++then
++ sys=linux
++fi
++
+ c=config.h
+ m=config.mk
+ echo >$c '#define PCI_CONFIG_H'
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch
new file mode 100644
index 000000000..540b4a0d1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/guess-fix.patch
@@ -0,0 +1,37 @@
+the original guess algorithm is broken for many archs
+for example, the following two would break:
+ arm-linux-gnueabi --> sys=gnueabi
+ x86_64-unknown-pc-linux-gnu --> sys = pc-linux-gnu
+
+use a simpler scheme here and hope it works for all the cases
+
+Upstream-Status: Pending
+
+7/30/2010 - created by Qing He <qing.he@intel.com>
+
+diff --git a/lib/configure b/lib/configure
+index 4318b05..84f6acb 100755
+--- a/lib/configure
++++ b/lib/configure
+@@ -53,20 +53,7 @@ cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ echo " $host $rel $cpu $sys"
+
+-if [ "$host" = "linux--gnueabi" ]
+-then
+- sys=linux
+-fi
+-
+-if [ "$host" = "linux--uclibc" ]
+-then
+- sys=linux
+-fi
+-
+-if [ "$host" = "linux--uclibceabi" ]
+-then
+- sys=linux
+-fi
++{ echo "$host" | grep linux; } && sys=linux
+
+ c=config.h
+ m=config.mk
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/makefile.patch b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/makefile.patch
new file mode 100644
index 000000000..c3fbc6f9b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils/makefile.patch
@@ -0,0 +1,26 @@
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Ionut Radu <ionutx.radu@intel.com>
+
+Index: pciutils-3.2.0/Makefile
+===================================================================
+--- pciutils-3.2.0.orig/Makefile
++++ pciutils-3.2.0/Makefile
+@@ -35,7 +35,7 @@ SHAREDIR=$(PREFIX)/share
+ IDSDIR=$(SHAREDIR)
+ MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
+ INCDIR=$(PREFIX)/include
+-LIBDIR=$(PREFIX)/lib
++LIBDIR=$(libdir)
+ PKGCFDIR=$(LIBDIR)/pkgconfig
+
+ # Commands
+@@ -94,7 +94,7 @@ example: example.o lib/$(PCILIB_DEV)
+ example.o: example.c $(PCIINC)
+
+ %: %.o
+- $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) -o $@
++ $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) $(LDLIBS) -o $@
+
+ %.8 %.7: %.man
+ 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/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils_3.4.1.bb b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils_3.4.1.bb
new file mode 100644
index 000000000..33be525c5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pciutils/pciutils_3.4.1.bb
@@ -0,0 +1,60 @@
+SUMMARY = "PCI utilities"
+DESCRIPTION = 'The PCI Utilities package contains a library for portable access \
+to PCI bus configuration space and several utilities based on this library.'
+HOMEPAGE = "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml"
+SECTION = "console/utils"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+DEPENDS = "zlib kmod"
+
+SRC_URI = "${KERNELORG_MIRROR}/software/utils/pciutils/pciutils-${PV}.tar.xz \
+ file://configure.patch \
+ file://guess-fix.patch \
+ file://makefile.patch"
+
+SRC_URI[md5sum] = "35763bb1eab7bc9bf6eb6efb72cbc8a1"
+SRC_URI[sha256sum] = "865554cc5604d1644bd8da38d94845405e2a319a6d5acabc6a0296417684a82a"
+
+inherit multilib_header
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'hwdb', '', d)}"
+PACKAGECONFIG[hwdb] = "HWDB=yes,HWDB=no,udev"
+
+PCI_CONF_FLAG = "ZLIB=yes DNS=yes SHARED=yes"
+
+# see configure.patch
+do_configure () {
+ (
+ cd lib && \
+ # EXTRA_OECONF for this recipe could only possibly contain 'HWDB=yes/no', so we put it
+ # before ./configure
+ ${PCI_CONF_FLAG} ${EXTRA_OECONF} ./configure ${PV} ${datadir} ${TARGET_OS} ${TARGET_ARCH}
+ )
+}
+
+export PREFIX = "${prefix}"
+export SBINDIR = "${sbindir}"
+export SHAREDIR = "${datadir}"
+export MANDIR = "${mandir}"
+
+EXTRA_OEMAKE = "-e MAKEFLAGS= ${PCI_CONF_FLAG}"
+
+# The configure script breaks if the HOST variable is set
+HOST[unexport] = "1"
+
+do_install () {
+ oe_runmake DESTDIR=${D} install install-lib
+
+ install -d ${D}${bindir}
+ ln -s ../sbin/lspci ${D}${bindir}/lspci
+
+ oe_multilib_header pci/config.h
+}
+
+PACKAGES =+ "${PN}-ids libpci"
+FILES_${PN}-ids = "${datadir}/pci.ids*"
+FILES_libpci = "${libdir}/libpci.so.*"
+SUMMARY_${PN}-ids = "PCI utilities - device ID database"
+DESCRIPTION_${PN}-ids = "Package providing the PCI device ID database for pciutils."
+RDEPENDS_${PN} += "${PN}-ids"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
new file mode 100644
index 000000000..d4c2bed15
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/lex_sys_types.patch
@@ -0,0 +1,21 @@
+Include sys/types.h for u_long definition
+
+Fix errors like
+In file included from src/lex_config.l:34:0:
+src/yacc_config.y:45:5: error: unknown type name 'u_long'
+ u_long num;
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: pcmciautils-018/src/lex_config.l
+===================================================================
+--- pcmciautils-018.orig/src/lex_config.l
++++ pcmciautils-018/src/lex_config.l
+@@ -22,6 +22,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <syslog.h>
++#include <sys/types.h>
+
+ #ifdef HAS_WORDEXP
+ #include <wordexp.h>
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch
new file mode 100644
index 000000000..7b0ce2119
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_fix.patch
@@ -0,0 +1,101 @@
+Upstream-Status: Inappropriate [configuration]
+
+Hardcoded paths are bad...
+This lets us use the install from OE's native sysroot
+rebase the patch to 018, removing hardcoded path for true
+as well. Removing of -D in install invocation is a little
+questionable, is it some GNU extention?
+
+-Khem Raj <raj.khem@gmail.com>
+
+Index: pcmciautils-018/Makefile
+===================================================================
+--- pcmciautils-018.orig/Makefile
++++ pcmciautils-018/Makefile
+@@ -76,7 +76,7 @@ sbindir = ${exec_prefix}/sbin
+ mandir = ${prefix}/usr/share/man
+ udevdir = ${prefix}/lib/udev
+
+-INSTALL = /usr/bin/install -c
++INSTALL = install -c
+ INSTALL_PROGRAM = ${INSTALL}
+ INSTALL_DATA = ${INSTALL} -m 644
+ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+@@ -180,7 +180,7 @@ endif
+ # if DEBUG is enabled, then we do not strip or optimize
+ ifeq ($(strip $(DEBUG)),true)
+ CFLAGS += -O1 -g -DDEBUG -D_GNU_SOURCE
+- STRIPCMD = /bin/true -Since_we_are_debugging
++ STRIPCMD = true -Since_we_are_debugging
+ else
+ CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE
+ STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
+@@ -273,30 +273,32 @@ clean:
+
+ install-hotplug:
+ $(INSTALL) -d $(DESTDIR)$(hotplugdir)
+- $(INSTALL_PROGRAM) -D hotplug/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.agent
+- $(INSTALL_PROGRAM) -D hotplug/pcmcia.rc $(DESTDIR)$(hotplugdir)/pcmcia.rc
++ $(INSTALL_PROGRAM) hotplug/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.agent
++ $(INSTALL_PROGRAM) hotplug/pcmcia.rc $(DESTDIR)$(hotplugdir)/pcmcia.rc
+
+ uninstall-hotplug:
+ - rm -f $(DESTDIR)$(hotplugdir)/pcmcia.agent $(DESTDIR)$(hotplugdir)/pcmcia.rc
+
+ install-socket-hotplug:
+- $(INSTALL_PROGRAM) -D hotplug/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent
+- $(INSTALL_PROGRAM) -D hotplug/pcmcia_socket.rc $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
++ $(INSTALL_PROGRAM) hotplug/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent
++ $(INSTALL_PROGRAM) hotplug/pcmcia_socket.rc $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
+
+ uninstall-socket-hotplug:
+ - rm -f $(DESTDIR)$(hotplugdir)/pcmcia_socket.agent $(DESTDIR)$(hotplugdir)/pcmcia_socket.rc
+
+ install-socket-tools:
+- $(INSTALL_PROGRAM) -D $(PCMCIA_SOCKET_STARTUP) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
++ $(INSTALL) -d $(DESTDIR)$(udevhelperdir)
++ $(INSTALL_PROGRAM) $(PCMCIA_SOCKET_STARTUP) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
+
+ uninstall-socket-tools:
+ - rm -f $(DESTDIR)$(udevhelperdir)/$(PCMCIA_SOCKET_STARTUP)
+
+ install-tools:
+ $(INSTALL) -d $(DESTDIR)$(sbindir)
+- $(INSTALL_PROGRAM) -D $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(PCCARDCTL)
++ $(INSTALL) -d $(DESTDIR)$(udevhelperdir)
++ $(INSTALL_PROGRAM) $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(PCCARDCTL)
+ $(SYMLINK) $(PCCARDCTL) $(DESTDIR)$(sbindir)/$(LSPCMCIA)
+- $(INSTALL_PROGRAM) -D $(PCMCIA_CHECK_BROKEN_CIS) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_CHECK_BROKEN_CIS)
++ $(INSTALL_PROGRAM) $(PCMCIA_CHECK_BROKEN_CIS) $(DESTDIR)$(udevhelperdir)/$(PCMCIA_CHECK_BROKEN_CIS)
+
+ uninstall-tools:
+ - rm -f $(DESTDIR)$(sbindir)/$(PCCARDCTL)
+@@ -305,22 +307,24 @@ uninstall-tools:
+
+ install-config:
+ $(INSTALL) -d $(DESTDIR)$(pcmciaconfdir)
+- $(INSTALL_DATA) -D config/config.opts $(DESTDIR)$(pcmciaconfdir)/config.opts
++ $(INSTALL_DATA) config/config.opts $(DESTDIR)$(pcmciaconfdir)/config.opts
+ if [ -f config/config.opts.$(ARCH) ]; then \
+- $(INSTALL_DATA) -D config/config.opts.$(ARCH) $(DESTDIR)$(pcmciaconfdir)/config.opts; \
++ $(INSTALL_DATA) config/config.opts.$(ARCH) $(DESTDIR)$(pcmciaconfdir)/config.opts; \
+ fi
+
+ uninstall-config:
+ # - rm -f $(DESTDIR)$(pcmciaconfdir)/config.opts
+
+ install-udev:
+- $(INSTALL_DATA) -D $(UDEV_RULES_FILE) $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
++ $(INSTALL) -d $(DESTDIR)$(udevrulesdir)
++ $(INSTALL_DATA) $(UDEV_RULES_FILE) $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
+
+ uninstall-udev:
+ - rm -f $(DESTDIR)$(udevrulesdir)/60-pcmcia.rules
+
+ install-man:
+- $(INSTALL_DATA) -D man/man8/pccardctl.8 $(DESTDIR)$(mandir)/man8/pccardctl.8
++ $(INSTALL) -d $(DESTDIR)$(mandir)/man8
++ $(INSTALL_DATA) man/man8/pccardctl.8 $(DESTDIR)$(mandir)/man8/pccardctl.8
+ $(SYMLINK) pccardctl.8 $(DESTDIR)$(mandir)/man8/lspcmcia.8
+
+ uninstall-man:
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_race.patch b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_race.patch
new file mode 100644
index 000000000..f5a518ff7
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils-018/makefile_race.patch
@@ -0,0 +1,43 @@
+"make src/lex_config.o"
+
+results in:
+
+src/lex_config.l:35:25: fatal error: yacc_config.h: No such file or directory
+
+so add missing dependency through a missing rule. Also remove a rule which
+doesn't appear to do anything.
+
+RP
+2016/1/31
+
+Upstream-Status: Pending
+
+Index: pcmciautils-018/Makefile
+===================================================================
+--- pcmciautils-018.orig/Makefile
++++ pcmciautils-018/Makefile
+@@ -249,6 +249,9 @@ $(PCMCIA_SOCKET_STARTUP): $(LIBC) src/st
+ yacc_config.o lex_config.o: %.o: %.c src/yacc_config.h
+ $(CC) -c -MD -O -pipe $(CPPFLAGS) $<
+
++src/lex_config.o : src/lex_config.c src/yacc_config.h
++ $(QUIET) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
++
+ debugtools: ccdv $(CBDUMP) $(CISDUMP)
+
+ $(CBDUMP): $(LIBC) debug/cbdump.o
+Index: pcmciautils-018/Makefile
+===================================================================
+--- pcmciautils-018.orig/Makefile
++++ pcmciautils-018/Makefile
+@@ -246,8 +246,8 @@ $(PCMCIA_SOCKET_STARTUP): $(LIBC) src/st
+ $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) src/startup.o src/yacc_config.o src/lex_config.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
+ $(QUIET) $(STRIPCMD) $@
+
+-yacc_config.o lex_config.o: %.o: %.c
+- $(CC) -c -MD -O -pipe $(CPPFLAGS) $<
++src/lex_config.o : src/lex_config.c src/yacc_config.h ccdv
++ $(QUIET) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+ debugtools: ccdv $(CBDUMP) $(CISDUMP)
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils.inc b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils.inc
new file mode 100644
index 000000000..581bff417
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils.inc
@@ -0,0 +1,32 @@
+SUMMARY = "Linux kernel userland utilities for the PCMCIA subsystem"
+HOMEPAGE = "https://www.kernel.org/pub/linux/utils/kernel/pcmcia/"
+SECTION = "kernel/userland"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+DEPENDS = "udev sysfsutils flex-native"
+RDEPENDS_${PN} = "udev module-init-tools"
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/pcmcia/${BP}.tar.xz"
+
+S = "${WORKDIR}/pcmciautils-${PV}"
+
+export HOSTCC = "${BUILD_CC}"
+export etcdir = "${sysconfdir}"
+export sbindir = "${base_sbindir}"
+export pcmciaconfdir = "${sysconfdir}/pcmcia"
+export udevdir = "`pkg-config --variable=udevdir udev`"
+export udevrulesdir = "`pkg-config --variable=udevdir udev`/rules.d"
+export UDEV = "1"
+LD = "${CC}"
+CFLAGS =+ "-I${S}/src"
+CFLAGS =+ "-DPCMCIAUTILS_VERSION=\\"${PV}\\""
+
+EXTRA_OEMAKE = "-e 'STRIP=echo' 'LIB_OBJS=-lc -lsysfs' 'LEX=flex'"
+
+do_install () {
+ oe_runmake 'DESTDIR=${D}' install
+}
+
+CONFFILES_${PN} += "${sysconfdir}/pcmcia/config.opts"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
new file mode 100644
index 000000000..3556a45cf
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pcmciautils/pcmciautils_018.bb
@@ -0,0 +1,13 @@
+require pcmciautils.inc
+
+SRC_URI += "file://makefile_fix.patch \
+ file://makefile_race.patch \
+ file://lex_sys_types.patch \
+"
+
+SRC_URI[md5sum] = "885431c3cefb76ffdad8cb985134e996"
+SRC_URI[sha256sum] = "57c27be8f04ef4d535bcfa988567316cc57659fe69068327486dab53791e6558"
+
+PR = "r1"
+
+FILES_${PN} += "*/udev */*/udev"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb b/import-layers/yocto-poky/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb
new file mode 100644
index 000000000..27cb3dbe8
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pm-utils/pm-utils_1.4.1.bb
@@ -0,0 +1,25 @@
+SECTION = "base"
+SUMMARY = "Utilities and scripts for power management"
+DESCRIPTION = "Simple shell command line tools to suspend and hibernate."
+HOMEPAGE = "http://pm-utils.freedesktop.org/wiki/"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
+ file://src/pm-pmu.c;beginline=1;endline=22;md5=3c1ddbc54e735fb4a0386e14c78a3147"
+
+PR = "r1"
+
+SRC_URI = "http://pm-utils.freedesktop.org/releases/pm-utils-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "1742a556089c36c3a89eb1b957da5a60"
+SRC_URI[sha256sum] = "8ed899032866d88b2933a1d34cc75e8ae42dcde20e1cc21836baaae3d4370c0b"
+
+inherit pkgconfig autotools
+
+RDEPENDS_${PN} = "grep bash"
+
+do_configure_prepend () {
+ ( cd ${S}; autoreconf -f -i -s )
+}
+
+FILES_${PN} += "${libdir}/${BPN}/*"
+FILES_${PN}-dbg += "${datadir}/doc/pm-utils/README.debugging"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/COPYING b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/COPYING
new file mode 100644
index 000000000..63f529381
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/COPYING
@@ -0,0 +1,2 @@
+This is a blank COPYING file, and should be filled in by original author in future.
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/pointercal
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/pointercal
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal
new file mode 100644
index 000000000..abd84ca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarm/pointercal
@@ -0,0 +1 @@
+8313 4 -8526 7 8334 -82604 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal
new file mode 100644
index 000000000..abd84ca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv6/pointercal
@@ -0,0 +1 @@
+8313 4 -8526 7 8334 -82604 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal
new file mode 100644
index 000000000..abd84ca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuarmv7/pointercal
@@ -0,0 +1 @@
+8313 4 -8526 7 8334 -82604 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal
new file mode 100644
index 000000000..abd84ca4b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemumips/pointercal
@@ -0,0 +1 @@
+8313 4 -8526 7 8334 -82604 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal
new file mode 100644
index 000000000..c2d6e37bf
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemuppc/pointercal
Binary files differ
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal
new file mode 100644
index 000000000..640053d39
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86-64/pointercal
@@ -0,0 +1 @@
+1280 0 1002 0 960 328 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal
new file mode 100644
index 000000000..640053d39
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal/qemux86/pointercal
@@ -0,0 +1 @@
+1280 0 1002 0 960 328 65536
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal_0.0.bb b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal_0.0.bb
new file mode 100644
index 000000000..df735a59f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/pointercal/pointercal_0.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Touchscreen calibration data"
+SECTION = "base"
+PR = "r11"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4b5fcfc87fb615860d398b5e38685edf"
+
+SRC_URI = "file://pointercal \
+ file://COPYING"
+
+S = "${WORKDIR}"
+
+do_install() {
+ # Only install file if it has a contents
+ if [ -s ${S}/pointercal ]; then
+ install -d ${D}${sysconfdir}/
+ install -m 0644 ${S}/pointercal ${D}${sysconfdir}/
+ fi
+}
+
+ALLOW_EMPTY_${PN} = "1"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+INHIBIT_DEFAULT_DEPS = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/add_stdlib.patch b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/add_stdlib.patch
new file mode 100644
index 000000000..e34f262a8
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/add_stdlib.patch
@@ -0,0 +1,18 @@
+# This patch addes stdlib.h to fix compiler warnings due to the exit
+# built-in not being defined and getting an incorrect implicit definition
+
+Upstream-Status: Pending
+
+Created-by: Saul Wold <saul.wold@intel.com>
+
+--- setserial-2.17/setserial.c 2010-09-02 14:11:27.569763088 -0700
++++ setserial-2.17_fixed/setserial.c 2010-09-02 14:11:08.546264139 -0700
+@@ -11,6 +11,7 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <fcntl.h>
+ #include <termios.h>
+ #include <string.h>
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/ldflags.patch b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/ldflags.patch
new file mode 100644
index 000000000..174adc89f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial/ldflags.patch
@@ -0,0 +1,24 @@
+Obey LDFLAGS
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+Upstream-Status: Pending
+
+--- setserial-2.17.orig/Makefile.in
++++ setserial-2.17/Makefile.in
+@@ -13,6 +13,7 @@ STRIP = @STRIP@
+ CC = @CC@
+ RM = rm -f
+ CFLAGS = @CFLAGS@
++LDFLAGS = @LDFLAGS@
+ DEFS = @DEFS@
+ INCS = -I.
+ TAR = tar
+@@ -20,7 +21,7 @@ TAR = tar
+ all: setserial setserial.cat
+
+ setserial: setserial.c
+- $(CC) $(CFLAGS) $(DEFS) $(INCS) setserial.c -o setserial
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) $(INCS) setserial.c -o setserial
+
+ setserial.cat: setserial.8
+ nroff -man setserial.8 > setserial.cat
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial_2.17.bb b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial_2.17.bb
new file mode 100644
index 000000000..8dbddd7dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/setserial/setserial_2.17.bb
@@ -0,0 +1,29 @@
+SUMMARY = "Controls the configuration of serial ports"
+DESCRIPTION = "setserial is a program designed to set and/or report the configuration information associated with a serial port"
+HOMEPAGE = "http://setserial.sourceforge.net"
+AUTHOR = "Theodore Ts'o <tytso@mit.edu>"
+SECTION = "console/utils"
+
+LICENSE = "GPLv2.0"
+LIC_FILES_CHKSUM = "file://version.h;beginline=1;endline=6;md5=2e7c59cb9e57e356ae81f50f4e4dfd99"
+PR = "r3"
+
+DEPENDS += "groff-native"
+
+inherit autotools-brokensep
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/setserial/${BPN}-${PV}.tar.gz \
+ file://add_stdlib.patch \
+ file://ldflags.patch \
+ "
+
+SRC_URI[md5sum] = "c4867d72c41564318e0107745eb7a0f2"
+SRC_URI[sha256sum] = "7e4487d320ac31558563424189435d396ddf77953bb23111a17a3d1487b5794a"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -d ${D}${mandir}/man8
+
+ install -m 0755 ${S}/setserial ${D}${bindir}
+ install -m 0644 ${S}/setserial.8 ${D}${mandir}/man8
+}
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb
new file mode 100644
index 000000000..dfda5c1d3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb
@@ -0,0 +1,49 @@
+SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
+SECTION = "bootloader"
+DEPENDS = "mtd-utils"
+
+# This revision corresponds to the tag "v2016.03"
+# We use the revision in order to avoid having to fetch it from the
+# repo during parse
+SRCREV = "df61a74e6845ec9bdcdd48d2aff5e9c2c6debeaa"
+
+PV = "v2016.03+git${SRCPV}"
+
+SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
+
+S = "${WORKDIR}/git"
+
+INSANE_SKIP_${PN} = "already-stripped"
+EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+EXTRA_OEMAKE_class-cross = 'ARCH=${TARGET_ARCH} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+
+inherit uboot-config
+
+do_compile () {
+ oe_runmake ${UBOOT_MACHINE}
+ oe_runmake env
+}
+
+do_install () {
+ install -d ${D}${base_sbindir}
+ install -d ${D}${sysconfdir}
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
+ install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
+}
+
+do_install_class-cross () {
+ install -d ${D}${bindir_cross}
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
+}
+
+SYSROOT_PREPROCESS_FUNCS_class-cross = "uboot_fw_utils_cross"
+uboot_fw_utils_cross() {
+ sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+BBCLASSEXTEND = "cross"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2016.03.bb b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2016.03.bb
new file mode 100644
index 000000000..d5921a044
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2016.03.bb
@@ -0,0 +1,32 @@
+SUMMARY = "U-Boot bootloader image creation tool"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
+SECTION = "bootloader"
+
+DEPENDS = "openssl"
+
+# This revision corresponds to the tag "v2016.03"
+# We use the revision in order to avoid having to fetch it from the
+# repo during parse
+SRCREV = "df61a74e6845ec9bdcdd48d2aff5e9c2c6debeaa"
+
+PV = "v2016.03+git${SRCPV}"
+
+SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OEMAKE = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" STRIP=true V=1'
+
+do_compile () {
+ oe_runmake sandbox_defconfig
+ oe_runmake cross_tools NO_SDL=1
+}
+
+do_install () {
+ install -d ${D}${bindir}
+ install -m 0755 tools/mkimage ${D}${bindir}/uboot-mkimage
+ ln -sf uboot-mkimage ${D}${bindir}/mkimage
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot.inc b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot.inc
new file mode 100644
index 000000000..3ba866de0
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot.inc
@@ -0,0 +1,289 @@
+SUMMARY = "Universal Boot Loader for embedded devices"
+HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
+SECTION = "bootloaders"
+PROVIDES = "virtual/bootloader"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
+
+SRC_URI = "git://git.denx.de/u-boot.git;branch=master"
+
+S = "${WORKDIR}/git"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+inherit uboot-config deploy
+
+EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1'
+EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
+
+PACKAGECONFIG ??= "openssl"
+# u-boot will compile its own tools during the build, with specific
+# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as
+# a host build dependency.
+PACKAGECONFIG[openssl] = ",,openssl-native"
+
+# Allow setting an additional version string that will be picked up by the
+# u-boot build system and appended to the u-boot version. If the .scmversion
+# file already exists it will not be overwritten.
+UBOOT_LOCALVERSION ?= ""
+
+# Some versions of u-boot use .bin and others use .img. By default use .bin
+# but enable individual recipes to change this value.
+UBOOT_SUFFIX ??= "bin"
+UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
+UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
+UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
+UBOOT_MAKE_TARGET ?= "all"
+
+# Output the ELF generated. Some platforms can use the ELF file and directly
+# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
+# purposes.
+UBOOT_ELF ?= ""
+UBOOT_ELF_SUFFIX ?= "elf"
+UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}"
+UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}"
+UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}"
+
+# Some versions of u-boot build an SPL (Second Program Loader) image that
+# should be packaged along with the u-boot binary as well as placed in the
+# deploy directory. For those versions they can set the following variables
+# to allow packaging the SPL.
+SPL_BINARY ?= ""
+SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY", True))}"
+SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}"
+SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}"
+
+# Additional environment variables or a script can be installed alongside
+# u-boot to be used automatically on boot. This file, typically 'uEnv.txt'
+# or 'boot.scr', should be packaged along with u-boot as well as placed in the
+# deploy directory. Machine configurations needing one of these files should
+# include it in the SRC_URI and set the UBOOT_ENV parameter.
+UBOOT_ENV_SUFFIX ?= "txt"
+UBOOT_ENV ?= ""
+UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
+UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}"
+UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}"
+
+do_compile () {
+ if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
+ sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk
+ fi
+
+ unset LDFLAGS
+ unset CFLAGS
+ unset CPPFLAGS
+
+ if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
+ then
+ echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
+ echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
+ fi
+
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ oe_runmake O=${config} ${config}
+ oe_runmake O=${config} ${UBOOT_MAKE_TARGET}
+ cp ${S}/${config}/${UBOOT_BINARY} ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ oe_runmake ${UBOOT_MACHINE}
+ oe_runmake ${UBOOT_MAKE_TARGET}
+ fi
+
+}
+
+do_install () {
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install -d ${D}/boot
+ install ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${D}/boot
+ install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
+ ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
+ fi
+
+ if [ "x${UBOOT_ELF}" != "x" ]
+ then
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install ${S}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install ${S}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
+ ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
+ fi
+ fi
+
+ if [ -e ${WORKDIR}/fw_env.config ] ; then
+ install -d ${D}${sysconfdir}
+ install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
+ fi
+
+ if [ "x${SPL_BINARY}" != "x" ]
+ then
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install ${S}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
+ ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME}
+ fi
+ fi
+
+ if [ "x${UBOOT_ENV}" != "x" ]
+ then
+ install ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
+ ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
+ fi
+}
+
+FILES_${PN} = "/boot ${sysconfdir}"
+
+do_deploy () {
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install -d ${DEPLOYDIR}
+ install ${S}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
+ cd ${DEPLOYDIR}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install -d ${DEPLOYDIR}
+ install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
+ cd ${DEPLOYDIR}
+ rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
+ ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
+ ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
+ fi
+
+ if [ "x${UBOOT_ELF}" != "x" ]
+ then
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install ${S}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
+ ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install ${S}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
+ ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
+ ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
+ fi
+ fi
+
+
+ if [ "x${SPL_BINARY}" != "x" ]
+ then
+ if [ "x${UBOOT_CONFIG}" != "x" ]
+ then
+ for config in ${UBOOT_MACHINE}; do
+ i=`expr $i + 1`;
+ for type in ${UBOOT_CONFIG}; do
+ j=`expr $j + 1`;
+ if [ $j -eq $i ]
+ then
+ install ${S}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR}
+ rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
+ ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}
+ fi
+ done
+ unset j
+ done
+ unset i
+ else
+ install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
+ rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}
+ ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
+ ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
+ fi
+ fi
+
+
+ if [ "x${UBOOT_ENV}" != "x" ]
+ then
+ install ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
+ rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
+ ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
+ ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
+ fi
+}
+
+addtask deploy before do_build after do_compile
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot_2016.03.bb b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot_2016.03.bb
new file mode 100644
index 000000000..836b0ce03
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/u-boot/u-boot_2016.03.bb
@@ -0,0 +1,10 @@
+require u-boot.inc
+
+DEPENDS += "dtc-native"
+
+# This revision corresponds to the tag "v2016.03"
+# We use the revision in order to avoid having to fetch it from the
+# repo during parse
+SRCREV = "df61a74e6845ec9bdcdd48d2aff5e9c2c6debeaa"
+
+PV = "v2016.03+git${SRCPV}"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit.bb b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit.bb
new file mode 100644
index 000000000..aba44b406
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Initscript for enabling USB gadget Ethernet"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe"
+
+PR = "r3"
+
+SRC_URI = "file://usb-gether \
+ file://COPYING.GPL"
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}${sysconfdir}
+ install -d ${D}${sysconfdir}/init.d
+ install usb-gether ${D}${sysconfdir}/init.d
+}
+
+inherit update-rc.d allarch
+
+INITSCRIPT_NAME = "usb-gether"
+INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ."
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL
new file mode 100644
index 000000000..d511905c1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/COPYING.GPL
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/usb-gether b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/usb-gether
new file mode 100755
index 000000000..e80a0bb30
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbinit/usbinit/usb-gether
@@ -0,0 +1,23 @@
+#! /bin/sh
+#
+# usb-ether Start up the gadget usb ethernet interface.
+#
+
+case "$1" in
+ start|"")
+ test "$VERBOSE" != no && echo "Initializing g_ether gadget..."
+ modprobe g_ether
+ ifup usb0
+ ;;
+ stop)
+ test "$VERBOSE" != no && echo "Disabling g_ether..."
+ ifdown usb0
+ rmmod g_ether
+ ;;
+ *)
+ echo "Usage: usb-ether {start|stop}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch
new file mode 100644
index 000000000..0efdc59fc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/Fix-NULL-pointer-crash.patch
@@ -0,0 +1,28 @@
+Fix NULL pointer crash.
+
+Before use usbbuslist, we should check if it is valid.
+
+Upstream-Status: Pending
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ lsusb-t.c | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/lsusb-t.c b/lsusb-t.c
+index f604155..583a46a 100644
+--- a/lsusb-t.c
++++ b/lsusb-t.c
+@@ -643,6 +643,10 @@ static void sort_busses(void)
+ /* need to reverse sort bus numbers */
+ struct usbbusnode *t, *p, **pp;
+ int swapped;
++
++ if (!usbbuslist)
++ return;
++
+ do {
+ p = usbbuslist;
+ pp = &usbbuslist;
+--
+1.7.4.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/iconv.patch b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/iconv.patch
new file mode 100644
index 000000000..645556717
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/iconv.patch
@@ -0,0 +1,41 @@
+This patch adds support for detecting iconv support using autotools
+uclibc does not have iconv implementation inside libc like glibc, therefore
+the existing checks were not sufficient, it worked for glibc but not for
+uclibc. The new patch portably detects the iconv support and adds the
+libiconv to linker cmdline
+
+This patch should be submitted upstream too
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: usbutils-008/configure.ac
+===================================================================
+--- usbutils-008.orig/configure.ac
++++ usbutils-008/configure.ac
+@@ -10,7 +10,9 @@ AC_USE_SYSTEM_EXTENSIONS
+ AC_SYS_LARGEFILE
+
+ AC_CHECK_HEADERS([byteswap.h])
+-AC_CHECK_FUNCS([nl_langinfo iconv])
++
++AM_GNU_GETTEXT
++AM_ICONV
+
+ PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.0)
+
+Index: usbutils-008/Makefile.am
+===================================================================
+--- usbutils-008.orig/Makefile.am
++++ usbutils-008/Makefile.am
+@@ -29,7 +29,8 @@ lsusb_CPPFLAGS = \
+
+ lsusb_LDADD = \
+ $(LIBUSB_LIBS) \
+- $(UDEV_LIBS)
++ $(UDEV_LIBS) \
++ $(LIBICONV)
+
+ man_MANS = \
+ lsusb.8 \
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch
new file mode 100644
index 000000000..a6b241f85
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils/usb-devices-avoid-dependency-on-bash.patch
@@ -0,0 +1,30 @@
+From 333d5fbbc03481f1aa222bd68c2609db168ae3e0 Mon Sep 17 00:00:00 2001
+From: Paul Eggleton <paul.eggleton@linux.intel.com>
+Date: Thu, 26 Jul 2012 10:37:32 +0100
+Subject: [PATCH] usb-devices: avoid dependency on bash
+
+By virtue of having #!/bin/bash this script declared that it requires
+bash, however manual examination, checkbashisms and tests with dash
+and busybox show that it doesn't contain any bashisms, so change the
+header to avoid the dependency.
+
+Upstream-Status: Pending
+
+Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
+---
+ usb-devices | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/usb-devices b/usb-devices
+index b2052e2..14a5358 100755
+--- a/usb-devices
++++ b/usb-devices
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+
+ # Copyright: 2009 Greg Kroah-Hartman <greg@kroah.com>
+ # 2009 Randy Dunlap <rdunlap@xenotime.net>
+--
+1.7.9.5
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils_008.bb b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils_008.bb
new file mode 100644
index 000000000..75312c3aa
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/usbutils/usbutils_008.bb
@@ -0,0 +1,25 @@
+SUMMARY = "Host side USB console utilities"
+DESCRIPTION = "Contains the lsusb utility for inspecting the devices connected to the USB bus."
+HOMEPAGE = "http://www.linux-usb.org"
+SECTION = "base"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS = "libusb zlib virtual/libiconv udev"
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/usb/usbutils/usbutils-${PV}.tar.gz \
+ file://usb-devices-avoid-dependency-on-bash.patch \
+ file://Fix-NULL-pointer-crash.patch \
+ file://iconv.patch \
+ "
+
+SRC_URI[md5sum] = "cb20148c2e784577e924a7b4c560c8fb"
+SRC_URI[sha256sum] = "6d5f16c2961df37e22e492c736a3e162a8fde24480f23a40d85f79af80d3fe95"
+
+inherit autotools gettext pkgconfig distro_features_check
+
+FILES_${PN}-dev += "${datadir}/pkgconfig"
+
+RDEPENDS_${PN} = "libudev"
+RDEPENDS_${PN}-ptest = "libboost-system libboost-thread"
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch
new file mode 100644
index 000000000..a09e2a257
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/Update-x86emu-from-X.org.patch
@@ -0,0 +1,21766 @@
+From 1a410ae58f28eeab32fa87626cfd5a663ba33c51 Mon Sep 17 00:00:00 2001
+From: Bernhard Walle <bernhard@bwalle.de>
+Date: Tue, 13 May 2014 23:40:56 +0200
+Subject: [PATCH 2/2] Update x86emu from X.org
+
+This commit updates the x86emu copy from X.org tarball
+(ftp://mirror.csclub.uwaterloo.ca/x.org/current/src/xserver/xorg-server-1.12.2.tar.bz2).
+
+This fixes a compatibility issue between v86d and SeaBIOS VGA BIOS where
+the leal instruction is not decoded properly. Read the
+http://thread.gmane.org/gmane.comp.emulators.qemu/271806 thread for more
+details.
+
+Upstream-Status: Backport
+
+Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
+---
+ libs/x86emu/LICENSE | 17 -
+ libs/x86emu/debug.c | 509 +++---
+ libs/x86emu/decode.c | 1069 ++++++------
+ libs/x86emu/fpu.c | 463 +++---
+ libs/x86emu/ops.c | 2940 +++++++++++++++++++--------------
+ libs/x86emu/ops2.c | 1929 +++++++++++-----------
+ libs/x86emu/prim_ops.c | 3219 +++++++++++++++++++------------------
+ libs/x86emu/sys.c | 583 +++----
+ libs/x86emu/validate.c | 52 +-
+ libs/x86emu/x86emu.h | 75 +-
+ libs/x86emu/x86emu/debug.h | 163 +-
+ libs/x86emu/x86emu/decode.h | 57 +-
+ libs/x86emu/x86emu/fpu.h | 23 +-
+ libs/x86emu/x86emu/fpu_regs.h | 44 +-
+ libs/x86emu/x86emu/ops.h | 6 +-
+ libs/x86emu/x86emu/prim_asm.h | 251 ++-
+ libs/x86emu/x86emu/prim_ops.h | 188 +--
+ libs/x86emu/x86emu/prim_x86_gcc.h | 77 +
+ libs/x86emu/x86emu/regs.h | 101 +-
+ libs/x86emu/x86emu/types.h | 50 +-
+ libs/x86emu/x86emu/x86emui.h | 34 +-
+ 21 files changed, 6379 insertions(+), 5471 deletions(-)
+ delete mode 100644 libs/x86emu/LICENSE
+ create mode 100644 libs/x86emu/x86emu/prim_x86_gcc.h
+
+diff --git a/libs/x86emu/LICENSE b/libs/x86emu/LICENSE
+deleted file mode 100644
+index a3ede4a..0000000
+--- a/libs/x86emu/LICENSE
++++ /dev/null
+@@ -1,17 +0,0 @@
+- License information
+- -------------------
+-
+-The x86emu library is under a BSD style license, comaptible
+-with the XFree86 and X licenses used by XFree86. The
+-original x86emu libraries were under the GNU General Public
+-License. Due to license incompatibilities between the GPL
+-and the XFree86 license, the original authors of the code
+-decided to allow a license change. If you have submitted
+-code to the original x86emu project, and you don't agree
+-with the license change, please contact us and let you
+-know. Your code will be removed to comply with your wishes.
+-
+-If you have any questions about this, please send email to
+-x86emu@linuxlabs.com or KendallB@scitechsoft.com for
+-clarification.
+-
+diff --git a/libs/x86emu/debug.c b/libs/x86emu/debug.c
+index 6fd7f11..1a8d1d6 100644
+--- a/libs/x86emu/debug.c
++++ b/libs/x86emu/debug.c
+@@ -38,6 +38,8 @@
+ ****************************************************************************/
+
+ #include "x86emu/x86emui.h"
++#include <stdio.h>
++#include <string.h>
+ #ifndef NO_SYS_HEADERS
+ #include <stdarg.h>
+ #include <stdlib.h>
+@@ -47,46 +49,51 @@
+
+ #ifdef DEBUG
+
+-static void print_encoded_bytes (u16 s, u16 o);
+-static void print_decoded_instruction (void);
+-static int parse_line (char *s, int *ps, int *n);
+-
++static void print_encoded_bytes(u16 s, u16 o);
++static void print_decoded_instruction(void);
++static int parse_line(char *s, int *ps, int *n);
++
+ /* should look something like debug's output. */
+-void X86EMU_trace_regs (void)
++void
++X86EMU_trace_regs(void)
+ {
+- if (DEBUG_TRACE()) {
+- x86emu_dump_regs();
++ if (DEBUG_TRACE()) {
++ x86emu_dump_regs();
+ }
+- if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
+- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
+- print_decoded_instruction();
++ if (DEBUG_DECODE() && !DEBUG_DECODE_NOPRINT()) {
++ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
++ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
++ print_decoded_instruction();
+ }
+ }
+
+-void X86EMU_trace_xregs (void)
++void
++X86EMU_trace_xregs(void)
+ {
+- if (DEBUG_TRACE()) {
+- x86emu_dump_xregs();
++ if (DEBUG_TRACE()) {
++ x86emu_dump_xregs();
+ }
+ }
+
+-void x86emu_just_disassemble (void)
++void
++x86emu_just_disassemble(void)
+ {
+ /*
+ * This routine called if the flag DEBUG_DISASSEMBLE is set kind
+ * of a hack!
+ */
+- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+- print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
+- print_decoded_instruction();
++ printk("%04x:%04x ", M.x86.saved_cs, M.x86.saved_ip);
++ print_encoded_bytes(M.x86.saved_cs, M.x86.saved_ip);
++ print_decoded_instruction();
+ }
+
+-static void disassemble_forward (u16 seg, u16 off, int n)
++static void
++disassemble_forward(u16 seg, u16 off, int n)
+ {
+- X86EMU_sysEnv tregs;
+- int i;
+- u8 op1;
++ X86EMU_sysEnv tregs;
++ int i;
++ u8 op1;
++
+ /*
+ * hack, hack, hack. What we do is use the exact machinery set up
+ * for execution, except that now there is an additional state
+@@ -111,17 +118,17 @@ static void disassemble_forward (u16 seg, u16 off, int n)
+ * This was done for an entirely different reason, but makes a
+ * nice way to get the system to help debug codes.
+ */
+- tregs = M;
++ tregs = M;
+ tregs.x86.R_IP = off;
+ tregs.x86.R_CS = seg;
+-
++
+ /* reset the decoding buffers */
+ tregs.x86.enc_str_pos = 0;
+ tregs.x86.enc_pos = 0;
+-
++
+ /* turn on the "disassemble only, no execute" flag */
+ tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
+-
++
+ /* DUMP NEXT n instructions to screen in straight_line fashion */
+ /*
+ * This looks like the regular instruction fetch stream, except
+@@ -130,299 +137,359 @@ static void disassemble_forward (u16 seg, u16 off, int n)
+ * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
+ * Note the use of a copy of the register structure...
+ */
+- for (i=0; i<n; i++) {
+- op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
+- (x86emu_optab[op1])(op1);
++ for (i = 0; i < n; i++) {
++ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
++ (x86emu_optab[op1]) (op1);
+ }
+ /* end major hack mode. */
+ }
+
+-void x86emu_check_ip_access (void)
++void
++x86emu_check_ip_access(void)
+ {
+ /* NULL as of now */
+ }
+
+-void x86emu_check_sp_access (void)
++void
++x86emu_check_sp_access(void)
+ {
+ }
+
+-void x86emu_check_mem_access (u32 dummy)
++void
++x86emu_check_mem_access(u32 dummy)
+ {
+- /* check bounds, etc */
++ /* check bounds, etc */
+ }
+
+-void x86emu_check_data_access (uint dummy1, uint dummy2)
++void
++x86emu_check_data_access(uint dummy1, uint dummy2)
+ {
+- /* check bounds, etc */
++ /* check bounds, etc */
+ }
+
+-void x86emu_inc_decoded_inst_len (int x)
++void
++x86emu_inc_decoded_inst_len(int x)
+ {
+- M.x86.enc_pos += x;
++ M.x86.enc_pos += x;
+ }
+
+-void x86emu_decode_printf (char *x)
++void
++x86emu_decode_printf(const char *x)
+ {
+- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
+- M.x86.enc_str_pos += strlen(x);
++ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", x);
++ M.x86.enc_str_pos += strlen(x);
+ }
+
+-void x86emu_decode_printf2 (char *x, int y)
++void
++x86emu_decode_printf2(const char *x, int y)
+ {
+- char temp[100];
+- sprintf(temp,x,y);
+- sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
+- M.x86.enc_str_pos += strlen(temp);
++ char temp[100];
++
++ snprintf(temp, sizeof(temp), x, y);
++ sprintf(M.x86.decoded_buf + M.x86.enc_str_pos, "%s", temp);
++ M.x86.enc_str_pos += strlen(temp);
+ }
+
+-void x86emu_end_instr (void)
++void
++x86emu_end_instr(void)
+ {
+- M.x86.enc_str_pos = 0;
+- M.x86.enc_pos = 0;
++ M.x86.enc_str_pos = 0;
++ M.x86.enc_pos = 0;
+ }
+
+-static void print_encoded_bytes (u16 s, u16 o)
++static void
++print_encoded_bytes(u16 s, u16 o)
+ {
+ int i;
+ char buf1[64];
+- for (i=0; i< M.x86.enc_pos; i++) {
+- sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
++
++ for (i = 0; i < M.x86.enc_pos; i++) {
++ sprintf(buf1 + 2 * i, "%02x", fetch_data_byte_abs(s, o + i));
+ }
+- printk("%-20s",buf1);
++ printk("%-20s", buf1);
+ }
+
+-static void print_decoded_instruction (void)
++static void
++print_decoded_instruction(void)
+ {
+- printk("%s", M.x86.decoded_buf);
++ printk("%s", M.x86.decoded_buf);
+ }
+
+-void x86emu_print_int_vect (u16 iv)
++void
++x86emu_print_int_vect(u16 iv)
+ {
+- u16 seg,off;
++ u16 seg, off;
+
+- if (iv > 256) return;
+- seg = fetch_data_word_abs(0,iv*4);
+- off = fetch_data_word_abs(0,iv*4+2);
+- printk("%04x:%04x ", seg, off);
++ if (iv > 256)
++ return;
++ seg = fetch_data_word_abs(0, iv * 4);
++ off = fetch_data_word_abs(0, iv * 4 + 2);
++ printk("%04x:%04x ", seg, off);
+ }
+
+-void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
++void
++X86EMU_dump_memory(u16 seg, u16 off, u32 amt)
+ {
+- u32 start = off & 0xfffffff0;
+- u32 end = (off+16) & 0xfffffff0;
+- u32 i;
+- u32 current;
+-
+- current = start;
+- while (end <= off + amt) {
+- printk("%04x:%04x ", seg, start);
+- for (i=start; i< off; i++)
+- printk(" ");
+- for ( ; i< end; i++)
+- printk("%02x ", fetch_data_byte_abs(seg,i));
+- printk("\n");
+- start = end;
+- end = start + 16;
+- }
++ u32 start = off & 0xfffffff0;
++ u32 end = (off + 16) & 0xfffffff0;
++ u32 i;
++ u32 current;
++
++ current = start;
++ while (end <= off + amt) {
++ printk("%04x:%04x ", seg, start);
++ for (i = start; i < off; i++)
++ printk(" ");
++ for (; i < end; i++)
++ printk("%02x ", fetch_data_byte_abs(seg, i));
++ printk("\n");
++ start = end;
++ end = start + 16;
++ }
+ }
+
+-void x86emu_single_step (void)
++void
++x86emu_single_step(void)
+ {
+ char s[1024];
+ int ps[10];
+ int ntok;
+ int cmd;
+ int done;
+- int segment;
++ int segment;
+ int offset;
+ static int breakpoint;
+ static int noDecode = 1;
+-
++
+ char *p;
+
+- if (DEBUG_BREAK()) {
+- if (M.x86.saved_ip != breakpoint) {
+- return;
+- } else {
+- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+- M.x86.debug |= DEBUG_TRACE_F;
+- M.x86.debug &= ~DEBUG_BREAK_F;
+- print_decoded_instruction ();
+- X86EMU_trace_regs();
+- }
+- }
+- done=0;
+- offset = M.x86.saved_ip;
++ if (DEBUG_BREAK()) {
++ if (M.x86.saved_ip != breakpoint) {
++ return;
++ }
++ else {
++ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
++ M.x86.debug |= DEBUG_TRACE_F;
++ M.x86.debug &= ~DEBUG_BREAK_F;
++ print_decoded_instruction();
++ X86EMU_trace_regs();
++ }
++ }
++ done = 0;
++ offset = M.x86.saved_ip;
+ while (!done) {
+ printk("-");
+ p = fgets(s, 1023, stdin);
+ cmd = parse_line(s, ps, &ntok);
+- switch(cmd) {
+- case 'u':
+- disassemble_forward(M.x86.saved_cs,(u16)offset,10);
++ switch (cmd) {
++ case 'u':
++ disassemble_forward(M.x86.saved_cs, (u16) offset, 10);
+ break;
+- case 'd':
+- if (ntok == 2) {
+- segment = M.x86.saved_cs;
+- offset = ps[1];
+- X86EMU_dump_memory(segment,(u16)offset,16);
+- offset += 16;
+- } else if (ntok == 3) {
+- segment = ps[1];
+- offset = ps[2];
+- X86EMU_dump_memory(segment,(u16)offset,16);
+- offset += 16;
+- } else {
+- segment = M.x86.saved_cs;
+- X86EMU_dump_memory(segment,(u16)offset,16);
+- offset += 16;
+- }
++ case 'd':
++ if (ntok == 2) {
++ segment = M.x86.saved_cs;
++ offset = ps[1];
++ X86EMU_dump_memory(segment, (u16) offset, 16);
++ offset += 16;
++ }
++ else if (ntok == 3) {
++ segment = ps[1];
++ offset = ps[2];
++ X86EMU_dump_memory(segment, (u16) offset, 16);
++ offset += 16;
++ }
++ else {
++ segment = M.x86.saved_cs;
++ X86EMU_dump_memory(segment, (u16) offset, 16);
++ offset += 16;
++ }
+ break;
+- case 'c':
+- M.x86.debug ^= DEBUG_TRACECALL_F;
++ case 'c':
++ M.x86.debug ^= DEBUG_TRACECALL_F;
+ break;
+- case 's':
+- M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
++ case 's':
++ M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
+ break;
+- case 'r':
+- X86EMU_trace_regs();
++ case 'r':
++ X86EMU_trace_regs();
+ break;
+- case 'x':
+- X86EMU_trace_xregs();
++ case 'x':
++ X86EMU_trace_xregs();
+ break;
+- case 'g':
++ case 'g':
+ if (ntok == 2) {
+ breakpoint = ps[1];
+- if (noDecode) {
+- M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
+- } else {
+- M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+- }
+- M.x86.debug &= ~DEBUG_TRACE_F;
+- M.x86.debug |= DEBUG_BREAK_F;
+- done = 1;
++ if (noDecode) {
++ M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
++ }
++ else {
++ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
++ }
++ M.x86.debug &= ~DEBUG_TRACE_F;
++ M.x86.debug |= DEBUG_BREAK_F;
++ done = 1;
+ }
+ break;
+- case 'q':
+- M.x86.debug |= DEBUG_EXIT;
+- return;
+- case 'P':
+- noDecode = (noDecode)?0:1;
+- printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
+- break;
+- case 't':
+- case 0:
++ case 'q':
++ M.x86.debug |= DEBUG_EXIT;
++ return;
++ case 'P':
++ noDecode = (noDecode) ? 0 : 1;
++ printk("Toggled decoding to %s\n", (noDecode) ? "FALSE" : "TRUE");
++ break;
++ case 't':
++ case 0:
+ done = 1;
+ break;
+- }
++ }
+ }
+ }
+
+-int X86EMU_trace_on(void)
++int
++X86EMU_trace_on(void)
+ {
+- return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
++ return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
+ }
+
+-int X86EMU_trace_off(void)
++int
++X86EMU_trace_off(void)
+ {
+- return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
++ return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
+ }
+
+-static int parse_line (char *s, int *ps, int *n)
++static int
++parse_line(char *s, int *ps, int *n)
+ {
+ int cmd;
+
+ *n = 0;
+- while(*s == ' ' || *s == '\t') s++;
++ while (*s == ' ' || *s == '\t')
++ s++;
+ ps[*n] = *s;
+ switch (*s) {
+- case '\n':
++ case '\n':
+ *n += 1;
+ return 0;
+- default:
++ default:
+ cmd = *s;
+ *n += 1;
+ }
+
+- while (1) {
+- while (*s != ' ' && *s != '\t' && *s != '\n') s++;
+-
+- if (*s == '\n')
+- return cmd;
+-
+- while(*s == ' ' || *s == '\t') s++;
+-
+- sscanf(s,"%x",&ps[*n]);
+- *n += 1;
+- }
++ while (1) {
++ while (*s != ' ' && *s != '\t' && *s != '\n')
++ s++;
++
++ if (*s == '\n')
++ return cmd;
++
++ while (*s == ' ' || *s == '\t')
++ s++;
++
++ sscanf(s, "%x", &ps[*n]);
++ *n += 1;
++ }
+ }
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+-void x86emu_dump_regs (void)
++void
++x86emu_dump_regs(void)
+ {
+- printk("\tAX=%04x ", M.x86.R_AX );
+- printk("BX=%04x ", M.x86.R_BX );
+- printk("CX=%04x ", M.x86.R_CX );
+- printk("DX=%04x ", M.x86.R_DX );
+- printk("SP=%04x ", M.x86.R_SP );
+- printk("BP=%04x ", M.x86.R_BP );
+- printk("SI=%04x ", M.x86.R_SI );
+- printk("DI=%04x\n", M.x86.R_DI );
+- printk("\tDS=%04x ", M.x86.R_DS );
+- printk("ES=%04x ", M.x86.R_ES );
+- printk("SS=%04x ", M.x86.R_SS );
+- printk("CS=%04x ", M.x86.R_CS );
+- printk("IP=%04x ", M.x86.R_IP );
+- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
+- else printk("NV ");
+- if (ACCESS_FLAG(F_DF)) printk("DN ");
+- else printk("UP ");
+- if (ACCESS_FLAG(F_IF)) printk("EI ");
+- else printk("DI ");
+- if (ACCESS_FLAG(F_SF)) printk("NG ");
+- else printk("PL ");
+- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
+- else printk("NZ ");
+- if (ACCESS_FLAG(F_AF)) printk("AC ");
+- else printk("NA ");
+- if (ACCESS_FLAG(F_PF)) printk("PE ");
+- else printk("PO ");
+- if (ACCESS_FLAG(F_CF)) printk("CY ");
+- else printk("NC ");
+- printk("\n");
++ printk("\tAX=%04x ", M.x86.R_AX);
++ printk("BX=%04x ", M.x86.R_BX);
++ printk("CX=%04x ", M.x86.R_CX);
++ printk("DX=%04x ", M.x86.R_DX);
++ printk("SP=%04x ", M.x86.R_SP);
++ printk("BP=%04x ", M.x86.R_BP);
++ printk("SI=%04x ", M.x86.R_SI);
++ printk("DI=%04x\n", M.x86.R_DI);
++ printk("\tDS=%04x ", M.x86.R_DS);
++ printk("ES=%04x ", M.x86.R_ES);
++ printk("SS=%04x ", M.x86.R_SS);
++ printk("CS=%04x ", M.x86.R_CS);
++ printk("IP=%04x ", M.x86.R_IP);
++ if (ACCESS_FLAG(F_OF))
++ printk("OV "); /* CHECKED... */
++ else
++ printk("NV ");
++ if (ACCESS_FLAG(F_DF))
++ printk("DN ");
++ else
++ printk("UP ");
++ if (ACCESS_FLAG(F_IF))
++ printk("EI ");
++ else
++ printk("DI ");
++ if (ACCESS_FLAG(F_SF))
++ printk("NG ");
++ else
++ printk("PL ");
++ if (ACCESS_FLAG(F_ZF))
++ printk("ZR ");
++ else
++ printk("NZ ");
++ if (ACCESS_FLAG(F_AF))
++ printk("AC ");
++ else
++ printk("NA ");
++ if (ACCESS_FLAG(F_PF))
++ printk("PE ");
++ else
++ printk("PO ");
++ if (ACCESS_FLAG(F_CF))
++ printk("CY ");
++ else
++ printk("NC ");
++ printk("\n");
+ }
+
+-void x86emu_dump_xregs (void)
++void
++x86emu_dump_xregs(void)
+ {
+- printk("\tEAX=%08x ", M.x86.R_EAX );
+- printk("EBX=%08x ", M.x86.R_EBX );
+- printk("ECX=%08x ", M.x86.R_ECX );
+- printk("EDX=%08x \n", M.x86.R_EDX );
+- printk("\tESP=%08x ", M.x86.R_ESP );
+- printk("EBP=%08x ", M.x86.R_EBP );
+- printk("ESI=%08x ", M.x86.R_ESI );
+- printk("EDI=%08x\n", M.x86.R_EDI );
+- printk("\tDS=%04x ", M.x86.R_DS );
+- printk("ES=%04x ", M.x86.R_ES );
+- printk("SS=%04x ", M.x86.R_SS );
+- printk("CS=%04x ", M.x86.R_CS );
+- printk("EIP=%08x\n\t", M.x86.R_EIP );
+- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
+- else printk("NV ");
+- if (ACCESS_FLAG(F_DF)) printk("DN ");
+- else printk("UP ");
+- if (ACCESS_FLAG(F_IF)) printk("EI ");
+- else printk("DI ");
+- if (ACCESS_FLAG(F_SF)) printk("NG ");
+- else printk("PL ");
+- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
+- else printk("NZ ");
+- if (ACCESS_FLAG(F_AF)) printk("AC ");
+- else printk("NA ");
+- if (ACCESS_FLAG(F_PF)) printk("PE ");
+- else printk("PO ");
+- if (ACCESS_FLAG(F_CF)) printk("CY ");
+- else printk("NC ");
+- printk("\n");
++ printk("\tEAX=%08x ", M.x86.R_EAX);
++ printk("EBX=%08x ", M.x86.R_EBX);
++ printk("ECX=%08x ", M.x86.R_ECX);
++ printk("EDX=%08x \n", M.x86.R_EDX);
++ printk("\tESP=%08x ", M.x86.R_ESP);
++ printk("EBP=%08x ", M.x86.R_EBP);
++ printk("ESI=%08x ", M.x86.R_ESI);
++ printk("EDI=%08x\n", M.x86.R_EDI);
++ printk("\tDS=%04x ", M.x86.R_DS);
++ printk("ES=%04x ", M.x86.R_ES);
++ printk("SS=%04x ", M.x86.R_SS);
++ printk("CS=%04x ", M.x86.R_CS);
++ printk("EIP=%08x\n\t", M.x86.R_EIP);
++ if (ACCESS_FLAG(F_OF))
++ printk("OV "); /* CHECKED... */
++ else
++ printk("NV ");
++ if (ACCESS_FLAG(F_DF))
++ printk("DN ");
++ else
++ printk("UP ");
++ if (ACCESS_FLAG(F_IF))
++ printk("EI ");
++ else
++ printk("DI ");
++ if (ACCESS_FLAG(F_SF))
++ printk("NG ");
++ else
++ printk("PL ");
++ if (ACCESS_FLAG(F_ZF))
++ printk("ZR ");
++ else
++ printk("NZ ");
++ if (ACCESS_FLAG(F_AF))
++ printk("AC ");
++ else
++ printk("NA ");
++ if (ACCESS_FLAG(F_PF))
++ printk("PE ");
++ else
++ printk("PO ");
++ if (ACCESS_FLAG(F_CF))
++ printk("CY ");
++ else
++ printk("NC ");
++ printk("\n");
+ }
+diff --git a/libs/x86emu/decode.c b/libs/x86emu/decode.c
+index 7d9a34a..12f8fb8 100644
+--- a/libs/x86emu/decode.c
++++ b/libs/x86emu/decode.c
+@@ -46,25 +46,27 @@
+ REMARKS:
+ Handles any pending asychronous interrupts.
+ ****************************************************************************/
+-static void x86emu_intr_handle(void)
++static void
++x86emu_intr_handle(void)
+ {
+- u8 intno;
+-
+- if (M.x86.intr & INTR_SYNCH) {
+- intno = M.x86.intno;
+- if (_X86EMU_intrTab[intno]) {
+- (*_X86EMU_intrTab[intno])(intno);
+- } else {
+- push_word((u16)M.x86.R_FLG);
+- CLEAR_FLAG(F_IF);
+- CLEAR_FLAG(F_TF);
+- push_word(M.x86.R_CS);
+- M.x86.R_CS = mem_access_word(intno * 4 + 2);
+- push_word(M.x86.R_IP);
+- M.x86.R_IP = mem_access_word(intno * 4);
+- M.x86.intr = 0;
+- }
+- }
++ u8 intno;
++
++ if (M.x86.intr & INTR_SYNCH) {
++ intno = M.x86.intno;
++ if (_X86EMU_intrTab[intno]) {
++ (*_X86EMU_intrTab[intno]) (intno);
++ }
++ else {
++ push_word((u16) M.x86.R_FLG);
++ CLEAR_FLAG(F_IF);
++ CLEAR_FLAG(F_TF);
++ push_word(M.x86.R_CS);
++ M.x86.R_CS = mem_access_word(intno * 4 + 2);
++ push_word(M.x86.R_IP);
++ M.x86.R_IP = mem_access_word(intno * 4);
++ M.x86.intr = 0;
++ }
++ }
+ }
+
+ /****************************************************************************
+@@ -75,11 +77,11 @@ REMARKS:
+ Raise the specified interrupt to be handled before the execution of the
+ next instruction.
+ ****************************************************************************/
+-void x86emu_intr_raise(
+- u8 intrnum)
++void
++x86emu_intr_raise(u8 intrnum)
+ {
+- M.x86.intno = intrnum;
+- M.x86.intr |= INTR_SYNCH;
++ M.x86.intno = intrnum;
++ M.x86.intr |= INTR_SYNCH;
+ }
+
+ /****************************************************************************
+@@ -88,39 +90,39 @@ Main execution loop for the emulator. We return from here when the system
+ halts, which is normally caused by a stack fault when we return from the
+ original real mode call.
+ ****************************************************************************/
+-void X86EMU_exec(void)
++void
++X86EMU_exec(void)
+ {
+- u8 op1;
+-
+- M.x86.intr = 0;
+- DB(x86emu_end_instr();)
+-
+- for (;;) {
+-DB( if (CHECK_IP_FETCH())
+- x86emu_check_ip_access();)
+- /* If debugging, save the IP and CS values. */
+- SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
+- INC_DECODED_INST_LEN(1);
+- if (M.x86.intr) {
+- if (M.x86.intr & INTR_HALTED) {
+-DB( if (M.x86.R_SP != 0) {
+- printk("halted\n");
+- X86EMU_trace_regs();
+- }
+- else {
+- if (M.x86.debug)
+- printk("Service completed successfully\n");
+- })
+- return;
++ u8 op1;
++
++ M.x86.intr = 0;
++ DB(x86emu_end_instr();
++ )
++
++ for (;;) {
++ DB(if (CHECK_IP_FETCH())
++ x86emu_check_ip_access();)
++ /* If debugging, save the IP and CS values. */
++ SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
++ INC_DECODED_INST_LEN(1);
++ if (M.x86.intr) {
++ if (M.x86.intr & INTR_HALTED) {
++ DB(if (M.x86.R_SP != 0) {
++ printk("halted\n"); X86EMU_trace_regs();}
++ else {
++ if (M.x86.debug)
++ printk("Service completed successfully\n");}
++ )
++ return;
+ }
+- if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) ||
+- !ACCESS_FLAG(F_IF)) {
+- x86emu_intr_handle();
+- }
+- }
+-
+- op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+- (*x86emu_optab[op1])(op1);
++ if (((M.x86.intr & INTR_SYNCH) &&
++ (M.x86.intno == 0 || M.x86.intno == 2)) ||
++ !ACCESS_FLAG(F_IF)) {
++ x86emu_intr_handle();
++ }
++ }
++ op1 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
++ (*x86emu_optab[op1]) (op1);
+ if (M.x86.debug & DEBUG_EXIT) {
+ M.x86.debug &= ~DEBUG_EXIT;
+ return;
+@@ -132,9 +134,10 @@ DB( if (M.x86.R_SP != 0) {
+ REMARKS:
+ Halts the system by setting the halted system flag.
+ ****************************************************************************/
+-void X86EMU_halt_sys(void)
++void
++X86EMU_halt_sys(void)
+ {
+- M.x86.intr |= INTR_HALTED;
++ M.x86.intr |= INTR_HALTED;
+ }
+
+ /****************************************************************************
+@@ -149,19 +152,17 @@ next instruction.
+
+ NOTE: Do not inline this function, as (*sys_rdb) is already inline!
+ ****************************************************************************/
+-void fetch_decode_modrm(
+- int *mod,
+- int *regh,
+- int *regl)
++void
++fetch_decode_modrm(int *mod, int *regh, int *regl)
+ {
+- int fetched;
+-
+-DB( if (CHECK_IP_FETCH())
+- x86emu_check_ip_access();)
+- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+- INC_DECODED_INST_LEN(1);
+- *mod = (fetched >> 6) & 0x03;
+- *regh = (fetched >> 3) & 0x07;
++ int fetched;
++
++ DB(if (CHECK_IP_FETCH())
++ x86emu_check_ip_access();)
++ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
++ INC_DECODED_INST_LEN(1);
++ *mod = (fetched >> 6) & 0x03;
++ *regh = (fetched >> 3) & 0x07;
+ *regl = (fetched >> 0) & 0x07;
+ }
+
+@@ -175,15 +176,16 @@ moves the instruction pointer to the next value.
+
+ NOTE: Do not inline this function, as (*sys_rdb) is already inline!
+ ****************************************************************************/
+-u8 fetch_byte_imm(void)
++u8
++fetch_byte_imm(void)
+ {
+- u8 fetched;
++ u8 fetched;
+
+-DB( if (CHECK_IP_FETCH())
+- x86emu_check_ip_access();)
+- fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+- INC_DECODED_INST_LEN(1);
+- return fetched;
++ DB(if (CHECK_IP_FETCH())
++ x86emu_check_ip_access();)
++ fetched = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
++ INC_DECODED_INST_LEN(1);
++ return fetched;
+ }
+
+ /****************************************************************************
+@@ -196,16 +198,17 @@ moves the instruction pointer to the next value.
+
+ NOTE: Do not inline this function, as (*sys_rdw) is already inline!
+ ****************************************************************************/
+-u16 fetch_word_imm(void)
++u16
++fetch_word_imm(void)
+ {
+- u16 fetched;
+-
+-DB( if (CHECK_IP_FETCH())
+- x86emu_check_ip_access();)
+- fetched = (*sys_rdw)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
+- M.x86.R_IP += 2;
+- INC_DECODED_INST_LEN(2);
+- return fetched;
++ u16 fetched;
++
++ DB(if (CHECK_IP_FETCH())
++ x86emu_check_ip_access();)
++ fetched = (*sys_rdw) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
++ M.x86.R_IP += 2;
++ INC_DECODED_INST_LEN(2);
++ return fetched;
+ }
+
+ /****************************************************************************
+@@ -218,16 +221,17 @@ moves the instruction pointer to the next value.
+
+ NOTE: Do not inline this function, as (*sys_rdw) is already inline!
+ ****************************************************************************/
+-u32 fetch_long_imm(void)
++u32
++fetch_long_imm(void)
+ {
+- u32 fetched;
+-
+-DB( if (CHECK_IP_FETCH())
+- x86emu_check_ip_access();)
+- fetched = (*sys_rdl)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
+- M.x86.R_IP += 4;
+- INC_DECODED_INST_LEN(4);
+- return fetched;
++ u32 fetched;
++
++ DB(if (CHECK_IP_FETCH())
++ x86emu_check_ip_access();)
++ fetched = (*sys_rdl) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP));
++ M.x86.R_IP += 4;
++ INC_DECODED_INST_LEN(4);
++ return fetched;
+ }
+
+ /****************************************************************************
+@@ -259,38 +263,39 @@ cpu-state-varible M.x86.mode. There are several potential states:
+
+ Each of the above 7 items are handled with a bit in the mode field.
+ ****************************************************************************/
+-_INLINE u32 get_data_segment(void)
++_INLINE u32
++get_data_segment(void)
+ {
+ #define GET_SEGMENT(segment)
+- switch (M.x86.mode & SYSMODE_SEGMASK) {
+- case 0: /* default case: use ds register */
+- case SYSMODE_SEGOVR_DS:
+- case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
+- return M.x86.R_DS;
+- case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
+- return M.x86.R_SS;
+- case SYSMODE_SEGOVR_CS:
+- case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
+- return M.x86.R_CS;
+- case SYSMODE_SEGOVR_ES:
+- case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
+- return M.x86.R_ES;
+- case SYSMODE_SEGOVR_FS:
+- case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
+- return M.x86.R_FS;
+- case SYSMODE_SEGOVR_GS:
+- case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
+- return M.x86.R_GS;
+- case SYSMODE_SEGOVR_SS:
+- case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
+- return M.x86.R_SS;
+- default:
++ switch (M.x86.mode & SYSMODE_SEGMASK) {
++ case 0: /* default case: use ds register */
++ case SYSMODE_SEGOVR_DS:
++ case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
++ return M.x86.R_DS;
++ case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
++ return M.x86.R_SS;
++ case SYSMODE_SEGOVR_CS:
++ case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
++ return M.x86.R_CS;
++ case SYSMODE_SEGOVR_ES:
++ case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
++ return M.x86.R_ES;
++ case SYSMODE_SEGOVR_FS:
++ case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
++ return M.x86.R_FS;
++ case SYSMODE_SEGOVR_GS:
++ case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
++ return M.x86.R_GS;
++ case SYSMODE_SEGOVR_SS:
++ case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
++ return M.x86.R_SS;
++ default:
+ #ifdef DEBUG
+- printk("error: should not happen: multiple overrides.\n");
++ printk("error: should not happen: multiple overrides.\n");
+ #endif
+- HALT_SYS();
+- return 0;
+- }
++ HALT_SYS();
++ return 0;
++ }
+ }
+
+ /****************************************************************************
+@@ -302,14 +307,14 @@ Byte value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u8 fetch_data_byte(
+- uint offset)
++u8
++fetch_data_byte(uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- return (*sys_rdb)((get_data_segment() << 4) + offset);
++ return (*sys_rdb) ((get_data_segment() << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -321,14 +326,14 @@ Word value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u16 fetch_data_word(
+- uint offset)
++u16
++fetch_data_word(uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- return (*sys_rdw)((get_data_segment() << 4) + offset);
++ return (*sys_rdw) ((get_data_segment() << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -340,14 +345,14 @@ Long value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u32 fetch_data_long(
+- uint offset)
++u32
++fetch_data_long(uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- return (*sys_rdl)((get_data_segment() << 4) + offset);
++ return (*sys_rdl) ((get_data_segment() << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -360,15 +365,14 @@ Byte value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u8 fetch_data_byte_abs(
+- uint segment,
+- uint offset)
++u8
++fetch_data_byte_abs(uint segment, uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- return (*sys_rdb)(((u32)segment << 4) + offset);
++ return (*sys_rdb) (((u32) segment << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -381,15 +385,14 @@ Word value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u16 fetch_data_word_abs(
+- uint segment,
+- uint offset)
++u16
++fetch_data_word_abs(uint segment, uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- return (*sys_rdw)(((u32)segment << 4) + offset);
++ return (*sys_rdw) (((u32) segment << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -402,15 +405,14 @@ Long value read from the absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u32 fetch_data_long_abs(
+- uint segment,
+- uint offset)
++u32
++fetch_data_long_abs(uint segment, uint offset)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- return (*sys_rdl)(((u32)segment << 4) + offset);
++ return (*sys_rdl) (((u32) segment << 4) + offset);
+ }
+
+ /****************************************************************************
+@@ -424,15 +426,14 @@ the current 'default' segment, which may have been overridden.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_byte(
+- uint offset,
+- u8 val)
++void
++store_data_byte(uint offset, u8 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- (*sys_wrb)((get_data_segment() << 4) + offset, val);
++ (*sys_wrb) ((get_data_segment() << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -446,15 +447,14 @@ the current 'default' segment, which may have been overridden.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_word(
+- uint offset,
+- u16 val)
++void
++store_data_word(uint offset, u16 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- (*sys_wrw)((get_data_segment() << 4) + offset, val);
++ (*sys_wrw) ((get_data_segment() << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -468,15 +468,14 @@ the current 'default' segment, which may have been overridden.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_long(
+- uint offset,
+- u32 val)
++void
++store_data_long(uint offset, u32 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access((u16)get_data_segment(), offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access((u16) get_data_segment(), offset);
+ #endif
+- (*sys_wrl)((get_data_segment() << 4) + offset, val);
++ (*sys_wrl) ((get_data_segment() << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -490,16 +489,14 @@ Writes a byte value to an absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_byte_abs(
+- uint segment,
+- uint offset,
+- u8 val)
++void
++store_data_byte_abs(uint segment, uint offset, u8 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- (*sys_wrb)(((u32)segment << 4) + offset, val);
++ (*sys_wrb) (((u32) segment << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -513,16 +510,14 @@ Writes a word value to an absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_word_abs(
+- uint segment,
+- uint offset,
+- u16 val)
++void
++store_data_word_abs(uint segment, uint offset, u16 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- (*sys_wrw)(((u32)segment << 4) + offset, val);
++ (*sys_wrw) (((u32) segment << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -536,16 +531,14 @@ Writes a long value to an absolute memory location.
+
+ NOTE: Do not inline this function as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void store_data_long_abs(
+- uint segment,
+- uint offset,
+- u32 val)
++void
++store_data_long_abs(uint segment, uint offset, u32 val)
+ {
+ #ifdef DEBUG
+- if (CHECK_DATA_ACCESS())
+- x86emu_check_data_access(segment, offset);
++ if (CHECK_DATA_ACCESS())
++ x86emu_check_data_access(segment, offset);
+ #endif
+- (*sys_wrl)(((u32)segment << 4) + offset, val);
++ (*sys_wrl) (((u32) segment << 4) + offset, val);
+ }
+
+ /****************************************************************************
+@@ -559,37 +552,37 @@ REMARKS:
+ Return a pointer to the register given by the R/RM field of the
+ modrm byte, for byte operands. Also enables the decoding of instructions.
+ ****************************************************************************/
+-u8* decode_rm_byte_register(
+- int reg)
++u8 *
++decode_rm_byte_register(int reg)
+ {
+- switch (reg) {
+- case 0:
+- DECODE_PRINTF("AL");
+- return &M.x86.R_AL;
+- case 1:
+- DECODE_PRINTF("CL");
+- return &M.x86.R_CL;
+- case 2:
+- DECODE_PRINTF("DL");
+- return &M.x86.R_DL;
+- case 3:
+- DECODE_PRINTF("BL");
+- return &M.x86.R_BL;
+- case 4:
+- DECODE_PRINTF("AH");
+- return &M.x86.R_AH;
+- case 5:
+- DECODE_PRINTF("CH");
+- return &M.x86.R_CH;
+- case 6:
+- DECODE_PRINTF("DH");
+- return &M.x86.R_DH;
+- case 7:
+- DECODE_PRINTF("BH");
+- return &M.x86.R_BH;
+- }
+- HALT_SYS();
+- return NULL; /* NOT REACHED OR REACHED ON ERROR */
++ switch (reg) {
++ case 0:
++ DECODE_PRINTF("AL");
++ return &M.x86.R_AL;
++ case 1:
++ DECODE_PRINTF("CL");
++ return &M.x86.R_CL;
++ case 2:
++ DECODE_PRINTF("DL");
++ return &M.x86.R_DL;
++ case 3:
++ DECODE_PRINTF("BL");
++ return &M.x86.R_BL;
++ case 4:
++ DECODE_PRINTF("AH");
++ return &M.x86.R_AH;
++ case 5:
++ DECODE_PRINTF("CH");
++ return &M.x86.R_CH;
++ case 6:
++ DECODE_PRINTF("DH");
++ return &M.x86.R_DH;
++ case 7:
++ DECODE_PRINTF("BH");
++ return &M.x86.R_BH;
++ }
++ HALT_SYS();
++ return NULL; /* NOT REACHED OR REACHED ON ERROR */
+ }
+
+ /****************************************************************************
+@@ -603,36 +596,36 @@ REMARKS:
+ Return a pointer to the register given by the R/RM field of the
+ modrm byte, for word operands. Also enables the decoding of instructions.
+ ****************************************************************************/
+-u16* decode_rm_word_register(
+- int reg)
++u16 *
++decode_rm_word_register(int reg)
+ {
+- switch (reg) {
+- case 0:
+- DECODE_PRINTF("AX");
+- return &M.x86.R_AX;
+- case 1:
+- DECODE_PRINTF("CX");
+- return &M.x86.R_CX;
+- case 2:
+- DECODE_PRINTF("DX");
+- return &M.x86.R_DX;
+- case 3:
+- DECODE_PRINTF("BX");
+- return &M.x86.R_BX;
+- case 4:
+- DECODE_PRINTF("SP");
+- return &M.x86.R_SP;
+- case 5:
+- DECODE_PRINTF("BP");
+- return &M.x86.R_BP;
+- case 6:
+- DECODE_PRINTF("SI");
+- return &M.x86.R_SI;
+- case 7:
+- DECODE_PRINTF("DI");
+- return &M.x86.R_DI;
+- }
+- HALT_SYS();
++ switch (reg) {
++ case 0:
++ DECODE_PRINTF("AX");
++ return &M.x86.R_AX;
++ case 1:
++ DECODE_PRINTF("CX");
++ return &M.x86.R_CX;
++ case 2:
++ DECODE_PRINTF("DX");
++ return &M.x86.R_DX;
++ case 3:
++ DECODE_PRINTF("BX");
++ return &M.x86.R_BX;
++ case 4:
++ DECODE_PRINTF("SP");
++ return &M.x86.R_SP;
++ case 5:
++ DECODE_PRINTF("BP");
++ return &M.x86.R_BP;
++ case 6:
++ DECODE_PRINTF("SI");
++ return &M.x86.R_SI;
++ case 7:
++ DECODE_PRINTF("DI");
++ return &M.x86.R_DI;
++ }
++ HALT_SYS();
+ return NULL; /* NOTREACHED OR REACHED ON ERROR */
+ }
+
+@@ -647,36 +640,36 @@ REMARKS:
+ Return a pointer to the register given by the R/RM field of the
+ modrm byte, for dword operands. Also enables the decoding of instructions.
+ ****************************************************************************/
+-u32* decode_rm_long_register(
+- int reg)
++u32 *
++decode_rm_long_register(int reg)
+ {
+ switch (reg) {
+- case 0:
+- DECODE_PRINTF("EAX");
+- return &M.x86.R_EAX;
+- case 1:
+- DECODE_PRINTF("ECX");
+- return &M.x86.R_ECX;
+- case 2:
+- DECODE_PRINTF("EDX");
+- return &M.x86.R_EDX;
+- case 3:
+- DECODE_PRINTF("EBX");
+- return &M.x86.R_EBX;
+- case 4:
+- DECODE_PRINTF("ESP");
+- return &M.x86.R_ESP;
+- case 5:
+- DECODE_PRINTF("EBP");
+- return &M.x86.R_EBP;
+- case 6:
+- DECODE_PRINTF("ESI");
+- return &M.x86.R_ESI;
+- case 7:
+- DECODE_PRINTF("EDI");
+- return &M.x86.R_EDI;
+- }
+- HALT_SYS();
++ case 0:
++ DECODE_PRINTF("EAX");
++ return &M.x86.R_EAX;
++ case 1:
++ DECODE_PRINTF("ECX");
++ return &M.x86.R_ECX;
++ case 2:
++ DECODE_PRINTF("EDX");
++ return &M.x86.R_EDX;
++ case 3:
++ DECODE_PRINTF("EBX");
++ return &M.x86.R_EBX;
++ case 4:
++ DECODE_PRINTF("ESP");
++ return &M.x86.R_ESP;
++ case 5:
++ DECODE_PRINTF("EBP");
++ return &M.x86.R_EBP;
++ case 6:
++ DECODE_PRINTF("ESI");
++ return &M.x86.R_ESI;
++ case 7:
++ DECODE_PRINTF("EDI");
++ return &M.x86.R_EDI;
++ }
++ HALT_SYS();
+ return NULL; /* NOTREACHED OR REACHED ON ERROR */
+ }
+
+@@ -692,126 +685,129 @@ Return a pointer to the register given by the R/RM field of the
+ modrm byte, for word operands, modified from above for the weirdo
+ special case of segreg operands. Also enables the decoding of instructions.
+ ****************************************************************************/
+-u16* decode_rm_seg_register(
+- int reg)
++u16 *
++decode_rm_seg_register(int reg)
+ {
+- switch (reg) {
+- case 0:
+- DECODE_PRINTF("ES");
+- return &M.x86.R_ES;
+- case 1:
+- DECODE_PRINTF("CS");
+- return &M.x86.R_CS;
+- case 2:
+- DECODE_PRINTF("SS");
+- return &M.x86.R_SS;
+- case 3:
+- DECODE_PRINTF("DS");
+- return &M.x86.R_DS;
+- case 4:
+- DECODE_PRINTF("FS");
+- return &M.x86.R_FS;
+- case 5:
+- DECODE_PRINTF("GS");
+- return &M.x86.R_GS;
+- case 6:
+- case 7:
+- DECODE_PRINTF("ILLEGAL SEGREG");
+- break;
+- }
+- HALT_SYS();
+- return NULL; /* NOT REACHED OR REACHED ON ERROR */
++ switch (reg) {
++ case 0:
++ DECODE_PRINTF("ES");
++ return &M.x86.R_ES;
++ case 1:
++ DECODE_PRINTF("CS");
++ return &M.x86.R_CS;
++ case 2:
++ DECODE_PRINTF("SS");
++ return &M.x86.R_SS;
++ case 3:
++ DECODE_PRINTF("DS");
++ return &M.x86.R_DS;
++ case 4:
++ DECODE_PRINTF("FS");
++ return &M.x86.R_FS;
++ case 5:
++ DECODE_PRINTF("GS");
++ return &M.x86.R_GS;
++ case 6:
++ case 7:
++ DECODE_PRINTF("ILLEGAL SEGREG");
++ break;
++ }
++ HALT_SYS();
++ return NULL; /* NOT REACHED OR REACHED ON ERROR */
+ }
+
+ /*
+ *
+ * return offset from the SIB Byte
+ */
+-u32 decode_sib_address(int sib, int mod)
++u32
++decode_sib_address(int sib, int mod)
+ {
+ u32 base = 0, i = 0, scale = 1;
+
+- switch(sib & 0x07) {
++ switch (sib & 0x07) {
+ case 0:
+- DECODE_PRINTF("[EAX]");
+- base = M.x86.R_EAX;
+- break;
++ DECODE_PRINTF("[EAX]");
++ base = M.x86.R_EAX;
++ break;
+ case 1:
+- DECODE_PRINTF("[ECX]");
+- base = M.x86.R_ECX;
+- break;
++ DECODE_PRINTF("[ECX]");
++ base = M.x86.R_ECX;
++ break;
+ case 2:
+- DECODE_PRINTF("[EDX]");
+- base = M.x86.R_EDX;
+- break;
++ DECODE_PRINTF("[EDX]");
++ base = M.x86.R_EDX;
++ break;
+ case 3:
+- DECODE_PRINTF("[EBX]");
+- base = M.x86.R_EBX;
+- break;
++ DECODE_PRINTF("[EBX]");
++ base = M.x86.R_EBX;
++ break;
+ case 4:
+- DECODE_PRINTF("[ESP]");
+- base = M.x86.R_ESP;
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
+- break;
++ DECODE_PRINTF("[ESP]");
++ base = M.x86.R_ESP;
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
++ break;
+ case 5:
+- if (mod == 0) {
+- base = fetch_long_imm();
+- DECODE_PRINTF2("%08x", base);
+- } else {
+- DECODE_PRINTF("[EBP]");
+- base = M.x86.R_ESP;
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
+- }
+- break;
++ if (mod == 0) {
++ base = fetch_long_imm();
++ DECODE_PRINTF2("%08x", base);
++ }
++ else {
++ DECODE_PRINTF("[EBP]");
++ base = M.x86.R_ESP;
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
++ }
++ break;
+ case 6:
+- DECODE_PRINTF("[ESI]");
+- base = M.x86.R_ESI;
+- break;
++ DECODE_PRINTF("[ESI]");
++ base = M.x86.R_ESI;
++ break;
+ case 7:
+- DECODE_PRINTF("[EDI]");
+- base = M.x86.R_EDI;
+- break;
++ DECODE_PRINTF("[EDI]");
++ base = M.x86.R_EDI;
++ break;
+ }
+ switch ((sib >> 3) & 0x07) {
+ case 0:
+- DECODE_PRINTF("[EAX");
+- i = M.x86.R_EAX;
+- break;
++ DECODE_PRINTF("[EAX");
++ i = M.x86.R_EAX;
++ break;
+ case 1:
+- DECODE_PRINTF("[ECX");
+- i = M.x86.R_ECX;
+- break;
++ DECODE_PRINTF("[ECX");
++ i = M.x86.R_ECX;
++ break;
+ case 2:
+- DECODE_PRINTF("[EDX");
+- i = M.x86.R_EDX;
+- break;
++ DECODE_PRINTF("[EDX");
++ i = M.x86.R_EDX;
++ break;
+ case 3:
+- DECODE_PRINTF("[EBX");
+- i = M.x86.R_EBX;
+- break;
++ DECODE_PRINTF("[EBX");
++ i = M.x86.R_EBX;
++ break;
+ case 4:
+- i = 0;
+- break;
++ i = 0;
++ break;
+ case 5:
+- DECODE_PRINTF("[EBP");
+- i = M.x86.R_EBP;
+- break;
++ DECODE_PRINTF("[EBP");
++ i = M.x86.R_EBP;
++ break;
+ case 6:
+- DECODE_PRINTF("[ESI");
+- i = M.x86.R_ESI;
+- break;
++ DECODE_PRINTF("[ESI");
++ i = M.x86.R_ESI;
++ break;
+ case 7:
+- DECODE_PRINTF("[EDI");
+- i = M.x86.R_EDI;
+- break;
++ DECODE_PRINTF("[EDI");
++ i = M.x86.R_EDI;
++ break;
+ }
+ scale = 1 << ((sib >> 6) & 0x03);
+ if (((sib >> 3) & 0x07) != 4) {
+- if (scale == 1) {
+- DECODE_PRINTF("]");
+- } else {
+- DECODE_PRINTF2("*%d]", scale);
+- }
++ if (scale == 1) {
++ DECODE_PRINTF("]");
++ }
++ else {
++ DECODE_PRINTF2("*%d]", scale);
++ }
+ }
+ return base + (i * scale);
+ }
+@@ -836,74 +832,75 @@ NOTE: The code which specifies the corresponding segment (ds vs ss)
+ if a SS access is needed, set this bit. Otherwise, DS access
+ occurs (unless any of the segment override bits are set).
+ ****************************************************************************/
+-u32 decode_rm00_address(
+- int rm)
++u32
++decode_rm00_address(int rm)
+ {
+ u32 offset;
+ int sib;
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+- switch (rm) {
+- case 0:
+- DECODE_PRINTF("[EAX]");
+- return M.x86.R_EAX;
+- case 1:
+- DECODE_PRINTF("[ECX]");
+- return M.x86.R_ECX;
+- case 2:
+- DECODE_PRINTF("[EDX]");
+- return M.x86.R_EDX;
+- case 3:
+- DECODE_PRINTF("[EBX]");
+- return M.x86.R_EBX;
+- case 4:
+- sib = fetch_byte_imm();
+- return decode_sib_address(sib, 0);
+- case 5:
+- offset = fetch_long_imm();
+- DECODE_PRINTF2("[%08x]", offset);
+- return offset;
+- case 6:
+- DECODE_PRINTF("[ESI]");
+- return M.x86.R_ESI;
+- case 7:
+- DECODE_PRINTF("[EDI]");
+- return M.x86.R_EDI;
+- }
+- HALT_SYS();
+- } else {
++ switch (rm) {
++ case 0:
++ DECODE_PRINTF("[EAX]");
++ return M.x86.R_EAX;
++ case 1:
++ DECODE_PRINTF("[ECX]");
++ return M.x86.R_ECX;
++ case 2:
++ DECODE_PRINTF("[EDX]");
++ return M.x86.R_EDX;
++ case 3:
++ DECODE_PRINTF("[EBX]");
++ return M.x86.R_EBX;
++ case 4:
++ sib = fetch_byte_imm();
++ return decode_sib_address(sib, 0);
++ case 5:
++ offset = fetch_long_imm();
++ DECODE_PRINTF2("[%08x]", offset);
++ return offset;
++ case 6:
++ DECODE_PRINTF("[ESI]");
++ return M.x86.R_ESI;
++ case 7:
++ DECODE_PRINTF("[EDI]");
++ return M.x86.R_EDI;
++ }
++ HALT_SYS();
++ }
++ else {
+ /* 16-bit addressing */
+- switch (rm) {
+- case 0:
+- DECODE_PRINTF("[BX+SI]");
++ switch (rm) {
++ case 0:
++ DECODE_PRINTF("[BX+SI]");
+ return (M.x86.R_BX + M.x86.R_SI) & 0xffff;
+- case 1:
+- DECODE_PRINTF("[BX+DI]");
++ case 1:
++ DECODE_PRINTF("[BX+DI]");
+ return (M.x86.R_BX + M.x86.R_DI) & 0xffff;
+- case 2:
+- DECODE_PRINTF("[BP+SI]");
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 2:
++ DECODE_PRINTF("[BP+SI]");
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI) & 0xffff;
+- case 3:
+- DECODE_PRINTF("[BP+DI]");
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 3:
++ DECODE_PRINTF("[BP+DI]");
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI) & 0xffff;
+- case 4:
+- DECODE_PRINTF("[SI]");
+- return M.x86.R_SI;
+- case 5:
+- DECODE_PRINTF("[DI]");
+- return M.x86.R_DI;
+- case 6:
+- offset = fetch_word_imm();
+- DECODE_PRINTF2("[%04x]", offset);
+- return offset;
+- case 7:
+- DECODE_PRINTF("[BX]");
+- return M.x86.R_BX;
+- }
+- HALT_SYS();
++ case 4:
++ DECODE_PRINTF("[SI]");
++ return M.x86.R_SI;
++ case 5:
++ DECODE_PRINTF("[DI]");
++ return M.x86.R_DI;
++ case 6:
++ offset = fetch_word_imm();
++ DECODE_PRINTF2("[%04x]", offset);
++ return offset;
++ case 7:
++ DECODE_PRINTF("[BX]");
++ return M.x86.R_BX;
++ }
++ HALT_SYS();
+ }
+ return 0;
+ }
+@@ -919,79 +916,80 @@ REMARKS:
+ Return the offset given by mod=01 addressing. Also enables the
+ decoding of instructions.
+ ****************************************************************************/
+-u32 decode_rm01_address(
+- int rm)
++u32
++decode_rm01_address(int rm)
+ {
+ int displacement = 0;
+ int sib;
+
+ /* Fetch disp8 if no SIB byte */
+ if (!((M.x86.mode & SYSMODE_PREFIX_ADDR) && (rm == 4)))
+- displacement = (s8)fetch_byte_imm();
++ displacement = (s8) fetch_byte_imm();
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+- switch (rm) {
+- case 0:
+- DECODE_PRINTF2("%d[EAX]", displacement);
+- return M.x86.R_EAX + displacement;
+- case 1:
+- DECODE_PRINTF2("%d[ECX]", displacement);
+- return M.x86.R_ECX + displacement;
+- case 2:
+- DECODE_PRINTF2("%d[EDX]", displacement);
+- return M.x86.R_EDX + displacement;
+- case 3:
+- DECODE_PRINTF2("%d[EBX]", displacement);
+- return M.x86.R_EBX + displacement;
+- case 4:
+- sib = fetch_byte_imm();
+- displacement = (s8)fetch_byte_imm();
+- DECODE_PRINTF2("%d", displacement);
+- return decode_sib_address(sib, 1) + displacement;
+- case 5:
+- DECODE_PRINTF2("%d[EBP]", displacement);
+- return M.x86.R_EBP + displacement;
+- case 6:
+- DECODE_PRINTF2("%d[ESI]", displacement);
+- return M.x86.R_ESI + displacement;
+- case 7:
+- DECODE_PRINTF2("%d[EDI]", displacement);
+- return M.x86.R_EDI + displacement;
+- }
+- HALT_SYS();
+- } else {
++ switch (rm) {
++ case 0:
++ DECODE_PRINTF2("%d[EAX]", displacement);
++ return M.x86.R_EAX + displacement;
++ case 1:
++ DECODE_PRINTF2("%d[ECX]", displacement);
++ return M.x86.R_ECX + displacement;
++ case 2:
++ DECODE_PRINTF2("%d[EDX]", displacement);
++ return M.x86.R_EDX + displacement;
++ case 3:
++ DECODE_PRINTF2("%d[EBX]", displacement);
++ return M.x86.R_EBX + displacement;
++ case 4:
++ sib = fetch_byte_imm();
++ displacement = (s8) fetch_byte_imm();
++ DECODE_PRINTF2("%d", displacement);
++ return decode_sib_address(sib, 1) + displacement;
++ case 5:
++ DECODE_PRINTF2("%d[EBP]", displacement);
++ return M.x86.R_EBP + displacement;
++ case 6:
++ DECODE_PRINTF2("%d[ESI]", displacement);
++ return M.x86.R_ESI + displacement;
++ case 7:
++ DECODE_PRINTF2("%d[EDI]", displacement);
++ return M.x86.R_EDI + displacement;
++ }
++ HALT_SYS();
++ }
++ else {
+ /* 16-bit addressing */
+- switch (rm) {
+- case 0:
+- DECODE_PRINTF2("%d[BX+SI]", displacement);
++ switch (rm) {
++ case 0:
++ DECODE_PRINTF2("%d[BX+SI]", displacement);
+ return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
+- case 1:
+- DECODE_PRINTF2("%d[BX+DI]", displacement);
++ case 1:
++ DECODE_PRINTF2("%d[BX+DI]", displacement);
+ return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
+- case 2:
+- DECODE_PRINTF2("%d[BP+SI]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 2:
++ DECODE_PRINTF2("%d[BP+SI]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
+- case 3:
+- DECODE_PRINTF2("%d[BP+DI]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 3:
++ DECODE_PRINTF2("%d[BP+DI]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
+- case 4:
+- DECODE_PRINTF2("%d[SI]", displacement);
++ case 4:
++ DECODE_PRINTF2("%d[SI]", displacement);
+ return (M.x86.R_SI + displacement) & 0xffff;
+- case 5:
+- DECODE_PRINTF2("%d[DI]", displacement);
++ case 5:
++ DECODE_PRINTF2("%d[DI]", displacement);
+ return (M.x86.R_DI + displacement) & 0xffff;
+- case 6:
+- DECODE_PRINTF2("%d[BP]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 6:
++ DECODE_PRINTF2("%d[BP]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + displacement) & 0xffff;
+- case 7:
+- DECODE_PRINTF2("%d[BX]", displacement);
++ case 7:
++ DECODE_PRINTF2("%d[BX]", displacement);
+ return (M.x86.R_BX + displacement) & 0xffff;
+- }
+- HALT_SYS();
++ }
++ HALT_SYS();
+ }
+ return 0; /* SHOULD NOT HAPPEN */
+ }
+@@ -1007,86 +1005,87 @@ REMARKS:
+ Return the offset given by mod=10 addressing. Also enables the
+ decoding of instructions.
+ ****************************************************************************/
+-u32 decode_rm10_address(
+- int rm)
++u32
++decode_rm10_address(int rm)
+ {
+ u32 displacement = 0;
+ int sib;
+
+ /* Fetch disp16 if 16-bit addr mode */
+ if (!(M.x86.mode & SYSMODE_PREFIX_ADDR))
+- displacement = (u16)fetch_word_imm();
++ displacement = (u16) fetch_word_imm();
+ else {
+- /* Fetch disp32 if no SIB byte */
+- if (rm != 4)
+- displacement = (u32)fetch_long_imm();
++ /* Fetch disp32 if no SIB byte */
++ if (rm != 4)
++ displacement = (u32) fetch_long_imm();
+ }
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+- switch (rm) {
+- case 0:
+- DECODE_PRINTF2("%08x[EAX]", displacement);
+- return M.x86.R_EAX + displacement;
+- case 1:
+- DECODE_PRINTF2("%08x[ECX]", displacement);
+- return M.x86.R_ECX + displacement;
+- case 2:
+- DECODE_PRINTF2("%08x[EDX]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
+- return M.x86.R_EDX + displacement;
+- case 3:
+- DECODE_PRINTF2("%08x[EBX]", displacement);
+- return M.x86.R_EBX + displacement;
+- case 4:
+- sib = fetch_byte_imm();
+- displacement = (u32)fetch_long_imm();
+- DECODE_PRINTF2("%08x", displacement);
+- return decode_sib_address(sib, 2) + displacement;
+- break;
+- case 5:
+- DECODE_PRINTF2("%08x[EBP]", displacement);
+- return M.x86.R_EBP + displacement;
+- case 6:
+- DECODE_PRINTF2("%08x[ESI]", displacement);
+- return M.x86.R_ESI + displacement;
+- case 7:
+- DECODE_PRINTF2("%08x[EDI]", displacement);
+- return M.x86.R_EDI + displacement;
+- }
+- HALT_SYS();
+- } else {
++ switch (rm) {
++ case 0:
++ DECODE_PRINTF2("%08x[EAX]", displacement);
++ return M.x86.R_EAX + displacement;
++ case 1:
++ DECODE_PRINTF2("%08x[ECX]", displacement);
++ return M.x86.R_ECX + displacement;
++ case 2:
++ DECODE_PRINTF2("%08x[EDX]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
++ return M.x86.R_EDX + displacement;
++ case 3:
++ DECODE_PRINTF2("%08x[EBX]", displacement);
++ return M.x86.R_EBX + displacement;
++ case 4:
++ sib = fetch_byte_imm();
++ displacement = (u32) fetch_long_imm();
++ DECODE_PRINTF2("%08x", displacement);
++ return decode_sib_address(sib, 2) + displacement;
++ break;
++ case 5:
++ DECODE_PRINTF2("%08x[EBP]", displacement);
++ return M.x86.R_EBP + displacement;
++ case 6:
++ DECODE_PRINTF2("%08x[ESI]", displacement);
++ return M.x86.R_ESI + displacement;
++ case 7:
++ DECODE_PRINTF2("%08x[EDI]", displacement);
++ return M.x86.R_EDI + displacement;
++ }
++ HALT_SYS();
++ }
++ else {
+ /* 16-bit addressing */
+- switch (rm) {
+- case 0:
++ switch (rm) {
++ case 0:
+ DECODE_PRINTF2("%04x[BX+SI]", displacement);
+ return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
+- case 1:
++ case 1:
+ DECODE_PRINTF2("%04x[BX+DI]", displacement);
+ return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
+- case 2:
+- DECODE_PRINTF2("%04x[BP+SI]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 2:
++ DECODE_PRINTF2("%04x[BP+SI]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
+- case 3:
+- DECODE_PRINTF2("%04x[BP+DI]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 3:
++ DECODE_PRINTF2("%04x[BP+DI]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
+- case 4:
++ case 4:
+ DECODE_PRINTF2("%04x[SI]", displacement);
+ return (M.x86.R_SI + displacement) & 0xffff;
+- case 5:
++ case 5:
+ DECODE_PRINTF2("%04x[DI]", displacement);
+ return (M.x86.R_DI + displacement) & 0xffff;
+- case 6:
+- DECODE_PRINTF2("%04x[BP]", displacement);
+- M.x86.mode |= SYSMODE_SEG_DS_SS;
++ case 6:
++ DECODE_PRINTF2("%04x[BP]", displacement);
++ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + displacement) & 0xffff;
+- case 7:
++ case 7:
+ DECODE_PRINTF2("%04x[BX]", displacement);
+ return (M.x86.R_BX + displacement) & 0xffff;
+- }
+- HALT_SYS();
++ }
++ HALT_SYS();
+ }
+ return 0;
+ /*NOTREACHED */
+diff --git a/libs/x86emu/fpu.c b/libs/x86emu/fpu.c
+index b72de1e..0dab05c 100644
+--- a/libs/x86emu/fpu.c
++++ b/libs/x86emu/fpu.c
+@@ -42,7 +42,8 @@
+ /*----------------------------- Implementation ----------------------------*/
+
+ /* opcode=0xd8 */
+-void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("ESC D8\n");
+@@ -52,7 +53,7 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
+
+ #ifdef DEBUG
+
+-static char *x86emu_fpu_op_d9_tab[] = {
++static const char *x86emu_fpu_op_d9_tab[] = {
+ "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
+ "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
+
+@@ -63,7 +64,7 @@ static char *x86emu_fpu_op_d9_tab[] = {
+ "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
+ };
+
+-static char *x86emu_fpu_op_d9_tab1[] = {
++static const char *x86emu_fpu_op_d9_tab1[] = {
+ "FLD\t", "FLD\t", "FLD\t", "FLD\t",
+ "FLD\t", "FLD\t", "FLD\t", "FLD\t",
+
+@@ -89,10 +90,11 @@ static char *x86emu_fpu_op_d9_tab1[] = {
+ "FRNDINT", "FSCALE", "ESC_D9", "ESC_D9",
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xd9 */
+-void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -103,56 +105,58 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
+ #ifdef DEBUG
+ if (mod != 3) {
+ DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
+- } else {
++ }
++ else {
+ DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
+ }
+ #endif
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
+- if (rh < 4) {
+- DECODE_PRINTF2("ST(%d)\n", stkelem);
+- } else {
+- DECODE_PRINTF("\n");
+- }
++ case 3: /* register to register */
++ stkelem = (u8) rl;
++ if (rh < 4) {
++ DECODE_PRINTF2("ST(%d)\n", stkelem);
++ }
++ else {
++ DECODE_PRINTF("\n");
++ }
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
+ break;
+- case 2:
++ case 2:
+ switch (rl) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_nop();
+ break;
+- default:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+- case 3:
++ case 3:
+ x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
+ break;
+- case 4:
++ case 4:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
+@@ -173,133 +177,133 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
+ }
+ break;
+
+- case 5:
++ case 5:
+ switch (rl) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
+ break;
+- default:
++ default:
+ /* 7 */
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+- case 6:
++ case 6:
+ switch (rl) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_illegal();
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_R_decstp();
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_R_incstp();
+ break;
+ }
+ break;
+
+- case 7:
++ case 7:
+ switch (rl) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_illegal();
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
+ break;
+- case 6:
+- case 7:
+- default:
++ case 6:
++ case 7:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_illegal();
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
+-#endif /* X86EMU_FPU_PRESENT */
++ (void) destoffset;
++ (void) stkelem;
++#endif /* X86EMU_FPU_PRESENT */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+ }
+
+ #ifdef DEBUG
+
+-char *x86emu_fpu_op_da_tab[] = {
++static const char *x86emu_fpu_op_da_tab[] = {
+ "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+@@ -309,7 +313,7 @@ char *x86emu_fpu_op_da_tab[] = {
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+ "FIDIVR\tDWORD PTR ",
+-
++
+ "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+@@ -319,10 +323,11 @@ char *x86emu_fpu_op_da_tab[] = {
+ "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ",
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xda */
+-void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -332,59 +337,59 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
++ case 3: /* register to register */
++ stkelem = (u8) rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+- case 3:
++ case 3:
+ x86emu_fpu_illegal();
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
++ (void) destoffset;
++ (void) stkelem;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+@@ -392,7 +397,7 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
+
+ #ifdef DEBUG
+
+-char *x86emu_fpu_op_db_tab[] = {
++static const char *x86emu_fpu_op_db_tab[] = {
+ "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
+ "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
+
+@@ -403,10 +408,11 @@ char *x86emu_fpu_op_db_tab[] = {
+ "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xdb */
+-void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -416,104 +422,106 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
+ #ifdef DEBUG
+ if (mod != 3) {
+ DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
+- } else if (rh == 4) { /* === 11 10 0 nnn */
++ }
++ else if (rh == 4) { /* === 11 10 0 nnn */
+ switch (rl) {
+- case 0:
++ case 0:
+ DECODE_PRINTF("FENI\n");
+ break;
+- case 1:
++ case 1:
+ DECODE_PRINTF("FDISI\n");
+ break;
+- case 2:
++ case 2:
+ DECODE_PRINTF("FCLEX\n");
+ break;
+- case 3:
++ case 3:
+ DECODE_PRINTF("FINIT\n");
+ break;
+ }
+- } else {
++ }
++ else {
+ DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
+ }
+-#endif /* DEBUG */
++#endif /* DEBUG */
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 4:
++ case 4:
+ switch (rl) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_feni();
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fdisi();
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fclex();
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_finit();
+ break;
+- default:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+- default:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_illegal();
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_illegal();
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_illegal();
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
++ (void) destoffset;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+ }
+
+ #ifdef DEBUG
+-char *x86emu_fpu_op_dc_tab[] = {
++static const char *x86emu_fpu_op_dc_tab[] = {
+ "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
+ "FCOMP\tQWORD PTR ",
+ "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
+@@ -532,10 +540,11 @@ char *x86emu_fpu_op_dc_tab[] = {
+ "FADD\t", "FMUL\t", "FCOM\t", "FCOMP\t",
+ "FSUBR\t", "FSUB\t", "FDIVR\t", "FDIV\t",
+ };
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xdc */
+-void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -545,85 +554,85 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
++ case 3: /* register to register */
++ stkelem = (u8) rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
++ (void) destoffset;
++ (void) stkelem;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+@@ -631,7 +640,7 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
+
+ #ifdef DEBUG
+
+-static char *x86emu_fpu_op_dd_tab[] = {
++static const char *x86emu_fpu_op_dd_tab[] = {
+ "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
+ "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
+
+@@ -645,10 +654,11 @@ static char *x86emu_fpu_op_dd_tab[] = {
+ "ESC_DD\t2C,", "ESC_DD\t2D,", "ESC_DD\t2E,", "ESC_DD\t2F,",
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xdd */
+-void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -658,75 +668,75 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
++ case 3: /* register to register */
++ stkelem = (u8) rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+- default:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_illegal();
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_illegal();
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
++ (void) destoffset;
++ (void) stkelem;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+@@ -734,8 +744,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
+
+ #ifdef DEBUG
+
+-static char *x86emu_fpu_op_de_tab[] =
+-{
++static const char *x86emu_fpu_op_de_tab[] = {
+ "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
+ "FICOMP\tWORD PTR ",
+ "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
+@@ -755,10 +764,11 @@ static char *x86emu_fpu_op_de_tab[] =
+ "FSUBRP\t", "FSUBP\t", "FDIVRP\t", "FDIVP\t",
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xde */
+-void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -768,87 +778,87 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
++ case 3: /* register to register */
++ stkelem = (u8) rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 3:
++ case 3:
+ if (stkelem == 1)
+- x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
++ x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
+ else
+- x86emu_fpu_illegal();
++ x86emu_fpu_illegal();
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
++ (void) destoffset;
++ (void) stkelem;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+@@ -856,7 +866,7 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
+
+ #ifdef DEBUG
+
+-static char *x86emu_fpu_op_df_tab[] = {
++static const char *x86emu_fpu_op_df_tab[] = {
+ /* mod == 00 */
+ "FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
+ "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
+@@ -877,10 +887,11 @@ static char *x86emu_fpu_op_df_tab[] = {
+ "ESC_DF\t3C,", "ESC_DF\t3D,", "ESC_DF\t3E,", "ESC_DF\t3F,"
+ };
+
+-#endif /* DEBUG */
++#endif /* DEBUG */
+
+ /* opcode=0xdf */
+-void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
++void
++x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset = 0;
+@@ -890,75 +901,75 @@ void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
+ switch (mod) {
+- case 0:
++ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 1:
++ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 2:
++ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+- case 3: /* register to register */
+- stkelem = (u8)rl;
++ case 3: /* register to register */
++ stkelem = (u8) rl;
+ DECODE_PRINTF2("\tST(%d)\n", stkelem);
+ break;
+ }
+ #ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+- case 3:
++ case 3:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+- default:
++ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+- default:
++ default:
+ switch (rh) {
+- case 0:
++ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 1:
++ case 1:
+ x86emu_fpu_illegal();
+ break;
+- case 2:
++ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 3:
++ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
+ break;
+- case 4:
++ case 4:
+ x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
+ break;
+- case 5:
++ case 5:
+ x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
+ break;
+- case 6:
++ case 6:
+ x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
+ break;
+- case 7:
++ case 7:
+ x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
+ break;
+ }
+ }
+ #else
+- (void)destoffset;
+- (void)stkelem;
++ (void) destoffset;
++ (void) stkelem;
+ #endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+diff --git a/libs/x86emu/ops.c b/libs/x86emu/ops.c
+index 4f504c9..76b8358 100644
+--- a/libs/x86emu/ops.c
++++ b/libs/x86emu/ops.c
+@@ -81,17 +81,17 @@ op1 - Instruction op code
+ REMARKS:
+ Handles illegal opcodes.
+ ****************************************************************************/
+-static void x86emuOp_illegal_op(
+- u8 op1)
++static void
++x86emuOp_illegal_op(u8 op1)
+ {
+ START_OF_INSTR();
+ if (M.x86.R_SP != 0) {
+- DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
+- TRACE_REGS();
+- printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
+- M.x86.R_CS, M.x86.R_IP-1,op1);
+- HALT_SYS();
+- }
++ DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
++ TRACE_REGS();
++ DB(printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
++ M.x86.R_CS, M.x86.R_IP - 1, op1));
++ HALT_SYS();
++ }
+ else {
+ /* If we get here, it means the stack pointer is back to zero
+ * so we are just returning from an emulator service call
+@@ -100,7 +100,7 @@ static void x86emuOp_illegal_op(
+ * call.
+ */
+ X86EMU_halt_sys();
+- }
++ }
+ END_OF_INSTR();
+ }
+
+@@ -108,7 +108,8 @@ static void x86emuOp_illegal_op(
+ REMARKS:
+ Handles opcode 0x00
+ ****************************************************************************/
+-static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -149,7 +150,7 @@ static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -166,7 +167,8 @@ static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x01
+ ****************************************************************************/
+-static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -188,7 +190,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -215,7 +218,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -242,7 +246,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -256,9 +261,9 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -266,8 +271,9 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -286,7 +292,8 @@ static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x02
+ ****************************************************************************/
+-static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -324,7 +331,7 @@ static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -341,7 +348,8 @@ static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x03
+ ****************************************************************************/
+-static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -362,7 +370,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -387,7 +396,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -412,7 +422,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -425,9 +436,9 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -435,8 +446,9 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -455,7 +467,8 @@ static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x04
+ ****************************************************************************/
+-static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -473,7 +486,8 @@ static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x05
+ ****************************************************************************/
+-static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -481,7 +495,8 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADD\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("ADD\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -489,8 +504,9 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = add_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -500,7 +516,8 @@ static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x06
+ ****************************************************************************/
+-static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tES\n");
+@@ -514,7 +531,8 @@ static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x07
+ ****************************************************************************/
+-static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tES\n");
+@@ -528,7 +546,8 @@ static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x08
+ ****************************************************************************/
+-static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -569,7 +588,7 @@ static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -586,7 +605,8 @@ static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x09
+ ****************************************************************************/
+-static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -608,7 +628,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -635,7 +656,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -662,7 +684,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -676,9 +699,9 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -686,8 +709,9 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -706,7 +730,8 @@ static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0a
+ ****************************************************************************/
+-static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -744,7 +769,7 @@ static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -761,7 +786,8 @@ static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0b
+ ****************************************************************************/
+-static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -782,7 +808,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -807,7 +834,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -832,7 +860,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -845,9 +874,9 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -855,8 +884,9 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -875,7 +905,8 @@ static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0c
+ ****************************************************************************/
+-static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -893,7 +924,8 @@ static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0d
+ ****************************************************************************/
+-static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -901,7 +933,8 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OR\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("OR\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -909,8 +942,9 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = or_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -920,7 +954,8 @@ static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0e
+ ****************************************************************************/
+-static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tCS\n");
+@@ -934,18 +969,21 @@ static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
+ ****************************************************************************/
+-static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
+ {
+- u8 op2 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
++ u8 op2 = (*sys_rdb) (((u32) M.x86.R_CS << 4) + (M.x86.R_IP++));
++
+ INC_DECODED_INST_LEN(1);
+- (*x86emu_optab2[op2])(op2);
++ (*x86emu_optab2[op2]) (op2);
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x10
+ ****************************************************************************/
+-static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -986,7 +1024,7 @@ static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -1003,7 +1041,8 @@ static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x11
+ ****************************************************************************/
+-static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -1025,7 +1064,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1052,7 +1092,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1079,7 +1120,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1093,9 +1135,9 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1103,8 +1145,9 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1123,7 +1166,8 @@ static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x12
+ ****************************************************************************/
+-static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -1161,7 +1205,7 @@ static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -1178,7 +1222,8 @@ static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x13
+ ****************************************************************************/
+-static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1199,7 +1244,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1224,7 +1270,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1249,7 +1296,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1262,9 +1310,9 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1272,8 +1320,9 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1292,7 +1341,8 @@ static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x14
+ ****************************************************************************/
+-static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -1310,7 +1360,8 @@ static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x15
+ ****************************************************************************/
+-static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -1318,7 +1369,8 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADC\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("ADC\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -1326,8 +1378,9 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = adc_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -1337,7 +1390,8 @@ static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x16
+ ****************************************************************************/
+-static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tSS\n");
+@@ -1351,7 +1405,8 @@ static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x17
+ ****************************************************************************/
+-static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tSS\n");
+@@ -1365,7 +1420,8 @@ static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x18
+ ****************************************************************************/
+-static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -1406,7 +1462,7 @@ static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -1423,7 +1479,8 @@ static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x19
+ ****************************************************************************/
+-static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -1445,7 +1502,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1472,7 +1530,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1499,7 +1558,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1513,9 +1573,9 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1523,8 +1583,9 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1543,7 +1604,8 @@ static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1a
+ ****************************************************************************/
+-static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -1581,7 +1643,7 @@ static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -1598,7 +1660,8 @@ static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1b
+ ****************************************************************************/
+-static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1619,7 +1682,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1644,7 +1708,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1669,7 +1734,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1682,9 +1748,9 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1692,8 +1758,9 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1712,7 +1779,8 @@ static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1c
+ ****************************************************************************/
+-static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -1730,7 +1798,8 @@ static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1d
+ ****************************************************************************/
+-static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -1738,7 +1807,8 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SBB\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("SBB\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -1746,8 +1816,9 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = sbb_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -1757,7 +1828,8 @@ static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1e
+ ****************************************************************************/
+-static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tDS\n");
+@@ -1771,7 +1843,8 @@ static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x1f
+ ****************************************************************************/
+-static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tDS\n");
+@@ -1785,7 +1858,8 @@ static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x20
+ ****************************************************************************/
+-static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -1830,7 +1904,7 @@ static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_byte(destoffset, destval);
+ break;
+
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -1847,7 +1921,8 @@ static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x21
+ ****************************************************************************/
+-static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -1869,7 +1944,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1896,7 +1972,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1923,7 +2000,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -1937,9 +2015,9 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1947,8 +2025,9 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1967,7 +2046,8 @@ static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x22
+ ****************************************************************************/
+-static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -2005,7 +2085,7 @@ static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -2022,7 +2102,8 @@ static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x23
+ ****************************************************************************/
+-static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2043,7 +2124,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2069,7 +2151,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ break;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2094,7 +2177,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2107,9 +2191,9 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2117,8 +2201,9 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2137,7 +2222,8 @@ static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x24
+ ****************************************************************************/
+-static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -2155,7 +2241,8 @@ static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x25
+ ****************************************************************************/
+-static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -2163,7 +2250,8 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("AND\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("AND\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -2171,8 +2259,9 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = and_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -2182,7 +2271,8 @@ static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x26
+ ****************************************************************************/
+-static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("ES:\n");
+@@ -2199,7 +2289,8 @@ static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x27
+ ****************************************************************************/
+-static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_daa(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("DAA\n");
+@@ -2213,7 +2304,8 @@ static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x28
+ ****************************************************************************/
+-static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -2254,7 +2346,7 @@ static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -2271,7 +2363,8 @@ static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x29
+ ****************************************************************************/
+-static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -2293,7 +2386,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2320,7 +2414,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2347,7 +2442,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2361,9 +2457,9 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -2371,8 +2467,9 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -2391,7 +2488,8 @@ static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2a
+ ****************************************************************************/
+-static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -2429,7 +2527,7 @@ static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -2446,7 +2544,8 @@ static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2b
+ ****************************************************************************/
+-static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2467,7 +2566,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2492,7 +2592,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2517,7 +2618,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2530,9 +2632,9 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2540,8 +2642,9 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2560,7 +2663,8 @@ static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2c
+ ****************************************************************************/
+-static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -2578,7 +2682,8 @@ static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2d
+ ****************************************************************************/
+-static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -2586,7 +2691,8 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SUB\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("SUB\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -2594,8 +2700,9 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = sub_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -2605,7 +2712,8 @@ static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2e
+ ****************************************************************************/
+-static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("CS:\n");
+@@ -2619,7 +2727,8 @@ static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x2f
+ ****************************************************************************/
+-static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_das(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("DAS\n");
+@@ -2633,7 +2742,8 @@ static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x30
+ ****************************************************************************/
+-static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -2674,7 +2784,7 @@ static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -2691,7 +2801,8 @@ static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x31
+ ****************************************************************************/
+-static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -2713,7 +2824,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2740,7 +2852,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2767,7 +2880,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -2781,9 +2895,9 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -2791,8 +2905,9 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -2811,7 +2926,8 @@ static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x32
+ ****************************************************************************/
+-static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -2849,7 +2965,7 @@ static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -2866,7 +2982,8 @@ static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x33
+ ****************************************************************************/
+-static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2887,7 +3004,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2912,7 +3030,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2937,7 +3056,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -2950,9 +3070,9 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2960,8 +3080,9 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -2980,7 +3101,8 @@ static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x34
+ ****************************************************************************/
+-static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -2998,7 +3120,8 @@ static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x35
+ ****************************************************************************/
+-static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -3006,7 +3129,8 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XOR\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XOR\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -3014,8 +3138,9 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
+- } else {
+- M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ M.x86.R_AX = xor_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -3025,7 +3150,8 @@ static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x36
+ ****************************************************************************/
+-static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("SS:\n");
+@@ -3039,7 +3165,8 @@ static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x37
+ ****************************************************************************/
+-static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("AAA\n");
+@@ -3053,7 +3180,8 @@ static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x38
+ ****************************************************************************/
+-static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -3091,7 +3219,7 @@ static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -3108,7 +3236,8 @@ static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x39
+ ****************************************************************************/
+-static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -3129,7 +3258,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -3154,7 +3284,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -3179,7 +3310,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -3192,9 +3324,9 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ cmp_word(destval, *srcreg);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -3202,8 +3334,9 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -3222,7 +3355,8 @@ static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3a
+ ****************************************************************************/
+-static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -3260,7 +3394,7 @@ static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -3277,7 +3411,8 @@ static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3b
+ ****************************************************************************/
+-static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -3298,7 +3433,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -3323,7 +3459,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -3348,7 +3485,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -3361,9 +3499,9 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ cmp_word(*destreg, srcval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -3371,8 +3509,9 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -3391,7 +3530,8 @@ static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3c
+ ****************************************************************************/
+-static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 srcval;
+
+@@ -3409,7 +3549,8 @@ static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3d
+ ****************************************************************************/
+-static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -3417,7 +3558,8 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMP\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("CMP\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -3425,8 +3567,9 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ cmp_long(M.x86.R_EAX, srcval);
+- } else {
+- cmp_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ cmp_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -3436,7 +3579,8 @@ static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3e
+ ****************************************************************************/
+-static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("DS:\n");
+@@ -3450,7 +3594,8 @@ static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x3f
+ ****************************************************************************/
+-static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_aas(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("AAS\n");
+@@ -3464,18 +3609,21 @@ static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x40
+ ****************************************************************************/
+-static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEAX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = inc_long(M.x86.R_EAX);
+- } else {
++ }
++ else {
+ M.x86.R_AX = inc_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3486,18 +3634,21 @@ static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x41
+ ****************************************************************************/
+-static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tECX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = inc_long(M.x86.R_ECX);
+- } else {
++ }
++ else {
+ M.x86.R_CX = inc_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3508,18 +3659,21 @@ static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x42
+ ****************************************************************************/
+-static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = inc_long(M.x86.R_EDX);
+- } else {
++ }
++ else {
+ M.x86.R_DX = inc_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3530,18 +3684,21 @@ static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x43
+ ****************************************************************************/
+-static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = inc_long(M.x86.R_EBX);
+- } else {
++ }
++ else {
+ M.x86.R_BX = inc_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3552,18 +3709,21 @@ static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x44
+ ****************************************************************************/
+-static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = inc_long(M.x86.R_ESP);
+- } else {
++ }
++ else {
+ M.x86.R_SP = inc_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3574,18 +3734,21 @@ static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x45
+ ****************************************************************************/
+-static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = inc_long(M.x86.R_EBP);
+- } else {
++ }
++ else {
+ M.x86.R_BP = inc_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3596,18 +3759,21 @@ static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x46
+ ****************************************************************************/
+-static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = inc_long(M.x86.R_ESI);
+- } else {
++ }
++ else {
+ M.x86.R_SI = inc_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3618,18 +3784,21 @@ static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x47
+ ****************************************************************************/
+-static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = inc_long(M.x86.R_EDI);
+- } else {
++ }
++ else {
+ M.x86.R_DI = inc_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3640,18 +3809,21 @@ static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x48
+ ****************************************************************************/
+-static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEAX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = dec_long(M.x86.R_EAX);
+- } else {
++ }
++ else {
+ M.x86.R_AX = dec_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3662,18 +3834,21 @@ static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x49
+ ****************************************************************************/
+-static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tECX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = dec_long(M.x86.R_ECX);
+- } else {
++ }
++ else {
+ M.x86.R_CX = dec_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3684,18 +3859,21 @@ static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4a
+ ****************************************************************************/
+-static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = dec_long(M.x86.R_EDX);
+- } else {
++ }
++ else {
+ M.x86.R_DX = dec_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3706,18 +3884,21 @@ static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4b
+ ****************************************************************************/
+-static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = dec_long(M.x86.R_EBX);
+- } else {
++ }
++ else {
+ M.x86.R_BX = dec_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3728,18 +3909,21 @@ static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4c
+ ****************************************************************************/
+-static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = dec_long(M.x86.R_ESP);
+- } else {
++ }
++ else {
+ M.x86.R_SP = dec_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3750,18 +3934,21 @@ static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4d
+ ****************************************************************************/
+-static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = dec_long(M.x86.R_EBP);
+- } else {
++ }
++ else {
+ M.x86.R_BP = dec_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3772,18 +3959,21 @@ static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4e
+ ****************************************************************************/
+-static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = dec_long(M.x86.R_ESI);
+- } else {
++ }
++ else {
+ M.x86.R_SI = dec_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3794,18 +3984,21 @@ static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x4f
+ ****************************************************************************/
+-static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = dec_long(M.x86.R_EDI);
+- } else {
++ }
++ else {
+ M.x86.R_DI = dec_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3816,18 +4009,21 @@ static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x50
+ ****************************************************************************/
+-static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEAX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EAX);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3838,18 +4034,21 @@ static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x51
+ ****************************************************************************/
+-static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tECX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ECX);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3860,18 +4059,21 @@ static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x52
+ ****************************************************************************/
+-static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDX);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3882,18 +4084,21 @@ static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x53
+ ****************************************************************************/
+-static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBX);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3904,23 +4109,26 @@ static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x54
+ ****************************************************************************/
+-static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tSP\n");
+ }
+ TRACE_AND_STEP();
+- /* Always push (E)SP, since we are emulating an i386 and above
+- * processor. This is necessary as some BIOS'es use this to check
+- * what type of processor is in the system.
+- */
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- push_long(M.x86.R_ESP);
+- } else {
+- push_word((u16)(M.x86.R_SP));
++ /* Always push (E)SP, since we are emulating an i386 and above
++ * processor. This is necessary as some BIOS'es use this to check
++ * what type of processor is in the system.
++ */
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ push_long(M.x86.R_ESP);
++ }
++ else {
++ push_word((u16) (M.x86.R_SP));
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -3930,18 +4138,21 @@ static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x55
+ ****************************************************************************/
+-static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBP);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3952,18 +4163,21 @@ static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x56
+ ****************************************************************************/
+-static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ESI);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3974,18 +4188,21 @@ static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x57
+ ****************************************************************************/
+-static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSH\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDI);
+- } else {
++ }
++ else {
+ push_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -3996,18 +4213,21 @@ static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x58
+ ****************************************************************************/
+-static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEAX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_AX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4018,18 +4238,21 @@ static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x59
+ ****************************************************************************/
+-static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tECX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_CX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4040,18 +4263,21 @@ static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5a
+ ****************************************************************************/
+-static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_DX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4062,18 +4288,21 @@ static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5b
+ ****************************************************************************/
+-static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_BX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4084,18 +4313,21 @@ static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5c
+ ****************************************************************************/
+-static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_SP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4106,18 +4338,21 @@ static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5d
+ ****************************************************************************/
+-static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_BP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4128,18 +4363,21 @@ static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5e
+ ****************************************************************************/
+-static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_SI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4150,18 +4388,21 @@ static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x5f
+ ****************************************************************************/
+-static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POP\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_DI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -4172,12 +4413,14 @@ static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x60
+ ****************************************************************************/
+-static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHAD\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSHA\n");
+ }
+ TRACE_AND_STEP();
+@@ -4192,7 +4435,8 @@ static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+ push_long(M.x86.R_EBP);
+ push_long(M.x86.R_ESI);
+ push_long(M.x86.R_EDI);
+- } else {
++ }
++ else {
+ u16 old_sp = M.x86.R_SP;
+
+ push_word(M.x86.R_AX);
+@@ -4212,12 +4456,14 @@ static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x61
+ ****************************************************************************/
+-static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPAD\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POPA\n");
+ }
+ TRACE_AND_STEP();
+@@ -4225,16 +4471,17 @@ static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+ M.x86.R_EDI = pop_long();
+ M.x86.R_ESI = pop_long();
+ M.x86.R_EBP = pop_long();
+- M.x86.R_ESP += 4; /* skip ESP */
++ M.x86.R_ESP += 4; /* skip ESP */
+ M.x86.R_EBX = pop_long();
+ M.x86.R_EDX = pop_long();
+ M.x86.R_ECX = pop_long();
+ M.x86.R_EAX = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_DI = pop_word();
+ M.x86.R_SI = pop_word();
+ M.x86.R_BP = pop_word();
+- M.x86.R_SP += 2; /* skip SP */
++ M.x86.R_SP += 2; /* skip SP */
+ M.x86.R_BX = pop_word();
+ M.x86.R_DX = pop_word();
+ M.x86.R_CX = pop_word();
+@@ -4251,7 +4498,8 @@ static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x64
+ ****************************************************************************/
+-static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("FS:\n");
+@@ -4268,7 +4516,8 @@ static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x65
+ ****************************************************************************/
+-static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("GS:\n");
+@@ -4285,7 +4534,8 @@ static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x66 - prefix for 32-bit register
+ ****************************************************************************/
+-static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("DATA:\n");
+@@ -4299,7 +4549,8 @@ static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x67 - prefix for 32-bit address
+ ****************************************************************************/
+-static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("ADDR:\n");
+@@ -4313,22 +4564,25 @@ static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x68
+ ****************************************************************************/
+-static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 imm;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ imm = fetch_long_imm();
+- } else {
++ }
++ else {
+ imm = fetch_word_imm();
+ }
+ DECODE_PRINTF2("PUSH\t%x\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(imm);
+- } else {
+- push_word((u16)imm);
++ }
++ else {
++ push_word((u16) imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -4338,7 +4592,8 @@ static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x69
+ ****************************************************************************/
+-static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -4351,7 +4606,7 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+@@ -4359,18 +4614,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4381,24 +4638,26 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+@@ -4406,18 +4665,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4428,24 +4689,26 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+@@ -4453,18 +4716,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4475,42 +4740,46 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
+- u32 res_lo,res_hi;
++ u32 *destreg, *srcreg;
++ u32 res_lo, res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
+- u16 *destreg,*srcreg;
++ *destreg = (u32) res_lo;
++ }
++ else {
++ u16 *destreg, *srcreg;
+ u32 res;
+ s16 imm;
+
+@@ -4518,16 +4787,17 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
+- res = (s16)*srcreg * (s16)imm;
++ DECODE_PRINTF2(",%d\n", (s32) imm);
++ res = (s16) * srcreg * (s16) imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ }
+@@ -4539,18 +4809,20 @@ static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6a
+ ****************************************************************************/
+-static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ s16 imm;
+
+ START_OF_INSTR();
+- imm = (s8)fetch_byte_imm();
++ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2("PUSH\t%d\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- push_long((s32)imm);
+- } else {
+- push_word(imm);
++ push_long((s32) imm);
++ }
++ else {
++ push_word(imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -4560,11 +4832,12 @@ static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6b
+ ****************************************************************************/
+-static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+- s8 imm;
++ s8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+@@ -4574,25 +4847,27 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4602,42 +4877,46 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4647,42 +4926,46 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) srcval, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -4692,57 +4975,62 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- res = (s16)srcval * (s16)imm;
++ res = (s16) srcval *(s16) imm;
++
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
+- u32 res_lo,res_hi;
++ u32 *destreg, *srcreg;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
++ DECODE_PRINTF2(",%d\n", (s32) imm);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
++ imul_long_direct(&res_lo, &res_hi, (s32) * srcreg, (s32) imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
+- u16 *destreg,*srcreg;
++ *destreg = (u32) res_lo;
++ }
++ else {
++ u16 *destreg, *srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_byte_imm();
+- DECODE_PRINTF2(",%d\n", (s32)imm);
+- res = (s16)*srcreg * (s16)imm;
++ DECODE_PRINTF2(",%d\n", (s32) imm);
++ res = (s16) * srcreg * (s16) imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ }
+@@ -4754,7 +5042,8 @@ static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6c
+ ****************************************************************************/
+-static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("INSB\n");
+@@ -4768,13 +5057,15 @@ static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6d
+ ****************************************************************************/
+-static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INSD\n");
+ ins(4);
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INSW\n");
+ ins(2);
+ }
+@@ -4787,7 +5078,8 @@ static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6e
+ ****************************************************************************/
+-static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("OUTSB\n");
+@@ -4801,13 +5093,15 @@ static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x6f
+ ****************************************************************************/
+-static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUTSD\n");
+ outs(4);
+- } else {
++ }
++ else {
+ DECODE_PRINTF("OUTSW\n");
+ outs(2);
+ }
+@@ -4820,7 +5114,8 @@ static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x70
+ ****************************************************************************/
+-static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4828,8 +5123,8 @@ static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JO\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF))
+@@ -4842,7 +5137,8 @@ static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x71
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4850,8 +5146,8 @@ static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if overflow is not set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNO\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_OF))
+@@ -4864,7 +5160,8 @@ static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x72
+ ****************************************************************************/
+-static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4872,8 +5169,8 @@ static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if carry flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JB\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF))
+@@ -4886,7 +5183,8 @@ static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x73
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4894,8 +5192,8 @@ static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if carry flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNB\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_CF))
+@@ -4908,7 +5206,8 @@ static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x74
+ ****************************************************************************/
+-static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4916,8 +5215,8 @@ static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if zero flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JZ\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_ZF))
+@@ -4930,7 +5229,8 @@ static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x75
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4938,8 +5238,8 @@ static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if zero flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNZ\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_ZF))
+@@ -4952,7 +5252,8 @@ static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x76
+ ****************************************************************************/
+-static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4961,8 +5262,8 @@ static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
+ flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JBE\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
+@@ -4975,7 +5276,8 @@ static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x77
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -4984,8 +5286,8 @@ static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
+ flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNBE\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
+@@ -4998,7 +5300,8 @@ static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x78
+ ****************************************************************************/
+-static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5006,8 +5309,8 @@ static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if sign flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JS\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_SF))
+@@ -5020,7 +5323,8 @@ static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x79
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5028,8 +5332,8 @@ static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if sign flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNS\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_SF))
+@@ -5042,7 +5346,8 @@ static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7a
+ ****************************************************************************/
+-static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5050,8 +5355,8 @@ static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if parity flag is set (even parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JP\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_PF))
+@@ -5064,7 +5369,8 @@ static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7b
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5072,8 +5378,8 @@ static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if parity flag is clear (odd parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNP\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_PF))
+@@ -5086,7 +5392,8 @@ static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7c
+ ****************************************************************************/
+-static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5095,8 +5402,8 @@ static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JL\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+@@ -5111,7 +5418,8 @@ static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7d
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5120,8 +5428,8 @@ static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNL\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+@@ -5137,7 +5445,8 @@ static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7e
+ ****************************************************************************/
+-static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5147,8 +5456,8 @@ static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
+ or the zero flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JLE\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+@@ -5163,7 +5472,8 @@ static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x7f
+ ****************************************************************************/
+-static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
+ {
+ s8 offset;
+ u16 target;
+@@ -5173,8 +5483,8 @@ static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
+ and the zero flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNLE\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + (s16)offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + (s16) offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+@@ -5185,23 +5495,23 @@ static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
+ END_OF_INSTR();
+ }
+
+-static u8 (*opc80_byte_operation[])(u8 d, u8 s) =
+-{
+- add_byte, /* 00 */
+- or_byte, /* 01 */
+- adc_byte, /* 02 */
+- sbb_byte, /* 03 */
+- and_byte, /* 04 */
+- sub_byte, /* 05 */
+- xor_byte, /* 06 */
+- cmp_byte, /* 07 */
++static u8(*opc80_byte_operation[]) (u8 d, u8 s) = {
++ add_byte, /* 00 */
++ or_byte, /* 01 */
++ adc_byte, /* 02 */
++ sbb_byte, /* 03 */
++ and_byte, /* 04 */
++ sub_byte, /* 05 */
++ xor_byte, /* 06 */
++ cmp_byte, /* 07 */
+ };
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x80
+ ****************************************************************************/
+-static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -5290,7 +5600,7 @@ static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_byte_imm();
+@@ -5305,35 +5615,34 @@ static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ END_OF_INSTR();
+ }
+
+-static u16 (*opc81_word_operation[])(u16 d, u16 s) =
+-{
+- add_word, /*00 */
+- or_word, /*01 */
+- adc_word, /*02 */
+- sbb_word, /*03 */
+- and_word, /*04 */
+- sub_word, /*05 */
+- xor_word, /*06 */
+- cmp_word, /*07 */
++static u16(*opc81_word_operation[]) (u16 d, u16 s) = {
++ add_word, /*00 */
++ or_word, /*01 */
++ adc_word, /*02 */
++ sbb_word, /*03 */
++ and_word, /*04 */
++ sub_word, /*05 */
++ xor_word, /*06 */
++ cmp_word, /*07 */
+ };
+
+-static u32 (*opc81_long_operation[])(u32 d, u32 s) =
+-{
+- add_long, /*00 */
+- or_long, /*01 */
+- adc_long, /*02 */
+- sbb_long, /*03 */
+- and_long, /*04 */
+- sub_long, /*05 */
+- xor_long, /*06 */
+- cmp_long, /*07 */
++static u32(*opc81_long_operation[]) (u32 d, u32 s) = {
++ add_long, /*00 */
++ or_long, /*01 */
++ adc_long, /*02 */
++ sbb_long, /*03 */
++ and_long, /*04 */
++ sub_long, /*05 */
++ xor_long, /*06 */
++ cmp_long, /*07 */
+ };
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x81
+ ****************************************************************************/
+-static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -5387,7 +5696,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -5399,8 +5708,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -5416,7 +5726,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -5428,8 +5738,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -5445,7 +5756,7 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -5457,8 +5768,9 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -5472,10 +5784,10 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+- u32 destval,imm;
++ u32 destval, imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -5485,9 +5797,10 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc81_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+- u16 destval,imm;
++ u16 destval, imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -5504,23 +5817,23 @@ static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ END_OF_INSTR();
+ }
+
+-static u8 (*opc82_byte_operation[])(u8 s, u8 d) =
+-{
+- add_byte, /*00 */
+- or_byte, /*01 *//*YYY UNUSED ???? */
+- adc_byte, /*02 */
+- sbb_byte, /*03 */
+- and_byte, /*04 *//*YYY UNUSED ???? */
+- sub_byte, /*05 */
+- xor_byte, /*06 *//*YYY UNUSED ???? */
+- cmp_byte, /*07 */
++static u8(*opc82_byte_operation[]) (u8 s, u8 d) = {
++ add_byte, /*00 */
++ or_byte, /*01 *//*YYY UNUSED ???? */
++ adc_byte, /*02 */
++ sbb_byte, /*03 */
++ and_byte, /*04 *//*YYY UNUSED ???? */
++ sub_byte, /*05 */
++ xor_byte, /*06 *//*YYY UNUSED ???? */
++ cmp_byte, /*07 */
+ };
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x82
+ ****************************************************************************/
+-static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -5606,7 +5919,7 @@ static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+@@ -5620,35 +5933,34 @@ static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ END_OF_INSTR();
+ }
+
+-static u16 (*opc83_word_operation[])(u16 s, u16 d) =
+-{
+- add_word, /*00 */
+- or_word, /*01 *//*YYY UNUSED ???? */
+- adc_word, /*02 */
+- sbb_word, /*03 */
+- and_word, /*04 *//*YYY UNUSED ???? */
+- sub_word, /*05 */
+- xor_word, /*06 *//*YYY UNUSED ???? */
+- cmp_word, /*07 */
++static u16(*opc83_word_operation[]) (u16 s, u16 d) = {
++ add_word, /*00 */
++ or_word, /*01 *//*YYY UNUSED ???? */
++ adc_word, /*02 */
++ sbb_word, /*03 */
++ and_word, /*04 *//*YYY UNUSED ???? */
++ sub_word, /*05 */
++ xor_word, /*06 *//*YYY UNUSED ???? */
++ cmp_word, /*07 */
+ };
+
+-static u32 (*opc83_long_operation[])(u32 s, u32 d) =
+-{
+- add_long, /*00 */
+- or_long, /*01 *//*YYY UNUSED ???? */
+- adc_long, /*02 */
+- sbb_long, /*03 */
+- and_long, /*04 *//*YYY UNUSED ???? */
+- sub_long, /*05 */
+- xor_long, /*06 *//*YYY UNUSED ???? */
+- cmp_long, /*07 */
++static u32(*opc83_long_operation[]) (u32 s, u32 d) = {
++ add_long, /*00 */
++ or_long, /*01 *//*YYY UNUSED ???? */
++ adc_long, /*02 */
++ sbb_long, /*03 */
++ and_long, /*04 *//*YYY UNUSED ???? */
++ sub_long, /*05 */
++ xor_long, /*06 *//*YYY UNUSED ???? */
++ cmp_long, /*07 */
+ };
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x83
+ ****************************************************************************/
+-static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -5667,7 +5979,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+- switch (rh) {
++ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+@@ -5700,7 +6012,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -5711,8 +6023,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -5727,7 +6040,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -5738,8 +6051,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -5754,7 +6068,7 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,imm;
++ u32 destval, imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -5765,8 +6079,9 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+- } else {
+- u16 destval,imm;
++ }
++ else {
++ u16 destval, imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -5779,10 +6094,10 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+- u32 destval,imm;
++ u32 destval, imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+@@ -5791,9 +6106,10 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ destval = (*opc83_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+- u16 destval,imm;
++ u16 destval, imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+@@ -5813,7 +6129,8 @@ static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x84
+ ****************************************************************************/
+-static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -5851,7 +6168,7 @@ static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -5868,7 +6185,8 @@ static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x85
+ ****************************************************************************/
+-static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -5889,7 +6207,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -5914,7 +6233,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -5939,7 +6259,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *srcreg;
+
+@@ -5952,9 +6273,9 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ test_word(destval, *srcreg);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -5962,8 +6283,9 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(*destreg, *srcreg);
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -5982,7 +6304,8 @@ static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x86
+ ****************************************************************************/
+-static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -6030,7 +6353,7 @@ static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -6049,7 +6372,8 @@ static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x87
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -6061,7 +6385,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+- u32 destval,tmp;
++ u32 destval, tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+@@ -6073,9 +6397,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+- u16 destval,tmp;
++ u16 destval, tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+@@ -6092,7 +6417,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+- u32 destval,tmp;
++ u32 destval, tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+@@ -6104,9 +6429,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+- u16 destval,tmp;
++ u16 destval, tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+@@ -6123,7 +6449,7 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+- u32 destval,tmp;
++ u32 destval, tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+@@ -6135,9 +6461,10 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+- u16 destval,tmp;
++ u16 destval, tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+@@ -6151,9 +6478,9 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+ u32 tmp;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+@@ -6164,8 +6491,9 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+ u16 tmp;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -6187,7 +6515,8 @@ static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x88
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -6221,7 +6550,7 @@ static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+@@ -6238,7 +6567,8 @@ static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x89
+ ****************************************************************************/
+-static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u32 destoffset;
+@@ -6257,7 +6587,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+@@ -6278,7 +6609,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+@@ -6299,7 +6631,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+- } else {
++ }
++ else {
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+@@ -6310,9 +6643,9 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
++ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -6320,8 +6653,9 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+- } else {
+- u16 *destreg,*srcreg;
++ }
++ else {
++ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -6340,7 +6674,8 @@ static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8a
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+@@ -6378,7 +6713,7 @@ static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+@@ -6395,7 +6730,8 @@ static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8b
+ ****************************************************************************/
+-static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -6416,7 +6752,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -6441,7 +6778,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -6466,7 +6804,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -6479,7 +6818,7 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = srcval;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+@@ -6489,7 +6828,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+- } else {
++ }
++ else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+@@ -6509,7 +6849,8 @@ static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8c
+ ****************************************************************************/
+-static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+@@ -6547,7 +6888,7 @@ static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+@@ -6564,47 +6905,77 @@ static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8d
+ ****************************************************************************/
+-static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+- u16 *srcreg;
+ uint destoffset;
+
+-/*
+- * TODO: Need to handle address size prefix!
+- *
+- * lea eax,[eax+ebx*2] ??
+- */
+-
+ START_OF_INSTR();
+ DECODE_PRINTF("LEA\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+- srcreg = DECODE_RM_WORD_REGISTER(rh);
+- DECODE_PRINTF(",");
+- destoffset = decode_rm00_address(rl);
+- DECODE_PRINTF("\n");
+- TRACE_AND_STEP();
+- *srcreg = (u16)destoffset;
++ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
++ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm00_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u32) destoffset;
++ }
++ else {
++ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm00_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u16) destoffset;
++ }
+ break;
+ case 1:
+- srcreg = DECODE_RM_WORD_REGISTER(rh);
+- DECODE_PRINTF(",");
+- destoffset = decode_rm01_address(rl);
+- DECODE_PRINTF("\n");
+- TRACE_AND_STEP();
+- *srcreg = (u16)destoffset;
++ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
++ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm01_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u32) destoffset;
++ }
++ else {
++ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm01_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u16) destoffset;
++ }
+ break;
+ case 2:
+- srcreg = DECODE_RM_WORD_REGISTER(rh);
+- DECODE_PRINTF(",");
+- destoffset = decode_rm10_address(rl);
+- DECODE_PRINTF("\n");
+- TRACE_AND_STEP();
+- *srcreg = (u16)destoffset;
++ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
++ u32 *srcreg = DECODE_RM_LONG_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm10_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u32) destoffset;
++ }
++ else {
++ u16 *srcreg = DECODE_RM_WORD_REGISTER(rh);
++
++ DECODE_PRINTF(",");
++ destoffset = decode_rm10_address(rl);
++ DECODE_PRINTF("\n");
++ TRACE_AND_STEP();
++ *srcreg = (u16) destoffset;
++ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* undefined. Do nothing. */
+ break;
+ }
+@@ -6616,7 +6987,8 @@ static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8e
+ ****************************************************************************/
+-static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+@@ -6654,7 +7026,7 @@ static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -6677,7 +7049,8 @@ static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x8f
+ ****************************************************************************/
+-static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -6699,7 +7072,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destoffset = decode_rm00_address(rl);
+@@ -6718,7 +7092,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destoffset = decode_rm01_address(rl);
+@@ -6737,7 +7112,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destoffset = decode_rm10_address(rl);
+@@ -6747,7 +7123,7 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+@@ -6755,7 +7131,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_long();
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -6773,7 +7150,8 @@ static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x90
+ ****************************************************************************/
+-static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_nop(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("NOP\n");
+@@ -6786,14 +7164,16 @@ static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x91
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ECX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,CX\n");
+ }
+ TRACE_AND_STEP();
+@@ -6801,10 +7181,11 @@ static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ECX;
+ M.x86.R_ECX = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_CX;
+- M.x86.R_CX = (u16)tmp;
++ M.x86.R_CX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6814,14 +7195,16 @@ static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x92
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+@@ -6829,10 +7212,11 @@ static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDX;
+ M.x86.R_EDX = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DX;
+- M.x86.R_DX = (u16)tmp;
++ M.x86.R_DX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6842,14 +7226,16 @@ static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x93
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,BX\n");
+ }
+ TRACE_AND_STEP();
+@@ -6857,10 +7243,11 @@ static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBX;
+ M.x86.R_EBX = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BX;
+- M.x86.R_BX = (u16)tmp;
++ M.x86.R_BX = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6870,14 +7257,16 @@ static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x94
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,SP\n");
+ }
+ TRACE_AND_STEP();
+@@ -6885,10 +7274,11 @@ static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESP;
+ M.x86.R_ESP = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SP;
+- M.x86.R_SP = (u16)tmp;
++ M.x86.R_SP = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6898,14 +7288,16 @@ static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x95
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBP\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,BP\n");
+ }
+ TRACE_AND_STEP();
+@@ -6913,10 +7305,11 @@ static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBP;
+ M.x86.R_EBP = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BP;
+- M.x86.R_BP = (u16)tmp;
++ M.x86.R_BP = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6926,14 +7319,16 @@ static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x96
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,SI\n");
+ }
+ TRACE_AND_STEP();
+@@ -6941,10 +7336,11 @@ static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESI;
+ M.x86.R_ESI = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SI;
+- M.x86.R_SI = (u16)tmp;
++ M.x86.R_SI = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6954,14 +7350,16 @@ static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x97
+ ****************************************************************************/
+-static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
+ {
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDI\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("XCHG\tAX,DI\n");
+ }
+ TRACE_AND_STEP();
+@@ -6969,10 +7367,11 @@ static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDI;
+ M.x86.R_EDI = tmp;
+- } else {
++ }
++ else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DI;
+- M.x86.R_DI = (u16)tmp;
++ M.x86.R_DI = (u16) tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -6982,25 +7381,30 @@ static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x98
+ ****************************************************************************/
+-static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CWDE\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("CBW\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_EAX |= 0xffff0000;
+- } else {
++ }
++ else {
+ M.x86.R_EAX &= 0x0000ffff;
+ }
+- } else {
++ }
++ else {
+ if (M.x86.R_AL & 0x80) {
+ M.x86.R_AH = 0xff;
+- } else {
++ }
++ else {
+ M.x86.R_AH = 0x0;
+ }
+ }
+@@ -7012,12 +7416,14 @@ static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x99
+ ****************************************************************************/
+-static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CDQ\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("CWD\n");
+ }
+ DECODE_PRINTF("CWD\n");
+@@ -7025,13 +7431,16 @@ static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_EAX & 0x80000000) {
+ M.x86.R_EDX = 0xffffffff;
+- } else {
++ }
++ else {
+ M.x86.R_EDX = 0x0;
+ }
+- } else {
++ }
++ else {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_DX = 0xffff;
+- } else {
++ }
++ else {
+ M.x86.R_DX = 0x0;
+ }
+ }
+@@ -7043,17 +7452,24 @@ static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9a
+ ****************************************************************************/
+-static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+ {
+- u16 farseg, faroff;
++ u32 farseg, faroff;
+
+ START_OF_INSTR();
+- DECODE_PRINTF("CALL\t");
+- faroff = fetch_word_imm();
+- farseg = fetch_word_imm();
+- DECODE_PRINTF2("%04x:", farseg);
+- DECODE_PRINTF2("%04x\n", faroff);
+- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
++ DECODE_PRINTF("CALL\t");
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ faroff = fetch_long_imm();
++ farseg = fetch_word_imm();
++ }
++ else {
++ faroff = fetch_word_imm();
++ farseg = fetch_word_imm();
++ }
++ DECODE_PRINTF2("%04x:", farseg);
++ DECODE_PRINTF2("%04x\n", faroff);
++ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
+
+ /* XXX
+ *
+@@ -7064,8 +7480,13 @@ static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = farseg;
+- push_word(M.x86.R_IP);
+- M.x86.R_IP = faroff;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ push_long(M.x86.R_EIP);
++ }
++ else {
++ push_word(M.x86.R_IP);
++ }
++ M.x86.R_EIP = faroff & 0xffff;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -7074,7 +7495,8 @@ static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9b
+ ****************************************************************************/
+-static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_wait(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("WAIT");
+@@ -7088,14 +7510,16 @@ static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9c
+ ****************************************************************************/
+-static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+ {
+ u32 flags;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHFD\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("PUSHF\n");
+ }
+ TRACE_AND_STEP();
+@@ -7104,8 +7528,9 @@ static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+ flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(flags);
+- } else {
+- push_word((u16)flags);
++ }
++ else {
++ push_word((u16) flags);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -7115,18 +7540,21 @@ static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9d
+ ****************************************************************************/
+-static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPFD\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("POPF\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EFLG = pop_long();
+- } else {
++ }
++ else {
+ M.x86.R_FLG = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -7137,7 +7565,8 @@ static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9e
+ ****************************************************************************/
+-static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("SAHF\n");
+@@ -7154,12 +7583,13 @@ static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0x9f
+ ****************************************************************************/
+-static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("LAHF\n");
+ TRACE_AND_STEP();
+- M.x86.R_AH = (u8)(M.x86.R_FLG & 0xff);
++ M.x86.R_AH = (u8) (M.x86.R_FLG & 0xff);
+ /*undocumented TC++ behavior??? Nope. It's documented, but
+ you have too look real hard to notice it. */
+ M.x86.R_AH |= 0x2;
+@@ -7171,7 +7601,8 @@ static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa0
+ ****************************************************************************/
+-static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 offset;
+
+@@ -7189,7 +7620,8 @@ static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa1
+ ****************************************************************************/
+-static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 offset;
+
+@@ -7197,13 +7629,15 @@ static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
+- } else {
++ }
++ else {
+ DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(offset);
+- } else {
++ }
++ else {
+ M.x86.R_AX = fetch_data_word(offset);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -7214,7 +7648,8 @@ static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa2
+ ****************************************************************************/
+-static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 offset;
+
+@@ -7232,7 +7667,8 @@ static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa3
+ ****************************************************************************/
+-static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 offset;
+
+@@ -7240,13 +7676,15 @@ static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
+- } else {
++ }
++ else {
+ DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long(offset, M.x86.R_EAX);
+- } else {
++ }
++ else {
+ store_data_word(offset, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -7257,15 +7695,16 @@ static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa4
+ ****************************************************************************/
+-static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
+ {
+- u8 val;
++ u8 val;
+ u32 count;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVS\tBYTE\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+@@ -7292,7 +7731,8 @@ static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa5
+ ****************************************************************************/
+-static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+ {
+ u32 val;
+ int inc;
+@@ -7301,13 +7741,14 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOVS\tDWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOVS\tWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+@@ -7325,9 +7766,10 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long(M.x86.R_SI);
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
+- } else {
++ }
++ else {
+ val = fetch_data_word(M.x86.R_SI);
+- store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
++ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16) val);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+@@ -7340,7 +7782,8 @@ static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa6
+ ****************************************************************************/
+-static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ {
+ s8 val1, val2;
+ int inc;
+@@ -7348,7 +7791,7 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ DECODE_PRINTF("CMPS\tBYTE\n");
+ TRACE_AND_STEP();
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+@@ -7359,7 +7802,7 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_byte(val1, val2);
++ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+@@ -7367,7 +7810,8 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
++ }
++ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+@@ -7381,7 +7825,8 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+- } else {
++ }
++ else {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+@@ -7396,21 +7841,23 @@ static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa7
+ ****************************************************************************/
+-static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ {
+- u32 val1,val2;
++ u32 val1, val2;
+ int inc;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMPS\tDWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+- } else {
++ }
++ else {
+ DECODE_PRINTF("CMPS\tWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+@@ -7424,10 +7871,11 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+- } else {
++ }
++ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word((u16)val1, (u16)val2);
++ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+@@ -7436,7 +7884,8 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
++ }
++ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+@@ -7444,10 +7893,11 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+- } else {
++ }
++ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word((u16)val1, (u16)val2);
++ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+@@ -7456,15 +7906,17 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+- } else {
++ }
++ else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+- } else {
++ }
++ else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word((u16)val1, (u16)val2);
++ cmp_word((u16) val1, (u16) val2);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+@@ -7477,7 +7929,8 @@ static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa8
+ ****************************************************************************/
+-static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int imm;
+
+@@ -7486,7 +7939,7 @@ static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%04x\n", imm);
+ TRACE_AND_STEP();
+- test_byte(M.x86.R_AL, (u8)imm);
++ test_byte(M.x86.R_AL, (u8) imm);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -7495,7 +7948,8 @@ static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xa9
+ ****************************************************************************/
+-static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -7503,7 +7957,8 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("TEST\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("TEST\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -7511,8 +7966,9 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ test_long(M.x86.R_EAX, srcval);
+- } else {
+- test_word(M.x86.R_AX, (u16)srcval);
++ }
++ else {
++ test_word(M.x86.R_AX, (u16) srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -7522,13 +7978,14 @@ static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xaa
+ ****************************************************************************/
+-static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+ {
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("STOS\tBYTE\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+@@ -7542,7 +7999,8 @@ static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+ M.x86.R_DI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+- } else {
++ }
++ else {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_DI += inc;
+ }
+@@ -7554,7 +8012,8 @@ static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xab
+ ****************************************************************************/
+-static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+ {
+ int inc;
+ u32 count;
+@@ -7562,13 +8021,14 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("STOS\tDWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+- } else {
++ }
++ else {
+ DECODE_PRINTF("STOS\tWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+@@ -7585,7 +8045,8 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
+- } else {
++ }
++ else {
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
+ }
+ M.x86.R_DI += inc;
+@@ -7598,14 +8059,15 @@ static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xac
+ ****************************************************************************/
+-static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+ {
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LODS\tBYTE\n");
+ TRACE_AND_STEP();
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+@@ -7618,7 +8080,8 @@ static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+ M.x86.R_SI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+- } else {
++ }
++ else {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_SI += inc;
+ }
+@@ -7630,7 +8093,8 @@ static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xad
+ ****************************************************************************/
+-static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+ {
+ int inc;
+ u32 count;
+@@ -7638,13 +8102,14 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("LODS\tDWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+- } else {
++ }
++ else {
+ DECODE_PRINTF("LODS\tWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+@@ -7661,7 +8126,8 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
+- } else {
++ }
++ else {
+ M.x86.R_AX = fetch_data_word(M.x86.R_SI);
+ }
+ M.x86.R_SI += inc;
+@@ -7674,7 +8140,8 @@ static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xae
+ ****************************************************************************/
+-static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+ {
+ s8 val2;
+ int inc;
+@@ -7682,7 +8149,7 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ DECODE_PRINTF("SCAS\tBYTE\n");
+ TRACE_AND_STEP();
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+@@ -7698,7 +8165,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
++ }
++ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+@@ -7710,7 +8178,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+- } else {
++ }
++ else {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_DI += inc;
+@@ -7723,7 +8192,8 @@ static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xaf
+ ****************************************************************************/
+-static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ {
+ int inc;
+ u32 val;
+@@ -7731,13 +8201,14 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SCAS\tDWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+- } else {
++ }
++ else {
+ DECODE_PRINTF("SCAS\tWORD\n");
+- if (ACCESS_FLAG(F_DF)) /* down */
++ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+@@ -7750,9 +8221,10 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+- } else {
++ }
++ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word(M.x86.R_AX, (u16)val);
++ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+@@ -7760,16 +8232,18 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+- } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
++ }
++ else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+- } else {
++ }
++ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word(M.x86.R_AX, (u16)val);
++ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+@@ -7777,13 +8251,15 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+- } else {
++ }
++ else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+- } else {
++ }
++ else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+- cmp_word(M.x86.R_AX, (u16)val);
++ cmp_word(M.x86.R_AX, (u16) val);
+ }
+ M.x86.R_DI += inc;
+ }
+@@ -7795,7 +8271,8 @@ static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb0
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7813,7 +8290,8 @@ static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb1
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7831,7 +8309,8 @@ static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb2
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7849,7 +8328,8 @@ static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb3
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7867,7 +8347,8 @@ static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb4
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7885,7 +8366,8 @@ static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb5
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7903,7 +8385,8 @@ static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb6
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7921,7 +8404,8 @@ static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb7
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 imm;
+
+@@ -7939,7 +8423,8 @@ static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb8
+ ****************************************************************************/
+-static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -7947,7 +8432,8 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEAX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tAX,");
+ srcval = fetch_word_imm();
+ }
+@@ -7955,8 +8441,9 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = srcval;
+- } else {
+- M.x86.R_AX = (u16)srcval;
++ }
++ else {
++ M.x86.R_AX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -7966,7 +8453,8 @@ static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xb9
+ ****************************************************************************/
+-static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -7974,7 +8462,8 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tECX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tCX,");
+ srcval = fetch_word_imm();
+ }
+@@ -7982,8 +8471,9 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = srcval;
+- } else {
+- M.x86.R_CX = (u16)srcval;
++ }
++ else {
++ M.x86.R_CX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -7993,7 +8483,8 @@ static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xba
+ ****************************************************************************/
+-static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8001,7 +8492,8 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tDX,");
+ srcval = fetch_word_imm();
+ }
+@@ -8009,8 +8501,9 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = srcval;
+- } else {
+- M.x86.R_DX = (u16)srcval;
++ }
++ else {
++ M.x86.R_DX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8020,7 +8513,8 @@ static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xbb
+ ****************************************************************************/
+-static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8028,7 +8522,8 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBX,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tBX,");
+ srcval = fetch_word_imm();
+ }
+@@ -8036,8 +8531,9 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = srcval;
+- } else {
+- M.x86.R_BX = (u16)srcval;
++ }
++ else {
++ M.x86.R_BX = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8047,7 +8543,8 @@ static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xbc
+ ****************************************************************************/
+-static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8055,7 +8552,8 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESP,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tSP,");
+ srcval = fetch_word_imm();
+ }
+@@ -8063,8 +8561,9 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = srcval;
+- } else {
+- M.x86.R_SP = (u16)srcval;
++ }
++ else {
++ M.x86.R_SP = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8074,7 +8573,8 @@ static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xbd
+ ****************************************************************************/
+-static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8082,7 +8582,8 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBP,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tBP,");
+ srcval = fetch_word_imm();
+ }
+@@ -8090,8 +8591,9 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = srcval;
+- } else {
+- M.x86.R_BP = (u16)srcval;
++ }
++ else {
++ M.x86.R_BP = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8101,7 +8603,8 @@ static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xbe
+ ****************************************************************************/
+-static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8109,7 +8612,8 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESI,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tSI,");
+ srcval = fetch_word_imm();
+ }
+@@ -8117,8 +8621,9 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = srcval;
+- } else {
+- M.x86.R_SI = (u16)srcval;
++ }
++ else {
++ M.x86.R_SI = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8128,7 +8633,8 @@ static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xbf
+ ****************************************************************************/
+-static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u32 srcval;
+
+@@ -8136,7 +8642,8 @@ static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDI,");
+ srcval = fetch_long_imm();
+- } else {
++ }
++ else {
+ DECODE_PRINTF("MOV\tDI,");
+ srcval = fetch_word_imm();
+ }
+@@ -8144,31 +8651,25 @@ static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = srcval;
+- } else {
+- M.x86.R_DI = (u16)srcval;
++ }
++ else {
++ M.x86.R_DI = (u16) srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+
+ /* used by opcodes c0, d0, and d2. */
+-static u8(*opcD0_byte_operation[])(u8 d, u8 s) =
+-{
+- rol_byte,
+- ror_byte,
+- rcl_byte,
+- rcr_byte,
+- shl_byte,
+- shr_byte,
+- shl_byte, /* sal_byte === shl_byte by definition */
+- sar_byte,
+-};
++static u8(*opcD0_byte_operation[]) (u8 d, u8 s) = {
++ rol_byte, ror_byte, rcl_byte, rcr_byte, shl_byte, shr_byte, shl_byte, /* sal_byte === shl_byte by definition */
++sar_byte,};
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0xc0
+ ****************************************************************************/
+-static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -8251,7 +8752,7 @@ static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+@@ -8265,36 +8766,21 @@ static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+ }
+
+ /* used by opcodes c1, d1, and d3. */
+-static u16(*opcD1_word_operation[])(u16 s, u8 d) =
+-{
+- rol_word,
+- ror_word,
+- rcl_word,
+- rcr_word,
+- shl_word,
+- shr_word,
+- shl_word, /* sal_byte === shl_byte by definition */
+- sar_word,
+-};
++static u16(*opcD1_word_operation[]) (u16 s, u8 d) = {
++ rol_word, ror_word, rcl_word, rcr_word, shl_word, shr_word, shl_word, /* sal_byte === shl_byte by definition */
++sar_word,};
+
+ /* used by opcodes c1, d1, and d3. */
+-static u32 (*opcD1_long_operation[])(u32 s, u8 d) =
+-{
+- rol_long,
+- ror_long,
+- rcl_long,
+- rcr_long,
+- shl_long,
+- shr_long,
+- shl_long, /* sal_byte === shl_byte by definition */
+- sar_long,
+-};
++static u32(*opcD1_long_operation[]) (u32 s, u8 d) = {
++ rol_long, ror_long, rcl_long, rcr_long, shl_long, shr_long, shl_long, /* sal_byte === shl_byte by definition */
++sar_long,};
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0xc1
+ ****************************************************************************/
+-static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -8357,7 +8843,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8382,7 +8869,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8407,7 +8895,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8420,7 +8909,7 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+@@ -8429,7 +8918,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -8448,7 +8938,8 @@ static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc2
+ ****************************************************************************/
+-static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 imm;
+
+@@ -8456,8 +8947,8 @@ static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("RET\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
+- TRACE_AND_STEP();
++ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
++ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_SP += imm;
+ DECODE_CLEAR_SEGOVR();
+@@ -8468,12 +8959,13 @@ static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc3
+ ****************************************************************************/
+-static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("RET\n");
+- RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
+- TRACE_AND_STEP();
++ RETURN_TRACE("RET", M.x86.saved_cs, M.x86.saved_ip);
++ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -8483,7 +8975,8 @@ static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc4
+ ****************************************************************************/
+-static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rh, rl;
+ u16 *dstreg;
+@@ -8520,7 +9013,7 @@ static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+@@ -8532,7 +9025,8 @@ static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc5
+ ****************************************************************************/
+-static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rh, rl;
+ u16 *dstreg;
+@@ -8569,7 +9063,7 @@ static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+@@ -8581,7 +9075,8 @@ static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc6
+ ****************************************************************************/
+-static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -8620,7 +9115,7 @@ static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+@@ -8636,7 +9131,8 @@ static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc7
+ ****************************************************************************/
+-static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -8659,7 +9155,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+- } else {
++ }
++ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8680,7 +9177,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+- } else {
++ }
++ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8701,7 +9199,8 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+- } else {
++ }
++ else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -8712,19 +9211,20 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, imm);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg;
+- u32 imm;
++ u32 *destreg;
++ u32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+- } else {
+- u16 *destreg;
+- u16 imm;
++ }
++ else {
++ u16 *destreg;
++ u16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+@@ -8742,10 +9242,11 @@ static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc8
+ ****************************************************************************/
+-static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+ {
+- u16 local,frame_pointer;
+- u8 nesting;
++ u16 local, frame_pointer;
++ u8 nesting;
+ int i;
+
+ START_OF_INSTR();
+@@ -8760,11 +9261,11 @@ static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+ for (i = 1; i < nesting; i++) {
+ M.x86.R_BP -= 2;
+ push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
+- }
+- push_word(frame_pointer);
+ }
++ push_word(frame_pointer);
++ }
+ M.x86.R_BP = frame_pointer;
+- M.x86.R_SP = (u16)(M.x86.R_SP - local);
++ M.x86.R_SP = (u16) (M.x86.R_SP - local);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -8773,7 +9274,8 @@ static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xc9
+ ****************************************************************************/
+-static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_leave(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("LEAVE\n");
+@@ -8788,7 +9290,8 @@ static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xca
+ ****************************************************************************/
+-static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 imm;
+
+@@ -8796,8 +9299,8 @@ static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("RETF\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
+- TRACE_AND_STEP();
++ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
++ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ M.x86.R_SP += imm;
+@@ -8809,12 +9312,13 @@ static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xcb
+ ****************************************************************************/
+-static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("RETF\n");
+- RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
+- TRACE_AND_STEP();
++ RETURN_TRACE("RETF", M.x86.saved_cs, M.x86.saved_ip);
++ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+@@ -8825,15 +9329,17 @@ static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xcc
+ ****************************************************************************/
+-static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_int3(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("INT 3\n");
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[3]) {
+- (*_X86EMU_intrTab[3])(3);
+- } else {
+- push_word((u16)M.x86.R_FLG);
++ (*_X86EMU_intrTab[3]) (3);
++ }
++ else {
++ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+@@ -8849,7 +9355,8 @@ static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xcd
+ ****************************************************************************/
+-static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 intnum;
+
+@@ -8859,9 +9366,10 @@ static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2("%x\n", intnum);
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[intnum]) {
+- (*_X86EMU_intrTab[intnum])(intnum);
+- } else {
+- push_word((u16)M.x86.R_FLG);
++ (*_X86EMU_intrTab[intnum]) (intnum);
++ }
++ else {
++ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+@@ -8877,16 +9385,18 @@ static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xce
+ ****************************************************************************/
+-static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_into(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("INTO\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF)) {
+- if (_X86EMU_intrTab[4]) {
+- (*_X86EMU_intrTab[4])(4);
+- } else {
+- push_word((u16)M.x86.R_FLG);
++ if (_X86EMU_intrTab[4]) {
++ (*_X86EMU_intrTab[4]) (4);
++ }
++ else {
++ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+@@ -8903,7 +9413,8 @@ static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xcf
+ ****************************************************************************/
+-static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_iret(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("IRET\n");
+@@ -8921,7 +9432,8 @@ static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd0
+ ****************************************************************************/
+-static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -8999,7 +9511,7 @@ static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+@@ -9015,7 +9527,8 @@ static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd1
+ ****************************************************************************/
+-static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -9075,7 +9588,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -9098,7 +9612,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -9121,7 +9636,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("BYTE PTR ");
+@@ -9133,19 +9649,20 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval;
+- u32 *destreg;
++ u32 destval;
++ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+- } else {
+- u16 destval;
+- u16 *destreg;
++ }
++ else {
++ u16 destval;
++ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+@@ -9163,7 +9680,8 @@ static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd2
+ ****************************************************************************/
+-static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -9243,7 +9761,7 @@ static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+@@ -9259,7 +9777,8 @@ static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd3
+ ****************************************************************************/
+-static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -9321,7 +9840,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -9344,7 +9864,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -9367,7 +9888,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+@@ -9379,7 +9901,7 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+@@ -9387,7 +9909,8 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -9405,16 +9928,17 @@ static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd4
+ ****************************************************************************/
+-static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_aam(u8 X86EMU_UNUSED(op1))
+ {
+ u8 a;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AAM\n");
+- a = fetch_byte_imm(); /* this is a stupid encoding. */
++ a = fetch_byte_imm(); /* this is a stupid encoding. */
+ if (a != 10) {
+- /* fix: add base decoding
+- aam_word(u8 val, int base a) */
++ /* fix: add base decoding
++ aam_word(u8 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+@@ -9430,7 +9954,8 @@ static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd5
+ ****************************************************************************/
+-static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+ {
+ u8 a;
+
+@@ -9438,8 +9963,8 @@ static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("AAD\n");
+ a = fetch_byte_imm();
+ if (a != 10) {
+- /* fix: add base decoding
+- aad_word(u16 val, int base a) */
++ /* fix: add base decoding
++ aad_word(u16 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+@@ -9456,14 +9981,15 @@ static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xd7
+ ****************************************************************************/
+-static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
+ {
+ u16 addr;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XLAT\n");
+ TRACE_AND_STEP();
+- addr = (u16)(M.x86.R_BX + (u8)M.x86.R_AL);
++ addr = (u16) (M.x86.R_BX + (u8) M.x86.R_AL);
+ M.x86.R_AL = fetch_data_byte(addr);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9475,7 +10001,8 @@ static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe0
+ ****************************************************************************/
+-static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+ {
+ s16 ip;
+
+@@ -9486,7 +10013,7 @@ static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+- if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
++ if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9496,7 +10023,8 @@ static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe1
+ ****************************************************************************/
+-static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+ {
+ s16 ip;
+
+@@ -9507,7 +10035,7 @@ static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+- if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
++ if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9517,7 +10045,8 @@ static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe2
+ ****************************************************************************/
+-static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_loop(u8 X86EMU_UNUSED(op1))
+ {
+ s16 ip;
+
+@@ -9538,16 +10067,17 @@ static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe3
+ ****************************************************************************/
+-static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
+ {
+ u16 target;
+- s8 offset;
++ s8 offset;
+
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JCXZ\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (M.x86.R_CX == 0)
+@@ -9560,16 +10090,17 @@ static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe4
+ ****************************************************************************/
+-static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+- port = (u8) fetch_byte_imm();
++ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+- M.x86.R_AL = (*sys_inb)(port);
++ M.x86.R_AL = (*sys_inb) (port);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9578,23 +10109,26 @@ static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe5
+ ****************************************************************************/
+-static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+- port = (u8) fetch_byte_imm();
++ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("EAX,%x\n", port);
+- } else {
++ }
++ else {
+ DECODE_PRINTF2("AX,%x\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- M.x86.R_EAX = (*sys_inl)(port);
+- } else {
+- M.x86.R_AX = (*sys_inw)(port);
++ M.x86.R_EAX = (*sys_inl) (port);
++ }
++ else {
++ M.x86.R_AX = (*sys_inw) (port);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9604,16 +10138,17 @@ static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe6
+ ****************************************************************************/
+-static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
+ {
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+- port = (u8) fetch_byte_imm();
++ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+- (*sys_outb)(port, M.x86.R_AL);
++ (*sys_outb) (port, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9622,23 +10157,26 @@ static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe7
+ ****************************************************************************/
+-static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
+ {
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+- port = (u8) fetch_byte_imm();
++ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("%x,EAX\n", port);
+- } else {
++ }
++ else {
+ DECODE_PRINTF2("%x,AX\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- (*sys_outl)(port, M.x86.R_EAX);
+- } else {
+- (*sys_outw)(port, M.x86.R_AX);
++ (*sys_outl) (port, M.x86.R_EAX);
++ }
++ else {
++ (*sys_outw) (port, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9648,19 +10186,35 @@ static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe8
+ ****************************************************************************/
+-static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
+ {
+- s16 ip;
++ s16 ip16;
++ s32 ip32;
+
+ START_OF_INSTR();
+- DECODE_PRINTF("CALL\t");
+- ip = (s16) fetch_word_imm();
+- ip += (s16) M.x86.R_IP; /* CHECK SIGN */
+- DECODE_PRINTF2("%04x\n", (u16)ip);
+- CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip, "");
++ DECODE_PRINTF("CALL\t");
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ ip32 = (s32) fetch_long_imm();
++ ip32 += (s16) M.x86.R_IP; /* CHECK SIGN */
++ DECODE_PRINTF2("%04x\n", (u16) ip32);
++ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip32, "");
++ }
++ else {
++ ip16 = (s16) fetch_word_imm();
++ ip16 += (s16) M.x86.R_IP; /* CHECK SIGN */
++ DECODE_PRINTF2("%04x\n", (u16) ip16);
++ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip16, "");
++ }
+ TRACE_AND_STEP();
+- push_word(M.x86.R_IP);
+- M.x86.R_IP = ip;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ push_long(M.x86.R_EIP);
++ M.x86.R_EIP = ip32 & 0xffff;
++ }
++ else {
++ push_word(M.x86.R_IP);
++ M.x86.R_EIP = ip16;
++ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9669,17 +10223,27 @@ static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xe9
+ ****************************************************************************/
+-static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
+ {
+- int ip;
++ u32 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+- ip = (s16)fetch_word_imm();
+- ip += (s16)M.x86.R_IP;
+- DECODE_PRINTF2("%04x\n", (u16)ip);
+- TRACE_AND_STEP();
+- M.x86.R_IP = (u16)ip;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ ip = (u32) fetch_long_imm();
++ ip += (u32) M.x86.R_EIP;
++ DECODE_PRINTF2("%08x\n", (u32) ip);
++ TRACE_AND_STEP();
++ M.x86.R_EIP = (u32) ip;
++ }
++ else {
++ ip = (s16) fetch_word_imm();
++ ip += (s16) M.x86.R_IP;
++ DECODE_PRINTF2("%04x\n", (u16) ip);
++ TRACE_AND_STEP();
++ M.x86.R_IP = (u16) ip;
++ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9688,18 +10252,25 @@ static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xea
+ ****************************************************************************/
+-static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
+ {
+- u16 cs, ip;
++ u16 cs;
++ u32 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\tFAR ");
+- ip = fetch_word_imm();
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ ip = fetch_long_imm();
++ }
++ else {
++ ip = fetch_word_imm();
++ }
+ cs = fetch_word_imm();
+ DECODE_PRINTF2("%04x:", cs);
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+- M.x86.R_IP = ip;
++ M.x86.R_EIP = ip & 0xffff;
+ M.x86.R_CS = cs;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9709,15 +10280,16 @@ static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xeb
+ ****************************************************************************/
+-static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
+ {
+ u16 target;
+ s8 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+- offset = (s8)fetch_byte_imm();
+- target = (u16)(M.x86.R_IP + offset);
++ offset = (s8) fetch_byte_imm();
++ target = (u16) (M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ M.x86.R_IP = target;
+@@ -9729,12 +10301,13 @@ static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xec
+ ****************************************************************************/
+-static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\tAL,DX\n");
+ TRACE_AND_STEP();
+- M.x86.R_AL = (*sys_inb)(M.x86.R_DX);
++ M.x86.R_AL = (*sys_inb) (M.x86.R_DX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9743,19 +10316,22 @@ static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xed
+ ****************************************************************************/
+-static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("IN\tEAX,DX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("IN\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
+- } else {
+- M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
++ M.x86.R_EAX = (*sys_inl) (M.x86.R_DX);
++ }
++ else {
++ M.x86.R_AX = (*sys_inw) (M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9765,12 +10341,13 @@ static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xee
+ ****************************************************************************/
+-static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\tDX,AL\n");
+ TRACE_AND_STEP();
+- (*sys_outb)(M.x86.R_DX, M.x86.R_AL);
++ (*sys_outb) (M.x86.R_DX, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -9779,19 +10356,22 @@ static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xef
+ ****************************************************************************/
+-static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUT\tDX,EAX\n");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("OUT\tDX,AX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
+- } else {
+- (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
++ (*sys_outl) (M.x86.R_DX, M.x86.R_EAX);
++ }
++ else {
++ (*sys_outw) (M.x86.R_DX, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -9801,7 +10381,8 @@ static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf0
+ ****************************************************************************/
+-static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_lock(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("LOCK:\n");
+@@ -9816,7 +10397,8 @@ static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf2
+ ****************************************************************************/
+-static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_repne(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("REPNE\n");
+@@ -9830,7 +10412,8 @@ static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf3
+ ****************************************************************************/
+-static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_repe(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("REPE\n");
+@@ -9844,7 +10427,8 @@ static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf4
+ ****************************************************************************/
+-static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_halt(u8 X86EMU_UNUSED(op1))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("HALT\n");
+@@ -9858,7 +10442,8 @@ static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf5
+ ****************************************************************************/
+-static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
+ {
+ /* complement the carry flag. */
+ START_OF_INSTR();
+@@ -9873,7 +10458,8 @@ static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf6
+ ****************************************************************************/
+-static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ u8 *destreg;
+@@ -9885,9 +10471,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+- case 0: /* mod=00 */
++ case 0: /* mod=00 */
+ switch (rh) {
+- case 0: /* test byte imm */
++ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+@@ -9953,9 +10539,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==00 */
+- case 1: /* mod=01 */
++ case 1: /* mod=01 */
+ switch (rh) {
+- case 0: /* test byte imm */
++ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+@@ -10021,9 +10607,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==01 */
+- case 2: /* mod=10 */
++ case 2: /* mod=10 */
+ switch (rh) {
+- case 0: /* test byte imm */
++ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+@@ -10089,9 +10675,9 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==10 */
+- case 3: /* mod=11 */
++ case 3: /* mod=11 */
+ switch (rh) {
+- case 0: /* test byte imm */
++ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -10123,7 +10709,7 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- mul_byte(*destreg); /*!!! */
++ mul_byte(*destreg); /*!!! */
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\t");
+@@ -10157,7 +10743,8 @@ static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf7
+ ****************************************************************************/
+-static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -10167,11 +10754,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+- case 0: /* mod=00 */
++ case 0: /* mod=00 */
+ switch (rh) {
+- case 0: /* test word imm */
++ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,srcval;
++ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -10181,8 +10768,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+- } else {
+- u16 destval,srcval;
++ }
++ else {
++ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+@@ -10209,7 +10797,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+@@ -10232,7 +10821,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+@@ -10254,7 +10844,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+@@ -10275,7 +10866,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+@@ -10296,7 +10888,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+@@ -10317,7 +10910,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+@@ -10330,11 +10924,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==00 */
+- case 1: /* mod=01 */
++ case 1: /* mod=01 */
+ switch (rh) {
+- case 0: /* test word imm */
++ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,srcval;
++ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -10344,8 +10938,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+- } else {
+- u16 destval,srcval;
++ }
++ else {
++ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+@@ -10372,7 +10967,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+@@ -10395,7 +10991,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+@@ -10417,7 +11014,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+@@ -10438,7 +11036,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+@@ -10459,7 +11058,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+@@ -10480,7 +11080,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+@@ -10493,11 +11094,11 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==01 */
+- case 2: /* mod=10 */
++ case 2: /* mod=10 */
+ switch (rh) {
+- case 0: /* test word imm */
++ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 destval,srcval;
++ u32 destval, srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -10507,8 +11108,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+- } else {
+- u16 destval,srcval;
++ }
++ else {
++ u16 destval, srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+@@ -10535,7 +11137,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+@@ -10558,7 +11161,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+@@ -10580,7 +11184,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+@@ -10601,7 +11206,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+@@ -10622,7 +11228,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+@@ -10643,7 +11250,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+@@ -10656,9 +11264,9 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ break;
+ }
+ break; /* end mod==10 */
+- case 3: /* mod=11 */
++ case 3: /* mod=11 */
+ switch (rh) {
+- case 0: /* test word imm */
++ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+@@ -10670,7 +11278,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_long(*destreg, srcval);
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -10696,7 +11305,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+@@ -10715,7 +11325,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+@@ -10733,15 +11344,16 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- mul_long(*destreg); /*!!! */
+- } else {
++ mul_long(*destreg); /*!!! */
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- mul_word(*destreg); /*!!! */
++ mul_word(*destreg); /*!!! */
+ }
+ break;
+ case 5:
+@@ -10753,7 +11365,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+@@ -10772,7 +11385,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+@@ -10791,7 +11405,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+@@ -10812,7 +11427,8 @@ static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf8
+ ****************************************************************************/
+-static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_clc(u8 X86EMU_UNUSED(op1))
+ {
+ /* clear the carry flag. */
+ START_OF_INSTR();
+@@ -10827,7 +11443,8 @@ static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xf9
+ ****************************************************************************/
+-static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_stc(u8 X86EMU_UNUSED(op1))
+ {
+ /* set the carry flag. */
+ START_OF_INSTR();
+@@ -10842,7 +11459,8 @@ static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xfa
+ ****************************************************************************/
+-static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cli(u8 X86EMU_UNUSED(op1))
+ {
+ /* clear interrupts. */
+ START_OF_INSTR();
+@@ -10857,7 +11475,8 @@ static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xfb
+ ****************************************************************************/
+-static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_sti(u8 X86EMU_UNUSED(op1))
+ {
+ /* enable interrupts. */
+ START_OF_INSTR();
+@@ -10872,7 +11491,8 @@ static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xfc
+ ****************************************************************************/
+-static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_cld(u8 X86EMU_UNUSED(op1))
+ {
+ /* clear interrupts. */
+ START_OF_INSTR();
+@@ -10887,7 +11507,8 @@ static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xfd
+ ****************************************************************************/
+-static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_std(u8 X86EMU_UNUSED(op1))
+ {
+ /* clear interrupts. */
+ START_OF_INSTR();
+@@ -10902,7 +11523,8 @@ static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xfe
+ ****************************************************************************/
+-static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rh, rl;
+ u8 destval;
+@@ -10944,13 +11566,13 @@ static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+- case 0: /* inc word ptr ... */
++ case 0: /* inc word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+- case 1: /* dec word ptr ... */
++ case 1: /* dec word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+@@ -11019,12 +11641,13 @@ static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+ REMARKS:
+ Handles opcode 0xff
+ ****************************************************************************/
+-static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
++static void
++x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ {
+ int mod, rh, rl;
+ uint destoffset = 0;
+- u16 *destreg;
+- u16 destval,destval2;
++ u16 *destreg;
++ u16 destval, destval2;
+
+ /* Yet another special case instruction. */
+ START_OF_INSTR();
+@@ -11040,14 +11663,16 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tDWORD PTR ");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("INC\tWORD PTR ");
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tDWORD PTR ");
+- } else {
++ }
++ else {
+ DECODE_PRINTF("DEC\tWORD PTR ");
+ }
+ break;
+@@ -11078,7 +11703,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+- case 0: /* inc word ptr ... */
++ case 0: /* inc word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+@@ -11086,7 +11711,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11095,7 +11721,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 1: /* dec word ptr ... */
++ case 1: /* dec word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+@@ -11103,7 +11729,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11112,13 +11739,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 2: /* call word ptr ... */
++ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 3: /* call far ptr ... */
++ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+@@ -11127,26 +11754,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 4: /* jmp word ptr ... */
++ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+- case 5: /* jmp far ptr ... */
++ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+- case 6: /* push word ptr ... */
++ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11168,7 +11796,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11185,7 +11814,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11194,13 +11824,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 2: /* call word ptr ... */
++ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 3: /* call far ptr ... */
++ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+@@ -11209,26 +11839,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 4: /* jmp word ptr ... */
++ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+- case 5: /* jmp far ptr ... */
++ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+- case 6: /* push word ptr ... */
++ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11250,7 +11881,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11267,7 +11899,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11276,13 +11909,13 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 2: /* call word ptr ... */
++ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 3: /* call far ptr ... */
++ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+@@ -11291,26 +11924,27 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+- case 4: /* jmp word ptr ... */
++ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+- case 5: /* jmp far ptr ... */
++ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+- case 6: /* push word ptr ... */
++ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+- } else {
++ }
++ else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+@@ -11330,7 +11964,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -11347,7 +11982,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -11356,26 +11992,26 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ *destreg = dec_word(*destreg);
+ }
+ break;
+- case 2: /* call word ptr ... */
++ case 2: /* call word ptr ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = *destreg;
+ break;
+- case 3: /* jmp far ptr ... */
++ case 3: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+
+- case 4: /* jmp ... */
++ case 4: /* jmp ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16) (*destreg);
+ break;
+- case 5: /* jmp far ptr ... */
++ case 5: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+@@ -11388,7 +12024,8 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_long(*destreg);
+- } else {
++ }
++ else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -11407,8 +12044,7 @@ static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+ /***************************************************************************
+ * Single byte operation code table:
+ **************************************************************************/
+-void (*x86emu_optab[256])(u8) =
+-{
++void (*x86emu_optab[256]) (u8) = {
+ /* 0x00 */ x86emuOp_add_byte_RM_R,
+ /* 0x01 */ x86emuOp_add_word_RM_R,
+ /* 0x02 */ x86emuOp_add_byte_R_RM,
+@@ -11417,7 +12053,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x05 */ x86emuOp_add_word_AX_IMM,
+ /* 0x06 */ x86emuOp_push_ES,
+ /* 0x07 */ x86emuOp_pop_ES,
+-
+ /* 0x08 */ x86emuOp_or_byte_RM_R,
+ /* 0x09 */ x86emuOp_or_word_RM_R,
+ /* 0x0a */ x86emuOp_or_byte_R_RM,
+@@ -11426,7 +12061,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x0d */ x86emuOp_or_word_AX_IMM,
+ /* 0x0e */ x86emuOp_push_CS,
+ /* 0x0f */ x86emuOp_two_byte,
+-
+ /* 0x10 */ x86emuOp_adc_byte_RM_R,
+ /* 0x11 */ x86emuOp_adc_word_RM_R,
+ /* 0x12 */ x86emuOp_adc_byte_R_RM,
+@@ -11435,7 +12069,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x15 */ x86emuOp_adc_word_AX_IMM,
+ /* 0x16 */ x86emuOp_push_SS,
+ /* 0x17 */ x86emuOp_pop_SS,
+-
+ /* 0x18 */ x86emuOp_sbb_byte_RM_R,
+ /* 0x19 */ x86emuOp_sbb_word_RM_R,
+ /* 0x1a */ x86emuOp_sbb_byte_R_RM,
+@@ -11444,7 +12077,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x1d */ x86emuOp_sbb_word_AX_IMM,
+ /* 0x1e */ x86emuOp_push_DS,
+ /* 0x1f */ x86emuOp_pop_DS,
+-
+ /* 0x20 */ x86emuOp_and_byte_RM_R,
+ /* 0x21 */ x86emuOp_and_word_RM_R,
+ /* 0x22 */ x86emuOp_and_byte_R_RM,
+@@ -11453,7 +12085,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x25 */ x86emuOp_and_word_AX_IMM,
+ /* 0x26 */ x86emuOp_segovr_ES,
+ /* 0x27 */ x86emuOp_daa,
+-
+ /* 0x28 */ x86emuOp_sub_byte_RM_R,
+ /* 0x29 */ x86emuOp_sub_word_RM_R,
+ /* 0x2a */ x86emuOp_sub_byte_R_RM,
+@@ -11462,7 +12093,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x2d */ x86emuOp_sub_word_AX_IMM,
+ /* 0x2e */ x86emuOp_segovr_CS,
+ /* 0x2f */ x86emuOp_das,
+-
+ /* 0x30 */ x86emuOp_xor_byte_RM_R,
+ /* 0x31 */ x86emuOp_xor_word_RM_R,
+ /* 0x32 */ x86emuOp_xor_byte_R_RM,
+@@ -11471,7 +12101,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x35 */ x86emuOp_xor_word_AX_IMM,
+ /* 0x36 */ x86emuOp_segovr_SS,
+ /* 0x37 */ x86emuOp_aaa,
+-
+ /* 0x38 */ x86emuOp_cmp_byte_RM_R,
+ /* 0x39 */ x86emuOp_cmp_word_RM_R,
+ /* 0x3a */ x86emuOp_cmp_byte_R_RM,
+@@ -11480,7 +12109,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x3d */ x86emuOp_cmp_word_AX_IMM,
+ /* 0x3e */ x86emuOp_segovr_DS,
+ /* 0x3f */ x86emuOp_aas,
+-
+ /* 0x40 */ x86emuOp_inc_AX,
+ /* 0x41 */ x86emuOp_inc_CX,
+ /* 0x42 */ x86emuOp_inc_DX,
+@@ -11489,7 +12117,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x45 */ x86emuOp_inc_BP,
+ /* 0x46 */ x86emuOp_inc_SI,
+ /* 0x47 */ x86emuOp_inc_DI,
+-
+ /* 0x48 */ x86emuOp_dec_AX,
+ /* 0x49 */ x86emuOp_dec_CX,
+ /* 0x4a */ x86emuOp_dec_DX,
+@@ -11498,7 +12125,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x4d */ x86emuOp_dec_BP,
+ /* 0x4e */ x86emuOp_dec_SI,
+ /* 0x4f */ x86emuOp_dec_DI,
+-
+ /* 0x50 */ x86emuOp_push_AX,
+ /* 0x51 */ x86emuOp_push_CX,
+ /* 0x52 */ x86emuOp_push_DX,
+@@ -11507,7 +12133,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x55 */ x86emuOp_push_BP,
+ /* 0x56 */ x86emuOp_push_SI,
+ /* 0x57 */ x86emuOp_push_DI,
+-
+ /* 0x58 */ x86emuOp_pop_AX,
+ /* 0x59 */ x86emuOp_pop_CX,
+ /* 0x5a */ x86emuOp_pop_DX,
+@@ -11516,16 +12141,16 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x5d */ x86emuOp_pop_BP,
+ /* 0x5e */ x86emuOp_pop_SI,
+ /* 0x5f */ x86emuOp_pop_DI,
+-
+ /* 0x60 */ x86emuOp_push_all,
+ /* 0x61 */ x86emuOp_pop_all,
+-/* 0x62 */ x86emuOp_illegal_op, /* bound */
+-/* 0x63 */ x86emuOp_illegal_op, /* arpl */
++ /* 0x62 */ x86emuOp_illegal_op,
++ /* bound */
++ /* 0x63 */ x86emuOp_illegal_op,
++ /* arpl */
+ /* 0x64 */ x86emuOp_segovr_FS,
+ /* 0x65 */ x86emuOp_segovr_GS,
+ /* 0x66 */ x86emuOp_prefix_data,
+ /* 0x67 */ x86emuOp_prefix_addr,
+-
+ /* 0x68 */ x86emuOp_push_word_IMM,
+ /* 0x69 */ x86emuOp_imul_word_IMM,
+ /* 0x6a */ x86emuOp_push_byte_IMM,
+@@ -11534,7 +12159,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x6d */ x86emuOp_ins_word,
+ /* 0x6e */ x86emuOp_outs_byte,
+ /* 0x6f */ x86emuOp_outs_word,
+-
+ /* 0x70 */ x86emuOp_jump_near_O,
+ /* 0x71 */ x86emuOp_jump_near_NO,
+ /* 0x72 */ x86emuOp_jump_near_B,
+@@ -11543,7 +12167,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x75 */ x86emuOp_jump_near_NZ,
+ /* 0x76 */ x86emuOp_jump_near_BE,
+ /* 0x77 */ x86emuOp_jump_near_NBE,
+-
+ /* 0x78 */ x86emuOp_jump_near_S,
+ /* 0x79 */ x86emuOp_jump_near_NS,
+ /* 0x7a */ x86emuOp_jump_near_P,
+@@ -11552,7 +12175,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x7d */ x86emuOp_jump_near_NL,
+ /* 0x7e */ x86emuOp_jump_near_LE,
+ /* 0x7f */ x86emuOp_jump_near_NLE,
+-
+ /* 0x80 */ x86emuOp_opc80_byte_RM_IMM,
+ /* 0x81 */ x86emuOp_opc81_word_RM_IMM,
+ /* 0x82 */ x86emuOp_opc82_byte_RM_IMM,
+@@ -11561,7 +12183,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x85 */ x86emuOp_test_word_RM_R,
+ /* 0x86 */ x86emuOp_xchg_byte_RM_R,
+ /* 0x87 */ x86emuOp_xchg_word_RM_R,
+-
+ /* 0x88 */ x86emuOp_mov_byte_RM_R,
+ /* 0x89 */ x86emuOp_mov_word_RM_R,
+ /* 0x8a */ x86emuOp_mov_byte_R_RM,
+@@ -11570,7 +12191,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x8d */ x86emuOp_lea_word_R_M,
+ /* 0x8e */ x86emuOp_mov_word_SR_RM,
+ /* 0x8f */ x86emuOp_pop_RM,
+-
+ /* 0x90 */ x86emuOp_nop,
+ /* 0x91 */ x86emuOp_xchg_word_AX_CX,
+ /* 0x92 */ x86emuOp_xchg_word_AX_DX,
+@@ -11579,7 +12199,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x95 */ x86emuOp_xchg_word_AX_BP,
+ /* 0x96 */ x86emuOp_xchg_word_AX_SI,
+ /* 0x97 */ x86emuOp_xchg_word_AX_DI,
+-
+ /* 0x98 */ x86emuOp_cbw,
+ /* 0x99 */ x86emuOp_cwd,
+ /* 0x9a */ x86emuOp_call_far_IMM,
+@@ -11588,7 +12207,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0x9d */ x86emuOp_popf_word,
+ /* 0x9e */ x86emuOp_sahf,
+ /* 0x9f */ x86emuOp_lahf,
+-
+ /* 0xa0 */ x86emuOp_mov_AL_M_IMM,
+ /* 0xa1 */ x86emuOp_mov_AX_M_IMM,
+ /* 0xa2 */ x86emuOp_mov_M_AL_IMM,
+@@ -11605,8 +12223,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xad */ x86emuOp_lods_word,
+ /* 0xac */ x86emuOp_scas_byte,
+ /* 0xad */ x86emuOp_scas_word,
+-
+-
+ /* 0xb0 */ x86emuOp_mov_byte_AL_IMM,
+ /* 0xb1 */ x86emuOp_mov_byte_CL_IMM,
+ /* 0xb2 */ x86emuOp_mov_byte_DL_IMM,
+@@ -11615,7 +12231,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xb5 */ x86emuOp_mov_byte_CH_IMM,
+ /* 0xb6 */ x86emuOp_mov_byte_DH_IMM,
+ /* 0xb7 */ x86emuOp_mov_byte_BH_IMM,
+-
+ /* 0xb8 */ x86emuOp_mov_word_AX_IMM,
+ /* 0xb9 */ x86emuOp_mov_word_CX_IMM,
+ /* 0xba */ x86emuOp_mov_word_DX_IMM,
+@@ -11624,7 +12239,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xbd */ x86emuOp_mov_word_BP_IMM,
+ /* 0xbe */ x86emuOp_mov_word_SI_IMM,
+ /* 0xbf */ x86emuOp_mov_word_DI_IMM,
+-
+ /* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM,
+ /* 0xc1 */ x86emuOp_opcC1_word_RM_MEM,
+ /* 0xc2 */ x86emuOp_ret_near_IMM,
+@@ -11641,14 +12255,14 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xcd */ x86emuOp_int_IMM,
+ /* 0xce */ x86emuOp_into,
+ /* 0xcf */ x86emuOp_iret,
+-
+ /* 0xd0 */ x86emuOp_opcD0_byte_RM_1,
+ /* 0xd1 */ x86emuOp_opcD1_word_RM_1,
+ /* 0xd2 */ x86emuOp_opcD2_byte_RM_CL,
+ /* 0xd3 */ x86emuOp_opcD3_word_RM_CL,
+ /* 0xd4 */ x86emuOp_aam,
+ /* 0xd5 */ x86emuOp_aad,
+-/* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */
++ /* 0xd6 */ x86emuOp_illegal_op,
++ /* Undocumented SETALC instruction */
+ /* 0xd7 */ x86emuOp_xlat,
+ /* 0xd8 */ x86emuOp_esc_coprocess_d8,
+ /* 0xd9 */ x86emuOp_esc_coprocess_d9,
+@@ -11658,7 +12272,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xdd */ x86emuOp_esc_coprocess_dd,
+ /* 0xde */ x86emuOp_esc_coprocess_de,
+ /* 0xdf */ x86emuOp_esc_coprocess_df,
+-
+ /* 0xe0 */ x86emuOp_loopne,
+ /* 0xe1 */ x86emuOp_loope,
+ /* 0xe2 */ x86emuOp_loop,
+@@ -11667,7 +12280,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xe5 */ x86emuOp_in_word_AX_IMM,
+ /* 0xe6 */ x86emuOp_out_byte_IMM_AL,
+ /* 0xe7 */ x86emuOp_out_word_IMM_AX,
+-
+ /* 0xe8 */ x86emuOp_call_near_IMM,
+ /* 0xe9 */ x86emuOp_jump_near_IMM,
+ /* 0xea */ x86emuOp_jump_far_IMM,
+@@ -11676,7 +12288,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xed */ x86emuOp_in_word_AX_DX,
+ /* 0xee */ x86emuOp_out_byte_DX_AL,
+ /* 0xef */ x86emuOp_out_word_DX_AX,
+-
+ /* 0xf0 */ x86emuOp_lock,
+ /* 0xf1 */ x86emuOp_illegal_op,
+ /* 0xf2 */ x86emuOp_repne,
+@@ -11685,7 +12296,6 @@ void (*x86emu_optab[256])(u8) =
+ /* 0xf5 */ x86emuOp_cmc,
+ /* 0xf6 */ x86emuOp_opcF6_byte_RM,
+ /* 0xf7 */ x86emuOp_opcF7_word_RM,
+-
+ /* 0xf8 */ x86emuOp_clc,
+ /* 0xf9 */ x86emuOp_stc,
+ /* 0xfa */ x86emuOp_cli,
+diff --git a/libs/x86emu/ops2.c b/libs/x86emu/ops2.c
+index 06b7f56..5ed2bf6 100644
+--- a/libs/x86emu/ops2.c
++++ b/libs/x86emu/ops2.c
+@@ -55,16 +55,14 @@ op1 - Instruction op code
+ REMARKS:
+ Handles illegal opcodes.
+ ****************************************************************************/
+-static void x86emuOp2_illegal_op(
+- u8 op2)
++static void
++x86emuOp2_illegal_op(u8 op2)
+ {
+- int mod, rl, rh;
+- START_OF_INSTR();
+- FETCH_DECODE_MODRM(mod, rh, rl);
+- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+- TRACE_REGS();
+- printk("%04x:%04x: %02X /%d ILLEGAL EXTENDED X86 OPCODE! (mod=%d rl=%d)\n",
+- M.x86.R_CS, M.x86.R_IP-2,op2, rh, mod, rl);
++ START_OF_INSTR();
++ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
++ TRACE_REGS();
++ printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
++ M.x86.R_CS, M.x86.R_IP - 2, op2);
+ HALT_SYS();
+ END_OF_INSTR();
+ }
+@@ -73,55 +71,10 @@ static void x86emuOp2_illegal_op(
+
+ /****************************************************************************
+ REMARKS:
+-Handles opcode 0x0f,0x01
+-****************************************************************************/
+-static void x86emuOp2_group_g(u8 X86EMU_UNUSED(op2))
+-{
+- int mod, rl, rh;
+- u16 *destreg;
+- uint destoffset;
+-
+- START_OF_INSTR();
+- FETCH_DECODE_MODRM(mod, rh, rl);
+- switch (rh) {
+- case 4: // SMSW (Store Machine Status Word)
+- // Decode the mod byte to find the addressing
+- // Always returns 0x10 (initial value as per intel manual volume 3, figure 8-1
+- switch (mod) {
+- case 0:
+- destoffset = decode_rm00_address(rl);
+- store_data_word(destoffset, 0x10);
+- break;
+- case 1:
+- destoffset = decode_rm01_address(rl);
+- store_data_word(destoffset, 0x10);
+- break;
+- case 2:
+- destoffset = decode_rm10_address(rl);
+- store_data_word(destoffset, 0x10);
+- break;
+- case 3:
+- destreg = DECODE_RM_WORD_REGISTER(rl);
+- *destreg = 0x10;
+- break;
+- }
+- break;
+- default:
+- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE IN 0F 01\n");
+- TRACE_REGS();
+- printk("%04x:%04x: 0F %02X /%d ILLEGAL EXTENDED X86 OPCODE! (mod=%d rl=%d)\n",
+- M.x86.R_CS, M.x86.R_IP-2,op2, rh, mod, rl);
+- HALT_SYS();
+- break;
+- }
+- END_OF_INSTR();
+-}
+-
+-/****************************************************************************
+-REMARKS:
+ Handles opcode 0x0f,0x31
+ ****************************************************************************/
+-static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
+ {
+ #ifdef __HAS_LONG_LONG__
+ static u64 counter = 0;
+@@ -155,90 +108,91 @@ static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0x80-0x8F
+ ****************************************************************************/
+-static void x86emuOp2_long_jump(u8 op2)
++static void
++x86emuOp2_long_jump(u8 op2)
+ {
+ s32 target;
+- char *name = 0;
++ const char *name = NULL;
+ int cond = 0;
+
+ /* conditional jump to word offset. */
+ START_OF_INSTR();
+ switch (op2) {
+- case 0x80:
++ case 0x80:
+ name = "JO\t";
+- cond = ACCESS_FLAG(F_OF);
++ cond = ACCESS_FLAG(F_OF);
+ break;
+- case 0x81:
++ case 0x81:
+ name = "JNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
+- case 0x82:
++ case 0x82:
+ name = "JB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
+- case 0x83:
++ case 0x83:
+ name = "JNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
+- case 0x84:
++ case 0x84:
+ name = "JZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
+- case 0x85:
++ case 0x85:
+ name = "JNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
+- case 0x86:
++ case 0x86:
+ name = "JBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
+- case 0x87:
++ case 0x87:
+ name = "JNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
+- case 0x88:
++ case 0x88:
+ name = "JS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
+- case 0x89:
++ case 0x89:
+ name = "JNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
+- case 0x8a:
++ case 0x8a:
+ name = "JP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
+- case 0x8b:
++ case 0x8b:
+ name = "JNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
+- case 0x8c:
++ case 0x8c:
+ name = "JL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+- case 0x8d:
++ case 0x8d:
+ name = "JNL\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)));
+ break;
+- case 0x8e:
++ case 0x8e:
+ name = "JLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+- case 0x8f:
++ case 0x8f:
+ name = "JNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ }
+ DECODE_PRINTF(name);
+- (void)name;
++ (void) name;
+ target = (s16) fetch_word_imm();
+ target += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", target);
+ TRACE_AND_STEP();
+ if (cond)
+- M.x86.R_IP = (u16)target;
++ M.x86.R_IP = (u16) target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+ }
+@@ -247,85 +201,86 @@ static void x86emuOp2_long_jump(u8 op2)
+ REMARKS:
+ Handles opcode 0x0f,0x90-0x9F
+ ****************************************************************************/
+-static void x86emuOp2_set_byte(u8 op2)
++static void
++x86emuOp2_set_byte(u8 op2)
+ {
+ int mod, rl, rh;
+ uint destoffset;
+- u8 *destreg;
+- char *name = 0;
++ u8 *destreg;
++ const char *name = NULL;
+ int cond = 0;
+
+ START_OF_INSTR();
+ switch (op2) {
+- case 0x90:
++ case 0x90:
+ name = "SETO\t";
+- cond = ACCESS_FLAG(F_OF);
++ cond = ACCESS_FLAG(F_OF);
+ break;
+- case 0x91:
++ case 0x91:
+ name = "SETNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
+- case 0x92:
++ case 0x92:
+ name = "SETB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
+- case 0x93:
++ case 0x93:
+ name = "SETNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
+- case 0x94:
++ case 0x94:
+ name = "SETZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
+- case 0x95:
++ case 0x95:
+ name = "SETNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
+- case 0x96:
++ case 0x96:
+ name = "SETBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
+- case 0x97:
++ case 0x97:
+ name = "SETNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
+- case 0x98:
++ case 0x98:
+ name = "SETS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
+- case 0x99:
++ case 0x99:
+ name = "SETNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
+- case 0x9a:
++ case 0x9a:
+ name = "SETP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
+- case 0x9b:
++ case 0x9b:
+ name = "SETNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
+- case 0x9c:
++ case 0x9c:
+ name = "SETL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+- case 0x9d:
++ case 0x9d:
+ name = "SETNL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+- case 0x9e:
++ case 0x9e:
+ name = "SETLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+- case 0x9f:
++ case 0x9f:
+ name = "SETNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ }
+ DECODE_PRINTF(name);
+- (void)name;
++ (void) name;
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+@@ -343,7 +298,7 @@ static void x86emuOp2_set_byte(u8 op2)
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ TRACE_AND_STEP();
+ *destreg = cond ? 0x01 : 0x00;
+@@ -357,7 +312,8 @@ static void x86emuOp2_set_byte(u8 op2)
+ REMARKS:
+ Handles opcode 0x0f,0xa0
+ ****************************************************************************/
+-static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tFS\n");
+@@ -371,7 +327,8 @@ static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa1
+ ****************************************************************************/
+-static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tFS\n");
+@@ -385,7 +342,8 @@ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
+ REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+ Handles opcode 0x0f,0xa2
+ ****************************************************************************/
+-static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("CPUID\n");
+@@ -399,11 +357,12 @@ static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa3
+ ****************************************************************************/
+-static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+- int bit,disp;
++ int bit, disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BT\t");
+@@ -419,10 +378,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+- } else {
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
++ }
++ else {
+ u16 srcval;
+ u16 *shiftreg;
+
+@@ -431,9 +391,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ break;
+ case 1:
+@@ -446,10 +406,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+- } else {
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
++ }
++ else {
+ u16 srcval;
+ u16 *shiftreg;
+
+@@ -458,9 +419,9 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ break;
+ case 2:
+@@ -473,10 +434,11 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+- } else {
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
++ }
++ else {
+ u16 srcval;
+ u16 *shiftreg;
+
+@@ -485,30 +447,31 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit), F_CF);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *srcreg,*shiftreg;
++ u32 *srcreg, *shiftreg;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+- } else {
+- u16 *srcreg,*shiftreg;
++ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
++ }
++ else {
++ u16 *srcreg, *shiftreg;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
++ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit), F_CF);
+ }
+ break;
+ }
+@@ -520,11 +483,12 @@ static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa4
+ ****************************************************************************/
+-static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+- u8 shift;
++ u8 shift;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+@@ -543,9 +507,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,shift);
++ destval = shld_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -557,7 +522,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,shift);
++ destval = shld_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -574,9 +539,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,shift);
++ destval = shld_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -588,7 +554,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,shift);
++ destval = shld_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -605,9 +571,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,shift);
++ destval = shld_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -619,13 +586,13 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,shift);
++ destval = shld_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*shiftreg;
++ u32 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -634,9 +601,10 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+- *destreg = shld_long(*destreg,*shiftreg,shift);
+- } else {
+- u16 *destreg,*shiftreg;
++ *destreg = shld_long(*destreg, *shiftreg, shift);
++ }
++ else {
++ u16 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -645,7 +613,7 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+- *destreg = shld_word(*destreg,*shiftreg,shift);
++ *destreg = shld_word(*destreg, *shiftreg, shift);
+ }
+ break;
+ }
+@@ -657,7 +625,8 @@ static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa5
+ ****************************************************************************/
+-static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -677,9 +646,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -689,7 +659,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -704,9 +674,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -716,7 +687,7 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -731,9 +702,10 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shld_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -743,29 +715,30 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shld_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shld_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*shiftreg;
++ u32 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+- *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
+- } else {
+- u16 *destreg,*shiftreg;
++ *destreg = shld_long(*destreg, *shiftreg, M.x86.R_CL);
++ }
++ else {
++ u16 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+- *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
++ *destreg = shld_word(*destreg, *shiftreg, M.x86.R_CL);
+ }
+ break;
+ }
+@@ -777,7 +750,8 @@ static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa8
+ ****************************************************************************/
+-static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tGS\n");
+@@ -791,7 +765,8 @@ static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xa9
+ ****************************************************************************/
+-static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tGS\n");
+@@ -805,11 +780,12 @@ static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xab
+ ****************************************************************************/
+-static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+- int bit,disp;
++ int bit, disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTS\t");
+@@ -817,7 +793,7 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+@@ -825,13 +801,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval | mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval | mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+@@ -839,16 +816,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, srcval | mask);
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, srcval | mask);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+@@ -856,13 +833,14 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval | mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval | mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+@@ -870,16 +848,16 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, srcval | mask);
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, srcval | mask);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+@@ -887,51 +865,53 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval | mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval | mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, srcval | mask);
+- }
+- break;
+- case 3: /* register to register */
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *srcreg,*shiftreg;
+- u32 mask;
+-
+- srcreg = DECODE_RM_LONG_REGISTER(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0x1F;
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- *srcreg |= mask;
+- } else {
+- u16 *srcreg,*shiftreg;
+- u16 mask;
+-
+- srcreg = DECODE_RM_WORD_REGISTER(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, srcval | mask);
++ }
++ break;
++ case 3: /* register to register */
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 *srcreg, *shiftreg;
++ u32 mask;
++
++ srcreg = DECODE_RM_LONG_REGISTER(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0x1F;
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ *srcreg |= mask;
++ }
++ else {
++ u16 *srcreg, *shiftreg;
++ u16 mask;
++
++ srcreg = DECODE_RM_WORD_REGISTER(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg |= mask;
+ }
+ break;
+@@ -944,11 +924,12 @@ static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xac
+ ****************************************************************************/
+-static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+- u8 shift;
++ u8 shift;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+@@ -967,9 +948,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,shift);
++ destval = shrd_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -981,7 +963,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,shift);
++ destval = shrd_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -998,9 +980,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,shift);
++ destval = shrd_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -1012,7 +995,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,shift);
++ destval = shrd_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -1029,9 +1012,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,shift);
++ destval = shrd_long(destval, *shiftreg, shift);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -1043,13 +1027,13 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,shift);
++ destval = shrd_word(destval, *shiftreg, shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*shiftreg;
++ u32 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1058,9 +1042,10 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+- *destreg = shrd_long(*destreg,*shiftreg,shift);
+- } else {
+- u16 *destreg,*shiftreg;
++ *destreg = shrd_long(*destreg, *shiftreg, shift);
++ }
++ else {
++ u16 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+@@ -1069,7 +1054,7 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+- *destreg = shrd_word(*destreg,*shiftreg,shift);
++ *destreg = shrd_word(*destreg, *shiftreg, shift);
+ }
+ break;
+ }
+@@ -1081,7 +1066,8 @@ static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xad
+ ****************************************************************************/
+-static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint destoffset;
+@@ -1101,9 +1087,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -1113,7 +1100,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -1128,9 +1115,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -1140,7 +1128,7 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+@@ -1155,9 +1143,10 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+- destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_long(destval, *shiftreg, M.x86.R_CL);
+ store_data_long(destoffset, destval);
+- } else {
++ }
++ else {
+ u16 destval;
+ u16 *shiftreg;
+
+@@ -1167,29 +1156,30 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+- destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
++ destval = shrd_word(destval, *shiftreg, M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*shiftreg;
++ u32 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+- *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
+- } else {
+- u16 *destreg,*shiftreg;
++ *destreg = shrd_long(*destreg, *shiftreg, M.x86.R_CL);
++ }
++ else {
++ u16 *destreg, *shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+- *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
++ *destreg = shrd_word(*destreg, *shiftreg, M.x86.R_CL);
+ }
+ break;
+ }
+@@ -1201,7 +1191,8 @@ static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xaf
+ ****************************************************************************/
+-static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1214,23 +1205,25 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
++ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -1240,38 +1233,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+- res = (s16)*destreg * (s16)srcval;
++ res = (s16) * destreg * (s16) srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
++ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -1281,38 +1277,41 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+- res = (s16)*destreg * (s16)srcval;
++ res = (s16) * destreg * (s16) srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+- u32 res_lo,res_hi;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
++ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
++ *destreg = (u32) res_lo;
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+@@ -1322,51 +1321,55 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+- res = (s16)*destreg * (s16)srcval;
++ res = (s16) * destreg * (s16) srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *destreg,*srcreg;
+- u32 res_lo,res_hi;
++ u32 *destreg, *srcreg;
++ u32 res_lo, res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ TRACE_AND_STEP();
+- imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
++ imul_long_direct(&res_lo, &res_hi, (s32) * destreg, (s32) * srcreg);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u32)res_lo;
+- } else {
+- u16 *destreg,*srcreg;
++ *destreg = (u32) res_lo;
++ }
++ else {
++ u16 *destreg, *srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+- res = (s16)*destreg * (s16)*srcreg;
++ res = (s16) * destreg * (s16) * srcreg;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+- } else {
++ }
++ else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+- *destreg = (u16)res;
++ *destreg = (u16) res;
+ }
+ break;
+ }
+@@ -1378,9 +1381,10 @@ static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xb2
+ ****************************************************************************/
+-static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+ {
+- int mod, rh, rl;
++ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+@@ -1415,7 +1419,7 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+@@ -1427,148 +1431,154 @@ static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xb3
+ ****************************************************************************/
+-static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
+ {
+- int mod, rl, rh;
+- uint srcoffset;
+- int bit,disp;
+-
+- START_OF_INSTR();
+- DECODE_PRINTF("BTR\t");
+- FETCH_DECODE_MODRM(mod, rh, rl);
+- switch (mod) {
+- case 0:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
+- u32 *shiftreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval & ~mask);
+- } else {
+- u16 srcval,mask;
+- u16 *shiftreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+- }
+- break;
+- case 1:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
+- u32 *shiftreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval & ~mask);
+- } else {
+- u16 srcval,mask;
+- u16 *shiftreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+- }
+- break;
+- case 2:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
+- u32 *shiftreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval & ~mask);
+- } else {
+- u16 srcval,mask;
+- u16 *shiftreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+- }
+- break;
+- case 3: /* register to register */
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *srcreg,*shiftreg;
+- u32 mask;
+-
+- srcreg = DECODE_RM_LONG_REGISTER(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0x1F;
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- *srcreg &= ~mask;
+- } else {
+- u16 *srcreg,*shiftreg;
+- u16 mask;
+-
+- srcreg = DECODE_RM_WORD_REGISTER(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- *srcreg &= ~mask;
+- }
+- break;
+- }
+- DECODE_CLEAR_SEGOVR();
+- END_OF_INSTR();
++ int mod, rl, rh;
++ uint srcoffset;
++ int bit, disp;
++
++ START_OF_INSTR();
++ DECODE_PRINTF("BTR\t");
++ FETCH_DECODE_MODRM(mod, rh, rl);
++ switch (mod) {
++ case 0:
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, mask;
++ u32 *shiftreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0x1F;
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval & ~mask);
++ }
++ else {
++ u16 srcval, mask;
++ u16 *shiftreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
++ }
++ break;
++ case 1:
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, mask;
++ u32 *shiftreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0x1F;
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval & ~mask);
++ }
++ else {
++ u16 srcval, mask;
++ u16 *shiftreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
++ }
++ break;
++ case 2:
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, mask;
++ u32 *shiftreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0x1F;
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval & ~mask);
++ }
++ else {
++ u16 srcval, mask;
++ u16 *shiftreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval & ~mask));
++ }
++ break;
++ case 3: /* register to register */
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 *srcreg, *shiftreg;
++ u32 mask;
++
++ srcreg = DECODE_RM_LONG_REGISTER(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0x1F;
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ *srcreg &= ~mask;
++ }
++ else {
++ u16 *srcreg, *shiftreg;
++ u16 mask;
++
++ srcreg = DECODE_RM_WORD_REGISTER(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ *srcreg &= ~mask;
++ }
++ break;
++ }
++ DECODE_CLEAR_SEGOVR();
++ END_OF_INSTR();
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Handles opcode 0x0f,0xb4
+ ****************************************************************************/
+-static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+ {
+- int mod, rh, rl;
++ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+@@ -1603,7 +1613,7 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+@@ -1615,9 +1625,10 @@ static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xb5
+ ****************************************************************************/
+-static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+ {
+- int mod, rh, rl;
++ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+@@ -1652,7 +1663,7 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+@@ -1664,7 +1675,8 @@ static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xb6
+ ****************************************************************************/
+-static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1685,7 +1697,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1710,7 +1723,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1735,7 +1749,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+@@ -1748,10 +1763,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ *destreg = srcval;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+- u8 *srcreg;
++ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1759,9 +1774,10 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+- } else {
++ }
++ else {
+ u16 *destreg;
+- u8 *srcreg;
++ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+@@ -1780,7 +1796,8 @@ static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xb7
+ ****************************************************************************/
+-static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1819,7 +1836,7 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+@@ -1836,7 +1853,8 @@ static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xba
+ ****************************************************************************/
+-static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -1846,23 +1864,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (rh) {
+ case 4:
+- DECODE_PRINTF("BT\t");
+- break;
++ DECODE_PRINTF("BT\t");
++ break;
+ case 5:
+- DECODE_PRINTF("BTS\t");
+- break;
++ DECODE_PRINTF("BTS\t");
++ break;
+ case 6:
+- DECODE_PRINTF("BTR\t");
+- break;
++ DECODE_PRINTF("BTR\t");
++ break;
+ case 7:
+- DECODE_PRINTF("BTC\t");
+- break;
++ DECODE_PRINTF("BTC\t");
++ break;
+ default:
+- DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+- TRACE_REGS();
+- printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
+- M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
+- HALT_SYS();
++ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
++ TRACE_REGS();
++ printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
++ M.x86.R_CS, M.x86.R_IP - 3, op2, (mod << 6) | (rh << 3) | rl);
++ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+@@ -1876,22 +1894,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_long(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_long(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_long(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
+- } else {
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_long(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_long(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_long(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
++ }
++ else {
+ u16 srcval, mask;
+ u8 shift;
+
+@@ -1901,21 +1920,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_word(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_word(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_word(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_word(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_word(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_word(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
+ }
+ break;
+ case 1:
+@@ -1929,22 +1948,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_long(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_long(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_long(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
+- } else {
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_long(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_long(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_long(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
++ }
++ else {
+ u16 srcval, mask;
+ u8 shift;
+
+@@ -1954,21 +1974,21 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_word(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_word(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_word(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_word(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_word(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_word(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
+ }
+ break;
+ case 2:
+@@ -1982,22 +2002,23 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_long(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_long(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_long(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
+- } else {
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_long(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_long(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_long(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
++ }
++ else {
+ u16 srcval, mask;
+ u8 shift;
+
+@@ -2007,74 +2028,75 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- switch (rh) {
+- case 5:
+- store_data_word(srcoffset, srcval | mask);
+- break;
+- case 6:
+- store_data_word(srcoffset, srcval & ~mask);
+- break;
+- case 7:
+- store_data_word(srcoffset, srcval ^ mask);
+- break;
+- default:
+- break;
+- }
+- }
+- break;
+- case 3: /* register to register */
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ switch (rh) {
++ case 5:
++ store_data_word(srcoffset, srcval | mask);
++ break;
++ case 6:
++ store_data_word(srcoffset, srcval & ~mask);
++ break;
++ case 7:
++ store_data_word(srcoffset, srcval ^ mask);
++ break;
++ default:
++ break;
++ }
++ }
++ break;
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+- u32 mask;
+- u8 shift;
++ u32 mask;
++ u8 shift;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- switch (rh) {
+- case 5:
+- *srcreg |= mask;
+- break;
+- case 6:
+- *srcreg &= ~mask;
+- break;
+- case 7:
+- *srcreg ^= mask;
+- break;
+- default:
+- break;
+- }
+- } else {
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ switch (rh) {
++ case 5:
++ *srcreg |= mask;
++ break;
++ case 6:
++ *srcreg &= ~mask;
++ break;
++ case 7:
++ *srcreg ^= mask;
++ break;
++ default:
++ break;
++ }
++ }
++ else {
+ u16 *srcreg;
+- u16 mask;
+- u8 shift;
++ u16 mask;
++ u8 shift;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+- mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- switch (rh) {
+- case 5:
+- *srcreg |= mask;
+- break;
+- case 6:
+- *srcreg &= ~mask;
+- break;
+- case 7:
+- *srcreg ^= mask;
+- break;
+- default:
+- break;
+- }
++ mask = (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ switch (rh) {
++ case 5:
++ *srcreg |= mask;
++ break;
++ case 6:
++ *srcreg &= ~mask;
++ break;
++ case 7:
++ *srcreg ^= mask;
++ break;
++ default:
++ break;
++ }
+ }
+ break;
+ }
+@@ -2086,11 +2108,12 @@ static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xbb
+ ****************************************************************************/
+-static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+- int bit,disp;
++ int bit, disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTC\t");
+@@ -2098,7 +2121,7 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+@@ -2106,13 +2129,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval ^ mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval ^ mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+@@ -2120,16 +2144,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+@@ -2137,13 +2161,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval ^ mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval ^ mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+@@ -2151,16 +2176,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval,mask;
++ u32 srcval, mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+@@ -2168,13 +2193,14 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+- disp = (s16)*shiftreg >> 5;
+- srcval = fetch_data_long(srcoffset+disp);
++ disp = (s16) * shiftreg >> 5;
++ srcval = fetch_data_long(srcoffset + disp);
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_long(srcoffset+disp, srcval ^ mask);
+- } else {
+- u16 srcval,mask;
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_long(srcoffset + disp, srcval ^ mask);
++ }
++ else {
++ u16 srcval, mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+@@ -2182,16 +2208,16 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+- disp = (s16)*shiftreg >> 4;
+- srcval = fetch_data_word(srcoffset+disp);
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+- store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
++ disp = (s16) * shiftreg >> 4;
++ srcval = fetch_data_word(srcoffset + disp);
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(srcval & mask, F_CF);
++ store_data_word(srcoffset + disp, (u16) (srcval ^ mask));
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 *srcreg,*shiftreg;
++ u32 *srcreg, *shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+@@ -2200,19 +2226,20 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+- *srcreg ^= mask;
+- } else {
+- u16 *srcreg,*shiftreg;
+- u16 mask;
+-
+- srcreg = DECODE_RM_WORD_REGISTER(rl);
+- DECODE_PRINTF(",");
+- shiftreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- bit = *shiftreg & 0xF;
+- mask = (u16)(0x1 << bit);
+- CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
++ *srcreg ^= mask;
++ }
++ else {
++ u16 *srcreg, *shiftreg;
++ u16 mask;
++
++ srcreg = DECODE_RM_WORD_REGISTER(rl);
++ DECODE_PRINTF(",");
++ shiftreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ bit = *shiftreg & 0xF;
++ mask = (u16) (0x1 << bit);
++ CONDITIONAL_SET_FLAG(*srcreg & mask, F_CF);
+ *srcreg ^= mask;
+ }
+ break;
+@@ -2225,7 +2252,8 @@ static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xbc
+ ****************************************************************************/
+-static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2233,105 +2261,117 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+ START_OF_INSTR();
+ DECODE_PRINTF("BSF\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+- switch(mod) {
++ switch (mod) {
+ case 0:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ case 1:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ case 2:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
+- case 3: /* register to register */
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcval = *DECODE_RM_LONG_REGISTER(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcval = *DECODE_RM_WORD_REGISTER(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
++ case 3: /* register to register */
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcval = *DECODE_RM_LONG_REGISTER(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 32; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcval = *DECODE_RM_WORD_REGISTER(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 0; *dstreg < 16; (*dstreg)++)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -2341,7 +2381,8 @@ static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xbd
+ ****************************************************************************/
+-static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2349,105 +2390,117 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+ START_OF_INSTR();
+ DECODE_PRINTF("BSR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+- switch(mod) {
++ switch (mod) {
+ case 0:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm00_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm00_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ case 1:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm01_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm01_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ case 2:
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_long(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcoffset = decode_rm10_address(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- srcval = fetch_data_word(srcoffset);
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
+- case 3: /* register to register */
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- u32 srcval, *dstreg;
+-
+- srcval = *DECODE_RM_LONG_REGISTER(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_LONG_REGISTER(rh);
+- TRACE_AND_STEP();
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- } else {
+- u16 srcval, *dstreg;
+-
+- srcval = *DECODE_RM_WORD_REGISTER(rl);
+- DECODE_PRINTF(",");
+- dstreg = DECODE_RM_WORD_REGISTER(rh);
+- TRACE_AND_STEP();
+- CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+- for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+- if ((srcval >> *dstreg) & 1) break;
+- }
+- break;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_long(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcoffset = decode_rm10_address(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ srcval = fetch_data_word(srcoffset);
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
++ case 3: /* register to register */
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ u32 srcval, *dstreg;
++
++ srcval = *DECODE_RM_LONG_REGISTER(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_LONG_REGISTER(rh);
++ TRACE_AND_STEP();
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 31; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ else {
++ u16 srcval, *dstreg;
++
++ srcval = *DECODE_RM_WORD_REGISTER(rl);
++ DECODE_PRINTF(",");
++ dstreg = DECODE_RM_WORD_REGISTER(rh);
++ TRACE_AND_STEP();
++ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
++ for (*dstreg = 15; *dstreg > 0; (*dstreg)--)
++ if ((srcval >> *dstreg) & 1)
++ break;
++ }
++ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+@@ -2457,7 +2510,8 @@ static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xbe
+ ****************************************************************************/
+-static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2474,18 +2528,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+- srcval = (s32)((s8)fetch_data_byte(srcoffset));
++ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+- srcval = (s16)((s8)fetch_data_byte(srcoffset));
++ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+@@ -2499,18 +2554,19 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+- srcval = (s32)((s8)fetch_data_byte(srcoffset));
++ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+- srcval = (s16)((s8)fetch_data_byte(srcoffset));
++ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+@@ -2524,44 +2580,46 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+- srcval = (s32)((s8)fetch_data_byte(srcoffset));
++ srcval = (s32) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+- } else {
++ }
++ else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+- srcval = (s16)((s8)fetch_data_byte(srcoffset));
++ srcval = (s16) ((s8) fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+- u8 *srcreg;
++ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- *destreg = (s32)((s8)*srcreg);
+- } else {
++ *destreg = (s32) ((s8) * srcreg);
++ }
++ else {
+ u16 *destreg;
+- u8 *srcreg;
++ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- *destreg = (s16)((s8)*srcreg);
++ *destreg = (s16) ((s8) * srcreg);
+ }
+ break;
+ }
+@@ -2573,7 +2631,8 @@ static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+ REMARKS:
+ Handles opcode 0x0f,0xbf
+ ****************************************************************************/
+-static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ {
+ int mod, rl, rh;
+ uint srcoffset;
+@@ -2589,7 +2648,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+- srcval = (s32)((s16)fetch_data_word(srcoffset));
++ srcval = (s32) ((s16) fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+@@ -2598,7 +2657,7 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+- srcval = (s32)((s16)fetch_data_word(srcoffset));
++ srcval = (s32) ((s16) fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+@@ -2607,18 +2666,18 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+- srcval = (s32)((s16)fetch_data_word(srcoffset));
++ srcval = (s32) ((s16) fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+- case 3: /* register to register */
++ case 3: /* register to register */
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+- *destreg = (s32)((s16)*srcreg);
++ *destreg = (s32) ((s16) * srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+@@ -2626,40 +2685,41 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+ }
+
+ /* Handles opcodes 0xc8-0xcf */
+-static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
++static void
++x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
+ {
+ START_OF_INSTR();
+ DECODE_PRINTF("BSWAP\n");
+ TRACE_AND_STEP();
+
+ switch (op2) {
+- case 0xc8:
+- M.x86.R_EAX = bswap_32(M.x86.R_EAX);
+- break;
+- case 0xc9:
+- M.x86.R_ECX = bswap_32(M.x86.R_ECX);
+- break;
+- case 0xca:
+- M.x86.R_EDX = bswap_32(M.x86.R_EDX);
+- break;
+- case 0xcb:
+- M.x86.R_EBX = bswap_32(M.x86.R_EBX);
+- break;
+- case 0xcc:
+- M.x86.R_ESP = bswap_32(M.x86.R_ESP);
+- break;
+- case 0xcd:
+- M.x86.R_EBP = bswap_32(M.x86.R_EBP);
+- break;
+- case 0xce:
+- M.x86.R_ESI = bswap_32(M.x86.R_ESI);
+- break;
+- case 0xcf:
+- M.x86.R_EDI = bswap_32(M.x86.R_EDI);
+- break;
+- default:
+- /* can't happen */
+- break;
++ case 0xc8:
++ M.x86.R_EAX = bswap_32(M.x86.R_EAX);
++ break;
++ case 0xc9:
++ M.x86.R_ECX = bswap_32(M.x86.R_ECX);
++ break;
++ case 0xca:
++ M.x86.R_EDX = bswap_32(M.x86.R_EDX);
++ break;
++ case 0xcb:
++ M.x86.R_EBX = bswap_32(M.x86.R_EBX);
++ break;
++ case 0xcc:
++ M.x86.R_ESP = bswap_32(M.x86.R_ESP);
++ break;
++ case 0xcd:
++ M.x86.R_EBP = bswap_32(M.x86.R_EBP);
++ break;
++ case 0xce:
++ M.x86.R_ESI = bswap_32(M.x86.R_ESI);
++ break;
++ case 0xcf:
++ M.x86.R_EDI = bswap_32(M.x86.R_EDI);
++ break;
++ default:
++ /* can't happen */
++ break;
+ }
+
+ DECODE_CLEAR_SEGOVR();
+@@ -2669,25 +2729,32 @@ static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
+ /***************************************************************************
+ * Double byte operation code table:
+ **************************************************************************/
+-void (*x86emu_optab2[256])(u8) =
+-{
+-/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
+-/* 0x01 */ x86emuOp2_group_g, /* Group G (ring 0 PM) */
+-/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
+-/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
++void (*x86emu_optab2[256]) (u8) = {
++ /* 0x00 */ x86emuOp2_illegal_op,
++ /* Group F (ring 0 PM) */
++ /* 0x01 */ x86emuOp2_illegal_op,
++ /* Group G (ring 0 PM) */
++ /* 0x02 */ x86emuOp2_illegal_op,
++ /* lar (ring 0 PM) */
++ /* 0x03 */ x86emuOp2_illegal_op,
++ /* lsl (ring 0 PM) */
+ /* 0x04 */ x86emuOp2_illegal_op,
+-/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
+-/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
+-/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
+-/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
+-/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
++ /* 0x05 */ x86emuOp2_illegal_op,
++ /* loadall (undocumented) */
++ /* 0x06 */ x86emuOp2_illegal_op,
++ /* clts (ring 0 PM) */
++ /* 0x07 */ x86emuOp2_illegal_op,
++ /* loadall (undocumented) */
++ /* 0x08 */ x86emuOp2_illegal_op,
++ /* invd (ring 0 PM) */
++ /* 0x09 */ x86emuOp2_illegal_op,
++ /* wbinvd (ring 0 PM) */
+ /* 0x0a */ x86emuOp2_illegal_op,
+ /* 0x0b */ x86emuOp2_illegal_op,
+ /* 0x0c */ x86emuOp2_illegal_op,
+ /* 0x0d */ x86emuOp2_illegal_op,
+ /* 0x0e */ x86emuOp2_illegal_op,
+ /* 0x0f */ x86emuOp2_illegal_op,
+-
+ /* 0x10 */ x86emuOp2_illegal_op,
+ /* 0x11 */ x86emuOp2_illegal_op,
+ /* 0x12 */ x86emuOp2_illegal_op,
+@@ -2704,14 +2771,19 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x1d */ x86emuOp2_illegal_op,
+ /* 0x1e */ x86emuOp2_illegal_op,
+ /* 0x1f */ x86emuOp2_illegal_op,
+-
+-/* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
+-/* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
+-/* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
+-/* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
+-/* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
++ /* 0x20 */ x86emuOp2_illegal_op,
++ /* mov reg32,creg (ring 0 PM) */
++ /* 0x21 */ x86emuOp2_illegal_op,
++ /* mov reg32,dreg (ring 0 PM) */
++ /* 0x22 */ x86emuOp2_illegal_op,
++ /* mov creg,reg32 (ring 0 PM) */
++ /* 0x23 */ x86emuOp2_illegal_op,
++ /* mov dreg,reg32 (ring 0 PM) */
++ /* 0x24 */ x86emuOp2_illegal_op,
++ /* mov reg32,treg (ring 0 PM) */
+ /* 0x25 */ x86emuOp2_illegal_op,
+-/* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
++ /* 0x26 */ x86emuOp2_illegal_op,
++ /* mov treg,reg32 (ring 0 PM) */
+ /* 0x27 */ x86emuOp2_illegal_op,
+ /* 0x28 */ x86emuOp2_illegal_op,
+ /* 0x29 */ x86emuOp2_illegal_op,
+@@ -2721,7 +2793,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x2d */ x86emuOp2_illegal_op,
+ /* 0x2e */ x86emuOp2_illegal_op,
+ /* 0x2f */ x86emuOp2_illegal_op,
+-
+ /* 0x30 */ x86emuOp2_illegal_op,
+ /* 0x31 */ x86emuOp2_rdtsc,
+ /* 0x32 */ x86emuOp2_illegal_op,
+@@ -2738,7 +2809,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x3d */ x86emuOp2_illegal_op,
+ /* 0x3e */ x86emuOp2_illegal_op,
+ /* 0x3f */ x86emuOp2_illegal_op,
+-
+ /* 0x40 */ x86emuOp2_illegal_op,
+ /* 0x41 */ x86emuOp2_illegal_op,
+ /* 0x42 */ x86emuOp2_illegal_op,
+@@ -2755,7 +2825,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x4d */ x86emuOp2_illegal_op,
+ /* 0x4e */ x86emuOp2_illegal_op,
+ /* 0x4f */ x86emuOp2_illegal_op,
+-
+ /* 0x50 */ x86emuOp2_illegal_op,
+ /* 0x51 */ x86emuOp2_illegal_op,
+ /* 0x52 */ x86emuOp2_illegal_op,
+@@ -2772,7 +2841,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x5d */ x86emuOp2_illegal_op,
+ /* 0x5e */ x86emuOp2_illegal_op,
+ /* 0x5f */ x86emuOp2_illegal_op,
+-
+ /* 0x60 */ x86emuOp2_illegal_op,
+ /* 0x61 */ x86emuOp2_illegal_op,
+ /* 0x62 */ x86emuOp2_illegal_op,
+@@ -2789,7 +2857,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x6d */ x86emuOp2_illegal_op,
+ /* 0x6e */ x86emuOp2_illegal_op,
+ /* 0x6f */ x86emuOp2_illegal_op,
+-
+ /* 0x70 */ x86emuOp2_illegal_op,
+ /* 0x71 */ x86emuOp2_illegal_op,
+ /* 0x72 */ x86emuOp2_illegal_op,
+@@ -2806,7 +2873,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x7d */ x86emuOp2_illegal_op,
+ /* 0x7e */ x86emuOp2_illegal_op,
+ /* 0x7f */ x86emuOp2_illegal_op,
+-
+ /* 0x80 */ x86emuOp2_long_jump,
+ /* 0x81 */ x86emuOp2_long_jump,
+ /* 0x82 */ x86emuOp2_long_jump,
+@@ -2823,7 +2889,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x8d */ x86emuOp2_long_jump,
+ /* 0x8e */ x86emuOp2_long_jump,
+ /* 0x8f */ x86emuOp2_long_jump,
+-
+ /* 0x90 */ x86emuOp2_set_byte,
+ /* 0x91 */ x86emuOp2_set_byte,
+ /* 0x92 */ x86emuOp2_set_byte,
+@@ -2840,7 +2905,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0x9d */ x86emuOp2_set_byte,
+ /* 0x9e */ x86emuOp2_set_byte,
+ /* 0x9f */ x86emuOp2_set_byte,
+-
+ /* 0xa0 */ x86emuOp2_push_FS,
+ /* 0xa1 */ x86emuOp2_pop_FS,
+ /* 0xa2 */ x86emuOp2_cpuid,
+@@ -2857,9 +2921,10 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0xad */ x86emuOp2_shrd_CL,
+ /* 0xae */ x86emuOp2_illegal_op,
+ /* 0xaf */ x86emuOp2_imul_R_RM,
+-
+-/* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
+-/* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
++ /* 0xb0 */ x86emuOp2_illegal_op,
++ /* TODO: cmpxchg */
++ /* 0xb1 */ x86emuOp2_illegal_op,
++ /* TODO: cmpxchg */
+ /* 0xb2 */ x86emuOp2_lss_R_IMM,
+ /* 0xb3 */ x86emuOp2_btr_R,
+ /* 0xb4 */ x86emuOp2_lfs_R_IMM,
+@@ -2874,9 +2939,10 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0xbd */ x86emuOp2_bsr,
+ /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
+ /* 0xbf */ x86emuOp2_movsx_word_R_RM,
+-
+-/* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
+-/* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
++ /* 0xc0 */ x86emuOp2_illegal_op,
++ /* TODO: xadd */
++ /* 0xc1 */ x86emuOp2_illegal_op,
++ /* TODO: xadd */
+ /* 0xc2 */ x86emuOp2_illegal_op,
+ /* 0xc3 */ x86emuOp2_illegal_op,
+ /* 0xc4 */ x86emuOp2_illegal_op,
+@@ -2891,7 +2957,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0xcd */ x86emuOp2_bswap,
+ /* 0xce */ x86emuOp2_bswap,
+ /* 0xcf */ x86emuOp2_bswap,
+-
+ /* 0xd0 */ x86emuOp2_illegal_op,
+ /* 0xd1 */ x86emuOp2_illegal_op,
+ /* 0xd2 */ x86emuOp2_illegal_op,
+@@ -2908,7 +2973,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0xdd */ x86emuOp2_illegal_op,
+ /* 0xde */ x86emuOp2_illegal_op,
+ /* 0xdf */ x86emuOp2_illegal_op,
+-
+ /* 0xe0 */ x86emuOp2_illegal_op,
+ /* 0xe1 */ x86emuOp2_illegal_op,
+ /* 0xe2 */ x86emuOp2_illegal_op,
+@@ -2925,7 +2989,6 @@ void (*x86emu_optab2[256])(u8) =
+ /* 0xed */ x86emuOp2_illegal_op,
+ /* 0xee */ x86emuOp2_illegal_op,
+ /* 0xef */ x86emuOp2_illegal_op,
+-
+ /* 0xf0 */ x86emuOp2_illegal_op,
+ /* 0xf1 */ x86emuOp2_illegal_op,
+ /* 0xf2 */ x86emuOp2_illegal_op,
+diff --git a/libs/x86emu/prim_ops.c b/libs/x86emu/prim_ops.c
+index ff17c3f..24f76b4 100644
+--- a/libs/x86emu/prim_ops.c
++++ b/libs/x86emu/prim_ops.c
+@@ -102,18 +102,23 @@
+ #define PRIM_OPS_NO_REDEFINE_ASM
+ #include "x86emu/x86emui.h"
+
++#if defined(__GNUC__)
++#if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)
++#include "x86emu/prim_x86_gcc.h"
++#endif
++#endif
++
+ /*------------------------- Global Variables ------------------------------*/
+
+-static u32 x86emu_parity_tab[8] =
+-{
+- 0x96696996,
+- 0x69969669,
+- 0x69969669,
+- 0x96696996,
+- 0x69969669,
+- 0x96696996,
+- 0x96696996,
+- 0x69969669,
++static u32 x86emu_parity_tab[8] = {
++ 0x96696996,
++ 0x69969669,
++ 0x69969669,
++ 0x96696996,
++ 0x69969669,
++ 0x96696996,
++ 0x96696996,
++ 0x69969669,
+ };
+
+ #define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
+@@ -125,88 +130,96 @@ static u32 x86emu_parity_tab[8] =
+ REMARKS:
+ Implements the AAA instruction and side effects.
+ ****************************************************************************/
+-u16 aaa_word(u16 d)
++u16
++aaa_word(u16 d)
+ {
+- u16 res;
+- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+- d += 0x6;
+- d += 0x100;
+- SET_FLAG(F_AF);
+- SET_FLAG(F_CF);
+- } else {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- }
+- res = (u16)(d & 0xFF0F);
+- CLEAR_FLAG(F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return res;
++ u16 res;
++
++ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
++ d += 0x6;
++ d += 0x100;
++ SET_FLAG(F_AF);
++ SET_FLAG(F_CF);
++ }
++ else {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ }
++ res = (u16) (d & 0xFF0F);
++ CLEAR_FLAG(F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the AAA instruction and side effects.
+ ****************************************************************************/
+-u16 aas_word(u16 d)
++u16
++aas_word(u16 d)
+ {
+- u16 res;
+- if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+- d -= 0x6;
+- d -= 0x100;
+- SET_FLAG(F_AF);
+- SET_FLAG(F_CF);
+- } else {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- }
+- res = (u16)(d & 0xFF0F);
+- CLEAR_FLAG(F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return res;
++ u16 res;
++
++ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
++ d -= 0x6;
++ d -= 0x100;
++ SET_FLAG(F_AF);
++ SET_FLAG(F_CF);
++ }
++ else {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ }
++ res = (u16) (d & 0xFF0F);
++ CLEAR_FLAG(F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the AAD instruction and side effects.
+ ****************************************************************************/
+-u16 aad_word(u16 d)
++u16
++aad_word(u16 d)
+ {
+- u16 l;
+- u8 hb, lb;
++ u16 l;
++ u8 hb, lb;
+
+- hb = (u8)((d >> 8) & 0xff);
+- lb = (u8)((d & 0xff));
+- l = (u16)((lb + 10 * hb) & 0xFF);
++ hb = (u8) ((d >> 8) & 0xff);
++ lb = (u8) ((d & 0xff));
++ l = (u16) ((lb + 10 * hb) & 0xFF);
+
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+- return l;
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
++ return l;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the AAM instruction and side effects.
+ ****************************************************************************/
+-u16 aam_word(u8 d)
++u16
++aam_word(u8 d)
+ {
+ u16 h, l;
+
+- h = (u16)(d / 10);
+- l = (u16)(d % 10);
+- l |= (u16)(h << 8);
++ h = (u16) (d / 10);
++ l = (u16) (d % 10);
++ l |= (u16) (h << 8);
+
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+ return l;
+ }
+
+@@ -214,155 +227,161 @@ u16 aam_word(u8 d)
+ REMARKS:
+ Implements the ADC instruction and side effects.
+ ****************************************************************************/
+-u8 adc_byte(u8 d, u8 s)
++u8
++adc_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- if (ACCESS_FLAG(F_CF))
+- res = 1 + d + s;
+- else
+- res = d + s;
++ if (ACCESS_FLAG(F_CF))
++ res = 1 + d + s;
++ else
++ res = d + s;
+
+- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (s & d) | ((~res) & (s | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ADC instruction and side effects.
+ ****************************************************************************/
+-u16 adc_word(u16 d, u16 s)
++u16
++adc_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- if (ACCESS_FLAG(F_CF))
+- res = 1 + d + s;
+- else
+- res = d + s;
++ if (ACCESS_FLAG(F_CF))
++ res = 1 + d + s;
++ else
++ res = d + s;
+
+- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u16)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (s & d) | ((~res) & (s | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ADC instruction and side effects.
+ ****************************************************************************/
+-u32 adc_long(u32 d, u32 s)
++u32
++adc_long(u32 d, u32 s)
+ {
+- register u32 lo; /* all operands in native machine order */
+- register u32 hi;
+- register u32 res;
+- register u32 cc;
++ register u32 lo; /* all operands in native machine order */
++ register u32 hi;
++ register u32 res;
++ register u32 cc;
+
+- if (ACCESS_FLAG(F_CF)) {
+- lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
+- res = 1 + d + s;
+- }
+- else {
+- lo = (d & 0xFFFF) + (s & 0xFFFF);
+- res = d + s;
+- }
+- hi = (lo >> 16) + (d >> 16) + (s >> 16);
++ if (ACCESS_FLAG(F_CF)) {
++ lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
++ res = 1 + d + s;
++ }
++ else {
++ lo = (d & 0xFFFF) + (s & 0xFFFF);
++ res = d + s;
++ }
++ hi = (lo >> 16) + (d >> 16) + (s >> 16);
+
+- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (s & d) | ((~res) & (s | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ADD instruction and side effects.
+ ****************************************************************************/
+-u8 add_byte(u8 d, u8 s)
++u8
++add_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- res = d + s;
+- CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d + s;
++ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (s & d) | ((~res) & (s | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ADD instruction and side effects.
+ ****************************************************************************/
+-u16 add_word(u16 d, u16 s)
++u16
++add_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- res = d + s;
+- CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d + s;
++ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u16)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (s & d) | ((~res) & (s | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ADD instruction and side effects.
+ ****************************************************************************/
+-u32 add_long(u32 d, u32 s)
++u32
++add_long(u32 d, u32 s)
+ {
+- register u32 lo; /* all operands in native machine order */
+- register u32 hi;
+- register u32 res;
+- register u32 cc;
++ register u32 lo; /* all operands in native machine order */
++ register u32 hi;
++ register u32 res;
++ register u32 cc;
+
+- lo = (d & 0xFFFF) + (s & 0xFFFF);
+- res = d + s;
+- hi = (lo >> 16) + (d >> 16) + (s >> 16);
++ lo = (d & 0xFFFF) + (s & 0xFFFF);
++ res = d + s;
++ hi = (lo >> 16) + (d >> 16) + (s >> 16);
+
+- CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+
+ return res;
+ }
+@@ -371,39 +390,41 @@ u32 add_long(u32 d, u32 s)
+ REMARKS:
+ Implements the AND instruction and side effects.
+ ****************************************************************************/
+-u8 and_byte(u8 d, u8 s)
++u8
++and_byte(u8 d, u8 s)
+ {
+- register u8 res; /* all operands in native machine order */
++ register u8 res; /* all operands in native machine order */
+
+- res = d & s;
++ res = d & s;
+
+- /* set the flags */
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+- return res;
++ /* set the flags */
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the AND instruction and side effects.
+ ****************************************************************************/
+-u16 and_word(u16 d, u16 s)
++u16
++and_word(u16 d, u16 s)
+ {
+- register u16 res; /* all operands in native machine order */
++ register u16 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ /* set the flags */
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+ }
+
+@@ -411,433 +432,456 @@ u16 and_word(u16 d, u16 s)
+ REMARKS:
+ Implements the AND instruction and side effects.
+ ****************************************************************************/
+-u32 and_long(u32 d, u32 s)
++u32
++and_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+- res = d & s;
++ res = d & s;
+
+- /* set the flags */
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return res;
++ /* set the flags */
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the CMP instruction and side effects.
+ ****************************************************************************/
+-u8 cmp_byte(u8 d, u8 s)
++u8
++cmp_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- res = d - s;
+- CLEAR_FLAG(F_CF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d - s;
++ CLEAR_FLAG(F_CF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return d;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return d;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the CMP instruction and side effects.
+ ****************************************************************************/
+-u16 cmp_word(u16 d, u16 s)
++u16
++cmp_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d - s;
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
++ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return d;
++ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return d;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the CMP instruction and side effects.
+ ****************************************************************************/
+-u32 cmp_long(u32 d, u32 s)
++u32
++cmp_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d - s;
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return d;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return d;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DAA instruction and side effects.
+ ****************************************************************************/
+-u8 daa_byte(u8 d)
++u8
++daa_byte(u8 d)
+ {
+- u32 res = d;
+- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+- res += 6;
+- SET_FLAG(F_AF);
+- }
+- if (res > 0x9F || ACCESS_FLAG(F_CF)) {
+- res += 0x60;
+- SET_FLAG(F_CF);
+- }
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return (u8)res;
++ u32 res = d;
++
++ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
++ res += 6;
++ SET_FLAG(F_AF);
++ }
++ if (res > 0x9F || ACCESS_FLAG(F_CF)) {
++ res += 0x60;
++ SET_FLAG(F_CF);
++ }
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DAS instruction and side effects.
+ ****************************************************************************/
+-u8 das_byte(u8 d)
++u8
++das_byte(u8 d)
+ {
+- if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+- d -= 6;
+- SET_FLAG(F_AF);
+- }
+- if (d > 0x9F || ACCESS_FLAG(F_CF)) {
+- d -= 0x60;
+- SET_FLAG(F_CF);
+- }
+- CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(d == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
+- return d;
++ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
++ d -= 6;
++ SET_FLAG(F_AF);
++ }
++ if (d > 0x9F || ACCESS_FLAG(F_CF)) {
++ d -= 0x60;
++ SET_FLAG(F_CF);
++ }
++ CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(d == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
++ return d;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DEC instruction and side effects.
+ ****************************************************************************/
+-u8 dec_byte(u8 d)
++u8
++dec_byte(u8 d)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- /* based on sub_byte, uses s==1. */
+- bc = (res & (~d | 1)) | (~d & 1);
+- /* carry flag unchanged */
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the borrow chain. See note at top */
++ /* based on sub_byte, uses s==1. */
++ bc = (res & (~d | 1)) | (~d & 1);
++ /* carry flag unchanged */
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DEC instruction and side effects.
+ ****************************************************************************/
+-u16 dec_word(u16 d)
++u16
++dec_word(u16 d)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ /* based on the sub_byte routine, with s==1 */
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u16)res;
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DEC instruction and side effects.
+ ****************************************************************************/
+-u32 dec_long(u32 d)
++u32
++dec_long(u32 d)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | 1)) | (~d & 1);
+- /* carry flag unchanged */
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++ bc = (res & (~d | 1)) | (~d & 1);
++ /* carry flag unchanged */
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the INC instruction and side effects.
+ ****************************************************************************/
+-u8 inc_byte(u8 d)
++u8
++inc_byte(u8 d)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- res = d + 1;
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d + 1;
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = ((1 & d) | (~res)) & (1 | d);
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = ((1 & d) | (~res)) & (1 | d);
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the INC instruction and side effects.
+ ****************************************************************************/
+-u16 inc_word(u16 d)
++u16
++inc_word(u16 d)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- res = d + 1;
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d + 1;
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (1 & d) | ((~res) & (1 | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return (u16)res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (1 & d) | ((~res) & (1 | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the INC instruction and side effects.
+ ****************************************************************************/
+-u32 inc_long(u32 d)
++u32
++inc_long(u32 d)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 cc;
++ register u32 res; /* all operands in native machine order */
++ register u32 cc;
+
+- res = d + 1;
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d + 1;
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the carry chain SEE NOTE AT TOP. */
+- cc = (1 & d) | ((~res) & (1 | d));
+- CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+- return res;
++ /* calculate the carry chain SEE NOTE AT TOP. */
++ cc = (1 & d) | ((~res) & (1 | d));
++ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u8 or_byte(u8 d, u8 s)
++u8
++or_byte(u8 d, u8 s)
+ {
+- register u8 res; /* all operands in native machine order */
++ register u8 res; /* all operands in native machine order */
+
+- res = d | s;
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+- return res;
++ res = d | s;
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u16 or_word(u16 d, u16 s)
++u16
++or_word(u16 d, u16 s)
+ {
+- register u16 res; /* all operands in native machine order */
++ register u16 res; /* all operands in native machine order */
+
+- res = d | s;
+- /* set the carry flag to be bit 8 */
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return res;
++ res = d | s;
++ /* set the carry flag to be bit 8 */
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u32 or_long(u32 d, u32 s)
++u32
++or_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+- res = d | s;
++ res = d | s;
+
+- /* set the carry flag to be bit 8 */
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- return res;
++ /* set the carry flag to be bit 8 */
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u8 neg_byte(u8 s)
++u8
++neg_byte(u8 s)
+ {
+ register u8 res;
+ register u8 bc;
+
+- CONDITIONAL_SET_FLAG(s != 0, F_CF);
+- res = (u8)-s;
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+- /* calculate the borrow chain --- modified such that d=0.
+- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+- (the one used for sub) and simplifying, since ~d=0xff...,
+- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+- ~d&s == s. So the simplified result is: */
+- bc = res | s;
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++ CONDITIONAL_SET_FLAG(s != 0, F_CF);
++ res = (u8) - s;
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
++ /* calculate the borrow chain --- modified such that d=0.
++ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
++ (the one used for sub) and simplifying, since ~d=0xff...,
++ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
++ ~d&s == s. So the simplified result is: */
++ bc = res | s;
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u16 neg_word(u16 s)
+-{
+- register u16 res;
+- register u16 bc;
+-
+- CONDITIONAL_SET_FLAG(s != 0, F_CF);
+- res = (u16)-s;
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+-
+- /* calculate the borrow chain --- modified such that d=0.
+- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+- (the one used for sub) and simplifying, since ~d=0xff...,
+- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+- ~d&s == s. So the simplified result is: */
+- bc = res | s;
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++u16
++neg_word(u16 s)
++{
++ register u16 res;
++ register u16 bc;
++
++ CONDITIONAL_SET_FLAG(s != 0, F_CF);
++ res = (u16) - s;
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++
++ /* calculate the borrow chain --- modified such that d=0.
++ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
++ (the one used for sub) and simplifying, since ~d=0xff...,
++ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
++ ~d&s == s. So the simplified result is: */
++ bc = res | s;
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the OR instruction and side effects.
+ ****************************************************************************/
+-u32 neg_long(u32 s)
++u32
++neg_long(u32 s)
+ {
+- register u32 res;
+- register u32 bc;
+-
+- CONDITIONAL_SET_FLAG(s != 0, F_CF);
+- res = (u32)-s;
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ register u32 res;
++ register u32 bc;
+
+- /* calculate the borrow chain --- modified such that d=0.
+- substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+- (the one used for sub) and simplifying, since ~d=0xff...,
+- ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+- ~d&s == s. So the simplified result is: */
+- bc = res | s;
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++ CONDITIONAL_SET_FLAG(s != 0, F_CF);
++ res = (u32) - s;
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++
++ /* calculate the borrow chain --- modified such that d=0.
++ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
++ (the one used for sub) and simplifying, since ~d=0xff...,
++ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
++ ~d&s == s. So the simplified result is: */
++ bc = res | s;
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the NOT instruction and side effects.
+ ****************************************************************************/
+-u8 not_byte(u8 s)
++u8
++not_byte(u8 s)
+ {
+- return ~s;
++ return ~s;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the NOT instruction and side effects.
+ ****************************************************************************/
+-u16 not_word(u16 s)
++u16
++not_word(u16 s)
+ {
+- return ~s;
++ return ~s;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the NOT instruction and side effects.
+ ****************************************************************************/
+-u32 not_long(u32 s)
++u32
++not_long(u32 s)
+ {
+- return ~s;
++ return ~s;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCL instruction and side effects.
+ ****************************************************************************/
+-u8 rcl_byte(u8 d, u8 s)
++u8
++rcl_byte(u8 d, u8 s)
+ {
+ register unsigned int res, cnt, mask, cf;
+
+ /* s is the rotate distance. It varies from 0 - 8. */
+- /* have
++ /* have
+
+ CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
+
+@@ -861,9 +905,9 @@ u8 rcl_byte(u8 d, u8 s)
+ 2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0
+ 3) B_(n-1) <- cf
+ 4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1))
+- */
+- res = d;
+- if ((cnt = s % 9) != 0) {
++ */
++ res = d;
++ if ((cnt = s % 9) != 0) {
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(8-n) */
+ cf = (d >> (8 - cnt)) & 0x1;
+@@ -872,7 +916,7 @@ u8 rcl_byte(u8 d, u8 s)
+ into the range B_7 .. B_cnt */
+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
+ /* note that the right hand side done by the mask */
+- res = (d << cnt) & 0xff;
++ res = (d << cnt) & 0xff;
+
+ /* now the high stuff which rotated around
+ into the positions B_cnt-2 .. B_0 */
+@@ -884,81 +928,81 @@ u8 rcl_byte(u8 d, u8 s)
+ res |= (d >> (9 - cnt)) & mask;
+
+ /* if the carry flag was set, or it in. */
+- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
++ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ /* B_(n-1) <- cf */
+ res |= 1 << (cnt - 1);
+ }
+ /* set the new carry flag, based on the variable "cf" */
+- CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cf, F_CF);
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized this expression since it appears to
+ be causing OF to be misset */
+- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
+- F_OF);
++ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), F_OF);
+
+ }
+- return (u8)res;
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCL instruction and side effects.
+ ****************************************************************************/
+-u16 rcl_word(u16 d, u8 s)
++u16
++rcl_word(u16 d, u8 s)
+ {
+- register unsigned int res, cnt, mask, cf;
++ register unsigned int res, cnt, mask, cf;
+
+- res = d;
+- if ((cnt = s % 17) != 0) {
+- cf = (d >> (16 - cnt)) & 0x1;
+- res = (d << cnt) & 0xffff;
+- mask = (1 << (cnt - 1)) - 1;
+- res |= (d >> (17 - cnt)) & mask;
+- if (ACCESS_FLAG(F_CF)) {
+- res |= 1 << (cnt - 1);
+- }
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)),
+- F_OF);
+- }
+- return (u16)res;
++ res = d;
++ if ((cnt = s % 17) != 0) {
++ cf = (d >> (16 - cnt)) & 0x1;
++ res = (d << cnt) & 0xffff;
++ mask = (1 << (cnt - 1)) - 1;
++ res |= (d >> (17 - cnt)) & mask;
++ if (ACCESS_FLAG(F_CF)) {
++ res |= 1 << (cnt - 1);
++ }
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), F_OF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCL instruction and side effects.
+ ****************************************************************************/
+-u32 rcl_long(u32 d, u8 s)
++u32
++rcl_long(u32 d, u8 s)
+ {
+- register u32 res, cnt, mask, cf;
++ register u32 res, cnt, mask, cf;
+
+- res = d;
+- if ((cnt = s % 33) != 0) {
+- cf = (d >> (32 - cnt)) & 0x1;
+- res = (d << cnt) & 0xffffffff;
+- mask = (1 << (cnt - 1)) - 1;
+- res |= (d >> (33 - cnt)) & mask;
+- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+- res |= 1 << (cnt - 1);
+- }
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)),
+- F_OF);
+- }
+- return res;
++ res = d;
++ if ((cnt = s % 33) != 0) {
++ cf = (d >> (32 - cnt)) & 0x1;
++ res = (d << cnt) & 0xffffffff;
++ mask = (1 << (cnt - 1)) - 1;
++ res |= (d >> (33 - cnt)) & mask;
++ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
++ res |= 1 << (cnt - 1);
++ }
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), F_OF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCR instruction and side effects.
+ ****************************************************************************/
+-u8 rcr_byte(u8 d, u8 s)
++u8
++rcr_byte(u8 d, u8 s)
+ {
+- u32 res, cnt;
+- u32 mask, cf, ocf = 0;
++ u32 res, cnt;
++ u32 mask, cf, ocf = 0;
+
+- /* rotate right through carry */
++ /* rotate right through carry */
+ /*
+ s is the rotate distance. It varies from 0 - 8.
+ d is the byte object rotated.
+@@ -979,9 +1023,9 @@ u8 rcr_byte(u8 d, u8 s)
+ 2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
+ 3) B_(8-n) <- cf
+ 4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0)
+- */
+- res = d;
+- if ((cnt = s % 9) != 0) {
++ */
++ res = d;
++ if ((cnt = s % 9) != 0) {
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(n-1) */
+ if (cnt == 1) {
+@@ -990,11 +1034,12 @@ u8 rcr_byte(u8 d, u8 s)
+ 0 if flag not set
+ non-zero if flag is set.
+ doing access_flag(..) != 0 casts that into either
+- 0..1 in any representation of the flags register
++ 0..1 in any representation of the flags register
+ (i.e. packed bit array or unpacked.)
+ */
+- ocf = ACCESS_FLAG(F_CF) != 0;
+- } else
++ ocf = ACCESS_FLAG(F_CF) != 0;
++ }
++ else
+ cf = (d >> (cnt - 1)) & 0x1;
+
+ /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
+@@ -1016,93 +1061,95 @@ u8 rcr_byte(u8 d, u8 s)
+ res |= (d << (9 - cnt));
+
+ /* if the carry flag was set, or it in. */
+- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
++ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ /* B_(8-n) <- cf */
+ res |= 1 << (8 - cnt);
+ }
+ /* set the new carry flag, based on the variable "cf" */
+- CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cf, F_CF);
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized... */
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)),
+- F_OF);
+- }
+- }
+- return (u8)res;
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)), F_OF);
++ }
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCR instruction and side effects.
+ ****************************************************************************/
+-u16 rcr_word(u16 d, u8 s)
++u16
++rcr_word(u16 d, u8 s)
+ {
+- u32 res, cnt;
+- u32 mask, cf, ocf = 0;
++ u32 res, cnt;
++ u32 mask, cf, ocf = 0;
+
+- /* rotate right through carry */
+- res = d;
+- if ((cnt = s % 17) != 0) {
+- if (cnt == 1) {
+- cf = d & 0x1;
+- ocf = ACCESS_FLAG(F_CF) != 0;
+- } else
+- cf = (d >> (cnt - 1)) & 0x1;
+- mask = (1 << (16 - cnt)) - 1;
+- res = (d >> cnt) & mask;
+- res |= (d << (17 - cnt));
+- if (ACCESS_FLAG(F_CF)) {
+- res |= 1 << (16 - cnt);
+- }
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)),
+- F_OF);
+- }
+- }
+- return (u16)res;
++ /* rotate right through carry */
++ res = d;
++ if ((cnt = s % 17) != 0) {
++ if (cnt == 1) {
++ cf = d & 0x1;
++ ocf = ACCESS_FLAG(F_CF) != 0;
++ }
++ else
++ cf = (d >> (cnt - 1)) & 0x1;
++ mask = (1 << (16 - cnt)) - 1;
++ res = (d >> cnt) & mask;
++ res |= (d << (17 - cnt));
++ if (ACCESS_FLAG(F_CF)) {
++ res |= 1 << (16 - cnt);
++ }
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)), F_OF);
++ }
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the RCR instruction and side effects.
+ ****************************************************************************/
+-u32 rcr_long(u32 d, u8 s)
+-{
+- u32 res, cnt;
+- u32 mask, cf, ocf = 0;
+-
+- /* rotate right through carry */
+- res = d;
+- if ((cnt = s % 33) != 0) {
+- if (cnt == 1) {
+- cf = d & 0x1;
+- ocf = ACCESS_FLAG(F_CF) != 0;
+- } else
+- cf = (d >> (cnt - 1)) & 0x1;
+- mask = (1 << (32 - cnt)) - 1;
+- res = (d >> cnt) & mask;
+- if (cnt != 1)
+- res |= (d << (33 - cnt));
+- if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+- res |= 1 << (32 - cnt);
+- }
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)),
+- F_OF);
+- }
+- }
+- return res;
++u32
++rcr_long(u32 d, u8 s)
++{
++ u32 res, cnt;
++ u32 mask, cf, ocf = 0;
++
++ /* rotate right through carry */
++ res = d;
++ if ((cnt = s % 33) != 0) {
++ if (cnt == 1) {
++ cf = d & 0x1;
++ ocf = ACCESS_FLAG(F_CF) != 0;
++ }
++ else
++ cf = (d >> (cnt - 1)) & 0x1;
++ mask = (1 << (32 - cnt)) - 1;
++ res = (d >> cnt) & mask;
++ if (cnt != 1)
++ res |= (d << (33 - cnt));
++ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
++ res |= 1 << (32 - cnt);
++ }
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)), F_OF);
++ }
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROL instruction and side effects.
+ ****************************************************************************/
+-u8 rol_byte(u8 d, u8 s)
++u8
++rol_byte(u8 d, u8 s)
+ {
+ register unsigned int res, cnt, mask;
+
+@@ -1121,87 +1168,90 @@ u8 rol_byte(u8 d, u8 s)
+ IF n > 0
+ 1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0)
+ 2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n)
+- */
++ */
+ res = d;
+- if ((cnt = s % 8) != 0) {
+- /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
+- res = (d << cnt);
++ if ((cnt = s % 8) != 0) {
++ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
++ res = (d << cnt);
+
+- /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
+- mask = (1 << cnt) - 1;
+- res |= (d >> (8 - cnt)) & mask;
++ /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
++ mask = (1 << cnt) - 1;
++ res |= (d >> (8 - cnt)) & mask;
+
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- /* OVERFLOW is set *IFF* s==1, then it is the
+- xor of CF and the most significant bit. Blecck. */
+- CONDITIONAL_SET_FLAG(s == 1 &&
+- XOR2((res & 0x1) + ((res >> 6) & 0x2)),
+- F_OF);
+- } if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- }
+- return (u8)res;
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ /* OVERFLOW is set *IFF* s==1, then it is the
++ xor of CF and the most significant bit. Blecck. */
++ CONDITIONAL_SET_FLAG(s == 1 &&
++ XOR2((res & 0x1) + ((res >> 6) & 0x2)), F_OF);
++ }
++ if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROL instruction and side effects.
+ ****************************************************************************/
+-u16 rol_word(u16 d, u8 s)
++u16
++rol_word(u16 d, u8 s)
+ {
+ register unsigned int res, cnt, mask;
+
+- res = d;
+- if ((cnt = s % 16) != 0) {
+- res = (d << cnt);
+- mask = (1 << cnt) - 1;
+- res |= (d >> (16 - cnt)) & mask;
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- CONDITIONAL_SET_FLAG(s == 1 &&
+- XOR2((res & 0x1) + ((res >> 14) & 0x2)),
+- F_OF);
+- } if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- }
+- return (u16)res;
++ res = d;
++ if ((cnt = s % 16) != 0) {
++ res = (d << cnt);
++ mask = (1 << cnt) - 1;
++ res |= (d >> (16 - cnt)) & mask;
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ CONDITIONAL_SET_FLAG(s == 1 &&
++ XOR2((res & 0x1) + ((res >> 14) & 0x2)), F_OF);
++ }
++ if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROL instruction and side effects.
+ ****************************************************************************/
+-u32 rol_long(u32 d, u8 s)
++u32
++rol_long(u32 d, u8 s)
+ {
+ register u32 res, cnt, mask;
+
+- res = d;
+- if ((cnt = s % 32) != 0) {
+- res = (d << cnt);
+- mask = (1 << cnt) - 1;
+- res |= (d >> (32 - cnt)) & mask;
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- CONDITIONAL_SET_FLAG(s == 1 &&
+- XOR2((res & 0x1) + ((res >> 30) & 0x2)),
+- F_OF);
+- } if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+- }
+- return res;
++ res = d;
++ if ((cnt = s % 32) != 0) {
++ res = (d << cnt);
++ mask = (1 << cnt) - 1;
++ res |= (d >> (32 - cnt)) & mask;
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ CONDITIONAL_SET_FLAG(s == 1 &&
++ XOR2((res & 0x1) + ((res >> 30) & 0x2)), F_OF);
++ }
++ if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROR instruction and side effects.
+ ****************************************************************************/
+-u8 ror_byte(u8 d, u8 s)
++u8
++ror_byte(u8 d, u8 s)
+ {
+ register unsigned int res, cnt, mask;
+
+@@ -1219,9 +1269,9 @@ u8 ror_byte(u8 d, u8 s)
+ IF n > 0
+ 1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
+ 2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0)
+- */
+- res = d;
+- if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
++ */
++ res = d;
++ if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
+ /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
+ res = (d << (8 - cnt));
+
+@@ -1231,291 +1281,317 @@ u8 ror_byte(u8 d, u8 s)
+
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+- /* OVERFLOW is set *IFF* s==1, then it is the
++ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
++ /* OVERFLOW is set *IFF* s==1, then it is the
+ xor of the two most significant bits. Blecck. */
+- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
+- } else if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+- }
+- return (u8)res;
++ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
++ }
++ else if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROR instruction and side effects.
+ ****************************************************************************/
+-u16 ror_word(u16 d, u8 s)
++u16
++ror_word(u16 d, u8 s)
+ {
+ register unsigned int res, cnt, mask;
+
+- res = d;
+- if ((cnt = s % 16) != 0) {
+- res = (d << (16 - cnt));
+- mask = (1 << (16 - cnt)) - 1;
+- res |= (d >> (cnt)) & mask;
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
+- } else if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+- }
+- return (u16)res;
++ res = d;
++ if ((cnt = s % 16) != 0) {
++ res = (d << (16 - cnt));
++ mask = (1 << (16 - cnt)) - 1;
++ res |= (d >> (cnt)) & mask;
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
++ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
++ }
++ else if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the ROR instruction and side effects.
+ ****************************************************************************/
+-u32 ror_long(u32 d, u8 s)
++u32
++ror_long(u32 d, u8 s)
+ {
+- register u32 res, cnt, mask;
++ register u32 res, cnt, mask;
+
+- res = d;
+- if ((cnt = s % 32) != 0) {
+- res = (d << (32 - cnt));
+- mask = (1 << (32 - cnt)) - 1;
+- res |= (d >> (cnt)) & mask;
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+- CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
+- } else if (s != 0) {
+- /* set the new carry flag, Note that it is the low order
+- bit of the result!!! */
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+- }
+- return res;
++ res = d;
++ if ((cnt = s % 32) != 0) {
++ res = (d << (32 - cnt));
++ mask = (1 << (32 - cnt)) - 1;
++ res |= (d >> (cnt)) & mask;
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
++ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
++ }
++ else if (s != 0) {
++ /* set the new carry flag, Note that it is the low order
++ bit of the result!!! */
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHL instruction and side effects.
+ ****************************************************************************/
+-u8 shl_byte(u8 d, u8 s)
++u8
++shl_byte(u8 d, u8 s)
+ {
+- unsigned int cnt, res, cf;
+-
+- if (s < 8) {
+- cnt = s % 8;
++ unsigned int cnt, res, cf;
+
+- /* last bit shifted out goes into carry flag */
+- if (cnt > 0) {
+- res = d << cnt;
+- cf = d & (1 << (8 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = (u8) d;
+- }
++ if (s < 8) {
++ cnt = s % 8;
++
++ /* last bit shifted out goes into carry flag */
++ if (cnt > 0) {
++ res = d << cnt;
++ cf = d & (1 << (8 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = (u8) d;
++ }
+
+- if (cnt == 1) {
+- /* Needs simplification. */
+- CONDITIONAL_SET_FLAG(
+- (((res & 0x80) == 0x80) ^
+- (ACCESS_FLAG(F_CF) != 0)),
+- /* was (M.x86.R_FLG&F_CF)==F_CF)), */
+- F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
++ if (cnt == 1) {
++ /* Needs simplification. */
++ CONDITIONAL_SET_FLAG((((res & 0x80) == 0x80) ^
++ (ACCESS_FLAG(F_CF) != 0)),
++ /* was (M.x86.R_FLG&F_CF)==F_CF)), */
++ F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
+ }
+- return (u8)res;
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHL instruction and side effects.
+ ****************************************************************************/
+-u16 shl_word(u16 d, u8 s)
++u16
++shl_word(u16 d, u8 s)
+ {
+ unsigned int cnt, res, cf;
+
+- if (s < 16) {
+- cnt = s % 16;
+- if (cnt > 0) {
+- res = d << cnt;
+- cf = d & (1 << (16 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = (u16) d;
+- }
+-
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(
+- (((res & 0x8000) == 0x8000) ^
+- (ACCESS_FLAG(F_CF) != 0)),
+- F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
+- }
+- return (u16)res;
++ if (s < 16) {
++ cnt = s % 16;
++ if (cnt > 0) {
++ res = d << cnt;
++ cf = d & (1 << (16 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = (u16) d;
++ }
++
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
++ (ACCESS_FLAG(F_CF) != 0)), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHL instruction and side effects.
+ ****************************************************************************/
+-u32 shl_long(u32 d, u8 s)
+-{
+- unsigned int cnt, res, cf;
+-
+- if (s < 32) {
+- cnt = s % 32;
+- if (cnt > 0) {
+- res = d << cnt;
+- cf = d & (1 << (32 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+- (ACCESS_FLAG(F_CF) != 0)), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
+- }
+- return res;
++u32
++shl_long(u32 d, u8 s)
++{
++ unsigned int cnt, res, cf;
++
++ if (s < 32) {
++ cnt = s % 32;
++ if (cnt > 0) {
++ res = d << cnt;
++ cf = d & (1 << (32 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
++ (ACCESS_FLAG(F_CF) != 0)), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHR instruction and side effects.
+ ****************************************************************************/
+-u8 shr_byte(u8 d, u8 s)
+-{
+- unsigned int cnt, res, cf;
+-
+- if (s < 8) {
+- cnt = s % 8;
+- if (cnt > 0) {
+- cf = d & (1 << (cnt - 1));
+- res = d >> cnt;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = (u8) d;
+- }
+-
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d >> (s-1)) & 0x1, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
+- }
+- return (u8)res;
++u8
++shr_byte(u8 d, u8 s)
++{
++ unsigned int cnt, res, cf;
++
++ if (s < 8) {
++ cnt = s % 8;
++ if (cnt > 0) {
++ cf = d & (1 << (cnt - 1));
++ res = d >> cnt;
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = (u8) d;
++ }
++
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d >> (s - 1)) & 0x1, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHR instruction and side effects.
+ ****************************************************************************/
+-u16 shr_word(u16 d, u8 s)
++u16
++shr_word(u16 d, u8 s)
+ {
+- unsigned int cnt, res, cf;
++ unsigned int cnt, res, cf;
+
+- if (s < 16) {
+- cnt = s % 16;
+- if (cnt > 0) {
+- cf = d & (1 << (cnt - 1));
+- res = d >> cnt;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
++ if (s < 16) {
++ cnt = s % 16;
++ if (cnt > 0) {
++ cf = d & (1 << (cnt - 1));
++ res = d >> cnt;
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
+
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+ }
+- } else {
+- res = 0;
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
+ }
+- return (u16)res;
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHR instruction and side effects.
+ ****************************************************************************/
+-u32 shr_long(u32 d, u8 s)
++u32
++shr_long(u32 d, u8 s)
+ {
+- unsigned int cnt, res, cf;
++ unsigned int cnt, res, cf;
+
+- if (s < 32) {
+- cnt = s % 32;
+- if (cnt > 0) {
+- cf = d & (1 << (cnt - 1));
+- res = d >> cnt;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
++ if (s < 32) {
++ cnt = s % 32;
++ if (cnt > 0) {
++ cf = d & (1 << (cnt - 1));
++ res = d >> cnt;
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
+ res = d;
+ }
+ if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
+ }
+- } else {
++ }
++ else {
+ res = 0;
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
+ }
+ return res;
+ }
+@@ -1524,592 +1600,634 @@ u32 shr_long(u32 d, u8 s)
+ REMARKS:
+ Implements the SAR instruction and side effects.
+ ****************************************************************************/
+-u8 sar_byte(u8 d, u8 s)
++u8
++sar_byte(u8 d, u8 s)
+ {
+- unsigned int cnt, res, cf, mask, sf;
++ unsigned int cnt, res, cf, mask, sf;
+
+- res = d;
+- sf = d & 0x80;
++ res = d;
++ sf = d & 0x80;
+ cnt = s % 8;
+- if (cnt > 0 && cnt < 8) {
+- mask = (1 << (8 - cnt)) - 1;
+- cf = d & (1 << (cnt - 1));
+- res = (d >> cnt) & mask;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- if (sf) {
+- res |= ~mask;
+- }
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- } else if (cnt >= 8) {
++ if (cnt > 0 && cnt < 8) {
++ mask = (1 << (8 - cnt)) - 1;
++ cf = d & (1 << (cnt - 1));
++ res = (d >> cnt) & mask;
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ if (sf) {
++ res |= ~mask;
++ }
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ }
++ else if (cnt >= 8) {
+ if (sf) {
+ res = 0xff;
+- SET_FLAG(F_CF);
+- CLEAR_FLAG(F_ZF);
+- SET_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- } else {
+- res = 0;
+- CLEAR_FLAG(F_CF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
+- }
+- }
+- return (u8)res;
++ SET_FLAG(F_CF);
++ CLEAR_FLAG(F_ZF);
++ SET_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ }
++ else {
++ res = 0;
++ CLEAR_FLAG(F_CF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
++ }
++ }
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SAR instruction and side effects.
+ ****************************************************************************/
+-u16 sar_word(u16 d, u8 s)
++u16
++sar_word(u16 d, u8 s)
+ {
+ unsigned int cnt, res, cf, mask, sf;
+
+ sf = d & 0x8000;
+ cnt = s % 16;
+- res = d;
+- if (cnt > 0 && cnt < 16) {
++ res = d;
++ if (cnt > 0 && cnt < 16) {
+ mask = (1 << (16 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else if (cnt >= 16) {
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else if (cnt >= 16) {
+ if (sf) {
+ res = 0xffff;
+- SET_FLAG(F_CF);
+- CLEAR_FLAG(F_ZF);
+- SET_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- } else {
++ SET_FLAG(F_CF);
++ CLEAR_FLAG(F_ZF);
++ SET_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ }
++ else {
+ res = 0;
+- CLEAR_FLAG(F_CF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
++ CLEAR_FLAG(F_CF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
+ }
+ }
+- return (u16)res;
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SAR instruction and side effects.
+ ****************************************************************************/
+-u32 sar_long(u32 d, u8 s)
++u32
++sar_long(u32 d, u8 s)
+ {
+ u32 cnt, res, cf, mask, sf;
+
+ sf = d & 0x80000000;
+ cnt = s % 32;
+- res = d;
+- if (cnt > 0 && cnt < 32) {
++ res = d;
++ if (cnt > 0 && cnt < 32) {
+ mask = (1 << (32 - cnt)) - 1;
+- cf = d & (1 << (cnt - 1));
++ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+- CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else if (cnt >= 32) {
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else if (cnt >= 32) {
+ if (sf) {
+ res = 0xffffffff;
+- SET_FLAG(F_CF);
+- CLEAR_FLAG(F_ZF);
+- SET_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- } else {
+- res = 0;
+- CLEAR_FLAG(F_CF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
+- }
+- }
+- return res;
++ SET_FLAG(F_CF);
++ CLEAR_FLAG(F_ZF);
++ SET_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ }
++ else {
++ res = 0;
++ CLEAR_FLAG(F_CF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
++ }
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHLD instruction and side effects.
+ ****************************************************************************/
+-u16 shld_word (u16 d, u16 fill, u8 s)
+-{
+- unsigned int cnt, res, cf;
+-
+- if (s < 16) {
+- cnt = s % 16;
+- if (cnt > 0) {
+- res = (d << cnt) | (fill >> (16-cnt));
+- cf = d & (1 << (16 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
+- (ACCESS_FLAG(F_CF) != 0)), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
+- }
+- return (u16)res;
++u16
++shld_word(u16 d, u16 fill, u8 s)
++{
++ unsigned int cnt, res, cf;
++
++ if (s < 16) {
++ cnt = s % 16;
++ if (cnt > 0) {
++ res = (d << cnt) | (fill >> (16 - cnt));
++ cf = d & (1 << (16 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
++ (ACCESS_FLAG(F_CF) != 0)), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x8000, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHLD instruction and side effects.
+ ****************************************************************************/
+-u32 shld_long (u32 d, u32 fill, u8 s)
+-{
+- unsigned int cnt, res, cf;
+-
+- if (s < 32) {
+- cnt = s % 32;
+- if (cnt > 0) {
+- res = (d << cnt) | (fill >> (32-cnt));
+- cf = d & (1 << (32 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+- (ACCESS_FLAG(F_CF) != 0)), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
+- }
+- } else {
+- res = 0;
+- CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
+- CLEAR_FLAG(F_OF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_PF);
+- SET_FLAG(F_ZF);
+- }
+- return res;
++u32
++shld_long(u32 d, u32 fill, u8 s)
++{
++ unsigned int cnt, res, cf;
++
++ if (s < 32) {
++ cnt = s % 32;
++ if (cnt > 0) {
++ res = (d << cnt) | (fill >> (32 - cnt));
++ cf = d & (1 << (32 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
++ (ACCESS_FLAG(F_CF) != 0)), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
++ }
++ }
++ else {
++ res = 0;
++ CONDITIONAL_SET_FLAG((d << (s - 1)) & 0x80000000, F_CF);
++ CLEAR_FLAG(F_OF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_PF);
++ SET_FLAG(F_ZF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHRD instruction and side effects.
+ ****************************************************************************/
+-u16 shrd_word (u16 d, u16 fill, u8 s)
++u16
++shrd_word(u16 d, u16 fill, u8 s)
+ {
+- unsigned int cnt, res, cf;
++ unsigned int cnt, res, cf;
+
+- if (s < 16) {
+- cnt = s % 16;
+- if (cnt > 0) {
+- cf = d & (1 << (cnt - 1));
+- res = (d >> cnt) | (fill << (16 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
++ if (s < 16) {
++ cnt = s % 16;
++ if (cnt > 0) {
++ cf = d & (1 << (cnt - 1));
++ res = (d >> cnt) | (fill << (16 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
+
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
+ }
+- } else {
+- res = 0;
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
+ }
+- return (u16)res;
++ else {
++ res = 0;
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
++ }
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SHRD instruction and side effects.
+ ****************************************************************************/
+-u32 shrd_long (u32 d, u32 fill, u8 s)
++u32
++shrd_long(u32 d, u32 fill, u8 s)
+ {
+- unsigned int cnt, res, cf;
++ unsigned int cnt, res, cf;
+
+- if (s < 32) {
+- cnt = s % 32;
+- if (cnt > 0) {
+- cf = d & (1 << (cnt - 1));
+- res = (d >> cnt) | (fill << (32 - cnt));
+- CONDITIONAL_SET_FLAG(cf, F_CF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- } else {
+- res = d;
+- }
+- if (cnt == 1) {
+- CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+- } else {
+- CLEAR_FLAG(F_OF);
++ if (s < 32) {
++ cnt = s % 32;
++ if (cnt > 0) {
++ cf = d & (1 << (cnt - 1));
++ res = (d >> cnt) | (fill << (32 - cnt));
++ CONDITIONAL_SET_FLAG(cf, F_CF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ }
++ else {
++ res = d;
++ }
++ if (cnt == 1) {
++ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
++ }
++ else {
++ CLEAR_FLAG(F_OF);
+ }
+- } else {
+- res = 0;
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- SET_FLAG(F_ZF);
+- CLEAR_FLAG(F_SF);
+- CLEAR_FLAG(F_PF);
+ }
+- return res;
++ else {
++ res = 0;
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ SET_FLAG(F_ZF);
++ CLEAR_FLAG(F_SF);
++ CLEAR_FLAG(F_PF);
++ }
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SBB instruction and side effects.
+ ****************************************************************************/
+-u8 sbb_byte(u8 d, u8 s)
++u8
++sbb_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+- if (ACCESS_FLAG(F_CF))
+- res = d - s - 1;
+- else
+- res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ if (ACCESS_FLAG(F_CF))
++ res = d - s - 1;
++ else
++ res = d - s;
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SBB instruction and side effects.
+ ****************************************************************************/
+-u16 sbb_word(u16 d, u16 s)
++u16
++sbb_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+- if (ACCESS_FLAG(F_CF))
++ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u16)res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SBB instruction and side effects.
+ ****************************************************************************/
+-u32 sbb_long(u32 d, u32 s)
++u32
++sbb_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- if (ACCESS_FLAG(F_CF))
++ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SUB instruction and side effects.
+ ****************************************************************************/
+-u8 sub_byte(u8 d, u8 s)
++u8
++sub_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d - s;
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u8)res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u8) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SUB instruction and side effects.
+ ****************************************************************************/
+-u16 sub_word(u16 d, u16 s)
++u16
++sub_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return (u16)res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return (u16) res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the SUB instruction and side effects.
+ ****************************************************************************/
+-u32 sub_long(u32 d, u32 s)
++u32
++sub_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
+- register u32 bc;
++ register u32 res; /* all operands in native machine order */
++ register u32 bc;
+
+- res = d - s;
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ res = d - s;
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+- /* calculate the borrow chain. See note at top */
+- bc = (res & (~d | s)) | (~d & s);
+- CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+- CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+- CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+- return res;
++ /* calculate the borrow chain. See note at top */
++ bc = (res & (~d | s)) | (~d & s);
++ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
++ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
++ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the TEST instruction and side effects.
+ ****************************************************************************/
+-void test_byte(u8 d, u8 s)
++void
++test_byte(u8 d, u8 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+ res = d & s;
+
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+- CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_CF);
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the TEST instruction and side effects.
+ ****************************************************************************/
+-void test_word(u16 d, u16 s)
++void
++test_word(u16 d, u16 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+- res = d & s;
++ res = d & s;
+
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- /* AF == dont care */
+- CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ /* AF == dont care */
++ CLEAR_FLAG(F_CF);
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the TEST instruction and side effects.
+ ****************************************************************************/
+-void test_long(u32 d, u32 s)
++void
++test_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+- res = d & s;
++ res = d & s;
+
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- /* AF == dont care */
+- CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ /* AF == dont care */
++ CLEAR_FLAG(F_CF);
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the XOR instruction and side effects.
+ ****************************************************************************/
+-u8 xor_byte(u8 d, u8 s)
++u8
++xor_byte(u8 d, u8 s)
+ {
+- register u8 res; /* all operands in native machine order */
++ register u8 res; /* all operands in native machine order */
+
+- res = d ^ s;
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- return res;
++ res = d ^ s;
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the XOR instruction and side effects.
+ ****************************************************************************/
+-u16 xor_word(u16 d, u16 s)
++u16
++xor_word(u16 d, u16 s)
+ {
+- register u16 res; /* all operands in native machine order */
++ register u16 res; /* all operands in native machine order */
+
+- res = d ^ s;
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- return res;
++ res = d ^ s;
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the XOR instruction and side effects.
+ ****************************************************************************/
+-u32 xor_long(u32 d, u32 s)
++u32
++xor_long(u32 d, u32 s)
+ {
+- register u32 res; /* all operands in native machine order */
++ register u32 res; /* all operands in native machine order */
+
+- res = d ^ s;
+- CLEAR_FLAG(F_OF);
+- CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+- CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- return res;
++ res = d ^ s;
++ CLEAR_FLAG(F_OF);
++ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
++ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ return res;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IMUL instruction and side effects.
+ ****************************************************************************/
+-void imul_byte(u8 s)
++void
++imul_byte(u8 s)
+ {
+- s16 res = (s16)((s8)M.x86.R_AL * (s8)s);
++ s16 res = (s16) ((s8) M.x86.R_AL * (s8) s);
+
+- M.x86.R_AX = res;
+- if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
+- ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
+- }
++ M.x86.R_AX = res;
++ if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
++ ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
++ }
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IMUL instruction and side effects.
+ ****************************************************************************/
+-void imul_word(u16 s)
++void
++imul_word(u16 s)
+ {
+- s32 res = (s16)M.x86.R_AX * (s16)s;
++ s32 res = (s16) M.x86.R_AX * (s16) s;
+
+- M.x86.R_AX = (u16)res;
+- M.x86.R_DX = (u16)(res >> 16);
+- if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
+- ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
+- }
++ M.x86.R_AX = (u16) res;
++ M.x86.R_DX = (u16) (res >> 16);
++ if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
++ ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
++ }
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IMUL instruction and side effects.
+ ****************************************************************************/
+-void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
++void
++imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s)
+ {
+ #ifdef __HAS_LONG_LONG__
+- s64 res = (s32)d * (s32)s;
++ s64 res = (s64) (s32) d * (s32) s;
+
+- *res_lo = (u32)res;
+- *res_hi = (u32)(res >> 32);
++ *res_lo = (u32) res;
++ *res_hi = (u32) (res >> 32);
+ #else
+- u32 d_lo,d_hi,d_sign;
+- u32 s_lo,s_hi,s_sign;
+- u32 rlo_lo,rlo_hi,rhi_lo;
+-
+- if ((d_sign = d & 0x80000000) != 0)
+- d = -d;
+- d_lo = d & 0xFFFF;
+- d_hi = d >> 16;
+- if ((s_sign = s & 0x80000000) != 0)
+- s = -s;
+- s_lo = s & 0xFFFF;
+- s_hi = s >> 16;
+- rlo_lo = d_lo * s_lo;
+- rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
+- rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
+- *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+- *res_hi = rhi_lo;
+- if (d_sign != s_sign) {
+- d = ~*res_lo;
+- s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
+- *res_lo = ~*res_lo+1;
+- *res_hi = ~*res_hi+(s >> 16);
+- }
++ u32 d_lo, d_hi, d_sign;
++ u32 s_lo, s_hi, s_sign;
++ u32 rlo_lo, rlo_hi, rhi_lo;
++
++ if ((d_sign = d & 0x80000000) != 0)
++ d = -d;
++ d_lo = d & 0xFFFF;
++ d_hi = d >> 16;
++ if ((s_sign = s & 0x80000000) != 0)
++ s = -s;
++ s_lo = s & 0xFFFF;
++ s_hi = s >> 16;
++ rlo_lo = d_lo * s_lo;
++ rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
++ rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
++ *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
++ *res_hi = rhi_lo;
++ if (d_sign != s_sign) {
++ d = ~*res_lo;
++ s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
++ *res_lo = ~*res_lo + 1;
++ *res_hi = ~*res_hi + (s >> 16);
++ }
+ #endif
+ }
+
+@@ -2117,53 +2235,59 @@ void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
+ REMARKS:
+ Implements the IMUL instruction and side effects.
+ ****************************************************************************/
+-void imul_long(u32 s)
++void
++imul_long(u32 s)
+ {
+- imul_long_direct(&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s);
+- if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
+- ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
+- }
++ imul_long_direct(&M.x86.R_EAX, &M.x86.R_EDX, M.x86.R_EAX, s);
++ if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
++ ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
++ }
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the MUL instruction and side effects.
+ ****************************************************************************/
+-void mul_byte(u8 s)
++void
++mul_byte(u8 s)
+ {
+- u16 res = (u16)(M.x86.R_AL * s);
++ u16 res = (u16) (M.x86.R_AL * s);
+
+- M.x86.R_AX = res;
+- if (M.x86.R_AH == 0) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
+- }
++ M.x86.R_AX = res;
++ if (M.x86.R_AH == 0) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
++ }
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the MUL instruction and side effects.
+ ****************************************************************************/
+-void mul_word(u16 s)
++void
++mul_word(u16 s)
+ {
+- u32 res = M.x86.R_AX * s;
++ u32 res = M.x86.R_AX * s;
+
+- M.x86.R_AX = (u16)res;
+- M.x86.R_DX = (u16)(res >> 16);
+- if (M.x86.R_DX == 0) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
++ M.x86.R_AX = (u16) res;
++ M.x86.R_DX = (u16) (res >> 16);
++ if (M.x86.R_DX == 0) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
+ }
+ }
+
+@@ -2171,36 +2295,38 @@ void mul_word(u16 s)
+ REMARKS:
+ Implements the MUL instruction and side effects.
+ ****************************************************************************/
+-void mul_long(u32 s)
++void
++mul_long(u32 s)
+ {
+ #ifdef __HAS_LONG_LONG__
+- u64 res = (u32)M.x86.R_EAX * (u32)s;
++ u64 res = (u64) M.x86.R_EAX * s;
+
+- M.x86.R_EAX = (u32)res;
+- M.x86.R_EDX = (u32)(res >> 32);
++ M.x86.R_EAX = (u32) res;
++ M.x86.R_EDX = (u32) (res >> 32);
+ #else
+- u32 a,a_lo,a_hi;
+- u32 s_lo,s_hi;
+- u32 rlo_lo,rlo_hi,rhi_lo;
+-
+- a = M.x86.R_EAX;
+- a_lo = a & 0xFFFF;
+- a_hi = a >> 16;
+- s_lo = s & 0xFFFF;
+- s_hi = s >> 16;
+- rlo_lo = a_lo * s_lo;
+- rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
+- rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
+- M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+- M.x86.R_EDX = rhi_lo;
++ u32 a, a_lo, a_hi;
++ u32 s_lo, s_hi;
++ u32 rlo_lo, rlo_hi, rhi_lo;
++
++ a = M.x86.R_EAX;
++ a_lo = a & 0xFFFF;
++ a_hi = a >> 16;
++ s_lo = s & 0xFFFF;
++ s_hi = s >> 16;
++ rlo_lo = a_lo * s_lo;
++ rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
++ rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
++ M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
++ M.x86.R_EDX = rhi_lo;
+ #endif
+
+- if (M.x86.R_EDX == 0) {
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_OF);
+- } else {
+- SET_FLAG(F_CF);
+- SET_FLAG(F_OF);
++ if (M.x86.R_EDX == 0) {
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_OF);
++ }
++ else {
++ SET_FLAG(F_CF);
++ SET_FLAG(F_OF);
+ }
+ }
+
+@@ -2208,309 +2334,319 @@ void mul_long(u32 s)
+ REMARKS:
+ Implements the IDIV instruction and side effects.
+ ****************************************************************************/
+-void idiv_byte(u8 s)
++void
++idiv_byte(u8 s)
+ {
+ s32 dvd, div, mod;
+
+- dvd = (s16)M.x86.R_AX;
+- if (s == 0) {
+- x86emu_intr_raise(0);
++ dvd = (s16) M.x86.R_AX;
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ div = dvd / (s8) s;
++ mod = dvd % (s8) s;
++ if (abs(div) > 0x7f) {
++ x86emu_intr_raise(0);
+ return;
+- }
+- div = dvd / (s8)s;
+- mod = dvd % (s8)s;
+- if (abs(div) > 0x7f) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- M.x86.R_AL = (s8) div;
+- M.x86.R_AH = (s8) mod;
++ }
++ M.x86.R_AL = (s8) div;
++ M.x86.R_AH = (s8) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IDIV instruction and side effects.
+ ****************************************************************************/
+-void idiv_word(u16 s)
++void
++idiv_word(u16 s)
+ {
+- s32 dvd, div, mod;
++ s32 dvd, div, mod;
+
+- dvd = (((s32)M.x86.R_DX) << 16) | M.x86.R_AX;
+- if (s == 0) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- div = dvd / (s16)s;
+- mod = dvd % (s16)s;
+- if (abs(div) > 0x7fff) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_SF);
+- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
++ dvd = (((s32) M.x86.R_DX) << 16) | M.x86.R_AX;
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ div = dvd / (s16) s;
++ mod = dvd % (s16) s;
++ if (abs(div) > 0x7fff) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_SF);
++ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+- M.x86.R_AX = (u16)div;
+- M.x86.R_DX = (u16)mod;
++ M.x86.R_AX = (u16) div;
++ M.x86.R_DX = (u16) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IDIV instruction and side effects.
+ ****************************************************************************/
+-void idiv_long(u32 s)
++void
++idiv_long(u32 s)
+ {
+ #ifdef __HAS_LONG_LONG__
+- s64 dvd, div, mod;
+-
+- dvd = (((s64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
+- if (s == 0) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- div = dvd / (s32)s;
+- mod = dvd % (s32)s;
+- if (abs(div) > 0x7fffffff) {
+- x86emu_intr_raise(0);
+- return;
+- }
++ s64 dvd, div, mod;
++
++ dvd = (((s64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ div = dvd / (s32) s;
++ mod = dvd % (s32) s;
++ if (abs(div) > 0x7fffffff) {
++ x86emu_intr_raise(0);
++ return;
++ }
+ #else
+- s32 div = 0, mod;
+- s32 h_dvd = M.x86.R_EDX;
+- u32 l_dvd = M.x86.R_EAX;
+- u32 abs_s = s & 0x7FFFFFFF;
+- u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
+- u32 h_s = abs_s >> 1;
+- u32 l_s = abs_s << 31;
+- int counter = 31;
+- int carry;
+-
+- if (s == 0) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- do {
+- div <<= 1;
+- carry = (l_dvd >= l_s) ? 0 : 1;
+-
+- if (abs_h_dvd < (h_s + carry)) {
+- h_s >>= 1;
+- l_s = abs_s << (--counter);
+- continue;
+- } else {
+- abs_h_dvd -= (h_s + carry);
+- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+- : (l_dvd - l_s);
+- h_s >>= 1;
+- l_s = abs_s << (--counter);
+- div |= 1;
+- continue;
+- }
+-
+- } while (counter > -1);
+- /* overflow */
+- if (abs_h_dvd || (l_dvd > abs_s)) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- /* sign */
+- div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
+- mod = l_dvd;
++ s32 div = 0, mod;
++ s32 h_dvd = M.x86.R_EDX;
++ u32 l_dvd = M.x86.R_EAX;
++ u32 abs_s = s & 0x7FFFFFFF;
++ u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
++ u32 h_s = abs_s >> 1;
++ u32 l_s = abs_s << 31;
++ int counter = 31;
++ int carry;
++
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ do {
++ div <<= 1;
++ carry = (l_dvd >= l_s) ? 0 : 1;
++
++ if (abs_h_dvd < (h_s + carry)) {
++ h_s >>= 1;
++ l_s = abs_s << (--counter);
++ continue;
++ }
++ else {
++ abs_h_dvd -= (h_s + carry);
++ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
++ : (l_dvd - l_s);
++ h_s >>= 1;
++ l_s = abs_s << (--counter);
++ div |= 1;
++ continue;
++ }
++
++ } while (counter > -1);
++ /* overflow */
++ if (abs_h_dvd || (l_dvd > abs_s)) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ /* sign */
++ div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
++ mod = l_dvd;
+
+ #endif
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+- M.x86.R_EAX = (u32)div;
+- M.x86.R_EDX = (u32)mod;
++ M.x86.R_EAX = (u32) div;
++ M.x86.R_EDX = (u32) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DIV instruction and side effects.
+ ****************************************************************************/
+-void div_byte(u8 s)
++void
++div_byte(u8 s)
+ {
+- u32 dvd, div, mod;
++ u32 dvd, div, mod;
+
+- dvd = M.x86.R_AX;
++ dvd = M.x86.R_AX;
+ if (s == 0) {
+- x86emu_intr_raise(0);
++ x86emu_intr_raise(0);
+ return;
+ }
+- div = dvd / (u8)s;
+- mod = dvd % (u8)s;
+- if (abs(div) > 0xff) {
+- x86emu_intr_raise(0);
++ div = dvd / (u8) s;
++ mod = dvd % (u8) s;
++ if (abs(div) > 0xff) {
++ x86emu_intr_raise(0);
+ return;
+- }
+- M.x86.R_AL = (u8)div;
+- M.x86.R_AH = (u8)mod;
++ }
++ M.x86.R_AL = (u8) div;
++ M.x86.R_AH = (u8) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DIV instruction and side effects.
+ ****************************************************************************/
+-void div_word(u16 s)
++void
++div_word(u16 s)
+ {
+- u32 dvd, div, mod;
++ u32 dvd, div, mod;
+
+- dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX;
+- if (s == 0) {
+- x86emu_intr_raise(0);
++ dvd = (((u32) M.x86.R_DX) << 16) | M.x86.R_AX;
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ div = dvd / (u16) s;
++ mod = dvd % (u16) s;
++ if (abs(div) > 0xffff) {
++ x86emu_intr_raise(0);
+ return;
+ }
+- div = dvd / (u16)s;
+- mod = dvd % (u16)s;
+- if (abs(div) > 0xffff) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_SF);
+- CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_SF);
++ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+- M.x86.R_AX = (u16)div;
+- M.x86.R_DX = (u16)mod;
++ M.x86.R_AX = (u16) div;
++ M.x86.R_DX = (u16) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the DIV instruction and side effects.
+ ****************************************************************************/
+-void div_long(u32 s)
++void
++div_long(u32 s)
+ {
+ #ifdef __HAS_LONG_LONG__
+- u64 dvd, div, mod;
+-
+- dvd = (((u64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
+- if (s == 0) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- div = dvd / (u32)s;
+- mod = dvd % (u32)s;
+- if (abs(div) > 0xffffffff) {
+- x86emu_intr_raise(0);
+- return;
+- }
++ u64 dvd, div, mod;
++
++ dvd = (((u64) M.x86.R_EDX) << 32) | M.x86.R_EAX;
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ div = dvd / (u32) s;
++ mod = dvd % (u32) s;
++ if (abs(div) > 0xffffffff) {
++ x86emu_intr_raise(0);
++ return;
++ }
+ #else
+- s32 div = 0, mod;
+- s32 h_dvd = M.x86.R_EDX;
+- u32 l_dvd = M.x86.R_EAX;
+-
+- u32 h_s = s;
+- u32 l_s = 0;
+- int counter = 32;
+- int carry;
+-
+- if (s == 0) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- do {
+- div <<= 1;
+- carry = (l_dvd >= l_s) ? 0 : 1;
+-
+- if (h_dvd < (h_s + carry)) {
+- h_s >>= 1;
+- l_s = s << (--counter);
+- continue;
+- } else {
+- h_dvd -= (h_s + carry);
+- l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+- : (l_dvd - l_s);
+- h_s >>= 1;
+- l_s = s << (--counter);
+- div |= 1;
+- continue;
+- }
+-
+- } while (counter > -1);
+- /* overflow */
+- if (h_dvd || (l_dvd > s)) {
+- x86emu_intr_raise(0);
+- return;
+- }
+- mod = l_dvd;
++ s32 div = 0, mod;
++ s32 h_dvd = M.x86.R_EDX;
++ u32 l_dvd = M.x86.R_EAX;
++
++ u32 h_s = s;
++ u32 l_s = 0;
++ int counter = 32;
++ int carry;
++
++ if (s == 0) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ do {
++ div <<= 1;
++ carry = (l_dvd >= l_s) ? 0 : 1;
++
++ if (h_dvd < (h_s + carry)) {
++ h_s >>= 1;
++ l_s = s << (--counter);
++ continue;
++ }
++ else {
++ h_dvd -= (h_s + carry);
++ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
++ : (l_dvd - l_s);
++ h_s >>= 1;
++ l_s = s << (--counter);
++ div |= 1;
++ continue;
++ }
++
++ } while (counter > -1);
++ /* overflow */
++ if (h_dvd || (l_dvd > s)) {
++ x86emu_intr_raise(0);
++ return;
++ }
++ mod = l_dvd;
+ #endif
+- CLEAR_FLAG(F_CF);
+- CLEAR_FLAG(F_AF);
+- CLEAR_FLAG(F_SF);
+- SET_FLAG(F_ZF);
+- CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
++ CLEAR_FLAG(F_CF);
++ CLEAR_FLAG(F_AF);
++ CLEAR_FLAG(F_SF);
++ SET_FLAG(F_ZF);
++ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+- M.x86.R_EAX = (u32)div;
+- M.x86.R_EDX = (u32)mod;
++ M.x86.R_EAX = (u32) div;
++ M.x86.R_EDX = (u32) mod;
+ }
+
+ /****************************************************************************
+ REMARKS:
+ Implements the IN string instruction and side effects.
+ ****************************************************************************/
+-void ins(int size)
++void
++ins(int size)
+ {
+- int inc = size;
++ int inc = size;
+
+- if (ACCESS_FLAG(F_DF)) {
+- inc = -size;
+- }
+- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
++ if (ACCESS_FLAG(F_DF)) {
++ inc = -size;
++ }
++ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* in until CX is ZERO. */
+- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+- M.x86.R_ECX : M.x86.R_CX);
++ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
++ M.x86.R_ECX : M.x86.R_CX);
+ switch (size) {
+- case 1:
++ case 1:
+ while (count--) {
+- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inb)(M.x86.R_DX));
+- M.x86.R_DI += inc;
++ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inb) (M.x86.R_DX));
++ M.x86.R_DI += inc;
+ }
+ break;
+
+- case 2:
++ case 2:
+ while (count--) {
+- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inw)(M.x86.R_DX));
+- M.x86.R_DI += inc;
++ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inw) (M.x86.R_DX));
++ M.x86.R_DI += inc;
+ }
+ break;
+- case 4:
++ case 4:
+ while (count--) {
+- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inl)(M.x86.R_DX));
+- M.x86.R_DI += inc;
++ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inl) (M.x86.R_DX));
++ M.x86.R_DI += inc;
++ break;
+ }
+- break;
+ }
+- M.x86.R_CX = 0;
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- M.x86.R_ECX = 0;
++ M.x86.R_CX = 0;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ M.x86.R_ECX = 0;
+ }
+- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+- } else {
++ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
++ }
++ else {
+ switch (size) {
+- case 1:
+- store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inb)(M.x86.R_DX));
++ case 1:
++ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inb) (M.x86.R_DX));
+ break;
+- case 2:
+- store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inw)(M.x86.R_DX));
++ case 2:
++ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inw) (M.x86.R_DX));
+ break;
+- case 4:
+- store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+- (*sys_inl)(M.x86.R_DX));
++ case 4:
++ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
++ (*sys_inl) (M.x86.R_DX));
+ break;
+ }
+- M.x86.R_DI += inc;
++ M.x86.R_DI += inc;
+ }
+ }
+
+@@ -2518,63 +2654,65 @@ void ins(int size)
+ REMARKS:
+ Implements the OUT string instruction and side effects.
+ ****************************************************************************/
+-void outs(int size)
++void
++outs(int size)
+ {
+ int inc = size;
+
+- if (ACCESS_FLAG(F_DF)) {
++ if (ACCESS_FLAG(F_DF)) {
+ inc = -size;
+ }
+- if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
++ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* out until CX is ZERO. */
+- u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+- M.x86.R_ECX : M.x86.R_CX);
++ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
++ M.x86.R_ECX : M.x86.R_CX);
+ switch (size) {
+- case 1:
++ case 1:
+ while (count--) {
+- (*sys_outb)(M.x86.R_DX,
+- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+- M.x86.R_SI += inc;
++ (*sys_outb) (M.x86.R_DX,
++ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
++ M.x86.R_SI += inc;
+ }
+ break;
+
+- case 2:
++ case 2:
+ while (count--) {
+- (*sys_outw)(M.x86.R_DX,
+- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+- M.x86.R_SI += inc;
++ (*sys_outw) (M.x86.R_DX,
++ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
++ M.x86.R_SI += inc;
+ }
+ break;
+- case 4:
++ case 4:
+ while (count--) {
+- (*sys_outl)(M.x86.R_DX,
+- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+- M.x86.R_SI += inc;
++ (*sys_outl) (M.x86.R_DX,
++ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
++ M.x86.R_SI += inc;
++ break;
+ }
+- break;
+ }
+- M.x86.R_CX = 0;
+- if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+- M.x86.R_ECX = 0;
++ M.x86.R_CX = 0;
++ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
++ M.x86.R_ECX = 0;
+ }
+- M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+- } else {
++ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
++ }
++ else {
+ switch (size) {
+- case 1:
+- (*sys_outb)(M.x86.R_DX,
+- fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
++ case 1:
++ (*sys_outb) (M.x86.R_DX,
++ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+- case 2:
+- (*sys_outw)(M.x86.R_DX,
+- fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
++ case 2:
++ (*sys_outw) (M.x86.R_DX,
++ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+- case 4:
+- (*sys_outl)(M.x86.R_DX,
+- fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
++ case 4:
++ (*sys_outl) (M.x86.R_DX,
++ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+ }
+- M.x86.R_SI += inc;
++ M.x86.R_SI += inc;
+ }
+ }
+
+@@ -2585,11 +2723,12 @@ addr - Address to fetch word from
+ REMARKS:
+ Fetches a word from emulator memory using an absolute address.
+ ****************************************************************************/
+-u16 mem_access_word(int addr)
++u16
++mem_access_word(int addr)
+ {
+-DB( if (CHECK_MEM_ACCESS())
+- x86emu_check_mem_access(addr);)
+- return (*sys_rdw)(addr);
++ DB(if (CHECK_MEM_ACCESS())
++ x86emu_check_mem_access(addr);)
++ return (*sys_rdw) (addr);
+ }
+
+ /****************************************************************************
+@@ -2598,12 +2737,13 @@ Pushes a word onto the stack.
+
+ NOTE: Do not inline this, as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void push_word(u16 w)
++void
++push_word(u16 w)
+ {
+-DB( if (CHECK_SP_ACCESS())
+- x86emu_check_sp_access();)
+- M.x86.R_SP -= 2;
+- (*sys_wrw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
++ DB(if (CHECK_SP_ACCESS())
++ x86emu_check_sp_access();)
++ M.x86.R_SP -= 2;
++ (*sys_wrw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
+ }
+
+ /****************************************************************************
+@@ -2612,12 +2752,13 @@ Pushes a long onto the stack.
+
+ NOTE: Do not inline this, as (*sys_wrX) is already inline!
+ ****************************************************************************/
+-void push_long(u32 w)
++void
++push_long(u32 w)
+ {
+-DB( if (CHECK_SP_ACCESS())
+- x86emu_check_sp_access();)
+- M.x86.R_SP -= 4;
+- (*sys_wrl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
++ DB(if (CHECK_SP_ACCESS())
++ x86emu_check_sp_access();)
++ M.x86.R_SP -= 4;
++ (*sys_wrl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP, w);
+ }
+
+ /****************************************************************************
+@@ -2626,15 +2767,16 @@ Pops a word from the stack.
+
+ NOTE: Do not inline this, as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u16 pop_word(void)
++u16
++pop_word(void)
+ {
+- register u16 res;
++ register u16 res;
+
+-DB( if (CHECK_SP_ACCESS())
+- x86emu_check_sp_access();)
+- res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
+- M.x86.R_SP += 2;
+- return res;
++ DB(if (CHECK_SP_ACCESS())
++ x86emu_check_sp_access();)
++ res = (*sys_rdw) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
++ M.x86.R_SP += 2;
++ return res;
+ }
+
+ /****************************************************************************
+@@ -2643,14 +2785,15 @@ Pops a long from the stack.
+
+ NOTE: Do not inline this, as (*sys_rdX) is already inline!
+ ****************************************************************************/
+-u32 pop_long(void)
++u32
++pop_long(void)
+ {
+ register u32 res;
+
+-DB( if (CHECK_SP_ACCESS())
+- x86emu_check_sp_access();)
+- res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
+- M.x86.R_SP += 4;
++ DB(if (CHECK_SP_ACCESS())
++ x86emu_check_sp_access();)
++ res = (*sys_rdl) (((u32) M.x86.R_SS << 4) + M.x86.R_SP);
++ M.x86.R_SP += 4;
+ return res;
+ }
+
+@@ -2658,45 +2801,59 @@ DB( if (CHECK_SP_ACCESS())
+ REMARKS:
+ CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+ ****************************************************************************/
+-void cpuid (void)
+-{
+- u32 feature = M.x86.R_EAX;
+-
+- switch (feature) {
+- case 0:
+- /* Regardless if we have real data from the hardware, the emulator
+- * will only support upto feature 1, which we set in register EAX.
+- * Registers EBX:EDX:ECX contain a string identifying the CPU.
+- */
+- M.x86.R_EAX = 1;
+- /* EBX:EDX:ECX = "GenuineIntel" */
+- M.x86.R_EBX = 0x756e6547;
+- M.x86.R_EDX = 0x49656e69;
+- M.x86.R_ECX = 0x6c65746e;
+- break;
+- case 1:
+- /* If we don't have x86 compatible hardware, we return values from an
+- * Intel 486dx4; which was one of the first processors to have CPUID.
+- */
+- M.x86.R_EAX = 0x00000480;
+- M.x86.R_EBX = 0x00000000;
+- M.x86.R_ECX = 0x00000000;
+- M.x86.R_EDX = 0x00000002; /* VME */
+- /* In the case that we have hardware CPUID instruction, we make sure
+- * that the features reported are limited to TSC and VME.
+- */
+- M.x86.R_EDX &= 0x00000012;
+- break;
+- default:
+- /* Finally, we don't support any additional features. Most CPUs
+- * return all zeros when queried for invalid or unsupported feature
+- * numbers.
+- */
+- M.x86.R_EAX = 0;
+- M.x86.R_EBX = 0;
+- M.x86.R_ECX = 0;
+- M.x86.R_EDX = 0;
+- break;
+- }
+-}
++void
++cpuid(void)
++{
++ u32 feature = M.x86.R_EAX;
+
++#ifdef X86EMU_HAS_HW_CPUID
++ /* If the platform allows it, we will base our values on the real
++ * results from the CPUID instruction. We limit support to the
++ * first two features, and the results of those are sanitized.
++ */
++ if (feature <= 1)
++ hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX);
++#endif
++
++ switch (feature) {
++ case 0:
++ /* Regardless if we have real data from the hardware, the emulator
++ * will only support upto feature 1, which we set in register EAX.
++ * Registers EBX:EDX:ECX contain a string identifying the CPU.
++ */
++ M.x86.R_EAX = 1;
++#ifndef X86EMU_HAS_HW_CPUID
++ /* EBX:EDX:ECX = "GenuineIntel" */
++ M.x86.R_EBX = 0x756e6547;
++ M.x86.R_EDX = 0x49656e69;
++ M.x86.R_ECX = 0x6c65746e;
++#endif
++ break;
++ case 1:
++#ifndef X86EMU_HAS_HW_CPUID
++ /* If we don't have x86 compatible hardware, we return values from an
++ * Intel 486dx4; which was one of the first processors to have CPUID.
++ */
++ M.x86.R_EAX = 0x00000480;
++ M.x86.R_EBX = 0x00000000;
++ M.x86.R_ECX = 0x00000000;
++ M.x86.R_EDX = 0x00000002; /* VME */
++#else
++ /* In the case that we have hardware CPUID instruction, we make sure
++ * that the features reported are limited to TSC and VME.
++ */
++ M.x86.R_EDX &= 0x00000012;
++#endif
++ break;
++ default:
++ /* Finally, we don't support any additional features. Most CPUs
++ * return all zeros when queried for invalid or unsupported feature
++ * numbers.
++ */
++ M.x86.R_EAX = 0;
++ M.x86.R_EBX = 0;
++ M.x86.R_ECX = 0;
++ M.x86.R_EDX = 0;
++ break;
++ }
++}
+diff --git a/libs/x86emu/sys.c b/libs/x86emu/sys.c
+index 4d90ea3..c514dde 100644
+--- a/libs/x86emu/sys.c
++++ b/libs/x86emu/sys.c
+@@ -47,223 +47,133 @@
+ #include "x86emu/prim_ops.h"
+ #ifndef NO_SYS_HEADERS
+ #include <string.h>
+-#endif
+-/*------------------------- Global Variables ------------------------------*/
++#endif
+
+-X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
+-X86EMU_intrFuncs _X86EMU_intrTab[256];
++#ifdef __GNUC__
+
+-/*----------------------------- Implementation ----------------------------*/
+-#if defined(__alpha__) || defined(__alpha)
+-/* to cope with broken egcs-1.1.2 :-(((( */
+-
+-#define ALPHA_UALOADS
+-/*
+- * inline functions to do unaligned accesses
+- * from linux/include/asm-alpha/unaligned.h
+- */
+-
+-/*
+- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+- * packed structures to talk about such things with.
+- */
+-
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+-struct __una_u64 { unsigned long x __attribute__((packed)); };
+-struct __una_u32 { unsigned int x __attribute__((packed)); };
+-struct __una_u16 { unsigned short x __attribute__((packed)); };
+-#endif
++/* Define some packed structures to use with unaligned accesses */
++
++struct __una_u64 {
++ u64 x __attribute__ ((packed));
++};
++struct __una_u32 {
++ u32 x __attribute__ ((packed));
++};
++struct __una_u16 {
++ u16 x __attribute__ ((packed));
++};
++
++/* Elemental unaligned loads */
+
+-static __inline__ unsigned long ldq_u(unsigned long * r11)
++static __inline__ u64
++ldq_u(u64 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+- return ptr->x;
+-#else
+- unsigned long r1,r2;
+- __asm__("ldq_u %0,%3\n\t"
+- "ldq_u %1,%4\n\t"
+- "extql %0,%2,%0\n\t"
+- "extqh %1,%2,%1"
+- :"=&r" (r1), "=&r" (r2)
+- :"r" (r11),
+- "m" (*r11),
+- "m" (*(const unsigned long *)(7+(char *) r11)));
+- return r1 | r2;
+-#endif
++ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
++
++ return ptr->x;
+ }
+
+-static __inline__ unsigned long ldl_u(unsigned int * r11)
++static __inline__ u32
++ldl_u(u32 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+- return ptr->x;
+-#else
+- unsigned long r1,r2;
+- __asm__("ldq_u %0,%3\n\t"
+- "ldq_u %1,%4\n\t"
+- "extll %0,%2,%0\n\t"
+- "extlh %1,%2,%1"
+- :"=&r" (r1), "=&r" (r2)
+- :"r" (r11),
+- "m" (*r11),
+- "m" (*(const unsigned long *)(3+(char *) r11)));
+- return r1 | r2;
+-#endif
++ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
++
++ return ptr->x;
+ }
+
+-static __inline__ unsigned long ldw_u(unsigned short * r11)
++static __inline__ u16
++ldw_u(u16 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+- return ptr->x;
+-#else
+- unsigned long r1,r2;
+- __asm__("ldq_u %0,%3\n\t"
+- "ldq_u %1,%4\n\t"
+- "extwl %0,%2,%0\n\t"
+- "extwh %1,%2,%1"
+- :"=&r" (r1), "=&r" (r2)
+- :"r" (r11),
+- "m" (*r11),
+- "m" (*(const unsigned long *)(1+(char *) r11)));
+- return r1 | r2;
+-#endif
++ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
++
++ return ptr->x;
+ }
+
+-/*
+- * Elemental unaligned stores
+- */
++/* Elemental unaligned stores */
+
+-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
++static __inline__ void
++stq_u(u64 val, u64 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- struct __una_u64 *ptr = (struct __una_u64 *) r11;
+- ptr->x = r5;
+-#else
+- unsigned long r1,r2,r3,r4;
+-
+- __asm__("ldq_u %3,%1\n\t"
+- "ldq_u %2,%0\n\t"
+- "insqh %6,%7,%5\n\t"
+- "insql %6,%7,%4\n\t"
+- "mskqh %3,%7,%3\n\t"
+- "mskql %2,%7,%2\n\t"
+- "bis %3,%5,%3\n\t"
+- "bis %2,%4,%2\n\t"
+- "stq_u %3,%1\n\t"
+- "stq_u %2,%0"
+- :"=m" (*r11),
+- "=m" (*(unsigned long *)(7+(char *) r11)),
+- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+- :"r" (r5), "r" (r11));
+-#endif
++ struct __una_u64 *ptr = (struct __una_u64 *) p;
++
++ ptr->x = val;
+ }
+
+-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
++static __inline__ void
++stl_u(u32 val, u32 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- struct __una_u32 *ptr = (struct __una_u32 *) r11;
+- ptr->x = r5;
+-#else
+- unsigned long r1,r2,r3,r4;
+-
+- __asm__("ldq_u %3,%1\n\t"
+- "ldq_u %2,%0\n\t"
+- "inslh %6,%7,%5\n\t"
+- "insll %6,%7,%4\n\t"
+- "msklh %3,%7,%3\n\t"
+- "mskll %2,%7,%2\n\t"
+- "bis %3,%5,%3\n\t"
+- "bis %2,%4,%2\n\t"
+- "stq_u %3,%1\n\t"
+- "stq_u %2,%0"
+- :"=m" (*r11),
+- "=m" (*(unsigned long *)(3+(char *) r11)),
+- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+- :"r" (r5), "r" (r11));
+-#endif
++ struct __una_u32 *ptr = (struct __una_u32 *) p;
++
++ ptr->x = val;
+ }
+
+-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
++static __inline__ void
++stw_u(u16 val, u16 * p)
+ {
+-#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+- struct __una_u16 *ptr = (struct __una_u16 *) r11;
+- ptr->x = r5;
+-#else
+- unsigned long r1,r2,r3,r4;
+-
+- __asm__("ldq_u %3,%1\n\t"
+- "ldq_u %2,%0\n\t"
+- "inswh %6,%7,%5\n\t"
+- "inswl %6,%7,%4\n\t"
+- "mskwh %3,%7,%3\n\t"
+- "mskwl %2,%7,%2\n\t"
+- "bis %3,%5,%3\n\t"
+- "bis %2,%4,%2\n\t"
+- "stq_u %3,%1\n\t"
+- "stq_u %2,%0"
+- :"=m" (*r11),
+- "=m" (*(unsigned long *)(1+(char *) r11)),
+- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+- :"r" (r5), "r" (r11));
+-#endif
++ struct __una_u16 *ptr = (struct __una_u16 *) p;
++
++ ptr->x = val;
+ }
++#else /* !__GNUC__ */
+
+-#elif defined(__GNUC__) && ((__GNUC__ < 3)) && \
+- (defined (__ia64__) || defined (ia64__))
+-#define IA64_UALOADS
+-/*
+- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+- * packed structures to talk about such things with.
+- */
+-struct __una_u64 { unsigned long x __attribute__((packed)); };
+-struct __una_u32 { unsigned int x __attribute__((packed)); };
+-struct __una_u16 { unsigned short x __attribute__((packed)); };
+-
+-static __inline__ unsigned long
+-__uldq (const unsigned long * r11)
++static __inline__ u64
++ldq_u(u64 * p)
+ {
+- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+- return ptr->x;
++ u64 ret;
++
++ memmove(&ret, p, sizeof(*p));
++ return ret;
+ }
+
+-static __inline__ unsigned long
+-uldl (const unsigned int * r11)
++static __inline__ u32
++ldl_u(u32 * p)
+ {
+- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+- return ptr->x;
++ u32 ret;
++
++ memmove(&ret, p, sizeof(*p));
++ return ret;
+ }
+
+-static __inline__ unsigned long
+-uldw (const unsigned short * r11)
++static __inline__ u16
++ldw_u(u16 * p)
+ {
+- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+- return ptr->x;
++ u16 ret;
++
++ memmove(&ret, p, sizeof(*p));
++ return ret;
+ }
+
+ static __inline__ void
+-ustq (unsigned long r5, unsigned long * r11)
++stq_u(u64 val, u64 * p)
+ {
+- struct __una_u64 *ptr = (struct __una_u64 *) r11;
+- ptr->x = r5;
++ u64 tmp = val;
++
++ memmove(p, &tmp, sizeof(*p));
+ }
+
+ static __inline__ void
+-ustl (unsigned long r5, unsigned int * r11)
++stl_u(u32 val, u32 * p)
+ {
+- struct __una_u32 *ptr = (struct __una_u32 *) r11;
+- ptr->x = r5;
++ u32 tmp = val;
++
++ memmove(p, &tmp, sizeof(*p));
+ }
+
+ static __inline__ void
+-ustw (unsigned long r5, unsigned short * r11)
++stw_u(u16 val, u16 * p)
+ {
+- struct __una_u16 *ptr = (struct __una_u16 *) r11;
+- ptr->x = r5;
++ u16 tmp = val;
++
++ memmove(p, &tmp, sizeof(*p));
+ }
+
+-#endif
++#endif /* __GNUC__ */
++/*------------------------- Global Variables ------------------------------*/
++
++X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
++X86EMU_intrFuncs _X86EMU_intrTab[256];
++
++/*----------------------------- Implementation ----------------------------*/
+
+ /****************************************************************************
+ PARAMETERS:
+@@ -275,19 +185,20 @@ Byte value read from emulator memory.
+ REMARKS:
+ Reads a byte value from the emulator memory.
+ ****************************************************************************/
+-u8 X86API rdb(
+- u32 addr)
++u8 X86API
++rdb(u32 addr)
+ {
+- u8 val;
+-
+- if (addr > M.mem_size - 1) {
+- DB(printk("mem_read: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
+- val = *(u8*)(M.mem_base + addr);
+-DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 1 -> %#x\n", addr, val);)
+- return val;
++ u8 val;
++
++ if (addr > M.mem_size - 1) {
++ DB(printk("mem_read: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
++ val = *(u8 *) (M.mem_base + addr);
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 1 -> %#x\n", addr, val);)
++ return val;
+ }
+
+ /****************************************************************************
+@@ -300,32 +211,27 @@ Word value read from emulator memory.
+ REMARKS:
+ Reads a word value from the emulator memory.
+ ****************************************************************************/
+-u16 X86API rdw(
+- u32 addr)
++u16 X86API
++rdw(u32 addr)
+ {
+- u16 val = 0;
++ u16 val = 0;
+
+- if (addr > M.mem_size - 2) {
+- DB(printk("mem_read: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
++ if (addr > M.mem_size - 2) {
++ DB(printk("mem_read: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
+ #ifdef __BIG_ENDIAN__
+- if (addr & 0x1) {
+- val = (*(u8*)(M.mem_base + addr) |
+- (*(u8*)(M.mem_base + addr + 1) << 8));
+- }
+- else
+-#endif
+-#if defined(ALPHA_UALOADS)
+- val = ldw_u((u16*)(M.mem_base + addr));
+-#elif defined(IA64_UALOADS)
+- val = uldw((u16*)(M.mem_base + addr));
+-#else
+- val = *(u16*)(M.mem_base + addr);
++ if (addr & 0x1) {
++ val = (*(u8 *) (M.mem_base + addr) |
++ (*(u8 *) (M.mem_base + addr + 1) << 8));
++ }
++ else
+ #endif
+- DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 2 -> %#x\n", addr, val);)
+- return val;
++ val = ldw_u((u16 *) (M.mem_base + addr));
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 2 -> %#x\n", addr, val);)
++ return val;
+ }
+
+ /****************************************************************************
+@@ -337,34 +243,29 @@ Long value read from emulator memory.
+ REMARKS:
+ Reads a long value from the emulator memory.
+ ****************************************************************************/
+-u32 X86API rdl(
+- u32 addr)
++u32 X86API
++rdl(u32 addr)
+ {
+- u32 val = 0;
++ u32 val = 0;
+
+- if (addr > M.mem_size - 4) {
+- DB(printk("mem_read: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
++ if (addr > M.mem_size - 4) {
++ DB(printk("mem_read: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
+ #ifdef __BIG_ENDIAN__
+- if (addr & 0x3) {
+- val = (*(u8*)(M.mem_base + addr + 0) |
+- (*(u8*)(M.mem_base + addr + 1) << 8) |
+- (*(u8*)(M.mem_base + addr + 2) << 16) |
+- (*(u8*)(M.mem_base + addr + 3) << 24));
+- }
+- else
+-#endif
+-#if defined(ALPHA_UALOADS)
+- val = ldl_u((u32*)(M.mem_base + addr));
+-#elif defined(IA64_UALOADS)
+- val = uldl((u32*)(M.mem_base + addr));
+-#else
+- val = *(u32*)(M.mem_base + addr);
++ if (addr & 0x3) {
++ val = (*(u8 *) (M.mem_base + addr + 0) |
++ (*(u8 *) (M.mem_base + addr + 1) << 8) |
++ (*(u8 *) (M.mem_base + addr + 2) << 16) |
++ (*(u8 *) (M.mem_base + addr + 3) << 24));
++ }
++ else
+ #endif
+-DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 4 -> %#x\n", addr, val);)
+- return val;
++ val = ldl_u((u32 *) (M.mem_base + addr));
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 4 -> %#x\n", addr, val);)
++ return val;
+ }
+
+ /****************************************************************************
+@@ -375,17 +276,17 @@ val - Value to store
+ REMARKS:
+ Writes a byte value to emulator memory.
+ ****************************************************************************/
+-void X86API wrb(
+- u32 addr,
+- u8 val)
++void X86API
++wrb(u32 addr, u8 val)
+ {
+-DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 1 <- %#x\n", addr, val);)
+- if (addr > M.mem_size - 1) {
+- DB(printk("mem_write: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
+- *(u8*)(M.mem_base + addr) = val;
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 1 <- %#x\n", addr, val);)
++ if (addr > M.mem_size - 1) {
++ DB(printk("mem_write: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
++ *(u8 *) (M.mem_base + addr) = val;
+ }
+
+ /****************************************************************************
+@@ -396,30 +297,24 @@ val - Value to store
+ REMARKS:
+ Writes a word value to emulator memory.
+ ****************************************************************************/
+-void X86API wrw(
+- u32 addr,
+- u16 val)
++void X86API
++wrw(u32 addr, u16 val)
+ {
+-DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 2 <- %#x\n", addr, val);)
+- if (addr > M.mem_size - 2) {
+- DB(printk("mem_write: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 2 <- %#x\n", addr, val);)
++ if (addr > M.mem_size - 2) {
++ DB(printk("mem_write: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
+ #ifdef __BIG_ENDIAN__
+- if (addr & 0x1) {
+- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+- }
+- else
+-#endif
+-#if defined(ALPHA_UALOADS)
+- stw_u(val,(u16*)(M.mem_base + addr));
+-#elif defined(IA64_UALOADS)
+- ustw(val,(u16*)(M.mem_base + addr));
+-#else
+- *(u16*)(M.mem_base + addr) = val;
++ if (addr & 0x1) {
++ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
++ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
++ }
++ else
+ #endif
++ stw_u(val, (u16 *) (M.mem_base + addr));
+ }
+
+ /****************************************************************************
+@@ -430,32 +325,26 @@ val - Value to store
+ REMARKS:
+ Writes a long value to emulator memory.
+ ****************************************************************************/
+-void X86API wrl(
+- u32 addr,
+- u32 val)
++void X86API
++wrl(u32 addr, u32 val)
+ {
+-DB( if (DEBUG_MEM_TRACE())
+- printk("%#08x 4 <- %#x\n", addr, val);)
+- if (addr > M.mem_size - 4) {
+- DB(printk("mem_write: address %#lx out of range!\n", addr);)
+- HALT_SYS();
+- }
++ DB(if (DEBUG_MEM_TRACE())
++ printk("%#08x 4 <- %#x\n", addr, val);)
++ if (addr > M.mem_size - 4) {
++ DB(printk("mem_write: address %#lx out of range!\n", addr);
++ )
++ HALT_SYS();
++ }
+ #ifdef __BIG_ENDIAN__
+- if (addr & 0x1) {
+- *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+- *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+- *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
+- *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
+- }
+- else
+-#endif
+-#if defined(ALPHA_UALOADS)
+- stl_u(val,(u32*)(M.mem_base + addr));
+-#elif defined(IA64_UALOADS)
+- ustl(val,(u32*)(M.mem_base + addr));
+-#else
+- *(u32*)(M.mem_base + addr) = val;
++ if (addr & 0x1) {
++ *(u8 *) (M.mem_base + addr + 0) = (val >> 0) & 0xff;
++ *(u8 *) (M.mem_base + addr + 1) = (val >> 8) & 0xff;
++ *(u8 *) (M.mem_base + addr + 2) = (val >> 16) & 0xff;
++ *(u8 *) (M.mem_base + addr + 3) = (val >> 24) & 0xff;
++ }
++ else
+ #endif
++ stl_u(val, (u32 *) (M.mem_base + addr));
+ }
+
+ /****************************************************************************
+@@ -466,12 +355,12 @@ RETURN:
+ REMARKS:
+ Default PIO byte read function. Doesn't perform real inb.
+ ****************************************************************************/
+-static u8 X86API p_inb(
+- X86EMU_pioAddr addr)
++static u8 X86API
++p_inb(X86EMU_pioAddr addr)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("inb %#04x \n", addr);)
+- return 0;
++ DB(if (DEBUG_IO_TRACE())
++ printk("inb %#04x \n", addr);)
++ return 0;
+ }
+
+ /****************************************************************************
+@@ -482,12 +371,12 @@ RETURN:
+ REMARKS:
+ Default PIO word read function. Doesn't perform real inw.
+ ****************************************************************************/
+-static u16 X86API p_inw(
+- X86EMU_pioAddr addr)
++static u16 X86API
++p_inw(X86EMU_pioAddr addr)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("inw %#04x \n", addr);)
+- return 0;
++ DB(if (DEBUG_IO_TRACE())
++ printk("inw %#04x \n", addr);)
++ return 0;
+ }
+
+ /****************************************************************************
+@@ -498,12 +387,12 @@ RETURN:
+ REMARKS:
+ Default PIO long read function. Doesn't perform real inl.
+ ****************************************************************************/
+-static u32 X86API p_inl(
+- X86EMU_pioAddr addr)
++static u32 X86API
++p_inl(X86EMU_pioAddr addr)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("inl %#04x \n", addr);)
+- return 0;
++ DB(if (DEBUG_IO_TRACE())
++ printk("inl %#04x \n", addr);)
++ return 0;
+ }
+
+ /****************************************************************************
+@@ -513,13 +402,12 @@ val - Value to store
+ REMARKS:
+ Default PIO byte write function. Doesn't perform real outb.
+ ****************************************************************************/
+-static void X86API p_outb(
+- X86EMU_pioAddr addr,
+- u8 val)
++static void X86API
++p_outb(X86EMU_pioAddr addr, u8 val)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("outb %#02x -> %#04x \n", val, addr);)
+- return;
++ DB(if (DEBUG_IO_TRACE())
++ printk("outb %#02x -> %#04x \n", val, addr);)
++ return;
+ }
+
+ /****************************************************************************
+@@ -529,13 +417,12 @@ val - Value to store
+ REMARKS:
+ Default PIO word write function. Doesn't perform real outw.
+ ****************************************************************************/
+-static void X86API p_outw(
+- X86EMU_pioAddr addr,
+- u16 val)
++static void X86API
++p_outw(X86EMU_pioAddr addr, u16 val)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("outw %#04x -> %#04x \n", val, addr);)
+- return;
++ DB(if (DEBUG_IO_TRACE())
++ printk("outw %#04x -> %#04x \n", val, addr);)
++ return;
+ }
+
+ /****************************************************************************
+@@ -545,29 +432,29 @@ val - Value to store
+ REMARKS:
+ Default PIO ;ong write function. Doesn't perform real outl.
+ ****************************************************************************/
+-static void X86API p_outl(
+- X86EMU_pioAddr addr,
+- u32 val)
++static void X86API
++p_outl(X86EMU_pioAddr addr, u32 val)
+ {
+-DB( if (DEBUG_IO_TRACE())
+- printk("outl %#08x -> %#04x \n", val, addr);)
+- return;
++ DB(if (DEBUG_IO_TRACE())
++ printk("outl %#08x -> %#04x \n", val, addr);)
++ return;
+ }
+
+ /*------------------------- Global Variables ------------------------------*/
+
+-u8 (X86APIP sys_rdb)(u32 addr) = rdb;
+-u16 (X86APIP sys_rdw)(u32 addr) = rdw;
+-u32 (X86APIP sys_rdl)(u32 addr) = rdl;
+-void (X86APIP sys_wrb)(u32 addr,u8 val) = wrb;
+-void (X86APIP sys_wrw)(u32 addr,u16 val) = wrw;
+-void (X86APIP sys_wrl)(u32 addr,u32 val) = wrl;
+-u8 (X86APIP sys_inb)(X86EMU_pioAddr addr) = p_inb;
+-u16 (X86APIP sys_inw)(X86EMU_pioAddr addr) = p_inw;
+-u32 (X86APIP sys_inl)(X86EMU_pioAddr addr) = p_inl;
+-void (X86APIP sys_outb)(X86EMU_pioAddr addr, u8 val) = p_outb;
+-void (X86APIP sys_outw)(X86EMU_pioAddr addr, u16 val) = p_outw;
+-void (X86APIP sys_outl)(X86EMU_pioAddr addr, u32 val) = p_outl;
++u8(X86APIP sys_rdb) (u32 addr) = rdb;
++u16(X86APIP sys_rdw) (u32 addr) = rdw;
++u32(X86APIP sys_rdl) (u32 addr) = rdl;
++void (X86APIP sys_wrb) (u32 addr, u8 val) = wrb;
++void (X86APIP sys_wrw) (u32 addr, u16 val) = wrw;
++void (X86APIP sys_wrl) (u32 addr, u32 val) = wrl;
++
++u8(X86APIP sys_inb) (X86EMU_pioAddr addr) = p_inb;
++u16(X86APIP sys_inw) (X86EMU_pioAddr addr) = p_inw;
++u32(X86APIP sys_inl) (X86EMU_pioAddr addr) = p_inl;
++void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val) = p_outb;
++void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val) = p_outw;
++void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val) = p_outl;
+
+ /*----------------------------- Setup -------------------------------------*/
+
+@@ -580,8 +467,8 @@ This function is used to set the pointers to functions which access
+ memory space, allowing the user application to override these functions
+ and hook them out as necessary for their application.
+ ****************************************************************************/
+-void X86EMU_setupMemFuncs(
+- X86EMU_memFuncs *funcs)
++void
++X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs)
+ {
+ sys_rdb = funcs->rdb;
+ sys_rdw = funcs->rdw;
+@@ -600,8 +487,8 @@ This function is used to set the pointers to functions which access
+ I/O space, allowing the user application to override these functions
+ and hook them out as necessary for their application.
+ ****************************************************************************/
+-void X86EMU_setupPioFuncs(
+- X86EMU_pioFuncs *funcs)
++void
++X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs)
+ {
+ sys_inb = funcs->inb;
+ sys_inw = funcs->inw;
+@@ -624,17 +511,17 @@ in the emulator via the interrupt vector table. This allows the application
+ to get control when the code being emulated executes specific software
+ interrupts.
+ ****************************************************************************/
+-void X86EMU_setupIntrFuncs(
+- X86EMU_intrFuncs funcs[])
++void
++X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[])
+ {
+ int i;
+-
+- for (i=0; i < 256; i++)
+- _X86EMU_intrTab[i] = NULL;
+- if (funcs) {
+- for (i = 0; i < 256; i++)
+- _X86EMU_intrTab[i] = funcs[i];
+- }
++
++ for (i = 0; i < 256; i++)
++ _X86EMU_intrTab[i] = NULL;
++ if (funcs) {
++ for (i = 0; i < 256; i++)
++ _X86EMU_intrTab[i] = funcs[i];
++ }
+ }
+
+ /****************************************************************************
+@@ -649,15 +536,15 @@ so that the code in the emulator will continue processing the software
+ interrupt as per normal. This essentially allows system code to actively
+ hook and handle certain software interrupts as necessary.
+ ****************************************************************************/
+-void X86EMU_prepareForInt(
+- int num)
++void
++X86EMU_prepareForInt(int num)
+ {
+- push_word((u16)M.x86.R_FLG);
++ push_word((u16) M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(num * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(num * 4);
+- M.x86.intr = 0;
++ M.x86.intr = 0;
+ }
+diff --git a/libs/x86emu/validate.c b/libs/x86emu/validate.c
+index 239f6c1..4c36e1d 100644
+--- a/libs/x86emu/validate.c
++++ b/libs/x86emu/validate.c
+@@ -591,58 +591,62 @@
+ printk("passed\n"); \
+ }
+
+-void printk(const char *fmt, ...)
++void
++printk(const char *fmt, ...)
+ {
+ va_list argptr;
++
+ va_start(argptr, fmt);
+ vfprintf(stdout, fmt, argptr);
+ fflush(stdout);
+ va_end(argptr);
+ }
+
+-char * print_flags(char *buf,ulong flags)
++char *
++print_flags(char *buf, ulong flags)
+ {
+ char *separator = "";
+
+ buf[0] = 0;
+ if (flags & F_CF) {
+- strcat(buf,separator);
+- strcat(buf,"CF");
++ strcat(buf, separator);
++ strcat(buf, "CF");
+ separator = ",";
+- }
++ }
+ if (flags & F_PF) {
+- strcat(buf,separator);
+- strcat(buf,"PF");
++ strcat(buf, separator);
++ strcat(buf, "PF");
+ separator = ",";
+- }
++ }
+ if (flags & F_AF) {
+- strcat(buf,separator);
+- strcat(buf,"AF");
++ strcat(buf, separator);
++ strcat(buf, "AF");
+ separator = ",";
+- }
++ }
+ if (flags & F_ZF) {
+- strcat(buf,separator);
+- strcat(buf,"ZF");
++ strcat(buf, separator);
++ strcat(buf, "ZF");
+ separator = ",";
+- }
++ }
+ if (flags & F_SF) {
+- strcat(buf,separator);
+- strcat(buf,"SF");
++ strcat(buf, separator);
++ strcat(buf, "SF");
+ separator = ",";
+- }
++ }
+ if (flags & F_OF) {
+- strcat(buf,separator);
+- strcat(buf,"OF");
++ strcat(buf, separator);
++ strcat(buf, "OF");
+ separator = ",";
+- }
++ }
+ if (separator[0] == 0)
+- strcpy(buf,"None");
++ strcpy(buf, "None");
+ return buf;
+ }
+
+-int main(int argc)
++int
++main(int argc)
+ {
+- ulong def_flags;
++ ulong def_flags;
+ int trace = false;
+
+ if (argc > 1)
+@@ -673,7 +677,7 @@ int main(int argc)
+ VAL_LONG_LONG_BINARY(cmp_long);
+
+ VAL_BYTE_UNARY(daa_byte);
+- VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
++ VAL_BYTE_UNARY(das_byte); /* Fails for 0x9A (out of range anyway) */
+
+ VAL_BYTE_UNARY(dec_byte);
+ VAL_WORD_UNARY(dec_word);
+diff --git a/libs/x86emu/x86emu.h b/libs/x86emu/x86emu.h
+index 795e2d6..501dd91 100644
+--- a/libs/x86emu/x86emu.h
++++ b/libs/x86emu/x86emu.h
+@@ -56,7 +56,7 @@ typedef int X86EMU_pioAddr;
+ /*---------------------- Macros and type definitions ----------------------*/
+
+ #ifdef PACK
+-# pragma PACK /* Don't pack structs with function pointers! */
++#pragma PACK /* Don't pack structs with function pointers! */
+ #endif
+
+ /****************************************************************************
+@@ -81,13 +81,13 @@ outw - Function to write a word to an I/O port
+ outl - Function to write a dword to an I/O port
+ ****************************************************************************/
+ typedef struct {
+- u8 (X86APIP inb)(X86EMU_pioAddr addr);
+- u16 (X86APIP inw)(X86EMU_pioAddr addr);
+- u32 (X86APIP inl)(X86EMU_pioAddr addr);
+- void (X86APIP outb)(X86EMU_pioAddr addr, u8 val);
+- void (X86APIP outw)(X86EMU_pioAddr addr, u16 val);
+- void (X86APIP outl)(X86EMU_pioAddr addr, u32 val);
+- } X86EMU_pioFuncs;
++ u8(X86APIP inb) (X86EMU_pioAddr addr);
++ u16(X86APIP inw) (X86EMU_pioAddr addr);
++ u32(X86APIP inl) (X86EMU_pioAddr addr);
++ void (X86APIP outb) (X86EMU_pioAddr addr, u8 val);
++ void (X86APIP outw) (X86EMU_pioAddr addr, u16 val);
++ void (X86APIP outl) (X86EMU_pioAddr addr, u32 val);
++} X86EMU_pioFuncs;
+
+ /****************************************************************************
+ REMARKS:
+@@ -112,13 +112,13 @@ wrw - Function to write a word to an address
+ wrl - Function to write a dword to an address
+ ****************************************************************************/
+ typedef struct {
+- u8 (X86APIP rdb)(u32 addr);
+- u16 (X86APIP rdw)(u32 addr);
+- u32 (X86APIP rdl)(u32 addr);
+- void (X86APIP wrb)(u32 addr, u8 val);
+- void (X86APIP wrw)(u32 addr, u16 val);
+- void (X86APIP wrl)(u32 addr, u32 val);
+- } X86EMU_memFuncs;
++ u8(X86APIP rdb) (u32 addr);
++ u16(X86APIP rdw) (u32 addr);
++ u32(X86APIP rdl) (u32 addr);
++ void (X86APIP wrb) (u32 addr, u8 val);
++ void (X86APIP wrw) (u32 addr, u16 val);
++ void (X86APIP wrl) (u32 addr, u32 val);
++} X86EMU_memFuncs;
+
+ /****************************************************************************
+ Here are the default memory read and write
+@@ -132,29 +132,29 @@ extern void X86API wrw(u32 addr, u16 val);
+ extern void X86API wrl(u32 addr, u32 val);
+
+ #ifdef END_PACK
+-# pragma END_PACK
++#pragma END_PACK
+ #endif
+
+ /*--------------------- type definitions -----------------------------------*/
+
+-typedef void (X86APIP X86EMU_intrFuncs)(int num);
++typedef void (X86APIP X86EMU_intrFuncs) (int num);
+ extern X86EMU_intrFuncs _X86EMU_intrTab[256];
+
+ /*-------------------------- Function Prototypes --------------------------*/
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+-void X86EMU_setupMemFuncs(X86EMU_memFuncs *funcs);
+-void X86EMU_setupPioFuncs(X86EMU_pioFuncs *funcs);
+-void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
+-void X86EMU_prepareForInt(int num);
++ void X86EMU_setupMemFuncs(X86EMU_memFuncs * funcs);
++ void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs);
++ void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
++ void X86EMU_prepareForInt(int num);
+
+ /* decode.c */
+
+-void X86EMU_exec(void);
+-void X86EMU_halt_sys(void);
++ void X86EMU_exec(void);
++ void X86EMU_halt_sys(void);
+
+ #ifdef DEBUG
+ #define HALT_SYS() \
+@@ -166,8 +166,8 @@ void X86EMU_halt_sys(void);
+
+ /* Debug options */
+
+-#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
+-#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
++#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
++#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
+ #define DEBUG_STEP_F 0x000004
+ #define DEBUG_DISASSEMBLE_F 0x000008
+ #define DEBUG_BREAK_F 0x000010
+@@ -175,24 +175,23 @@ void X86EMU_halt_sys(void);
+ #define DEBUG_SAVE_IP_CS_F 0x000040
+ #define DEBUG_FS_F 0x000080
+ #define DEBUG_PROC_F 0x000100
+-#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
++#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
+ #define DEBUG_TRACECALL_F 0x000400
+ #define DEBUG_INSTRUMENT_F 0x000800
+-#define DEBUG_MEM_TRACE_F 0x001000
+-#define DEBUG_IO_TRACE_F 0x002000
++#define DEBUG_MEM_TRACE_F 0x001000
++#define DEBUG_IO_TRACE_F 0x002000
+ #define DEBUG_TRACECALL_REGS_F 0x004000
+-#define DEBUG_DECODE_NOPRINT_F 0x008000
++#define DEBUG_DECODE_NOPRINT_F 0x008000
+ #define DEBUG_EXIT 0x010000
+ #define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
+
+-void X86EMU_trace_regs(void);
+-void X86EMU_trace_xregs(void);
+-void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
+-int X86EMU_trace_on(void);
+-int X86EMU_trace_off(void);
++ void X86EMU_trace_regs(void);
++ void X86EMU_trace_xregs(void);
++ void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
++ int X86EMU_trace_on(void);
++ int X86EMU_trace_off(void);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_X86EMU_H */
++#endif /* __X86EMU_X86EMU_H */
+diff --git a/libs/x86emu/x86emu/debug.h b/libs/x86emu/x86emu/debug.h
+index 47aacb6..385b804 100644
+--- a/libs/x86emu/x86emu/debug.h
++++ b/libs/x86emu/x86emu/debug.h
+@@ -45,65 +45,65 @@
+
+ #define CHECK_IP_FETCH_F 0x1
+ #define CHECK_SP_ACCESS_F 0x2
+-#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
+-#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
++#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
++#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset */
+
+ #ifdef DEBUG
+-# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
+-# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
+-# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
+-# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
++#define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
++#define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
++#define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
++#define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
+ #else
+-# define CHECK_IP_FETCH()
+-# define CHECK_SP_ACCESS()
+-# define CHECK_MEM_ACCESS()
+-# define CHECK_DATA_ACCESS()
++#define CHECK_IP_FETCH()
++#define CHECK_SP_ACCESS()
++#define CHECK_MEM_ACCESS()
++#define CHECK_DATA_ACCESS()
+ #endif
+
+ #ifdef DEBUG
+-# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
+-# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
+-# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
+-# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
+-# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
+-# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
+-# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
+-# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
+-
+-# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
+-# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
+-# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
+-# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
+-# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
+-# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
+-# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
+-# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
+-# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
++#define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
++#define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
++#define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
++#define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
++#define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
++#define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
++#define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
++#define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
++
++#define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
++#define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
++#define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
++#define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
++#define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
++#define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
++#define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
++#define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
++#define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
+ #else
+-# define DEBUG_INSTRUMENT() 0
+-# define DEBUG_DECODE() 0
+-# define DEBUG_TRACE() 0
+-# define DEBUG_STEP() 0
+-# define DEBUG_DISASSEMBLE() 0
+-# define DEBUG_BREAK() 0
+-# define DEBUG_SVC() 0
+-# define DEBUG_SAVE_IP_CS() 0
+-# define DEBUG_FS() 0
+-# define DEBUG_PROC() 0
+-# define DEBUG_SYSINT() 0
+-# define DEBUG_TRACECALL() 0
+-# define DEBUG_TRACECALLREGS() 0
+-# define DEBUG_SYS() 0
+-# define DEBUG_MEM_TRACE() 0
+-# define DEBUG_IO_TRACE() 0
+-# define DEBUG_DECODE_NOPRINT() 0
++#define DEBUG_INSTRUMENT() 0
++#define DEBUG_DECODE() 0
++#define DEBUG_TRACE() 0
++#define DEBUG_STEP() 0
++#define DEBUG_DISASSEMBLE() 0
++#define DEBUG_BREAK() 0
++#define DEBUG_SVC() 0
++#define DEBUG_SAVE_IP_CS() 0
++#define DEBUG_FS() 0
++#define DEBUG_PROC() 0
++#define DEBUG_SYSINT() 0
++#define DEBUG_TRACECALL() 0
++#define DEBUG_TRACECALLREGS() 0
++#define DEBUG_SYS() 0
++#define DEBUG_MEM_TRACE() 0
++#define DEBUG_IO_TRACE() 0
++#define DEBUG_DECODE_NOPRINT() 0
+ #endif
+
+ #ifdef DEBUG
+
+-# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
++#define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
+ x86emu_decode_printf(x)
+-# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
++#define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
+ x86emu_decode_printf2(x,y)
+
+ /*
+@@ -123,10 +123,10 @@
+ M.x86.saved_ip = y; \
+ }
+ #else
+-# define INC_DECODED_INST_LEN(x)
+-# define DECODE_PRINTF(x)
+-# define DECODE_PRINTF2(x,y)
+-# define SAVE_IP_CS(x,y)
++#define INC_DECODED_INST_LEN(x)
++#define DECODE_PRINTF(x)
++#define DECODE_PRINTF2(x,y)
++#define SAVE_IP_CS(x,y)
+ #endif
+
+ #ifdef DEBUG
+@@ -137,13 +137,13 @@
+ } \
+ if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
+ #else
+-# define TRACE_REGS()
++#define TRACE_REGS()
+ #endif
+
+ #ifdef DEBUG
+-# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
++#define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
+ #else
+-# define SINGLE_STEP()
++#define SINGLE_STEP()
+ #endif
+
+ #define TRACE_AND_STEP() \
+@@ -151,29 +151,29 @@
+ SINGLE_STEP()
+
+ #ifdef DEBUG
+-# define START_OF_INSTR()
+-# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
+-# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
++#define START_OF_INSTR()
++#define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
++#define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
+ #else
+-# define START_OF_INSTR()
+-# define END_OF_INSTR()
+-# define END_OF_INSTR_NO_TRACE()
++#define START_OF_INSTR()
++#define END_OF_INSTR()
++#define END_OF_INSTR_NO_TRACE()
+ #endif
+
+ #ifdef DEBUG
+-# define CALL_TRACE(u,v,w,x,s) \
++#define CALL_TRACE(u,v,w,x,s) \
+ if (DEBUG_TRACECALLREGS()) \
+ x86emu_dump_regs(); \
+ if (DEBUG_TRACECALL()) \
+ printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
+-# define RETURN_TRACE(n,u,v) \
++#define RETURN_TRACE(n,u,v) \
+ if (DEBUG_TRACECALLREGS()) \
+ x86emu_dump_regs(); \
+ if (DEBUG_TRACECALL()) \
+ printk("%04x:%04x: %s\n",u,v,n);
+ #else
+-# define CALL_TRACE(u,v,w,x,s)
+-# define RETURN_TRACE(n,u,v)
++#define CALL_TRACE(u,v,w,x,s)
++#define RETURN_TRACE(n,u,v)
+ #endif
+
+ #ifdef DEBUG
+@@ -185,26 +185,25 @@
+ /*-------------------------- Function Prototypes --------------------------*/
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+-extern void x86emu_inc_decoded_inst_len (int x);
+-extern void x86emu_decode_printf (char *x);
+-extern void x86emu_decode_printf2 (char *x, int y);
+-extern void x86emu_just_disassemble (void);
+-extern void x86emu_single_step (void);
+-extern void x86emu_end_instr (void);
+-extern void x86emu_dump_regs (void);
+-extern void x86emu_dump_xregs (void);
+-extern void x86emu_print_int_vect (u16 iv);
+-extern void x86emu_instrument_instruction (void);
+-extern void x86emu_check_ip_access (void);
+-extern void x86emu_check_sp_access (void);
+-extern void x86emu_check_mem_access (u32 p);
+-extern void x86emu_check_data_access (uint s, uint o);
++ extern void x86emu_inc_decoded_inst_len(int x);
++ extern void x86emu_decode_printf(const char *x);
++ extern void x86emu_decode_printf2(const char *x, int y);
++ extern void x86emu_just_disassemble(void);
++ extern void x86emu_single_step(void);
++ extern void x86emu_end_instr(void);
++ extern void x86emu_dump_regs(void);
++ extern void x86emu_dump_xregs(void);
++ extern void x86emu_print_int_vect(u16 iv);
++ extern void x86emu_instrument_instruction(void);
++ extern void x86emu_check_ip_access(void);
++ extern void x86emu_check_sp_access(void);
++ extern void x86emu_check_mem_access(u32 p);
++ extern void x86emu_check_data_access(uint s, uint o);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_DEBUG_H */
++#endif /* __X86EMU_DEBUG_H */
+diff --git a/libs/x86emu/x86emu/decode.h b/libs/x86emu/x86emu/decode.h
+index 61cd4dc..49a1f7b 100644
+--- a/libs/x86emu/x86emu/decode.h
++++ b/libs/x86emu/x86emu/decode.h
+@@ -52,37 +52,36 @@
+ /*-------------------------- Function Prototypes --------------------------*/
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+-void x86emu_intr_raise (u8 type);
+-void fetch_decode_modrm (int *mod,int *regh,int *regl);
+-u8 fetch_byte_imm (void);
+-u16 fetch_word_imm (void);
+-u32 fetch_long_imm (void);
+-u8 fetch_data_byte (uint offset);
+-u8 fetch_data_byte_abs (uint segment, uint offset);
+-u16 fetch_data_word (uint offset);
+-u16 fetch_data_word_abs (uint segment, uint offset);
+-u32 fetch_data_long (uint offset);
+-u32 fetch_data_long_abs (uint segment, uint offset);
+-void store_data_byte (uint offset, u8 val);
+-void store_data_byte_abs (uint segment, uint offset, u8 val);
+-void store_data_word (uint offset, u16 val);
+-void store_data_word_abs (uint segment, uint offset, u16 val);
+-void store_data_long (uint offset, u32 val);
+-void store_data_long_abs (uint segment, uint offset, u32 val);
+-u8* decode_rm_byte_register(int reg);
+-u16* decode_rm_word_register(int reg);
+-u32* decode_rm_long_register(int reg);
+-u16* decode_rm_seg_register(int reg);
+-u32 decode_rm00_address(int rm);
+-u32 decode_rm01_address(int rm);
+-u32 decode_rm10_address(int rm);
+-u32 decode_sib_address(int sib, int mod);
++ void x86emu_intr_raise(u8 type);
++ void fetch_decode_modrm(int *mod, int *regh, int *regl);
++ u8 fetch_byte_imm(void);
++ u16 fetch_word_imm(void);
++ u32 fetch_long_imm(void);
++ u8 fetch_data_byte(uint offset);
++ u8 fetch_data_byte_abs(uint segment, uint offset);
++ u16 fetch_data_word(uint offset);
++ u16 fetch_data_word_abs(uint segment, uint offset);
++ u32 fetch_data_long(uint offset);
++ u32 fetch_data_long_abs(uint segment, uint offset);
++ void store_data_byte(uint offset, u8 val);
++ void store_data_byte_abs(uint segment, uint offset, u8 val);
++ void store_data_word(uint offset, u16 val);
++ void store_data_word_abs(uint segment, uint offset, u16 val);
++ void store_data_long(uint offset, u32 val);
++ void store_data_long_abs(uint segment, uint offset, u32 val);
++ u8 *decode_rm_byte_register(int reg);
++ u16 *decode_rm_word_register(int reg);
++ u32 *decode_rm_long_register(int reg);
++ u16 *decode_rm_seg_register(int reg);
++ u32 decode_rm00_address(int rm);
++ u32 decode_rm01_address(int rm);
++ u32 decode_rm10_address(int rm);
++ u32 decode_sib_address(int sib, int mod);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_DECODE_H */
++#endif /* __X86EMU_DECODE_H */
+diff --git a/libs/x86emu/x86emu/fpu.h b/libs/x86emu/x86emu/fpu.h
+index 5fb2714..1c11498 100644
+--- a/libs/x86emu/x86emu/fpu.h
++++ b/libs/x86emu/x86emu/fpu.h
+@@ -40,22 +40,21 @@
+ #define __X86EMU_FPU_H
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+ /* these have to be defined, whether 8087 support compiled in or not. */
+
+-extern void x86emuOp_esc_coprocess_d8 (u8 op1);
+-extern void x86emuOp_esc_coprocess_d9 (u8 op1);
+-extern void x86emuOp_esc_coprocess_da (u8 op1);
+-extern void x86emuOp_esc_coprocess_db (u8 op1);
+-extern void x86emuOp_esc_coprocess_dc (u8 op1);
+-extern void x86emuOp_esc_coprocess_dd (u8 op1);
+-extern void x86emuOp_esc_coprocess_de (u8 op1);
+-extern void x86emuOp_esc_coprocess_df (u8 op1);
++ extern void x86emuOp_esc_coprocess_d8(u8 op1);
++ extern void x86emuOp_esc_coprocess_d9(u8 op1);
++ extern void x86emuOp_esc_coprocess_da(u8 op1);
++ extern void x86emuOp_esc_coprocess_db(u8 op1);
++ extern void x86emuOp_esc_coprocess_dc(u8 op1);
++ extern void x86emuOp_esc_coprocess_dd(u8 op1);
++ extern void x86emuOp_esc_coprocess_de(u8 op1);
++ extern void x86emuOp_esc_coprocess_df(u8 op1);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_FPU_H */
++#endif /* __X86EMU_FPU_H */
+diff --git a/libs/x86emu/x86emu/fpu_regs.h b/libs/x86emu/x86emu/fpu_regs.h
+index e59b807..5a780e6 100644
+--- a/libs/x86emu/x86emu/fpu_regs.h
++++ b/libs/x86emu/x86emu/fpu_regs.h
+@@ -42,23 +42,23 @@
+ #ifdef X86_FPU_SUPPORT
+
+ #ifdef PACK
+-# pragma PACK
++#pragma PACK
+ #endif
+
+ /* Basic 8087 register can hold any of the following values: */
+
+ union x86_fpu_reg_u {
+- s8 tenbytes[10];
+- double dval;
+- float fval;
+- s16 sval;
+- s32 lval;
+- };
++ s8 tenbytes[10];
++ double dval;
++ float fval;
++ s16 sval;
++ s32 lval;
++};
+
+ struct x86_fpu_reg {
+- union x86_fpu_reg_u reg;
+- char tag;
+- };
++ union x86_fpu_reg_u reg;
++ char tag;
++};
+
+ /*
+ * Since we are not going to worry about the problems of aliasing
+@@ -83,14 +83,14 @@ struct x86_fpu_reg {
+ #define X86_FPU_STKTOP 0
+
+ struct x86_fpu_registers {
+- struct x86_fpu_reg x86_fpu_stack[8];
+- int x86_fpu_flags;
+- int x86_fpu_config; /* rounding modes, etc. */
+- short x86_fpu_tos, x86_fpu_bos;
+- };
++ struct x86_fpu_reg x86_fpu_stack[8];
++ int x86_fpu_flags;
++ int x86_fpu_config; /* rounding modes, etc. */
++ short x86_fpu_tos, x86_fpu_bos;
++};
+
+ #ifdef END_PACK
+-# pragma END_PACK
++#pragma END_PACK
+ #endif
+
+ /*
+@@ -104,16 +104,16 @@ struct x86_fpu_registers {
+ * instructions.
+ */
+
+-#endif /* X86_FPU_SUPPORT */
++#endif /* X86_FPU_SUPPORT */
+
+ #ifdef DEBUG
+-# define DECODE_PRINTINSTR32(t,mod,rh,rl) \
++#define DECODE_PRINTINSTR32(t,mod,rh,rl) \
+ DECODE_PRINTF(t[(mod<<3)+(rh)]);
+-# define DECODE_PRINTINSTR256(t,mod,rh,rl) \
++#define DECODE_PRINTINSTR256(t,mod,rh,rl) \
+ DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
+ #else
+-# define DECODE_PRINTINSTR32(t,mod,rh,rl)
+-# define DECODE_PRINTINSTR256(t,mod,rh,rl)
++#define DECODE_PRINTINSTR32(t,mod,rh,rl)
++#define DECODE_PRINTINSTR256(t,mod,rh,rl)
+ #endif
+
+-#endif /* __X86EMU_FPU_REGS_H */
++#endif /* __X86EMU_FPU_REGS_H */
+diff --git a/libs/x86emu/x86emu/ops.h b/libs/x86emu/x86emu/ops.h
+index 65ea676..1bc07a4 100644
+--- a/libs/x86emu/x86emu/ops.h
++++ b/libs/x86emu/x86emu/ops.h
+@@ -39,7 +39,7 @@
+ #ifndef __X86EMU_OPS_H
+ #define __X86EMU_OPS_H
+
+-extern void (*x86emu_optab[0x100])(u8 op1);
+-extern void (*x86emu_optab2[0x100])(u8 op2);
++extern void (*x86emu_optab[0x100]) (u8 op1);
++extern void (*x86emu_optab2[0x100]) (u8 op2);
+
+-#endif /* __X86EMU_OPS_H */
++#endif /* __X86EMU_OPS_H */
+diff --git a/libs/x86emu/x86emu/prim_asm.h b/libs/x86emu/x86emu/prim_asm.h
+index e023cf8..aca132b 100644
+--- a/libs/x86emu/x86emu/prim_asm.h
++++ b/libs/x86emu/x86emu/prim_asm.h
+@@ -49,14 +49,16 @@
+ #define __HAVE_INLINE_ASSEMBLER__
+ #endif
+
+-u32 get_flags_asm(void);
++u32 get_flags_asm(void);
++
+ #pragma aux get_flags_asm = \
+ "pushf" \
+ "pop eax" \
+ value [eax] \
+ modify exact [eax];
+
+-u16 aaa_word_asm(u32 *flags,u16 d);
++u16 aaa_word_asm(u32 * flags, u16 d);
++
+ #pragma aux aaa_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -67,7 +69,8 @@ u16 aaa_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u16 aas_word_asm(u32 *flags,u16 d);
++u16 aas_word_asm(u32 * flags, u16 d);
++
+ #pragma aux aas_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -78,7 +81,8 @@ u16 aas_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u16 aad_word_asm(u32 *flags,u16 d);
++u16 aad_word_asm(u32 * flags, u16 d);
++
+ #pragma aux aad_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -89,7 +93,8 @@ u16 aad_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u16 aam_word_asm(u32 *flags,u8 d);
++u16 aam_word_asm(u32 * flags, u8 d);
++
+ #pragma aux aam_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -100,7 +105,8 @@ u16 aam_word_asm(u32 *flags,u8 d);
+ value [ax] \
+ modify exact [ax];
+
+-u8 adc_byte_asm(u32 *flags,u8 d, u8 s);
++u8 adc_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux adc_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -111,7 +117,8 @@ u8 adc_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 adc_word_asm(u32 *flags,u16 d, u16 s);
++u16 adc_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux adc_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -122,7 +129,8 @@ u16 adc_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 adc_long_asm(u32 *flags,u32 d, u32 s);
++u32 adc_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux adc_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -133,7 +141,8 @@ u32 adc_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 add_byte_asm(u32 *flags,u8 d, u8 s);
++u8 add_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux add_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -144,7 +153,8 @@ u8 add_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 add_word_asm(u32 *flags,u16 d, u16 s);
++u16 add_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux add_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -155,7 +165,8 @@ u16 add_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 add_long_asm(u32 *flags,u32 d, u32 s);
++u32 add_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux add_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -166,7 +177,8 @@ u32 add_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 and_byte_asm(u32 *flags,u8 d, u8 s);
++u8 and_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux and_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -177,7 +189,8 @@ u8 and_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 and_word_asm(u32 *flags,u16 d, u16 s);
++u16 and_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux and_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -188,7 +201,8 @@ u16 and_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 and_long_asm(u32 *flags,u32 d, u32 s);
++u32 and_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux and_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -199,7 +213,8 @@ u32 and_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 cmp_byte_asm(u32 *flags,u8 d, u8 s);
++u8 cmp_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux cmp_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -210,7 +225,8 @@ u8 cmp_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 cmp_word_asm(u32 *flags,u16 d, u16 s);
++u16 cmp_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux cmp_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -221,7 +237,8 @@ u16 cmp_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 cmp_long_asm(u32 *flags,u32 d, u32 s);
++u32 cmp_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux cmp_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -232,7 +249,8 @@ u32 cmp_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 daa_byte_asm(u32 *flags,u8 d);
++u8 daa_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux daa_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -243,7 +261,8 @@ u8 daa_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u8 das_byte_asm(u32 *flags,u8 d);
++u8 das_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux das_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -254,7 +273,8 @@ u8 das_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u8 dec_byte_asm(u32 *flags,u8 d);
++u8 dec_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux dec_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -265,7 +285,8 @@ u8 dec_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u16 dec_word_asm(u32 *flags,u16 d);
++u16 dec_word_asm(u32 * flags, u16 d);
++
+ #pragma aux dec_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -276,7 +297,8 @@ u16 dec_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u32 dec_long_asm(u32 *flags,u32 d);
++u32 dec_long_asm(u32 * flags, u32 d);
++
+ #pragma aux dec_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -287,7 +309,8 @@ u32 dec_long_asm(u32 *flags,u32 d);
+ value [eax] \
+ modify exact [eax];
+
+-u8 inc_byte_asm(u32 *flags,u8 d);
++u8 inc_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux inc_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -298,7 +321,8 @@ u8 inc_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u16 inc_word_asm(u32 *flags,u16 d);
++u16 inc_word_asm(u32 * flags, u16 d);
++
+ #pragma aux inc_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -309,7 +333,8 @@ u16 inc_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u32 inc_long_asm(u32 *flags,u32 d);
++u32 inc_long_asm(u32 * flags, u32 d);
++
+ #pragma aux inc_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -320,7 +345,8 @@ u32 inc_long_asm(u32 *flags,u32 d);
+ value [eax] \
+ modify exact [eax];
+
+-u8 or_byte_asm(u32 *flags,u8 d, u8 s);
++u8 or_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux or_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -331,7 +357,8 @@ u8 or_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 or_word_asm(u32 *flags,u16 d, u16 s);
++u16 or_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux or_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -342,7 +369,8 @@ u16 or_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 or_long_asm(u32 *flags,u32 d, u32 s);
++u32 or_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux or_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -353,7 +381,8 @@ u32 or_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 neg_byte_asm(u32 *flags,u8 d);
++u8 neg_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux neg_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -364,7 +393,8 @@ u8 neg_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u16 neg_word_asm(u32 *flags,u16 d);
++u16 neg_word_asm(u32 * flags, u16 d);
++
+ #pragma aux neg_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -375,7 +405,8 @@ u16 neg_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u32 neg_long_asm(u32 *flags,u32 d);
++u32 neg_long_asm(u32 * flags, u32 d);
++
+ #pragma aux neg_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -386,7 +417,8 @@ u32 neg_long_asm(u32 *flags,u32 d);
+ value [eax] \
+ modify exact [eax];
+
+-u8 not_byte_asm(u32 *flags,u8 d);
++u8 not_byte_asm(u32 * flags, u8 d);
++
+ #pragma aux not_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -397,7 +429,8 @@ u8 not_byte_asm(u32 *flags,u8 d);
+ value [al] \
+ modify exact [al];
+
+-u16 not_word_asm(u32 *flags,u16 d);
++u16 not_word_asm(u32 * flags, u16 d);
++
+ #pragma aux not_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -408,7 +441,8 @@ u16 not_word_asm(u32 *flags,u16 d);
+ value [ax] \
+ modify exact [ax];
+
+-u32 not_long_asm(u32 *flags,u32 d);
++u32 not_long_asm(u32 * flags, u32 d);
++
+ #pragma aux not_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -419,7 +453,8 @@ u32 not_long_asm(u32 *flags,u32 d);
+ value [eax] \
+ modify exact [eax];
+
+-u8 rcl_byte_asm(u32 *flags,u8 d, u8 s);
++u8 rcl_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux rcl_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -430,7 +465,8 @@ u8 rcl_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 rcl_word_asm(u32 *flags,u16 d, u8 s);
++u16 rcl_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux rcl_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -441,7 +477,8 @@ u16 rcl_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 rcl_long_asm(u32 *flags,u32 d, u8 s);
++u32 rcl_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux rcl_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -452,7 +489,8 @@ u32 rcl_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 rcr_byte_asm(u32 *flags,u8 d, u8 s);
++u8 rcr_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux rcr_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -463,7 +501,8 @@ u8 rcr_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 rcr_word_asm(u32 *flags,u16 d, u8 s);
++u16 rcr_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux rcr_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -474,7 +513,8 @@ u16 rcr_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 rcr_long_asm(u32 *flags,u32 d, u8 s);
++u32 rcr_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux rcr_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -485,7 +525,8 @@ u32 rcr_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 rol_byte_asm(u32 *flags,u8 d, u8 s);
++u8 rol_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux rol_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -496,7 +537,8 @@ u8 rol_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 rol_word_asm(u32 *flags,u16 d, u8 s);
++u16 rol_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux rol_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -507,7 +549,8 @@ u16 rol_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 rol_long_asm(u32 *flags,u32 d, u8 s);
++u32 rol_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux rol_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -518,7 +561,8 @@ u32 rol_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 ror_byte_asm(u32 *flags,u8 d, u8 s);
++u8 ror_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux ror_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -529,7 +573,8 @@ u8 ror_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 ror_word_asm(u32 *flags,u16 d, u8 s);
++u16 ror_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux ror_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -540,7 +585,8 @@ u16 ror_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 ror_long_asm(u32 *flags,u32 d, u8 s);
++u32 ror_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux ror_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -551,7 +597,8 @@ u32 ror_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 shl_byte_asm(u32 *flags,u8 d, u8 s);
++u8 shl_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux shl_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -562,7 +609,8 @@ u8 shl_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 shl_word_asm(u32 *flags,u16 d, u8 s);
++u16 shl_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux shl_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -573,7 +621,8 @@ u16 shl_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 shl_long_asm(u32 *flags,u32 d, u8 s);
++u32 shl_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux shl_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -584,7 +633,8 @@ u32 shl_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 shr_byte_asm(u32 *flags,u8 d, u8 s);
++u8 shr_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux shr_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -595,7 +645,8 @@ u8 shr_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 shr_word_asm(u32 *flags,u16 d, u8 s);
++u16 shr_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux shr_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -606,7 +657,8 @@ u16 shr_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 shr_long_asm(u32 *flags,u32 d, u8 s);
++u32 shr_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux shr_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -617,7 +669,8 @@ u32 shr_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u8 sar_byte_asm(u32 *flags,u8 d, u8 s);
++u8 sar_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux sar_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -628,7 +681,8 @@ u8 sar_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al cl];
+
+-u16 sar_word_asm(u32 *flags,u16 d, u8 s);
++u16 sar_word_asm(u32 * flags, u16 d, u8 s);
++
+ #pragma aux sar_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -639,7 +693,8 @@ u16 sar_word_asm(u32 *flags,u16 d, u8 s);
+ value [ax] \
+ modify exact [ax cl];
+
+-u32 sar_long_asm(u32 *flags,u32 d, u8 s);
++u32 sar_long_asm(u32 * flags, u32 d, u8 s);
++
+ #pragma aux sar_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -650,7 +705,8 @@ u32 sar_long_asm(u32 *flags,u32 d, u8 s);
+ value [eax] \
+ modify exact [eax cl];
+
+-u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
++u16 shld_word_asm(u32 * flags, u16 d, u16 fill, u8 s);
++
+ #pragma aux shld_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -661,7 +717,8 @@ u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
+ value [ax] \
+ modify exact [ax dx cl];
+
+-u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
++u32 shld_long_asm(u32 * flags, u32 d, u32 fill, u8 s);
++
+ #pragma aux shld_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -672,7 +729,8 @@ u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
+ value [eax] \
+ modify exact [eax edx cl];
+
+-u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
++u16 shrd_word_asm(u32 * flags, u16 d, u16 fill, u8 s);
++
+ #pragma aux shrd_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -683,7 +741,8 @@ u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
+ value [ax] \
+ modify exact [ax dx cl];
+
+-u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
++u32 shrd_long_asm(u32 * flags, u32 d, u32 fill, u8 s);
++
+ #pragma aux shrd_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -694,7 +753,8 @@ u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
+ value [eax] \
+ modify exact [eax edx cl];
+
+-u8 sbb_byte_asm(u32 *flags,u8 d, u8 s);
++u8 sbb_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux sbb_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -705,7 +765,8 @@ u8 sbb_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 sbb_word_asm(u32 *flags,u16 d, u16 s);
++u16 sbb_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux sbb_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -716,7 +777,8 @@ u16 sbb_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 sbb_long_asm(u32 *flags,u32 d, u32 s);
++u32 sbb_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux sbb_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -727,7 +789,8 @@ u32 sbb_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-u8 sub_byte_asm(u32 *flags,u8 d, u8 s);
++u8 sub_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux sub_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -738,7 +801,8 @@ u8 sub_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 sub_word_asm(u32 *flags,u16 d, u16 s);
++u16 sub_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux sub_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -749,7 +813,8 @@ u16 sub_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 sub_long_asm(u32 *flags,u32 d, u32 s);
++u32 sub_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux sub_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -760,7 +825,8 @@ u32 sub_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-void test_byte_asm(u32 *flags,u8 d, u8 s);
++void test_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux test_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -770,7 +836,8 @@ void test_byte_asm(u32 *flags,u8 d, u8 s);
+ parm [edi] [al] [bl] \
+ modify exact [al bl];
+
+-void test_word_asm(u32 *flags,u16 d, u16 s);
++void test_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux test_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -780,7 +847,8 @@ void test_word_asm(u32 *flags,u16 d, u16 s);
+ parm [edi] [ax] [bx] \
+ modify exact [ax bx];
+
+-void test_long_asm(u32 *flags,u32 d, u32 s);
++void test_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux test_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -790,7 +858,8 @@ void test_long_asm(u32 *flags,u32 d, u32 s);
+ parm [edi] [eax] [ebx] \
+ modify exact [eax ebx];
+
+-u8 xor_byte_asm(u32 *flags,u8 d, u8 s);
++u8 xor_byte_asm(u32 * flags, u8 d, u8 s);
++
+ #pragma aux xor_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -801,7 +870,8 @@ u8 xor_byte_asm(u32 *flags,u8 d, u8 s);
+ value [al] \
+ modify exact [al bl];
+
+-u16 xor_word_asm(u32 *flags,u16 d, u16 s);
++u16 xor_word_asm(u32 * flags, u16 d, u16 s);
++
+ #pragma aux xor_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -812,7 +882,8 @@ u16 xor_word_asm(u32 *flags,u16 d, u16 s);
+ value [ax] \
+ modify exact [ax bx];
+
+-u32 xor_long_asm(u32 *flags,u32 d, u32 s);
++u32 xor_long_asm(u32 * flags, u32 d, u32 s);
++
+ #pragma aux xor_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -823,7 +894,8 @@ u32 xor_long_asm(u32 *flags,u32 d, u32 s);
+ value [eax] \
+ modify exact [eax ebx];
+
+-void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
++void imul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s);
++
+ #pragma aux imul_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -834,7 +906,8 @@ void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
+ parm [edi] [esi] [al] [bl] \
+ modify exact [esi ax bl];
+
+-void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
++void imul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s);
++
+ #pragma aux imul_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -846,7 +919,8 @@ void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
+ parm [edi] [esi] [ecx] [ax] [bx]\
+ modify exact [esi edi ax bx dx];
+
+-void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
++void imul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s);
++
+ #pragma aux imul_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -858,7 +932,8 @@ void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
+ parm [edi] [esi] [ecx] [eax] [ebx] \
+ modify exact [esi edi eax ebx edx];
+
+-void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
++void mul_byte_asm(u32 * flags, u16 * ax, u8 d, u8 s);
++
+ #pragma aux mul_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -869,7 +944,8 @@ void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
+ parm [edi] [esi] [al] [bl] \
+ modify exact [esi ax bl];
+
+-void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
++void mul_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 d, u16 s);
++
+ #pragma aux mul_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -881,7 +957,8 @@ void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
+ parm [edi] [esi] [ecx] [ax] [bx]\
+ modify exact [esi edi ax bx dx];
+
+-void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
++void mul_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 d, u32 s);
++
+ #pragma aux mul_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -893,7 +970,8 @@ void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
+ parm [edi] [esi] [ecx] [eax] [ebx] \
+ modify exact [esi edi eax ebx edx];
+
+-void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
++void idiv_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s);
++
+ #pragma aux idiv_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -905,7 +983,8 @@ void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
+ parm [edi] [esi] [ecx] [ax] [bl]\
+ modify exact [esi edi ax bl];
+
+-void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
++void idiv_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s);
++
+ #pragma aux idiv_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -917,7 +996,8 @@ void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
+ parm [edi] [esi] [ecx] [ax] [dx] [bx]\
+ modify exact [esi edi ax dx bx];
+
+-void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
++void idiv_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s);
++
+ #pragma aux idiv_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -929,7 +1009,8 @@ void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
+ parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
+ modify exact [esi edi eax edx ebx];
+
+-void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
++void div_byte_asm(u32 * flags, u8 * al, u8 * ah, u16 d, u8 s);
++
+ #pragma aux div_byte_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -941,7 +1022,8 @@ void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
+ parm [edi] [esi] [ecx] [ax] [bl]\
+ modify exact [esi edi ax bl];
+
+-void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
++void div_word_asm(u32 * flags, u16 * ax, u16 * dx, u16 dlo, u16 dhi, u16 s);
++
+ #pragma aux div_word_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -953,7 +1035,8 @@ void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
+ parm [edi] [esi] [ecx] [ax] [dx] [bx]\
+ modify exact [esi edi ax dx bx];
+
+-void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
++void div_long_asm(u32 * flags, u32 * eax, u32 * edx, u32 dlo, u32 dhi, u32 s);
++
+ #pragma aux div_long_asm = \
+ "push [edi]" \
+ "popf" \
+@@ -967,4 +1050,4 @@ void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
+
+ #endif
+
+-#endif /* __X86EMU_PRIM_ASM_H */
++#endif /* __X86EMU_PRIM_ASM_H */
+diff --git a/libs/x86emu/x86emu/prim_ops.h b/libs/x86emu/x86emu/prim_ops.h
+index bea8357..0f0e78d 100644
+--- a/libs/x86emu/x86emu/prim_ops.h
++++ b/libs/x86emu/x86emu/prim_ops.h
+@@ -40,102 +40,102 @@
+ #define __X86EMU_PRIM_OPS_H
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+-u16 aaa_word (u16 d);
+-u16 aas_word (u16 d);
+-u16 aad_word (u16 d);
+-u16 aam_word (u8 d);
+-u8 adc_byte (u8 d, u8 s);
+-u16 adc_word (u16 d, u16 s);
+-u32 adc_long (u32 d, u32 s);
+-u8 add_byte (u8 d, u8 s);
+-u16 add_word (u16 d, u16 s);
+-u32 add_long (u32 d, u32 s);
+-u8 and_byte (u8 d, u8 s);
+-u16 and_word (u16 d, u16 s);
+-u32 and_long (u32 d, u32 s);
+-u8 cmp_byte (u8 d, u8 s);
+-u16 cmp_word (u16 d, u16 s);
+-u32 cmp_long (u32 d, u32 s);
+-u8 daa_byte (u8 d);
+-u8 das_byte (u8 d);
+-u8 dec_byte (u8 d);
+-u16 dec_word (u16 d);
+-u32 dec_long (u32 d);
+-u8 inc_byte (u8 d);
+-u16 inc_word (u16 d);
+-u32 inc_long (u32 d);
+-u8 or_byte (u8 d, u8 s);
+-u16 or_word (u16 d, u16 s);
+-u32 or_long (u32 d, u32 s);
+-u8 neg_byte (u8 s);
+-u16 neg_word (u16 s);
+-u32 neg_long (u32 s);
+-u8 not_byte (u8 s);
+-u16 not_word (u16 s);
+-u32 not_long (u32 s);
+-u8 rcl_byte (u8 d, u8 s);
+-u16 rcl_word (u16 d, u8 s);
+-u32 rcl_long (u32 d, u8 s);
+-u8 rcr_byte (u8 d, u8 s);
+-u16 rcr_word (u16 d, u8 s);
+-u32 rcr_long (u32 d, u8 s);
+-u8 rol_byte (u8 d, u8 s);
+-u16 rol_word (u16 d, u8 s);
+-u32 rol_long (u32 d, u8 s);
+-u8 ror_byte (u8 d, u8 s);
+-u16 ror_word (u16 d, u8 s);
+-u32 ror_long (u32 d, u8 s);
+-u8 shl_byte (u8 d, u8 s);
+-u16 shl_word (u16 d, u8 s);
+-u32 shl_long (u32 d, u8 s);
+-u8 shr_byte (u8 d, u8 s);
+-u16 shr_word (u16 d, u8 s);
+-u32 shr_long (u32 d, u8 s);
+-u8 sar_byte (u8 d, u8 s);
+-u16 sar_word (u16 d, u8 s);
+-u32 sar_long (u32 d, u8 s);
+-u16 shld_word (u16 d, u16 fill, u8 s);
+-u32 shld_long (u32 d, u32 fill, u8 s);
+-u16 shrd_word (u16 d, u16 fill, u8 s);
+-u32 shrd_long (u32 d, u32 fill, u8 s);
+-u8 sbb_byte (u8 d, u8 s);
+-u16 sbb_word (u16 d, u16 s);
+-u32 sbb_long (u32 d, u32 s);
+-u8 sub_byte (u8 d, u8 s);
+-u16 sub_word (u16 d, u16 s);
+-u32 sub_long (u32 d, u32 s);
+-void test_byte (u8 d, u8 s);
+-void test_word (u16 d, u16 s);
+-void test_long (u32 d, u32 s);
+-u8 xor_byte (u8 d, u8 s);
+-u16 xor_word (u16 d, u16 s);
+-u32 xor_long (u32 d, u32 s);
+-void imul_byte (u8 s);
+-void imul_word (u16 s);
+-void imul_long (u32 s);
+-void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s);
+-void mul_byte (u8 s);
+-void mul_word (u16 s);
+-void mul_long (u32 s);
+-void idiv_byte (u8 s);
+-void idiv_word (u16 s);
+-void idiv_long (u32 s);
+-void div_byte (u8 s);
+-void div_word (u16 s);
+-void div_long (u32 s);
+-void ins (int size);
+-void outs (int size);
+-u16 mem_access_word (int addr);
+-void push_word (u16 w);
+-void push_long (u32 w);
+-u16 pop_word (void);
+-u32 pop_long (void);
++ u16 aaa_word(u16 d);
++ u16 aas_word(u16 d);
++ u16 aad_word(u16 d);
++ u16 aam_word(u8 d);
++ u8 adc_byte(u8 d, u8 s);
++ u16 adc_word(u16 d, u16 s);
++ u32 adc_long(u32 d, u32 s);
++ u8 add_byte(u8 d, u8 s);
++ u16 add_word(u16 d, u16 s);
++ u32 add_long(u32 d, u32 s);
++ u8 and_byte(u8 d, u8 s);
++ u16 and_word(u16 d, u16 s);
++ u32 and_long(u32 d, u32 s);
++ u8 cmp_byte(u8 d, u8 s);
++ u16 cmp_word(u16 d, u16 s);
++ u32 cmp_long(u32 d, u32 s);
++ u8 daa_byte(u8 d);
++ u8 das_byte(u8 d);
++ u8 dec_byte(u8 d);
++ u16 dec_word(u16 d);
++ u32 dec_long(u32 d);
++ u8 inc_byte(u8 d);
++ u16 inc_word(u16 d);
++ u32 inc_long(u32 d);
++ u8 or_byte(u8 d, u8 s);
++ u16 or_word(u16 d, u16 s);
++ u32 or_long(u32 d, u32 s);
++ u8 neg_byte(u8 s);
++ u16 neg_word(u16 s);
++ u32 neg_long(u32 s);
++ u8 not_byte(u8 s);
++ u16 not_word(u16 s);
++ u32 not_long(u32 s);
++ u8 rcl_byte(u8 d, u8 s);
++ u16 rcl_word(u16 d, u8 s);
++ u32 rcl_long(u32 d, u8 s);
++ u8 rcr_byte(u8 d, u8 s);
++ u16 rcr_word(u16 d, u8 s);
++ u32 rcr_long(u32 d, u8 s);
++ u8 rol_byte(u8 d, u8 s);
++ u16 rol_word(u16 d, u8 s);
++ u32 rol_long(u32 d, u8 s);
++ u8 ror_byte(u8 d, u8 s);
++ u16 ror_word(u16 d, u8 s);
++ u32 ror_long(u32 d, u8 s);
++ u8 shl_byte(u8 d, u8 s);
++ u16 shl_word(u16 d, u8 s);
++ u32 shl_long(u32 d, u8 s);
++ u8 shr_byte(u8 d, u8 s);
++ u16 shr_word(u16 d, u8 s);
++ u32 shr_long(u32 d, u8 s);
++ u8 sar_byte(u8 d, u8 s);
++ u16 sar_word(u16 d, u8 s);
++ u32 sar_long(u32 d, u8 s);
++ u16 shld_word(u16 d, u16 fill, u8 s);
++ u32 shld_long(u32 d, u32 fill, u8 s);
++ u16 shrd_word(u16 d, u16 fill, u8 s);
++ u32 shrd_long(u32 d, u32 fill, u8 s);
++ u8 sbb_byte(u8 d, u8 s);
++ u16 sbb_word(u16 d, u16 s);
++ u32 sbb_long(u32 d, u32 s);
++ u8 sub_byte(u8 d, u8 s);
++ u16 sub_word(u16 d, u16 s);
++ u32 sub_long(u32 d, u32 s);
++ void test_byte(u8 d, u8 s);
++ void test_word(u16 d, u16 s);
++ void test_long(u32 d, u32 s);
++ u8 xor_byte(u8 d, u8 s);
++ u16 xor_word(u16 d, u16 s);
++ u32 xor_long(u32 d, u32 s);
++ void imul_byte(u8 s);
++ void imul_word(u16 s);
++ void imul_long(u32 s);
++ void imul_long_direct(u32 * res_lo, u32 * res_hi, u32 d, u32 s);
++ void mul_byte(u8 s);
++ void mul_word(u16 s);
++ void mul_long(u32 s);
++ void idiv_byte(u8 s);
++ void idiv_word(u16 s);
++ void idiv_long(u32 s);
++ void div_byte(u8 s);
++ void div_word(u16 s);
++ void div_long(u32 s);
++ void ins(int size);
++ void outs(int size);
++ u16 mem_access_word(int addr);
++ void push_word(u16 w);
++ void push_long(u32 w);
++ u16 pop_word(void);
++ u32 pop_long(void);
++ void cpuid(void);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_PRIM_OPS_H */
++#endif /* __X86EMU_PRIM_OPS_H */
+diff --git a/libs/x86emu/x86emu/prim_x86_gcc.h b/libs/x86emu/x86emu/prim_x86_gcc.h
+new file mode 100644
+index 0000000..646ec9d
+--- /dev/null
++++ b/libs/x86emu/x86emu/prim_x86_gcc.h
+@@ -0,0 +1,77 @@
++/****************************************************************************
++*
++* Inline helpers for x86emu
++*
++* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC
++*
++* ========================================================================
++*
++* Permission to use, copy, modify, distribute, and sell this software and
++* its documentation for any purpose is hereby granted without fee,
++* provided that the above copyright notice appear in all copies and that
++* both that copyright notice and this permission notice appear in
++* supporting documentation, and that the name of the authors not be used
++* in advertising or publicity pertaining to distribution of the software
++* without specific, written prior permission. The authors makes no
++* representations about the suitability of this software for any purpose.
++* It is provided "as is" without express or implied warranty.
++*
++* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
++* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
++* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
++* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
++* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
++* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++* PERFORMANCE OF THIS SOFTWARE.
++*
++* ========================================================================
++*
++* Language: GNU C
++* Environment: GCC on i386 or x86-64
++* Developer: Bart Trojanowski
++*
++* Description: This file defines a few x86 macros that can be used by the
++* emulator to execute native instructions.
++*
++* For PIC vs non-PIC code refer to:
++* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
++*
++****************************************************************************/
++#ifndef __X86EMU_PRIM_X86_GCC_H
++#define __X86EMU_PRIM_X86_GCC_H
++
++#include "x86emu/types.h"
++
++#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__))
++#error This file is intended to be used by gcc on i386 or x86-64 system
++#endif
++
++#if defined(__PIC__) && defined(__i386__)
++
++#define X86EMU_HAS_HW_CPUID 1
++static inline void
++hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
++{
++ __asm__ __volatile__("pushl %%ebx \n\t"
++ "cpuid \n\t"
++ "movl %%ebx, %1 \n\t"
++ "popl %%ebx \n\t":"=a"(*a), "=r"(*b),
++ "=c"(*c), "=d"(*d)
++ :"a"(*a), "c"(*c)
++ :"cc");
++}
++
++#else /* ! (__PIC__ && __i386__) */
++
++#define x86EMU_HAS_HW_CPUID 1
++static inline void
++hw_cpuid(u32 * a, u32 * b, u32 * c, u32 * d)
++{
++ __asm__ __volatile__("cpuid":"=a"(*a), "=b"(*b), "=c"(*c), "=d"(*d)
++ :"a"(*a), "c"(*c)
++ :"cc");
++}
++
++#endif /* __PIC__ && __i386__ */
++
++#endif /* __X86EMU_PRIM_X86_GCC_H */
+diff --git a/libs/x86emu/x86emu/regs.h b/libs/x86emu/x86emu/regs.h
+index 52cf8e4..6bd0611 100644
+--- a/libs/x86emu/x86emu/regs.h
++++ b/libs/x86emu/x86emu/regs.h
+@@ -42,7 +42,7 @@
+ /*---------------------- Macros and type definitions ----------------------*/
+
+ #ifdef PACK
+-# pragma PACK
++#pragma PACK
+ #endif
+
+ /*
+@@ -64,48 +64,48 @@
+
+ typedef struct {
+ u32 e_reg;
+- } I32_reg_t;
++} I32_reg_t;
+
+ typedef struct {
+- u16 filler0, x_reg;
+- } I16_reg_t;
++ u16 filler0, x_reg;
++} I16_reg_t;
+
+ typedef struct {
+- u8 filler0, filler1, h_reg, l_reg;
+- } I8_reg_t;
++ u8 filler0, filler1, h_reg, l_reg;
++} I8_reg_t;
+
+-#else /* !__BIG_ENDIAN__ */
++#else /* !__BIG_ENDIAN__ */
+
+ typedef struct {
+ u32 e_reg;
+- } I32_reg_t;
++} I32_reg_t;
+
+ typedef struct {
+- u16 x_reg;
+- } I16_reg_t;
++ u16 x_reg;
++} I16_reg_t;
+
+ typedef struct {
+- u8 l_reg, h_reg;
+- } I8_reg_t;
++ u8 l_reg, h_reg;
++} I8_reg_t;
+
+-#endif /* BIG_ENDIAN */
++#endif /* BIG_ENDIAN */
+
+ typedef union {
+- I32_reg_t I32_reg;
+- I16_reg_t I16_reg;
+- I8_reg_t I8_reg;
+- } i386_general_register;
++ I32_reg_t I32_reg;
++ I16_reg_t I16_reg;
++ I8_reg_t I8_reg;
++} i386_general_register;
+
+ struct i386_general_regs {
+- i386_general_register A, B, C, D;
+- };
++ i386_general_register A, B, C, D;
++};
+
+ typedef struct i386_general_regs Gen_reg_t;
+
+ struct i386_special_regs {
+- i386_general_register SP, BP, SI, DI, IP;
+- u32 FLAGS;
+- };
++ i386_general_register SP, BP, SI, DI, IP;
++ u32 FLAGS;
++};
+
+ /*
+ * Segment registers here represent the 16 bit quantities
+@@ -114,7 +114,7 @@ struct i386_special_regs {
+
+ struct i386_segment_regs {
+ u16 CS, DS, SS, ES, FS, GS;
+- };
++};
+
+ /* 8 bit registers */
+ #define R_AH gen.A.I8_reg.h_reg
+@@ -258,9 +258,9 @@ struct i386_segment_regs {
+ #define INTR_HALTED 0x4
+
+ typedef struct {
+- struct i386_general_regs gen;
+- struct i386_special_regs spc;
+- struct i386_segment_regs seg;
++ struct i386_general_regs gen;
++ struct i386_special_regs spc;
++ struct i386_segment_regs seg;
+ /*
+ * MODE contains information on:
+ * REPE prefix 2 bits repe,repne
+@@ -273,21 +273,21 @@ typedef struct {
+ * Extern interrupt 1 bits
+ * Halted 1 bits
+ */
+- u32 mode;
+- volatile int intr; /* mask of pending interrupts */
+- int debug;
++ u32 mode;
++ volatile int intr; /* mask of pending interrupts */
++ int debug;
+ #ifdef DEBUG
+- int check;
+- u16 saved_ip;
+- u16 saved_cs;
+- int enc_pos;
+- int enc_str_pos;
+- char decode_buf[32]; /* encoded byte stream */
+- char decoded_buf[256]; /* disassembled strings */
++ int check;
++ u16 saved_ip;
++ u16 saved_cs;
++ int enc_pos;
++ int enc_str_pos;
++ char decode_buf[32]; /* encoded byte stream */
++ char decoded_buf[256]; /* disassembled strings */
+ #endif
+- u8 intno;
+- u8 __pad[3];
+- } X86EMU_regs;
++ u8 intno;
++ u8 __pad[3];
++} X86EMU_regs;
+
+ /****************************************************************************
+ REMARKS:
+@@ -300,20 +300,20 @@ private - private data pointer
+ x86 - X86 registers
+ ****************************************************************************/
+ typedef struct {
+- unsigned long mem_base;
+- unsigned long mem_size;
+- void* private;
+- X86EMU_regs x86;
+- } X86EMU_sysEnv;
++ unsigned long mem_base;
++ unsigned long mem_size;
++ void *private;
++ X86EMU_regs x86;
++} X86EMU_sysEnv;
+
+ #ifdef END_PACK
+-# pragma END_PACK
++#pragma END_PACK
+ #endif
+
+ /*----------------------------- Global Variables --------------------------*/
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+ /* Global emulator machine state.
+@@ -321,17 +321,16 @@ extern "C" { /* Use "C" linkage when in C++ mode */
+ * We keep it global to avoid pointer dereferences in the code for speed.
+ */
+
+-extern X86EMU_sysEnv _X86EMU_env;
++ extern X86EMU_sysEnv _X86EMU_env;
+ #define M _X86EMU_env
+
+ /*-------------------------- Function Prototypes --------------------------*/
+
+ /* Function to log information at runtime */
+
+-void printk(const char *fmt, ...);
++ void printk(const char *fmt, ...);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_REGS_H */
++#endif /* __X86EMU_REGS_H */
+diff --git a/libs/x86emu/x86emu/types.h b/libs/x86emu/x86emu/types.h
+index c0c09c1..5a6ef01 100644
+--- a/libs/x86emu/x86emu/types.h
++++ b/libs/x86emu/x86emu/types.h
+@@ -36,7 +36,6 @@
+ *
+ ****************************************************************************/
+
+-
+ #ifndef __X86EMU_TYPES_H
+ #define __X86EMU_TYPES_H
+
+@@ -61,46 +60,21 @@
+
+ /*---------------------- Macros and type definitions ----------------------*/
+
+-/* Currently only for Linux/32bit */
+-#undef __HAS_LONG_LONG__
+-#if defined(__GNUC__) && !defined(NO_LONG_LONG)
+-#define __HAS_LONG_LONG__
+-#endif
++#include <stdint.h>
+
+-/* Taken from Xmd.h */
+-#undef NUM32
+-#if defined (_LP64) || \
+- defined(__alpha) || defined(__alpha__) || \
+- defined(__ia64__) || defined(ia64) || \
+- defined(__sparc64__) || \
+- defined(__s390x__) || \
+- (defined(__hppa__) && defined(__LP64)) || \
+- defined(__amd64__) || defined(amd64) || \
+- (defined(__sgi) && (_MIPS_SZLONG == 64))
+-#define NUM32 int
+-#else
+-#define NUM32 long
+-#endif
++typedef uint8_t u8;
++typedef uint16_t u16;
++typedef uint32_t u32;
++typedef uint64_t u64;
+
+-typedef unsigned char u8;
+-typedef unsigned short u16;
+-typedef unsigned NUM32 u32;
+-#ifdef __HAS_LONG_LONG__
+-typedef unsigned long long u64;
+-#endif
++typedef int8_t s8;
++typedef int16_t s16;
++typedef int32_t s32;
++typedef int64_t s64;
+
+-typedef char s8;
+-typedef short s16;
+-typedef NUM32 s32;
+-#ifdef __HAS_LONG_LONG__
+-typedef long long s64;
+-#endif
+-
+-typedef unsigned int uint;
+-typedef int sint;
++typedef unsigned int uint;
++typedef int sint;
+
+ typedef u16 X86EMU_pioAddr;
+
+-#undef NUM32
+-
+-#endif /* __X86EMU_TYPES_H */
++#endif /* __X86EMU_TYPES_H */
+diff --git a/libs/x86emu/x86emu/x86emui.h b/libs/x86emu/x86emu/x86emui.h
+index 112ee36..f11dc10 100644
+--- a/libs/x86emu/x86emu/x86emui.h
++++ b/libs/x86emu/x86emu/x86emui.h
+@@ -38,7 +38,6 @@
+ *
+ ****************************************************************************/
+
+-
+ #ifndef __X86EMU_X86EMUI_H
+ #define __X86EMU_X86EMUI_H
+
+@@ -74,29 +73,28 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#endif
++#endif
+ /*--------------------------- Inline Functions ----------------------------*/
+
+ #ifdef __cplusplus
+-extern "C" { /* Use "C" linkage when in C++ mode */
++extern "C" { /* Use "C" linkage when in C++ mode */
+ #endif
+
+-extern u8 (X86APIP sys_rdb)(u32 addr);
+-extern u16 (X86APIP sys_rdw)(u32 addr);
+-extern u32 (X86APIP sys_rdl)(u32 addr);
+-extern void (X86APIP sys_wrb)(u32 addr,u8 val);
+-extern void (X86APIP sys_wrw)(u32 addr,u16 val);
+-extern void (X86APIP sys_wrl)(u32 addr,u32 val);
++ extern u8(X86APIP sys_rdb) (u32 addr);
++ extern u16(X86APIP sys_rdw) (u32 addr);
++ extern u32(X86APIP sys_rdl) (u32 addr);
++ extern void (X86APIP sys_wrb) (u32 addr, u8 val);
++ extern void (X86APIP sys_wrw) (u32 addr, u16 val);
++ extern void (X86APIP sys_wrl) (u32 addr, u32 val);
+
+-extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
+-extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
+-extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
+-extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val);
+-extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val);
+-extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val);
++ extern u8(X86APIP sys_inb) (X86EMU_pioAddr addr);
++ extern u16(X86APIP sys_inw) (X86EMU_pioAddr addr);
++ extern u32(X86APIP sys_inl) (X86EMU_pioAddr addr);
++ extern void (X86APIP sys_outb) (X86EMU_pioAddr addr, u8 val);
++ extern void (X86APIP sys_outw) (X86EMU_pioAddr addr, u16 val);
++ extern void (X86APIP sys_outl) (X86EMU_pioAddr addr, u32 val);
+
+ #ifdef __cplusplus
+-} /* End of "C" linkage for C++ */
++} /* End of "C" linkage for C++ */
+ #endif
+-
+-#endif /* __X86EMU_X86EMUI_H */
++#endif /* __X86EMU_X86EMUI_H */
+--
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/ar-from-env.patch b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/ar-from-env.patch
new file mode 100644
index 000000000..1dcbc71dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/ar-from-env.patch
@@ -0,0 +1,33 @@
+Fix cross link using host-cross ar
+
+If building on 32bit host and creating 64bit libraries, the target
+package builds should not invoke the 32bit hosts's ar. Specifically
+you will get an error message like:
+
+x86_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
+libs/x86emu/libx86emu.a: could not read symbols: Archive has no index; run ranlib to add one
+collect2: error: ld returned 1 exit status
+
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+
+Upstream-Status: Pending
+
+---
+ libs/x86emu/Makefile | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/libs/x86emu/Makefile
++++ b/libs/x86emu/Makefile
+@@ -1,7 +1,11 @@
+ OBJS = decode.o fpu.o ops.o ops2.o prim_ops.o sys.o
+
++ifeq ($(AR),)
++ AR = ar
++endif
++
+ libx86emu.a: $(OBJS)
+- ar rv $@ $+
++ $(AR) rv $@ $+
+
+ %.o: %.c
+ $(CC) -c $(CFLAGS) -o $@ $<
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/fbsetup b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/fbsetup
new file mode 100755
index 000000000..2a409cc52
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/fbsetup
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/sbin/modprobe uvesafb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/uvesafb.conf b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/uvesafb.conf
new file mode 100644
index 000000000..43789755d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d/uvesafb.conf
@@ -0,0 +1,2 @@
+# Load uvesafb.ko at boot
+uvesafb
diff --git a/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d_0.1.10.bb b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d_0.1.10.bb
new file mode 100644
index 000000000..f50207212
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-bsp/v86d/v86d_0.1.10.bb
@@ -0,0 +1,69 @@
+SUMMARY = "User support binary for the uvesafb kernel module"
+HOMEPAGE = "http://dev.gentoo.org/~spock/projects/uvesafb/"
+
+# the copyright info is at the bottom of README, expect break
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://README;md5=94ac1971e4f2309dc322d598e7b1f7dd"
+
+DEPENDS = "virtual/kernel"
+RRECOMMENDS_${PN} = "kernel-module-uvesafb"
+PR = "r2"
+
+SRC_URI = "http://distfiles.gentoo.org/distfiles/${BP}.tar.bz2 \
+ file://Update-x86emu-from-X.org.patch \
+ file://fbsetup \
+ file://uvesafb.conf \
+ file://ar-from-env.patch"
+
+SRC_URI[md5sum] = "51c792ba7b874ad8c43f0d3da4cfabe0"
+SRC_URI[sha256sum] = "634964ae18ef68c8493add2ce150e3b4502badeb0d9194b4bd81241d25e6735c"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
+
+INITSCRIPT_NAME = "fbsetup"
+INITSCRIPT_PARAMS = "start 0 S ."
+
+do_configure () {
+ ./configure --with-x86emu
+}
+
+do_compile () {
+ KDIR="${STAGING_DIR_HOST}/usr" make
+}
+
+do_install () {
+ install -d ${D}${base_sbindir}
+ install v86d ${D}${base_sbindir}/
+
+ # Only install fbsetup script if 'sysvinit' is in DISTRO_FEATURES
+ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ install -d ${D}${sysconfdir}/init.d/
+ install -m 0755 ${WORKDIR}/fbsetup ${D}${sysconfdir}/init.d/fbsetup
+ fi
+
+ # Install systemd related configuration file
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${sysconfdir}/modules-load.d
+ install -m 0644 ${WORKDIR}/uvesafb.conf ${D}${sysconfdir}/modules-load.d
+ fi
+}
+
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
+# manually to avoid unnecessary postinst/preinst generated.
+python __anonymous() {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
+inherit update-rc.d
+
+DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+pkg_postinst_${PN} () {
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
+ if [ -n "$D" ]; then
+ OPTS="--root=$D"
+ fi
+ systemctl $OPTS mask fbsetup.service
+ fi
+}
OpenPOWER on IntegriCloud