From fe781e5ae7116733e5b335a0ac016af97266db5f Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Mon, 8 Oct 2018 23:47:07 +0300 Subject: Way better Edit --- CMakeLists.txt | 2 +- README.html | 186 ++++++++++++++++++++++++++++++----------------------- README.org | 34 ++++++++-- res/check_ck | 112 -------------------------------- res/test-ck | 112 ++++++++++++++++++++++++++++++++ src/actionhelper.c | 26 ++++---- src/actionparser.c | 2 +- src/actions.c | 102 +++++++++++++++++------------ src/ckutil.c | 6 +- src/dblayer.c | 130 ++++++++++++++++++++++++++++++++++++- src/dblayer.h | 6 +- 11 files changed, 454 insertions(+), 264 deletions(-) delete mode 100755 res/check_ck create mode 100755 res/test-ck diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f5117f..b5e474e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,5 +114,5 @@ if (CK_TESTS) configure_file(${TESTS_DIR}/03_delete ${BIN_TESTS_DIR}/03_delete @ONLY) configure_file(${TESTS_DIR}/04_search ${BIN_TESTS_DIR}/04_search @ONLY) # check_ck - configure_file(${RES_DIR}/check_ck check_ck @ONLY) + configure_file(${RES_DIR}/test-ck test-ck @ONLY) endif() diff --git a/README.html b/README.html index e51fc39..2180663 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -232,35 +232,35 @@ for the JavaScript code in this tag.

Table of Contents

-
-

ck

-
+
+

ck

+

The Config Keeper

-
-

build it

-
+
+

build it

+
-
-

requirements

-
+
+

requirements

+
  • clang (llvm) or gcc (gnu)
  • cmake
  • @@ -293,9 +293,9 @@ for the JavaScript code in this tag.
-
-

compiler

-
+
+

compiler

+
> export CC=clang
 # or
@@ -305,9 +305,9 @@ for the JavaScript code in this tag.
 
-
-

make

-
+
+

make

+
# clone the repo
 > cd ~/code; git clone https://gitlab.com/grm-grm/ck
@@ -325,13 +325,13 @@ for the JavaScript code in this tag.
 
-
-

for devs

-
+
+

for devs

+
-
-

CMake options

-
+
+

CMake options

+

cmake accepts the following options:

@@ -371,9 +371,9 @@ llvm has better asan than gcc, so I use that.
-
-

tests

-
+
+

tests

+

The testing "suite" is a bash script that runs regression and unit tests. Regression tests are under the tests/ directory @@ -382,24 +382,25 @@ under unit/ directory and test the code.

-
-

run tests

-
+
+

run tests

+

-Simply go to the build dir and type. +First make sure you build ck with the -DCK_TESTS=1 option. Then +go to the build directory and type:

-
$ ./check_ck
+
$ ./test-ck
 
-
-

test suite

-
+
+

test suite

+
-
$ ./check_ck -h
+
$ ./test-ck -h
 ck test suite
 use without flags to run all tests
 
@@ -415,9 +416,9 @@ flags:
 
-
-

manual

-
+
+

manual

+

ck's goal is to assist with the configuration file management. To that end it tries to provides a cli interface that is pretty straight-forward @@ -467,9 +468,9 @@ of flags one has to pass to ck.

-
-

ck configuration

-
+
+

ck configuration

+

ck uses sqlite to index the configuration files. The init action creates a .ck directory (under $HOME) @@ -511,13 +512,13 @@ $ ck -c /someplace/else ...

-
-

Actions

-
+
+

Actions

+
-
-

init

-
+
+

init

+

or i or -i

@@ -547,9 +548,9 @@ $ ck init /path_to/where_you_want/your_configs/to_be -

add

-
+
+

add

+

or a or -a

@@ -590,9 +591,9 @@ $ ck add program_name config_path [-s] [-p]
-
-

list

-
+
+

list

+

or ls or l or -l

@@ -636,9 +637,9 @@ $ ck ls programs -t lisp
-
-

search

-
+
+

search

+

or s or -s

@@ -687,26 +688,49 @@ $ for i ($(ck ls paths)) grep -E 'A|B' $
-
-

edit

-
+
+

edit

+

or e or -e

-=--WIP--= +Edit configurations with $EDITOR.

-Currently edit can only edit the primary config of a program. +Edit takes at least one and up to two arguments.

