pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 93c90c6b9d04d01fc6d7b5eefcb0ca488512beb7
parent 2c21ea32dfdc263efdc030050d16a88f28c2dd48
Author: z3bra <willyatmailoodotorg>
Date:   Tue Jan  5 18:57:36 2016

Add comments to all functions

Diffstat:
 pm.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/pm.c b/pm.c @@ -68,7 +68,7 @@ usage(char *name) /* - * returns 0 if a directory is empty, -1 otherwise + * Returns 0 if a directory is empty, -1 otherwise */ int is_empty(char *dir) @@ -92,7 +92,7 @@ is_empty(char *dir) /* - * recursive mkdir, taken from the ii project + * Recursive mkdir, taken from the ii project * http://nion.modprobe.de/blog/archives/357-Recursive-directory-creation.html */ int @@ -117,7 +117,7 @@ mkdir_parents(char *dir, mode_t mode) /* - * return a pointer to the basename, or NULL if path ends with '/' + * Return a pointer to the basename, or NULL if path ends with '/' */ char * base_name(char *path) @@ -126,6 +126,10 @@ base_name(char *path) return b ? b + 1 : path; } +/* + * Inspect the system, either by looking into a pack, checking installed + * files, or listing packs actually installed + */ int inspect(char *name) { @@ -145,7 +149,7 @@ inspect(char *name) /* - * write the content of an archive to a filedes + * Write the content of an archive to a filedes */ int list_archive(int fd, char *filename) @@ -178,7 +182,7 @@ list_archive(int fd, char *filename) /* - * write files installed by a pack to a filedes + * Write files installed by a pack to a filedes */ int list_content(int fd, char *name) @@ -200,7 +204,7 @@ list_content(int fd, char *name) /* - * write packs installed in PACKAGE_ROOT to a filedes + * Write packs installed in PACKAGE_ROOT to a filedes */ int list_local(int fd, char *datadir) @@ -237,7 +241,7 @@ list_local(int fd, char *datadir) /* - * write metadata about a pack file + * Write metadata about a pack file * * TODO: * + /deps /asdep @@ -290,7 +294,7 @@ metadata(char *datadir, struct pack *pack) } /* - * extract files into the given directory + * Extract files into the given directory */ int unpack(char *root, char *in) @@ -430,6 +434,9 @@ delete(const char *datadir, const char *rootfs, const char *name) } +/* + * Load a pack from a tarball and return a pack structure + */ struct pack * pack_load_file(char *path) { @@ -471,9 +478,7 @@ pack_load_file(char *path) } /* - * build a package structure from the given argument - * - * TODO: handle pack names (built from cache/repo file + * Build a package structure from the argument */ struct pack * pack_load(char *name) @@ -494,6 +499,9 @@ pack_load(char *name) return p; } +/* + * Free a pack structure + */ void pack_unload(struct pack *p) {