diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-08-23 23:44:49 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-08-23 23:44:49 +0000 |
commit | b1ce9e53a3e6b06267fee6d7b86ab7f5f5ba0f80 (patch) | |
tree | 39314507cee53c249c362faf0c2a79c9ea9b3bc0 /extra/scripts | |
parent | 4b54d5bd133cd8c7a2e39aaa6bb7db0fccbd5003 (diff) |
some updates from psm to better mirror glibc getent behavior
Diffstat (limited to 'extra/scripts')
-rwxr-xr-x | extra/scripts/getent | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/extra/scripts/getent b/extra/scripts/getent index c02149498..3a96d74f6 100755 --- a/extra/scripts/getent +++ b/extra/scripts/getent @@ -1,5 +1,5 @@ #!/bin/sh -# $Header: /var/cvs/uClibc/extra/scripts/getent,v 1.2 2005/02/02 14:18:01 solar Exp $ +# Script to replicate the `getent` binary that comes with glibc search_entry() { if [ -e "$1" ] ; then @@ -11,9 +11,19 @@ search_entry() { fi } +if [ -z "$1" ] ; then + echo "getent: wrong number of arguments" 1>&2 + exit 1 +fi + file="/etc/$1" string="dummy" +if [ ! -f "$file" ] ; then + echo "Unknown database: $1" 1>&2 + exit 1 +fi + #aliases|ethers|group|hosts|netgroup|networks|passwd|protocols|rpc|services|shadow) # dns based search is not supported for hosts|networks # ethers|netgroup (not done, needed)? @@ -48,6 +58,11 @@ case $1 in ;; esac -search_entry $file $2 +if [ -z "$2" ] ; then + cat $file + retval=$? +else + search_entry "$file" "$2" +fi exit $retval |