mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-17 03:49:46 +08:00
8b8952064c
newlib/libc/ * stdio64/freopen64.c: Include <string.h> for memset(). * stdlib/quick_exit.c: Include <unistd.h> for _exit(). * string/gnu_basename.c (__gnu_basename): Fix discarded const qualifier warning. * stdlib/strtold.c: Include "mprec.h" for _strtorx_r(). Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
27 lines
673 B
C
27 lines
673 B
C
#ifndef _NO_BASENAME
|
|
/* Copyright 2015 Red Hat, Inc.
|
|
* Permission to use, copy, modify, and distribute this software
|
|
* is freely granted, provided that this notice is preserved.
|
|
*/
|
|
|
|
/* The differences with the POSIX version (unix/basename.c):
|
|
* - declared in <string.h> (instead of <libgen.h>);
|
|
* - the argument is never modified, and therefore is marked const;
|
|
* - the empty string is returned if path is an empty string, "/", or ends
|
|
* with a trailing slash.
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
char *
|
|
_DEFUN (__gnu_basename, (path),
|
|
const char *path)
|
|
{
|
|
char *p;
|
|
if ((p = strrchr (path, '/')))
|
|
return p + 1;
|
|
return (char *) path;
|
|
}
|
|
|
|
#endif /* !_NO_BASENAME */
|