diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/app/ecgeval.c wfdb-10.5.21/app/ecgeval.c
--- wfdb-10.5.20/app/ecgeval.c	2010-07-27 13:52:41.000000000 -0400
+++ wfdb-10.5.21/app/ecgeval.c	2013-11-19 13:04:39.000000000 -0500
@@ -1,9 +1,9 @@
 /* file: ecgeval.c	G. Moody	22 March 1992
-			Last revised:   27 July 2010
+			Last revised:  19 November 2013		wfdb 10.5.21
 
 -------------------------------------------------------------------------------
 ecgeval: Generate and run a script of commands to compare sets of annotations
-Copyright (C) 1992-2010 George B. Moody
+Copyright (C) 1992-2013 George B. Moody
 
 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
@@ -23,6 +23,10 @@
 please visit PhysioNet (http://www.physionet.org/).
 _______________________________________________________________________________
 
+Note: versions prior to 10.5.21 included code that was conditionally compiled
+if MSDOS was defined.  This code truncated file names to 8.3 format.  If you
+need to run ecgeval on an ancient OS that cannot handle longer filenames, use
+an archived version (available on PhysioNet).
 */
 
 #include <stdio.h>
@@ -30,14 +34,7 @@
 #include <wfdb/wfdb.h>
 
 #define NDBMAX	50	/* maximum number of databases in `dblist' */
-
-#ifdef MSDOS
-#define RNLMAX	8	/* maximum length of a record name */
-#define ECHONOTHING	"echo . >>%s\n"	/* closest simple approximation */
-#else
-#define RNLMAX	20
 #define ECHONOTHING "echo >>%s\n"
-#endif
 
 char buf[256];
 
@@ -220,13 +217,8 @@
 		  dbname[dbi]);
     (void)fprintf(stderr,
  "are identified by the test annotator name (the part of the file name\n");
-#ifdef MSDOS
-    (void)fprintf(stderr,
- "that follows the record name and `.'; three characters or less).\n");
-#else
     (void)fprintf(stderr,
  "that precedes the `.' and the record name).\n");
-#endif
     (void)fprintf(stderr,
  "If you don't yet have a set of test annotation files, you can add the\n");
     (void)fprintf(stderr,
@@ -237,9 +229,6 @@
 	(void)fprintf(stderr, "What is the test annotator name? ");
 	if (tname[0]) (void)fprintf(stderr, "[%s]: ", tname);
 	getans(tname, 20);
-#ifdef MSDOS
-	if ((int)strlen(tname) > 3) tname[0] = '\0';
-#endif
     } while (tname[0] == '\0');
 
     (void)fprintf(stderr, "\n");
@@ -260,9 +249,6 @@
 		      "What is the reference heart rate annotator name? ");
 	if (rhrname[0]) (void)fprintf(stderr, "[%s]: ", rhrname);
 	getans(rhrname, 20);
-#ifdef MSDOS
-	if ((int)strlen(rhrname) > 3) rhrname[0] = '\0';
-#endif
     } while (rhrname[0] == '\0');
 
     (void)fprintf(stderr, "\n");
@@ -342,13 +328,8 @@
 	else
 	    dbtn[i] = dbname[dbi][i];
     }
-#ifdef MSDOS
-    (void)sprintf(scriptname, "%s-%s.bat", tname, dbtn);
-    (void)sprintf(reportname, "%s-%s.out", tname, dbtn);
-#else
     (void)sprintf(scriptname, "eval-%s-%s", tname, dbtn);
     (void)sprintf(reportname, "%s-%s-evaluation", tname, dbtn);
