Hello,
I was wondering why getprotoent() fails. I am trying to figure this out because trying to get ftp to work, gives the message "ftp: ftp/tcp: unknown service"
I believe that this is coming from getprotobyname ("tcp").
both /etc/services and /etc/protocols exist and are readable:
empeg:/empeg/bin# ls -l /etc/services
-rw-r--r-- 1 0 0 12961 Feb 21 1999 /etc/services
empeg:/empeg/bin# ls -l /etc/protocols
-rw-r--r-- 1 0 0 1702 Feb 21 1999 /etc/protocols
empeg:/empeg/bin# grep ftp /etc/services 2>/dev/nul
ftp-data 20/tcp
ftp 21/tcp
tftp 69/udp
sftp 115/tcp
venus-se 2431/udp # udp sftp side effect
codasrv-se 2433/udp # udp sftp side effect
empeg:/empeg/bin# grep tcp /etc/protocols 2>/dev/nul
tcp 6 TCP # transmission control
I know there is extra junk in these files. I'll fix them later.
I wrote a small test case:
#include <netdb.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
struct protoent *pe;
printf ("Hello world!\n");
while (NULL != (pe = getprotoent ()))
{
printf("pe = { %s }\n", pe->p_name);
}
return 0;
}
which returns the following on empeg:
empeg:/empeg/bin# /drive0/fids/9ac0
Hello world!
On a RH 6.2 system, it returns:
Hello world!
pe = { ip }
pe = { icmp }
pe = { igmp }
pe = { ggp }
pe = { ipencap }
pe = { st }
pe = { tcp }
pe = { egp }
pe = { pup }
pe = { udp }
pe = { hmp }
pe = { xns-idp }
pe = { rdp }
pe = { iso-tp4 }
pe = { xtp }
pe = { ddp }
pe = { idpr-cmtp }
pe = { rspf }
pe = { vmtp }
pe = { ospf }
pe = { ipip }
pe = { encap }
These are the following files that I have installed on the empeg from ftp://ftp.jimpick.com/pub/debian/arm/image/debian-image_990822.tar.gz
with the command tar -xvzpf /drive0/fids/9aa0 etc/protocols etc/services sbin/ifconfig bin/ping usr/bin/ftp lib/libreadline.so.2.1 lib/libreadline.so.2 lib/libncurses.so.4.2 lib/libncurses.so.4 usr/sbin/inetd usr/sbin/tcpd usr/sbin/in.ftpd etc/inetd.conf
Perhaps I should be using a different set of files?