pm

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

commit b5e9210a1157c7316f3de603ae7731f084135b7f
parent 365b4680352256efca096caabfcedb6ef654f17d
Author: z3bra <willyatmailoodotorg>
Date:   Tue Jun 21 01:56:28 +0200

Updated error messages to be more informative

Diffstat:
pm.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/pm.c b/pm.c @@ -167,7 +167,7 @@ re_match(const char *re, const char *str) regmatch_t sub[1]; if (regcomp(&preg, re, 0)) { - fprintf(stderr, "%s: invalid expression\n", re); + fprintf(stderr, "%s: Invalid regular expression\n", re); return -1; } @@ -193,7 +193,7 @@ pack_load_tarball(char *path) fn = base_name(path); if (re_match(PACK_FORMAT, fn) != 0) { - fprintf(stderr, "%s: invalid filename\n", fn); + fprintf(stderr, "%s: Invalid filename format\n", fn); return NULL; } @@ -243,7 +243,7 @@ pack_load_metadata(const char *datadir, char *name) snprintf(tmp, PATH_MAX, "%s/%s", datadir, name); if (stat(tmp, &st) < 0) { - fprintf(stderr, "%s: no such pack installed\n", name); + fprintf(stderr, "%s: No such pack installed\n", name); return NULL; } @@ -370,7 +370,7 @@ pack_install(const char *rootfs, const char *datadir, struct pack *p) snprintf(tmp, PATH_MAX, "%s/%s", datadir, p->name); log(LOG_VERBOSE, "checking installation status\n"); if (stat(tmp, &st) == 0 && S_ISDIR(st.st_mode)) { - fprintf(stderr, "%s: already installed\n", p->name); + fprintf(stderr, "%s: Pack already installed\n", p->name); return -1; } log(LOG_VERBOSE, "checking for collisions\n"); @@ -405,7 +405,7 @@ pack_delete(const char *rootfs, const char *datadir, struct pack *p) snprintf(tmp, PATH_MAX, "%s/%s/files", datadir, p->name); if (stat(tmp, &st) < 0 && errno == ENOENT) { - fprintf(stderr, "%s: not installed\n", p->name); + fprintf(stderr, "%s: No installed files\n", p->name); return -1; } if ((fd = open(tmp, O_RDONLY)) < 0) { @@ -422,7 +422,7 @@ pack_delete(const char *rootfs, const char *datadir, struct pack *p) log(LOG_VERBOSE, "deleting installed files\n"); /* ignore errors so everything gets deleted */ if (delete_content(rootfs, addr, st.st_size) < 0) { - fprintf(stderr, "%s: pack not removed\n", p->name); + fprintf(stderr, "%s: Pack removal failed\n", p->name); close(fd); return ERR_DELETE; } @@ -504,7 +504,7 @@ inspect_collision(const char *rootfs, struct pack *p) chdir(rootfs); while (archive_read_next_header(a, &e) == ARCHIVE_OK) { if (stat(archive_entry_pathname(e), &st) == 0 && !S_ISDIR(st.st_mode)) { - fprintf(stderr, "%s: file exists\n", archive_entry_pathname(e)); + fprintf(stderr, "%s: File exists\n", archive_entry_pathname(e)); r = -1; break; }