From owner-svn-src-head@FreeBSD.ORG Mon Jun 8 05:27:36 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 DA10BF43; Mon, 8 Jun 2015 05:27:35 +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 C8829190E; Mon, 8 Jun 2015 05:27:35 +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 t585RZVp057442; Mon, 8 Jun 2015 05:27:35 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t585RYth057438; Mon, 8 Jun 2015 05:27:34 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201506080527.t585RYth057438@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 8 Jun 2015 05:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284149 - 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: Mon, 08 Jun 2015 05:27:36 -0000 Author: bapt Date: Mon Jun 8 05:27:34 2015 New Revision: 284149 URL: https://svnweb.freebsd.org/changeset/base/284149 Log: backout remove of -q option for pw [user|group] next While the return code is broken, some corner case usage depends on the functionnality, so backout until we get better regression tests covering those corner case usage. Modified: head/usr.sbin/pw/pw.8 head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw.8 ============================================================================== --- head/usr.sbin/pw/pw.8 Mon Jun 8 05:06:17 2015 (r284148) +++ head/usr.sbin/pw/pw.8 Mon Jun 8 05:27:34 2015 (r284149) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 7, 2015 +.Dd June 3, 2015 .Dt PW 8 .Os .Sh NAME @@ -128,6 +128,7 @@ .Op Fl V Ar etcdir .Ar usernext .Op Fl C Ar config +.Op Fl q .Nm .Op Fl R Ar rootdir .Op Fl V Ar etcdir @@ -183,6 +184,7 @@ .Op Fl V Ar etcdir .Ar groupnext .Op Fl C Ar config +.Op Fl q .Nm .Op Fl R Ar rootdir .Op Fl V Ar etcdir Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Mon Jun 8 05:06:17 2015 (r284148) +++ head/usr.sbin/pw/pw.c Mon Jun 8 05:27:34 2015 (r284149) @@ -113,7 +113,7 @@ main(int argc, char *argv[]) "R:V:C:qn:u:rY", "R:V:C:qn:u:c:d:e:p:g:G:mM:l:k:s:w:L:h:H:FNPY", "R:V:C:qn:u:FPa7", - "R:V:C:", + "R:V:C:q", "R:V:C:q", "R:V:C:q" }, @@ -122,7 +122,7 @@ main(int argc, char *argv[]) "R:V:C:qn:g:Y", "R:V:C:qn:d:g:l:h:H:FM:m:NPY", "R:V:C:qn:g:FPa", - "R:V:C:" + "R:V:C:q" } }; @@ -469,7 +469,8 @@ cmdhelp(int mode, int which) "usage: pw usernext [switches]\n" "\t-V etcdir alternate /etc location\n" "\t-R rootir alternate root directory\n" - "\t-C config configuration file\n", + "\t-C config configuration file\n" + "\t-q quiet operation\n", "usage pw: lock [switches]\n" "\t-V etcdir alternate /etc locations\n" "\t-C config configuration file\n" @@ -523,6 +524,7 @@ cmdhelp(int mode, int which) "\t-V etcdir alternate /etc location\n" "\t-R rootir alternate root directory\n" "\t-C config configuration file\n" + "\t-q quiet operation\n" } }; Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Mon Jun 8 05:06:17 2015 (r284148) +++ head/usr.sbin/pw/pw_group.c Mon Jun 8 05:27:34 2015 (r284149) @@ -73,8 +73,11 @@ pw_group(int mode, char *name, long id, * next gid to stdout */ if (mode == M_NEXT) { - printf("%u\n", gr_gidpolicy(cnf, id)); - return (EXIT_SUCCESS); + gid_t next = gr_gidpolicy(cnf, id); + if (getarg(args, 'q')) + return next; + printf("%u\n", next); + return EXIT_SUCCESS; } if (mode == M_PRINT && getarg(args, 'a')) { Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Mon Jun 8 05:06:17 2015 (r284148) +++ head/usr.sbin/pw/pw_user.c Mon Jun 8 05:27:34 2015 (r284149) @@ -158,10 +158,14 @@ pw_user(int mode, char *name, long id, s * With M_NEXT, we only need to return the * next uid to stdout */ - if (mode == M_NEXT) { - printf("%u:", pw_uidpolicy(cnf, id)); + if (mode == M_NEXT) + { + uid_t next = pw_uidpolicy(cnf, id); + if (getarg(args, 'q')) + return next; + printf("%u:", next); pw_group(mode, name, -1, args); - return (EXIT_SUCCESS); + return EXIT_SUCCESS; } /*