1 /* 2 * Operations and their invocation. 3 * 4 * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 /* Invocation support. */ 25 26 enum op_results 27 { 28 OP_SUCCESS = 0, 29 OP_FAILED = 1, 30 OP_UNKNOWN = 2, 31 }; 32 33 int handle_op_result(const char *operation, enum op_results op_result); 34 enum op_results run_operation(const char *operation, int argc, char *argv[]); 35 36 /* Operations exposed by the program. */ 37 38 typedef int (*op_sig)(int, char *[]); 39 40 struct operation 41 { 42 const char *name; 43 op_sig fn; 44 }; 45 46 int copy_in(int argc, char *argv[]); 47 int copy_out(int argc, char *argv[]); 48 int list_objects(int argc, char *argv[]); 49 int make_dirs(int argc, char *argv[]); 50 int remove_dirs(int argc, char *argv[]); 51 int remove_non_dirs(int argc, char *argv[]); 52 int run_script(int argc, char *argv[]); 53 int stat_objects(int argc, char *argv[]); 54 55 /* vim: tabstop=4 expandtab shiftwidth=4 56 */