diff options
| author | gramanas <anastasis.gramm2@gmail.com> | 2018-09-27 16:54:43 +0300 | 
|---|---|---|
| committer | gramanas <anastasis.gramm2@gmail.com> | 2018-09-27 16:54:43 +0300 | 
| commit | 65986f9cd9429c7876e5d2f09e4a0cd19d966fa3 (patch) | |
| tree | a77f12361571bd6c89ccd478db3dba2866719df3 /src/actionhelper.c | |
| parent | 03917439a1ddcf202e9fc53937b10eeb7ec0a99a (diff) | |
| download | ck-65986f9cd9429c7876e5d2f09e4a0cd19d966fa3.tar.gz ck-65986f9cd9429c7876e5d2f09e4a0cd19d966fa3.tar.bz2 ck-65986f9cd9429c7876e5d2f09e4a0cd19d966fa3.zip  | |
Add dummy delete
Diffstat (limited to 'src/actionhelper.c')
| -rw-r--r-- | src/actionhelper.c | 30 | 
1 files changed, 29 insertions, 1 deletions
diff --git a/src/actionhelper.c b/src/actionhelper.c index c3b1b81..596a7db 100644 --- a/src/actionhelper.c +++ b/src/actionhelper.c @@ -50,7 +50,7 @@ void move_config(const AddOpt *opt, const Conf *conf, char *ret) {  AddOpt add_make_options(cklist *args) {    list_rewind(args); -  /* since we are here, the first two argumens must exist */ +  /* since we are here, the first two arguments must exist */    AddOpt addOpt = {      .progName = list_get(args),      .secret = 0, @@ -79,6 +79,34 @@ AddOpt add_make_options(cklist *args) {    return addOpt;  } +DelOpt del_make_options(cklist *args) { +  list_rewind(args); +  DelOpt delOpt = { +    .prog = NULL, +    .path = "", +    .isConf = 0, +    .err = DEL_NO_ERR +  }; + +  if (strcmp(list_get(args), "-c") == 0) { +    delOpt.isConf = 1; +    if (!list_next(args)) { +      delOpt.err = DEL_ERR_WRONG_ARGS; +      return delOpt; +    } +    realpath(list_get(args), delOpt.path); +    if (!util_is_file_rw(delOpt.path)) { +      delOpt.err = DEL_ERR_WRONG_PATH; +      return delOpt; +    } +  } else { +    delOpt.prog = list_get(args); +  } + +  list_rewind(args); +  return delOpt; +} +  void add_print_opts(AddOpt *opt) {    printf("Program:\t%s\nConfig:\t\t%s\n", opt->progName, opt->confPath);    if (opt->prime && opt->secret) {  | 
