home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
emacs-19.28-src.tgz
/
tar.out
/
fsf
/
emacs
/
unixlib
/
src
/
rmdir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
584b
|
32 lines
#include "amiga.h"
#include <utility/tagitem.h>
int rmdir(char *name)
{
struct FileInfoBlock *fib = 0;
BPTR lock = 0;
if ((fib = AllocDosObjectTags(DOS_FIB, TAG_END)) &&
(lock = Lock(name, ACCESS_READ)) &&
Examine(lock, fib))
{
int isdir = fib->fib_DirEntryType > 0;
UnLock(lock);
FreeDosObject(DOS_FIB, fib);
if (isdir)
{
if (DeleteFile(name)) return 0;
ERROR;
}
errno = ENOTDIR;
return -1;
}
errno = convert_oserr(IoErr());
if (lock) UnLock(lock);
if (fib) FreeDosObject(DOS_FIB, fib);
return -1;
}