2009-10-24  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2009-10-24.

	* include/fcntl.h: Patch removed because it has been checked in
	into the djgpp cvs repository.

	* include/time.h: Patch removed because it has been checked in
	into the djgpp cvs repository.

	* src/libc/posix/fcntl/open.c: Patch removed because it has been
	rejected to be included into the djgpp cvs repository.  It will be
	always be part of libsupp.

	* tests/libc/posix/fcntl/open.c: Patch removed because it has been
	rejected to be included into the djgpp cvs repository.  It will be
	always be part of libsupp.

	* src/docs/kb/wc204.txi: Patch removed because it has been rejected
	to be included into the djgpp cvs repository.


2009-07-17  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2009-04-14.

	* src/libc/posix/fcntl/open.c: Implementation of POSIX conforming
	handling of pathnames ending with a slash.

	* tests/libc/posix/fcntl/open.c: Checks added to test implementation
	of POSIX conforming handling of pathnames ending with a slash.

	* src/docs/kb/wc204.txi: Info about open() added.


2009-06-20  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/fcntl.h: Macro _O_TEMPORARY as alias for O_TEMPORARY added
	for compatibility with other compilers.

	* include/time.h: static qualifier added to _rdtsc prototype.


2009-04-04  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/ansi/stdio/doscan.c: Prototype for _doscan_low added.

	* tests/libc/ansi/stdio/tscanf.c: %[aA] conversion specifiers test adjusted.


2009-02-02  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2009-02-01.

	* src/libc/ansi/stdio/doscan.c: Support for %[aA] conversion specifier
	added.

	* src/libc/ansi/stdio/scanf.txh: Information about %[aA] conversion
	specifier added.

	* src/docs/kb/wc204.txi: Info about %[aA] conversion specifier for
	doscan() added.

	* tests/libc/ansi/stdio/tscanf.c: Test case for %[aA] conversion specifier
	added.


2008-12-15  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2008-12-12.

	* include/wchar.h: Replace mbstate_t.


2008-12-14  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/ansi/time/strftime.c: Minor coding style fixes.


2008-12-09  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/posix/sys/stat/fixpath.c: The patch that fixes the bug that
	lower case characters are not recognized as valid drive specifiers has
	been commited to DJGPP's cvs repositry and removed from this patch.
	Also the patch that fixes that the backslash following the drive
	specifier character is not replaced by a slash when the path is
	canonicalized has been commited to DJGPP's cvs repository and removed
	from this patch.

	* src/libc/posix/dirent/opendir.c: The patch that makes that no longer
	a trailing "/*.*" string is added to the canonicalized directory string
	stored in the DIR directory structure has been commited to DJGPP's cvs
	repository and removed from the patch.



2008-09-27  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2008-09-27.


	* include/string.h: Declaration of memmem added.

	* src/libc/compat/string/makefile: memmem added to target list.

	* src/libc/compat/string/memmem.c: Implementation of memmem.

	* src/libc/compat/string/memmem.txh: Documentation of memmem.

	* tests/libc/compat/string/makefile: memmem added to target list.

	* tests/libc/compat/string/memmem.c: memmem tests.

	* src/docs/kb/wc204.txi: Info about memmem added.

	* include/ieeefp.h: Patch removed because it has been checked in.



2008-09-17  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/posix/sys/stat/fixpath.c: The patch that inhibits that ENOSYS is
	reported if no LFN API is available has been removed because it has been checked
	in.



2008-09-16  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2008-09-14.

	* src/libc/posix/sys/stat/lstat.c: Patch to define _ioctl_get_first_cluster
	as static has been checked in and has been removed.

	* src/libc/posix/sys/stat/fixpath.c: Do not signal that LFN API is not
	available (ENOSYS).



2008-06-25  Juan Manuel Guerrero  <juan.guerrero@gmx.de>
	Diffs against djgpp CVS head of 2008-06-25.

	* src/libc/posix/sys/stat/lstat.c: Define _ioctl_get_first_cluster as static
	and remove declaration.



2008-06-23  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/posix/sys/stat/fixpath.c: If path is root path remove
	the backslash following the drive specifier.  The trailing slash is
	always added by the calling function.
	Also always allow for lower case drive specifier letter in a path.

	* src/docs/kb/wc204.txi: Info about bug fixes for __get_current_directory
	added.



2008-06-15  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	Patches provided by Andris Pavenis for emu387.cc have been checked in
	and are removed from this patch.



2008-06-10  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	Patches provided by Andris Pavenis to fix certain gcc 4.3.0 specific
	issues when compiling djgpp CVS sources.  See:
	<http://www.delorie.com/archives/browse.cgi?p=djgpp-workers/2008/06/09/16:26:00>

	* include/ieeefp.h: gcc 4.3.0 and gcc 4.3.1 specific patch.



2008-06-09  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/libc/compat/string/strndup.c: Implementation of strndup fixed.



2008-05-21  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* djgpp/src/libc/posix/dirent/opendir.c (opendir): Add trailing slash
	to the full directory path but no longer append "*.*" to it.
	(__set_need_fake_dot_dotdot): Adjust path string passed to findfirst
	accordingly.

	* djgpp/src/libc/posix/dirent/readdir.c (readdir):  Add "*.*" to the
	path string passed to findfirst.

	* src/docs/kb/wc204.txi: Document changes.



2005-05-10  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	Patches provided by Andris Pavenis to fix certain gcc 4.3.0 specific
	issues when compiling djgpp CVS sources.  See:
	<http://www.delorie.com/archives/browse.cgi?p=djgpp-workers/2008/05/01/08:49:44>
	<http://www.delorie.com/archives/browse.cgi?p=djgpp-workers/2008/05/01/09:18:37>

	* include/ieeefp.h: gcc 4.3.0 specific patch.

	* src/libemu/src/emu387.cc (fpatan): gcc 4.3.0 specific patch.



2008-05-03  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/string.h: Declaration of strnlen and strndup added.

	* src/libc/compat/string/strndup.c: Implementation of strndup.

	* src/libc/compat/string/strndup.txh: Documentation of strndup.

	* src/libc/compat/string/strnlen.c: Implementation of strnlen.

	* src/libc/compat/string/strnlen.txh: Documentation of strnlen.

	* src/docs/kb/wc204.txi: Info about strndup and strnlen added.



2008-04-27  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/argz.h: New file.  Declaration of functions.

	* include/errno.h: Make error_t available.

	* include/sys/djtypes.h: Define error_t.

	* src/libc/compat/argz/add.c: Implementation of argz_add.

	* src/libc/compat/argz/add.txh: Documentation of argz_add.

	* src/libc/compat/argz/add_sep.c: Implementation of argz_add_sep.

	* src/libc/compat/argz/add_sep.txh: Documentation of argz_add_sep.

	* src/libc/compat/argz/append.c: Implementation of argz_append.

	* src/libc/compat/argz/append.txh: Documentation of argz_append.

	* src/libc/compat/argz/count.c: Implementation of argz_count.

	* src/libc/compat/argz/count.txh: Documentation of argz_count.

	* src/libc/compat/argz/create.c: Implementation of argz_create.

	* src/libc/compat/argz/create.txh: Documentation of argz_create.

	* src/libc/compat/argz/creatsep.c: Implementation of argz_creatsep.

	* src/libc/compat/argz/creatsep.txh: Documentation of argz_creatsep.

	* src/libc/compat/argz/delete.c: Implementation of argz_delete.

	* src/libc/compat/argz/delete.txh: Documentation of argz_delete.

	* src/libc/compat/argz/extract.c: Implementation of argz_extract.

	* src/libc/compat/argz/extract.txh: Documentation of argz_extract.

	* src/libc/compat/argz/insert.c: Implementation of argz_insert.

	* src/libc/compat/argz/insert.txh: Documentation of argz_insert.

	* src/libc/compat/argz/next.c: Implementation of argz_next.

	* src/libc/compat/argz/next.txh: Documentation of argz_next.

	* src/libc/compat/argz/replace.c: Implementation of argz_replace.

	* src/libc/compat/argz/replace.txh: Documentation of argz_replace.

	* src/libc/compat/argz/strngify.c: Implementation of argz_strngify.

	* src/libc/compat/argz/strngify.txh: Documentation of argz_strngify.

	* src/libc/compat/argz/makefile: Initial version.

	* src/docs/kb/wc204.txi: Info about argz family of functions added.

	* tests/libc/compat/argz/argztest.c: New file.  Implements tests for
	argz family of functions.








