Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/lib Modified Files: libevfs.c Log Message: * Fixed a parser idiocy. It was only by luck that it was working * Commit first version of sirkha's Curl-based FTP plugin * Memory cleanups =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/lib/libevfs.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- libevfs.c 3 Nov 2005 04:05:30 -0000 1.19 +++ libevfs.c 5 Nov 2005 06:03:27 -0000 1.20 @@ -163,8 +163,12 @@ Ecore_DList* tokens = ecore_dlist_new(); Ecore_List* reserved = ecore_dlist_new(); Ecore_List* plugin = ecore_dlist_new(); - - char* l_uri = uri; + + char* dup_uri = strdup(uri); + /*dup_uri = realloc(dup_uri, strlen(uri)+2); + strcat(dup_uri," ");*/ + + char* l_uri = dup_uri; int solid_alpha = 0; int new_alpha = 0; evfs_uri_token* token; @@ -173,11 +177,13 @@ int i = 0; int j=1; char c='1'; + int len=0; ecore_list_append(plugin, "smb"); /*Shift these to register when a plugin registers*/ ecore_list_append(plugin, "posix"); ecore_list_append(plugin, "tar"); ecore_list_append(plugin, "bzip2"); + ecore_list_append(plugin, "ftp"); ecore_list_append(reserved, "://"); ecore_list_append(reserved, "@"); @@ -186,10 +192,12 @@ ecore_list_append(reserved, "#"); ecore_list_append(reserved, ";"); - //printf ("Lexing '%s'\n", uri); + //printf ("Lexing '%s'\n", dup_uri); + //printf("Strlen(uri): %d\n", strlen(uri)); - while (j < strlen(uri)) { - new_alpha = isalnum(l_uri[i]) | isspace(l_uri[i]) | l_uri[i] == '.'; + while (j <= strlen(dup_uri)) { + new_alpha = isalnum(l_uri[i]) | l_uri[i] == '.'; + len=0; strncpy(tmp_tok, l_uri, 3); tmp_tok[3] = '\0'; @@ -199,8 +207,9 @@ ecore_list_goto_first(reserved); while ( (cmp = ecore_list_next(reserved))) { if (!strncmp(tmp_tok, cmp, strlen(cmp)) ) { - /*printf("Found token (operator) %s, added %d to l_uri\n", cmp, strlen(cmp));*/ + //printf("Found token (operator) %s, added %d to l_uri\n", cmp, strlen(cmp)); l_uri += strlen(cmp); + len=strlen(cmp); i = 0; /*printf("L_URI becomes '%s'\n", l_uri);*/ @@ -221,9 +230,8 @@ ecore_list_goto_first(plugin); while ( (cmp = ecore_list_next(plugin))) { if (!strncmp(tmp_tok, cmp, strlen(cmp)) ) { - /*printf("Found token (keyword) %s, added %d to l_uri\n", cmp, strlen(cmp));*/ + // printf("Found token (keyword) %s, added %d to l_uri\n", cmp, strlen(cmp)); - l_uri += strlen(cmp); i = 0; /*printf("L_URI becomes '%s'\n", l_uri);*/ @@ -242,8 +250,8 @@ strncpy(tmp_tok, l_uri, i); tmp_tok[i] = '\0'; - /*printf ("Looks like a string..\n"); - printf("Found string: '%s'\n", tmp_tok);*/ + /*printf ("Looks like a string..\n");*/ + //printf("Found string: '%s'\n", tmp_tok); token = NEW(evfs_uri_token); token->token_s = strdup(tmp_tok); @@ -258,10 +266,19 @@ solid_alpha = new_alpha; cont_loop: - j++; + if (!len) + j++; + else + if (len-1>0) + j+=len-1; + else + j+=len; i++; + //printf("i:J (%d:%d)\n", i,j); } + free(dup_uri); + return tokens; } ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs