00001 /************************************************************************ 00002 * Copyright (C) 2005-2009 Philipp Marek. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License version 3 as 00006 * published by the Free Software Foundation. 00007 ************************************************************************/ 00008 00009 #ifndef __ACTION_H__ 00010 #define __ACTION_H__ 00011 00012 #include "global.h" 00013 00014 00033 /* unused, wrong doc 00034 * As in the entry list file (\ref dir) there is a callback \ref 00035 * actionlist_t::early_entry that's done \b before the child entries; 00036 * Clearing \ref estat::do_this_entry and \ref estat::do_tree in this 00037 * callback will skip calling \ref actionlist_t::local_callback for this and 00038 * the child entries (see \ref ops__set_to_handle_bits()). */ 00039 typedef int (action_t)(struct estat *sts); 00041 typedef int (work_t)(struct estat *root, int argc, char *argv[]); 00043 typedef int (action_uninit_t)(void); 00047 action_t ac__dispatch; 00048 00049 00051 work_t ac__Usage; 00053 #define ac__Usage_dflt() do { ac__Usage(NULL, 0, NULL); } while (0) 00054 00055 #define ac__Usage_this() do { ac__Usage(NULL, 1, (char**)action->name); } while (0) 00056 00057 00059 struct actionlist_t 00060 { 00062 const char** name; 00063 00068 work_t *work; 00069 00074 action_t *repos_feedback; 00075 00089 action_t *local_callback; 00092 action_uninit_t *local_uninit; 00093 00095 char const *help_text; 00096 00098 int i_val; 00099 00103 int is_import_export:1; 00108 int is_compare:1; 00113 int needs_decoder:1; 00115 int only_opt_filter:1; 00118 int keep_user_prop:1; 00121 int keep_children:1; 00124 int overwrite_sts_st:1; 00128 int do_update_dir:1; 00130 int is_readonly:1; 00131 }; 00132 00133 00138 int act__find_action_by_name(const char *cmd, 00139 struct actionlist_t **action_p); 00140 00141 00143 extern struct actionlist_t action_list[]; 00145 extern struct actionlist_t *action; 00147 extern const int action_list_count; 00148 00149 00150 #endif