Deleted Added
full compact
get_addrs.c (87710) get_addrs.c (178642)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/talk/get_addrs.c 87710 2001-12-11 23:51:14Z markm $");
36__FBSDID("$FreeBSD: head/usr.bin/talk/get_addrs.c 178642 2008-04-28 21:08:42Z delphij $");
37
38#ifndef lint
39static const char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42#include <err.h>
43#include <netdb.h>
44#include <string.h>
45
46#include "talk.h"
47#include "talk_ctl.h"
48
49void
37
38#ifndef lint
39static const char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93";
40#endif
41
42#include <err.h>
43#include <netdb.h>
44#include <string.h>
45
46#include "talk.h"
47#include "talk_ctl.h"
48
49void
50get_addrs(my_machine_name, his_machine_name)
51 char *my_machine_name __unused, *his_machine_name;
50get_addrs(const char *my_machine_name __unused, const char *his_machine_name)
52{
53 struct hostent *hp;
54 struct servent *sp;
55
56 msg.pid = htonl(getpid());
57
58 hp = gethostbyname(his_machine_name);
59 if (hp == NULL)
60 errx(1, "%s: %s", his_machine_name, hstrerror(h_errno));
61 bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
62 if (get_iface(&his_machine_addr, &my_machine_addr) == -1)
63 err(1, "failed to find my interface address");
64 /* find the server's port */
65 sp = getservbyname("ntalk", "udp");
66 if (sp == 0)
67 errx(1, "ntalk/udp: service is not registered");
68 daemon_port = sp->s_port;
69}
51{
52 struct hostent *hp;
53 struct servent *sp;
54
55 msg.pid = htonl(getpid());
56
57 hp = gethostbyname(his_machine_name);
58 if (hp == NULL)
59 errx(1, "%s: %s", his_machine_name, hstrerror(h_errno));
60 bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length);
61 if (get_iface(&his_machine_addr, &my_machine_addr) == -1)
62 err(1, "failed to find my interface address");
63 /* find the server's port */
64 sp = getservbyname("ntalk", "udp");
65 if (sp == 0)
66 errx(1, "ntalk/udp: service is not registered");
67 daemon_port = sp->s_port;
68}