From owner-svn-src-all@freebsd.org Fri Apr 13 18:25:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F38AF9CFF2; Fri, 13 Apr 2018 18:25:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8E9883554; Fri, 13 Apr 2018 18:25:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB49A1D55A; Fri, 13 Apr 2018 18:25:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DIP01o089010; Fri, 13 Apr 2018 18:25:00 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DIP07v089009; Fri, 13 Apr 2018 18:25:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201804131825.w3DIP07v089009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Apr 2018 18:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332484 - head/usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.sbin/pkg X-SVN-Commit-Revision: 332484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2018 18:25:01 -0000 Author: bapt Date: Fri Apr 13 18:25:00 2018 New Revision: 332484 URL: https://svnweb.freebsd.org/changeset/base/332484 Log: pkg: accept -y and --yes from arguments By popular demand, pkg now walks thought the arguments passed and if it finds -y or --yes it does accept those as equivalent of ASSUME_ALWAYS_YES env var. Requested by: many MFC after: 1 week Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Fri Apr 13 18:04:51 2018 (r332483) +++ head/usr.sbin/pkg/pkg.c Fri Apr 13 18:25:00 2018 (r332484) @@ -1032,6 +1032,7 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; + int i; bool bootstrap_only, force, yes; bootstrap_only = false; @@ -1083,6 +1084,15 @@ main(int argc, char *argv[]) * tucked in there already. */ config_bool(ASSUME_ALWAYS_YES, &yes); + if (!yes) { + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-y") == 0 || + strcmp(argv[i], "--yes") == 0) { + yes = true; + break; + } + } + } if (!yes) { if (!isatty(fileno(stdin))) { fprintf(stderr, non_interactive_message);