aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actionhelper.h24
-rw-r--r--src/actionparser.h8
-rw-r--r--src/actions.h2
-rw-r--r--src/ckerrlog.c2
-rw-r--r--src/ckerrlog.h8
-rw-r--r--src/ckinfo.h.in2
-rw-r--r--src/cklist.h41
-rw-r--r--src/ckutil.h30
-rw-r--r--src/confparser.h8
-rw-r--r--src/dbhelper.h32
-rw-r--r--src/dblayer.h34
11 files changed, 96 insertions, 95 deletions
diff --git a/src/actionhelper.h b/src/actionhelper.h
index 3f16ce3..0c96a8a 100644
--- a/src/actionhelper.h
+++ b/src/actionhelper.h
@@ -24,7 +24,7 @@
/* INIT */
/********/
-extern int init_create_config_file(UserOpt *opt);
+int init_create_config_file(UserOpt *opt);
/*******/
/* ADD */
@@ -33,36 +33,36 @@ extern int init_create_config_file(UserOpt *opt);
/* if add_err is set, return true
* along with a copy of the error message.
* Pass NULL if you don't care about the message */
-extern int add_err_message(char *err);
-extern AddOpt add_make_options(cklist *args);
-extern void add_print_opts(AddOpt *opt);
-extern void add_make_link(const AddOpt *opt, const Conf *conf);
+int add_err_message(char *err);
+AddOpt add_make_options(cklist *args);
+void add_print_opts(AddOpt *opt);
+void add_make_link(const AddOpt *opt, const Conf *conf);
/********/
/* EDIT */
/********/
-extern void edit_print_suggested_configs(DB *db, const char *pName);
+void edit_print_suggested_configs(DB *db, const char *pName);
/********/
/* LIST */
/********/
-extern ListOpt list_make_options(cklist *args);
+ListOpt list_make_options(cklist *args);
/***********/
/* RESTORE */
/***********/
-extern int restore_make_links(cklist *from, cklist *to);
+int restore_make_links(cklist *from, cklist *to);
/************************/
/* PRINT RESULTS & HELP */
/************************/
#define X(ACTION) \
- extern void print_##ACTION##_result(int err); \
- extern void print_##ACTION##_help(void);
+ void print_##ACTION##_result(int err); \
+ void print_##ACTION##_help(void);
CK_ACTIONS
#undef X
-extern void print_conf_help(void);
-extern void print_verbose_help(void);
+void print_conf_help(void);
+void print_verbose_help(void);
#endif /* ACTIONHELPER_H */
diff --git a/src/actionparser.h b/src/actionparser.h
index 0a28511..0b8d2da 100644
--- a/src/actionparser.h
+++ b/src/actionparser.h
@@ -68,9 +68,9 @@ struct UserOptions {
/* Parse cli args, fill UserOpt struct
* and return the result enum */
-extern int parse_action(int argc, const char **argv, UserOpt *opt);
-extern CkAction parser_get_action(const char *name, char *actionName);
-extern void get_possible_action_strings(char *dest, CkAction ckAction);
-extern void free_user_opt(UserOpt *opt);
+int parse_action(int argc, const char **argv, UserOpt *opt);
+CkAction parser_get_action(const char *name, char *actionName);
+void get_possible_action_strings(char *dest, CkAction ckAction);
+void free_user_opt(UserOpt *opt);
#endif // ACTIONPARSER_H
diff --git a/src/actions.h b/src/actions.h
index 4bd0c9e..aa8cf44 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -21,7 +21,7 @@
#include "confparser.h"
#define X(ACTION) \
- extern int run_##ACTION(UserOpt *, Conf *);
+ int run_##ACTION(UserOpt *, Conf *);
CK_ACTIONS
#undef X
diff --git a/src/ckerrlog.c b/src/ckerrlog.c
index fe4c688..fab18b0 100644
--- a/src/ckerrlog.c
+++ b/src/ckerrlog.c
@@ -119,7 +119,7 @@ void ckerr_add_component(char *txt, ...) {
va_end(args);
}
-extern void errlog_set_verbose(int level) {
+void errlog_set_verbose(int level) {
loglvl = level;
}
diff --git a/src/ckerrlog.h b/src/ckerrlog.h
index bf0c0a5..a4cc9e1 100644
--- a/src/ckerrlog.h
+++ b/src/ckerrlog.h
@@ -48,12 +48,12 @@
X(logv) \
X(help)
-extern void initialize_errlog(int argc, const char** argv);
-extern void report_errlog();
-extern void errlog_set_verbose(int level);
+void initialize_errlog(int argc, const char** argv);
+void report_errlog();
+void errlog_set_verbose(int level);
#define X(stream) \
- extern void ck## stream(const char *log, ...); \
+ void ck## stream(const char *log, ...); \
void ck## stream ##_with_delim(const char *d,const char *txt, ...); \
void report_## stream();
CK_STREAMS
diff --git a/src/ckinfo.h.in b/src/ckinfo.h.in
index 832532f..07ffa69 100644
--- a/src/ckinfo.h.in
+++ b/src/ckinfo.h.in
@@ -23,7 +23,7 @@
#define CK_PATCH_VERSION @ck_PATCH_VERSION@
-extern void print_version() {
+void print_version() {
printf("ck version %d.%d.%d\n", CK_MAJOR_VERSION,
CK_MINOR_VERSION, CK_PATCH_VERSION);
printf("%s", "ck Copyright (C) 2018 gramanas\n"
diff --git a/src/cklist.h b/src/cklist.h
index dcc6763..6ce8960 100644
--- a/src/cklist.h
+++ b/src/cklist.h
@@ -14,49 +14,50 @@
* -------------------------------------------------------------------------- */
#ifndef CKLIST_H
#define CKLIST_H
-typedef struct cklist_st cklist;
+
struct cklist_st {
unsigned int size;
unsigned int pos;
char **arr;
};
+typedef struct cklist_st cklist;
-extern cklist* list_make_new();
-extern void list_add(cklist *ckl, const char *str);
-extern cklist* list_make_and_add(const char *str);
-extern void list_rewind(cklist *ckl);
+cklist* list_make_new();
+void list_add(cklist *ckl, const char *str);
+cklist* list_make_and_add(const char *str);
+void list_rewind(cklist *ckl);
-extern int list_next(cklist *ckl);
-extern char* list_get(cklist *ckl);
-extern char* list_get_at(cklist *ckl,unsigned int pos);
+int list_next(cklist *ckl);
+char* list_get(cklist *ckl);
+char* list_get_at(cklist *ckl, unsigned int pos);
-extern unsigned int list_size(cklist *ckl);
+unsigned int list_size(cklist *ckl);
/* rewinds */
-extern cklist* list_duplicate(cklist *ckl);
+cklist* list_duplicate(cklist *ckl);
/* rewinds */
-extern cklist* list_move(cklist *ckl);
+cklist* list_move(cklist *ckl);
/* rewinds
* copy from index (>=) to the end */
-extern cklist* list_copy_from(cklist *ckl,unsigned int index);
+cklist* list_copy_from(cklist *ckl, unsigned int index);
/* rewinds
* copy from the start until (<) index*/
-extern cklist* list_copy_until(cklist *ckl,unsigned int index);
+cklist* list_copy_until(cklist *ckl, unsigned int index);
/* rewinds
* copy from (>=) until (<) */
-extern cklist* list_copy_part(cklist *ckl,unsigned int from,unsigned int until);
+cklist* list_copy_part(cklist *ckl ,unsigned int from, unsigned int until);
/* return 1 if str exists in the list, 0 otherwise */
-extern int list_exists(cklist *ckl, const char *str);
+int list_exists(cklist *ckl, const char *str);
/* rewinds */
-extern void list_print_lisp(cklist *ckl);
-extern void list_print_python(cklist *ckl);
-extern void list_print(cklist *ckl);
-extern void list_print_concat(cklist *ckl);
+void list_print_lisp(cklist *ckl);
+void list_print_python(cklist *ckl);
+void list_print(cklist *ckl);
+void list_print_concat(cklist *ckl);
/* Deallocate resources */
-extern void list_free(cklist *ckl);
+void list_free(cklist *ckl);
#endif /* CKLIST_H */
diff --git a/src/ckutil.h b/src/ckutil.h
index 3003a45..d29b302 100644
--- a/src/ckutil.h
+++ b/src/ckutil.h
@@ -48,55 +48,55 @@
/* Create the config name to be used when storing a new config to
* the VC or SCRT dir */
-extern void str_make_ck_config_name(char *ret, const char *path,
+void str_make_ck_config_name(char *ret, const char *path,
const char *progName);
/* Joins the two strings into ret, with a '/' in between */
-extern void str_join_dirname_with_basename(char *ret, const char *path,
+void str_join_dirname_with_basename(char *ret, const char *path,
const char *progName);
/* Returns 1 if str contains only whitespace, or nothing,
* else returns 0. */
-extern int str_is_empty(const char *s);
+int str_is_empty(const char *s);
-extern char *swap_tilde_with_home(char *ret, const char *s, const char *home);
-extern char *swap_home_with_tilde(char *ret, const char *s, const char *home);
+char *swap_tilde_with_home(char *ret, const char *s, const char *home);
+char *swap_home_with_tilde(char *ret, const char *s, const char *home);
/*********************/
/* utility functions */
/*********************/
/* Returns 1 if path is a directory, else returns 0. */
-extern int util_is_dir(const char *path);
+int util_is_dir(const char *path);
/* Returns 1 if file(or dir) exists, else returns 0.
* Pass a char array in absPath to get the absolute path
* of the file it it exists. Pass NULL if no need. */
-extern int util_file_exists(const char *path, char *absPath);
+int util_file_exists(const char *path, char *absPath);
/* Returns 1 if file(or dir) is readable and writable,
* else returns 0. */
-extern int util_is_file_rw(const char *path);
+int util_is_file_rw(const char *path);
/* Returns 1 if file is link 0 otherwise */
-extern int util_is_file_link(const char *path);
+int util_is_file_link(const char *path);
/* Wrapper around mkdir with 0775 permissions */
-extern void util_mkdir(const char *path);
+void util_mkdir(const char *path);
/* Moves file from path, to destination
* keeping the same permissions.
* Only deletes original on successful copy */
-extern int util_move_file(const char *path, const char* dest);
+int util_move_file(const char *path, const char* dest);
/* Wrapper around symlink() */
-extern int util_symlink_file(const char *path, const char* dest);
+int util_symlink_file(const char *path, const char* dest);
/* Chnage owner and group of `new` and make it like `old`*/
-extern int util_own_grp_copy(const char *new, const char* old);
+int util_own_grp_copy(const char *new, const char* old);
-extern int util_is_link_owned_by_root(const char *link);
+int util_is_link_owned_by_root(const char *link);
/* yes is 1, no is 0 */
-extern int y_or_n_prompt();
+int y_or_n_prompt();
#endif // CKUTIL_H
diff --git a/src/confparser.h b/src/confparser.h
index 3e772fc..d8013e0 100644
--- a/src/confparser.h
+++ b/src/confparser.h
@@ -40,9 +40,9 @@ struct ConfigValues {
};
/* Parse the configuration file and fill the conf struct */
-extern int config_file_parse(Conf *conf, UserOpt *opt);
+int config_file_parse(Conf *conf, UserOpt *opt);
-extern void make_config_name(char * ret, const char *confPath);
-extern void initialize_conf(Conf *conf);
-extern void free_conf(Conf *conf);
+void make_config_name(char * ret, const char *confPath);
+void initialize_conf(Conf *conf);
+void free_conf(Conf *conf);
#endif // CONFPARSER_H
diff --git a/src/dbhelper.h b/src/dbhelper.h
index 8f664d0..86e3a99 100644
--- a/src/dbhelper.h
+++ b/src/dbhelper.h
@@ -46,20 +46,20 @@
/* form queries */
/****************/
-extern void dbh_form_query_make_tables(char *query);
-extern void dbh_form_query_insert_program(char *query);
-extern void dbh_form_query_insert_config(char *query);
-extern void dbh_form_query_select_id_from(char *query, const char* tableName);
-extern void dbh_form_query_select_all_tables(char *query);
-extern void dhb_form_query_insert_relationship(char *query);
-extern void dhb_form_query_find_program(char *query);
-extern void dhb_form_query_find_config(char *query);
-extern void dhb_form_query_find_relationship(char *query);
-extern void dbh_form_query_select_paths_with_attributes(char *query);
-extern void dbh_form_query_select_programs(char *query);
-extern void dbh_form_query_select_from_joined_eq(char *query, const char *selection, const char* condition);
-extern void dbh_form_query_select_from_joined_like(char *query, const char *selection, const char* condition);
-extern void dbh_form_query_delete_x_from_y(char *query, const char *x, const char *y);
-extern void dbh_form_query_count_program_relations(char *query);
-extern void dbh_form_query_get_pid_from_cid(char *query);
+void dbh_form_query_make_tables(char *query);
+void dbh_form_query_insert_program(char *query);
+void dbh_form_query_insert_config(char *query);
+void dbh_form_query_select_id_from(char *query, const char* tableName);
+void dbh_form_query_select_all_tables(char *query);
+void dhb_form_query_insert_relationship(char *query);
+void dhb_form_query_find_program(char *query);
+void dhb_form_query_find_config(char *query);
+void dhb_form_query_find_relationship(char *query);
+void dbh_form_query_select_paths_with_attributes(char *query);
+void dbh_form_query_select_programs(char *query);
+void dbh_form_query_select_from_joined_eq(char *query, const char *selection, const char* condition);
+void dbh_form_query_select_from_joined_like(char *query, const char *selection, const char* condition);
+void dbh_form_query_delete_x_from_y(char *query, const char *x, const char *y);
+void dbh_form_query_count_program_relations(char *query);
+void dbh_form_query_get_pid_from_cid(char *query);
#endif /* DBHELPER_H */
diff --git a/src/dblayer.h b/src/dblayer.h
index 199471a..0d012bb 100644
--- a/src/dblayer.h
+++ b/src/dblayer.h
@@ -35,57 +35,57 @@ struct DBstruct {
SqlError error;
};
-extern int db_exists(const UserOpt *opt);
+int db_exists(const UserOpt *opt);
/* Open the db file. On fail return null pointer to db
* and the corresponding SQL error (NO_DB_FILE | NO_TABLES)*/
-extern DB open_DB(const UserOpt *opt);
+DB open_DB(const UserOpt *opt);
-extern void close_DB(DB *db);
-extern int program_exists(DB *db, const char *pName);
-extern int get_program_paths(DB *db, cklist *ckl, const char* pName, int bName, int attr, const char *home);
+void close_DB(DB *db);
+int program_exists(DB *db, const char *pName);
+int get_program_paths(DB *db, cklist *ckl, const char* pName, int bName, int attr, const char *home);
/********/
/* init */
/********/
/* Create the tables required for the ckdb */
-extern void init_make_tables(DB *db);
-extern DB init_make_DB(const UserOpt *opt);
+void init_make_tables(DB *db);
+DB init_make_DB(const UserOpt *opt);
/*******/
/* add */
/*******/
/* Returns 1 in error, 0 otherwise */
-extern int add_transaction_try(DB *db, const AddOpt * const opt, const char *home);
+int add_transaction_try(DB *db, const AddOpt * const opt, const char *home);
/********/
/* edit */
/********/
-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);
+int edit_get_prime_config_from_program(DB *db, char *pName, char *ret, int *secret);
+int get_config_number(DB *db, char *pName);
+int edit_get_config(DB *db, const char *pName, char *ret, const char *cName, int *sec);
/********/
/* list */
/********/
-extern int list_get_paths(DB *db, cklist *ckl, int bName, int attr, const char *home);
-extern int list_get_programs(DB *db, cklist *ckl);
-extern int list_get_path_program_tree(DB *db, cklist *ckl, int bName, int attr, const char *home);
+int list_get_paths(DB *db, cklist *ckl, int bName, int attr, const char *home);
+int list_get_programs(DB *db, cklist *ckl);
+int list_get_path_program_tree(DB *db, cklist *ckl, int bName, int attr, const char *home);
/*******/
/* del */
/*******/
-extern int del_transaction_try(DB *db, const char *pName, const char *cBaseName);
+int del_transaction_try(DB *db, const char *pName, const char *cBaseName);
/***********/
/* restore */
/***********/
-extern int restore_configs_exists(DB *db, Conf *conf, const char *pName, cklist *from, cklist *to);
-extern int restore_all_exist(DB *db, Conf *conf, cklist *from, cklist *to);
+int restore_configs_exists(DB *db, Conf *conf, const char *pName, cklist *from, cklist *to);
+int restore_all_exist(DB *db, Conf *conf, cklist *from, cklist *to);
#endif /* DBLAYER_H */