Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/demo Modified Files: evfs_demo.c Log Message: Indenting =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/demo/evfs_demo.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- evfs_demo.c 23 Jan 2006 10:59:33 -0000 1.22 +++ evfs_demo.c 3 Feb 2006 23:12:13 -0000 1.23 @@ -1,112 +1,131 @@ #include <evfs.h> #include <string.h> -static int mon_current =0; /*A demo of stopping monitoring, after 10 events*/ -evfs_file_uri_path* dir_path; -evfs_connection* con; - -void callback(evfs_event* data, void* obj) { - if (data->type == EVFS_EV_FILE_MONITOR) { - printf("DEMO: Received a file monitor notification\n"); - printf("DEMO: For file: '%s'\n", data->file_monitor.filename); - mon_current++; - } else if (data->type == EVFS_EV_STAT) { - printf("Received stat event for file '%s'!\n", data->resp_command.file_command.files[0]->path); - printf("File size: %ld\n", data->stat.stat_obj.st_size); - //printf("File inode: %ld\n", data->stat.stat_obj.st_ino); - printf("File uid: %ld\n", data->stat.stat_obj.st_uid); - printf("File gid: %ld\n", data->stat.stat_obj.st_gid); - printf("Last access: %ld\n", data->stat.stat_obj.ist_atime); - printf("Last modify : %ld\n", data->stat.stat_obj.ist_mtime); - } else if (data->type == EVFS_EV_DIR_LIST) { - evfs_filereference* ref; - - printf("Received a directory listing..\nFiles:\n\n"); - - ecore_list_goto_first(data->file_list.list); - while ( (ref= ecore_list_next(data->file_list.list)) ) { - printf("(%s) Received file type for file: %d\n", ref->path, ref->file_type); - } - - - } - - /*if (mon_current == 2) { - static char str_data[1024]; - snprintf(str_data,1024,"posix://%s/newfile", getenv("HOME")); - - evfs_file_uri_path* path = evfs_parse_uri(str_data); - printf("Removing monitor...\n"); - evfs_monitor_remove(con, dir_path->files[0]); - - printf("DEMO: Removing HOME/newfile\n"); - evfs_client_file_remove(con, path->files[0]); - - - }*/ +static int mon_current = 0; /*A demo of stopping monitoring, after 10 events */ +evfs_file_uri_path *dir_path; +evfs_connection *con; + +void +callback(evfs_event * data, void *obj) +{ + if (data->type == EVFS_EV_FILE_MONITOR) + { + printf("DEMO: Received a file monitor notification\n"); + printf("DEMO: For file: '%s'\n", data->file_monitor.filename); + mon_current++; + } + else if (data->type == EVFS_EV_STAT) + { + printf("Received stat event for file '%s'!\n", + data->resp_command.file_command.files[0]->path); + printf("File size: %ld\n", data->stat.stat_obj.st_size); + //printf("File inode: %ld\n", data->stat.stat_obj.st_ino); + printf("File uid: %ld\n", data->stat.stat_obj.st_uid); + printf("File gid: %ld\n", data->stat.stat_obj.st_gid); + printf("Last access: %ld\n", data->stat.stat_obj.ist_atime); + printf("Last modify : %ld\n", data->stat.stat_obj.ist_mtime); + } + else if (data->type == EVFS_EV_DIR_LIST) + { + evfs_filereference *ref; + + printf("Received a directory listing..\nFiles:\n\n"); + + ecore_list_goto_first(data->file_list.list); + while ((ref = ecore_list_next(data->file_list.list))) + { + printf("(%s) Received file type for file: %d\n", ref->path, + ref->file_type); + } + + } + + /*if (mon_current == 2) { + * static char str_data[1024]; + * snprintf(str_data,1024,"posix://%s/newfile", getenv("HOME")); + * + * evfs_file_uri_path* path = evfs_parse_uri(str_data); + * printf("Removing monitor...\n"); + * evfs_monitor_remove(con, dir_path->files[0]); + * + * printf("DEMO: Removing HOME/newfile\n"); + * evfs_client_file_remove(con, path->files[0]); + * + * + * } */ } -int main(int argc, char** argv) { - - evfs_file_uri_path* path; - char pathi[1024]; - char *patharg = NULL; - char *cmd = NULL; - int i; - - for(i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-u")) { - if (++i < argc) { - patharg = strdup(argv[i]); - } else { - printf("The option \"-u\" requires a valid URI\n"); - return 1; - } - } else { - if (!cmd) { - cmd = strdup(argv[i]); - } else { - printf("Error: Enter only one command.\n"); - return 1; - } - } - - } - - printf("EVFS Demo system..\n"); - - /*Check if the user entered a command. TODO: Add command functionality.*/ - if (!cmd) - { - printf("You did not enter a command. Defaulting to DIR.\n"); - cmd = strdup("DIR"); - } - - if (!patharg) - { - snprintf(pathi,1024,"posix://%s", getenv("HOME")); - } - else - { - snprintf(pathi,1024,"%s", patharg); - } - - con = evfs_connect(&callback, NULL); - - //path = evfs_parse_uri("posix:///dev/ttyS0"); - - printf ("Listing dir: %s\n", pathi); - dir_path = evfs_parse_uri(pathi); - - - - printf("Plugin uri is '%s', for path '%s'\n\n", dir_path->files[0]->plugin_uri, dir_path->files[0]->path); - - - /*evfs_monitor_add(con, dir_path->files[0]); - evfs_client_file_copy(con, dir_path->files[0], NULL);*/ - evfs_client_dir_list(con, dir_path->files[0]); - ecore_main_loop_begin(); - evfs_disconnect(con); +int +main(int argc, char **argv) +{ + + evfs_file_uri_path *path; + char pathi[1024]; + char *patharg = NULL; + char *cmd = NULL; + int i; + + for (i = 1; i < argc; i++) + { + if (!strcmp(argv[i], "-u")) + { + if (++i < argc) + { + patharg = strdup(argv[i]); + } + else + { + printf("The option \"-u\" requires a valid URI\n"); + return 1; + } + } + else + { + if (!cmd) + { + cmd = strdup(argv[i]); + } + else + { + printf("Error: Enter only one command.\n"); + return 1; + } + } + + } + + printf("EVFS Demo system..\n"); + + /*Check if the user entered a command. TODO: Add command functionality. */ + if (!cmd) + { + printf("You did not enter a command. Defaulting to DIR.\n"); + cmd = strdup("DIR"); + } + + if (!patharg) + { + snprintf(pathi, 1024, "posix://%s", getenv("HOME")); + } + else + { + snprintf(pathi, 1024, "%s", patharg); + } + + con = evfs_connect(&callback, NULL); + + //path = evfs_parse_uri("posix:///dev/ttyS0"); + + printf("Listing dir: %s\n", pathi); + dir_path = evfs_parse_uri(pathi); + + printf("Plugin uri is '%s', for path '%s'\n\n", + dir_path->files[0]->plugin_uri, dir_path->files[0]->path); + + /*evfs_monitor_add(con, dir_path->files[0]); + * evfs_client_file_copy(con, dir_path->files[0], NULL); */ + evfs_client_dir_list(con, dir_path->files[0]); + ecore_main_loop_begin(); + evfs_disconnect(con); } ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs