diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/Makefile ./Makefile
--- ../../branches/vendor/bomstrip/Makefile	1970-01-01 02:00:00.000000000 +0200
+++ ./Makefile	2008-06-13 20:27:34.000000000 +0300
@@ -0,0 +1,104 @@
+# Makefile for bomstrip, the UTF-8 BOM stripper
+#
+# Written by Peter Pentchev in 2008.
+# This file is hereby placed into the public domain.
+
+LOCALBASE?=	/usr/local
+PREFIX?=	${LOCALBASE}
+BINDIR?=	${PREFIX}/bin
+MANDIR?=	${PREFIX}/man/man
+SHAREDIR?=	${PREFIX}/share/bomstrip
+
+PROG=		bomstrip
+SRCS=		bomstrip.c
+OBJS=		${SRCS:%.c=%.o}
+BFILES=		bomstrip-files
+
+SOURCES=	bomstrip.b \
+		bomstrip.bf \
+		bomstrip.c \
+		bomstrip.hs \
+		bomstrip.ocaml \
+		bomstrip.ook \
+		bomstrip.pas \
+		bomstrip.php \
+		bomstrip.pl \
+		bomstrip.ps \
+		bomstrip.py \
+		bomstrip.rb \
+		bomstrip.sed \
+		bomstrip.unl
+TESTS=		bom0 bom1 bom-ml1 bom-ml2 bom-ml3 bom-ml4 \
+		nobom0 nobom1 nobom2 nobom-ml1 nobom-ml2 nobom-ml3 nobom-ml4
+TESTS_CORRECT=	${TESTS:%=correct/r%}
+
+CFLAGS_WARN?=	-Wall -W -Werror -ansi -pedantic -Wbad-function-cast \
+		-Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
+		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+		-Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
+CFLAGS_OPT?=	-O2 -pipe
+CFLAGS_DBG?=
+
+CFLAGS?=	${CFLAGS_WARN} ${CFLAGS_OPT} ${CFLAGS_DBG}
+LDFLAGS?=
+LIBS?=
+
+COPY?=		-c
+STRIP?=		-s
+
+BINOWN?=	root
+BINGRP?=	root
+BINMODE?=	755
+
+SHAREOWN?=	${BINOWN}
+SHAREGRP?=	${BINGRP}
+SHAREMODE?=	644
+
+CC?=		cc
+GZIP?=		gzip -c -9
+LN?=		ln
+MKDIR?=		mkdir -p
+RM?=		rm -f
+
+INSTALL?=	install
+INSTALL_PROGRAM?=	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
+INSTALL_SCRIPT?=	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
+INSTALL_DATA?=		${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
+
+all:		${PROG} ${PROG}.1.gz
+
+clean:
+		${RM} ${PROG} ${OBJS} ${PROG}.1.gz
+
+install:	all
+		${MKDIR} ${DESTDIR}${BINDIR}
+		${INSTALL_PROGRAM} ${PROG} ${DESTDIR}${BINDIR}
+		${INSTALL_SCRIPT} ${BFILES}.sh ${DESTDIR}${BINDIR}/${BFILES}
+		${MKDIR} ${DESTDIR}${MANDIR}1
+		${INSTALL_DATA} ${PROG}.1.gz ${DESTDIR}${MANDIR}1
+		${RM} ${DESTDIR}${MANDIR}1/${BFILES}.1.gz
+		${LN} ${DESTDIR}${MANDIR}1/${PROG}.1.gz ${DESTDIR}${MANDIR}1/${BFILES}.1.gz
+		${MKDIR} ${DESTDIR}${SHAREDIR}/source
+		${INSTALL_DATA} ${SOURCES} ${DESTDIR}${SHAREDIR}/source
+		${MKDIR} ${DESTDIR}${SHAREDIR}/tests/correct
+		${INSTALL_DATA} ${TESTS} ${DESTDIR}${SHAREDIR}/tests
+		${INSTALL_DATA} ${TESTS_CORRECT} ${DESTDIR}${SHAREDIR}/tests/correct
+
+# If you set the TEST_X environment variable to, say, "-x", you may
+# get a bit more verbose shell output.
+# For the present, the test.sh script does not take any arguments, but
+# why not foresee the possibility - just set TEST_ARGS and go.
+#
+test:		all
+		BOM=./bomstrip BOMFILES="${TESTS}" sh ${TEST_X} test.sh ${TEST_ARGS}
+
+${PROG}:	${OBJS}
+		${CC} ${LDFLAGS} ${STRIP} -o ${PROG} ${OBJS} ${LIBS}
+
+.c.o:
+		${CC} -c ${CFLAGS} $<
+
+%.1.gz:		%.1
+		${GZIP} $< > $@
+
+.PHONY:		all clean install test
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip-files.sh ./bomstrip-files.sh
--- ../../branches/vendor/bomstrip/bomstrip-files.sh	1970-01-01 02:00:00.000000000 +0200
+++ ./bomstrip-files.sh	2008-06-13 20:27:34.000000000 +0300
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Written by Peter Pentchev in 2008.
+# This file is hereby placed into the public domain.
+
+set -e
+
+[ -z "$BOMSTRIP" ] && BOMSTRIP='bomstrip'
+
+if [ "$#" -eq 0 ]; then
+	echo 'Usage: bomstrip-files file...' 1>&2
+	exit 1
+fi
+
+while [ "$#" -ne 0 ]; do
+	cp "$1" "$1.bom"
+	$BOMSTRIP < "$1.bom" > "$1"
+	shift
+done
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip.1 ./bomstrip.1
--- ../../branches/vendor/bomstrip/bomstrip.1	1970-01-01 02:00:00.000000000 +0200
+++ ./bomstrip.1	2008-06-13 20:27:34.000000000 +0300
@@ -0,0 +1,75 @@
+.\" Written by Peter Pentchev in 2008.
+.\" This file is hereby placed into the public domain.
+.\"
+.Dd June 13, 2008
+.Dt BOMSTRIP 1
+.Os
+.Sh NAME
+.Nm bomstrip ,
+.Nm bomstrip-files
+.Nd strip the BOM sequence from UTF-8 files
+.Sh SYNOPSIS
+.Nm
+.Nm bomstrip-files
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+utility reads UTF-8 data from its standard input and copies it to
+its standard output, stripping the BOM (byte-order mark) from
+the beginning of the text if it is present.
+There are no command-line options and no parameters.
+.Pp
+The
+.Nm bomstrip-files
+utility removes the UTF-8 BOM from the specified files, saving each
+file's original contents with a
+.Pa .bom
+extension.
+It uses the
+.Nm
+utility, trying to execute it as
+.Dq Nm ;
+if the
+.Nm
+utility is installed under another name, or if a more complex command
+is desired, it may be supplied in the
+.Ev BOMSTRIP
+environment variable.
+.Sh EXAMPLES
+Strip the BOM, if present, from a text file:
+.Pp
+.Dl bomstrip < bom.txt > nobom.txt
+.Pp
+Strip the BOM, if present, from all text files, backing them up with a
+.Pa .bom
+extension:
+.Pp
+.Dl bomstrip-files *.txt
+.Pp
+Use the OCAML implementation of
+.Nm :
+.Pp
+.Dl env BOMSTRIP='ocaml bomstrip.ocaml' bomstrip-files *.txt
+.Sh SEE ALSO
+The
+.Nm
+home page:
+.Li http://www.xs4all.nl/~mechiel/projects/bomstrip/
+.Sh HISTORY
+The
+.Nm
+utility (in many languages) was written by
+.An Mechiel Lukkien .
+The
+.Nm bomstrip-files
+utility and this manual page were written by
+.An Peter Pentchev
+in the hope that they reflect the behavior of all the
+.Nm
+implementations in all languages.
+.Sh AUTHORS
+.An Mechiel Lukkien
+.Aq mechiel@xs4all.nl
+.An Peter Pentchev
+.Aq roam@ringlet.net
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip.c ./bomstrip.c
--- ../../branches/vendor/bomstrip/bomstrip.c	2008-06-13 16:03:15.000000000 +0300
+++ ./bomstrip.c	2008-06-13 20:27:34.000000000 +0300
@@ -3,19 +3,25 @@
 #include <unistd.h>
 #include <string.h>
 
-void
-usage(char *prog)
+char		 buf[BUFSIZ];
+const char	*utf8bom = "\xef\xbb\xbf";
+
+static void	 usage(const char *);
+
+static void
+usage(const char *prog)
 {
 	fprintf(stderr, "usage: %s\n", prog);
 	exit(1);
 }
 
 int
-main(int argc, char *argv[])
+main(int argc, const char * const argv[])
 {
-	size_t nread;
-	char buf[65536];
-	char *utf8bom = "\xef\xbb\xbf";
+	ssize_t nread;
+
+	if (argc > 1)
+		usage(argv[0]);
 
 	nread = fread(buf, 1, strlen(utf8bom), stdin);
 	if (nread == 0)
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip.cpp ./bomstrip.cpp
--- ../../branches/vendor/bomstrip/bomstrip.cpp	1970-01-01 02:00:00.000000000 +0200
+++ ./bomstrip.cpp	2008-06-13 20:27:34.000000000 +0300
@@ -0,0 +1,49 @@
+// Written by Peter Pentchev in 2008
+// This file is hereby placed into the public domain.
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const char	*utf8bom = "\xef\xbb\xbf";
+
+static void	 usage(const char *);
+static void	 outendl(string &);
+
+static void
+usage(const char *prog)
+{
+	cerr << "usage: " << prog << endl;
+	exit(1);
+}
+
+static void
+outendl(string &s)
+{
+	cout << s;
+	if (!cin.eof())
+		cout << endl;
+}
+
+int
+main(int argc, const char * const argv[])
+{
+	string s;
+
+	if (argc > 1)
+		usage(argv[0]);
+
+	/* Empty? */
+	if (!getline(cin, s))
+		return 0;
+
+	/* First line... */
+	if (!s.substr(0, 3).compare(utf8bom))
+		s = s.substr(3);
+	outendl(s);
+
+	/* ...and the rest. */
+	while (getline(cin, s))
+		outendl(s);
+}
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip.pl ./bomstrip.pl
--- ../../branches/vendor/bomstrip/bomstrip.pl	2008-06-13 16:03:15.000000000 +0300
+++ ./bomstrip.pl	2008-06-13 20:27:34.000000000 +0300
@@ -3,6 +3,6 @@
 my $buf;
 if (read STDIN, $buf, 3) {
 	print $buf if $buf ne "\xef\xbb\xbf";
-	undef $!;
+	undef $/;
 	print <STDIN>;
 }
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/bomstrip.py ./bomstrip.py
--- ../../branches/vendor/bomstrip/bomstrip.py	2008-06-13 16:03:15.000000000 +0300
+++ ./bomstrip.py	2008-06-13 20:27:34.000000000 +0300
@@ -33,11 +33,8 @@
 		return
 
 	while True:
-		print 'reading...'
 		buf = inf.read(bufsize)
-		print 'read!'
 		if buf == '':
-			print 'empty string'
 			break
 		outf.write(buf)
 	
diff -urN -x .svn -x '*bom-ml*' ../../branches/vendor/bomstrip/test.sh ./test.sh
--- ../../branches/vendor/bomstrip/test.sh	2008-06-13 16:03:15.000000000 +0300
+++ ./test.sh	2008-06-13 20:27:34.000000000 +0300
@@ -1,9 +1,17 @@
 #!/bin/sh
 
-cmd='ocaml ./bomstrip.ocaml'
+[ -z "$BOM" ] && BOM='ocaml ./bomstrip.ocaml'
+[ -z "$BOMFILES" ] && BOMFILES='bom0 bom1 bom-ml1 bom-ml2 bom-ml3 bom-ml4 '\
+'nobom0 nobom1 nobom2 nobom-ml1 nobom-ml2 nobom-ml3 nobom-ml4'
 
-$cmd < bom0 > rbom0 && cmp rbom0 correct/rbom0 || echo bom0 is wrong
-$cmd < bom1 > rbom1 && cmp rbom1 correct/rbom1 || echo bom1 is wrong
-$cmd < nobom0 > rnobom0 && cmp rnobom0 correct/rnobom0 || echo nobom0 is wrong
-$cmd < nobom1 > rnobom1 && cmp rnobom1 correct/rnobom1 || echo nobom1 is wrong
-$cmd < nobom2 > rnobom2 && cmp rnobom2 correct/rnobom2 || echo nobom2 is wrong
+res=0
+for f in $BOMFILES; do
+	$BOM < "$f" > "r$f"
+	if ! cmp "r$f" correct/"r$f"; then
+		echo "$f is wrong"
+		res=1
+	else
+		rm -f "r$f"
+	fi
+done
+exit "$res"
