pathcat.c
来自「dos 1.0 其中包含quick basic源代码、内存管理himem emm」· C语言 代码 · 共 43 行
C
43 行
/*** pathcat.c - concatenate a string onto another, handing path seps
*
* Modifications
* 23-Nov-1988 mz Created
*/
#include "..\h\tools.h"
#include <string.h>
/** pathcat - handle concatenation of path strings
*
* Care must be take to handle:
* "" XXX => XXX
* A B => A\B
* A\ B => A\B
* A \B => A\B
* A\ \B => A\B
*
* pDst char pointer to location of 'A' above
* pSrc char pointer to location of 'B' above
*
* returns pDst
*/
char *pathcat (char *pDst, char *pSrc)
{
/* If dest is empty and src begins with a drive
*/
if (*pDst == '\0')
return strcpy (pDst, pSrc);
/* Make destination end in a path char
*/
if (*pDst == '\0' || !fPathChr (strend (pDst)[-1]))
strcat (pDst, PSEPSTR);
/* Skip leading path separators on source
*/
while (fPathChr (*pSrc))
pSrc++;
return strcat (pDst, pSrc);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?