📄 unlink.c
字号:
/* $id:dmUnlink.c V1.0 2002/06/06 */
/******************************************************************************
* This source code has been made available to you by CORETEK on
* AS-IS.Anyone receiving this source is licensed under
* CORETEK copyrights to use it in any way he or she deems fit,including
* copying it,modifying it,compiling it,and redistributing it either with
* or without modifictions.
*
*
* Any person who transfers this source code or any derivative work must
* include the CORETEK copyright notice, this paragraph,and the preceding
* two paragraphs in the transferred software.
*
*
* COPYRIGHT CORETEK CORPORATION 2001
* LICENSED MATERIAL - PROGRAM PROPERTY OF CORETEK
*****************************************************************************/
/******************************************************************************
*
* FILE: unlink.c
*
* MODULE: RTL
*
* PURPOSE: unlink() - POSIX 1003.1b 6.4.2 - delete the file
*
* AUTHOR(S):Zhang Yumin
*
* GROUP:TOOL_GROUP
*
* DATE CREATED:2002/06/06
*
* REFERENCE DOCUMENT ID:
*
* MODIFICATIONS:
* Date user Name Description
* 2002/06/06 Zhang Yumin Create this file
*
*********************************************************************************/
#include <sys/types.h>
#include <sys/reent.h>
extern int sys_unlink(const char *file);
/********************************************************************
* FUNCTION: unlink
*
* PURPOSE: Delete the file.
* PARAMETERS:
*
* Input fd -file descriptor of target file.
* offset&whence
* -If whence is SEEK_SET,the offset is set to offset bytes.
* -If whence is SEEK_CUR,the offset is set to its current
* location plusoffset bytes.
* -If whence isSEEK_END,the offset is set to the size of the
* file plusoffset bytes.
* Output: None
* InOut: None
*
* Return value: Upon successful completion,lseek() returns the resulting
* offset location as measured in bytes from the beginning
* of the file. Otherwise, a value of -1 is returned and
* errno is set to indicate the error.
* Reentrant: No
********************************************************************/
int _unlink_r(struct _reent *ptr, const char *file)
{
int rc = sys_unlink(file);
if(rc < 0)
{
ptr->_errno = -rc;
return -1;
}
return rc;
}
#ifndef _REENT_ONLY
int unlink(const char *file)
{
return _unlink_r(_REENT,file);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -