From owner-svn-src-head@FreeBSD.ORG Sun Jun 7 15:33:09 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B958B21; Sun, 7 Jun 2015 15:33:09 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6038316E7; Sun, 7 Jun 2015 15:33:09 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t57FX9tu027660; Sun, 7 Jun 2015 15:33:09 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t57FX8aJ027654; Sun, 7 Jun 2015 15:33:08 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201506071533.t57FX8aJ027654@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 7 Jun 2015 15:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284124 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 15:33:09 -0000 Author: bapt Date: Sun Jun 7 15:33:08 2015 New Revision: 284124 URL: https://svnweb.freebsd.org/changeset/base/284124 Log: Handle -7 via gloval pwconf Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sun Jun 7 15:29:58 2015 (r284123) +++ head/usr.sbin/pw/pw.c Sun Jun 7 15:33:08 2015 (r284124) @@ -215,6 +215,9 @@ main(int argc, char *argv[]) case '?': errx(EX_USAGE, "unknown switch"); break; + case '7': + conf.v7 = true; + break; case 'C': config = optarg; break; Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sun Jun 7 15:29:58 2015 (r284123) +++ head/usr.sbin/pw/pw_user.c Sun Jun 7 15:33:08 2015 (r284124) @@ -53,7 +53,7 @@ static char locked_str[] = "*LOCKED*"; static int delete_user(struct userconf *cnf, struct passwd *pwd, struct carg *a_name, int delete, int mode); -static int print_user(struct passwd * pwd, int v7); +static int print_user(struct passwd * pwd); static uid_t pw_uidpolicy(struct userconf * cnf, struct cargs * args); static uid_t pw_gidpolicy(struct cargs * args, char *nam, gid_t prefer); static time_t pw_pwdpolicy(struct userconf * cnf, struct cargs * args); @@ -316,10 +316,9 @@ pw_user(int mode, struct cargs * args) } if (mode == M_PRINT && getarg(args, 'a')) { - int v7 = getarg(args, '7') != NULL; SETPWENT(); while ((pwd = GETPWENT()) != NULL) - print_user(pwd, v7); + print_user(pwd); ENDPWENT(); return EXIT_SUCCESS; } @@ -1161,15 +1160,15 @@ delete_user(struct userconf *cnf, struct } static int -print_user(struct passwd * pwd, int v7) +print_user(struct passwd * pwd) { if (!conf.pretty) { char *buf; - if (!v7) + if (!conf.v7) pwd->pw_passwd = (pwd->pw_passwd == NULL) ? "" : "*"; - buf = v7 ? pw_make_v7(pwd) : pw_make(pwd); + buf = conf.v7 ? pw_make_v7(pwd) : pw_make(pwd); printf("%s\n", buf); free(buf); } else { Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sun Jun 7 15:29:58 2015 (r284123) +++ head/usr.sbin/pw/pwupd.h Sun Jun 7 15:33:08 2015 (r284124) @@ -85,6 +85,7 @@ struct pwconf { char etcpath[MAXPATHLEN]; bool dryrun; bool pretty; + bool v7; struct userconf *userconf; };