/*
 * unlink — remove a file via ESTEX DELETE ($0E).
 *   HL = ASCIIZ path; CF=err with code in A. Sets errno on failure.
 */

#include <unistd.h>

int unlink(const char *path) __naked
{
    (void)path;
    __asm
        push  ix
        ld    c, #0x0E              ; ESTEX DELETE (HL = file name, A = attribure file)
        rst   #0x10
        pop   ix
        jr    c, _unlink_err
        ld    de, #0
        ret
    _unlink_err:
        call  __errno_set
        ld    de, #-1
        ret
    __endasm;
}
