aboutsummaryrefslogblamecommitdiffstats
path: root/src/actions.h
blob: 495984e3319cc8ca4de843a82c2bccf6aec1e063 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                


                                             
                                                                                
  

                                          
  

                                                                                

                                                         

                                                                                


                 
                   







                                                 









                                    
                       



                
 








                                 
            



             

                                
          

             
          

               












                                        
              
           


          
                      
/* actions.h - ck actions ----------------------------------------------*- C -*-
 *
 * This file is part of ck, the config keeper
 *
 * -----------------------------------------------------------------------------
 *
 * Copyright (C) 2018  Anastasis Grammenos
 * GPLv3 (see LICENCE for the full notice)
 *
 * -----------------------------------------------------------------------------
 *
 * The various structs actions use to keep track of their
 * specific options and the run_ACTION routines.
 *
 * -------------------------------------------------------------------------- */
#ifndef ACTIONS_H
#define ACTIONS_H

#include "ckutil.h"
#include "actionparser.h"
#include "confparser.h"

#define X(ACTION)                               \
  extern int run_##ACTION(UserOpt *, Conf *);
CK_ACTIONS
#undef X

typedef enum AddOptErrors AddOptErr;
enum AddOptErrors {
  ADD_NO_ERR = 0,
  ADD_ERR_WRONG_CONFIG,
  ADD_ERR_WRONG_FLAGS
};

typedef struct AddOptions AddOpt;
struct AddOptions {
  char *progName;
  char confPath[STR_L];
  int secret;
  int prime;
  AddOptErr err;
};

typedef enum DelErrors DelErr;
enum DelErrors {
  DEL_NO_ERR = 0,
  DEL_ERR_WRONG_PATH,
  DEL_ERR_WRONG_ARGS
};

typedef struct DelOptions DelOpt;
struct DelOptions {
  char *arg;
  int isConf;
  DelErr err;
};

typedef enum ListTypes ListType;
enum ListTypes {
  LT_NONE,
  LT_PATH,
  LT_PROGRAM,
  LT_TREE,
  LT_CKCONF,
  LT_PROG_CONFS
};

typedef enum ListShowTypes ListShowType;
enum ListShowTypes {
   LST_PLAIN,
   LST_LISP,
   LST_PYTHON,
};

typedef struct ListOptions ListOpt;
struct ListOptions {
  ListType _lt;
  ListShowType _lst;
  char *pName;
  int attr;
  int err;
};

#endif /* ACTIONS_H */