From howardjp@wam.umd.edu Wed Aug  4 05:56:43 1999
Return-Path: <howardjp@wam.umd.edu>
Received: from po4.wam.umd.edu (po4.wam.umd.edu [128.8.10.166])
	by hub.freebsd.org (Postfix) with ESMTP id D23561538B
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  4 Aug 1999 05:56:38 -0700 (PDT)
	(envelope-from howardjp@wam.umd.edu)
Received: from rac3.wam.umd.edu (root@rac3.wam.umd.edu [128.8.10.143])
	by po4.wam.umd.edu (8.9.3/8.9.3) with ESMTP id IAA17077
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 4 Aug 1999 08:56:05 -0400 (EDT)
Received: from rac3.wam.umd.edu (sendmail@localhost [127.0.0.1])
	by rac3.wam.umd.edu (8.9.3/8.9.3) with SMTP id IAA09106
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 4 Aug 1999 08:56:04 -0400 (EDT)
Received: (from howardjp@localhost)
	by rac3.wam.umd.edu (8.9.3/8.9.3) id IAA09102
	for FreeBSD-gnats-submit@freebsd.org; Wed, 4 Aug 1999 08:56:03 -0400 (EDT)
Message-Id: <199908041256.IAA09102@rac3.wam.umd.edu>
Date: Wed, 4 Aug 1999 08:56:03 -0400 (EDT)
From: James Howard <howardjp@wam.umd.edu>
Reply-To: howardjp@wam.umd.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: basename(3) and dirname(3)
X-Send-Pr-Version: 3.2

>Number:         12960
>Category:       bin
>Synopsis:       basename(3) and dirname(3)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug  4 06:00:01 PDT 1999
>Closed-Date:    Thu Aug 31 08:57:04 PDT 2000
>Last-Modified:  Thu Aug 31 08:57:34 PDT 2000
>Originator:     James Howard
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
University of Maryland
>Environment:

FreeBSD byzantine.student.umd.edu 3.2-STABLE FreeBSD 3.2-STABLE #4: Thu Jun 17 18:40:41 GMT 1999     howardjp@byzantine.student.umd.edu:/usr/src/sys/compile/BYZANTINE  i386

>Description:

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?

>How-To-Repeat:

	<Code/input/activities to reproduce the problem (multiple lines)>

>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_ */

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Mon Aug 9 06:30:21 PDT 1999 
Responsible-Changed-Why:  
Put this on my todo list. 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Thu Aug 31 08:57:04 PDT 2000 
State-Changed-Why:  
Incomplete PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12960 
>Unformatted:
