Bug 12960 - basename(3) and dirname(3)
Summary: basename(3) and dirname(3)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 3.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1999-08-04 14:00 UTC by howardjp
Modified: 2000-08-31 16:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description howardjp 1999-08-04 14:00:01 UTC
I was working to port man/apropos/whatis/etc. from OpenBSD to replace
GPL'd versions currently available under FreeBSD.  Even to get man(1)
to compile under FreeBSD, I had to port dirname(3) and basename(3), 
as well as libgen.h from OpenBSD.  It would be worthwhile to add these
because they are mandated by Unix 98 (XPG5).  This went smoothly and 
without errors.  

This is the first of two PRs on this.  Under "Fix:" will be libgen.h, 
this should be added to /usr/src/include and the appropriate changes
made to the Makefiles.  The second PR will contain basename.[3c] and
dirname.[3c].  Sorry this is not a diff, I could not get diff to
properly handle the directory.  Does it have problems dealing with large
directories?  Also, should I have removed the "$OpenBSD:" line?

Fix: 

/*	$OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $	*/

/*
 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _LIBGEN_H_
#define _LIBGEN_H_

#include <sys/cdefs.h>

__BEGIN_DECLS

char	*basename __P((const char *));
char	*dirname __P((const char *));
#if 0
char	*regcmp __P((const char *, ...));
char	*regex __P((const char *, const char *, ...));

extern char *__loc1;
#endif

__END_DECLS

#endif /* _LIBGEN_H_ */
How-To-Repeat: 
	<Code/input/activities to reproduce the problem (multiple lines)>
Comment 1 Dag-Erling Smørgrav freebsd_committer freebsd_triage 1999-08-09 14:30:21 UTC
Responsible Changed
From-To: freebsd-bugs->des

Put this on my todo list. 
Comment 2 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2000-08-31 16:57:04 UTC
State Changed
From-To: open->closed

Incomplete PR.