constify dirname(3) and basename(3)

This commit is contained in:
plunky 2008-04-23 07:53:26 +00:00
parent f983e71d70
commit 043900c0cb
5 changed files with 17 additions and 19 deletions

View File

@ -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. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -42,8 +42,8 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__BEGIN_DECLS __BEGIN_DECLS
char *basename(char *); char *basename(const char *);
char *dirname(char *); char *dirname(const char *);
__END_DECLS __END_DECLS
#endif /* !_LIBGEN_H_ */ #endif /* !_LIBGEN_H_ */

View File

@ -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. .\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd October 16, 2002 .Dd April 22, 2008
.Dt BASENAME 3 .Dt BASENAME 3
.Os .Os
.Sh NAME .Sh NAME
@ -45,7 +45,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.In libgen.h .In libgen.h
.Ft char * .Ft char *
.Fn basename "char *path" .Fn basename "const char *path"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn basename .Fn basename

View File

@ -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. * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* !LIBC_SCCS && !lint */
#include "namespace.h" #include "namespace.h"
@ -52,12 +52,11 @@ __weak_alias(basename,_basename)
#if !HAVE_BASENAME #if !HAVE_BASENAME
char * char *
basename(path) basename(const char *path)
char *path;
{ {
static char singledot[] = "."; static char singledot[] = ".";
static char result[PATH_MAX]; static char result[PATH_MAX];
char *p, *lastp; const char *p, *lastp;
size_t len; size_t len;
/* /*

View File

@ -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. .\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd October 16, 2002 .Dd April 22, 2008
.Dt DIRNAME 3 .Dt DIRNAME 3
.Os .Os
.Sh NAME .Sh NAME
@ -45,7 +45,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.In libgen.h .In libgen.h
.Ft char * .Ft char *
.Fn dirname "char *path" .Fn dirname "const char *path"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn dirname .Fn dirname

View File

@ -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. * Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* !LIBC_SCCS && !lint */
#include "namespace.h" #include "namespace.h"
@ -52,12 +52,11 @@ __weak_alias(dirname,_dirname)
#if !HAVE_DIRNAME #if !HAVE_DIRNAME
char * char *
dirname(path) dirname(const char *path)
char *path;
{ {
static char singledot[] = "."; static char singledot[] = ".";
static char result[PATH_MAX]; static char result[PATH_MAX];
char *lastp; const char *lastp;
size_t len; size_t len;
/* /*