Apple - How can I install getent on Snow Leopard?

dscacheutil is probably the best way to do this. It doesn't emulate the usual search process, it uses it, so you'll actually get the same results as a standard lookup (including caching, /etc/hosts, computer records in directory services, DNS, mDNS for .local names, etc).

$ dscacheutil -q host -a name

$ dscacheutil -q host -a name gordons-mbp.local
name: gordons-mbp.local
ipv6_address: fe80:5::e6ce:8fff:fe50:136

name: gordons-mbp.local

$ dscacheutil -q host -a ip_address
name: localhost

$ dscacheutil -q user -a name gordon
name: gordon
password: ********
uid: 501
gid: 20
dir: /Users/gordon
shell: /bin/bash
gecos: Gordon Davisson

Have a look at How to emulate Unix’ getent with MacOSX’s dscl. Since you have scripts that make use of getent, you may wish to pursue a script as a wrapper around dscl.

It's not rocket science to scrounge the getent source from OpenSolaris (or some other OS, I'd try one of the BSDs rather than Linux) and port it; I got that to work mainly by just disabling the stuff that macOS didn't have any equivalent for (netmasks and project - Solaris specific). Or one can write it in perl fairly easily. Someone did a limited one a long time ago, and I did a more complete one; it doesn't support ethers because there's no standard lookup for that from perl, but the rest seems to work ok.