Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/plugins Modified Files: evfs_fs_tar.c Log Message: * Make the tar file stat function work * More EET work =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/plugins/evfs_fs_tar.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- evfs_fs_tar.c 9 Nov 2005 09:56:34 -0000 1.10 +++ evfs_fs_tar.c 9 Nov 2005 11:26:40 -0000 1.11 @@ -1,6 +1,7 @@ /* Copyright (C) 2005 <[EMAIL PROTECTED]> - Alex Taylor +Portions (as noted) Copyright(C) 2005 GNU Foundation, under the GNU GPL Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to @@ -41,8 +42,24 @@ #define uintmax_t long #define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) -static uintmax_t from_header (const char *, size_t, const char *, - uintmax_t, uintmax_t); + + +#define octal_field_convert(f) (octal ((f), sizeof (f))) +#define IS_DIGIT_O(f) ((f) >= '0' && (f) <= '8') +#define OCTAL_DIGIT(f) ((f) - '0') + +static int octal (const char *str, int len) +{ + int i, ret = 0; + for (i = 0; i < len; i++) + { + if (str[i] == '\0') break; + else if (!IS_DIGIT_O (str[i])) return 0; + ret = ret * 8 + OCTAL_DIGIT (str[i]); + } + return ret; +} + evfs_filereference* evfs_file_top_level_find(evfs_filereference* file) { @@ -84,6 +101,7 @@ struct tar_element { char* path; char* name; + struct stat file_prop; evfs_file_type type; Ecore_Hash* children; } tar_element; @@ -175,6 +193,8 @@ } /////////////////////////////////////////////////////// + + void tar_name_split(union TARPET_block* block , struct tar_file* tar) { char* tok; char* path = strdup(block->p.name); @@ -227,6 +247,15 @@ break; } + /*Assign properties*/ + ele->file_prop.st_uid = octal_field_convert(block->p.uid); + ele->file_prop.st_uid = octal_field_convert(block->p.gid); + ele->file_prop.st_mtime = octal_field_convert(block->p.mtime); + ele->file_prop.st_atime = 0; + ele->file_prop.st_size = octal_field_convert(block->p.size); + + + ecore_hash_set(search_hash, strdup(tok), ele); @@ -289,6 +318,8 @@ tar_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare); + + return functions; @@ -434,7 +465,24 @@ int evfs_file_stat(evfs_command* command, struct stat* file_stat) { - printf("evfs_fs_tar.c: evfs_file_stat -> stub\n"); + struct tar_file* file; + struct tar_element* ele; + + printf("Looking for file '%s'\n", evfs_file_top_level_find(command->file_command.files[0])->path); + if (!(file = ecore_hash_get(tar_cache, evfs_file_top_level_find(command->file_command.files[0])->path))) { + printf("Could not find file in lookup ref\n"); + + + } else { + printf("located tar file in cache"); + ele = ecore_hash_get(file->link_in, command->file_command.files[0]->path ); + if (ele) { + memcpy(file_stat, &ele->file_prop, sizeof(struct stat)); + } else { + printf("Couldn't locate file '%s' in tar file\n", command->file_command.files[0]->path); + } + } + return 0; } ------------------------------------------------------- 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