[klibc] [git patch] fstype + klibc enhancements

H. Peter Anvin hpa at zytor.com
Mon Aug 13 09:41:22 PDT 2007


maximilian attems wrote:

> diff --git a/usr/include/string.h b/usr/include/string.h
> index 1a6072c..7fd8b49 100644
> --- a/usr/include/string.h
> +++ b/usr/include/string.h
> @@ -43,5 +43,6 @@ __extern char *strsep(char **, const char *);
>  __extern size_t strspn(const char *, const char *);
>  __extern char *strstr(const char *, const char *);
>  __extern char *strtok(char *, const char *);
> +__extern void bzero(void *, size_t);
>  
>  #endif				/* _STRING_H */
> diff --git a/usr/include/strings.h b/usr/include/strings.h
> new file mode 100644
> index 0000000..d4ab74a
> --- /dev/null
> +++ b/usr/include/strings.h
> @@ -0,0 +1,10 @@
> +#ifndef _STRINGS_H
> +#define _STRINGS_H
> +
> +#if !defined _STRING_H
> +
> +/* XXX: add actual content */
> +
> +#endif
> +
> +#endif /* _STRINGS_H */

NAK on these changes, at least without serious motivation.

I really don't want to support ancient BSD crap, especially not since
sooner or later it leads to supporting the absolutely horribly-named
index().

> diff --git a/usr/klibc/vdprintf.c b/usr/klibc/vdprintf.c
> new file mode 100644
> index 0000000..8a9f252
> --- /dev/null
> +++ b/usr/klibc/vdprintf.c
> @@ -0,0 +1,22 @@
> +#include <stdio.h>
> +#include <string.h>
> +#include <stdarg.h>
> +#include <unistd.h>
> +
> +#define BUFFER_SIZE	32768
> +
> +int vdprintf(int fd, const char *format, va_list ap)
> +{
> +	int rv;
> +	char buffer[BUFFER_SIZE];
> +
> +	rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
> +
> +	if (rv < 0)
> +		return rv;
> +
> +	if (rv > BUFFER_SIZE - 1)
> +		rv = BUFFER_SIZE - 1;
> +
> +	return write(fd, buffer, rv);
> +}
> 

What does vdprintf() etc add which aren't better done with fdopen()?

	-hpa



More information about the klibc mailing list