Skip to content

Commit

Permalink
Fixed bad return code for inexistant searched package
Browse files Browse the repository at this point in the history
  • Loading branch information
iMilnb committed Apr 25, 2013
1 parent 123ef23 commit b756e82
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PROJECT_NAME = pkgin
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 0.5
PROJECT_NUMBER = 0.6

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
Expand Down
2 changes: 1 addition & 1 deletion actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ pkgin_install(char **opkgargs, uint8_t do_inst)
char *unmet_reqs = NULL;
char pkgpath[BUFSIZ], pkgurl[BUFSIZ], query[BUFSIZ];
char h_psize[H_BUF], h_fsize[H_BUF], h_free[H_BUF];
struct stat st;
struct stat st;

/* transform command line globs into pkgnames */
if ((pkgargs = glob_to_pkgarg(opkgargs)) == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ main(int argc, char *argv[])
break;
case PKG_SRCH_CMD: /* search for package */
missing_param(argc, 2, MSG_MISSING_SRCH);
search_pkg(argv[1]);
rc = search_pkg(argv[1]);
break;
case PKG_CLEAN_CMD: /* clean pkgin's packages cache */
clean_cache();
Expand Down
2 changes: 1 addition & 1 deletion pkgin.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Plisthead *init_head(void);
Plistnumbered *rec_pkglist(const char *, ...);
int pkg_is_installed(Plisthead *, Pkglist *);
void list_pkgs(const char *, int);
void search_pkg(const char *);
int search_pkg(const char *);
void show_category(char *);
void show_pkg_category(char *);
void show_all_categories(void);
Expand Down
9 changes: 6 additions & 3 deletions pkglist.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ list_pkgs(const char *pkgquery, int lstype)
free(plisthead);
}

void
int
search_pkg(const char *pattern)
{
Pkglist *plist;
Expand Down Expand Up @@ -336,9 +336,12 @@ search_pkg(const char *pattern)

if (matched_pkgs == 1)
printf(MSG_IS_INSTALLED_CODE);
else
else {
printf(MSG_NO_SEARCH_RESULTS, pattern);
return(EXIT_FAILURE);
}
}
return(EXIT_SUCCESS);
}

void
Expand All @@ -348,7 +351,7 @@ show_category(char *category)

SLIST_FOREACH(plist, &r_plisthead, next) {
if (strcmp(plist->category, category) == 0)
printf("%-20s %s\n", plist->full, plist->comment);
printf("%-20s %s\n", plist->full, plist->comment);
}
}

Expand Down

0 comments on commit b756e82

Please sign in to comment.