diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cla_parse.c | 4 | ||||
| -rw-r--r-- | src/create_pkg.c | 1 | ||||
| -rw-r--r-- | src/find.c | 23 | ||||
| -rw-r--r-- | src/update_all.c | 5 |
4 files changed, 29 insertions, 4 deletions
diff --git a/src/cla_parse.c b/src/cla_parse.c index 91dca3f..6bac273 100644 --- a/src/cla_parse.c +++ b/src/cla_parse.c @@ -8,6 +8,7 @@ #include "build.h" #include "create_pkg.h" #include "declare.h" +#include "find.h" #include "help.h" #include "install_pkg.h" #include "list_pkgs.h" @@ -34,7 +35,7 @@ void cla_parse(int argc, char **argv) { } for (int i = 1; i < argc; i++) { - COMMAND("--large", "-l", { is_symlink_install = true; }); + COMMAND("--link", "-l", { is_symlink_install = true; }); COMMAND("add", "a", { if (argv[i + 1]) { add_repo(argv[i + 1], name_from_url(argv[i + 1])); @@ -80,6 +81,7 @@ void cla_parse(int argc, char **argv) { COMMAND("update", "u", { update_all(); }); COMMAND("declare", "d", { declare(); }); COMMAND("list", "l", { list_pkgs(); }); + COMMAND("find", "f", { find(); }); COMMAND("--version", "-v", { printf("%s\n", version); }); COMMAND("--help", "-h", { help(); }); COMMAND("--check", "-c", { resolve_deps(); return; }); diff --git a/src/create_pkg.c b/src/create_pkg.c index 4f4781e..056a3ad 100644 --- a/src/create_pkg.c +++ b/src/create_pkg.c @@ -18,7 +18,6 @@ Pkg create_pkg(const char *arg, const char *target) { for (int i = 0; i < cached_repos_count; i++) { if (strcmp(cached_repos[i].source_key, arg) == 0) { pkg.ver = cached_repos[i].version; - printf("THIS IS THE VERSION NUMBER: %s\n", pkg.ver); } } diff --git a/src/find.c b/src/find.c new file mode 100644 index 0000000..aaeaaa2 --- /dev/null +++ b/src/find.c @@ -0,0 +1,23 @@ +#include <dirent.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> + +#include "lua_state.h" +#include "vars.h" + +void find() { + char* src_code = map_get(&cached_install_directories, "src"); + struct dirent* dirent_ptr; + DIR* dir_ptr = opendir(src_code); + + if (dir_ptr == NULL) { + fprintf(stderr, "%scould not open %s\n", print_pkgit, src_code); + return; + } + + while ((dirent_ptr = readdir(dir_ptr)) != NULL) { + if (strcmp(dirent_ptr->d_name, "..") == 0 || strcmp(dirent_ptr->d_name, ".") == 0) { continue; } + printf("%s\n", dirent_ptr->d_name); + } +} diff --git a/src/update_all.c b/src/update_all.c index ff0f54d..85ad613 100644 --- a/src/update_all.c +++ b/src/update_all.c @@ -19,11 +19,12 @@ void update_all() { cache_repos(); struct dirent* dirent_ptr; DIR* dir_ptr; - if ((dir_ptr = opendir(src)) == NULL) { - fprintf(stderr, "%scould not open %s\n", print_pkgit, src); + if ((dir_ptr = opendir(get_install_dir("src"))) == NULL) { + fprintf(stderr, "%scould not open %s\n", print_pkgit, get_install_dir("src")); } while ((dirent_ptr = readdir(dir_ptr)) != NULL) { if (strcmp(dirent_ptr->d_name, "..") == 0 || strcmp(dirent_ptr->d_name, ".") == 0) continue; + printf("%sUpdating package: %s\n", print_pkgit, dirent_ptr->d_name); struct stat stat_buf; FILE* file_ptr = fopen(dirent_ptr->d_name, "r"); if (!file_ptr) { continue; } |
