From 0e12850e27c2be548041a425425f2bcfefdfe05a Mon Sep 17 00:00:00 2001 From: Ned Ludd Date: Wed, 2 Feb 2005 14:18:01 +0000 Subject: - updated getent script to match behaviors of newer glibc getent. update from Peter S. Mazinger --- extra/scripts/getent | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'extra') diff --git a/extra/scripts/getent b/extra/scripts/getent index 4cbe2876f..c02149498 100755 --- a/extra/scripts/getent +++ b/extra/scripts/getent @@ -1,5 +1,5 @@ #!/bin/sh -# $Header: /var/cvs/uClibc/extra/scripts/getent,v 1.1 2004/11/11 14:50:52 vapier Exp $ +# $Header: /var/cvs/uClibc/extra/scripts/getent,v 1.2 2005/02/02 14:18:01 solar Exp $ search_entry() { if [ -e "$1" ] ; then @@ -16,12 +16,16 @@ string="dummy" #aliases|ethers|group|hosts|netgroup|networks|passwd|protocols|rpc|services|shadow) # dns based search is not supported for hosts|networks -# networks searches ^string -# protocols|rpc|services searches string anywhere -# ethers|netgroup ? +# ethers|netgroup (not done, needed)? # it returns only the first match case $1 in - group|passwd|shadow) + passwd) + string="(^\<$2\>:|^.*:.*:\<$2\>:.*:.*:.*:.*)" + ;; + group) + string="(^|:)\<$2\>:" + ;; + shadow) string="^\<$2\>:" ;; aliases) @@ -35,7 +39,7 @@ case $1 in networks) string="^\<$2\>" ;; - hosts|protocol|rpc|services) + hosts|protocols|rpc|services) string="\<$2\>" ;; *) -- cgit v1.2.3