-#endif
 
     while (sfile == NULL) {
 	do {
@@ -356,19 +337,9 @@
 	    if (scriptname[0])
 		(void)fprintf(stderr, " [%s]", scriptname);
 	    (void)fprintf(stderr, ": ");
-#ifdef MSDOS
-	    getans(scriptname, 9);
-#else
 	    getans(scriptname, 20);
-#endif
 	} while (scriptname[0] == '\0');
 
-#ifdef MSDOS
-	i = strlen(scriptname) - 4;
-	if (i <= 0 || strcmp(scriptname+i, ".bat"))
-	    (void)strcat(scriptname, ".bat");
-#endif
-
 	if (sfile = fopen(scriptname, "r")) {
 	    (void)fclose(sfile);
 	    (void)fprintf(stderr,
@@ -547,9 +518,6 @@
 	(void)strcat(epicmpcommand, "\n");
     }
 
-#ifdef MSDOS
-    (void)fprintf(sfile, "@echo off\n");
-#endif
     (void)fprintf(sfile, ": file: %s\tecgeval\t\t%d %s %d\n", scriptname,
 	    now->tm_mday, month_name[now->tm_mon], now->tm_year+1900);
     (void)fprintf(sfile,
@@ -564,7 +532,7 @@
 	record = strtok(buf, " \t\n\r");
 	if (*record == '#' || *record == '\0')
 	    continue;	/* comment or empty line -- ignore */
-	if ((int)strlen(record) > RNLMAX) {
+	if ((int)strlen(record) > WFDB_MAXRNL) {
 	    (void)fprintf(stderr,
 		    "Illegal record name, `%s', found in `%s' (ignored).\n",
 			  record, dbfn);
@@ -663,19 +631,9 @@
 	(void)fprintf(sfile,
 		      "echo to get the results.\n");
 
-#ifdef MSDOS
-    (void)fprintf(sfile, "@echo on\n");
-#endif
     (void)fclose(sfile);
     (void)fprintf(stderr, " done\n\n");
-
-#ifdef MSDOS
-    strncpy(evalcommand, scriptname, strlen(scriptname) - 4);
-	/* The command need not include the final `.bat'. */
-#else
     (void)sprintf(evalcommand, "sh ./%s", scriptname);
-#endif
-
     (void)fprintf(stderr,
 	    "Do you wish to run the evaluation script now? [y]: ");
     tans[0] = 'y';
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/app/psfd.c wfdb-10.5.21/app/psfd.c
--- wfdb-10.5.20/app/psfd.c	2010-07-27 13:53:48.000000000 -0400
+++ wfdb-10.5.21/app/psfd.c	2013-11-21 09:36:44.000000000 -0500
@@ -1,9 +1,9 @@
 /* file: psfd.c		G. Moody         9 August 1988
-			Last revised:	  27 July 2010
+			Last revised:	21 November 2013
 
 -------------------------------------------------------------------------------
 psfd: Produces annotated full-disclosure ECG plots on a PostScript device
-Copyright (C) 1988-2010 George B. Moody
+Copyright (C) 1988-2013 George B. Moody
 
 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
@@ -776,7 +776,7 @@
     /* Allocate buffers for the samples to be plotted, and initialize the
        range and filter variables. */
     for (i = 0; i < nosig; i++) {
-	accept[i] = 0;
+	accept[i] = vn[i] = 0;
 	vmax[i] = vmin[i] = WFDB_INVALID_SAMPLE; vs[i] = 0L; vsum[i] = 0L;
 	if (nosamp > buflen[i]) {
 	    if ((vbuf[i] = realloc(vbuf[i], nosamp * sizeof(int))) == NULL) {
@@ -851,7 +851,7 @@
 	    else	/* no valid samples in this trace */
 		vbase[i] = 0;
 	}
-	
+
 	/* Determine the width and height of the strip. */
 	s_width = j*tscale/sps;
 	/* The calculation of nstrips allots roughly t_hideal (7.5 by default)
@@ -951,7 +951,7 @@
 	x0 = mm(s_left);
 	if (lflag) setitalic(fs_label);
 	for (i = 0; i < nosig; i++) {
-	    int last_sample_valid, sig = siglist[i];
+	    int last_sample_valid = 0, sig = siglist[i];
 	    static WFDB_Calinfo ci;
 	    
 	    setrgbcolor(&lc);
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/appcheck wfdb-10.5.21/checkpkg/appcheck
--- wfdb-10.5.20/checkpkg/appcheck	2010-11-26 11:51:55.000000000 -0500
+++ wfdb-10.5.21/checkpkg/appcheck	2013-11-19 12:32:18.000000000 -0500
@@ -176,14 +176,14 @@
 
 echo Testing ecgeval ...
 F=ecgeval.out
-rm -f eval-qrs-mit qrs-mit-evaluation
+rm -f qrs-mit.bat qrs-mit.out
 ecgeval <input/ecgeval >$F 2>&1
-grep -v file: eval-qrs-mit >>$F
-grep -v file: qrs-mit-evaluation >>$F
+grep -v file: qrs-mit.bat >>$F
+grep -v file: qrs-mit.out >>$F
 if ( ./checkfile $F )
 then
     PASS=`expr $PASS + 1`
-    rm -f $F eval-qrs-mit qrs-mit-evaluation bxb.out sd.out
+    rm -f $F qrs-mit.bat qrs-mit.out bxb.out sd.out
 else
     FAIL=`expr $FAIL + 1`
 fi
@@ -191,7 +191,8 @@
 
 echo Testing bxb ...
 F=bxb.out
-bxb -r 100s -a atr ann -f 0 >$F 2>&1
+E=bxb.err
+bxb -r 100s -a atr ann -f 0 >$F 2>$E
 if ( ./checkfile $F )
 then
     PASS=`expr $PASS + 1`
@@ -199,11 +200,19 @@
 else
     FAIL=`expr $FAIL + 1`
 fi
-TESTS=`expr $TESTS + 1`
+if ( ./checkfile $E )
+then
+    PASS=`expr $PASS + 1`
+    rm -f $E
+else
+    FAIL=`expr $FAIL + 1`
+fi
+TESTS=`expr $TESTS + 2`
 
 echo Testing rxr ...
 F=rxr.out
-rxr -r 100s -a atr ann -f 0 >$F 2>&1
+E=rxr.err
+rxr -r 100s -a atr ann -f 0 >$F 2>$E
 if ( ./checkfile $F )
 then
     PASS=`expr $PASS + 1`
@@ -211,7 +220,14 @@
 else
     FAIL=`expr $FAIL + 1`
 fi
-TESTS=`expr $TESTS + 1`
+if ( ./checkfile $E )
+then
+    PASS=`expr $PASS + 1`
+    rm -f $E
+else
+    FAIL=`expr $FAIL + 1`
+fi
+TESTS=`expr $TESTS + 2`
 rm 100s.ann
 
 echo Testing fir ...
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/dosify wfdb-10.5.21/checkpkg/dosify
--- wfdb-10.5.20/checkpkg/dosify	1969-12-31 19:00:00.000000000 -0500
+++ wfdb-10.5.21/checkpkg/dosify	2013-11-19 13:17:39.000000000 -0500
@@ -0,0 +1,29 @@
+#! /bin/bash
+# file: dosify		G. Moody		19 November 2013
+#
+# Convert expected test results to MS-DOS/MS-Windows format for MinGW, using
+# mv, sed, u2d, and bash builtins.
+
+cd expected
+if [ ! -e wfdbwhich.out.orig ]
+then
+    mv wfdbwhich.out wfdbwhich.out.orig
+    sed s+/+\\\\+ <wfdbwhich.out.orig >wfdbwhich.out
+    u2d wfdbwhich.out
+fi
+
+for F in lcheck.log-NETFILES lcheck.log-no-NETFILES bxb.out rxr.out psfd.ps
+do
+    if [ ! -e $F.orig ]
+    then
+    	cp $F $F.orig
+	u2d $F
+    fi
+done
+
+# if [ ! -e ecgeval.out.orig ]
+# then
+#    mv ecgeval.out ecgeval.out.orig
+#    cp ecgeval.out.dos ecgeval.out
+# fi
+
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/expected/bxb.err wfdb-10.5.21/checkpkg/expected/bxb.err
--- wfdb-10.5.20/checkpkg/expected/bxb.err	1969-12-31 19:00:00.000000000 -0500
+++ wfdb-10.5.21/checkpkg/expected/bxb.err	2013-11-19 12:10:14.000000000 -0500
@@ -0,0 +1 @@
+bxb: (warning) nonstandard comparison selected
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/expected/bxb.out wfdb-10.5.21/checkpkg/expected/bxb.out
--- wfdb-10.5.20/checkpkg/expected/bxb.out	2001-12-11 12:52:56.000000000 -0500
+++ wfdb-10.5.21/checkpkg/expected/bxb.out	2013-11-19 12:10:14.000000000 -0500
@@ -1,4 +1,3 @@
-bxb: (warning) nonstandard comparison selected
 Beat-by-beat comparison results for record 100s
 Reference annotator: atr
      Test annotator: ann
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/expected/ecgeval.out wfdb-10.5.21/checkpkg/expected/ecgeval.out
--- wfdb-10.5.20/checkpkg/expected/ecgeval.out	2007-03-29 14:23:47.000000000 -0400
+++ wfdb-10.5.21/checkpkg/expected/ecgeval.out	2013-11-19 12:36:26.000000000 -0500
@@ -58,15 +58,15 @@
 Choose a name for the evaluation report [qrs-mit-evaluation]: The next group of questions refers to the names of files in which
 intermediate summary statistics are to be written.  If any of these exist
 already, new statistics will be appended, and the aggregate statistics
-in `qrs-mit-evaluation' will be based on the entire contents of these files.
+in `qrs-mit.out' will be based on the entire contents of these files.
 Beat detection and classification file [bxb.out]: Analysis shutdown file [sd.out]: Ventricular ectopic run file [vruns.out]: Supraventricular ectopic run file [sruns.out]: Ventricular fibrillation file [vf.out]: Atrial fibrillation file [af.out]: ST analysis file [st.out]: ST measurement file [stm.out]: PostScript scatter plot of ST measurements [stm.ps]: The name given for the heart rate measurement file must contain `%d',
 which is replaced by the measurement number.
 Heart rate measurement file [hr%d.out]: 
 Do you wish to change any of these answers? [y]: 
-Generating `eval-qrs-mit' ... done
+Generating `qrs-mit.bat' ... done
 
-Do you wish to run the evaluation script now? [y]: Inspect and edit `eval-qrs-mit' as necessary, then type
-   sh ./eval-qrs-mit
+Do you wish to run the evaluation script now? [y]: Inspect and edit `qrs-mit.bat' as necessary, then type
+   sh ./qrs-mit.bat
 to run the evaluation.
 :
 : Evaluate test annotator qrs on the MIT DB
@@ -363,41 +363,41 @@
 epicmp -r 234 -a atr qrs -L -A af.out -V vf.out -S st.out stm.out
 
 : Generate summary report
-echo Beat detection and classification performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats bxb.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Analysis shutdowns >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats sd.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Ventricular ectopic run detection performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats vruns.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Supraventricular ectopic run detection performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats sruns.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Heart rate measurement number 0 performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats hr0.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Ventricular fibrillation detection performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats vf.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Atrial fibrillation detection performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats af.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-echo Ischemic ST detection performance >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
-sumstats st.out >>qrs-mit-evaluation
-echo >>qrs-mit-evaluation
+echo Beat detection and classification performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats bxb.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Analysis shutdowns >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats sd.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Ventricular ectopic run detection performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats vruns.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Supraventricular ectopic run detection performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats sruns.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Heart rate measurement number 0 performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats hr0.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Ventricular fibrillation detection performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats vf.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Atrial fibrillation detection performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats af.out >>qrs-mit.out
+echo >>qrs-mit.out
+echo Ischemic ST detection performance >>qrs-mit.out
+echo >>qrs-mit.out
+sumstats st.out >>qrs-mit.out
+echo >>qrs-mit.out
 : Generate PostScript scatter plot of ST measurements
 plotstm stm.out >stm.ps
-echo The evaluation is complete.  Print text file qrs-mit-evaluation
+echo The evaluation is complete.  Print text file qrs-mit.out
 echo and PostScript file stm.ps to get the results.
 Evaluation of `qrs' on the MIT-BIH Arrhythmia Database
 
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/expected/rxr.err wfdb-10.5.21/checkpkg/expected/rxr.err
--- wfdb-10.5.20/checkpkg/expected/rxr.err	1969-12-31 19:00:00.000000000 -0500
+++ wfdb-10.5.21/checkpkg/expected/rxr.err	2013-11-19 12:10:14.000000000 -0500
@@ -0,0 +1 @@
+rxr: (warning) nonstandard comparison selected
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/expected/rxr.out wfdb-10.5.21/checkpkg/expected/rxr.out
--- wfdb-10.5.20/checkpkg/expected/rxr.out	2001-12-11 12:48:02.000000000 -0500
+++ wfdb-10.5.21/checkpkg/expected/rxr.out	2013-11-19 12:10:14.000000000 -0500
@@ -1,4 +1,3 @@
-rxr: (warning) nonstandard comparison selected
 VE run-by-run comparison results for record 100s
 Reference annotator: atr
      Test annotator: ann
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/checkpkg/input/ecgeval wfdb-10.5.21/checkpkg/input/ecgeval
--- wfdb-10.5.20/checkpkg/input/ecgeval	2001-09-10 12:07:19.000000000 -0400
+++ wfdb-10.5.21/checkpkg/input/ecgeval	2013-11-19 10:58:58.000000000 -0500
@@ -10,8 +10,8 @@
 y
 y
 n
-eval-qrs-mit
-qrs-mit-evaluation
+qrs-mit.bat
+qrs-mit.out
 bxb.out
 sd.out
 vruns.out
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/conf/mingw.def wfdb-10.5.21/conf/mingw.def
--- wfdb-10.5.20/conf/mingw.def	2010-05-13 11:01:23.000000000 -0400
+++ wfdb-10.5.21/conf/mingw.def	2013-11-19 09:14:24.000000000 -0500
@@ -1,5 +1,5 @@
 # file: mingw.def		I. Henry and G. Moody       11 February 2005 
-#				Last revised:		      13 May 2010
+#				Last revised:		    19 November 2013
 #
 # This file contains default 'make' definitions for compiling the WFDB Software
 # Package under MS Windows using the free Mininmalist GNU for Windows (MinGW) 
@@ -76,6 +76,8 @@
 # by spaces if you use more than one):
 #   -DISPRINTF	  if you do not have `stdlib.h' and your `sprintf' returns an
 #		   int (see wfdblib.h)
+#   -DMSDOS	  if the target platform is MS-DOS or MS-Windows without a
+#   		   POSIX compatibility layer such as Cygwin
 #   -DNETFILES	  if you have libwww and want to be able to access WFDB files
 #		   remotely via http or ftp (as well as local files)
 #   -DNOSTRTOK	  if your standard C library does not include function `strtok'
@@ -85,7 +87,7 @@
 #   -DOLDC	  if you have neither `stdarg.h' nor `varargs.h' (see wfdbio.c)
 # If your C compiler fails to compile `signal.c', add -DBROKEN_CC to CCDEFS
 # and try again (see signal.c).
-CCDEFS = $(VDEFS) -DNOVALUES_H -DNOMKSTEMP
+CCDEFS = $(VDEFS) -DMSDOS -DNOVALUES_H -DNOMKSTEMP
 
 # MFLAGS is the set of architecture-dependent (-m*) compiler options, which
 # is usually empty.  See the gcc manual for information about gcc's -m options.
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/conf/mingw-slib.def wfdb-10.5.21/conf/mingw-slib.def
--- wfdb-10.5.20/conf/mingw-slib.def	2010-05-13 11:00:56.000000000 -0400
+++ wfdb-10.5.21/conf/mingw-slib.def	2013-11-19 09:14:26.000000000 -0500
@@ -1,5 +1,5 @@
-# file: mingw-slib.def	I. Henry and G. Moody	11 February 2005
-#				Last revised:	  13 May 2010
+# file: mingw-slib.def		I. Henry and G. Moody	    11 February 2005
+#				Last revised:		    19 November 2013
 #
 # This section contains settings suitable for generating a DLL (shared library)
 # under MS Windows using the free gcc ANSI C compiler.
@@ -55,7 +55,7 @@
 # CCDEFS is the set of C compiler options needed to set preprocessor variables
 # while compiling the WFDB Software Package.  CCDEFS should always include
 # VDEFS.
-CCDEFS = $(VDEFS) -DNOVALUES_H -DNOMKSTEMP
+CCDEFS = $(VDEFS) -DMSDOS -DNOVALUES_H -DNOMKSTEMP
 
 # MFLAGS is the set of architecture-dependent (-m*) compiler options, which
 # is usually empty.  See the gcc manual for information about gcc's -m options.
@@ -78,6 +78,9 @@
 WFDBLIB = $(WFDBLIB_SONAME).$(MINOR)
 # For a shared library, the soname is significant for proper run-time binding.
 # If you change function interfaces in the library, change its soname by
+
+
+
 # incrementing the major version number;  when you do this, set the minor
 # version number to zero.  If you change the library without changing the
 # function interfaces, increment the minor version number; this allows existing
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/configure wfdb-10.5.21/configure
--- wfdb-10.5.20/configure	2013-01-02 18:22:11.000000000 -0500
+++ wfdb-10.5.21/configure	2013-11-19 11:29:43.000000000 -0500
@@ -1,6 +1,6 @@
 #! /bin/sh
 # file: configure             G. Moody         24 May 2000
-#                             Last revised:   2 January 2013
+#                             Last revised:  19 November 2013
 # Configuration script for the WFDB Software Package
 
 # This script was not generated using 'autoconf'.  If you can implement
@@ -77,9 +77,6 @@
 echo "Checking the operating system type ..."
 CPUOS=`uname -m`-`uname -s`
 ARCH=`echo $CPUOS | tr -d " "`
-case $OS in
- mingw*) 
-esac
 case `uname` in
   Linux*)    case `uname -m` in
 	        x86_64) OS=Linux-64 ;;
@@ -187,7 +184,8 @@
 	LIB=bin
 	WAVE=0
 	sed 's/NOCYGWIN//' site.def mingw-slib.def >site-slib.def
-	sed 's/NOCYGWIN//' mingw.def >>site.def ;;
+	sed 's/NOCYGWIN//' mingw.def >>site.def
+        ( cd ../checkpkg; ./dosify ) ;;
   mingw-compat)
 	LIB=bin
 	OS=mingw
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/convert/rdedfann.c wfdb-10.5.21/convert/rdedfann.c
--- wfdb-10.5.20/convert/rdedfann.c	2009-08-06 14:44:43.000000000 -0400
+++ wfdb-10.5.21/convert/rdedfann.c	2013-10-22 10:18:53.000000000 -0400
@@ -1,9 +1,9 @@
 /* file: rdedfann.c	G. Moody	 14 March 2008
-   			Last revised:	 6 August 2009
+   			Last revised:	22 October 2013
 
 -------------------------------------------------------------------------------
 rdedfann: Print annotations from an EDF+ file
-Copyright (C) 2009 George B. Moody
+Copyright (C) 2008-2013 George B. Moody
 
 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
@@ -38,7 +38,7 @@
 #include <wfdb/wfdb.h>
 
 char *pname;
-double sfreq;
+double sfreq = 0.0;
 int state;
 
 main(int argc, char **argv)
@@ -53,6 +53,15 @@
     pname = prog_name(argv[0]);
     for (i = 1; i < argc; i++) {
 	if (*argv[i] == '-') switch (*(argv[i]+1)) {
+	  case 'F':
+	    if (++i >= argc) {
+		(void)fprintf(stderr, "%s: sampling frequency must follow -F\n",
+			      pname);
+		exit(1);
+	    }
+	    sscanf(argv[i], "%lf", &sfreq);
+	    if (sfreq <= 0.0) sfreq = 1.0;
+	    break;
 	  case 'h':	/* help requested */
 	    help();
 	    exit(0);
@@ -111,7 +120,13 @@
 	exit(2);
     }
 
-    sfreq = sampfreq(NULL);
+    if (sfreq > 0.0) {
+	setgvmode(WFDB_LOWRES);
+	setsampfreq(sfreq);
+    }
+    else 
+	sfreq = sampfreq(NULL);
+	
 
     /* Print column headers if '-v' option selected. */
     if (vflag)	
@@ -230,9 +245,8 @@
 static char *help_strings[] = {
  "usage: %s -r RECORD [OPTIONS ...]\n",
  "where RECORD is the name of the input EDF+ record, and OPTIONS may include:",
- " -f TIME     begin at specified time",
+ " -F FREQ     set the sampling frequency to FREQ Hz\n",
  " -h          print this usage summary",
- " -t TIME     stop at specified time",
  " -v          print column headings",
 NULL
 };
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/doc/wag-src/rdedfann.1 wfdb-10.5.21/doc/wag-src/rdedfann.1
--- wfdb-10.5.20/doc/wag-src/rdedfann.1	2012-05-24 16:30:12.000000000 -0400
+++ wfdb-10.5.21/doc/wag-src/rdedfann.1	2013-10-31 10:03:58.000000000 -0400
@@ -10,6 +10,9 @@
 .PP
 Options include:
 .TP
+\fB-F\fI frequency\fR
+Set the sampling frequency to \fIfrequency\fR (in Hz).
+.TP
 \fB-h\fR
 Print a brief usage summary.
 .TP
@@ -19,14 +22,20 @@
 .PP
 Note that the annotation mnemonics in EDF+ files do not in general
 match those used in WFDB-compatible annotation files, so that it will
-usually be necessary to translate those that come from EDF+ file
-before the text can be converted by \fBwrann\fR.  For example, this
+often be desirable to translate those that come from EDF+ file
+before converting the text with \fBwrann\fR.  For example, this
 command can be used to extract annotations from \fBfoo.edf\fR, change
 the EDF+ annotation type "QRS" to the WFDB type "N", and then produce
 a WFDB-compatible annotation file \fBfoo.edf.qrs\fR:
 .br
         \fBrdedfann -r foo.edf | sed "s/QRS/ N" | wrann -r foo.edf -a qrs\fR
 
+.PP
+Recent versions of \fBwrann\fR copy unrecognized mnemonics into
+the \fBaux\fR field, setting the annotation type to \fBNOTE\fR, so it
+is no longer essential to translate mnemonics as described above before
+processing \fBrdedfann\fR's output with \fBwrann\fR.
+
 .SH ENVIRONMENT
 .PP
 It may be necessary to set and export the shell variable \fBWFDB\fR (see
@@ -36,7 +45,7 @@
 Package.  Run \fBmake\fR in that directory to compile and install it if it
 has not been installed already.
 .SH SEE ALSO
-\fBedftomit\fR(1)
+\fBedf2mit\fR(1)
 .HP
 http://www.edfplus.info/spscs/edfplus.html
 Full specification of EDF+, by Bob Kemp and Jesus Olivan.
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/doc/wpg-src/wpg0.tex wfdb-10.5.21/doc/wpg-src/wpg0.tex
--- wfdb-10.5.20/doc/wpg-src/wpg0.tex	2013-09-02 22:37:30.000000000 -0400
+++ wfdb-10.5.21/doc/wpg-src/wpg0.tex	2013-11-18 19:43:02.000000000 -0500
@@ -9051,6 +9051,12 @@
 
 @unnumberedsec WFDB 10.5
 
+@unnumberedsubsec Changes in version 10.5.21 (18 November 2013)
+
+In previous releases, WFDB library function @code{strtim()} did not always
+handle bracketed string inputs properly.  Thanks to Benjamin Moody,
+who reported the problem and provided a patch to fix it.
+
 @unnumberedsubsec Changes in version 10.5.20 (2 September 2013)
 
 Absolute pathnames are not tested in @code{wfdb_open()} unless the WFDB
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/install-wave32 wfdb-10.5.21/install-wave32
--- wfdb-10.5.20/install-wave32	2012-04-25 08:19:17.000000000 -0400
+++ wfdb-10.5.21/install-wave32	2013-11-18 19:25:56.000000000 -0500
@@ -1,9 +1,10 @@
 #! /bin/sh
 # file: install-wave32		G. Moody	7 October 2008
-#				Last revised:   25 April 2012
+#				Last revised:  18 November 2013
 # Build and install WAVE on 64-bit Linux
 #
-# *** Fedora 12 users: if this script fails, see the note at the end! ***
+# *** Debian and Ubuntu users, see the notes at the end! ***
+# *** Fedora 12 users: if this script fails, see the notes near the end! ***
 #
 # WAVE must be compiled as a 32-bit application, because it depends on the
 # XView toolkit, which does not support 64-bit mode (and most likely, never
@@ -26,8 +27,8 @@
 # as root, using the -q option.  See the notes below for hints.
 
 echo "This script builds and installs 'wave' as a 32-bit application on x86_64"
-echo "(AMD/Intel 64-bit) Fedora GNU/Linux.  It has been tested on Fedora 12 and"
-echo "will probably require modification on other platforms."
+echo "(AMD/Intel 64-bit) Fedora GNU/Linux.  It has been tested on Fedora 12,"
+echo "14, and 18;  it will probably require modification on other platforms."
 echo
 
 if [ $UID != 0 ]
@@ -156,3 +157,46 @@
 #    yum -y install nss.i686 nss-softokn.i686 openldap.i686
 #    rpm -ivh --force libcurl-7.19.7-2.fc12.i686.rpm 
 #    rpm -ivh --force libcurl-devel-7.19.7-2.fc12.i686.rpm 
+#
+# ****************************************************************************
+#
+# Notes for Debian Wheezy and Ubuntu 12.04, from Benjamin Moody:
+#
+# 1. Get the latest updates (needed on Wheezy, a good idea otherwise):
+#      apt-get update
+#
+# 2. Ensure that i386 is enabled in dpkg configuration.  Apparently this
+#    is not needed on Ubuntu; on Debian:
+#      dpkg --add-architecture i386
+#
+# 3. On Ubuntu 12.10 or earlier, or Debian Wheezy, you will need to
+#    upgrade the 'xbitmaps' package to version 1.1.1-2 manually (older
+#    versions aren't marked as multiarch-safe):
+#      wget http://archive.ubuntu.com/ubuntu/pool/main/x/xbitmaps/xbitmaps_1.1.1-2_all.deb
+#      dpkg -i xbitmaps_1.1.1-2_all.deb
+#    (Debian users can safely install the package from Ubuntu.)
+#
+# 4. On Ubuntu, ensure that 'universe' section is enabled:
+#      sed '/^deb/{/universe/!s/ main/ main universe/}' -i /etc/apt/sources.list
+#      apt-get update
+#
+# 5. Install the XView library and developer packages:
+#      apt-get install xviewg-dev:i386
+#    On Debian Wheezy, this won't work if you skipped step 1!
+#
+# 6. Install the 32-bit libcurl library and developer packages:
+#      apt-get install libcurl4-gnutls-dev:i386
+#    This can coexist with libcurl4-gnutls-dev:amd64 on Debian, not tested
+#    on Ubuntu (please send feedback if you try it).
+#
+# 7. Install the remaining 32-bit compatibility tools and libraries:
+#      apt-get install build-essential gcc-multilib
+#
+# 8. Compile and install the WFDB Software Package as usual, using configure's
+#    -m32 option.  For example, to install in /usr/local, begin with:
+#      ./configure -m32 --prefix=/usr/local
+#      make install
+#    You will need to set and export LD_LIBRARY_PATH if you use --prefix as
+#    above:
+#      LD_LIBRARY_PATH=/usr/local/lib
+#      export LD_LIBRARY_PATH
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/annot.c wfdb-10.5.21/lib/annot.c
--- wfdb-10.5.20/lib/annot.c	2013-03-25 17:42:04.000000000 -0400
+++ wfdb-10.5.21/lib/annot.c	2013-11-21 10:18:40.000000000 -0500
@@ -1,10 +1,10 @@
 /* file: annot.c	G. Moody       	 13 April 1989
-			Last revised:     6 April 2012	wfdblib 10.5.11
+			Last revised:  18 November 2013		wfdblib 10.5.21
 WFDB library functions for annotations
 
 _______________________________________________________________________________
 wfdb: a library for reading and writing annotated waveforms (time series data)
-Copyright (C) 1989-2012 George B. Moody
+Copyright (C) 1989-2013 George B. Moody
 
 This library 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
@@ -183,7 +183,7 @@
 	    continue;
 	}
 	    p1 = strtok((char *)annot.aux+1, " \t");
-	a = atoi(p1);
+	    a = strtol(p1, NULL, 10);
 	if (0 <= a && a <= ACMAX && (p1 = strtok((char *)NULL, " \t"))) {
 	    SSTRCPY(s1, p1);
 	    (void)setannstr(a, s1);
@@ -951,7 +951,7 @@
 	    int dosort = DEFWFDBANNSORT;
 	    char *p = getenv("WFDBANNSORT");
 
-	    if (p) dosort = atoi(p);
+	    if (p) dosort = strtol(p, NULL, 10);
 	    if (dosort) {
 		if (system(NULL) != 0) {
 		    wfdb_error(
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/calib.c wfdb-10.5.21/lib/calib.c
--- wfdb-10.5.20/lib/calib.c	2008-04-08 14:41:36.000000000 -0400
+++ wfdb-10.5.21/lib/calib.c	2013-11-21 10:18:17.000000000 -0500
@@ -1,10 +1,10 @@
 /* file: calib.c	G. Moody	  4 July 1991
-			Last revised:	  8 April 2008		wfdblib 10.4.6
+			Last revised:  18 November 2013		wfdblib 10.5.21
 WFDB library functions for signal calibration
 
 _______________________________________________________________________________
 wfdb: a library for reading and writing annotated waveforms (time series data)
-Copyright (C) 1991-2008 George B. Moody
+Copyright (C) 1991-2013 George B. Moody
 
 This library 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
@@ -115,12 +115,12 @@
 	}
 	else {
 	    this_cle->caltype = WFDB_DC_COUPLED;
-	    this_cle->low = atof(p2);
+	    this_cle->low = strtod(p2, NULL);
 	}
 	if (strcmp(p3, "-") == 0)
 	    this_cle->high = this_cle->low = 0.0;
 	else
-	    this_cle->high = atof(p3);
+	    this_cle->high = strtod(p3, NULL);
 	if (strcmp(p4, "square") == 0)
 	    this_cle->caltype |= WFDB_CAL_SQUARE;
 	else if (strcmp(p4, "sine") == 0)
@@ -128,7 +128,7 @@
 	else if (strcmp(p4, "sawtooth") == 0)
 	    this_cle->caltype |= WFDB_CAL_SAWTOOTH;
 	/* otherwise pulse shape is undefined */
-	this_cle->scale = atof(p5);
+	this_cle->scale = strtod(p5, NULL);
 	SSTRCPY(this_cle->units, p6);
 	this_cle->next = NULL;
 
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/signal.c wfdb-10.5.21/lib/signal.c
--- wfdb-10.5.20/lib/signal.c	2013-07-21 08:46:27.000000000 -0400
+++ wfdb-10.5.21/lib/signal.c	2013-11-19 12:25:22.000000000 -0500
@@ -1,5 +1,5 @@
 /* file: signal.c	G. Moody	13 April 1989
-			Last revised:   21 July 2013		wfdblib 10.5.19
+			Last revised:  18 November 2013		wfdblib 10.5.21
 WFDB library functions for signals
 
 _______________________________________________________________________________
@@ -863,7 +863,7 @@
 		     record);
 	    return (-2);
 	}
-	segments = atoi(q+1);
+	segments = strtol(q+1, NULL, 10);
 	*q = '\0';
     }
 
@@ -903,11 +903,11 @@
 
     /* The file appears to be a new-style header file.  The second token
        specifies the number of signals. */
-    nsig = (unsigned)atoi(p);
+    nsig = (unsigned)strtol(p, NULL, 10);
 
     /* Determine the frame rate, if present and not set already. */
     if (p = strtok((char *)NULL, sep)) {
-	if ((f = (WFDB_Frequency)atof(p)) <= (WFDB_Frequency)0.) {
+	if ((f = (WFDB_Frequency)strtod(p, NULL)) <= (WFDB_Frequency)0.) {
 	    wfdb_error(
 		 "init: sampling frequency in record %s header is incorrect\n",
 		 record);
@@ -935,11 +935,11 @@
 	for ( ; *p && *p != '/'; p++)
 	    ;
 	if (*p == '/') {
-	    cfreq = atof(++p);
+	    cfreq = strtod(++p, NULL);
 	    for ( ; *p && *p != '('; p++)
 		;
 	    if (*p == '(')
-		bcount = atof(++p);
+		bcount = strtod(++p, NULL);
 	}
     }
     if (cfreq <= 0.0) cfreq = ffreq;
@@ -947,7 +947,7 @@
     /* Determine the number of samples per signal, if present and not
        set already. */
     if (p = strtok((char *)NULL, sep)) {
-	if ((ns = (WFDB_Time)atol(p)) < 0L) {
+	if ((ns = (WFDB_Time)strtol(p, NULL, 10)) < 0L) {
 	    wfdb_error(
 		"init: number of samples in record %s header is incorrect\n",
 		record);
@@ -1002,7 +1002,7 @@
 	    }
 	    (void)strcpy(segp->recname, p);
 	    if ((p = strtok((char *)NULL, sep)) == NULL ||
-		(segp->nsamp = (WFDB_Time)atol(p)) < 0L) {
+		(segp->nsamp = (WFDB_Time)strtol(p, NULL, 10)) < 0L) {
 		wfdb_error(
 		"init: length must be specified for segment %s in record %s\n",
 		           segp->recname, record);
@@ -1076,7 +1076,7 @@
 
 	/* Determine the signal format. */
 	if ((p = strtok((char *)NULL, sep)) == NULL ||
-	    !isfmt(hs->info.fmt = atoi(p))) {
+	    !isfmt(hs->info.fmt = strtol(p, NULL, 10))) {
 	    wfdb_error("init: illegal format for signal %d, record %s\n",
 		       s, record);
 	    return (-2);
@@ -1086,11 +1086,11 @@
 	hs->start = 0L;
 	while (*(++p)) {
 	    if (*p == 'x' && *(++p))
-		if ((hs->info.spf = atoi(p)) < 1) hs->info.spf = 1;
+		if ((hs->info.spf = strtol(p, NULL, 10)) < 1) hs->info.spf = 1;
 	    if (*p == ':' && *(++p))
-		if ((hs->skew = atoi(p)) < 0) hs->skew = 0;
+		if ((hs->skew = strtol(p, NULL, 10)) < 0) hs->skew = 0;
 	    if (*p == '+' && *(++p))
-		if ((hs->start = atol(p)) < 0L) hs->start = 0L;
+		if ((hs->start = strtol(p, NULL, 10)) < 0L) hs->start = 0L;
 	}
 	/* The resolution for deskewing is one frame.  The skew in samples
 	   (given in the header) is converted to skew in frames here. */
@@ -1099,7 +1099,7 @@
 	/* Determine the gain in ADC units per physical unit.  This number
 	   may be zero or missing;  if so, the signal is uncalibrated. */
 	if (p = strtok((char *)NULL, sep))
-	    hs->info.gain = (WFDB_Gain)atof(p);
+	    hs->info.gain = (WFDB_Gain)strtod(p, NULL);
 	else
 	    hs->info.gain = (WFDB_Gain)0.;
 
@@ -1110,7 +1110,7 @@
 	    for ( ; *p && *p != '(' && *p != '/'; p++)
 		;
 	    if (*p == '(') {
-		hs->info.baseline = atoi(++p);
+		hs->info.baseline = strtol(++p, NULL, 10);
 		nobaseline = 0;
 	    }
 	    while (*p)
@@ -1128,7 +1128,7 @@
 	   missing and cannot be inferred from the format, the default
 	   value (from wfdb.h) is filled in. */
 	if (p = strtok((char *)NULL, sep))
-	    i = (unsigned)atoi(p);
+	    i = (unsigned)strtol(p, NULL, 10);
 	else switch (hs->info.fmt) {
 	  case 80: i = 8; break;
 	  case 160: i = 16; break;
@@ -1140,7 +1140,7 @@
 	hs->info.adcres = i;
 
 	/* Determine the ADC zero (assumed to be zero if missing). */
-	hs->info.adczero = (p = strtok((char *)NULL, sep)) ? atoi(p) : 0;
+	hs->info.adczero = (p=strtok((char *)NULL,sep)) ? strtol(p,NULL,10) : 0;
 	    
 	/* Set the baseline to adczero if no baseline field was found. */
 	if (nobaseline) hs->info.baseline = hs->info.adczero;
@@ -1148,11 +1148,11 @@
 	/* Determine the initial value (assumed to be equal to the ADC 
 	   zero if missing). */
 	hs->info.initval = (p = strtok((char *)NULL, sep)) ?
-	    atoi(p) : hs->info.adczero;
+	    strtol(p, NULL, 10) : hs->info.adczero;
 
 	/* Determine the checksum (assumed to be zero if missing). */
 	if (p = strtok((char *)NULL, sep)) {
-	    hs->info.cksum = atoi(p);
+	    hs->info.cksum = strtol(p, NULL, 10);
 	    hs->info.nsamp = ns;
 	}
 	else {
@@ -1161,7 +1161,7 @@
 	}
 
 	/* Determine the block size (assumed to be zero if missing). */
-	hs->info.bsize = (p = strtok((char *)NULL, sep)) ? atoi(p) : 0;
+	hs->info.bsize = (p = strtok((char *)NULL,sep)) ? strtol(p,NULL,10) : 0;
 
 	/* Check that formats and block sizes match for signals belonging
 	   to the same group. */
@@ -2304,7 +2304,7 @@
   while ('0' <= *q && *q <= '9')
       q++;
   if (*q == 0) {	/* all digits, probably a signal number */
-      s = atoi(p);
+      s = strtol(p, NULL, 10);
       if (s < nisig || s < nvsig) return (s);
   }
   /* Otherwise, p is either an integer too large to be a signal number or a
@@ -2352,7 +2352,7 @@
 	char *p;
 
         if (p = getenv("WFDBGVMODE"))
-	    mode = atoi(p);
+	    mode = strtol(p, NULL, 10);
 	else
 	    mode = DEFWFDBGVMODE;
     }
@@ -3301,40 +3301,44 @@
    frequency */
 static WFDB_Time fstrtim(char *string, WFDB_Frequency f)
 {
-    char *p;
+    char *p, *q, *r;
     double x, y, z;
-    WFDB_Date days = 0L;
+    WFDB_Date days;
     WFDB_Time t;
 
     while (*string==' ' || *string=='\t' || *string=='\n' || *string=='\r')
 	string++;
     switch (*string) {
       case 'c': return (cfreq > 0. ?
-			(WFDB_Time)((atof(string+1)-bcount)*f/cfreq) :
-			(WFDB_Time)atol(string+1));
+			(WFDB_Time)((strtod(string+1, NULL)-bcount)*f/cfreq) :
+			(WFDB_Time)(strtol(string+1, NULL, 10)));
       case 'e':	return ((in_msrec ? msnsamples : nsamples) * 
 		        (((gvmode&WFDB_HIGHRES) == WFDB_HIGHRES) ? ispfmax: 1));
-      case 'f': return (WFDB_Time)(atol(string+1)*f/ffreq);
+      case 'f': return (WFDB_Time)(strtol(string+1, NULL, 10)*f/ffreq);
       case 'i':	return (WFDB_Time)(istime *
 			(ifreq > 0.0 ? (ifreq/sfreq) : 1.0) *
 			(((gvmode&WFDB_HIGHRES) == WFDB_HIGHRES) ? ispfmax: 1));
       case 'o':	return (ostime);
-      case 's':	return ((WFDB_Time)atol(string+1));
+	  case 's':	return ((WFDB_Time)strtol(string+1, NULL, 10));
       case '[':	  /* time of day, possibly with date or days since start */
-	if (p = strchr(string, ' ')) {
-	    if (strchr(p, '/')) days = strdat(p) - bdate;
-	    else days = atol(p+1);
-	}
-        x = fstrtim(string+1, 1000.0) - btime;
+	if ((q = strchr(++string, ']')) == NULL)
+	    return ((WFDB_Time)0);	/* '[...': malformed time string */
+	if ((p = strchr(string, ' ')) == NULL || p > q)
+	    days = (WFDB_Date)0;/* '[hh:mm:ss.sss]': time since midnight only */
+	else if ((r = strchr(p+1, '/')) == NULL || r > q)
+	    days = (WFDB_Date)strtol(p+1, NULL, 10); /* '[hh:mm:ss.sss d]' */
+	else
+	    days = strdat(p+1) - bdate; /* '[hh:mm:ss.sss dd/mm/yyyy]' */
+        x = fstrtim(string, 1000.0) - btime;
         if (days > 0L) x += (days*(24*60*60*1000.0));
-        t = (x * f / 1000.0 + 0.5);
+        t = (WFDB_Time)(x * f / 1000.0 + 0.5);
 	return (-t);
       default:
-	x = atof(string);
+	x = strtod(string, NULL);
 	if ((p = strchr(string, ':')) == NULL) return ((long)(x*f + 0.5));
-	y = atof(++p);
+	y = strtod(++p, NULL);
 	if ((p = strchr(p, ':')) == NULL) return ((long)((60.*x + y)*f + 0.5));
-	z = atof(++p);
+	z = strtod(++p, NULL);
 	return ((WFDB_Time)((3600.*x + 60.*y + z)*f + 0.5));
     }
 }
@@ -3386,8 +3390,9 @@
     WFDB_Date date;
 
     if ((mp = strchr(string,'/')) == NULL || (yp = strchr(mp+1,'/')) == NULL ||
-	(d = atoi(string)) < 1 || d > 31 || (m = atoi(mp+1)) < 1 || m > 12 ||
-	(y = atoi(yp+1)) == 0)
+	(d = strtol(string, NULL, 10)) < 1 || d > 31 ||
+	(m = strtol(mp+1, NULL, 10)) < 1 || m > 12 ||
+	(y = strtol(yp+1, NULL, 10)) == 0)
 	return (0L);
     if (m > 2) { jy = y; jm = m + 1; }
     else { jy = y - 1; 	jm = m + 13; }
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/wfdb.h wfdb-10.5.21/lib/wfdb.h
--- wfdb-10.5.20/lib/wfdb.h	2013-09-02 18:05:30.000000000 -0400
+++ wfdb-10.5.21/lib/wfdb.h	2013-11-21 10:26:25.000000000 -0500
@@ -1,9 +1,9 @@
 /* file: wfdb.h		G. Moody	13 June 1983
-			Last revised:   4 April 2012		wfdblib 10.5.11
+			Last revised: 18 November 2013		wfdblib 10.5.21
 WFDB library type, constant, structure, and function interface definitions
 _______________________________________________________________________________
 wfdb: a library for reading and writing annotated waveforms (time series data)
-Copyright (C) 1983-2012 George B. Moody
+Copyright (C) 1983-2013 George B. Moody
 
 This library 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
@@ -32,7 +32,7 @@
 /* WFDB library version. */
 #define WFDB_MAJOR   10
 #define WFDB_MINOR   5
-#define WFDB_RELEASE 20
+#define WFDB_RELEASE 21
 #define WFDB_NETFILES 1	/* if 1, library includes code for HTTP, FTP clients */
 #define WFDB_NETFILES_LIBCURL 1
 
@@ -416,8 +416,6 @@
 #if defined(__STDC__) || defined(_WINDOWS)
 # include <stdlib.h>
 #else
-extern double atof();
-extern long atol();
 extern char *getenv();
 extern void exit();
 typedef long time_t;
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/wfdb.h0 wfdb-10.5.21/lib/wfdb.h0
--- wfdb-10.5.20/lib/wfdb.h0	2012-04-04 16:10:54.000000000 -0400
+++ wfdb-10.5.21/lib/wfdb.h0	2013-11-21 10:18:29.000000000 -0500
@@ -1,9 +1,9 @@
 /* file: wfdb.h		G. Moody	13 June 1983
-			Last revised:   4 April 2012		wfdblib 10.5.11
+			Last revised: 18 November 2013		wfdblib 10.5.21
 WFDB library type, constant, structure, and function interface definitions
 _______________________________________________________________________________
 wfdb: a library for reading and writing annotated waveforms (time series data)
-Copyright (C) 1983-2012 George B. Moody
+Copyright (C) 1983-2013 George B. Moody
 
 This library 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
@@ -416,8 +416,6 @@
 #if defined(__STDC__) || defined(_WINDOWS)
 # include <stdlib.h>
 #else
-extern double atof();
-extern long atol();
 extern char *getenv();
 extern void exit();
 typedef long time_t;
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/lib/wfdbio.c wfdb-10.5.21/lib/wfdbio.c
--- wfdb-10.5.20/lib/wfdbio.c	2013-09-02 18:13:40.000000000 -0400
+++ wfdb-10.5.21/lib/wfdbio.c	2013-11-19 12:23:56.000000000 -0500
@@ -1,5 +1,5 @@
 /* file: wfdbio.c	G. Moody	18 November 1988
-                        Last revised:   2 September 2013       wfdblib 10.5.20
+                        Last revised:   18 November 2013       wfdblib 10.5.21
 Low-level I/O functions for the WFDB library
 
 _______________________________________________________________________________
@@ -1081,7 +1081,7 @@
 	if (('0' <= *p && *p <= '9') || *p == '_' || *p == '~' || *p== '-' ||
 	    *p == DSEP ||
 #ifdef MSDOS
-	    *p == ':' ||
+	    *p == ':' || *p == '/' ||
 #endif
 	    ('a' <= *p && *p <= 'z') || ('A' <= *p && *p <= 'Z'))
 	    p++;
@@ -1263,7 +1263,8 @@
     if (!www_done_init) {
 	char *p, *u, version[20];
 
-	if ((p = getenv("WFDB_PAGESIZE")) && *p) page_size = atol(p);
+	if ((p = getenv("WFDB_PAGESIZE")) && *p)
+	    page_size = strtol(p, NULL, 10);
 
 #if WFDB_NETFILES_LIBCURL
 	/* Initialize the curl "easy" handle. */
@@ -1302,9 +1303,12 @@
 	int cachesize = CACHESIZE;	/* maximum size of the cache in MB */
 	int entrysize = ENTRYSIZE;	/* maximum cache entry size in MB */
 
-	if ((p = getenv("WFDB_CACHEDIR")) && *p) cachedir = p;
-	if ((p = getenv("WFDB_CACHESIZE")) && *p) cachesize = atoi(p);
-	if ((p = getenv("WFDB_CACHEENTRYSIZE")) && *p) entrysize = atoi(p);
+	if ((p = getenv("WFDB_CACHEDIR")) && *p)
+	    cachedir = p;
+	if ((p = getenv("WFDB_CACHESIZE")) && *p)
+	    cachesize = strtol(p, NULL, 10);
+	if ((p = getenv("WFDB_CACHEENTRYSIZE")) && *p)
+	    entrysize = strtol(p, NULL, 10);
 #endif
 	sprintf(version, "%d.%d.%d", WFDB_MAJOR, WFDB_MINOR, WFDB_RELEASE);
 	HTProfile_newPreemptiveClient("WFDB", version);
@@ -1380,7 +1384,7 @@
 	if ((a = HTRequest_anchor(request)) && (headers = HTAnchor_header(a)))
 	    while ((pres = (HTAssoc *)HTAssocList_nextObject(headers)))
 		if (HTStrCaseMatch("Content-Length", HTAssoc_name(pres)))
-		    length = atol(HTAssoc_value(pres));
+		    length = strtol(HTAssoc_value(pres), NULL, 10);
 	HTRequest_delete(request);  
     }
     return (length);
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/MANIFEST wfdb-10.5.21/MANIFEST
--- wfdb-10.5.20/MANIFEST	2012-09-25 12:18:58.000000000 -0400
+++ wfdb-10.5.21/MANIFEST	2013-11-19 13:09:04.000000000 -0500
@@ -67,6 +67,7 @@
 checkpkg
 checkpkg/appcheck
 checkpkg/checkfile
+checkpkg/dosify
 checkpkg/expected
 checkpkg/expected/100a.nguess
 checkpkg/expected/100s.a2r
@@ -83,6 +84,7 @@
 checkpkg/expected/100x.hea
 checkpkg/expected/100z.hea
 checkpkg/expected/ann2rr.out
+checkpkg/expected/bxb.err
 checkpkg/expected/bxb.out
 checkpkg/expected/ecgeval.out
 checkpkg/expected/fir.dat
@@ -97,6 +99,7 @@
 checkpkg/expected/psfd.ps
 checkpkg/expected/rdann.out
 checkpkg/expected/rdsamp.out
+checkpkg/expected/rxr.err
 checkpkg/expected/rxr.out
 checkpkg/expected/sampfreq.out
 checkpkg/expected/sigamp.out
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/NEWS wfdb-10.5.21/NEWS
--- wfdb-10.5.20/NEWS	2013-09-02 22:44:49.041000895 -0400
+++ wfdb-10.5.21/NEWS	2013-11-21 18:28:13.046204780 -0500
@@ -1,3 +1,28 @@
+10.5.21 (21 November 2013):
+	This release is the first to pass all tests performed by 'make check'
+	when compiled on MS-Windows using MinGW.  Changes in 'configure',
+	'conf/mingw.def', 'conf/mingw-slib.def', 'lib/wfdbio.c',
+	'app/ecgeval.c', 'app/psfd.c', 'checkpkg/appcheck', and several of the
+	test output references in 'checkpkg/expected/', as well as a new script
+	('checkpkg/dosify'), made this possible.
+
+	In previous releases, WFDB library function strtim() did not always
+	handle bracketed string inputs properly.  Thanks to Benjamin Moody,
+	who reported the problem and provided a patch to fix it.  Prompted
+	by this fix, the deprecated atoi(), atof(), and atol() functions
+	have been replaced throughout the WFDB library by strtol() and
+	strtod().
+
+	rdedfann (convert/rdedfann.c) now accepts a -F option to specify
+	the implied sampling frequency for the output it generates
+	from input that contains EDF annotations only.
+
+	WAVE no longer fails when started with the option -VS 2 (to display
+	valid signals only).  Thanks to Benjamin Moody for reporting the
+	misbehavior and providing a patch.  Benjamin also provided a working
+	set of instructions for compiling WAVE as a 32-bit application on
+	64-bit Debian Wheezy or Ubuntu 12.04;  see 'install-wave32'.
+
 10.5.20 (2 September 2013):
 	Absolute pathnames are not tested in wfdb_open() unless the WFDB
 	path contains an empty component.
diff -Naur --exclude Makefile --exclude info wfdb-10.5.20/wave/init.c wfdb-10.5.21/wave/init.c
--- wfdb-10.5.20/wave/init.c	2010-07-13 16:41:32.000000000 -0400
+++ wfdb-10.5.21/wave/init.c	2013-11-21 10:22:34.000000000 -0500
@@ -1,10 +1,10 @@
 /* file: init.c		G. Moody	 1 May 1990
-			Last revised:   13 July 2010
+			Last revised: 18 November 2013
 Initialization functions for WAVE
 
 -------------------------------------------------------------------------------
 WAVE: Waveform analyzer, viewer, and editor
-Copyright (C) 1990-2010 George B. Moody
+Copyright (C) 1990-2013 George B. Moody
 
 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
@@ -254,7 +254,7 @@
     else
 	for (i = 0; i < siglistlen; i++)
 	    base[i] = canvas_height*(2*i+1.)/(2.*siglistlen);
-    if (nsig > 1)
+    if (i > 1)
 	abase = (base[i/2] + base[i/2-1])/2;
     else if (nsig > 0)
 	abase = canvas_height*4/5;
