summaryrefslogtreecommitdiff
path: root/extra/scripts/getent
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2005-02-02 14:18:01 +0000
committerNed Ludd <solar@gentoo.org>2005-02-02 14:18:01 +0000
commit0e12850e27c2be548041a425425f2bcfefdfe05a (patch)
treeee0485bb192e86b4515f8d311ae69113e1c45f63 /extra/scripts/getent
parent6c08a18f5dd8a5019e8563b9862e20dbdf55c209 (diff)
- updated getent script to match behaviors of newer glibc getent. update from Peter S. Mazinger
Diffstat (limited to 'extra/scripts/getent')
-rwxr-xr-xextra/scripts/getent16
1 files changed, 10 insertions, 6 deletions
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\>"
;;
*)