1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
--- Makefile.orig Thu Sep 10 16:59:31 1992
+++ Makefile Tue Feb 24 01:36:50 1998
@@ -8,7 +8,7 @@
### socket.1 in /usr/local/man/man1/socket.1
### Make sure the target directories exist before doing a "make install".
-INSTALLBASE = /usr/local
+INSTALLBASE = ${PREFIX}
INSTALLBINPATH = $(INSTALLBASE)/bin
INSTALLBINMODE = 755
INSTALLMANPATH = $(INSTALLBASE)/man
@@ -43,7 +43,8 @@
### CDC 4680 EP/IX: (I know it *has* setsid(2), but not with bsd43)
# SWITCHES = -systype bsd43 -DNOSETSID
-
+# FreeBSD 2.x (4.4BSD)
+SWITCHES=-DHAVE_SYS_PARAM_H -Wall
### It should not be necessary to change anything below this line.
##################################################################
--- README.orig Wed Sep 9 16:45:16 1992
+++ README Wed Aug 14 16:57:58 1996
@@ -166,4 +166,4 @@
1000 Berlin 10
Germany
- <nickel@cs.tu-berlin.de>
+Juergen Nickelsen <jn@berlin.snafu.de>
--- globals.h.orig Sun Aug 30 21:04:27 1992
+++ globals.h Wed Aug 14 16:57:58 1996
@@ -8,6 +8,11 @@
*/
#include "patchlevel.h"
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
/* globals for socket */
@@ -49,4 +54,7 @@
extern int crlfflag ;
extern int active_socket ;
extern char *progname ;
-extern char *sys_errlist[], *sys_siglist[] ;
+
+#if !(defined(BSD) && (BSD >=199306))
+ extern char *sys_errlist[], *sys_siglist[] ;
+#endif
--- io.c.orig Sun Aug 30 19:15:26 1992
+++ io.c Wed Aug 14 16:57:58 1996
@@ -16,6 +16,8 @@
#endif
#include <errno.h>
#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
#include "globals.h"
/* read from from, write to to. select(2) has returned, so input
@@ -90,7 +92,7 @@
/* all IO to and from the socket is handled here. The main part is
* a loop around select(2). */
-do_io()
+void do_io()
{
fd_set readfds ;
int fdset_width ;
--- siglist.c.orig Sun Aug 30 15:50:48 1992
+++ siglist.c Wed Aug 14 16:57:58 1996
@@ -32,12 +32,18 @@
# endif /* !_NSIG */
#endif /* !NSIG */
-char *sys_siglist[NSIG];
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#if !(defined(BSD) && (BSD >=199306))
+char *sys_siglist[NSIG];
+#endif
extern *malloc ();
-initialize_siglist ()
+void initialize_siglist ()
{
+#if !(defined(BSD) && (BSD >=199306))
register int i;
for (i = 0; i < NSIG; i++)
@@ -219,4 +225,5 @@
sprintf (sys_siglist[i], "Unknown Signal #%d", i);
}
}
+#endif /* !(defined(BSD) && (BSD >=199306)) */
}
--- socket.1.orig Wed Sep 9 16:38:19 1992
+++ socket.1 Wed Aug 14 16:57:58 1996
@@ -158,4 +158,4 @@
.SH VERSION
This manual page describes Socket\-1.1.
.SH AUTHOR
-Juergen Nickelsen <nickel@cs.tu-berlin.de>
+Juergen Nickelsen <jn@berlin.snafu.de>
--- socket.c.orig Wed Sep 9 16:14:34 1992
+++ socket.c Wed Aug 14 16:57:59 1996
@@ -18,6 +18,8 @@
#else
#include <string.h>
#endif
+#include <stdlib.h>
+#include <unistd.h>
#include "globals.h"
/* global variables */
@@ -37,6 +39,8 @@
void server A((int port, char *service_name)) ;
void handle_server_connection A((void)) ;
void client A((char *host, int port, char *service_name)) ;
+extern void init_signals A((void)) ;
+extern void do_io A((void)) ;
int main(argc, argv)
int argc ;
@@ -46,7 +50,7 @@
int opt ; /* option character */
int error = 0 ; /* usage error occurred */
extern int optind ; /* from getopt() */
- char *host ; /* name of remote host */
+ /* char *host ; */ /* name of remote host */
int port ; /* port number for socket */
char *service_name ; /* name of service for port */
@@ -58,7 +62,7 @@
/* set up progname for later use */
progname = argv[0] ;
- if (cp = strrchr(progname, '/')) progname = cp + 1 ;
+ if ((cp = strrchr(progname, '/'))) progname = cp + 1 ;
/* parse options */
while ((opt = getopt(argc, argv, "bcflp:qrsvw?")) != -1) {
@@ -185,15 +189,15 @@
long norder ;
char dotted[20] ;
- he = gethostbyaddr(&sa.sin_addr.s_addr,
+ he = gethostbyaddr((char *)&sa.sin_addr.s_addr,
sizeof(sa.sin_addr.s_addr), AF_INET) ;
if (!he) {
norder = htonl(sa.sin_addr.s_addr) ;
sprintf(dotted, "%d.%d.%d.%d",
- (norder >> 24) & 0xff,
- (norder >> 16) & 0xff,
- (norder >> 8) & 0xff,
- norder & 0xff) ;
+ (int)((norder >> 24) & 0xff),
+ (int)((norder >> 16) & 0xff),
+ (int)((norder >> 8) & 0xff),
+ (int)(norder & 0xff)) ;
}
fprintf(stderr, "connection from %s\n",
(he ? he->h_name : dotted)) ;
--- socketp.c.orig Sun Aug 9 03:41:42 1992
+++ socketp.c Wed Aug 14 16:57:59 1996
@@ -11,10 +11,16 @@
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "globals.h"
+extern int is_number A((char *));
+
/*
* create a server socket on PORT accepting QUEUE_LENGTH connections
*/
@@ -52,7 +58,7 @@
{
struct sockaddr_in sa ;
struct hostent *hp ;
- int a, s ;
+ int s ;
long addr ;
@@ -76,7 +82,7 @@
if ((s = socket(sa.sin_family, SOCK_STREAM, 0)) < 0) { /* get socket */
return -1 ;
}
- if (connect(s, &sa, sizeof(sa)) < 0) { /* connect */
+ if (connect(s, (struct sockaddr *)&sa, sizeof(sa)) < 0) { /* connect */
close(s) ;
return -1 ;
}
--- utils.c.orig Wed Sep 9 16:31:16 1992
+++ utils.c Wed Aug 14 16:57:59 1996
@@ -25,8 +25,10 @@
#else
#include <sys/resource.h>
#endif
+#include <unistd.h>
#include "globals.h"
+extern void initialize_siglist A((void)) ;
/* Signal handler, print message and exit */
SIG_HANDLER_RET exitsig(sig)
@@ -70,7 +72,7 @@
/* set up signal handling. All except TSTP, CONT, CLD, and QUIT
* are caught with exitsig(). */
-init_signals()
+void init_signals()
{
int i ;
#ifdef SIG_SETMASK /* only with BSD signals */
|