constify dirname(3) and basename(3)
This commit is contained in:
parent
f983e71d70
commit
043900c0cb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: libgen.h,v 1.2 2005/02/03 04:39:32 perry Exp $ */
|
||||
/* $NetBSD: libgen.h,v 1.3 2008/04/23 07:53:26 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -42,8 +42,8 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
char *basename(char *);
|
||||
char *dirname(char *);
|
||||
char *basename(const char *);
|
||||
char *dirname(const char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_LIBGEN_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: basename.3,v 1.11 2003/09/06 20:58:11 kleink Exp $
|
||||
.\" $NetBSD: basename.3,v 1.12 2008/04/23 07:53:26 plunky Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -34,7 +34,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 16, 2002
|
||||
.Dd April 22, 2008
|
||||
.Dt BASENAME 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,7 +45,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.In libgen.h
|
||||
.Ft char *
|
||||
.Fn basename "char *path"
|
||||
.Fn basename "const char *path"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn basename
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: basename.c,v 1.5 2002/10/17 02:06:04 thorpej Exp $ */
|
||||
/* $NetBSD: basename.c,v 1.6 2008/04/23 07:53:26 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: basename.c,v 1.5 2002/10/17 02:06:04 thorpej Exp $");
|
||||
__RCSID("$NetBSD: basename.c,v 1.6 2008/04/23 07:53:26 plunky Exp $");
|
||||
#endif /* !LIBC_SCCS && !lint */
|
||||
|
||||
#include "namespace.h"
|
||||
@ -52,12 +52,11 @@ __weak_alias(basename,_basename)
|
||||
|
||||
#if !HAVE_BASENAME
|
||||
char *
|
||||
basename(path)
|
||||
char *path;
|
||||
basename(const char *path)
|
||||
{
|
||||
static char singledot[] = ".";
|
||||
static char result[PATH_MAX];
|
||||
char *p, *lastp;
|
||||
const char *p, *lastp;
|
||||
size_t len;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: dirname.3,v 1.11 2003/09/06 20:58:39 kleink Exp $
|
||||
.\" $NetBSD: dirname.3,v 1.12 2008/04/23 07:53:26 plunky Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -34,7 +34,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 16, 2002
|
||||
.Dd April 22, 2008
|
||||
.Dt DIRNAME 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,7 +45,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.In libgen.h
|
||||
.Ft char *
|
||||
.Fn dirname "char *path"
|
||||
.Fn dirname "const char *path"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn dirname
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dirname.c,v 1.7 2002/10/17 11:36:39 tron Exp $ */
|
||||
/* $NetBSD: dirname.c,v 1.8 2008/04/23 07:53:26 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: dirname.c,v 1.7 2002/10/17 11:36:39 tron Exp $");
|
||||
__RCSID("$NetBSD: dirname.c,v 1.8 2008/04/23 07:53:26 plunky Exp $");
|
||||
#endif /* !LIBC_SCCS && !lint */
|
||||
|
||||
#include "namespace.h"
|
||||
@ -52,12 +52,11 @@ __weak_alias(dirname,_dirname)
|
||||
|
||||
#if !HAVE_DIRNAME
|
||||
char *
|
||||
dirname(path)
|
||||
char *path;
|
||||
dirname(const char *path)
|
||||
{
|
||||
static char singledot[] = ".";
|
||||
static char result[PATH_MAX];
|
||||
char *lastp;
|
||||
const char *lastp;
|
||||
size_t len;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user