-/* GNU gettext - internationalization aids
- Copyright (C) 1995, 2000, 2002 Free Software Foundation, Inc.
+/* Fuzzy string comparison.
+ Copyright (C) 1995, 2000, 2002-2003 Free Software Foundation, Inc.
This file was written by Peter Miller <pmiller@agso.gov.au>
#ifndef _FSTRCMP_H
#define _FSTRCMP_H
-extern double fstrcmp (const char *__s1, const char *__s2);
+/* Fuzzy compare of S1 and S2. Return a measure for the similarity of S1
+ and S1. The higher the result, the more similar the strings are. */
+extern double fstrcmp (const char *s1, const char *s2);
#endif
/* MIN, MAX macros.
- Copyright (C) 1995, 1998, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1998, 2001, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
since otherwise we get redefinitions on some systems. */
#include <limits.h>
+/* MAX(a,b) returns the maximum of A and B. */
#ifndef MAX
# if __STDC__ && defined __GNUC__ && __GNUC__ >= 2
# define MAX(a,b) (__extension__ \
# endif
#endif
+/* MIN(a,b) returns the minimum of A and B. */
#ifndef MIN
# if __STDC__ && defined __GNUC__ && __GNUC__ >= 2
# define MIN(a,b) (__extension__ \
/* String copying.
- Copyright (C) 1995, 2001-2002 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#else
-extern char *stpcpy (char *__dst, const char *__src);
+/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
+extern char *stpcpy (char *dst, const char *src);
#endif
/* String copying.
- Copyright (C) 1995, 2001-2002 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef __GNU_LIBRARY__
+/* Copy no more than N characters of SRC to DST, returning the address of
+ the last character written into DST. */
/* When not using the GNU libc we use the stpncpy implementation we
provide here. */
-extern char *gnu_stpncpy (char *__dst, const char *__src, size_t __n);
+extern char *gnu_stpncpy (char *dst, const char *src, size_t n);
#define stpncpy(Dst, Src, N) gnu_stpncpy (Dst, Src, N)
#endif
/* Case-insensitive string comparison functions.
- Copyright (C) 1995-1996, 2001-2002 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <stddef.h>
-extern int strcasecmp (const char *__s1, const char *__s2);
-extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
+ greater than zero if S1 is lexicographically less than, equal to or greater
+ than S2.
+ Note: This function does not work correctly in multibyte locales. */
+extern int strcasecmp (const char *s1, const char *s2);
+
+/* Compare no more than N characters of strings S1 and S2, ignoring case,
+ returning less than, equal to or greater than zero if S1 is
+ lexicographically less than, equal to or greater than S2.
+ Note: This function can not work correctly in multibyte locales. */
+extern int strncasecmp (const char *s1, const char *s2, size_t n);
#endif /* _STRCASE_H */
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
extern "C" {
#endif
+/* Write formatted output to a string dynamically allocated with malloc().
+ If the memory allocation succeeds, store the address of the string in
+ *RESULT and return the number of resulting bytes, excluding the trailing
+ NUL. Upon memory allocation error, or some other error, return -1. */
extern int asprintf (char **result, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int vasprintf (char **result, const char *format, va_list args)
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
extern "C" {
#endif
+/* Write formatted output to a string dynamically allocated with malloc().
+ You can pass a preallocated buffer for the result in RESULTBUF and its
+ size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
+ If successful, return the address of the string (this may be = RESULTBUF
+ if no dynamic memory allocation was necessary) and set *LENGTHP to the
+ number of resulting bytes, excluding the trailing NUL. Upon error, set
+ errno and return NULL. */
extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)