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