diff options
Diffstat (limited to 'c/src/main.c')
-rw-r--r-- | c/src/main.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/c/src/main.c b/c/src/main.c new file mode 100644 index 0000000..1c2aa16 --- /dev/null +++ b/c/src/main.c @@ -0,0 +1,50 @@ +/** + * GPGSecure manages GPG encrypted archives + * Copyright (C) 2018 Aaron Ball <nullspoon@oper.io> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "encarchive.h" + +int main(int argc, char* argv[]) { + char* action; // Action to perform on the archive + char* archive; // Path to the archive to open. + char* tmp; // Temp (memory) path to extract into + + if(argc == 1) { + printf("Archive action required (enum, extract)\n"); + return 1; + } + + if(argc == 2) { + printf("Path to archive required\n"); + return 1; + } + action = argv[1]; + archive = argv[2]; + tmp = "/tmp/gpgsecure/"; + + if(strcmp(action, "enum") == 0) { + return enc_archive_enum(archive); + } else if(strcmp(action, "extract") == 0) { + return enc_archive_extract(archive, tmp); + } + + printf("Unknown action \"%s\"\n", action); + return 1; +} |