aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/delete/perform.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-02-27 09:00:18 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-02-27 09:00:18 +0000
commit29114b928346eacb4eb7105d9601754a69a8a63a (patch)
tree2ef455831e8d0cbb67316a434dad2add58e1769f /usr.sbin/pkg_install/delete/perform.c
parentb1fe97412bf49e603f5af10405fe4b6158470b0f (diff)
Notes
Diffstat (limited to 'usr.sbin/pkg_install/delete/perform.c')
-rw-r--r--usr.sbin/pkg_install/delete/perform.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c
index 072b6d5c4b15..3453cf83237a 100644
--- a/usr.sbin/pkg_install/delete/perform.c
+++ b/usr.sbin/pkg_install/delete/perform.c
@@ -37,10 +37,33 @@ static char LogDir[FILENAME_MAX];
int
pkg_perform(char **pkgs)
{
+ char **matched;
char *tmp;
int i, j;
int err_cnt = 0;
- int loop_cnt;
+ int loop_cnt, errcode;
+
+ if (MatchType != MATCH_EXACT) {
+ matched = matchinstalled(MatchType, pkgs, &errcode);
+ if (errcode != 0)
+ return 1;
+ /* Not reached */
+
+ if (matched != NULL)
+ pkgs = matched;
+ else switch (MatchType) {
+ case MATCH_GLOB:
+ break;
+ case MATCH_ALL:
+ warnx("no packages installed");
+ return 0;
+ case MATCH_REGEX:
+ warnx("no packages match pattern(s)");
+ return 1;
+ default:
+ break;
+ }
+ }
for (i = 0; pkgs[i]; i++) {
/*
@@ -122,6 +145,19 @@ pkg_do(char *pkg)
return 1;
}
+ if (Interactive == TRUE) {
+ int first, ch;
+
+ (void)fprintf(stderr, "delete %s? ", pkg);
+ (void)fflush(stderr);
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ if (first != 'y' && first != 'Y')
+ return 0;
+ /* Not reached */
+ }
+
if (!isemptyfile(REQUIRED_BY_FNAME)) {
char buf[512];
warnx("package `%s' is required by these other packages\n"