Your message dated Tue, 25 Jul 2006 09:57:09 +0200
with message-id <[EMAIL PROTECTED]>
and subject line klibc: add basename implementation
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: klibc
Severity: minor

The attached patch adds the "basename" function to klibc. A "basename"
utility is also implemented.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-mm1-michich
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
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;
+	
+	last_component = p;
+	was_slash = (*p++ == '/');
+	
+	while (*p) {
+		if (*p == '/') {
+			*p = '\0';
+			was_slash = 1;
+		} else {
+			if (was_slash) {
+				last_component = p;
+				was_slash = 0;
+			}
+		}
+		p++;
+	}
+
+	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;
+}
+
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

--- End Message ---
--- Begin Message ---
On Tue, 18 Apr 2006, Michal Schmidt wrote:

> maximilian attems wrote:
> >
> >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.

initramfs-tools 0.71 no longer needs a basename for the default image,
it should in between be much easier to build klibc only initramfs.
(readlink is missing, have it already done in my klibc tree and udev
 needs to apply #376349 - well the lvm2 hook is still a bit in the way
 but will soon go to lvm2 proper).

then you just need to rebuild udev and module-init-tools against klibc.

personally i doubt that there is a big use case for basename in
klibc-utils. as there is no need in Debian for basename and as already
said such patch should be sent upstream closing the bug report for now.

best regards

-- 
maks

--- End Message ---

Reply via email to