[klibc] [git patch] fstype + klibc enhancements
maximilian attems
max at stro.at
Tue Aug 14 01:50:09 PDT 2007
On Mon, 13 Aug 2007, H. Peter Anvin wrote:
> 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().
grep -Er 'strings.h' toybox/ busybox-1.6.1/ mdadm-2.6.2/
toybox/toys.h:#include <strings.h>
busybox-1.6.1/include/libbb.h:#include <strings.h>
busybox-1.6.1/e2fsprogs/old_e2fsprogs/ext2fs/bitops.h:#include <strings.h>
mdadm-2.6.2/mdadm.h:#include <strings.h>
of course all of these include string.h too,
so i'll change aboves comment to:
/* no content everybody uses string.h anyway */
> > 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
hmm yeah they are gnu extensions, busybox seems to like dprintf().
i encountered it first in toybox.
do you want an _GNU_SOURCE .config variable for it?
--
maks
More information about the klibc
mailing list