/* $Header: /var/lib/cvsd/repos/CSRG/43BSD/contrib/mkmf/src/pathhead.c,v 1.1.1.1 2018/04/24 16:12:54 root Exp $ */

/*
 * Author: Peter J. Nicklin
 */

/*
 * pathhead() removes tail of pathname and returns pathname. The tail is
 * defined as that part of the pathname after the last separator.
 */
#include "null.h"
#include "path.h"

char *
pathhead(pathname)
	register char *pathname;
{
	register char *ls;		/* last separator character */
	register char *p;		/* pathname pointer */

	ls = NULL;
	for (p = pathname; *p != '\0'; p++)
		if (*p == _PSC)
			ls = p;
	if (ls != NULL) *ls = '\0';
	return(pathname);
}
