1 /* 2 * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <stdio.h> 8 9 #include <errno.h> 10 11 #include <syscalls.h> 12 13 14 int 15 remove(const char* path) 16 { 17 // TODO: find a better way that does not require two syscalls for directories 18 int status = _kern_unlink(-1, path); 19 if (status == B_IS_A_DIRECTORY) 20 status = _kern_remove_dir(-1, path); 21 22 if (status != B_OK) { 23 errno = status; 24 return -1; 25 } 26 27 return status; 28 } 29 30