Lines Matching refs:X

98 sed "s/^X//" >gethostbyaddr.c <<'END_OF_gethostbyaddr.c'
99 X /*
100 X * gethostbyaddr tester. compile with:
101 X *
102 X * cc -o gethostbyaddr gethostbyaddr.c (SunOS 4.x)
103 X *
104 X * cc -o gethostbyaddr gethostbyaddr.c -lnsl (SunOS 5.x)
105 X *
106 X * run as: gethostbyaddr address
107 X *
108 X * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
109 X */
110 X
111 X#include <sys/types.h>
112 X#include <sys/socket.h>
113 X#include <netinet/in.h>
114 X#include <arpa/inet.h>
115 X#include <netdb.h>
116 X#include <stdio.h>
117 X
121 X{
122 X struct hostent *hp;
123 X long addr;
124 X
125 X if (argc != 2) {
126 X fprintf(stderr, "usage: %s i.p.addres\n", argv[0]);
127 X exit(1);
128 X }
129 X addr = inet_addr(argv[1]);
130 X if (hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET)) {
131 X printf("Hostname:\t%s\n", hp->h_name);
132 X printf("Aliases:\t");
133 X while (hp->h_aliases[0])
134 X printf("%s ", *hp->h_aliases++);
135 X printf("\n");
136 X printf("Addresses:\t");
137 X while (hp->h_addr_list[0])
138 X printf("%s ", inet_ntoa(*(struct in_addr *) * hp->h_addr_list++));
139 X printf("\n");
140 X exit(0);
141 X }
142 X fprintf(stderr, "host %s not found\n", argv[1]);
143 X exit(1);
144 X}
155 sed "s/^X//" >gethostbyname.c <<'END_OF_gethostbyname.c'
156 X /*
157 X * gethostbyname tester. compile with:
158 X *
159 X * cc -o gethostbyname gethostbyname.c (SunOS 4.x)
160 X *
161 X * cc -o gethostbyname gethostbyname.c -lnsl (SunOS 5.x)
162 X *
163 X * run as: gethostbyname hostname
164 X *
165 X * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
166 X */
167 X#include <sys/types.h>
168 X#include <sys/socket.h>
169 X#include <netinet/in.h>
170 X#include <arpa/inet.h>
171 X#include <netdb.h>
172 X#include <stdio.h>
173 X
177 X{
178 X struct hostent *hp;
179 X
180 X if (argc != 2) {
181 X fprintf(stderr, "usage: %s hostname\n", argv[0]);
182 X exit(1);
183 X }
184 X if (hp = gethostbyname(argv[1])) {
185 X printf("Hostname:\t%s\n", hp->h_name);
186 X printf("Aliases:\t");
187 X while (hp->h_aliases[0])
188 X printf("%s ", *hp->h_aliases++);
189 X printf("\n");
190 X printf("Addresses:\t");
191 X while (hp->h_addr_list[0])
192 X printf("%s ", inet_ntoa(*(struct in_addr *) * hp->h_addr_list++));
193 X printf("\n");
194 X exit(0);
195 X } else {
196 X fprintf(stderr, "host %s not found\n", argv[1]);
197 X exit(1);
198 X }
199 X}