summaryrefslogtreecommitdiff
path: root/c/src/main.c
blob: 1c2aa16367d33d2d32fa7725336f264fd495990e (plain)
    1 /**
    2  * GPGSecure manages GPG encrypted archives
    3  * Copyright (C) 2018  Aaron Ball <nullspoon@oper.io>
    4  * 
    5  * This program is free software: you can redistribute it and/or modify
    6  * it under the terms of the GNU General Public License as published by
    7  * the Free Software Foundation, either version 3 of the License, or
    8  * (at your option) any later version.
    9  * 
   10  * This program is distributed in the hope that it will be useful,
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13  * GNU General Public License for more details.
   14  * 
   15  * You should have received a copy of the GNU General Public License
   16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   17  */
   18 #include <stdio.h>
   19 #include <stdlib.h>
   20 #include <string.h>
   21 
   22 #include "encarchive.h"
   23 
   24 int main(int argc, char* argv[]) {
   25   char* action;  // Action to perform on the archive
   26   char* archive; // Path to the archive to open.
   27   char* tmp;     // Temp (memory) path to extract into
   28 
   29   if(argc == 1) {
   30     printf("Archive action required (enum, extract)\n");
   31     return 1;
   32   }
   33 
   34   if(argc == 2) {
   35     printf("Path to archive required\n");
   36     return 1;
   37   }
   38   action  = argv[1];
   39   archive = argv[2];
   40   tmp     = "/tmp/gpgsecure/";
   41 
   42   if(strcmp(action, "enum") == 0) {
   43     return enc_archive_enum(archive);
   44   } else if(strcmp(action, "extract") == 0) {
   45     return enc_archive_extract(archive, tmp);
   46   }
   47 
   48   printf("Unknown action \"%s\"\n", action);
   49   return 1;
   50 }

Generated by cgit