Enlightenment CVS committal Author : onefang Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_file Modified Files: Ecore_File.h ecore_file.c Log Message: Copy filename escaping code from e_utils to make it more generally available. Step 2 is to remove the original and have everything call this one instead. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/Ecore_File.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- Ecore_File.h 8 Sep 2006 16:52:29 -0000 1.27 +++ Ecore_File.h 28 Oct 2006 08:48:11 -0000 1.28 @@ -76,6 +76,7 @@ EAPI char *ecore_file_readlink (const char *link); EAPI Ecore_List *ecore_file_ls (const char *dir); EAPI char *ecore_file_app_exe_get (const char *app); + EAPI char *ecore_file_escape_name (const char *filename); EAPI char *ecore_file_strip_ext (const char *file); EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path, =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -3 -r1.49 -r1.50 --- ecore_file.c 15 Oct 2006 09:32:25 -0000 1.49 +++ ecore_file.c 28 Oct 2006 08:48:11 -0000 1.50 @@ -480,6 +480,40 @@ } EAPI char * +ecore_file_escape_name(const char *filename) +{ + const char *p; + char *q; + static char buf[PATH_MAX]; + + p = filename; + q = buf; + while (*p) + { + if ((q - buf) > (PATH_MAX - 6)) return NULL; + if ( + (*p == ' ') || (*p == '\t') || (*p == '\n') || + (*p == '\\') || (*p == '\'') || (*p == '\"') || + (*p == ';') || (*p == '!') || (*p == '#') || + (*p == '$') || (*p == '%') || (*p == '&') || + (*p == '*') || (*p == '(') || (*p == ')') || + (*p == '[') || (*p == ']') || (*p == '{') || + (*p == '}') || (*p == '|') || (*p == '<') || + (*p == '>') || (*p == '?') + ) + { + *q = '\\'; + q++; + } + *q = *p; + q++; + p++; + } + *q = 0; + return strdup(buf); +} + +EAPI char * ecore_file_strip_ext(const char *path) { char *p, *file = NULL; ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs