Skip to content

Commit

Permalink
First attempt to make the legacy app build.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoraCodes committed Oct 19, 2016
1 parent 08c890d commit a1ae783
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
17 changes: 17 additions & 0 deletions analysis/building.md
@@ -0,0 +1,17 @@
# Building the Legacy Server

In order to make the game server build, I had to follow the author's instructions:

```
/* This program compiles for Sparc Solaris 2.6.
* To compile for Linux:
* 1) Comment out the #include <pthread.h> line.
* 2) Comment out the line that defines the variable newthread.
* 3) Comment out the two lines that run pthread_create().
* 4) Uncomment the line that runs accept_request().
* 5) Remove -lsocket from the Makefile.
*/
```

However, these instructions seemed to be out of date; there are not two occurances
of `pthread_create`, and the server does not work with these modifications.
10 changes: 7 additions & 3 deletions legacy/httpd.c
Expand Up @@ -22,7 +22,8 @@
#include <strings.h>
#include <string.h>
#include <sys/stat.h>
#include <pthread.h>
// Commented out in order to build on Linux
//#include <pthread.h>
#include <sys/wait.h>
#include <stdlib.h>

Expand Down Expand Up @@ -505,7 +506,8 @@ int main(void)
u_short port = 9999;
struct sockaddr_in client_name;
socklen_t client_name_len = sizeof(client_name);
pthread_t newthread;
// Commented out to build on Linux
//pthread_t newthread;

signal(SIGPIPE, SIG_IGN);

Expand All @@ -520,10 +522,12 @@ int main(void)
error_die("accept");
}

if (pthread_create(&newthread , NULL, (void *)accept_request, (void *)&client_sock) != 0)
// Commented out in order to build on Linux
/* if (pthread_create(&newthread , NULL, (void *)accept_request, (void *)&client_sock) != 0)
{
perror("pthread_create");
}
*/
}

close(server_sock);
Expand Down

0 comments on commit a1ae783

Please sign in to comment.