-To do it use: +The first argument is the programName. If the program has a primary configuration +edit will open this. If the program has only one configuration edit will open it. +If the program has more than 1 configurations and no primary, it will print the +avaliable configurations and exit. +

+ +

+The second argument is the configName. If it exists it will open, else it will +print the avaliable configurations and exit. +

+ +

+Usage:

-
$ ck edit program_name
+
# suppose this is our ck instance
+$ ck list tree -a
+emacs:
+|- init.el
+|- accounts.el [s]
+|- orgconf.org [p]
+
+# edit the primary emacs config
+$ ck edit emacs
+
+# edit a specific emacs config, other than the primary
+$ ck edit emacs accounts.el
 
@@ -715,7 +739,7 @@ To do it use:
-

Created: 2018-10-07 Sun 16:25

+

Created: 2018-10-08 Mon 23:46

Validate

diff --git a/README.org b/README.org index 13c126e..446ff02 100644 --- a/README.org +++ b/README.org @@ -67,14 +67,15 @@ and are bash scripts that test =ck= functionality. Unit tests reside under =unit/= directory and test the code. *** run tests -Simply go to the build dir and type. +First make sure you build ck with the =-DCK_TESTS=1= option. Then +go to the build directory and type: #+BEGIN_SRC sh -$ ./check_ck +$ ./test-ck #+END_SRC *** test suite #+BEGIN_SRC sh -$ ./check_ck -h +$ ./test-ck -h ck test suite use without flags to run all tests @@ -259,11 +260,30 @@ a different pattern matching program you can do it like so: *** edit or e or -e -==--WIP--== +Edit configurations with =$EDITOR=. -Currently edit can only edit the primary config of a program. +Edit takes at least one and up to two arguments. -To do it use: +The first argument is the *programName*. If the program has a primary configuration +edit will open this. If the program has only one configuration edit will open it. +If the program has more than 1 configurations and no primary, it will print the +avaliable configurations and exit. + +The second argument is the *configName*. If it exists it will open, else it will +print the avaliable configurations and exit. + +Usage: #+BEGIN_SRC sh -$ ck edit program_name +# suppose this is our ck instance +$ ck list tree -a +emacs: +|- init.el +|- accounts.el [s] +|- orgconf.org [p] + +# edit the primary emacs config +$ ck edit emacs + +# edit a specific emacs config, other than the primary +$ ck edit emacs accounts.el #+END_SRC diff --git a/res/check_ck b/res/check_ck deleted file mode 100755 index 423d3bd..0000000 --- a/res/check_ck +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash - -BIN=$(realpath @CMAKE_BINARY_DIR@) # solve symlink problems -TEST_LOCATION=$(realpath @PROJECT_TESTING_GROUNDS@) - -# used in regression tests -function running { - echo "[$COUNT/$TOTAL] testing $1" - ((++COUNT)) -} - -# used in regression tests -function init { - running $1 - mkdir -p $TEST_LOCATION/vc - mkdir $TEST_LOCATION/sec - - exec $BIN/ck conf $BIN init $TEST_LOCATION/vc $TEST_LOCATION/sec > /dev/null & - wait $! -} - -function add_config { - echo -e "test $2\n$3" > $2 - exec $BIN/ck -c $BIN -a $1 $2 > /dev/null & - wait $! - - if [ $? -ne 0 ]; then - err "ck crashed." - fi -} - -function clear_tests { - rm $BIN/ckrc - rm $BIN/ckdb - rm $BIN/test*.conf - rm -rf $TEST_LOCATION -} - -function unit_tests { - echo -e "Unit Tests:" - echo -e "~~~~~~~~~~~" - ./ck-test -} - -function regression_tests { - echo -e "Regression Tests:" - echo -e "~~~~~~~~~~~~~~~~~" - DIR=@BIN_TESTS_DIR@ - COUNT=1 - TOTAL=$(ls $DIR | wc -l) - for i in $(ls $DIR); do - ERROR="TEST "$i" FAILED:" - PASS="=> $i passed\n" - source $DIR/$i - wait $! - done -} - -function err { - echo -e "$ERROR $1" - clear_tests - exit 1 -} - -function run { - unit_tests - regression_tests -} - -function print_help { - echo -e "ck test suite" - echo -e "use without flags to run all tests" - echo -e "\nflags:" - echo -e " -u, --unit\t\trun only the unit tests" - echo -e " -r, --regression\trun only the regression tests" - echo -e " -c, --clear\t\tremove test files" - echo -e " \t\t use if the tests crush unexpectedly" - echo -e " -h, --help, *\t\tprint this" - exit -} - -if [[ $# -gt 1 ]]; then - print_help -fi - -while [[ $# -gt 0 ]] -do - key="$1" - case $key in - -h | --help) - print_help - ;; - -c | --clear) - clear_tests - exit - ;; - -u | --unit) - unit_tests - exit - ;; - -r | --regression) - regression_tests - exit - ;; - *) # unknown option - print_help - exit - ;; - esac -done - -run diff --git a/res/test-ck b/res/test-ck new file mode 100755 index 0000000..423d3bd --- /dev/null +++ b/res/test-ck @@ -0,0 +1,112 @@ +#!/bin/bash + +BIN=$(realpath @CMAKE_BINARY_DIR@) # solve symlink problems +TEST_LOCATION=$(realpath @PROJECT_TESTING_GROUNDS@) + +# used in regression tests +function running { + echo "[$COUNT/$TOTAL] testing $1" + ((++COUNT)) +} + +# used in regression tests +function init { + running $1 + mkdir -p $TEST_LOCATION/vc + mkdir $TEST_LOCATION/sec + + exec $BIN/ck conf $BIN init $TEST_LOCATION/vc $TEST_LOCATION/sec > /dev/null & + wait $! +} + +function add_config { + echo -e "test $2\n$3" > $2 + exec $BIN/ck -c $BIN -a $1 $2 > /dev/null & + wait $! + + if [ $? -ne 0 ]; then + err "ck crashed." + fi +} + +function clear_tests { + rm $BIN/ckrc + rm $BIN/ckdb + rm $BIN/test*.conf + rm -rf $TEST_LOCATION +} + +function unit_tests { + echo -e "Unit Tests:" + echo -e "~~~~~~~~~~~" + ./ck-test +} + +function regression_tests { + echo -e "Regression Tests:" + echo -e "~~~~~~~~~~~~~~~~~" + DIR=@BIN_TESTS_DIR@ + COUNT=1 + TOTAL=$(ls $DIR | wc -l) + for i in $(ls $DIR); do + ERROR="TEST "$i" FAILED:" + PASS="=> $i passed\n" + source $DIR/$i + wait $! + done +} + +function err { + echo -e "$ERROR $1" + clear_tests + exit 1 +} + +function run { + unit_tests + regression_tests +} + +function print_help { + echo -e "ck test suite" + echo -e "use without flags to run all tests" + echo -e "\nflags:" + echo -e " -u, --unit\t\trun only the unit tests" + echo -e " -r, --regression\trun only the regression tests" + echo -e " -c, --clear\t\tremove test files" + echo -e " \t\t use if the tests crush unexpectedly" + echo -e " -h, --help, *\t\tprint this" + exit +} + +if [[ $# -gt 1 ]]; then + print_help +fi + +while [[ $# -gt 0 ]] +do + key="$1" + case $key in + -h | --help) + print_help + ;; + -c | --clear) + clear_tests + exit + ;; + -u | --unit) + unit_tests + exit + ;; + -r | --regression) + regression_tests + exit + ;; + *) # unknown option + print_help + exit + ;; + esac +done + +run diff --git a/src/actionhelper.c b/src/actionhelper.c index 883229f..3e898af 100644 --- a/src/actionhelper.c +++ b/src/actionhelper.c @@ -15,6 +15,9 @@ #include #include "actionhelper.h" +#include "ckerrlog.h" + +ERRLOG(action); char add_err[STR_M] = ""; @@ -146,11 +149,8 @@ void add_make_link(const AddOpt *opt, const Conf *conf) { } } -edit_rc -edit_get_config_or_suggestions(cklist *args, char *ret) { +int edit_make_options(cklist *args) { UNUSED(args); - UNUSED(ret); - return ERC_ERR; } ListOpt list_make_options(cklist *args) { @@ -210,50 +210,48 @@ ListOpt list_make_options(cklist *args) { void print_INIT_result(int err) { if (!err) { - printf("Initialized empty ckdb.\n"); + HELP("Initialized empty ckdb."); } } void print_ADD_result(int err) { if (!err) { - printf("ckdb updated succesfully.\n"); + HELP("ckdb updated succesfully."); return; } - printf("Could not complete add transaction.\n"); + ERR("Could not complete add transaction."); } void print_DEL_result(int err) { if (!err) { - printf("succes\n"); + HELP("ckdb updated succesfully"); return; } - printf("Not Supported\n"); + ERR("Could not complete delete transaction"); } void print_EDIT_result(int err) { if (!err) { - printf("succes\n"); return; } - printf("failure\n"); } void print_LIST_result(int err) { if (!err) { return; } - printf("Wrong list arguments\n"); + ERR("Wrong list arguments"); } void print_SEARCH_result(int err) { if (err == 2) { - printf("No grep avaliable. Please make sure you have grep installed.\n"); + ERR("No grep avaliable. Please make sure you have grep installed."); return; } if (!err) { return; } - printf("Wrong search.\n"); + ERR("Wrong search."); } void print_HELP_result(int err) { diff --git a/src/actionparser.c b/src/actionparser.c index 25c7c19..7c1186a 100644 --- a/src/actionparser.c +++ b/src/actionparser.c @@ -332,7 +332,7 @@ void print_parser_error(UserOpt *opt) { sprintf(errStr, "Delete config or program\nUsage: %s ....", names); break; case PERR_EDIT_WRONG: - sprintf(errStr, "Edit config with $EDITOR\nUsage: %s ProgramName or configBasename (or both)", names); + sprintf(errStr, "Edit config with $EDITOR (%s)\nUsage: %s ProgramName [configBasename]", getenv("EDITOR"), names); break; case PERR_LIST_WRONG: sprintf(errStr, "List programs, configs and more\nUsage: %s value-to-list (or tree) [-t list-type] [-a]", names); diff --git a/src/actions.c b/src/actions.c index d5f9a29..4ff6816 100644 --- a/src/actions.c +++ b/src/actions.c @@ -102,7 +102,6 @@ int run_DEL(UserOpt * opt, Conf *conf) { } int run_EDIT(UserOpt *opt, Conf *conf) { - printf("Running %s\n", "edit"); DB db = open_DB(opt); if (db.ptr == NULL) { if (db.error == SQL_ERR_NO_TABLES) { @@ -112,31 +111,52 @@ int run_EDIT(UserOpt *opt, Conf *conf) { } list_rewind(opt->args); - char confPath[STR_M]; - if (list_size(opt->args) == 1) { - char confName[STR_M]; - int secret = 0; - if (edit_get_prime_config_from_program(&db, list_get(opt->args), confName, &secret) == 1) { - str_join_dirname_with_basename(confPath, secret ? conf->scrt_dir : conf->vc_dir, confName); - printf("%s\n", confPath); - } else { - PRINT_ERR("No primary config"); - close_DB(&db); - return 1; + char confPath[STR_L]; + char confName[STR_M]; + int secret = 0; + /* Since we are here, args have to be 1 or 2 */ + char *pName = list_get(opt->args); + if (!program_exists(&db, pName)) { + ERR("Program %s doesn't exist in the database.", pName); + goto error; + } + /* If there is no next argument */ + if (!list_next(opt->args)) { + /* If there is no primary config*/ + if (edit_get_prime_config_from_program(&db, pName, confName, &secret) == -1) { + /* If the program has only one config */ + if (get_config_number(&db, pName) == 1) { + if (edit_get_config(&db, pName, confName, NULL, &secret)) { + ERR("Coudln't find config file for %s", pName); + goto error; + } + } + /* If the program has many configs */ + else { + HELP("Ambiguous config. Please type the config name after the program."); + cklist *paths = list_make_new(); + edit_get_avaliable_paths(&db, paths, pName); + list_print(paths); + list_free(paths); + goto error; + } } - } else { - close_DB(&db); - char confName[STR_L]; - switch (edit_get_config_or_suggestions(opt->args, confName)) { - case ERC_OK: - return 0; - case ERC_ERR: - return 1; - case ERC_SUGGESTIONS: - return 1; + } + /* If there are more arguments */ + else { + char *cName = list_get(opt->args); + if (edit_get_config(&db, pName, confName, cName, &secret)) { + ERR("Program %s doesn't have a config named %s", pName, cName); + cklist *paths = list_make_new(); + edit_get_avaliable_paths(&db, paths, pName); + list_print(paths); + list_free(paths); + goto error; } } close_DB(&db); + str_join_dirname_with_basename(confPath, secret ? conf->scrt_dir : conf->vc_dir, confName); + HELP("Editing %s", confPath); char *editor = getenv("EDITOR"); char command[STR_L]; @@ -145,6 +165,9 @@ int run_EDIT(UserOpt *opt, Conf *conf) { strcat(command, confPath); system(command); return 0; + error: + close_DB(&db); + return 1; } int run_LIST(UserOpt *opt, Conf *conf) { @@ -157,45 +180,44 @@ int run_LIST(UserOpt *opt, Conf *conf) { return 1; } - cklist *list_type = list_make_new(); + cklist *the_list = list_make_new(); ListOpt listOpt = list_make_options(opt->args); if (listOpt.err) { - close_DB(&db); - list_free(list_type); - return 1; + goto error; } switch(listOpt._lt) { case LT_PATH: - list_get_paths(&db, list_type, listOpt.attr); + list_get_paths(&db, the_list, listOpt.attr); break; case LT_PROGRAM: - list_get_programs(&db, list_type); + list_get_programs(&db, the_list); break; case LT_TREE: - list_get_path_program_tree(&db, list_type, listOpt.attr); - list_print(list_type); - close_DB(&db); - list_free(list_type); - return 0; + list_get_path_program_tree(&db, the_list, listOpt.attr); + list_print(the_list); + goto close; case LT_NONE: - close_DB(&db); - list_free(list_type); - return 1; + goto error; } switch(listOpt._lst) { case LST_PLAIN: - list_print(list_type); + list_print(the_list); break; case LST_LISP: - list_print_lisp(list_type); + list_print_lisp(the_list); break; case LST_PYTHON: - list_print_python(list_type); + list_print_python(the_list); } + close: close_DB(&db); - list_free(list_type); + list_free(the_list); return 0; + error: + close_DB(&db); + list_free(the_list); + return 1; } FILE *popen(const char *command, const char *mode); diff --git a/src/ckutil.c b/src/ckutil.c index a477b36..9bfa139 100644 --- a/src/ckutil.c +++ b/src/ckutil.c @@ -97,13 +97,11 @@ int util_symlink_file(const char *path, const char* dest) { } void str_make_ck_config_name(char *ret, const char *path, - const char *progName) { + const char *progName) { char *basec = strdup(path); char *bname = basename(basec); - strcpy(ret, progName); - strcat(ret, "_"); - strcat(ret, bname); + str_join_dirname_with_basename(ret, progName, bname); free(basec); } diff --git a/src/dblayer.c b/src/dblayer.c index 8ec062c..4290a7a 100644 --- a/src/dblayer.c +++ b/src/dblayer.c @@ -12,6 +12,8 @@ * Give access to the database. * * -------------------------------------------------------------------------- */ +#include + #include "dblayer.h" #include "dbhelper.h" #include "ckutil.h" @@ -254,6 +256,13 @@ int get_program_id(DB *db, const char* name) { return id; } +int program_exists(DB *db, const char *pName) { + if (get_program_id(db, pName) == -1) { + return 0; + } + return 1; +} + int get_config_id(DB *db, const char* path) { sqlite3_stmt *stmt; int rc; @@ -281,7 +290,6 @@ int add_insert_relationship(DB *db, const int pid, const int cid) { return insert_to_rel_table(db, pid, cid); } - /* Returns the path of the found config via *ret */ int program_has_primary_config(DB *db, const int pid, char *ret, int *sec) { sqlite3_stmt *stmt; @@ -403,13 +411,116 @@ int edit_get_prime_config_from_program(DB *db, char *pName, char *ret, int *secr str_make_ck_config_name(confName, path, pName); strcpy(ret, confName); } - return 1; + return 0; } } } /* No prime config found */ - return 0; + return -1; +} + +int edit_get_config(DB *db, const char *pName, char *ret, const char *cName, int *sec) { + int pid = get_program_id(db, pName); + /* error */ + if (pid == -2) { + return -1; + } + + /* program exists */ + if (pid > -1) { + sqlite3_stmt *stmt; + int rc; + + char selection[STR_M] = COL_CONFIG_PATH; + strcat(selection, ", "); + strcat(selection, COL_CONFIG_SECRET); + char condition[STR_M] = TBL_PROGRAM; + strcat(condition, "."); + strcat(condition, COL_PROGRAM_ID); + + char sql[STR_L]; + dbh_form_query_select_from_joined_eq(sql, selection, condition); + + rc = sqlite3_prepare_v2(db->ptr, sql, -1, &stmt, 0); + sqlite3_bind_int(stmt, 1, pid); + if (rc != SQLITE_OK) { + return -2; + } + + int flag = -1; + while (sqlite3_step(stmt) == SQLITE_ROW) { + char confName[STR_M]; + if (cName) { + char *tmp = strdup((char *)sqlite3_column_text(stmt, 0)); + if (strcmp(cName, basename(tmp)) == 0) { + flag = 0; + char confName[STR_M]; + str_make_ck_config_name(confName, (char *)sqlite3_column_text(stmt, 0), pName); + strcpy(ret, confName); + if (sec) { + *sec = sqlite3_column_int(stmt, 1); + } + } + free(tmp); + } + else { + char confName[STR_M]; + str_make_ck_config_name(confName, (char *)sqlite3_column_text(stmt, 0), pName); + strcpy(ret, confName); + flag = 0; + if (sec) { + *sec = sqlite3_column_int(stmt, 1); + } + break; + } + } + sqlite3_finalize(stmt); + return flag; + } +} + +int edit_get_avaliable_paths(DB *db, cklist *ckl, const char* pName) { + int pid = get_program_id(db, pName); + /* error */ + if (pid == -2) { + return -1; + } + + /* program exists */ + if (pid > -1) { + sqlite3_stmt *stmt; + int rc; + + char selection[STR_M] = COL_CONFIG_PATH; + char condition[STR_M] = TBL_PROGRAM; + strcat(condition, "."); + strcat(condition, COL_PROGRAM_ID); + + char sql[STR_L]; + dbh_form_query_select_from_joined_eq(sql, selection, condition); + + rc = sqlite3_prepare_v2(db->ptr, sql, -1, &stmt, 0); + sqlite3_bind_int(stmt, 1, pid); + if (rc != SQLITE_OK) { + return -2; + } + + char name[STR_M] = ""; + strcat(name, pName); + strcat(name, ":"); + list_add(ckl, name); + while (sqlite3_step(stmt) == SQLITE_ROW) { + char *tmp = strdup((char *)sqlite3_column_text(stmt, 0)); + char entry[STR_M] = ""; + strcat(entry, "|- "); + strcat(entry, basename(tmp)); + list_add(ckl, entry); + free(tmp); + } + sqlite3_finalize(stmt); + return 0; + } } int list_get_paths(DB *db, cklist *ckl, int attr) { @@ -619,6 +730,19 @@ int get_program_relations(DB *db, int pid) { return count; } +int get_config_number(DB *db, char* pName) { + int pid = get_program_id(db, pName); + /* error */ + if (pid == -2) { + return -1; + } + + /* program exists */ + if (pid > -1) { + return get_program_relations(db, pid); + } +} + /* Removes the relationship of `cid` with the corresponding program. * Returns the program's pid on succes, negative integer otherwise. */ diff --git a/src/dblayer.h b/src/dblayer.h index cf01ccf..05ba5bd 100644 --- a/src/dblayer.h +++ b/src/dblayer.h @@ -41,7 +41,8 @@ extern int db_exists(const UserOpt *opt); * and the corresponding SQL error (NO_DB_FILE | NO_TABLES)*/ extern DB open_DB(const UserOpt *opt); -extern void close_DB(DB *DB); +extern void close_DB(DB *db); +extern int program_exists(DB *db, const char *pName); /********/ /* init */ @@ -63,6 +64,9 @@ extern int add_transaction_try(DB *db, const AddOpt * const opt); /********/ extern int edit_get_prime_config_from_program(DB *db, char *pName, char *ret, int *secret); +extern int get_config_number(DB *db, char *pName); +extern int edit_get_config(DB *db, const char *pName, char *ret, const char *cName, int *sec); +extern int edit_get_avaliable_paths(DB *db, cklist *ckl, const char* pName); /********/ /* list */ -- cgit v1.2.3