NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: using getent(3) and specifying more arguments after the key?



> Looks broken to me. Fix it.

Okay, one line fix. I will commit if nobody objects.

t1:getent$ ./getent gettytab Console junk rw sp      
false
true
300

Index: getent.1
===================================================================
RCS file: /cvsroot/src/usr.bin/getent/getent.1,v
retrieving revision 1.23
diff -U 7 -r1.23 getent.1
--- getent.1    11 Oct 2011 20:39:40 -0000      1.23
+++ getent.1    25 Jun 2014 18:58:28 -0000
@@ -23,15 +23,15 @@
 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 11, 2011
+.Dd June 25, 2014
 .Dt GETENT 1
 .Os
 .Sh NAME
 .Nm getent
 .Nd get entries from administrative databases
 .Sh SYNOPSIS
 .Nm getent
@@ -97,20 +97,23 @@
 will be retrieved using the appropriate enumeration function and printed.
 .Pp
 For
 .Xr cgetcap 3
 style databases
 .Sy ( disktab ,
 .Sy printcap )
-specifying a key, lists the entry for that key, and specifying more arguments
-after the key are used as fields in that key, and only the values of the keys
-are returned.
-For boolean keys
+specifying a key,
+.Nm
+lists the record entry for that key.
+Additional arguments specified after the key are used as capability
+fields in that record, and only the values of the fields are
+returned.
+For boolean fields,
 .Dv true
-is returned if the key is found.
+is returned if the capability is found.
 If a key is not found, then
 .Dv false
 is always
 returned.
 .Sh DIAGNOSTICS
 .Nm
 exits 0 on success,
Index: getent.c
===================================================================
RCS file: /cvsroot/src/usr.bin/getent/getent.c,v
retrieving revision 1.19
diff -U 7 -r1.19 getent.c
--- getent.c    15 Mar 2012 02:02:23 -0000      1.19
+++ getent.c    25 Jun 2014 18:58:28 -0000
@@ -634,15 +634,15 @@
                }
        } else {
                if ((b = mygetent(db_array, argv[0])) == NULL)
                        return RV_NOTFOUND;
                if (argc == 1)
                        handleone(db_array, b, recurse, pretty, 0);
                else {
-                       for (i = 2; i < argc; i++) {
+                       for (i = 1; i < argc; i++) {
                                for (j = 0; j < sizeof(sfx) - 1; j++) {
                                        cap = cgetcap(b, argv[i], sfx[j]);
                                        if (cap) {
                                                capprint(cap);
                                                break;
                                        } 
                                }


Home | Main Index | Thread Index | Old Index