severity 359342 wishlist thanks On Tue, 28 Mar 2006, Michal Schmidt wrote:
> Package: klibc > Severity: minor > > The attached patch adds the "basename" function to klibc. A "basename" > utility is also implemented. please send your patch upstream to the klibc mailinglist: http://www.zytor.com/mailman/listinfo/klibc Debian klibc should ideally include no patches. current policy is to accept build and arch fixes. below is just a quick glance over your patch. regards -- maks <snipp reportbug> > diff -Nurp klibc-1.2.4/include/libgen.h klibc-1.2.4.mich/include/libgen.h > --- klibc-1.2.4/include/libgen.h 1970-01-01 01:00:00.000000000 +0100 > +++ klibc-1.2.4.mich/include/libgen.h 2006-03-28 00:06:15.000000000 +0200 > @@ -0,0 +1,13 @@ > +/* > + * libgen.h > + */ > + > +#ifndef _LIBGEN_H > +#define _LIBGEN_H > + > +#include <klibc/extern.h> > + > +__extern char *dirname(char *); > + > +#endif /* _LIBGEN_H */ > + > diff -Nurp klibc-1.2.4/klibc/basename.c klibc-1.2.4.mich/klibc/basename.c > --- klibc-1.2.4/klibc/basename.c 1970-01-01 01:00:00.000000000 +0100 > +++ klibc-1.2.4.mich/klibc/basename.c 2006-03-28 00:02:50.000000000 +0200 > @@ -0,0 +1,28 @@ > +/* > + * basename.c > + */ > + > +char *basename(char *p) > +{ > + char *last_component; > + int was_slash; > + useless trailing spaces > + last_component = p; > + was_slash = (*p++ == '/'); > + ditto > + while (*p) { > + if (*p == '/') { > + *p = '\0'; > + was_slash = 1; > + } else { > + if (was_slash) { > + last_component = p; > + was_slash = 0; > + } > + } > + p++; > + } for (basename = p; *p; p++) might be more readble > + > + return last_component; > +} > + > diff -Nurp klibc-1.2.4/klibc/Kbuild klibc-1.2.4.mich/klibc/Kbuild > --- klibc-1.2.4/klibc/Kbuild 2006-02-23 04:49:32.000000000 +0100 > +++ klibc-1.2.4.mich/klibc/Kbuild 2006-03-28 00:04:23.000000000 +0200 > @@ -30,6 +30,7 @@ libc-y := vsnprintf.o snprintf.o vsprint > strncat.o strlcpy.o strlcat.o \ > strstr.o strncmp.o strncpy.o strrchr.o \ > strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \ > + basename.o \ > gethostname.o getdomainname.o getcwd.o \ > seteuid.o setegid.o \ > getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ > diff -Nurp klibc-1.2.4/utils/basename.c klibc-1.2.4.mich/utils/basename.c > --- klibc-1.2.4/utils/basename.c 1970-01-01 01:00:00.000000000 +0100 > +++ klibc-1.2.4.mich/utils/basename.c 2006-03-28 00:07:05.000000000 +0200 > @@ -0,0 +1,18 @@ > +/* basename.c - strip directory from filenames */ > + > +/* Written 2006 by Michal Schmidt */ > + > +#include <stdio.h> > +#include <libgen.h> > + > +int main(int argc, char **argv) > +{ > + if (argc != 2) { > + fprintf(stderr,"Usage: %s filename\n",argv[0]); > + return 1; > + } > + > + printf("%s\n", basename(argv[1])); > + return 0; > +} > + one line too much ;) seems to affect almost any of these files.. > diff -Nurp klibc-1.2.4/utils/Kbuild klibc-1.2.4.mich/utils/Kbuild > --- klibc-1.2.4/utils/Kbuild 2006-03-28 00:37:46.000000000 +0200 > +++ klibc-1.2.4.mich/utils/Kbuild 2006-03-28 00:10:56.000000000 +0200 > @@ -4,7 +4,7 @@ > > progs := chroot dd mkdir mkfifo mount pivot_root umount > progs += true false sleep ln nuke minips cat > -progs += insmod uname > +progs += insmod uname basename > > static-y := $(addprefix static/, $(progs)) > shared-y := $(addprefix shared/, $(progs)) > @@ -42,6 +42,8 @@ static/insmod-y := insmod.o > shared/insmod-y := insmod.o > static/uname-y := uname.o > shared/uname-y := uname.o > +static/basename-y := basename.o > +shared/basename-y := basename.o > > # Clean deletes the static and shared dir > clean-dirs := static shared ps make sure to read the "perfect patch" by akpm before submitting -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

