[uClibc-cvs] svn commit: trunk/uClibc/extra/scripts
vapier at uclibc.org
vapier at uclibc.org
Tue Aug 23 23:44:50 UTC 2005
Author: vapier
Date: 2005-08-23 17:44:49 -0600 (Tue, 23 Aug 2005)
New Revision: 11233
Log:
some updates from psm to better mirror glibc getent behavior
Modified:
trunk/uClibc/extra/scripts/getent
Changeset:
Modified: trunk/uClibc/extra/scripts/getent
===================================================================
--- trunk/uClibc/extra/scripts/getent 2005-08-23 23:08:17 UTC (rev 11232)
+++ trunk/uClibc/extra/scripts/getent 2005-08-23 23:44:49 UTC (rev 11233)
@@ -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 @@
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 @@
;;
esac
-search_entry $file $2
+if [ -z "$2" ] ; then
+ cat $file
+ retval=$?
+else
+ search_entry "$file" "$2"
+fi
exit $retval
More information about the uClibc-cvs
mailing list