/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* MKS Library -- basename -- produce base name of a file name
* NOTE: not standard SVID routine.
*
* Copyright 1985, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
* james Partanen, June '95
*
*/
#ifdef M_RCSID
#ifndef lint
#endif
#endif
#include <string.h>
#define DIRNAME 0
#define M_DRDELIM(c) (0)
/*f
* Since the goal is essentially common: find the last occurring
* M_FSDELIM, and since most of the degenerate cases end up with the
* same result, let's do most of the work in one function.
* - check degenerate arg forms
* - deal with a possible drive specifier
* - deal with degenerate paths
* - find last non-trailing M_FSDELIM
* - deal with degenerate dirname
* - deal with general case, returning prefix or suffix based on type
*/
static char *
{
return curdir; /* arg NULL, empty, ".", or ".." in DIRNAME */
else
return arg;
cp--;
*(cp--) = '\0';
;
*path = '\0';
return arg; /* curdir on the specified drive */
} else
return arg; /* root directory involved */
return(arg);
return ++cp;
*cp = '\0';
return arg;
}
/*f
* Finds the dirname of the given file. Spec1170 conformant.
*/
char *
{
}
/*f
* Finds the basename of the given file. Spec1170 conformant.
*/
char *
{
}
#ifdef TEST_MAIN_BASE_C
#include <stdio.h>
{
int cnt;
char *tmp;
if (argc>1) {
printf("%s\t%s\n",
}
return 0;
}
printf("enter pathnames less than 128 chars. enter 'q' to quit.\n");
break;
else {
}
return 0;
}
#endif /* TEST_MAIN_BASE_C */