Showing preview only (2,204K chars total). Download the full file or copy to clipboard to get everything.
Repository: hailinzeng/Unix-Network-Programming
Branch: master
Commit: e4b6ea5f9169
Files: 779
Total size: 2.0 MB
Directory structure:
gitextract_h3wfhmct/
├── .gitattributes
├── .gitignore
├── DISCLAIMER
├── Make.defines.in
├── Makefile.in
├── README
├── VERSION
├── aclocal.m4
├── advio/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── daytimeudpcli3.c
│ ├── daytimeudpcli4.c
│ ├── dgclitimeo.c
│ ├── dgclitimeo1.c
│ ├── dgclitimeo2.c
│ ├── dgclitimeo2.lc
│ ├── dgclitimeo3.c
│ ├── dgclitimeo3.lc
│ ├── dgechoaddr.c
│ ├── dgechoaddr.lc
│ ├── old/
│ │ ├── dgechoaddr.c
│ │ ├── recvfromflags.c
│ │ └── test01.c
│ ├── recvfromflags.c
│ ├── recvfromflags.lc
│ ├── script.1
│ ├── sig_chld_waitpid.c
│ ├── str_cli_kqueue04.c
│ ├── str_cli_poll03.c
│ ├── str_cli_select02.c
│ ├── str_echo_stdio02.c
│ ├── str_echo_stdio02.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpcli03.c
│ ├── tcpcli04.c
│ ├── tcpserv02.c
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpserv01.c
│ ├── udpserv03.c
│ ├── udpserv03.lc
│ ├── udpserv04.c
│ └── udpserv04.lc
├── bcast/
│ ├── Makefile
│ ├── dgclibcast1.c
│ ├── dgclibcast1.lc
│ ├── dgclibcast2.c
│ ├── dgclibcast3.c
│ ├── dgclibcast3.lc
│ ├── dgclibcast4.c
│ ├── dgclibcast4.lc
│ ├── dgclibcast5.c
│ ├── dgclibcast5.lc
│ ├── dgclibcast6.c
│ ├── dgclibcast6.lc
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpcli04.c
│ ├── udpcli05.c
│ └── udpcli06.c
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.in
├── icmpd/
│ ├── Makefile
│ ├── dgcli01.c
│ ├── dgcli01.lc
│ ├── icmpd.c
│ ├── icmpd.h
│ ├── icmpd.lc
│ ├── readable_conn.c
│ ├── readable_conn.lc
│ ├── readable_listen.c
│ ├── readable_listen.lc
│ ├── readable_v4.c
│ ├── readable_v4.lc
│ ├── readable_v6.c
│ ├── readable_v6.lc
│ ├── script.1
│ ├── script.2
│ ├── script.3
│ ├── script.4
│ ├── udpcli01.c
│ └── unpicmpd.h
├── inetd/
│ ├── Makefile
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ └── daytimetcpsrv3.lc
├── install-sh
├── intro/
│ ├── Makefile
│ ├── byteorder.c
│ ├── daytimetcpcli.c
│ ├── daytimetcpcli1.c
│ ├── daytimetcpcli2.c
│ ├── daytimetcpcli3.c
│ ├── daytimetcpcliv6.c
│ ├── daytimetcpsrv.c
│ ├── daytimetcpsrv.lc
│ ├── daytimetcpsrv1.c
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ ├── daytimetcpsrvv6.c
│ ├── truss.solaris.2.6
│ └── truss.unixware.2.1
├── ioctl/
│ ├── Makefile
│ ├── Progs.siocgifconf
│ ├── Script.solaris
│ ├── lsif01.c
│ ├── lsif02.c
│ ├── prifinfo.c
│ ├── prifinfo.lc
│ ├── prmac.c
│ └── test1.c
├── ipopts/
│ ├── Makefile
│ ├── dgechoprintroute.c
│ ├── sigchldwaitpid.c
│ ├── sourceroute.c
│ ├── sourceroute.lc
│ ├── sourceroute6.c
│ ├── tcpcli01.c
│ ├── tcpserv01.c
│ ├── udpcli01.c
│ └── udpserv01.c
├── key/
│ ├── Makefile
│ ├── add.c
│ ├── dump.c
│ ├── name.c
│ ├── printsadbmsg.c
│ ├── register.c
│ └── unp.h
├── lib/
│ ├── Makefile
│ ├── addrinfo.h
│ ├── connect_nonb.c
│ ├── connect_nonb.lc
│ ├── connect_timeo.c
│ ├── connect_timeo.lc
│ ├── daemon_inetd.c
│ ├── daemon_inetd.lc
│ ├── daemon_init.c
│ ├── dg_cli.c
│ ├── dg_echo.c
│ ├── error.c
│ ├── family_to_level.c
│ ├── get_ifi_info.c
│ ├── get_ifi_info.lc
│ ├── gf_time.c
│ ├── host_serv.c
│ ├── host_serv.lc
│ ├── hstrerror.c
│ ├── if_indextoname.c
│ ├── if_nameindex.c
│ ├── if_nametoindex.c
│ ├── in6addr_any.c
│ ├── mcast_get_if.c
│ ├── mcast_get_loop.c
│ ├── mcast_get_ttl.c
│ ├── mcast_join.c
│ ├── mcast_join.lc
│ ├── mcast_leave.c
│ ├── mcast_set_if.c
│ ├── mcast_set_loop.c
│ ├── mcast_set_loop.lc
│ ├── mcast_set_ttl.c
│ ├── my_addrs.c
│ ├── my_addrs.lc
│ ├── pselect.c
│ ├── pselect.lc
│ ├── read_fd.c
│ ├── read_fd.lc
│ ├── readable_timeo.c
│ ├── readable_timeo.lc
│ ├── readline.c
│ ├── readline.lc
│ ├── readn.c
│ ├── readn.lc
│ ├── rtt.c
│ ├── rtt.lc
│ ├── signal.c
│ ├── signal.lc
│ ├── signal_intr.c
│ ├── snprintf.c
│ ├── sock_bind_wild.c
│ ├── sock_cmp_addr.c
│ ├── sock_cmp_port.c
│ ├── sock_get_port.c
│ ├── sock_ntop.c
│ ├── sock_ntop.lc
│ ├── sock_ntop_host.c
│ ├── sock_set_addr.c
│ ├── sock_set_port.c
│ ├── sock_set_wild.c
│ ├── sockatmark.c
│ ├── sockfd_to_family.c
│ ├── sockfd_to_family.lc
│ ├── str_cli.c
│ ├── str_cli.lc
│ ├── str_echo.c
│ ├── str_echo.lc
│ ├── tcp_connect.c
│ ├── tcp_connect.lc
│ ├── tcp_listen.c
│ ├── tcp_listen.lc
│ ├── tv_sub.c
│ ├── udp_client.c
│ ├── udp_client.lc
│ ├── udp_connect.c
│ ├── udp_connect.lc
│ ├── udp_server.c
│ ├── udp_server.lc
│ ├── unp.h
│ ├── unp.lh
│ ├── unpifi.h
│ ├── unprtt.h
│ ├── unprtt.lh
│ ├── unpthread.h
│ ├── wraplib.c
│ ├── wrappthread.c
│ ├── wrappthread.lc
│ ├── wrapsock.c
│ ├── wrapsock.lc
│ ├── wrapstdio.c
│ ├── wrapunix.c
│ ├── writable_timeo.c
│ ├── write_fd.c
│ ├── write_fd.lc
│ ├── writen.c
│ └── writen.lc
├── libfree/
│ ├── Makefile
│ ├── README
│ ├── README.getaddrinfo
│ ├── addrinfo.h
│ ├── getaddrinfo.c
│ ├── getnameinfo.c
│ ├── in_cksum.c
│ ├── inet_aton.c
│ ├── inet_ntop.c
│ ├── inet_ntop_ipv4.c
│ ├── inet_ntop_ipv4.lc
│ ├── inet_pton.c
│ ├── inet_pton_ipv4.c
│ ├── inet_pton_ipv4.lc
│ ├── test_ascii2addr.c
│ ├── test_getservbyname_r.c
│ └── test_inet_pton.c
├── libgai/
│ ├── Makefile
│ ├── addrinfo.h
│ ├── freeaddrinfo.c
│ ├── ga_aistruct.c
│ ├── ga_aistruct.lc
│ ├── ga_clone.c
│ ├── ga_clone.lc
│ ├── ga_echeck.c
│ ├── ga_echeck.lc
│ ├── ga_nsearch.c
│ ├── ga_nsearch.lc
│ ├── ga_port.c
│ ├── ga_port.lc
│ ├── ga_serv.c
│ ├── ga_serv.lc
│ ├── ga_unix.c
│ ├── ga_unix.lc
│ ├── gai_hdr.h
│ ├── gai_hdr.lh
│ ├── gai_strerror.c
│ ├── getaddrinfo.c
│ ├── getaddrinfo.lc
│ ├── getnameinfo.c
│ ├── getnameinfo.lc
│ ├── gn_ipv46.c
│ ├── gn_ipv46.lc
│ ├── old/
│ │ ├── ga_unixstruct.c
│ │ └── savecopy.c
│ ├── test1.c
│ └── testga.c
├── libroute/
│ ├── Makefile
│ ├── get_rtaddrs.c
│ ├── get_rtaddrs.lc
│ ├── if_indextoname.c
│ ├── if_indextoname.lc
│ ├── if_nameindex.c
│ ├── if_nameindex.lc
│ ├── if_nametoindex.c
│ ├── if_nametoindex.lc
│ ├── net_rt_dump.c
│ ├── net_rt_iflist.c
│ ├── net_rt_iflist.lc
│ ├── sock_masktop.c
│ └── unproute.h
├── mcast/
│ ├── Makefile
│ ├── dgclibcast1.c
│ ├── dgclimcast5.c
│ ├── dgclimcast6.c
│ ├── main.c
│ ├── recv.c
│ ├── send.c
│ ├── udpcli01.c
│ ├── udpcli05.c
│ ├── udpcli06.c
│ └── udpserv01.c
├── mysdr/
│ ├── Makefile
│ ├── loop.c
│ ├── loop.lc
│ ├── main.c
│ ├── main.lc
│ ├── mysdr.h
│ ├── script.1
│ └── script.2
├── names/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── daytimetcpcli1.c
│ ├── daytimetcpcli1.lc
│ ├── daytimetcpcli2.c
│ ├── daytimetcpcli2.lc
│ ├── daytimetcpcli3.c
│ ├── daytimetcpcli3.lc
│ ├── daytimetcpsrv1.c
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ ├── daytimetcpsrv4.c
│ ├── daytimeudpcli1.c
│ ├── daytimeudpcli1.lc
│ ├── daytimeudpcli2.c
│ ├── daytimeudpsrv2.c
│ ├── daytimeudpsrv3.c
│ ├── hostent.c
│ ├── hostent.lc
│ ├── hostent2.c
│ ├── hostent2.lc
│ ├── hostent3.c
│ ├── myaddrs1.c
│ ├── myaddrs1.lc
│ ├── netent.c
│ ├── prmyaddrs.c
│ ├── prmyaddrs1.c
│ ├── prmyaddrs1.lc
│ ├── test1.c
│ ├── test2.c
│ └── udp_server_reuseaddr.c
├── nonblock/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── doit.1
│ ├── home_page.c
│ ├── script.1.sh
│ ├── script.1.tcpd
│ ├── start_connect.c
│ ├── strclifork.c
│ ├── strclinonb.c
│ ├── strclinonb.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpcli03.c
│ ├── tcpcli03.lc
│ ├── tcpcli04.c
│ ├── tcpservselect03.c
│ ├── web.c
│ ├── web.h
│ ├── web.lc
│ └── write_get_cmd.c
├── oob/
│ ├── Makefile
│ ├── heartbeatcli.c
│ ├── heartbeatserv.c
│ ├── sigchldwaitpid.c
│ ├── strcliselect02.c
│ ├── strecho02.c
│ ├── tcpcli02.c
│ ├── tcprecv01.c
│ ├── tcprecv01.lc
│ ├── tcprecv02.c
│ ├── tcprecv02.lc
│ ├── tcprecv03.c
│ ├── tcprecv03p.c
│ ├── tcprecv03p.lc
│ ├── tcprecv04.c
│ ├── tcprecv04.lc
│ ├── tcprecv05.c
│ ├── tcprecv06.c
│ ├── tcpsend01.c
│ ├── tcpsend01.lc
│ ├── tcpsend02.c
│ ├── tcpsend03.c
│ ├── tcpsend04.c
│ ├── tcpsend04.lc
│ ├── tcpsend05.c
│ ├── tcpsend05.lc
│ ├── tcpsend06.c
│ ├── tcpsend06.lc
│ └── tcpserv02.c
├── ping/
│ ├── Makefile
│ ├── bsdping.c
│ ├── init_v6.c
│ ├── main.c
│ ├── main.lc
│ ├── old/
│ │ ├── icmp6.h
│ │ └── ip6.h
│ ├── ping.h
│ ├── ping_v4.c
│ ├── proc_v4.c
│ ├── proc_v4.lc
│ ├── proc_v6.c
│ ├── proc_v6.lc
│ ├── readloop.c
│ ├── send_v4.c
│ ├── send_v6.c
│ ├── sig_alrm.c
│ ├── sig_alrm.lc
│ └── tv_sub.c
├── route/
│ ├── Makefile
│ ├── checkudpsum.c
│ ├── get_ifi_info.c
│ ├── get_ifi_info.lc
│ ├── getrt.c
│ ├── getrt.lc
│ ├── mynetstat.c
│ ├── prifindex.c
│ ├── prifinfo.c
│ ├── prifname.c
│ ├── prifnameindex.c
│ └── unproute.h
├── rtt/
│ ├── Makefile
│ ├── dg_cli.c
│ ├── dg_cli.lc
│ ├── dg_echo.c
│ ├── dg_send_recv.c
│ ├── dg_send_recv.lc
│ ├── rtt.out.kumba.1
│ ├── rtt.out.kumba.2
│ ├── rtt.out.vangogh.1
│ ├── rtt.out.vangogh.2
│ ├── rtt.vals.kumba.1
│ ├── rtt.vals.vangogh.1
│ ├── udpcli01.c
│ └── unprtt.h
├── sctp/
│ ├── Makefile
│ ├── sctp_addr_to_associd.c
│ ├── sctp_addr_to_associd.lc
│ ├── sctp_bindargs.c
│ ├── sctp_bindargs.lc
│ ├── sctp_check_notify.c
│ ├── sctp_check_notify.lc
│ ├── sctp_displayevents.c
│ ├── sctp_displayevents.lc
│ ├── sctp_getnostrm.c
│ ├── sctp_modify_hb.c
│ ├── sctp_modify_hb.lc
│ ├── sctp_pdapircv.c
│ ├── sctp_pdapircv.lc
│ ├── sctp_print_addrs.c
│ ├── sctp_print_addrs.lc
│ ├── sctp_strcli.c
│ ├── sctp_strcli.lc
│ ├── sctp_strcli1.c
│ ├── sctp_strcli1.lc
│ ├── sctp_strcli_un.c
│ ├── sctp_strcli_un.lc
│ ├── sctp_strcliecho.c
│ ├── sctp_strcliecho.lc
│ ├── sctp_strcliecho2.c
│ ├── sctp_strcliecho2.lc
│ ├── sctp_wrapper.c
│ ├── sctpclient01.c
│ ├── sctpclient01.lc
│ ├── sctpclient02.c
│ ├── sctpclient02.lc
│ ├── sctpclient04.c
│ ├── sctpclient04.lc
│ ├── sctpserv01.c
│ ├── sctpserv01.lc
│ ├── sctpserv02.c
│ ├── sctpserv02.lc
│ ├── sctpserv03.c
│ ├── sctpserv03.lc
│ ├── sctpserv04.c
│ ├── sctpserv04.lc
│ ├── sctpserv05.c
│ ├── sctpserv05.lc
│ ├── sctpserv06.c
│ ├── sctpserv06.lc
│ ├── sctpserv07.c
│ ├── sctpserv07.lc
│ ├── sctpserv_fork.c
│ ├── sctpserv_fork.lc
│ └── unp.h
├── select/
│ ├── Makefile
│ ├── strcliselect01.c
│ ├── strcliselect02.c
│ ├── strcliselect02.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ └── tcpcli03.c
├── server/
│ ├── Makefile
│ ├── child.h
│ ├── child.lh
│ ├── child02.c
│ ├── child02.lc
│ ├── child02l.c
│ ├── child02m.c
│ ├── child03.c
│ ├── child03m.c
│ ├── child04.c
│ ├── child05.c
│ ├── child05.lc
│ ├── client.c
│ ├── clientrst.c
│ ├── lock_fcntl.c
│ ├── lock_fcntl.lc
│ ├── lock_pthread.c
│ ├── lock_pthread.lc
│ ├── meter.c
│ ├── pr_cpu_time.c
│ ├── pthread07.c
│ ├── pthread07.h
│ ├── pthread07.lc
│ ├── pthread08.c
│ ├── pthread08.h
│ ├── pthread08.lc
│ ├── pthread09.c
│ ├── pthread09.h
│ ├── readline.c
│ ├── readline_r.c
│ ├── readline_r.h
│ ├── serv00.c
│ ├── serv01.c
│ ├── serv01.lc
│ ├── serv02.c
│ ├── serv02.lc
│ ├── serv02m.c
│ ├── serv03.c
│ ├── serv03m.c
│ ├── serv04.c
│ ├── serv05.c
│ ├── serv05.lc
│ ├── serv06.c
│ ├── serv06.lc
│ ├── serv07.c
│ ├── serv07.lc
│ ├── serv08.c
│ ├── serv08.lc
│ ├── serv09.c
│ ├── sig_chld_waitpid.c
│ ├── unpthread.h
│ ├── web_child.c
│ └── web_child_r.c
├── sigio/
│ ├── Makefile
│ ├── dgcli01.c
│ ├── dgecho01.c
│ ├── dgecho01.lc
│ ├── script.1
│ ├── script.2
│ ├── udpcli01.c
│ └── udpserv01.c
├── sock/
│ ├── Makefile
│ ├── README
│ ├── TODO
│ ├── buffers.c
│ ├── cliopen.c
│ ├── crlf.c
│ ├── error.c
│ ├── loop.c
│ ├── looptcp.c
│ ├── loopudp.c
│ ├── main.c
│ ├── multicast.c
│ ├── ourhdr.h
│ ├── pattern.c
│ ├── servopen.c
│ ├── sinktcp.c
│ ├── sinkudp.c
│ ├── sleepus.c
│ ├── sock.h
│ ├── sock.in
│ ├── sockopts.c
│ ├── sourceroute.c
│ ├── sourcesink.c
│ ├── sourcetcp.c
│ ├── sourceudp.c
│ ├── strerror.c
│ ├── tellwait.c
│ ├── write.c
│ └── writen.c
├── sockopt/
│ ├── Makefile
│ ├── checkopts.c
│ ├── checkopts.lc
│ ├── prdefaults.c
│ ├── rcvbuf.c
│ ├── rcvbufset.c
│ └── sockopt.c
├── sparc64-unknown-freebsd5.1/
│ └── config.h
├── ssntp/
│ ├── Makefile
│ ├── main.c
│ ├── main.lc
│ ├── ntp.h
│ ├── sntp.h
│ └── sntp_proc.c
├── streams/
│ ├── Makefile
│ ├── stream_dg/
│ │ ├── Makefile
│ │ ├── client.c
│ │ ├── net_stream.c
│ │ └── server.c
│ ├── strlist_sock.c
│ ├── strlist_xti.c
│ ├── tpi_bind.c
│ ├── tpi_close.c
│ ├── tpi_close.lc
│ ├── tpi_connect.c
│ ├── tpi_connect.lc
│ ├── tpi_daytime.c
│ ├── tpi_daytime.h
│ ├── tpi_read.c
│ ├── tpi_read.lc
│ └── unpxti.h
├── tcpcliserv/
│ ├── Makefile
│ ├── sigchldwait.c
│ ├── sigchldwait.lc
│ ├── sigchldwaitpid.c
│ ├── sigchldwaitpid.lc
│ ├── str_cli08.c
│ ├── str_cli09.c
│ ├── str_cli11.c
│ ├── str_cli11.lc
│ ├── str_echo08.c
│ ├── str_echo08.lc
│ ├── str_echo09.c
│ ├── sum.h
│ ├── tcpcli01.c
│ ├── tcpcli01.lc
│ ├── tcpcli04.c
│ ├── tcpcli05.c
│ ├── tcpcli06.c
│ ├── tcpcli07.c
│ ├── tcpcli08.c
│ ├── tcpcli09.c
│ ├── tcpcli10.c
│ ├── tcpcli11.c
│ ├── tcpserv01.c
│ ├── tcpserv01.lc
│ ├── tcpserv02.c
│ ├── tcpserv03.c
│ ├── tcpserv04.c
│ ├── tcpserv04.lc
│ ├── tcpserv08.c
│ ├── tcpserv09.c
│ ├── tcpservpoll01.c
│ ├── tcpservpoll01.lc
│ ├── tcpservselect01.c
│ ├── tcpservselect01.lc
│ └── tsigpipe.c
├── test/
│ ├── Makefile
│ ├── accept_eintr.c
│ ├── funcs.c
│ ├── readline.h
│ ├── readline1.c
│ ├── readline1.lc
│ ├── readline2.c
│ ├── readline3.c
│ ├── test.h
│ ├── test1.c
│ ├── test2.c
│ ├── tisfdtype.c
│ ├── treadline1.c
│ ├── treadline2.c
│ ├── treadline3.c
│ ├── tshutdown.c
│ └── tsnprintf.c
├── threads/
│ ├── Makefile
│ ├── doit.1
│ ├── doit.2
│ ├── example01.c
│ ├── example01.lc
│ ├── example02.c
│ ├── example02.lc
│ ├── example03.c
│ ├── readline.c
│ ├── readline.lc
│ ├── script.example01
│ ├── script.example02
│ ├── strclithread.c
│ ├── strclithread.lc
│ ├── strclithread2.c
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpserv01.c
│ ├── tcpserv02.c
│ ├── test01.c
│ ├── test02.c
│ ├── test03.c
│ ├── test04.c
│ ├── test05.c
│ ├── unpthread.h
│ ├── web01.c
│ ├── web01.lc
│ ├── web02.c
│ ├── web03.c
│ └── web03.lc
├── traceroute/
│ ├── Makefile
│ ├── icmpcode_v4.c
│ ├── icmpcode_v6.c
│ ├── main.c
│ ├── main.lc
│ ├── recv_v4.c
│ ├── recv_v4.lc
│ ├── recv_v6.c
│ ├── recv_v6.lc
│ ├── sig_alrm.c
│ ├── trace.h
│ ├── trace.lh
│ ├── traceloop.c
│ ├── traceloop.lc
│ └── tv_sub.c
├── udpcksum/
│ ├── Makefile
│ ├── cleanup.c
│ ├── cleanup.lc
│ ├── main.c
│ ├── main.lc
│ ├── pcap.c
│ ├── pcap.lc
│ ├── senddnsquery-libnet.c
│ ├── senddnsquery-libnet.lc
│ ├── senddnsquery-raw.c
│ ├── senddnsquery-raw.lc
│ ├── udpcksum.c
│ ├── udpcksum.h
│ ├── udpcksum.lc
│ ├── udpread.c
│ ├── udpread.c.bad
│ ├── udpread.lc
│ ├── udpwrite.c
│ └── udpwrite.lc
├── udpcliserv/
│ ├── Makefile
│ ├── dgcliaddr.c
│ ├── dgclibig.c
│ ├── dgclibig.lc
│ ├── dgcliconnect.c
│ ├── dgcliconnect.lc
│ ├── dgcliinetaddr.c
│ ├── dgcliloop1.c
│ ├── dgcliloop3.c
│ ├── dgecholoop1.c
│ ├── dgecholoop2.c
│ ├── dgecholoop2.lc
│ ├── sigchldwaitpid.c
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpcli04.c
│ ├── udpcli05.c
│ ├── udpcli06.c
│ ├── udpcli08.c
│ ├── udpcli09.c
│ ├── udpcli10.c
│ ├── udpserv01.c
│ ├── udpserv06.c
│ ├── udpserv07.c
│ ├── udpservselect01.c
│ └── udpservselect01.lc
└── unixdomain/
├── Makefile
├── daytimetcpcli.c
├── daytimetcpsrv2.c
├── mycat.c
├── mycat.lc
├── myopen.c
├── openfile.c
├── readcred.c
├── sigchldwaitpid.c
├── strecho.c
├── testfcred.c
├── tfcred01.c
├── unixbind.c
├── unixbind.lc
├── unixdgcli01.c
├── unixdgcli01.lc
├── unixdgserv01.c
├── unixstrcli01.c
├── unixstrserv01.c
├── unixstrserv01.lc
└── unixstrserv02.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
================================================
FILE: .gitignore
================================================
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store
================================================
FILE: DISCLAIMER
================================================
LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
The authors and publisher of the book "UNIX Network Programming" have
used their best efforts in preparing this software. These efforts
include the development, research, and testing of the theories and
programs to determine their effectiveness. The authors and publisher
make no warranty of any kind, express or implied, with regard to
these programs or the documentation contained in the book. The authors
and publisher shall not be liable in any event for incidental or
consequential damages in connection with, or arising out of, the
furnishing, performance, or use of these programs.
================================================
FILE: Make.defines.in
================================================
#
# This file is generated by autoconf from "Make.defines.in".
#
# This is the "Make.defines" file that almost every "Makefile" in the
# source directories below this directory include.
# The "../" in the pathnames actually refer to this directory, since
# "make" is executed in all the subdirectories of this directory.
#
# System = @host@
CC = @CC@
CFLAGS = -I../lib @CFLAGS@
LIBS = @LIBUNP@ @LIBS@
LIBS_XTI = @LIBUNPXTI@ @LIBUNP@ @LIBS_XTI@
RANLIB = @RANLIB@
# Following is the main library, built from all the object files
# in the lib/ and libfree/ directories.
LIBUNP_NAME = @LIBUNP_NAME@
# Following is the XTI library, built from all the object files
# in the libxti/ directory.
LIBUNPXTI_NAME = @LIBUNPXTI_NAME@
# Following are all the object files to create in the lib/ directory.
LIB_OBJS = @LIB_OBJS@
# Following are all the object files to create in the libfree/ directory.
LIBFREE_OBJS = @LIBFREE_OBJS@
# Following are all the object files to create in the libgai/ directory.
LIBGAI_OBJS = @LIBGAI_OBJS@
# Following are all the object files to create in the libroute/ directory.
LIBROUTE_OBJS = @LIBROUTE_OBJS@
# Following are all the object files to create in the libxti/ directory.
LIBXTI_OBJS = @LIBXTI_OBJS@
CLEANFILES = core core.* *.core *.o temp.* *.out typescript* \
*.lc *.lh *.bsdi *.sparc *.uw
================================================
FILE: Makefile.in
================================================
include ./Make.defines
all:
@echo "Nothing to make in this directory"
@echo "Please read the README file"
clean:
rm -f $(CLEANFILES)
distclean:
rm -f $(CLEANFILES) config.cache config.log config.status config.h Make.defines Makefile
================================================
FILE: README
================================================
QUICK AND DIRTY
===============
Execute the following from the src/ directory:
./configure # try to figure out all implementation differences
cd lib # build the basic library that all programs need
make # use "gmake" everywhere on BSD/OS systems
cd ../libfree # continue building the basic library
make
cd ../libroute # only if your system supports 4.4BSD style routing sockets
make # only if your system supports 4.4BSD style routing sockets
cd ../libxti # only if your system supports XTI
make # only if your system supports XTI
cd ../intro # build and test a basic client program
make daytimetcpcli
./daytimetcpcli 127.0.0.1
If all that works, you're all set to start compiling individual programs.
Notice that all the source code assumes tabs every 4 columns, not 8.
MORE DETAILS
============
5. If you need to make any changes to the "unp.h" header, notice that it
is a hard link in each directory, so you only need to change it once.
6. Go into the "lib/" directory and type "make". This builds the library
"libunp.a" that is required by almost all of the programs. There may
be compiler warnings (see NOTES below). This step is where you'll find
all of your system's dependencies, and you must just update your cf/
files from step 1, rerun "config" and do this step again.
6. Go into the "libfree/" directory and type "make". This adds to the
"libunp.a" library. The files in this directory do not #include
the "unp.h" header, as people may want to use these functions
independent of the book's examples.
8. Once the library is made from steps 5 and 6, you can then go into any
of the source code directories and make whatever program you are
interested in. Note that the horizontal rules at the beginning and
end of each program listing in the book contain the directory name and
filename.
BEWARE: Not all programs in each directory will compile on all systems
(e.g., the file src/advio/recvfromflags.c will not compile unless your
system supports the IP_RECVDSTADDR socket option). Also, not all files
in each directory are included in the book. Beware of any files with
"test" in the filename: they are probably a quick test program that I
wrote to check something, and may or may not work.
NOTES
-----
- Many systems do not have correct function prototypes for the socket
functions, and this can cause many warnings during compilation.
For example, Solaris 2.5 omits the "const" from the 2nd argument
to connect(). Lots of systems use "int" for the length of socket
address structures, while Posix.1g specifies "size_t". Lots of
systems still have the pointer argument to [sg]etsockopt() as a
"char *" instead of a "void *", and this also causes warnings.
- SunOS 4.1.x: If you are using Sun's acc compiler, you need to run
the configure program as
CC=acc CFLAGS=-w CPPFLAGS=-w ./configure
Failure to do this results in numerous system headers (<sys/sockio.h>)
not being found during configuration, causing compile errors later.
- If your system supports IPv6 and you want to run the examples in the
book using hostnames, you must install the latest BIND release. You
can get it from ftp://ftp.vix.com/pub/bind/release. All you need from
this release is a resolver library that you should then add to the
LDLIBS and LDLIBS_THREADS lines.
- IPv6 support is still in its infancy. There may be differences
between the IPv6 sockets API specifications and what the vendor
provides. This may require hand tweaking, but should get better
over time.
- If your system supports an older draft of the Posix pthreads standard,
but configure detects the support of pthreads, you will have to disable
this by hand. Digital Unix V3.2C has this problem, for example, as it
supports draft 4, not the final draft.
To fix this, remove wrappthread.o from LIB_OBJS in "Make.defines" and
don't try to build and run any of the threads programs.
COMMON DIFFERENCES
------------------
These are the common differences that I see in various headers that are
not "yet" at the level of Posix.1g or X/Open XNS Issue 5.
- getsockopt() and setsockopt(): 5th argument is not correct type.
- t_bind(): second argument is missing "const".
- t_connect(): second argument is missing "const".
- t_open(): first argument is missing "const".
- t_optmsmg(): second argument is missing "const".
- If your <xti.h> defines the members of the t_opthdr{} as longs,
instead of t_uscalar_t, some of the printf formats of these value
might generate warnings from your compiler, since you are printing
a long without a corresponding long format specifier.
================================================
FILE: VERSION
================================================
2004/12/12
================================================
FILE: aclocal.m4
================================================
dnl ##################################################################
dnl Our macro to check for a function prototype in a given header.
dnl
AC_DEFUN(AC_CHECK_FUNC_PROTO,
[AC_CACHE_CHECK(for $1 function prototype in $2, ac_cv_have_$1_proto,
AC_EGREP_HEADER($1, $2,
ac_cv_have_$1_proto=yes,
ac_cv_have_$1_proto=no))
if test $ac_cv_have_$1_proto = yes ; then
ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_PROTO
AC_DEFINE_UNQUOTED($ac_tr_func)
fi
])
dnl ##################################################################
dnl We cannot use the AC_CHECK_TYPE macros because AC_CHECK_TYPE
dnl #includes only <sys/types.h>, <stdlib.h>, and <stddef.h>.
dnl Unfortunately, many implementations today hide typedefs in wierd
dnl locations: Solaris 2.5.1 has uint8_t and uint32_t in <pthread.h>.
dnl SunOS 4.1.x has int8_t in <sys/bitypes.h>.
dnl So we define our own macro AC_UNP_CHECK_TYPE that does the same
dnl #includes as "unp.h", and then looks for the typedef.
dnl
dnl This macro should be invoked after all the header checks have been
dnl performed, since we #include "confdefs.h" below, and then use the
dnl HAVE_foo_H values that it can #define.
dnl
AC_DEFUN(AC_UNP_CHECK_TYPE,
[AC_MSG_CHECKING(if $1 defined)
AC_CACHE_VAL(ac_cv_type_$1,
AC_TRY_COMPILE(
[
#include "confdefs.h" /* the header built by configure so far */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_PTHREAD_H
# include <pthread.h>
#endif],
[ $1 foo ],
ac_cv_type_$1=yes,
ac_cv_type_$1=no))
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no ; then
AC_DEFINE($1, $2, $3)
fi
])
dnl ##################################################################
dnl The following checks for any typedefs for XTI programs.
dnl We perform all the #includes that "libxti/unpxti.h" performs.
dnl
AC_DEFUN(AC_UNPXTI_CHECK_TYPE,
[AC_MSG_CHECKING(if $1 defined)
AC_CACHE_VAL(ac_cv_type_$1,
AC_TRY_COMPILE(
[
#include "confdefs.h" /* the header built by configure so far */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_PTHREAD_H
# include <pthread.h>
#endif
#ifdef HAVE_POLL_H
# include <poll.h>
#endif
#ifdef HAVE_XTI_H
# include <xti.h>
#endif
#ifdef HAVE_NETCONFIG_H
# include <netconfig.h>
#endif
#ifdef HAVE_NETDIR_H
# include <netdir.h>
#endif
#ifdef HAVE_STROPTS_H
# include <stropts.h>
#endif],
[ $1 foo ],
ac_cv_type_$1=yes,
ac_cv_type_$1=no))
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no ; then
AC_DEFINE($1, $2, $3)
fi
])
================================================
FILE: advio/Makefile
================================================
include ../Make.defines
PROGS = tcpcli01 tcpcli02 tcpserv02 \
udpcli01 udpcli02 udpcli03 \
udpserv01 udpserv03 udpserv04 \
daytimetcpcli daytimeudpcli3 daytimeudpcli4
all: ${PROGS}
tcpcli01: tcpcli01.o
${CC} ${CFLAGS} -o $@ tcpcli01.o ${LIBS}
tcpcli02: tcpcli02.o str_cli_select02.o
${CC} ${CFLAGS} -o $@ tcpcli02.o str_cli_select02.o ${LIBS}
tcpcli03: tcpcli03.o str_cli_poll03.o
${CC} ${CFLAGS} -o $@ tcpcli03.o str_cli_poll03.o ${LIBS}
tcpcli04: tcpcli04.o str_cli_kqueue04.o
${CC} ${CFLAGS} -o $@ tcpcli04.o str_cli_kqueue04.o ${LIBS}
tcpserv02: tcpserv02.o str_echo_stdio02.o sig_chld_waitpid.o
${CC} ${CFLAGS} -o $@ tcpserv02.o str_echo_stdio02.o \
sig_chld_waitpid.o ${LIBS}
udpcli01: udpcli01.o dgclitimeo1.o
${CC} ${CFLAGS} -o $@ udpcli01.o dgclitimeo1.o ${LIBS}
udpcli02: udpcli02.o dgclitimeo2.o
${CC} ${CFLAGS} -o $@ udpcli02.o dgclitimeo2.o ${LIBS}
udpcli03: udpcli03.o dgclitimeo3.o
${CC} ${CFLAGS} -o $@ udpcli03.o dgclitimeo3.o ${LIBS}
udpserv01: udpserv01.o dgechoaddr.o recvfromflags.o
${CC} ${CFLAGS} -o $@ udpserv01.o dgechoaddr.o recvfromflags.o ${LIBS}
udpserv03: udpserv03.o
${CC} ${CFLAGS} -o $@ udpserv03.o ${LIBS}
udpserv04: udpserv04.o
${CC} ${CFLAGS} -o $@ udpserv04.o ${LIBS}
daytimetcpcli: daytimetcpcli.o
${CC} ${CFLAGS} -o $@ daytimetcpcli.o ${LIBS}
daytimeudpcli3: daytimeudpcli3.o
${CC} ${CFLAGS} -o $@ daytimeudpcli3.o ${LIBS}
daytimeudpcli4: daytimeudpcli4.o
${CC} ${CFLAGS} -o $@ daytimeudpcli4.o ${LIBS}
clean:
rm -f ${PROGS} ${CLEANFILES}
================================================
FILE: advio/daytimetcpcli.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd, n, npend;
char recvline[MAXLINE + 1];
socklen_t len;
struct sockaddr_storage ss;
if (argc != 3)
err_quit("usage: a.out <hostname or IPaddress> <service or port#>");
sockfd = Tcp_connect(argv[1], argv[2]);
len = sizeof(ss);
Getpeername(sockfd, (SA *)&ss, &len);
printf("connected to %s\n", Sock_ntop_host((SA *)&ss, len));
for ( ; ; ) {
if ( (n = Recv(sockfd, recvline, MAXLINE, MSG_PEEK)) == 0)
break; /* server closed connection */
Ioctl(sockfd, FIONREAD, &npend); /* check FIONREAD support */
printf("%d bytes from PEEK, %d bytes pending\n", n, npend);
n = Read(sockfd, recvline, MAXLINE);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
}
exit(0);
}
================================================
FILE: advio/daytimeudpcli3.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd, n, nq;
char recvline[MAXLINE + 1];
socklen_t salen;
struct sockaddr *sa;
if (argc != 3)
err_quit("usage: a.out <hostname or IPaddress> <service or port#>");
sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);
printf("sending to %s\n", Sock_ntop_host(sa, salen));
Sendto(sockfd, "", 1, 0, sa, salen); /* send 1-byte datagram */
n = Recvfrom(sockfd, recvline, MAXLINE, MSG_PEEK, NULL, NULL);
Ioctl(sockfd, FIONREAD, &nq); /* check FIONREAD support */
printf("%d bytes from PEEK, %d bytes pending\n", n, nq);
n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
exit(0);
}
================================================
FILE: advio/daytimeudpcli4.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd, n, nq;
char recvline[MAXLINE + 1];
socklen_t len;
struct sockaddr_storage ss;
if (argc != 3)
err_quit("usage: a.out <hostname or IPaddress> <service or port#>");
sockfd = Udp_connect(argv[1], argv[2]);
len = sizeof(ss);
Getpeername(sockfd, (SA *)&ss, &len);
printf("connected to %s\n", Sock_ntop_host((SA *)&ss, len));
Write(sockfd, "", 2); /* send 1-byte datagram */
n = Recv(sockfd, recvline, MAXLINE, MSG_PEEK);
Ioctl(sockfd, FIONREAD, &nq); /* check FIONREAD support */
printf("%d bytes from PEEK, %d bytes pending\n", n, nq);
n = Read(sockfd, recvline, MAXLINE);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
exit(0);
}
================================================
FILE: advio/dgclitimeo.c
================================================
#include "unp.h"
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
if (Readable_timeo(sockfd, 5) == 0) {
fprintf(stderr, "socket timeout\n");
continue;
}
n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
}
}
================================================
FILE: advio/dgclitimeo1.c
================================================
#include "unp.h"
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
if (Readable_timeo(sockfd, 5) == 0) {
fprintf(stderr, "socket timeout\n");
} else {
n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
}
}
}
================================================
FILE: advio/dgclitimeo2.c
================================================
#include "unp.h"
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];
struct timeval tv;
tv.tv_sec = 5;
tv.tv_usec = 0;
Setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
if (n < 0) {
if (errno == EWOULDBLOCK) {
fprintf(stderr, "socket timeout\n");
continue;
} else
err_sys("recvfrom error");
}
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
}
}
================================================
FILE: advio/dgclitimeo2.lc
================================================
#include "unp.h"## 1 ##src/advio/dgclitimeo2.c##
void## 2 ##src/advio/dgclitimeo2.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 3 ##src/advio/dgclitimeo2.c##
{## 4 ##src/advio/dgclitimeo2.c##
int n;## 5 ##src/advio/dgclitimeo2.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 6 ##src/advio/dgclitimeo2.c##
struct timeval tv;## 7 ##src/advio/dgclitimeo2.c##
tv.tv_sec = 5;## 8 ##src/advio/dgclitimeo2.c##
tv.tv_usec = 0;## 9 ##src/advio/dgclitimeo2.c##
Setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));## 10 ##src/advio/dgclitimeo2.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 11 ##src/advio/dgclitimeo2.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 12 ##src/advio/dgclitimeo2.c##
n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);## 13 ##src/advio/dgclitimeo2.c##
if (n < 0) {## 14 ##src/advio/dgclitimeo2.c##
if (errno == EWOULDBLOCK) {## 15 ##src/advio/dgclitimeo2.c##
fprintf(stderr, "socket timeout\n");## 16 ##src/advio/dgclitimeo2.c##
continue;## 17 ##src/advio/dgclitimeo2.c##
} else## 18 ##src/advio/dgclitimeo2.c##
err_sys("recvfrom error");## 19 ##src/advio/dgclitimeo2.c##
}## 20 ##src/advio/dgclitimeo2.c##
recvline[n] = 0; /* null terminate */## 21 ##src/advio/dgclitimeo2.c##
Fputs(recvline, stdout);## 22 ##src/advio/dgclitimeo2.c##
}## 23 ##src/advio/dgclitimeo2.c##
}## 24 ##src/advio/dgclitimeo2.c##
================================================
FILE: advio/dgclitimeo3.c
================================================
#include "unp.h"
static void sig_alrm(int);
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];
Signal(SIGALRM, sig_alrm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(5);
if ( (n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL)) < 0) {
if (errno == EINTR)
fprintf(stderr, "socket timeout\n");
else
err_sys("recvfrom error");
} else {
alarm(0);
recvline[n] = 0; /* null terminate */
Fputs(recvline, stdout);
}
}
}
static void
sig_alrm(int signo)
{
return; /* just interrupt the recvfrom() */
}
================================================
FILE: advio/dgclitimeo3.lc
================================================
#include "unp.h"## 1 ##src/advio/dgclitimeo3.c##
static void sig_alrm(int);## 2 ##src/advio/dgclitimeo3.c##
void## 3 ##src/advio/dgclitimeo3.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/advio/dgclitimeo3.c##
{## 5 ##src/advio/dgclitimeo3.c##
int n;## 6 ##src/advio/dgclitimeo3.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 7 ##src/advio/dgclitimeo3.c##
Signal(SIGALRM, sig_alrm);## 8 ##src/advio/dgclitimeo3.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 9 ##src/advio/dgclitimeo3.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 10 ##src/advio/dgclitimeo3.c##
alarm(5);## 11 ##src/advio/dgclitimeo3.c##
if ((n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL)) < 0) {## 12 ##src/advio/dgclitimeo3.c##
if (errno == EINTR)## 13 ##src/advio/dgclitimeo3.c##
fprintf(stderr, "socket timeout\n");## 14 ##src/advio/dgclitimeo3.c##
else## 15 ##src/advio/dgclitimeo3.c##
err_sys("recvfrom error");## 16 ##src/advio/dgclitimeo3.c##
} else {## 17 ##src/advio/dgclitimeo3.c##
alarm(0);## 18 ##src/advio/dgclitimeo3.c##
recvline[n] = 0; /* null terminate */## 19 ##src/advio/dgclitimeo3.c##
Fputs(recvline, stdout);## 20 ##src/advio/dgclitimeo3.c##
}## 21 ##src/advio/dgclitimeo3.c##
}## 22 ##src/advio/dgclitimeo3.c##
}## 23 ##src/advio/dgclitimeo3.c##
static void## 24 ##src/advio/dgclitimeo3.c##
sig_alrm(int signo)## 25 ##src/advio/dgclitimeo3.c##
{## 26 ##src/advio/dgclitimeo3.c##
return; /* just interrupt the recvfrom() */## 27 ##src/advio/dgclitimeo3.c##
}## 28 ##src/advio/dgclitimeo3.c##
================================================
FILE: advio/dgechoaddr.c
================================================
#include "unpifi.h"
#undef MAXLINE
#define MAXLINE 20 /* to see datagram truncation */
void
dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)
{
int flags;
const int on = 1;
socklen_t len;
ssize_t n;
char mesg[MAXLINE], str[INET6_ADDRSTRLEN],
ifname[IFNAMSIZ];
struct in_addr in_zero;
struct unp_in_pktinfo pktinfo;
#ifdef IP_RECVDSTADDR
if (setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)) < 0)
err_ret("setsockopt of IP_RECVDSTADDR");
#endif
#ifdef IP_RECVIF
if (setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on)) < 0)
err_ret("setsockopt of IP_RECVIF");
#endif
bzero(&in_zero, sizeof(struct in_addr)); /* all 0 IPv4 address */
for ( ; ; ) {
len = clilen;
flags = 0;
n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,
pcliaddr, &len, &pktinfo);
printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));
if (memcmp(&pktinfo.ipi_addr, &in_zero, sizeof(in_zero)) != 0)
printf(", to %s", Inet_ntop(AF_INET, &pktinfo.ipi_addr,
str, sizeof(str)));
if (pktinfo.ipi_ifindex > 0)
printf(", recv i/f = %s",
If_indextoname(pktinfo.ipi_ifindex, ifname));
#ifdef MSG_TRUNC
if (flags & MSG_TRUNC) printf(" (datagram truncated)");
#endif
#ifdef MSG_CTRUNC
if (flags & MSG_CTRUNC) printf(" (control info truncated)");
#endif
#ifdef MSG_BCAST
if (flags & MSG_BCAST) printf(" (broadcast)");
#endif
#ifdef MSG_MCAST
if (flags & MSG_MCAST) printf(" (multicast)");
#endif
printf("\n");
Sendto(sockfd, mesg, n, 0, pcliaddr, len);
}
}
================================================
FILE: advio/dgechoaddr.lc
================================================
#include "unpifi.h"## 1 ##src/advio/dgechoaddr.c##
#undef MAXLINE## 2 ##src/advio/dgechoaddr.c##
#define MAXLINE 20 /* to see datagram truncation */## 3 ##src/advio/dgechoaddr.c##
void## 4 ##src/advio/dgechoaddr.c##
dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)## 5 ##src/advio/dgechoaddr.c##
{## 6 ##src/advio/dgechoaddr.c##
int flags;## 7 ##src/advio/dgechoaddr.c##
const int on = 1;## 8 ##src/advio/dgechoaddr.c##
socklen_t len;## 9 ##src/advio/dgechoaddr.c##
ssize_t n;## 10 ##src/advio/dgechoaddr.c##
char mesg[MAXLINE], str[INET6_ADDRSTRLEN], ifname[IFNAMSIZ];## 11 ##src/advio/dgechoaddr.c##
struct in_addr in_zero;## 12 ##src/advio/dgechoaddr.c##
struct in_pktinfo pktinfo;## 13 ##src/advio/dgechoaddr.c##
#ifdef IP_RECVDSTADDR## 14 ##src/advio/dgechoaddr.c##
if (setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)) < 0)## 15 ##src/advio/dgechoaddr.c##
err_ret("setsockopt of IP_RECVDSTADDR");## 16 ##src/advio/dgechoaddr.c##
#endif## 17 ##src/advio/dgechoaddr.c##
#ifdef IP_RECVIF## 18 ##src/advio/dgechoaddr.c##
if (setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on)) < 0)## 19 ##src/advio/dgechoaddr.c##
err_ret("setsockopt of IP_RECVIF");## 20 ##src/advio/dgechoaddr.c##
#endif## 21 ##src/advio/dgechoaddr.c##
bzero(&in_zero, sizeof(struct in_addr)); /* all 0 IPv4 address */## 22 ##src/advio/dgechoaddr.c##
for (;;) {## 23 ##src/advio/dgechoaddr.c##
len = clilen;## 24 ##src/advio/dgechoaddr.c##
flags = 0;## 25 ##src/advio/dgechoaddr.c##
n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,## 26 ##src/advio/dgechoaddr.c##
pcliaddr, &len, &pktinfo);## 27 ##src/advio/dgechoaddr.c##
printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));## 28 ##src/advio/dgechoaddr.c##
if (memcmp(&pktinfo.ipi_addr, &in_zero, sizeof(in_zero)) != 0)## 29 ##src/advio/dgechoaddr.c##
printf(", to %s", Inet_ntop(AF_INET, &pktinfo.ipi_addr,## 30 ##src/advio/dgechoaddr.c##
str, sizeof(str)));## 31 ##src/advio/dgechoaddr.c##
if (pktinfo.ipi_ifindex > 0)## 32 ##src/advio/dgechoaddr.c##
printf(", recv i/f = %s",## 33 ##src/advio/dgechoaddr.c##
If_indextoname(pktinfo.ipi_ifindex, ifname));## 34 ##src/advio/dgechoaddr.c##
#ifdef MSG_TRUNC## 35 ##src/advio/dgechoaddr.c##
if (flags & MSG_TRUNC)## 36 ##src/advio/dgechoaddr.c##
printf(" (datagram truncated)");## 37 ##src/advio/dgechoaddr.c##
#endif## 38 ##src/advio/dgechoaddr.c##
#ifdef MSG_CTRUNC## 39 ##src/advio/dgechoaddr.c##
if (flags & MSG_CTRUNC)## 40 ##src/advio/dgechoaddr.c##
printf(" (control info truncated)");## 41 ##src/advio/dgechoaddr.c##
#endif## 42 ##src/advio/dgechoaddr.c##
#ifdef MSG_BCAST## 43 ##src/advio/dgechoaddr.c##
if (flags & MSG_BCAST)## 44 ##src/advio/dgechoaddr.c##
printf(" (broadcast)");## 45 ##src/advio/dgechoaddr.c##
#endif## 46 ##src/advio/dgechoaddr.c##
#ifdef MSG_MCAST## 47 ##src/advio/dgechoaddr.c##
if (flags & MSG_MCAST)## 48 ##src/advio/dgechoaddr.c##
printf(" (multicast)");## 49 ##src/advio/dgechoaddr.c##
#endif## 50 ##src/advio/dgechoaddr.c##
printf("\n");## 51 ##src/advio/dgechoaddr.c##
Sendto(sockfd, mesg, n, 0, pcliaddr, len);## 52 ##src/advio/dgechoaddr.c##
}## 53 ##src/advio/dgechoaddr.c##
}## 54 ##src/advio/dgechoaddr.c##
================================================
FILE: advio/old/dgechoaddr.c
================================================
#include "unp.h"
#undef MAXLINE
#define MAXLINE 20 /* to see datagram truncation */
void
dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)
{
int flags;
const int on = 1;
socklen_t len;
ssize_t n;
char mesg[MAXLINE], str[INET6_ADDRSTRLEN];
struct in_addr dstaddr;
#ifdef IP_RECVDSTADDR
Setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
#endif
for ( ; ; ) {
len = clilen;
flags = 0;
n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,
pcliaddr, &len, &dstaddr);
printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));
if ((flags & MSG_CTRUNC) == 0)
printf(", to %s", Inet_ntop(AF_INET, &dstaddr, str, sizeof(str)));
#ifdef MSG_TRUNC
if (flags & MSG_TRUNC) printf(" (datagram truncated)");
#endif
#ifdef MSG_BCAST
if (flags & MSG_BCAST) printf(" (broadcast)");
#endif
#ifdef MSG_MCAST
if (flags & MSG_MCAST) printf(" (multicast)");
#endif
printf("\n");
Sendto(sockfd, mesg, n, 0, pcliaddr, clilen);
}
}
================================================
FILE: advio/old/recvfromflags.c
================================================
#include "unp.h"
ssize_t
recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
SA *sa, socklen_t *salenptr, void *dstaddrp)
{
struct msghdr msg;
struct iovec iov[1];
ssize_t n;
#ifdef HAVE_MSGHDR_MSG_CONTROL
#define CONTROL_LEN (sizeof(struct cmsghdr) + sizeof(struct in_addr))
char control[CONTROL_LEN];
msg.msg_control = control;
msg.msg_controllen = sizeof(control);
msg.msg_flags = 0;
#else
bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
#endif
msg.msg_name = sa;
msg.msg_namelen = *salenptr;
iov[0].iov_base = ptr;
iov[0].iov_len = nbytes;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
return(n);
*salenptr = msg.msg_namelen; /* pass back results */
#ifdef HAVE_MSGHDR_MSG_CONTROL
*flagsp = msg.msg_flags; /* pass back results */
/*
* We need someway to indicate to the caller that nothing was
* returned through dstaddrp (since all 32-bit values are valid
* IP destination addresses). To avoid having to add yet another
* pointer argument, we return MSG_CTRUNC (which unp.h always
* defines, even if the implementation does not).
*/
#ifdef IP_RECVDSTADDR
if (dstaddrp && msg.msg_controllen > 0 &&
(msg.msg_flags & MSG_CTRUNC) == 0) {
struct cmsghdr *cmptr = CMSG_FIRSTHDR(&msg);
if (cmptr->cmsg_len != CONTROL_LEN)
err_quit("control length = %d", cmptr->cmsg_len);
if (cmptr->cmsg_level != IPPROTO_IP)
err_quit("control level != IPPROTO_IP");
if (cmptr->cmsg_type != IP_RECVDSTADDR)
err_quit("control type != IP_RECVDSTADDR");
memcpy(dstaddrp, CMSG_DATA(cmptr), sizeof(struct in_addr));
} else
#endif
*flagsp |= MSG_CTRUNC; /* dest IP addr not returned */
#else
*flagsp |= MSG_CTRUNC; /* dest IP addr not returned */
#endif /* HAVE_MSGHDR_MSG_CONTROL */
return(n);
}
ssize_t
Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
SA *sa, socklen_t *salenptr, void *dstaddrp)
{
ssize_t n;
n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, dstaddrp);
if (n < 0)
err_quit("recvfrom_flags error");
return(n);
}
================================================
FILE: advio/old/test01.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd, flag;
ssize_t n;
char buff[MAXLINE];
const int on = 1;
socklen_t addrlen, len;
struct sockaddr *cliaddr;
if (argc == 2)
sockfd = Udp_server(NULL, argv[1], &addrlen);
else if (argc == 3)
sockfd = Udp_server(argv[1], argv[2], &addrlen);
else
err_quit("usage: test01 <hostname> <service>");
cliaddr = Malloc(addrlen);
#ifdef IP_RECVDSTADDR
Setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
len = sizeof(flag);
Getsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &flag, &len);
printf("IP_RECVDSTADDR option = %d, size = %d\n", flag, len);
#else
printf("IP_RECVDSTADDR not defined\n");
#endif
#ifdef IP_RECVIF
Setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on));
len = sizeof(flag);
Getsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &flag, &len);
printf("IP_RECVIF option = %d, size = %d\n", flag, len);
#else
printf("IP_RECVIF not defined\n");
#endif
for ( ; ; ) {
#define CONTROL_LEN (sizeof(struct cmsghdr) + sizeof(struct in_addr))
char control[CONTROL_LEN];
msg.msg_control = control;
msg.msg_controllen = sizeof(control);
msg.msg_flags = 0;
#else
bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
#endif
msg.msg_name = sa;
msg.msg_namelen = *salenptr;
iov[0].iov_base = ptr;
iov[0].iov_len = nbytes;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
return(n);
len = addrlen;
n = Recvfrom(sockfd, buff, MAXLINE, 0, cliaddr, &len);
printf("datagram from %s\n", Sock_ntop(cliaddr, len));
ticks = time(NULL);
snprintf(buff, sizeof(buff), "%.24s\r\n", ctime(&ticks));
Sendto(sockfd, buff, strlen(buff), 0, cliaddr, len);
}
exit(0);
}
================================================
FILE: advio/recvfromflags.c
================================================
/* include recvfrom_flags1 */
#include "unp.h"
#include <sys/param.h> /* ALIGN macro for CMSG_NXTHDR() macro */
ssize_t
recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
SA *sa, socklen_t *salenptr, struct unp_in_pktinfo *pktp)
{
struct msghdr msg;
struct iovec iov[1];
ssize_t n;
#ifdef HAVE_MSGHDR_MSG_CONTROL
struct cmsghdr *cmptr;
union {
struct cmsghdr cm;
char control[CMSG_SPACE(sizeof(struct in_addr)) +
CMSG_SPACE(sizeof(struct unp_in_pktinfo))];
} control_un;
msg.msg_control = control_un.control;
msg.msg_controllen = sizeof(control_un.control);
msg.msg_flags = 0;
#else
bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
#endif
msg.msg_name = sa;
msg.msg_namelen = *salenptr;
iov[0].iov_base = ptr;
iov[0].iov_len = nbytes;
msg.msg_iov = iov;
msg.msg_iovlen = 1;
if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
return(n);
*salenptr = msg.msg_namelen; /* pass back results */
if (pktp)
bzero(pktp, sizeof(struct unp_in_pktinfo)); /* 0.0.0.0, i/f = 0 */
/* end recvfrom_flags1 */
/* include recvfrom_flags2 */
#ifndef HAVE_MSGHDR_MSG_CONTROL
*flagsp = 0; /* pass back results */
return(n);
#else
*flagsp = msg.msg_flags; /* pass back results */
if (msg.msg_controllen < sizeof(struct cmsghdr) ||
(msg.msg_flags & MSG_CTRUNC) || pktp == NULL)
return(n);
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;
cmptr = CMSG_NXTHDR(&msg, cmptr)) {
#ifdef IP_RECVDSTADDR
if (cmptr->cmsg_level == IPPROTO_IP &&
cmptr->cmsg_type == IP_RECVDSTADDR) {
memcpy(&pktp->ipi_addr, CMSG_DATA(cmptr),
sizeof(struct in_addr));
continue;
}
#endif
#ifdef IP_RECVIF
if (cmptr->cmsg_level == IPPROTO_IP &&
cmptr->cmsg_type == IP_RECVIF) {
struct sockaddr_dl *sdl;
sdl = (struct sockaddr_dl *) CMSG_DATA(cmptr);
pktp->ipi_ifindex = sdl->sdl_index;
continue;
}
#endif
err_quit("unknown ancillary data, len = %d, level = %d, type = %d",
cmptr->cmsg_len, cmptr->cmsg_level, cmptr->cmsg_type);
}
return(n);
#endif /* HAVE_MSGHDR_MSG_CONTROL */
}
/* end recvfrom_flags2 */
ssize_t
Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
SA *sa, socklen_t *salenptr, struct unp_in_pktinfo *pktp)
{
ssize_t n;
n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, pktp);
if (n < 0)
err_quit("recvfrom_flags error");
return(n);
}
================================================
FILE: advio/recvfromflags.lc
================================================
/* include recvfrom_flags1 */
#include "unp.h"## 1 ##src/advio/recvfromflags.c##
#include <sys/param.h> /* ALIGN macro for CMSG_NXTHDR() macro */## 2 ##src/advio/recvfromflags.c##
#ifdef HAVE_SOCKADDR_DL_STRUCT## 3 ##src/advio/recvfromflags.c##
# include <net/if_dl.h>## 4 ##src/advio/recvfromflags.c##
#endif## 5 ##src/advio/recvfromflags.c##
ssize_t## 6 ##src/advio/recvfromflags.c##
recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,## 7 ##src/advio/recvfromflags.c##
SA *sa, socklen_t *salenptr, struct in_pktinfo *pktp)## 8 ##src/advio/recvfromflags.c##
{## 9 ##src/advio/recvfromflags.c##
struct msghdr msg;## 10 ##src/advio/recvfromflags.c##
struct iovec iov[1];## 11 ##src/advio/recvfromflags.c##
ssize_t n;## 12 ##src/advio/recvfromflags.c##
#ifdef HAVE_MSGHDR_MSG_CONTROL## 13 ##src/advio/recvfromflags.c##
struct cmsghdr *cmptr;## 14 ##src/advio/recvfromflags.c##
union {## 15 ##src/advio/recvfromflags.c##
struct cmsghdr cm;## 16 ##src/advio/recvfromflags.c##
char control[CMSG_SPACE(sizeof(struct in_addr)) +## 17 ##src/advio/recvfromflags.c##
CMSG_SPACE(sizeof(struct in_pktinfo))];## 18 ##src/advio/recvfromflags.c##
} control_un;## 19 ##src/advio/recvfromflags.c##
msg.msg_control = control_un.control;## 20 ##src/advio/recvfromflags.c##
msg.msg_controllen = sizeof(control_un.control);## 21 ##src/advio/recvfromflags.c##
msg.msg_flags = 0;## 22 ##src/advio/recvfromflags.c##
#else## 23 ##src/advio/recvfromflags.c##
bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */## 24 ##src/advio/recvfromflags.c##
#endif## 25 ##src/advio/recvfromflags.c##
msg.msg_name = sa;## 26 ##src/advio/recvfromflags.c##
msg.msg_namelen = *salenptr;## 27 ##src/advio/recvfromflags.c##
iov[0].iov_base = ptr;## 28 ##src/advio/recvfromflags.c##
iov[0].iov_len = nbytes;## 29 ##src/advio/recvfromflags.c##
msg.msg_iov = iov;## 30 ##src/advio/recvfromflags.c##
msg.msg_iovlen = 1;## 31 ##src/advio/recvfromflags.c##
if ((n = recvmsg(fd, &msg, *flagsp)) < 0)## 32 ##src/advio/recvfromflags.c##
return (n);## 33 ##src/advio/recvfromflags.c##
*salenptr = msg.msg_namelen; /* pass back results */## 34 ##src/advio/recvfromflags.c##
if (pktp)## 35 ##src/advio/recvfromflags.c##
bzero(pktp, sizeof(struct in_pktinfo)); /* 0.0.0.0, i/f = 0 */## 36 ##src/advio/recvfromflags.c##
/* end recvfrom_flags1 */
/* include recvfrom_flags2 */
#ifndef HAVE_MSGHDR_MSG_CONTROL## 37 ##src/advio/recvfromflags.c##
*flagsp = 0; /* pass back results */## 38 ##src/advio/recvfromflags.c##
return (n);## 39 ##src/advio/recvfromflags.c##
#else## 40 ##src/advio/recvfromflags.c##
*flagsp = msg.msg_flags; /* pass back results */## 41 ##src/advio/recvfromflags.c##
if (msg.msg_controllen < sizeof(struct cmsghdr) ||## 42 ##src/advio/recvfromflags.c##
(msg.msg_flags & MSG_CTRUNC) || pktp == NULL)## 43 ##src/advio/recvfromflags.c##
return (n);## 44 ##src/advio/recvfromflags.c##
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;## 45 ##src/advio/recvfromflags.c##
cmptr = CMSG_NXTHDR(&msg, cmptr)) {## 46 ##src/advio/recvfromflags.c##
#ifdef IP_RECVDSTADDR## 47 ##src/advio/recvfromflags.c##
if (cmptr->cmsg_level == IPPROTO_IP &&## 48 ##src/advio/recvfromflags.c##
cmptr->cmsg_type == IP_RECVDSTADDR) {## 49 ##src/advio/recvfromflags.c##
memcpy(&pktp->ipi_addr, CMSG_DATA(cmptr),## 50 ##src/advio/recvfromflags.c##
sizeof(struct in_addr));## 51 ##src/advio/recvfromflags.c##
continue;## 52 ##src/advio/recvfromflags.c##
}## 53 ##src/advio/recvfromflags.c##
#endif## 54 ##src/advio/recvfromflags.c##
#ifdef IP_RECVIF## 55 ##src/advio/recvfromflags.c##
if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVIF) {## 56 ##src/advio/recvfromflags.c##
struct sockaddr_dl *sdl;## 57 ##src/advio/recvfromflags.c##
sdl = (struct sockaddr_dl *) CMSG_DATA(cmptr);## 58 ##src/advio/recvfromflags.c##
pktp->ipi_ifindex = sdl->sdl_index;## 59 ##src/advio/recvfromflags.c##
continue;## 60 ##src/advio/recvfromflags.c##
}## 61 ##src/advio/recvfromflags.c##
#endif## 62 ##src/advio/recvfromflags.c##
err_quit("unknown ancillary data, len = %d, level = %d, type = %d",## 63 ##src/advio/recvfromflags.c##
cmptr->cmsg_len, cmptr->cmsg_level, cmptr->cmsg_type);## 64 ##src/advio/recvfromflags.c##
}## 65 ##src/advio/recvfromflags.c##
return (n);## 66 ##src/advio/recvfromflags.c##
#endif /* HAVE_MSGHDR_MSG_CONTROL */## 67 ##src/advio/recvfromflags.c##
}## 68 ##src/advio/recvfromflags.c##
/* end recvfrom_flags2 */
ssize_t## 69 ##src/advio/recvfromflags.c##
Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,## 70 ##src/advio/recvfromflags.c##
SA *sa, socklen_t *salenptr, struct in_pktinfo *pktp)## 71 ##src/advio/recvfromflags.c##
{## 72 ##src/advio/recvfromflags.c##
ssize_t n;## 73 ##src/advio/recvfromflags.c##
n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, pktp);## 74 ##src/advio/recvfromflags.c##
if (n < 0)## 75 ##src/advio/recvfromflags.c##
err_quit("recvfrom_flags error");## 76 ##src/advio/recvfromflags.c##
return (n);## 77 ##src/advio/recvfromflags.c##
}## 78 ##src/advio/recvfromflags.c##
================================================
FILE: advio/script.1
================================================
kalae % ./udpserv01
9-byte datagram from 206.62.226.33.41164, to 206.62.226.35, recv i/f = ef0
13-byte datagram from 206.62.226.65.1057, to 206.62.226.95, recv i/f = we0 (broadcast)
4-byte datagram from 206.62.226.33.41176, to 224.0.0.1, recv i/f = ef0 (multicast)
20-byte datagram from 127.0.0.1.4632, to 127.0.0.1, recv i/f = lo0 (datagram truncated)
9-byte datagram from 206.62.226.33.41178, to 206.62.226.66, recv i/f = ef0
================================================
FILE: advio/sig_chld_waitpid.c
================================================
#include "unp.h"
void
sig_chld(int signo)
{
pid_t pid;
int stat;
while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0) {
printf("child %d terminated\n", pid);
}
return;
}
================================================
FILE: advio/str_cli_kqueue04.c
================================================
#include "unp.h"
void
str_cli(FILE *fp, int sockfd)
{
int kq, i, n, nev, stdineof = 0, isfile;
char buf[MAXLINE];
struct kevent kev[2];
struct timespec ts;
struct stat st;
isfile = ((fstat(fileno(fp), &st) == 0) &&
(st.st_mode & S_IFMT) == S_IFREG);
EV_SET(&kev[0], fileno(fp), EVFILT_READ, EV_ADD, 0, 0, NULL);
EV_SET(&kev[1], sockfd, EVFILT_READ, EV_ADD, 0, 0, NULL);
kq = Kqueue();
ts.tv_sec = ts.tv_nsec = 0;
Kevent(kq, kev, 2, NULL, 0, &ts);
for ( ; ; ) {
nev = Kevent(kq, NULL, 0, kev, 2, NULL);
for (i = 0; i < nev; i++) {
if (kev[i].ident == sockfd) { /* socket is readable */
if ( (n = Read(sockfd, buf, MAXLINE)) == 0) {
if (stdineof == 1)
return; /* normal termination */
else
err_quit("str_cli: server terminated prematurely");
}
Write(fileno(stdout), buf, n);
}
if (kev[i].ident == fileno(fp)) { /* input is readable */
n = Read(fileno(fp), buf, MAXLINE);
if (n > 0)
Writen(sockfd, buf, n);
if (n == 0 || (isfile && n == kev[i].data)) {
stdineof = 1;
Shutdown(sockfd, SHUT_WR); /* send FIN */
kev[i].flags = EV_DELETE;
Kevent(kq, &kev[i], 1, NULL, 0, &ts); /* remove kevent */
continue;
}
}
}
}
}
================================================
FILE: advio/str_cli_poll03.c
================================================
#include "unp.h"
#include <sys/devpoll.h>
void
str_cli(FILE *fp, int sockfd)
{
int stdineof;
char buf[MAXLINE];
int n;
int wfd;
struct pollfd pollfd[2];
struct dvpoll dopoll;
int i;
int result;
wfd = Open("/dev/poll", O_RDWR, 0);
pollfd[0].fd = fileno(fp);
pollfd[0].events = POLLIN;
pollfd[0].revents = 0;
pollfd[1].fd = sockfd;
pollfd[1].events = POLLIN;
pollfd[1].revents = 0;
Write(wfd, pollfd, sizeof(struct pollfd) * 2);
stdineof = 0;
for ( ; ; ) {
/* block until /dev/poll says something is ready */
dopoll.dp_timeout = -1;
dopoll.dp_nfds = 2;
dopoll.dp_fds = pollfd;
result = Ioctl(wfd, DP_POLL, &dopoll);
/* loop through ready file descriptors */
for (i = 0; i < result; i++) {
if (dopoll.dp_fds[i].fd == sockfd) {
/* socket is readable */
if ( (n = Read(sockfd, buf, MAXLINE)) == 0) {
if (stdineof == 1)
return; /* normal termination */
else
err_quit("str_cli: server terminated prematurely");
}
Write(fileno(stdout), buf, n);
} else {
/* input is readable */
if ( (n = Read(fileno(fp), buf, MAXLINE)) == 0) {
stdineof = 1;
Shutdown(sockfd, SHUT_WR); /* send FIN */
continue;
}
Writen(sockfd, buf, n);
}
}
}
}
================================================
FILE: advio/str_cli_select02.c
================================================
#include "unp.h"
void
str_cli(FILE *fp, int sockfd)
{
int maxfdp1, stdineof = 0;
fd_set rset;
char sendline[MAXLINE], recvline[MAXLINE];
FD_ZERO(&rset);
for ( ; ; ) {
if (stdineof == 0)
FD_SET(fileno(fp), &rset);
FD_SET(sockfd, &rset);
maxfdp1 = max(fileno(fp), sockfd) + 1;
Select(maxfdp1, &rset, NULL, NULL, NULL);
if (FD_ISSET(sockfd, &rset)) { /* socket is readable */
if (Readline(sockfd, recvline, MAXLINE) == 0) {
if (stdineof == 1)
return; /* normal termination */
else
err_quit("str_cli: server terminated prematurely");
}
Fputs(recvline, stdout);
}
if (FD_ISSET(fileno(fp), &rset)) { /* input is readable */
if (Fgets(sendline, MAXLINE, fp) == NULL) {
stdineof = 1;
Shutdown(sockfd, SHUT_WR); /* send FIN */
FD_CLR(fileno(fp), &rset);
continue;
}
Writen(sockfd, sendline, strlen(sendline));
}
}
}
================================================
FILE: advio/str_echo_stdio02.c
================================================
#include "unp.h"
void
str_echo(int sockfd)
{
char line[MAXLINE];
FILE *fpin, *fpout;
fpin = Fdopen(sockfd, "r");
fpout = Fdopen(sockfd, "w");
while (Fgets(line, MAXLINE, fpin) != NULL)
Fputs(line, fpout);
}
================================================
FILE: advio/str_echo_stdio02.lc
================================================
#include "unp.h"## 1 ##src/advio/str_echo_stdio02.c##
void## 2 ##src/advio/str_echo_stdio02.c##
str_echo(int sockfd)## 3 ##src/advio/str_echo_stdio02.c##
{## 4 ##src/advio/str_echo_stdio02.c##
char line[MAXLINE];## 5 ##src/advio/str_echo_stdio02.c##
FILE *fpin, *fpout;## 6 ##src/advio/str_echo_stdio02.c##
fpin = Fdopen(sockfd, "r");## 7 ##src/advio/str_echo_stdio02.c##
fpout = Fdopen(sockfd, "w");## 8 ##src/advio/str_echo_stdio02.c##
while (Fgets(line, MAXLINE, fpin) != NULL)## 9 ##src/advio/str_echo_stdio02.c##
Fputs(line, fpout);## 10 ##src/advio/str_echo_stdio02.c##
}## 11 ##src/advio/str_echo_stdio02.c##
================================================
FILE: advio/tcpcli01.c
================================================
/* Use standard echo server; baseline measurements for nonblocking version */
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: tcpcli <IPaddress>");
sockfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(7);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
Connect_timeo(sockfd, (SA *) &servaddr, sizeof(servaddr), 10);
str_cli(stdin, sockfd); /* do it all */
exit(0);
}
================================================
FILE: advio/tcpcli02.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: tcpcli <IPaddress>");
sockfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(SERV_PORT);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
str_cli(stdin, sockfd); /* do it all */
exit(0);
}
================================================
FILE: advio/tcpcli03.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: tcpcli <IPaddress>");
sockfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(SERV_PORT);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
str_cli(stdin, sockfd); /* do it all */
exit(0);
}
================================================
FILE: advio/tcpcli04.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: tcpcli <IPaddress>");
sockfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(SERV_PORT);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
str_cli(stdin, sockfd); /* do it all */
exit(0);
}
================================================
FILE: advio/tcpserv02.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int listenfd, connfd;
pid_t childpid;
socklen_t clilen;
struct sockaddr_in cliaddr, servaddr;
void sig_chld(int);
listenfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Bind(listenfd, (SA *) &servaddr, sizeof(servaddr));
Listen(listenfd, LISTENQ);
Signal(SIGCHLD, sig_chld);
for ( ; ; ) {
clilen = sizeof(cliaddr);
if ( (connfd = accept(listenfd, (SA *) &cliaddr, &clilen)) < 0) {
if (errno == EINTR)
continue; /* back to for() */
else
err_sys("accept error");
}
if ( (childpid = Fork()) == 0) { /* child process */
Close(listenfd); /* close listening socket */
str_echo(connfd); /* process the request */
exit(0);
}
Close(connfd); /* parent closes connected socket */
}
}
================================================
FILE: advio/udpcli01.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(7);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: advio/udpcli02.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(7);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: advio/udpcli03.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(7);
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: advio/udpserv01.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr, cliaddr;
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Bind(sockfd, (SA *) &servaddr, sizeof(servaddr));
dg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr));
}
================================================
FILE: advio/udpserv03.c
================================================
/* include udpserv1 */
#include "unpifi.h"
void mydg_echo(int, SA *, socklen_t, SA *);
int
main(int argc, char **argv)
{
int sockfd;
const int on = 1;
pid_t pid;
struct ifi_info *ifi, *ifihead;
struct sockaddr_in *sa, cliaddr, wildaddr;
for (ifihead = ifi = Get_ifi_info(AF_INET, 1);
ifi != NULL; ifi = ifi->ifi_next) {
/*4bind unicast address */
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
sa = (struct sockaddr_in *) ifi->ifi_addr;
sa->sin_family = AF_INET;
sa->sin_port = htons(SERV_PORT);
Bind(sockfd, (SA *) sa, sizeof(*sa));
printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);
exit(0); /* never executed */
}
/* end udpserv1 */
/* include udpserv2 */
if (ifi->ifi_flags & IFF_BROADCAST) {
/* 4try to bind broadcast address */
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
sa = (struct sockaddr_in *) ifi->ifi_brdaddr;
sa->sin_family = AF_INET;
sa->sin_port = htons(SERV_PORT);
if (bind(sockfd, (SA *) sa, sizeof(*sa)) < 0) {
if (errno == EADDRINUSE) {
printf("EADDRINUSE: %s\n",
Sock_ntop((SA *) sa, sizeof(*sa)));
Close(sockfd);
continue;
} else
err_sys("bind error for %s",
Sock_ntop((SA *) sa, sizeof(*sa)));
}
printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr),
(SA *) sa);
exit(0); /* never executed */
}
}
}
/* end udpserv2 */
/* include udpserv3 */
/* 4bind wildcard address */
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
bzero(&wildaddr, sizeof(wildaddr));
wildaddr.sin_family = AF_INET;
wildaddr.sin_addr.s_addr = htonl(INADDR_ANY);
wildaddr.sin_port = htons(SERV_PORT);
Bind(sockfd, (SA *) &wildaddr, sizeof(wildaddr));
printf("bound %s\n", Sock_ntop((SA *) &wildaddr, sizeof(wildaddr)));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);
exit(0); /* never executed */
}
exit(0);
}
/* end udpserv3 */
/* include mydg_echo */
void
mydg_echo(int sockfd, SA *pcliaddr, socklen_t clilen, SA *myaddr)
{
int n;
char mesg[MAXLINE];
socklen_t len;
for ( ; ; ) {
len = clilen;
n = Recvfrom(sockfd, mesg, MAXLINE, 0, pcliaddr, &len);
printf("child %d, datagram from %s", getpid(),
Sock_ntop(pcliaddr, len));
printf(", to %s\n", Sock_ntop(myaddr, clilen));
Sendto(sockfd, mesg, n, 0, pcliaddr, len);
}
}
/* end mydg_echo */
================================================
FILE: advio/udpserv03.lc
================================================
/* include udpserv1 */
#include "unpifi.h"## 1 ##src/advio/udpserv03.c##
void mydg_echo(int, SA *, socklen_t, SA *);## 2 ##src/advio/udpserv03.c##
int## 3 ##src/advio/udpserv03.c##
main(int argc, char **argv)## 4 ##src/advio/udpserv03.c##
{## 5 ##src/advio/udpserv03.c##
int sockfd;## 6 ##src/advio/udpserv03.c##
const int on = 1;## 7 ##src/advio/udpserv03.c##
pid_t pid;## 8 ##src/advio/udpserv03.c##
struct ifi_info *ifi, *ifihead;## 9 ##src/advio/udpserv03.c##
struct sockaddr_in *sa, cliaddr, wildaddr;## 10 ##src/advio/udpserv03.c##
for (ifihead = ifi = Get_ifi_info(AF_INET, 1);## 11 ##src/advio/udpserv03.c##
ifi != NULL; ifi = ifi->ifi_next) {## 12 ##src/advio/udpserv03.c##
/* 4bind unicast address */## 13 ##src/advio/udpserv03.c##
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 14 ##src/advio/udpserv03.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 15 ##src/advio/udpserv03.c##
sa = (struct sockaddr_in *) ifi->ifi_addr;## 16 ##src/advio/udpserv03.c##
sa->sin_family = AF_INET;## 17 ##src/advio/udpserv03.c##
sa->sin_port = htons(SERV_PORT);## 18 ##src/advio/udpserv03.c##
Bind(sockfd, (SA *) sa, sizeof(*sa));## 19 ##src/advio/udpserv03.c##
printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));## 20 ##src/advio/udpserv03.c##
if ((pid = Fork()) == 0) { /* child */## 21 ##src/advio/udpserv03.c##
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);## 22 ##src/advio/udpserv03.c##
exit(0); /* never executed */## 23 ##src/advio/udpserv03.c##
}## 24 ##src/advio/udpserv03.c##
/* end udpserv1 */
/* include udpserv2 */
if (ifi->ifi_flags & IFF_BROADCAST) {## 25 ##src/advio/udpserv03.c##
/* 4try to bind broadcast address */## 26 ##src/advio/udpserv03.c##
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 27 ##src/advio/udpserv03.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 28 ##src/advio/udpserv03.c##
sa = (struct sockaddr_in *) ifi->ifi_brdaddr;## 29 ##src/advio/udpserv03.c##
sa->sin_family = AF_INET;## 30 ##src/advio/udpserv03.c##
sa->sin_port = htons(SERV_PORT);## 31 ##src/advio/udpserv03.c##
if (bind(sockfd, (SA *) sa, sizeof(*sa)) < 0) {## 32 ##src/advio/udpserv03.c##
if (errno == EADDRINUSE) {## 33 ##src/advio/udpserv03.c##
printf("EADDRINUSE: %s\n",## 34 ##src/advio/udpserv03.c##
Sock_ntop((SA *) sa, sizeof(*sa)));## 35 ##src/advio/udpserv03.c##
Close(sockfd);## 36 ##src/advio/udpserv03.c##
continue;## 37 ##src/advio/udpserv03.c##
} else## 38 ##src/advio/udpserv03.c##
err_sys("bind error for %s",## 39 ##src/advio/udpserv03.c##
Sock_ntop((SA *) sa, sizeof(*sa)));## 40 ##src/advio/udpserv03.c##
}## 41 ##src/advio/udpserv03.c##
printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));## 42 ##src/advio/udpserv03.c##
if ((pid = Fork()) == 0) { /* child */## 43 ##src/advio/udpserv03.c##
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr),## 44 ##src/advio/udpserv03.c##
(SA *) sa);## 45 ##src/advio/udpserv03.c##
exit(0); /* never executed */## 46 ##src/advio/udpserv03.c##
}## 47 ##src/advio/udpserv03.c##
}## 48 ##src/advio/udpserv03.c##
}## 49 ##src/advio/udpserv03.c##
/* end udpserv2 */
/* include udpserv3 */
/* 4bind wildcard address */## 50 ##src/advio/udpserv03.c##
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 51 ##src/advio/udpserv03.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 52 ##src/advio/udpserv03.c##
bzero(&wildaddr, sizeof(wildaddr));## 53 ##src/advio/udpserv03.c##
wildaddr.sin_family = AF_INET;## 54 ##src/advio/udpserv03.c##
wildaddr.sin_addr.s_addr = htonl(INADDR_ANY);## 55 ##src/advio/udpserv03.c##
wildaddr.sin_port = htons(SERV_PORT);## 56 ##src/advio/udpserv03.c##
Bind(sockfd, (SA *) &wildaddr, sizeof(wildaddr));## 57 ##src/advio/udpserv03.c##
printf("bound %s\n", Sock_ntop((SA *) &wildaddr, sizeof(wildaddr)));## 58 ##src/advio/udpserv03.c##
if ((pid = Fork()) == 0) { /* child */## 59 ##src/advio/udpserv03.c##
mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);## 60 ##src/advio/udpserv03.c##
exit(0); /* never executed */## 61 ##src/advio/udpserv03.c##
}## 62 ##src/advio/udpserv03.c##
exit(0);## 63 ##src/advio/udpserv03.c##
}## 64 ##src/advio/udpserv03.c##
/* end udpserv3 */
/* include mydg_echo */
void## 65 ##src/advio/udpserv03.c##
mydg_echo(int sockfd, SA *pcliaddr, socklen_t clilen, SA *myaddr)## 66 ##src/advio/udpserv03.c##
{## 67 ##src/advio/udpserv03.c##
int n;## 68 ##src/advio/udpserv03.c##
char mesg[MAXLINE];## 69 ##src/advio/udpserv03.c##
socklen_t len;## 70 ##src/advio/udpserv03.c##
for (;;) {## 71 ##src/advio/udpserv03.c##
len = clilen;## 72 ##src/advio/udpserv03.c##
n = Recvfrom(sockfd, mesg, MAXLINE, 0, pcliaddr, &len);## 73 ##src/advio/udpserv03.c##
printf("child %d, datagram from %s", getpid(),## 74 ##src/advio/udpserv03.c##
Sock_ntop(pcliaddr, len));## 75 ##src/advio/udpserv03.c##
printf(", to %s\n", Sock_ntop(myaddr, clilen));## 76 ##src/advio/udpserv03.c##
Sendto(sockfd, mesg, n, 0, pcliaddr, len);## 77 ##src/advio/udpserv03.c##
}## 78 ##src/advio/udpserv03.c##
}## 79 ##src/advio/udpserv03.c##
/* end mydg_echo */
================================================
FILE: advio/udpserv04.c
================================================
#include "unpifi.h"
void mydg_echo(int, SA *, socklen_t);
int
main(int argc, char **argv)
{
int sockfd, family, port;
const int on = 1;
pid_t pid;
socklen_t salen;
struct sockaddr *sa, *wild;
struct ifi_info *ifi, *ifihead;
if (argc == 2)
sockfd = Udp_client(NULL, argv[1], (void **) &sa, &salen);
else if (argc == 3)
sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);
else
err_quit("usage: udpserv04 [ <host> ] <service or port>");
family = sa->sa_family;
port = sock_get_port(sa, salen);
Close(sockfd); /* we just want family, port, salen */
for (ifihead = ifi = Get_ifi_info(family, 1);
ifi != NULL; ifi = ifi->ifi_next) {
/*4bind unicast address */
sockfd = Socket(family, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
sock_set_port(ifi->ifi_addr, salen, port);
Bind(sockfd, ifi->ifi_addr, salen);
printf("bound %s\n", Sock_ntop(ifi->ifi_addr, salen));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, ifi->ifi_addr, salen);
exit(0); /* never executed */
}
if (ifi->ifi_flags & IFF_BROADCAST) {
/* 4try to bind broadcast address */
sockfd = Socket(family, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
sock_set_port(ifi->ifi_brdaddr, salen, port);
if (bind(sockfd, ifi->ifi_brdaddr, salen) < 0) {
if (errno == EADDRINUSE) {
printf("EADDRINUSE: %s\n",
Sock_ntop(ifi->ifi_brdaddr, salen));
Close(sockfd);
continue;
} else
err_sys("bind error for %s",
Sock_ntop(ifi->ifi_brdaddr, salen));
}
printf("bound %s\n", Sock_ntop(ifi->ifi_brdaddr, salen));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, ifi->ifi_brdaddr, salen);
exit(0); /* never executed */
}
}
}
/* 4bind wildcard address */
sockfd = Socket(family, SOCK_DGRAM, 0);
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
wild = Malloc(salen);
memcpy(wild, sa, salen); /* copy family and port */
sock_set_wild(wild, salen);
Bind(sockfd, wild, salen);
printf("bound %s\n", Sock_ntop(wild, salen));
if ( (pid = Fork()) == 0) { /* child */
mydg_echo(sockfd, wild, salen);
exit(0); /* never executed */
}
exit(0);
}
void
mydg_echo(int sockfd, SA *myaddr, socklen_t salen)
{
int n;
char mesg[MAXLINE];
socklen_t len;
struct sockaddr *cli;
cli = Malloc(salen);
for ( ; ; ) {
len = salen;
n = Recvfrom(sockfd, mesg, MAXLINE, 0, cli, &len);
printf("child %d, datagram from %s",
getpid(), Sock_ntop(cli, len));
printf(", to %s\n", Sock_ntop(myaddr, salen));
Sendto(sockfd, mesg, n, 0, cli, len);
}
}
================================================
FILE: advio/udpserv04.lc
================================================
#include "unpifi.h"## 1 ##src/advio/udpserv04.c##
void mydg_echo(int, SA *, socklen_t);## 2 ##src/advio/udpserv04.c##
int## 3 ##src/advio/udpserv04.c##
main(int argc, char **argv)## 4 ##src/advio/udpserv04.c##
{## 5 ##src/advio/udpserv04.c##
int sockfd, family, port;## 6 ##src/advio/udpserv04.c##
const int on = 1;## 7 ##src/advio/udpserv04.c##
pid_t pid;## 8 ##src/advio/udpserv04.c##
socklen_t salen;## 9 ##src/advio/udpserv04.c##
struct sockaddr *sa, *wild;## 10 ##src/advio/udpserv04.c##
struct ifi_info *ifi, *ifihead;## 11 ##src/advio/udpserv04.c##
if (argc == 2)## 12 ##src/advio/udpserv04.c##
sockfd = Udp_client(NULL, argv[1], (void **) &sa, &salen);## 13 ##src/advio/udpserv04.c##
else if (argc == 3)## 14 ##src/advio/udpserv04.c##
sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);## 15 ##src/advio/udpserv04.c##
else## 16 ##src/advio/udpserv04.c##
err_quit("usage: udpserv04 [ <host> ] <service or port>");## 17 ##src/advio/udpserv04.c##
family = sa->sa_family;## 18 ##src/advio/udpserv04.c##
port = sock_get_port(sa, salen);## 19 ##src/advio/udpserv04.c##
Close(sockfd); /* we just want family, port, salen */## 20 ##src/advio/udpserv04.c##
for (ifihead = ifi = Get_ifi_info(family, 1);## 21 ##src/advio/udpserv04.c##
ifi != NULL; ifi = ifi->ifi_next) {## 22 ##src/advio/udpserv04.c##
/* 4bind unicast address */## 23 ##src/advio/udpserv04.c##
sockfd = Socket(family, SOCK_DGRAM, 0);## 24 ##src/advio/udpserv04.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 25 ##src/advio/udpserv04.c##
sock_set_port(ifi->ifi_addr, salen, port);## 26 ##src/advio/udpserv04.c##
Bind(sockfd, ifi->ifi_addr, salen);## 27 ##src/advio/udpserv04.c##
printf("bound %s\n", Sock_ntop(ifi->ifi_addr, salen));## 28 ##src/advio/udpserv04.c##
if ((pid = Fork()) == 0) { /* child */## 29 ##src/advio/udpserv04.c##
mydg_echo(sockfd, ifi->ifi_addr, salen);## 30 ##src/advio/udpserv04.c##
exit(0); /* never executed */## 31 ##src/advio/udpserv04.c##
}## 32 ##src/advio/udpserv04.c##
if (ifi->ifi_flags & IFF_BROADCAST) {## 33 ##src/advio/udpserv04.c##
/* 4try to bind broadcast address */## 34 ##src/advio/udpserv04.c##
sockfd = Socket(family, SOCK_DGRAM, 0);## 35 ##src/advio/udpserv04.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 36 ##src/advio/udpserv04.c##
sock_set_port(ifi->ifi_brdaddr, salen, port);## 37 ##src/advio/udpserv04.c##
if (bind(sockfd, ifi->ifi_brdaddr, salen) < 0) {## 38 ##src/advio/udpserv04.c##
if (errno == EADDRINUSE) {## 39 ##src/advio/udpserv04.c##
printf("EADDRINUSE: %s\n",## 40 ##src/advio/udpserv04.c##
Sock_ntop(ifi->ifi_brdaddr, salen));## 41 ##src/advio/udpserv04.c##
Close(sockfd);## 42 ##src/advio/udpserv04.c##
continue;## 43 ##src/advio/udpserv04.c##
} else## 44 ##src/advio/udpserv04.c##
err_sys("bind error for %s",## 45 ##src/advio/udpserv04.c##
Sock_ntop(ifi->ifi_brdaddr, salen));## 46 ##src/advio/udpserv04.c##
}## 47 ##src/advio/udpserv04.c##
printf("bound %s\n", Sock_ntop(ifi->ifi_brdaddr, salen));## 48 ##src/advio/udpserv04.c##
if ((pid = Fork()) == 0) { /* child */## 49 ##src/advio/udpserv04.c##
mydg_echo(sockfd, ifi->ifi_brdaddr, salen);## 50 ##src/advio/udpserv04.c##
exit(0); /* never executed */## 51 ##src/advio/udpserv04.c##
}## 52 ##src/advio/udpserv04.c##
}## 53 ##src/advio/udpserv04.c##
}## 54 ##src/advio/udpserv04.c##
/* 4bind wildcard address */## 55 ##src/advio/udpserv04.c##
sockfd = Socket(family, SOCK_DGRAM, 0);## 56 ##src/advio/udpserv04.c##
Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 57 ##src/advio/udpserv04.c##
wild = Malloc(salen);## 58 ##src/advio/udpserv04.c##
memcpy(wild, sa, salen); /* copy family and port */## 59 ##src/advio/udpserv04.c##
sock_set_wild(wild, salen);## 60 ##src/advio/udpserv04.c##
Bind(sockfd, wild, salen);## 61 ##src/advio/udpserv04.c##
printf("bound %s\n", Sock_ntop(wild, salen));## 62 ##src/advio/udpserv04.c##
if ((pid = Fork()) == 0) { /* child */## 63 ##src/advio/udpserv04.c##
mydg_echo(sockfd, wild, salen);## 64 ##src/advio/udpserv04.c##
exit(0); /* never executed */## 65 ##src/advio/udpserv04.c##
}## 66 ##src/advio/udpserv04.c##
exit(0);## 67 ##src/advio/udpserv04.c##
}## 68 ##src/advio/udpserv04.c##
void## 69 ##src/advio/udpserv04.c##
mydg_echo(int sockfd, SA *myaddr, socklen_t salen)## 70 ##src/advio/udpserv04.c##
{## 71 ##src/advio/udpserv04.c##
int n;## 72 ##src/advio/udpserv04.c##
char mesg[MAXLINE];## 73 ##src/advio/udpserv04.c##
socklen_t len;## 74 ##src/advio/udpserv04.c##
struct sockaddr *cli;## 75 ##src/advio/udpserv04.c##
cli = Malloc(salen);## 76 ##src/advio/udpserv04.c##
for (;;) {## 77 ##src/advio/udpserv04.c##
len = salen;## 78 ##src/advio/udpserv04.c##
n = Recvfrom(sockfd, mesg, MAXLINE, 0, cli, &len);## 79 ##src/advio/udpserv04.c##
printf("child %d, datagram from %s", getpid(), Sock_ntop(cli, len));## 80 ##src/advio/udpserv04.c##
printf(", to %s\n", Sock_ntop(myaddr, salen));## 81 ##src/advio/udpserv04.c##
Sendto(sockfd, mesg, n, 0, cli, len);## 82 ##src/advio/udpserv04.c##
}## 83 ##src/advio/udpserv04.c##
}## 84 ##src/advio/udpserv04.c##
================================================
FILE: bcast/Makefile
================================================
include ../Make.defines
PROGS = udpcli01 udpcli02 udpcli03 udpcli04 udpcli05 udpcli06
all: ${PROGS}
# Version in book.
udpcli01: udpcli01.o dgclibcast1.o
${CC} ${CFLAGS} -o $@ udpcli01.o dgclibcast1.o ${LIBS}
# Incorrect version with alarm(1) and sleep(1) to tickle race condition.
udpcli02: udpcli02.o dgclibcast2.o
${CC} ${CFLAGS} -o $@ udpcli02.o dgclibcast2.o ${LIBS}
# Incorrect version that blocks signals, but still has a race condition.
udpcli03: udpcli03.o dgclibcast3.o
${CC} ${CFLAGS} -o $@ udpcli03.o dgclibcast3.o ${LIBS}
# Correct version using pselect().
udpcli04: udpcli04.o dgclibcast4.o
${CC} ${CFLAGS} -o $@ udpcli04.o dgclibcast4.o ${LIBS}
# Correct version using sigsetjmp()/siglongjmp().
udpcli05: udpcli05.o dgclibcast5.o
${CC} ${CFLAGS} -o $@ udpcli05.o dgclibcast5.o ${LIBS}
# Correct version using a pipe from signal handler to select().
udpcli06: udpcli06.o dgclibcast6.o
${CC} ${CFLAGS} -o $@ udpcli06.o dgclibcast6.o ${LIBS}
clean:
rm -f ${PROGS} ${CLEANFILES}
================================================
FILE: bcast/dgclibcast1.c
================================================
#include "unp.h"
static void recvfrom_alarm(int);
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(5);
for ( ; ; ) {
len = servlen;
n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
if (n < 0) {
if (errno == EINTR)
break; /* waited long enough for replies */
else
err_sys("recvfrom error");
} else {
recvline[n] = 0; /* null terminate */
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
return; /* just interrupt the recvfrom() */
}
================================================
FILE: bcast/dgclibcast1.lc
================================================
#include "unp.h"## 1 ##src/bcast/dgclibcast1.c##
static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast1.c##
void## 3 ##src/bcast/dgclibcast1.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast1.c##
{## 5 ##src/bcast/dgclibcast1.c##
int n;## 6 ##src/bcast/dgclibcast1.c##
const int on = 1;## 7 ##src/bcast/dgclibcast1.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast1.c##
socklen_t len;## 9 ##src/bcast/dgclibcast1.c##
struct sockaddr *preply_addr;## 10 ##src/bcast/dgclibcast1.c##
preply_addr = Malloc(servlen);## 11 ##src/bcast/dgclibcast1.c##
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 12 ##src/bcast/dgclibcast1.c##
Signal(SIGALRM, recvfrom_alarm);## 13 ##src/bcast/dgclibcast1.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 14 ##src/bcast/dgclibcast1.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 15 ##src/bcast/dgclibcast1.c##
alarm(5);## 16 ##src/bcast/dgclibcast1.c##
for (;;) {## 17 ##src/bcast/dgclibcast1.c##
len = servlen;## 18 ##src/bcast/dgclibcast1.c##
n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 19 ##src/bcast/dgclibcast1.c##
if (n < 0) {## 20 ##src/bcast/dgclibcast1.c##
if (errno == EINTR)## 21 ##src/bcast/dgclibcast1.c##
break; /* waited long enough for replies */## 22 ##src/bcast/dgclibcast1.c##
else## 23 ##src/bcast/dgclibcast1.c##
err_sys("recvfrom error");## 24 ##src/bcast/dgclibcast1.c##
} else {## 25 ##src/bcast/dgclibcast1.c##
recvline[n] = 0; /* null terminate */## 26 ##src/bcast/dgclibcast1.c##
printf("from %s: %s",## 27 ##src/bcast/dgclibcast1.c##
Sock_ntop_host(preply_addr, len), recvline);## 28 ##src/bcast/dgclibcast1.c##
}## 29 ##src/bcast/dgclibcast1.c##
}## 30 ##src/bcast/dgclibcast1.c##
}## 31 ##src/bcast/dgclibcast1.c##
}## 32 ##src/bcast/dgclibcast1.c##
static void## 33 ##src/bcast/dgclibcast1.c##
recvfrom_alarm(int signo)## 34 ##src/bcast/dgclibcast1.c##
{## 35 ##src/bcast/dgclibcast1.c##
return; /* just interrupt the recvfrom() */## 36 ##src/bcast/dgclibcast1.c##
}## 37 ##src/bcast/dgclibcast1.c##
================================================
FILE: bcast/dgclibcast2.c
================================================
#include "unp.h"
static void recvfrom_alarm(int);
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(1);
for ( ; ; ) {
len = servlen;
n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
if (n == -1) {
if (errno == EINTR)
break; /* waited long enough for replies */
else
err_sys("recvfrom error");
} else {
recvline[n] = 0; /* null terminate */
sleep(1);
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
return; /* just interrupt the recvfrom() */
}
================================================
FILE: bcast/dgclibcast3.c
================================================
#include "unp.h"
static void recvfrom_alarm(int);
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
sigset_t sigset_alrm;
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
Sigemptyset(&sigset_alrm);
Sigaddset(&sigset_alrm, SIGALRM);
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(5);
for ( ; ; ) {
len = servlen;
Sigprocmask(SIG_UNBLOCK, &sigset_alrm, NULL);
n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);
if (n < 0) {
if (errno == EINTR)
break; /* waited long enough for replies */
else
err_sys("recvfrom error");
} else {
recvline[n] = 0; /* null terminate */
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
return; /* just interrupt the recvfrom() */
}
================================================
FILE: bcast/dgclibcast3.lc
================================================
#include "unp.h"## 1 ##src/bcast/dgclibcast3.c##
static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast3.c##
void## 3 ##src/bcast/dgclibcast3.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast3.c##
{## 5 ##src/bcast/dgclibcast3.c##
int n;## 6 ##src/bcast/dgclibcast3.c##
const int on = 1;## 7 ##src/bcast/dgclibcast3.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast3.c##
sigset_t sigset_alrm;## 9 ##src/bcast/dgclibcast3.c##
socklen_t len;## 10 ##src/bcast/dgclibcast3.c##
struct sockaddr *preply_addr;## 11 ##src/bcast/dgclibcast3.c##
preply_addr = Malloc(servlen);## 12 ##src/bcast/dgclibcast3.c##
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 13 ##src/bcast/dgclibcast3.c##
Sigemptyset(&sigset_alrm);## 14 ##src/bcast/dgclibcast3.c##
Sigaddset(&sigset_alrm, SIGALRM);## 15 ##src/bcast/dgclibcast3.c##
Signal(SIGALRM, recvfrom_alarm);## 16 ##src/bcast/dgclibcast3.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 17 ##src/bcast/dgclibcast3.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 18 ##src/bcast/dgclibcast3.c##
alarm(5);## 19 ##src/bcast/dgclibcast3.c##
for (;;) {## 20 ##src/bcast/dgclibcast3.c##
len = servlen;## 21 ##src/bcast/dgclibcast3.c##
Sigprocmask(SIG_UNBLOCK, &sigset_alrm, NULL);## 22 ##src/bcast/dgclibcast3.c##
n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 23 ##src/bcast/dgclibcast3.c##
Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);## 24 ##src/bcast/dgclibcast3.c##
if (n < 0) {## 25 ##src/bcast/dgclibcast3.c##
if (errno == EINTR)## 26 ##src/bcast/dgclibcast3.c##
break; /* waited long enough for replies */## 27 ##src/bcast/dgclibcast3.c##
else## 28 ##src/bcast/dgclibcast3.c##
err_sys("recvfrom error");## 29 ##src/bcast/dgclibcast3.c##
} else {## 30 ##src/bcast/dgclibcast3.c##
recvline[n] = 0; /* null terminate */## 31 ##src/bcast/dgclibcast3.c##
printf("from %s: %s",## 32 ##src/bcast/dgclibcast3.c##
Sock_ntop_host(preply_addr, len), recvline);## 33 ##src/bcast/dgclibcast3.c##
}## 34 ##src/bcast/dgclibcast3.c##
}## 35 ##src/bcast/dgclibcast3.c##
}## 36 ##src/bcast/dgclibcast3.c##
}## 37 ##src/bcast/dgclibcast3.c##
static void## 38 ##src/bcast/dgclibcast3.c##
recvfrom_alarm(int signo)## 39 ##src/bcast/dgclibcast3.c##
{## 40 ##src/bcast/dgclibcast3.c##
return; /* just interrupt the recvfrom() */## 41 ##src/bcast/dgclibcast3.c##
}## 42 ##src/bcast/dgclibcast3.c##
================================================
FILE: bcast/dgclibcast4.c
================================================
#include "unp.h"
static void recvfrom_alarm(int);
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
fd_set rset;
sigset_t sigset_alrm, sigset_empty;
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
FD_ZERO(&rset);
Sigemptyset(&sigset_empty);
Sigemptyset(&sigset_alrm);
Sigaddset(&sigset_alrm, SIGALRM);
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);
alarm(5);
for ( ; ; ) {
FD_SET(sockfd, &rset);
n = pselect(sockfd+1, &rset, NULL, NULL, NULL, &sigset_empty);
if (n < 0) {
if (errno == EINTR)
break;
else
err_sys("pselect error");
} else if (n != 1)
err_sys("pselect error: returned %d", n);
len = servlen;
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
recvline[n] = 0; /* null terminate */
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
return; /* just interrupt the recvfrom() */
}
================================================
FILE: bcast/dgclibcast4.lc
================================================
#include "unp.h"## 1 ##src/bcast/dgclibcast4.c##
static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast4.c##
void## 3 ##src/bcast/dgclibcast4.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast4.c##
{## 5 ##src/bcast/dgclibcast4.c##
int n;## 6 ##src/bcast/dgclibcast4.c##
const int on = 1;## 7 ##src/bcast/dgclibcast4.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast4.c##
fd_set rset;## 9 ##src/bcast/dgclibcast4.c##
sigset_t sigset_alrm, sigset_empty;## 10 ##src/bcast/dgclibcast4.c##
socklen_t len;## 11 ##src/bcast/dgclibcast4.c##
struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast4.c##
preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast4.c##
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast4.c##
FD_ZERO(&rset);## 15 ##src/bcast/dgclibcast4.c##
Sigemptyset(&sigset_empty);## 16 ##src/bcast/dgclibcast4.c##
Sigemptyset(&sigset_alrm);## 17 ##src/bcast/dgclibcast4.c##
Sigaddset(&sigset_alrm, SIGALRM);## 18 ##src/bcast/dgclibcast4.c##
Signal(SIGALRM, recvfrom_alarm);## 19 ##src/bcast/dgclibcast4.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 20 ##src/bcast/dgclibcast4.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 21 ##src/bcast/dgclibcast4.c##
Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);## 22 ##src/bcast/dgclibcast4.c##
alarm(5);## 23 ##src/bcast/dgclibcast4.c##
for (;;) {## 24 ##src/bcast/dgclibcast4.c##
FD_SET(sockfd, &rset);## 25 ##src/bcast/dgclibcast4.c##
n = pselect(sockfd + 1, &rset, NULL, NULL, NULL, &sigset_empty);## 26 ##src/bcast/dgclibcast4.c##
if (n < 0) {## 27 ##src/bcast/dgclibcast4.c##
if (errno == EINTR)## 28 ##src/bcast/dgclibcast4.c##
break;## 29 ##src/bcast/dgclibcast4.c##
else## 30 ##src/bcast/dgclibcast4.c##
err_sys("pselect error");## 31 ##src/bcast/dgclibcast4.c##
} else if (n != 1)## 32 ##src/bcast/dgclibcast4.c##
err_sys("pselect error: returned %d", n);## 33 ##src/bcast/dgclibcast4.c##
len = servlen;## 34 ##src/bcast/dgclibcast4.c##
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 35 ##src/bcast/dgclibcast4.c##
recvline[n] = 0; /* null terminate */## 36 ##src/bcast/dgclibcast4.c##
printf("from %s: %s",## 37 ##src/bcast/dgclibcast4.c##
Sock_ntop_host(preply_addr, len), recvline);## 38 ##src/bcast/dgclibcast4.c##
}## 39 ##src/bcast/dgclibcast4.c##
}## 40 ##src/bcast/dgclibcast4.c##
}## 41 ##src/bcast/dgclibcast4.c##
static void## 42 ##src/bcast/dgclibcast4.c##
recvfrom_alarm(int signo)## 43 ##src/bcast/dgclibcast4.c##
{## 44 ##src/bcast/dgclibcast4.c##
return; /* just interrupt the recvfrom() */## 45 ##src/bcast/dgclibcast4.c##
}## 46 ##src/bcast/dgclibcast4.c##
================================================
FILE: bcast/dgclibcast5.c
================================================
#include "unp.h"
#include <setjmp.h>
static void recvfrom_alarm(int);
static sigjmp_buf jmpbuf;
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(5);
for ( ; ; ) {
if (sigsetjmp(jmpbuf, 1) != 0)
break;
len = servlen;
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
recvline[n] = 0; /* null terminate */
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
siglongjmp(jmpbuf, 1);
}
================================================
FILE: bcast/dgclibcast5.lc
================================================
#include "unp.h"## 1 ##src/bcast/dgclibcast5.c##
#include <setjmp.h>## 2 ##src/bcast/dgclibcast5.c##
static void recvfrom_alarm(int);## 3 ##src/bcast/dgclibcast5.c##
static sigjmp_buf jmpbuf;## 4 ##src/bcast/dgclibcast5.c##
void## 5 ##src/bcast/dgclibcast5.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 6 ##src/bcast/dgclibcast5.c##
{## 7 ##src/bcast/dgclibcast5.c##
int n;## 8 ##src/bcast/dgclibcast5.c##
const int on = 1;## 9 ##src/bcast/dgclibcast5.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 10 ##src/bcast/dgclibcast5.c##
socklen_t len;## 11 ##src/bcast/dgclibcast5.c##
struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast5.c##
preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast5.c##
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast5.c##
Signal(SIGALRM, recvfrom_alarm);## 15 ##src/bcast/dgclibcast5.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 16 ##src/bcast/dgclibcast5.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 17 ##src/bcast/dgclibcast5.c##
alarm(5);## 18 ##src/bcast/dgclibcast5.c##
for (;;) {## 19 ##src/bcast/dgclibcast5.c##
if (sigsetjmp(jmpbuf, 1) != 0)## 20 ##src/bcast/dgclibcast5.c##
break;## 21 ##src/bcast/dgclibcast5.c##
len = servlen;## 22 ##src/bcast/dgclibcast5.c##
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 23 ##src/bcast/dgclibcast5.c##
recvline[n] = 0; /* null terminate */## 24 ##src/bcast/dgclibcast5.c##
printf("from %s: %s",## 25 ##src/bcast/dgclibcast5.c##
Sock_ntop_host(preply_addr, len), recvline);## 26 ##src/bcast/dgclibcast5.c##
}## 27 ##src/bcast/dgclibcast5.c##
}## 28 ##src/bcast/dgclibcast5.c##
}## 29 ##src/bcast/dgclibcast5.c##
static void## 30 ##src/bcast/dgclibcast5.c##
recvfrom_alarm(int signo)## 31 ##src/bcast/dgclibcast5.c##
{## 32 ##src/bcast/dgclibcast5.c##
siglongjmp(jmpbuf, 1);## 33 ##src/bcast/dgclibcast5.c##
}## 34 ##src/bcast/dgclibcast5.c##
================================================
FILE: bcast/dgclibcast6.c
================================================
#include "unp.h"
static void recvfrom_alarm(int);
static int pipefd[2];
void
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
{
int n, maxfdp1;
const int on = 1;
char sendline[MAXLINE], recvline[MAXLINE + 1];
fd_set rset;
socklen_t len;
struct sockaddr *preply_addr;
preply_addr = Malloc(servlen);
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
Pipe(pipefd);
maxfdp1 = max(sockfd, pipefd[0]) + 1;
FD_ZERO(&rset);
Signal(SIGALRM, recvfrom_alarm);
while (Fgets(sendline, MAXLINE, fp) != NULL) {
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
alarm(5);
for ( ; ; ) {
FD_SET(sockfd, &rset);
FD_SET(pipefd[0], &rset);
if ( (n = select(maxfdp1, &rset, NULL, NULL, NULL)) < 0) {
if (errno == EINTR)
continue;
else
err_sys("select error");
}
if (FD_ISSET(sockfd, &rset)) {
len = servlen;
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
recvline[n] = 0; /* null terminate */
printf("from %s: %s",
Sock_ntop_host(preply_addr, len), recvline);
}
if (FD_ISSET(pipefd[0], &rset)) {
Read(pipefd[0], &n, 1); /* timer expired */
break;
}
}
}
free(preply_addr);
}
static void
recvfrom_alarm(int signo)
{
Write(pipefd[1], "", 1); /* write one null byte to pipe */
return;
}
================================================
FILE: bcast/dgclibcast6.lc
================================================
#include "unp.h"## 1 ##src/bcast/dgclibcast6.c##
static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast6.c##
static int pipefd[2];## 3 ##src/bcast/dgclibcast6.c##
void## 4 ##src/bcast/dgclibcast6.c##
dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 5 ##src/bcast/dgclibcast6.c##
{## 6 ##src/bcast/dgclibcast6.c##
int n, maxfdp1;## 7 ##src/bcast/dgclibcast6.c##
const int on = 1;## 8 ##src/bcast/dgclibcast6.c##
char sendline[MAXLINE], recvline[MAXLINE + 1];## 9 ##src/bcast/dgclibcast6.c##
fd_set rset;## 10 ##src/bcast/dgclibcast6.c##
socklen_t len;## 11 ##src/bcast/dgclibcast6.c##
struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast6.c##
preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast6.c##
Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast6.c##
Pipe(pipefd);## 15 ##src/bcast/dgclibcast6.c##
maxfdp1 = max(sockfd, pipefd[0]) + 1;## 16 ##src/bcast/dgclibcast6.c##
FD_ZERO(&rset);## 17 ##src/bcast/dgclibcast6.c##
Signal(SIGALRM, recvfrom_alarm);## 18 ##src/bcast/dgclibcast6.c##
while (Fgets(sendline, MAXLINE, fp) != NULL) {## 19 ##src/bcast/dgclibcast6.c##
Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 20 ##src/bcast/dgclibcast6.c##
alarm(5);## 21 ##src/bcast/dgclibcast6.c##
for (;;) {## 22 ##src/bcast/dgclibcast6.c##
FD_SET(sockfd, &rset);## 23 ##src/bcast/dgclibcast6.c##
FD_SET(pipefd[0], &rset);## 24 ##src/bcast/dgclibcast6.c##
if ((n = select(maxfdp1, &rset, NULL, NULL, NULL)) < 0) {## 25 ##src/bcast/dgclibcast6.c##
if (errno == EINTR)## 26 ##src/bcast/dgclibcast6.c##
continue;## 27 ##src/bcast/dgclibcast6.c##
else## 28 ##src/bcast/dgclibcast6.c##
err_sys("select error");## 29 ##src/bcast/dgclibcast6.c##
}## 30 ##src/bcast/dgclibcast6.c##
if (FD_ISSET(sockfd, &rset)) {## 31 ##src/bcast/dgclibcast6.c##
len = servlen;## 32 ##src/bcast/dgclibcast6.c##
n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr,## 33 ##src/bcast/dgclibcast6.c##
&len);## 34 ##src/bcast/dgclibcast6.c##
recvline[n] = 0; /* null terminate */## 35 ##src/bcast/dgclibcast6.c##
printf("from %s: %s",## 36 ##src/bcast/dgclibcast6.c##
Sock_ntop_host(preply_addr, len), recvline);## 37 ##src/bcast/dgclibcast6.c##
}## 38 ##src/bcast/dgclibcast6.c##
if (FD_ISSET(pipefd[0], &rset)) {## 39 ##src/bcast/dgclibcast6.c##
Read(pipefd[0], &n, 1); /* timer expired */## 40 ##src/bcast/dgclibcast6.c##
break;## 41 ##src/bcast/dgclibcast6.c##
}## 42 ##src/bcast/dgclibcast6.c##
}## 43 ##src/bcast/dgclibcast6.c##
}## 44 ##src/bcast/dgclibcast6.c##
}## 45 ##src/bcast/dgclibcast6.c##
static void## 46 ##src/bcast/dgclibcast6.c##
recvfrom_alarm(int signo)## 47 ##src/bcast/dgclibcast6.c##
{## 48 ##src/bcast/dgclibcast6.c##
Write(pipefd[1], "", 1); /* write 1 null byte to pipe */## 49 ##src/bcast/dgclibcast6.c##
return;## 50 ##src/bcast/dgclibcast6.c##
}## 51 ##src/bcast/dgclibcast6.c##
================================================
FILE: bcast/udpcli01.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli01 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: bcast/udpcli02.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli02 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: bcast/udpcli03.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli03 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: bcast/udpcli04.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli04 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: bcast/udpcli05.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli05 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: bcast/udpcli06.c
================================================
#include "unp.h"
int
main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2)
err_quit("usage: udpcli02 <IPaddress>");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* standard daytime server */
Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
exit(0);
}
================================================
FILE: config.guess
================================================
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-03-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
--version | -v )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 c99 ; do
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
macppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mipseb-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main
.align 4
.ent main
main:
.frame \$30,16,\$26,0
ldgp \$29,0(\$27)
.prologue 1
.long 0x47e03d80 # implver \$0
lda \$2,-1
.long 0x47e20c21 # amask \$2,\$1
lda \$16,\$Lformat
mov \$0,\$17
not \$1,\$18
jsr \$26,printf
ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main
EOF
eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
case `./$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
1-0)
UNAME_MACHINE="alphaev5"
;;
1-1)
UNAME_MACHINE="alphaev56"
;;
1-101)
UNAME_MACHINE="alphapca56"
;;
2-303)
UNAME_MACHINE="alphaev6"
;;
2-307)
UNAME_MACHINE="alphaev67"
;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
esac
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit 0;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy
fi ;;
esac
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i386-pc-interix3
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit 0 ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit 0 ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit 0 ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit 0 ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit 0 ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0 ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit 0 ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#ifdef __INTEL_COMPILER
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit 0 ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
i*86:*:5:[78]*)
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit 0 ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit 0 ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit 0 ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit 0 ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit 0 ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit 0 ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit 0 ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit 0 ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit 0 ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type
This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
ftp://ftp.gnu.org/pub/gnu/config/
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
================================================
FILE: config.h.in
================================================
/* config.h.in. Generated from configure.in by autoheader. */
/* CPU, vendor, and operating system */
#undef CPU_VENDOR_OS
/* Define to 1 if <netdb.h> defines struct addrinfo */
#undef HAVE_ADDRINFO_STRUCT
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Define to 1 if the /dev/streams/xtiso/tcp device exists */
#undef HAVE_DEV_STREAMS_XTISO_TCP
/* Define to 1 if the /dev/tcp device exists */
#undef HAVE_DEV_TCP
/* Define to 1 if the /dev/xti/tcp device exists */
#undef HAVE_DEV_XTI_TCP
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO
/* define if getaddrinfo prototype is in <netdb.h> */
#undef HAVE_GETADDRINFO_PROTO
/* Define to 1 if you have the `gethostbyname2' function. */
#undef HAVE_GETHOSTBYNAME2
/* Define to 1 if you have the `gethostbyname_r' function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
/* define if gethostname prototype is in <unistd.h> */
#undef HAVE_GETHOSTNAME_PROTO
/* Define to 1 if you have the `getnameinfo' function. */
#undef HAVE_GETNAMEINFO
/* define if getnameinfo prototype is in <netdb.h> */
#undef HAVE_GETNAMEINFO_PROTO
/* define if getrusage prototype is in <sys/resource.h> */
#undef HAVE_GETRUSAGE_PROTO
/* Define to 1 if you have the `hstrerror' function. */
#undef HAVE_HSTRERROR
/* define if hstrerror prototype is in <netdb.h> */
#undef HAVE_HSTRERROR_PROTO
/* Define to 1 if <net/if.h> defines struct if_nameindex */
#undef HAVE_IF_NAMEINDEX_STRUCT
/* Define to 1 if you have the `if_nametoindex' function. */
#undef HAVE_IF_NAMETOINDEX
/* define if if_nametoindex prototype is in <net/if.h> */
#undef HAVE_IF_NAMETOINDEX_PROTO
/* Define to 1 if you have the `inet6_rth_init' function. */
#undef HAVE_INET6_RTH_INIT
/* Define to 1 if you have the `inet_aton' function. */
#undef HAVE_INET_ATON
/* define if inet_aton prototype is in <arpa/inet.h> */
#undef HAVE_INET_ATON_PROTO
/* Define to 1 if you have the `inet_pton' function. */
#undef HAVE_INET_PTON
/* define if inet_pton prototype is in <arpa/inet.h> */
#undef HAVE_INET_PTON_PROTO
/* Define to 1 if you have the `kevent' function. */
#undef HAVE_KEVENT
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `pthreads' library (-lpthreads). */
#undef HAVE_LIBPTHREADS
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define to 1 if you have the `xti' library (-lxti). */
#undef HAVE_LIBXTI
/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
/* define if struct msghdr contains the msg_control member */
#undef HAVE_MSGHDR_MSG_CONTROL
/* Define to 1 if you have the <netconfig.h> header file. */
#undef HAVE_NETCONFIG_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netdir.h> header file. */
#undef HAVE_NETDIR_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H
/* Define to 1 if you have the `poll' function. */
#undef HAVE_POLL
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define to 1 if you have the `pselect' function. */
#undef HAVE_PSELECT
/* define if pselect prototype is in <sys/stat.h> */
#undef HAVE_PSELECT_PROTO
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* define if snprintf prototype is in <stdio.h> */
#undef HAVE_SNPRINTF_PROTO
/* Define to 1 if <net/if_dl.h> defines struct sockaddr_dl */
#undef HAVE_SOCKADDR_DL_STRUCT
/* define if socket address structures have length fields */
#undef HAVE_SOCKADDR_SA_LEN
/* Define to 1 if you have the `sockatmark' function. */
#undef HAVE_SOCKATMARK
/* define if sockatmark prototype is in <sys/socket.h> */
#undef HAVE_SOCKATMARK_PROTO
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
/* Define to 1 if `ifr_mtu' is member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_MTU
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#undef HAVE_STRUCT_SOCKADDR_STORAGE
/* Define to 1 if you have the <sys/event.h> header file. */
#undef HAVE_SYS_EVENT_H
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/uio.h> header file. */
#undef HAVE_SYS_UIO_H
/* Define to 1 if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if <time.h> or <sys/time.h> defines struct timespec */
#undef HAVE_TIMESPEC_STRUCT
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the <xti.h> header file. */
#undef HAVE_XTI_H
/* Define to 1 if you have the <xti_inet.h> header file. */
#undef HAVE_XTI_INET_H
/* Define to 1 if the system supports IPv4 */
#undef IPV4
/* Define to 1 if the system supports IPv6 */
#undef IPV6
/* Define to 1 if the system supports IPv4 */
#undef IPv4
/* Define to 1 if the system supports IPv6 */
#undef IPv6
/* Define to 1 if the system supports IP Multicast */
#undef MCAST
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* the size of the sa_family field in a socket address structure */
#undef SA_FAMILY_T
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if the system supports UNIX domain sockets */
#undef UNIXDOMAIN
/* Define to 1 if the system supports UNIX domain sockets */
#undef UNIXdomain
/* 16 bit signed type */
#undef int16_t
/* 32 bit signed type */
#undef int32_t
/* the type of the sa_family struct member */
#undef sa_family_t
/* unsigned integer type of the result of the sizeof operator */
#undef size_t
/* a type appropriate for address */
#undef socklen_t
/* define to __ss_family if sockaddr_storage has that instead of ss_family */
#undef ss_family
/* a signed type appropriate for a count of bytes or an error indication */
#undef ssize_t
/* scalar type */
#undef t_scalar_t
/* unsigned scalar type */
#undef t_uscalar_t
/* 16 bit unsigned type */
#undef uint16_t
/* 32 bit unsigned type */
#undef uint32_t
/* 8-bit unsigned type */
#undef uint8_t
================================================
FILE: config.sub
================================================
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2002-03-07'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Canonicalize a configuration name.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
--version | -v )
echo "$version" ; exit 0 ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help"
exit 1 ;;
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
os=
basic_machine=$1
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
| d10v | d30v | dsp16xx \
| fr30 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
| mipsisa32 | mipsisa64 \
| mn10200 | mn10300 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| ymp-* \
| z8k-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1)
basic_machine=np1-gould
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
basic_machine=or32-unknown
os=-coff
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon)
basic_machine=i686-pc
;;
pentiumii | pentium2)
basic_machine=i686-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto*)
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-atheos*)
os=-atheos
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-nova*)
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
;;
-nsk*)
os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-ibm)
os=-aix
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs* | -opened*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
================================================
FILE: configure
================================================
#! /bin/sh
# From configure.in Revision: 1.13 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57.
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
. : '\(.\)' 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
/^X\/\(\/\/\)$/{ s//\1/; q; }
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" || {
# Find who we are. Look in the path if we contain no path at all
# relative or not.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
{ echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
{ (exit 1); exit 1; }; }
fi
case $CONFIG_SHELL in
'')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for as_base in sh bash ksh sh5; do
case $as_dir in
/*)
if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
fi;;
esac
done
done
;;
esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line before each line; the second 'sed' does the real
# work. The second script uses 'N' to pair each line-number line
# with the numbered line, and appends trailing '-' during
# substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
sed '=' <$as_myself |
sed '
N
s,$,-,
: loop
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
s,-$,,
s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensible to this).
. ./$as_me.lineno
# Exit status is that of the last command.
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
# We could just check for DJGPP; but this test a) works b) is more generic
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
if test -f conf$$.exe; then
# Don't use ln at all; we don't have any links
as_ln_s='cp -p'
else
as_ln_s='ln -s'
fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
exec 6>&1
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="lib/unp.h"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB CPP EGREP LIB_OBJS LIBFREE_OBJS LIBGAI_OBJS LIBROUTE_OBJS LIBXTI_OBJS LIBS_XTI LIBUNP LIBUNPXTI LIBUNP_NAME LIBUNPXTI_NAME LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir=$ac_optarg ;;
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
case $ac_option in
*=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
{ echo "$as_me: error: missing argument to $ac_option" >&2
{ (exit 1); exit 1; }; }
fi
# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
[\\/$]* | ?:[\\/]* ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
{ (exit 1); exit 1; }; };;
esac
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
else
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_al
gitextract_h3wfhmct/
├── .gitattributes
├── .gitignore
├── DISCLAIMER
├── Make.defines.in
├── Makefile.in
├── README
├── VERSION
├── aclocal.m4
├── advio/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── daytimeudpcli3.c
│ ├── daytimeudpcli4.c
│ ├── dgclitimeo.c
│ ├── dgclitimeo1.c
│ ├── dgclitimeo2.c
│ ├── dgclitimeo2.lc
│ ├── dgclitimeo3.c
│ ├── dgclitimeo3.lc
│ ├── dgechoaddr.c
│ ├── dgechoaddr.lc
│ ├── old/
│ │ ├── dgechoaddr.c
│ │ ├── recvfromflags.c
│ │ └── test01.c
│ ├── recvfromflags.c
│ ├── recvfromflags.lc
│ ├── script.1
│ ├── sig_chld_waitpid.c
│ ├── str_cli_kqueue04.c
│ ├── str_cli_poll03.c
│ ├── str_cli_select02.c
│ ├── str_echo_stdio02.c
│ ├── str_echo_stdio02.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpcli03.c
│ ├── tcpcli04.c
│ ├── tcpserv02.c
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpserv01.c
│ ├── udpserv03.c
│ ├── udpserv03.lc
│ ├── udpserv04.c
│ └── udpserv04.lc
├── bcast/
│ ├── Makefile
│ ├── dgclibcast1.c
│ ├── dgclibcast1.lc
│ ├── dgclibcast2.c
│ ├── dgclibcast3.c
│ ├── dgclibcast3.lc
│ ├── dgclibcast4.c
│ ├── dgclibcast4.lc
│ ├── dgclibcast5.c
│ ├── dgclibcast5.lc
│ ├── dgclibcast6.c
│ ├── dgclibcast6.lc
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpcli04.c
│ ├── udpcli05.c
│ └── udpcli06.c
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.in
├── icmpd/
│ ├── Makefile
│ ├── dgcli01.c
│ ├── dgcli01.lc
│ ├── icmpd.c
│ ├── icmpd.h
│ ├── icmpd.lc
│ ├── readable_conn.c
│ ├── readable_conn.lc
│ ├── readable_listen.c
│ ├── readable_listen.lc
│ ├── readable_v4.c
│ ├── readable_v4.lc
│ ├── readable_v6.c
│ ├── readable_v6.lc
│ ├── script.1
│ ├── script.2
│ ├── script.3
│ ├── script.4
│ ├── udpcli01.c
│ └── unpicmpd.h
├── inetd/
│ ├── Makefile
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ └── daytimetcpsrv3.lc
├── install-sh
├── intro/
│ ├── Makefile
│ ├── byteorder.c
│ ├── daytimetcpcli.c
│ ├── daytimetcpcli1.c
│ ├── daytimetcpcli2.c
│ ├── daytimetcpcli3.c
│ ├── daytimetcpcliv6.c
│ ├── daytimetcpsrv.c
│ ├── daytimetcpsrv.lc
│ ├── daytimetcpsrv1.c
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ ├── daytimetcpsrvv6.c
│ ├── truss.solaris.2.6
│ └── truss.unixware.2.1
├── ioctl/
│ ├── Makefile
│ ├── Progs.siocgifconf
│ ├── Script.solaris
│ ├── lsif01.c
│ ├── lsif02.c
│ ├── prifinfo.c
│ ├── prifinfo.lc
│ ├── prmac.c
│ └── test1.c
├── ipopts/
│ ├── Makefile
│ ├── dgechoprintroute.c
│ ├── sigchldwaitpid.c
│ ├── sourceroute.c
│ ├── sourceroute.lc
│ ├── sourceroute6.c
│ ├── tcpcli01.c
│ ├── tcpserv01.c
│ ├── udpcli01.c
│ └── udpserv01.c
├── key/
│ ├── Makefile
│ ├── add.c
│ ├── dump.c
│ ├── name.c
│ ├── printsadbmsg.c
│ ├── register.c
│ └── unp.h
├── lib/
│ ├── Makefile
│ ├── addrinfo.h
│ ├── connect_nonb.c
│ ├── connect_nonb.lc
│ ├── connect_timeo.c
│ ├── connect_timeo.lc
│ ├── daemon_inetd.c
│ ├── daemon_inetd.lc
│ ├── daemon_init.c
│ ├── dg_cli.c
│ ├── dg_echo.c
│ ├── error.c
│ ├── family_to_level.c
│ ├── get_ifi_info.c
│ ├── get_ifi_info.lc
│ ├── gf_time.c
│ ├── host_serv.c
│ ├── host_serv.lc
│ ├── hstrerror.c
│ ├── if_indextoname.c
│ ├── if_nameindex.c
│ ├── if_nametoindex.c
│ ├── in6addr_any.c
│ ├── mcast_get_if.c
│ ├── mcast_get_loop.c
│ ├── mcast_get_ttl.c
│ ├── mcast_join.c
│ ├── mcast_join.lc
│ ├── mcast_leave.c
│ ├── mcast_set_if.c
│ ├── mcast_set_loop.c
│ ├── mcast_set_loop.lc
│ ├── mcast_set_ttl.c
│ ├── my_addrs.c
│ ├── my_addrs.lc
│ ├── pselect.c
│ ├── pselect.lc
│ ├── read_fd.c
│ ├── read_fd.lc
│ ├── readable_timeo.c
│ ├── readable_timeo.lc
│ ├── readline.c
│ ├── readline.lc
│ ├── readn.c
│ ├── readn.lc
│ ├── rtt.c
│ ├── rtt.lc
│ ├── signal.c
│ ├── signal.lc
│ ├── signal_intr.c
│ ├── snprintf.c
│ ├── sock_bind_wild.c
│ ├── sock_cmp_addr.c
│ ├── sock_cmp_port.c
│ ├── sock_get_port.c
│ ├── sock_ntop.c
│ ├── sock_ntop.lc
│ ├── sock_ntop_host.c
│ ├── sock_set_addr.c
│ ├── sock_set_port.c
│ ├── sock_set_wild.c
│ ├── sockatmark.c
│ ├── sockfd_to_family.c
│ ├── sockfd_to_family.lc
│ ├── str_cli.c
│ ├── str_cli.lc
│ ├── str_echo.c
│ ├── str_echo.lc
│ ├── tcp_connect.c
│ ├── tcp_connect.lc
│ ├── tcp_listen.c
│ ├── tcp_listen.lc
│ ├── tv_sub.c
│ ├── udp_client.c
│ ├── udp_client.lc
│ ├── udp_connect.c
│ ├── udp_connect.lc
│ ├── udp_server.c
│ ├── udp_server.lc
│ ├── unp.h
│ ├── unp.lh
│ ├── unpifi.h
│ ├── unprtt.h
│ ├── unprtt.lh
│ ├── unpthread.h
│ ├── wraplib.c
│ ├── wrappthread.c
│ ├── wrappthread.lc
│ ├── wrapsock.c
│ ├── wrapsock.lc
│ ├── wrapstdio.c
│ ├── wrapunix.c
│ ├── writable_timeo.c
│ ├── write_fd.c
│ ├── write_fd.lc
│ ├── writen.c
│ └── writen.lc
├── libfree/
│ ├── Makefile
│ ├── README
│ ├── README.getaddrinfo
│ ├── addrinfo.h
│ ├── getaddrinfo.c
│ ├── getnameinfo.c
│ ├── in_cksum.c
│ ├── inet_aton.c
│ ├── inet_ntop.c
│ ├── inet_ntop_ipv4.c
│ ├── inet_ntop_ipv4.lc
│ ├── inet_pton.c
│ ├── inet_pton_ipv4.c
│ ├── inet_pton_ipv4.lc
│ ├── test_ascii2addr.c
│ ├── test_getservbyname_r.c
│ └── test_inet_pton.c
├── libgai/
│ ├── Makefile
│ ├── addrinfo.h
│ ├── freeaddrinfo.c
│ ├── ga_aistruct.c
│ ├── ga_aistruct.lc
│ ├── ga_clone.c
│ ├── ga_clone.lc
│ ├── ga_echeck.c
│ ├── ga_echeck.lc
│ ├── ga_nsearch.c
│ ├── ga_nsearch.lc
│ ├── ga_port.c
│ ├── ga_port.lc
│ ├── ga_serv.c
│ ├── ga_serv.lc
│ ├── ga_unix.c
│ ├── ga_unix.lc
│ ├── gai_hdr.h
│ ├── gai_hdr.lh
│ ├── gai_strerror.c
│ ├── getaddrinfo.c
│ ├── getaddrinfo.lc
│ ├── getnameinfo.c
│ ├── getnameinfo.lc
│ ├── gn_ipv46.c
│ ├── gn_ipv46.lc
│ ├── old/
│ │ ├── ga_unixstruct.c
│ │ └── savecopy.c
│ ├── test1.c
│ └── testga.c
├── libroute/
│ ├── Makefile
│ ├── get_rtaddrs.c
│ ├── get_rtaddrs.lc
│ ├── if_indextoname.c
│ ├── if_indextoname.lc
│ ├── if_nameindex.c
│ ├── if_nameindex.lc
│ ├── if_nametoindex.c
│ ├── if_nametoindex.lc
│ ├── net_rt_dump.c
│ ├── net_rt_iflist.c
│ ├── net_rt_iflist.lc
│ ├── sock_masktop.c
│ └── unproute.h
├── mcast/
│ ├── Makefile
│ ├── dgclibcast1.c
│ ├── dgclimcast5.c
│ ├── dgclimcast6.c
│ ├── main.c
│ ├── recv.c
│ ├── send.c
│ ├── udpcli01.c
│ ├── udpcli05.c
│ ├── udpcli06.c
│ └── udpserv01.c
├── mysdr/
│ ├── Makefile
│ ├── loop.c
│ ├── loop.lc
│ ├── main.c
│ ├── main.lc
│ ├── mysdr.h
│ ├── script.1
│ └── script.2
├── names/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── daytimetcpcli1.c
│ ├── daytimetcpcli1.lc
│ ├── daytimetcpcli2.c
│ ├── daytimetcpcli2.lc
│ ├── daytimetcpcli3.c
│ ├── daytimetcpcli3.lc
│ ├── daytimetcpsrv1.c
│ ├── daytimetcpsrv2.c
│ ├── daytimetcpsrv3.c
│ ├── daytimetcpsrv4.c
│ ├── daytimeudpcli1.c
│ ├── daytimeudpcli1.lc
│ ├── daytimeudpcli2.c
│ ├── daytimeudpsrv2.c
│ ├── daytimeudpsrv3.c
│ ├── hostent.c
│ ├── hostent.lc
│ ├── hostent2.c
│ ├── hostent2.lc
│ ├── hostent3.c
│ ├── myaddrs1.c
│ ├── myaddrs1.lc
│ ├── netent.c
│ ├── prmyaddrs.c
│ ├── prmyaddrs1.c
│ ├── prmyaddrs1.lc
│ ├── test1.c
│ ├── test2.c
│ └── udp_server_reuseaddr.c
├── nonblock/
│ ├── Makefile
│ ├── daytimetcpcli.c
│ ├── doit.1
│ ├── home_page.c
│ ├── script.1.sh
│ ├── script.1.tcpd
│ ├── start_connect.c
│ ├── strclifork.c
│ ├── strclinonb.c
│ ├── strclinonb.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpcli03.c
│ ├── tcpcli03.lc
│ ├── tcpcli04.c
│ ├── tcpservselect03.c
│ ├── web.c
│ ├── web.h
│ ├── web.lc
│ └── write_get_cmd.c
├── oob/
│ ├── Makefile
│ ├── heartbeatcli.c
│ ├── heartbeatserv.c
│ ├── sigchldwaitpid.c
│ ├── strcliselect02.c
│ ├── strecho02.c
│ ├── tcpcli02.c
│ ├── tcprecv01.c
│ ├── tcprecv01.lc
│ ├── tcprecv02.c
│ ├── tcprecv02.lc
│ ├── tcprecv03.c
│ ├── tcprecv03p.c
│ ├── tcprecv03p.lc
│ ├── tcprecv04.c
│ ├── tcprecv04.lc
│ ├── tcprecv05.c
│ ├── tcprecv06.c
│ ├── tcpsend01.c
│ ├── tcpsend01.lc
│ ├── tcpsend02.c
│ ├── tcpsend03.c
│ ├── tcpsend04.c
│ ├── tcpsend04.lc
│ ├── tcpsend05.c
│ ├── tcpsend05.lc
│ ├── tcpsend06.c
│ ├── tcpsend06.lc
│ └── tcpserv02.c
├── ping/
│ ├── Makefile
│ ├── bsdping.c
│ ├── init_v6.c
│ ├── main.c
│ ├── main.lc
│ ├── old/
│ │ ├── icmp6.h
│ │ └── ip6.h
│ ├── ping.h
│ ├── ping_v4.c
│ ├── proc_v4.c
│ ├── proc_v4.lc
│ ├── proc_v6.c
│ ├── proc_v6.lc
│ ├── readloop.c
│ ├── send_v4.c
│ ├── send_v6.c
│ ├── sig_alrm.c
│ ├── sig_alrm.lc
│ └── tv_sub.c
├── route/
│ ├── Makefile
│ ├── checkudpsum.c
│ ├── get_ifi_info.c
│ ├── get_ifi_info.lc
│ ├── getrt.c
│ ├── getrt.lc
│ ├── mynetstat.c
│ ├── prifindex.c
│ ├── prifinfo.c
│ ├── prifname.c
│ ├── prifnameindex.c
│ └── unproute.h
├── rtt/
│ ├── Makefile
│ ├── dg_cli.c
│ ├── dg_cli.lc
│ ├── dg_echo.c
│ ├── dg_send_recv.c
│ ├── dg_send_recv.lc
│ ├── rtt.out.kumba.1
│ ├── rtt.out.kumba.2
│ ├── rtt.out.vangogh.1
│ ├── rtt.out.vangogh.2
│ ├── rtt.vals.kumba.1
│ ├── rtt.vals.vangogh.1
│ ├── udpcli01.c
│ └── unprtt.h
├── sctp/
│ ├── Makefile
│ ├── sctp_addr_to_associd.c
│ ├── sctp_addr_to_associd.lc
│ ├── sctp_bindargs.c
│ ├── sctp_bindargs.lc
│ ├── sctp_check_notify.c
│ ├── sctp_check_notify.lc
│ ├── sctp_displayevents.c
│ ├── sctp_displayevents.lc
│ ├── sctp_getnostrm.c
│ ├── sctp_modify_hb.c
│ ├── sctp_modify_hb.lc
│ ├── sctp_pdapircv.c
│ ├── sctp_pdapircv.lc
│ ├── sctp_print_addrs.c
│ ├── sctp_print_addrs.lc
│ ├── sctp_strcli.c
│ ├── sctp_strcli.lc
│ ├── sctp_strcli1.c
│ ├── sctp_strcli1.lc
│ ├── sctp_strcli_un.c
│ ├── sctp_strcli_un.lc
│ ├── sctp_strcliecho.c
│ ├── sctp_strcliecho.lc
│ ├── sctp_strcliecho2.c
│ ├── sctp_strcliecho2.lc
│ ├── sctp_wrapper.c
│ ├── sctpclient01.c
│ ├── sctpclient01.lc
│ ├── sctpclient02.c
│ ├── sctpclient02.lc
│ ├── sctpclient04.c
│ ├── sctpclient04.lc
│ ├── sctpserv01.c
│ ├── sctpserv01.lc
│ ├── sctpserv02.c
│ ├── sctpserv02.lc
│ ├── sctpserv03.c
│ ├── sctpserv03.lc
│ ├── sctpserv04.c
│ ├── sctpserv04.lc
│ ├── sctpserv05.c
│ ├── sctpserv05.lc
│ ├── sctpserv06.c
│ ├── sctpserv06.lc
│ ├── sctpserv07.c
│ ├── sctpserv07.lc
│ ├── sctpserv_fork.c
│ ├── sctpserv_fork.lc
│ └── unp.h
├── select/
│ ├── Makefile
│ ├── strcliselect01.c
│ ├── strcliselect02.c
│ ├── strcliselect02.lc
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ └── tcpcli03.c
├── server/
│ ├── Makefile
│ ├── child.h
│ ├── child.lh
│ ├── child02.c
│ ├── child02.lc
│ ├── child02l.c
│ ├── child02m.c
│ ├── child03.c
│ ├── child03m.c
│ ├── child04.c
│ ├── child05.c
│ ├── child05.lc
│ ├── client.c
│ ├── clientrst.c
│ ├── lock_fcntl.c
│ ├── lock_fcntl.lc
│ ├── lock_pthread.c
│ ├── lock_pthread.lc
│ ├── meter.c
│ ├── pr_cpu_time.c
│ ├── pthread07.c
│ ├── pthread07.h
│ ├── pthread07.lc
│ ├── pthread08.c
│ ├── pthread08.h
│ ├── pthread08.lc
│ ├── pthread09.c
│ ├── pthread09.h
│ ├── readline.c
│ ├── readline_r.c
│ ├── readline_r.h
│ ├── serv00.c
│ ├── serv01.c
│ ├── serv01.lc
│ ├── serv02.c
│ ├── serv02.lc
│ ├── serv02m.c
│ ├── serv03.c
│ ├── serv03m.c
│ ├── serv04.c
│ ├── serv05.c
│ ├── serv05.lc
│ ├── serv06.c
│ ├── serv06.lc
│ ├── serv07.c
│ ├── serv07.lc
│ ├── serv08.c
│ ├── serv08.lc
│ ├── serv09.c
│ ├── sig_chld_waitpid.c
│ ├── unpthread.h
│ ├── web_child.c
│ └── web_child_r.c
├── sigio/
│ ├── Makefile
│ ├── dgcli01.c
│ ├── dgecho01.c
│ ├── dgecho01.lc
│ ├── script.1
│ ├── script.2
│ ├── udpcli01.c
│ └── udpserv01.c
├── sock/
│ ├── Makefile
│ ├── README
│ ├── TODO
│ ├── buffers.c
│ ├── cliopen.c
│ ├── crlf.c
│ ├── error.c
│ ├── loop.c
│ ├── looptcp.c
│ ├── loopudp.c
│ ├── main.c
│ ├── multicast.c
│ ├── ourhdr.h
│ ├── pattern.c
│ ├── servopen.c
│ ├── sinktcp.c
│ ├── sinkudp.c
│ ├── sleepus.c
│ ├── sock.h
│ ├── sock.in
│ ├── sockopts.c
│ ├── sourceroute.c
│ ├── sourcesink.c
│ ├── sourcetcp.c
│ ├── sourceudp.c
│ ├── strerror.c
│ ├── tellwait.c
│ ├── write.c
│ └── writen.c
├── sockopt/
│ ├── Makefile
│ ├── checkopts.c
│ ├── checkopts.lc
│ ├── prdefaults.c
│ ├── rcvbuf.c
│ ├── rcvbufset.c
│ └── sockopt.c
├── sparc64-unknown-freebsd5.1/
│ └── config.h
├── ssntp/
│ ├── Makefile
│ ├── main.c
│ ├── main.lc
│ ├── ntp.h
│ ├── sntp.h
│ └── sntp_proc.c
├── streams/
│ ├── Makefile
│ ├── stream_dg/
│ │ ├── Makefile
│ │ ├── client.c
│ │ ├── net_stream.c
│ │ └── server.c
│ ├── strlist_sock.c
│ ├── strlist_xti.c
│ ├── tpi_bind.c
│ ├── tpi_close.c
│ ├── tpi_close.lc
│ ├── tpi_connect.c
│ ├── tpi_connect.lc
│ ├── tpi_daytime.c
│ ├── tpi_daytime.h
│ ├── tpi_read.c
│ ├── tpi_read.lc
│ └── unpxti.h
├── tcpcliserv/
│ ├── Makefile
│ ├── sigchldwait.c
│ ├── sigchldwait.lc
│ ├── sigchldwaitpid.c
│ ├── sigchldwaitpid.lc
│ ├── str_cli08.c
│ ├── str_cli09.c
│ ├── str_cli11.c
│ ├── str_cli11.lc
│ ├── str_echo08.c
│ ├── str_echo08.lc
│ ├── str_echo09.c
│ ├── sum.h
│ ├── tcpcli01.c
│ ├── tcpcli01.lc
│ ├── tcpcli04.c
│ ├── tcpcli05.c
│ ├── tcpcli06.c
│ ├── tcpcli07.c
│ ├── tcpcli08.c
│ ├── tcpcli09.c
│ ├── tcpcli10.c
│ ├── tcpcli11.c
│ ├── tcpserv01.c
│ ├── tcpserv01.lc
│ ├── tcpserv02.c
│ ├── tcpserv03.c
│ ├── tcpserv04.c
│ ├── tcpserv04.lc
│ ├── tcpserv08.c
│ ├── tcpserv09.c
│ ├── tcpservpoll01.c
│ ├── tcpservpoll01.lc
│ ├── tcpservselect01.c
│ ├── tcpservselect01.lc
│ └── tsigpipe.c
├── test/
│ ├── Makefile
│ ├── accept_eintr.c
│ ├── funcs.c
│ ├── readline.h
│ ├── readline1.c
│ ├── readline1.lc
│ ├── readline2.c
│ ├── readline3.c
│ ├── test.h
│ ├── test1.c
│ ├── test2.c
│ ├── tisfdtype.c
│ ├── treadline1.c
│ ├── treadline2.c
│ ├── treadline3.c
│ ├── tshutdown.c
│ └── tsnprintf.c
├── threads/
│ ├── Makefile
│ ├── doit.1
│ ├── doit.2
│ ├── example01.c
│ ├── example01.lc
│ ├── example02.c
│ ├── example02.lc
│ ├── example03.c
│ ├── readline.c
│ ├── readline.lc
│ ├── script.example01
│ ├── script.example02
│ ├── strclithread.c
│ ├── strclithread.lc
│ ├── strclithread2.c
│ ├── tcpcli01.c
│ ├── tcpcli02.c
│ ├── tcpserv01.c
│ ├── tcpserv02.c
│ ├── test01.c
│ ├── test02.c
│ ├── test03.c
│ ├── test04.c
│ ├── test05.c
│ ├── unpthread.h
│ ├── web01.c
│ ├── web01.lc
│ ├── web02.c
│ ├── web03.c
│ └── web03.lc
├── traceroute/
│ ├── Makefile
│ ├── icmpcode_v4.c
│ ├── icmpcode_v6.c
│ ├── main.c
│ ├── main.lc
│ ├── recv_v4.c
│ ├── recv_v4.lc
│ ├── recv_v6.c
│ ├── recv_v6.lc
│ ├── sig_alrm.c
│ ├── trace.h
│ ├── trace.lh
│ ├── traceloop.c
│ ├── traceloop.lc
│ └── tv_sub.c
├── udpcksum/
│ ├── Makefile
│ ├── cleanup.c
│ ├── cleanup.lc
│ ├── main.c
│ ├── main.lc
│ ├── pcap.c
│ ├── pcap.lc
│ ├── senddnsquery-libnet.c
│ ├── senddnsquery-libnet.lc
│ ├── senddnsquery-raw.c
│ ├── senddnsquery-raw.lc
│ ├── udpcksum.c
│ ├── udpcksum.h
│ ├── udpcksum.lc
│ ├── udpread.c
│ ├── udpread.c.bad
│ ├── udpread.lc
│ ├── udpwrite.c
│ └── udpwrite.lc
├── udpcliserv/
│ ├── Makefile
│ ├── dgcliaddr.c
│ ├── dgclibig.c
│ ├── dgclibig.lc
│ ├── dgcliconnect.c
│ ├── dgcliconnect.lc
│ ├── dgcliinetaddr.c
│ ├── dgcliloop1.c
│ ├── dgcliloop3.c
│ ├── dgecholoop1.c
│ ├── dgecholoop2.c
│ ├── dgecholoop2.lc
│ ├── sigchldwaitpid.c
│ ├── udpcli01.c
│ ├── udpcli02.c
│ ├── udpcli03.c
│ ├── udpcli04.c
│ ├── udpcli05.c
│ ├── udpcli06.c
│ ├── udpcli08.c
│ ├── udpcli09.c
│ ├── udpcli10.c
│ ├── udpserv01.c
│ ├── udpserv06.c
│ ├── udpserv07.c
│ ├── udpservselect01.c
│ └── udpservselect01.lc
└── unixdomain/
├── Makefile
├── daytimetcpcli.c
├── daytimetcpsrv2.c
├── mycat.c
├── mycat.lc
├── myopen.c
├── openfile.c
├── readcred.c
├── sigchldwaitpid.c
├── strecho.c
├── testfcred.c
├── tfcred01.c
├── unixbind.c
├── unixbind.lc
├── unixdgcli01.c
├── unixdgcli01.lc
├── unixdgserv01.c
├── unixstrcli01.c
├── unixstrserv01.c
├── unixstrserv01.lc
└── unixstrserv02.c
SYMBOL INDEX (1139 symbols across 502 files)
FILE: advio/daytimetcpcli.c
function main (line 3) | int
FILE: advio/daytimeudpcli3.c
function main (line 3) | int
FILE: advio/daytimeudpcli4.c
function main (line 3) | int
FILE: advio/dgclitimeo.c
function dg_cli (line 3) | void
FILE: advio/dgclitimeo1.c
function dg_cli (line 3) | void
FILE: advio/dgclitimeo2.c
function dg_cli (line 3) | void
FILE: advio/dgclitimeo3.c
function dg_cli (line 5) | void
function sig_alrm (line 31) | static void
FILE: advio/dgechoaddr.c
function dg_echo (line 6) | void
FILE: advio/old/dgechoaddr.c
function dg_echo (line 6) | void
FILE: advio/old/recvfromflags.c
function recvfrom_flags (line 3) | ssize_t
function Recvfrom_flags (line 66) | ssize_t
FILE: advio/old/test01.c
function main (line 3) | int
FILE: advio/recvfromflags.c
function recvfrom_flags (line 5) | ssize_t
function Recvfrom_flags (line 85) | ssize_t
FILE: advio/sig_chld_waitpid.c
function sig_chld (line 3) | void
FILE: advio/str_cli_kqueue04.c
function str_cli (line 3) | void
FILE: advio/str_cli_poll03.c
function str_cli (line 4) | void
FILE: advio/str_cli_select02.c
function str_cli (line 3) | void
FILE: advio/str_echo_stdio02.c
function str_echo (line 3) | void
FILE: advio/tcpcli01.c
function main (line 4) | int
FILE: advio/tcpcli02.c
function main (line 3) | int
FILE: advio/tcpcli03.c
function main (line 3) | int
FILE: advio/tcpcli04.c
function main (line 3) | int
FILE: advio/tcpserv02.c
function main (line 3) | int
FILE: advio/udpcli01.c
function main (line 3) | int
FILE: advio/udpcli02.c
function main (line 3) | int
FILE: advio/udpcli03.c
function main (line 3) | int
FILE: advio/udpserv01.c
function main (line 3) | int
FILE: advio/udpserv03.c
function main (line 6) | int
function mydg_echo (line 84) | void
FILE: advio/udpserv04.c
function main (line 5) | int
function mydg_echo (line 84) | void
FILE: bcast/dgclibcast1.c
function dg_cli (line 5) | void
function recvfrom_alarm (line 43) | static void
FILE: bcast/dgclibcast2.c
function dg_cli (line 5) | void
function recvfrom_alarm (line 44) | static void
FILE: bcast/dgclibcast3.c
function dg_cli (line 5) | void
function recvfrom_alarm (line 49) | static void
FILE: bcast/dgclibcast4.c
function dg_cli (line 5) | void
function recvfrom_alarm (line 54) | static void
FILE: bcast/dgclibcast5.c
function dg_cli (line 7) | void
function recvfrom_alarm (line 40) | static void
FILE: bcast/dgclibcast6.c
function dg_cli (line 6) | void
function recvfrom_alarm (line 58) | static void
FILE: bcast/udpcli01.c
function main (line 3) | int
FILE: bcast/udpcli02.c
function main (line 3) | int
FILE: bcast/udpcli03.c
function main (line 3) | int
FILE: bcast/udpcli04.c
function main (line 3) | int
FILE: bcast/udpcli05.c
function main (line 3) | int
FILE: bcast/udpcli06.c
function main (line 3) | int
FILE: icmpd/dgcli01.c
function dg_cli (line 4) | void
FILE: icmpd/icmpd.c
function main (line 4) | int
FILE: icmpd/icmpd.h
type client (line 3) | struct client {
type sockaddr_un (line 13) | struct sockaddr_un
FILE: icmpd/readable_conn.c
function readable_conn (line 4) | int
FILE: icmpd/readable_listen.c
function readable_listen (line 3) | int
FILE: icmpd/readable_v4.c
function readable_v4 (line 8) | int
FILE: icmpd/readable_v6.c
function readable_v6 (line 13) | int
FILE: icmpd/udpcli01.c
function main (line 3) | int
FILE: icmpd/unpicmpd.h
type icmpd_err (line 8) | struct icmpd_err {
FILE: inetd/daytimetcpsrv2.c
function main (line 4) | int
FILE: inetd/daytimetcpsrv3.c
function main (line 4) | int
FILE: intro/byteorder.c
function main (line 3) | int
FILE: intro/daytimetcpcli.c
function main (line 3) | int
FILE: intro/daytimetcpcli1.c
function main (line 3) | int
FILE: intro/daytimetcpcli2.c
function main (line 3) | int
FILE: intro/daytimetcpcli3.c
function main (line 3) | int
FILE: intro/daytimetcpcliv6.c
function main (line 3) | int
FILE: intro/daytimetcpsrv.c
function main (line 4) | int
FILE: intro/daytimetcpsrv1.c
function main (line 4) | int
FILE: intro/daytimetcpsrv2.c
function main (line 4) | int
FILE: intro/daytimetcpsrv3.c
function main (line 4) | int
FILE: intro/daytimetcpsrvv6.c
function main (line 4) | int
FILE: ioctl/lsif01.c
function main (line 5) | int
FILE: ioctl/lsif02.c
function main (line 9) | int
FILE: ioctl/prifinfo.c
function main (line 3) | int
FILE: ioctl/prmac.c
function main (line 4) | int
FILE: ioctl/test1.c
function main (line 4) | int
FILE: ipopts/dgechoprintroute.c
function dg_echo (line 3) | void
FILE: ipopts/sigchldwaitpid.c
function sig_chld (line 3) | void
FILE: ipopts/sourceroute.c
function u_char (line 10) | u_char *
function inet_srcrt_add (line 26) | int
function inet_srcrt_print (line 50) | void
FILE: ipopts/sourceroute6.c
function inet6_srcrt_print (line 3) | void
FILE: ipopts/tcpcli01.c
function main (line 3) | int
FILE: ipopts/tcpserv01.c
function main (line 3) | int
FILE: ipopts/udpcli01.c
function main (line 3) | int
FILE: ipopts/udpserv01.c
function main (line 3) | int
FILE: key/add.c
function salen (line 4) | int
function prefix_all (line 23) | int
function sadb_add (line 39) | void
function main (line 132) | int
FILE: key/dump.c
function sadb_dump (line 5) | void
function main (line 42) | int
FILE: key/name.c
type idlist (line 4) | struct idlist {
type idlist (line 9) | struct idlist
type idlist (line 19) | struct idlist
type idlist (line 25) | struct idlist
function idlistlookup (line 32) | int
function getsatypebyname (line 42) | int
function getsaalgbyname (line 48) | int
FILE: key/printsadbmsg.c
function sa_print (line 120) | void
function supported_print (line 135) | void
function lifetime_print (line 159) | void
function address_print (line 196) | void
function key_print (line 224) | void
function print_sadb_msg (line 241) | void
FILE: key/register.c
function sadb_register (line 5) | void
function main (line 47) | int
FILE: key/unp.h
type in_pktinfo (line 122) | struct in_pktinfo {
type if_nameindex (line 212) | struct if_nameindex {
type timespec (line 222) | struct timespec {
type addrinfo (line 243) | struct addrinfo
type in_pktinfo (line 253) | struct in_pktinfo
type timeval (line 269) | struct timeval
type timeval (line 269) | struct timeval
type addrinfo (line 318) | struct addrinfo
type addrinfo (line 319) | struct addrinfo
type addrinfo (line 320) | struct addrinfo
type if_nameindex (line 339) | struct if_nameindex
type if_nameindex (line 340) | struct if_nameindex
type in_addr (line 349) | struct in_addr
type timespec (line 358) | struct timespec
type addrinfo (line 372) | struct addrinfo
type if_nameindex (line 377) | struct if_nameindex
type in_pktinfo (line 382) | struct in_pktinfo
type timeval (line 402) | struct timeval
type pollfd (line 443) | struct pollfd
type msghdr (line 449) | struct msghdr
type timeval (line 450) | struct timeval
type msghdr (line 453) | struct msghdr
FILE: lib/addrinfo.h
type addrinfo (line 10) | struct addrinfo {
FILE: lib/connect_nonb.c
function connect_nonb (line 3) | int
FILE: lib/connect_timeo.c
function connect_timeo (line 6) | int
function connect_alarm (line 27) | static void
function Connect_timeo (line 34) | void
FILE: lib/daemon_inetd.c
function daemon_inetd (line 6) | void
FILE: lib/daemon_init.c
function daemon_init (line 8) | int
FILE: lib/dg_cli.c
function dg_cli (line 3) | void
FILE: lib/dg_echo.c
function dg_echo (line 3) | void
FILE: lib/error.c
function err_ret (line 13) | void
function err_sys (line 27) | void
function err_dump (line 41) | void
function err_msg (line 56) | void
function err_quit (line 70) | void
function err_doit (line 84) | static void
FILE: lib/family_to_level.c
function family_to_level (line 3) | int
function Family_to_level (line 18) | int
FILE: lib/get_ifi_info.c
type ifi_info (line 4) | struct ifi_info
type ifi_info (line 7) | struct ifi_info
type ifconf (line 10) | struct ifconf
type ifreq (line 11) | struct ifreq
type sockaddr_in (line 12) | struct sockaddr_in
type sockaddr_in6 (line 13) | struct sockaddr_in6
type ifreq (line 18) | struct ifreq
type ifreq (line 31) | struct ifreq
type ifreq (line 42) | struct ifreq
type sockaddr (line 45) | struct sockaddr
type sockaddr_in6 (line 50) | struct sockaddr_in6
type sockaddr (line 55) | struct sockaddr
type sockaddr_dl (line 64) | struct sockaddr_dl
type sockaddr_dl (line 64) | struct sockaddr_dl
type ifi_info (line 93) | struct ifi_info
type sockaddr_in (line 120) | struct sockaddr_in
type sockaddr_in (line 121) | struct sockaddr_in
type sockaddr_in (line 122) | struct sockaddr_in
type sockaddr_in (line 127) | struct sockaddr_in
type sockaddr_in (line 128) | struct sockaddr_in
type sockaddr_in (line 129) | struct sockaddr_in
type sockaddr_in (line 136) | struct sockaddr_in
type sockaddr_in (line 137) | struct sockaddr_in
type sockaddr_in (line 138) | struct sockaddr_in
type sockaddr_in6 (line 144) | struct sockaddr_in6
type sockaddr_in6 (line 145) | struct sockaddr_in6
type sockaddr_in6 (line 146) | struct sockaddr_in6
type sockaddr_in6 (line 151) | struct sockaddr_in6
type sockaddr_in6 (line 152) | struct sockaddr_in6
type sockaddr_in6 (line 153) | struct sockaddr_in6
function free_ifi_info (line 168) | void
type ifi_info (line 186) | struct ifi_info
type ifi_info (line 189) | struct ifi_info
FILE: lib/gf_time.c
type timeval (line 7) | struct timeval
FILE: lib/host_serv.c
type addrinfo (line 4) | struct addrinfo
type addrinfo (line 8) | struct addrinfo
type addrinfo (line 10) | struct addrinfo
type addrinfo (line 29) | struct addrinfo
type addrinfo (line 33) | struct addrinfo
type addrinfo (line 35) | struct addrinfo
FILE: lib/if_nameindex.c
type if_nameindex (line 9) | struct if_nameindex
function if_freenameindex (line 15) | void
type if_nameindex (line 20) | struct if_nameindex
type if_nameindex (line 23) | struct if_nameindex
FILE: lib/if_nametoindex.c
function if_nametoindex (line 9) | unsigned int
function If_nametoindex (line 15) | unsigned int
FILE: lib/in6addr_any.c
type in6_addr (line 4) | struct in6_addr
FILE: lib/mcast_get_if.c
function mcast_get_if (line 3) | int
function Mcast_get_if (line 31) | int
FILE: lib/mcast_get_loop.c
function mcast_get_loop (line 3) | int
function Mcast_get_loop (line 37) | int
FILE: lib/mcast_get_ttl.c
function mcast_get_ttl (line 3) | int
function Mcast_get_ttl (line 37) | int
FILE: lib/mcast_join.c
function mcast_join (line 5) | int
function Mcast_join (line 97) | void
function mcast_join_source_group (line 105) | int
function Mcast_join_source_group (line 175) | void
function mcast_block_source (line 185) | int
function Mcast_block_source (line 229) | void
function mcast_unblock_source (line 237) | int
function Mcast_unblock_source (line 281) | void
FILE: lib/mcast_leave.c
function mcast_leave (line 3) | int
function Mcast_leave (line 52) | void
function mcast_leave_source_group (line 59) | int
function Mcast_leave_source_group (line 103) | void
FILE: lib/mcast_set_if.c
function mcast_set_if (line 4) | int
function Mcast_set_if (line 58) | void
FILE: lib/mcast_set_loop.c
function mcast_set_loop (line 4) | int
function Mcast_set_loop (line 33) | void
FILE: lib/mcast_set_ttl.c
function mcast_set_ttl (line 3) | int
function Mcast_set_ttl (line 31) | void
FILE: lib/my_addrs.c
type hostent (line 8) | struct hostent
type utsname (line 9) | struct utsname
FILE: lib/pselect.c
function pselect (line 12) | int
FILE: lib/read_fd.c
function read_fd (line 4) | ssize_t
function Read_fd (line 61) | ssize_t
FILE: lib/readable_timeo.c
function readable_timeo (line 4) | int
function Readable_timeo (line 21) | int
FILE: lib/readline.c
function my_read (line 8) | static ssize_t
function readline (line 28) | ssize_t
function readlinebuf (line 51) | ssize_t
function Readline (line 60) | ssize_t
FILE: lib/readn.c
function readn (line 4) | ssize_t /* Read "n" bytes from a descriptor. */
function Readn (line 29) | ssize_t
FILE: lib/rtt.c
function rtt_minmax (line 12) | static float
function rtt_init (line 22) | void
function rtt_ts (line 45) | uint32_t
function rtt_newpack (line 56) | void
function rtt_start (line 62) | int
function rtt_stop (line 80) | void
function rtt_timeout (line 111) | int
function rtt_debug (line 126) | void
FILE: lib/signal.c
function Sigfunc (line 4) | Sigfunc *
function Sigfunc (line 27) | Sigfunc *
FILE: lib/signal_intr.c
function Sigfunc (line 4) | Sigfunc *
function Sigfunc (line 21) | Sigfunc *
FILE: lib/snprintf.c
function snprintf (line 14) | int
FILE: lib/sock_bind_wild.c
function sock_bind_wild (line 3) | int
function Sock_bind_wild (line 46) | int
FILE: lib/sock_cmp_addr.c
function sock_cmp_addr (line 7) | int
FILE: lib/sock_cmp_port.c
function sock_cmp_port (line 7) | int
FILE: lib/sock_get_port.c
function sock_get_port (line 3) | int
FILE: lib/sock_ntop.c
type sockaddr (line 9) | struct sockaddr
type sockaddr_in (line 16) | struct sockaddr_in
type sockaddr_in (line 16) | struct sockaddr_in
type sockaddr_in6 (line 30) | struct sockaddr_in6
type sockaddr_in6 (line 30) | struct sockaddr_in6
type sockaddr_un (line 46) | struct sockaddr_un
type sockaddr_un (line 46) | struct sockaddr_un
type sockaddr_dl (line 60) | struct sockaddr_dl
type sockaddr_dl (line 60) | struct sockaddr_dl
type sockaddr (line 79) | struct sockaddr
FILE: lib/sock_ntop_host.c
type sockaddr (line 8) | struct sockaddr
type sockaddr_in (line 14) | struct sockaddr_in
type sockaddr_in (line 14) | struct sockaddr_in
type sockaddr_in6 (line 23) | struct sockaddr_in6
type sockaddr_in6 (line 23) | struct sockaddr_in6
type sockaddr_un (line 33) | struct sockaddr_un
type sockaddr_un (line 33) | struct sockaddr_un
type sockaddr_dl (line 47) | struct sockaddr_dl
type sockaddr_dl (line 47) | struct sockaddr_dl
type sockaddr (line 66) | struct sockaddr
FILE: lib/sock_set_addr.c
function sock_set_addr (line 3) | void
FILE: lib/sock_set_port.c
function sock_set_port (line 3) | void
FILE: lib/sock_set_wild.c
function sock_set_wild (line 3) | void
FILE: lib/sockatmark.c
function sockatmark (line 3) | int
FILE: lib/sockfd_to_family.c
function sockfd_to_family (line 4) | int
function Sockfd_to_family (line 17) | int
FILE: lib/str_cli.c
function str_cli (line 3) | void
FILE: lib/str_echo.c
function str_echo (line 3) | void
FILE: lib/tcp_connect.c
function tcp_connect (line 4) | int
function Tcp_connect (line 45) | int
FILE: lib/tcp_listen.c
function tcp_listen (line 4) | int
function Tcp_listen (line 53) | int
FILE: lib/tv_sub.c
function tv_sub (line 3) | void
FILE: lib/udp_client.c
function udp_client (line 4) | int
function Udp_client (line 38) | int
FILE: lib/udp_connect.c
function udp_connect (line 4) | int
function Udp_connect (line 39) | int
FILE: lib/udp_server.c
function udp_server (line 4) | int
function Udp_server (line 43) | int
FILE: lib/unp.h
type unp_in_pktinfo (line 141) | struct unp_in_pktinfo {
type sockaddr_storage (line 227) | struct sockaddr_storage {
type if_nameindex (line 253) | struct if_nameindex {
type timespec (line 263) | struct timespec {
type addrinfo (line 284) | struct addrinfo
type unp_in_pktinfo (line 295) | struct unp_in_pktinfo
type timeval (line 311) | struct timeval
type timeval (line 311) | struct timeval
type addrinfo (line 360) | struct addrinfo
type addrinfo (line 361) | struct addrinfo
type addrinfo (line 362) | struct addrinfo
type if_nameindex (line 381) | struct if_nameindex
type if_nameindex (line 382) | struct if_nameindex
type in_addr (line 391) | struct in_addr
type timespec (line 396) | struct timespec
type addrinfo (line 410) | struct addrinfo
type if_nameindex (line 415) | struct if_nameindex
type unp_in_pktinfo (line 420) | struct unp_in_pktinfo
type timeval (line 440) | struct timeval
type in6_addr (line 481) | struct in6_addr
type in6_addr (line 484) | struct in6_addr
type kevent (line 488) | struct kevent
type kevent (line 489) | struct kevent
type timespec (line 489) | struct timespec
type pollfd (line 493) | struct pollfd
type msghdr (line 499) | struct msghdr
type timeval (line 500) | struct timeval
type msghdr (line 503) | struct msghdr
FILE: lib/unpifi.h
type ifi_info (line 13) | struct ifi_info {
type ifi_info (line 30) | struct ifi_info
type ifi_info (line 31) | struct ifi_info
type ifi_info (line 32) | struct ifi_info
FILE: lib/unprtt.h
type rtt_info (line 6) | struct rtt_info {
type rtt_info (line 20) | struct rtt_info
type rtt_info (line 21) | struct rtt_info
type rtt_info (line 22) | struct rtt_info
type rtt_info (line 23) | struct rtt_info
type rtt_info (line 24) | struct rtt_info
type rtt_info (line 25) | struct rtt_info
type rtt_info (line 26) | struct rtt_info
FILE: lib/unpthread.h
type timespec (line 25) | struct timespec
FILE: lib/wraplib.c
function Inet_pton (line 20) | void
FILE: lib/wrappthread.c
function Pthread_create (line 8) | void
function Pthread_join (line 20) | void
function Pthread_detach (line 31) | void
function Pthread_kill (line 42) | void
function Pthread_mutexattr_init (line 53) | void
function Pthread_mutexattr_setpshared (line 65) | void
function Pthread_mutex_init (line 77) | void
function Pthread_mutex_lock (line 89) | void
function Pthread_mutex_unlock (line 101) | void
function Pthread_cond_broadcast (line 112) | void
function Pthread_cond_signal (line 123) | void
function Pthread_cond_wait (line 134) | void
function Pthread_cond_timedwait (line 145) | void
function Pthread_once (line 157) | void
function Pthread_key_create (line 168) | void
function Pthread_setspecific (line 179) | void
FILE: lib/wrapsock.c
function Accept (line 21) | int
function Bind (line 40) | void
function Connect (line 47) | void
function Getpeername (line 54) | void
function Getsockname (line 61) | void
function Getsockopt (line 68) | void
function Inet6_rth_space (line 76) | int
function Inet6_rth_add (line 100) | void
function Inet6_rth_reverse (line 107) | void
function Inet6_rth_segments (line 114) | int
type in6_addr (line 126) | struct in6_addr
type in6_addr (line 129) | struct in6_addr
function Kqueue (line 140) | int
function Kevent (line 150) | int
function Listen (line 165) | void
function Poll (line 180) | int
function Recv (line 192) | ssize_t
function Recvfrom (line 202) | ssize_t
function Recvmsg (line 213) | ssize_t
function Select (line 223) | int
function Send (line 234) | void
function Sendto (line 241) | void
function Sendmsg (line 249) | void
function Setsockopt (line 263) | void
function Shutdown (line 270) | void
function Sockatmark (line 277) | int
function Socket (line 288) | int
function Socketpair (line 299) | void
FILE: lib/wrapstdio.c
function Fclose (line 7) | void
function FILE (line 14) | FILE *
function FILE (line 36) | FILE *
function Fputs (line 47) | void
FILE: lib/wrapunix.c
function Close (line 31) | void
function Dup2 (line 38) | void
function Fcntl (line 45) | int
function Gettimeofday (line 55) | void
function Ioctl (line 63) | int
function pid_t (line 73) | pid_t
function Mkstemp (line 93) | int
function Open (line 122) | int
function Pipe (line 132) | void
function Read (line 139) | ssize_t
function Sigaddset (line 149) | void
function Sigdelset (line 156) | void
function Sigemptyset (line 163) | void
function Sigfillset (line 170) | void
function Sigismember (line 177) | int
function Sigpending (line 187) | void
function Sigprocmask (line 194) | void
function Sysconf (line 211) | long
function Sysctl (line 223) | void
function Unlink (line 232) | void
function pid_t (line 239) | pid_t
function pid_t (line 249) | pid_t
function Write (line 259) | void
FILE: lib/writable_timeo.c
function writable_timeo (line 4) | int
function Writable_timeo (line 21) | int
FILE: lib/write_fd.c
function write_fd (line 4) | ssize_t
function Write_fd (line 42) | ssize_t
FILE: lib/writen.c
function writen (line 4) | ssize_t /* Write "n" bytes to a descriptor. */
function Writen (line 28) | void
FILE: libfree/addrinfo.h
type addrinfo (line 10) | struct addrinfo {
FILE: libfree/getaddrinfo.c
type hostent (line 122) | struct hostent
type hostent (line 123) | struct hostent
type addrinfo (line 124) | struct addrinfo
type addrinfo (line 125) | struct addrinfo
type servent (line 126) | struct servent
type addrinfo (line 127) | struct addrinfo
type addrinfo (line 128) | struct addrinfo
type addrinfo (line 129) | struct addrinfo
type addrinfo (line 130) | struct addrinfo
type addrinfo (line 130) | struct addrinfo
type addrinfo (line 134) | struct addrinfo
function getaddrinfo (line 136) | int
function getaddrinfo_host (line 442) | static int
function getaddrinfo_serv (line 537) | static int
function getaddrinfo_port (line 639) | static int
type addrinfo (line 689) | struct addrinfo
type addrinfo (line 690) | struct addrinfo
type addrinfo (line 692) | struct addrinfo
type addrinfo (line 694) | struct addrinfo
function addrinfo_local (line 719) | static int
function freeaddrinfo (line 756) | void
FILE: libfree/getnameinfo.c
function getnameinfo (line 48) | int
function do_ipv46 (line 83) | static int
FILE: libfree/in_cksum.c
function in_cksum (line 3) | uint16_t
FILE: libfree/inet_aton.c
function inet_aton (line 22) | int
FILE: libfree/inet_pton.c
function inet_pton (line 58) | int
function inet_pton4 (line 86) | static int
function inet_pton6 (line 140) | static int
FILE: libfree/inet_pton_ipv4.c
type in_addr (line 10) | struct in_addr
function inet_pton (line 13) | int
FILE: libfree/test_ascii2addr.c
type in6_addr (line 9) | struct in6_addr
FILE: libfree/test_getservbyname_r.c
type servent (line 6) | struct servent
FILE: libfree/test_inet_pton.c
function main (line 9) | int
FILE: libgai/addrinfo.h
type addrinfo (line 10) | struct addrinfo {
FILE: libgai/freeaddrinfo.c
function freeaddrinfo (line 4) | void
FILE: libgai/ga_aistruct.c
function ga_aistruct (line 8) | int
FILE: libgai/ga_clone.c
type addrinfo (line 8) | struct addrinfo
type addrinfo (line 9) | struct addrinfo
type addrinfo (line 11) | struct addrinfo
type addrinfo (line 13) | struct addrinfo
FILE: libgai/ga_echeck.c
function ga_echeck (line 8) | int
FILE: libgai/ga_nsearch.c
function ga_nsearch (line 9) | int
FILE: libgai/ga_port.c
function ga_port (line 30) | int
FILE: libgai/ga_serv.c
function ga_serv (line 8) | int
FILE: libgai/ga_unix.c
function ga_unix (line 6) | int
FILE: libgai/gai_hdr.h
type search (line 7) | struct search {
type addrinfo (line 13) | struct addrinfo
type addrinfo (line 13) | struct addrinfo
type addrinfo (line 15) | struct addrinfo
type addrinfo (line 15) | struct addrinfo
type addrinfo (line 17) | struct addrinfo
type search (line 17) | struct search
type addrinfo (line 18) | struct addrinfo
type addrinfo (line 19) | struct addrinfo
type addrinfo (line 19) | struct addrinfo
type addrinfo (line 20) | struct addrinfo
type addrinfo (line 20) | struct addrinfo
FILE: libgai/getaddrinfo.c
function getaddrinfo (line 6) | int
FILE: libgai/getnameinfo.c
function getnameinfo (line 4) | int
FILE: libgai/gn_ipv46.c
function gn_ipv46 (line 8) | int
FILE: libgai/old/ga_unixstruct.c
function ga_unixstruct (line 4) | int
FILE: libgai/old/savecopy.c
type search (line 9) | struct search {
type addrinfo (line 15) | struct addrinfo
type addrinfo (line 16) | struct addrinfo
type search (line 17) | struct search
type addrinfo (line 18) | struct addrinfo
type addrinfo (line 18) | struct addrinfo
type addrinfo (line 20) | struct addrinfo
type addrinfo (line 20) | struct addrinfo
type addrinfo (line 21) | struct addrinfo
type addrinfo (line 22) | struct addrinfo
type addrinfo (line 22) | struct addrinfo
type addrinfo (line 23) | struct addrinfo
type addrinfo (line 23) | struct addrinfo
type addrinfo (line 27) | struct addrinfo
function getaddrinfo (line 29) | int
function ga_echeck (line 169) | static int
function ga_nsearch (line 221) | static int
function ga_aistruct (line 328) | static int
function ga_serv (line 390) | static int
function ga_port (line 462) | static int
type addrinfo (line 503) | struct addrinfo
type addrinfo (line 504) | struct addrinfo
type addrinfo (line 506) | struct addrinfo
type addrinfo (line 508) | struct addrinfo
function ga_unix (line 533) | static int
function freeaddrinfo (line 569) | void
FILE: libgai/test1.c
function main (line 9) | int
FILE: libgai/testga.c
type addrinfo (line 10) | struct addrinfo
function main (line 18) | int
function do_errtest (line 160) | static void
function do_funccall (line 210) | static void
function do_onetest (line 237) | static int
function usage (line 301) | static void
FILE: libroute/get_rtaddrs.c
function get_rtaddrs (line 16) | void
FILE: libroute/if_indextoname.c
type if_msghdr (line 10) | struct if_msghdr
type sockaddr (line 11) | struct sockaddr
type sockaddr_dl (line 12) | struct sockaddr_dl
type if_msghdr (line 19) | struct if_msghdr
type sockaddr (line 21) | struct sockaddr
type sockaddr_dl (line 25) | struct sockaddr_dl
FILE: libroute/if_nameindex.c
type if_nameindex (line 5) | struct if_nameindex
type if_msghdr (line 10) | struct if_msghdr
type sockaddr (line 11) | struct sockaddr
type sockaddr_dl (line 12) | struct sockaddr_dl
type if_nameindex (line 13) | struct if_nameindex
type if_msghdr (line 26) | struct if_msghdr
type sockaddr (line 28) | struct sockaddr
type sockaddr_dl (line 32) | struct sockaddr_dl
function if_freenameindex (line 52) | void
type if_nameindex (line 59) | struct if_nameindex
type if_nameindex (line 62) | struct if_nameindex
FILE: libroute/if_nametoindex.c
function if_nametoindex (line 5) | unsigned int
function If_nametoindex (line 43) | unsigned int
FILE: libroute/unproute.h
type sockaddr (line 12) | struct sockaddr
type sockaddr (line 12) | struct sockaddr
type sockaddr (line 15) | struct sockaddr
FILE: mcast/dgclibcast1.c
function dg_cli (line 5) | void
function recvfrom_alarm (line 39) | static void
FILE: mcast/dgclimcast5.c
function dg_cli (line 7) | void
function recvfrom_alarm (line 36) | static void
FILE: mcast/dgclimcast6.c
function dg_cli (line 7) | void
function recvfrom_alarm (line 36) | static void
FILE: mcast/main.c
function main (line 6) | int
FILE: mcast/recv.c
function recv_all (line 3) | void
FILE: mcast/send.c
function send_all (line 6) | void
FILE: mcast/udpcli01.c
function main (line 3) | int
FILE: mcast/udpcli05.c
function main (line 3) | int
FILE: mcast/udpcli06.c
function main (line 3) | int
FILE: mcast/udpserv01.c
function main (line 3) | int
FILE: mysdr/loop.c
function loop (line 3) | void
FILE: mysdr/main.c
function main (line 8) | int
FILE: names/daytimetcpcli.c
function main (line 3) | int
FILE: names/daytimetcpcli1.c
function main (line 3) | int
FILE: names/daytimetcpcli2.c
function main (line 3) | int
FILE: names/daytimetcpcli3.c
function main (line 3) | int
FILE: names/daytimetcpsrv1.c
function main (line 4) | int
FILE: names/daytimetcpsrv2.c
function main (line 4) | int
FILE: names/daytimetcpsrv3.c
function main (line 4) | int
FILE: names/daytimetcpsrv4.c
function main (line 4) | int
FILE: names/daytimeudpcli1.c
function main (line 3) | int
FILE: names/daytimeudpcli2.c
function main (line 3) | int
FILE: names/daytimeudpsrv2.c
function main (line 4) | int
FILE: names/daytimeudpsrv3.c
function main (line 4) | int
FILE: names/hostent.c
function main (line 3) | int
FILE: names/hostent2.c
function main (line 3) | int
FILE: names/hostent3.c
function main (line 5) | int
function pr_ipv4 (line 42) | void
FILE: names/myaddrs1.c
type hostent (line 7) | struct hostent
FILE: names/netent.c
function main (line 3) | int
FILE: names/prmyaddrs.c
function main (line 5) | int
FILE: names/prmyaddrs1.c
function main (line 5) | int
FILE: names/test1.c
function main (line 5) | int
FILE: names/test2.c
function main (line 3) | int
FILE: names/udp_server_reuseaddr.c
function udp_server_reuseaddr (line 4) | int
function Udp_server_reuseaddr (line 45) | int
FILE: nonblock/daytimetcpcli.c
function main (line 3) | int
FILE: nonblock/home_page.c
function home_page (line 3) | void
FILE: nonblock/start_connect.c
function start_connect (line 3) | void
FILE: nonblock/strclifork.c
function str_cli (line 3) | void
FILE: nonblock/strclinonb.c
function str_cli (line 4) | void
FILE: nonblock/tcpcli01.c
function main (line 3) | int
FILE: nonblock/tcpcli02.c
function main (line 3) | int
FILE: nonblock/tcpcli03.c
function main (line 3) | int
FILE: nonblock/tcpcli04.c
function main (line 3) | int
FILE: nonblock/tcpservselect03.c
function main (line 3) | int
FILE: nonblock/web.c
function main (line 4) | int
FILE: nonblock/web.h
type file (line 6) | struct file {
type file (line 25) | struct file
type file (line 26) | struct file
FILE: nonblock/write_get_cmd.c
function write_get_cmd (line 3) | void
FILE: oob/heartbeatcli.c
function heartbeat_cli (line 9) | void
function sig_urg (line 26) | static void
function sig_alrm (line 40) | static void
FILE: oob/heartbeatserv.c
function heartbeat_serv (line 9) | void
function sig_urg (line 25) | static void
function sig_alrm (line 41) | static void
FILE: oob/sigchldwaitpid.c
function sig_chld (line 3) | void
FILE: oob/strcliselect02.c
function str_cli (line 3) | void
FILE: oob/strecho02.c
function str_echo (line 3) | void
FILE: oob/tcpcli02.c
function main (line 3) | int
FILE: oob/tcprecv01.c
function main (line 7) | int
function sig_urg (line 35) | void
FILE: oob/tcprecv02.c
function main (line 3) | int
FILE: oob/tcprecv03.c
function main (line 3) | int
FILE: oob/tcprecv03p.c
function main (line 3) | int
FILE: oob/tcprecv04.c
function main (line 3) | int
FILE: oob/tcprecv05.c
function main (line 7) | int
function sig_urg (line 31) | void
FILE: oob/tcprecv06.c
function main (line 3) | int
FILE: oob/tcpsend01.c
function main (line 3) | int
FILE: oob/tcpsend02.c
function main (line 3) | int
FILE: oob/tcpsend03.c
function main (line 3) | int
FILE: oob/tcpsend04.c
function main (line 3) | int
FILE: oob/tcpsend05.c
function main (line 3) | int
FILE: oob/tcpsend06.c
function main (line 3) | int
FILE: oob/tcpserv02.c
function main (line 3) | int
FILE: ping/bsdping.c
type sockaddr (line 119) | struct sockaddr
type icmp (line 148) | struct icmp
type ip (line 149) | struct ip
type sockaddr_in (line 150) | struct sockaddr_in
type ip (line 151) | struct ip
type timeval (line 153) | struct timeval
type timeval (line 153) | struct timeval
function main (line 156) | int
function onalrm (line 366) | void
function pinger (line 405) | void
function pr_pack (line 449) | void
function u_short (line 635) | u_short
function tvsub (line 673) | void
function oninfo (line 688) | void
function onint (line 699) | void
function summary (line 716) | void
function pr_icmph (line 762) | void
function pr_iph (line 903) | void
type hostent (line 936) | struct hostent
type in_addr (line 941) | struct in_addr
type in_addr (line 944) | struct in_addr
function pr_retip (line 952) | void
function fill (line 971) | void
function usage (line 1002) | void
FILE: ping/init_v6.c
function init_v6 (line 3) | void
FILE: ping/main.c
type proto (line 3) | struct proto
type proto (line 6) | struct proto
function main (line 11) | int
FILE: ping/old/icmp6.h
type icmp6hdr (line 1) | struct icmp6hdr {
FILE: ping/old/ip6.h
type ip6hdr (line 1) | struct ip6hdr {
FILE: ping/ping.h
type msghdr (line 20) | struct msghdr
type timeval (line 20) | struct timeval
type msghdr (line 21) | struct msghdr
type timeval (line 21) | struct timeval
type timeval (line 26) | struct timeval
type timeval (line 26) | struct timeval
type proto (line 28) | struct proto {
FILE: ping/ping_v4.c
function ping_v4 (line 3) | void
FILE: ping/proc_v4.c
function proc_v4 (line 3) | void
FILE: ping/proc_v6.c
function proc_v6 (line 3) | void
FILE: ping/readloop.c
function readloop (line 3) | void
FILE: ping/send_v4.c
function send_v4 (line 3) | void
FILE: ping/send_v6.c
function send_v6 (line 3) | void
FILE: ping/sig_alrm.c
function sig_alrm (line 3) | void
FILE: ping/tv_sub.c
function tv_sub (line 3) | void
FILE: route/checkudpsum.c
function main (line 6) | int
FILE: route/get_ifi_info.c
type ifi_info (line 5) | struct ifi_info
type if_msghdr (line 11) | struct if_msghdr
type ifa_msghdr (line 12) | struct ifa_msghdr
type sockaddr (line 13) | struct sockaddr
type sockaddr_dl (line 14) | struct sockaddr_dl
type ifi_info (line 15) | struct ifi_info
type if_msghdr (line 24) | struct if_msghdr
type sockaddr (line 29) | struct sockaddr
type ifi_info (line 32) | struct ifi_info
type sockaddr_dl (line 38) | struct sockaddr_dl
type ifi_info (line 62) | struct ifi_info
type ifa_msghdr (line 72) | struct ifa_msghdr
type sockaddr (line 73) | struct sockaddr
function free_ifi_info (line 101) | void
type ifi_info (line 118) | struct ifi_info
type ifi_info (line 121) | struct ifi_info
FILE: route/getrt.c
function main (line 8) | int
FILE: route/mynetstat.c
function main (line 6) | int
function pr_rtable (line 31) | void
function pr_iflist (line 56) | void
FILE: route/prifindex.c
function main (line 3) | int
FILE: route/prifinfo.c
function main (line 3) | int
FILE: route/prifname.c
function main (line 3) | int
FILE: route/prifnameindex.c
function main (line 3) | int
FILE: route/unproute.h
type sockaddr (line 12) | struct sockaddr
type sockaddr (line 12) | struct sockaddr
type sockaddr (line 15) | struct sockaddr
FILE: rtt/dg_cli.c
function dg_cli (line 6) | void
FILE: rtt/dg_echo.c
function dg_echo (line 3) | void
FILE: rtt/dg_send_recv.c
type rtt_info (line 7) | struct rtt_info
type msghdr (line 9) | struct msghdr
type hdr (line 10) | struct hdr {
function dg_send_recv (line 18) | ssize_t
function sig_alrm (line 95) | static void
function Dg_send_recv (line 102) | ssize_t
FILE: rtt/udpcli01.c
function main (line 3) | int
FILE: rtt/unprtt.h
type rtt_info (line 6) | struct rtt_info {
type rtt_info (line 20) | struct rtt_info
type rtt_info (line 21) | struct rtt_info
type rtt_info (line 22) | struct rtt_info
type rtt_info (line 23) | struct rtt_info
type rtt_info (line 24) | struct rtt_info
type rtt_info (line 25) | struct rtt_info
type rtt_info (line 26) | struct rtt_info
FILE: sctp/sctp_addr_to_associd.c
function sctp_assoc_t (line 3) | sctp_assoc_t
FILE: sctp/sctp_bindargs.c
function sctp_bind_arg_list (line 3) | int
FILE: sctp/sctp_check_notify.c
function check_notification (line 3) | void
FILE: sctp/sctp_displayevents.c
function print_notification (line 3) | void
FILE: sctp/sctp_getnostrm.c
function sctp_get_no_strms (line 3) | int
FILE: sctp/sctp_modify_hb.c
function heartbeat_action (line 3) | int heartbeat_action(int sock_fd, struct sockaddr *sa, socklen_t salen,
FILE: sctp/sctp_pdapircv.c
type sctp_sndrcvinfo (line 12) | struct sctp_sndrcvinfo
FILE: sctp/sctp_print_addrs.c
function sctp_print_addresses (line 3) | void
FILE: sctp/sctp_strcli.c
function sctpstr_cli (line 3) | void
FILE: sctp/sctp_strcli1.c
function sctpstr_cli (line 3) | void
FILE: sctp/sctp_strcli_un.c
function sctpstr_cli (line 3) | void
FILE: sctp/sctp_strcliecho.c
function sctpstr_cli_echoall (line 5) | void
FILE: sctp/sctp_strcliecho2.c
function sctpstr_cli_echoall (line 5) | void
FILE: sctp/sctp_wrapper.c
function Sctp_recvmsg (line 4) | int
function Sctp_sendmsg (line 19) | int
function Sctp_bindx (line 33) | int
FILE: sctp/sctpclient01.c
function main (line 3) | int
FILE: sctp/sctpclient02.c
function main (line 3) | int
FILE: sctp/sctpclient04.c
function main (line 3) | int
FILE: sctp/sctpserv01.c
function main (line 3) | int
FILE: sctp/sctpserv02.c
function main (line 3) | int
FILE: sctp/sctpserv03.c
function main (line 3) | int
FILE: sctp/sctpserv04.c
function main (line 3) | int
FILE: sctp/sctpserv05.c
function main (line 3) | int
FILE: sctp/sctpserv06.c
function main (line 3) | int
FILE: sctp/sctpserv07.c
function main (line 3) | int
FILE: sctp/sctpserv_fork.c
function main (line 3) | int
FILE: sctp/unp.h
type in_pktinfo (line 115) | struct in_pktinfo {
type if_nameindex (line 212) | struct if_nameindex {
type timespec (line 222) | struct timespec {
type addrinfo (line 242) | struct addrinfo
type in_pktinfo (line 252) | struct in_pktinfo
type sockaddr (line 266) | struct sockaddr
type sockaddr (line 267) | struct sockaddr
type sctp_sndrcvinfo (line 270) | struct sctp_sndrcvinfo
type sockaddr_storage (line 273) | struct sockaddr_storage
type sockaddr (line 280) | struct sockaddr
type sockaddr (line 284) | struct sockaddr
type timeval (line 292) | struct timeval
type timeval (line 292) | struct timeval
type addrinfo (line 323) | struct addrinfo
type addrinfo (line 324) | struct addrinfo
type addrinfo (line 325) | struct addrinfo
type if_nameindex (line 344) | struct if_nameindex
type if_nameindex (line 345) | struct if_nameindex
type in_addr (line 354) | struct in_addr
type timespec (line 363) | struct timespec
type addrinfo (line 376) | struct addrinfo
type if_nameindex (line 381) | struct if_nameindex
type in_pktinfo (line 386) | struct in_pktinfo
type timeval (line 406) | struct timeval
type pollfd (line 447) | struct pollfd
type msghdr (line 453) | struct msghdr
type timeval (line 454) | struct timeval
type msghdr (line 457) | struct msghdr
FILE: select/strcliselect01.c
function str_cli (line 3) | void
FILE: select/strcliselect02.c
function str_cli (line 3) | void
FILE: select/tcpcli01.c
function main (line 4) | int
FILE: select/tcpcli02.c
function main (line 4) | int
FILE: select/tcpcli03.c
function main (line 4) | int
FILE: server/child.h
type Child (line 1) | typedef struct {
FILE: server/child02.c
function pid_t (line 4) | pid_t
function child_main (line 18) | void
FILE: server/child02l.c
function pid_t (line 3) | pid_t
function child_main (line 15) | void
FILE: server/child02m.c
function pid_t (line 3) | pid_t
function child_main (line 15) | void
FILE: server/child03.c
function pid_t (line 3) | pid_t
function child_main (line 15) | void
FILE: server/child03m.c
function pid_t (line 3) | pid_t
function child_main (line 15) | void
FILE: server/child04.c
function pid_t (line 3) | pid_t
function child_main (line 15) | void
FILE: server/child05.c
function pid_t (line 5) | pid_t
function child_main (line 31) | void
FILE: server/client.c
function main (line 5) | int
FILE: server/clientrst.c
function main (line 5) | int
FILE: server/lock_fcntl.c
type flock (line 4) | struct flock
function my_lock_init (line 8) | void
function my_lock_wait (line 32) | void
function my_lock_release (line 45) | void
FILE: server/lock_pthread.c
function my_lock_init (line 7) | void
function my_lock_wait (line 26) | void
function my_lock_release (line 32) | void
FILE: server/pr_cpu_time.c
type rusage (line 5) | struct rusage
function pr_cpu_time (line 8) | void
FILE: server/pthread07.c
function thread_make (line 4) | void
type sockaddr (line 19) | struct sockaddr
FILE: server/pthread07.h
type Thread (line 1) | typedef struct {
FILE: server/pthread08.c
function thread_make (line 4) | void
FILE: server/pthread08.h
type Thread (line 1) | typedef struct {
FILE: server/pthread09.c
function thread_make (line 4) | void
type sockaddr (line 19) | struct sockaddr
FILE: server/pthread09.h
type Thread (line 1) | typedef struct {
FILE: server/readline.c
function readline (line 4) | ssize_t
function Readline (line 30) | ssize_t
FILE: server/readline_r.c
function my_read_r (line 5) | static ssize_t
function readline_rinit (line 27) | void
function readline_r (line 38) | ssize_t
function Readline_r (line 64) | ssize_t
FILE: server/readline_r.h
type Rline (line 1) | typedef struct {
FILE: server/serv00.c
function main (line 4) | int
function sig_int (line 34) | void
FILE: server/serv01.c
function main (line 4) | int
function sig_int (line 44) | void
FILE: server/serv02.c
function main (line 7) | int
function sig_int (line 35) | void
FILE: server/serv02m.c
function main (line 7) | int
function sig_int (line 34) | void
FILE: server/serv03.c
function main (line 6) | int
function sig_int (line 33) | void
FILE: server/serv03m.c
function main (line 7) | int
function sig_int (line 35) | void
FILE: server/serv04.c
function main (line 6) | int
function sig_int (line 33) | void
FILE: server/serv05.c
function main (line 7) | int
function sig_int (line 85) | void
FILE: server/serv06.c
function main (line 4) | int
function sig_int (line 44) | void
FILE: server/serv07.c
function main (line 7) | int
function sig_int (line 32) | void
FILE: server/serv08.c
function main (line 9) | int
function sig_int (line 51) | void
FILE: server/serv09.c
function main (line 5) | int
function sig_int (line 30) | void
FILE: server/sig_chld_waitpid.c
function sig_chld (line 3) | void
FILE: server/unpthread.h
type timespec (line 25) | struct timespec
FILE: server/web_child.c
function web_child (line 5) | void
FILE: server/web_child_r.c
function web_child (line 6) | void
FILE: sigio/dgcli01.c
function dg_cli (line 3) | void
FILE: sigio/dgecho01.c
type DG (line 9) | typedef struct {
function dg_echo (line 28) | void
function sig_io (line 78) | static void
function sig_hup (line 112) | static void
FILE: sigio/udpcli01.c
function main (line 3) | int
FILE: sigio/udpserv01.c
function main (line 3) | int
FILE: sock/buffers.c
function buffers (line 12) | void
FILE: sock/cliopen.c
function cliopen (line 12) | int
FILE: sock/crlf.c
function crlf_add (line 14) | int
function crlf_strip (line 35) | int
FILE: sock/error.c
function err_ret (line 12) | void
function err_sys (line 27) | void
function err_dump (line 42) | void
function err_msg (line 58) | void
function err_quit (line 73) | void
function err_doit (line 88) | static void
FILE: sock/loop.c
function loop (line 18) | void
function sig_catch (line 196) | void
FILE: sock/looptcp.c
function loop_tcp (line 15) | void
FILE: sock/loopudp.c
function loop_udp (line 15) | void
FILE: sock/main.c
type sockaddr_in (line 68) | struct sockaddr_in
function main (line 72) | int
function usage (line 364) | static void
FILE: sock/multicast.c
function join_mcast (line 12) | void
FILE: sock/ourhdr.h
type termios (line 56) | struct termios
type termios (line 78) | struct termios
type winsize (line 79) | struct winsize
FILE: sock/pattern.c
function pattern (line 13) | void
FILE: sock/servopen.c
function servopen (line 12) | int
FILE: sock/sinktcp.c
function sink_tcp (line 12) | void
FILE: sock/sinkudp.c
function sink_udp (line 12) | void
FILE: sock/sleepus.c
function sleep_us (line 7) | void
FILE: sock/sock.h
type sockaddr_in (line 71) | struct sockaddr_in
type sockaddr_in (line 88) | struct sockaddr_in
FILE: sock/sockopts.c
function sockopts (line 14) | void
function sigio_func (line 356) | static void
FILE: sock/sourceroute.c
function sroute_doopt (line 40) | void
function sroute_set (line 79) | void
FILE: sock/sourcesink.c
function sink (line 15) | void
function pattern (line 79) | void
FILE: sock/sourcetcp.c
function source_tcp (line 12) | void
FILE: sock/sourceudp.c
function source_udp (line 12) | void
FILE: sock/tellwait.c
function sig_usr (line 8) | static void
function TELL_WAIT (line 15) | void
function TELL_PARENT (line 33) | void
function WAIT_PARENT (line 39) | void
function TELL_CHILD (line 51) | void
function WAIT_CHILD (line 57) | void
FILE: sock/write.c
function dowrite (line 17) | ssize_t
FILE: sock/writen.c
function writen (line 3) | ssize_t /* Write "n" bytes to a descriptor. */
FILE: sockopt/checkopts.c
type linger (line 9) | struct linger
type timeval (line 10) | struct timeval
type sock_opts (line 18) | struct sock_opts {
function main (line 90) | int
type linger (line 166) | struct linger
type linger (line 168) | struct linger
type timeval (line 180) | struct timeval
type timeval (line 182) | struct timeval
FILE: sockopt/prdefaults.c
function main (line 5) | void
FILE: sockopt/rcvbuf.c
function main (line 4) | int
FILE: sockopt/rcvbufset.c
function main (line 4) | int
FILE: sockopt/sockopt.c
function main (line 4) | int
FILE: ssntp/main.c
function main (line 3) | int
FILE: ssntp/ntp.h
type l_fixedpt (line 3) | struct l_fixedpt { /* 64-bit fixed-point */
type s_fixedpt (line 8) | struct s_fixedpt { /* 32-bit fixed-point */
type ntpdata (line 13) | struct ntpdata { /* NTP header */
FILE: ssntp/sntp.h
type timeval (line 4) | struct timeval
FILE: ssntp/sntp_proc.c
function sntp_proc (line 3) | void
FILE: streams/stream_dg/client.c
type sockaddr_in (line 16) | struct sockaddr_in
type sockaddr_in (line 17) | struct sockaddr_in
type sockaddr_in (line 19) | struct sockaddr_in
type sockaddr_in (line 34) | struct sockaddr_in
function echo_driver (line 50) | void
FILE: streams/stream_dg/net_stream.c
function net_open (line 13) | int
function net_bind (line 27) | int
function net_send (line 101) | int
function net_recv (line 133) | int
FILE: streams/stream_dg/server.c
type sockaddr_in (line 16) | struct sockaddr_in
type sockaddr_in (line 25) | struct sockaddr_in
function echo_serv (line 31) | void
FILE: streams/strlist_sock.c
function main (line 4) | int
FILE: streams/strlist_xti.c
function main (line 4) | int
FILE: streams/tpi_bind.c
function tpi_bind (line 3) | void
FILE: streams/tpi_close.c
function tpi_close (line 3) | void
FILE: streams/tpi_connect.c
function tpi_connect (line 3) | void
FILE: streams/tpi_daytime.c
function main (line 3) | int
FILE: streams/tpi_read.c
function tpi_read (line 3) | ssize_t
FILE: streams/unpxti.h
type strbuf (line 93) | struct strbuf
type strbuf (line 93) | struct strbuf
type strbuf (line 94) | struct strbuf
type strbuf (line 94) | struct strbuf
type t_call (line 102) | struct t_call
type t_bind (line 103) | struct t_bind
type t_bind (line 103) | struct t_bind
type t_call (line 105) | struct t_call
type t_call (line 105) | struct t_call
type t_bind (line 107) | struct t_bind
type t_bind (line 107) | struct t_bind
type t_call (line 109) | struct t_call
type t_info (line 111) | struct t_info
type t_optmgmt (line 112) | struct t_optmgmt
type t_optmgmt (line 112) | struct t_optmgmt
type t_discon (line 114) | struct t_discon
type t_unitdata (line 116) | struct t_unitdata
type t_uderr (line 117) | struct t_uderr
type t_unitdata (line 120) | struct t_unitdata
type netbuf (line 122) | struct netbuf
type netbuf (line 126) | struct netbuf
type netbuf (line 127) | struct netbuf
type netbuf (line 131) | struct netbuf
type netbuf (line 135) | struct netbuf
type netbuf (line 136) | struct netbuf
type t_opthdr (line 140) | struct t_opthdr
type t_opthdr (line 141) | struct t_opthdr
type t_opthdr (line 142) | struct t_opthdr
type t_opthdr (line 143) | struct t_opthdr
type t_opthdr (line 146) | struct t_opthdr
type t_opthdr (line 147) | struct t_opthdr
type t_opthdr (line 148) | struct t_opthdr
type t_opthdr (line 149) | struct t_opthdr
FILE: tcpcliserv/sigchldwait.c
function sig_chld (line 3) | void
FILE: tcpcliserv/sigchldwaitpid.c
function sig_chld (line 3) | void
FILE: tcpcliserv/str_cli08.c
function str_cli (line 3) | void
FILE: tcpcliserv/str_cli09.c
function str_cli (line 4) | void
FILE: tcpcliserv/str_cli11.c
function str_cli (line 3) | void
FILE: tcpcliserv/str_echo08.c
function str_echo (line 3) | void
FILE: tcpcliserv/str_echo09.c
function str_echo (line 4) | void
FILE: tcpcliserv/sum.h
type args (line 1) | struct args {
type result (line 6) | struct result {
FILE: tcpcliserv/tcpcli01.c
function main (line 3) | int
FILE: tcpcliserv/tcpcli04.c
function main (line 3) | int
FILE: tcpcliserv/tcpcli05.c
function main (line 4) | int
FILE: tcpcliserv/tcpcli06.c
function main (line 6) | int
FILE: tcpcliserv/tcpcli07.c
function main (line 3) | int
function sig_alrm (line 37) | void
FILE: tcpcliserv/tcpcli08.c
function main (line 3) | int
FILE: tcpcliserv/tcpcli09.c
function main (line 3) | int
FILE: tcpcliserv/tcpcli10.c
function main (line 3) | int
FILE: tcpcliserv/tcpcli11.c
function main (line 4) | int
FILE: tcpcliserv/tcpserv01.c
function main (line 3) | int
FILE: tcpcliserv/tcpserv02.c
function main (line 3) | int
FILE: tcpcliserv/tcpserv03.c
function main (line 3) | int
FILE: tcpcliserv/tcpserv04.c
function main (line 3) | int
FILE: tcpcliserv/tcpserv08.c
function main (line 3) | int
FILE: tcpcliserv/tcpserv09.c
function main (line 3) | int
FILE: tcpcliserv/tcpservpoll01.c
function main (line 5) | int
FILE: tcpcliserv/tcpservselect01.c
function main (line 4) | int
FILE: tcpcliserv/tsigpipe.c
function sig_pipe (line 3) | void
function main (line 10) | int
FILE: test/accept_eintr.c
function sig_int (line 5) | void
function main (line 12) | int
FILE: test/funcs.c
function TcpSockByAddr (line 7) | int
function UdpSockByAddr (line 29) | int
function UdpConnSockByAddr (line 48) | int
FILE: test/readline.h
type Rline (line 1) | typedef struct {
FILE: test/readline1.c
function readline (line 5) | ssize_t
function Readline (line 33) | ssize_t
FILE: test/readline2.c
function my_read (line 4) | static ssize_t
function readline (line 24) | ssize_t
function Readline (line 48) | ssize_t
FILE: test/readline3.c
function my_read (line 5) | static ssize_t
function readline_rinit (line 27) | void
function readline_r (line 38) | ssize_t
function Readline (line 62) | ssize_t
FILE: test/test.h
type sockaddr_in (line 4) | struct sockaddr_in
FILE: test/test1.c
type sockaddr_in (line 12) | struct sockaddr_in
function header_flags (line 20) | void
function sendto_01 (line 48) | void
function udp_01 (line 164) | void
function usage (line 169) | static void
function main (line 181) | int
FILE: test/test2.c
function main (line 3) | int
function udp_client (line 27) | int
function Udp_client (line 60) | int
FILE: test/treadline1.c
function main (line 3) | int
FILE: test/treadline2.c
function main (line 3) | int
FILE: test/treadline3.c
function main (line 4) | int
FILE: test/tshutdown.c
function main (line 6) | int
FILE: test/tsnprintf.c
function main (line 15) | int
FILE: threads/example01.c
function main (line 9) | int
FILE: threads/example02.c
function main (line 10) | int
FILE: threads/example03.c
type buf_t (line 27) | struct buf_t {
function main (line 40) | int
function produce (line 62) | void
function consume (line 82) | int
FILE: threads/readline.c
function readline_destructor (line 7) | static void
function readline_once (line 13) | static void
type Rline (line 19) | typedef struct {
function my_read (line 27) | static ssize_t
function readline (line 46) | ssize_t
function Readline (line 77) | ssize_t
FILE: threads/strclithread.c
function str_cli (line 8) | void
FILE: threads/strclithread2.c
function str_cli (line 9) | void
FILE: threads/tcpcli01.c
function main (line 3) | int
FILE: threads/tcpcli02.c
function main (line 3) | int
FILE: threads/tcpserv01.c
function main (line 5) | int
FILE: threads/tcpserv02.c
function main (line 5) | int
FILE: threads/test01.c
function main (line 9) | int
FILE: threads/test02.c
function main (line 17) | int
FILE: threads/test03.c
function main (line 18) | int
FILE: threads/test04.c
function main (line 32) | int
FILE: threads/test05.c
function main (line 7) | int
FILE: threads/unpthread.h
type timespec (line 25) | struct timespec
FILE: threads/web01.c
type file (line 8) | struct file {
type file (line 25) | struct file
function main (line 27) | int
type file (line 86) | struct file
type file (line 88) | struct file
function write_get_cmd (line 113) | void
function home_page (line 128) | void
FILE: threads/web02.c
type file (line 9) | struct file {
type file (line 29) | struct file
function main (line 31) | int
type file (line 106) | struct file
type file (line 108) | struct file
function write_get_cmd (line 140) | void
function home_page (line 157) | void
FILE: threads/web03.c
type file (line 7) | struct file {
type file (line 29) | struct file
function main (line 31) | int
type file (line 101) | struct file
type file (line 103) | struct file
function write_get_cmd (line 131) | void
function home_page (line 144) | void
FILE: traceroute/main.c
type proto (line 3) | struct proto
type proto (line 7) | struct proto
type rec (line 11) | struct rec
function main (line 16) | int
FILE: traceroute/recv_v4.c
function recv_v4 (line 12) | int
FILE: traceroute/recv_v6.c
function recv_v6 (line 12) | int
FILE: traceroute/sig_alrm.c
function sig_alrm (line 5) | void
FILE: traceroute/trace.h
type rec (line 9) | struct rec { /* format of outgoing UDP data */
type timeval (line 32) | struct timeval
type timeval (line 33) | struct timeval
type timeval (line 36) | struct timeval
type timeval (line 36) | struct timeval
type proto (line 38) | struct proto {
FILE: traceroute/traceloop.c
function traceloop (line 3) | void
FILE: traceroute/tv_sub.c
function tv_sub (line 3) | void
FILE: udpcksum/cleanup.c
function cleanup (line 4) | void
FILE: udpcksum/main.c
type sockaddr (line 5) | struct sockaddr
type sockaddr_in (line 6) | struct sockaddr_in
function main (line 19) | int
function usage (line 110) | static void
FILE: udpcksum/pcap.c
function open_pcap (line 6) | void
type pcap_pkthdr (line 54) | struct pcap_pkthdr
FILE: udpcksum/senddnsquery-libnet.c
function open_output (line 12) | void
function send_dns_query (line 26) | void
FILE: udpcksum/senddnsquery-raw.c
function send_dns_query (line 9) | void
FILE: udpcksum/udpcksum.c
function sig_alrm (line 8) | void
function test_udp (line 18) | void
FILE: udpcksum/udpcksum.h
type sockaddr (line 16) | struct sockaddr
type udpiphdr (line 34) | struct udpiphdr
FILE: udpcksum/udpread.c
type udpiphdr (line 3) | struct udpiphdr
type udpiphdr (line 11) | struct udpiphdr
type ether_header (line 16) | struct ether_header
type ether_header (line 26) | struct ether_header
type udpiphdr (line 52) | struct udpiphdr
type ip (line 56) | struct ip
type udpiphdr (line 57) | struct udpiphdr
type ip (line 60) | struct ip
type udphdr (line 60) | struct udphdr
type ip (line 65) | struct ip
type ip (line 70) | struct ip
type udphdr (line 72) | struct udphdr
type udpiphdr (line 80) | struct udpiphdr
FILE: udpcksum/udpwrite.c
function open_output (line 6) | void
function udp_write (line 28) | void
FILE: udpcliserv/dgcliaddr.c
function dg_cli (line 3) | void
FILE: udpcliserv/dgclibig.c
function dg_cli (line 6) | void
FILE: udpcliserv/dgcliconnect.c
function dg_cli (line 3) | void
FILE: udpcliserv/dgcliinetaddr.c
function dg_cli (line 3) | void
FILE: udpcliserv/dgcliloop1.c
function dg_cli (line 6) | void
FILE: udpcliserv/dgcliloop3.c
function dg_cli (line 9) | void
FILE: udpcliserv/dgecholoop1.c
function dg_echo (line 6) | void
function recvfrom_int (line 22) | static void
FILE: udpcliserv/dgecholoop2.c
function dg_echo (line 6) | void
function recvfrom_int (line 26) | static void
FILE: udpcliserv/sigchldwaitpid.c
function sig_chld (line 3) | void
FILE: udpcliserv/udpcli01.c
function main (line 3) | int
FILE: udpcliserv/udpcli02.c
function main (line 3) | int
FILE: udpcliserv/udpcli03.c
function main (line 3) | int
FILE: udpcliserv/udpcli04.c
function main (line 3) | int
FILE: udpcliserv/udpcli05.c
function main (line 3) | int
FILE: udpcliserv/udpcli06.c
function main (line 3) | int
FILE: udpcliserv/udpcli08.c
function main (line 3) | int
FILE: udpcliserv/udpcli09.c
function main (line 3) | int
FILE: udpcliserv/udpcli10.c
function main (line 3) | int
FILE: udpcliserv/udpserv01.c
function main (line 3) | int
FILE: udpcliserv/udpserv06.c
function main (line 3) | int
FILE: udpcliserv/udpserv07.c
function main (line 3) | int
FILE: udpcliserv/udpservselect01.c
function main (line 4) | int
FILE: unixdomain/daytimetcpcli.c
function main (line 3) | int
FILE: unixdomain/daytimetcpsrv2.c
function main (line 4) | int
FILE: unixdomain/mycat.c
function main (line 5) | int
FILE: unixdomain/myopen.c
function my_open (line 3) | int
FILE: unixdomain/openfile.c
function main (line 3) | int
FILE: unixdomain/readcred.c
function read_cred (line 5) | ssize_t
FILE: unixdomain/sigchldwaitpid.c
function sig_chld (line 3) | void
FILE: unixdomain/strecho.c
type cmsgcred (line 3) | struct cmsgcred
function str_echo (line 5) | void
FILE: unixdomain/testfcred.c
type fcred (line 7) | struct fcred
type cmsghdr (line 8) | struct cmsghdr
FILE: unixdomain/tfcred01.c
type fcred (line 5) | struct fcred
type fcred (line 11) | struct fcred
function recv_cred (line 49) | ssize_t
FILE: unixdomain/unixbind.c
function main (line 3) | int
FILE: unixdomain/unixdgcli01.c
function main (line 3) | int
FILE: unixdomain/unixdgserv01.c
function main (line 3) | int
FILE: unixdomain/unixstrcli01.c
function main (line 3) | int
FILE: unixdomain/unixstrserv01.c
function main (line 3) | int
FILE: unixdomain/unixstrserv02.c
function main (line 3) | int
Condensed preview — 779 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,265K chars).
[
{
"path": ".gitattributes",
"chars": 483,
"preview": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs diff=csharp\n*.sln"
},
{
"path": ".gitignore",
"chars": 1970,
"preview": "#################\n## Eclipse\n#################\n\n*.pydevproject\n.project\n.metadata\nbin/\ntmp/\n*.tmp\n*.bak\n*.swp\n*~.nib\nloc"
},
{
"path": "DISCLAIMER",
"chars": 641,
"preview": "\tLIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY\n\nThe authors and publisher of the book \"UNIX Network Programming\" have\nu"
},
{
"path": "Make.defines.in",
"chars": 1330,
"preview": "#\n# This file is generated by autoconf from \"Make.defines.in\".\n#\n# This is the \"Make.defines\" file that almost every \"Ma"
},
{
"path": "Makefile.in",
"chars": 241,
"preview": "include ./Make.defines\n\nall:\n\t@echo \"Nothing to make in this directory\"\n\t@echo \"Please read the README file\"\n\nclean:\n\trm"
},
{
"path": "README",
"chars": 4792,
"preview": "QUICK AND DIRTY\n===============\n\nExecute the following from the src/ directory:\n\n ./configure # try to figure out "
},
{
"path": "VERSION",
"chars": 11,
"preview": "2004/12/12\n"
},
{
"path": "aclocal.m4",
"chars": 4800,
"preview": "dnl ##################################################################\ndnl Our macro to check for a function prototype i"
},
{
"path": "advio/Makefile",
"chars": 1534,
"preview": "include ../Make.defines\n\nPROGS =\ttcpcli01 tcpcli02 tcpserv02 \\\n\t\tudpcli01 udpcli02 udpcli03 \\\n\t\tudpserv01 udpserv03 udps"
},
{
"path": "advio/daytimetcpcli.c",
"chars": 769,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\tsockfd, n, npend;\n\tchar\trecvline[MAXLINE + 1];\n\tsocklen_t\tlen;"
},
{
"path": "advio/daytimeudpcli3.c",
"chars": 736,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\tsockfd, n, nq;\n\tchar\trecvline[MAXLINE + 1];\n\tsocklen_t\tsalen;\n"
},
{
"path": "advio/daytimeudpcli4.c",
"chars": 734,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\tsockfd, n, nq;\n\tchar\trecvline[MAXLINE + 1];\n\tsocklen_t\tlen;\n\ts"
},
{
"path": "advio/dgclitimeo.c",
"chars": 498,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n{\n\tint\tn;\n\tchar\tsendline[MAX"
},
{
"path": "advio/dgclitimeo1.c",
"chars": 498,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n{\n\tint\tn;\n\tchar\tsendline[MAX"
},
{
"path": "advio/dgclitimeo2.c",
"chars": 669,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n{\n\tint\t\t\t\tn;\n\tchar\t\t\tsendlin"
},
{
"path": "advio/dgclitimeo2.lc",
"chars": 1587,
"preview": "#include \"unp.h\"## 1 ##src/advio/dgclitimeo2.c##\n\nvoid## 2 ##src/advio/dgclitimeo2.c##\ndg_cli(FILE *fp, int sockfd,"
},
{
"path": "advio/dgclitimeo3.c",
"chars": 699,
"preview": "#include\t\"unp.h\"\n\nstatic void\tsig_alrm(int);\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n"
},
{
"path": "advio/dgclitimeo3.lc",
"chars": 1770,
"preview": "#include \"unp.h\"## 1 ##src/advio/dgclitimeo3.c##\n\nstatic void sig_alrm(int);## 2 ##src/advio/dgclitimeo3.c##\n\nvoid#"
},
{
"path": "advio/dgechoaddr.c",
"chars": 1550,
"preview": "#include\t\"unpifi.h\"\n\n#undef\tMAXLINE\n#define\tMAXLINE\t20\t\t/* to see datagram truncation */\n\nvoid\ndg_echo(int sockfd, SA *p"
},
{
"path": "advio/dgechoaddr.lc",
"chars": 3521,
"preview": "#include \"unpifi.h\"## 1 ##src/advio/dgechoaddr.c##\n\n#undef MAXLINE## 2 ##src/advio/dgechoaddr.c##\n#define MAXLINE "
},
{
"path": "advio/old/dgechoaddr.c",
"chars": 980,
"preview": "#include\t\"unp.h\"\n\n#undef\tMAXLINE\n#define\tMAXLINE\t20\t\t/* to see datagram truncation */\n\nvoid\ndg_echo(int sockfd, SA *pcli"
},
{
"path": "advio/old/recvfromflags.c",
"chars": 2090,
"preview": "#include\t\"unp.h\"\n\nssize_t\nrecvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,\n\t\t\t SA *sa, socklen_t *salenpt"
},
{
"path": "advio/old/test01.c",
"chars": 1760,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\tsockfd, flag;\n\tssize_t\t\t\tn;\n\tchar\t\t\tbuff[MAXLINE];\n\tconst in"
},
{
"path": "advio/recvfromflags.c",
"chars": 2379,
"preview": "/* include recvfrom_flags1 */\n#include\t\"unp.h\"\n#include\t<sys/param.h>\t\t/* ALIGN macro for CMSG_NXTHDR() macro */\n\nssize_"
},
{
"path": "advio/recvfromflags.lc",
"chars": 5477,
"preview": "/* include recvfrom_flags1 */\n#include \"unp.h\"## 1 ##src/advio/recvfromflags.c##\n#include <sys/param.h> /* "
},
{
"path": "advio/script.1",
"chars": 428,
"preview": "kalae % ./udpserv01\n9-byte datagram from 206.62.226.33.41164, to 206.62.226.35, recv i/f = ef0\n13-byte datagram from 206"
},
{
"path": "advio/sig_chld_waitpid.c",
"chars": 176,
"preview": "#include\t\"unp.h\"\n\nvoid\nsig_chld(int signo)\n{\n\tpid_t\tpid;\n\tint\t\tstat;\n\n\twhile ( (pid = waitpid(-1, &stat, WNOHANG)) > 0) "
},
{
"path": "advio/str_cli_kqueue04.c",
"chars": 1243,
"preview": "#include\t\"unp.h\"\n\nvoid\nstr_cli(FILE *fp, int sockfd)\n{\n\tint\t\t\t\tkq, i, n, nev, stdineof = 0, isfile;\n\tchar\t\t\tbuf[MAXLINE]"
},
{
"path": "advio/str_cli_poll03.c",
"chars": 1249,
"preview": "#include\t\"unp.h\"\n#include\t<sys/devpoll.h>\n\nvoid\nstr_cli(FILE *fp, int sockfd)\n{\n\tint\t\tstdineof;\n\tchar\t\tbuf[MAXLINE];\n\tin"
},
{
"path": "advio/str_cli_select02.c",
"chars": 896,
"preview": "#include\t\"unp.h\"\n\nvoid\nstr_cli(FILE *fp, int sockfd)\n{\n\tint\t\t\tmaxfdp1, stdineof = 0;\n\tfd_set\t\trset;\n\tchar\t\tsendline[MAXL"
},
{
"path": "advio/str_echo_stdio02.c",
"chars": 219,
"preview": "#include\t\"unp.h\"\n\nvoid\nstr_echo(int sockfd)\n{\n\tchar\t\tline[MAXLINE];\n\tFILE\t\t*fpin, *fpout;\n\n\tfpin = Fdopen(sockfd, \"r\");\n"
},
{
"path": "advio/str_echo_stdio02.lc",
"chars": 664,
"preview": "#include \"unp.h\"## 1 ##src/advio/str_echo_stdio02.c##\n\nvoid## 2 ##src/advio/str_echo_stdio02.c##\nstr_echo(int sockf"
},
{
"path": "advio/tcpcli01.c",
"chars": 551,
"preview": "/* Use standard echo server; baseline measurements for nonblocking version */\n#include\t\"unp.h\"\n\nint\nmain(int argc, char "
},
{
"path": "advio/tcpcli02.c",
"chars": 471,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/tcpcli03.c",
"chars": 471,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/tcpcli04.c",
"chars": 471,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/tcpserv02.c",
"chars": 949,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tpid_t\t\t\t\tchildpid;\n\tsocklen_t\t\t\tclilen;\n"
},
{
"path": "advio/udpcli01.c",
"chars": 425,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/udpcli02.c",
"chars": 425,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/udpcli03.c",
"chars": 425,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "advio/udpserv01.c",
"chars": 426,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr, cliaddr;\n\n\tsockfd = S"
},
{
"path": "advio/udpserv03.c",
"chars": 2773,
"preview": "/* include udpserv1 */\n#include\t\"unpifi.h\"\n\nvoid\tmydg_echo(int, SA *, socklen_t, SA *);\n\nint\nmain(int argc, char **argv)"
},
{
"path": "advio/udpserv03.lc",
"chars": 5733,
"preview": "/* include udpserv1 */\n#include \"unpifi.h\"## 1 ##src/advio/udpserv03.c##\n\nvoid mydg_echo(int, SA *, socklen_t, SA"
},
{
"path": "advio/udpserv04.c",
"chars": 2667,
"preview": "#include\t\"unpifi.h\"\n\nvoid\tmydg_echo(int, SA *, socklen_t);\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, family, p"
},
{
"path": "advio/udpserv04.lc",
"chars": 5773,
"preview": "#include \"unpifi.h\"## 1 ##src/advio/udpserv04.c##\n\nvoid mydg_echo(int, SA *, socklen_t);## 2 ##src/advio/udpserv"
},
{
"path": "bcast/Makefile",
"chars": 1013,
"preview": "include ../Make.defines\n\nPROGS =\tudpcli01 udpcli02 udpcli03 udpcli04 udpcli05 udpcli06\n\nall:\t${PROGS}\n\n# Version in book"
},
{
"path": "bcast/dgclibcast1.c",
"chars": 1008,
"preview": "#include\t\"unp.h\"\n\nstatic void\trecvfrom_alarm(int);\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t ser"
},
{
"path": "bcast/dgclibcast1.lc",
"chars": 2431,
"preview": "#include \"unp.h\"## 1 ##src/bcast/dgclibcast1.c##\n\nstatic void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast1.c##\n"
},
{
"path": "bcast/dgclibcast2.c",
"chars": 1024,
"preview": "#include\t\"unp.h\"\n\nstatic void\trecvfrom_alarm(int);\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t ser"
},
{
"path": "bcast/dgclibcast3.c",
"chars": 1192,
"preview": "#include\t\"unp.h\"\n\nstatic void\trecvfrom_alarm(int);\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t ser"
},
{
"path": "bcast/dgclibcast3.lc",
"chars": 2806,
"preview": "#include \"unp.h\"## 1 ##src/bcast/dgclibcast3.c##\n\nstatic void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast3.c##\n"
},
{
"path": "bcast/dgclibcast4.c",
"chars": 1320,
"preview": "#include\t\"unp.h\"\n\nstatic void\trecvfrom_alarm(int);\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t ser"
},
{
"path": "bcast/dgclibcast4.lc",
"chars": 3072,
"preview": "#include \"unp.h\"## 1 ##src/bcast/dgclibcast4.c##\n\nstatic void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast4.c##\n"
},
{
"path": "bcast/dgclibcast5.c",
"chars": 928,
"preview": "#include\t\"unp.h\"\n#include\t<setjmp.h>\n\nstatic void\t\t\trecvfrom_alarm(int);\nstatic sigjmp_buf\tjmpbuf;\n\nvoid\ndg_cli(FILE *fp"
},
{
"path": "bcast/dgclibcast5.lc",
"chars": 2161,
"preview": "#include \"unp.h\"## 1 ##src/bcast/dgclibcast5.c##\n#include <setjmp.h>## 2 ##src/bcast/dgclibcast5.c##\n\nstatic voi"
},
{
"path": "bcast/dgclibcast6.c",
"chars": 1347,
"preview": "#include\t\"unp.h\"\n\nstatic void\trecvfrom_alarm(int);\nstatic int\tpipefd[2];\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *ps"
},
{
"path": "bcast/dgclibcast6.lc",
"chars": 3326,
"preview": "#include \"unp.h\"## 1 ##src/bcast/dgclibcast6.c##\n\nstatic void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast6.c##\n"
},
{
"path": "bcast/udpcli01.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "bcast/udpcli02.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "bcast/udpcli03.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "bcast/udpcli04.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "bcast/udpcli05.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "bcast/udpcli06.c",
"chars": 459,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in\tservaddr;\n\n\tif (argc != 2)\n\t\ter"
},
{
"path": "config.guess",
"chars": 38470,
"preview": "#! /bin/sh\n# Attempt to guess a canonical system name.\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,"
},
{
"path": "config.h.in",
"chars": 8631,
"preview": "/* config.h.in. Generated from configure.in by autoheader. */\n\n/* CPU, vendor, and operating system */\n#undef CPU_VEND"
},
{
"path": "config.sub",
"chars": 29027,
"preview": "#! /bin/sh\n# Configuration validation subroutine script.\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 199"
},
{
"path": "configure",
"chars": 242858,
"preview": "#! /bin/sh\n# From configure.in Revision: 1.13 .\n# Guess values for system-dependent variables and create Makefiles.\n# Ge"
},
{
"path": "configure.in",
"chars": 23905,
"preview": "dnl\ndnl autoconf script for UNP 3/e Volume 1 source code.\ndnl Process this file with autoconf to produce a configure scr"
},
{
"path": "icmpd/Makefile",
"chars": 321,
"preview": "include ../Make.defines\n\nOBJS = icmpd.o readable_listen.o readable_conn.o readable_v4.o readable_v6.o\n\nPROGS =\ticmpd udp"
},
{
"path": "icmpd/dgcli01.c",
"chars": 1746,
"preview": "/* include dgcli011 */\n#include\t\"unpicmpd.h\"\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n"
},
{
"path": "icmpd/dgcli01.lc",
"chars": 3213,
"preview": "/* include dgcli011 */\n#include \"unpicmpd.h\"## 1 ##src/icmpd/dgcli01.c##\n\nvoid## 2 ##src/icmpd/dgcli01.c##\ndg_cli(F"
},
{
"path": "icmpd/icmpd.c",
"chars": 1421,
"preview": "/* include icmpd1 */\n#include\t\"icmpd.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\ti, sockfd;\n\tstruct sockaddr_un sun;\n\n\ti"
},
{
"path": "icmpd/icmpd.h",
"chars": 511,
"preview": "#include\t\"unpicmpd.h\"\n\nstruct client {\n int\tconnfd;\t\t\t/* Unix domain stream socket to client */\n int\tfamily;\t\t\t/* AF_I"
},
{
"path": "icmpd/icmpd.lc",
"chars": 2801,
"preview": "/* include icmpd1 */\n#include \"icmpd.h\"## 1 ##src/icmpd/icmpd.c##\n\nint## 2 ##src/icmpd/icmpd.c##\nmain(int argc, cha"
},
{
"path": "icmpd/readable_conn.c",
"chars": 1309,
"preview": "/* include readable_conn1 */\n#include\t\"icmpd.h\"\n\nint\nreadable_conn(int i)\n{\n\tint\t\t\t\tunixfd, recvfd;\n\tchar\t\t\tc;\n\tssize_t\t"
},
{
"path": "icmpd/readable_conn.lc",
"chars": 3569,
"preview": "/* include readable_conn1 */\n#include \"icmpd.h\"## 1 ##src/icmpd/readable_conn.c##\n\nint## 2 ##src/icmpd/readable_con"
},
{
"path": "icmpd/readable_listen.c",
"chars": 746,
"preview": "#include\t\"icmpd.h\"\n\nint\nreadable_listen(void)\n{\n\tint\t\t\ti, connfd;\n\tsocklen_t\tclilen;\n\n\tclilen = sizeof(cliaddr);\n\tconnfd"
},
{
"path": "icmpd/readable_listen.lc",
"chars": 1649,
"preview": "#include \"icmpd.h\"## 1 ##src/icmpd/readable_listen.c##\n\nint## 2 ##src/icmpd/readable_listen.c##\nreadable_listen(voi"
},
{
"path": "icmpd/readable_v4.c",
"chars": 2698,
"preview": "/* include readable_v41 */\n#include\t\"icmpd.h\"\n#include\t<netinet/in_systm.h>\n#include\t<netinet/ip.h>\n#include\t<netinet/ip"
},
{
"path": "icmpd/readable_v4.lc",
"chars": 5673,
"preview": "/* include readable_v41 */\n#include \"icmpd.h\"## 1 ##src/icmpd/readable_v4.c##\n#include <netinet/in_systm.h>## 2 "
},
{
"path": "icmpd/readable_v6.c",
"chars": 2730,
"preview": "/* include readable_v61 */\n#include\t\"icmpd.h\"\n#include\t<netinet/in_systm.h>\n#include\t<netinet/ip.h>\n#include\t<netinet/ip"
},
{
"path": "icmpd/readable_v6.lc",
"chars": 6191,
"preview": "/* include readable_v61 */\n#include \"icmpd.h\"## 1 ##src/icmpd/readable_v6.c##\n#include <netinet/in_systm.h>## 2 "
},
{
"path": "icmpd/script.1",
"chars": 269,
"preview": "kalae % ./udpcli01 198.82.204.99 echo\nhello, world\nICMP error: type = 11, code = 0\ntesting\nICMP error: type = 11, code ="
},
{
"path": "icmpd/script.2",
"chars": 297,
"preview": "kalae % ./udpcli01 gemini.tuc.noao.edu echo\nhi there\nICMPv4 error: dest = 140.252.8.54.1792, type = 3, code = 3\n\n\nkalae "
},
{
"path": "icmpd/script.3",
"chars": 530,
"preview": "kohala % ./udpcli01 gemini.tuc.noao.edu echo\nhello, world\nICMP error: dest = 140.252.1.11.7, type = 3, code = 3\nkohala "
},
{
"path": "icmpd/script.4",
"chars": 339,
"preview": "kohala % ./udpcli01 192.3.4.5 echo\nhi there\nsocket timeout\nand hello\nsocket timeout\nkohala % ./udpcli01 gemini.tuc.noao"
},
{
"path": "icmpd/udpcli01.c",
"chars": 284,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tsocklen_t\t\t\tsalen;\n\tstruct sockaddr\t\t*sa;\n\n\tif (ar"
},
{
"path": "icmpd/unpicmpd.h",
"chars": 483,
"preview": "#ifndef\t__unpicmp_h\n#define\t__unpicmp_h\n\n#include\t\"unp.h\"\n\n#define\tICMPD_PATH\t\t\"/tmp/icmpd\"\t/* server's well-known pathn"
},
{
"path": "inetd/Makefile",
"chars": 283,
"preview": "include ../Make.defines\n\nPROGS =\tdaytimetcpsrv2 daytimetcpsrv3\n\nall:\t${PROGS}\n\ndaytimetcpsrv2:\tdaytimetcpsrv2.o\n\t\t${CC} "
},
{
"path": "inetd/daytimetcpsrv2.c",
"chars": 735,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint listenfd, connfd;\n\tsocklen_t addrlen, len;\n\ts"
},
{
"path": "inetd/daytimetcpsrv3.c",
"chars": 536,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tsocklen_t\t\tlen;\n\tstruct sockaddr\t*cliaddr;\n\tchar\t"
},
{
"path": "inetd/daytimetcpsrv3.lc",
"chars": 1272,
"preview": "#include \"unp.h\"## 1 ##src/inetd/daytimetcpsrv3.c##\n#include <time.h>## 2 ##src/inetd/daytimetcpsrv3.c##\n\nint## "
},
{
"path": "install-sh",
"chars": 5585,
"preview": "#! /bin/sh\n#\n# install - install a program, script, or datafile\n# This comes from X11R5 (mit/util/scripts/install.sh).\n#"
},
{
"path": "intro/Makefile",
"chars": 1157,
"preview": "include ../Make.defines\n\nPROGS =\tdaytimetcpcli daytimetcpcli1 daytimetcpcli2 daytimetcpcli3 \\\n\t\tdaytimetcpsrv daytimetcp"
},
{
"path": "intro/byteorder.c",
"chars": 426,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tunion {\n\t short s;\n char c[sizeof(short)];\n } un;\n\n\tun."
},
{
"path": "intro/daytimetcpcli.c",
"chars": 808,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, n;\n\tchar\t\t\t\trecvline[MAXLINE + 1];\n\tstruct sockaddr"
},
{
"path": "intro/daytimetcpcli1.c",
"chars": 870,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, n, counter = 0;\n\tchar\t\t\t\trecvline[MAXLINE + 1];\n\tst"
},
{
"path": "intro/daytimetcpcli2.c",
"chars": 872,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, n, counter = 0;\n\tchar\t\t\t\trecvline[MAXLINE + 1];\n\tst"
},
{
"path": "intro/daytimetcpcli3.c",
"chars": 984,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, n;\n\tsocklen_t\t\t\tlen;\n\tchar\t\t\t\trecvline[MAXLINE + 1]"
},
{
"path": "intro/daytimetcpcliv6.c",
"chars": 815,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, n;\n\tstruct sockaddr_in6\tservaddr;\n\tchar\t\t\t\trecvline"
},
{
"path": "intro/daytimetcpsrv.c",
"chars": 705,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tstruct sockaddr_in\tser"
},
{
"path": "intro/daytimetcpsrv.lc",
"chars": 1586,
"preview": "#include \"unp.h\"## 1 ##src/intro/daytimetcpsrv.c##\n#include <time.h>## 2 ##src/intro/daytimetcpsrv.c##\n\nint## 3"
},
{
"path": "intro/daytimetcpsrv1.c",
"chars": 900,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tsocklen_t\t\t\tlen;\n\tstru"
},
{
"path": "intro/daytimetcpsrv2.c",
"chars": 720,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd, i;\n\tstruct sockaddr_in\t"
},
{
"path": "intro/daytimetcpsrv3.c",
"chars": 902,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tsocklen_t\t\t\tlen;\n\tstru"
},
{
"path": "intro/daytimetcpsrvv6.c",
"chars": 819,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tsocklen_t\t\t\tlen;\n\tchar"
},
{
"path": "intro/truss.solaris.2.6",
"chars": 380,
"preview": "so_socket(2, 2, 0, \"\", 1) = 3\nconnect(3, 0xEFFFE8C8, 16) = 0\nread(3, \" F r i "
},
{
"path": "intro/truss.unixware.2.1",
"chars": 4659,
"preview": "execve(\"./daytimetcpcli\", 0x08047BA8, 0x08047BB4) argc = 2\nopen(\"/usr/lib/libsocket.so.2\", O_RDONLY, 0)\t= 3\nfxstat(2, 3"
},
{
"path": "ioctl/Makefile",
"chars": 411,
"preview": "include ../Make.defines\n\nPROGS =\tlsif01 lsif02 prifinfo prmac\n\nall:\t${PROGS}\n\nlsif01:\tlsif01.o\n\t\t${CC} ${CFLAGS} -o $@ l"
},
{
"path": "ioctl/Progs.siocgifconf",
"chars": 4017,
"preview": "\tif (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0)\n./games/hunt/hunt/hunt.c\n\ti = ioctl(sock, SIOCGIFCONF, (char *)&ifc);\n./"
},
{
"path": "ioctl/Script.solaris",
"chars": 598,
"preview": "kohala % ./prifinfo 4 1\ntrying len = 64\nioctl error\ntrying len = 96\nioctl error\ntrying len = 128\nioctl error\ntrying len "
},
{
"path": "ioctl/lsif01.c",
"chars": 958,
"preview": "#include\t\"unp.h\"\n\n#include\t<net/if.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd, len;\n\tchar\t\t\t\t*ptr, buf[2048],"
},
{
"path": "ioctl/lsif02.c",
"chars": 2151,
"preview": "#include\t\"unp.h\"\n\n#include\t<net/if.h>\n#ifdef\tHAVE_SOCKADDR_DL_STRUCT\n#include\t<net/if_dl.h>\n#include\t<net/if_types.h>\n#e"
},
{
"path": "ioctl/prifinfo.c",
"chars": 1595,
"preview": "#include\t\"unpifi.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tstruct ifi_info\t*ifi, *ifihead;\n\tstruct sockaddr\t*sa;\n\tu_char\t\t\t"
},
{
"path": "ioctl/prifinfo.lc",
"chars": 3103,
"preview": "#include \"unpifi.h\"## 1 ##src/ioctl/prifinfo.c##\n\nint## 2 ##src/ioctl/prifinfo.c##\nmain(int argc, char **argv)## 3"
},
{
"path": "ioctl/prmac.c",
"chars": 728,
"preview": "#include\t\"unpifi.h\"\n#include\t<net/if_arp.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct ifi_info\t\t\t*ifi;"
},
{
"path": "ioctl/test1.c",
"chars": 333,
"preview": "#include\t\"unp.h\"\n#include\t<net/if.h>\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\ti, sockfd, numif;\n\tchar\tbuf[1024];\n\n\tsockf"
},
{
"path": "ipopts/Makefile",
"chars": 538,
"preview": "include ../Make.defines\n\nPROGS =\ttcpcli01 tcpserv01\n\nall:\t${PROGS}\n\ntcpcli01:\ttcpcli01.o sourceroute.o\n\t\t${CC} ${CFLAGS}"
},
{
"path": "ipopts/dgechoprintroute.c",
"chars": 913,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)\n{\n\tint\t\t\t\tn;\n\tchar\t\t\tmesg[MAXLINE];\n\tint\t\t\t\to"
},
{
"path": "ipopts/sigchldwaitpid.c",
"chars": 176,
"preview": "#include\t\"unp.h\"\n\nvoid\nsig_chld(int signo)\n{\n\tpid_t\tpid;\n\tint\t\tstat;\n\n\twhile ( (pid = waitpid(-1, &stat, WNOHANG)) > 0) "
},
{
"path": "ipopts/sourceroute.c",
"chars": 2060,
"preview": "/* include inet_srcrt_init */\n#include\t\"unp.h\"\n#include\t<netinet/in_systm.h>\n#include\t<netinet/ip.h>\n\nstatic u_char\t*opt"
},
{
"path": "ipopts/sourceroute.lc",
"chars": 4593,
"preview": "/* include inet_srcrt_init */\n#include \"unp.h\"## 1 ##src/ipopts/sourceroute.c##\n#include <netinet/in_systm.h>## "
},
{
"path": "ipopts/sourceroute6.c",
"chars": 319,
"preview": "#include\t\"unp.h\"\n\nvoid\ninet6_srcrt_print(void *ptr)\n{\n\tint\t\t\ti, segments;\n\tchar\t\t\tstr[INET6_ADDRSTRLEN];\n\n\tsegments = In"
},
{
"path": "ipopts/tcpcli01.c",
"chars": 1257,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tc, sockfd, len = 0;\n\tu_char\t\t\t\t*ptr = NULL;\n\tstruct addrinf"
},
{
"path": "ipopts/tcpserv01.c",
"chars": 1168,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tlistenfd, connfd;\n\tu_char\t\t\t\t*opts;\n\tpid_t\t\t\t\tchildpid;\n\tso"
},
{
"path": "ipopts/udpcli01.c",
"chars": 843,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tc, sockfd, len = 0;\n\tu_char\t\t\t\t*ptr = NULL;\n\tvoid\t\t\t\t*rth;\n"
},
{
"path": "ipopts/udpserv01.c",
"chars": 423,
"preview": "#include\t\"unp.h\"\n\nint\nmain(int argc, char **argv)\n{\n\tint\t\t\t\t\tsockfd;\n\tstruct sockaddr_in6\tservaddr, cliaddr;\n\n\tsockfd = "
},
{
"path": "key/Makefile",
"chars": 301,
"preview": "include ../Make.defines\n\nPROGS =\tdump register add\nOBJS = printsadbmsg.o name.o\n\nall:\t${PROGS}\n\ndump:\tdump.o ${OBJS}\n\t\t$"
},
{
"path": "key/add.c",
"chars": 4692,
"preview": "#include \"unp.h\"\n#include <net/pfkeyv2.h>\n\nint\nsalen(struct sockaddr *sa)\n{\n#ifdef HAVE_SOCKADDR_SA_LEN\n\treturn sa->sa_l"
},
{
"path": "key/dump.c",
"chars": 1283,
"preview": "#include \"unp.h\"\n#include <net/pfkeyv2.h>\n\n/* include sadb_dump */\nvoid\nsadb_dump(int type)\n{\n\tint s;\n\tchar buf[4096];\n\t"
},
{
"path": "key/name.c",
"chars": 1156,
"preview": "#include \"unp.h\"\n#include <net/pfkeyv2.h>\n\nstruct idlist {\n\tint val;\n\tconst char *name;\n};\n\nstatic struct idlist satype["
},
{
"path": "key/printsadbmsg.c",
"chars": 8023,
"preview": "#include \"unp.h\"\n#include <net/pfkeyv2.h>\n\nconst char *\nget_sadb_msg_type(int type)\n{\n\tstatic char buf[100];\n\tswitch (ty"
},
{
"path": "key/register.c",
"chars": 1463,
"preview": "#include \"unp.h\"\n#include <net/pfkeyv2.h>\n\n/* include sadb_register */\nvoid\nsadb_register(int type)\n{\n\tint s;\n\tchar buf["
},
{
"path": "key/unp.h",
"chars": 15529,
"preview": "/* include unph */\n/* Our own header. Tabs are set for 4 spaces, not 8 */\n\n#ifndef\t__unp_h\n#define\t__unp_h\n\n#include\t\"."
},
{
"path": "lib/Makefile",
"chars": 134,
"preview": "include ../Make.defines\n\nall:\t${LIB_OBJS}\n\t\tar rv ${LIBUNP_NAME} $?\n\t\t${RANLIB} ${LIBUNP_NAME}\n\nclean:\n\t\trm -f ${PROGS} "
},
{
"path": "lib/addrinfo.h",
"chars": 1964,
"preview": "#ifndef\t__addrinfo_h\n#define\t__addrinfo_h\n\n/*\n * Everything here really belongs in <netdb.h>.\n * These defines are separ"
},
{
"path": "lib/connect_nonb.c",
"chars": 1158,
"preview": "#include\t\"unp.h\"\n\nint\nconnect_nonb(int sockfd, const SA *saptr, socklen_t salen, int nsec)\n{\n\tint\t\t\t\tflags, n, error;\n\ts"
},
{
"path": "lib/connect_nonb.lc",
"chars": 2745,
"preview": "#include \"unp.h\"## 1 ##src/lib/connect_nonb.c##\n\nint## 2 ##src/lib/connect_nonb.c##\nconnect_nonb(int sockfd, const "
},
{
"path": "lib/connect_timeo.c",
"chars": 796,
"preview": "/* include connect_timeo */\n#include\t\"unp.h\"\n\nstatic void\tconnect_alarm(int);\n\nint\nconnect_timeo(int sockfd, const SA *s"
},
{
"path": "lib/connect_timeo.lc",
"chars": 1893,
"preview": "/* include connect_timeo */\n#include \"unp.h\"## 1 ##src/lib/connect_timeo.c##\n\nstatic void connect_alarm(int);## 2 #"
},
{
"path": "lib/daemon_inetd.c",
"chars": 232,
"preview": "#include\t\"unp.h\"\n#include\t<syslog.h>\n\nextern int\tdaemon_proc;\t/* defined in error.c */\n\nvoid\ndaemon_inetd(const char *pn"
},
{
"path": "lib/daemon_inetd.lc",
"chars": 550,
"preview": "#include \"unp.h\"## 1 ##src/lib/daemon_inetd.c##\n#include <syslog.h>## 2 ##src/lib/daemon_inetd.c##\n\nextern int d"
},
{
"path": "lib/daemon_init.c",
"chars": 905,
"preview": "#include\t\"unp.h\"\n#include\t<syslog.h>\n\n#define\tMAXFD\t64\n\nextern int\tdaemon_proc;\t/* defined in error.c */\n\nint\ndaemon_ini"
},
{
"path": "lib/dg_cli.c",
"chars": 401,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)\n{\n\tint\tn;\n\tchar\tsendline[MAX"
},
{
"path": "lib/dg_echo.c",
"chars": 266,
"preview": "#include\t\"unp.h\"\n\nvoid\ndg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)\n{\n\tint\t\t\tn;\n\tsocklen_t\tlen;\n\tchar\t\tmesg[MAXLI"
},
{
"path": "lib/error.c",
"chars": 2000,
"preview": "#include\t\"unp.h\"\n\n#include\t<stdarg.h>\t\t/* ANSI C header file */\n#include\t<syslog.h>\t\t/* for syslog() */\n\nint\t\tdaemon_pro"
},
{
"path": "lib/family_to_level.c",
"chars": 333,
"preview": "#include \"unp.h\"\n\nint\nfamily_to_level(int family)\n{\n\tswitch (family) {\n\tcase AF_INET:\n\t\treturn IPPROTO_IP;\n#ifdef\tIPV6\n\t"
},
{
"path": "lib/get_ifi_info.c",
"chars": 5496,
"preview": "/* include get_ifi_info1 */\n#include\t\"unpifi.h\"\n\nstruct ifi_info *\nget_ifi_info(int family, int doaliases)\n{\n\tstruct ifi"
},
{
"path": "lib/get_ifi_info.lc",
"chars": 11482,
"preview": "/* include get_ifi_info1 */\n#include \"unpifi.h\"## 1 ##src/lib/get_ifi_info.c##\n\nstruct ifi_info *## 2 ##src/lib/get"
},
{
"path": "lib/gf_time.c",
"chars": 463,
"preview": "#include\t\"unp.h\"\n#include\t<time.h>\n\nchar *\ngf_time(void)\n{\n\tstruct timeval\ttv;\n\ttime_t\t\t\tt;\n\tstatic char\t\tstr[30];\n\tchar"
},
{
"path": "lib/host_serv.c",
"chars": 1514,
"preview": "/* include host_serv */\n#include\t\"unp.h\"\n\nstruct addrinfo *\nhost_serv(const char *host, const char *serv, int family, in"
},
{
"path": "lib/host_serv.lc",
"chars": 2696,
"preview": "/* include host_serv */\n#include \"unp.h\"## 1 ##src/lib/host_serv.c##\n\nstruct addrinfo *## 2 ##src/lib/host_serv.c##"
},
{
"path": "lib/hstrerror.c",
"chars": 632,
"preview": "/*\n * Return a string containing some additional information after a\n * host name or address lookup error - gethostbynam"
},
{
"path": "lib/if_indextoname.c",
"chars": 495,
"preview": "#include\t\"unp.h\"\n\n/*\n * This is a placeholder if the system does not provide this RFC 2133\n * function. If routing sock"
},
{
"path": "lib/if_nameindex.c",
"chars": 514,
"preview": "#include\t\"unp.h\"\n\n/*\n * This is a placeholder if the system does not provide this RFC 2133\n * function. If routing sock"
},
{
"path": "lib/if_nametoindex.c",
"chars": 470,
"preview": "#include\t\"unp.h\"\n\n/*\n * This is a placeholder if the system does not provide this RFC 2133\n * function. If routing sock"
},
{
"path": "lib/in6addr_any.c",
"chars": 72,
"preview": "#include\t\"unp.h\"\n\n#ifdef\tIPV6\nconst struct in6_addr in6addr_any;\n#endif\n"
},
{
"path": "lib/mcast_get_if.c",
"chars": 551,
"preview": "#include\t\"unp.h\"\n\nint\nmcast_get_if(int sockfd)\n{\n\tswitch (sockfd_to_family(sockfd)) {\n\tcase AF_INET: {\n\t\t/* TODO: simila"
},
{
"path": "lib/mcast_get_loop.c",
"chars": 680,
"preview": "#include\t\"unp.h\"\n\nint\nmcast_get_loop(int sockfd)\n{\n\tswitch (sockfd_to_family(sockfd)) {\n\tcase AF_INET: {\n\t\tu_char\t\tflag;"
},
{
"path": "lib/mcast_get_ttl.c",
"chars": 666,
"preview": "#include\t\"unp.h\"\n\nint\nmcast_get_ttl(int sockfd)\n{\n\tswitch (sockfd_to_family(sockfd)) {\n\tcase AF_INET: {\n\t\tu_char\t\tttl;\n\t"
},
{
"path": "lib/mcast_join.c",
"chars": 7278,
"preview": "/* include mcast_join1 */\n#include\t\"unp.h\"\n#include\t<net/if.h>\n\nint\nmcast_join(int sockfd, const SA *grp, socklen_t grpl"
},
{
"path": "lib/mcast_join.lc",
"chars": 15753,
"preview": "/* include mcast_join1 */\n#include \"unp.h\"## 1 ##src/lib/mcast_join.c##\n#include <net/if.h>## 2 ##src/lib/mcast_"
},
{
"path": "lib/mcast_leave.c",
"chars": 2690,
"preview": "#include\t\"unp.h\"\n\nint\nmcast_leave(int sockfd, const SA *grp, socklen_t grplen)\n{\n#ifdef MCAST_JOIN_GROUP\n\tstruct group_r"
},
{
"path": "lib/mcast_set_if.c",
"chars": 1414,
"preview": "#include\t\"unp.h\"\n#include\t<net/if.h>\n\nint\nmcast_set_if(int sockfd, const char *ifname, u_int ifindex)\n{\n\tswitch (sockfd_"
},
{
"path": "lib/mcast_set_loop.c",
"chars": 640,
"preview": "/* include mcast_set_loop */\n#include\t\"unp.h\"\n\nint\nmcast_set_loop(int sockfd, int onoff)\n{\n\tswitch (sockfd_to_family(soc"
},
{
"path": "lib/mcast_set_loop.lc",
"chars": 1825,
"preview": "/* include mcast_set_loop */\n#include \"unp.h\"## 1 ##src/lib/mcast_set_loop.c##\n\nint## 2 ##src/lib/mcast_set_loop.c#"
},
{
"path": "lib/mcast_set_ttl.c",
"chars": 561,
"preview": "#include\t\"unp.h\"\n\nint\nmcast_set_ttl(int sockfd, int val)\n{\n\tswitch (sockfd_to_family(sockfd)) {\n\tcase AF_INET: {\n\t\tu_cha"
},
{
"path": "lib/my_addrs.c",
"chars": 479,
"preview": "/* include my_addrs */\n#include\t\"unp.h\"\n#include\t<sys/utsname.h>\n\nchar **\nmy_addrs(int *addrtype)\n{\n\tstruct hostent\t*hpt"
},
{
"path": "lib/my_addrs.lc",
"chars": 1151,
"preview": "/* include my_addrs */\n#include \"unp.h\"## 1 ##src/lib/my_addrs.c##\n#include <sys/utsname.h>## 2 ##src/lib/my_add"
},
{
"path": "lib/pselect.c",
"chars": 937,
"preview": "/*\n * This is *not* a complete implementation of the Posix.1g pselect()\n * function. For atomicity this must be impleme"
},
{
"path": "lib/pselect.lc",
"chars": 1666,
"preview": "/*## 1 ##src/lib/pselect.c##\n * This is *not* a complete implementation of the Posix.1g pselect()## 2 ##src/lib/pselec"
},
{
"path": "lib/read_fd.c",
"chars": 1455,
"preview": "/* include read_fd */\n#include\t\"unp.h\"\n\nssize_t\nread_fd(int fd, void *ptr, size_t nbytes, int *recvfd)\n{\n\tstruct msghdr\t"
},
{
"path": "lib/read_fd.lc",
"chars": 3051,
"preview": "/* include read_fd */\n#include \"unp.h\"## 1 ##src/lib/read_fd.c##\n\nssize_t## 2 ##src/lib/read_fd.c##\nread_fd(int fd,"
},
{
"path": "lib/readable_timeo.c",
"chars": 448,
"preview": "/* include readable_timeo */\n#include\t\"unp.h\"\n\nint\nreadable_timeo(int fd, int sec)\n{\n\tfd_set\t\t\trset;\n\tstruct timeval\ttv;"
},
{
"path": "lib/readable_timeo.lc",
"chars": 1208,
"preview": "/* include readable_timeo */\n#include \"unp.h\"## 1 ##src/lib/readable_timeo.c##\n\nint## 2 ##src/lib/readable_timeo.c#"
},
{
"path": "lib/readline.c",
"chars": 1158,
"preview": "/* include readline */\n#include\t\"unp.h\"\n\nstatic int\tread_cnt;\nstatic char\t*read_ptr;\nstatic char\tread_buf[MAXLINE];\n\nsta"
},
{
"path": "lib/readline.lc",
"chars": 2974,
"preview": "/* include readline */\n#include \"unp.h\"## 1 ##src/lib/readline.c##\n\nstatic int read_cnt;## 2 ##src/lib/readline.c##"
},
{
"path": "lib/readn.c",
"chars": 645,
"preview": "/* include readn */\n#include\t\"unp.h\"\n\nssize_t\t\t\t\t\t\t/* Read \"n\" bytes from a descriptor. */\nreadn(int fd, void *vptr, siz"
},
{
"path": "lib/readn.lc",
"chars": 1553,
"preview": "/* include readn */\n#include \"unp.h\"## 1 ##src/lib/readn.c##\n\nssize_t /* Read \"n\" bytes from"
},
{
"path": "lib/rtt.c",
"chars": 2939,
"preview": "/* include rtt1 */\n#include\t\"unprtt.h\"\n\nint\t\trtt_d_flag = 0;\t\t/* debug flag; can be set by caller */\n\n/*\n * Calculate th"
},
{
"path": "lib/rtt.lc",
"chars": 5482,
"preview": "/* include rtt1 */\n#include \"unprtt.h\"## 1 ##src/lib/rtt.c##\n\nint rtt_d_flag = 0; /* debug flag; can be "
},
{
"path": "lib/signal.c",
"chars": 671,
"preview": "/* include signal */\n#include\t\"unp.h\"\n\nSigfunc *\nsignal(int signo, Sigfunc *func)\n{\n\tstruct sigaction\tact, oact;\n\n\tact.s"
},
{
"path": "lib/signal.lc",
"chars": 1523,
"preview": "/* include signal */\n#include \"unp.h\"## 1 ##src/lib/signal.c##\n\nSigfunc *## 2 ##src/lib/signal.c##\nsignal(int signo"
},
{
"path": "lib/signal_intr.c",
"chars": 552,
"preview": "/* include signal_intr */\n#include\t\"unp.h\"\n\nSigfunc *\nsignal_intr(int signo, Sigfunc *func)\n{\n\tstruct sigaction\tact, oac"
},
{
"path": "lib/snprintf.c",
"chars": 724,
"preview": "/*\n * Throughout the book I use snprintf() because it's safer than sprintf().\n * But as of the time of this writing, not"
},
{
"path": "lib/sock_bind_wild.c",
"chars": 1055,
"preview": "#include\t\"unp.h\"\n\nint\nsock_bind_wild(int sockfd, int family)\n{\n\tsocklen_t\tlen;\n\n\tswitch (family) {\n\tcase AF_INET: {\n\t\tst"
},
{
"path": "lib/sock_cmp_addr.c",
"chars": 889,
"preview": "#include\t\"unp.h\"\n\n#ifdef\tHAVE_SOCKADDR_DL_STRUCT\n#include\t<net/if_dl.h>\n#endif\n\nint\nsock_cmp_addr(const struct sockaddr "
},
{
"path": "lib/sock_cmp_port.c",
"chars": 540,
"preview": "#include\t\"unp.h\"\n\n#ifdef\tHAVE_SOCKADDR_DL_STRUCT\n#include\t<net/if_dl.h>\n#endif\n\nint\nsock_cmp_port(const struct sockaddr "
},
{
"path": "lib/sock_get_port.c",
"chars": 369,
"preview": "#include\t\"unp.h\"\n\nint\nsock_get_port(const struct sockaddr *sa, socklen_t salen)\n{\n\tswitch (sa->sa_family) {\n\tcase AF_INE"
},
{
"path": "lib/sock_ntop.c",
"chars": 2024,
"preview": "#include\t\"unp.h\"\n\n#ifdef\tHAVE_SOCKADDR_DL_STRUCT\n#include\t<net/if_dl.h>\n#endif\n\n/* include sock_ntop */\nchar *\nsock_ntop"
},
{
"path": "lib/sock_ntop.lc",
"chars": 4806,
"preview": "#include \"unp.h\"## 1 ##src/lib/sock_ntop.c##\n\n#ifdef HAVE_SOCKADDR_DL_STRUCT## 2 ##src/lib/sock_ntop.c##\n#include "
},
{
"path": "lib/sock_ntop_host.c",
"chars": 1642,
"preview": "#include\t\"unp.h\"\n\n#ifdef\tHAVE_SOCKADDR_DL_STRUCT\n#include\t<net/if_dl.h>\n#endif\n\nchar *\nsock_ntop_host(const struct socka"
},
{
"path": "lib/sock_set_addr.c",
"chars": 450,
"preview": "#include\t\"unp.h\"\n\nvoid\nsock_set_addr(struct sockaddr *sa, socklen_t salen, const void *addr)\n{\n\tswitch (sa->sa_family) {"
},
{
"path": "lib/sock_set_port.c",
"chars": 377,
"preview": "#include\t\"unp.h\"\n\nvoid\nsock_set_port(struct sockaddr *sa, socklen_t salen, int port)\n{\n\tswitch (sa->sa_family) {\n\tcase A"
},
{
"path": "lib/sock_set_wild.c",
"chars": 411,
"preview": "#include\t\"unp.h\"\n\nvoid\nsock_set_wild(struct sockaddr *sa, socklen_t salen)\n{\n\tconst void\t*wildptr;\n\n\tswitch (sa->sa_fami"
},
{
"path": "lib/sockatmark.c",
"chars": 131,
"preview": "#include\t\"unp.h\"\n\nint\nsockatmark(int fd)\n{\n\tint\t\tflag;\n\n\tif (ioctl(fd, SIOCATMARK, &flag) < 0)\n\t\treturn(-1);\n\treturn(fla"
},
{
"path": "lib/sockfd_to_family.c",
"chars": 406,
"preview": "/* include sockfd_to_family */\n#include\t\"unp.h\"\n\nint\nsockfd_to_family(int sockfd)\n{\n\tstruct sockaddr_storage ss;\n\tsockle"
},
{
"path": "lib/sockfd_to_family.lc",
"chars": 1134,
"preview": "/* include sockfd_to_family */\n#include \"unp.h\"## 1 ##src/lib/sockfd_to_family.c##\n\nint## 2 ##src/lib/sockfd_to_fam"
},
{
"path": "lib/str_cli.c",
"chars": 332,
"preview": "#include\t\"unp.h\"\n\nvoid\nstr_cli(FILE *fp, int sockfd)\n{\n\tchar\tsendline[MAXLINE], recvline[MAXLINE];\n\n\twhile (Fgets(sendli"
},
{
"path": "lib/str_cli.lc",
"chars": 698,
"preview": "#include \"unp.h\"## 1 ##src/lib/str_cli.c##\n\nvoid## 2 ##src/lib/str_cli.c##\nstr_cli(FILE *fp, int sockfd)## 3 ##src"
}
]
// ... and 579 more files (download for full content)
About this extraction
This page contains the full source code of the hailinzeng/Unix-Network-Programming GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 779 files (2.0 MB), approximately 553.4k tokens, and a symbol index with 1139 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.