2
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3
Copyright (C) 2005- The University of Notre Dame
4
This software is distributed under the GNU General Public License.
5
See the file COPYING for details.
8
#include "delete_dir.h"
9
#include "stringtools.h"
19
int delete_dir( const char *dirname )
21
char subdir[PATH_MAX];
26
dir = opendir(dirname);
29
result = unlink(dirname);
35
} else if(errno==ENOENT) {
44
while((d=readdir(dir))) {
45
if(!strcmp(d->d_name,".")) continue;
46
if(!strcmp(d->d_name,"..")) continue;
47
sprintf(subdir,"%s/%s",dirname,d->d_name);
48
if(!delete_dir(subdir)) {
55
if(rmdir(dirname)!=0) {