/*<Header>==============================================================
*
*	STRINGS OPERATION / "EIN_ST04.C"
*
*		[ EIN(tm) project : 文字列操作補助関数群 ]
*
*	COPYRIGHT  Nam & みんたっ♪  1994, All rights reserved.
*
*-----------------------------------------------------------------------
*	V1.0L01α	94.07.16/Nam	プロトタイプ(みんたっ♪さんの関数を利用)
*</Header>==============================================================*/
#include	<stdio.h>
#include 	<stdlib.h>
#include 	<string.h>
#include	<snd.h>
#include	<winb.h>
#include	<te.h>
#include	<fntb.h>
#include	<gui.h>

#define	EIN_FSTR
#include	"..\eintm.h"

#ifndef NOERR
#define	NOERR	(0)
#endif
#ifndef ERROR
#define	ERROR	(1)
#endif

extern char	*EIN_strrchr( char *, char );

/*<Func>================================================================
*	int		EIN_fnameDirectory( char *src, char *dst )
*
*	【概  要】	パス名からファイル名を除いたディレクトリ部を返します。
*
*	【機  能】	
*
*	【入  力】*src		:
*
*	【出  力】*dst		:
*
*	【関数値】	==0			正常終了
*				!=0			異常終了
*
*	【注  意】	
*
*	【参  照】	EIN_strrchr
*
*-----------------------------------------------------------------------
*	V11L10	1994.07.16/Nam
*</Func>==============================================================*/
int		EIN_fnameDirectory( char *src, char *dst )
{
	char			*fnp;	/* ファイル名解析ポインタ */
	register int	ret = ERROR;
	
	if ( src==NULL || dst==NULL ){
		return ret;
	}
	if ( ((fnp = EIN_strrchr(src, '\\')) != NULL)||	/* パス指定は有る? */
		 ((fnp = EIN_strrchr(src, ':' )) != NULL)){	/* ドライブ指定は? */
		fnp++;
		strncpy(dst, src, (fnp-src));		/* パス名コピー */
		*(dst+(fnp-src)) = '\0';
		ret = NOERR;
	} else {
		strcpy(dst,"");
	}
	return ret;
}

