python: make hashlib and readline modules really optional
[buildroot-gz.git] / package / tinyhttpd / 0001-misc-fixes.patch
blob05d6e50a70d9fa1d92e0f472b725564deb0c1683
1 diff -ur tinyhttpd-0.1.0/httpd.c tinyhttpd-0.1.0-patched/httpd.c
2 --- tinyhttpd-0.1.0/httpd.c 2001-04-21 19:13:13.000000000 -0500
3 +++ tinyhttpd-0.1.0-patched/httpd.c 2007-07-02 09:19:27.000000000 -0500
4 @@ -4,14 +4,6 @@
5 * CSE 4344 (Network concepts), Prof. Zeigler
6 * University of Texas at Arlington
7 */
8 -/* This program compiles for Sparc Solaris 2.6.
9 - * To compile for Linux:
10 - * 1) Comment out the #include <pthread.h> line.
11 - * 2) Comment out the line that defines the variable newthread.
12 - * 3) Comment out the two lines that run pthread_create().
13 - * 4) Uncomment the line that runs accept_request().
14 - * 5) Remove -lsocket from the Makefile.
15 - */
16 #include <stdio.h>
17 #include <sys/socket.h>
18 #include <sys/types.h>
19 @@ -22,7 +14,6 @@
20 #include <strings.h>
21 #include <string.h>
22 #include <sys/stat.h>
23 -#include <pthread.h>
24 #include <sys/wait.h>
25 #include <stdlib.h>
27 @@ -30,7 +21,6 @@
29 #define SERVER_STRING "Server: jdbhttpd/0.1.0\r\n"
31 -void accept_request(int);
32 void bad_request(int);
33 void cat(int, FILE *);
34 void cannot_execute(int);
35 @@ -102,7 +92,7 @@
39 - sprintf(path, "htdocs%s", url);
40 + sprintf(path, "/var/www%s", url);
41 if (path[strlen(path) - 1] == '/')
42 strcat(path, "index.html");
43 if (stat(path, &st) == -1) {
44 @@ -475,11 +465,10 @@
45 int main(void)
47 int server_sock = -1;
48 - u_short port = 0;
49 + u_short port = 80;
50 int client_sock = -1;
51 struct sockaddr_in client_name;
52 int client_name_len = sizeof(client_name);
53 - pthread_t newthread;
55 server_sock = startup(&port);
56 printf("httpd running on port %d\n", port);
57 @@ -491,9 +480,7 @@
58 &client_name_len);
59 if (client_sock == -1)
60 error_die("accept");
61 - /* accept_request(client_sock); */
62 - if (pthread_create(&newthread , NULL, accept_request, client_sock) != 0)
63 - perror("pthread_create");
64 + accept_request(client_sock);
67 close(server_sock);
68 diff -ur tinyhttpd-0.1.0/Makefile tinyhttpd-0.1.0-patched/Makefile
69 --- tinyhttpd-0.1.0/Makefile 2001-04-21 17:03:39.000000000 -0500
70 +++ tinyhttpd-0.1.0-patched/Makefile 2007-07-02 10:29:41.000000000 -0500
71 @@ -1,7 +1,7 @@
72 all: httpd
74 httpd: httpd.c
75 - gcc -W -Wall -lsocket -lpthread -o httpd httpd.c
76 + $(CC) $(CFLAGS) $(LDFLAGS) -W -Wall -o httpd httpd.c
78 clean:
79 - rm httpd
80 + rm -f httpd