Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_file
Modified Files:
ecore_file.c ecore_file_path.c
Log Message:
Move ecore_file_app_exe_get since it doesn't use path
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ecore_file.c 29 Sep 2005 17:50:03 -0000 1.16
+++ ecore_file.c 30 Sep 2005 00:46:14 -0000 1.17
@@ -2,6 +2,7 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_file_private.h"
+#include <ctype.h>
static int init = 0;
@@ -270,3 +271,103 @@
ecore_list_goto_first(list);
return list;
}
+
+char *
+ecore_file_app_exe_get(const char *app)
+{
+ char *p, *pp, *exe1 = NULL, *exe2 = NULL;
+ char *exe;
+ int in_quot_dbl = 0, in_quot_sing = 0;
+
+ p = (char *)app;
+ while ((*p) && (isspace(*p))) p++;
+ exe1 = p;
+ while (*p)
+ {
+ if (in_quot_sing)
+ {
+ if (*p == '\'')
+ in_quot_sing = 0;
+ }
+ else if (in_quot_dbl)
+ {
+ if (*p == '\"')
+ in_quot_dbl = 0;
+ }
+ else
+ {
+ if (*p == '\'')
+ in_quot_sing = 1;
+ else if (*p == '\"')
+ in_quot_dbl = 1;
+ if ((isspace(*p)) && (!((p > app) && (p[-1] != '\\'))))
+ break;
+ }
+ p++;
+ }
+ exe2 = p;
+ if (exe2 == exe1) return NULL;
+ exe = malloc(exe2 - exe1 + 1);
+ if (!exe) return NULL;
+ p = exe1;
+ in_quot_dbl = 0;
+ in_quot_sing = 0;
+ pp = exe;
+ while (*p)
+ {
+ if (in_quot_sing)
+ {
+ if (*p == '\'')
+ in_quot_sing = 0;
+ else
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+ else if (in_quot_dbl)
+ {
+ if (*p == '\"')
+ in_quot_dbl = 0;
+ else
+ {
+ /* techcincally this is wrong. double quotes also accept
+ * special chars:
+ *
+ * $, `, \
+ */
+ *pp = *p;
+ pp++;
+ }
+ }
+ else
+ {
+ /* technically we should handle special chars:
+ *
+ * $, `, \, etc.
+ */
+ if ((p > app) && (p[-1] == '\\'))
+ {
+ if (*p != '\n')
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+ else if (*p == '\'')
+ in_quot_sing = 1;
+ else if (*p == '\"')
+ in_quot_dbl = 1;
+ else if (isspace(*p))
+ break;
+ else
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+ p++;
+ }
+ *pp = 0;
+ return exe;
+}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file_path.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_file_path.c 29 Sep 2005 17:50:04 -0000 1.13
+++ ecore_file_path.c 30 Sep 2005 00:46:15 -0000 1.14
@@ -2,7 +2,6 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_file_private.h"
-#include <ctype.h>
static int init = 0;
static Ecore_List *__ecore_file_path_bin;
@@ -74,103 +73,3 @@
}
return 0;
}
-
-char *
-ecore_file_app_exe_get(const char *app)
-{
- char *p, *pp, *exe1 = NULL, *exe2 = NULL;
- char *exe;
- int in_quot_dbl = 0, in_quot_sing = 0;
-
- p = (char *)app;
- while ((*p) && (isspace(*p))) p++;
- exe1 = p;
- while (*p)
- {
- if (in_quot_sing)
- {
- if (*p == '\'')
- in_quot_sing = 0;
- }
- else if (in_quot_dbl)
- {
- if (*p == '\"')
- in_quot_dbl = 0;
- }
- else
- {
- if (*p == '\'')
- in_quot_sing = 1;
- else if (*p == '\"')
- in_quot_dbl = 1;
- if ((isspace(*p)) && (!((p > app) && (p[-1] != '\\'))))
- break;
- }
- p++;
- }
- exe2 = p;
- if (exe2 == exe1) return NULL;
- exe = malloc(exe2 - exe1 + 1);
- if (!exe) return NULL;
- p = exe1;
- in_quot_dbl = 0;
- in_quot_sing = 0;
- pp = exe;
- while (*p)
- {
- if (in_quot_sing)
- {
- if (*p == '\'')
- in_quot_sing = 0;
- else
- {
- *pp = *p;
- pp++;
- }
- }
- else if (in_quot_dbl)
- {
- if (*p == '\"')
- in_quot_dbl = 0;
- else
- {
- /* techcincally this is wrong. double quotes also accept
- * special chars:
- *
- * $, `, \
- */
- *pp = *p;
- pp++;
- }
- }
- else
- {
- /* technically we should handle special chars:
- *
- * $, `, \, etc.
- */
- if ((p > app) && (p[-1] == '\\'))
- {
- if (*p != '\n')
- {
- *pp = *p;
- pp++;
- }
- }
- else if (*p == '\'')
- in_quot_sing = 1;
- else if (*p == '\"')
- in_quot_dbl = 1;
- else if (isspace(*p))
- break;
- else
- {
- *pp = *p;
- pp++;
- }
- }
- p++;
- }
- *pp = 0;
- return exe;
-}
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs