Fix build error with clang.

This commit is contained in:
Vanilla I. Shu 2011-09-06 03:49:50 +00:00
parent 1f79b231d2
commit 45eefa03bd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=281272
6 changed files with 155 additions and 12 deletions

View file

@ -0,0 +1,11 @@
--- Makefile.orig 2011-09-06 11:10:37.000000000 +0800
+++ Makefile 2011-09-06 11:10:42.000000000 +0800
@@ -1,7 +1,7 @@
# Where cgichk goes when user decides to install
INSTALLDIR=/usr/local/bin
-CC = gcc
+CC ?= gcc
OPTIONS = $(WINCRAP)
CFLAGS = -O2 -s $(OPTIONS)
OUTPUT = cgichk

View file

@ -0,0 +1,56 @@
--- cgichk.c.orig 2001-04-06 16:36:25.000000000 +0800
+++ cgichk.c 2011-09-06 11:29:49.000000000 +0800
@@ -58,7 +58,7 @@ void check_dir_only()
CPRINT(" \r");
CPRINT(" Looking for /%s\r", r->v[count]);
- if (result = http_has(temp,0))
+ if ((result = http_has(temp,0)))
{
CPRINT(" \r");
PRINT(" Found /%s (%d) \n", r->v[count], result);
@@ -77,7 +77,7 @@ void check_hole(char *hole)
CPRINT(" \r");
CPRINT(" Looking for %s\r", hole);
- if (result = http_has(hole,0))
+ if ((result = http_has(hole,0)))
{
CPRINT(" \r");
PRINT(" Found %s (%d)\n",hole, result);
@@ -131,7 +131,7 @@ void check_interest()
CPRINT(" Looking for /%s \r", r->v[y]);
- if (result = http_has(temp,0)) // See if the directory exists, so no wasted time
+ if ((result = http_has(temp,0))) // See if the directory exists, so no wasted time
{
PRINT(" Found %s (%d) \n", temp, result);
BEEP();
@@ -144,7 +144,7 @@ void check_interest()
CPRINT(" \r");
CPRINT(" Looking for /%s \r", temp);
- if (result = http_has(temp,0))
+ if ((result = http_has(temp,0)))
{
PRINT(" ---> /%s (%d)\n", temp, result);
BEEP();
@@ -289,7 +289,7 @@ void get_commandline(int argc, char *arg
parms.URL = (char*) strdup(argv[optind]);
- breakup_url(parms.URL, domain, 1024, &parms.port, 80, dir, 1024);
+ breakup_url(parms.URL, domain, 1024, (int *)&parms.port, 80, dir, 1024);
}
/*----------------------------------------------------------------*/
void mainloop()
@@ -343,7 +343,7 @@ int main(int argc, char *argv[])
{
char *env = NULL;
- if (env = getenv(PROXY_ENV))
+ if ((env = getenv(PROXY_ENV)))
{
proxy.host = (char *) malloc(strlen(env));
breakup_url(env, proxy.host, strlen(env), &proxy.port, 8000, NULL, 0);

View file

@ -1,6 +1,6 @@
--- cgichk.h.orig 2007-11-08 12:58:24.000000000 +0000 --- cgichk.h.orig 2001-04-06 16:36:25.000000000 +0800
+++ cgichk.h 2007-11-08 12:58:46.000000000 +0000 +++ cgichk.h 2011-09-06 11:30:51.000000000 +0800
@@ -19,6 +19,8 @@ @@ -19,13 +19,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -8,4 +8,30 @@
+#include <sys/types.h> +#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
+#include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <stdarg.h>
#include <getopt.h>
#include <time.h>
#include <unistd.h>
+#include <ctype.h>
#ifdef DEBUG
#define MEMWATCH
@@ -125,3 +129,16 @@ extern struct in_addr addr;
extern struct sockaddr_in _sin;
extern struct hostent *he;
+void waitafew(unsigned int del);
+void PRINT(char *arg, ...);
+void CPRINT(char *arg, ...);
+void close_config(result_t *r);
+void read_config(result_t *r, char *section);
+int setup_socket(char *host, int port);
+void PerformWhois(char *domain);
+result_t *open_config(char *fn);
+void read_head();
+int http_has(char *file, int result);
+void free_strings(result_t *r);
+void breakup_url(char *_url, char *_host, int hl, int *_port, int defport, char *_path, int pl);
+char *cgichk_strnstr(const char *HAYSTACK, const char *NEEDLE);

View file

@ -0,0 +1,19 @@
--- config.c.orig 2011-09-06 11:18:17.000000000 +0800
+++ config.c 2011-09-06 11:18:33.000000000 +0800
@@ -30,14 +30,14 @@ result_t *open_config(char *fn)
}
// ...try defaults, current dir...
- if (r->F = fopen("./cgichk.cfg", "rb"))
+ if ((r->F = fopen("./cgichk.cfg", "rb")))
{
resultfile = (char *) strdup("./cgichk.cfg");
return r;
}
// ...and then config dir
- if (r->F = fopen(CONFIG_PATH, "rb"))
+ if ((r->F = fopen(CONFIG_PATH, "rb")))
{
resultfile = (char *) strdup(CONFIG_PATH);
return r;

View file

@ -1,15 +1,27 @@
--- misc.c.orig 2007-11-08 13:41:34.000000000 +0000 --- misc.c.orig 2001-04-06 16:36:25.000000000 +0800
+++ misc.c 2007-11-08 13:43:22.000000000 +0000 +++ misc.c 2011-09-06 11:17:27.000000000 +0800
@@ -92,7 +92,7 @@ @@ -83,16 +83,16 @@ void breakup_url( char *_url,
*_port = defport;
- if ( t = (char *)strstr(u, "://") ) // skip past http bit
+ if ((t = (char *)strstr(u, "://"))) // skip past http bit
u = t + 3;
// parse hostname and port
- if (t = (char *)index(u, ':')) // does host have a port #?
+ if ((t = (char *)index(u, ':'))) // does host have a port #?
hasport = 1; hasport = 1;
if (t = (char *)index(u, '/')) // does host have path? - if (t = (char *)index(u, '/')) // does host have path?
- (char *)haspath = 1; - (char *)haspath = 1;
+ if ((t = (char *)index(u, '/'))) // does host have path?
+ haspath = 1; + haspath = 1;
if (hasport) if (hasport)
t = (char *)index(u, ':'); t = (char *)index(u, ':');
@@ -209,7 +209,7 @@ @@ -209,7 +209,7 @@ char *lowerstr(char *str)
return str; return str;
} }
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/

View file

@ -1,6 +1,25 @@
--- net.c.orig 2007-11-08 13:24:24.000000000 +0000 --- net.c.orig 2001-04-06 16:36:25.000000000 +0800
+++ net.c 2007-11-08 13:27:30.000000000 +0000 +++ net.c 2011-09-06 11:35:01.000000000 +0800
@@ -150,10 +150,10 @@ @@ -9,6 +9,7 @@ proxy_t proxy = {NULL, 8000};
/*----------------------------------------------------------------*/
int setup_socket(char *host, int port)
{
+ struct in_addr addr;
unsigned long start;
unsigned long end;
unsigned long counter;
@@ -24,8 +25,8 @@ int setup_socket(char *host, int port)
}
//start = inet_addr(host);
- inet_aton(host, &start); // rather than inet_addr, etc.
- counter = ntohl(start);
+ inet_aton(host, &addr); // rather than inet_addr, etc.
+ counter = ntohl(addr.s_addr);
sock = socket(AF_INET, SOCK_STREAM, 0);
bcopy(he->h_addr, (char *) &_sin.sin_addr, he->h_length);
@@ -150,10 +151,10 @@ int http_has(char *file, int result)
{ {
if (parms.no_false_200_search == FALSE) if (parms.no_false_200_search == FALSE)
{ {
@ -15,7 +34,7 @@
{ {
err = HTTP_NOEXIST; err = HTTP_NOEXIST;
} }
@@ -161,7 +161,7 @@ @@ -161,7 +162,7 @@ int http_has(char *file, int result)
// If user spcified an additional string to search for, check for that too. // If user spcified an additional string to search for, check for that too.
if (parms.alt_fake_404_string) if (parms.alt_fake_404_string)
{ {