diff -aprNU5 djgpp.orig/include/argz.h djgpp/include/argz.h
--- djgpp.orig/include/argz.h	1970-01-01 00:00:00 +0000
+++ djgpp/include/argz.h	2009-10-24 20:02:08 +0000
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+
+#ifndef __dj_include_argz_h_
+#define __dj_include_argz_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __dj_ENFORCE_ANSI_FREESTANDING
+
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+  || !defined(__STRICT_ANSI__)
+
+#endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */
+
+#ifndef __STRICT_ANSI__
+
+#ifndef _POSIX_SOURCE
+
+#include <errno.h>
+
+#ifndef _SIZE_T
+__DJ_size_t
+#define _SIZE_T
+#endif
+
+error_t  argz_add(char **_argz, size_t *_argz_len, const char *_str);
+error_t  argz_add_sep(char **_argz, size_t *_argz_len, const char *_str, int _sep);
+error_t  argz_append(char **_argz, size_t *_argz_len, const char *_buf, size_t _buf_len);
+size_t   argz_count(const char *_argz, size_t _argz_len);
+error_t  argz_create(char *const _argv[], char **_argz, size_t *_argz_len);
+error_t  argz_create_sep(const char *_str, int _sep, char **_argz, size_t *_argz_len);
+void     argz_delete(char **_argz, size_t *_argz_len, char *_entry);
+void     argz_extract(const char *_argz, size_t _argz_len, char **_argv);
+error_t  argz_insert(char **_argz, size_t *_argz_len, char *_before, const char *_entry);
+char    *argz_next(const char *_argz, size_t _argz_len, const char *_entry);
+error_t  argz_replace(char **_argz, size_t *_argz_len, const char *_str, const char *_with, unsigned *_replace_count);
+void     argz_stringify(char *_argz, size_t _argz_len, int _sep);
+
+#endif /* !_POSIX_SOURCE */
+#endif /* !__STRICT_ANSI__ */
+#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
+
+#ifndef __dj_ENFORCE_FUNCTION_CALLS
+#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !__dj_include__h_ */
diff -aprNU5 djgpp.orig/include/errno.h djgpp/include/errno.h
--- djgpp.orig/include/errno.h	2003-02-04 20:17:16 +0000
+++ djgpp/include/errno.h	2009-10-24 20:02:08 +0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
@@ -73,10 +74,17 @@ extern char *		sys_errlist[];
 extern int		sys_nerr;
 extern const char *	__sys_errlist[];
 extern int		__sys_nerr;
 extern int		_doserrno;
 
+#include <sys/djtypes.h>
+
+#ifndef _ERROR_T
+__DJ_error_t
+#define _ERROR_T
+#endif
+
 #endif /* !_POSIX_SOURCE */
 #endif /* !__STRICT_ANSI__ */
 #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
 
 #ifndef __dj_ENFORCE_FUNCTION_CALLS
