-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Troy Rollo
authored and
Julius Schwartzenberg
committed
Oct 7, 2017
1 parent
2fb31f7
commit 181e468
Showing
21 changed files
with
1,267 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* TwinSock - "Troy's Windows Sockets" | ||
* | ||
* Copyright (C) 1994 Troy Rollo <[email protected]> | ||
* | ||
* This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
*/ | ||
#include <windows.h> | ||
|
||
extern HINSTANCE hinst; | ||
|
||
BOOL CALLBACK | ||
AboutDlgProc( HWND hDlg, | ||
UINT wMsg, | ||
WPARAM wParam, | ||
LPARAM lParam) | ||
{ | ||
if (wMsg == WM_COMMAND && | ||
(wParam == IDOK || wParam == IDCANCEL)) | ||
{ | ||
EndDialog(hDlg, TRUE); | ||
return TRUE; | ||
} | ||
else if (wMsg == WM_INITDIALOG) | ||
{ | ||
return TRUE; | ||
} | ||
else | ||
{ | ||
return FALSE; | ||
} | ||
} | ||
|
||
void | ||
About(HWND hwndParent) | ||
{ | ||
FARPROC fpDlgProc; | ||
|
||
fpDlgProc = MakeProcInstance((FARPROC) AboutDlgProc, hinst); | ||
DialogBox(hinst, "ABOUT_DLG", hwndParent, fpDlgProc); | ||
FreeProcInstance(fpDlgProc); | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
#!/bin/sh | ||
# Remove all carriage returns and Control-Zs | ||
rm -f a.out test.c | ||
rm -f *.o tshost | ||
echo "Cleaning the source code of MS-DOS control characters" | ||
for i in *.c *.h | ||
do | ||
tr -d '\015\032' < $i > tempfile | ||
mv tempfile $i | ||
done | ||
|
||
# Test for a few things we need to know about | ||
|
||
echo "Testing for sys/select.h" | ||
if [ -f /usr/include/sys/select.h ] | ||
then | ||
SELECT_H=-DNEED_SELECT_H | ||
echo "You have sys/select.h" | ||
fi | ||
|
||
echo "Testing for sys/ttold.h" | ||
if [ -f /usr/include/sys/ttold.h ] | ||
then | ||
TTOLD_H=-DNEED_TTOLD_H | ||
echo "You have sys/ttold.h" | ||
fi | ||
|
||
echo "Testing for sgtty.h" | ||
if [ -f /usr/include/sgtty.h ] | ||
then | ||
echo "You have it" | ||
else | ||
echo "You don't have it - I will use ioctl.h instead" | ||
SGTTY_H=-DNO_SGTTY_H | ||
fi | ||
|
||
# Try to find a C compiler that does ANSI. | ||
# Note that just testing for no error exit is not sufficient | ||
# because what we find may not be a compiler, so we test for | ||
# an a.out file. | ||
|
||
echo "main(int argc, char **argv) { return (int) argv[argc]; }" > test.c | ||
echo "Attempting to find a compiler that will work" | ||
for i in bsdcc ucbcc cc acc gcc /usr/local/bin/gcc | ||
do | ||
( $i test.c ) </dev/null >/dev/null 2>&1 | ||
if [ -f a.out ] | ||
then | ||
CC=$i | ||
break | ||
fi | ||
done | ||
|
||
case "$CC" in | ||
"") | ||
echo "Unable to find an ANSI C compiler" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
echo "Using $CC as the C compiler" | ||
|
||
echo "main() {}" > test.c | ||
|
||
echo "Testing for -lsocket" | ||
if $CC test.c -lsocket > /dev/null 2>/dev/null | ||
then | ||
echo "You will need -lsocket" | ||
L_SOCKET=-lsocket | ||
else | ||
echo "You don't need it" | ||
fi | ||
|
||
echo "Testing for -lresolv" | ||
if $CC test.c -lresolv ${L_SOCKET} > /dev/null 2>/dev/null | ||
then | ||
echo "You will need -lresolv" | ||
L_RESOLV=-lresolv | ||
else | ||
if [ -f /lib/resolv.so ] | ||
then | ||
echo "Found the resolver libraries in /lib/resolv.so" | ||
L_RESOLV=/lib/resolv.so | ||
else | ||
if [ -f /usr/lib/resolv.so ] | ||
then | ||
echo "Found the resolver libraries in /usr/lib/resolv.so" | ||
L_RESOLV=/usr/lib/resolv.so | ||
else | ||
echo "You don't appear to need resolver libraries" | ||
fi | ||
fi | ||
fi | ||
|
||
echo "Testing for -lnsl" | ||
if $CC test.c -lnsl ${L_RESOLV} -lresolv ${L_SOCKET} > /dev/null 2>/dev/null | ||
then | ||
echo "You will need -lnsl" | ||
L_NSL=-lnsl | ||
else | ||
echo "You don't appear to need -lnsl" | ||
fi | ||
|
||
echo "main() {char *pch1, *pch2; memcpy(pch1, pch2, 10); memset(pch1, 0, 10); }" > test.c | ||
if $CC test.c > /dev/null 2>&1 | ||
then | ||
echo "You have memcpy and memset" | ||
else | ||
echo "We will use TwinSock's memcpy and memset" | ||
NEED_MEM=mem.o | ||
fi | ||
|
||
echo "Testing for h_errno" | ||
echo "#include <netdb.h> | ||
main() { return h_errno; }" > test.c | ||
if $CC test.c > /dev/null 2>&1 | ||
then | ||
echo "h_errno is where it should be" | ||
else | ||
echo "extern int h_errno; main() { return h_errno; }" > test.c | ||
if $CC test.c > /dev/null 2>&1 | ||
then | ||
echo "h_errno is not declared in netdb.h, but exists" | ||
H_ERRNO=-DNEED_H_ERRNO | ||
else | ||
echo "h_errno does not exist, using errno" | ||
H_ERRNO=-DNO_H_ERRNO | ||
fi | ||
fi | ||
|
||
rm -f a.out test.c | ||
|
||
OBJECTS="tshost.o packet.o commands.o term.o $NEED_MEM" | ||
|
||
echo "Building makefile" | ||
echo ".c.o:" > Makefile | ||
echo " ${CC} ${SELECT_H} ${TTOLD_H} ${SGTTY_H} ${H_ERRNO} -c "'$*.c' >> Makefile | ||
echo >> Makefile | ||
echo "tshost: ${OBJECTS}" >> Makefile | ||
echo " ${CC} -o tshost ${OBJECTS} ${L_NSL} ${L_RESOLV} ${L_SOCKET}" >> Makefile | ||
|
||
echo | ||
echo 'Running "make"' | ||
echo | ||
exec make | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.