Enlightenment CVS committal Author : sebastid Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_file Modified Files: ecore_file.c Log Message: Style. Assume the operations will succeed, and set ret to 0 on fail. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- ecore_file.c 24 Oct 2005 09:37:13 -0000 1.35 +++ ecore_file.c 24 Oct 2005 10:05:35 -0000 1.36 @@ -96,35 +96,39 @@ int ecore_file_recursive_rm(const char *dir) -{ +{ DIR *dirp; struct dirent *dp; Ecore_List *list; int ret; - if(!ecore_file_is_dir(dir)) + if (!ecore_file_is_dir(dir)) return ecore_file_unlink(dir); - - ret = 0; + dirp = opendir(dir); - if (!dirp) return ret; - + if (!dirp) return 0; + + ret = 1; while ((dp = readdir(dirp))) { if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) { char path[PATH_MAX]; struct stat st; - + snprintf(path, PATH_MAX, "%s/%s", dir, dp->d_name); - if (stat(path, &st) == -1) { ret = 0; continue; } - - if(S_ISDIR(st.st_mode)) + if (stat(path, &st) == -1) + { + ret = 0; + continue; + } + + if (S_ISDIR(st.st_mode)) { ecore_file_recursive_rm(path); ecore_file_rmdir(path); } - else if(S_ISREG(st.st_mode)||S_ISLNK(st.st_mode)) + else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { ecore_file_unlink(path); } @@ -132,9 +136,9 @@ } closedir(dirp); - if(ecore_file_rmdir(dir)) - ret = 1; - + if (!ecore_file_rmdir(dir)) + ret = 0; + return ret; } @@ -173,7 +177,7 @@ char realpath1[PATH_MAX]; char realpath2[PATH_MAX]; size_t num; - + if (!realpath(src, realpath1)) return 0; if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0; @@ -306,7 +310,7 @@ char *p, *pp, *exe1 = NULL, *exe2 = NULL; char *exe = NULL; int in_quot_dbl = 0, in_quot_sing = 0, restart = 0; - + p = (char *)app; restart: while ((*p) && (isspace(*p))) p++; @@ -393,7 +397,7 @@ { /* techcincally this is wrong. double quotes also accept * special chars: - * + * * $, `, \ */ *pp = *p; @@ -403,7 +407,7 @@ else { /* technically we should handle special chars: - * + * * $, `, \, etc. */ if ((p > exe1) && (p[-1] == '\\')) ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs