1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2000-12-13  Jakub Jelinek  <jakub@redhat.com>

	* misc/efgcvt.c (FCVT_MAXDIG): Define.
	(FCVT_BUFPTR): New variable.
	(fcvt): If fcvt_r returns -1 on the static short buffer,
	try to malloc a sufficiently large one and retry.
	(free_mem): New function.
	* misc/qefgcvt.c (FCVT_MAXDIG): Define.
	* misc/tst-efgcvt.c (fcvt_tests): Add new test.

2000-12-15  Ulrich Drepper  <drepper@redhat.com>

	* misc/dirname.c (dirname): Fix search for second to last slash.

2000-12-13  Andreas Jaeger  <aj@suse.de>

	* misc/tst-dirname.c (main): Fix typo in test to really use
	the examples from Unix98.
	Reported by Michael Kerrisk <mtk16@ext.canterbury.ac.nz>.
This commit is contained in:
Ulrich Drepper
2000-12-16 07:54:18 +00:00
parent bafd15679c
commit 887e7ab6c5
6 changed files with 68 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/* dirname - return directory part of PATH.
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -31,17 +31,20 @@ dirname (char *path)
/* Find last '/'. */
last_slash = path != NULL ? strrchr (path, '/') : NULL;
if (last_slash == path)
/* The last slash is the first character in the string. We have to
return "/". */
++last_slash;
else if (last_slash != NULL && last_slash[1] == '\0')
if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
/* The '/' is the last character, we have to look further. */
last_slash = memchr (path, last_slash - path, '/');
last_slash = __memrchr (path, '/', last_slash - path);
if (last_slash != NULL)
/* Terminate the path. */
last_slash[0] = '\0';
{
/* Terminate the path. */
if (last_slash == path)
/* The last slash is the first character in the string. We have to
return "/". */
++last_slash;
last_slash[0] = '\0';
}
else
/* This assignment is ill-designed but the XPG specs require to
return a string containing "." in any case no directory part is