diff -aprNU5 djgpp.orig/include/string.h djgpp/include/string.h
--- djgpp.orig/include/string.h	2007-12-11 07:01:20 +0000
+++ djgpp/include/string.h	2009-10-24 20:02:08 +0000
@@ -71,21 +71,24 @@ void 	bcopy(const void *_a, void *_b, si
 void 	bzero(void *ptr, size_t _len);
 int	ffs(int _mask);
 char *  index(const char *_string, int _c);
 void *	memccpy(void *_to, const void *_from, int c, size_t n);
 int	memicmp(const void *_s1, const void *_s2, size_t _n);
+void *	memmem(const void *_haystack, size_t _haystack_len, const void *_needle, size_t _needle_len);
 char *  rindex(const char *_string, int _c);
 char *	stpcpy(char *_dest, const char *_src);
 char *	stpncpy(char *_dest, const char *_src, size_t _n);
 char *	strdup(const char *_s);
+char *	strndup(const char *_s, size_t _n);
 size_t	strlcat(char *_dest, const char *_src, size_t _size);
 size_t	strlcpy(char *_dest, const char *_src, size_t _size);
 char *	strlwr(char *_s);
 int	strcasecmp(const char *_s1, const char *_s2);
 int	stricmp(const char *_s1, const char *_s2);
 int	strncasecmp(const char *_s1, const char *_s2, size_t _n);
 int	strnicmp(const char *_s1, const char *_s2, size_t _n);
+size_t	strnlen(const char *_s, size_t _n);
 char *	strsep(char **_stringp, const char *_delim);
 char *	strupr(char *_s);
 
 #endif /* !_POSIX_SOURCE */
 #endif /* !__STRICT_ANSI__ */
diff -aprNU5 djgpp.orig/include/sys/djtypes.h djgpp/include/sys/djtypes.h
--- djgpp.orig/include/sys/djtypes.h	2008-09-26 22:20:46 +0000
+++ djgpp/include/sys/djtypes.h	2009-10-24 20:02:08 +0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
@@ -7,10 +8,11 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
 #ifndef __DJ_sys_djtypes_h_
 #define __DJ_sys_djtypes_h_
 
 #define __DJ_clock_t	typedef int clock_t;
+#define __DJ_error_t	typedef int error_t;
 #define __DJ_gid_t	typedef int gid_t;
 #define __DJ_off_t	typedef int off_t;
 #define __DJ_off64_t	__extension__ typedef long long off64_t;
 #define __DJ_offset_t	__extension__ typedef long long offset_t;
 #define __DJ_pid_t	typedef int pid_t;
diff -aprNU5 djgpp.orig/src/docs/kb/wc204.txi djgpp/src/docs/kb/wc204.txi
--- djgpp.orig/src/docs/kb/wc204.txi	2009-09-15 09:14:08 +0000
+++ djgpp/src/docs/kb/wc204.txi	2009-10-24 20:10:58 +0000
@@ -1187,5 +1187,33 @@ but their usage is deprecated.
 @findex _O_TEMPORARY@r{, new flag accepted by @code{open}}
 @findex open@r{, supports temporary files}
 The @code{_O_TEMPORARY} flag is an alias for the @code{O_TEMPORARY} flag
 supported by @code{open}.  It is supported to increase compatibility
 with other C compilers.
+
+@findex add@r{, added to the library}
+@findex add_sep@r{, added to the library}
+@findex append@r{, added to the library}
+@findex count@r{, added to the library}
+@findex create@r{, added to the library}
+@findex create_sep@r{, added to the library}
+@findex delete@r{, added to the library}
+@findex extract@r{, added to the library}
+@findex insert@r{, added to the library}
+@findex next@r{, added to the library}
+@findex replace@r{, added to the library}
+@findex stringify@r{, added to the library}
+New GNU glibc compatibility @code{argz} family of functions were added.
+
+@findex strndup@r{, added to the library}
+@findex strnlen@r{, added to the library}
+The GNU compatibility functions @code{strndup} and @code{strnlen} were added.
+
+@findex memmem@r{, added to the library}
+The GNU compatibility function @code{memmem} was added.
+
+@findex _doscan@r{, and C99 conversion specifiers}
+@findex scanf@r{, and C99 conversion specifiers}
+The @code{a}, @code{A} and @code{F} conversion specifiers
+are now supported by @code{_doscan} and the @code{scanf}
+family of functions.
+
diff -aprNU5 djgpp.orig/src/libc/ansi/stdio/doscan.c djgpp/src/libc/ansi/stdio/doscan.c
--- djgpp.orig/src/libc/ansi/stdio/doscan.c	2004-04-08 16:11:04 +0000
+++ djgpp/src/libc/ansi/stdio/doscan.c	2009-10-24 20:02:08 +0000
@@ -1,5 +1,6 @@
+/* Copyright (C) 2009 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
@@ -42,11 +43,14 @@ static char _sctab[256] = {
 	0,0,0,0,0,0,0,0,
 	0,0,0,0,0,0,0,0,
 };
 
 static int nchars = 0;
-static char decimal = '.';
+static char decimal_point = '.';
+
+int _doscan_low(FILE *_iop, int (*_scan_getc)(FILE *), int (*_scan_ungetc)(int, FILE *), const char *_fmt, va_list _argp);
+
 
 int 
 _doscan(FILE *iop, const char *fmt, va_list argp)
 {
   return(_doscan_low(iop, fgetc, ungetc, fmt, argp));
@@ -59,11 +63,11 @@ _doscan_low(FILE *iop, int (*scan_getc)(
   register int ch;
   int nmatch, len, ch1;
   int *ptr, fileended, size;
   int suppressed;
 
-  decimal = localeconv()->decimal_point[0];
+  decimal_point = localeconv()->decimal_point[0];
   nchars = 0;
   nmatch = 0;
   fileended = 0;
   suppressed = 0;
   for (;;) switch (ch = *fmt++) {
@@ -226,16 +230,16 @@ _innum(int *ptr, int type, int len, int 
     return(_instr(ptr? (char *)ptr: (char *)NULL, type, len,
 		  iop, scan_getc, scan_ungetc, eofptr));
   lcval = 0;
   ndigit = 0;
   scale = INT;
-  if (type=='e'||type=='f'||type=='g')
+  if (type=='a'||type=='e'||type=='f'||type=='g')
     scale = FLOAT;
   base = 10;
   if (type=='o')
     base = 8;
-  else if (type=='x'||type=='p')
+  else if (type=='x'||type=='p'||type=='a')
     base = 16;
   np = numbuf;
   expseen = 0;
   negflg = 0;
   while (((nchars++, c = scan_getc(iop)) != EOF)
@@ -256,11 +260,11 @@ _innum(int *ptr, int type, int len, int 
   cpos = 0;
   for ( ; --len>=0; *np++ = c, c = scan_getc(iop), nchars++) {
     cpos++;
     if (c == '0' && cpos == 1 && type == 'i')
       base = 8;
-    if ((c == 'x' || c == 'X') && (type == 'i' || type == 'x')
+    if ((c == 'x' || c == 'X') && (type == 'a' || type == 'i' || type == 'x')
 	&& cpos == 2 && lcval == 0)
     {
       base = 16;
       continue;
     }
@@ -281,17 +285,17 @@ _innum(int *ptr, int type, int len, int 
       else
 	c -= 'A'-10;
       lcval += c;
       c = c1;
       continue;
-    } else if (c==decimal) {
-      if (base!=10 || scale==INT)
+    } else if (c==decimal_point) {
+      if (scale==INT || base==8)
 	break;
       ndigit++;
       continue;
-    } else if ((c=='e'||c=='E') && expseen==0) {
-      if (base!=10 || scale==INT || ndigit==0)
+    } else if ((c=='e'||c=='E'||c=='p'||c=='P') && expseen==0) {
+      if (scale==INT || base==8 || ndigit==0)
 	break;
       expseen++;
       *np++ = c;
       c = scan_getc(iop);
       nchars++;
diff -aprNU5 djgpp.orig/src/libc/ansi/stdio/scanf.txh djgpp/src/libc/ansi/stdio/scanf.txh
--- djgpp.orig/src/libc/ansi/stdio/scanf.txh	2003-01-29 12:28:44 +0000
+++ djgpp/src/libc/ansi/stdio/scanf.txh	2009-10-24 20:02:08 +0000
@@ -113,27 +113,45 @@ Convert the input to a @code{ptrdiff_t} 
 
 @item zd
 
 Convert the input to a @code{size_t} using 10 as the base.
 
+
+@item a
+@itemx A
+
+Convert the input of the form [+|-]0xH.HHHHp|P[+|-]DDD to a floating point number (a @code{float}).
+
 @item e
 @itemx E
 @itemx f
 @itemx F
 @itemx g
 @itemx G
 
 Convert the input to a floating point number (a @code{float}).
 
+@item la
+@itemx lA
+
+Convert the input of the form [+|-]0xH.HHHHp|P[+|-]DDD to a floating point number (a @code{double}).
+
 @item le
 @itemx lE
 @itemx lf
 @itemx lF
 @itemx lg
 @itemx lG
 
-Convert the input to a @code{double}.
+Convert the input to a floating point number (a @code{double}).
+
+@item La
+@itemx LA
+@item lla
+@itemx llA
+
+Convert the input of the form [+|-]0xH.HHHHp|P[+|-]DDD to a floating point number (a @code{double}).
 
 @item Le
 @itemx LE
 @itemx lle
 @itemx llE
@@ -144,11 +162,11 @@ Convert the input to a @code{double}.
 @itemx Lg
 @itemx LG
 @itemx llg
 @itemx llG
 
-Convert the input to a @code{long double}.
+Convert the input to a floating point number (a @code{long double}.
 
 @item i
 
 Convert the input, determining base automatically by the presence of
 @code{0x} or @code{0} prefixes, and store in a signed @code{int}.
diff -aprNU5 djgpp.orig/src/libc/compat/argz/add.c djgpp/src/libc/compat/argz/add.c
--- djgpp.orig/src/libc/compat/argz/add.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/add.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,16 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <string.h>
+
+
+error_t
+argz_add(char **argz, size_t *argz_len, const char *str)
+{
+  /*
+   *  Add STR to the end of the argz vector in ARGZ of length ARGZ_LEN.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  return argz_append(argz, argz_len, str, strlen(str) + 1);
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/add.txh djgpp/src/libc/compat/argz/add.txh
--- djgpp.orig/src/libc/compat/argz/add.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/add.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,46 @@
+@node argz_add, string
+@findex argz_add
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_add(char **@var{argz}, size_t *@var{argz_len}, const char *@var{str})
+@end example
+
+@subheading Description
+
+Adds the string @var{str} to the end of the argz vector @var{argz} of length @var{argz_len}.
+If the string @var{str} is successfully added then the length @var{argz_len} will be increased
+accordingly.  Because the function modifies the argz vector, both its length @var{argz_len} and
+@var{argz} itself must be passed as pointers.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *str = "foobar";  /*  String to be added to argz.  */
+error_t error;
+
+error = argz_add(&argz, &argz_len, str);
+
+if (error)
+@{
+  printf("error: String %s could not be added to argz.\n", str);
+  exit(ENOMEM);
+@}
+else
+@{
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/add_sep.c djgpp/src/libc/compat/argz/add_sep.c
--- djgpp.orig/src/libc/compat/argz/add_sep.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/add_sep.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+error_t
+argz_add_sep(char **argz, size_t *argz_len, const char *str, int sep)
+{
+  /*
+   *  Add SEP separated list in STR to the end of the argz vector
+   *  in ARGZ with length ARGZ_LEN adjusted accordingly.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  char *str_argz = NULL;
+  size_t str_argz_len = 0;
+
+
+  argz_create_sep(str, sep, &str_argz, &str_argz_len);
+
+  if (str_argz_len)
+  {
+    size_t new_argz_len = *argz_len + str_argz_len;
+
+    *argz = realloc(*argz, new_argz_len);
+    if (*argz == NULL)
+      return ENOMEM;
+
+    memcpy(*argz + *argz_len, str_argz, str_argz_len);
+    *argz_len = new_argz_len;
+  }
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/add_sep.txh djgpp/src/libc/compat/argz/add_sep.txh
--- djgpp.orig/src/libc/compat/argz/add_sep.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/add_sep.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,50 @@
+@node argz_add_sep, string
+@findex argz_add_sep
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_add_sep(char **@var{argz}, size_t *@var{argz_len}, const char *@var{str},
+                     int @var{sep})
+@end example
+
+@subheading Description
+
+Adds the string @var{str} to the end of the argz vector @var{argz} of length @var{argz_len}.
+For every occurence of the delimiter @var{sep} in @var{str}, the delimiter is replaced by
+the @code{NUL} byte as separating token.  If the string @var{str} is successfully added
+then the length @var{argz_len} will be increased accordingly.  Because the function modifies
+the argz vector, both its length @var{argz_len} and itself @var{argz} must be passed as pointers.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *str = "foo:bar:foo";  /*  String to be added to argz.  */
+int delimiter = ':';  /*  Separator token.  Every ':' in str  */
+                      /*  will be replaced with '\0'.  */
+error_t error;
+
+error = argz_add_sep(&argz, &argz_len, str, delimiter);
+
+if (error)
+@{
+  printf("error: String %s could not be added to argz.\n", str);
+  exit(ENOMEM);
+@}
+else
+@{
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/append.c djgpp/src/libc/compat/argz/append.c
--- djgpp.orig/src/libc/compat/argz/append.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/append.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+error_t
+argz_append(char **argz, size_t *argz_len, const char *buf, size_t buf_len)
+{
+  /*
+   *  Append BUF, of length BUF_LEN to the argz vector in ARGZ
+   *  of length ARGZ_LEN.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  if (buf_len)
+  {
+    char *new_argz;
+    size_t new_argz_len;
+
+    new_argz_len = *argz_len + buf_len;
+    new_argz = realloc(*argz, new_argz_len);
+    if (new_argz == NULL)
+      return ENOMEM;
+
+    memcpy(new_argz + *argz_len, buf, buf_len);
+    *argz = new_argz;
+    *argz_len = new_argz_len;
+  }
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/argz.txh djgpp/src/libc/compat/argz/argz.txh
--- djgpp.orig/src/libc/compat/argz/argz.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/argz.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,24 @@
+@node argz functions, string
+@cindex argz functions
+
+@subheading Description
+
+These functions are glibc-specific and a GNU extension, so handle with care.
+
+An argz vector is a pointer to a character buffer together with a length.  The
+intended interpretation of the character buffer is array of strings, where the
+strings are separated by @code{NUL} bytes.  If the length is nonzero, the last
+byte of the buffer must be a @code{NUL} byte.  These functions are for handling
+argz vectors.  The pair (@code{NULL}, 0) is an argz  vector, and, conversely,
+argz vectors of length 0 must have @code{NULL} pointer.  Allocation of nonempty
+argz vectors is done using malloc, so that free can be used to dispose of them
+again.
+
+Argz vectors without final @code{NUL} may lead to Segmentation Faults.
+
+
+@subheading Return Value
+
+All argz functions that do memory allocation have a return type of @code{error_t},
+and return 0 for success, and ENOMEM if an allocation error occurs.
+
diff -aprNU5 djgpp.orig/src/libc/compat/argz/count.c djgpp/src/libc/compat/argz/count.c
--- djgpp.orig/src/libc/compat/argz/count.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/count.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,22 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+
+#define EOS  '\0'
+
+
+size_t
+argz_count(const char *argz, size_t argz_len)
+{
+  /*
+   *  Return the number of strings in ARGZ.
+   */
+
+  size_t counts, i;
+
+
+  for (counts = i = 0; i < argz_len; i++)
+    if (argz[i] == EOS)
+      counts++;
+
+  return counts;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/count.c.jmg djgpp/src/libc/compat/argz/count.c.jmg
--- djgpp.orig/src/libc/compat/argz/count.c.jmg	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/count.c.jmg	2009-10-24 20:02:08 +0000
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+
+#define EOS  '\0'
+
+
+size_t
+argz_count(const char *argz, size_t argz_len)
+{
+  /*
+   *  Return the number of strings in ARGZ.
+   *  Version, die erlaubt dass angehaengter string nicht mit '\0' enden muss.  JMG.
+   */
+
+  size_t counts, i;
+
+
+  for (counts = i = 0; i < argz_len; i++)
+    if (argz[i] == EOS)
+      counts++;
+  if (argz[argz_len - 1] != EOS)
+    counts++;  /*  A not '\0' terminated string.  */
+
+  return counts;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/count.txh djgpp/src/libc/compat/argz/count.txh
--- djgpp.orig/src/libc/compat/argz/count.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/count.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,32 @@
+@node argz_count, string
+@findex argz_count
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+size_t argz_count(const char *@var{argz}, size_t @var{argz_len})
+@end example
+
+@subheading Description
+
+Counts the number of strings contained in the argz vector @var{argz} of length @var{argz_len}.
+Every string must be terminated with a @code{NUL} byte to be counted.
+
+@subheading Return Value
+
+The number of strings.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+size_t entries;
+
+entries = argz_count(argz, argz_len);
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/create.c djgpp/src/libc/compat/argz/create.c
--- djgpp.orig/src/libc/compat/argz/create.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/create.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+error_t
+argz_create(char *const argv[], char **argz, size_t *argz_len)
+{
+  /*
+   *  Make a '\0' separated argz vector from a ARGV vector,
+   *  returning it via ARGZ, and the total length in ARGZ_LEN.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  *argz_len = 0;
+  if (*argv == NULL)
+    *argz = NULL;
+  else
+  {
+    unsigned int argc, i;
+    char *p;
+
+    for (argc = 0; argv[argc]; argc++)
+      *argz_len += (strlen(argv[argc]) + 1);
+    *argz = malloc(*argz_len);
+    if (*argz == NULL)
+      return ENOMEM;
+
+    for (p = *argz, i = 0; i < argc; i++, p++)
+      p = stpcpy(p, argv[i]);
+  }
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/create.txh djgpp/src/libc/compat/argz/create.txh
--- djgpp.orig/src/libc/compat/argz/create.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/create.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,55 @@
+@node argz_create, string
+@findex argz_create
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_create(char *const @var{argv}[], char **@var{argz}, size_t *@var{argz_len})
+@end example
+
+@subheading Description
+
+Makes a @code{NUL} byte separated argz vector from a string array @var{argv},
+returning it via the pointer **@var{argz} and the total length via the pointer
+*@var{argz_len}.  The string array @var{argv} must be a Unix-style argument
+vector @code{argv} (a vector of pointers to normal C strings, terminated by @code{NULL}).
+Because the function modifies the argz vector, both its length @var{argz_len} and @var{argz}
+itself must be passed as pointers.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *const _argv[] = @{
+  "foo",
+  "bar",
+  NULL
+@};
+char *argz;  /*  Buffer will be allocated by argz_create.  */
+size_t argz_len;
+error_t error;
+
+
+error = argz_create(_argv, &argz, &argz_len);
+
+if (error)
+@{
+  printf("error: argz vector could not be created.\n");
+  exit(error);
+@}
+else
+@{
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/creatsep.c djgpp/src/libc/compat/argz/creatsep.c
--- djgpp.orig/src/libc/compat/argz/creatsep.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/creatsep.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define EOS '\0'
+
+
+error_t
+argz_create_sep(const char *str, int sep, char **argz, size_t *argz_len)
+{
+  /*
+   *  Make a '\0' separated argz vector from a SEP separated list in
+   *  STR, returning it via ARGZ, and the total length in ARGZ_LEN.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  if (!str || str[0] == EOS)
+  {
+    *argz_len = 0;
+    *argz= NULL;
+  }
+  else
+  {
+    size_t i;
+
+    *argz_len = strlen(str) + 1;
+    *argz = malloc(*argz_len);
+    if (*argz == NULL)
+      return ENOMEM;
+
+    for (i = 0; i < *argz_len; i++)
+      (*argz)[i] = (str[i] == sep) ? EOS : str[i];
+  }
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/creatsep.c.jmg djgpp/src/libc/compat/argz/creatsep.c.jmg
--- djgpp.orig/src/libc/compat/argz/creatsep.c.jmg	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/creatsep.c.jmg	2009-10-24 20:02:08 +0000
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define EOS '\0'
+
+
+error_t
+argz_create_sep(const char *str, int sep, char **argz, size_t *argz_len)
+{
+  /*
+   *  Make a '\0' separated arg vector from a SEP separated list in
+   *  STR, returning it via ARGZ, and the total length in ARGZ_LEN.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   *  Version mit selber Anzahl von Zeichen.  JMG.
+   */
+
+  if (!str || str[0] == EOS)
+  {
+    *argz_len = 0;
+    *argz= NULL;
+  }
+  else
+  {
+    size_t i;
+
+    *argz_len = strlen(str) - 1;
+    if (str[*argz_len] != sep)
+      (*argz_len)++;
+    *argz = malloc(*argz_len);
+    if (*argz == NULL)
+      return ENOMEM;
+
+    (*argz_len)++;  /*  Count the trailing '\0' too.  */
+    for (i = 0; i < *argz_len; i++)
+      (*argz)[i] = (str[i] == sep) ? EOS : str[i];
+  }
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/creatsep.txh djgpp/src/libc/compat/argz/creatsep.txh
--- djgpp.orig/src/libc/compat/argz/creatsep.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/creatsep.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,51 @@
+@node argz_create_sep, string
+@findex argz_create_sep
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_create_sep(const char *@var{str}, int @var{sep}, char **@var{argz},
+                        size_t *@var{argz_len})
+@end example
+
+@subheading Description
+
+Makes a @code{NUL} byte separated argz vector from a @var{sep} separated list in
+@var{str}, returning it via the pointer **@var{argz} and the total length via the pointer
+*@var{argz_len}.  Because the function modifies the argz vector, both its length @var{argz_len}
+and @var{argz} itself must be passed as pointers.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *path = "c:\\foo;c:\\bar;c:\\baz";
+int path_sep = ';';
+char *argz;  /*  Buffer will be allocated by argz_create_sep.  */
+size_t argz_len;
+error_t error;
+
+
+error = argz_create_sep(path, path_sep, &argz, &argz_len);
+
+if (error)
+@{
+  printf("error: argz vector could not be created.\n");
+  exit(error);
+@}
+else
+@{
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/delete.c djgpp/src/libc/compat/argz/delete.c
--- djgpp.orig/src/libc/compat/argz/delete.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/delete.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+void
+argz_delete(char **argz, size_t *argz_len, char *entry)
+{
+  /*
+   *  Delete ENTRY from the argz vector in ARGZ
+   *  adjusting its length ARGZ_LEN accordingly.
+   */
+
+  if (entry)
+  {
+    size_t entry_len = strlen(entry) + 1;
+
+    *argz_len -= entry_len;
+    memmove(entry, entry + entry_len, *argz_len - (entry - *argz));
+    if (*argz_len == 0)
+    {
+      free(*argz);
+      *argz = NULL;
+    }
+  }
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/delete.txh djgpp/src/libc/compat/argz/delete.txh
--- djgpp.orig/src/libc/compat/argz/delete.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/delete.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,32 @@
+@node argz_delete, string
+@findex argz_delete
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+void argz_delete(char **@var{argz}, size_t *@var{argz_len}, char *@var{entry})
+@end example
+
+@subheading Description
+
+Deletes the string @var{entry} from the argz vector in @var{argz} adjusting its
+length @var{argz_len} accordingly.  Because the function modifies the argz
+vector, both its length @var{argz_len} and @var{argz} itself must be passed as
+pointers.
+
+@subheading Return Value
+
+Nothing.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+argz_delete(&argz, &argz_len, "FOOBAR");
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/extract.c djgpp/src/libc/compat/argz/extract.c
--- djgpp.orig/src/libc/compat/argz/extract.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/extract.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <libc/unconst.h>
+
+#define EOS  '\0'
+
+
+void
+argz_extract(const char *argz, size_t argz_len, char **argv)
+{
+  /*
+   *  Store pointers to each string in ARGZ, plus a terminating 0 element,
+   *  into the argv array ARGV, which must be large enough to hold them all.
+   */
+
+  const size_t counts = argz_count(argz, argz_len);
+  size_t i;
+
+
+
+  if (counts == argz_len)
+    for (i = 0; i < counts; i++)
+      argv[i] = unconst(&argz[i], char *);
+  else if (counts > 1)
+  {
+    size_t j = counts - 1;
+
+    for (i = argz_len - 2; i; i--)
+      if (argz[i] == EOS)
+        argv[j--] = unconst(&argz[i + 1], char *);
+    argv[0] = unconst(&argz[0], char *);
+  }
+  argv[counts] = NULL;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/extract.txh djgpp/src/libc/compat/argz/extract.txh
--- djgpp.orig/src/libc/compat/argz/extract.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/extract.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,56 @@
+@node argz_extract, string
+@findex argz_extract
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_extract(char *@var{argz}, size_t @var{argz_len}, char **@var{argv})
+@end example
+
+@subheading Description
+Converts the @code{NUL} byte separated argz vector @var{argz} of length @var{argz_len}
+into a Unix-style argument vector @var{argv} (a vector of pointers to normal
+C strings, terminated by @code{NULL}) by storing the pointers to every string in
+@var{argz} in @var{argv}.  The user must supply a @var{argv} large enough to contain
+all pointers and the terminating @code{NULL} pointer.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char **_argv;  /*  Unix-style argument vector.  */
+size_t entries;
+error_t error;
+
+entries = argz_count(argz, argz_len);  /*  Get number of strings  */
+                                       /*  contained in argz.  */
+_argv = malloc((entries + 1) * sizeof(char *)); /* One entry more for */
+                                                /* the terminating NULL. */
+error = argz_extract(argz, argz_len, _argv);
+
+if (error)
+@{
+  printf("error: Strings could not be extracted from argz.\n", str);
+  free(_argv);
+  exit(ENOMEM);
+@}
+else
+@{
+  size_t i;
+
+  for (i = 0; _argv[i]; i++)
+    printf("argv[%zi] = \"%s\"\n", i, _argv[i]);
+
+  free(_argv);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/insert.c djgpp/src/libc/compat/argz/insert.c
--- djgpp.orig/src/libc/compat/argz/insert.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/insert.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+
+
+error_t
+argz_insert(char **argz, size_t *argz_len, char *before, const char *entry)
+{
+  /*
+   *  Insert ENTRY into ARGZ of length ARGZ_LEN before BEFORE, which should be an
+   *  existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end.
+   *  Since ARGZ's first entry is the same as ARGZ, argz_insert(ARGZ, ARGZ_LEN,
+   *  ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ.  If BEFORE is not
+   *  in ARGZ, EINVAL is returned, else if memory can't be allocated for the new
+   *  ARGZ, ENOMEM is returned, else 0.
+   */
+
+  ptrdiff_t first_part_len;
+  size_t entry_len;
+
+
+  if (before == NULL)
+    return argz_add(argz, argz_len, entry);
+
+  if (before < *argz || before >= *argz + *argz_len)
+    return EINVAL;
+
+  for (; before != *argz && before[-1]; before--)
+    ;  /*  Make sure before is actually the beginning of an entry.  */
+
+  first_part_len = before - *argz;
+  entry_len = strlen(entry) + 1;
+  *argz = realloc(*argz, *argz_len + entry_len);
+  if (*argz == NULL)
+    return ENOMEM;
+
+  memmove(*argz + first_part_len + entry_len, *argz + first_part_len,  *argz_len - first_part_len);
+  memcpy(*argz + first_part_len, entry, entry_len);
+  *argz_len += entry_len;
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/insert.txh djgpp/src/libc/compat/argz/insert.txh
--- djgpp.orig/src/libc/compat/argz/insert.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/insert.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,55 @@
+@node argz_insert, string
+@findex argz_insert
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_insert(char **@var{argz}, size_t *@var{argz_len}, char *@var{before},
+                    const char *@var{entry})
+@end example
+
+@subheading Description
+
+Inserts the string @var{entry} into the argz vector @var{argz} of length @var{argz_len}
+before the string @var{before}, which should be an existing entry in @var{argz}; if @var{before}
+is @code{NULL}, @var{entry} is appended to the end.  Since @var{argz}'s first entry is the
+same as @var{argz}, @code{argz_insert(ARGZ, ARGZ_LEN, ARGZ, ENTRY)} will insert @var{entry}
+at the beginning of @var{argz}.  Because the function modifies the argz vector, both its
+length @var{argz_len} and @var{argz} itself must be passed as pointers.
+
+@subheading Return Value
+
+If @var{before} is not in @var{argz}, EINVAL is returned,
+else if memory can't be allocated for the new @var{argz},
+ENOMEM is returned, else 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *entry = "foobar";  /*  String to be inserted into argz.  */
+error_t error;
+
+error = argz_insert(&argz, &argz_len, before, entry);
+
+switch (error)
+@{
+case EINVAL:
+  printf("error: Entry \"%s\" is not in argz.\n", before);
+  exit(EINVAL);
+  break;
+case ENOMEM:
+  printf("error: Not enough memory to insert \"%s\" into argz.\n", entry);
+  exit(ENOMEM);
+  break;
+default:
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/makefile djgpp/src/libc/compat/argz/makefile
--- djgpp.orig/src/libc/compat/argz/makefile	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/makefile	2009-10-24 20:02:08 +0000
@@ -0,0 +1,17 @@
+# Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details
+TOP=../..
+
+SRC += add.c
+SRC += add_sep.c
+SRC += append.c
+SRC += count.c
+SRC += create.c
+SRC += creatsep.c
+SRC += delete.c
+SRC += extract.c
+SRC += insert.c
+SRC += next.c
+SRC += replace.c
+SRC += strngify.c
+
+include $(TOP)/../makefile.inc
diff -aprNU5 djgpp.orig/src/libc/compat/argz/next.c djgpp/src/libc/compat/argz/next.c
--- djgpp.orig/src/libc/compat/argz/next.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/next.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <string.h>
+#include <libc/unconst.h>
+
+
+char *
+argz_next(const char *argz, size_t argz_len, const char *entry)
+{
+  /*
+   *  Return the next entry in ARGZ of length ARGZ_LEN after ENTRY,
+   *  or NULL if there are no more.  If entry is NULL, then the first
+   *  entry is returned.
+   */
+
+  if (entry)
+  {
+    for (; *entry; entry++)
+      ;
+    entry++;
+    return (entry + 1 > argz + argz_len) ? NULL : unconst(entry, char *);
+  }
+
+  return (argz_len > 0) ? unconst(argz, char *) : NULL;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/next.txh djgpp/src/libc/compat/argz/next.txh
--- djgpp.orig/src/libc/compat/argz/next.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/next.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,42 @@
+@node argz_next, string
+@findex argz_next
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+char *argz_next(const char *@var{argz}, size_t @var{argz_len}, const char *@var{entry})
+@end example
+
+@subheading Description
+
+Returns the next entry in @var{argz} of length @var{argz_len} after the string @var{entry},
+or @code{NULL} if there are no more.  If entry is @code{NULL}, then the first entry is returned.
+
+@subheading Return Value
+
+A pointer to the entry or NULL.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *next_entry;
+
+next_entry = argz_next(argz, argz_len, entry);
+
+if (next_entry == NULL)
+@{
+  printf("error: No more entries in argz.\n");
+@}
+else
+@{
+  do_something_with(next_entry);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/replace.c djgpp/src/libc/compat/argz/replace.c
--- djgpp.orig/src/libc/compat/argz/replace.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/replace.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+
+
+error_t
+argz_replace(char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count)
+{
+  /*
+   *  Replace any occurrences of the string STR in the argz vector ARGZ with string WITH,
+   *  reallocating ARGZ as necessary.  If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be
+   *  incremented by number of replacements performed.
+   *  If a memory allocation error occurs, ENOMEM is returned,
+   *  otherwise 0.
+   */
+
+  error_t error = 0;
+
+
+  if (str && *str)
+  {
+    char *entry, *dst, *src;
+    size_t dst_len, src_len;
+    size_t str_len, with_len;
+
+    entry = NULL;
+    dst = NULL;
+    dst_len = 0;
+    src = *argz;
+    src_len = *argz_len;
+    str_len = strlen(str);
+    with_len = strlen(with);
+    while (!error && (entry = argz_next(src, src_len, entry)))
+      if (strstr(entry, str))
+      {
+        dst_len = src_len + with_len - str_len;
+        dst =  malloc(dst_len);
+        if (dst == NULL)
+          error = ENOMEM;
+        else
+        {
+          ptrdiff_t len;
+
+          len = entry - src;
+          memcpy(dst, src, len);
+          memcpy(dst + len, with, with_len);
+          memcpy(dst + len + with_len, entry + str_len, src_len - (len + str_len));
+
+          entry = dst + len + with_len + 1;
+          free(src);
+          src = dst;
+          src_len = dst_len;
+          if (replace_count)
+            (*replace_count)++;
+        }
+      }
+    *argz = src;
+    *argz_len = src_len;
+  }
+
+  return error;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/replace.txh djgpp/src/libc/compat/argz/replace.txh
--- djgpp.orig/src/libc/compat/argz/replace.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/replace.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,48 @@
+@node argz_replace, string
+@findex argz_replace
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+error_t argz_replace(char **@var{argz}, size_t *@var{argz_len}, const char *@var{str},
+                     const char *@var{with}, unsigned *@var{replace_count})
+@end example
+
+@subheading Description
+
+Replaces any occurrences of the string @var{str} in the argz vector @var{argz} with the string @var{with},
+reallocating @var{argz} as necessary.  If @var{replace_count} is non-zero, *@var{replace_count} will be
+incremented by the number of replacements performed.  Because the function modifies the argz vector,
+both its length @var{argz_len} and @var{argz} itself must be passed as pointers.
+
+@subheading Return Value
+
+If a memory allocation error occurs, ENOMEM is returned, otherwise 0.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *str = "foobar";  /*  String to be replaced in argz.  */
+char *with = "BARFOO"; /*  Replacement.  */
+error_t error;
+
+error = argz_replace(&argz, &argz_len, str, with, NULL);
+
+if (error)
+@{
+  printf("error: \"%s\" could not be replaced by \"%s\" in argz.\n", str, with);
+  exit(ENOMEM);
+@}
+else
+@{
+  do_something_with(argz, argz_len);
+  free(argz);  /*  Free the resources.  */
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/argz/strngify.c djgpp/src/libc/compat/argz/strngify.c
--- djgpp.orig/src/libc/compat/argz/strngify.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/strngify.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,24 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <argz.h>
+
+#define EOS  '\0'
+
+
+void
+argz_stringify(char *argz, size_t argz_len, int sep)
+{
+  /*
+   *  Make '\0' separated argz vector ARGZ printable by converting
+   *  all the '\0's except the last into the character SEP.
+   */
+
+  if (argz_len > 1)
+  {
+    size_t i, i_max;
+
+    i_max = argz_len - 1;
+    for (i = 0; i < i_max; i++)
+      if (argz[i] == EOS)
+        argz[i] = sep;
+  }
+}
diff -aprNU5 djgpp.orig/src/libc/compat/argz/strngify.txh djgpp/src/libc/compat/argz/strngify.txh
--- djgpp.orig/src/libc/compat/argz/strngify.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/argz/strngify.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,32 @@
+@node argz_stringify, string
+@findex argz_stringify
+@subheading Syntax
+
+@example
+#include <argz.h>
+
+void argz_stringify(char *@var{argz}, size_t @var{argz_len}, int @var{sep})
+@end example
+
+@subheading Description
+
+Makes a @code{NUL} byte separated argz vector @var{argz} printable by converting
+all the @code{NUL}s except the last into the character @var{sep}.
+
+@subheading Return Value
+
+Nothing.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+
+argz_stringify(argz, argz_len, '/');
+
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/string/makefile djgpp/src/libc/compat/string/makefile
--- djgpp.orig/src/libc/compat/string/makefile	2003-01-19 13:03:56 +0000
+++ djgpp/src/libc/compat/string/makefile	2009-10-24 20:02:08 +0000
@@ -1,15 +1,17 @@
+# Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details
 TOP=../..
 
 SRC += ffs.S
 SRC += memccpy.c
 SRC += memicmp.c
+SRC += memmem.c
 SRC += stpcpy.c
 SRC += stpncpy.c
 SRC += strcasec.S
 SRC += strdup.c
 SRC += stricmp.c
diff -aprNU5 djgpp.orig/src/libc/compat/string/memmem.c djgpp/src/libc/compat/string/memmem.c
--- djgpp.orig/src/libc/compat/string/memmem.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/memmem.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+#include <libc/unconst.h>
+
+
+void *
+memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
+{
+  if (haystack == NULL || needle == NULL)
+    return NULL;
+  else if (needle_len == 0)
+    /*  The first occurrence of the empty string is deemed to occur at the beginning of the string.  */
+    return unconst(haystack, void *);
+  else if (haystack_len < needle_len)
+    /*  Sanity check, otherwise the loop might search through the whole memory.  */
+    return NULL;
+  else
+  {
+    const unsigned char *begin;
+    const unsigned char *const last_possible = (const unsigned char *const) haystack + haystack_len - needle_len + 1;
+
+    for (begin = haystack; begin < last_possible; begin++)
+      if (!memcmp(begin, needle, needle_len))
+        return (void *)unconst(begin, unsigned char *);
+    return NULL;
+  }
+}
diff -aprNU5 djgpp.orig/src/libc/compat/string/memmem.txh djgpp/src/libc/compat/string/memmem.txh
--- djgpp.orig/src/libc/compat/string/memmem.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/memmem.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,26 @@
+@node memmem, memory
+@findex memmem
+@subheading Syntax
+
+@example
+#include <string.h>
+
+char *memmem(const void *haystack, size_t haystack_len,
+             const void *needle, size_t needle_len);
+@end example
+
+@subheading Description
+
+This function finds the start of the first occurrence of the substring @var{needle} of
+length @var{needle_len} in the memory area @var{haystack} of length @var{haystack_len}.
+
+@subheading Return Value
+
+A pointer to the beginning of the substring @var{needle}, or @code{NULL} if @var{needle} wasn't found.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
diff -aprNU5 djgpp.orig/src/libc/compat/string/strndup.c djgpp/src/libc/compat/string/strndup.c
--- djgpp.orig/src/libc/compat/string/strndup.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/strndup.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,26 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+#include <stdlib.h>
+
+char *
+strndup(const char *str, size_t n)
+{
+  char *copy;
+  size_t str_len;
+
+
+  if (str == NULL)
+    return NULL;
+
+  str_len = strlen(str);
+  if (str_len > n)
+    str_len = n;
+
+  copy = malloc(str_len + 1);
+  if (copy == NULL)
+    return NULL;
+  memcpy(copy, str, str_len);
+  copy[str_len] = '\0';
+
+  return copy;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/string/strndup.txh djgpp/src/libc/compat/string/strndup.txh
--- djgpp.orig/src/libc/compat/string/strndup.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/strndup.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,36 @@
+@node strndup, string
+@findex strndup
+@subheading Syntax
+
+@example
+#include <string.h>
+
+char *strndup(const char *@var{source}, size_t @var{n});
+@end example
+
+@subheading Description
+
+Returns a newly allocated area of memory that contains a duplicate with at most
+@var{n} characters of the string pointed to by @var{source}.  The result is
+always NUL terminated.  The memory returned by this call must be freed by the
+caller.
+
+@subheading Return Value
+
+Returns the newly allocated string, or @code{NULL} if there
+is no more memory.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+char *foo()
+@{
+  return strndup("hello world", 5);
+@}
+@end example
diff -aprNU5 djgpp.orig/src/libc/compat/string/strnlen.c djgpp/src/libc/compat/string/strnlen.c
--- djgpp.orig/src/libc/compat/string/strnlen.c	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/strnlen.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,14 @@
+/* Copyright (C) 2008 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+
+size_t
+strnlen(const char *str, size_t n)
+{
+  const char *start;
+
+
+  for (start = str; n && *str; n--, str++)
+    ;
+
+  return  str - start;
+}
diff -aprNU5 djgpp.orig/src/libc/compat/string/strnlen.txh djgpp/src/libc/compat/string/strnlen.txh
--- djgpp.orig/src/libc/compat/string/strnlen.txh	1970-01-01 00:00:00 +0000
+++ djgpp/src/libc/compat/string/strnlen.txh	2009-10-24 20:02:08 +0000
@@ -0,0 +1,34 @@
+@node strnlen, string
+@findex strnlen
+@subheading Syntax
+
+@example
+#include <string.h>
+
+char *strnlen(const char *@var{string}, size_t @var{n});
+@end example
+
+@subheading Description
+
+This function returns the number of characters in @var{string} until it
+reaches a @code{NUL} character or the maximum: @var{n} number of characters
+have been inspected.
+
+@subheading Return Value
+
+The length of the string or @var{n}.
+
+@subheading Portability
+
+@port-note ansi This function is a GNU extension.
+
+@portability !ansi, !posix
+
+@subheading Example
+
+@example
+size_t foo()
+@{
+  return strnlen("hello world", 5);
+@}
+@end example
diff -aprNU5 djgpp.orig/tests/libc/ansi/stdio/tscanf.c djgpp/tests/libc/ansi/stdio/tscanf.c
--- djgpp.orig/tests/libc/ansi/stdio/tscanf.c	2002-06-08 13:54:12 +0000
+++ djgpp/tests/libc/ansi/stdio/tscanf.c	2009-10-24 20:02:08 +0000
@@ -117,10 +117,11 @@ int convert_and_print (const char *fmt, 
 	    else
 	      printf ("Result: long %ld (0x%lx)\n", lnum[0], lnum[0]);
 
 	    return converted;
 	  }
+      case 'a': case 'A':
       case 'e': case 'E':
       case 'f':
       case 'g': case 'G':
 	if (cnv_qual == 'L')
 	  {
@@ -133,11 +134,16 @@ int convert_and_print (const char *fmt, 
 		printf ("ERROR: more than a single long double converted!\n");
 		printf ("Result: %.21Lg\n", ldnum[0]);
 		converted = 0;
 	      }
 	    else
-	      printf ("Result: long double %.21Lg\n", ldnum[0]);
+            {
+              if (cnv_spec == 'a' || cnv_spec == 'A')
+	        printf ("Result: long double hex %.15La  long double dec %.21Lg\n", ldnum[0], ldnum[0]);
+              else
+	        printf ("Result: long double %.21Lg\n", ldnum[0]);
+            }
 
 	    return converted;
 	  }
 	else if (cnv_qual == 'l')
 	  {
@@ -150,11 +156,16 @@ int convert_and_print (const char *fmt, 
 		printf ("ERROR: more than a single double converted!\n");
 		printf ("Result: %.17g\n", dnum[0]);
 		converted = 0;
 	      }
 	    else
-	      printf ("Result: double %.17g\n", dnum[0]);
+            {
+              if (cnv_spec == 'a' || cnv_spec == 'A')
+	        printf ("Result: double hex %.13a  double dec %.17g\n", dnum[0], dnum[0]);
+              else
+	        printf ("Result: long double %.17g\n", dnum[0]);
+            }
 
 	    return converted;
 	  }
 	else
 	  {
@@ -168,10 +179,16 @@ int convert_and_print (const char *fmt, 
 		printf ("Result: %.7g\n", fnum[0]);
 		converted = 0;
 	      }
 	    else
 	      printf ("Result: float %.7g\n", fnum[0]);
+            {
+              if (cnv_spec == 'a' || cnv_spec == 'A')
+	        printf ("Result: float hex %.6a  float dec %.7g\n", fnum[0], fnum[0]);
+              else
+	        printf ("Result: float %.7g\n", fnum[0]);
+            }
 
 	    return converted;
 	  }
       default:
 	printf ("I don't know what to do with format `%s'...\n", fmt);
diff -aprNU5 djgpp.orig/tests/libc/compat/argz/argztest.c djgpp/tests/libc/compat/argz/argztest.c
--- djgpp.orig/tests/libc/compat/argz/argztest.c	1970-01-01 00:00:00 +0000
+++ djgpp/tests/libc/compat/argz/argztest.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,687 @@
+#include <argz.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define BUFFER1 "TEXT TO BE APPENDED"
+#define BUFFER2 "NEW:TEST:STRING"
+#define BUFFER3 "TAIL"
+#define BUFFER4 "CENTRAL"
+#define BUFFER5 "HEAD"
+#define BUFFER  ""
+
+void print_result(char *argz, size_t argz_len)
+{
+  size_t index, len;
+
+
+  printf("argz_len: %zd\n", argz_len);
+  if (argz_len)
+    for (index = 0; index < argz_len;)
+    {
+      printf("argz[%zd] = <", index);
+      len = index;
+      index += printf("%s", argz + index);
+      printf("\\0>\t\tlength = %zd\n", ++index - len);
+    }
+  else
+    printf("argz[0] = %s", argz);
+}
+
+
+int main(void)
+{
+  char *const glibc_compatibility_test_argv[] = {
+    NULL
+  };
+  char *glibc_compatibility_test_string = "";
+  char *const test_argv[] = {
+    "Test",
+    "string",
+    "for",
+    "argz_create",
+    NULL
+  };
+  const char *test_string1 = "Test#string#1# #for#argz_create_sep#";
+  const char *test_string2 = "Test#string#2# #for#argz_create_sep";
+  const char *test_string3 = "TO BE REPLACED#string 1#TO BE REPLACED#string 2#string 3#TO BE REPLACED#string 4#string 5#TO BE REPLACED";
+  int delimiter = '#';
+  char *argz, **argvp = NULL, *before, *entry;
+  size_t argz_len, counts, entry_index, i;
+  error_t error;
+
+
+  /*
+   *  argz_create test.
+   */
+  printf("Test: argz_create.\n"
+         "==================\n"
+         "An argz vector shall be created using the following UNIX-style argv array:\n");
+  for (i = 0; test_argv[i]; i++)
+    printf("test_argv[%zi]: \"%s\"\n", i, test_argv[i]);
+  printf("test_argv[%zi]: \"%s\"\n", i, test_argv[i]);
+  printf("\n");
+
+  error = argz_create(test_argv, &argz, &argz_len);
+  if (error)
+  {
+    printf("argz_create test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("argz_create test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_count test.
+   */
+  printf("Test: argz_count.\n"
+         "=================\n"
+         "Count the strings contained in an argz vector.\n");
+  for (counts = 0; test_argv[counts]; counts++)
+    ;
+  if (counts != argz_count(argz, argz_len))
+  {
+    printf("argz_count test failed.\n");
+    exit(1);
+  }
+  else
+  {
+    printf("\nargz_count test passed.\n");
+    printf("counts: %zd\n", counts);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_create_sep test.
+   */
+  printf("Test 1: argz_create_sep.\n"
+         "========================\n"
+         "An argz vector shall be created using the following test string:\n"
+         "\"%s\"\n"
+         "The delimiter character \'%c\' will be used as string separator\n"
+         "in the test string and will be replaced with \'\\0\' in the argz vector.\n", test_string1, delimiter);
+  free(argz);
+  error = argz_create_sep(test_string1, delimiter, &argz, &argz_len);
+  if (error)
+  {
+    printf("\nargz_create_sep test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_create_sep test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n");
+
+  printf("Test 2: argz_create_sep.\n"
+         "========================\n"
+         "An argz vector shall be created using the following test string:\n"
+         "\"%s\"\n"
+         "The delimiter character \'%c\' will be used as string separator\n"
+         "in the test string and will be replaced with \'\\0\' in the argz vector.\n", test_string2, delimiter);
+  free(argz);
+  error = argz_create_sep(test_string2, delimiter, &argz, &argz_len);
+  if (error)
+  {
+    printf("argz_create_sep failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_create_sep test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_add test.
+   */
+  printf("Test: argz_add.\n"
+         "===============\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be added to the end of an argz vector.\n", BUFFER1);
+  entry_index = argz_len;  /*  Remember the position of the entry that later will be deleted.  */
+  error = argz_add(&argz, &argz_len, BUFFER1);
+  if (error)
+  {
+    printf("\nargz_add test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_add test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_add_sep test.
+   */
+  delimiter = ':';
+  printf("Test: argz_add_sep.\n"
+         "===================\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be added to the end of an argz vector.\n"
+         "The delimiter character \'%c\' will be used as string separator\n"
+         "in the test string and will be replaced with \'\\0\' in the argz vector.\n", BUFFER2, delimiter);
+  error = argz_add_sep(&argz, &argz_len, BUFFER2, delimiter);
+  if (error)
+  {
+    printf("\nargz_add_sep test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_add_sep test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_delete test.
+   */
+  printf("Test: argz_delete.\n"
+         "==================\n"
+         "The entry:\n"
+         "\"%s\"\n"
+         "will be deleted from argz vector.\n", BUFFER1);
+  argz_delete(&argz, &argz_len, argz + entry_index);
+  printf("\nargz_delete test passed.\n");
+  print_result(argz, argz_len);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_append test.
+   */
+  printf("Test: argz_append.\n"
+         "==================\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be appended to the end of an argz vector.\n", BUFFER1);
+  error = argz_append(&argz, &argz_len, BUFFER1, sizeof(BUFFER1));
+  if (error)
+  {
+    printf("\nargz_append test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_append test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_extract test.
+   */
+  printf("Test: argz_extract.\n"
+         "===================\n"
+         "Store pointers to each string contained in the argz vector in an UNIX-style argv array,\n"
+         "which must be large enough to contain them inclusive the terminating NULL pointer.\n");
+  counts = argz_count(argz, argz_len) + 1;
+  argvp = malloc(counts * sizeof(*argvp));
+  printf("\nargz_extract test passed.\n");
+  argz_extract(argz, argz_len, argvp);
+  printf("argz_len: %zd\n", argz_len);
+  for (i = 0; i < counts; i++)
+    printf("argvp[%zi]: \"%s\"\n", i, argvp[i]);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_next test.
+   */
+  printf("Test: argz_next.\n"
+         "================\n"
+         "Get a pointer to the next entry in the argz vector after the entry passed to the function.\n");
+  printf("\nargz_extract test passed.\n");
+  entry = NULL;
+  do {
+    printf("entry passed (0x%p):  \"%s\"\t\t", entry, entry);
+    entry = argz_next(argz, argz_len, entry);
+    printf("entry returned (0x%p):  \"%s\"\n", entry, entry);
+  } while (entry);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_insert test.
+   */
+  printf("Test: argz_insert.\n"
+         "==================\n"
+         "Insert entry in the argz vector before the string pointed by the pointer passed to the function.\n");
+  before = NULL;
+  error = argz_insert(&argz, &argz_len, before, BUFFER3);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nFirst argz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  thus  entry \"%s\" will be appended at the end of argz.\n", before, before, BUFFER3);
+    print_result(argz, argz_len);
+  }
+  before = argz + entry_index;
+  entry = strdup(before);
+  error = argz_insert(&argz, &argz_len, before, BUFFER4);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nSecond argz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  >  argz (0x%p): \"%s\"  thus  entry \"%s\" will be inserted before \"%s\".\n", entry, entry, argz, argz, BUFFER4, entry);
+    print_result(argz, argz_len);
+  }
+  free(entry);
+  before = argz;
+  error = argz_insert(&argz, &argz_len, before, BUFFER5);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nThird argz_insert test passed.\n");
+    printf("before (0x%p) == argz (0x%p)  thus  entry \"%s\" will be inserted before the beginnig of argz.\n", before, argz, BUFFER5);
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_stringify test.
+   */
+  delimiter = '/';
+  printf("Test: argz_stringify.\n"
+         "=====================\n"
+         "Make a '\\0' separated argz vector printable by converting all the '\\0's\n"
+         "except the last into the character '%c'.\n", delimiter);
+  argz_stringify(argz, argz_len, delimiter);
+  printf("\nargz_stringify test passed.\n");
+  print_result(argz, argz_len);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_replace test.
+   */
+  free(argz);
+  error = argz_create_sep(test_string3, '#', &argz, &argz_len);
+  if (error)
+  {
+    printf("argz_create_sep failed: ENOMEM\n");
+    exit(error);
+  }
+  entry = malloc(argz_len);
+  memcpy(entry, argz, argz_len);
+  argz_stringify(argz, argz_len, '/');
+  printf("Test: argz_replace.\n"
+         "===================\n"
+         "Replace any occurrences of string:\n"
+         "\"%s\"\n"
+         "in the argz vector:\n"
+         "\"%s\"\n"
+         "with:\n"
+         "\"%s\",\n"
+         "reallocating the argz vector as necessary.\n", "TO BE REPLACED", argz, "REPLACEMENT STRING");
+  free(argz);
+  argz = entry;
+  error = argz_replace(&argz, &argz_len, "TO BE REPLACED", "REPLACEMENT STRING", NULL);
+  if (error)
+  {
+    printf("\nargz_replace test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_replace test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+
+
+  /*
+   *
+   *  The same test but with (NULL, 0) to check if no SIGSEGV happens.
+   *
+   */
+  free(argz);
+  printf("#\n#\n#\n#  The same tests but with an argz vector of the form (NULL, 0).\n#\n#\n#\n\n\n");
+
+  /*
+   *  argz_create test.
+   */
+  printf("Test: argz_create.\n"
+         "==================\n"
+         "An argz vector shall be created using the following argv array:\n");
+  for (i = 0; glibc_compatibility_test_argv[i]; i++)
+    printf("test_argv[%zi]: \"%s\"\n", i, glibc_compatibility_test_argv[i]);
+  printf("test_argv[%zi]: \"%s\"\n", i, glibc_compatibility_test_argv[i]);
+  printf("\n");
+
+  error = argz_create(glibc_compatibility_test_argv, &argz, &argz_len);
+  if (error)
+  {
+    printf("argz_create test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("argz_create test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_create_sep test.
+   */
+  printf("Test: argz_create_sep.\n"
+         "======================\n"
+         "An argz vector shall be created using the following test string:\n"
+         "\"%s\"\n"
+         "The delimiter character \'%c\' will be used as string separator\n"
+         "in the test string and will be replaced with \'\\0\' in the argz vector.\n", glibc_compatibility_test_string, delimiter);
+  error = argz_create_sep(glibc_compatibility_test_string, delimiter, &argz, &argz_len);
+  if (error)
+  {
+    printf("\nargz_create_sep test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_create_sep test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_count test.
+   */
+  printf("Test: argz_count.\n"
+         "=================\n"
+         "Count the strings contained in an argz vector.\n");
+  for (counts = 0; glibc_compatibility_test_argv[counts]; counts++)
+    ;
+  if (counts != argz_count(argz, argz_len))
+  {
+    printf("argz_count test failed.\n");
+    exit(1);
+  }
+  else
+  {
+    printf("\nargz_count test passed.\n");
+    printf("counts: %zd\n", counts);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_add test.
+   */
+  printf("Test: argz_add.\n"
+         "===============\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be added to the end of an argz vector.\n", BUFFER);
+  entry_index = argz_len;  /*  Remember the position of the entry that later will be deleted.  */
+  error = argz_add(&argz, &argz_len, BUFFER);
+  if (error)
+  {
+    printf("\nargz_add test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_add test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_add_sep test.
+   */
+  delimiter = ':';
+  printf("Test: argz_add_sep.\n"
+         "======================\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be added to the end of an argz vector.\n"
+         "The delimiter character \'%c\' will be used as string separator\n"
+         "in the test string and will be replaced with \'\\0\' in the argz vector.\n", BUFFER, delimiter);
+  error = argz_add_sep(&argz, &argz_len, BUFFER, delimiter);
+  if (error)
+  {
+    printf("\nargz_add_sep test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_add_sep test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_delete test.
+   */
+  printf("Test: argz_delete.\n"
+         "==================\n"
+         "The entry:\n"
+         "\"%s\"\n"
+         "will be deleted from argz vector.\n", BUFFER);
+  argz_delete(&argz, &argz_len, argz + entry_index);
+  printf("\nargz_delete test passed.\n");
+  printf("argz_len: %zd\n", argz_len);
+  printf("argz:     %s\n", argz);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_append test.
+   */
+  printf("Test: argz_append.\n"
+         "==================\n"
+         "The test string:\n"
+         "\"%s\"\n"
+         "shall be appended to the end of an argz vector.\n", BUFFER);
+  error = argz_append(&argz, &argz_len, BUFFER, sizeof(BUFFER));
+  if (error)
+  {
+    printf("\nargz_append test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_append test passed.\n");
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_extract test.
+   */
+  printf("Test: argz_extract.\n"
+         "===================\n"
+         "Store pointers to each string contained in the argz vector in an argv array,\n"
+         "which must be large enough to contain them inclusive the terminating NULL pointer.\n");
+  error = argz_add(&argz, &argz_len, BUFFER);
+  error = argz_add(&argz, &argz_len, BUFFER);
+  error = argz_add(&argz, &argz_len, BUFFER);
+  error = argz_add(&argz, &argz_len, BUFFER);
+  counts = argz_count(argz, argz_len) + 1;
+  argvp = malloc(counts * sizeof(*argvp));
+  printf("\nargz_extract test passed.\n");
+  argz_extract(argz, 0, argvp);
+  printf("argz_len=0\n");
+  printf("argvp[0]: \"%s\"\n", argvp[0]);
+  printf("\n");
+  argz_extract(argz, 1, argvp);
+  printf("argz_len=1\n");
+  for (i = 0; i < 2; i++)
+    printf("argvp[%zi]: \"%s\"\n", i, argvp[i]);
+  printf("\n");
+  argz_extract(argz, argz_len, argvp);
+  printf("argz_len: %zd\n", argz_len);
+  for (i = 0; i < counts; i++)
+    printf("argvp[%zi]: \"%s\"\n", i, argvp[i]);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_next test.
+   */
+  printf("Test: argz_next.\n"
+         "================\n"
+         "Get a pointer to the next entry in the argz vector after the entry passed to the function.\n");
+  printf("\nargz_extract test passed.\n");
+  entry = NULL;
+  do {
+    printf("entry passed (0x%p):  \"%s\"\t\t", entry, entry);
+    entry = argz_next(argz, argz_len, entry);
+    printf("entry returned (0x%p):  \"%s\"\n", entry, entry);
+  } while (entry);
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_insert test.
+   */
+  printf("Test 1: argz_insert.\n"
+         "====================\n"
+         "Insert entry in the argz vector before the string pointed by the pointer passed to the function.\n");
+  before = NULL;
+  error = argz_insert(&argz, &argz_len, before, BUFFER);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  thus  entry \"%s\" will be appended at the end of argz.\n", before, before, BUFFER);
+    print_result(argz, argz_len);
+  }
+  before = argz + argz_len / 2;
+  entry = strdup(before);
+  error = argz_insert(&argz, &argz_len, before, BUFFER);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  >  argz (0x%p): \"%s\"  thus  entry \"%s\" will be inserted before \"%s\".\n", entry, entry, argz, argz, BUFFER, entry);
+    print_result(argz, argz_len);
+  }
+  free(entry);
+  before = argz;
+  error = argz_insert(&argz, &argz_len, before, BUFFER);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p) == argz (0x%p)  thus  entry \"%s\" will be inserted before the beginnig of argz.\n", before, argz, BUFFER);
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_insert test.
+   */
+  printf("Test 2: argz_insert.\n"
+         "==================\n"
+         "Insert entry in the argz vector before the string pointed by the pointer passed to the function.\n");
+  before = NULL;
+  error = argz_insert(&argz, &argz_len, before, BUFFER3);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  thus  entry: \"%s\" will be appended to the end of argz.\n", before, before, BUFFER3);
+    print_result(argz, argz_len);
+  }
+  before = argz + argz_len / 2;
+  entry = strdup(before);
+  error = argz_insert(&argz, &argz_len, before, BUFFER4);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p): \"%s\"  >  argz (0x%p): \"%s\"  thus  entry: \"%s\" will be inserted before \"%s\".\n", entry, entry, argz, argz, BUFFER4, entry);
+    print_result(argz, argz_len);
+  }
+  free(entry);
+  before = argz;
+  error = argz_insert(&argz, &argz_len, before, BUFFER5);
+  if (error)
+  {
+    printf("\nargz_insert test failed: ENOMEM\n");
+    exit(error);
+  }
+  else
+  {
+    printf("\nargz_insert test passed.\n");
+    printf("before (0x%p) == argz (0x%p)  thus  entry (0x%p): \"%s\" will be inserted before the beginnig of argz.\n", before, argz, BUFFER5, BUFFER5);
+    print_result(argz, argz_len);
+  }
+  printf("\n################################################################################\n\n\n");
+
+
+  /*
+   *  argz_stringify test.
+   */
+  delimiter = '/';
+  printf("Test: argz_stringify.\n"
+         "=====================\n"
+         "Make a '\\0' separated argz vector printable by converting all the '\\0's\n"
+         "except the last into the character '%c'.\n", delimiter);
+  argz_stringify(argz, argz_len, delimiter);
+  printf("\nargz_stringify test passed.\n");
+  print_result(argz, argz_len);
+  printf("\n################################################################################\n\n\n");
+
+  return 0;
+}
diff -aprNU5 djgpp.orig/tests/libc/compat/string/makefile djgpp/tests/libc/compat/string/makefile
--- djgpp.orig/tests/libc/compat/string/makefile	2003-01-19 13:05:54 +0000
+++ djgpp/tests/libc/compat/string/makefile	2009-10-24 20:02:08 +0000
@@ -1,8 +1,9 @@
 TOP=../..
 
 SRC += ffs.c
+SRC += memmem.c
 SRC += stpcpy.c
 SRC += stpncpy.c
 SRC += t-stlcat.c
 SRC += t-stlcpy.c
 
diff -aprNU5 djgpp.orig/tests/libc/compat/string/memmem.c djgpp/tests/libc/compat/string/memmem.c
--- djgpp.orig/tests/libc/compat/string/memmem.c	1970-01-01 00:00:00 +0000
+++ djgpp/tests/libc/compat/string/memmem.c	2009-10-24 20:02:08 +0000
@@ -0,0 +1,55 @@
+#include <stdio.h>
+#include <string.h>
+
+#define LENGTH_OF(s)      (sizeof(s) - 1)  /*  Without the terminating zero.  */
+
+#define HAYSTACK_STRING   "\0001234567890\xB0"
+#define HAYSTACK_LENGTH   LENGTH_OF(HAYSTACK_STRING)
+
+int main(void)
+{
+  typedef const struct {
+    const char   *str;
+    const size_t  len;
+  } substring_t;
+  substring_t needle[] = {
+    {"456",       LENGTH_OF("456")},
+    {"\00012",    LENGTH_OF("\00012")},
+    {"90\xB0",    LENGTH_OF("90\xB0")},
+    {"ABC",       LENGTH_OF("ABC")},
+    {"0\xB0\000", LENGTH_OF("0\xB0\000")},
+    {"\xB0",      LENGTH_OF("\xB0")},
+    {NULL,  0}
+  };
+  char *begin;
+  const char haystack[HAYSTACK_LENGTH + 1] = HAYSTACK_STRING;
+  int i;
+
+
+  printf("Testing memmem()...\n\n");
+
+  for (i = 0; needle[i].str; i++)
+  {
+    int j;
+
+    printf("Searching for \"");
+    for (j = 0; j < needle[i].len; j++)
+      if (needle[i].str[j] != '\0')
+        printf("%c", needle[i].str[j]);
+      else
+        printf("\\0");
+    printf("\" in \"");
+    for (j = 0; j < HAYSTACK_LENGTH; j++)
+      if (haystack[j] != '\0')
+        printf("%c", haystack[j]);
+      else
+        printf("\\0");
+    printf("\":  ");
+    if ((begin = memmem(haystack, HAYSTACK_LENGTH, needle[i].str, needle[i].len)))
+      printf("found at position %u.\n", begin - haystack);
+    else
+      printf("not found.\n");
+  }
+
+  return 0;
+}
