source file of the flowerlib
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
-#include <stdarg.h>
+
+#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "libc-extension.hh"
-
+/*
+ urg: why soo wierd?
+ */
char*
strnlwr (char* start_l ,int n)
{
return start_l;
}
+
#if !HAVE_MEMMEM
/** locate a substring. #memmem# finds the first occurrence of
Manual v1.15, but it is with /usr/include/string.h */
Byte *
-memmem (Byte const *needle,int needle_len,
- Byte const *haystack, int haystack_len)
+memmem (Byte const *haystack, int haystack_len,
+ Byte const *needle,int needle_len)
{
Byte const * end_haystack = haystack + haystack_len - needle_len + 1;
Byte const * end_needle = needle + needle_len ;
Byte const *subneedle_l = needle;
Byte const *subhaystack_l = haystack;
while (subneedle_l < end_needle)
- {
- if (*subneedle_l++ != *subhaystack_l++)
- {
- haystack ++;
- continue;
- }
- }
+ if (*subneedle_l++ != *subhaystack_l++)
+ goto next;
// completed the needle. Gotcha.
return (Byte *) haystack;
+ next:
+ haystack++;
}
return 0;
}
}
#if ! HAVE_SNPRINTF
-int snprintf (char *str, size_t,
- char const *format, ...)
+int
+snprintf (char *str, size_t, char const *format, ...)
{
va_list ap;
va_start (ap, format);
return i;
}
#endif
+
+#if ! HAVE_VSNPRINTF
+int
+vsnprintf (char *str, size_t, char const *format, va_list args)
+{
+ int i = vsprintf (str, format, args);
+ return i;
+}
+#endif
+