Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : apps/evfs
Dir : e17/apps/evfs/src/lib
Modified Files:
libevfs.c
Log Message:
* Function to de-parse a filereference and output as a uri
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/lib/libevfs.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- libevfs.c 9 Nov 2005 23:51:05 -0000 1.22
+++ libevfs.c 16 Nov 2005 11:48:53 -0000 1.23
@@ -423,3 +423,53 @@
return path;
}
+
+
+char* evfs_filereference_to_string(evfs_filereference* ref) {
+ int length=0;
+ char* uri;
+ Ecore_List* parent_list = ecore_list_new();
+ evfs_filereference* parent;
+
+ ecore_list_prepend(parent_list, ref);
+ length += strlen(ref->plugin_uri) + strlen("://");
+ if (ref->username) {
+ length += strlen(ref->username) + strlen(ref->password) +
strlen(":") + strlen("@");
+ }
+ length += strlen(ref->path);
+
+ while ( (parent = ref->parent)) {
+ ecore_list_prepend(parent_list, parent);
+
+ length += strlen(parent->plugin_uri) + strlen("://");
+ if (parent->username) {
+ length += strlen(parent->username) +
strlen(parent->password) + strlen(":") + strlen("@");
+
+ }
+
+ length += strlen(parent->path);
+ length += strlen("#");
+
+ }
+ length += 1;
+ uri = calloc(length,sizeof(char));
+
+
+ while ( (parent = ecore_list_remove_first(parent_list))) {
+ strcat(uri, parent->plugin_uri);
+ strcat(uri, "://");
+ if (parent->username) {
+ strcat(uri, parent->username);
+ strcat(uri, ":");
+ strcat(uri, parent->password);
+ strcat(uri, "@");
+ }
+ strcat(uri, parent->path);
+ if (ecore_list_next(parent_list)) strcat(uri, "#");
+ }
+
+ ecore_list_destroy(parent_list);
+
+ return uri;
+
+}
-------------------------------------------------------
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. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs